mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-04 22:38:33 +00:00
ctype: return true in isupper/islower if there is a simple case mapping present
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
## 9.0.0.1 - (In Progress)
|
||||
|
||||
* Add `iswblank` and `iswxdigit` compatibility.
|
||||
* Improve ctype compatibility.
|
||||
|
||||
## 9.0.0 - 2016-12-28
|
||||
|
||||
|
||||
+4
-2
@@ -97,7 +97,8 @@ int ucd_isgraph(codepoint_t c)
|
||||
|
||||
int ucd_islower(codepoint_t c)
|
||||
{
|
||||
return ucd_lookup_category(c) == UCD_CATEGORY_Ll;
|
||||
return ucd_lookup_category(c) == UCD_CATEGORY_Ll
|
||||
|| ucd_toupper(c) != c;
|
||||
}
|
||||
|
||||
int ucd_isprint(codepoint_t c)
|
||||
@@ -159,7 +160,8 @@ int ucd_isspace(codepoint_t c)
|
||||
|
||||
int ucd_isupper(codepoint_t c)
|
||||
{
|
||||
return ucd_lookup_category(c) == UCD_CATEGORY_Lu;
|
||||
return ucd_lookup_category(c) == UCD_CATEGORY_Lu
|
||||
|| ucd_tolower(c) != c;
|
||||
}
|
||||
|
||||
int ucd_isxdigit(codepoint_t c)
|
||||
|
||||
+1
-1
@@ -248,7 +248,7 @@ int main(int argc, char **argv)
|
||||
else
|
||||
{
|
||||
for (codepoint_t c = 0; c <= 0x10FFFF; ++c)
|
||||
uprintf(stdout, c, format ? format : "%pH %s %C %c %UH %LH %TH %is\n");
|
||||
uprintf(stdout, c, format ? format : "%pH %s %C %c %UH %LH %TH %is %iu %il\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ int main(int argc, char **argv)
|
||||
else
|
||||
{
|
||||
for (codepoint_t c = 0; c <= 0x10FFFF; ++c)
|
||||
uprintf(stdout, c, format ? format : "%pH %s %C %c %UH %LH %TH %is\n");
|
||||
uprintf(stdout, c, format ? format : "%pH %s %C %c %UH %LH %TH %is %iu %il\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ int main(int argc, char **argv)
|
||||
else
|
||||
{
|
||||
for (ucd::codepoint_t c = 0; c <= 0x10FFFF; ++c)
|
||||
uprintf(stdout, c, format ? format : "%pH %s %C %c %UH %LH %TH %is\n");
|
||||
uprintf(stdout, c, format ? format : "%pH %s %C %c %UH %LH %TH %is %iu %il\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+21
-3
@@ -24,6 +24,8 @@ import ucd
|
||||
ucd_rootdir = sys.argv[1]
|
||||
csur_rootdir = 'data/csur'
|
||||
|
||||
null = ucd.CodePoint('0000')
|
||||
|
||||
unicode_chars = {}
|
||||
for data in ucd.parse_ucd_data(ucd_rootdir, 'UnicodeData'):
|
||||
for codepoint in data['CodePoint']:
|
||||
@@ -44,7 +46,22 @@ if '--with-csur' in sys.argv:
|
||||
def isspace(data):
|
||||
return data.get('White_Space', 0)
|
||||
|
||||
null = ucd.CodePoint('0000')
|
||||
def isupper(data):
|
||||
if data.get('LowerCase', null) != null:
|
||||
return 1
|
||||
elif data.get('GeneralCategory', 'Cn') == 'Lu':
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
def islower(data):
|
||||
if data.get('UpperCase', null) != null:
|
||||
return 1
|
||||
elif data.get('GeneralCategory', 'Cn') == 'Ll':
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
for codepoint in ucd.CodeRange('000000..10FFFF'):
|
||||
try:
|
||||
@@ -58,8 +75,9 @@ 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' % (
|
||||
print('%s %s %s %s %s %s %s %s %s %s' % (
|
||||
codepoint, script,
|
||||
data.get('GeneralCategory', 'Cn')[0], data.get('GeneralCategory', 'Cn'),
|
||||
upper, lower, title,
|
||||
isspace(data)))
|
||||
isspace(data),
|
||||
isupper(data), islower(data)))
|
||||
|
||||
Reference in New Issue
Block a user