home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c329 / 2.img / INCL / CTYPE.H next >
Encoding:
C/C++ Source or Header  |  1989-11-07  |  1.3 KB  |  38 lines

  1. /*
  2.  *    ctype.h
  3.  *
  4.  *    Copyright (C) MicroWay, Inc., 1987, 1988
  5.  *
  6.  */
  7.  
  8. #define    _UPPER        0x01
  9. #define _LOWER        0x02
  10. #define _DIGIT        0x04
  11. #define _SPACE        0x08
  12. #define _PUNCT        0x10
  13. #define _CONTROL    0x20
  14. #define _HEXDIGIT    0x40
  15. #define _UNDERSCORE    0x80
  16.  
  17. extern unsigned char _ctype_[];
  18.  
  19. #define isascii(ch) ((unsigned)(ch)<=0x7f)
  20. #define toascii(ch) ((ch)&0x7f)
  21. #define isupper(ch) (((_ctype_+1)[(ch)])&(_UPPER))
  22. #define _toupper(ch) ((ch)-('a'-'A'))
  23. #define toupper(ch) ((islower((ch)))?(_toupper((ch))):(ch))
  24. #define islower(ch) (((_ctype_+1)[(ch)])&(_LOWER))
  25. #define _tolower(ch) ((ch)+('a'-'A'))
  26. #define tolower(ch) ((isupper((ch)))?(_tolower((ch))):(ch))
  27. #define isalpha(ch) (((_ctype_+1)[(ch)])&(_UPPER|_LOWER))
  28. #define isdigit(ch) (((_ctype_+1)[(ch)])&(_DIGIT))
  29. #define isxdigit(ch) (((_ctype_+1)[(ch)])&(_DIGIT|_HEXDIGIT))
  30. #define isalnum(ch) (((_ctype_+1)[(ch)])&(_UPPER|_LOWER|_DIGIT))
  31. #define iscsym(ch)  (((_ctype_+1)[(ch)])&(_UPPER|_LOWER|_DIGIT|_UNDERSCORE))
  32. #define iscsymf(ch) (((_ctype_+1)[(ch)])&(_UPPER|_LOWER|_UNDERSCORE))
  33. #define isspace(ch) (((_ctype_+1)[(ch)])&(_SPACE))
  34. #define ispunct(ch) (((_ctype_+1)[(ch)])&(_PUNCT))
  35. #define iscntl(ch)  (((_ctype_+1)[(ch)])&(_CONTROL))
  36. #define isprint(ch) (!iscntl(ch))
  37. #define isgraph(ch) (((_ctype_+1)[(ch)])&(_UPPER|_LOWER|_DIGIT|_PUNCT))
  38.