xref: /original-bsd/include/ctype.h (revision 655593d0)
1 /*
2  * Copyright (c) 1989 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)ctype.h	5.3 (Berkeley) 04/03/91
8  */
9 
10 #ifndef _CTYPE_H_
11 #define _CTYPE_H_
12 
13 #define	_U	0x01
14 #define	_L	0x02
15 #define	_N	0x04
16 #define	_S	0x08
17 #define	_P	0x10
18 #define	_C	0x20
19 #define	_X	0x40
20 #define	_B	0x80
21 
22 extern char	_ctype_[];
23 
24 #define	isdigit(c)	((_ctype_ + 1)[c] & _N)
25 #define	islower(c)	((_ctype_ + 1)[c] & _L)
26 #define	isspace(c)	((_ctype_ + 1)[c] & _S)
27 #define	ispunct(c)	((_ctype_ + 1)[c] & _P)
28 #define	isupper(c)	((_ctype_ + 1)[c] & _U)
29 #define	isalpha(c)	((_ctype_ + 1)[c] & (_U|_L))
30 #define	isxdigit(c)	((_ctype_ + 1)[c] & (_N|_X))
31 #define	isalnum(c)	((_ctype_ + 1)[c] & (_U|_L|_N))
32 #define	isprint(c)	((_ctype_ + 1)[c] & (_P|_U|_L|_N|_B))
33 #define	isgraph(c)	((_ctype_ + 1)[c] & (_P|_U|_L|_N))
34 #define	iscntrl(c)	((_ctype_ + 1)[c] & _C)
35 #define	isascii(c)	((unsigned)(c) <= 0177)
36 #define	toupper(c)	((c) - 'a' + 'A')
37 #define	tolower(c)	((c) - 'A' + 'a')
38 #define	toascii(c)	((c) & 0177)
39 
40 #endif /* !_CTYPE_H_ */
41