GDBserver

wctype.h
Go to the documentation of this file.
1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
3
4 Copyright (C) 2006-2016 Free Software Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>. */
18
19 /* Written by Bruno Haible and Paul Eggert. */
20
21 /*
22 * ISO C 99 <wctype.h> for platforms that lack it.
23 * <http://www.opengroup.org/susv3xbd/wctype.h.html>
24 *
25 * iswctype, towctrans, towlower, towupper, wctrans, wctype,
26 * wctrans_t, and wctype_t are not yet implemented.
27 */
28
29 #if __GNUC__ >= 3
30 #pragma GCC system_header
31 #endif
32
33
34 #if (defined __MINGW32__ && defined __CTYPE_H_SOURCED__)
35
36 /* Special invocation convention:
37 - With MinGW 3.22, when <ctype.h> includes <wctype.h>, only some part of
38 <wctype.h> is being processed, which doesn't include the idempotency
39 guard. */
40
41 #include_next <wctype.h>
42
43 #else
44 /* Normal invocation convention. */
45
46 #ifndef _GL_WCTYPE_H
47
48 #if 1
49 /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
50 Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
51 <wchar.h>.
52 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
53 included before <wchar.h>. */
54 # include <stddef.h>
55 # include <stdio.h>
56 # include <time.h>
57 # include <wchar.h>
58 #endif
59
60 /* mingw has declarations of towupper and towlower in <ctype.h> as
61 well <wctype.h>. Include <ctype.h> in advance to avoid rpl_ prefix
62 being added to the declarations. */
63 #ifdef __MINGW32__
64 # include <ctype.h>
65 #endif
66
67 /* Include the original <wctype.h> if it exists.
68 BeOS 5 has the functions but no <wctype.h>. */
69 /* The include_next requires a split double-inclusion guard. */
70 #if 1
71 # include_next <wctype.h>
72 #endif
73
74 #ifndef _GL_WCTYPE_H
75 #define _GL_WCTYPE_H
76
77 #ifndef _GL_INLINE_HEADER_BEGIN
78 #error "Please include config.h first."
79 #endif
80 _GL_INLINE_HEADER_BEGIN
81 #ifndef _GL_WCTYPE_INLINE
82 # define _GL_WCTYPE_INLINE _GL_INLINE
83 #endif
84
85 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
86 #ifndef _GL_CXXDEFS_H
87 #define _GL_CXXDEFS_H
88
89 /* Begin/end the GNULIB_NAMESPACE namespace. */
90 #if defined __cplusplus && defined GNULIB_NAMESPACE
91 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
92 # define _GL_END_NAMESPACE }
93 #else
94 # define _GL_BEGIN_NAMESPACE
95 # define _GL_END_NAMESPACE
96 #endif
97
98 /* The three most frequent use cases of these macros are:
99
100 * For providing a substitute for a function that is missing on some
101 platforms, but is declared and works fine on the platforms on which
102 it exists:
103
104 #if @GNULIB_FOO@
105 # if !@HAVE_FOO@
106 _GL_FUNCDECL_SYS (foo, ...);
107 # endif
108 _GL_CXXALIAS_SYS (foo, ...);
109 _GL_CXXALIASWARN (foo);
110 #elif defined GNULIB_POSIXCHECK
111 ...
112 #endif
113
114 * For providing a replacement for a function that exists on all platforms,
115 but is broken/insufficient and needs to be replaced on some platforms:
116
117 #if @GNULIB_FOO@
118 # if @REPLACE_FOO@
119 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
120 # undef foo
121 # define foo rpl_foo
122 # endif
123 _GL_FUNCDECL_RPL (foo, ...);
124 _GL_CXXALIAS_RPL (foo, ...);
125 # else
126 _GL_CXXALIAS_SYS (foo, ...);
127 # endif
128 _GL_CXXALIASWARN (foo);
129 #elif defined GNULIB_POSIXCHECK
130 ...
131 #endif
132
133 * For providing a replacement for a function that exists on some platforms
134 but is broken/insufficient and needs to be replaced on some of them and
135 is additionally either missing or undeclared on some other platforms:
136
137 #if @GNULIB_FOO@
138 # if @REPLACE_FOO@
139 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
140 # undef foo
141 # define foo rpl_foo
142 # endif
143 _GL_FUNCDECL_RPL (foo, ...);
144 _GL_CXXALIAS_RPL (foo, ...);
145 # else
146 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
147 _GL_FUNCDECL_SYS (foo, ...);
148 # endif
149 _GL_CXXALIAS_SYS (foo, ...);
150 # endif
151 _GL_CXXALIASWARN (foo);
152 #elif defined GNULIB_POSIXCHECK
153 ...
154 #endif
155 */
156
157 /* _GL_EXTERN_C declaration;
158 performs the declaration with C linkage. */
159 #if defined __cplusplus
160 # define _GL_EXTERN_C extern "C"
161 #else
162 # define _GL_EXTERN_C extern
163 #endif
164
165 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
166 declares a replacement function, named rpl_func, with the given prototype,
167 consisting of return type, parameters, and attributes.
168 Example:
169 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
170 _GL_ARG_NONNULL ((1)));
171 */
172 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
173 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
174 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
175 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
176
177 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
178 declares the system function, named func, with the given prototype,
179 consisting of return type, parameters, and attributes.
180 Example:
181 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
182 _GL_ARG_NONNULL ((1)));
183 */
184 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
185 _GL_EXTERN_C rettype func parameters_and_attributes
186
187 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
188 declares a C++ alias called GNULIB_NAMESPACE::func
189 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
190 Example:
191 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
192
193 Wrapping rpl_func in an object with an inline conversion operator
194 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
195 actually used in the program. */
196 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
197 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
198 #if defined __cplusplus && defined GNULIB_NAMESPACE
199 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
200 namespace GNULIB_NAMESPACE \
201 { \
202 static const struct _gl_ ## func ## _wrapper \
203 { \
204 typedef rettype (*type) parameters; \
205 inline type rpl () const { return ::rpl_func; } \
206 inline operator type () const { return rpl (); } \
207 } func = {}; \
208 } \
209 _GL_EXTERN_C int _gl_cxxalias_dummy
210 #else
211 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
212 _GL_EXTERN_C int _gl_cxxalias_dummy
213 #endif
214
215 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
216 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
217 except that the C function rpl_func may have a slightly different
218 declaration. A cast is used to silence the "invalid conversion" error
219 that would otherwise occur. */
220 #if defined __cplusplus && defined GNULIB_NAMESPACE
221 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
222 namespace GNULIB_NAMESPACE \
223 { \
224 static const struct _gl_ ## func ## _wrapper \
225 { \
226 typedef rettype (*type) parameters; \
227 inline type rpl () const \
228 { return reinterpret_cast<type>(::rpl_func); } \
229 inline operator type () const { return rpl (); } \
230 } func = {}; \
231 } \
232 _GL_EXTERN_C int _gl_cxxalias_dummy
233 #else
234 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
235 _GL_EXTERN_C int _gl_cxxalias_dummy
236 #endif
237
238 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
239 declares a C++ alias called GNULIB_NAMESPACE::func
240 that redirects to the system provided function func, if GNULIB_NAMESPACE
241 is defined.
242 Example:
243 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
244
245 Wrapping func in an object with an inline conversion operator
246 avoids a reference to func unless GNULIB_NAMESPACE::func is
247 actually used in the program. */
248 #if defined __cplusplus && defined GNULIB_NAMESPACE
249 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
250 namespace GNULIB_NAMESPACE \
251 { \
252 static const struct _gl_ ## func ## _wrapper \
253 { \
254 typedef rettype (*type) parameters; \
255 inline type rpl () const { return ::func; } \
256 inline operator type () const { return rpl (); } \
257 } func = {}; \
258 } \
259 _GL_EXTERN_C int _gl_cxxalias_dummy
260 #else
261 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
262 _GL_EXTERN_C int _gl_cxxalias_dummy
263 #endif
264
265 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
266 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
267 except that the C function func may have a slightly different declaration.
268 A cast is used to silence the "invalid conversion" error that would
269 otherwise occur. */
270 #if defined __cplusplus && defined GNULIB_NAMESPACE
271 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
272 namespace GNULIB_NAMESPACE \
273 { \
274 static const struct _gl_ ## func ## _wrapper \
275 { \
276 typedef rettype (*type) parameters; \
277 inline type rpl () const \
278 { return reinterpret_cast<type>(::func); } \
279 inline operator type () const { return rpl (); }\
280 } func = {}; \
281 } \
282 _GL_EXTERN_C int _gl_cxxalias_dummy
283 #else
284 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
285 _GL_EXTERN_C int _gl_cxxalias_dummy
286 #endif
287
288 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
289 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
290 except that the C function is picked among a set of overloaded functions,
291 namely the one with rettype2 and parameters2. Two consecutive casts
292 are used to silence the "cannot find a match" and "invalid conversion"
293 errors that would otherwise occur. */
294 #if defined __cplusplus && defined GNULIB_NAMESPACE
295 /* The outer cast must be a reinterpret_cast.
296 The inner cast: When the function is defined as a set of overloaded
297 functions, it works as a static_cast<>, choosing the designated variant.
298 When the function is defined as a single variant, it works as a
299 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
300 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
301 namespace GNULIB_NAMESPACE \
302 { \
303 static const struct _gl_ ## func ## _wrapper \
304 { \
305 typedef rettype (*type) parameters; \
306 \
307 inline type rpl () const \
308 { return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); }\
309 \
310 inline operator type () const { return rpl (); } \
311 } func = {}; \
312 } \
313 _GL_EXTERN_C int _gl_cxxalias_dummy
314 #else
315 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
316 _GL_EXTERN_C int _gl_cxxalias_dummy
317 #endif
318
319 /* _GL_CXXALIASWARN (func);
320 causes a warning to be emitted when ::func is used but not when
321 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
322 variants. */
323 #if defined __cplusplus && defined GNULIB_NAMESPACE
324 # define _GL_CXXALIASWARN(func) \
325 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
326 # define _GL_CXXALIASWARN_1(func,namespace) \
327 _GL_CXXALIASWARN_2 (func, namespace)
328 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
329 we enable the warning only when not optimizing. */
330 # if !__OPTIMIZE__
331 # define _GL_CXXALIASWARN_2(func,namespace) \
332 _GL_WARN_ON_USE (func, \
333 "The symbol ::" #func " refers to the system function. " \
334 "Use " #namespace "::" #func " instead.")
335 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
336 # define _GL_CXXALIASWARN_2(func,namespace) \
337 extern __typeof__ (func) func
338 # else
339 # define _GL_CXXALIASWARN_2(func,namespace) \
340 _GL_EXTERN_C int _gl_cxxalias_dummy
341 # endif
342 #else
343 # define _GL_CXXALIASWARN(func) \
344 _GL_EXTERN_C int _gl_cxxalias_dummy
345 #endif
346
347 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
348 causes a warning to be emitted when the given overloaded variant of ::func
349 is used but not when GNULIB_NAMESPACE::func is used. */
350 #if defined __cplusplus && defined GNULIB_NAMESPACE
351 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
352 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
353 GNULIB_NAMESPACE)
354 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
355 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
356 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
357 we enable the warning only when not optimizing. */
358 # if !__OPTIMIZE__
359 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
360 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
361 "The symbol ::" #func " refers to the system function. " \
362 "Use " #namespace "::" #func " instead.")
363 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
364 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
365 extern __typeof__ (func) func
366 # else
367 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
368 _GL_EXTERN_C int _gl_cxxalias_dummy
369 # endif
370 #else
371 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
372 _GL_EXTERN_C int _gl_cxxalias_dummy
373 #endif
374
375 #endif /* _GL_CXXDEFS_H */
376
377 /* The definition of _GL_WARN_ON_USE is copied here. */
378 #ifndef _GL_WARN_ON_USE
379
380 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
381 /* A compiler attribute is available in gcc versions 4.3.0 and later. */
382 # define _GL_WARN_ON_USE(function, message) \
383 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
384 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
385 /* Verify the existence of the function. */
386 # define _GL_WARN_ON_USE(function, message) \
387 extern __typeof__ (function) function
388 # else /* Unsupported. */
389 # define _GL_WARN_ON_USE(function, message) \
390 _GL_WARN_EXTERN_C int _gl_warn_on_use
391 # endif
392 #endif
393
394 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
395 is like _GL_WARN_ON_USE (function, "string"), except that the function is
396 declared with the given prototype, consisting of return type, parameters,
397 and attributes.
398 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
399 not work in this case. */
400 #ifndef _GL_WARN_ON_USE_CXX
401 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
402 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
403 extern rettype function parameters_and_attributes \
404 __attribute__ ((__warning__ (msg)))
405 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
406 /* Verify the existence of the function. */
407 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
408 extern rettype function parameters_and_attributes
409 # else /* Unsupported. */
410 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
411 _GL_WARN_EXTERN_C int _gl_warn_on_use
412 # endif
413 #endif
414
415 /* _GL_WARN_EXTERN_C declaration;
416 performs the declaration with C linkage. */
417 #ifndef _GL_WARN_EXTERN_C
418 # if defined __cplusplus
419 # define _GL_WARN_EXTERN_C extern "C"
420 # else
421 # define _GL_WARN_EXTERN_C extern
422 # endif
423 #endif
424
425 /* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which
426 #defines a number of identifiers in the application namespace. Revert
427 these #defines. */
428 #ifdef __sun
429 # undef multibyte
430 # undef eucw1
431 # undef eucw2
432 # undef eucw3
433 # undef scrw1
434 # undef scrw2
435 # undef scrw3
436 #endif
437
438 /* Define wint_t and WEOF. (Also done in wchar.in.h.) */
439 #if !1 && !defined wint_t
440 # define wint_t int
441 # ifndef WEOF
442 # define WEOF -1
443 # endif
444 #else
445 /* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>.
446 This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
447 "unchanged by default argument promotions". Override it. */
448 # if defined _MSC_VER
449 # if !GNULIB_defined_wint_t
450 # include <crtdefs.h>
451 typedef unsigned int rpl_wint_t;
452 # undef wint_t
453 # define wint_t rpl_wint_t
454 # define GNULIB_defined_wint_t 1
455 # endif
456 # endif
457 # ifndef WEOF
458 # define WEOF ((wint_t) -1)
459 # endif
460 #endif
461
462
463 #if !GNULIB_defined_wctype_functions
464
465 /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
466 Linux libc5 has <wctype.h> and the functions but they are broken.
467 Assume all 11 functions (all isw* except iswblank) are implemented the
468 same way, or not at all. */
469 # if ! 1 || 0
470
471 /* IRIX 5.3 has macros but no functions, its isw* macros refer to an
472 undefined variable _ctmp_ and to <ctype.h> macros like _P, and they
473 refer to system functions like _iswctype that are not in the
474 standard C library. Rather than try to get ancient buggy
475 implementations like this to work, just disable them. */
476 # undef iswalnum
477 # undef iswalpha
478 # undef iswblank
479 # undef iswcntrl
480 # undef iswdigit
481 # undef iswgraph
482 # undef iswlower
483 # undef iswprint
484 # undef iswpunct
485 # undef iswspace
486 # undef iswupper
487 # undef iswxdigit
488 # undef towlower
489 # undef towupper
490
491 /* Linux libc5 has <wctype.h> and the functions but they are broken. */
492 # if 0
493 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
494 # define iswalnum rpl_iswalnum
495 # define iswalpha rpl_iswalpha
496 # define iswblank rpl_iswblank
497 # define iswcntrl rpl_iswcntrl
498 # define iswdigit rpl_iswdigit
499 # define iswgraph rpl_iswgraph
500 # define iswlower rpl_iswlower
501 # define iswprint rpl_iswprint
502 # define iswpunct rpl_iswpunct
503 # define iswspace rpl_iswspace
504 # define iswupper rpl_iswupper
505 # define iswxdigit rpl_iswxdigit
506 # endif
507 # endif
508 # if 0
509 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
510 # define towlower rpl_towlower
511 # define towupper rpl_towupper
512 # endif
513 # endif
514
515 _GL_WCTYPE_INLINE int
516 # if 0
517 rpl_iswalnum
518 # else
519 iswalnum
520 # endif
521 (wint_t wc)
522 {
523 return ((wc >= '0' && wc <= '9')
524 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
525 }
526
527 _GL_WCTYPE_INLINE int
528 # if 0
529 rpl_iswalpha
530 # else
531 iswalpha
532 # endif
533 (wint_t wc)
534 {
535 return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
536 }
537
538 _GL_WCTYPE_INLINE int
539 # if 0
540 rpl_iswblank
541 # else
542 iswblank
543 # endif
544 (wint_t wc)
545 {
546 return wc == ' ' || wc == '\t';
547 }
548
549 _GL_WCTYPE_INLINE int
550 # if 0
551 rpl_iswcntrl
552 # else
553 iswcntrl
554 # endif
555 (wint_t wc)
556 {
557 return (wc & ~0x1f) == 0 || wc == 0x7f;
558 }
559
560 _GL_WCTYPE_INLINE int
561 # if 0
562 rpl_iswdigit
563 # else
564 iswdigit
565 # endif
566 (wint_t wc)
567 {
568 return wc >= '0' && wc <= '9';
569 }
570
571 _GL_WCTYPE_INLINE int
572 # if 0
573 rpl_iswgraph
574 # else
575 iswgraph
576 # endif
577 (wint_t wc)
578 {
579 return wc >= '!' && wc <= '~';
580 }
581
582 _GL_WCTYPE_INLINE int
583 # if 0
584 rpl_iswlower
585 # else
586 iswlower
587 # endif
588 (wint_t wc)
589 {
590 return wc >= 'a' && wc <= 'z';
591 }
592
593 _GL_WCTYPE_INLINE int
594 # if 0
595 rpl_iswprint
596 # else
597 iswprint
598 # endif
599 (wint_t wc)
600 {
601 return wc >= ' ' && wc <= '~';
602 }
603
604 _GL_WCTYPE_INLINE int
605 # if 0
606 rpl_iswpunct
607 # else
608 iswpunct
609 # endif
610 (wint_t wc)
611 {
612 return (wc >= '!' && wc <= '~'
613 && !((wc >= '0' && wc <= '9')
614 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
615 }
616
617 _GL_WCTYPE_INLINE int
618 # if 0
619 rpl_iswspace
620 # else
621 iswspace
622 # endif
623 (wint_t wc)
624 {
625 return (wc == ' ' || wc == '\t'
626 || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
627 }
628
629 _GL_WCTYPE_INLINE int
630 # if 0
631 rpl_iswupper
632 # else
633 iswupper
634 # endif
635 (wint_t wc)
636 {
637 return wc >= 'A' && wc <= 'Z';
638 }
639
640 _GL_WCTYPE_INLINE int
641 # if 0
642 rpl_iswxdigit
643 # else
644 iswxdigit
645 # endif
646 (wint_t wc)
647 {
648 return ((wc >= '0' && wc <= '9')
649 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
650 }
651
652 _GL_WCTYPE_INLINE wint_t
653 # if 0
654 rpl_towlower
655 # else
656 towlower
657 # endif
658 (wint_t wc)
659 {
660 return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc);
661 }
662
663 _GL_WCTYPE_INLINE wint_t
664 # if 0
665 rpl_towupper
666 # else
667 towupper
668 # endif
669 (wint_t wc)
670 {
671 return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
672 }
673
674 # elif 0 && (! 1 || 0)
675 /* Only the iswblank function is missing. */
676
677 # if 0
678 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
679 # define iswblank rpl_iswblank
680 # endif
681 _GL_FUNCDECL_RPL (iswblank, int, (wint_t wc));
682 # else
683 _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
684 # endif
685
686 # endif
687
688 # if defined __MINGW32__
689
690 /* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t.
691 The functions towlower and towupper are implemented in the MSVCRT library
692 to take a wchar_t argument and return a wchar_t result. mingw declares
693 these functions to take a wint_t argument and return a wint_t result.
694 This means that:
695 1. When the user passes an argument outside the range 0x0000..0xFFFF, the
696 function will look only at the lower 16 bits. This is allowed according
697 to POSIX.
698 2. The return value is returned in the lower 16 bits of the result register.
699 The upper 16 bits are random: whatever happened to be in that part of the
700 result register. We need to fix this by adding a zero-extend from
701 wchar_t to wint_t after the call. */
702
703 _GL_WCTYPE_INLINE wint_t
704 rpl_towlower (wint_t wc)
705 {
706 return (wint_t) (wchar_t) towlower (wc);
707 }
708 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
709 # define towlower rpl_towlower
710 # endif
711
712 _GL_WCTYPE_INLINE wint_t
713 rpl_towupper (wint_t wc)
714 {
715 return (wint_t) (wchar_t) towupper (wc);
716 }
717 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
718 # define towupper rpl_towupper
719 # endif
720
721 # endif /* __MINGW32__ */
722
723 # define GNULIB_defined_wctype_functions 1
724 #endif
725
726 #if 0
727 _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc));
728 _GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc));
729 _GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc));
730 _GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc));
731 _GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc));
732 _GL_CXXALIAS_RPL (iswlower, int, (wint_t wc));
733 _GL_CXXALIAS_RPL (iswprint, int, (wint_t wc));
734 _GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc));
735 _GL_CXXALIAS_RPL (iswspace, int, (wint_t wc));
736 _GL_CXXALIAS_RPL (iswupper, int, (wint_t wc));
737 _GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc));
738 #else
739 _GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
740 _GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
741 _GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc));
742 _GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc));
743 _GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc));
744 _GL_CXXALIAS_SYS (iswlower, int, (wint_t wc));
745 _GL_CXXALIAS_SYS (iswprint, int, (wint_t wc));
746 _GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc));
747 _GL_CXXALIAS_SYS (iswspace, int, (wint_t wc));
748 _GL_CXXALIAS_SYS (iswupper, int, (wint_t wc));
749 _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc));
750 #endif
751 _GL_CXXALIASWARN (iswalnum);
752 _GL_CXXALIASWARN (iswalpha);
753 _GL_CXXALIASWARN (iswcntrl);
754 _GL_CXXALIASWARN (iswdigit);
755 _GL_CXXALIASWARN (iswgraph);
756 _GL_CXXALIASWARN (iswlower);
757 _GL_CXXALIASWARN (iswprint);
758 _GL_CXXALIASWARN (iswpunct);
759 _GL_CXXALIASWARN (iswspace);
760 _GL_CXXALIASWARN (iswupper);
761 _GL_CXXALIASWARN (iswxdigit);
762
763 #if 0
764 # if 0 || 0
765 _GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
766 # else
767 _GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
768 # endif
769 _GL_CXXALIASWARN (iswblank);
770 #endif
771
772 #if !1
773 # if !GNULIB_defined_wctype_t
774 typedef void * wctype_t;
775 # define GNULIB_defined_wctype_t 1
776 # endif
777 #endif
778
779 /* Get a descriptor for a wide character property. */
780 #if 0
781 # if !1
782 _GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name));
783 # endif
784 _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
785 _GL_CXXALIASWARN (wctype);
786 #elif defined GNULIB_POSIXCHECK
787 # undef wctype
788 # if HAVE_RAW_DECL_WCTYPE
789 _GL_WARN_ON_USE (wctype, "wctype is unportable - "
790 "use gnulib module wctype for portability");
791 # endif
792 #endif
793
794 /* Test whether a wide character has a given property.
795 The argument WC must be either a wchar_t value or WEOF.
796 The argument DESC must have been returned by the wctype() function. */
797 #if 0
798 # if !1
799 _GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc));
800 # endif
801 _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
802 _GL_CXXALIASWARN (iswctype);
803 #elif defined GNULIB_POSIXCHECK
804 # undef iswctype
805 # if HAVE_RAW_DECL_ISWCTYPE
806 _GL_WARN_ON_USE (iswctype, "iswctype is unportable - "
807 "use gnulib module iswctype for portability");
808 # endif
809 #endif
810
811 #if 0 || defined __MINGW32__
812 _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc));
813 _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
814 #else
815 _GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc));
816 _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc));
817 #endif
818 _GL_CXXALIASWARN (towlower);
819 _GL_CXXALIASWARN (towupper);
820
821 #if !1
822 # if !GNULIB_defined_wctrans_t
823 typedef void * wctrans_t;
824 # define GNULIB_defined_wctrans_t 1
825 # endif
826 #endif
827
828 /* Get a descriptor for a wide character case conversion. */
829 #if 0
830 # if !1
831 _GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name));
832 # endif
833 _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
834 _GL_CXXALIASWARN (wctrans);
835 #elif defined GNULIB_POSIXCHECK
836 # undef wctrans
837 # if HAVE_RAW_DECL_WCTRANS
838 _GL_WARN_ON_USE (wctrans, "wctrans is unportable - "
839 "use gnulib module wctrans for portability");
840 # endif
841 #endif
842
843 /* Perform a given case conversion on a wide character.
844 The argument WC must be either a wchar_t value or WEOF.
845 The argument DESC must have been returned by the wctrans() function. */
846 #if 0
847 # if !1
848 _GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
849 # endif
850 _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
851 _GL_CXXALIASWARN (towctrans);
852 #elif defined GNULIB_POSIXCHECK
853 # undef towctrans
854 # if HAVE_RAW_DECL_TOWCTRANS
855 _GL_WARN_ON_USE (towctrans, "towctrans is unportable - "
856 "use gnulib module towctrans for portability");
857 # endif
858 #endif
859
860 _GL_INLINE_HEADER_END
861
862 #endif /* _GL_WCTYPE_H */
863 #endif /* _GL_WCTYPE_H */
864 #endif
time.h
name
const char * name
Definition: tracepoint.c:180
_GL_WCTYPE_INLINE
#define _GL_WCTYPE_INLINE
Definition: wctype.h:82
_GL_CXXALIAS_SYS
_GL_CXXALIAS_SYS(iswalnum, int,(wint_t wc))
_GL_WARN_ON_USE
#define _GL_WARN_ON_USE(function, message)
Definition: dirent.h:383
_GL_FUNCDECL_RPL
#define _GL_FUNCDECL_RPL(func, rettype, parameters_and_attributes)
Definition: c++defs.h:87
_GL_CXXALIAS_RPL
#define _GL_CXXALIAS_RPL(func, rettype, parameters)
Definition: c++defs.h:111
wchar.h
stdio.h
_GL_CXXALIASWARN
_GL_CXXALIASWARN(iswalnum)
_GL_INLINE_HEADER_END
#define _GL_INLINE_HEADER_END
Definition: config.h:1868
_GL_FUNCDECL_SYS
#define _GL_FUNCDECL_SYS(func, rettype, parameters_and_attributes)
Definition: c++defs.h:99
_GL_INLINE_HEADER_BEGIN
#define _GL_INLINE_HEADER_BEGIN
Definition: config.h:1867