This source file includes following definitions.
- c_isalnum
- c_isalpha
- c_isascii
- c_isblank
- c_iscntrl
- c_isdigit
- c_isgraph
- c_islower
- c_isprint
- c_ispunct
- c_isspace
- c_isupper
- c_isxdigit
- c_tolower
- c_toupper
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #ifndef C_CTYPE_H
25 #define C_CTYPE_H
26
27 #ifndef _GL_INLINE_HEADER_BEGIN
28 #error "Please include config.h first."
29 #endif
30 _GL_INLINE_HEADER_BEGIN
31 #ifndef C_CTYPE_INLINE
32 # define C_CTYPE_INLINE _GL_INLINE
33 #endif
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39
40
41
42
43
44
45
46
47
48 #if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
49 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
50 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
51 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
52 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
53 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
54 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
55 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
56 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
57 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
58 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
59 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
60 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
61 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
62 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
63 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
64 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
65 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
66 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
67 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
68 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
69 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
70 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)
71
72
73 # define C_CTYPE_ASCII 1
74 #elif ! (' ' == '\x40' && '0' == '\xf0' \
75 && 'A' == '\xc1' && 'J' == '\xd1' && 'S' == '\xe2' \
76 && 'a' == '\x81' && 'j' == '\x91' && 's' == '\xa2')
77 # error "Only ASCII and EBCDIC are supported"
78 #endif
79
80 #if 'A' < 0
81 # error "EBCDIC and char is signed -- not supported"
82 #endif
83
84
85
86 #define _C_CTYPE_CNTRL \
87 case '\a': case '\b': case '\f': case '\n': \
88 case '\r': case '\t': case '\v': \
89 _C_CTYPE_OTHER_CNTRL
90
91
92
93 #if C_CTYPE_ASCII
94 # define _C_CTYPE_OTHER_CNTRL \
95 case '\x00': case '\x01': case '\x02': case '\x03': \
96 case '\x04': case '\x05': case '\x06': case '\x0e': \
97 case '\x0f': case '\x10': case '\x11': case '\x12': \
98 case '\x13': case '\x14': case '\x15': case '\x16': \
99 case '\x17': case '\x18': case '\x19': case '\x1a': \
100 case '\x1b': case '\x1c': case '\x1d': case '\x1e': \
101 case '\x1f': case '\x7f'
102 #else
103
104
105 # define _C_CTYPE_OTHER_CNTRL \
106 case '\x00': case '\x01': case '\x02': case '\x03': \
107 case '\x07': case '\x0e': case '\x0f': case '\x10': \
108 case '\x11': case '\x12': case '\x13': case '\x18': \
109 case '\x19': case '\x1c': case '\x1d': case '\x1e': \
110 case '\x1f': case '\x26': case '\x27': case '\x2d': \
111 case '\x2e': case '\x32': case '\x37': case '\x3c': \
112 case '\x3d': case '\x3f'
113 #endif
114
115
116
117 #define _C_CTYPE_LOWER_A_THRU_F_N(N) \
118 case 'a' + (N): case 'b' + (N): case 'c' + (N): case 'd' + (N): \
119 case 'e' + (N): case 'f' + (N)
120 #define _C_CTYPE_LOWER_N(N) \
121 _C_CTYPE_LOWER_A_THRU_F_N(N): \
122 case 'g' + (N): case 'h' + (N): case 'i' + (N): case 'j' + (N): \
123 case 'k' + (N): case 'l' + (N): case 'm' + (N): case 'n' + (N): \
124 case 'o' + (N): case 'p' + (N): case 'q' + (N): case 'r' + (N): \
125 case 's' + (N): case 't' + (N): case 'u' + (N): case 'v' + (N): \
126 case 'w' + (N): case 'x' + (N): case 'y' + (N): case 'z' + (N)
127
128
129
130 #define _C_CTYPE_A_THRU_F \
131 _C_CTYPE_LOWER_A_THRU_F_N (0): \
132 _C_CTYPE_LOWER_A_THRU_F_N ('A' - 'a')
133 #define _C_CTYPE_DIGIT \
134 case '0': case '1': case '2': case '3': \
135 case '4': case '5': case '6': case '7': \
136 case '8': case '9'
137 #define _C_CTYPE_LOWER _C_CTYPE_LOWER_N (0)
138 #define _C_CTYPE_PUNCT \
139 case '!': case '"': case '#': case '$': \
140 case '%': case '&': case '\'': case '(': \
141 case ')': case '*': case '+': case ',': \
142 case '-': case '.': case '/': case ':': \
143 case ';': case '<': case '=': case '>': \
144 case '?': case '@': case '[': case '\\': \
145 case ']': case '^': case '_': case '`': \
146 case '{': case '|': case '}': case '~'
147 #define _C_CTYPE_UPPER _C_CTYPE_LOWER_N ('A' - 'a')
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167 C_CTYPE_INLINE bool
168 c_isalnum (int c)
169 {
170 switch (c)
171 {
172 _C_CTYPE_DIGIT:
173 _C_CTYPE_LOWER:
174 _C_CTYPE_UPPER:
175 return true;
176 default:
177 return false;
178 }
179 }
180
181 C_CTYPE_INLINE bool
182 c_isalpha (int c)
183 {
184 switch (c)
185 {
186 _C_CTYPE_LOWER:
187 _C_CTYPE_UPPER:
188 return true;
189 default:
190 return false;
191 }
192 }
193
194
195
196 C_CTYPE_INLINE bool
197 c_isascii (int c)
198 {
199 switch (c)
200 {
201 case ' ':
202 _C_CTYPE_CNTRL:
203 _C_CTYPE_DIGIT:
204 _C_CTYPE_LOWER:
205 _C_CTYPE_PUNCT:
206 _C_CTYPE_UPPER:
207 return true;
208 default:
209 return false;
210 }
211 }
212
213 C_CTYPE_INLINE bool
214 c_isblank (int c)
215 {
216 return c == ' ' || c == '\t';
217 }
218
219 C_CTYPE_INLINE bool
220 c_iscntrl (int c)
221 {
222 switch (c)
223 {
224 _C_CTYPE_CNTRL:
225 return true;
226 default:
227 return false;
228 }
229 }
230
231 C_CTYPE_INLINE bool
232 c_isdigit (int c)
233 {
234 switch (c)
235 {
236 _C_CTYPE_DIGIT:
237 return true;
238 default:
239 return false;
240 }
241 }
242
243 C_CTYPE_INLINE bool
244 c_isgraph (int c)
245 {
246 switch (c)
247 {
248 _C_CTYPE_DIGIT:
249 _C_CTYPE_LOWER:
250 _C_CTYPE_PUNCT:
251 _C_CTYPE_UPPER:
252 return true;
253 default:
254 return false;
255 }
256 }
257
258 C_CTYPE_INLINE bool
259 c_islower (int c)
260 {
261 switch (c)
262 {
263 _C_CTYPE_LOWER:
264 return true;
265 default:
266 return false;
267 }
268 }
269
270 C_CTYPE_INLINE bool
271 c_isprint (int c)
272 {
273 switch (c)
274 {
275 case ' ':
276 _C_CTYPE_DIGIT:
277 _C_CTYPE_LOWER:
278 _C_CTYPE_PUNCT:
279 _C_CTYPE_UPPER:
280 return true;
281 default:
282 return false;
283 }
284 }
285
286 C_CTYPE_INLINE bool
287 c_ispunct (int c)
288 {
289 switch (c)
290 {
291 _C_CTYPE_PUNCT:
292 return true;
293 default:
294 return false;
295 }
296 }
297
298 C_CTYPE_INLINE bool
299 c_isspace (int c)
300 {
301 switch (c)
302 {
303 case ' ': case '\t': case '\n': case '\v': case '\f': case '\r':
304 return true;
305 default:
306 return false;
307 }
308 }
309
310 C_CTYPE_INLINE bool
311 c_isupper (int c)
312 {
313 switch (c)
314 {
315 _C_CTYPE_UPPER:
316 return true;
317 default:
318 return false;
319 }
320 }
321
322 C_CTYPE_INLINE bool
323 c_isxdigit (int c)
324 {
325 switch (c)
326 {
327 _C_CTYPE_DIGIT:
328 _C_CTYPE_A_THRU_F:
329 return true;
330 default:
331 return false;
332 }
333 }
334
335 C_CTYPE_INLINE int
336 c_tolower (int c)
337 {
338 switch (c)
339 {
340 _C_CTYPE_UPPER:
341 return c - 'A' + 'a';
342 default:
343 return c;
344 }
345 }
346
347 C_CTYPE_INLINE int
348 c_toupper (int c)
349 {
350 switch (c)
351 {
352 _C_CTYPE_LOWER:
353 return c - 'a' + 'A';
354 default:
355 return c;
356 }
357 }
358
359 #ifdef __cplusplus
360 }
361 #endif
362
363 _GL_INLINE_HEADER_END
364
365 #endif