2 * Character classification and conversion */
9 /* For now, just always use the functions instead of the macros...*/
10 #define __USE_CTYPE_C_FUNCTIONS
12 /* Locale-compatible macros/inlines have yet to be implemented. */
13 #if defined(__UCLIBC_HAS_LOCALE__) && !defined(__USE_CTYPE_C_FUNCTIONS)
14 #define __USE_CTYPE_C_FUNCTIONS
17 #ifdef __USE_CTYPE_C_FUNCTIONS
18 /* function prototpes */
19 extern int isalnum(int c);
20 extern int isalpha(int c);
21 extern int isascii(int c);
22 extern int iscntrl(int c);
23 extern int isdigit(int c);
24 extern int isgraph(int c);
25 extern int islower(int c);
26 extern int isprint(int c);
27 extern int ispunct(int c);
28 extern int isspace(int c);
29 extern int isupper(int c);
30 extern int isxdigit(int c);
31 extern int isxlower(int c);
32 extern int isxupper(int c);
33 extern int toascii(int c);
34 extern int tolower(int c);
35 extern int toupper(int c);
39 /* macro definitions */
40 #define isalnum(c) (isalpha(c) || isdigit(c))
41 #define isalpha(c) (isupper(c) || islower(c))
42 #define isascii(c) (c > 0 && c <= 0x7f)
43 #define iscntrl(c) ((c >= 0) && ((c <= 0x1F) || (c == 0x7f)))
44 #define isdigit(c) (c >= '0' && c <= '9')
45 #define isgraph(c) (c != ' ' && isprint(c))
46 #define islower(c) (c >= 'a' && c <= 'z')
47 #define isprint(c) (c >= ' ' && c <= '~')
48 #define ispunct(c) ((c > ' ' && c <= '~') && !isalnum(c))
49 #define isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' ||\
50 c == '\t' || c == '\v')
51 #define isupper(c) (c >= 'A' && c <= 'Z')
52 #define isxdigit(c) (isxupper(c) || isxlower(c))
53 #define isxlower(c) (isdigit(c) || (c >= 'a' && c <= 'f'))
54 #define isxupper(c) (isdigit(c) || (c >= 'A' && c <= 'F'))
55 #define toascii(c) (c & 0x7f)
56 #define tolower(c) (isupper(c) ? ( c - 'A' + 'a') : (c))
57 #define toupper(c) (islower(c) ? (c - 'a' + 'A') : (c))
61 #endif /* __CTYPE_H */