Commit | Line | Data |
---|---|---|
7a00777e KB |
1 | /* |
2 | * Copyright (c) 1989 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
863005e5 | 5 | * %sccs.include.redist.c% |
7a00777e | 6 | * |
02fa8db5 | 7 | * @(#)ctype.h 5.5 (Berkeley) %G% |
7a00777e | 8 | */ |
a5c4c76d | 9 | |
d2b7358e KB |
10 | #ifndef _CTYPE_H_ |
11 | #define _CTYPE_H_ | |
12 | ||
7a00777e KB |
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 | |
a5c4c76d | 21 | |
7a00777e | 22 | extern char _ctype_[]; |
a5c4c76d | 23 | |
172d4362 KB |
24 | #define isalnum(c) ((_ctype_ + 1)[c] & (_U|_L|_N)) |
25 | #define isalpha(c) ((_ctype_ + 1)[c] & (_U|_L)) | |
172d4362 | 26 | #define iscntrl(c) ((_ctype_ + 1)[c] & _C) |
7a00777e | 27 | #define isdigit(c) ((_ctype_ + 1)[c] & _N) |
172d4362 | 28 | #define isgraph(c) ((_ctype_ + 1)[c] & (_P|_U|_L|_N)) |
7a00777e | 29 | #define islower(c) ((_ctype_ + 1)[c] & _L) |
172d4362 | 30 | #define isprint(c) ((_ctype_ + 1)[c] & (_P|_U|_L|_N|_B)) |
7a00777e | 31 | #define ispunct(c) ((_ctype_ + 1)[c] & _P) |
172d4362 | 32 | #define isspace(c) ((_ctype_ + 1)[c] & _S) |
7a00777e | 33 | #define isupper(c) ((_ctype_ + 1)[c] & _U) |
7a00777e | 34 | #define isxdigit(c) ((_ctype_ + 1)[c] & (_N|_X)) |
172d4362 KB |
35 | #define tolower(c) ((c) - 'A' + 'a') |
36 | #define toupper(c) ((c) - 'a' + 'A') | |
d2b7358e | 37 | |
02fa8db5 KB |
38 | #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) |
39 | #define isascii(c) ((unsigned)(c) <= 0177) | |
40 | #define isblank(c) ((c) == '\t' || (c) == ' ') | |
41 | #define toascii(c) ((c) & 0177) | |
42 | #endif | |
43 | ||
d2b7358e | 44 | #endif /* !_CTYPE_H_ */ |