wctype.h 5.2 KB

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