Rev 647 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
215 | victor | 1 | /* |
2 | ** All character classification functions except isascii(). |
||
3 | ** Integer argument (c) must be in ASCII range (0-127) for |
||
4 | ** dependable answers. |
||
5 | */ |
||
6 | |||
6424 | siemargl | 7 | #define __ALNUM 1 |
8 | #define __ALPHA 2 |
||
9 | #define __CNTRL 4 |
||
10 | #define __DIGIT 8 |
||
11 | #define __GRAPH 16 |
||
12 | #define __LOWER 32 |
||
13 | #define __PRINT 64 |
||
14 | #define __PUNCT 128 |
||
15 | #define __BLANK 256 |
||
16 | #define __UPPER 512 |
||
17 | #define __XDIGIT 1024 |
||
215 | victor | 18 | |
6424 | siemargl | 19 | extern char __is[128]; |
215 | victor | 20 | |
6424 | siemargl | 21 | #define isalnum(c)(__is[c] & __ALNUM ) /* 'a'-'z', 'A'-'Z', '0'-'9' */ |
22 | #define isalpha(c)(__is[c] & __ALPHA ) /* 'a'-'z', 'A'-'Z' */ |
||
23 | #define iscntrl(c)(__is[c] & __CNTRL ) /* 0-31, 127 */ |
||
24 | #define isdigit(c)(__is[c] & __DIGIT ) /* '0'-'9' */ |
||
25 | #define isgraph(c)(__is[c] & __GRAPH ) /* '!'-'~' */ |
||
26 | #define islower(c)(__is[c] & __LOWER ) /* 'a'-'z' */ |
||
27 | #define isprint(c)(__is[c] & __PRINT ) /* ' '-'~' */ |
||
28 | #define ispunct(c)(__is[c] & __PUNCT ) /* !alnum && !cntrl && !space */ |
||
29 | #define isspace(c)(__is[c] & __BLANK ) /* HT, LF, VT, FF, CR, ' ' */ |
||
30 | #define isupper(c)(__is[c] & __UPPER ) /* 'A'-'Z' */ |
||
31 | #define isxdigit(c)(__is[c] & __XDIGIT) /* '0'-'9', 'a'-'f', 'A'-'F' */ |
||
647 | andrew_pro | 32 | |
33 | #define isascii(c) (!((c)&(~0x7f))) |
||
34 | #define toascii(c) ((c)&0x7f) |
||
35 |