ctype.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #define _U 01
  10. #define _L 02
  11. #define _N 04
  12. #define _S 010
  13. #define _P 020
  14. #define _C 040
  15. #define _B 0100
  16. #define _X 0200
  17. extern unsigned char _ctype[];
  18. #define isalpha(c) (_ctype[(unsigned char)(c)]&(_U|_L))
  19. #define isupper(c) (_ctype[(unsigned char)(c)]&_U)
  20. #define islower(c) (_ctype[(unsigned char)(c)]&_L)
  21. #define isdigit(c) (_ctype[(unsigned char)(c)]&_N)
  22. #define isxdigit(c) (_ctype[(unsigned char)(c)]&_X)
  23. #define isspace(c) (_ctype[(unsigned char)(c)]&_S)
  24. #define ispunct(c) (_ctype[(unsigned char)(c)]&_P)
  25. #define isalnum(c) (_ctype[(unsigned char)(c)]&(_U|_L|_N))
  26. #define isprint(c) (_ctype[(unsigned char)(c)]&(_P|_U|_L|_N|_B))
  27. #define isgraph(c) (_ctype[(unsigned char)(c)]&(_P|_U|_L|_N))
  28. #define iscntrl(c) (_ctype[(unsigned char)(c)]&_C)
  29. #define isascii(c) ((unsigned char)(c)<=0177)
  30. #define _toupper(c) ((c)-'a'+'A')
  31. #define _tolower(c) ((c)-'A'+'a')
  32. #define toascii(c) ((c)&0177)