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