home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / ansi / ctype.h < prev    next >
Text File  |  1990-01-22  |  2KB  |  63 lines

  1. /*    ctype.h    4.2    85/09/04    */
  2.  
  3. /* Copyright (c) 1988 NeXT, Inc. - 9/13/88 CCH */
  4.  
  5. #ifndef _CTYPE_H
  6. #define _CTYPE_H
  7.  
  8. extern int isalnum(int c);
  9. extern int isalpha(int c);
  10. extern int iscntrl(int c);
  11. extern int isdigit(int c);
  12. extern int isgraph(int c);
  13. extern int islower(int c);
  14. extern int isprint(int c);
  15. extern int ispunct(int c);
  16. extern int isspace(int c);
  17. extern int isupper(int c);
  18. extern int isxdigit(int c);
  19. extern int tolower(int c);
  20. extern int toupper(int c);
  21.  
  22. #define    _U    01
  23. #define    _L    02
  24. #define    _N    04
  25. #define    _S    010
  26. #define _P    020
  27. #define _C    040
  28. #define _X    0100
  29. #define    _B    0200
  30.  
  31. extern const char _ctype_[];
  32.  
  33. #define isalnum(c)    ((int)((_ctype_+1)[c]&(_U|_L|_N)))
  34. #define    isalpha(c)    ((int)((_ctype_+1)[c]&(_U|_L)))
  35. #define iscntrl(c)    ((int)((_ctype_+1)[c]&_C))
  36. #define    isdigit(c)    ((int)((_ctype_+1)[c]&_N))
  37. #define isgraph(c)    ((int)((_ctype_+1)[c]&(_P|_U|_L|_N)))
  38. #define    islower(c)    ((int)((_ctype_+1)[c]&_L))
  39. #define isprint(c)    ((int)((_ctype_+1)[c]&(_P|_U|_L|_N|_B)))
  40. #define ispunct(c)    ((int)((_ctype_+1)[c]&_P))
  41. #define    isspace(c)    ((int)((_ctype_+1)[c]&_S))
  42. #define    isupper(c)    ((int)((_ctype_+1)[c]&_U))
  43. #define    isxdigit(X(int)((_ctype_+1)[c]&(_N|_X)))
  44.  
  45. #define _tolower(c)    ((int)((c)-'A'+'a'))
  46. #define _toupper(c)    ((int)((c)-'a'+'A'))
  47.  
  48. #ifdef __STRICT_BSD__
  49. #define tolower(c)    _tolower(c)
  50. #define toupper(c)    _toupper(c)
  51. #define isascii(c)    ((unsigned)(c)<=0177)
  52. #define toascii(c)    ((int)((c)&0177))
  53. #else
  54. #ifndef __STRICT_ANSI__
  55. #define tolower(c)    ({int _c=(c); isupper(_c) ? _tolower(_c) : _c;})
  56. #define toupper(c)    ({int _c=(c); islower(_c) ? _toupper(_c) : _c;})
  57. #define isascii(c)    ((unsigned)(c)<=0177)
  58. #define toascii(c)    ((int)((c)&0177))
  59. #endif /* __STRICT_ANSI__ */
  60. #endif /* __STRICT_BSD__ */
  61.  
  62. #endif /* _CTYPE_H */
  63.