1 /* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
2
3 Copyright (C) 2006-2023 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_WARN_ON_USE is copied here. */
85
86 /* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which
87 #defines a number of identifiers in the application namespace. Revert
88 these #defines. */
89 #ifdef __sun
90 # undef multibyte
91 # undef eucw1
92 # undef eucw2
93 # undef eucw3
94 # undef scrw1
95 # undef scrw2
96 # undef scrw3
97 #endif
98
99 /* Define wint_t and WEOF. (Also done in wchar.in.h.) */
100 #if !@HAVE_WINT_T@ && !defined wint_t
101 # define wint_t int
102 # ifndef WEOF
103 # define WEOF -1
104 # endif
105 #else
106 /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
107 <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that
108 wint_t must be "unchanged by default argument promotions". Override it. */
109 # if @GNULIBHEADERS_OVERRIDE_WINT_T@
110 # if !GNULIB_defined_wint_t
111 # if @HAVE_CRTDEFS_H@
112 # include <crtdefs.h>
113 # else
114 # include <stddef.h>
115 # endif
116 typedef unsigned int rpl_wint_t;
117 # undef wint_t
118 # define wint_t rpl_wint_t
119 # define GNULIB_defined_wint_t 1
120 # endif
121 # endif
122 # ifndef WEOF
123 # define WEOF ((wint_t) -1)
124 # endif
125 #endif
126
127
128 #if !GNULIB_defined_wctype_functions
129
130 /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
131 Linux libc5 has <wctype.h> and the functions but they are broken.
132 mingw and MSVC have <wctype.h> and the functions but they take a wchar_t
133 as argument, not an rpl_wint_t.
134 Assume all 11 functions (all isw* except iswblank) are implemented the
135 same way, or not at all. */
136 # if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
137
138 # if @GNULIBHEADERS_OVERRIDE_WINT_T@ /* implies @REPLACE_ISWCNTRL@ */
139
140 _GL_WCTYPE_INLINE int
141 rpl_iswalnum (wint_t wc)
142 {
143 return ((wchar_t) wc == wc ? iswalnum ((wchar_t) wc) : 0);
144 }
145
146 _GL_WCTYPE_INLINE int
147 rpl_iswalpha (wint_t wc)
148 {
149 return ((wchar_t) wc == wc ? iswalpha ((wchar_t) wc) : 0);
150 }
151
152 _GL_WCTYPE_INLINE int
153 rpl_iswblank (wint_t wc)
154 {
155 return ((wchar_t) wc == wc ? iswblank ((wchar_t) wc) : 0);
156 }
157
158 _GL_WCTYPE_INLINE int
159 rpl_iswcntrl (wint_t wc)
160 {
161 return ((wchar_t) wc == wc ? iswcntrl ((wchar_t) wc) : 0);
162 }
163
164 _GL_WCTYPE_INLINE int
165 rpl_iswdigit (wint_t wc)
166 {
167 return ((wchar_t) wc == wc ? wc >= '0' && wc <= '9' : 0);
168 }
169
170 _GL_WCTYPE_INLINE int
171 rpl_iswgraph (wint_t wc)
172 {
173 return ((wchar_t) wc == wc ? iswgraph ((wchar_t) wc) : 0);
174 }
175
176 _GL_WCTYPE_INLINE int
177 rpl_iswlower (wint_t wc)
178 {
179 return ((wchar_t) wc == wc ? iswlower ((wchar_t) wc) : 0);
180 }
181
182 _GL_WCTYPE_INLINE int
183 rpl_iswprint (wint_t wc)
184 {
185 return ((wchar_t) wc == wc ? iswprint ((wchar_t) wc) : 0);
186 }
187
188 _GL_WCTYPE_INLINE int
189 rpl_iswpunct (wint_t wc)
190 {
191 return ((wchar_t) wc == wc ? iswpunct ((wchar_t) wc) : 0);
192 }
193
194 _GL_WCTYPE_INLINE int
195 rpl_iswspace (wint_t wc)
196 {
197 return ((wchar_t) wc == wc ? iswspace ((wchar_t) wc) : 0);
198 }
199
200 _GL_WCTYPE_INLINE int
201 rpl_iswupper (wint_t wc)
202 {
203 return ((wchar_t) wc == wc ? iswupper ((wchar_t) wc) : 0);
204 }
205
206 _GL_WCTYPE_INLINE int
207 rpl_iswxdigit (wint_t wc)
208 {
209 return ((wchar_t) wc == wc
210 ? (wc >= '0' && wc <= '9')
211 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')
212 : 0);
213 }
214
215 _GL_WCTYPE_INLINE wint_t
216 rpl_towlower (wint_t wc)
217 {
218 return ((wchar_t) wc == wc ? (wchar_t) towlower ((wchar_t) wc) : wc);
219 }
220
221 _GL_WCTYPE_INLINE wint_t
222 rpl_towupper (wint_t wc)
223 {
224 return ((wchar_t) wc == wc ? (wchar_t) towupper ((wchar_t) wc) : wc);
225 }
226
227 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
228 # undef iswalnum
229 # undef iswalpha
230 # undef iswblank
231 # undef iswcntrl
232 # undef iswdigit
233 # undef iswgraph
234 # undef iswlower
235 # undef iswprint
236 # undef iswpunct
237 # undef iswspace
238 # undef iswupper
239 # undef iswxdigit
240 # undef towlower
241 # undef towupper
242 # define iswalnum rpl_iswalnum
243 # define iswalpha rpl_iswalpha
244 # define iswblank rpl_iswblank
245 # define iswcntrl rpl_iswcntrl
246 # define iswdigit rpl_iswdigit
247 # define iswgraph rpl_iswgraph
248 # define iswlower rpl_iswlower
249 # define iswprint rpl_iswprint
250 # define iswpunct rpl_iswpunct
251 # define iswspace rpl_iswspace
252 # define iswupper rpl_iswupper
253 # define iswxdigit rpl_iswxdigit
254 # define towlower rpl_towlower
255 # define towupper rpl_towupper
256 # endif
257
258 # else
259
260 /* IRIX 5.3 has macros but no functions, its isw* macros refer to an
261 undefined variable _ctmp_ and to <ctype.h> macros like _P, and they
262 refer to system functions like _iswctype that are not in the
263 standard C library. Rather than try to get ancient buggy
264 implementations like this to work, just disable them. */
265 # undef iswalnum
266 # undef iswalpha
267 # undef iswblank
268 # undef iswcntrl
269 # undef iswdigit
270 # undef iswgraph
271 # undef iswlower
272 # undef iswprint
273 # undef iswpunct
274 # undef iswspace
275 # undef iswupper
276 # undef iswxdigit
277 # undef towlower
278 # undef towupper
279
280 /* Linux libc5 has <wctype.h> and the functions but they are broken. */
281 # if @REPLACE_ISWCNTRL@
282 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
283 # define iswalnum rpl_iswalnum
284 # define iswalpha rpl_iswalpha
285 # define iswblank rpl_iswblank
286 # define iswcntrl rpl_iswcntrl
287 # define iswdigit rpl_iswdigit
288 # define iswgraph rpl_iswgraph
289 # define iswlower rpl_iswlower
290 # define iswprint rpl_iswprint
291 # define iswpunct rpl_iswpunct
292 # define iswspace rpl_iswspace
293 # define iswupper rpl_iswupper
294 # define iswxdigit rpl_iswxdigit
295 # endif
296 # endif
297 # if @REPLACE_TOWLOWER@
298 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
299 # define towlower rpl_towlower
300 # define towupper rpl_towupper
301 # endif
302 # endif
303
304 _GL_WCTYPE_INLINE int
305 # if @REPLACE_ISWCNTRL@
306 rpl_iswalnum
307 # else
308 iswalnum
309 # endif
310 (wint_t wc)
311 {
312 return ((wc >= '0' && wc <= '9')
313 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
314 }
315
316 _GL_WCTYPE_INLINE int
317 # if @REPLACE_ISWCNTRL@
318 rpl_iswalpha
319 # else
320 iswalpha
321 # endif
322 (wint_t wc)
323 {
324 return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
325 }
326
327 _GL_WCTYPE_INLINE int
328 # if @REPLACE_ISWCNTRL@
329 rpl_iswblank
330 # else
331 iswblank
332 # endif
333 (wint_t wc)
334 {
335 return wc == ' ' || wc == '\t';
336 }
337
338 _GL_WCTYPE_INLINE int
339 # if @REPLACE_ISWCNTRL@
340 rpl_iswcntrl
341 # else
342 iswcntrl
343 # endif
344 (wint_t wc)
345 {
346 return (wc & ~0x1f) == 0 || wc == 0x7f;
347 }
348
349 _GL_WCTYPE_INLINE int
350 # if @REPLACE_ISWDIGIT@
351 rpl_iswdigit
352 # else
353 iswdigit
354 # endif
355 (wint_t wc)
356 {
357 return wc >= '0' && wc <= '9';
358 }
359
360 _GL_WCTYPE_INLINE int
361 # if @REPLACE_ISWCNTRL@
362 rpl_iswgraph
363 # else
364 iswgraph
365 # endif
366 (wint_t wc)
367 {
368 return wc >= '!' && wc <= '~';
369 }
370
371 _GL_WCTYPE_INLINE int
372 # if @REPLACE_ISWCNTRL@
373 rpl_iswlower
374 # else
375 iswlower
376 # endif
377 (wint_t wc)
378 {
379 return wc >= 'a' && wc <= 'z';
380 }
381
382 _GL_WCTYPE_INLINE int
383 # if @REPLACE_ISWCNTRL@
384 rpl_iswprint
385 # else
386 iswprint
387 # endif
388 (wint_t wc)
389 {
390 return wc >= ' ' && wc <= '~';
391 }
392
393 _GL_WCTYPE_INLINE int
394 # if @REPLACE_ISWCNTRL@
395 rpl_iswpunct
396 # else
397 iswpunct
398 # endif
399 (wint_t wc)
400 {
401 return (wc >= '!' && wc <= '~'
402 && !((wc >= '0' && wc <= '9')
403 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
404 }
405
406 _GL_WCTYPE_INLINE int
407 # if @REPLACE_ISWCNTRL@
408 rpl_iswspace
409 # else
410 iswspace
411 # endif
412 (wint_t wc)
413 {
414 return (wc == ' ' || wc == '\t'
415 || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
416 }
417
418 _GL_WCTYPE_INLINE int
419 # if @REPLACE_ISWCNTRL@
420 rpl_iswupper
421 # else
422 iswupper
423 # endif
424 (wint_t wc)
425 {
426 return wc >= 'A' && wc <= 'Z';
427 }
428
429 _GL_WCTYPE_INLINE int
430 # if @REPLACE_ISWXDIGIT@
431 rpl_iswxdigit
432 # else
433 iswxdigit
434 # endif
435 (wint_t wc)
436 {
437 return ((wc >= '0' && wc <= '9')
438 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
439 }
440
441 _GL_WCTYPE_INLINE wint_t
442 # if @REPLACE_TOWLOWER@
443 rpl_towlower
444 # else
445 towlower
446 # endif
447 (wint_t wc)
448 {
449 return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc);
450 }
451
452 _GL_WCTYPE_INLINE wint_t
453 # if @REPLACE_TOWLOWER@
454 rpl_towupper
455 # else
456 towupper
457 # endif
458 (wint_t wc)
459 {
460 return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
461 }
462
463 # endif
464
465 # else
466 /* Only some of the functions are missing or broken. */
467
468 # if @GNULIB_ISWBLANK@ && (! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@)
469 /* Only the iswblank function is missing. */
470 # if @REPLACE_ISWBLANK@
471 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
472 # define iswblank rpl_iswblank
473 # endif
474 _GL_FUNCDECL_RPL (iswblank, int, (wint_t wc));
475 # else
476 _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
477 # endif
478 # endif
479
480 # if @GNULIB_ISWDIGIT@
481 # if @REPLACE_ISWDIGIT@
482 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
483 # undef iswdigit
484 # define iswdigit rpl_iswdigit
485 # endif
486 _GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc));
487 # endif
488 # endif
489
490 # if @GNULIB_ISWXDIGIT@
491 # if @REPLACE_ISWXDIGIT@
492 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
493 # undef iswxdigit
494 # define iswxdigit rpl_iswxdigit
495 # endif
496 _GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc));
497 # endif
498 # endif
499
500 # endif
501
502 # if defined __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@
503
504 /* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t.
505 The functions towlower and towupper are implemented in the MSVCRT library
506 to take a wchar_t argument and return a wchar_t result. mingw declares
507 these functions to take a wint_t argument and return a wint_t result.
508 This means that:
509 1. When the user passes an argument outside the range 0x0000..0xFFFF, the
510 function will look only at the lower 16 bits. This is allowed according
511 to POSIX.
512 2. The return value is returned in the lower 16 bits of the result register.
513 The upper 16 bits are random: whatever happened to be in that part of the
514 result register. We need to fix this by adding a zero-extend from
515 wchar_t to wint_t after the call. */
516
517 _GL_WCTYPE_INLINE wint_t
518 rpl_towlower (wint_t wc)
519 {
520 return (wint_t) (wchar_t) towlower (wc);
521 }
522 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
523 # define towlower rpl_towlower
524 # endif
525
526 _GL_WCTYPE_INLINE wint_t
527 rpl_towupper (wint_t wc)
528 {
529 return (wint_t) (wchar_t) towupper (wc);
530 }
531 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
532 # define towupper rpl_towupper
533 # endif
534
535 # endif /* __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@ */
536
537 # define GNULIB_defined_wctype_functions 1
538 #endif
539
540 #if @REPLACE_ISWCNTRL@
541 _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc));
542 #else
543 _GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
544 #endif
545 #if @REPLACE_ISWCNTRL@
546 _GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc));
547 #else
548 _GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
549 #endif
550 #if @REPLACE_ISWCNTRL@
551 _GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc));
552 #else
553 _GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc));
554 #endif
555 #if @GNULIB_ISWDIGIT@
556 # if @REPLACE_ISWDIGIT@
557 _GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc));
558 # else
559 _GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc));
560 # endif
561 #endif
562 #if @REPLACE_ISWCNTRL@
563 _GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc));
564 #else
565 _GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc));
566 #endif
567 #if @REPLACE_ISWCNTRL@
568 _GL_CXXALIAS_RPL (iswlower, int, (wint_t wc));
569 #else
570 _GL_CXXALIAS_SYS (iswlower, int, (wint_t wc));
571 #endif
572 #if @REPLACE_ISWCNTRL@
573 _GL_CXXALIAS_RPL (iswprint, int, (wint_t wc));
574 #else
575 _GL_CXXALIAS_SYS (iswprint, int, (wint_t wc));
576 #endif
577 #if @REPLACE_ISWCNTRL@
578 _GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc));
579 #else
580 _GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc));
581 #endif
582 #if @REPLACE_ISWCNTRL@
583 _GL_CXXALIAS_RPL (iswspace, int, (wint_t wc));
584 #else
585 _GL_CXXALIAS_SYS (iswspace, int, (wint_t wc));
586 #endif
587 #if @REPLACE_ISWCNTRL@
588 _GL_CXXALIAS_RPL (iswupper, int, (wint_t wc));
589 #else
590 _GL_CXXALIAS_SYS (iswupper, int, (wint_t wc));
591 #endif
592 #if @GNULIB_ISWXDIGIT@
593 # if @REPLACE_ISWXDIGIT@
594 _GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc));
595 # else
596 _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc));
597 # endif
598 #endif
599 #if __GLIBC__ >= 2
600 _GL_CXXALIASWARN (iswalnum);
601 _GL_CXXALIASWARN (iswalpha);
602 _GL_CXXALIASWARN (iswcntrl);
603 _GL_CXXALIASWARN (iswdigit);
604 _GL_CXXALIASWARN (iswgraph);
605 _GL_CXXALIASWARN (iswlower);
606 _GL_CXXALIASWARN (iswprint);
607 _GL_CXXALIASWARN (iswpunct);
608 _GL_CXXALIASWARN (iswspace);
609 _GL_CXXALIASWARN (iswupper);
610 _GL_CXXALIASWARN (iswxdigit);
611 #endif
612
613 #if @GNULIB_ISWBLANK@
614 # if @REPLACE_ISWCNTRL@ || @REPLACE_ISWBLANK@
615 _GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
616 # else
617 _GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
618 # endif
619 # if __GLIBC__ >= 2
620 _GL_CXXALIASWARN (iswblank);
621 # endif
622 #endif
623
624 #if !@HAVE_WCTYPE_T@
625 # if !GNULIB_defined_wctype_t
626 typedef void * wctype_t;
627 # define GNULIB_defined_wctype_t 1
628 # endif
629 #endif
630
631 /* Get a descriptor for a wide character property. */
632 #if @GNULIB_WCTYPE@
633 # if !@HAVE_WCTYPE_T@
634 _GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name));
635 # endif
636 _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
637 # if __GLIBC__ >= 2
638 _GL_CXXALIASWARN (wctype);
639 # endif
640 #elif defined GNULIB_POSIXCHECK
641 # undef wctype
642 # if HAVE_RAW_DECL_WCTYPE
643 _GL_WARN_ON_USE (wctype, "wctype is unportable - "
644 "use gnulib module wctype for portability");
645 # endif
646 #endif
647
648 /* Test whether a wide character has a given property.
649 The argument WC must be either a wchar_t value or WEOF.
650 The argument DESC must have been returned by the wctype() function. */
651 #if @GNULIB_ISWCTYPE@
652 # if @GNULIBHEADERS_OVERRIDE_WINT_T@
653 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
654 # undef iswctype
655 # define iswctype rpl_iswctype
656 # endif
657 _GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc));
658 _GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc));
659 # else
660 # if !@HAVE_WCTYPE_T@
661 _GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc));
662 # endif
663 _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
664 # endif
665 # if __GLIBC__ >= 2
666 _GL_CXXALIASWARN (iswctype);
667 # endif
668 #elif defined GNULIB_POSIXCHECK
669 # undef iswctype
670 # if HAVE_RAW_DECL_ISWCTYPE
671 _GL_WARN_ON_USE (iswctype, "iswctype is unportable - "
672 "use gnulib module iswctype for portability");
673 # endif
674 #endif
675
676 #if @REPLACE_TOWLOWER@ || defined __MINGW32__
677 _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc));
678 _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
679 #else
680 _GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc));
681 _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc));
682 #endif
683 #if __GLIBC__ >= 2
684 _GL_CXXALIASWARN (towlower);
685 _GL_CXXALIASWARN (towupper);
686 #endif
687
688 #if !@HAVE_WCTRANS_T@
689 # if !GNULIB_defined_wctrans_t
690 typedef void * wctrans_t;
691 # define GNULIB_defined_wctrans_t 1
692 # endif
693 #endif
694
695 /* Get a descriptor for a wide character case conversion. */
696 #if @GNULIB_WCTRANS@
697 # if !@HAVE_WCTRANS_T@
698 _GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name));
699 # endif
700 _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
701 # if __GLIBC__ >= 2
702 _GL_CXXALIASWARN (wctrans);
703 # endif
704 #elif defined GNULIB_POSIXCHECK
705 # undef wctrans
706 # if HAVE_RAW_DECL_WCTRANS
707 _GL_WARN_ON_USE (wctrans, "wctrans is unportable - "
708 "use gnulib module wctrans for portability");
709 # endif
710 #endif
711
712 /* Perform a given case conversion on a wide character.
713 The argument WC must be either a wchar_t value or WEOF.
714 The argument DESC must have been returned by the wctrans() function. */
715 #if @GNULIB_TOWCTRANS@
716 # if !@HAVE_WCTRANS_T@
717 _GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
718 # endif
719 _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
720 # if __GLIBC__ >= 2
721 _GL_CXXALIASWARN (towctrans);
722 # endif
723 #elif defined GNULIB_POSIXCHECK
724 # undef towctrans
725 # if HAVE_RAW_DECL_TOWCTRANS
726 _GL_WARN_ON_USE (towctrans, "towctrans is unportable - "
727 "use gnulib module towctrans for portability");
728 # endif
729 #endif
730
731 _GL_INLINE_HEADER_END
732
733 #endif /* _@GUARD_PREFIX@_WCTYPE_H */
734 #endif /* _@GUARD_PREFIX@_WCTYPE_H */
735 #endif