diff options
author | Marc-André Lemburg <mal@egenix.com> | 2000-07-03 10:52:13 (GMT) |
---|---|---|
committer | Marc-André Lemburg <mal@egenix.com> | 2000-07-03 10:52:13 (GMT) |
commit | a9c103bc09bbad19c001eaf170e27fc09e34e152 (patch) | |
tree | f7f83b3dfc45997b9188afab72cc39584b6f077f | |
parent | 891bc6548677fd0542fd715713f082be6f78e54e (diff) | |
download | cpython-a9c103bc09bbad19c001eaf170e27fc09e34e152.zip cpython-a9c103bc09bbad19c001eaf170e27fc09e34e152.tar.gz cpython-a9c103bc09bbad19c001eaf170e27fc09e34e152.tar.bz2 |
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).
-rw-r--r-- | Include/unicodeobject.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 967334a..f076fae 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -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))) |