wctype.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /**
  2. * This file has no copyright assigned and is placed in the Public Domain.
  3. * This file is part of the w64 mingw-runtime package.
  4. * No warranty is given; refer to the file DISCLAIMER within this package.
  5. */
  6. #ifndef _INC_WCTYPE
  7. #define _INC_WCTYPE
  8. #ifndef _WIN32
  9. #error Only Win32 target is supported!
  10. #endif
  11. #include <_mingw.h>
  12. #pragma pack(push,_CRT_PACKING)
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #ifndef _CRTIMP
  17. #define _CRTIMP __declspec(dllimport)
  18. #endif
  19. #ifndef _WCHAR_T_DEFINED
  20. typedef unsigned short wchar_t;
  21. #define _WCHAR_T_DEFINED
  22. #endif
  23. #ifndef _WCTYPE_T_DEFINED
  24. typedef unsigned short wint_t;
  25. typedef unsigned short wctype_t;
  26. #define _WCTYPE_T_DEFINED
  27. #endif
  28. #ifndef WEOF
  29. #define WEOF (wint_t)(0xFFFF)
  30. #endif
  31. #ifndef _CRT_CTYPEDATA_DEFINED
  32. #define _CRT_CTYPEDATA_DEFINED
  33. #ifndef _CTYPE_DISABLE_MACROS
  34. #ifndef __PCTYPE_FUNC
  35. #define __PCTYPE_FUNC __pctype_func()
  36. #ifdef _MSVCRT_
  37. #define __pctype_func() (_pctype)
  38. #else
  39. #define __pctype_func() (*_imp___pctype)
  40. #endif
  41. #endif
  42. #ifndef _pctype
  43. #ifdef _MSVCRT_
  44. extern unsigned short *_pctype;
  45. #else
  46. extern unsigned short **_imp___pctype;
  47. #define _pctype (*_imp___pctype)
  48. #endif
  49. #endif
  50. #endif
  51. #endif
  52. #ifndef _CRT_WCTYPEDATA_DEFINED
  53. #define _CRT_WCTYPEDATA_DEFINED
  54. #ifndef _CTYPE_DISABLE_MACROS
  55. #ifndef _wctype
  56. #ifdef _MSVCRT_
  57. extern unsigned short *_wctype;
  58. #else
  59. extern unsigned short **_imp___wctype;
  60. #define _wctype (*_imp___wctype)
  61. #endif
  62. #endif
  63. #ifndef _pwctype
  64. #ifdef _MSVCRT_
  65. extern unsigned short *_pwctype;
  66. #else
  67. extern unsigned short **_imp___pwctype;
  68. #define _pwctype (*_imp___pwctype)
  69. #define __pwctype_func() (*_imp___pwctype)
  70. #endif
  71. #endif
  72. #endif
  73. #endif
  74. #define _UPPER 0x1
  75. #define _LOWER 0x2
  76. #define _DIGIT 0x4
  77. #define _SPACE 0x8
  78. #define _PUNCT 0x10
  79. #define _CONTROL 0x20
  80. #define _BLANK 0x40
  81. #define _HEX 0x80
  82. #define _LEADBYTE 0x8000
  83. #define _ALPHA (0x0100|_UPPER|_LOWER)
  84. #ifndef _WCTYPE_DEFINED
  85. #define _WCTYPE_DEFINED
  86. int __cdecl iswalpha(wint_t);
  87. int __cdecl iswupper(wint_t);
  88. int __cdecl iswlower(wint_t);
  89. int __cdecl iswdigit(wint_t);
  90. int __cdecl iswxdigit(wint_t);
  91. int __cdecl iswspace(wint_t);
  92. int __cdecl iswpunct(wint_t);
  93. int __cdecl iswalnum(wint_t);
  94. int __cdecl iswprint(wint_t);
  95. int __cdecl iswgraph(wint_t);
  96. int __cdecl iswcntrl(wint_t);
  97. int __cdecl iswascii(wint_t);
  98. int __cdecl isleadbyte(int);
  99. wint_t __cdecl towupper(wint_t);
  100. wint_t __cdecl towlower(wint_t);
  101. int __cdecl iswctype(wint_t,wctype_t);
  102. _CRTIMP int __cdecl __iswcsymf(wint_t);
  103. _CRTIMP int __cdecl __iswcsym(wint_t);
  104. int __cdecl is_wctype(wint_t,wctype_t);
  105. #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES)
  106. int __cdecl isblank(int _C);
  107. #endif
  108. #endif
  109. #ifndef _WCTYPE_INLINE_DEFINED
  110. #define _WCTYPE_INLINE_DEFINED
  111. #ifndef __cplusplus
  112. #define iswalpha(_c) (iswctype(_c,_ALPHA))
  113. #define iswupper(_c) (iswctype(_c,_UPPER))
  114. #define iswlower(_c) (iswctype(_c,_LOWER))
  115. #define iswdigit(_c) (iswctype(_c,_DIGIT))
  116. #define iswxdigit(_c) (iswctype(_c,_HEX))
  117. #define iswspace(_c) (iswctype(_c,_SPACE))
  118. #define iswpunct(_c) (iswctype(_c,_PUNCT))
  119. #define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT))
  120. #define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT))
  121. #define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT))
  122. #define iswcntrl(_c) (iswctype(_c,_CONTROL))
  123. #define iswascii(_c) ((unsigned)(_c) < 0x80)
  124. #define isleadbyte(c) (__pctype_func()[(unsigned char)(c)] & _LEADBYTE)
  125. #else
  126. __CRT_INLINE int __cdecl iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); }
  127. __CRT_INLINE int __cdecl iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); }
  128. __CRT_INLINE int __cdecl iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); }
  129. __CRT_INLINE int __cdecl iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); }
  130. __CRT_INLINE int __cdecl iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); }
  131. __CRT_INLINE int __cdecl iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); }
  132. __CRT_INLINE int __cdecl iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); }
  133. __CRT_INLINE int __cdecl iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); }
  134. __CRT_INLINE int __cdecl iswprint(wint_t _C) {return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); }
  135. __CRT_INLINE int __cdecl iswgraph(wint_t _C) {return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); }
  136. __CRT_INLINE int __cdecl iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); }
  137. __CRT_INLINE int __cdecl iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); }
  138. __CRT_INLINE int __cdecl isleadbyte(int _C) {return (__pctype_func()[(unsigned char)(_C)] & _LEADBYTE); }
  139. #endif
  140. #endif
  141. typedef wchar_t wctrans_t;
  142. wint_t __cdecl towctrans(wint_t,wctrans_t);
  143. wctrans_t __cdecl wctrans(const char *);
  144. wctype_t __cdecl wctype(const char *);
  145. #ifdef __cplusplus
  146. }
  147. #endif
  148. #pragma pack(pop)
  149. #endif