-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCTYPE.H
30 lines (26 loc) · 841 Bytes
/
CTYPE.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef _CTYPE_H_
#define _CTYPE_H_
#define _U 0x01
#define _L 0x02
#define _N 0x04
#define _S 0x08
#define _P 0x10
#define _C 0x20
#define _X 0x40
extern unsigned char _ctype_[];
#define isalpha(c) ((_ctype_+1)[c]&(_U|_L))
#define isupper(c) ((_ctype_+1)[c]&_U)
#define islower(c) ((_ctype_+1)[c]&_L)
#define isdigit(c) ((_ctype_+1)[c]&_N)
#define isxdigit(c) ((_ctype_+1)[c]&(_N|_X))
#define isspace(c) ((_ctype_+1)[c]&_S)
#define ispunct(c) ((_ctype_+1)[c]&_P)
#define isalnum(c) ((_ctype_+1)[c]&(_U|_L|_N))
#define isprint(c) ((_ctype_+1)[c]&(_P|_U|_L|_N|_S))
#define isgraph(c) ((_ctype_+1)[c]&(_P|_U|_L|_N))
#define iscntrl(c) ((_ctype_+1)[c]&_C)
#define isascii(c) (!((c)&0xFF80))
#define toupper(c) ((c)-'a'+'A')
#define tolower(c) ((c)-'A'+'a')
#define toascii(c) ((c)&0x7F)
#endif /* _CTYPE_H_ */