]> Savannah Git Hosting - gnulib.git/commitdiff
unimetadata/u-version: New module.
authorBruno Haible <bruno@clisp.org>
Tue, 20 Feb 2024 23:59:05 +0000 (00:59 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 20 Feb 2024 23:59:05 +0000 (00:59 +0100)
* 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.

ChangeLog
lib/gen-uni-tables.c
lib/unimetadata/u-version.c [new file with mode: 0644]
modules/unimetadata/u-version [new file with mode: 0644]

index 0e2478fe5f24516a6dd1a72553deb430ab0fa001..a718dfa325fab8dace0ff34e116110309f57670c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 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.
index c73ce06d645e6be29f981d09494371cad3c4eaac..ea5e6aa3f8087ce75f3d6d8431f49639e4578656 100644 (file)
@@ -11768,6 +11768,52 @@ output_casing_properties (const char *version)
 
 /* ========================================================================= */
 
+/* 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[])
 {
@@ -11885,6 +11931,8 @@ 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;
 }
 
diff --git a/lib/unimetadata/u-version.c b/lib/unimetadata/u-version.c
new file mode 100644 (file)
index 0000000..95ff0dc
--- /dev/null
@@ -0,0 +1,33 @@
+/* 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;
diff --git a/modules/unimetadata/u-version b/modules/unimetadata/u-version
new file mode 100644 (file)
index 0000000..af5c2b6
--- /dev/null
@@ -0,0 +1,26 @@
+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