Browse Source

Add Prepended_Concatenation_Mark support from PropList.txt.

master
Reece H. Dunn 8 years ago
parent
commit
691457e98d
6 changed files with 43 additions and 29 deletions
  1. 2
    0
      src/include/ucd/ucd.h
  2. 37
    26
      src/proplist.c
  3. 1
    1
      tests/printcdata.c
  4. 1
    1
      tests/printucddata.c
  5. 1
    1
      tests/printucddata_cpp.cpp
  6. 1
    0
      tools/printdata.py

+ 2
- 0
src/include/ucd/ucd.h View File

UCD_PROPERTY_VARIATION_SELECTOR = 0x0000000020000000ull, /**< @brief Variation_Selector */ UCD_PROPERTY_VARIATION_SELECTOR = 0x0000000020000000ull, /**< @brief Variation_Selector */
UCD_PROPERTY_PATTERN_WHITE_SPACE = 0x0000000040000000ull, /**< @brief Pattern_White_Space */ UCD_PROPERTY_PATTERN_WHITE_SPACE = 0x0000000040000000ull, /**< @brief Pattern_White_Space */
UCD_PROPERTY_PATTERN_SYNTAX = 0x0000000080000000ull, /**< @brief Pattern_Syntax */ UCD_PROPERTY_PATTERN_SYNTAX = 0x0000000080000000ull, /**< @brief Pattern_Syntax */
UCD_PROPERTY_PREPENDED_CONCATENATION_MARK = 0x0000000100000000ull, /**< @brief Prepended_Concatenation_Mark */
}; };


/** @brief Return the properties of the specified codepoint. /** @brief Return the properties of the specified codepoint.
Variation_Selector = UCD_PROPERTY_VARIATION_SELECTOR, /**< @brief Variation_Selector */ Variation_Selector = UCD_PROPERTY_VARIATION_SELECTOR, /**< @brief Variation_Selector */
Pattern_White_Space = UCD_PROPERTY_PATTERN_WHITE_SPACE, /**< @brief Pattern_White_Space */ Pattern_White_Space = UCD_PROPERTY_PATTERN_WHITE_SPACE, /**< @brief Pattern_White_Space */
Pattern_Syntax = UCD_PROPERTY_PATTERN_SYNTAX, /**< @brief Pattern_Syntax */ Pattern_Syntax = UCD_PROPERTY_PATTERN_SYNTAX, /**< @brief Pattern_Syntax */
Prepended_Concatenation_Mark = UCD_PROPERTY_PREPENDED_CONCATENATION_MARK, /**< @brief Prepended_Concatenation_Mark */
}; };


/** @brief Return the properties of the specified codepoint. /** @brief Return the properties of the specified codepoint.

+ 37
- 26
src/proplist.c View File



#include "ucd/ucd.h" #include "ucd/ucd.h"


static int properties_Cc(codepoint_t c)
static ucd_property properties_Cc(codepoint_t c)
{ {
if (c >= 0x0009 && c <= 0x000D) return UCD_PROPERTY_WHITE_SPACE | UCD_PROPERTY_PATTERN_WHITE_SPACE; if (c >= 0x0009 && c <= 0x000D) return UCD_PROPERTY_WHITE_SPACE | UCD_PROPERTY_PATTERN_WHITE_SPACE;
if (c == 0x0085) return UCD_PROPERTY_WHITE_SPACE | UCD_PROPERTY_PATTERN_WHITE_SPACE; if (c == 0x0085) return UCD_PROPERTY_WHITE_SPACE | UCD_PROPERTY_PATTERN_WHITE_SPACE;
return 0; return 0;
} }


static int properties_Cf(codepoint_t c)
static ucd_property properties_Cf(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
if (c == 0x00AD) return UCD_PROPERTY_HYPHEN; if (c == 0x00AD) return UCD_PROPERTY_HYPHEN;
break; break;
case 0x0600: case 0x0600:
if (c >= 0x0600 && c <= 0x0605) return UCD_PROPERTY_PREPENDED_CONCATENATION_MARK;
if (c == 0x061C) return UCD_PROPERTY_BIDI_CONTROL; if (c == 0x061C) return UCD_PROPERTY_BIDI_CONTROL;
if (c == 0x06DD) return UCD_PROPERTY_PREPENDED_CONCATENATION_MARK;
break;
case 0x0700:
if (c == 0x070F) return UCD_PROPERTY_PREPENDED_CONCATENATION_MARK;
break;
case 0x0800:
if (c == 0x08E2) return UCD_PROPERTY_PREPENDED_CONCATENATION_MARK;
break; break;
case 0x2000: case 0x2000:
if (c == 0x200C) return UCD_PROPERTY_JOIN_CONTROL | UCD_PROPERTY_OTHER_GRAPHEME_EXTEND; if (c == 0x200C) return UCD_PROPERTY_JOIN_CONTROL | UCD_PROPERTY_OTHER_GRAPHEME_EXTEND;
if (c >= 0x2066 && c <= 0x2069) return UCD_PROPERTY_BIDI_CONTROL; if (c >= 0x2066 && c <= 0x2069) return UCD_PROPERTY_BIDI_CONTROL;
if (c >= 0x206A && c <= 0x206F) return UCD_PROPERTY_DEPRECATED; if (c >= 0x206A && c <= 0x206F) return UCD_PROPERTY_DEPRECATED;
break; break;
case 0x011000:
if (c == 0x0110BD) return UCD_PROPERTY_PREPENDED_CONCATENATION_MARK;
break;
case 0x0E0000: case 0x0E0000:
if (c == 0x0E0001) return UCD_PROPERTY_DEPRECATED;
if (c == 0x0E0001) return UCD_PROPERTY_DEPRECATED;
if (c >= 0x0E0020 && c <= 0x0E007F) return UCD_PROPERTY_OTHER_GRAPHEME_EXTEND; if (c >= 0x0E0020 && c <= 0x0E007F) return UCD_PROPERTY_OTHER_GRAPHEME_EXTEND;
break; break;
} }
return 0; return 0;
} }


static int properties_Cn(codepoint_t c)
static ucd_property properties_Cn(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Ll(codepoint_t c)
static ucd_property properties_Ll(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Lm(codepoint_t c)
static ucd_property properties_Lm(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Lo(codepoint_t c)
static ucd_property properties_Lo(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Lo_ideographic(codepoint_t c)
static ucd_property properties_Lo_ideographic(codepoint_t c)
{ {
switch (c & 0xFFFF0000) switch (c & 0xFFFF0000)
{ {
return 0; return 0;
} }


static int properties_Lu(codepoint_t c)
static ucd_property properties_Lu(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Mc(codepoint_t c)
static ucd_property properties_Mc(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Mn(codepoint_t c)
static ucd_property properties_Mn(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Nd(codepoint_t c)
static ucd_property properties_Nd(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Nl(codepoint_t c)
static ucd_property properties_Nl(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_No(codepoint_t c)
static ucd_property properties_No(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Pc(codepoint_t c)
static ucd_property properties_Pc(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Pd(codepoint_t c)
static ucd_property properties_Pd(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return UCD_PROPERTY_DASH; return UCD_PROPERTY_DASH;
} }


static int properties_Pe(codepoint_t c)
static ucd_property properties_Pe(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Pf(codepoint_t c)
static ucd_property properties_Pf(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Pi(codepoint_t c)
static ucd_property properties_Pi(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Po(codepoint_t c)
static ucd_property properties_Po(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Ps(codepoint_t c)
static ucd_property properties_Ps(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Sc(codepoint_t c)
static ucd_property properties_Sc(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Sk(codepoint_t c)
static ucd_property properties_Sk(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Sm(codepoint_t c)
static ucd_property properties_Sm(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_So(codepoint_t c)
static ucd_property properties_So(codepoint_t c)
{ {
switch (c & 0xFFFFFF00) switch (c & 0xFFFFFF00)
{ {
return 0; return 0;
} }


static int properties_Zs(codepoint_t c)
static ucd_property properties_Zs(codepoint_t c)
{ {
if (c == 0x0020) return UCD_PROPERTY_WHITE_SPACE | UCD_PROPERTY_PATTERN_WHITE_SPACE; if (c == 0x0020) return UCD_PROPERTY_WHITE_SPACE | UCD_PROPERTY_PATTERN_WHITE_SPACE;
return UCD_PROPERTY_WHITE_SPACE; return UCD_PROPERTY_WHITE_SPACE;

+ 1
- 1
tests/printcdata.c View File

uprintf_codepoint(out, c, *++format); uprintf_codepoint(out, c, *++format);
break; break;
case 'P': // properties case 'P': // properties
fprintf(out, "%016x", ucd_properties(c, ucd_lookup_category(c)));
fprintf(out, "%016llx", ucd_properties(c, ucd_lookup_category(c)));
break; break;
case 'i': // is* case 'i': // is*
uprintf_is(out, c, *++format); uprintf_is(out, c, *++format);

+ 1
- 1
tests/printucddata.c View File

uprintf_codepoint(out, c, *++format); uprintf_codepoint(out, c, *++format);
break; break;
case 'P': // properties case 'P': // properties
fprintf(out, "%016x", ucd_properties(c, ucd_lookup_category(c)));
fprintf(out, "%016llx", ucd_properties(c, ucd_lookup_category(c)));
break; break;
case 'i': // is* case 'i': // is*
uprintf_is(out, c, *++format); uprintf_is(out, c, *++format);

+ 1
- 1
tests/printucddata_cpp.cpp View File

uprintf_codepoint(out, c, *++format); uprintf_codepoint(out, c, *++format);
break; break;
case 'P': // properties case 'P': // properties
fprintf(out, "%016x", ucd::properties(c, ucd::lookup_category(c)));
fprintf(out, "%016llx", ucd::properties(c, ucd::lookup_category(c)));
break; break;
case 'i': // is* case 'i': // is*
uprintf_is(out, c, *++format); uprintf_is(out, c, *++format);

+ 1
- 0
tools/printdata.py View File

props += (2 ** 29) * data.get('Variation_Selector', 0) props += (2 ** 29) * data.get('Variation_Selector', 0)
props += (2 ** 30) * data.get('Pattern_White_Space', 0) props += (2 ** 30) * data.get('Pattern_White_Space', 0)
props += (2 ** 31) * data.get('Pattern_Syntax', 0) props += (2 ** 31) * data.get('Pattern_Syntax', 0)
props += (2 ** 32) * data.get('Prepended_Concatenation_Mark', 0)
return props return props


if __name__ == '__main__': if __name__ == '__main__':

Loading…
Cancel
Save