exp2l: Work around a NetBSD 10.0/i386 bug.
[gnulib.git] / lib / wctype.in.h
blob851c4f4eb21b85a5ced81de0ab25724be15edd9b
1 /* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
3 Copyright (C) 2006-2024 Free Software Foundation, Inc.
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18 /* Written by Bruno Haible and Paul Eggert. */
21 * ISO C 99 <wctype.h> for platforms that lack it.
22 * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html>
24 * iswctype, towctrans, towlower, towupper, wctrans, wctype,
25 * wctrans_t, and wctype_t are not yet implemented.
28 #if __GNUC__ >= 3
29 @PRAGMA_SYSTEM_HEADER@
30 #endif
31 @PRAGMA_COLUMNS@
33 #if (defined __MINGW32__ && defined __CTYPE_H_SOURCED__)
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. */
40 #@INCLUDE_NEXT@ @NEXT_WCTYPE_H@
42 #else
43 /* Normal invocation convention. */
45 #ifndef _@GUARD_PREFIX@_WCTYPE_H
47 /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK,
48 HAVE_RAW_DECL_*. */
49 #if !_GL_CONFIG_H_INCLUDED
50 #error "Please include config.h first."
51 #endif
53 #if @HAVE_WINT_T@
54 /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
55 # include <wchar.h>
56 #endif
58 /* Native Windows (mingw, MSVC) have declarations of towupper, towlower, and
59 isw* functions in <ctype.h>, <wchar.h> as well as in <wctype.h>. Include
60 <ctype.h>, <wchar.h> in advance to avoid rpl_ prefix being added to the
61 declarations. */
62 #if defined _WIN32 && ! defined __CYGWIN__
63 # include <ctype.h>
64 # include <wchar.h>
65 #endif
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 @HAVE_WCTYPE_H@
71 # @INCLUDE_NEXT@ @NEXT_WCTYPE_H@
72 #endif
74 #ifndef _@GUARD_PREFIX@_WCTYPE_H
75 #define _@GUARD_PREFIX@_WCTYPE_H
77 _GL_INLINE_HEADER_BEGIN
78 #ifndef _GL_WCTYPE_INLINE
79 # define _GL_WCTYPE_INLINE _GL_INLINE
80 #endif
82 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
84 /* The definition of _GL_ARG_NONNULL is copied here. */
86 /* The definition of _GL_WARN_ON_USE is copied here. */
88 /* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which
89 #defines a number of identifiers in the application namespace. Revert
90 these #defines. */
91 #ifdef __sun
92 # undef multibyte
93 # undef eucw1
94 # undef eucw2
95 # undef eucw3
96 # undef scrw1
97 # undef scrw2
98 # undef scrw3
99 #endif
101 /* Define wint_t and WEOF. (Also done in wchar.in.h.) */
102 #if !@HAVE_WINT_T@ && !defined wint_t
103 # define wint_t int
104 # ifndef WEOF
105 # define WEOF -1
106 # endif
107 #else
108 /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
109 <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that
110 wint_t must be "unchanged by default argument promotions". Override it. */
111 # if @GNULIBHEADERS_OVERRIDE_WINT_T@
112 # if !GNULIB_defined_wint_t
113 # if @HAVE_CRTDEFS_H@
114 # include <crtdefs.h>
115 # else
116 # include <stddef.h>
117 # endif
118 typedef unsigned int rpl_wint_t;
119 # undef wint_t
120 # define wint_t rpl_wint_t
121 # define GNULIB_defined_wint_t 1
122 # endif
123 # endif
124 # ifndef WEOF
125 # define WEOF ((wint_t) -1)
126 # endif
127 #endif
130 #if !GNULIB_defined_wctype_functions
132 /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
133 Linux libc5 has <wctype.h> and the functions but they are broken.
134 mingw and MSVC have <wctype.h> and the functions but they take a wchar_t
135 as argument, not an rpl_wint_t. Additionally, the mingw iswprint function
136 and the Android iswpunct function are broken.
137 Assume all 11 functions (all isw* except iswblank) are implemented the
138 same way, or not at all. */
139 # if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
141 # if @GNULIBHEADERS_OVERRIDE_WINT_T@ /* implies @REPLACE_ISWCNTRL@ */
143 _GL_WCTYPE_INLINE int
144 rpl_iswalnum (wint_t wc)
146 return ((wchar_t) wc == wc ? iswalnum ((wchar_t) wc) : 0);
149 _GL_WCTYPE_INLINE int
150 rpl_iswalpha (wint_t wc)
152 return ((wchar_t) wc == wc ? iswalpha ((wchar_t) wc) : 0);
155 _GL_WCTYPE_INLINE int
156 rpl_iswblank (wint_t wc)
158 return ((wchar_t) wc == wc ? iswblank ((wchar_t) wc) : 0);
161 _GL_WCTYPE_INLINE int
162 rpl_iswcntrl (wint_t wc)
164 return ((wchar_t) wc == wc ? iswcntrl ((wchar_t) wc) : 0);
167 _GL_WCTYPE_INLINE int
168 rpl_iswdigit (wint_t wc)
170 return ((wchar_t) wc == wc ? wc >= '0' && wc <= '9' : 0);
173 _GL_WCTYPE_INLINE int
174 rpl_iswgraph (wint_t wc)
176 return ((wchar_t) wc == wc ? iswgraph ((wchar_t) wc) : 0);
179 _GL_WCTYPE_INLINE int
180 rpl_iswlower (wint_t wc)
182 return ((wchar_t) wc == wc ? iswlower ((wchar_t) wc) : 0);
185 _GL_WCTYPE_INLINE int
186 rpl_iswprint (wint_t wc)
188 # ifdef __MINGW32__
189 return ((wchar_t) wc == wc ? wc == ' ' || iswgraph ((wchar_t) wc) : 0);
190 # else
191 return ((wchar_t) wc == wc ? iswprint ((wchar_t) wc) : 0);
192 # endif
195 _GL_WCTYPE_INLINE int
196 rpl_iswpunct (wint_t wc)
198 return ((wchar_t) wc == wc ? iswpunct ((wchar_t) wc) : 0);
201 _GL_WCTYPE_INLINE int
202 rpl_iswspace (wint_t wc)
204 return ((wchar_t) wc == wc ? iswspace ((wchar_t) wc) : 0);
207 _GL_WCTYPE_INLINE int
208 rpl_iswupper (wint_t wc)
210 return ((wchar_t) wc == wc ? iswupper ((wchar_t) wc) : 0);
213 _GL_WCTYPE_INLINE int
214 rpl_iswxdigit (wint_t wc)
216 return ((wchar_t) wc == wc
217 ? (wc >= '0' && wc <= '9')
218 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')
219 : 0);
222 _GL_WCTYPE_INLINE wint_t
223 rpl_towlower (wint_t wc)
225 return ((wchar_t) wc == wc ? (wchar_t) towlower ((wchar_t) wc) : wc);
228 _GL_WCTYPE_INLINE wint_t
229 rpl_towupper (wint_t wc)
231 return ((wchar_t) wc == wc ? (wchar_t) towupper ((wchar_t) wc) : wc);
234 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
235 # undef iswalnum
236 # undef iswalpha
237 # undef iswblank
238 # undef iswcntrl
239 # undef iswdigit
240 # undef iswgraph
241 # undef iswlower
242 # undef iswprint
243 # undef iswpunct
244 # undef iswspace
245 # undef iswupper
246 # undef iswxdigit
247 # undef towlower
248 # undef towupper
249 # define iswalnum rpl_iswalnum
250 # define iswalpha rpl_iswalpha
251 # define iswblank rpl_iswblank
252 # define iswcntrl rpl_iswcntrl
253 # define iswdigit rpl_iswdigit
254 # define iswgraph rpl_iswgraph
255 # define iswlower rpl_iswlower
256 # define iswprint rpl_iswprint
257 # define iswpunct rpl_iswpunct
258 # define iswspace rpl_iswspace
259 # define iswupper rpl_iswupper
260 # define iswxdigit rpl_iswxdigit
261 # define towlower rpl_towlower
262 # define towupper rpl_towupper
263 # endif
265 # else
267 /* IRIX 5.3 has macros but no functions, its isw* macros refer to an
268 undefined variable _ctmp_ and to <ctype.h> macros like _P, and they
269 refer to system functions like _iswctype that are not in the
270 standard C library. Rather than try to get ancient buggy
271 implementations like this to work, just disable them. */
272 # undef iswalnum
273 # undef iswalpha
274 # undef iswblank
275 # undef iswcntrl
276 # undef iswdigit
277 # undef iswgraph
278 # undef iswlower
279 # undef iswprint
280 # undef iswpunct
281 # undef iswspace
282 # undef iswupper
283 # undef iswxdigit
284 # undef towlower
285 # undef towupper
287 /* Linux libc5 has <wctype.h> and the functions but they are broken. */
288 # if @REPLACE_ISWCNTRL@
289 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
290 # define iswalnum rpl_iswalnum
291 # define iswalpha rpl_iswalpha
292 # define iswblank rpl_iswblank
293 # define iswcntrl rpl_iswcntrl
294 # define iswdigit rpl_iswdigit
295 # define iswgraph rpl_iswgraph
296 # define iswlower rpl_iswlower
297 # define iswprint rpl_iswprint
298 # define iswpunct rpl_iswpunct
299 # define iswspace rpl_iswspace
300 # define iswupper rpl_iswupper
301 # define iswxdigit rpl_iswxdigit
302 # endif
303 # endif
304 # if @REPLACE_TOWLOWER@
305 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
306 # define towlower rpl_towlower
307 # define towupper rpl_towupper
308 # endif
309 # endif
311 _GL_WCTYPE_INLINE int
312 # if @REPLACE_ISWCNTRL@
313 rpl_iswalnum
314 # else
315 iswalnum
316 # endif
317 (wint_t wc)
319 return ((wc >= '0' && wc <= '9')
320 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
323 _GL_WCTYPE_INLINE int
324 # if @REPLACE_ISWCNTRL@
325 rpl_iswalpha
326 # else
327 iswalpha
328 # endif
329 (wint_t wc)
331 return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
334 _GL_WCTYPE_INLINE int
335 # if @REPLACE_ISWCNTRL@
336 rpl_iswblank
337 # else
338 iswblank
339 # endif
340 (wint_t wc)
342 return wc == ' ' || wc == '\t';
345 _GL_WCTYPE_INLINE int
346 # if @REPLACE_ISWCNTRL@
347 rpl_iswcntrl
348 # else
349 iswcntrl
350 # endif
351 (wint_t wc)
353 return (wc & ~0x1f) == 0 || wc == 0x7f;
356 _GL_WCTYPE_INLINE int
357 # if @REPLACE_ISWDIGIT@
358 rpl_iswdigit
359 # else
360 iswdigit
361 # endif
362 (wint_t wc)
364 return wc >= '0' && wc <= '9';
367 _GL_WCTYPE_INLINE int
368 # if @REPLACE_ISWCNTRL@
369 rpl_iswgraph
370 # else
371 iswgraph
372 # endif
373 (wint_t wc)
375 return wc >= '!' && wc <= '~';
378 _GL_WCTYPE_INLINE int
379 # if @REPLACE_ISWCNTRL@
380 rpl_iswlower
381 # else
382 iswlower
383 # endif
384 (wint_t wc)
386 return wc >= 'a' && wc <= 'z';
389 _GL_WCTYPE_INLINE int
390 # if @REPLACE_ISWCNTRL@
391 rpl_iswprint
392 # else
393 iswprint
394 # endif
395 (wint_t wc)
397 return wc >= ' ' && wc <= '~';
400 _GL_WCTYPE_INLINE int
401 # if @REPLACE_ISWCNTRL@
402 rpl_iswpunct
403 # else
404 iswpunct
405 # endif
406 (wint_t wc)
408 return (wc >= '!' && wc <= '~'
409 && !((wc >= '0' && wc <= '9')
410 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
413 _GL_WCTYPE_INLINE int
414 # if @REPLACE_ISWCNTRL@
415 rpl_iswspace
416 # else
417 iswspace
418 # endif
419 (wint_t wc)
421 return (wc == ' ' || wc == '\t'
422 || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
425 _GL_WCTYPE_INLINE int
426 # if @REPLACE_ISWCNTRL@
427 rpl_iswupper
428 # else
429 iswupper
430 # endif
431 (wint_t wc)
433 return wc >= 'A' && wc <= 'Z';
436 _GL_WCTYPE_INLINE int
437 # if @REPLACE_ISWXDIGIT@
438 rpl_iswxdigit
439 # else
440 iswxdigit
441 # endif
442 (wint_t wc)
444 return ((wc >= '0' && wc <= '9')
445 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
448 _GL_WCTYPE_INLINE wint_t
449 # if @REPLACE_TOWLOWER@
450 rpl_towlower
451 # else
452 towlower
453 # endif
454 (wint_t wc)
456 return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc);
459 _GL_WCTYPE_INLINE wint_t
460 # if @REPLACE_TOWLOWER@
461 rpl_towupper
462 # else
463 towupper
464 # endif
465 (wint_t wc)
467 return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
470 # endif
472 # else
473 /* Only some of the functions are missing or broken. */
475 # if @GNULIB_ISWBLANK@ && (! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@)
476 /* Only the iswblank function is missing. */
477 # if @REPLACE_ISWBLANK@
478 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
479 # define iswblank rpl_iswblank
480 # endif
481 _GL_FUNCDECL_RPL (iswblank, int, (wint_t wc));
482 # else
483 _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
484 # endif
485 # endif
487 # if @GNULIB_ISWDIGIT@
488 # if @REPLACE_ISWDIGIT@
489 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
490 # undef iswdigit
491 # define iswdigit rpl_iswdigit
492 # endif
493 _GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc));
494 # endif
495 # endif
497 # if @GNULIB_ISWPUNCT@
498 # if @REPLACE_ISWPUNCT@
499 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
500 # undef iswpunct
501 # define iswpunct rpl_iswpunct
502 # endif
503 _GL_FUNCDECL_RPL (iswpunct, int, (wint_t wc));
504 # endif
505 # endif
507 # if @GNULIB_ISWXDIGIT@
508 # if @REPLACE_ISWXDIGIT@
509 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
510 # undef iswxdigit
511 # define iswxdigit rpl_iswxdigit
512 # endif
513 _GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc));
514 # endif
515 # endif
517 # endif
519 # if defined __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@
521 /* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t.
522 The functions towlower and towupper are implemented in the MSVCRT library
523 to take a wchar_t argument and return a wchar_t result. mingw declares
524 these functions to take a wint_t argument and return a wint_t result.
525 This means that:
526 1. When the user passes an argument outside the range 0x0000..0xFFFF, the
527 function will look only at the lower 16 bits. This is allowed according
528 to POSIX.
529 2. The return value is returned in the lower 16 bits of the result register.
530 The upper 16 bits are random: whatever happened to be in that part of the
531 result register. We need to fix this by adding a zero-extend from
532 wchar_t to wint_t after the call. */
534 _GL_WCTYPE_INLINE wint_t
535 rpl_towlower (wint_t wc)
537 return (wint_t) (wchar_t) towlower (wc);
539 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
540 # define towlower rpl_towlower
541 # endif
543 _GL_WCTYPE_INLINE wint_t
544 rpl_towupper (wint_t wc)
546 return (wint_t) (wchar_t) towupper (wc);
548 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
549 # define towupper rpl_towupper
550 # endif
552 # endif /* __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@ */
554 # define GNULIB_defined_wctype_functions 1
555 #endif
557 #if @REPLACE_ISWCNTRL@
558 _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc));
559 #else
560 _GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
561 #endif
562 #if @REPLACE_ISWCNTRL@
563 _GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc));
564 #else
565 _GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
566 #endif
567 #if @REPLACE_ISWCNTRL@
568 _GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc));
569 #else
570 _GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc));
571 #endif
572 #if @GNULIB_ISWDIGIT@
573 # if @REPLACE_ISWDIGIT@
574 _GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc));
575 # else
576 _GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc));
577 # endif
578 #endif
579 #if @REPLACE_ISWCNTRL@
580 _GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc));
581 #else
582 _GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc));
583 #endif
584 #if @REPLACE_ISWCNTRL@
585 _GL_CXXALIAS_RPL (iswlower, int, (wint_t wc));
586 #else
587 _GL_CXXALIAS_SYS (iswlower, int, (wint_t wc));
588 #endif
589 #if @REPLACE_ISWCNTRL@
590 _GL_CXXALIAS_RPL (iswprint, int, (wint_t wc));
591 #else
592 _GL_CXXALIAS_SYS (iswprint, int, (wint_t wc));
593 #endif
594 #if @REPLACE_ISWCNTRL@
595 _GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc));
596 #else
597 _GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc));
598 #endif
599 #if @REPLACE_ISWCNTRL@
600 _GL_CXXALIAS_RPL (iswspace, int, (wint_t wc));
601 #else
602 _GL_CXXALIAS_SYS (iswspace, int, (wint_t wc));
603 #endif
604 #if @REPLACE_ISWCNTRL@
605 _GL_CXXALIAS_RPL (iswupper, int, (wint_t wc));
606 #else
607 _GL_CXXALIAS_SYS (iswupper, int, (wint_t wc));
608 #endif
609 #if @GNULIB_ISWXDIGIT@
610 # if @REPLACE_ISWXDIGIT@
611 _GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc));
612 # else
613 _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc));
614 # endif
615 #endif
616 #if __GLIBC__ >= 2
617 _GL_CXXALIASWARN (iswalnum);
618 _GL_CXXALIASWARN (iswalpha);
619 _GL_CXXALIASWARN (iswcntrl);
620 _GL_CXXALIASWARN (iswdigit);
621 _GL_CXXALIASWARN (iswgraph);
622 _GL_CXXALIASWARN (iswlower);
623 _GL_CXXALIASWARN (iswprint);
624 _GL_CXXALIASWARN (iswpunct);
625 _GL_CXXALIASWARN (iswspace);
626 _GL_CXXALIASWARN (iswupper);
627 _GL_CXXALIASWARN (iswxdigit);
628 #endif
630 #if @GNULIB_ISWBLANK@
631 # if @REPLACE_ISWCNTRL@ || @REPLACE_ISWBLANK@
632 _GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
633 # else
634 _GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
635 # endif
636 # if __GLIBC__ >= 2
637 _GL_CXXALIASWARN (iswblank);
638 # endif
639 #endif
641 #if !@HAVE_WCTYPE_T@
642 # if !GNULIB_defined_wctype_t
643 typedef void * wctype_t;
644 # define GNULIB_defined_wctype_t 1
645 # endif
646 #elif @REPLACE_WCTYPE@
647 # if !GNULIB_defined_wctype_t
648 typedef void *rpl_wctype_t;
649 # undef wctype_t
650 # define wctype_t rpl_wctype_t
651 # define GNULIB_defined_wctype_t 1
652 # endif
653 #endif
655 /* Get a descriptor for a wide character property. */
656 #if @GNULIB_WCTYPE@
657 # if @REPLACE_WCTYPE@
658 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
659 # undef wctype
660 # define wctype rpl_wctype
661 # endif
662 _GL_FUNCDECL_RPL (wctype, wctype_t, (const char *name)
663 _GL_ARG_NONNULL ((1)));
664 _GL_CXXALIAS_RPL (wctype, wctype_t, (const char *name));
665 # else
666 # if !@HAVE_WCTYPE_T@
667 _GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name)
668 _GL_ARG_NONNULL ((1)));
669 # endif
670 _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
671 # endif
672 # if __GLIBC__ >= 2
673 _GL_CXXALIASWARN (wctype);
674 # endif
675 #elif defined GNULIB_POSIXCHECK
676 # undef wctype
677 # if HAVE_RAW_DECL_WCTYPE
678 _GL_WARN_ON_USE (wctype, "wctype is unportable - "
679 "use gnulib module wctype for portability");
680 # endif
681 #endif
683 /* Test whether a wide character has a given property.
684 The argument WC must be either a wchar_t value or WEOF.
685 The argument DESC must have been returned by the wctype() function. */
686 #if @GNULIB_ISWCTYPE@
687 # if @GNULIBHEADERS_OVERRIDE_WINT_T@ || @REPLACE_WCTYPE@
688 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
689 # undef iswctype
690 # define iswctype rpl_iswctype
691 # endif
692 _GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc));
693 _GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc));
694 # else
695 # if !@HAVE_WCTYPE_T@
696 _GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc));
697 # endif
698 _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
699 # endif
700 # if __GLIBC__ >= 2
701 _GL_CXXALIASWARN (iswctype);
702 # endif
703 #elif defined GNULIB_POSIXCHECK
704 # undef iswctype
705 # if HAVE_RAW_DECL_ISWCTYPE
706 _GL_WARN_ON_USE (iswctype, "iswctype is unportable - "
707 "use gnulib module iswctype for portability");
708 # endif
709 #endif
711 #if @REPLACE_TOWLOWER@ || defined __MINGW32__
712 _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc));
713 _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
714 #else
715 _GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc));
716 _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc));
717 #endif
718 #if __GLIBC__ >= 2
719 _GL_CXXALIASWARN (towlower);
720 _GL_CXXALIASWARN (towupper);
721 #endif
723 #if !@HAVE_WCTRANS_T@
724 # if !GNULIB_defined_wctrans_t
725 typedef void * wctrans_t;
726 # define GNULIB_defined_wctrans_t 1
727 # endif
728 #elif @REPLACE_WCTRANS@
729 # if !GNULIB_defined_wctrans_t
730 typedef void *rpl_wctrans_t;
731 # undef wctrans_t
732 # define wctrans_t rpl_wctrans_t
733 # define GNULIB_defined_wctrans_t 1
734 # endif
735 #endif
737 /* Get a descriptor for a wide character case conversion. */
738 #if @GNULIB_WCTRANS@
739 # if @REPLACE_WCTRANS@
740 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
741 # undef wctrans
742 # define wctrans rpl_wctrans
743 # endif
744 _GL_FUNCDECL_RPL (wctrans, wctrans_t, (const char *name)
745 _GL_ARG_NONNULL ((1)));
746 _GL_CXXALIAS_RPL (wctrans, wctrans_t, (const char *name));
747 # else
748 # if !@HAVE_WCTRANS_T@
749 _GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name)
750 _GL_ARG_NONNULL ((1)));
751 # endif
752 _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
753 # endif
754 # if __GLIBC__ >= 2
755 _GL_CXXALIASWARN (wctrans);
756 # endif
757 #elif defined GNULIB_POSIXCHECK
758 # undef wctrans
759 # if HAVE_RAW_DECL_WCTRANS
760 _GL_WARN_ON_USE (wctrans, "wctrans is unportable - "
761 "use gnulib module wctrans for portability");
762 # endif
763 #endif
765 /* Perform a given case conversion on a wide character.
766 The argument WC must be either a wchar_t value or WEOF.
767 The argument DESC must have been returned by the wctrans() function. */
768 #if @GNULIB_TOWCTRANS@
769 # if @REPLACE_WCTRANS@
770 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
771 # undef towctrans
772 # define towctrans rpl_towctrans
773 # endif
774 _GL_FUNCDECL_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc));
775 _GL_CXXALIAS_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc));
776 # else
777 # if !@HAVE_WCTRANS_T@
778 _GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
779 # endif
780 _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
781 # endif
782 # if __GLIBC__ >= 2
783 _GL_CXXALIASWARN (towctrans);
784 # endif
785 #elif defined GNULIB_POSIXCHECK
786 # undef towctrans
787 # if HAVE_RAW_DECL_TOWCTRANS
788 _GL_WARN_ON_USE (towctrans, "towctrans is unportable - "
789 "use gnulib module towctrans for portability");
790 # endif
791 #endif
793 _GL_INLINE_HEADER_END
795 #endif /* _@GUARD_PREFIX@_WCTYPE_H */
796 #endif /* _@GUARD_PREFIX@_WCTYPE_H */
797 #endif