From: Marc-André Lemburg Date: Mon, 3 Jul 2000 10:52:13 +0000 (+0000) Subject: Added new Py_UNICODE_ISALPHA() and Py_UNICODE_ISALNUM() macros X-Git-Tag: v2.0b1~1111 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9c103bc09bbad19c001eaf170e27fc09e34e152;p=python 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). --- diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 967334ae2d..f076fae53b 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)))