5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
8 Desc: ANSI-C header file ctype.h
12 #include <sys/arosc.h>
13 #include <sys/cdefs.h>
15 #define _ISupper 0x0001 /* UPPERCASE */
16 #define _ISlower 0x0002 /* lowercase */
17 #define _ISalpha 0x0004 /* a-y */
18 #define _ISdigit 0x0008 /* 0-9 */
19 #define _ISxdigit 0x0010 /* 0-9, a-f, A-F */
20 #define _ISspace 0x0020 /* Space, Tab, CR, LF, FF */
21 #define _ISprint 0x0040 /* 32-126, 160-255 */
22 #define _ISgraph 0x0080 /* [] */
23 #define _ISblank 0x0100 /* Space, Tab */
24 #define _IScntrl 0x0200 /* 0-31, 127 */
25 #define _ISpunct 0x0400 /* .,:;!? */
26 #define _ISalnum (_ISalpha | _ISdigit)
28 #define __ctype_b (__get_arosc_userdata()->acud_ctype_b)
29 #define __ctype_toupper (__get_arosc_userdata()->acud_ctype_toupper)
30 #define __ctype_tolower (__get_arosc_userdata()->acud_ctype_tolower)
32 #define _istype(c,type) \
33 (__ctype_b[(int) (c)] & (unsigned short int) (type))
35 #define __ctype_make_func(__name__, __body__) \
37 static __inline__ int __name__(int c); \
39 static __inline__ int __name__(int c) \
42 __ctype_make_func(isupper
, _istype(c
,_ISupper
))
43 __ctype_make_func(islower
, _istype(c
,_ISlower
))
44 __ctype_make_func(isalpha
, _istype(c
,_ISalpha
))
45 __ctype_make_func(isdigit
, _istype(c
,_ISdigit
))
46 __ctype_make_func(isxdigit
, _istype(c
,_ISxdigit
))
47 __ctype_make_func(isspace
, _istype(c
,_ISspace
))
48 __ctype_make_func(isprint
, _istype(c
,_ISprint
))
49 __ctype_make_func(isgraph
, _istype(c
,_ISgraph
))
50 __ctype_make_func(isblank
, _istype(c
,_ISblank
))
51 __ctype_make_func(iscntrl
, _istype(c
,_IScntrl
))
52 __ctype_make_func(ispunct
, _istype(c
,_ISpunct
))
53 __ctype_make_func(isalnum
, _istype(c
,_ISalnum
))
54 __ctype_make_func(isascii
, (c
& ~0x7F) == 0)
55 __ctype_make_func(toascii
, c
& 0x7F)
56 __ctype_make_func(iscsym
, isalnum(c
) || toascii(c
) == 0x5F)
57 __ctype_make_func(iscsymf
, isalpha(c
) || toascii(c
) == 0x5F)
58 __ctype_make_func(toupper
, __ctype_toupper
[c
])
59 __ctype_make_func(tolower
, __ctype_tolower
[c
])
61 #endif /* _CTYPE_H_ */