annotate lib/c-ctype.c @ 14612:6ef4f1f39105

Revert "use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE" This reverts commit 349d7fe0e307d59d508b3579317ee8d4eacfeb9c. Revert accidentally-pushed patch. Not yet ready.
author Jim Meyering <meyering@redhat.com>
date Mon, 25 Apr 2011 10:38:33 +0200
parents b427a1938336
children 8250f2777afc
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
14079
97fc9a21a8fb maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents: 12559
diff changeset
3 Copyright 2000-2003, 2006, 2009-2011 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
7009
d531215a47b2 Linebreak copyright message.
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
16 along with this program; if not, write to the Free Software Foundation,
d531215a47b2 Linebreak copyright message.
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
4218
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
7471
49b97d5983be Make it possible to #define c_isascii etc. to aliases.
Bruno Haible <bruno@clisp.org>
parents: 7009
diff changeset
19 #include <config.h>
4218
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
7471
49b97d5983be Make it possible to #define c_isascii etc. to aliases.
Bruno Haible <bruno@clisp.org>
parents: 7009
diff changeset
21 /* Specification. */
49b97d5983be Make it possible to #define c_isascii etc. to aliases.
Bruno Haible <bruno@clisp.org>
parents: 7009
diff changeset
22 #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
23 #include "c-ctype.h"
4218
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 /* 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
26 questionable. */
14612
6ef4f1f39105 Revert "use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE"
Jim Meyering <meyering@redhat.com>
parents: 14610
diff changeset
27 bool
4218
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 c_isascii (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 {
4219
4665ee17573f Optimization and comments.
Bruno Haible <bruno@clisp.org>
parents: 4218
diff changeset
30 return (c >= 0x00 && c <= 0x7f);
4218
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 c_isalnum (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 #if C_CTYPE_CONSECUTIVE_DIGITS \
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 return ((c >= '0' && c <= '9')
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'));
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 return ((c >= '0' && c <= '9')
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 || (c >= 'a' && c <= 'z'));
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 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
50 case '6': case '7': case '8': case '9':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 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
52 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
53 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
54 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
55 case 'Y': case 'Z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 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
57 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
58 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
59 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
60 case 'y': case 'z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 #endif
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 c_isalpha (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75 return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 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
81 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
82 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
83 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
84 case 'Y': case 'Z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 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
86 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
87 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
88 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
89 case 'y': case 'z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 #endif
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
98 c_isblank (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 return (c == ' ' || c == '\t');
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
104 c_iscntrl (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
107 return ((c & ~0x1f) == 0 || c == 0x7f);
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
108 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
109 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
110 {
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 ')': case '*': case '+':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
113 case ',': case '-': case '.': case '/':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114 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
115 case '6': case '7': case '8': case '9':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
116 case ':': case ';': case '<': case '=': case '>': case '?':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 case '@':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
118 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
119 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
120 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
121 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
122 case 'Y': case 'Z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
123 case '[': case '\\': case ']': case '^': case '_': case '`':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124 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
125 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
126 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
127 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
128 case 'y': case 'z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129 case '{': case '|': case '}': case '~':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
131 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
132 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134 #endif
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
137 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
138 c_isdigit (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
139 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
140 #if C_CTYPE_CONSECUTIVE_DIGITS
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
141 return (c >= '0' && c <= '9');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
142 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
143 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
144 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
145 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
146 case '6': case '7': case '8': case '9':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
147 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
148 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
149 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
150 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
151 #endif
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
154 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
155 c_islower (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
156 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
157 #if C_CTYPE_CONSECUTIVE_LOWERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
158 return (c >= 'a' && c <= 'z');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
159 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
160 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
161 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
162 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
163 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
164 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
165 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
166 case 'y': case 'z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
167 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
168 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
169 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
170 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
171 #endif
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
174 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
175 c_isgraph (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
176 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
177 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
178 return (c >= '!' && c <= '~');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
179 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
180 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
181 {
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 ')': case '*': case '+': case ',':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
184 case '-': case '.': case '/':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
185 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
186 case '6': case '7': case '8': case '9':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
187 case ':': case ';': case '<': case '=': case '>': case '?':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
188 case '@':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
189 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
190 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
191 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
192 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
193 case 'Y': case 'Z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
194 case '[': case '\\': case ']': case '^': case '_': case '`':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
195 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
196 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
197 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
198 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
199 case 'y': case 'z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
200 case '{': case '|': case '}': case '~':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
201 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
202 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
203 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
204 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
205 #endif
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
208 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
209 c_isprint (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
210 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
211 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
212 return (c >= ' ' && c <= '~');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
213 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
214 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
215 {
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 ')': case '*': case '+':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
218 case ',': case '-': case '.': case '/':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
219 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
220 case '6': case '7': case '8': case '9':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
221 case ':': case ';': case '<': case '=': case '>': case '?':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
222 case '@':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
223 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
224 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
225 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
226 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
227 case 'Y': case 'Z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
228 case '[': case '\\': case ']': case '^': case '_': case '`':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
229 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
230 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
231 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
232 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
233 case 'y': case 'z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
234 case '{': case '|': case '}': case '~':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
235 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
236 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
237 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
238 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
239 #endif
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
242 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
243 c_ispunct (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
244 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
245 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
246 return ((c >= '!' && c <= '~')
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
247 && !((c >= '0' && c <= '9')
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
248 || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')));
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
249 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
250 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
251 {
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 ')': case '*': case '+': case ',':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
254 case '-': case '.': case '/':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
255 case ':': case ';': case '<': case '=': case '>': case '?':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
256 case '@':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
257 case '[': case '\\': case ']': case '^': case '_': case '`':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
258 case '{': case '|': case '}': case '~':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
259 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
260 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
261 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
262 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
263 #endif
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
266 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
267 c_isspace (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
268 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
269 return (c == ' ' || c == '\t'
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
270 || c == '\n' || c == '\v' || c == '\f' || c == '\r');
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
273 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
274 c_isupper (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
275 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
276 #if C_CTYPE_CONSECUTIVE_UPPERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
277 return (c >= 'A' && c <= 'Z');
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
278 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
279 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
280 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
281 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
282 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
283 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
284 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
285 case 'Y': case 'Z':
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
286 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
287 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
288 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
289 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
290 #endif
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
293 bool
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
294 c_isxdigit (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
295 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
296 #if C_CTYPE_CONSECUTIVE_DIGITS \
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
297 && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
298 #if C_CTYPE_ASCII
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
299 return ((c >= '0' && c <= '9')
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
300 || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F'));
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
301 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
302 return ((c >= '0' && c <= '9')
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 || (c >= 'a' && c <= 'f'));
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
305 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
306 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
307 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
308 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
309 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
310 case '6': case '7': case '8': case '9':
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 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
313 return 1;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
314 default:
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
315 return 0;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
316 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
317 #endif
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
320 int
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
321 c_tolower (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
322 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
323 #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
324 return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c);
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
325 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
326 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
327 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
328 case 'A': return 'a';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
329 case 'B': return 'b';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
330 case 'C': return 'c';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
331 case 'D': return 'd';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
332 case 'E': return 'e';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
333 case 'F': return 'f';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
334 case 'G': return 'g';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
335 case 'H': return 'h';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
336 case 'I': return 'i';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
337 case 'J': return 'j';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
338 case 'K': return 'k';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
339 case 'L': return 'l';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
340 case 'M': return 'm';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
341 case 'N': return 'n';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
342 case 'O': return 'o';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
343 case 'P': return 'p';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
344 case 'Q': return 'q';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
345 case 'R': return 'r';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
346 case 'S': return 's';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
347 case 'T': return 't';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
348 case 'U': return 'u';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
349 case 'V': return 'v';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
350 case 'W': return 'w';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
351 case 'X': return 'x';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
352 case 'Y': return 'y';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
353 case 'Z': return 'z';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
354 default: return c;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
355 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
356 #endif
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
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
359 int
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
360 c_toupper (int c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
361 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
362 #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
363 return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c);
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
364 #else
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
365 switch (c)
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
366 {
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
367 case 'a': return 'A';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
368 case 'b': return 'B';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
369 case 'c': return 'C';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
370 case 'd': return 'D';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
371 case 'e': return 'E';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
372 case 'f': return 'F';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
373 case 'g': return 'G';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
374 case 'h': return 'H';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
375 case 'i': return 'I';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
376 case 'j': return 'J';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
377 case 'k': return 'K';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
378 case 'l': return 'L';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
379 case 'm': return 'M';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
380 case 'n': return 'N';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
381 case 'o': return 'O';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
382 case 'p': return 'P';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
383 case 'q': return 'Q';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
384 case 'r': return 'R';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
385 case 's': return 'S';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
386 case 't': return 'T';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
387 case 'u': return 'U';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
388 case 'v': return 'V';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
389 case 'w': return 'W';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
390 case 'x': return 'X';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
391 case 'y': return 'Y';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
392 case 'z': return 'Z';
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
393 default: return c;
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
394 }
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
395 #endif
c711c0a14205 New module c-ctype.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
396 }