Debian Codegraph @

lib/wctype.in.h

raw
1 /* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
2
3 Copyright (C) 2006-2026 Free Software Foundation, Inc.
4
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.
9
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.
14
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/>. */
17
18 /* Written by Bruno Haible and Paul Eggert. */
19
20 /*
21 * ISO C 99 <wctype.h> for platforms that lack it.
22 * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html>
23 *
24 * iswctype, towctrans, towlower, towupper, wctrans, wctype,
25 * wctrans_t, and wctype_t are not yet implemented.
26 */
27
28 #if __GNUC__ >= 3
29 @PRAGMA_SYSTEM_HEADER@
30 #endif
31 @PRAGMA_COLUMNS@
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
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
52
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
57
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
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 @HAVE_WCTYPE_H@
71 # @INCLUDE_NEXT@ @NEXT_WCTYPE_H@
72 #endif
73
74 #ifndef _@GUARD_PREFIX@_WCTYPE_H
75 #define _@GUARD_PREFIX@_WCTYPE_H
76
77 _GL_INLINE_HEADER_BEGIN
78 #ifndef _GL_WCTYPE_INLINE
79 # define _GL_WCTYPE_INLINE _GL_INLINE
80 #endif
81
82 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
83
84 /* The definition of _GL_ARG_NONNULL is copied here. */
85
86 /* The definition of _GL_WARN_ON_USE is copied here. */
87
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
100
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
128
129
130 #if !GNULIB_defined_wctype_functions
131
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@
140
141 # if @GNULIBHEADERS_OVERRIDE_WINT_T@ /* implies @REPLACE_ISWCNTRL@ */
142
143 _GL_WCTYPE_INLINE int
144 rpl_iswalnum (wint_t wc)
145 {
146 return ((wchar_t) wc == wc ? iswalnum ((wchar_t) wc) : 0);
147 }
148
149 _GL_WCTYPE_INLINE int
150 rpl_iswalpha (wint_t wc)
151 {
152 return ((wchar_t) wc == wc ? iswalpha ((wchar_t) wc) : 0);
153 }
154
155 _GL_WCTYPE_INLINE int
156 rpl_iswblank (wint_t wc)
157 {
158 return ((wchar_t) wc == wc ? iswblank ((wchar_t) wc) : 0);
159 }
160
161 _GL_WCTYPE_INLINE int
162 rpl_iswcntrl (wint_t wc)
163 {
164 return ((wchar_t) wc == wc ? iswcntrl ((wchar_t) wc) : 0);
165 }
166
167 _GL_WCTYPE_INLINE int
168 rpl_iswdigit (wint_t wc)
169 {
170 return ((wchar_t) wc == wc ? wc >= '0' && wc <= '9' : 0);
171 }
172
173 _GL_WCTYPE_INLINE int
174 rpl_iswgraph (wint_t wc)
175 {
176 return ((wchar_t) wc == wc ? iswgraph ((wchar_t) wc) : 0);
177 }
178
179 _GL_WCTYPE_INLINE int
180 rpl_iswlower (wint_t wc)
181 {
182 return ((wchar_t) wc == wc ? iswlower ((wchar_t) wc) : 0);
183 }
184
185 _GL_WCTYPE_INLINE int
186 rpl_iswprint (wint_t wc)
187 {
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
193 }
194
195 _GL_WCTYPE_INLINE int
196 rpl_iswpunct (wint_t wc)
197 {
198 return ((wchar_t) wc == wc ? iswpunct ((wchar_t) wc) : 0);
199 }
200
201 _GL_WCTYPE_INLINE int
202 rpl_iswspace (wint_t wc)
203 {
204 return ((wchar_t) wc == wc ? iswspace ((wchar_t) wc) : 0);
205 }
206
207 _GL_WCTYPE_INLINE int
208 rpl_iswupper (wint_t wc)
209 {
210 return ((wchar_t) wc == wc ? iswupper ((wchar_t) wc) : 0);
211 }
212
213 _GL_WCTYPE_INLINE int
214 rpl_iswxdigit (wint_t wc)
215 {
216 return ((wchar_t) wc == wc
217 ? (wc >= '0' && wc <= '9')
218 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')
219 : 0);
220 }
221
222 _GL_WCTYPE_INLINE wint_t
223 rpl_towlower (wint_t wc)
224 {
225 return ((wchar_t) wc == wc ? (wchar_t) towlower ((wchar_t) wc) : wc);
226 }
227
228 _GL_WCTYPE_INLINE wint_t
229 rpl_towupper (wint_t wc)
230 {
231 return ((wchar_t) wc == wc ? (wchar_t) towupper ((wchar_t) wc) : wc);
232 }
233
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
264
265 # else
266
267 /* On some old platforms the functions are broken. */
268 # if @REPLACE_ISWCNTRL@
269 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
270 # define iswalnum rpl_iswalnum
271 # define iswalpha rpl_iswalpha
272 # define iswblank rpl_iswblank
273 # define iswcntrl rpl_iswcntrl
274 # define iswdigit rpl_iswdigit
275 # define iswgraph rpl_iswgraph
276 # define iswlower rpl_iswlower
277 # define iswprint rpl_iswprint
278 # define iswpunct rpl_iswpunct
279 # define iswspace rpl_iswspace
280 # define iswupper rpl_iswupper
281 # define iswxdigit rpl_iswxdigit
282 # endif
283 # endif
284 # if @REPLACE_TOWLOWER@
285 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
286 # define towlower rpl_towlower
287 # define towupper rpl_towupper
288 # endif
289 # endif
290
291 _GL_WCTYPE_INLINE int
292 # if @REPLACE_ISWCNTRL@
293 rpl_iswalnum
294 # else
295 iswalnum
296 # endif
297 (wint_t wc)
298 {
299 return ((wc >= '0' && wc <= '9')
300 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
301 }
302
303 _GL_WCTYPE_INLINE int
304 # if @REPLACE_ISWCNTRL@
305 rpl_iswalpha
306 # else
307 iswalpha
308 # endif
309 (wint_t wc)
310 {
311 return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
312 }
313
314 _GL_WCTYPE_INLINE int
315 # if @REPLACE_ISWCNTRL@
316 rpl_iswblank
317 # else
318 iswblank
319 # endif
320 (wint_t wc)
321 {
322 return wc == ' ' || wc == '\t';
323 }
324
325 _GL_WCTYPE_INLINE int
326 # if @REPLACE_ISWCNTRL@
327 rpl_iswcntrl
328 # else
329 iswcntrl
330 # endif
331 (wint_t wc)
332 {
333 return (wc & ~0x1f) == 0 || wc == 0x7f;
334 }
335
336 _GL_WCTYPE_INLINE int
337 # if @REPLACE_ISWDIGIT@
338 rpl_iswdigit
339 # else
340 iswdigit
341 # endif
342 (wint_t wc)
343 {
344 return wc >= '0' && wc <= '9';
345 }
346
347 _GL_WCTYPE_INLINE int
348 # if @REPLACE_ISWCNTRL@
349 rpl_iswgraph
350 # else
351 iswgraph
352 # endif
353 (wint_t wc)
354 {
355 return wc >= '!' && wc <= '~';
356 }
357
358 _GL_WCTYPE_INLINE int
359 # if @REPLACE_ISWCNTRL@
360 rpl_iswlower
361 # else
362 iswlower
363 # endif
364 (wint_t wc)
365 {
366 return wc >= 'a' && wc <= 'z';
367 }
368
369 _GL_WCTYPE_INLINE int
370 # if @REPLACE_ISWCNTRL@
371 rpl_iswprint
372 # else
373 iswprint
374 # endif
375 (wint_t wc)
376 {
377 return wc >= ' ' && wc <= '~';
378 }
379
380 _GL_WCTYPE_INLINE int
381 # if @REPLACE_ISWCNTRL@
382 rpl_iswpunct
383 # else
384 iswpunct
385 # endif
386 (wint_t wc)
387 {
388 return (wc >= '!' && wc <= '~'
389 && !((wc >= '0' && wc <= '9')
390 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
391 }
392
393 _GL_WCTYPE_INLINE int
394 # if @REPLACE_ISWCNTRL@
395 rpl_iswspace
396 # else
397 iswspace
398 # endif
399 (wint_t wc)
400 {
401 return (wc == ' ' || wc == '\t'
402 || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
403 }
404
405 _GL_WCTYPE_INLINE int
406 # if @REPLACE_ISWCNTRL@
407 rpl_iswupper
408 # else
409 iswupper
410 # endif
411 (wint_t wc)
412 {
413 return wc >= 'A' && wc <= 'Z';
414 }
415
416 _GL_WCTYPE_INLINE int
417 # if @REPLACE_ISWXDIGIT@
418 rpl_iswxdigit
419 # else
420 iswxdigit
421 # endif
422 (wint_t wc)
423 {
424 return ((wc >= '0' && wc <= '9')
425 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
426 }
427
428 _GL_WCTYPE_INLINE wint_t
429 # if @REPLACE_TOWLOWER@
430 rpl_towlower
431 # else
432 towlower
433 # endif
434 (wint_t wc)
435 {
436 return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc);
437 }
438
439 _GL_WCTYPE_INLINE wint_t
440 # if @REPLACE_TOWLOWER@
441 rpl_towupper
442 # else
443 towupper
444 # endif
445 (wint_t wc)
446 {
447 return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
448 }
449
450 # endif
451
452 # else
453 /* Only some of the functions are missing or broken. */
454
455 # if @GNULIB_ISWBLANK@ && (! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@)
456 /* Only the iswblank function is missing. */
457 # if @REPLACE_ISWBLANK@
458 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
459 # define iswblank rpl_iswblank
460 # endif
461 _GL_FUNCDECL_RPL (iswblank, int, (wint_t wc), );
462 # else
463 _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc), );
464 # endif
465 # endif
466
467 # if @GNULIB_ISWDIGIT@
468 # if @REPLACE_ISWDIGIT@
469 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
470 # undef iswdigit
471 # define iswdigit rpl_iswdigit
472 # endif
473 _GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc), );
474 # endif
475 # endif
476
477 # if @GNULIB_ISWPUNCT@
478 # if @REPLACE_ISWPUNCT@
479 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
480 # undef iswpunct
481 # define iswpunct rpl_iswpunct
482 # endif
483 _GL_FUNCDECL_RPL (iswpunct, 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
495 # endif
496
497 # endif
498
499 # if defined __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@
500
501 /* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t.
502 The functions towlower and towupper are implemented in the MSVCRT library
503 to take a wchar_t argument and return a wchar_t result. mingw declares
504 these functions to take a wint_t argument and return a wint_t result.
505 This means that:
506 1. When the user passes an argument outside the range 0x0000..0xFFFF, the
507 function will look only at the lower 16 bits. This is allowed according
508 to POSIX.
509 2. The return value is returned in the lower 16 bits of the result register.
510 The upper 16 bits are random: whatever happened to be in that part of the
511 result register. We need to fix this by adding a zero-extend from
512 wchar_t to wint_t after the call. */
513
514 _GL_WCTYPE_INLINE wint_t
515 rpl_towlower (wint_t wc)
516 {
517 return (wint_t) (wchar_t) towlower (wc);
518 }
519 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
520 # define towlower rpl_towlower
521 # endif
522
523 _GL_WCTYPE_INLINE wint_t
524 rpl_towupper (wint_t wc)
525 {
526 return (wint_t) (wchar_t) towupper (wc);
527 }
528 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
529 # define towupper rpl_towupper
530 # endif
531
532 # endif /* __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@ */
533
534 # define GNULIB_defined_wctype_functions 1
535 #endif
536
537 #if @REPLACE_ISWCNTRL@
538 _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc));
539 #else
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
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
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
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
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
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
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
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
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
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
593 _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc));
594 # endif
595 #endif
596 #if __GLIBC__ >= 2
597 _GL_CXXALIASWARN (iswalnum);
598 _GL_CXXALIASWARN (iswalpha);
599 _GL_CXXALIASWARN (iswcntrl);
600 _GL_CXXALIASWARN (iswdigit);
601 _GL_CXXALIASWARN (iswgraph);
602 _GL_CXXALIASWARN (iswlower);
603 _GL_CXXALIASWARN (iswprint);
604 _GL_CXXALIASWARN (iswpunct);
605 _GL_CXXALIASWARN (iswspace);
606 _GL_CXXALIASWARN (iswupper);
607 _GL_CXXALIASWARN (iswxdigit);
608 #endif
609
610 #if @GNULIB_ISWBLANK@
611 # if @REPLACE_ISWCNTRL@ || @REPLACE_ISWBLANK@
612 _GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
613 # else
614 _GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
615 # endif
616 # if __GLIBC__ >= 2
617 _GL_CXXALIASWARN (iswblank);
618 # endif
619 #endif
620
621 #if !@HAVE_WCTYPE_T@
622 # if !GNULIB_defined_wctype_t
623 typedef void * wctype_t;
624 # define GNULIB_defined_wctype_t 1
625 # endif
626 #elif @REPLACE_WCTYPE@
627 # if !GNULIB_defined_wctype_t
628 typedef void *rpl_wctype_t;
629 # undef wctype_t
630 # define wctype_t rpl_wctype_t
631 # define GNULIB_defined_wctype_t 1
632 # endif
633 #endif
634
635 /* Get a descriptor for a wide character property. */
636 #if @GNULIB_WCTYPE@
637 # if @REPLACE_WCTYPE@
638 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
639 # undef wctype
640 # define wctype rpl_wctype
641 # endif
642 _GL_FUNCDECL_RPL (wctype, wctype_t, (const char *name),
643 _GL_ARG_NONNULL ((1)));
644 _GL_CXXALIAS_RPL (wctype, wctype_t, (const char *name));
645 # else
646 # if !@HAVE_WCTYPE_T@
647 _GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name),
648 _GL_ARG_NONNULL ((1)));
649 # endif
650 _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
651 # endif
652 # if __GLIBC__ >= 2
653 _GL_CXXALIASWARN (wctype);
654 # endif
655 #elif defined GNULIB_POSIXCHECK
656 # if HAVE_RAW_DECL_WCTYPE
657 _GL_WARN_ON_USE (wctype, "wctype is unportable - "
658 "use gnulib module wctype for portability");
659 # endif
660 #endif
661
662 /* Test whether a wide character has a given property.
663 The argument WC must be either a wchar_t value or WEOF.
664 The argument DESC must have been returned by the wctype() function. */
665 #if @GNULIB_ISWCTYPE@
666 # if @GNULIBHEADERS_OVERRIDE_WINT_T@ || @REPLACE_WCTYPE@
667 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
668 # undef iswctype
669 # define iswctype rpl_iswctype
670 # endif
671 _GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc), );
672 _GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc));
673 # else
674 # if !@HAVE_WCTYPE_T@
675 _GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc), );
676 # endif
677 _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
678 # endif
679 # if __GLIBC__ >= 2
680 _GL_CXXALIASWARN (iswctype);
681 # endif
682 #elif defined GNULIB_POSIXCHECK
683 # if HAVE_RAW_DECL_ISWCTYPE
684 _GL_WARN_ON_USE (iswctype, "iswctype is unportable - "
685 "use gnulib module iswctype for portability");
686 # endif
687 #endif
688
689 #if @REPLACE_TOWLOWER@ || defined __MINGW32__
690 _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc));
691 _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
692 #else
693 _GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc));
694 _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc));
695 #endif
696 #if __GLIBC__ >= 2
697 _GL_CXXALIASWARN (towlower);
698 _GL_CXXALIASWARN (towupper);
699 #endif
700
701 #if !@HAVE_WCTRANS_T@
702 # if !GNULIB_defined_wctrans_t
703 typedef void * wctrans_t;
704 # define GNULIB_defined_wctrans_t 1
705 # endif
706 #elif @REPLACE_WCTRANS@
707 # if !GNULIB_defined_wctrans_t
708 typedef void *rpl_wctrans_t;
709 # undef wctrans_t
710 # define wctrans_t rpl_wctrans_t
711 # define GNULIB_defined_wctrans_t 1
712 # endif
713 #endif
714
715 /* Get a descriptor for a wide character case conversion. */
716 #if @GNULIB_WCTRANS@
717 # if @REPLACE_WCTRANS@
718 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
719 # undef wctrans
720 # define wctrans rpl_wctrans
721 # endif
722 _GL_FUNCDECL_RPL (wctrans, wctrans_t, (const char *name),
723 _GL_ARG_NONNULL ((1)));
724 _GL_CXXALIAS_RPL (wctrans, wctrans_t, (const char *name));
725 # else
726 # if !@HAVE_WCTRANS_T@
727 _GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name),
728 _GL_ARG_NONNULL ((1)));
729 # endif
730 _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
731 # endif
732 # if __GLIBC__ >= 2
733 _GL_CXXALIASWARN (wctrans);
734 # endif
735 #elif defined GNULIB_POSIXCHECK
736 # if HAVE_RAW_DECL_WCTRANS
737 _GL_WARN_ON_USE (wctrans, "wctrans is unportable - "
738 "use gnulib module wctrans for portability");
739 # endif
740 #endif
741
742 /* Perform a given case conversion on a wide character.
743 The argument WC must be either a wchar_t value or WEOF.
744 The argument DESC must have been returned by the wctrans() function. */
745 #if @GNULIB_TOWCTRANS@
746 # if @REPLACE_WCTRANS@
747 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
748 # undef towctrans
749 # define towctrans rpl_towctrans
750 # endif
751 _GL_FUNCDECL_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc), );
752 _GL_CXXALIAS_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc));
753 # else
754 # if !@HAVE_WCTRANS_T@
755 _GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc), );
756 # endif
757 _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
758 # endif
759 # if __GLIBC__ >= 2
760 _GL_CXXALIASWARN (towctrans);
761 # endif
762 #elif defined GNULIB_POSIXCHECK
763 # if HAVE_RAW_DECL_TOWCTRANS
764 _GL_WARN_ON_USE (towctrans, "towctrans is unportable - "
765 "use gnulib module towctrans for portability");
766 # endif
767 #endif
768
769 _GL_INLINE_HEADER_END
770
771 #endif /* _@GUARD_PREFIX@_WCTYPE_H */
772 #endif /* _@GUARD_PREFIX@_WCTYPE_H */
773 #endif