1 #include <string.h>
2 #undef __MINGW_IMPORT
3 #define __MINGW_IMPORT
4 #include <ctype.h>
5
6 #ifndef _LIBCNT_
7 #include <precomp.h>
8 #endif
9
10 #undef _pctype
11 #undef _pwctype
12
13 /* MS's CRT header defines all that, and we actually implement that */
14 #undef iswalnum
15 #undef __isascii
16 #undef iswascii
17 #undef __iscsym
18 #undef __iscsymf
19 #undef iswalpha
20 #undef iswcntrl
21 #undef iswdigit
22 #undef iswgraph
23 #undef iswprint
24 #undef iswpunct
25 #undef iswlower
26 #undef iswupper
27 #undef iswspace
28 #undef iswxdigit
29 #undef __toascii
30 #undef _tolower
31 #undef _toupper
32
33 #define upalpha ('A' - 'a')
34
35
36 const unsigned short _ctype[] = {
37 0, /* <EOF>, 0xFFFF */
38 _CONTROL, /* CTRL+@, 0x00 */
39 _CONTROL, /* CTRL+A, 0x01 */
40 _CONTROL, /* CTRL+B, 0x02 */
41 _CONTROL, /* CTRL+C, 0x03 */
42 _CONTROL, /* CTRL+D, 0x04 */
43 _CONTROL, /* CTRL+E, 0x05 */
44 _CONTROL, /* CTRL+F, 0x06 */
45 _CONTROL, /* CTRL+G, 0x07 */
46 _CONTROL, /* CTRL+H, 0x08 */
47 _CONTROL | _SPACE, /* CTRL+I, 0x09 */
48 _CONTROL | _SPACE, /* CTRL+J, 0x0a */
49 _CONTROL | _SPACE, /* CTRL+K, 0x0b */
50 _CONTROL | _SPACE, /* CTRL+L, 0x0c */
51 _CONTROL | _SPACE, /* CTRL+M, 0x0d */
52 _CONTROL, /* CTRL+N, 0x0e */
53 _CONTROL, /* CTRL+O, 0x0f */
54 _CONTROL, /* CTRL+P, 0x10 */
55 _CONTROL, /* CTRL+Q, 0x11 */
56 _CONTROL, /* CTRL+R, 0x12 */
57 _CONTROL, /* CTRL+S, 0x13 */
58 _CONTROL, /* CTRL+T, 0x14 */
59 _CONTROL, /* CTRL+U, 0x15 */
60 _CONTROL, /* CTRL+V, 0x16 */
61 _CONTROL, /* CTRL+W, 0x17 */
62 _CONTROL, /* CTRL+X, 0x18 */
63 _CONTROL, /* CTRL+Y, 0x19 */
64 _CONTROL, /* CTRL+Z, 0x1a */
65 _CONTROL, /* CTRL+[, 0x1b */
66 _CONTROL, /* CTRL+\, 0x1c */
67 _CONTROL, /* CTRL+], 0x1d */
68 _CONTROL, /* CTRL+^, 0x1e */
69 _CONTROL, /* CTRL+_, 0x1f */
70 _SPACE | _BLANK, /* ` ', 0x20 */
71 _PUNCT, /* `!', 0x21 */
72 _PUNCT, /* 0x22 */
73 _PUNCT, /* `#', 0x23 */
74 _PUNCT, /* `$', 0x24 */
75 _PUNCT, /* `%', 0x25 */
76 _PUNCT, /* `&', 0x26 */
77 _PUNCT, /* 0x27 */
78 _PUNCT, /* `(', 0x28 */
79 _PUNCT, /* `)', 0x29 */
80 _PUNCT, /* `*', 0x2a */
81 _PUNCT, /* `+', 0x2b */
82 _PUNCT, /* `,', 0x2c */
83 _PUNCT, /* `-', 0x2d */
84 _PUNCT, /* `.', 0x2e */
85 _PUNCT, /* `/', 0x2f */
86 _DIGIT | _HEX, /* `0', 0x30 */
87 _DIGIT | _HEX, /* `1', 0x31 */
88 _DIGIT | _HEX, /* `2', 0x32 */
89 _DIGIT | _HEX, /* `3', 0x33 */
90 _DIGIT | _HEX, /* `4', 0x34 */
91 _DIGIT | _HEX, /* `5', 0x35 */
92 _DIGIT | _HEX, /* `6', 0x36 */
93 _DIGIT | _HEX, /* `7', 0x37 */
94 _DIGIT | _HEX, /* `8', 0x38 */
95 _DIGIT | _HEX, /* `9', 0x39 */
96 _PUNCT, /* `:', 0x3a */
97 _PUNCT, /* `;', 0x3b */
98 _PUNCT, /* `<', 0x3c */
99 _PUNCT, /* `=', 0x3d */
100 _PUNCT, /* `>', 0x3e */
101 _PUNCT, /* `?', 0x3f */
102 _PUNCT, /* `@', 0x40 */
103 _UPPER | _HEX, /* `A', 0x41 */
104 _UPPER | _HEX, /* `B', 0x42 */
105 _UPPER | _HEX, /* `C', 0x43 */
106 _UPPER | _HEX, /* `D', 0x44 */
107 _UPPER | _HEX, /* `E', 0x45 */
108 _UPPER | _HEX, /* `F', 0x46 */
109 _UPPER, /* `G', 0x47 */
110 _UPPER, /* `H', 0x48 */
111 _UPPER, /* `I', 0x49 */
112 _UPPER, /* `J', 0x4a */
113 _UPPER, /* `K', 0x4b */
114 _UPPER, /* `L', 0x4c */
115 _UPPER, /* `M', 0x4d */
116 _UPPER, /* `N', 0x4e */
117 _UPPER, /* `O', 0x4f */
118 _UPPER, /* `P', 0x50 */
119 _UPPER, /* `Q', 0x51 */
120 _UPPER, /* `R', 0x52 */
121 _UPPER, /* `S', 0x53 */
122 _UPPER, /* `T', 0x54 */
123 _UPPER, /* `U', 0x55 */
124 _UPPER, /* `V', 0x56 */
125 _UPPER, /* `W', 0x57 */
126 _UPPER, /* `X', 0x58 */
127 _UPPER, /* `Y', 0x59 */
128 _UPPER, /* `Z', 0x5a */
129 _PUNCT, /* `[', 0x5b */
130 _PUNCT, /* 0x5c */
131 _PUNCT, /* `]', 0x5d */
132 _PUNCT, /* `^', 0x5e */
133 _PUNCT, /* `_', 0x5f */
134 _PUNCT, /* 0x60 */
135 _LOWER | _HEX, /* `a', 0x61 */
136 _LOWER | _HEX, /* `b', 0x62 */
137 _LOWER | _HEX, /* `c', 0x63 */
138 _LOWER | _HEX, /* `d', 0x64 */
139 _LOWER | _HEX, /* `e', 0x65 */
140 _LOWER | _HEX, /* `f', 0x66 */
141 _LOWER, /* `g', 0x67 */
142 _LOWER, /* `h', 0x68 */
143 _LOWER, /* `i', 0x69 */
144 _LOWER, /* `j', 0x6a */
145 _LOWER, /* `k', 0x6b */
146 _LOWER, /* `l', 0x6c */
147 _LOWER, /* `m', 0x6d */
148 _LOWER, /* `n', 0x6e */
149 _LOWER, /* `o', 0x6f */
150 _LOWER, /* `p', 0x70 */
151 _LOWER, /* `q', 0x71 */
152 _LOWER, /* `r', 0x72 */
153 _LOWER, /* `s', 0x73 */
154 _LOWER, /* `t', 0x74 */
155 _LOWER, /* `u', 0x75 */
156 _LOWER, /* `v', 0x76 */
157 _LOWER, /* `w', 0x77 */
158 _LOWER, /* `x', 0x78 */
159 _LOWER, /* `y', 0x79 */
160 _LOWER, /* `z', 0x7a */
161 _PUNCT, /* `{', 0x7b */
162 _PUNCT, /* `|', 0x7c */
163 _PUNCT, /* `}', 0x7d */
164 _PUNCT, /* `~', 0x7e */
165 _CONTROL, /* 0x7f */
166 0, /* 0x80 */
167 0, /* 0x81 */
168 0, /* 0x82 */
169 0, /* 0x83 */
170 0, /* 0x84 */
171 0, /* 0x85 */
172 0, /* 0x86 */
173 0, /* 0x87 */
174 0, /* 0x88 */
175 0, /* 0x89 */
176 0, /* 0x8a */
177 0, /* 0x8b */
178 0, /* 0x8c */
179 0, /* 0x8d */
180 0, /* 0x8e */
181 0, /* 0x8f */
182 0, /* 0x90 */
183 0, /* 0x91 */
184 0, /* 0x92 */
185 0, /* 0x93 */
186 0, /* 0x94 */
187 0, /* 0x95 */
188 0, /* 0x96 */
189 0, /* 0x97 */
190 0, /* 0x98 */
191 0, /* 0x99 */
192 0, /* 0x9a */
193 0, /* 0x9b */
194 0, /* 0x9c */
195 0, /* 0x9d */
196 0, /* 0x9e */
197 0, /* 0x9f */
198 0, /* 0xa0 */
199 0, /* 0xa1 */
200 0, /* 0xa2 */
201 0, /* 0xa3 */
202 0, /* 0xa4 */
203 0, /* 0xa5 */
204 0, /* 0xa6 */
205 0, /* 0xa7 */
206 0, /* 0xa8 */
207 0, /* 0xa9 */
208 0, /* 0xaa */
209 0, /* 0xab */
210 0, /* 0xac */
211 0, /* 0xad */
212 0, /* 0xae */
213 0, /* 0xaf */
214 0, /* 0xb0 */
215 0, /* 0xb1 */
216 0, /* 0xb2 */
217 0, /* 0xb3 */
218 0, /* 0xb4 */
219 0, /* 0xb5 */
220 0, /* 0xb6 */
221 0, /* 0xb7 */
222 0, /* 0xb8 */
223 0, /* 0xb9 */
224 0, /* 0xba */
225 0, /* 0xbb */
226 0, /* 0xbc */
227 0, /* 0xbd */
228 0, /* 0xbe */
229 0, /* 0xbf */
230 0, /* 0xc0 */
231 0, /* 0xc1 */
232 0, /* 0xc2 */
233 0, /* 0xc3 */
234 0, /* 0xc4 */
235 0, /* 0xc5 */
236 0, /* 0xc6 */
237 0, /* 0xc7 */
238 0, /* 0xc8 */
239 0, /* 0xc9 */
240 0, /* 0xca */
241 0, /* 0xcb */
242 0, /* 0xcc */
243 0, /* 0xcd */
244 0, /* 0xce */
245 0, /* 0xcf */
246 0, /* 0xd0 */
247 0, /* 0xd1 */
248 0, /* 0xd2 */
249 0, /* 0xd3 */
250 0, /* 0xd4 */
251 0, /* 0xd5 */
252 0, /* 0xd6 */
253 0, /* 0xd7 */
254 0, /* 0xd8 */
255 0, /* 0xd9 */
256 0, /* 0xda */
257 0, /* 0xdb */
258 0, /* 0xdc */
259 0, /* 0xdd */
260 0, /* 0xde */
261 0, /* 0xdf */
262 0, /* 0xe0 */
263 0, /* 0xe1 */
264 0, /* 0xe2 */
265 0, /* 0xe3 */
266 0, /* 0xe4 */
267 0, /* 0xe5 */
268 0, /* 0xe6 */
269 0, /* 0xe7 */
270 0, /* 0xe8 */
271 0, /* 0xe9 */
272 0, /* 0xea */
273 0, /* 0xeb */
274 0, /* 0xec */
275 0, /* 0xed */
276 0, /* 0xee */
277 0, /* 0xef */
278 0, /* 0xf0 */
279 0, /* 0xf1 */
280 0, /* 0xf2 */
281 0, /* 0xf3 */
282 0, /* 0xf4 */
283 0, /* 0xf5 */
284 0, /* 0xf6 */
285 0, /* 0xf7 */
286 0, /* 0xf8 */
287 0, /* 0xf9 */
288 0, /* 0xfa */
289 0, /* 0xfb */
290 0, /* 0xfc */
291 0, /* 0xfd */
292 0, /* 0xfe */
293 0 /* 0xff */
294 };
295
296 const unsigned short _wctype[] = {
297 0, /* <EOF>, 0xFFFF */
298 _CONTROL, /* CTRL+@, 0x00 */
299 _CONTROL, /* CTRL+A, 0x01 */
300 _CONTROL, /* CTRL+B, 0x02 */
301 _CONTROL, /* CTRL+C, 0x03 */
302 _CONTROL, /* CTRL+D, 0x04 */
303 _CONTROL, /* CTRL+E, 0x05 */
304 _CONTROL, /* CTRL+F, 0x06 */
305 _CONTROL, /* CTRL+G, 0x07 */
306 _CONTROL, /* CTRL+H, 0x08 */
307 _BLANK | _CONTROL | _SPACE, /* CTRL+I, 0x09 */
308 _CONTROL | _SPACE, /* CTRL+J, 0x0a */
309 _CONTROL | _SPACE, /* CTRL+K, 0x0b */
310 _CONTROL | _SPACE, /* CTRL+L, 0x0c */
311 _CONTROL | _SPACE, /* CTRL+M, 0x0d */
312 _CONTROL, /* CTRL+N, 0x0e */
313 _CONTROL, /* CTRL+O, 0x0f */
314 _CONTROL, /* CTRL+P, 0x10 */
315 _CONTROL, /* CTRL+Q, 0x11 */
316 _CONTROL, /* CTRL+R, 0x12 */
317 _CONTROL, /* CTRL+S, 0x13 */
318 _CONTROL, /* CTRL+T, 0x14 */
319 _CONTROL, /* CTRL+U, 0x15 */
320 _CONTROL, /* CTRL+V, 0x16 */
321 _CONTROL, /* CTRL+W, 0x17 */
322 _CONTROL, /* CTRL+X, 0x18 */
323 _CONTROL, /* CTRL+Y, 0x19 */
324 _CONTROL, /* CTRL+Z, 0x1a */
325 _CONTROL, /* CTRL+[, 0x1b */
326 _CONTROL, /* CTRL+\, 0x1c */
327 _CONTROL, /* CTRL+], 0x1d */
328 _CONTROL, /* CTRL+^, 0x1e */
329 _CONTROL, /* CTRL+_, 0x1f */
330 _SPACE | _BLANK, /* ` ', 0x20 */
331 _PUNCT, /* `!', 0x21 */
332 _PUNCT, /* 0x22 */
333 _PUNCT, /* `#', 0x23 */
334 _PUNCT, /* `$', 0x24 */
335 _PUNCT, /* `%', 0x25 */
336 _PUNCT, /* `&', 0x26 */
337 _PUNCT, /* 0x27 */
338 _PUNCT, /* `(', 0x28 */
339 _PUNCT, /* `)', 0x29 */
340 _PUNCT, /* `*', 0x2a */
341 _PUNCT, /* `+', 0x2b */
342 _PUNCT, /* `,', 0x2c */
343 _PUNCT, /* `-', 0x2d */
344 _PUNCT, /* `.', 0x2e */
345 _PUNCT, /* `/', 0x2f */
346 _DIGIT | _HEX, /* `0', 0x30 */
347 _DIGIT | _HEX, /* `1', 0x31 */
348 _DIGIT | _HEX, /* `2', 0x32 */
349 _DIGIT | _HEX, /* `3', 0x33 */
350 _DIGIT | _HEX, /* `4', 0x34 */
351 _DIGIT | _HEX, /* `5', 0x35 */
352 _DIGIT | _HEX, /* `6', 0x36 */
353 _DIGIT | _HEX, /* `7', 0x37 */
354 _DIGIT | _HEX, /* `8', 0x38 */
355 _DIGIT | _HEX, /* `9', 0x39 */
356 _PUNCT, /* `:', 0x3a */
357 _PUNCT, /* `;', 0x3b */
358 _PUNCT, /* `<', 0x3c */
359 _PUNCT, /* `=', 0x3d */
360 _PUNCT, /* `>', 0x3e */
361 _PUNCT, /* `?', 0x3f */
362 _PUNCT, /* `@', 0x40 */
363 0x0100 | _UPPER | _HEX, /* `A', 0x41 */
364 0x0100 | _UPPER | _HEX, /* `B', 0x42 */
365 0x0100 | _UPPER | _HEX, /* `C', 0x43 */
366 0x0100 | _UPPER | _HEX, /* `D', 0x44 */
367 0x0100 | _UPPER | _HEX, /* `E', 0x45 */
368 0x0100 | _UPPER | _HEX, /* `F', 0x46 */
369 0x0100 | _UPPER, /* `G', 0x47 */
370 0x0100 | _UPPER, /* `H', 0x48 */
371 0x0100 | _UPPER, /* `I', 0x49 */
372 0x0100 | _UPPER, /* `J', 0x4a */
373 0x0100 | _UPPER, /* `K', 0x4b */
374 0x0100 | _UPPER, /* `L', 0x4c */
375 0x0100 | _UPPER, /* `M', 0x4d */
376 0x0100 | _UPPER, /* `N', 0x4e */
377 0x0100 | _UPPER, /* `O', 0x4f */
378 0x0100 | _UPPER, /* `P', 0x50 */
379 0x0100 | _UPPER, /* `Q', 0x51 */
380 0x0100 | _UPPER, /* `R', 0x52 */
381 0x0100 | _UPPER, /* `S', 0x53 */
382 0x0100 | _UPPER, /* `T', 0x54 */
383 0x0100 | _UPPER, /* `U', 0x55 */
384 0x0100 | _UPPER, /* `V', 0x56 */
385 0x0100 | _UPPER, /* `W', 0x57 */
386 0x0100 | _UPPER, /* `X', 0x58 */
387 0x0100 | _UPPER, /* `Y', 0x59 */
388 0x0100 | _UPPER, /* `Z', 0x5a */
389 _PUNCT, /* `[', 0x5b */
390 _PUNCT, /* 0x5c */
391 _PUNCT, /* `]', 0x5d */
392 _PUNCT, /* `^', 0x5e */
393 _PUNCT, /* `_', 0x5f */
394 _PUNCT, /* 0x60 */
395 0x0100 | _LOWER | _HEX, /* `a', 0x61 */
396 0x0100 | _LOWER | _HEX, /* `b', 0x62 */
397 0x0100 | _LOWER | _HEX, /* `c', 0x63 */
398 0x0100 | _LOWER | _HEX, /* `d', 0x64 */
399 0x0100 | _LOWER | _HEX, /* `e', 0x65 */
400 0x0100 | _LOWER | _HEX, /* `f', 0x66 */
401 0x0100 | _LOWER, /* `g', 0x67 */
402 0x0100 | _LOWER, /* `h', 0x68 */
403 0x0100 | _LOWER, /* `i', 0x69 */
404 0x0100 | _LOWER, /* `j', 0x6a */
405 0x0100 | _LOWER, /* `k', 0x6b */
406 0x0100 | _LOWER, /* `l', 0x6c */
407 0x0100 | _LOWER, /* `m', 0x6d */
408 0x0100 | _LOWER, /* `n', 0x6e */
409 0x0100 | _LOWER, /* `o', 0x6f */
410 0x0100 | _LOWER, /* `p', 0x70 */
411 0x0100 | _LOWER, /* `q', 0x71 */
412 0x0100 | _LOWER, /* `r', 0x72 */
413 0x0100 | _LOWER, /* `s', 0x73 */
414 0x0100 | _LOWER, /* `t', 0x74 */
415 0x0100 | _LOWER, /* `u', 0x75 */
416 0x0100 | _LOWER, /* `v', 0x76 */
417 0x0100 | _LOWER, /* `w', 0x77 */
418 0x0100 | _LOWER, /* `x', 0x78 */
419 0x0100 | _LOWER, /* `y', 0x79 */
420 0x0100 | _LOWER, /* `z', 0x7a */
421 _PUNCT, /* `{', 0x7b */
422 _PUNCT, /* `|', 0x7c */
423 _PUNCT, /* `}', 0x7d */
424 _PUNCT, /* `~', 0x7e */
425 _CONTROL, /* 0x7f */
426 _CONTROL, /* 0x80 */
427 _CONTROL, /* 0x81 */
428 _CONTROL, /* 0x82 */
429 _CONTROL, /* 0x83 */
430 _CONTROL, /* 0x84 */
431 _CONTROL, /* 0x85 */
432 _CONTROL, /* 0x86 */
433 _CONTROL, /* 0x87 */
434 _CONTROL, /* 0x88 */
435 _CONTROL, /* 0x89 */
436 _CONTROL, /* 0x8a */
437 _CONTROL, /* 0x8b */
438 _CONTROL, /* 0x8c */
439 _CONTROL, /* 0x8d */
440 _CONTROL, /* 0x8e */
441 _CONTROL, /* 0x8f */
442 _CONTROL, /* 0x90 */
443 _CONTROL, /* 0x91 */
444 _CONTROL, /* 0x92 */
445 _CONTROL, /* 0x93 */
446 _CONTROL, /* 0x94 */
447 _CONTROL, /* 0x95 */
448 _CONTROL, /* 0x96 */
449 _CONTROL, /* 0x97 */
450 _CONTROL, /* 0x98 */
451 _CONTROL, /* 0x99 */
452 _CONTROL, /* 0x9a */
453 _CONTROL, /* 0x9b */
454 _CONTROL, /* 0x9c */
455 _CONTROL, /* 0x9d */
456 _CONTROL, /* 0x9e */
457 _CONTROL, /* 0x9f */
458 _BLANK | _SPACE, /* 0xa0 */
459 _PUNCT, /* 0xa1 */
460 _PUNCT, /* 0xa2 */
461 _PUNCT, /* 0xa3 */
462 _PUNCT, /* 0xa4 */
463 _PUNCT, /* 0xa5 */
464 _PUNCT, /* 0xa6 */
465 _PUNCT, /* 0xa7 */
466 _PUNCT, /* 0xa8 */
467 _PUNCT, /* 0xa9 */
468 _PUNCT, /* 0xaa */
469 _PUNCT, /* 0xab */
470 _PUNCT, /* 0xac */
471 _PUNCT, /* 0xad */
472 _PUNCT, /* 0xae */
473 _PUNCT, /* 0xaf */
474 _PUNCT, /* 0xb0 */
475 _PUNCT, /* 0xb1 */
476 _PUNCT | _DIGIT, /* 0xb2 */
477 _PUNCT | _DIGIT, /* 0xb3 */
478 _PUNCT, /* 0xb4 */
479 _PUNCT, /* 0xb5 */
480 _PUNCT, /* 0xb6 */
481 _PUNCT, /* 0xb7 */
482 _PUNCT, /* 0xb8 */
483 _PUNCT | _DIGIT, /* 0xb9 */
484 _PUNCT, /* 0xba */
485 _PUNCT, /* 0xbb */
486 _PUNCT, /* 0xbc */
487 _PUNCT, /* 0xbd */
488 _PUNCT, /* 0xbe */
489 _PUNCT, /* 0xbf */
490 0x0100 | _UPPER, /* 0xc0 */
491 0x0100 | _UPPER, /* 0xc1 */
492 0x0100 | _UPPER, /* 0xc2 */
493 0x0100 | _UPPER, /* 0xc3 */
494 0x0100 | _UPPER, /* 0xc4 */
495 0x0100 | _UPPER, /* 0xc5 */
496 0x0100 | _UPPER, /* 0xc6 */
497 0x0100 | _UPPER, /* 0xc7 */
498 0x0100 | _UPPER, /* 0xc8 */
499 0x0100 | _UPPER, /* 0xc9 */
500 0x0100 | _UPPER, /* 0xca */
501 0x0100 | _UPPER, /* 0xcb */
502 0x0100 | _UPPER, /* 0xcc */
503 0x0100 | _UPPER, /* 0xcd */
504 0x0100 | _UPPER, /* 0xce */
505 0x0100 | _UPPER, /* 0xcf */
506 0x0100 | _UPPER, /* 0xd0 */
507 0x0100 | _UPPER, /* 0xd1 */
508 0x0100 | _UPPER, /* 0xd2 */
509 0x0100 | _UPPER, /* 0xd3 */
510 0x0100 | _UPPER, /* 0xd4 */
511 0x0100 | _UPPER, /* 0xd5 */
512 0x0100 | _UPPER, /* 0xd6 */
513 _PUNCT, /* 0xd7 */
514 0x0100 | _UPPER, /* 0xd8 */
515 0x0100 | _UPPER, /* 0xd9 */
516 0x0100 | _UPPER, /* 0xda */
517 0x0100 | _UPPER, /* 0xdb */
518 0x0100 | _UPPER, /* 0xdc */
519 0x0100 | _UPPER, /* 0xdd */
520 0x0100 | _UPPER, /* 0xde */
521 0x0100 | _LOWER, /* 0xdf */
522 0x0100 | _LOWER, /* 0xe0 */
523 0x0100 | _LOWER, /* 0xe1 */
524 0x0100 | _LOWER, /* 0xe2 */
525 0x0100 | _LOWER, /* 0xe3 */
526 0x0100 | _LOWER, /* 0xe4 */
527 0x0100 | _LOWER, /* 0xe5 */
528 0x0100 | _LOWER, /* 0xe6 */
529 0x0100 | _LOWER, /* 0xe7 */
530 0x0100 | _LOWER, /* 0xe8 */
531 0x0100 | _LOWER, /* 0xe9 */
532 0x0100 | _LOWER, /* 0xea */
533 0x0100 | _LOWER, /* 0xeb */
534 0x0100 | _LOWER, /* 0xec */
535 0x0100 | _LOWER, /* 0xed */
536 0x0100 | _LOWER, /* 0xee */
537 0x0100 | _LOWER, /* 0xef */
538 0x0100 | _LOWER, /* 0xf0 */
539 0x0100 | _LOWER, /* 0xf1 */
540 0x0100 | _LOWER, /* 0xf2 */
541 0x0100 | _LOWER, /* 0xf3 */
542 0x0100 | _LOWER, /* 0xf4 */
543 0x0100 | _LOWER, /* 0xf5 */
544 0x0100 | _LOWER, /* 0xf6 */
545 _PUNCT, /* 0xf7 */
546 0x0100 | _LOWER, /* 0xf8 */
547 0x0100 | _LOWER, /* 0xf9 */
548 0x0100 | _LOWER, /* 0xfa */
549 0x0100 | _LOWER, /* 0xfb */
550 0x0100 | _LOWER, /* 0xfc */
551 0x0100 | _LOWER, /* 0xfd */
552 0x0100 | _LOWER, /* 0xfe */
553 0x0100 | _LOWER /* 0xff */
554 };
555
556 const unsigned short *_pctype = _ctype + 1;
557 const unsigned short *_pwctype = _wctype + 1;
558
559 extern const unsigned short wine_wctype_table[];
560
561 /*
562 * @implemented
563 */
__p__pwctype(void)564 const unsigned short **__p__pwctype(void)
565 {
566 return &_pwctype;
567 }
568
__pwctype_func(void)569 const unsigned short* __cdecl __pwctype_func(void)
570 {
571 return _pwctype;
572 }
573
574 #ifdef _LIBCNT_
_isctype(int c,int ctypeFlags)575 int __cdecl _isctype (int c, int ctypeFlags)
576 {
577 return (_pctype[(unsigned char)(c & 0xFF)] & ctypeFlags);
578 }
579 #else
580 /*********************************************************************
581 * _isctype_l (MSVCRT.@)
582 */
_isctype_l(int c,int type,_locale_t locale)583 int __cdecl _isctype_l(int c, int type, _locale_t locale)
584 {
585 MSVCRT_pthreadlocinfo locinfo;
586
587 if(!locale)
588 locinfo = get_locinfo();
589 else
590 locinfo = ((MSVCRT__locale_t)locale)->locinfo;
591
592 if (c >= -1 && c <= 255)
593 return locinfo->pctype[c] & type;
594
595 if (locinfo->mb_cur_max != 1 && c > 0)
596 {
597 /* FIXME: Is there a faster way to do this? */
598 WORD typeInfo;
599 char convert[3], *pconv = convert;
600
601 if (locinfo->pctype[(UINT)c >> 8] & _LEADBYTE)
602 *pconv++ = (UINT)c >> 8;
603 *pconv++ = c & 0xff;
604 *pconv = 0;
605
606 if (GetStringTypeExA(locinfo->lc_handle[LC_CTYPE],
607 CT_CTYPE1, convert, convert[1] ? 2 : 1, &typeInfo))
608 return typeInfo & type;
609 }
610 return 0;
611 }
612
_isctype(int c,int ctypeFlags)613 int __cdecl _isctype (int c, int ctypeFlags)
614 {
615 return _isctype_l(c, ctypeFlags, NULL);
616 }
617
618 /*********************************************************************
619 * _isleadbyte_l (MSVCRT.@)
620 */
_isleadbyte_l(int c,_locale_t locale)621 int __cdecl _isleadbyte_l(int c, _locale_t locale)
622 {
623 return _isctype_l( c, _LEADBYTE, locale );
624 }
625
626 #endif /* _LIBCNT_ */
627
628 /*
629 * @implemented
630 */
isalpha(int c)631 int __cdecl isalpha(int c)
632 {
633 return(_isctype(c, _ALPHA));
634 }
635
636 /*
637 * @implemented
638 */
isalnum(int c)639 int __cdecl isalnum(int c)
640 {
641 return(_isctype(c, _ALPHA | _DIGIT));
642 }
643
644 /*
645 * @implemented
646 */
iswalnum(wint_t c)647 int __cdecl iswalnum(wint_t c)
648 {
649 return iswctype(c, _ALPHA | _DIGIT);
650 }
651
652 /*
653 * @implemented
654 */
__isascii(int c)655 int __cdecl __isascii(int c)
656 {
657 return ((unsigned char)c <= 0x7f);
658 }
659
660 /*
661 * @implemented
662 */
iswascii(wint_t c)663 int __cdecl iswascii(wint_t c)
664 {
665 return __isascii(c);
666 }
667
668 /*
669 * @implemented
670 */
iscntrl(int c)671 int __cdecl iscntrl(int c)
672 {
673 return(_isctype(c, _CONTROL));
674 }
675
676 /*
677 * @implemented
678 */
__iscsym(int c)679 int __cdecl __iscsym(int c)
680 {
681 return (c < 127 && (isalnum(c) || (c == '_')));
682 }
683
684 /*
685 * @implemented
686 */
__iscsymf(int c)687 int __cdecl __iscsymf(int c)
688 {
689 return (c < 127 && (isalpha(c) || (c == '_')));
690 }
691
692 /*
693 * @implemented
694 */
isdigit(int c)695 int __cdecl isdigit(int c)
696 {
697 return(_isctype(c, _DIGIT));
698 }
699
700 /*
701 * @implemented
702 */
isgraph(int c)703 int __cdecl isgraph(int c)
704 {
705 return (_isctype (c, _PUNCT | _ALPHA | _DIGIT));
706 }
707
708 /*
709 * @implemented
710 */
islower(int c)711 int __cdecl islower(int c)
712 {
713 return (_isctype (c, _LOWER));
714 }
715
716 /*
717 * @implemented
718 */
isprint(int c)719 int __cdecl isprint(int c)
720 {
721 return (_isctype (c, _BLANK | _PUNCT | _ALPHA | _DIGIT));
722 }
723
724 /*
725 * @implemented
726 */
ispunct(int c)727 int __cdecl ispunct(int c)
728 {
729 return (_isctype (c, _PUNCT));
730 }
731
732 /*
733 * @implemented
734 */
isspace(int c)735 int __cdecl isspace(int c)
736 {
737 return (_isctype (c, _SPACE));
738 }
739
740 /*
741 * @implemented
742 */
isupper(int c)743 int __cdecl isupper(int c)
744 {
745 return (_isctype (c, _UPPER));
746 }
747
748 /*
749 * @implemented
750 */
isxdigit(int c)751 int __cdecl isxdigit(int c)
752 {
753 return (_isctype (c, _HEX));
754 }
755
756
757 /*
758 * @implemented
759 */
iswalpha(wint_t c)760 int __cdecl iswalpha(wint_t c)
761 {
762 return (iswctype (c, _ALPHA));
763 }
764
765 /*
766 * @implemented
767 */
iswcntrl(wint_t c)768 int __cdecl iswcntrl(wint_t c)
769 {
770 return iswctype(c, _CONTROL);
771 }
772
773 /*
774 * @implemented
775 */
iswdigit(wint_t c)776 int __cdecl iswdigit(wint_t c)
777 {
778 return (iswctype (c, _DIGIT));
779 }
780
781 /*
782 * @implemented
783 */
iswgraph(wint_t c)784 int __cdecl iswgraph(wint_t c)
785 {
786 return iswctype(c,_PUNCT | _ALPHA | _DIGIT);
787 }
788
789 /*
790 * @implemented
791 */
iswprint(wint_t c)792 int __cdecl iswprint(wint_t c)
793 {
794 return iswctype((unsigned short)c,_BLANK | _PUNCT | _ALPHA | _DIGIT);
795 }
796
797
798 /*
799 * @implemented
800 */
iswpunct(wint_t c)801 int __cdecl iswpunct(wint_t c)
802 {
803 return iswctype(c, _PUNCT);
804 }
805
806 /*
807 * @implemented
808 */
iswlower(wint_t c)809 int __cdecl iswlower(wint_t c)
810 {
811 return (iswctype (c, _LOWER));
812 }
813
814 /*
815 * @implemented
816 */
iswupper(wint_t c)817 int __cdecl iswupper(wint_t c)
818 {
819 return iswctype(c, _UPPER);
820 }
821
822
823 /*
824 * @implemented
825 */
iswspace(wint_t c)826 int __cdecl iswspace(wint_t c)
827 {
828 return (iswctype (c, _SPACE));
829 }
830
831 /*
832 * @implemented
833 */
iswxdigit(wint_t c)834 int __cdecl iswxdigit(wint_t c)
835 {
836 return (iswctype (c, _HEX));
837 }
838
839
840 /*
841 * @implemented
842 */
__toascii(int c)843 int __cdecl __toascii(int c)
844 {
845 return((unsigned int)(c) & 0x7f);
846 }
847
848 /*
849 * @implemented
850 */
_tolower(int c)851 int __cdecl _tolower(int c)
852 {
853 if (_isctype (c, _UPPER))
854 return (c - upalpha);
855 return(c);
856 }
857
858 /*
859 * @implemented
860 */
_toupper(int c)861 int __cdecl _toupper(int c)
862 {
863 if (_isctype (c, _LOWER))
864 return (c + upalpha);
865 return(c);
866 }
867
868 /*
869 * @implemented
870 */
tolower(int c)871 int __cdecl tolower(int c)
872 {
873 if (_isctype (c, _UPPER))
874 return (c - upalpha);
875 return(c);
876 }
877
878 /*
879 * @implemented
880 */
toupper(int c)881 int __cdecl toupper(int c)
882 {
883 if (_isctype (c, _LOWER))
884 return (c + upalpha);
885 return(c);
886 }
887
888 /*
889 * @implemented
890 */
towlower(wint_t c)891 wint_t __cdecl towlower(wint_t c)
892 {
893 if (iswctype (c, _UPPER))
894 return (c - upalpha);
895 return(c);
896 }
897
898 /*
899 * @implemented
900 */
towupper(wint_t c)901 wint_t __cdecl towupper(wint_t c)
902 {
903 if (iswctype (c, _LOWER))
904 return (c + upalpha);
905 return(c);
906 }
907
908 /* EOF */
909