Clean up embedded Makefile targets; fix build failure
[syslinux.git] / com32 / include / ctype.h
blob89b6e6dd2027d08691a725a43b9b6aa2d1062d6e
1 /*
2 * ctype.h
4 * This assumes ISO 8859-1, being a reasonable superset of ASCII.
5 */
7 #ifndef _CTYPE_H
8 #define _CTYPE_H
10 #ifndef __CTYPE_NO_INLINE
11 # define __ctype_inline static __inline__
12 #else
13 # define __ctype_inline
14 #endif
17 * This relies on the following definitions:
19 * cntrl = !print
20 * alpha = upper|lower
21 * graph = punct|alpha|digit
22 * blank = '\t' || ' ' (per POSIX requirement)
24 enum {
25 __ctype_upper = (1 << 0),
26 __ctype_lower = (1 << 1),
27 __ctype_digit = (1 << 2),
28 __ctype_xdigit = (1 << 3),
29 __ctype_space = (1 << 4),
30 __ctype_print = (1 << 5),
31 __ctype_punct = (1 << 6),
32 __ctype_cntrl = (1 << 7),
35 extern const unsigned char __ctypes[];
37 __ctype_inline int isalnum(int __c)
39 return __ctypes[__c+1] &
40 (__ctype_upper|__ctype_lower|__ctype_digit);
43 __ctype_inline int isalpha(int __c)
45 return __ctypes[__c+1] &
46 (__ctype_upper|__ctype_lower);
49 __ctype_inline int isascii(int __c)
51 return !(__c & ~0x7f);
54 __ctype_inline int isblank(int __c)
56 return (__c == '\t') || (__c == ' ');
59 __ctype_inline int iscntrl(int __c)
61 return __ctypes[__c+1] & __ctype_cntrl;
64 __ctype_inline int isdigit(int __c)
66 return ((unsigned)__c - '0') <= 9;
69 __ctype_inline int isgraph(int __c)
71 return __ctypes[__c+1] &
72 (__ctype_upper|__ctype_lower|__ctype_digit|__ctype_punct);
75 __ctype_inline int islower(int __c)
77 return __ctypes[__c+1] & __ctype_lower;
80 __ctype_inline int isprint(int __c)
82 return __ctypes[__c+1] & __ctype_print;
85 __ctype_inline int ispunct(int __c)
87 return __ctypes[__c+1] & __ctype_punct;
90 __ctype_inline int isspace(int __c)
92 return __ctypes[__c+1] & __ctype_space;
95 __ctype_inline int isupper(int __c)
97 return __ctypes[__c+1] & __ctype_upper;
100 __ctype_inline int isxdigit(int __c)
102 return __ctypes[__c+1] & __ctype_xdigit;
105 /* Note: this is decimal, not hex, to avoid accidental promotion to unsigned */
106 #define _toupper(__c) ((__c) & ~32)
107 #define _tolower(__c) ((__c) | 32)
109 __ctype_inline int toupper(int __c)
111 return islower(__c) ? _toupper(__c) : __c;
114 __ctype_inline int tolower(int __c)
116 return isupper(__c) ? _tolower(__c) : __c;
119 #endif /* _CTYPE_H */