diff options
Diffstat (limited to 'gl/wctype.in.h')
-rw-r--r-- | gl/wctype.in.h | 457 |
1 files changed, 339 insertions, 118 deletions
diff --git a/gl/wctype.in.h b/gl/wctype.in.h index a7c07d1..f6e474d 100644 --- a/gl/wctype.in.h +++ b/gl/wctype.in.h | |||
@@ -1,54 +1,61 @@ | |||
1 | /* A substitute for ISO C99 <wctype.h>, for platforms that lack it. | 1 | /* A substitute for ISO C99 <wctype.h>, for platforms that lack it. |
2 | 2 | ||
3 | Copyright (C) 2006-2013 Free Software Foundation, Inc. | 3 | Copyright (C) 2006-2023 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU Lesser General Public License as |
7 | the Free Software Foundation; either version 3, or (at your option) | 7 | published by the Free Software Foundation; either version 2.1 of the |
8 | any later version. | 8 | License, or (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This file is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Lesser General Public License |
16 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
17 | 17 | ||
18 | /* Written by Bruno Haible and Paul Eggert. */ | 18 | /* Written by Bruno Haible and Paul Eggert. */ |
19 | 19 | ||
20 | /* | 20 | /* |
21 | * ISO C 99 <wctype.h> for platforms that lack it. | 21 | * ISO C 99 <wctype.h> for platforms that lack it. |
22 | * <http://www.opengroup.org/susv3xbd/wctype.h.html> | 22 | * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html> |
23 | * | 23 | * |
24 | * iswctype, towctrans, towlower, towupper, wctrans, wctype, | 24 | * iswctype, towctrans, towlower, towupper, wctrans, wctype, |
25 | * wctrans_t, and wctype_t are not yet implemented. | 25 | * wctrans_t, and wctype_t are not yet implemented. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef _@GUARD_PREFIX@_WCTYPE_H | ||
29 | |||
30 | #if __GNUC__ >= 3 | 28 | #if __GNUC__ >= 3 |
31 | @PRAGMA_SYSTEM_HEADER@ | 29 | @PRAGMA_SYSTEM_HEADER@ |
32 | #endif | 30 | #endif |
33 | @PRAGMA_COLUMNS@ | 31 | @PRAGMA_COLUMNS@ |
34 | 32 | ||
33 | #if (defined __MINGW32__ && defined __CTYPE_H_SOURCED__) | ||
34 | |||
35 | /* Special invocation convention: | ||
36 | - With MinGW 3.22, when <ctype.h> includes <wctype.h>, only some part of | ||
37 | <wctype.h> is being processed, which doesn't include the idempotency | ||
38 | guard. */ | ||
39 | |||
40 | #@INCLUDE_NEXT@ @NEXT_WCTYPE_H@ | ||
41 | |||
42 | #else | ||
43 | /* Normal invocation convention. */ | ||
44 | |||
45 | #ifndef _@GUARD_PREFIX@_WCTYPE_H | ||
46 | |||
35 | #if @HAVE_WINT_T@ | 47 | #if @HAVE_WINT_T@ |
36 | /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. | 48 | /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */ |
37 | Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
38 | <wchar.h>. | ||
39 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
40 | included before <wchar.h>. */ | ||
41 | # include <stddef.h> | ||
42 | # include <stdio.h> | ||
43 | # include <time.h> | ||
44 | # include <wchar.h> | 49 | # include <wchar.h> |
45 | #endif | 50 | #endif |
46 | 51 | ||
47 | /* mingw has declarations of towupper and towlower in <ctype.h> as | 52 | /* Native Windows (mingw, MSVC) have declarations of towupper, towlower, and |
48 | well <wctype.h>. Include <ctype.h> in advance to avoid rpl_ prefix | 53 | isw* functions in <ctype.h>, <wchar.h> as well as in <wctype.h>. Include |
49 | being added to the declarations. */ | 54 | <ctype.h>, <wchar.h> in advance to avoid rpl_ prefix being added to the |
50 | #ifdef __MINGW32__ | 55 | declarations. */ |
56 | #if defined _WIN32 && ! defined __CYGWIN__ | ||
51 | # include <ctype.h> | 57 | # include <ctype.h> |
58 | # include <wchar.h> | ||
52 | #endif | 59 | #endif |
53 | 60 | ||
54 | /* Include the original <wctype.h> if it exists. | 61 | /* Include the original <wctype.h> if it exists. |
@@ -61,6 +68,9 @@ | |||
61 | #ifndef _@GUARD_PREFIX@_WCTYPE_H | 68 | #ifndef _@GUARD_PREFIX@_WCTYPE_H |
62 | #define _@GUARD_PREFIX@_WCTYPE_H | 69 | #define _@GUARD_PREFIX@_WCTYPE_H |
63 | 70 | ||
71 | #ifndef _GL_INLINE_HEADER_BEGIN | ||
72 | #error "Please include config.h first." | ||
73 | #endif | ||
64 | _GL_INLINE_HEADER_BEGIN | 74 | _GL_INLINE_HEADER_BEGIN |
65 | #ifndef _GL_WCTYPE_INLINE | 75 | #ifndef _GL_WCTYPE_INLINE |
66 | # define _GL_WCTYPE_INLINE _GL_INLINE | 76 | # define _GL_WCTYPE_INLINE _GL_INLINE |
@@ -90,12 +100,16 @@ _GL_INLINE_HEADER_BEGIN | |||
90 | # define WEOF -1 | 100 | # define WEOF -1 |
91 | # endif | 101 | # endif |
92 | #else | 102 | #else |
93 | /* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>. | 103 | /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or |
94 | This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be | 104 | <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that |
95 | "unchanged by default argument promotions". Override it. */ | 105 | wint_t must be "unchanged by default argument promotions". Override it. */ |
96 | # if defined _MSC_VER | 106 | # if @GNULIBHEADERS_OVERRIDE_WINT_T@ |
97 | # if !GNULIB_defined_wint_t | 107 | # if !GNULIB_defined_wint_t |
98 | # include <crtdefs.h> | 108 | # if @HAVE_CRTDEFS_H@ |
109 | # include <crtdefs.h> | ||
110 | # else | ||
111 | # include <stddef.h> | ||
112 | # endif | ||
99 | typedef unsigned int rpl_wint_t; | 113 | typedef unsigned int rpl_wint_t; |
100 | # undef wint_t | 114 | # undef wint_t |
101 | # define wint_t rpl_wint_t | 115 | # define wint_t rpl_wint_t |
@@ -112,33 +126,116 @@ typedef unsigned int rpl_wint_t; | |||
112 | 126 | ||
113 | /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. | 127 | /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. |
114 | Linux libc5 has <wctype.h> and the functions but they are broken. | 128 | Linux libc5 has <wctype.h> and the functions but they are broken. |
129 | mingw and MSVC have <wctype.h> and the functions but they take a wchar_t | ||
130 | as argument, not an rpl_wint_t. | ||
115 | Assume all 11 functions (all isw* except iswblank) are implemented the | 131 | Assume all 11 functions (all isw* except iswblank) are implemented the |
116 | same way, or not at all. */ | 132 | same way, or not at all. */ |
117 | # if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ | 133 | # if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ |
118 | 134 | ||
119 | /* IRIX 5.3 has macros but no functions, its isw* macros refer to an | 135 | # if @GNULIBHEADERS_OVERRIDE_WINT_T@ /* implies @REPLACE_ISWCNTRL@ */ |
120 | undefined variable _ctmp_ and to <ctype.h> macros like _P, and they | 136 | |
121 | refer to system functions like _iswctype that are not in the | 137 | _GL_WCTYPE_INLINE int |
122 | standard C library. Rather than try to get ancient buggy | 138 | rpl_iswalnum (wint_t wc) |
123 | implementations like this to work, just disable them. */ | 139 | { |
124 | # undef iswalnum | 140 | return ((wchar_t) wc == wc ? iswalnum ((wchar_t) wc) : 0); |
125 | # undef iswalpha | 141 | } |
126 | # undef iswblank | 142 | |
127 | # undef iswcntrl | 143 | _GL_WCTYPE_INLINE int |
128 | # undef iswdigit | 144 | rpl_iswalpha (wint_t wc) |
129 | # undef iswgraph | 145 | { |
130 | # undef iswlower | 146 | return ((wchar_t) wc == wc ? iswalpha ((wchar_t) wc) : 0); |
131 | # undef iswprint | 147 | } |
132 | # undef iswpunct | 148 | |
133 | # undef iswspace | 149 | _GL_WCTYPE_INLINE int |
134 | # undef iswupper | 150 | rpl_iswblank (wint_t wc) |
135 | # undef iswxdigit | 151 | { |
136 | # undef towlower | 152 | return ((wchar_t) wc == wc ? iswblank ((wchar_t) wc) : 0); |
137 | # undef towupper | 153 | } |
154 | |||
155 | _GL_WCTYPE_INLINE int | ||
156 | rpl_iswcntrl (wint_t wc) | ||
157 | { | ||
158 | return ((wchar_t) wc == wc ? iswcntrl ((wchar_t) wc) : 0); | ||
159 | } | ||
160 | |||
161 | _GL_WCTYPE_INLINE int | ||
162 | rpl_iswdigit (wint_t wc) | ||
163 | { | ||
164 | return ((wchar_t) wc == wc ? wc >= '0' && wc <= '9' : 0); | ||
165 | } | ||
166 | |||
167 | _GL_WCTYPE_INLINE int | ||
168 | rpl_iswgraph (wint_t wc) | ||
169 | { | ||
170 | return ((wchar_t) wc == wc ? iswgraph ((wchar_t) wc) : 0); | ||
171 | } | ||
172 | |||
173 | _GL_WCTYPE_INLINE int | ||
174 | rpl_iswlower (wint_t wc) | ||
175 | { | ||
176 | return ((wchar_t) wc == wc ? iswlower ((wchar_t) wc) : 0); | ||
177 | } | ||
178 | |||
179 | _GL_WCTYPE_INLINE int | ||
180 | rpl_iswprint (wint_t wc) | ||
181 | { | ||
182 | return ((wchar_t) wc == wc ? iswprint ((wchar_t) wc) : 0); | ||
183 | } | ||
184 | |||
185 | _GL_WCTYPE_INLINE int | ||
186 | rpl_iswpunct (wint_t wc) | ||
187 | { | ||
188 | return ((wchar_t) wc == wc ? iswpunct ((wchar_t) wc) : 0); | ||
189 | } | ||
190 | |||
191 | _GL_WCTYPE_INLINE int | ||
192 | rpl_iswspace (wint_t wc) | ||
193 | { | ||
194 | return ((wchar_t) wc == wc ? iswspace ((wchar_t) wc) : 0); | ||
195 | } | ||
196 | |||
197 | _GL_WCTYPE_INLINE int | ||
198 | rpl_iswupper (wint_t wc) | ||
199 | { | ||
200 | return ((wchar_t) wc == wc ? iswupper ((wchar_t) wc) : 0); | ||
201 | } | ||
202 | |||
203 | _GL_WCTYPE_INLINE int | ||
204 | rpl_iswxdigit (wint_t wc) | ||
205 | { | ||
206 | return ((wchar_t) wc == wc | ||
207 | ? (wc >= '0' && wc <= '9') | ||
208 | || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F') | ||
209 | : 0); | ||
210 | } | ||
211 | |||
212 | _GL_WCTYPE_INLINE wint_t | ||
213 | rpl_towlower (wint_t wc) | ||
214 | { | ||
215 | return ((wchar_t) wc == wc ? (wchar_t) towlower ((wchar_t) wc) : wc); | ||
216 | } | ||
217 | |||
218 | _GL_WCTYPE_INLINE wint_t | ||
219 | rpl_towupper (wint_t wc) | ||
220 | { | ||
221 | return ((wchar_t) wc == wc ? (wchar_t) towupper ((wchar_t) wc) : wc); | ||
222 | } | ||
138 | 223 | ||
139 | /* Linux libc5 has <wctype.h> and the functions but they are broken. */ | ||
140 | # if @REPLACE_ISWCNTRL@ | ||
141 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 224 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
225 | # undef iswalnum | ||
226 | # undef iswalpha | ||
227 | # undef iswblank | ||
228 | # undef iswcntrl | ||
229 | # undef iswdigit | ||
230 | # undef iswgraph | ||
231 | # undef iswlower | ||
232 | # undef iswprint | ||
233 | # undef iswpunct | ||
234 | # undef iswspace | ||
235 | # undef iswupper | ||
236 | # undef iswxdigit | ||
237 | # undef towlower | ||
238 | # undef towupper | ||
142 | # define iswalnum rpl_iswalnum | 239 | # define iswalnum rpl_iswalnum |
143 | # define iswalpha rpl_iswalpha | 240 | # define iswalpha rpl_iswalpha |
144 | # define iswblank rpl_iswblank | 241 | # define iswblank rpl_iswblank |
@@ -151,21 +248,62 @@ typedef unsigned int rpl_wint_t; | |||
151 | # define iswspace rpl_iswspace | 248 | # define iswspace rpl_iswspace |
152 | # define iswupper rpl_iswupper | 249 | # define iswupper rpl_iswupper |
153 | # define iswxdigit rpl_iswxdigit | 250 | # define iswxdigit rpl_iswxdigit |
154 | # endif | ||
155 | # endif | ||
156 | # if @REPLACE_TOWLOWER@ | ||
157 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
158 | # define towlower rpl_towlower | 251 | # define towlower rpl_towlower |
159 | # define towupper rpl_towupper | 252 | # define towupper rpl_towupper |
160 | # endif | 253 | # endif |
161 | # endif | 254 | |
255 | # else | ||
256 | |||
257 | /* IRIX 5.3 has macros but no functions, its isw* macros refer to an | ||
258 | undefined variable _ctmp_ and to <ctype.h> macros like _P, and they | ||
259 | refer to system functions like _iswctype that are not in the | ||
260 | standard C library. Rather than try to get ancient buggy | ||
261 | implementations like this to work, just disable them. */ | ||
262 | # undef iswalnum | ||
263 | # undef iswalpha | ||
264 | # undef iswblank | ||
265 | # undef iswcntrl | ||
266 | # undef iswdigit | ||
267 | # undef iswgraph | ||
268 | # undef iswlower | ||
269 | # undef iswprint | ||
270 | # undef iswpunct | ||
271 | # undef iswspace | ||
272 | # undef iswupper | ||
273 | # undef iswxdigit | ||
274 | # undef towlower | ||
275 | # undef towupper | ||
276 | |||
277 | /* Linux libc5 has <wctype.h> and the functions but they are broken. */ | ||
278 | # if @REPLACE_ISWCNTRL@ | ||
279 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
280 | # define iswalnum rpl_iswalnum | ||
281 | # define iswalpha rpl_iswalpha | ||
282 | # define iswblank rpl_iswblank | ||
283 | # define iswcntrl rpl_iswcntrl | ||
284 | # define iswdigit rpl_iswdigit | ||
285 | # define iswgraph rpl_iswgraph | ||
286 | # define iswlower rpl_iswlower | ||
287 | # define iswprint rpl_iswprint | ||
288 | # define iswpunct rpl_iswpunct | ||
289 | # define iswspace rpl_iswspace | ||
290 | # define iswupper rpl_iswupper | ||
291 | # define iswxdigit rpl_iswxdigit | ||
292 | # endif | ||
293 | # endif | ||
294 | # if @REPLACE_TOWLOWER@ | ||
295 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
296 | # define towlower rpl_towlower | ||
297 | # define towupper rpl_towupper | ||
298 | # endif | ||
299 | # endif | ||
162 | 300 | ||
163 | _GL_WCTYPE_INLINE int | 301 | _GL_WCTYPE_INLINE int |
164 | # if @REPLACE_ISWCNTRL@ | 302 | # if @REPLACE_ISWCNTRL@ |
165 | rpl_iswalnum | 303 | rpl_iswalnum |
166 | # else | 304 | # else |
167 | iswalnum | 305 | iswalnum |
168 | # endif | 306 | # endif |
169 | (wint_t wc) | 307 | (wint_t wc) |
170 | { | 308 | { |
171 | return ((wc >= '0' && wc <= '9') | 309 | return ((wc >= '0' && wc <= '9') |
@@ -173,88 +311,88 @@ iswalnum | |||
173 | } | 311 | } |
174 | 312 | ||
175 | _GL_WCTYPE_INLINE int | 313 | _GL_WCTYPE_INLINE int |
176 | # if @REPLACE_ISWCNTRL@ | 314 | # if @REPLACE_ISWCNTRL@ |
177 | rpl_iswalpha | 315 | rpl_iswalpha |
178 | # else | 316 | # else |
179 | iswalpha | 317 | iswalpha |
180 | # endif | 318 | # endif |
181 | (wint_t wc) | 319 | (wint_t wc) |
182 | { | 320 | { |
183 | return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; | 321 | return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; |
184 | } | 322 | } |
185 | 323 | ||
186 | _GL_WCTYPE_INLINE int | 324 | _GL_WCTYPE_INLINE int |
187 | # if @REPLACE_ISWCNTRL@ | 325 | # if @REPLACE_ISWCNTRL@ |
188 | rpl_iswblank | 326 | rpl_iswblank |
189 | # else | 327 | # else |
190 | iswblank | 328 | iswblank |
191 | # endif | 329 | # endif |
192 | (wint_t wc) | 330 | (wint_t wc) |
193 | { | 331 | { |
194 | return wc == ' ' || wc == '\t'; | 332 | return wc == ' ' || wc == '\t'; |
195 | } | 333 | } |
196 | 334 | ||
197 | _GL_WCTYPE_INLINE int | 335 | _GL_WCTYPE_INLINE int |
198 | # if @REPLACE_ISWCNTRL@ | 336 | # if @REPLACE_ISWCNTRL@ |
199 | rpl_iswcntrl | 337 | rpl_iswcntrl |
200 | # else | 338 | # else |
201 | iswcntrl | 339 | iswcntrl |
202 | # endif | 340 | # endif |
203 | (wint_t wc) | 341 | (wint_t wc) |
204 | { | 342 | { |
205 | return (wc & ~0x1f) == 0 || wc == 0x7f; | 343 | return (wc & ~0x1f) == 0 || wc == 0x7f; |
206 | } | 344 | } |
207 | 345 | ||
208 | _GL_WCTYPE_INLINE int | 346 | _GL_WCTYPE_INLINE int |
209 | # if @REPLACE_ISWCNTRL@ | 347 | # if @REPLACE_ISWDIGIT@ |
210 | rpl_iswdigit | 348 | rpl_iswdigit |
211 | # else | 349 | # else |
212 | iswdigit | 350 | iswdigit |
213 | # endif | 351 | # endif |
214 | (wint_t wc) | 352 | (wint_t wc) |
215 | { | 353 | { |
216 | return wc >= '0' && wc <= '9'; | 354 | return wc >= '0' && wc <= '9'; |
217 | } | 355 | } |
218 | 356 | ||
219 | _GL_WCTYPE_INLINE int | 357 | _GL_WCTYPE_INLINE int |
220 | # if @REPLACE_ISWCNTRL@ | 358 | # if @REPLACE_ISWCNTRL@ |
221 | rpl_iswgraph | 359 | rpl_iswgraph |
222 | # else | 360 | # else |
223 | iswgraph | 361 | iswgraph |
224 | # endif | 362 | # endif |
225 | (wint_t wc) | 363 | (wint_t wc) |
226 | { | 364 | { |
227 | return wc >= '!' && wc <= '~'; | 365 | return wc >= '!' && wc <= '~'; |
228 | } | 366 | } |
229 | 367 | ||
230 | _GL_WCTYPE_INLINE int | 368 | _GL_WCTYPE_INLINE int |
231 | # if @REPLACE_ISWCNTRL@ | 369 | # if @REPLACE_ISWCNTRL@ |
232 | rpl_iswlower | 370 | rpl_iswlower |
233 | # else | 371 | # else |
234 | iswlower | 372 | iswlower |
235 | # endif | 373 | # endif |
236 | (wint_t wc) | 374 | (wint_t wc) |
237 | { | 375 | { |
238 | return wc >= 'a' && wc <= 'z'; | 376 | return wc >= 'a' && wc <= 'z'; |
239 | } | 377 | } |
240 | 378 | ||
241 | _GL_WCTYPE_INLINE int | 379 | _GL_WCTYPE_INLINE int |
242 | # if @REPLACE_ISWCNTRL@ | 380 | # if @REPLACE_ISWCNTRL@ |
243 | rpl_iswprint | 381 | rpl_iswprint |
244 | # else | 382 | # else |
245 | iswprint | 383 | iswprint |
246 | # endif | 384 | # endif |
247 | (wint_t wc) | 385 | (wint_t wc) |
248 | { | 386 | { |
249 | return wc >= ' ' && wc <= '~'; | 387 | return wc >= ' ' && wc <= '~'; |
250 | } | 388 | } |
251 | 389 | ||
252 | _GL_WCTYPE_INLINE int | 390 | _GL_WCTYPE_INLINE int |
253 | # if @REPLACE_ISWCNTRL@ | 391 | # if @REPLACE_ISWCNTRL@ |
254 | rpl_iswpunct | 392 | rpl_iswpunct |
255 | # else | 393 | # else |
256 | iswpunct | 394 | iswpunct |
257 | # endif | 395 | # endif |
258 | (wint_t wc) | 396 | (wint_t wc) |
259 | { | 397 | { |
260 | return (wc >= '!' && wc <= '~' | 398 | return (wc >= '!' && wc <= '~' |
@@ -263,11 +401,11 @@ iswpunct | |||
263 | } | 401 | } |
264 | 402 | ||
265 | _GL_WCTYPE_INLINE int | 403 | _GL_WCTYPE_INLINE int |
266 | # if @REPLACE_ISWCNTRL@ | 404 | # if @REPLACE_ISWCNTRL@ |
267 | rpl_iswspace | 405 | rpl_iswspace |
268 | # else | 406 | # else |
269 | iswspace | 407 | iswspace |
270 | # endif | 408 | # endif |
271 | (wint_t wc) | 409 | (wint_t wc) |
272 | { | 410 | { |
273 | return (wc == ' ' || wc == '\t' | 411 | return (wc == ' ' || wc == '\t' |
@@ -275,22 +413,22 @@ iswspace | |||
275 | } | 413 | } |
276 | 414 | ||
277 | _GL_WCTYPE_INLINE int | 415 | _GL_WCTYPE_INLINE int |
278 | # if @REPLACE_ISWCNTRL@ | 416 | # if @REPLACE_ISWCNTRL@ |
279 | rpl_iswupper | 417 | rpl_iswupper |
280 | # else | 418 | # else |
281 | iswupper | 419 | iswupper |
282 | # endif | 420 | # endif |
283 | (wint_t wc) | 421 | (wint_t wc) |
284 | { | 422 | { |
285 | return wc >= 'A' && wc <= 'Z'; | 423 | return wc >= 'A' && wc <= 'Z'; |
286 | } | 424 | } |
287 | 425 | ||
288 | _GL_WCTYPE_INLINE int | 426 | _GL_WCTYPE_INLINE int |
289 | # if @REPLACE_ISWCNTRL@ | 427 | # if @REPLACE_ISWXDIGIT@ |
290 | rpl_iswxdigit | 428 | rpl_iswxdigit |
291 | # else | 429 | # else |
292 | iswxdigit | 430 | iswxdigit |
293 | # endif | 431 | # endif |
294 | (wint_t wc) | 432 | (wint_t wc) |
295 | { | 433 | { |
296 | return ((wc >= '0' && wc <= '9') | 434 | return ((wc >= '0' && wc <= '9') |
@@ -298,42 +436,67 @@ iswxdigit | |||
298 | } | 436 | } |
299 | 437 | ||
300 | _GL_WCTYPE_INLINE wint_t | 438 | _GL_WCTYPE_INLINE wint_t |
301 | # if @REPLACE_TOWLOWER@ | 439 | # if @REPLACE_TOWLOWER@ |
302 | rpl_towlower | 440 | rpl_towlower |
303 | # else | 441 | # else |
304 | towlower | 442 | towlower |
305 | # endif | 443 | # endif |
306 | (wint_t wc) | 444 | (wint_t wc) |
307 | { | 445 | { |
308 | return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc); | 446 | return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc); |
309 | } | 447 | } |
310 | 448 | ||
311 | _GL_WCTYPE_INLINE wint_t | 449 | _GL_WCTYPE_INLINE wint_t |
312 | # if @REPLACE_TOWLOWER@ | 450 | # if @REPLACE_TOWLOWER@ |
313 | rpl_towupper | 451 | rpl_towupper |
314 | # else | 452 | # else |
315 | towupper | 453 | towupper |
316 | # endif | 454 | # endif |
317 | (wint_t wc) | 455 | (wint_t wc) |
318 | { | 456 | { |
319 | return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc); | 457 | return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc); |
320 | } | 458 | } |
321 | 459 | ||
322 | # elif @GNULIB_ISWBLANK@ && (! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@) | 460 | # endif |
323 | /* Only the iswblank function is missing. */ | ||
324 | 461 | ||
325 | # if @REPLACE_ISWBLANK@ | 462 | # else |
326 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 463 | /* Only some of the functions are missing or broken. */ |
327 | # define iswblank rpl_iswblank | 464 | |
328 | # endif | 465 | # if @GNULIB_ISWBLANK@ && (! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@) |
466 | /* Only the iswblank function is missing. */ | ||
467 | # if @REPLACE_ISWBLANK@ | ||
468 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
469 | # define iswblank rpl_iswblank | ||
470 | # endif | ||
329 | _GL_FUNCDECL_RPL (iswblank, int, (wint_t wc)); | 471 | _GL_FUNCDECL_RPL (iswblank, int, (wint_t wc)); |
330 | # else | 472 | # else |
331 | _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc)); | 473 | _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc)); |
474 | # endif | ||
475 | # endif | ||
476 | |||
477 | # if @GNULIB_ISWDIGIT@ | ||
478 | # if @REPLACE_ISWDIGIT@ | ||
479 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
480 | # undef iswdigit | ||
481 | # define iswdigit rpl_iswdigit | ||
482 | # endif | ||
483 | _GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc)); | ||
484 | # endif | ||
485 | # endif | ||
486 | |||
487 | # if @GNULIB_ISWXDIGIT@ | ||
488 | # if @REPLACE_ISWXDIGIT@ | ||
489 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
490 | # undef iswxdigit | ||
491 | # define iswxdigit rpl_iswxdigit | ||
492 | # endif | ||
493 | _GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc)); | ||
494 | # endif | ||
332 | # endif | 495 | # endif |
333 | 496 | ||
334 | # endif | 497 | # endif |
335 | 498 | ||
336 | # if defined __MINGW32__ | 499 | # if defined __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@ |
337 | 500 | ||
338 | /* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t. | 501 | /* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t. |
339 | The functions towlower and towupper are implemented in the MSVCRT library | 502 | The functions towlower and towupper are implemented in the MSVCRT library |
@@ -366,36 +529,71 @@ rpl_towupper (wint_t wc) | |||
366 | # define towupper rpl_towupper | 529 | # define towupper rpl_towupper |
367 | # endif | 530 | # endif |
368 | 531 | ||
369 | # endif /* __MINGW32__ */ | 532 | # endif /* __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@ */ |
370 | 533 | ||
371 | # define GNULIB_defined_wctype_functions 1 | 534 | # define GNULIB_defined_wctype_functions 1 |
372 | #endif | 535 | #endif |
373 | 536 | ||
374 | #if @REPLACE_ISWCNTRL@ | 537 | #if @REPLACE_ISWCNTRL@ |
375 | _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc)); | 538 | _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc)); |
376 | _GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc)); | ||
377 | _GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc)); | ||
378 | _GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc)); | ||
379 | _GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc)); | ||
380 | _GL_CXXALIAS_RPL (iswlower, int, (wint_t wc)); | ||
381 | _GL_CXXALIAS_RPL (iswprint, int, (wint_t wc)); | ||
382 | _GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc)); | ||
383 | _GL_CXXALIAS_RPL (iswspace, int, (wint_t wc)); | ||
384 | _GL_CXXALIAS_RPL (iswupper, int, (wint_t wc)); | ||
385 | _GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc)); | ||
386 | #else | 539 | #else |
387 | _GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc)); | 540 | _GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc)); |
541 | #endif | ||
542 | #if @REPLACE_ISWCNTRL@ | ||
543 | _GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc)); | ||
544 | #else | ||
388 | _GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc)); | 545 | _GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc)); |
546 | #endif | ||
547 | #if @REPLACE_ISWCNTRL@ | ||
548 | _GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc)); | ||
549 | #else | ||
389 | _GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc)); | 550 | _GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc)); |
551 | #endif | ||
552 | #if @GNULIB_ISWDIGIT@ | ||
553 | # if @REPLACE_ISWDIGIT@ | ||
554 | _GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc)); | ||
555 | # else | ||
390 | _GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc)); | 556 | _GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc)); |
557 | # endif | ||
558 | #endif | ||
559 | #if @REPLACE_ISWCNTRL@ | ||
560 | _GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc)); | ||
561 | #else | ||
391 | _GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc)); | 562 | _GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc)); |
563 | #endif | ||
564 | #if @REPLACE_ISWCNTRL@ | ||
565 | _GL_CXXALIAS_RPL (iswlower, int, (wint_t wc)); | ||
566 | #else | ||
392 | _GL_CXXALIAS_SYS (iswlower, int, (wint_t wc)); | 567 | _GL_CXXALIAS_SYS (iswlower, int, (wint_t wc)); |
568 | #endif | ||
569 | #if @REPLACE_ISWCNTRL@ | ||
570 | _GL_CXXALIAS_RPL (iswprint, int, (wint_t wc)); | ||
571 | #else | ||
393 | _GL_CXXALIAS_SYS (iswprint, int, (wint_t wc)); | 572 | _GL_CXXALIAS_SYS (iswprint, int, (wint_t wc)); |
573 | #endif | ||
574 | #if @REPLACE_ISWCNTRL@ | ||
575 | _GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc)); | ||
576 | #else | ||
394 | _GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc)); | 577 | _GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc)); |
578 | #endif | ||
579 | #if @REPLACE_ISWCNTRL@ | ||
580 | _GL_CXXALIAS_RPL (iswspace, int, (wint_t wc)); | ||
581 | #else | ||
395 | _GL_CXXALIAS_SYS (iswspace, int, (wint_t wc)); | 582 | _GL_CXXALIAS_SYS (iswspace, int, (wint_t wc)); |
583 | #endif | ||
584 | #if @REPLACE_ISWCNTRL@ | ||
585 | _GL_CXXALIAS_RPL (iswupper, int, (wint_t wc)); | ||
586 | #else | ||
396 | _GL_CXXALIAS_SYS (iswupper, int, (wint_t wc)); | 587 | _GL_CXXALIAS_SYS (iswupper, int, (wint_t wc)); |
588 | #endif | ||
589 | #if @GNULIB_ISWXDIGIT@ | ||
590 | # if @REPLACE_ISWXDIGIT@ | ||
591 | _GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc)); | ||
592 | # else | ||
397 | _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc)); | 593 | _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc)); |
594 | # endif | ||
398 | #endif | 595 | #endif |
596 | #if __GLIBC__ >= 2 | ||
399 | _GL_CXXALIASWARN (iswalnum); | 597 | _GL_CXXALIASWARN (iswalnum); |
400 | _GL_CXXALIASWARN (iswalpha); | 598 | _GL_CXXALIASWARN (iswalpha); |
401 | _GL_CXXALIASWARN (iswcntrl); | 599 | _GL_CXXALIASWARN (iswcntrl); |
@@ -407,6 +605,7 @@ _GL_CXXALIASWARN (iswpunct); | |||
407 | _GL_CXXALIASWARN (iswspace); | 605 | _GL_CXXALIASWARN (iswspace); |
408 | _GL_CXXALIASWARN (iswupper); | 606 | _GL_CXXALIASWARN (iswupper); |
409 | _GL_CXXALIASWARN (iswxdigit); | 607 | _GL_CXXALIASWARN (iswxdigit); |
608 | #endif | ||
410 | 609 | ||
411 | #if @GNULIB_ISWBLANK@ | 610 | #if @GNULIB_ISWBLANK@ |
412 | # if @REPLACE_ISWCNTRL@ || @REPLACE_ISWBLANK@ | 611 | # if @REPLACE_ISWCNTRL@ || @REPLACE_ISWBLANK@ |
@@ -414,7 +613,9 @@ _GL_CXXALIAS_RPL (iswblank, int, (wint_t wc)); | |||
414 | # else | 613 | # else |
415 | _GL_CXXALIAS_SYS (iswblank, int, (wint_t wc)); | 614 | _GL_CXXALIAS_SYS (iswblank, int, (wint_t wc)); |
416 | # endif | 615 | # endif |
616 | # if __GLIBC__ >= 2 | ||
417 | _GL_CXXALIASWARN (iswblank); | 617 | _GL_CXXALIASWARN (iswblank); |
618 | # endif | ||
418 | #endif | 619 | #endif |
419 | 620 | ||
420 | #if !@HAVE_WCTYPE_T@ | 621 | #if !@HAVE_WCTYPE_T@ |
@@ -430,7 +631,9 @@ typedef void * wctype_t; | |||
430 | _GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name)); | 631 | _GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name)); |
431 | # endif | 632 | # endif |
432 | _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name)); | 633 | _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name)); |
634 | # if __GLIBC__ >= 2 | ||
433 | _GL_CXXALIASWARN (wctype); | 635 | _GL_CXXALIASWARN (wctype); |
636 | # endif | ||
434 | #elif defined GNULIB_POSIXCHECK | 637 | #elif defined GNULIB_POSIXCHECK |
435 | # undef wctype | 638 | # undef wctype |
436 | # if HAVE_RAW_DECL_WCTYPE | 639 | # if HAVE_RAW_DECL_WCTYPE |
@@ -443,11 +646,22 @@ _GL_WARN_ON_USE (wctype, "wctype is unportable - " | |||
443 | The argument WC must be either a wchar_t value or WEOF. | 646 | The argument WC must be either a wchar_t value or WEOF. |
444 | The argument DESC must have been returned by the wctype() function. */ | 647 | The argument DESC must have been returned by the wctype() function. */ |
445 | #if @GNULIB_ISWCTYPE@ | 648 | #if @GNULIB_ISWCTYPE@ |
446 | # if !@HAVE_WCTYPE_T@ | 649 | # if @GNULIBHEADERS_OVERRIDE_WINT_T@ |
650 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
651 | # undef iswctype | ||
652 | # define iswctype rpl_iswctype | ||
653 | # endif | ||
654 | _GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc)); | ||
655 | _GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc)); | ||
656 | # else | ||
657 | # if !@HAVE_WCTYPE_T@ | ||
447 | _GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc)); | 658 | _GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc)); |
448 | # endif | 659 | # endif |
449 | _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc)); | 660 | _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc)); |
661 | # endif | ||
662 | # if __GLIBC__ >= 2 | ||
450 | _GL_CXXALIASWARN (iswctype); | 663 | _GL_CXXALIASWARN (iswctype); |
664 | # endif | ||
451 | #elif defined GNULIB_POSIXCHECK | 665 | #elif defined GNULIB_POSIXCHECK |
452 | # undef iswctype | 666 | # undef iswctype |
453 | # if HAVE_RAW_DECL_ISWCTYPE | 667 | # if HAVE_RAW_DECL_ISWCTYPE |
@@ -463,8 +677,10 @@ _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc)); | |||
463 | _GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc)); | 677 | _GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc)); |
464 | _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc)); | 678 | _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc)); |
465 | #endif | 679 | #endif |
680 | #if __GLIBC__ >= 2 | ||
466 | _GL_CXXALIASWARN (towlower); | 681 | _GL_CXXALIASWARN (towlower); |
467 | _GL_CXXALIASWARN (towupper); | 682 | _GL_CXXALIASWARN (towupper); |
683 | #endif | ||
468 | 684 | ||
469 | #if !@HAVE_WCTRANS_T@ | 685 | #if !@HAVE_WCTRANS_T@ |
470 | # if !GNULIB_defined_wctrans_t | 686 | # if !GNULIB_defined_wctrans_t |
@@ -479,7 +695,9 @@ typedef void * wctrans_t; | |||
479 | _GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name)); | 695 | _GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name)); |
480 | # endif | 696 | # endif |
481 | _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name)); | 697 | _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name)); |
698 | # if __GLIBC__ >= 2 | ||
482 | _GL_CXXALIASWARN (wctrans); | 699 | _GL_CXXALIASWARN (wctrans); |
700 | # endif | ||
483 | #elif defined GNULIB_POSIXCHECK | 701 | #elif defined GNULIB_POSIXCHECK |
484 | # undef wctrans | 702 | # undef wctrans |
485 | # if HAVE_RAW_DECL_WCTRANS | 703 | # if HAVE_RAW_DECL_WCTRANS |
@@ -496,7 +714,9 @@ _GL_WARN_ON_USE (wctrans, "wctrans is unportable - " | |||
496 | _GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); | 714 | _GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); |
497 | # endif | 715 | # endif |
498 | _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); | 716 | _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); |
717 | # if __GLIBC__ >= 2 | ||
499 | _GL_CXXALIASWARN (towctrans); | 718 | _GL_CXXALIASWARN (towctrans); |
719 | # endif | ||
500 | #elif defined GNULIB_POSIXCHECK | 720 | #elif defined GNULIB_POSIXCHECK |
501 | # undef towctrans | 721 | # undef towctrans |
502 | # if HAVE_RAW_DECL_TOWCTRANS | 722 | # if HAVE_RAW_DECL_TOWCTRANS |
@@ -509,3 +729,4 @@ _GL_INLINE_HEADER_END | |||
509 | 729 | ||
510 | #endif /* _@GUARD_PREFIX@_WCTYPE_H */ | 730 | #endif /* _@GUARD_PREFIX@_WCTYPE_H */ |
511 | #endif /* _@GUARD_PREFIX@_WCTYPE_H */ | 731 | #endif /* _@GUARD_PREFIX@_WCTYPE_H */ |
732 | #endif | ||