From a9c103bc09bbad19c001eaf170e27fc09e34e152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lemburg?= Date: Mon, 3 Jul 2000 10:52:13 +0000 Subject: [PATCH] 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). --- Include/unicodeobject.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 967334ae2dc..f076fae53bb 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)))