From 93293be63096a2708e3cc83e4360e7b3eb1c2174 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 21 Feb 2024 00:59:05 +0100 Subject: [PATCH] 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. --- ChangeLog | 6 +++++ lib/gen-uni-tables.c | 48 +++++++++++++++++++++++++++++++++++ lib/unimetadata/u-version.c | 33 ++++++++++++++++++++++++ modules/unimetadata/u-version | 26 +++++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 lib/unimetadata/u-version.c create mode 100644 modules/unimetadata/u-version diff --git a/ChangeLog b/ChangeLog index 0e2478fe5f..a718dfa325 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2024-02-20 Bruno Haible + 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. diff --git a/lib/gen-uni-tables.c b/lib/gen-uni-tables.c index c73ce06d64..ea5e6aa3f8 100644 --- a/lib/gen-uni-tables.c +++ b/lib/gen-uni-tables.c @@ -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 \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 index 0000000000..95ff0dcf31 --- /dev/null +++ b/lib/unimetadata/u-version.c @@ -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 . */ + +#include + +/* 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 index 0000000000..af5c2b665f --- /dev/null +++ b/modules/unimetadata/u-version @@ -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 -- 2.39.5