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