* lib/gen-uni-tables.c (output_version): New function.
(main): Invoke it.
* lib/unimetadata/u-version.c: New generated file.
* modules/unimetadata/u-version: New file.
2024-02-20 Bruno Haible <bruno@clisp.org>
+ unimetadata/u-version: New module.
+ * lib/gen-uni-tables.c (output_version): New function.
+ (main): Invoke it.
+ * lib/unimetadata/u-version.c: New generated file.
+ * modules/unimetadata/u-version: New file.
+
unimetadata/base: New module.
* lib/unimetadata.in.h: New file.
* m4/unimetadata_h.m4: New file.
/* ========================================================================= */
+/* Output the Unicode version. */
+static void
+output_version (const char *filename, const char *version)
+{
+ FILE *stream;
+ int major;
+ int minor;
+
+ stream = fopen (filename, "w");
+ if (stream == NULL)
+ {
+ fprintf (stderr, "cannot open '%s' for writing\n", filename);
+ exit (1);
+ }
+
+ fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n");
+ fprintf (stream, "/* Supported Unicode version. */\n");
+ fprintf (stream, "/* Generated automatically by gen-uni-tables.c for Unicode %s. */\n",
+ version);
+ fprintf (stream, "\n");
+
+ fprintf (stream, "/* Copyright (C) 2024 Free Software Foundation, Inc.\n");
+ fprintf (stream, "\n");
+ output_library_license (stream, false);
+ fprintf (stream, "\n");
+
+ fprintf (stream, "#include <config.h>\n");
+ fprintf (stream, "\n");
+
+ fprintf (stream, "/* Specification. */\n");
+ fprintf (stream, "#include \"unimetadata.h\"\n");
+ fprintf (stream, "\n");
+
+ sscanf (version, "%d.%d", &major, &minor);
+ fprintf (stream, "const int _libunistring_unicode_version = (%d << 8) | %d;\n",
+ major, minor);
+
+ if (ferror (stream) || fclose (stream))
+ {
+ fprintf (stderr, "error writing to '%s'\n", filename);
+ exit (1);
+ }
+}
+
+/* ========================================================================= */
+
int
main (int argc, char * argv[])
{
output_casing_rules ("unicase/special-casing-table.gperf", version);
output_casing_properties (version);
+ output_version ("unimetadata/u-version.c", version);
+
return 0;
}
--- /dev/null
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Supported Unicode version. */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.1.0. */
+
+/* Copyright (C) 2024 Free Software Foundation, Inc.
+
+ This file is free software.
+ It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
+ You can redistribute it and/or modify it under either
+ - the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation, either version 3, or (at your
+ option) any later version, or
+ - the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version, or
+ - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+".
+
+ This file is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License and the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License and of the GNU General Public License along with this
+ program. If not, see <https://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include "unimetadata.h"
+
+const int _libunistring_unicode_version = (15 << 8) | 1;
--- /dev/null
+Description:
+Supported Unicode version.
+
+Files:
+lib/unimetadata/u-version.c
+
+Depends-on:
+unimetadata/base
+
+configure.ac:
+gl_UNIMETADATA_H_REQUIRE_DEFAULTS
+gl_LIBUNISTRING_MODULE_WITH_VARIABLE([1.2], [unimetadata/u-version])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNIMETADATA_U_VERSION
+lib_SOURCES += unimetadata/u-version.c
+endif
+
+Include:
+"unimetadata.h"
+
+License:
+LGPLv3+ or GPLv2+
+
+Maintainer:
+all