src_libucd_la_SOURCES = \ | src_libucd_la_SOURCES = \ | ||||
src/case.cpp \ | src/case.cpp \ | ||||
src/categories.cpp \ | src/categories.cpp \ | ||||
src/ctype.cpp \ | |||||
src/ctype.c \ | |||||
src/scripts.cpp \ | src/scripts.cpp \ | ||||
src/tostring.c | src/tostring.c | ||||
int ucd_isalnum(codepoint_t c) | int ucd_isalnum(codepoint_t c) | ||||
{ | { | ||||
return ucd::isalnum(c); | |||||
} | |||||
int ucd::isalnum(codepoint_t c) | |||||
{ | |||||
switch (lookup_category(c)) | |||||
switch (ucd_lookup_category(c)) | |||||
{ | { | ||||
case Ll: case Lm: case Lo: case Lt: case Lu: | |||||
case Nd: case Nl: case No: | |||||
case UCD_CATEGORY_Ll: | |||||
case UCD_CATEGORY_Lm: | |||||
case UCD_CATEGORY_Lo: | |||||
case UCD_CATEGORY_Lt: | |||||
case UCD_CATEGORY_Lu: | |||||
case UCD_CATEGORY_Nd: | |||||
case UCD_CATEGORY_Nl: | |||||
case UCD_CATEGORY_No: | |||||
return 1; | return 1; | ||||
default: | default: | ||||
return 0; | return 0; | ||||
int ucd_isalpha(codepoint_t c) | int ucd_isalpha(codepoint_t c) | ||||
{ | { | ||||
return ucd::isalpha(c); | |||||
} | |||||
int ucd::isalpha(codepoint_t c) | |||||
{ | |||||
switch (lookup_category(c)) | |||||
switch (ucd_lookup_category(c)) | |||||
{ | { | ||||
case Ll: case Lm: case Lo: case Lt: case Lu: | |||||
case UCD_CATEGORY_Ll: | |||||
case UCD_CATEGORY_Lm: | |||||
case UCD_CATEGORY_Lo: | |||||
case UCD_CATEGORY_Lt: | |||||
case UCD_CATEGORY_Lu: | |||||
return 1; | return 1; | ||||
default: | default: | ||||
return 0; | return 0; | ||||
int ucd_iscntrl(codepoint_t c) | int ucd_iscntrl(codepoint_t c) | ||||
{ | { | ||||
return ucd::iscntrl(c); | |||||
} | |||||
int ucd::iscntrl(codepoint_t c) | |||||
{ | |||||
return lookup_category(c) == Cc; | |||||
return ucd_lookup_category(c) == UCD_CATEGORY_Cc; | |||||
} | } | ||||
int ucd_isdigit(codepoint_t c) | int ucd_isdigit(codepoint_t c) | ||||
{ | { | ||||
return ucd::isdigit(c); | |||||
} | |||||
int ucd::isdigit(codepoint_t c) | |||||
{ | |||||
switch (lookup_category(c)) | |||||
switch (ucd_lookup_category(c)) | |||||
{ | { | ||||
case Nd: case Nl: case No: | |||||
case UCD_CATEGORY_Nd: | |||||
case UCD_CATEGORY_Nl: | |||||
case UCD_CATEGORY_No: | |||||
return 1; | return 1; | ||||
default: | default: | ||||
return 0; | return 0; | ||||
int ucd_isgraph(codepoint_t c) | int ucd_isgraph(codepoint_t c) | ||||
{ | { | ||||
return ucd::isgraph(c); | |||||
} | |||||
int ucd::isgraph(codepoint_t c) | |||||
{ | |||||
switch (lookup_category(c)) | |||||
switch (ucd_lookup_category(c)) | |||||
{ | { | ||||
case Cc: case Cf: case Cn: case Co: case Cs: | |||||
case Zl: case Zp: case Zs: | |||||
case Ii: | |||||
case UCD_CATEGORY_Cc: | |||||
case UCD_CATEGORY_Cf: | |||||
case UCD_CATEGORY_Cn: | |||||
case UCD_CATEGORY_Co: | |||||
case UCD_CATEGORY_Cs: | |||||
case UCD_CATEGORY_Zl: | |||||
case UCD_CATEGORY_Zp: | |||||
case UCD_CATEGORY_Zs: | |||||
case UCD_CATEGORY_Ii: | |||||
return 0; | return 0; | ||||
default: | default: | ||||
return 1; | return 1; | ||||
int ucd_islower(codepoint_t c) | int ucd_islower(codepoint_t c) | ||||
{ | { | ||||
return ucd::islower(c); | |||||
} | |||||
int ucd::islower(codepoint_t c) | |||||
{ | |||||
return lookup_category(c) == Ll; | |||||
return ucd_lookup_category(c) == UCD_CATEGORY_Ll; | |||||
} | } | ||||
int ucd_isprint(codepoint_t c) | int ucd_isprint(codepoint_t c) | ||||
{ | { | ||||
return ucd::isprint(c); | |||||
} | |||||
int ucd::isprint(codepoint_t c) | |||||
{ | |||||
switch (lookup_category(c)) | |||||
switch (ucd_lookup_category(c)) | |||||
{ | { | ||||
case Cc: case Cf: case Cn: case Co: case Cs: | |||||
case Ii: | |||||
case UCD_CATEGORY_Cc: | |||||
case UCD_CATEGORY_Cf: | |||||
case UCD_CATEGORY_Cn: | |||||
case UCD_CATEGORY_Co: | |||||
case UCD_CATEGORY_Cs: | |||||
case UCD_CATEGORY_Ii: | |||||
return 0; | return 0; | ||||
default: | default: | ||||
return 1; | return 1; | ||||
int ucd_ispunct(codepoint_t c) | int ucd_ispunct(codepoint_t c) | ||||
{ | { | ||||
return ucd::ispunct(c); | |||||
} | |||||
int ucd::ispunct(codepoint_t c) | |||||
{ | |||||
switch (lookup_category(c)) | |||||
switch (ucd_lookup_category(c)) | |||||
{ | { | ||||
case Pc: case Pd: case Pe: case Pf: case Pi: case Po: case Ps: | |||||
case UCD_CATEGORY_Pc: | |||||
case UCD_CATEGORY_Pd: | |||||
case UCD_CATEGORY_Pe: | |||||
case UCD_CATEGORY_Pf: | |||||
case UCD_CATEGORY_Pi: | |||||
case UCD_CATEGORY_Po: | |||||
case UCD_CATEGORY_Ps: | |||||
return 1; | return 1; | ||||
default: | default: | ||||
return 0; | return 0; | ||||
int ucd_isspace(codepoint_t c) | int ucd_isspace(codepoint_t c) | ||||
{ | { | ||||
return ucd::isspace(c); | |||||
} | |||||
int ucd::isspace(codepoint_t c) | |||||
{ | |||||
switch (lookup_category(c)) | |||||
switch (ucd_lookup_category(c)) | |||||
{ | { | ||||
case Zl: case Zp: case Zs: | |||||
case UCD_CATEGORY_Zl: | |||||
case UCD_CATEGORY_Zp: | |||||
case UCD_CATEGORY_Zs: | |||||
return 1; | return 1; | ||||
case Cc: | |||||
case UCD_CATEGORY_Cc: | |||||
switch (c) // Some control characters are also whitespace characters: | switch (c) // Some control characters are also whitespace characters: | ||||
{ | { | ||||
case 0x09: // U+0009 : CHARACTER TABULATION | case 0x09: // U+0009 : CHARACTER TABULATION | ||||
int ucd_isupper(codepoint_t c) | int ucd_isupper(codepoint_t c) | ||||
{ | { | ||||
return ucd::isupper(c); | |||||
} | |||||
int ucd::isupper(codepoint_t c) | |||||
{ | |||||
return lookup_category(c) == Lu; | |||||
return ucd_lookup_category(c) == UCD_CATEGORY_Lu; | |||||
} | } |
* @param c The Unicode codepoint to check. | * @param c The Unicode codepoint to check. | ||||
* @return Non-zero if the codepoint is a letter or number, zero otherwise. | * @return Non-zero if the codepoint is a letter or number, zero otherwise. | ||||
*/ | */ | ||||
int isalnum(codepoint_t c); | |||||
inline int isalnum(codepoint_t c) | |||||
{ | |||||
return ucd_isalnum(c); | |||||
} | |||||
/** @brief Is the codepoint a letter? | /** @brief Is the codepoint a letter? | ||||
* | * | ||||
* @param c The Unicode codepoint to check. | * @param c The Unicode codepoint to check. | ||||
* @return Non-zero if the codepoint is a letter, zero otherwise. | * @return Non-zero if the codepoint is a letter, zero otherwise. | ||||
*/ | */ | ||||
int isalpha(codepoint_t c); | |||||
inline int isalpha(codepoint_t c) | |||||
{ | |||||
return ucd_isalpha(c); | |||||
} | |||||
/** @brief Is the codepoint a control character? | /** @brief Is the codepoint a control character? | ||||
* | * | ||||
* @param c The Unicode codepoint to check. | * @param c The Unicode codepoint to check. | ||||
* @return Non-zero if the codepoint is a control character, zero otherwise. | * @return Non-zero if the codepoint is a control character, zero otherwise. | ||||
*/ | */ | ||||
int iscntrl(codepoint_t c); | |||||
inline int iscntrl(codepoint_t c) | |||||
{ | |||||
return ucd_iscntrl(c); | |||||
} | |||||
/** @brief Is the codepoint a numeric character? | /** @brief Is the codepoint a numeric character? | ||||
* | * | ||||
* @param c The Unicode codepoint to check. | * @param c The Unicode codepoint to check. | ||||
* @return Non-zero if the codepoint is a number, zero otherwise. | * @return Non-zero if the codepoint is a number, zero otherwise. | ||||
*/ | */ | ||||
int isdigit(codepoint_t c); | |||||
inline int isdigit(codepoint_t c) | |||||
{ | |||||
return ucd_isdigit(c); | |||||
} | |||||
/** @brief Does the codepoint have a displayable glyph? | /** @brief Does the codepoint have a displayable glyph? | ||||
* | * | ||||
* @param c The Unicode codepoint to check. | * @param c The Unicode codepoint to check. | ||||
* @return Non-zero if the codepoint has a displayable glyph, zero otherwise. | * @return Non-zero if the codepoint has a displayable glyph, zero otherwise. | ||||
*/ | */ | ||||
int isgraph(codepoint_t c); | |||||
inline int isgraph(codepoint_t c) | |||||
{ | |||||
return ucd_isgraph(c); | |||||
} | |||||
/** @brief Is the codepoint a lower-case letter? | /** @brief Is the codepoint a lower-case letter? | ||||
* | * | ||||
* @param c The Unicode codepoint to check. | * @param c The Unicode codepoint to check. | ||||
* @return Non-zero if the codepoint is a lower-case letter, zero otherwise. | * @return Non-zero if the codepoint is a lower-case letter, zero otherwise. | ||||
*/ | */ | ||||
int islower(codepoint_t c); | |||||
inline int islower(codepoint_t c) | |||||
{ | |||||
return ucd_islower(c); | |||||
} | |||||
/** @brief Is the codepoint a printable character? | /** @brief Is the codepoint a printable character? | ||||
* | * | ||||
* @param c The Unicode codepoint to check. | * @param c The Unicode codepoint to check. | ||||
* @return Non-zero if the codepoint is a printable character, zero otherwise. | * @return Non-zero if the codepoint is a printable character, zero otherwise. | ||||
*/ | */ | ||||
int isprint(codepoint_t c); | |||||
inline int isprint(codepoint_t c) | |||||
{ | |||||
return ucd_isprint(c); | |||||
} | |||||
/** @brief Is the codepoint a punctuation character? | /** @brief Is the codepoint a punctuation character? | ||||
* | * | ||||
* @param c The Unicode codepoint to check. | * @param c The Unicode codepoint to check. | ||||
* @return Non-zero if the codepoint is a punctuation character, zero otherwise. | * @return Non-zero if the codepoint is a punctuation character, zero otherwise. | ||||
*/ | */ | ||||
int ispunct(codepoint_t c); | |||||
inline int ispunct(codepoint_t c) | |||||
{ | |||||
return ucd_ispunct(c); | |||||
} | |||||
/** @brief Is the codepoint a whitespace character? | /** @brief Is the codepoint a whitespace character? | ||||
* | * | ||||
* @param c The Unicode codepoint to check. | * @param c The Unicode codepoint to check. | ||||
* @return Non-zero if the codepoint is a whitespace character, zero otherwise. | * @return Non-zero if the codepoint is a whitespace character, zero otherwise. | ||||
*/ | */ | ||||
int isspace(codepoint_t c); | |||||
inline int isspace(codepoint_t c) | |||||
{ | |||||
return ucd_isspace(c); | |||||
} | |||||
/** @brief Is the codepoint an upper-case letter? | /** @brief Is the codepoint an upper-case letter? | ||||
* | * | ||||
* @param c The Unicode codepoint to check. | * @param c The Unicode codepoint to check. | ||||
* @return Non-zero if the codepoint is an upper-case letter, zero otherwise. | * @return Non-zero if the codepoint is an upper-case letter, zero otherwise. | ||||
*/ | */ | ||||
int isupper(codepoint_t c); | |||||
inline int isupper(codepoint_t c) | |||||
{ | |||||
return ucd_isupper(c); | |||||
} | |||||
/** @brief Convert the Unicode codepoint to upper-case. | /** @brief Convert the Unicode codepoint to upper-case. | ||||
* | * |