| # Change Log | # Change Log | ||||
| ## 9.0.0.1 - (In Progress) | |||||
| * Add `iswblank` compatibility. | |||||
| ## 9.0.0 - 2016-12-28 | ## 9.0.0 - 2016-12-28 | ||||
| * Update to Unicode Character Data 9.0.0. | * Update to Unicode Character Data 9.0.0. |
| |---------------|----------------| | |---------------|----------------| | ||||
| | `ucd_isalnum` | `ucd::isalnum` | | | `ucd_isalnum` | `ucd::isalnum` | | ||||
| | `ucd_isalpha` | `ucd::isalpha` | | | `ucd_isalpha` | `ucd::isalpha` | | ||||
| | `ucd_isblank` | `ucd::isblank` | | |||||
| | `ucd_iscntrl` | `ucd::iscntrl` | | | `ucd_iscntrl` | `ucd::iscntrl` | | ||||
| | `ucd_isdigit` | `ucd::isdigit` | | | `ucd_isdigit` | `ucd::isdigit` | | ||||
| | `ucd_isgraph` | `ucd::isgraph` | | | `ucd_isgraph` | `ucd::isgraph` | | ||||
| | `ucd_isspace` | `ucd::isspace` | | | `ucd_isspace` | `ucd::isspace` | | ||||
| | `ucd_isupper` | `ucd::isupper` | | | `ucd_isupper` | `ucd::isupper` | | ||||
| __NOTE:__ Equivalents for `isblank` and `isxdigit` are not provided. | |||||
| __NOTE:__ An equivalent for `isxdigit` is not provided. | |||||
| ## Build Dependencies | ## Build Dependencies | ||||
| } | } | ||||
| } | } | ||||
| int ucd_isblank(codepoint_t c) | |||||
| { | |||||
| switch (ucd_lookup_category(c)) | |||||
| { | |||||
| case UCD_CATEGORY_Zs: | |||||
| return 1; | |||||
| case UCD_CATEGORY_Cc: | |||||
| return c == 0x09; // U+0009 : CHARACTER TABULATION | |||||
| default: | |||||
| return 0; | |||||
| } | |||||
| } | |||||
| int ucd_iscntrl(codepoint_t c) | int ucd_iscntrl(codepoint_t c) | ||||
| { | { | ||||
| return ucd_lookup_category(c) == UCD_CATEGORY_Cc; | return ucd_lookup_category(c) == UCD_CATEGORY_Cc; |
| */ | */ | ||||
| int ucd_isalpha(codepoint_t c); | int ucd_isalpha(codepoint_t c); | ||||
| /** @brief Is the codepoint a tab or Unicode whitespace character? | |||||
| * | |||||
| * @param c The Unicode codepoint to check. | |||||
| * @return Non-zero if the codepoint is a whitespace character, zero otherwise. | |||||
| */ | |||||
| int ucd_isblank(codepoint_t 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 ucd_isalpha(c); | return ucd_isalpha(c); | ||||
| } | } | ||||
| /** @brief Is the codepoint a tab or Unicode whitespace character? | |||||
| * | |||||
| * @param c The Unicode codepoint to check. | |||||
| * @return Non-zero if the codepoint is a whitespace character, zero otherwise. | |||||
| */ | |||||
| inline int isblank(codepoint_t c) | |||||
| { | |||||
| return ucd_isblank(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. |
| case 'a': // alpha | case 'a': // alpha | ||||
| fputc(iswalpha(c) ? '1' : '0', out); | fputc(iswalpha(c) ? '1' : '0', out); | ||||
| break; | break; | ||||
| case 'b': // blank | |||||
| fputc(iswblank(c) ? '1' : '0', out); | |||||
| break; | |||||
| case 'c': // control | case 'c': // control | ||||
| fputc(iswcntrl(c) ? '1' : '0', out); | fputc(iswcntrl(c) ? '1' : '0', out); | ||||
| break; | break; |
| case 'a': // alpha | case 'a': // alpha | ||||
| fputc(ucd_isalpha(c) ? '1' : '0', out); | fputc(ucd_isalpha(c) ? '1' : '0', out); | ||||
| break; | break; | ||||
| case 'b': // blank | |||||
| fputc(ucd_isblank(c) ? '1' : '0', out); | |||||
| break; | |||||
| case 'c': // control | case 'c': // control | ||||
| fputc(ucd_iscntrl(c) ? '1' : '0', out); | fputc(ucd_iscntrl(c) ? '1' : '0', out); | ||||
| break; | break; |
| case 'a': // alpha | case 'a': // alpha | ||||
| fputc(ucd::isalpha(c) ? '1' : '0', out); | fputc(ucd::isalpha(c) ? '1' : '0', out); | ||||
| break; | break; | ||||
| case 'b': // blank | |||||
| fputc(ucd::isblank(c) ? '1' : '0', out); | |||||
| break; | |||||
| case 'c': // control | case 'c': // control | ||||
| fputc(ucd::iscntrl(c) ? '1' : '0', out); | fputc(ucd::iscntrl(c) ? '1' : '0', out); | ||||
| break; | break; |