Rev 9811 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8687 | turbocat | 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 | |||
8730 | turbocat | 9 | #include |
10 | |||
9766 | turbocat | 11 | #define __ALNUM 1 |
12 | #define __ALPHA 2 |
||
13 | #define __CNTRL 4 |
||
14 | #define __DIGIT 8 |
||
15 | #define __GRAPH 16 |
||
16 | #define __LOWER 32 |
||
17 | #define __PRINT 64 |
||
18 | #define __PUNCT 128 |
||
19 | #define __BLANK 256 |
||
20 | #define __UPPER 512 |
||
8687 | turbocat | 21 | #define __XDIGIT 1024 |
22 | |||
9766 | turbocat | 23 | #ifdef _BUILD_LIBC |
8687 | turbocat | 24 | extern unsigned short __is[129]; |
25 | #else |
||
9766 | turbocat | 26 | extern unsigned short* __is; |
8687 | turbocat | 27 | #endif |
28 | |||
9766 | turbocat | 29 | #define isalnum(c) (__is[c + 1] & __ALNUM) /* 'a'-'z', 'A'-'Z', '0'-'9' */ |
30 | #define isalpha(c) (__is[c + 1] & __ALPHA) /* 'a'-'z', 'A'-'Z' */ |
||
31 | #define iscntrl(c) (__is[c + 1] & __CNTRL) /* 0-31, 127 */ |
||
32 | #define isdigit(c) (__is[c + 1] & __DIGIT) /* '0'-'9' */ |
||
33 | #define isgraph(c) (__is[c + 1] & __GRAPH) /* '!'-'~' */ |
||
34 | #define islower(c) (__is[c + 1] & __LOWER) /* 'a'-'z' */ |
||
35 | #define isprint(c) (__is[c + 1] & __PRINT) /* ' '-'~' */ |
||
36 | #define ispunct(c) (__is[c + 1] & __PUNCT) /* !alnum && !cntrl && !space */ |
||
37 | #define isspace(c) (__is[c + 1] & __BLANK) /* HT, LF, VT, FF, CR, ' ' */ |
||
38 | #define isupper(c) (__is[c + 1] & __UPPER) /* 'A'-'Z' */ |
||
39 | #define isxdigit(c) (__is[c + 1] & __XDIGIT) /* '0'-'9', 'a'-'f', 'A'-'F' */ |
||
8687 | turbocat | 40 | |
9766 | turbocat | 41 | #define isascii(c) (!((c) & (~0x7f))) |
8687 | turbocat | 42 | #define toascii(c) ((c)&0x7f) |
43 | |||
9812 | Coldy | 44 | DLLAPI int tolower(int c); |
45 | DLLAPI int toupper(int c); |
||
8687 | turbocat | 46 | |
8730 | turbocat | 47 | #endif |