From e3e85d33f2949cdb29fa1090c0165d6117aa9217 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sat, 22 Dec 2012 01:27:18 +0000 Subject: [PATCH] Rename Ci to Ii and move it to an I/Invalid category group as it is not part of the UCD C/Other category group. --- src/categories.cpp | 6 ++++-- src/ctype.cpp | 6 ++++-- src/include/ucd/ucd.h | 4 +++- tools/categories.py | 6 ++++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/categories.cpp b/src/categories.cpp index 230a5058..1e9fc134 100644 --- a/src/categories.cpp +++ b/src/categories.cpp @@ -3278,14 +3278,14 @@ ucd::category ucd::lookup_category(codepoint_t c) if (c <= 0x0FFFFF) return Cn; // 0FFFFE..0FFFFF : Plane 15 Private Use if (c <= 0x10FFFD) return Co; // 100000..10FFFD : Plane 16 Private Use if (c <= 0x10FFFF) return Cn; // 10FFFE..10FFFF : Plane 16 Private Use - return Ci; + return Ii; // Invalid Unicode Codepoint } ucd::category_group ucd::lookup_category_group(codepoint_t c) { switch (lookup_category(c)) { - case Cc: case Cf: case Ci: case Cn: case Co: case Cs: + case Cc: case Cf: case Cn: case Co: case Cs: return C; case Ll: case Lm: case Lo: case Lt: case Lu: return L; @@ -3299,5 +3299,7 @@ ucd::category_group ucd::lookup_category_group(codepoint_t c) return S; case Zl: case Zp: case Zs: return Z; + case Ii: + return I; } } diff --git a/src/ctype.cpp b/src/ctype.cpp index 6237ba73..db860a5e 100644 --- a/src/ctype.cpp +++ b/src/ctype.cpp @@ -63,8 +63,9 @@ int ucd::isgraph(codepoint_t c) { switch (lookup_category(c)) { - case Cc: case Cf: case Ci: case Cn: case Co: case Cs: + case Cc: case Cf: case Cn: case Co: case Cs: case Zl: case Zp: case Zs: + case Ii: return 0; } return 1; @@ -79,7 +80,8 @@ int ucd::isprint(codepoint_t c) { switch (lookup_category(c)) { - case Cc: case Cf: case Ci: case Cn: case Co: case Cs: + case Cc: case Cf: case Cn: case Co: case Cs: + case Ii: return 0; } return 1; diff --git a/src/include/ucd/ucd.h b/src/include/ucd/ucd.h index cb95d2ca..5f87afb5 100644 --- a/src/include/ucd/ucd.h +++ b/src/include/ucd/ucd.h @@ -37,6 +37,7 @@ namespace ucd enum category_group { C, /**< @brief Other */ + I, /**< @brief Invalid */ L, /**< @brief Letter */ M, /**< @brief Mark */ N, /**< @brief Number */ @@ -52,11 +53,12 @@ namespace ucd { Cc, /**< @brief Control Character */ Cf, /**< @brief Format Control Character */ - Ci, /**< @brief Invalid Unicode Character */ Cn, /**< @brief Unassigned */ Co, /**< @brief Private Use */ Cs, /**< @brief Surrogate Code Point */ + Ii, /**< @brief Invalid Unicode Codepoint */ + Ll, /**< @brief Lower Case Letter */ Lm, /**< @brief Letter Modifier */ Lo, /**< @brief Other Letter */ diff --git a/tools/categories.py b/tools/categories.py index 895ce747..837af34e 100755 --- a/tools/categories.py +++ b/tools/categories.py @@ -151,7 +151,7 @@ using namespace ucd; sys.stdout.write('\t\tconst ucd::category *table = categories_%s_%s[(c - 0x%s) / 256];\n' % (codepoints.first, codepoints.last, codepoints.first)) sys.stdout.write('\t\treturn table ? table[c % 256] : Cn;\n') sys.stdout.write('\t}\n') - sys.stdout.write('\treturn Ci;\n') + sys.stdout.write('\treturn Ii; // Invalid Unicode Codepoint\n') sys.stdout.write('}\n') sys.stdout.write(""" @@ -159,7 +159,7 @@ ucd::category_group ucd::lookup_category_group(codepoint_t c) { switch (lookup_category(c)) { - case Cc: case Cf: case Ci: case Cn: case Co: case Cs: + case Cc: case Cf: case Cn: case Co: case Cs: return C; case Ll: case Lm: case Lo: case Lt: case Lu: return L; @@ -173,6 +173,8 @@ ucd::category_group ucd::lookup_category_group(codepoint_t c) return S; case Zl: case Zp: case Zs: return Z; + case Ii: + return I; } } """)