2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include <aros/symbolsets.h>
9 const unsigned short int __ctype_b_array
[384] =
43 _IScntrl
, /* NBSpace */
147 _IScntrl
, /* Backspace */
148 _ISblank
|_IScntrl
|_ISspace
, /* 9 */
149 _IScntrl
|_ISspace
, /* LF */
150 _IScntrl
|_ISspace
, /* 11 */
151 _IScntrl
|_ISspace
, /* 12 */
152 _IScntrl
|_ISspace
, /* CR */
171 _ISblank
|_ISprint
|_ISspace
, /* Space */
172 _ISgraph
|_ISprint
|_ISpunct
, /* ! */
173 _ISgraph
|_ISprint
|_ISpunct
, /* " */
174 _ISgraph
|_ISprint
|_ISpunct
, /* # */
175 _ISgraph
|_ISprint
|_ISpunct
, /* $ */
176 _ISgraph
|_ISprint
|_ISpunct
, /* % */
177 _ISgraph
|_ISprint
|_ISpunct
, /* & */
178 _ISgraph
|_ISprint
|_ISpunct
, /* ' */
179 _ISgraph
|_ISprint
|_ISpunct
, /* ( */
180 _ISgraph
|_ISprint
|_ISpunct
, /* ) */
181 _ISgraph
|_ISprint
|_ISpunct
, /* * */
182 _ISgraph
|_ISprint
|_ISpunct
, /* + */
183 _ISgraph
|_ISprint
|_ISpunct
, /* , */
184 _ISgraph
|_ISprint
|_ISpunct
, /* - */
185 _ISgraph
|_ISprint
|_ISpunct
, /* . */
186 _ISgraph
|_ISprint
|_ISpunct
, /* / */
187 _ISdigit
|_ISgraph
|_ISprint
|_ISxdigit
, /* 0 */
188 _ISdigit
|_ISgraph
|_ISprint
|_ISxdigit
, /* 1 */
189 _ISdigit
|_ISgraph
|_ISprint
|_ISxdigit
, /* 2 */
190 _ISdigit
|_ISgraph
|_ISprint
|_ISxdigit
, /* 3 */
191 _ISdigit
|_ISgraph
|_ISprint
|_ISxdigit
, /* 4 */
192 _ISdigit
|_ISgraph
|_ISprint
|_ISxdigit
, /* 5 */
193 _ISdigit
|_ISgraph
|_ISprint
|_ISxdigit
, /* 6 */
194 _ISdigit
|_ISgraph
|_ISprint
|_ISxdigit
, /* 7 */
195 _ISdigit
|_ISgraph
|_ISprint
|_ISxdigit
, /* 8 */
196 _ISdigit
|_ISgraph
|_ISprint
|_ISxdigit
, /* 9 */
197 _ISgraph
|_ISprint
|_ISpunct
, /* : */
198 _ISgraph
|_ISprint
|_ISpunct
, /* ; */
199 _ISgraph
|_ISprint
|_ISpunct
, /* < */
200 _ISgraph
|_ISprint
|_ISpunct
, /* = */
201 _ISgraph
|_ISprint
|_ISpunct
, /* > */
202 _ISgraph
|_ISprint
|_ISpunct
, /* ? */
203 _ISgraph
|_ISprint
|_ISpunct
, /* @ */
204 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
|_ISxdigit
, /* A */
205 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
|_ISxdigit
, /* B */
206 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
|_ISxdigit
, /* C */
207 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
|_ISxdigit
, /* D */
208 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
|_ISxdigit
, /* E */
209 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
|_ISxdigit
, /* F */
210 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* G */
211 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* H */
212 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* I */
213 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* J */
214 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* K */
215 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* L */
216 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* M */
217 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* N */
218 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* O */
219 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* P */
220 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* Q */
221 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* R */
222 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* S */
223 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* T */
224 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* U */
225 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* V */
226 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* W */
227 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* X */
228 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* Y */
229 _ISupper
|_ISalpha
|_ISgraph
|_ISprint
, /* Z */
230 _ISgraph
|_ISprint
|_ISpunct
, /* [ */
231 _ISgraph
|_ISprint
|_ISpunct
, /* \ */
232 _ISgraph
|_ISprint
|_ISpunct
, /* ] */
233 _ISgraph
|_ISprint
|_ISpunct
, /* ^ */
234 _ISgraph
|_ISprint
|_ISpunct
, /* _ */
235 _ISgraph
|_ISprint
|_ISpunct
, /* ` */
236 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
|_ISxdigit
, /* a */
237 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
|_ISxdigit
, /* b */
238 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
|_ISxdigit
, /* c */
239 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
|_ISxdigit
, /* d */
240 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
|_ISxdigit
, /* e */
241 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
|_ISxdigit
, /* f */
242 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* g */
243 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* h */
244 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* i */
245 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* j */
246 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* k */
247 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* l */
248 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* m */
249 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* n */
250 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* o */
251 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* p */
252 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* q */
253 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* r */
254 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* s */
255 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* t */
256 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* u */
257 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* v */
258 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* w */
259 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* x */
260 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* y */
261 _ISlower
|_ISalpha
|_ISgraph
|_ISprint
, /* z */
262 _ISgraph
|_ISprint
|_ISpunct
, /* { */
263 _ISgraph
|_ISprint
|_ISpunct
, /* | */
264 _ISgraph
|_ISprint
|_ISpunct
, /* } */
265 _ISgraph
|_ISprint
|_ISpunct
, /* ~ */
299 _IScntrl
, /* NBSpace */
397 const int __ctype_toupper_array
[384] =
400 128,129,130,131, 132,133,134,135,
401 136,137,138,139, 140,141,142,143,
402 144,145,146,147, 148,149,150,151,
403 152,153,154,155, 156,157,158,159,
404 160,161,162,163, 164,165,166,167,
405 168,169,170,171, 172,173,174,175,
406 176,177,178,179, 180,181,182,183,
407 184,185,186,187, 188,189,190,191,
408 192,193,194,195, 196,197,198,199,
409 200,201,202,203, 204,205,206,207,
410 208,209,210,211, 212,213,214,215,
411 216,217,218,219, 220,221,222,223,
412 224,225,226,227, 228,229,230,231,
413 232,233,234,235, 236,237,238,239,
414 240,241,242,243, 244,245,246,247,
415 248,249,250,251, 252,253,254,255,
417 0, 1, 2, 3, 4, 5, 6, 7,
418 8, 9, 10, 11, 12, 13, 14, 15,
419 16, 17, 18, 19, 20, 21, 22, 23,
420 24, 25, 26, 27, 28, 29, 30, 31,
421 ' ','!','"','#', '$','%','&','\'',
422 '(',')','*','+', ',','-','.','/',
423 '0','1','2','3', '4','5','6','7',
424 '8','9',':',';', '<','=','>','?',
425 '@','A','B','C', 'D','E','F','G',
426 'H','I','J','K', 'L','M','N','O',
427 'P','Q','R','S', 'T','U','V','W',
428 'X','Y','Z','[', '\\',']','^','_',
429 '`','A','B','C', 'D','E','F','G',
430 'H','I','J','K', 'L','M','N','O',
431 'P','Q','R','S', 'T','U','V','W',
432 'X','Y','Z','{', '|','}','~',127,
434 128,129,130,131, 132,133,134,135,
435 136,137,138,139, 140,141,142,143,
436 144,145,146,147, 148,149,150,151,
437 152,153,154,155, 156,157,158,159,
438 160,161,162,163, 164,165,166,167,
439 168,169,170,171, 172,173,174,175,
440 176,177,178,179, 180,181,182,183,
441 184,185,186,187, 188,189,190,191,
442 192,193,194,195, 196,197,198,199,
443 200,201,202,203, 204,205,206,207,
444 208,209,210,211, 212,213,214,215,
445 216,217,218,219, 220,221,222,223,
446 224,225,226,227, 228,229,230,231,
447 232,233,234,235, 236,237,238,239,
448 240,241,242,243, 244,245,246,247,
449 248,249,250,251, 252,253,254,255,
452 const int __ctype_tolower_array
[384] =
454 128,129,130,131, 132,133,134,135,
455 136,137,138,139, 140,141,142,143,
456 144,145,146,147, 148,149,150,151,
457 152,153,154,155, 156,157,158,159,
458 160,161,162,163, 164,165,166,167,
459 168,169,170,171, 172,173,174,175,
460 176,177,178,179, 180,181,182,183,
461 184,185,186,187, 188,189,190,191,
462 192,193,194,195, 196,197,198,199,
463 200,201,202,203, 204,205,206,207,
464 208,209,210,211, 212,213,214,215,
465 216,217,218,219, 220,221,222,223,
466 224,225,226,227, 228,229,230,231,
467 232,233,234,235, 236,237,238,239,
468 240,241,242,243, 244,245,246,247,
469 248,249,250,251, 252,253,254,255,
471 0, 1, 2, 3, 4, 5, 6, 7,
472 8, 9, 10, 11, 12, 13, 14, 15,
473 16, 17, 18, 19, 20, 21, 22, 23,
474 24, 25, 26, 27, 28, 29, 30, 31,
475 ' ','!','"','#', '$','%','&','\'',
476 '(',')','*','+', ',','-','.','/',
477 '0','1','2','3', '4','5','6','7',
478 '8','9',':',';', '<','=','>','?',
479 '@','a','b','c', 'd','e','f','g',
480 'h','i','j','k', 'l','m','n','o',
481 'p','q','r','s', 't','u','v','w',
482 'x','y','z','[', '\\',']','^','_',
483 '`','a','b','c', 'd','e','f','g',
484 'h','i','j','k', 'l','m','n','o',
485 'p','q','r','s', 't','u','v','w',
486 'x','y','z','{', '|','}','~',127,
488 128,129,130,131, 132,133,134,135,
489 136,137,138,139, 140,141,142,143,
490 144,145,146,147, 148,149,150,151,
491 152,153,154,155, 156,157,158,159,
492 160,161,162,163, 164,165,166,167,
493 168,169,170,171, 172,173,174,175,
494 176,177,178,179, 180,181,182,183,
495 184,185,186,187, 188,189,190,191,
496 192,193,194,195, 196,197,198,199,
497 200,201,202,203, 204,205,206,207,
498 208,209,210,211, 212,213,214,215,
499 216,217,218,219, 220,221,222,223,
500 224,225,226,227, 228,229,230,231,
501 232,233,234,235, 236,237,238,239,
502 240,241,242,243, 244,245,246,247,
503 248,249,250,251, 252,253,254,255,
508 static int __ctype_init(void)
510 __ctype_b
= &__ctype_b_array
[128];
511 __ctype_toupper
= &__ctype_toupper_array
[128];
512 __ctype_tolower
= &__ctype_tolower_array
[128];
517 ADD2INIT(__ctype_init
, 20);
521 /*****************************************************************************
532 Test if a character is uppercase. Works for all characters between
533 -128 and 255 inclusive both.
536 c - The character to test.
539 != 0 if the character is uppercase, 0 otherwise.
544 isupper ('A') -> true
545 isupper ('a') -> false
546 isupper ('0') -> false
547 isupper ('.') -> false
548 isupper ('\n') -> false
549 isupper ('\001') -> false
550 isupper (EOF) -> false
558 ******************************************************************************/
559 /*****************************************************************************
570 Test if a character is lowercase. Works for all characters between
571 -128 and 255 inclusive both.
574 c - The character to test.
577 != 0 if the character is lowercase, 0 otherwise.
582 islower ('A') -> false
583 islower ('a') -> true
584 islower ('0') -> false
585 islower ('.') -> false
586 islower ('\n') -> false
587 islower ('\001') -> false
588 islower (EOF) -> false
596 ******************************************************************************/
597 /******************************************************************************
608 Test if a character is an alphabetic character. Works for all
609 characters between -128 and 255 inclusive both.
612 c - The character to test.
615 != 0 if the character is an alphabetic character, 0 otherwise.
620 isalpha ('A') -> true
621 isalpha ('a') -> true
622 isalpha ('0') -> false
623 isalpha ('.') -> false
624 isalpha ('\n') -> false
625 isalpha ('\001') -> false
626 isalpha (EOF) -> false
634 ******************************************************************************/
635 /*****************************************************************************
646 Test if a character is an alphabetic character or a digit. Works
647 for all characters between -128 and 255 inclusive both.
650 c - The character to test.
653 != 0 if the character is alphabetic character or a digit, 0 otherwise.
658 isalnum ('A') -> true
659 isalnum ('a') -> true
660 isalnum ('0') -> true
661 isalnum ('.') -> false
662 isalnum ('\n') -> false
663 isalnum ('\001') -> false
664 isalnum (EOF) -> false
672 ******************************************************************************/
673 /*****************************************************************************
684 Test if a character is an ascii character. Works for all characters
685 between -128 and 255 inclusive both.
688 c - The character to test.
691 != 0 if the character is an ascii character, 0 otherwise.
696 isascii ('A') -> true
697 isascii ('a') -> true
698 isascii ('0') -> true
699 isascii ('.') -> true
700 isascii ('\n') -> true
701 isascii ('\001') -> true
702 isascii (EOF) -> false
710 ******************************************************************************/
711 /*****************************************************************************
722 Test if a character is a space or a tab. Works for all characters
723 between -128 and 255 inclusive both.
726 c - The character to test.
729 != 0 if the character is a space or tab, 0 otherwise.
734 isblank ('A') -> false
735 isblank ('a') -> false
736 isblank ('0') -> false
737 isblank ('.') -> false
738 isblank (' ') -> true
739 isblank ('\n') -> false
740 isblank ('\001') -> false
741 isblank (EOF) -> false
749 ******************************************************************************/
750 /*****************************************************************************
761 Test if a character is a control character. Works for all
762 characters between -128 and 255 inclusive both.
765 c - The character to test.
768 != 0 if the character is a control character, 0 otherwise.
773 iscntrl ('A') -> false
774 iscntrl ('a') -> false
775 iscntrl ('0') -> false
776 iscntrl ('.') -> false
777 iscntrl ('\n') -> true
778 iscntrl ('\001') -> true
779 iscntrl (EOF) -> false
787 ******************************************************************************/
788 /*****************************************************************************
799 Test if a character is a digit. Works for all characters between
800 -128 and 255 inclusive both.
803 c - The character to test.
806 != 0 if the character is a digit, 0 otherwise.
811 isdigit ('A') -> false
812 isdigit ('a') -> false
813 isdigit ('0') -> true
814 isdigit ('.') -> false
815 isdigit ('\n') -> false
816 isdigit ('\001') -> false
817 isdigit (EOF) -> false
825 ******************************************************************************/
826 /*****************************************************************************
837 Test if a character is a printable character but no whitespace.
838 Works for all characters between -128 and 255 inclusive both.
841 c - The character to test.
844 != 0 if the character is a printable character but no whitespace, 0
850 isgraph ('A') -> true
851 isgraph ('a') -> true
852 isgraph ('0') -> true
853 isgraph ('.') -> true
854 isgraph ('\n') -> false
855 isgraph ('\001') -> false
856 isgraph (EOF) -> false
864 ******************************************************************************/
865 /*****************************************************************************
876 Test if a character is a printable character. Works for all
877 characters between -128 and 255 inclusive both.
880 c - The character to test.
883 != 0 if the character is a printable character, 0 otherwise.
888 isprint ('A') -> true
889 isprint ('a') -> true
890 isprint ('0') -> true
891 isprint ('.') -> true
892 isprint ('\n') -> true
893 isprint ('\001') -> false
894 isprint (EOF) -> false
902 ******************************************************************************/
903 /*****************************************************************************
914 Test if a character is whitespace. Works for all characters between
915 -128 and 255 inclusive both.
918 c - The character to test.
921 != 0 if the character is whitespace, 0 otherwise.
926 isspace ('A') -> false
927 isspace ('a') -> false
928 isspace ('0') -> false
929 isspace ('.') -> false
930 isspace ('\n') -> true
931 isspace ('\001') -> false
932 isspace (EOF) -> false
940 ******************************************************************************/
941 /*****************************************************************************
952 Test if a character is printable but not alphanumeric. Works for
953 all characters between -128 and 255 inclusive both.
956 c - The character to test.
959 != 0 if the character is printable but not alphanumeric, 0
965 ispunct ('A') -> false
966 ispunct ('a') -> false
967 ispunct ('0') -> false
968 ispunct ('.') -> true
969 ispunct ('\n') -> false
970 ispunct ('\001') -> false
971 ispunct (EOF) -> false
979 ******************************************************************************/
980 /*****************************************************************************
991 Test if a character is a hexadecimal digit. Works for all
992 characters between -128 and 255 inclusive both.
995 c - The character to test.
998 != 0 if the character is a hexadecimal digit, 0 otherwise.
1003 isxdigit ('A') -> true
1004 isxdigit ('a') -> true
1005 isxdigit ('x') -> false
1006 isxdigit ('0') -> true
1007 isxdigit ('.') -> false
1008 isxdigit ('\n') -> false
1009 isxdigit ('\001') -> false
1010 isxdigit (EOF) -> false
1018 ******************************************************************************/