ctype.h 951 B

1234567891011121314151617181920212223242526272829
  1. #pragma src "/sys/src/libc/port"
  2. #pragma lib "libc.a"
  3. #define _U 01
  4. #define _L 02
  5. #define _N 04
  6. #define _S 010
  7. #define _P 020
  8. #define _C 040
  9. #define _B 0100
  10. #define _X 0200
  11. extern unsigned char _ctype[];
  12. #define isalpha(c) (_ctype[(unsigned char)(c)]&(_U|_L))
  13. #define isupper(c) (_ctype[(unsigned char)(c)]&_U)
  14. #define islower(c) (_ctype[(unsigned char)(c)]&_L)
  15. #define isdigit(c) (_ctype[(unsigned char)(c)]&_N)
  16. #define isxdigit(c) (_ctype[(unsigned char)(c)]&_X)
  17. #define isspace(c) (_ctype[(unsigned char)(c)]&_S)
  18. #define ispunct(c) (_ctype[(unsigned char)(c)]&_P)
  19. #define isalnum(c) (_ctype[(unsigned char)(c)]&(_U|_L|_N))
  20. #define isprint(c) (_ctype[(unsigned char)(c)]&(_P|_U|_L|_N|_B))
  21. #define isgraph(c) (_ctype[(unsigned char)(c)]&(_P|_U|_L|_N))
  22. #define iscntrl(c) (_ctype[(unsigned char)(c)]&_C)
  23. #define isascii(c) ((unsigned char)(c)<=0177)
  24. #define _toupper(c) ((c)-'a'+'A')
  25. #define _tolower(c) ((c)-'A'+'a')
  26. #define toascii(c) ((c)&0177)