xref: /plan9/sys/include/ctype.h (revision 80ee5cbfe36716af62da8896207e9763b8e3d760)
1 #pragma	src	"/sys/src/libc/port"
2 #pragma	lib	"libc.a"
3 
4 #define	_U	01
5 #define	_L	02
6 #define	_N	04
7 #define	_S	010
8 #define	_P	020
9 #define	_C	040
10 #define	_B	0100
11 #define	_X	0200
12 
13 extern unsigned char	_ctype[];
14 
15 #define	isalpha(c)	(_ctype[(unsigned char)(c)]&(_U|_L))
16 #define	isupper(c)	(_ctype[(unsigned char)(c)]&_U)
17 #define	islower(c)	(_ctype[(unsigned char)(c)]&_L)
18 #define	isdigit(c)	(_ctype[(unsigned char)(c)]&_N)
19 #define	isxdigit(c)	(_ctype[(unsigned char)(c)]&_X)
20 #define	isspace(c)	(_ctype[(unsigned char)(c)]&_S)
21 #define	ispunct(c)	(_ctype[(unsigned char)(c)]&_P)
22 #define	isalnum(c)	(_ctype[(unsigned char)(c)]&(_U|_L|_N))
23 #define	isprint(c)	(_ctype[(unsigned char)(c)]&(_P|_U|_L|_N|_B))
24 #define	isgraph(c)	(_ctype[(unsigned char)(c)]&(_P|_U|_L|_N))
25 #define	iscntrl(c)	(_ctype[(unsigned char)(c)]&_C)
26 #define	isascii(c)	((unsigned char)(c)<=0177)
27 #define	_toupper(c)	((c)-'a'+'A')
28 #define	_tolower(c)	((c)-'A'+'a')
29 #define	toascii(c)	((c)&0177)
30