mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-25 12:46:13 +00:00
Add an iswxdigit compatibility API.
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
## 9.0.0.1 - (In Progress)
|
||||
|
||||
* Add `iswblank` compatibility.
|
||||
* Add `iswblank` and `iswxdigit` compatibility.
|
||||
|
||||
## 9.0.0 - 2016-12-28
|
||||
|
||||
|
||||
@@ -92,21 +92,20 @@ C library provides a set of APIs that are compatible with `wctype.h`.
|
||||
|
||||
The following character classification functions are provided:
|
||||
|
||||
| C API | C++ API |
|
||||
|---------------|----------------|
|
||||
| `ucd_isalnum` | `ucd::isalnum` |
|
||||
| `ucd_isalpha` | `ucd::isalpha` |
|
||||
| `ucd_isblank` | `ucd::isblank` |
|
||||
| `ucd_iscntrl` | `ucd::iscntrl` |
|
||||
| `ucd_isdigit` | `ucd::isdigit` |
|
||||
| `ucd_isgraph` | `ucd::isgraph` |
|
||||
| `ucd_islower` | `ucd::islower` |
|
||||
| `ucd_isprint` | `ucd::isprint` |
|
||||
| `ucd_ispunct` | `ucd::ispunct` |
|
||||
| `ucd_isspace` | `ucd::isspace` |
|
||||
| `ucd_isupper` | `ucd::isupper` |
|
||||
|
||||
__NOTE:__ An equivalent for `isxdigit` is not provided.
|
||||
| C API | C++ API |
|
||||
|----------------|-----------------|
|
||||
| `ucd_isalnum` | `ucd::isalnum` |
|
||||
| `ucd_isalpha` | `ucd::isalpha` |
|
||||
| `ucd_isblank` | `ucd::isblank` |
|
||||
| `ucd_iscntrl` | `ucd::iscntrl` |
|
||||
| `ucd_isdigit` | `ucd::isdigit` |
|
||||
| `ucd_isgraph` | `ucd::isgraph` |
|
||||
| `ucd_islower` | `ucd::islower` |
|
||||
| `ucd_isprint` | `ucd::isprint` |
|
||||
| `ucd_ispunct` | `ucd::ispunct` |
|
||||
| `ucd_isspace` | `ucd::isspace` |
|
||||
| `ucd_isupper` | `ucd::isupper` |
|
||||
| `ucd_isxdigit` | `ucd::isxdigit` |
|
||||
|
||||
## Build Dependencies
|
||||
|
||||
|
||||
@@ -169,3 +169,10 @@ int ucd_isupper(codepoint_t c)
|
||||
{
|
||||
return ucd_lookup_category(c) == UCD_CATEGORY_Lu;
|
||||
}
|
||||
|
||||
int ucd_isxdigit(codepoint_t c)
|
||||
{
|
||||
return (c >= 0x30 && c <= 0x39) // [0-9]
|
||||
|| (c >= 0x41 && c <= 0x46) // [A-Z]
|
||||
|| (c >= 0x61 && c <= 0x66); // [a-z]
|
||||
}
|
||||
|
||||
@@ -402,6 +402,13 @@ int ucd_isspace(codepoint_t c);
|
||||
*/
|
||||
int ucd_isupper(codepoint_t c);
|
||||
|
||||
/** @brief Is the codepoint in the 'xdigit' class?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is in the 'xdigit' class, zero otherwise.
|
||||
*/
|
||||
int ucd_isxdigit(codepoint_t c);
|
||||
|
||||
/** @brief Convert the Unicode codepoint to upper-case.
|
||||
*
|
||||
* This function only uses the simple case mapping present in the
|
||||
@@ -873,6 +880,16 @@ namespace ucd
|
||||
return ucd_isupper(c);
|
||||
}
|
||||
|
||||
/** @brief Is the codepoint in the 'xdigit' class?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is in the 'xdigit' class, zero otherwise.
|
||||
*/
|
||||
inline int isxdigit(codepoint_t c)
|
||||
{
|
||||
return ucd_isxdigit(c);
|
||||
}
|
||||
|
||||
/** @brief Convert the Unicode codepoint to upper-case.
|
||||
*
|
||||
* This function only uses the simple case mapping present in the
|
||||
|
||||
@@ -141,6 +141,9 @@ void uprintf_is(FILE *out, codepoint_t c, char mode)
|
||||
case 'u': // upper case
|
||||
fputc(iswupper(c) ? '1' : '0', out);
|
||||
break;
|
||||
case 'x': // xdigit
|
||||
fputc(iswxdigit(c) ? '1' : '0', out);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,6 +138,9 @@ void uprintf_is(FILE *out, codepoint_t c, char mode)
|
||||
case 'u': // upper case
|
||||
fputc(ucd_isupper(c) ? '1' : '0', out);
|
||||
break;
|
||||
case 'x': // xdigit
|
||||
fputc(ucd_isxdigit(c) ? '1' : '0', out);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,6 +138,9 @@ void uprintf_is(FILE *out, ucd::codepoint_t c, char mode)
|
||||
case 'u': // upper case
|
||||
fputc(ucd::isupper(c) ? '1' : '0', out);
|
||||
break;
|
||||
case 'x': // xdigit
|
||||
fputc(ucd::isxdigit(c) ? '1' : '0', out);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user