annotate lib/c-ctype.c @ 17464:290d581e2e24

autoupdate
author Karl Berry <karl@freefriends.org>
date Sat, 10 Aug 2013 07:10:55 -0700
parents e542fd46ad6f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4218
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Character handling in C locale.
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16366
diff changeset
3 Copyright 2000-2003, 2006, 2009-2013 Free Software Foundation, Inc.
4218
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 the Free Software Foundation; either version 2 of the License, or
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 (at your option) any later version.
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
16366
bb182ee4a09d maint: replace FSF snail-mail addresses with URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
4218
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
7471
49b97d5983be Make it possible to #define c_isascii etc. to aliases.
Bruno Haible <bruno@clisp.org>
parents: 7009
diff changeset
18 #include <config.h>
4218
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
7471
49b97d5983be Make it possible to #define c_isascii etc. to aliases.
Bruno Haible <bruno@clisp.org>
parents: 7009
diff changeset
20 /* Specification. */
49b97d5983be Make it possible to #define c_isascii etc. to aliases.
Bruno Haible <bruno@clisp.org>
parents: 7009
diff changeset
21 #define NO_C_CTYPE_MACROS
49b97d5983be Make it possible to #define c_isascii etc. to aliases.
Bruno Haible <bruno@clisp.org>
parents: 7009
diff changeset
22 #include "c-ctype.h"
4218
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 /* The function isascii is not locale dependent. Its use in EBCDIC is
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 questionable. */
14612
6ef4f1f39105 Revert "use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE"
Jim Meyering <meyering@redhat.com>
parents: 14610
diff changeset
26 bool
4218
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 c_isascii (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 {
4219
4665ee17573f Optimization and comments.
Bruno Haible <bruno@clisp.org>
parents: 4218
diff changeset
29 return (c >= 0x00 && c <= 0x7f);
4218
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 c_isalnum (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 #if C_CTYPE_CONSECUTIVE_DIGITS \
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 return ((c >= '0' && c <= '9')
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'));
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 return ((c >= '0' && c <= '9')
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 || (c >= 'A' && c <= 'Z')
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 || (c >= 'a' && c <= 'z'));
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 case '0': case '1': case '2': case '3': case '4': case '5':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 case '6': case '7': case '8': case '9':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 case 'Y': case 'Z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 case 's': case 't': case 'u': case 'v': case 'w': case 'x':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 case 'y': case 'z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 c_isalpha (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
82 case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
83 case 'Y': case 'Z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
84 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86 case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87 case 's': case 't': case 'u': case 'v': case 'w': case 'x':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88 case 'y': case 'z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 c_isblank (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
98 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 return (c == ' ' || c == '\t');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
102 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 c_iscntrl (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
104 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106 return ((c & ~0x1f) == 0 || c == 0x7f);
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
107 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
108 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
109 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
110 case ' ': case '!': case '"': case '#': case '$': case '%':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
111 case '&': case '\'': case '(': case ')': case '*': case '+':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
112 case ',': case '-': case '.': case '/':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
113 case '0': case '1': case '2': case '3': case '4': case '5':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114 case '6': case '7': case '8': case '9':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
115 case ':': case ';': case '<': case '=': case '>': case '?':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
116 case '@':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
118 case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
119 case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120 case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
121 case 'Y': case 'Z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
122 case '[': case '\\': case ']': case '^': case '_': case '`':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
123 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124 case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
125 case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 case 's': case 't': case 'u': case 'v': case 'w': case 'x':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
127 case 'y': case 'z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
128 case '{': case '|': case '}': case '~':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
131 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
132 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
135
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
137 c_isdigit (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
138 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
139 #if C_CTYPE_CONSECUTIVE_DIGITS
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
140 return (c >= '0' && c <= '9');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
141 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
142 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
143 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
144 case '0': case '1': case '2': case '3': case '4': case '5':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
145 case '6': case '7': case '8': case '9':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
146 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
147 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
148 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
149 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
150 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
151 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
152
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
153 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
154 c_islower (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
155 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
156 #if C_CTYPE_CONSECUTIVE_LOWERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
157 return (c >= 'a' && c <= 'z');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
158 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
159 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
160 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
161 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
162 case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
163 case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
164 case 's': case 't': case 'u': case 'v': case 'w': case 'x':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
165 case 'y': case 'z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
166 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
167 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
168 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
169 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
170 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
171 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
172
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
173 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
174 c_isgraph (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
175 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
176 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
177 return (c >= '!' && c <= '~');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
178 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
179 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
180 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
181 case '!': case '"': case '#': case '$': case '%': case '&':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
182 case '\'': case '(': case ')': case '*': case '+': case ',':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
183 case '-': case '.': case '/':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
184 case '0': case '1': case '2': case '3': case '4': case '5':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
185 case '6': case '7': case '8': case '9':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
186 case ':': case ';': case '<': case '=': case '>': case '?':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
187 case '@':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
188 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
189 case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
190 case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
191 case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
192 case 'Y': case 'Z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
193 case '[': case '\\': case ']': case '^': case '_': case '`':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
194 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
195 case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
196 case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
197 case 's': case 't': case 'u': case 'v': case 'w': case 'x':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
198 case 'y': case 'z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
199 case '{': case '|': case '}': case '~':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
200 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
201 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
202 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
203 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
204 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
205 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
206
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
207 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
208 c_isprint (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
209 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
210 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
211 return (c >= ' ' && c <= '~');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
212 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
213 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
214 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
215 case ' ': case '!': case '"': case '#': case '$': case '%':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
216 case '&': case '\'': case '(': case ')': case '*': case '+':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
217 case ',': case '-': case '.': case '/':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
218 case '0': case '1': case '2': case '3': case '4': case '5':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
219 case '6': case '7': case '8': case '9':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
220 case ':': case ';': case '<': case '=': case '>': case '?':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
221 case '@':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
222 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
223 case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
224 case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
225 case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
226 case 'Y': case 'Z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
227 case '[': case '\\': case ']': case '^': case '_': case '`':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
228 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
229 case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
230 case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
231 case 's': case 't': case 'u': case 'v': case 'w': case 'x':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
232 case 'y': case 'z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
233 case '{': case '|': case '}': case '~':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
234 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
235 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
236 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
237 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
238 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
239 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
240
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
241 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
242 c_ispunct (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
243 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
244 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
245 return ((c >= '!' && c <= '~')
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
246 && !((c >= '0' && c <= '9')
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
247 || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')));
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
248 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
249 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
250 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
251 case '!': case '"': case '#': case '$': case '%': case '&':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
252 case '\'': case '(': case ')': case '*': case '+': case ',':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
253 case '-': case '.': case '/':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
254 case ':': case ';': case '<': case '=': case '>': case '?':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
255 case '@':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
256 case '[': case '\\': case ']': case '^': case '_': case '`':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
257 case '{': case '|': case '}': case '~':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
258 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
259 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
260 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
261 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
262 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
263 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
264
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
265 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
266 c_isspace (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
267 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
268 return (c == ' ' || c == '\t'
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
269 || c == '\n' || c == '\v' || c == '\f' || c == '\r');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
270 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
271
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
272 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
273 c_isupper (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
274 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
275 #if C_CTYPE_CONSECUTIVE_UPPERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
276 return (c >= 'A' && c <= 'Z');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
277 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
278 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
279 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
280 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
281 case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
282 case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
283 case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
284 case 'Y': case 'Z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
285 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
286 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
287 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
288 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
289 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
290 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
291
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
292 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
293 c_isxdigit (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
294 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
295 #if C_CTYPE_CONSECUTIVE_DIGITS \
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
296 && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
297 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
298 return ((c >= '0' && c <= '9')
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
299 || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F'));
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
300 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
301 return ((c >= '0' && c <= '9')
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
302 || (c >= 'A' && c <= 'F')
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
303 || (c >= 'a' && c <= 'f'));
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
304 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
305 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
306 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
307 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
308 case '0': case '1': case '2': case '3': case '4': case '5':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
309 case '6': case '7': case '8': case '9':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
310 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
311 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
312 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
313 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
314 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
315 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
316 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
317 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
318
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
319 int
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
320 c_tolower (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
321 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
322 #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
323 return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c);
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
324 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
325 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
326 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
327 case 'A': return 'a';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
328 case 'B': return 'b';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
329 case 'C': return 'c';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
330 case 'D': return 'd';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
331 case 'E': return 'e';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
332 case 'F': return 'f';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
333 case 'G': return 'g';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
334 case 'H': return 'h';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
335 case 'I': return 'i';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
336 case 'J': return 'j';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
337 case 'K': return 'k';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
338 case 'L': return 'l';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
339 case 'M': return 'm';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
340 case 'N': return 'n';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
341 case 'O': return 'o';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
342 case 'P': return 'p';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
343 case 'Q': return 'q';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
344 case 'R': return 'r';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
345 case 'S': return 's';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
346 case 'T': return 't';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
347 case 'U': return 'u';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
348 case 'V': return 'v';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
349 case 'W': return 'w';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
350 case 'X': return 'x';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
351 case 'Y': return 'y';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
352 case 'Z': return 'z';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
353 default: return c;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
354 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
355 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
356 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
357
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
358 int
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
359 c_toupper (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
360 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
361 #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
362 return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c);
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
363 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
364 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
365 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
366 case 'a': return 'A';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
367 case 'b': return 'B';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
368 case 'c': return 'C';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
369 case 'd': return 'D';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
370 case 'e': return 'E';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
371 case 'f': return 'F';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
372 case 'g': return 'G';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
373 case 'h': return 'H';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
374 case 'i': return 'I';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
375 case 'j': return 'J';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
376 case 'k': return 'K';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
377 case 'l': return 'L';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
378 case 'm': return 'M';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
379 case 'n': return 'N';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
380 case 'o': return 'O';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
381 case 'p': return 'P';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
382 case 'q': return 'Q';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
383 case 'r': return 'R';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
384 case 's': return 'S';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
385 case 't': return 'T';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
386 case 'u': return 'U';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
387 case 'v': return 'V';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
388 case 'w': return 'W';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
389 case 'x': return 'X';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
390 case 'y': return 'Y';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
391 case 'z': return 'Z';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
392 default: return c;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
393 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
394 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
395 }