chartypes.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. #pragma src "/sys/src/lib/c/port"
  10. #pragma lib "libc.a"
  11. #define _U 01
  12. #define _L 02
  13. #define _N 04
  14. #define _S 010
  15. #define _P 020
  16. #define _C 040
  17. #define _B 0100
  18. #define _X 0200
  19. extern unsigned char _ctype[];
  20. #define isalpha(c) (_ctype[(unsigned char)(c)]&(_U|_L))
  21. #define isupper(c) (_ctype[(unsigned char)(c)]&_U)
  22. #define islower(c) (_ctype[(unsigned char)(c)]&_L)
  23. #define isdigit(c) (_ctype[(unsigned char)(c)]&_N)
  24. #define isxdigit(c) (_ctype[(unsigned char)(c)]&_X)
  25. #define isspace(c) (_ctype[(unsigned char)(c)]&_S)
  26. #define ispunct(c) (_ctype[(unsigned char)(c)]&_P)
  27. #define isalnum(c) (_ctype[(unsigned char)(c)]&(_U|_L|_N))
  28. #define isprint(c) (_ctype[(unsigned char)(c)]&(_P|_U|_L|_N|_B))
  29. #define isgraph(c) (_ctype[(unsigned char)(c)]&(_P|_U|_L|_N))
  30. #define iscntrl(c) (_ctype[(unsigned char)(c)]&_C)
  31. #define isascii(c) ((unsigned char)(c)<=0177)
  32. #define _toupper(c) ((c)-'a'+'A')
  33. #define _tolower(c) ((c)-'A'+'a')
  34. #define toascii(c) ((c)&0177)