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