From 6483be121e361537bccfee8ca766912f61c3df6c Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 25 Mar 2011 20:23:43 +0100 Subject: [PATCH 1/1] New module 'unictype/category-LC'. * lib/unictype.in.h (UC_CATEGORY_MASK_LC): New enumeration value. (UC_CATEGORY_LC): New declaration. (UC_CASED_LETTER): New macro. * lib/gen-uni-tables.c (is_category_LC): New function. (output_categories): Also handle category LC. (UC_CATEGORY_MASK_LC): New enumeration value. (general_category_byname): Also handle category LC. * lib/unictype/categ_LC.c: New file. * lib/unictype/categ_LC.h: New file, automatically generated. * lib/unictype/categ_name.c (uc_general_category_name): Also handle category LC. * lib/unictype/categ_byname.c (uc_general_category_byname): Likewise. * modules/unictype/category-LC: New file. * modules/unictype/category-all (Depends-on): Add unictype/category-LC. --- ChangeLog | 18 +++ lib/gen-uni-tables.c | 14 ++ lib/unictype.in.h | 3 + lib/unictype/categ_LC.c | 27 ++++ lib/unictype/categ_LC.h | 339 ++++++++++++++++++++++++++++++++++++++++++ lib/unictype/categ_byname.c | 3 +- lib/unictype/categ_name.c | 4 +- modules/unictype/category-LC | 26 ++++ modules/unictype/category-all | 1 + 9 files changed, 433 insertions(+), 2 deletions(-) create mode 100644 lib/unictype/categ_LC.c create mode 100644 lib/unictype/categ_LC.h create mode 100644 modules/unictype/category-LC diff --git a/ChangeLog b/ChangeLog index c6c969091..a46136485 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2011-03-25 Bruno Haible + + New module 'unictype/category-LC'. + * lib/unictype.in.h (UC_CATEGORY_MASK_LC): New enumeration value. + (UC_CATEGORY_LC): New declaration. + (UC_CASED_LETTER): New macro. + * lib/gen-uni-tables.c (is_category_LC): New function. + (output_categories): Also handle category LC. + (UC_CATEGORY_MASK_LC): New enumeration value. + (general_category_byname): Also handle category LC. + * lib/unictype/categ_LC.c: New file. + * lib/unictype/categ_LC.h: New file, automatically generated. + * lib/unictype/categ_name.c (uc_general_category_name): Also handle + category LC. + * lib/unictype/categ_byname.c (uc_general_category_byname): Likewise. + * modules/unictype/category-LC: New file. + * modules/unictype/category-all (Depends-on): Add unictype/category-LC. + 2011-03-25 Eric Blake xmalloc: revert yesterday's regression diff --git a/lib/gen-uni-tables.c b/lib/gen-uni-tables.c index 9713200c0..28b725517 100644 --- a/lib/gen-uni-tables.c +++ b/lib/gen-uni-tables.c @@ -282,6 +282,17 @@ is_category_L (unsigned int ch) } static bool +is_category_LC (unsigned int ch) +{ + /* See PropertyValueAliases.txt. */ + return (unicode_attributes[ch].name != NULL + && unicode_attributes[ch].category[0] == 'L' + && (unicode_attributes[ch].category[1] == 'u' + || unicode_attributes[ch].category[1] == 'l' + || unicode_attributes[ch].category[1] == 't')); +} + +static bool is_category_Lu (unsigned int ch) { return (unicode_attributes[ch].name != NULL @@ -805,6 +816,7 @@ output_categories (const char *version) output_predicate_test ("../tests/unictype/test-categ_" #C ".c", is_category_ ## C, "uc_is_general_category (c, UC_CATEGORY_" #C ")"); \ output_predicate ("unictype/categ_" #C ".h", is_category_ ## C, "u_categ_" #C, "Categories", version); CATEGORY (L) + CATEGORY (LC) CATEGORY (Lu) CATEGORY (Ll) CATEGORY (Lt) @@ -847,6 +859,7 @@ output_categories (const char *version) enum { UC_CATEGORY_MASK_L = 0x0000001f, + UC_CATEGORY_MASK_LC = 0x00000007, UC_CATEGORY_MASK_Lu = 0x00000001, UC_CATEGORY_MASK_Ll = 0x00000002, UC_CATEGORY_MASK_Lt = 0x00000004, @@ -896,6 +909,7 @@ general_category_byname (const char *category_name) switch (category_name[1]) { case '\0': return UC_CATEGORY_MASK_L; + case 'C': return UC_CATEGORY_MASK_LC; case 'u': return UC_CATEGORY_MASK_Lu; case 'l': return UC_CATEGORY_MASK_Ll; case 't': return UC_CATEGORY_MASK_Lt; diff --git a/lib/unictype.in.h b/lib/unictype.in.h index 8fbf8b9ab..b25a46198 100644 --- a/lib/unictype.in.h +++ b/lib/unictype.in.h @@ -61,6 +61,7 @@ uc_general_category_t; enum { UC_CATEGORY_MASK_L = 0x0000001f, + UC_CATEGORY_MASK_LC = 0x00000007, UC_CATEGORY_MASK_Lu = 0x00000001, UC_CATEGORY_MASK_Ll = 0x00000002, UC_CATEGORY_MASK_Lt = 0x00000004, @@ -101,6 +102,7 @@ enum /* Predefined General category values. */ extern const uc_general_category_t UC_CATEGORY_L; +extern const uc_general_category_t UC_CATEGORY_LC; extern const uc_general_category_t UC_CATEGORY_Lu; extern const uc_general_category_t UC_CATEGORY_Ll; extern const uc_general_category_t UC_CATEGORY_Lt; @@ -142,6 +144,7 @@ extern const uc_general_category_t _UC_CATEGORY_NONE; /* Alias names for predefined General category values. */ #define UC_LETTER UC_CATEGORY_L +#define UC_CASED_LETTER UC_CATEGORY_LC #define UC_UPPERCASE_LETTER UC_CATEGORY_Lu #define UC_LOWERCASE_LETTER UC_CATEGORY_Ll #define UC_TITLECASE_LETTER UC_CATEGORY_Lt diff --git a/lib/unictype/categ_LC.c b/lib/unictype/categ_LC.c new file mode 100644 index 000000000..13801d926 --- /dev/null +++ b/lib/unictype/categ_LC.c @@ -0,0 +1,27 @@ +/* Categories of Unicode characters. + Copyright (C) 2002, 2006-2007, 2011 Free Software Foundation, Inc. + Written by Bruno Haible , 2011. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unictype.h" + +/* Define u_categ_LC table. */ +#include "categ_LC.h" + +const uc_general_category_t UC_CATEGORY_LC = + { UC_CATEGORY_MASK_LC, 0, { &u_categ_LC } }; diff --git a/lib/unictype/categ_LC.h b/lib/unictype/categ_LC.h new file mode 100644 index 000000000..454bf7561 --- /dev/null +++ b/lib/unictype/categ_LC.h @@ -0,0 +1,339 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Categories of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 6.0.0. */ +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[2]; + short level2[2 << 7]; + /*unsigned*/ int level3[14 << 4]; + } +u_categ_LC = +{ + { 2 }, + { + 3 * sizeof (int) / sizeof (short) + 0, + 3 * sizeof (int) / sizeof (short) + 128 + }, + { + 3 + 256 * sizeof (short) / sizeof (int) + 0, + 3 + 256 * sizeof (short) / sizeof (int) + 16, + 3 + 256 * sizeof (short) / sizeof (int) + 32, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 48, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 64, + 3 + 256 * sizeof (short) / sizeof (int) + 80, + 3 + 256 * sizeof (short) / sizeof (int) + 96, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 112, + -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, + 3 + 256 * sizeof (short) / sizeof (int) + 128, + -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, + 3 + 256 * sizeof (short) / sizeof (int) + 144, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 160, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 176, + -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, + 3 + 256 * sizeof (short) / sizeof (int) + 192, + 3 + 256 * sizeof (short) / sizeof (int) + 208, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + }, + { + 0x00000000, 0x00000000, 0x07FFFFFE, 0x07FFFFFE, + 0x00000000, 0x04200400, 0xFF7FFFFF, 0xFF7FFFFF, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, + 0xFFFFFFFF, 0xF7FFFFFF, 0xFFFFFFF0, 0xFFFFFFFF, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, + 0xFFEFFFFF, 0x0000FFFF, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x38CF0000, + 0xFFFFD740, 0xFFFFFFFB, 0xFFFFFFFF, 0xFFBFFFFF, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, + 0xFFFFFC03, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, + 0xFFFFFFFF, 0xFFFE00FF, 0x007FFFFF, 0xFFFFFFFE, + 0x000000FF, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0xFFFFFFFF, 0x0000003F, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0xFFFFFFFF, 0x00000FFF, 0x00000000, 0xFEFFFFFC, + 0x07FFFFFF, 0x00000000, 0x00000000, 0x00000000, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, + 0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, + 0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x3E2FFC84, 0xF21FBD50, 0x000043E0, 0x00000000, + 0x00000018, 0x00000000, 0x00000000, 0x00000000, + 0xFFFFFFFF, 0xFFFF7FFF, 0x7FFFFFFF, 0xDFFFFFFF, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000781F, + 0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0xFFFFFFFF, 0x00003FFF, + 0x00FFFFFF, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0xFFFFFFFC, 0xFFFFFFFF, 0xFFFEFFFF, + 0x000378FF, 0x000003FF, 0x00000000, 0x04000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00F8007F, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x07FFFFFE, 0x07FFFFFE, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0xFFFFFFFF, 0xFFFFFFFF, 0x0000FFFF, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFDFFFFF, 0xFFFFFFFF, + 0xDFFFFFFF, 0xEBFFDE64, 0xFFFFFFEF, 0xFFFFFFFF, + 0xDFDFE7BF, 0x7BFFFFFF, 0xFFFDFC5F, 0xFFFFFFFF, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, + 0xFFFFFFFF, 0xFFFFFF3F, 0xF7FFFFFD, 0xF7FFFFFF, + 0xFFDFFFFF, 0xFFDFFFFF, 0xFFFF7FFF, 0xFFFF7FFF, + 0xFFFFFDFF, 0xFFFFFDFF, 0x00000FF7, 0x00000000 + } +}; diff --git a/lib/unictype/categ_byname.c b/lib/unictype/categ_byname.c index f3342ed13..d2da64e43 100644 --- a/lib/unictype/categ_byname.c +++ b/lib/unictype/categ_byname.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007, 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2011 Free Software Foundation, Inc. Written by Bruno Haible , 2002. This program is free software: you can redistribute it and/or modify it @@ -31,6 +31,7 @@ uc_general_category_byname (const char *category_name) switch (category_name[1]) { case '\0': return UC_CATEGORY_L; + case 'C': return UC_CATEGORY_LC; case 'u': return UC_CATEGORY_Lu; case 'l': return UC_CATEGORY_Ll; case 't': return UC_CATEGORY_Lt; diff --git a/lib/unictype/categ_name.c b/lib/unictype/categ_name.c index fcbdbee08..40ecb92eb 100644 --- a/lib/unictype/categ_name.c +++ b/lib/unictype/categ_name.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007, 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2011 Free Software Foundation, Inc. Written by Bruno Haible , 2002. This program is free software: you can redistribute it and/or modify it @@ -59,6 +59,8 @@ uc_general_category_name (uc_general_category_t category) { if (bitmask == UC_CATEGORY_MASK_L) return "L"; + if (bitmask == UC_CATEGORY_MASK_LC) + return "LC"; if (bitmask == UC_CATEGORY_MASK_M) return "M"; if (bitmask == UC_CATEGORY_MASK_N) diff --git a/modules/unictype/category-LC b/modules/unictype/category-LC new file mode 100644 index 000000000..42ca0be48 --- /dev/null +++ b/modules/unictype/category-LC @@ -0,0 +1,26 @@ +Description: +Test whether a Unicode character is of general category LC. + +Files: +lib/unictype/categ_LC.c +lib/unictype/categ_LC.h + +Depends-on: +unictype/base + +configure.ac: +gl_LIBUNISTRING_MODULE([0.9.4], [unictype/category-LC]) + +Makefile.am: +if LIBUNISTRING_COMPILE_UNICTYPE_CATEGORY_LC +lib_SOURCES += unictype/categ_LC.c +endif + +Include: +"unictype.h" + +License: +LGPL + +Maintainer: +Bruno Haible diff --git a/modules/unictype/category-all b/modules/unictype/category-all index c1b14486c..76ea1627a 100644 --- a/modules/unictype/category-all +++ b/modules/unictype/category-all @@ -11,6 +11,7 @@ unictype/category-Cn unictype/category-Co unictype/category-Cs unictype/category-L +unictype/category-LC unictype/category-Ll unictype/category-Lm unictype/category-Lo -- 2.11.0