Added new Py_UNICODE_ISALPHA() and Py_UNICODE_ISALNUM() macros

which are true for alphabetic and alphanumeric characters resp.

The macros are currently implemented using the existing is* tables
but will have to be updated to meet the Unicode standard definitions
(add tables for non-cased letters and letter modifiers).
This commit is contained in:
Marc-André Lemburg 2000-07-03 10:52:13 +00:00
parent 891bc65486
commit a9c103bc09
1 changed files with 11 additions and 0 deletions

View File

@ -160,6 +160,17 @@ typedef unsigned short Py_UNICODE;
#endif
#define Py_UNICODE_ISALPHA(ch) \
(Py_UNICODE_ISLOWER(ch) || \
Py_UNICODE_ISUPPER(ch) || \
Py_UNICODE_ISTITLE(ch))
#define Py_UNICODE_ISALNUM(ch) \
(Py_UNICODE_ISALPHA(ch) || \
Py_UNICODE_ISDECIMAL(ch) || \
Py_UNICODE_ISDIGIT(ch) || \
Py_UNICODE_ISNUMERIC(ch))
#define Py_UNICODE_COPY(target, source, length)\
(memcpy((target), (source), (length)*sizeof(Py_UNICODE)))