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.7 (Berkeley) 03/13/92 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[], __maplower[], __mapupper[]; 23 24 #define isalnum(c) ((__ctype + 1)[c] & (_U|_L|_N)) 25 #define isalpha(c) ((__ctype + 1)[c] & (_U|_L)) 26 #define iscntrl(c) ((__ctype + 1)[c] & _C) 27 #define isdigit(c) ((__ctype + 1)[c] & _N) 28 #define isgraph(c) ((__ctype + 1)[c] & (_P|_U|_L|_N)) 29 #define islower(c) ((__ctype + 1)[c] & _L) 30 #define isprint(c) ((__ctype + 1)[c] & (_P|_U|_L|_N|_B)) 31 #define ispunct(c) ((__ctype + 1)[c] & _P) 32 #define isspace(c) ((__ctype + 1)[c] & _S) 33 #define isupper(c) ((__ctype + 1)[c] & _U) 34 #define isxdigit(c) ((__ctype + 1)[c] & (_N|_X)) 35 #define tolower(c) ((__maplower + 1)[c]) 36 #define toupper(c) ((__mapupper + 1)[c]) 37 38 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 39 #define isascii(c) ((unsigned int)(c) <= 0177) 40 #define isblank(c) ((c) == '\t' || (c) == ' ') 41 #define toascii(c) ((c) & 0177) 42 #endif 43 44 #endif /* !_CTYPE_H_ */ 45