| 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_CTYPE
|
|---|
| 7 | #define _INC_CTYPE
|
|---|
| 8 |
|
|---|
| 9 | #include <crtdefs.h>
|
|---|
| 10 |
|
|---|
| 11 | #ifdef __cplusplus
|
|---|
| 12 | extern "C" {
|
|---|
| 13 | #endif
|
|---|
| 14 |
|
|---|
| 15 | #ifndef WEOF
|
|---|
| 16 | #define WEOF (wint_t)(0xFFFF)
|
|---|
| 17 | #endif
|
|---|
| 18 |
|
|---|
| 19 | #ifndef _CRT_CTYPEDATA_DEFINED
|
|---|
| 20 | #define _CRT_CTYPEDATA_DEFINED
|
|---|
| 21 | #ifndef _CTYPE_DISABLE_MACROS
|
|---|
| 22 |
|
|---|
| 23 | #ifndef __PCTYPE_FUNC
|
|---|
| 24 | #define __PCTYPE_FUNC __pctype_func()
|
|---|
| 25 | #ifdef _MSVCRT_
|
|---|
| 26 | #define __pctype_func() (_pctype)
|
|---|
| 27 | #else
|
|---|
| 28 | #ifdef _UCRT
|
|---|
| 29 | _CRTIMP unsigned short* __pctype_func(void);
|
|---|
| 30 | #else
|
|---|
| 31 | #define __pctype_func() (* __MINGW_IMP_SYMBOL(_pctype))
|
|---|
| 32 | #endif
|
|---|
| 33 | #endif
|
|---|
| 34 | #endif
|
|---|
| 35 |
|
|---|
| 36 | #ifndef _pctype
|
|---|
| 37 | #ifdef _MSVCRT_
|
|---|
| 38 | extern unsigned short *_pctype;
|
|---|
| 39 | #else
|
|---|
| 40 | #ifdef _UCRT
|
|---|
| 41 | #define _pctype (__pctype_func())
|
|---|
| 42 | #else
|
|---|
| 43 | extern unsigned short ** __MINGW_IMP_SYMBOL(_pctype);
|
|---|
| 44 | #define _pctype (* __MINGW_IMP_SYMBOL(_pctype))
|
|---|
| 45 | #endif
|
|---|
| 46 | #endif
|
|---|
| 47 | #endif
|
|---|
| 48 |
|
|---|
| 49 | #endif
|
|---|
| 50 | #endif
|
|---|
| 51 |
|
|---|
| 52 | #ifndef _CRT_WCTYPEDATA_DEFINED
|
|---|
| 53 | #define _CRT_WCTYPEDATA_DEFINED
|
|---|
| 54 | #ifndef _CTYPE_DISABLE_MACROS
|
|---|
| 55 | #if !defined(_wctype) && defined(_CRT_USE_WINAPI_FAMILY_DESKTOP_APP)
|
|---|
| 56 | #ifdef _MSVCRT_
|
|---|
| 57 | extern unsigned short *_wctype;
|
|---|
| 58 | #else
|
|---|
| 59 | extern unsigned short ** __MINGW_IMP_SYMBOL(_wctype);
|
|---|
| 60 | #define _wctype (* __MINGW_IMP_SYMBOL(_wctype))
|
|---|
| 61 | #endif
|
|---|
| 62 | #endif
|
|---|
| 63 | #ifdef _MSVCRT_
|
|---|
| 64 | #define __pwctype_func() (_pwctype)
|
|---|
| 65 | #ifndef _pwctype
|
|---|
| 66 | extern unsigned short *_pwctype;
|
|---|
| 67 | #endif
|
|---|
| 68 | #else
|
|---|
| 69 | #define __pwctype_func() (* __MINGW_IMP_SYMBOL(_pwctype))
|
|---|
| 70 | #ifndef _pwctype
|
|---|
| 71 | extern unsigned short ** __MINGW_IMP_SYMBOL(_pwctype);
|
|---|
| 72 | #define _pwctype (* __MINGW_IMP_SYMBOL(_pwctype))
|
|---|
| 73 | #endif
|
|---|
| 74 | #endif
|
|---|
| 75 | #endif
|
|---|
| 76 | #endif
|
|---|
| 77 |
|
|---|
| 78 | /* CRT stuff */
|
|---|
| 79 | #if 1
|
|---|
| 80 | extern const unsigned char __newclmap[];
|
|---|
| 81 | extern const unsigned char __newcumap[];
|
|---|
| 82 | extern pthreadlocinfo __ptlocinfo;
|
|---|
| 83 | extern pthreadmbcinfo __ptmbcinfo;
|
|---|
| 84 | extern int __globallocalestatus;
|
|---|
| 85 | extern int __locale_changed;
|
|---|
| 86 | extern struct threadlocaleinfostruct __initiallocinfo;
|
|---|
| 87 | extern _locale_tstruct __initiallocalestructinfo;
|
|---|
| 88 | pthreadlocinfo __cdecl __updatetlocinfo(void);
|
|---|
| 89 | pthreadmbcinfo __cdecl __updatetmbcinfo(void);
|
|---|
| 90 | #endif
|
|---|
| 91 |
|
|---|
| 92 | #define _UPPER 0x1
|
|---|
| 93 | #define _LOWER 0x2
|
|---|
| 94 | #define _DIGIT 0x4
|
|---|
| 95 | #define _SPACE 0x8
|
|---|
| 96 |
|
|---|
| 97 | #define _PUNCT 0x10
|
|---|
| 98 | #define _CONTROL 0x20
|
|---|
| 99 | #define _BLANK 0x40
|
|---|
| 100 | #define _HEX 0x80
|
|---|
| 101 |
|
|---|
| 102 | #define _LEADBYTE 0x8000
|
|---|
| 103 | #define _ALPHA (0x0100|_UPPER|_LOWER)
|
|---|
| 104 |
|
|---|
| 105 | #ifndef _CTYPE_DEFINED
|
|---|
| 106 | #define _CTYPE_DEFINED
|
|---|
| 107 |
|
|---|
| 108 | _CRTIMP int __cdecl _isctype(int _C,int _Type);
|
|---|
| 109 | _CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale);
|
|---|
| 110 | _CRTIMP int __cdecl isalpha(int _C);
|
|---|
| 111 | _CRTIMP int __cdecl _isalpha_l(int _C,_locale_t _Locale);
|
|---|
| 112 | _CRTIMP int __cdecl isupper(int _C);
|
|---|
| 113 | _CRTIMP int __cdecl _isupper_l(int _C,_locale_t _Locale);
|
|---|
| 114 | _CRTIMP int __cdecl islower(int _C);
|
|---|
| 115 | _CRTIMP int __cdecl _islower_l(int _C,_locale_t _Locale);
|
|---|
| 116 | _CRTIMP int __cdecl isdigit(int _C);
|
|---|
| 117 | _CRTIMP int __cdecl _isdigit_l(int _C,_locale_t _Locale);
|
|---|
| 118 | _CRTIMP int __cdecl isxdigit(int _C);
|
|---|
| 119 | _CRTIMP int __cdecl _isxdigit_l(int _C,_locale_t _Locale);
|
|---|
| 120 | _CRTIMP int __cdecl isspace(int _C);
|
|---|
| 121 | _CRTIMP int __cdecl _isspace_l(int _C,_locale_t _Locale);
|
|---|
| 122 | _CRTIMP int __cdecl ispunct(int _C);
|
|---|
| 123 | _CRTIMP int __cdecl _ispunct_l(int _C,_locale_t _Locale);
|
|---|
| 124 | _CRTIMP int __cdecl isalnum(int _C);
|
|---|
| 125 | _CRTIMP int __cdecl _isalnum_l(int _C,_locale_t _Locale);
|
|---|
| 126 | _CRTIMP int __cdecl isprint(int _C);
|
|---|
| 127 | _CRTIMP int __cdecl _isprint_l(int _C,_locale_t _Locale);
|
|---|
| 128 | _CRTIMP int __cdecl isgraph(int _C);
|
|---|
| 129 | _CRTIMP int __cdecl _isgraph_l(int _C,_locale_t _Locale);
|
|---|
| 130 | _CRTIMP int __cdecl iscntrl(int _C);
|
|---|
| 131 | _CRTIMP int __cdecl _iscntrl_l(int _C,_locale_t _Locale);
|
|---|
| 132 | _CRTIMP int __cdecl toupper(int _C);
|
|---|
| 133 | _CRTIMP int __cdecl tolower(int _C);
|
|---|
| 134 | _CRTIMP int __cdecl _tolower(int _C);
|
|---|
| 135 | _CRTIMP int __cdecl _tolower_l(int _C,_locale_t _Locale);
|
|---|
| 136 | _CRTIMP int __cdecl _toupper(int _C);
|
|---|
| 137 | _CRTIMP int __cdecl _toupper_l(int _C,_locale_t _Locale);
|
|---|
| 138 | _CRTIMP int __cdecl __isascii(int _C);
|
|---|
| 139 | _CRTIMP int __cdecl __toascii(int _C);
|
|---|
| 140 | _CRTIMP int __cdecl __iscsymf(int _C);
|
|---|
| 141 | _CRTIMP int __cdecl __iscsym(int _C);
|
|---|
| 142 |
|
|---|
| 143 | #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) || defined (__cplusplus)
|
|---|
| 144 | int __cdecl isblank(int _C);
|
|---|
| 145 | #endif
|
|---|
| 146 | #endif
|
|---|
| 147 |
|
|---|
| 148 | #ifndef _WCTYPE_DEFINED
|
|---|
| 149 | #define _WCTYPE_DEFINED
|
|---|
| 150 |
|
|---|
| 151 | int __cdecl iswalpha(wint_t _C);
|
|---|
| 152 | _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale);
|
|---|
| 153 | int __cdecl iswupper(wint_t _C);
|
|---|
| 154 | _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale);
|
|---|
| 155 | int __cdecl iswlower(wint_t _C);
|
|---|
| 156 | _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale);
|
|---|
| 157 | int __cdecl iswdigit(wint_t _C);
|
|---|
| 158 | _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale);
|
|---|
| 159 | int __cdecl iswxdigit(wint_t _C);
|
|---|
| 160 | _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale);
|
|---|
| 161 | int __cdecl iswspace(wint_t _C);
|
|---|
| 162 | _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale);
|
|---|
| 163 | int __cdecl iswpunct(wint_t _C);
|
|---|
| 164 | _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale);
|
|---|
| 165 | int __cdecl iswalnum(wint_t _C);
|
|---|
| 166 | _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale);
|
|---|
| 167 | int __cdecl iswprint(wint_t _C);
|
|---|
| 168 | _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale);
|
|---|
| 169 | int __cdecl iswgraph(wint_t _C);
|
|---|
| 170 | _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale);
|
|---|
| 171 | int __cdecl iswcntrl(wint_t _C);
|
|---|
| 172 | _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale);
|
|---|
| 173 | int __cdecl iswascii(wint_t _C);
|
|---|
| 174 | #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
|
|---|
| 175 | int __cdecl isleadbyte(int _C);
|
|---|
| 176 | _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale);
|
|---|
| 177 | #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */
|
|---|
| 178 | wint_t __cdecl towupper(wint_t _C);
|
|---|
| 179 | _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale);
|
|---|
| 180 | wint_t __cdecl towlower(wint_t _C);
|
|---|
| 181 | _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale);
|
|---|
| 182 | int __cdecl iswctype(wint_t _C,wctype_t _Type);
|
|---|
| 183 | #if __MSVCRT_VERSION__ >= 0x800
|
|---|
| 184 | _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale);
|
|---|
| 185 | _CRTIMP int __cdecl __iswcsymf(wint_t _C);
|
|---|
| 186 | _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale);
|
|---|
| 187 | _CRTIMP int __cdecl __iswcsym(wint_t _C);
|
|---|
| 188 | _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale);
|
|---|
| 189 | #endif
|
|---|
| 190 | #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
|
|---|
| 191 | int __cdecl is_wctype(wint_t _C,wctype_t _Type);
|
|---|
| 192 | #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */
|
|---|
| 193 |
|
|---|
| 194 | #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) || defined (__cplusplus)
|
|---|
| 195 | int __cdecl iswblank(wint_t _C);
|
|---|
| 196 | #endif
|
|---|
| 197 | #endif
|
|---|
| 198 |
|
|---|
| 199 | #ifndef _CTYPE_DISABLE_MACROS
|
|---|
| 200 |
|
|---|
| 201 | #ifndef MB_CUR_MAX
|
|---|
| 202 | #define MB_CUR_MAX ___mb_cur_max_func()
|
|---|
| 203 | #ifndef __mb_cur_max
|
|---|
| 204 | #ifdef _MSVCRT_
|
|---|
| 205 | extern int __mb_cur_max;
|
|---|
| 206 | #define __mb_cur_max __mb_cur_max
|
|---|
| 207 | #else
|
|---|
| 208 | #ifndef _UCRT
|
|---|
| 209 | extern int * __MINGW_IMP_SYMBOL(__mb_cur_max);
|
|---|
| 210 | #endif
|
|---|
| 211 | #define __mb_cur_max (___mb_cur_max_func())
|
|---|
| 212 | #endif
|
|---|
| 213 | #endif
|
|---|
| 214 | _CRTIMP int __cdecl ___mb_cur_max_func(void);
|
|---|
| 215 | #endif
|
|---|
| 216 |
|
|---|
| 217 | #define __chvalidchk(a,b) (__PCTYPE_FUNC[(unsigned char)(a)] & (b))
|
|---|
| 218 | #ifdef _UCRT
|
|---|
| 219 | #define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->_locale_pctype[(unsigned char)(_Char)] & (_Flag))
|
|---|
| 220 | #define _ischartype_l(_Char,_Flag,_Locale) (((_Locale)!=NULL && (((_locale_t)(_Locale))->locinfo->_locale_mb_cur_max) > 1) ? _isctype_l(_Char,(_Flag),_Locale) : _chvalidchk_l(_Char,_Flag,_Locale))
|
|---|
| 221 | #else
|
|---|
| 222 | #define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->pctype[(unsigned char)(_Char)] & (_Flag))
|
|---|
| 223 | #define _ischartype_l(_Char,_Flag,_Locale) (((_Locale)!=NULL && (((_locale_t)(_Locale))->locinfo->mb_cur_max) > 1) ? _isctype_l(_Char,(_Flag),_Locale) : _chvalidchk_l(_Char,_Flag,_Locale))
|
|---|
| 224 | #endif
|
|---|
| 225 | #define _isalpha_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA,_Locale)
|
|---|
| 226 | #define _isupper_l(_Char,_Locale) _ischartype_l(_Char,_UPPER,_Locale)
|
|---|
| 227 | #define _islower_l(_Char,_Locale) _ischartype_l(_Char,_LOWER,_Locale)
|
|---|
| 228 | #define _isdigit_l(_Char,_Locale) _ischartype_l(_Char,_DIGIT,_Locale)
|
|---|
| 229 | #define _isxdigit_l(_Char,_Locale) _ischartype_l(_Char,_HEX,_Locale)
|
|---|
| 230 | #define _isspace_l(_Char,_Locale) _ischartype_l(_Char,_SPACE,_Locale)
|
|---|
| 231 | #define _ispunct_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT,_Locale)
|
|---|
| 232 | #define _isalnum_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA|_DIGIT,_Locale)
|
|---|
| 233 | #define _isprint_l(_Char,_Locale) _ischartype_l(_Char,_BLANK|_PUNCT|_ALPHA|_DIGIT,_Locale)
|
|---|
| 234 | #define _isgraph_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT|_ALPHA|_DIGIT,_Locale)
|
|---|
| 235 | #define _iscntrl_l(_Char,_Locale) _ischartype_l(_Char,_CONTROL,_Locale)
|
|---|
| 236 | #define _tolower(_Char) ((_Char)-'A'+'a')
|
|---|
| 237 | #define _toupper(_Char) ((_Char)-'a'+'A')
|
|---|
| 238 | #define __isascii(_Char) ((unsigned)(_Char) < 0x80)
|
|---|
| 239 | #define __toascii(_Char) ((_Char) & 0x7f)
|
|---|
| 240 |
|
|---|
| 241 | #ifndef _WCTYPE_INLINE_DEFINED
|
|---|
| 242 | #define _WCTYPE_INLINE_DEFINED
|
|---|
| 243 |
|
|---|
| 244 | #undef _CRT_WCTYPE_NOINLINE
|
|---|
| 245 | #ifndef __cplusplus
|
|---|
| 246 | #define iswalpha(_c) (iswctype(_c,_ALPHA))
|
|---|
| 247 | #define iswupper(_c) (iswctype(_c,_UPPER))
|
|---|
| 248 | #define iswlower(_c) (iswctype(_c,_LOWER))
|
|---|
| 249 | #define iswdigit(_c) (iswctype(_c,_DIGIT))
|
|---|
| 250 | #define iswxdigit(_c) (iswctype(_c,_HEX))
|
|---|
| 251 | #define iswspace(_c) (iswctype(_c,_SPACE))
|
|---|
| 252 | #define iswpunct(_c) (iswctype(_c,_PUNCT))
|
|---|
| 253 | #define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT))
|
|---|
| 254 | #define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT))
|
|---|
| 255 | #define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT))
|
|---|
| 256 | #define iswcntrl(_c) (iswctype(_c,_CONTROL))
|
|---|
| 257 | #define iswascii(_c) ((unsigned)(_c) < 0x80)
|
|---|
| 258 | #define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p))
|
|---|
| 259 | #define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p))
|
|---|
| 260 | #define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p))
|
|---|
| 261 | #define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p))
|
|---|
| 262 | #define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p))
|
|---|
| 263 | #define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p))
|
|---|
| 264 | #define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p))
|
|---|
| 265 | #define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p))
|
|---|
| 266 | #define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p))
|
|---|
| 267 | #define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p))
|
|---|
| 268 | #define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p))
|
|---|
| 269 | #endif
|
|---|
| 270 | #endif
|
|---|
| 271 |
|
|---|
| 272 | #define __iscsymf(_c) (isalpha(_c) || ((_c)=='_'))
|
|---|
| 273 | #define __iscsym(_c) (isalnum(_c) || ((_c)=='_'))
|
|---|
| 274 | #define __iswcsymf(_c) (iswalpha(_c) || ((_c)=='_'))
|
|---|
| 275 | #define __iswcsym(_c) (iswalnum(_c) || ((_c)=='_'))
|
|---|
| 276 | #define _iscsymf_l(_c,_p) (_isalpha_l(_c,_p) || ((_c)=='_'))
|
|---|
| 277 | #define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_'))
|
|---|
| 278 | #define _iswcsymf_l(_c,_p) (_iswalpha_l(_c,_p) || ((_c)=='_'))
|
|---|
| 279 | #define _iswcsym_l(_c,_p) (_iswalnum_l(_c,_p) || ((_c)=='_'))
|
|---|
| 280 | #endif
|
|---|
| 281 |
|
|---|
| 282 | #ifndef NO_OLDNAMES
|
|---|
| 283 | #ifndef _CTYPE_DEFINED
|
|---|
| 284 | int __cdecl isascii(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
|
|---|
| 285 | int __cdecl toascii(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
|
|---|
| 286 | int __cdecl iscsymf(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
|
|---|
| 287 | int __cdecl iscsym(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
|
|---|
| 288 | #else
|
|---|
| 289 | #define isascii __isascii
|
|---|
| 290 | #define toascii __toascii
|
|---|
| 291 | #define iscsymf __iscsymf
|
|---|
| 292 | #define iscsym __iscsym
|
|---|
| 293 | #endif
|
|---|
| 294 | #endif
|
|---|
| 295 |
|
|---|
| 296 | #ifdef __cplusplus
|
|---|
| 297 | }
|
|---|
| 298 | #endif
|
|---|
| 299 | #endif
|
|---|