ctype.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Copyright (c) 1999
  3. * Boris Fomitchev
  4. *
  5. * This material is provided "as is", with absolutely no warranty expressed
  6. * or implied. Any use is at your own risk.
  7. *
  8. * Permission to use or copy this software for any purpose is hereby granted
  9. * without fee, provided the above notices are retained on all copies.
  10. * Permission to modify the code and to distribute modified code is granted,
  11. * provided the above notices are retained, and a notice that the code was
  12. * modified is included with the above copyright notice.
  13. *
  14. */
  15. #ifndef _STLP_CTYPE_H
  16. /* Workaround for a "misbehaviour" when compiling resource scripts using
  17. * eMbedded Visual C++. The standard .rc file includes windows header files,
  18. * which in turn include ctype.h, which results in warnings and errors
  19. */
  20. #if !defined(RC_INVOKED)
  21. # if !defined (_STLP_OUTERMOST_HEADER_ID)
  22. # define _STLP_OUTERMOST_HEADER_ID 0x219
  23. # include <stl/_prolog.h>
  24. # elif (_STLP_OUTERMOST_HEADER_ID == 0x219)
  25. # define _STLP_DONT_POP_HEADER_ID
  26. # define _STLP_CTYPE_H
  27. # endif
  28. # if defined(_STLP_WCE_EVC3)
  29. struct _exception;
  30. # endif
  31. # if defined (_STLP_HAS_INCLUDE_NEXT)
  32. # include_next <ctype.h>
  33. # else
  34. # include _STLP_NATIVE_C_HEADER(ctype.h)
  35. # endif
  36. /* on evc4 including ctype.h also defines setjmp macro */
  37. # if defined (_STLP_WCE)
  38. # define _STLP_NATIVE_SETJMP_H_INCLUDED
  39. # endif
  40. # ifndef _STLP_CTYPE_H_SEEN
  41. # define _STLP_CTYPE_H_SEEN
  42. /* Undef convenience interfaces */
  43. # undef isspace
  44. # undef isprint
  45. # undef iscntrl
  46. # undef isupper
  47. # undef islower
  48. # undef isalpha
  49. # undef isdigit
  50. # undef ispunct
  51. # undef isxdigit
  52. # undef isalnum
  53. # undef isgraph
  54. # undef toupper
  55. # undef tolower
  56. # if defined (UNDER_CE)
  57. # if (_WIN32_WCE < 300) /* Only wide chars for older versions */
  58. # define _isctype iswctype
  59. # endif
  60. __inline int (isalpha)(int c) { return _isctype(c, _ALPHA); }
  61. __inline int (isupper)(int c) { return _isctype(c, _UPPER); }
  62. __inline int (islower)(int c) { return _isctype(c, _LOWER); }
  63. __inline int (isdigit)(int c) { return _isctype(c, _DIGIT); }
  64. __inline int (isxdigit)(int c) { return _isctype(c, _HEX); }
  65. __inline int (isspace)(int c) { return _isctype(c, _SPACE); }
  66. __inline int (ispunct)(int c) { return _isctype(c, _PUNCT); }
  67. __inline int (isalnum)(int c) { return _isctype(c, _ALPHA|_DIGIT); }
  68. __inline int (isprint)(int c) { return _isctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); }
  69. __inline int (isgraph)(int c) { return _isctype(c, _PUNCT|_ALPHA|_DIGIT); }
  70. __inline int (iscntrl)(int c) { return _isctype(c, _CONTROL); }
  71. __inline int (isascii)(int c) { return ((unsigned)(c) < 0x80); }
  72. # undef _isctype
  73. __inline int (iswalpha)(int c) { return iswctype((unsigned short)(c), _ALPHA); }
  74. __inline int (iswupper)(int c) { return iswctype((unsigned short)(c), _UPPER); }
  75. __inline int (iswlower)(int c) { return iswctype((unsigned short)(c), _LOWER); }
  76. __inline int (iswdigit)(int c) { return iswctype((unsigned short)(c), _DIGIT); }
  77. __inline int (iswxdigit)(int c) { return iswctype((unsigned short)(c), _HEX); }
  78. __inline int (iswspace)(int c) { return iswctype((unsigned short)(c), _SPACE); }
  79. __inline int (iswpunct)(int c) { return iswctype((unsigned short)(c), _PUNCT); }
  80. __inline int (iswalnum)(int c) { return iswctype((unsigned short)(c), _ALPHA|_DIGIT); }
  81. __inline int (iswprint)(int c) { return iswctype((unsigned short)(c), _BLANK|_PUNCT|_ALPHA|_DIGIT); }
  82. __inline int (iswgraph)(int c) { return iswctype((unsigned short)(c), _PUNCT|_ALPHA|_DIGIT); }
  83. __inline int (iswcntrl)(int c) { return iswctype((unsigned short)(c), _CONTROL); }
  84. __inline int (iswascii)(int c) { return ((unsigned)(c) < 0x80); }
  85. # endif /* UNDER_CE */
  86. # endif /* _STLP_CTYPE_H_SEEN */
  87. # if (_STLP_OUTERMOST_HEADER_ID == 0x219)
  88. # if ! defined (_STLP_DONT_POP_HEADER_ID)
  89. # include <stl/_epilog.h>
  90. # undef _STLP_OUTERMOST_HEADER_ID
  91. # else
  92. # undef _STLP_DONT_POP_HEADER_ID
  93. # endif
  94. # endif
  95. #endif /* RC_INVOKED */
  96. #endif /* _STLP_CTYPE_H */