3 * (C) Copyright Jun 2 1995, Edmond J. Breen.
5 * This code may be copied for personal, non-profit use only.
13 #define _C_SPA 1 /* space */
14 #define _C_DIG 2 /* digit indicator */
15 #define _C_UPP 4 /* upper case */
16 #define _C_LOW 8 /* lower case */
17 #define _C_HEX 16 /* [A-F or [a-f] */
18 #define _C_CTL 32 /* Control */
19 #define _C_PUN 64 /* punctuation */
20 #define _C_OTH 128 /* other */
23 #define isalnum(c) (_CtYpE[(int)(c)] & (_C_DIG|_C_UPP|_C_LOW))
24 #define isalpha(c) (_CtYpE[(int)(c)] & (_C_UPP|_C_LOW))
25 #define iscntrl(c) (_CtYpE[(int)(c)] & (_C_CTL|_C_OTH))
26 #define isdigit(c) (_CtYpE[(int)(c)] & _C_DIG)
27 #define isgraph(c) (_CtYpE[(int)(c)] & (_C_DIG|_C_LOW|_C_UPP|_C_PUN))
28 #define islower(c) (_CtYpE[(int)(c)] & _C_LOW)
29 #define isprint(c) (_CtYpE[(int)(c)] & (_C_DIG|_C_LOW|_C_UPP|_C_PUN|_C_SPA))
30 #define ispunct(c) (_CtYpE[(int)(c)] & _C_PUN)
31 #define isspace(c) (_CtYpE[(int)(c)] & (_C_SPA|_C_CTL))
32 #define isupper(c) (_CtYpE[(int)(c)] & _C_UPP)
33 #define isxdigit(c) (_CtYpE[(int)(c)] & _C_HEX)
36 * The next two marcos work, but they are unsafe.
37 * They must eventually be REPLACED.
39 #define tolower(c) (isupper(c) ? (c)+32:c)
40 #define toupper(c) (islower(c) ? (c)-32:c)
44 extern unsigned short *_CtYpE;
46 unsigned short *_CtYpE;
47 unsigned short *_get_ctype(void);
48 _CtYpE = _get_ctype();