convert // comments to /**/; remove empty #if/#endif pairs. no code changes
[uclibc-ng.git] / libc / misc / ctype / ctype.c
blobe46f66b58b435561bf00e412ce8a62cb96ee0577
1 /* Copyright (C) 2003 Manuel Novoa III
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Library General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
13 * You should have received a copy of the GNU Library General Public
14 * License along with this library; if not, write to the Free
15 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION!
20 * Besides uClibc, I'm using this code in my libc for elks, which is
21 * a 16-bit environment with a fairly limited compiler. It would make
22 * things much easier for me if this file isn't modified unnecessarily.
23 * In particular, please put any new or replacement functions somewhere
24 * else, and modify the makefile to use your version instead.
25 * Thanks. Manuel
27 * ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */
29 #define __NO_CTYPE
31 #include <ctype.h>
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <limits.h>
35 #include <stdint.h>
36 #include <assert.h>
37 #include <locale.h>
39 #ifdef __UCLIBC_HAS_XLOCALE__
40 # include <xlocale.h>
41 #endif
43 /**********************************************************************/
44 #ifdef __UCLIBC_HAS_CTYPE_TABLES__
46 #ifdef __UCLIBC_HAS_CTYPE_SIGNED__
48 #if EOF >= CHAR_MIN
49 #define CTYPE_DOMAIN_CHECK(C) \
50 (((unsigned int)((C) - CHAR_MIN)) <= (UCHAR_MAX - CHAR_MIN))
51 #else
52 #define CTYPE_DOMAIN_CHECK(C) \
53 ((((unsigned int)((C) - CHAR_MIN)) <= (UCHAR_MAX - CHAR_MIN)) || ((C) == EOF))
54 #endif
56 #else /* __UCLIBC_HAS_CTYPE_SIGNED__ */
58 #if EOF == -1
59 #define CTYPE_DOMAIN_CHECK(C) \
60 (((unsigned int)((C) - EOF)) <= (UCHAR_MAX - EOF))
61 #else
62 #define CTYPE_DOMAIN_CHECK(C) \
63 ((((unsigned int)(C)) <= UCHAR_MAX) || ((C) == EOF))
64 #endif
66 #endif /* __UCLIBC_HAS_CTYPE_SIGNED__ */
68 #endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
69 /**********************************************************************/
70 #ifdef __UCLIBC_MJN3_ONLY__
71 #ifdef L_isspace
72 /* emit only once */
73 #warning CONSIDER: Should we assert when debugging and __UCLIBC_HAS_CTYPE_CHECKED?
74 #warning TODO: Fix asserts in to{upper|lower}{_l}.
75 #warning TODO: Optimize the isx*() funcs.
76 #endif
77 #endif /* __UCLIBC_MJN3_ONLY__ */
78 /**********************************************************************/
79 #undef PASTE2
80 #define PASTE2(X,Y) X ## Y
82 #ifdef __UCLIBC_HAS_CTYPE_TABLES__
84 #undef CTYPE_NAME
85 #undef ISCTYPE
86 #undef CTYPE_ALIAS
87 #undef CTYPE_DEF
88 #ifdef __UCLIBC_DO_XLOCALE
89 #define CTYPE_NAME(X) __is ## X ## _l
90 #define ISCTYPE(C,F) __isctype_l( C, F, locale_arg)
91 #define CTYPE_ALIAS(NAME) strong_alias( __is ## NAME ## _l , is ## NAME ## _l)
92 #define CTYPE_DEF(NAME) libc_hidden_def(is ## NAME ## _l)
93 #else
94 #define CTYPE_NAME(X) is ## X
95 #define ISCTYPE(C,F) __isctype( C, F )
96 #define CTYPE_ALIAS(NAME)
97 #define CTYPE_DEF(NAME) libc_hidden_def(is ## NAME)
98 #endif
101 #undef CTYPE_BODY
103 #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
104 /* Make sure assert is active for to*() funcs below. */
105 #undef NDEBUG
106 #include <assert.h>
108 extern void __isctype_assert(int c, int mask) __attribute__ ((__noreturn__)) attribute_hidden;
110 #define CTYPE_BODY(NAME,C,MASK) \
111 if (CTYPE_DOMAIN_CHECK(C)) { \
112 return ISCTYPE(C, MASK); \
114 __isctype_assert(C, MASK);
116 #elif defined(__UCLIBC_HAS_CTYPE_CHECKED__)
118 #define CTYPE_BODY(NAME,C,MASK) \
119 return CTYPE_DOMAIN_CHECK(C) \
120 ? ISCTYPE(C, MASK) \
121 : 0;
123 #elif defined(__UCLIBC_HAS_CTYPE_UNSAFE__)
125 #define CTYPE_BODY(NAME,C,MASK) \
126 return ISCTYPE(C, MASK);
129 #else /* No checking done. */
131 #error Unknown type of ctype checking!
133 #endif
137 #define IS_FUNC_BODY(NAME) \
138 int CTYPE_NAME(NAME) (int c __LOCALE_PARAM ); \
139 int CTYPE_NAME(NAME) (int c __LOCALE_PARAM ) \
141 CTYPE_BODY(NAME,c,PASTE2(_IS,NAME)) \
143 CTYPE_DEF(NAME) \
144 CTYPE_ALIAS(NAME)
146 #else /* __UCLIBC_HAS_CTYPE_TABLES__ */
148 #define C_MACRO(X) PASTE2(__C_is,X)(c)
149 #define CTYPE_NAME(X) is ## X
150 #define CTYPE_DEF(NAME) libc_hidden_def(is ## NAME)
152 #define IS_FUNC_BODY(NAME) \
153 int CTYPE_NAME(NAME) (int c) \
155 return C_MACRO(NAME); \
158 #endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
159 /**********************************************************************/
160 #ifdef L___ctype_assert
161 #ifdef __UCLIBC_HAS_CTYPE_ENFORCED__
164 attribute_hidden void __isctype_assert(int c, int mask)
166 fprintf(stderr, "%s: __is*{_l}(%d,%#x {locale})\n", __uclibc_progname, c, mask);
167 abort();
170 #endif
171 #endif
172 /**********************************************************************/
173 #if defined(L_isalnum) || defined(L_isalnum_l)
175 IS_FUNC_BODY(alnum);
177 #endif
178 /**********************************************************************/
179 #if defined(L_isalpha) || defined(L_isalpha_l)
181 IS_FUNC_BODY(alpha);
183 #endif
184 /**********************************************************************/
185 #if defined(L_isblank) || defined(L_isblank_l)
187 IS_FUNC_BODY(blank);
189 #endif
190 /**********************************************************************/
191 #if defined(L_iscntrl) || defined(L_iscntrl_l)
193 IS_FUNC_BODY(cntrl);
195 #endif
196 /**********************************************************************/
197 #if defined(L_isdigit) || defined(L_isdigit_l)
199 #ifdef __UCLIBC_HAS_CTYPE_TABLES__
201 /* The standards require EOF < 0. */
202 #if EOF >= CHAR_MIN
203 #define __isdigit_char_or_EOF(C) __isdigit_char((C))
204 #else
205 #define __isdigit_char_or_EOF(C) __isdigit_int((C))
206 #endif
208 int CTYPE_NAME(digit) (int C __LOCALE_PARAM);
209 int CTYPE_NAME(digit) (int C __LOCALE_PARAM)
211 #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
212 if (CTYPE_DOMAIN_CHECK(C)) {
213 return __isdigit_char_or_EOF(C); /* C is (unsigned) char or EOF. */
215 __isctype_assert(C, _ISdigit);
216 #else
217 return __isdigit_int(C); /* C could be invalid. */
218 #endif
220 CTYPE_DEF(digit)
221 CTYPE_ALIAS(digit)
223 #else /* __UCLIBC_HAS_CTYPE_TABLES__ */
225 IS_FUNC_BODY(digit);
227 #endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
229 #endif
230 /**********************************************************************/
231 #if defined(L_isgraph) || defined(L_isgraph_l)
233 IS_FUNC_BODY(graph);
235 #endif
236 /**********************************************************************/
237 #if defined(L_islower) || defined(L_islower_l)
239 IS_FUNC_BODY(lower);
241 #endif
242 /**********************************************************************/
243 #if defined(L_isprint) || defined(L_isprint_l)
245 IS_FUNC_BODY(print);
247 #endif
248 /**********************************************************************/
249 #if defined(L_ispunct) || defined(L_ispunct_l)
251 IS_FUNC_BODY(punct);
253 #endif
254 /**********************************************************************/
255 #if defined(L_isspace) || defined(L_isspace_l)
257 IS_FUNC_BODY(space);
259 #endif
260 /**********************************************************************/
261 #if defined(L_isupper) || defined(L_isupper_l)
263 IS_FUNC_BODY(upper);
265 #endif
266 /**********************************************************************/
267 #if defined(L_isxdigit) || defined(L_isxdigit_l)
269 IS_FUNC_BODY(xdigit);
271 #endif
272 /**********************************************************************/
273 #ifdef L_tolower
275 #undef tolower
276 #ifdef __UCLIBC_HAS_CTYPE_TABLES__
278 int tolower(int c)
280 #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
281 assert(CTYPE_DOMAIN_CHECK(c));
282 #endif
283 return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? (__UCLIBC_CTYPE_TOLOWER)[c] : c;
286 #else /* __UCLIBC_HAS_CTYPE_TABLES__ */
288 int tolower(int c)
290 return __C_tolower(c);
293 #endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
294 libc_hidden_def(tolower)
296 #endif
297 /**********************************************************************/
298 #ifdef L_tolower_l
300 #undef tolower_l
301 int tolower_l(int c, __locale_t l)
303 #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
304 assert(CTYPE_DOMAIN_CHECK(c));
305 #endif
306 return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_tolower[c] : c;
308 libc_hidden_def(tolower_l)
309 /*remove after 0.9.31. See ctype.h for why.
310 *weak_alias (tolower_l, __tolower_l) */
312 #endif
313 /**********************************************************************/
314 #ifdef L_toupper
316 #undef toupper
317 #ifdef __UCLIBC_HAS_CTYPE_TABLES__
319 int toupper(int c)
321 #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
322 assert(CTYPE_DOMAIN_CHECK(c));
323 #endif
324 return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? (__UCLIBC_CTYPE_TOUPPER)[c] : c;
327 #else /* __UCLIBC_HAS_CTYPE_TABLES__ */
329 int toupper(int c)
331 return __C_toupper(c);
334 #endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
335 libc_hidden_def(toupper)
337 #endif
338 /**********************************************************************/
339 #ifdef L_toupper_l
341 #undef toupper_l
342 int toupper_l(int c, __locale_t l)
344 #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
345 assert(CTYPE_DOMAIN_CHECK(c));
346 #endif
347 return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_toupper[c] : c;
349 libc_hidden_def(toupper_l)
350 /*remove after 0.9.31. See ctype.h for why.
351 *weak_alias (toupper_l, __toupper_l) */
353 #endif
354 /**********************************************************************/
355 #if defined(L_isascii) || defined(L_isascii_l)
357 #ifdef __UCLIBC_HAS_CTYPE_TABLES__
359 int __XL_NPP(isascii)(int c);
360 int __XL_NPP(isascii)(int c)
362 return __isascii(c); /* locale-independent */
365 #else /* __UCLIBC_HAS_CTYPE_TABLES__ */
367 int isascii(int c)
369 return __isascii(c); /* locale-independent */
372 #endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
373 CTYPE_DEF(ascii)
376 #endif
377 /**********************************************************************/
378 #if defined(L_toascii) || defined(L_toascii_l)
380 #ifdef __UCLIBC_HAS_CTYPE_TABLES__
382 int __XL_NPP(toascii)(int c);
383 int __XL_NPP(toascii)(int c)
385 return __toascii(c); /* locale-independent */
388 #else /* __UCLIBC_HAS_CTYPE_TABLES__ */
390 int toascii(int c)
392 return __toascii(c); /* locale-independent */
395 #endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
397 #endif
398 /**********************************************************************/
399 /* glibc extensions */
400 /**********************************************************************/
401 #ifdef L_isctype
403 int isctype(int c, int mask)
405 CTYPE_BODY(NAME,c,mask)
408 #endif
409 /**********************************************************************/
410 #ifdef L___ctype_b_loc
412 #ifdef __UCLIBC_HAS_XLOCALE__
414 const __ctype_mask_t **__ctype_b_loc(void)
416 return &(__UCLIBC_CURLOCALE->__ctype_b);
419 libc_hidden_def(__ctype_b_loc)
420 #endif
422 #endif
423 /**********************************************************************/
424 #ifdef L___ctype_tolower_loc
426 #ifdef __UCLIBC_HAS_XLOCALE__
428 const __ctype_touplow_t **__ctype_tolower_loc(void)
430 return &(__UCLIBC_CURLOCALE->__ctype_tolower);
432 libc_hidden_def(__ctype_tolower_loc)
434 #endif
436 #endif
437 /**********************************************************************/
438 #ifdef L___ctype_toupper_loc
440 #ifdef __UCLIBC_HAS_XLOCALE__
442 const __ctype_touplow_t **__ctype_toupper_loc(void)
444 return &(__UCLIBC_CURLOCALE->__ctype_toupper);
446 libc_hidden_def(__ctype_toupper_loc)
448 #endif
450 #endif
451 /**********************************************************************/
452 #ifdef L___C_ctype_b
454 static const __ctype_mask_t __C_ctype_b_data[] = {
455 #ifdef __UCLIBC_HAS_CTYPE_SIGNED__
456 /* -128 M-^@ */ 0,
457 /* -127 M-^A */ 0,
458 /* -126 M-^B */ 0,
459 /* -125 M-^C */ 0,
460 /* -124 M-^D */ 0,
461 /* -123 M-^E */ 0,
462 /* -122 M-^F */ 0,
463 /* -121 M-^G */ 0,
464 /* -120 M-^H */ 0,
465 /* -119 M-^I */ 0,
466 /* -118 M-^J */ 0,
467 /* -117 M-^K */ 0,
468 /* -116 M-^L */ 0,
469 /* -115 M-^M */ 0,
470 /* -114 M-^N */ 0,
471 /* -113 M-^O */ 0,
472 /* -112 M-^P */ 0,
473 /* -111 M-^Q */ 0,
474 /* -110 M-^R */ 0,
475 /* -109 M-^S */ 0,
476 /* -108 M-^T */ 0,
477 /* -107 M-^U */ 0,
478 /* -106 M-^V */ 0,
479 /* -105 M-^W */ 0,
480 /* -104 M-^X */ 0,
481 /* -103 M-^Y */ 0,
482 /* -102 M-^Z */ 0,
483 /* -101 M-^[ */ 0,
484 /* -100 M-^\ */ 0,
485 /* -99 M-^] */ 0,
486 /* -98 M-^^ */ 0,
487 /* -97 M-^_ */ 0,
488 /* -96 M- */ 0,
489 /* -95 M-! */ 0,
490 /* -94 M-" */ 0,
491 /* -93 M-# */ 0,
492 /* -92 M-$ */ 0,
493 /* -91 M-% */ 0,
494 /* -90 M-& */ 0,
495 /* -89 M-' */ 0,
496 /* -88 M-( */ 0,
497 /* -87 M-) */ 0,
498 /* -86 M-* */ 0,
499 /* -85 M-+ */ 0,
500 /* -84 M-, */ 0,
501 /* -83 M-- */ 0,
502 /* -82 M-. */ 0,
503 /* -81 M-/ */ 0,
504 /* -80 M-0 */ 0,
505 /* -79 M-1 */ 0,
506 /* -78 M-2 */ 0,
507 /* -77 M-3 */ 0,
508 /* -76 M-4 */ 0,
509 /* -75 M-5 */ 0,
510 /* -74 M-6 */ 0,
511 /* -73 M-7 */ 0,
512 /* -72 M-8 */ 0,
513 /* -71 M-9 */ 0,
514 /* -70 M-: */ 0,
515 /* -69 M-; */ 0,
516 /* -68 M-< */ 0,
517 /* -67 M-= */ 0,
518 /* -66 M-> */ 0,
519 /* -65 M-? */ 0,
520 /* -64 M-@ */ 0,
521 /* -63 M-A */ 0,
522 /* -62 M-B */ 0,
523 /* -61 M-C */ 0,
524 /* -60 M-D */ 0,
525 /* -59 M-E */ 0,
526 /* -58 M-F */ 0,
527 /* -57 M-G */ 0,
528 /* -56 M-H */ 0,
529 /* -55 M-I */ 0,
530 /* -54 M-J */ 0,
531 /* -53 M-K */ 0,
532 /* -52 M-L */ 0,
533 /* -51 M-M */ 0,
534 /* -50 M-N */ 0,
535 /* -49 M-O */ 0,
536 /* -48 M-P */ 0,
537 /* -47 M-Q */ 0,
538 /* -46 M-R */ 0,
539 /* -45 M-S */ 0,
540 /* -44 M-T */ 0,
541 /* -43 M-U */ 0,
542 /* -42 M-V */ 0,
543 /* -41 M-W */ 0,
544 /* -40 M-X */ 0,
545 /* -39 M-Y */ 0,
546 /* -38 M-Z */ 0,
547 /* -37 M-[ */ 0,
548 /* -36 M-\ */ 0,
549 /* -35 M-] */ 0,
550 /* -34 M-^ */ 0,
551 /* -33 M-_ */ 0,
552 /* -32 M-` */ 0,
553 /* -31 M-a */ 0,
554 /* -30 M-b */ 0,
555 /* -29 M-c */ 0,
556 /* -28 M-d */ 0,
557 /* -27 M-e */ 0,
558 /* -26 M-f */ 0,
559 /* -25 M-g */ 0,
560 /* -24 M-h */ 0,
561 /* -23 M-i */ 0,
562 /* -22 M-j */ 0,
563 /* -21 M-k */ 0,
564 /* -20 M-l */ 0,
565 /* -19 M-m */ 0,
566 /* -18 M-n */ 0,
567 /* -17 M-o */ 0,
568 /* -16 M-p */ 0,
569 /* -15 M-q */ 0,
570 /* -14 M-r */ 0,
571 /* -13 M-s */ 0,
572 /* -12 M-t */ 0,
573 /* -11 M-u */ 0,
574 /* -10 M-v */ 0,
575 /* -9 M-w */ 0,
576 /* -8 M-x */ 0,
577 /* -7 M-y */ 0,
578 /* -6 M-z */ 0,
579 /* -5 M-{ */ 0,
580 /* -4 M-| */ 0,
581 /* -3 M-} */ 0,
582 /* -2 M-~ */ 0,
583 #endif /* __UCLIBC_HAS_CTYPE_SIGNED__*/
584 /* -1 M-^? */ 0,
585 /* 0 ^@ */ _IScntrl,
586 /* 1 ^A */ _IScntrl,
587 /* 2 ^B */ _IScntrl,
588 /* 3 ^C */ _IScntrl,
589 /* 4 ^D */ _IScntrl,
590 /* 5 ^E */ _IScntrl,
591 /* 6 ^F */ _IScntrl,
592 /* 7 ^G */ _IScntrl,
593 /* 8 ^H */ _IScntrl,
594 /* 9 ^I */ _ISspace|_ISblank|_IScntrl,
595 /* 10 ^J */ _ISspace|_IScntrl,
596 /* 11 ^K */ _ISspace|_IScntrl,
597 /* 12 ^L */ _ISspace|_IScntrl,
598 /* 13 ^M */ _ISspace|_IScntrl,
599 /* 14 ^N */ _IScntrl,
600 /* 15 ^O */ _IScntrl,
601 /* 16 ^P */ _IScntrl,
602 /* 17 ^Q */ _IScntrl,
603 /* 18 ^R */ _IScntrl,
604 /* 19 ^S */ _IScntrl,
605 /* 20 ^T */ _IScntrl,
606 /* 21 ^U */ _IScntrl,
607 /* 22 ^V */ _IScntrl,
608 /* 23 ^W */ _IScntrl,
609 /* 24 ^X */ _IScntrl,
610 /* 25 ^Y */ _IScntrl,
611 /* 26 ^Z */ _IScntrl,
612 /* 27 ^[ */ _IScntrl,
613 /* 28 ^\ */ _IScntrl,
614 /* 29 ^] */ _IScntrl,
615 /* 30 ^^ */ _IScntrl,
616 /* 31 ^_ */ _IScntrl,
617 /* 32 */ _ISspace|_ISprint|_ISblank,
618 /* 33 ! */ _ISprint|_ISgraph|_ISpunct,
619 /* 34 " */ _ISprint|_ISgraph|_ISpunct,
620 /* 35 # */ _ISprint|_ISgraph|_ISpunct,
621 /* 36 $ */ _ISprint|_ISgraph|_ISpunct,
622 /* 37 % */ _ISprint|_ISgraph|_ISpunct,
623 /* 38 & */ _ISprint|_ISgraph|_ISpunct,
624 /* 39 ' */ _ISprint|_ISgraph|_ISpunct,
625 /* 40 ( */ _ISprint|_ISgraph|_ISpunct,
626 /* 41 ) */ _ISprint|_ISgraph|_ISpunct,
627 /* 42 * */ _ISprint|_ISgraph|_ISpunct,
628 /* 43 + */ _ISprint|_ISgraph|_ISpunct,
629 /* 44 , */ _ISprint|_ISgraph|_ISpunct,
630 /* 45 - */ _ISprint|_ISgraph|_ISpunct,
631 /* 46 . */ _ISprint|_ISgraph|_ISpunct,
632 /* 47 / */ _ISprint|_ISgraph|_ISpunct,
633 /* 48 0 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
634 /* 49 1 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
635 /* 50 2 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
636 /* 51 3 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
637 /* 52 4 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
638 /* 53 5 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
639 /* 54 6 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
640 /* 55 7 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
641 /* 56 8 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
642 /* 57 9 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
643 /* 58 : */ _ISprint|_ISgraph|_ISpunct,
644 /* 59 ; */ _ISprint|_ISgraph|_ISpunct,
645 /* 60 < */ _ISprint|_ISgraph|_ISpunct,
646 /* 61 = */ _ISprint|_ISgraph|_ISpunct,
647 /* 62 > */ _ISprint|_ISgraph|_ISpunct,
648 /* 63 ? */ _ISprint|_ISgraph|_ISpunct,
649 /* 64 @ */ _ISprint|_ISgraph|_ISpunct,
650 /* 65 A */ _ISupper|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
651 /* 66 B */ _ISupper|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
652 /* 67 C */ _ISupper|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
653 /* 68 D */ _ISupper|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
654 /* 69 E */ _ISupper|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
655 /* 70 F */ _ISupper|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
656 /* 71 G */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
657 /* 72 H */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
658 /* 73 I */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
659 /* 74 J */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
660 /* 75 K */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
661 /* 76 L */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
662 /* 77 M */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
663 /* 78 N */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
664 /* 79 O */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
665 /* 80 P */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
666 /* 81 Q */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
667 /* 82 R */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
668 /* 83 S */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
669 /* 84 T */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
670 /* 85 U */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
671 /* 86 V */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
672 /* 87 W */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
673 /* 88 X */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
674 /* 89 Y */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
675 /* 90 Z */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
676 /* 91 [ */ _ISprint|_ISgraph|_ISpunct,
677 /* 92 \ */ _ISprint|_ISgraph|_ISpunct,
678 /* 93 ] */ _ISprint|_ISgraph|_ISpunct,
679 /* 94 ^ */ _ISprint|_ISgraph|_ISpunct,
680 /* 95 _ */ _ISprint|_ISgraph|_ISpunct,
681 /* 96 ` */ _ISprint|_ISgraph|_ISpunct,
682 /* 97 a */ _ISlower|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
683 /* 98 b */ _ISlower|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
684 /* 99 c */ _ISlower|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
685 /* 100 d */ _ISlower|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
686 /* 101 e */ _ISlower|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
687 /* 102 f */ _ISlower|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
688 /* 103 g */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
689 /* 104 h */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
690 /* 105 i */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
691 /* 106 j */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
692 /* 107 k */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
693 /* 108 l */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
694 /* 109 m */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
695 /* 110 n */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
696 /* 111 o */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
697 /* 112 p */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
698 /* 113 q */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
699 /* 114 r */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
700 /* 115 s */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
701 /* 116 t */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
702 /* 117 u */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
703 /* 118 v */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
704 /* 119 w */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
705 /* 120 x */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
706 /* 121 y */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
707 /* 122 z */ _ISlower|_ISalpha|_ISprint|_ISgraph|_ISalnum,
708 /* 123 { */ _ISprint|_ISgraph|_ISpunct,
709 /* 124 | */ _ISprint|_ISgraph|_ISpunct,
710 /* 125 } */ _ISprint|_ISgraph|_ISpunct,
711 /* 126 ~ */ _ISprint|_ISgraph|_ISpunct,
712 /* 127 ^? */ _IScntrl,
713 /* 128 M-^@ */ 0,
714 /* 129 M-^A */ 0,
715 /* 130 M-^B */ 0,
716 /* 131 M-^C */ 0,
717 /* 132 M-^D */ 0,
718 /* 133 M-^E */ 0,
719 /* 134 M-^F */ 0,
720 /* 135 M-^G */ 0,
721 /* 136 M-^H */ 0,
722 /* 137 M-^I */ 0,
723 /* 138 M-^J */ 0,
724 /* 139 M-^K */ 0,
725 /* 140 M-^L */ 0,
726 /* 141 M-^M */ 0,
727 /* 142 M-^N */ 0,
728 /* 143 M-^O */ 0,
729 /* 144 M-^P */ 0,
730 /* 145 M-^Q */ 0,
731 /* 146 M-^R */ 0,
732 /* 147 M-^S */ 0,
733 /* 148 M-^T */ 0,
734 /* 149 M-^U */ 0,
735 /* 150 M-^V */ 0,
736 /* 151 M-^W */ 0,
737 /* 152 M-^X */ 0,
738 /* 153 M-^Y */ 0,
739 /* 154 M-^Z */ 0,
740 /* 155 M-^[ */ 0,
741 /* 156 M-^\ */ 0,
742 /* 157 M-^] */ 0,
743 /* 158 M-^^ */ 0,
744 /* 159 M-^_ */ 0,
745 /* 160 M- */ 0,
746 /* 161 M-! */ 0,
747 /* 162 M-" */ 0,
748 /* 163 M-# */ 0,
749 /* 164 M-$ */ 0,
750 /* 165 M-% */ 0,
751 /* 166 M-& */ 0,
752 /* 167 M-' */ 0,
753 /* 168 M-( */ 0,
754 /* 169 M-) */ 0,
755 /* 170 M-* */ 0,
756 /* 171 M-+ */ 0,
757 /* 172 M-, */ 0,
758 /* 173 M-- */ 0,
759 /* 174 M-. */ 0,
760 /* 175 M-/ */ 0,
761 /* 176 M-0 */ 0,
762 /* 177 M-1 */ 0,
763 /* 178 M-2 */ 0,
764 /* 179 M-3 */ 0,
765 /* 180 M-4 */ 0,
766 /* 181 M-5 */ 0,
767 /* 182 M-6 */ 0,
768 /* 183 M-7 */ 0,
769 /* 184 M-8 */ 0,
770 /* 185 M-9 */ 0,
771 /* 186 M-: */ 0,
772 /* 187 M-; */ 0,
773 /* 188 M-< */ 0,
774 /* 189 M-= */ 0,
775 /* 190 M-> */ 0,
776 /* 191 M-? */ 0,
777 /* 192 M-@ */ 0,
778 /* 193 M-A */ 0,
779 /* 194 M-B */ 0,
780 /* 195 M-C */ 0,
781 /* 196 M-D */ 0,
782 /* 197 M-E */ 0,
783 /* 198 M-F */ 0,
784 /* 199 M-G */ 0,
785 /* 200 M-H */ 0,
786 /* 201 M-I */ 0,
787 /* 202 M-J */ 0,
788 /* 203 M-K */ 0,
789 /* 204 M-L */ 0,
790 /* 205 M-M */ 0,
791 /* 206 M-N */ 0,
792 /* 207 M-O */ 0,
793 /* 208 M-P */ 0,
794 /* 209 M-Q */ 0,
795 /* 210 M-R */ 0,
796 /* 211 M-S */ 0,
797 /* 212 M-T */ 0,
798 /* 213 M-U */ 0,
799 /* 214 M-V */ 0,
800 /* 215 M-W */ 0,
801 /* 216 M-X */ 0,
802 /* 217 M-Y */ 0,
803 /* 218 M-Z */ 0,
804 /* 219 M-[ */ 0,
805 /* 220 M-\ */ 0,
806 /* 221 M-] */ 0,
807 /* 222 M-^ */ 0,
808 /* 223 M-_ */ 0,
809 /* 224 M-` */ 0,
810 /* 225 M-a */ 0,
811 /* 226 M-b */ 0,
812 /* 227 M-c */ 0,
813 /* 228 M-d */ 0,
814 /* 229 M-e */ 0,
815 /* 230 M-f */ 0,
816 /* 231 M-g */ 0,
817 /* 232 M-h */ 0,
818 /* 233 M-i */ 0,
819 /* 234 M-j */ 0,
820 /* 235 M-k */ 0,
821 /* 236 M-l */ 0,
822 /* 237 M-m */ 0,
823 /* 238 M-n */ 0,
824 /* 239 M-o */ 0,
825 /* 240 M-p */ 0,
826 /* 241 M-q */ 0,
827 /* 242 M-r */ 0,
828 /* 243 M-s */ 0,
829 /* 244 M-t */ 0,
830 /* 245 M-u */ 0,
831 /* 246 M-v */ 0,
832 /* 247 M-w */ 0,
833 /* 248 M-x */ 0,
834 /* 249 M-y */ 0,
835 /* 250 M-z */ 0,
836 /* 251 M-{ */ 0,
837 /* 252 M-| */ 0,
838 /* 253 M-} */ 0,
839 /* 254 M-~ */ 0,
840 /* 255 M-^? */ 0
843 const __ctype_mask_t *__C_ctype_b = __C_ctype_b_data + __UCLIBC_CTYPE_B_TBL_OFFSET;
844 libc_hidden_data_def(__C_ctype_b)
846 #ifndef __UCLIBC_HAS_XLOCALE__
848 const __ctype_mask_t *__ctype_b = __C_ctype_b_data + __UCLIBC_CTYPE_B_TBL_OFFSET;
849 libc_hidden_data_def(__ctype_b)
851 #endif
853 #endif
854 /**********************************************************************/
855 #ifdef L___C_ctype_tolower
857 static const __ctype_touplow_t __C_ctype_tolower_data[] = {
858 #ifdef __UCLIBC_HAS_CTYPE_SIGNED__
859 -128, -127, -126, -125,
860 -124, -123, -122, -121,
861 -120, -119, -118, -117,
862 -116, -115, -114, -113,
863 -112, -111, -110, -109,
864 -108, -107, -106, -105,
865 -104, -103, -102, -101,
866 -100, -99, -98, -97,
867 -96, -95, -94, -93,
868 -92, -91, -90, -89,
869 -88, -87, -86, -85,
870 -84, -83, -82, -81,
871 -80, -79, -78, -77,
872 -76, -75, -74, -73,
873 -72, -71, -70, -69,
874 -68, -67, -66, -65,
875 -64, -63, -62, -61,
876 -60, -59, -58, -57,
877 -56, -55, -54, -53,
878 -52, -51, -50, -49,
879 -48, -47, -46, -45,
880 -44, -43, -42, -41,
881 -40, -39, -38, -37,
882 -36, -35, -34, -33,
883 -32, -31, -30, -29,
884 -28, -27, -26, -25,
885 -24, -23, -22, -21,
886 -20, -19, -18, -17,
887 -16, -15, -14, -13,
888 -12, -11, -10, -9,
889 -8, -7, -6, -5,
890 -4, -3, -2, -1,
891 #endif /* __UCLIBC_HAS_CTYPE_SIGNED__*/
892 0, 1, 2, 3,
893 4, 5, 6, 7,
894 8, 9, 10, 11,
895 12, 13, 14, 15,
896 16, 17, 18, 19,
897 20, 21, 22, 23,
898 24, 25, 26, 27,
899 28, 29, 30, 31,
900 32, 33, 34, 35,
901 36, 37, 38, 39,
902 40, 41, 42, 43,
903 44, 45, 46, 47,
904 48, 49, 50, 51,
905 52, 53, 54, 55,
906 56, 57, 58, 59,
907 60, 61, 62, 63,
908 64, 97 /* a */, 98 /* b */, 99 /* c */,
909 100 /* d */, 101 /* e */, 102 /* f */, 103 /* g */,
910 104 /* h */, 105 /* i */, 106 /* j */, 107 /* k */,
911 108 /* l */, 109 /* m */, 110 /* n */, 111 /* o */,
912 112 /* p */, 113 /* q */, 114 /* r */, 115 /* s */,
913 116 /* t */, 117 /* u */, 118 /* v */, 119 /* w */,
914 120 /* x */, 121 /* y */, 122 /* z */, 91,
915 92, 93, 94, 95,
916 96, 97, 98, 99,
917 100, 101, 102, 103,
918 104, 105, 106, 107,
919 108, 109, 110, 111,
920 112, 113, 114, 115,
921 116, 117, 118, 119,
922 120, 121, 122, 123,
923 124, 125, 126, 127,
924 128, 129, 130, 131,
925 132, 133, 134, 135,
926 136, 137, 138, 139,
927 140, 141, 142, 143,
928 144, 145, 146, 147,
929 148, 149, 150, 151,
930 152, 153, 154, 155,
931 156, 157, 158, 159,
932 160, 161, 162, 163,
933 164, 165, 166, 167,
934 168, 169, 170, 171,
935 172, 173, 174, 175,
936 176, 177, 178, 179,
937 180, 181, 182, 183,
938 184, 185, 186, 187,
939 188, 189, 190, 191,
940 192, 193, 194, 195,
941 196, 197, 198, 199,
942 200, 201, 202, 203,
943 204, 205, 206, 207,
944 208, 209, 210, 211,
945 212, 213, 214, 215,
946 216, 217, 218, 219,
947 220, 221, 222, 223,
948 224, 225, 226, 227,
949 228, 229, 230, 231,
950 232, 233, 234, 235,
951 236, 237, 238, 239,
952 240, 241, 242, 243,
953 244, 245, 246, 247,
954 248, 249, 250, 251,
955 252, 253, 254, 255
958 const __ctype_touplow_t *__C_ctype_tolower =
959 __C_ctype_tolower_data + __UCLIBC_CTYPE_TO_TBL_OFFSET;
960 libc_hidden_data_def(__C_ctype_tolower)
962 #ifndef __UCLIBC_HAS_XLOCALE__
964 const __ctype_touplow_t *__ctype_tolower =
965 __C_ctype_tolower_data + __UCLIBC_CTYPE_TO_TBL_OFFSET;
966 libc_hidden_data_def(__ctype_tolower)
968 #endif
970 #endif
971 /**********************************************************************/
972 #ifdef L___C_ctype_toupper
974 static const __ctype_touplow_t __C_ctype_toupper_data[] = {
975 #ifdef __UCLIBC_HAS_CTYPE_SIGNED__
976 -128, -127, -126, -125,
977 -124, -123, -122, -121,
978 -120, -119, -118, -117,
979 -116, -115, -114, -113,
980 -112, -111, -110, -109,
981 -108, -107, -106, -105,
982 -104, -103, -102, -101,
983 -100, -99, -98, -97,
984 -96, -95, -94, -93,
985 -92, -91, -90, -89,
986 -88, -87, -86, -85,
987 -84, -83, -82, -81,
988 -80, -79, -78, -77,
989 -76, -75, -74, -73,
990 -72, -71, -70, -69,
991 -68, -67, -66, -65,
992 -64, -63, -62, -61,
993 -60, -59, -58, -57,
994 -56, -55, -54, -53,
995 -52, -51, -50, -49,
996 -48, -47, -46, -45,
997 -44, -43, -42, -41,
998 -40, -39, -38, -37,
999 -36, -35, -34, -33,
1000 -32, -31, -30, -29,
1001 -28, -27, -26, -25,
1002 -24, -23, -22, -21,
1003 -20, -19, -18, -17,
1004 -16, -15, -14, -13,
1005 -12, -11, -10, -9,
1006 -8, -7, -6, -5,
1007 -4, -3, -2, -1,
1008 #endif /* __UCLIBC_HAS_CTYPE_SIGNED__*/
1009 0, 1, 2, 3,
1010 4, 5, 6, 7,
1011 8, 9, 10, 11,
1012 12, 13, 14, 15,
1013 16, 17, 18, 19,
1014 20, 21, 22, 23,
1015 24, 25, 26, 27,
1016 28, 29, 30, 31,
1017 32, 33, 34, 35,
1018 36, 37, 38, 39,
1019 40, 41, 42, 43,
1020 44, 45, 46, 47,
1021 48, 49, 50, 51,
1022 52, 53, 54, 55,
1023 56, 57, 58, 59,
1024 60, 61, 62, 63,
1025 64, 65, 66, 67,
1026 68, 69, 70, 71,
1027 72, 73, 74, 75,
1028 76, 77, 78, 79,
1029 80, 81, 82, 83,
1030 84, 85, 86, 87,
1031 88, 89, 90, 91,
1032 92, 93, 94, 95,
1033 96, 65 /* A */, 66 /* B */, 67 /* C */,
1034 68 /* D */, 69 /* E */, 70 /* F */, 71 /* G */,
1035 72 /* H */, 73 /* I */, 74 /* J */, 75 /* K */,
1036 76 /* L */, 77 /* M */, 78 /* N */, 79 /* O */,
1037 80 /* P */, 81 /* Q */, 82 /* R */, 83 /* S */,
1038 84 /* T */, 85 /* U */, 86 /* V */, 87 /* W */,
1039 88 /* X */, 89 /* Y */, 90 /* Z */, 123,
1040 124, 125, 126, 127,
1041 128, 129, 130, 131,
1042 132, 133, 134, 135,
1043 136, 137, 138, 139,
1044 140, 141, 142, 143,
1045 144, 145, 146, 147,
1046 148, 149, 150, 151,
1047 152, 153, 154, 155,
1048 156, 157, 158, 159,
1049 160, 161, 162, 163,
1050 164, 165, 166, 167,
1051 168, 169, 170, 171,
1052 172, 173, 174, 175,
1053 176, 177, 178, 179,
1054 180, 181, 182, 183,
1055 184, 185, 186, 187,
1056 188, 189, 190, 191,
1057 192, 193, 194, 195,
1058 196, 197, 198, 199,
1059 200, 201, 202, 203,
1060 204, 205, 206, 207,
1061 208, 209, 210, 211,
1062 212, 213, 214, 215,
1063 216, 217, 218, 219,
1064 220, 221, 222, 223,
1065 224, 225, 226, 227,
1066 228, 229, 230, 231,
1067 232, 233, 234, 235,
1068 236, 237, 238, 239,
1069 240, 241, 242, 243,
1070 244, 245, 246, 247,
1071 248, 249, 250, 251,
1072 252, 253, 254, 255
1075 const __ctype_touplow_t *__C_ctype_toupper =
1076 __C_ctype_toupper_data + __UCLIBC_CTYPE_TO_TBL_OFFSET;
1077 libc_hidden_data_def(__C_ctype_toupper)
1079 #ifndef __UCLIBC_HAS_XLOCALE__
1081 const __ctype_touplow_t *__ctype_toupper =
1082 __C_ctype_toupper_data + __UCLIBC_CTYPE_TO_TBL_OFFSET;
1083 libc_hidden_data_def(__ctype_toupper)
1085 #endif
1087 #endif
1088 /**********************************************************************/