ctype.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:3k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* ctype.h - ANSI standard ctype functions header */
  2. /* Copyright 1992 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01h,30nov01,f_b  Remove is*() macros when compiling in C++ mode
  7. 01g,19aug93,dvs  added outside parens for __toupper & __tolower (SPR #2340)
  8. 01f,25jan93,smb  added __STDC__ wrapper for __ctype table, SPR 1924.
  9. 01e,22sep92,rrr  added support for c++
  10. 01d,19aug92,smb  fixed SPR #1471, toupper & tolower checks for valid argument.
  11. 01d,11jul92,smb  reversed order of function decl. and defines.
  12. 01c,11jul92,smb  added __STDC__.
  13. 01b,04jul92,jcf  cleaned up.
  14. 01a,03jul92,smb  written
  15. */
  16. #ifndef __INCctypeh
  17. #define __INCctypeh
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #include "types/vxANSI.h"
  22. #if defined(__STDC__) || defined(__cplusplus)
  23. extern int      isalnum(int __c);
  24. extern int      isalpha(int __c);
  25. extern int      iscntrl(int __c);
  26. extern int      isdigit(int __c);
  27. extern int      isgraph(int __c);
  28. extern int      islower(int __c);
  29. extern int      isprint(int __c);
  30. extern int      ispunct(int __c);
  31. extern int      isspace(int __c);
  32. extern int      isupper(int __c);
  33. extern int      isxdigit(int __c);
  34. extern int      tolower(int __c);
  35. extern int      toupper(int __c);
  36. #else   /* __STDC__ */
  37. extern int      isalnum();
  38. extern int      isalpha();
  39. extern int      iscntrl();
  40. extern int      isdigit();
  41. extern int      isgraph();
  42. extern int      islower();
  43. extern int      isprint();
  44. extern int      ispunct();
  45. extern int      isspace();
  46. extern int      isupper();
  47. extern int      isxdigit();
  48. extern int      tolower();
  49. extern int      toupper();
  50. #endif  /* __STDC__ */
  51. #define _C_UPPER         0x1
  52. #define _C_LOWER         0x2
  53. #define _C_NUMBER        0x4
  54. #define _C_WHITE_SPACE   0x8
  55. #define _C_PUNCT         0x10
  56. #define _C_CONTROL       0x20
  57. #define _C_HEX_NUMBER    0x40
  58. #define _C_B             0x80
  59. #if defined(__STDC__) || defined(__cplusplus)
  60. extern  const unsigned char *__ctype;
  61. #else   /* __STDC__ */
  62. extern  unsigned char *__ctype;
  63. #endif  /* __STDC__ */
  64. #define __isalpha(c)    (__ctype[c] & (_C_UPPER | _C_LOWER))
  65. #define __isupper(c)    (__ctype[c] & (_C_UPPER))
  66. #define __islower(c)    (__ctype[c] & (_C_LOWER))
  67. #define __isdigit(c)    (__ctype[c] & (_C_NUMBER))
  68. #define __isxdigit(c)   (__ctype[c] & (_C_HEX_NUMBER))
  69. #define __isspace(c)    (__ctype[c] & (_C_WHITE_SPACE | _C_CONTROL))
  70. #define __ispunct(c)    (__ctype[c] & (_C_PUNCT))
  71. #define __isalnum(c)    (__ctype[c] & (_C_UPPER | _C_LOWER | _C_NUMBER))
  72. #define __isprint(c)    (__ctype[c] & (_C_PUNCT | _C_UPPER | _C_LOWER | 
  73.        _C_WHITE_SPACE | _C_NUMBER))
  74. #define __isgraph(c)    (__ctype[c] & (_C_PUNCT | _C_UPPER | _C_LOWER | 
  75.        _C_NUMBER))
  76. #define __iscntrl(c)    (__ctype[c] & (_C_CONTROL | _C_B))
  77. #define __toupper(c)    ((('a' <= (c))&&((c) <= 'z')) ? ((c) - 'a' + 'A') : (c))
  78. #define __tolower(c)    ((('A' <= (c))&&((c) <= 'Z')) ? ((c) - 'A' + 'a') : (c))
  79. #ifndef __cplusplus
  80. #define isalpha(c)      __isalpha(c)
  81. #define isupper(c)      __isupper(c)
  82. #define islower(c)      __islower(c)
  83. #define isdigit(c)      __isdigit(c)
  84. #define isxdigit(c)     __isxdigit(c)
  85. #define isspace(c)      __isspace(c)
  86. #define ispunct(c)      __ispunct(c)
  87. #define isalnum(c)      __isalnum(c)
  88. #define isprint(c)      __isprint(c)
  89. #define isgraph(c)      __isgraph(c)
  90. #define iscntrl(c)      __iscntrl(c)
  91. #define toupper(c)      __toupper(c)
  92. #define tolower(c)      __tolower(c)
  93. #endif
  94. #ifdef __cplusplus
  95. }
  96. #endif
  97. #endif /* __INCctypeh */