From: Bruno Haible Date: Fri, 13 Sep 2024 13:25:05 +0000 (+0200) Subject: Implement a new property, added by Unicode 16.0.0. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=8fc1946792c94ba7bf206a4bd53aa08ae9f57f2e;p=gnulib.git Implement a new property, added by Unicode 16.0.0. * lib/gen-uni-tables.c (is_property_modifier_combining_mark): New function. (output_properties): Output also the property modifier_combining_mark. * lib/unictype.in.h (UC_PROPERTY_MODIFIER_COMBINING_MARK, uc_is_property_modifier_combining_mark): New declarations. * m4/unictype_h.m4 (gl_UNICTYPE_H_REQUIRE_DEFAULTS): Initialize GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK. * modules/unictype/base (Makefile.am): Substitute GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK. * lib/unictype/pr_modifier_combining_mark.c: New file. * lib/unictype/pr_modifier_combining_mark.h: New generated file. * modules/unictype/property-modifier-combining-mark: New file. * tests/unictype/test-pr_modifier_combining_mark.c: New generated file. * modules/unictype/property-modifier-combining-mark-tests: New file. * lib/unictype/pr_byname.gperf: Add modifier_combining_mark. * lib/unictype/pr_byname.c (UC_PROPERTY_INDEX_MODIFIER_COMBINING_MARK): New enum item. (uc_property_byname): Handle it. * modules/unictype/property-byname (Depends-on): Add unictype/property-modifier-combining-mark. * modules/unictype/property-all (Depends-on): Likewise. * MODULES.html.sh (func_all_modules): Add unictype/property-modifier-combining-mark. --- diff --git a/ChangeLog b/ChangeLog index 5d650ab170..8d3c66d510 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2024-09-13 Bruno Haible + + Implement a new property, added by Unicode 16.0.0. + * lib/gen-uni-tables.c (is_property_modifier_combining_mark): New + function. + (output_properties): Output also the property modifier_combining_mark. + * lib/unictype.in.h (UC_PROPERTY_MODIFIER_COMBINING_MARK, + uc_is_property_modifier_combining_mark): New declarations. + * m4/unictype_h.m4 (gl_UNICTYPE_H_REQUIRE_DEFAULTS): Initialize + GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK. + * modules/unictype/base (Makefile.am): Substitute + GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK. + * lib/unictype/pr_modifier_combining_mark.c: New file. + * lib/unictype/pr_modifier_combining_mark.h: New generated file. + * modules/unictype/property-modifier-combining-mark: New file. + * tests/unictype/test-pr_modifier_combining_mark.c: New generated file. + * modules/unictype/property-modifier-combining-mark-tests: New file. + * lib/unictype/pr_byname.gperf: Add modifier_combining_mark. + * lib/unictype/pr_byname.c + (UC_PROPERTY_INDEX_MODIFIER_COMBINING_MARK): New enum item. + (uc_property_byname): Handle it. + * modules/unictype/property-byname (Depends-on): Add + unictype/property-modifier-combining-mark. + * modules/unictype/property-all (Depends-on): Likewise. + * MODULES.html.sh (func_all_modules): Add + unictype/property-modifier-combining-mark. + 2024-09-13 Bruno Haible Update to Unicode 16.0.0. diff --git a/MODULES.html.sh b/MODULES.html.sh index 711659f042..775841bff0 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -3438,6 +3438,7 @@ func_all_modules () func_module unictype/property-logical-order-exception func_module unictype/property-lowercase func_module unictype/property-math + func_module unictype/property-modifier-combining-mark func_module unictype/property-non-break func_module unictype/property-not-a-character func_module unictype/property-numeric diff --git a/lib/gen-uni-tables.c b/lib/gen-uni-tables.c index d9897d5ae5..c27f870bd1 100644 --- a/lib/gen-uni-tables.c +++ b/lib/gen-uni-tables.c @@ -3484,6 +3484,13 @@ is_property_grapheme_link (unsigned int ch) return ((unicode_properties[ch] & (1ULL << PROP_GRAPHEME_LINK)) != 0); } +/* See PropList.txt, UCD.html. */ +static bool +is_property_modifier_combining_mark (unsigned int ch) +{ + return ((unicode_properties[ch] & (1ULL << PROP_MODIFIER_COMBINING_MARK)) != 0); +} + /* See PropList.txt, UCD.html. */ static bool is_property_bidi_control (unsigned int ch) @@ -4016,6 +4023,7 @@ output_properties (const char *version) PROPERTY(grapheme_extend) PROPERTY(other_grapheme_extend) PROPERTY(grapheme_link) + PROPERTY(modifier_combining_mark) PROPERTY(bidi_control) PROPERTY(bidi_left_to_right) PROPERTY(bidi_hebrew_right_to_left) diff --git a/lib/unictype.in.h b/lib/unictype.in.h index 224407b0b5..8ad2e5410d 100644 --- a/lib/unictype.in.h +++ b/lib/unictype.in.h @@ -651,6 +651,7 @@ extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE@ const uc_property_t extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_EXTEND; extern @GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_GRAPHEME_EXTEND; extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_LINK; +extern @GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_MODIFIER_COMBINING_MARK; /* Bidi. */ extern @GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_CONTROL; extern @GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_LEFT_TO_RIGHT; @@ -803,6 +804,8 @@ extern bool uc_is_property_other_grapheme_extend (ucs4_t uc) _UC_ATTRIBUTE_CONST; extern bool uc_is_property_grapheme_link (ucs4_t uc) _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_modifier_combining_mark (ucs4_t uc) + _UC_ATTRIBUTE_CONST; extern bool uc_is_property_bidi_control (ucs4_t uc) _UC_ATTRIBUTE_CONST; extern bool uc_is_property_bidi_left_to_right (ucs4_t uc) diff --git a/lib/unictype/pr_byname.c b/lib/unictype/pr_byname.c index 802e25f8e2..25d12ba4fa 100644 --- a/lib/unictype/pr_byname.c +++ b/lib/unictype/pr_byname.c @@ -79,6 +79,7 @@ enum UC_PROPERTY_INDEX_GRAPHEME_EXTEND, UC_PROPERTY_INDEX_OTHER_GRAPHEME_EXTEND, UC_PROPERTY_INDEX_GRAPHEME_LINK, + UC_PROPERTY_INDEX_MODIFIER_COMBINING_MARK, /* Bidi. */ UC_PROPERTY_INDEX_BIDI_CONTROL, UC_PROPERTY_INDEX_BIDI_LEFT_TO_RIGHT, @@ -249,6 +250,8 @@ uc_property_byname (const char *property_name) return UC_PROPERTY_OTHER_GRAPHEME_EXTEND; case UC_PROPERTY_INDEX_GRAPHEME_LINK: return UC_PROPERTY_GRAPHEME_LINK; + case UC_PROPERTY_INDEX_MODIFIER_COMBINING_MARK: + return UC_PROPERTY_MODIFIER_COMBINING_MARK; case UC_PROPERTY_INDEX_BIDI_CONTROL: return UC_PROPERTY_BIDI_CONTROL; case UC_PROPERTY_INDEX_BIDI_LEFT_TO_RIGHT: diff --git a/lib/unictype/pr_byname.gperf b/lib/unictype/pr_byname.gperf index 8a654de129..b341947142 100644 --- a/lib/unictype/pr_byname.gperf +++ b/lib/unictype/pr_byname.gperf @@ -147,6 +147,8 @@ grapheme_link, UC_PROPERTY_INDEX_GRAPHEME_LINK graphemelink, UC_PROPERTY_INDEX_GRAPHEME_LINK gr_link, UC_PROPERTY_INDEX_GRAPHEME_LINK grlink, UC_PROPERTY_INDEX_GRAPHEME_LINK +modifier_combining_mark, UC_PROPERTY_INDEX_MODIFIER_COMBINING_MARK +modifiercombiningmark, UC_PROPERTY_INDEX_MODIFIER_COMBINING_MARK bidi_control, UC_PROPERTY_INDEX_BIDI_CONTROL bidicontrol, UC_PROPERTY_INDEX_BIDI_CONTROL bidi_c, UC_PROPERTY_INDEX_BIDI_CONTROL diff --git a/lib/unictype/pr_modifier_combining_mark.c b/lib/unictype/pr_modifier_combining_mark.c new file mode 100644 index 0000000000..ed5f304f4a --- /dev/null +++ b/lib/unictype/pr_modifier_combining_mark.c @@ -0,0 +1,43 @@ +/* Properties of Unicode characters. + Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + 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 "unictype.h" + +#include "bitmap.h" + +/* Define u_property_modifier_combining_mark table. */ +#include "pr_modifier_combining_mark.h" + +bool +uc_is_property_modifier_combining_mark (ucs4_t uc) +{ + return bitmap_lookup (&u_property_modifier_combining_mark, uc); +} + +const uc_property_t UC_PROPERTY_MODIFIER_COMBINING_MARK = + { &uc_is_property_modifier_combining_mark }; diff --git a/lib/unictype/pr_modifier_combining_mark.h b/lib/unictype/pr_modifier_combining_mark.h new file mode 100644 index 0000000000..d5f9286610 --- /dev/null +++ b/lib/unictype/pr_modifier_combining_mark.h @@ -0,0 +1,184 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Properties of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-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 . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[1]; + short level2[1 << 7]; + unsigned int level3[2 << 4]; + } +u_property_modifier_combining_mark = +{ + { 1 }, + { 2 * sizeof (int) / sizeof (short) + 0 }, + { + -1, + -1, + -1, + 2 + 128 * sizeof (short) / sizeof (int) + 0, + 2 + 128 * sizeof (short) / sizeof (int) + 16, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + }, + { + 0x00000000U, 0x00000000U, 0x01300000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x10000000U, 0x00000188U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x0008EC00U, 0x00080000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U + } +}; diff --git a/m4/unictype_h.m4 b/m4/unictype_h.m4 index 477fec995d..f36204a8c9 100644 --- a/m4/unictype_h.m4 +++ b/m4/unictype_h.m4 @@ -1,5 +1,5 @@ # unictype_h.m4 -# serial 3 +# serial 4 dnl Copyright (C) 2023-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -108,6 +108,7 @@ AC_DEFUN([gl_UNICTYPE_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) diff --git a/modules/unictype/base b/modules/unictype/base index 346b8ef66b..26abd2265e 100644 --- a/modules/unictype/base +++ b/modules/unictype/base @@ -105,6 +105,7 @@ unictype.h: unictype.in.h -e 's/@''GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE''@/$(GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE)/g' \ -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE''@/$(GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE)/g' \ -e 's/@''GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE''@/$(GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE''@/$(GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE)/g' \ -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE''@/$(GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE)/g' \ -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE''@/$(GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE)/g' \ -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE''@/$(GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE)/g' \ diff --git a/modules/unictype/property-all b/modules/unictype/property-all index a9bc3cf6f7..5e52922c48 100644 --- a/modules/unictype/property-all +++ b/modules/unictype/property-all @@ -68,6 +68,7 @@ unictype/property-line-separator unictype/property-logical-order-exception unictype/property-lowercase unictype/property-math +unictype/property-modifier-combining-mark unictype/property-non-break unictype/property-not-a-character unictype/property-numeric diff --git a/modules/unictype/property-byname b/modules/unictype/property-byname index d961cc178b..7f470688a2 100644 --- a/modules/unictype/property-byname +++ b/modules/unictype/property-byname @@ -64,6 +64,7 @@ unictype/property-line-separator unictype/property-logical-order-exception unictype/property-lowercase unictype/property-math +unictype/property-modifier-combining-mark unictype/property-non-break unictype/property-not-a-character unictype/property-numeric diff --git a/modules/unictype/property-modifier-combining-mark b/modules/unictype/property-modifier-combining-mark new file mode 100644 index 0000000000..cf4af26ada --- /dev/null +++ b/modules/unictype/property-modifier-combining-mark @@ -0,0 +1,29 @@ +Description: +Test whether a Unicode character is "modifier combining mark". + +Files: +lib/unictype/pr_modifier_combining_mark.c +lib/unictype/pr_modifier_combining_mark.h +lib/unictype/bitmap.h + +Depends-on: +unictype/base + +configure.ac: +AC_REQUIRE([AC_C_INLINE]) +gl_UNICTYPE_H_REQUIRE_DEFAULTS +gl_LIBUNISTRING_MODULE_WITH_VARIABLE([1.3], [unictype/property-modifier-combining-mark]) + +Makefile.am: +if LIBUNISTRING_COMPILE_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK +lib_SOURCES += unictype/pr_modifier_combining_mark.c +endif + +Include: +"unictype.h" + +License: +LGPLv3+ or GPLv2+ + +Maintainer: +all diff --git a/modules/unictype/property-modifier-combining-mark-tests b/modules/unictype/property-modifier-combining-mark-tests new file mode 100644 index 0000000000..903dee96b0 --- /dev/null +++ b/modules/unictype/property-modifier-combining-mark-tests @@ -0,0 +1,15 @@ +Files: +tests/unictype/test-pr_modifier_combining_mark.c +tests/unictype/test-predicate-part1.h +tests/unictype/test-predicate-part2.h +tests/macros.h + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-pr_modifier_combining_mark +check_PROGRAMS += test-pr_modifier_combining_mark +test_pr_modifier_combining_mark_SOURCES = unictype/test-pr_modifier_combining_mark.c +test_pr_modifier_combining_mark_LDADD = $(LDADD) $(LIBUNISTRING) diff --git a/tests/unictype/test-pr_modifier_combining_mark.c b/tests/unictype/test-pr_modifier_combining_mark.c new file mode 100644 index 0000000000..7e1f90cdd6 --- /dev/null +++ b/tests/unictype/test-pr_modifier_combining_mark.c @@ -0,0 +1,31 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Test the Unicode character type functions. + Copyright (C) 2007-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "test-predicate-part1.h" + + { 0x0654, 0x0655 }, + { 0x0658, 0x0658 }, + { 0x06DC, 0x06DC }, + { 0x06E3, 0x06E3 }, + { 0x06E7, 0x06E8 }, + { 0x08CA, 0x08CB }, + { 0x08CD, 0x08CF }, + { 0x08D3, 0x08D3 }, + { 0x08F3, 0x08F3 } + +#define PREDICATE(c) uc_is_property_modifier_combining_mark (c) +#include "test-predicate-part2.h"