mirror of
https://github.com/python/cpython.git
synced 2024-11-28 08:20:55 +01:00
521ee5651c
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82194 | stefan.krah | 2010-06-24 12:25:08 +0200 (Thu, 24 Jun 2010) | 3 lines Add specification for the Py_IS* macros in pyctype.h. ........
32 lines
1.2 KiB
C
32 lines
1.2 KiB
C
#ifndef PYCTYPE_H
|
|
#define PYCTYPE_H
|
|
|
|
#define PY_CTF_LOWER 0x01
|
|
#define PY_CTF_UPPER 0x02
|
|
#define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER)
|
|
#define PY_CTF_DIGIT 0x04
|
|
#define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT)
|
|
#define PY_CTF_SPACE 0x08
|
|
#define PY_CTF_XDIGIT 0x10
|
|
|
|
extern const unsigned int _Py_ctype_table[256];
|
|
|
|
/* Unlike their C counterparts, the following macros are not meant to
|
|
* handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument
|
|
* must be a signed/unsigned char. */
|
|
#define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER)
|
|
#define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER)
|
|
#define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA)
|
|
#define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT)
|
|
#define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT)
|
|
#define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM)
|
|
#define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE)
|
|
|
|
extern const unsigned char _Py_ctype_tolower[256];
|
|
extern const unsigned char _Py_ctype_toupper[256];
|
|
|
|
#define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)])
|
|
#define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)])
|
|
|
|
#endif /* !PYCTYPE_H */
|