Browse Source

Extend ucd_property to 64-bits to allow all properties to be specified.

master
Reece H. Dunn 8 years ago
parent
commit
4ce8b61180
5 changed files with 30 additions and 28 deletions
  1. 26
    24
      src/include/ucd/ucd.h
  2. 1
    1
      tests/printcdata.c
  3. 1
    1
      tests/printucddata.c
  4. 1
    1
      tests/printucddata_cpp.cpp
  5. 1
    1
      tools/printdata.py

+ 26
- 24
src/include/ucd/ucd.h View File

@@ -327,30 +327,31 @@ ucd_script ucd_lookup_script(codepoint_t c);

/** @brief Properties
*/
typedef enum ucd_property_
typedef uint64_t ucd_property;
enum
{
UCD_PROPERTY_WHITE_SPACE = 0x00000001, /**< @brief White_Space */
UCD_PROPERTY_BIDI_CONTROL = 0x00000002, /**< @brief Bidi_Control */
UCD_PROPERTY_JOIN_CONTROL = 0x00000004, /**< @brief Join_Control */
UCD_PROPERTY_DASH = 0x00000008, /**< @brief Dash */
UCD_PROPERTY_HYPHEN = 0x00000010, /**< @brief Hyphen */
UCD_PROPERTY_QUOTATION_MARK = 0x00000020, /**< @brief Quotation_Mark */
UCD_PROPERTY_TERMINAL_PUNCTUATION = 0x00000040, /**< @brief Terminal_Punctuation */
UCD_PROPERTY_OTHER_MATH = 0x00000080, /**< @brief Other_Math */
UCD_PROPERTY_HEX_DIGIT = 0x00000100, /**< @brief Hex_Digit */
UCD_PROPERTY_ASCII_HEX_DIGIT = 0x00000200, /**< @brief ASCII_Hex_Digit */
UCD_PROPERTY_OTHER_ALPHABETIC = 0x00000400, /**< @brief Other_Alphabetic */
UCD_PROPERTY_IDEOGRAPHIC = 0x00000800, /**< @brief Ideographic */
UCD_PROPERTY_DIACRITIC = 0x00001000, /**< @brief Diacritic */
UCD_PROPERTY_EXTENDER = 0x00002000, /**< @brief Extender */
UCD_PROPERTY_OTHER_LOWERCASE = 0x00004000, /**< @brief Other_Lowercase */
UCD_PROPERTY_OTHER_UPPERCASE = 0x00008000, /**< @brief Other_Uppercase */
UCD_PROPERTY_NONCHARACTER_CODE_POINT = 0x00010000, /**< @brief Noncharacter_Code_Point */
UCD_PROPERTY_OTHER_GRAPHEME_EXTEND = 0x00020000, /**< @brief Other_Grapheme_Extend */
UCD_PROPERTY_IDS_BINARY_OPERATOR = 0x00040000, /**< @brief IDS_Binary_Operator */
UCD_PROPERTY_IDS_TRINARY_OPERATOR = 0x00080000, /**< @brief IDS_Trinary_Operator */
UCD_PROPERTY_RADICAL = 0x00100000, /**< @brief Radical */
} ucd_property;
UCD_PROPERTY_WHITE_SPACE = 0x0000000000000001ull, /**< @brief White_Space */
UCD_PROPERTY_BIDI_CONTROL = 0x0000000000000002ull, /**< @brief Bidi_Control */
UCD_PROPERTY_JOIN_CONTROL = 0x0000000000000004ull, /**< @brief Join_Control */
UCD_PROPERTY_DASH = 0x0000000000000008ull, /**< @brief Dash */
UCD_PROPERTY_HYPHEN = 0x0000000000000010ull, /**< @brief Hyphen */
UCD_PROPERTY_QUOTATION_MARK = 0x0000000000000020ull, /**< @brief Quotation_Mark */
UCD_PROPERTY_TERMINAL_PUNCTUATION = 0x0000000000000040ull, /**< @brief Terminal_Punctuation */
UCD_PROPERTY_OTHER_MATH = 0x0000000000000080ull, /**< @brief Other_Math */
UCD_PROPERTY_HEX_DIGIT = 0x0000000000000100ull, /**< @brief Hex_Digit */
UCD_PROPERTY_ASCII_HEX_DIGIT = 0x0000000000000200ull, /**< @brief ASCII_Hex_Digit */
UCD_PROPERTY_OTHER_ALPHABETIC = 0x0000000000000400ull, /**< @brief Other_Alphabetic */
UCD_PROPERTY_IDEOGRAPHIC = 0x0000000000000800ull, /**< @brief Ideographic */
UCD_PROPERTY_DIACRITIC = 0x0000000000001000ull, /**< @brief Diacritic */
UCD_PROPERTY_EXTENDER = 0x0000000000002000ull, /**< @brief Extender */
UCD_PROPERTY_OTHER_LOWERCASE = 0x0000000000004000ull, /**< @brief Other_Lowercase */
UCD_PROPERTY_OTHER_UPPERCASE = 0x0000000000008000ull, /**< @brief Other_Uppercase */
UCD_PROPERTY_NONCHARACTER_CODE_POINT = 0x0000000000010000ull, /**< @brief Noncharacter_Code_Point */
UCD_PROPERTY_OTHER_GRAPHEME_EXTEND = 0x0000000000020000ull, /**< @brief Other_Grapheme_Extend */
UCD_PROPERTY_IDS_BINARY_OPERATOR = 0x0000000000040000ull, /**< @brief IDS_Binary_Operator */
UCD_PROPERTY_IDS_TRINARY_OPERATOR = 0x0000000000080000ull, /**< @brief IDS_Trinary_Operator */
UCD_PROPERTY_RADICAL = 0x0000000000100000ull, /**< @brief Radical */
};

/** @brief Return the properties of the specified codepoint.
*
@@ -807,7 +808,8 @@ namespace ucd

/** @brief Properties
*/
enum property
typedef ucd_property property;
enum
{
White_Space = UCD_PROPERTY_WHITE_SPACE, /**< @brief White_Space */
Bidi_Control = UCD_PROPERTY_BIDI_CONTROL, /**< @brief Bidi_Control */

+ 1
- 1
tests/printcdata.c View File

@@ -164,7 +164,7 @@ void uprintf(FILE *out, codepoint_t c, const char *format)
uprintf_codepoint(out, c, *++format);
break;
case 'P': // properties
fprintf(out, "%08x", ucd_properties(c, ucd_lookup_category(c)));
fprintf(out, "%016x", ucd_properties(c, ucd_lookup_category(c)));
break;
case 'i': // is*
uprintf_is(out, c, *++format);

+ 1
- 1
tests/printucddata.c View File

@@ -161,7 +161,7 @@ void uprintf(FILE *out, codepoint_t c, const char *format)
uprintf_codepoint(out, c, *++format);
break;
case 'P': // properties
fprintf(out, "%08x", ucd_properties(c, ucd_lookup_category(c)));
fprintf(out, "%016x", ucd_properties(c, ucd_lookup_category(c)));
break;
case 'i': // is*
uprintf_is(out, c, *++format);

+ 1
- 1
tests/printucddata_cpp.cpp View File

@@ -161,7 +161,7 @@ void uprintf(FILE *out, ucd::codepoint_t c, const char *format)
uprintf_codepoint(out, c, *++format);
break;
case 'P': // properties
fprintf(out, "%08x", ucd::properties(c, ucd::lookup_category(c)));
fprintf(out, "%016x", ucd::properties(c, ucd::lookup_category(c)));
break;
case 'i': // is*
uprintf_is(out, c, *++format);

+ 1
- 1
tools/printdata.py View File

@@ -157,7 +157,7 @@ if __name__ == '__main__':
if title == null: title = codepoint
if upper == null: upper = codepoint
if lower == null: lower = codepoint
print('%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %08x' % (
print('%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %016x' % (
codepoint, script,
data.get('GeneralCategory', 'Cn')[0], data.get('GeneralCategory', 'Cn'),
upper, lower, title,

Loading…
Cancel
Save