home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s038 / 10.ddi / 017.LIF / CTYPE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-02  |  2.3 KB  |  81 lines

  1. /* ctype.h - character tests
  2.  * $Version: 1.1 $
  3.  * Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
  4.  */
  5.  
  6. #ifndef _ctypeh
  7. #define _ctypeh
  8. /*lint -library */
  9.  
  10. #pragma fixedparams("_tolower", "_toupper", "isalnum",  "isascii", "isalpha")
  11. #pragma fixedparams("iscntrl",  "isdigit",  "isgraph",  "islower", "isodigit")
  12. #pragma fixedparams("isprint",  "ispunct",  "isspace",  "isupper", "isxdigit")
  13. #pragma fixedparams("tolower",  "toupper")
  14.  
  15. #define _UPPER   0x01
  16. #define _LOWER   0x02
  17. #define _DIGIT   0x04
  18. #define _SPACE   0x08
  19. #define _PUNCT   0x10
  20. #define _CONTROL 0x20
  21. #define _BLANK   0x40
  22. #define _HEX     0x80
  23.  
  24. /*
  25.  * Function prototypes:
  26.  */
  27. int  isalnum(int);
  28. int  isalpha(int);
  29. int  isascii(int);
  30. int  iscntrl(int);
  31. int  iscsym(int);
  32. int  iscsymf(int);
  33. int  isdigit(int);
  34. int  isgraph(int);
  35. int  islower(int);
  36. int  isodigit(int);
  37. int  isprint(int);
  38. int  ispunct(int);
  39. int  isspace(int);
  40. int  isupper(int);
  41. int  isxdigit(int);
  42. int  toascii(int);
  43. int _tolower(int);
  44. int  tolower(int);
  45. int _toupper(int);
  46. int  toupper(int);
  47.  
  48. /*
  49.  * Macros for ctype functions:
  50.  */
  51. #if _FAR_CODE_ || _ROM_ || !_FAR_DATA_
  52.  
  53. extern const unsigned char _ctype[257];
  54.  
  55. #define isalnum(_c)  (_ctype[(unsigned char)(_c)] & (_DIGIT|_LOWER|_UPPER))
  56. #define isalpha(_c)  (_ctype[(unsigned char)(_c)] & (_LOWER|_UPPER))
  57. #define iscntrl(_c)  (_ctype[(unsigned char)(_c)] & (_CONTROL))
  58. #define isdigit(_c)  (_ctype[(unsigned char)(_c)] & (_DIGIT))
  59. #define isgraph(_c)  (_ctype[(unsigned char)(_c)] & (_DIGIT|_LOWER|_PUNCT|_UPPER))
  60. #define islower(_c)  (_ctype[(unsigned char)(_c)] & (_LOWER))
  61. #define isprint(_c)  (_ctype[(unsigned char)(_c)] & (_DIGIT|_LOWER|_PUNCT|_BLANK|_UPPER))
  62. #define ispunct(_c)  (_ctype[(unsigned char)(_c)] & (_PUNCT))
  63. #define isspace(_c)  (_ctype[(unsigned char)(_c)] & (_SPACE))
  64. #define isupper(_c)  (_ctype[(unsigned char)(_c)] & (_UPPER))
  65. #define isxdigit(_c) (_ctype[(unsigned char)(_c)] & (_HEX))
  66.  
  67. #endif
  68.  
  69. #define isascii(_c)  (int)((unsigned)(_c)<=0x7f)
  70. #define toascii(_c)  (int)((unsigned)(_c)&0x7f)
  71. #define _tolower(_c) ((_c)+'a'-'A')
  72. #define _toupper(_c) ((_c)+'A'-'a')
  73.  
  74. /*
  75.  * iscsym() and iscsymf() are only defined as macros:
  76.  */
  77. #define iscsym(_c)   ((isalnum(_c)) || (_c == '_'))
  78. #define iscsymf(_c)  ((isalpha(_c)) || (_c == '_'))
  79.  
  80. #endif /* _ctypeh */
  81.