151ddd709SJohn Marino /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
251ddd709SJohn Marino /* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
351ddd709SJohn Marino 
4*4ce1b016SDaniel Fojt    Copyright (C) 2006-2020 Free Software Foundation, Inc.
551ddd709SJohn Marino 
651ddd709SJohn Marino    This program is free software; you can redistribute it and/or modify
751ddd709SJohn Marino    it under the terms of the GNU General Public License as published by
851ddd709SJohn Marino    the Free Software Foundation; either version 3, or (at your option)
951ddd709SJohn Marino    any later version.
1051ddd709SJohn Marino 
1151ddd709SJohn Marino    This program is distributed in the hope that it will be useful,
1251ddd709SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
1351ddd709SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1451ddd709SJohn Marino    GNU General Public License for more details.
1551ddd709SJohn Marino 
1651ddd709SJohn Marino    You should have received a copy of the GNU General Public License
17*4ce1b016SDaniel Fojt    along with this program; if not, see <https://www.gnu.org/licenses/>.  */
1851ddd709SJohn Marino 
1951ddd709SJohn Marino /* Written by Bruno Haible and Paul Eggert.  */
2051ddd709SJohn Marino 
2151ddd709SJohn Marino /*
2251ddd709SJohn Marino  * ISO C 99 <wctype.h> for platforms that lack it.
23*4ce1b016SDaniel Fojt  * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html>
2451ddd709SJohn Marino  *
2551ddd709SJohn Marino  * iswctype, towctrans, towlower, towupper, wctrans, wctype,
2651ddd709SJohn Marino  * wctrans_t, and wctype_t are not yet implemented.
2751ddd709SJohn Marino  */
2851ddd709SJohn Marino 
2951ddd709SJohn Marino #if __GNUC__ >= 3
3051ddd709SJohn Marino #pragma GCC system_header
3151ddd709SJohn Marino #endif
3251ddd709SJohn Marino 
3351ddd709SJohn Marino 
34*4ce1b016SDaniel Fojt #if (defined __MINGW32__ && defined __CTYPE_H_SOURCED__)
35*4ce1b016SDaniel Fojt 
36*4ce1b016SDaniel Fojt /* Special invocation convention:
37*4ce1b016SDaniel Fojt    - With MinGW 3.22, when <ctype.h> includes <wctype.h>, only some part of
38*4ce1b016SDaniel Fojt      <wctype.h> is being processed, which doesn't include the idempotency
39*4ce1b016SDaniel Fojt      guard.   */
40*4ce1b016SDaniel Fojt 
41*4ce1b016SDaniel Fojt #include_next <wctype.h>
42*4ce1b016SDaniel Fojt 
43*4ce1b016SDaniel Fojt #else
44*4ce1b016SDaniel Fojt /* Normal invocation convention.  */
45*4ce1b016SDaniel Fojt 
46*4ce1b016SDaniel Fojt #ifndef _GL_WCTYPE_H
47*4ce1b016SDaniel Fojt 
4851ddd709SJohn Marino #if 1
4951ddd709SJohn Marino /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
5051ddd709SJohn Marino    Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
5151ddd709SJohn Marino    <wchar.h>.
5251ddd709SJohn Marino    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
5351ddd709SJohn Marino    included before <wchar.h>.  */
5451ddd709SJohn Marino # include <stddef.h>
5551ddd709SJohn Marino # include <stdio.h>
5651ddd709SJohn Marino # include <time.h>
5751ddd709SJohn Marino # include <wchar.h>
5851ddd709SJohn Marino #endif
5951ddd709SJohn Marino 
60*4ce1b016SDaniel Fojt /* Native Windows (mingw, MSVC) have declarations of towupper, towlower, and
61*4ce1b016SDaniel Fojt    isw* functions in <ctype.h>, <wchar.h> as well as in <wctype.h>.  Include
62*4ce1b016SDaniel Fojt    <ctype.h>, <wchar.h> in advance to avoid rpl_ prefix being added to the
63*4ce1b016SDaniel Fojt    declarations.  */
64*4ce1b016SDaniel Fojt #if defined _WIN32 && ! defined __CYGWIN__
6551ddd709SJohn Marino # include <ctype.h>
66*4ce1b016SDaniel Fojt # include <wchar.h>
6751ddd709SJohn Marino #endif
6851ddd709SJohn Marino 
6951ddd709SJohn Marino /* Include the original <wctype.h> if it exists.
7051ddd709SJohn Marino    BeOS 5 has the functions but no <wctype.h>.  */
7151ddd709SJohn Marino /* The include_next requires a split double-inclusion guard.  */
7251ddd709SJohn Marino #if 1
7351ddd709SJohn Marino # include_next <wctype.h>
7451ddd709SJohn Marino #endif
7551ddd709SJohn Marino 
7651ddd709SJohn Marino #ifndef _GL_WCTYPE_H
7751ddd709SJohn Marino #define _GL_WCTYPE_H
7851ddd709SJohn Marino 
7951ddd709SJohn Marino #ifndef _GL_INLINE_HEADER_BEGIN
8051ddd709SJohn Marino  #error "Please include config.h first."
8151ddd709SJohn Marino #endif
8251ddd709SJohn Marino _GL_INLINE_HEADER_BEGIN
8351ddd709SJohn Marino #ifndef _GL_WCTYPE_INLINE
8451ddd709SJohn Marino # define _GL_WCTYPE_INLINE _GL_INLINE
8551ddd709SJohn Marino #endif
8651ddd709SJohn Marino 
8751ddd709SJohn Marino /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
88*4ce1b016SDaniel Fojt /* C++ compatible function declaration macros.
89*4ce1b016SDaniel Fojt    Copyright (C) 2010-2020 Free Software Foundation, Inc.
90*4ce1b016SDaniel Fojt 
91*4ce1b016SDaniel Fojt    This program is free software: you can redistribute it and/or modify it
92*4ce1b016SDaniel Fojt    under the terms of the GNU General Public License as published
93*4ce1b016SDaniel Fojt    by the Free Software Foundation; either version 3 of the License, or
94*4ce1b016SDaniel Fojt    (at your option) any later version.
95*4ce1b016SDaniel Fojt 
96*4ce1b016SDaniel Fojt    This program is distributed in the hope that it will be useful,
97*4ce1b016SDaniel Fojt    but WITHOUT ANY WARRANTY; without even the implied warranty of
98*4ce1b016SDaniel Fojt    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
99*4ce1b016SDaniel Fojt    General Public License for more details.
100*4ce1b016SDaniel Fojt 
101*4ce1b016SDaniel Fojt    You should have received a copy of the GNU General Public License
102*4ce1b016SDaniel Fojt    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
103*4ce1b016SDaniel Fojt 
10451ddd709SJohn Marino #ifndef _GL_CXXDEFS_H
10551ddd709SJohn Marino #define _GL_CXXDEFS_H
10651ddd709SJohn Marino 
107*4ce1b016SDaniel Fojt /* Begin/end the GNULIB_NAMESPACE namespace.  */
108*4ce1b016SDaniel Fojt #if defined __cplusplus && defined GNULIB_NAMESPACE
109*4ce1b016SDaniel Fojt # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
110*4ce1b016SDaniel Fojt # define _GL_END_NAMESPACE }
111*4ce1b016SDaniel Fojt #else
112*4ce1b016SDaniel Fojt # define _GL_BEGIN_NAMESPACE
113*4ce1b016SDaniel Fojt # define _GL_END_NAMESPACE
114*4ce1b016SDaniel Fojt #endif
115*4ce1b016SDaniel Fojt 
11651ddd709SJohn Marino /* The three most frequent use cases of these macros are:
11751ddd709SJohn Marino 
11851ddd709SJohn Marino    * For providing a substitute for a function that is missing on some
11951ddd709SJohn Marino      platforms, but is declared and works fine on the platforms on which
12051ddd709SJohn Marino      it exists:
12151ddd709SJohn Marino 
12251ddd709SJohn Marino        #if @GNULIB_FOO@
12351ddd709SJohn Marino        # if !@HAVE_FOO@
12451ddd709SJohn Marino        _GL_FUNCDECL_SYS (foo, ...);
12551ddd709SJohn Marino        # endif
12651ddd709SJohn Marino        _GL_CXXALIAS_SYS (foo, ...);
12751ddd709SJohn Marino        _GL_CXXALIASWARN (foo);
12851ddd709SJohn Marino        #elif defined GNULIB_POSIXCHECK
12951ddd709SJohn Marino        ...
13051ddd709SJohn Marino        #endif
13151ddd709SJohn Marino 
13251ddd709SJohn Marino    * For providing a replacement for a function that exists on all platforms,
13351ddd709SJohn Marino      but is broken/insufficient and needs to be replaced on some platforms:
13451ddd709SJohn Marino 
13551ddd709SJohn Marino        #if @GNULIB_FOO@
13651ddd709SJohn Marino        # if @REPLACE_FOO@
13751ddd709SJohn Marino        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
13851ddd709SJohn Marino        #   undef foo
13951ddd709SJohn Marino        #   define foo rpl_foo
14051ddd709SJohn Marino        #  endif
14151ddd709SJohn Marino        _GL_FUNCDECL_RPL (foo, ...);
14251ddd709SJohn Marino        _GL_CXXALIAS_RPL (foo, ...);
14351ddd709SJohn Marino        # else
14451ddd709SJohn Marino        _GL_CXXALIAS_SYS (foo, ...);
14551ddd709SJohn Marino        # endif
14651ddd709SJohn Marino        _GL_CXXALIASWARN (foo);
14751ddd709SJohn Marino        #elif defined GNULIB_POSIXCHECK
14851ddd709SJohn Marino        ...
14951ddd709SJohn Marino        #endif
15051ddd709SJohn Marino 
15151ddd709SJohn Marino    * For providing a replacement for a function that exists on some platforms
15251ddd709SJohn Marino      but is broken/insufficient and needs to be replaced on some of them and
15351ddd709SJohn Marino      is additionally either missing or undeclared on some other platforms:
15451ddd709SJohn Marino 
15551ddd709SJohn Marino        #if @GNULIB_FOO@
15651ddd709SJohn Marino        # if @REPLACE_FOO@
15751ddd709SJohn Marino        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
15851ddd709SJohn Marino        #   undef foo
15951ddd709SJohn Marino        #   define foo rpl_foo
16051ddd709SJohn Marino        #  endif
16151ddd709SJohn Marino        _GL_FUNCDECL_RPL (foo, ...);
16251ddd709SJohn Marino        _GL_CXXALIAS_RPL (foo, ...);
16351ddd709SJohn Marino        # else
16451ddd709SJohn Marino        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
16551ddd709SJohn Marino        _GL_FUNCDECL_SYS (foo, ...);
16651ddd709SJohn Marino        #  endif
16751ddd709SJohn Marino        _GL_CXXALIAS_SYS (foo, ...);
16851ddd709SJohn Marino        # endif
16951ddd709SJohn Marino        _GL_CXXALIASWARN (foo);
17051ddd709SJohn Marino        #elif defined GNULIB_POSIXCHECK
17151ddd709SJohn Marino        ...
17251ddd709SJohn Marino        #endif
17351ddd709SJohn Marino */
17451ddd709SJohn Marino 
17551ddd709SJohn Marino /* _GL_EXTERN_C declaration;
17651ddd709SJohn Marino    performs the declaration with C linkage.  */
17751ddd709SJohn Marino #if defined __cplusplus
17851ddd709SJohn Marino # define _GL_EXTERN_C extern "C"
17951ddd709SJohn Marino #else
18051ddd709SJohn Marino # define _GL_EXTERN_C extern
18151ddd709SJohn Marino #endif
18251ddd709SJohn Marino 
18351ddd709SJohn Marino /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
18451ddd709SJohn Marino    declares a replacement function, named rpl_func, with the given prototype,
18551ddd709SJohn Marino    consisting of return type, parameters, and attributes.
18651ddd709SJohn Marino    Example:
18751ddd709SJohn Marino      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
18851ddd709SJohn Marino                                   _GL_ARG_NONNULL ((1)));
18951ddd709SJohn Marino  */
19051ddd709SJohn Marino #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
19151ddd709SJohn Marino   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
19251ddd709SJohn Marino #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
19351ddd709SJohn Marino   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
19451ddd709SJohn Marino 
19551ddd709SJohn Marino /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
19651ddd709SJohn Marino    declares the system function, named func, with the given prototype,
19751ddd709SJohn Marino    consisting of return type, parameters, and attributes.
19851ddd709SJohn Marino    Example:
19951ddd709SJohn Marino      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
20051ddd709SJohn Marino                                   _GL_ARG_NONNULL ((1)));
20151ddd709SJohn Marino  */
20251ddd709SJohn Marino #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
20351ddd709SJohn Marino   _GL_EXTERN_C rettype func parameters_and_attributes
20451ddd709SJohn Marino 
20551ddd709SJohn Marino /* _GL_CXXALIAS_RPL (func, rettype, parameters);
20651ddd709SJohn Marino    declares a C++ alias called GNULIB_NAMESPACE::func
20751ddd709SJohn Marino    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
20851ddd709SJohn Marino    Example:
20951ddd709SJohn Marino      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
210*4ce1b016SDaniel Fojt 
211*4ce1b016SDaniel Fojt    Wrapping rpl_func in an object with an inline conversion operator
212*4ce1b016SDaniel Fojt    avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
213*4ce1b016SDaniel Fojt    actually used in the program.  */
21451ddd709SJohn Marino #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
21551ddd709SJohn Marino   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
21651ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
21751ddd709SJohn Marino # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
21851ddd709SJohn Marino     namespace GNULIB_NAMESPACE                                \
21951ddd709SJohn Marino     {                                                         \
220*4ce1b016SDaniel Fojt       static const struct _gl_ ## func ## _wrapper            \
221*4ce1b016SDaniel Fojt       {                                                       \
222*4ce1b016SDaniel Fojt         typedef rettype (*type) parameters;                   \
223*4ce1b016SDaniel Fojt                                                               \
224*4ce1b016SDaniel Fojt         inline operator type () const                         \
225*4ce1b016SDaniel Fojt         {                                                     \
226*4ce1b016SDaniel Fojt           return ::rpl_func;                                  \
227*4ce1b016SDaniel Fojt         }                                                     \
228*4ce1b016SDaniel Fojt       } func = {};                                            \
22951ddd709SJohn Marino     }                                                         \
23051ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
23151ddd709SJohn Marino #else
23251ddd709SJohn Marino # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
23351ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
23451ddd709SJohn Marino #endif
23551ddd709SJohn Marino 
23651ddd709SJohn Marino /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
23751ddd709SJohn Marino    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
23851ddd709SJohn Marino    except that the C function rpl_func may have a slightly different
23951ddd709SJohn Marino    declaration.  A cast is used to silence the "invalid conversion" error
24051ddd709SJohn Marino    that would otherwise occur.  */
24151ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
24251ddd709SJohn Marino # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
24351ddd709SJohn Marino     namespace GNULIB_NAMESPACE                                     \
24451ddd709SJohn Marino     {                                                              \
245*4ce1b016SDaniel Fojt       static const struct _gl_ ## func ## _wrapper                 \
246*4ce1b016SDaniel Fojt       {                                                            \
247*4ce1b016SDaniel Fojt         typedef rettype (*type) parameters;                        \
248*4ce1b016SDaniel Fojt                                                                    \
249*4ce1b016SDaniel Fojt         inline operator type () const                              \
250*4ce1b016SDaniel Fojt         {                                                          \
251*4ce1b016SDaniel Fojt           return reinterpret_cast<type>(::rpl_func);               \
252*4ce1b016SDaniel Fojt         }                                                          \
253*4ce1b016SDaniel Fojt       } func = {};                                                 \
25451ddd709SJohn Marino     }                                                              \
25551ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
25651ddd709SJohn Marino #else
25751ddd709SJohn Marino # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
25851ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
25951ddd709SJohn Marino #endif
26051ddd709SJohn Marino 
26151ddd709SJohn Marino /* _GL_CXXALIAS_SYS (func, rettype, parameters);
26251ddd709SJohn Marino    declares a C++ alias called GNULIB_NAMESPACE::func
26351ddd709SJohn Marino    that redirects to the system provided function func, if GNULIB_NAMESPACE
26451ddd709SJohn Marino    is defined.
26551ddd709SJohn Marino    Example:
26651ddd709SJohn Marino      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
267*4ce1b016SDaniel Fojt 
268*4ce1b016SDaniel Fojt    Wrapping func in an object with an inline conversion operator
269*4ce1b016SDaniel Fojt    avoids a reference to func unless GNULIB_NAMESPACE::func is
270*4ce1b016SDaniel Fojt    actually used in the program.  */
27151ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
27251ddd709SJohn Marino # define _GL_CXXALIAS_SYS(func,rettype,parameters)            \
27351ddd709SJohn Marino     namespace GNULIB_NAMESPACE                                \
27451ddd709SJohn Marino     {                                                         \
275*4ce1b016SDaniel Fojt       static const struct _gl_ ## func ## _wrapper            \
276*4ce1b016SDaniel Fojt       {                                                       \
277*4ce1b016SDaniel Fojt         typedef rettype (*type) parameters;                   \
278*4ce1b016SDaniel Fojt                                                               \
279*4ce1b016SDaniel Fojt         inline operator type () const                         \
280*4ce1b016SDaniel Fojt         {                                                     \
281*4ce1b016SDaniel Fojt           return ::func;                                      \
282*4ce1b016SDaniel Fojt         }                                                     \
283*4ce1b016SDaniel Fojt       } func = {};                                            \
28451ddd709SJohn Marino     }                                                         \
28551ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
28651ddd709SJohn Marino #else
28751ddd709SJohn Marino # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
28851ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
28951ddd709SJohn Marino #endif
29051ddd709SJohn Marino 
29151ddd709SJohn Marino /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
29251ddd709SJohn Marino    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
29351ddd709SJohn Marino    except that the C function func may have a slightly different declaration.
29451ddd709SJohn Marino    A cast is used to silence the "invalid conversion" error that would
29551ddd709SJohn Marino    otherwise occur.  */
29651ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
29751ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
29851ddd709SJohn Marino     namespace GNULIB_NAMESPACE                          \
29951ddd709SJohn Marino     {                                                   \
300*4ce1b016SDaniel Fojt       static const struct _gl_ ## func ## _wrapper      \
301*4ce1b016SDaniel Fojt       {                                                 \
302*4ce1b016SDaniel Fojt         typedef rettype (*type) parameters;             \
303*4ce1b016SDaniel Fojt                                                         \
304*4ce1b016SDaniel Fojt         inline operator type () const                   \
305*4ce1b016SDaniel Fojt         {                                               \
306*4ce1b016SDaniel Fojt           return reinterpret_cast<type>(::func);        \
307*4ce1b016SDaniel Fojt         }                                               \
308*4ce1b016SDaniel Fojt       } func = {};                                      \
30951ddd709SJohn Marino     }                                                   \
31051ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
31151ddd709SJohn Marino #else
31251ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
31351ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
31451ddd709SJohn Marino #endif
31551ddd709SJohn Marino 
31651ddd709SJohn Marino /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
31751ddd709SJohn Marino    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
31851ddd709SJohn Marino    except that the C function is picked among a set of overloaded functions,
31951ddd709SJohn Marino    namely the one with rettype2 and parameters2.  Two consecutive casts
32051ddd709SJohn Marino    are used to silence the "cannot find a match" and "invalid conversion"
32151ddd709SJohn Marino    errors that would otherwise occur.  */
32251ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
32351ddd709SJohn Marino   /* The outer cast must be a reinterpret_cast.
32451ddd709SJohn Marino      The inner cast: When the function is defined as a set of overloaded
32551ddd709SJohn Marino      functions, it works as a static_cast<>, choosing the designated variant.
32651ddd709SJohn Marino      When the function is defined as a single variant, it works as a
32751ddd709SJohn Marino      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
32851ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
32951ddd709SJohn Marino     namespace GNULIB_NAMESPACE                                                \
33051ddd709SJohn Marino     {                                                                         \
331*4ce1b016SDaniel Fojt       static const struct _gl_ ## func ## _wrapper                            \
332*4ce1b016SDaniel Fojt       {                                                                       \
333*4ce1b016SDaniel Fojt         typedef rettype (*type) parameters;                                   \
334*4ce1b016SDaniel Fojt                                                                               \
335*4ce1b016SDaniel Fojt         inline operator type () const                                         \
336*4ce1b016SDaniel Fojt         {                                                                     \
337*4ce1b016SDaniel Fojt           return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
338*4ce1b016SDaniel Fojt         }                                                                     \
339*4ce1b016SDaniel Fojt       } func = {};                                                            \
34051ddd709SJohn Marino     }                                                                         \
34151ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
34251ddd709SJohn Marino #else
34351ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
34451ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
34551ddd709SJohn Marino #endif
34651ddd709SJohn Marino 
34751ddd709SJohn Marino /* _GL_CXXALIASWARN (func);
34851ddd709SJohn Marino    causes a warning to be emitted when ::func is used but not when
34951ddd709SJohn Marino    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
35051ddd709SJohn Marino    variants.  */
35151ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
35251ddd709SJohn Marino # define _GL_CXXALIASWARN(func) \
35351ddd709SJohn Marino    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
35451ddd709SJohn Marino # define _GL_CXXALIASWARN_1(func,namespace) \
35551ddd709SJohn Marino    _GL_CXXALIASWARN_2 (func, namespace)
356*4ce1b016SDaniel Fojt /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
35751ddd709SJohn Marino    we enable the warning only when not optimizing.  */
35851ddd709SJohn Marino # if !__OPTIMIZE__
35951ddd709SJohn Marino #  define _GL_CXXALIASWARN_2(func,namespace) \
36051ddd709SJohn Marino     _GL_WARN_ON_USE (func, \
36151ddd709SJohn Marino                      "The symbol ::" #func " refers to the system function. " \
36251ddd709SJohn Marino                      "Use " #namespace "::" #func " instead.")
36351ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
36451ddd709SJohn Marino #  define _GL_CXXALIASWARN_2(func,namespace) \
36551ddd709SJohn Marino      extern __typeof__ (func) func
36651ddd709SJohn Marino # else
36751ddd709SJohn Marino #  define _GL_CXXALIASWARN_2(func,namespace) \
36851ddd709SJohn Marino      _GL_EXTERN_C int _gl_cxxalias_dummy
36951ddd709SJohn Marino # endif
37051ddd709SJohn Marino #else
37151ddd709SJohn Marino # define _GL_CXXALIASWARN(func) \
37251ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
37351ddd709SJohn Marino #endif
37451ddd709SJohn Marino 
37551ddd709SJohn Marino /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
37651ddd709SJohn Marino    causes a warning to be emitted when the given overloaded variant of ::func
37751ddd709SJohn Marino    is used but not when GNULIB_NAMESPACE::func is used.  */
37851ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
37951ddd709SJohn Marino # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
38051ddd709SJohn Marino    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
38151ddd709SJohn Marino                         GNULIB_NAMESPACE)
38251ddd709SJohn Marino # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
38351ddd709SJohn Marino    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
384*4ce1b016SDaniel Fojt /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
38551ddd709SJohn Marino    we enable the warning only when not optimizing.  */
38651ddd709SJohn Marino # if !__OPTIMIZE__
38751ddd709SJohn Marino #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
38851ddd709SJohn Marino     _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
38951ddd709SJohn Marino                          "The symbol ::" #func " refers to the system function. " \
39051ddd709SJohn Marino                          "Use " #namespace "::" #func " instead.")
39151ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
39251ddd709SJohn Marino #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
39351ddd709SJohn Marino      extern __typeof__ (func) func
39451ddd709SJohn Marino # else
39551ddd709SJohn Marino #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
39651ddd709SJohn Marino      _GL_EXTERN_C int _gl_cxxalias_dummy
39751ddd709SJohn Marino # endif
39851ddd709SJohn Marino #else
39951ddd709SJohn Marino # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
40051ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
40151ddd709SJohn Marino #endif
40251ddd709SJohn Marino 
40351ddd709SJohn Marino #endif /* _GL_CXXDEFS_H */
40451ddd709SJohn Marino 
40551ddd709SJohn Marino /* The definition of _GL_WARN_ON_USE is copied here.  */
406*4ce1b016SDaniel Fojt /* A C macro for emitting warnings if a function is used.
407*4ce1b016SDaniel Fojt    Copyright (C) 2010-2020 Free Software Foundation, Inc.
408*4ce1b016SDaniel Fojt 
409*4ce1b016SDaniel Fojt    This program is free software: you can redistribute it and/or modify it
410*4ce1b016SDaniel Fojt    under the terms of the GNU General Public License as published
411*4ce1b016SDaniel Fojt    by the Free Software Foundation; either version 3 of the License, or
412*4ce1b016SDaniel Fojt    (at your option) any later version.
413*4ce1b016SDaniel Fojt 
414*4ce1b016SDaniel Fojt    This program is distributed in the hope that it will be useful,
415*4ce1b016SDaniel Fojt    but WITHOUT ANY WARRANTY; without even the implied warranty of
416*4ce1b016SDaniel Fojt    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
417*4ce1b016SDaniel Fojt    General Public License for more details.
418*4ce1b016SDaniel Fojt 
419*4ce1b016SDaniel Fojt    You should have received a copy of the GNU General Public License
420*4ce1b016SDaniel Fojt    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
421*4ce1b016SDaniel Fojt 
422*4ce1b016SDaniel Fojt /* _GL_WARN_ON_USE (function, "literal string") issues a declaration
423*4ce1b016SDaniel Fojt    for FUNCTION which will then trigger a compiler warning containing
424*4ce1b016SDaniel Fojt    the text of "literal string" anywhere that function is called, if
425*4ce1b016SDaniel Fojt    supported by the compiler.  If the compiler does not support this
426*4ce1b016SDaniel Fojt    feature, the macro expands to an unused extern declaration.
427*4ce1b016SDaniel Fojt 
428*4ce1b016SDaniel Fojt    _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
429*4ce1b016SDaniel Fojt    attribute used in _GL_WARN_ON_USE.  If the compiler does not support
430*4ce1b016SDaniel Fojt    this feature, it expands to empty.
431*4ce1b016SDaniel Fojt 
432*4ce1b016SDaniel Fojt    These macros are useful for marking a function as a potential
433*4ce1b016SDaniel Fojt    portability trap, with the intent that "literal string" include
434*4ce1b016SDaniel Fojt    instructions on the replacement function that should be used
435*4ce1b016SDaniel Fojt    instead.
436*4ce1b016SDaniel Fojt    _GL_WARN_ON_USE is for functions with 'extern' linkage.
437*4ce1b016SDaniel Fojt    _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
438*4ce1b016SDaniel Fojt    linkage.
439*4ce1b016SDaniel Fojt 
440*4ce1b016SDaniel Fojt    However, one of the reasons that a function is a portability trap is
441*4ce1b016SDaniel Fojt    if it has the wrong signature.  Declaring FUNCTION with a different
442*4ce1b016SDaniel Fojt    signature in C is a compilation error, so this macro must use the
443*4ce1b016SDaniel Fojt    same type as any existing declaration so that programs that avoid
444*4ce1b016SDaniel Fojt    the problematic FUNCTION do not fail to compile merely because they
445*4ce1b016SDaniel Fojt    included a header that poisoned the function.  But this implies that
446*4ce1b016SDaniel Fojt    _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
447*4ce1b016SDaniel Fojt    have a declaration.  Use of this macro implies that there must not
448*4ce1b016SDaniel Fojt    be any other macro hiding the declaration of FUNCTION; but
449*4ce1b016SDaniel Fojt    undefining FUNCTION first is part of the poisoning process anyway
450*4ce1b016SDaniel Fojt    (although for symbols that are provided only via a macro, the result
451*4ce1b016SDaniel Fojt    is a compilation error rather than a warning containing
452*4ce1b016SDaniel Fojt    "literal string").  Also note that in C++, it is only safe to use if
453*4ce1b016SDaniel Fojt    FUNCTION has no overloads.
454*4ce1b016SDaniel Fojt 
455*4ce1b016SDaniel Fojt    For an example, it is possible to poison 'getline' by:
456*4ce1b016SDaniel Fojt    - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
457*4ce1b016SDaniel Fojt      [getline]) in configure.ac, which potentially defines
458*4ce1b016SDaniel Fojt      HAVE_RAW_DECL_GETLINE
459*4ce1b016SDaniel Fojt    - adding this code to a header that wraps the system <stdio.h>:
460*4ce1b016SDaniel Fojt      #undef getline
461*4ce1b016SDaniel Fojt      #if HAVE_RAW_DECL_GETLINE
462*4ce1b016SDaniel Fojt      _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
463*4ce1b016SDaniel Fojt        "not universally present; use the gnulib module getline");
464*4ce1b016SDaniel Fojt      #endif
465*4ce1b016SDaniel Fojt 
466*4ce1b016SDaniel Fojt    It is not possible to directly poison global variables.  But it is
467*4ce1b016SDaniel Fojt    possible to write a wrapper accessor function, and poison that
468*4ce1b016SDaniel Fojt    (less common usage, like &environ, will cause a compilation error
469*4ce1b016SDaniel Fojt    rather than issue the nice warning, but the end result of informing
470*4ce1b016SDaniel Fojt    the developer about their portability problem is still achieved):
471*4ce1b016SDaniel Fojt      #if HAVE_RAW_DECL_ENVIRON
472*4ce1b016SDaniel Fojt      static char ***
473*4ce1b016SDaniel Fojt      rpl_environ (void) { return &environ; }
474*4ce1b016SDaniel Fojt      _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
475*4ce1b016SDaniel Fojt      # undef environ
476*4ce1b016SDaniel Fojt      # define environ (*rpl_environ ())
477*4ce1b016SDaniel Fojt      #endif
478*4ce1b016SDaniel Fojt    or better (avoiding contradictory use of 'static' and 'extern'):
479*4ce1b016SDaniel Fojt      #if HAVE_RAW_DECL_ENVIRON
480*4ce1b016SDaniel Fojt      static char ***
481*4ce1b016SDaniel Fojt      _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
482*4ce1b016SDaniel Fojt      rpl_environ (void) { return &environ; }
483*4ce1b016SDaniel Fojt      # undef environ
484*4ce1b016SDaniel Fojt      # define environ (*rpl_environ ())
485*4ce1b016SDaniel Fojt      #endif
486*4ce1b016SDaniel Fojt    */
48751ddd709SJohn Marino #ifndef _GL_WARN_ON_USE
48851ddd709SJohn Marino 
48951ddd709SJohn Marino # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
49051ddd709SJohn Marino /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
49151ddd709SJohn Marino #  define _GL_WARN_ON_USE(function, message) \
49251ddd709SJohn Marino extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
493*4ce1b016SDaniel Fojt #  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
494*4ce1b016SDaniel Fojt   __attribute__ ((__warning__ (message)))
49551ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
49651ddd709SJohn Marino /* Verify the existence of the function.  */
49751ddd709SJohn Marino #  define _GL_WARN_ON_USE(function, message) \
49851ddd709SJohn Marino extern __typeof__ (function) function
499*4ce1b016SDaniel Fojt #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
50051ddd709SJohn Marino # else /* Unsupported.  */
50151ddd709SJohn Marino #  define _GL_WARN_ON_USE(function, message) \
50251ddd709SJohn Marino _GL_WARN_EXTERN_C int _gl_warn_on_use
503*4ce1b016SDaniel Fojt #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
50451ddd709SJohn Marino # endif
50551ddd709SJohn Marino #endif
50651ddd709SJohn Marino 
50751ddd709SJohn Marino /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
50851ddd709SJohn Marino    is like _GL_WARN_ON_USE (function, "string"), except that the function is
50951ddd709SJohn Marino    declared with the given prototype, consisting of return type, parameters,
51051ddd709SJohn Marino    and attributes.
51151ddd709SJohn Marino    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
51251ddd709SJohn Marino    not work in this case.  */
51351ddd709SJohn Marino #ifndef _GL_WARN_ON_USE_CXX
51451ddd709SJohn Marino # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
51551ddd709SJohn Marino #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
51651ddd709SJohn Marino extern rettype function parameters_and_attributes \
51751ddd709SJohn Marino      __attribute__ ((__warning__ (msg)))
51851ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
51951ddd709SJohn Marino /* Verify the existence of the function.  */
52051ddd709SJohn Marino #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
52151ddd709SJohn Marino extern rettype function parameters_and_attributes
52251ddd709SJohn Marino # else /* Unsupported.  */
52351ddd709SJohn Marino #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
52451ddd709SJohn Marino _GL_WARN_EXTERN_C int _gl_warn_on_use
52551ddd709SJohn Marino # endif
52651ddd709SJohn Marino #endif
52751ddd709SJohn Marino 
52851ddd709SJohn Marino /* _GL_WARN_EXTERN_C declaration;
52951ddd709SJohn Marino    performs the declaration with C linkage.  */
53051ddd709SJohn Marino #ifndef _GL_WARN_EXTERN_C
53151ddd709SJohn Marino # if defined __cplusplus
53251ddd709SJohn Marino #  define _GL_WARN_EXTERN_C extern "C"
53351ddd709SJohn Marino # else
53451ddd709SJohn Marino #  define _GL_WARN_EXTERN_C extern
53551ddd709SJohn Marino # endif
53651ddd709SJohn Marino #endif
53751ddd709SJohn Marino 
53851ddd709SJohn Marino /* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which
53951ddd709SJohn Marino    #defines a number of identifiers in the application namespace.  Revert
54051ddd709SJohn Marino    these #defines.  */
54151ddd709SJohn Marino #ifdef __sun
54251ddd709SJohn Marino # undef multibyte
54351ddd709SJohn Marino # undef eucw1
54451ddd709SJohn Marino # undef eucw2
54551ddd709SJohn Marino # undef eucw3
54651ddd709SJohn Marino # undef scrw1
54751ddd709SJohn Marino # undef scrw2
54851ddd709SJohn Marino # undef scrw3
54951ddd709SJohn Marino #endif
55051ddd709SJohn Marino 
55151ddd709SJohn Marino /* Define wint_t and WEOF.  (Also done in wchar.in.h.)  */
55251ddd709SJohn Marino #if !1 && !defined wint_t
55351ddd709SJohn Marino # define wint_t int
55451ddd709SJohn Marino # ifndef WEOF
55551ddd709SJohn Marino #  define WEOF -1
55651ddd709SJohn Marino # endif
55751ddd709SJohn Marino #else
558*4ce1b016SDaniel Fojt /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
559*4ce1b016SDaniel Fojt    <stddef.h>.  This is too small: ISO C 99 section 7.24.1.(2) says that
560*4ce1b016SDaniel Fojt    wint_t must be "unchanged by default argument promotions".  Override it.  */
561*4ce1b016SDaniel Fojt # if 0
56251ddd709SJohn Marino #  if !GNULIB_defined_wint_t
563*4ce1b016SDaniel Fojt #   if 0
56451ddd709SJohn Marino #    include <crtdefs.h>
565*4ce1b016SDaniel Fojt #   else
566*4ce1b016SDaniel Fojt #    include <stddef.h>
567*4ce1b016SDaniel Fojt #   endif
56851ddd709SJohn Marino typedef unsigned int rpl_wint_t;
56951ddd709SJohn Marino #   undef wint_t
57051ddd709SJohn Marino #   define wint_t rpl_wint_t
57151ddd709SJohn Marino #   define GNULIB_defined_wint_t 1
57251ddd709SJohn Marino #  endif
57351ddd709SJohn Marino # endif
57451ddd709SJohn Marino # ifndef WEOF
57551ddd709SJohn Marino #  define WEOF ((wint_t) -1)
57651ddd709SJohn Marino # endif
57751ddd709SJohn Marino #endif
57851ddd709SJohn Marino 
57951ddd709SJohn Marino 
58051ddd709SJohn Marino #if !GNULIB_defined_wctype_functions
58151ddd709SJohn Marino 
58251ddd709SJohn Marino /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
58351ddd709SJohn Marino    Linux libc5 has <wctype.h> and the functions but they are broken.
584*4ce1b016SDaniel Fojt    mingw and MSVC have <wctype.h> and the functions but they take a wchar_t
585*4ce1b016SDaniel Fojt    as argument, not an rpl_wint_t.
58651ddd709SJohn Marino    Assume all 11 functions (all isw* except iswblank) are implemented the
58751ddd709SJohn Marino    same way, or not at all.  */
58851ddd709SJohn Marino # if ! 1 || 0
58951ddd709SJohn Marino 
590*4ce1b016SDaniel Fojt #  if 0 /* implies 0 */
591*4ce1b016SDaniel Fojt 
592*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE int
593*4ce1b016SDaniel Fojt rpl_iswalnum (wint_t wc)
594*4ce1b016SDaniel Fojt {
595*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? iswalnum ((wchar_t) wc) : 0);
596*4ce1b016SDaniel Fojt }
597*4ce1b016SDaniel Fojt 
598*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE int
599*4ce1b016SDaniel Fojt rpl_iswalpha (wint_t wc)
600*4ce1b016SDaniel Fojt {
601*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? iswalpha ((wchar_t) wc) : 0);
602*4ce1b016SDaniel Fojt }
603*4ce1b016SDaniel Fojt 
604*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE int
605*4ce1b016SDaniel Fojt rpl_iswblank (wint_t wc)
606*4ce1b016SDaniel Fojt {
607*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? iswblank ((wchar_t) wc) : 0);
608*4ce1b016SDaniel Fojt }
609*4ce1b016SDaniel Fojt 
610*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE int
611*4ce1b016SDaniel Fojt rpl_iswcntrl (wint_t wc)
612*4ce1b016SDaniel Fojt {
613*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? iswcntrl ((wchar_t) wc) : 0);
614*4ce1b016SDaniel Fojt }
615*4ce1b016SDaniel Fojt 
616*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE int
617*4ce1b016SDaniel Fojt rpl_iswdigit (wint_t wc)
618*4ce1b016SDaniel Fojt {
619*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? iswdigit ((wchar_t) wc) : 0);
620*4ce1b016SDaniel Fojt }
621*4ce1b016SDaniel Fojt 
622*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE int
623*4ce1b016SDaniel Fojt rpl_iswgraph (wint_t wc)
624*4ce1b016SDaniel Fojt {
625*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? iswgraph ((wchar_t) wc) : 0);
626*4ce1b016SDaniel Fojt }
627*4ce1b016SDaniel Fojt 
628*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE int
629*4ce1b016SDaniel Fojt rpl_iswlower (wint_t wc)
630*4ce1b016SDaniel Fojt {
631*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? iswlower ((wchar_t) wc) : 0);
632*4ce1b016SDaniel Fojt }
633*4ce1b016SDaniel Fojt 
634*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE int
635*4ce1b016SDaniel Fojt rpl_iswprint (wint_t wc)
636*4ce1b016SDaniel Fojt {
637*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? iswprint ((wchar_t) wc) : 0);
638*4ce1b016SDaniel Fojt }
639*4ce1b016SDaniel Fojt 
640*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE int
641*4ce1b016SDaniel Fojt rpl_iswpunct (wint_t wc)
642*4ce1b016SDaniel Fojt {
643*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? iswpunct ((wchar_t) wc) : 0);
644*4ce1b016SDaniel Fojt }
645*4ce1b016SDaniel Fojt 
646*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE int
647*4ce1b016SDaniel Fojt rpl_iswspace (wint_t wc)
648*4ce1b016SDaniel Fojt {
649*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? iswspace ((wchar_t) wc) : 0);
650*4ce1b016SDaniel Fojt }
651*4ce1b016SDaniel Fojt 
652*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE int
653*4ce1b016SDaniel Fojt rpl_iswupper (wint_t wc)
654*4ce1b016SDaniel Fojt {
655*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? iswupper ((wchar_t) wc) : 0);
656*4ce1b016SDaniel Fojt }
657*4ce1b016SDaniel Fojt 
658*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE int
659*4ce1b016SDaniel Fojt rpl_iswxdigit (wint_t wc)
660*4ce1b016SDaniel Fojt {
661*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? iswxdigit ((wchar_t) wc) : 0);
662*4ce1b016SDaniel Fojt }
663*4ce1b016SDaniel Fojt 
664*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE wint_t
665*4ce1b016SDaniel Fojt rpl_towlower (wint_t wc)
666*4ce1b016SDaniel Fojt {
667*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? (wchar_t) towlower ((wchar_t) wc) : wc);
668*4ce1b016SDaniel Fojt }
669*4ce1b016SDaniel Fojt 
670*4ce1b016SDaniel Fojt _GL_WCTYPE_INLINE wint_t
671*4ce1b016SDaniel Fojt rpl_towupper (wint_t wc)
672*4ce1b016SDaniel Fojt {
673*4ce1b016SDaniel Fojt   return ((wchar_t) wc == wc ? (wchar_t) towupper ((wchar_t) wc) : wc);
674*4ce1b016SDaniel Fojt }
675*4ce1b016SDaniel Fojt 
676*4ce1b016SDaniel Fojt #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
677*4ce1b016SDaniel Fojt #    undef iswalnum
678*4ce1b016SDaniel Fojt #    undef iswalpha
679*4ce1b016SDaniel Fojt #    undef iswblank
680*4ce1b016SDaniel Fojt #    undef iswcntrl
681*4ce1b016SDaniel Fojt #    undef iswdigit
682*4ce1b016SDaniel Fojt #    undef iswgraph
683*4ce1b016SDaniel Fojt #    undef iswlower
684*4ce1b016SDaniel Fojt #    undef iswprint
685*4ce1b016SDaniel Fojt #    undef iswpunct
686*4ce1b016SDaniel Fojt #    undef iswspace
687*4ce1b016SDaniel Fojt #    undef iswupper
688*4ce1b016SDaniel Fojt #    undef iswxdigit
689*4ce1b016SDaniel Fojt #    undef towlower
690*4ce1b016SDaniel Fojt #    undef towupper
691*4ce1b016SDaniel Fojt #    define iswalnum rpl_iswalnum
692*4ce1b016SDaniel Fojt #    define iswalpha rpl_iswalpha
693*4ce1b016SDaniel Fojt #    define iswblank rpl_iswblank
694*4ce1b016SDaniel Fojt #    define iswcntrl rpl_iswcntrl
695*4ce1b016SDaniel Fojt #    define iswdigit rpl_iswdigit
696*4ce1b016SDaniel Fojt #    define iswgraph rpl_iswgraph
697*4ce1b016SDaniel Fojt #    define iswlower rpl_iswlower
698*4ce1b016SDaniel Fojt #    define iswprint rpl_iswprint
699*4ce1b016SDaniel Fojt #    define iswpunct rpl_iswpunct
700*4ce1b016SDaniel Fojt #    define iswspace rpl_iswspace
701*4ce1b016SDaniel Fojt #    define iswupper rpl_iswupper
702*4ce1b016SDaniel Fojt #    define iswxdigit rpl_iswxdigit
703*4ce1b016SDaniel Fojt #    define towlower rpl_towlower
704*4ce1b016SDaniel Fojt #    define towupper rpl_towupper
705*4ce1b016SDaniel Fojt #   endif
706*4ce1b016SDaniel Fojt 
707*4ce1b016SDaniel Fojt #  else
708*4ce1b016SDaniel Fojt 
70951ddd709SJohn Marino /* IRIX 5.3 has macros but no functions, its isw* macros refer to an
71051ddd709SJohn Marino    undefined variable _ctmp_ and to <ctype.h> macros like _P, and they
71151ddd709SJohn Marino    refer to system functions like _iswctype that are not in the
71251ddd709SJohn Marino    standard C library.  Rather than try to get ancient buggy
71351ddd709SJohn Marino    implementations like this to work, just disable them.  */
71451ddd709SJohn Marino #   undef iswalnum
71551ddd709SJohn Marino #   undef iswalpha
71651ddd709SJohn Marino #   undef iswblank
71751ddd709SJohn Marino #   undef iswcntrl
71851ddd709SJohn Marino #   undef iswdigit
71951ddd709SJohn Marino #   undef iswgraph
72051ddd709SJohn Marino #   undef iswlower
72151ddd709SJohn Marino #   undef iswprint
72251ddd709SJohn Marino #   undef iswpunct
72351ddd709SJohn Marino #   undef iswspace
72451ddd709SJohn Marino #   undef iswupper
72551ddd709SJohn Marino #   undef iswxdigit
72651ddd709SJohn Marino #   undef towlower
72751ddd709SJohn Marino #   undef towupper
72851ddd709SJohn Marino 
72951ddd709SJohn Marino /* Linux libc5 has <wctype.h> and the functions but they are broken.  */
73051ddd709SJohn Marino #   if 0
73151ddd709SJohn Marino #    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
73251ddd709SJohn Marino #     define iswalnum rpl_iswalnum
73351ddd709SJohn Marino #     define iswalpha rpl_iswalpha
73451ddd709SJohn Marino #     define iswblank rpl_iswblank
73551ddd709SJohn Marino #     define iswcntrl rpl_iswcntrl
73651ddd709SJohn Marino #     define iswdigit rpl_iswdigit
73751ddd709SJohn Marino #     define iswgraph rpl_iswgraph
73851ddd709SJohn Marino #     define iswlower rpl_iswlower
73951ddd709SJohn Marino #     define iswprint rpl_iswprint
74051ddd709SJohn Marino #     define iswpunct rpl_iswpunct
74151ddd709SJohn Marino #     define iswspace rpl_iswspace
74251ddd709SJohn Marino #     define iswupper rpl_iswupper
74351ddd709SJohn Marino #     define iswxdigit rpl_iswxdigit
74451ddd709SJohn Marino #    endif
74551ddd709SJohn Marino #   endif
74651ddd709SJohn Marino #   if 0
74751ddd709SJohn Marino #    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
74851ddd709SJohn Marino #     define towlower rpl_towlower
74951ddd709SJohn Marino #     define towupper rpl_towupper
75051ddd709SJohn Marino #    endif
75151ddd709SJohn Marino #   endif
75251ddd709SJohn Marino 
75351ddd709SJohn Marino _GL_WCTYPE_INLINE int
75451ddd709SJohn Marino #   if 0
75551ddd709SJohn Marino rpl_iswalnum
75651ddd709SJohn Marino #   else
iswalnum(wint_t wc)75751ddd709SJohn Marino iswalnum
75851ddd709SJohn Marino #   endif
75951ddd709SJohn Marino          (wint_t wc)
76051ddd709SJohn Marino {
76151ddd709SJohn Marino   return ((wc >= '0' && wc <= '9')
76251ddd709SJohn Marino           || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
76351ddd709SJohn Marino }
76451ddd709SJohn Marino 
76551ddd709SJohn Marino _GL_WCTYPE_INLINE int
76651ddd709SJohn Marino #   if 0
76751ddd709SJohn Marino rpl_iswalpha
76851ddd709SJohn Marino #   else
iswalpha(wint_t wc)76951ddd709SJohn Marino iswalpha
77051ddd709SJohn Marino #   endif
77151ddd709SJohn Marino          (wint_t wc)
77251ddd709SJohn Marino {
77351ddd709SJohn Marino   return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
77451ddd709SJohn Marino }
77551ddd709SJohn Marino 
77651ddd709SJohn Marino _GL_WCTYPE_INLINE int
77751ddd709SJohn Marino #   if 0
77851ddd709SJohn Marino rpl_iswblank
77951ddd709SJohn Marino #   else
iswblank(wint_t wc)78051ddd709SJohn Marino iswblank
78151ddd709SJohn Marino #   endif
78251ddd709SJohn Marino          (wint_t wc)
78351ddd709SJohn Marino {
78451ddd709SJohn Marino   return wc == ' ' || wc == '\t';
78551ddd709SJohn Marino }
78651ddd709SJohn Marino 
78751ddd709SJohn Marino _GL_WCTYPE_INLINE int
78851ddd709SJohn Marino #   if 0
78951ddd709SJohn Marino rpl_iswcntrl
79051ddd709SJohn Marino #   else
iswcntrl(wint_t wc)79151ddd709SJohn Marino iswcntrl
79251ddd709SJohn Marino #   endif
79351ddd709SJohn Marino         (wint_t wc)
79451ddd709SJohn Marino {
79551ddd709SJohn Marino   return (wc & ~0x1f) == 0 || wc == 0x7f;
79651ddd709SJohn Marino }
79751ddd709SJohn Marino 
79851ddd709SJohn Marino _GL_WCTYPE_INLINE int
79951ddd709SJohn Marino #   if 0
80051ddd709SJohn Marino rpl_iswdigit
80151ddd709SJohn Marino #   else
iswdigit(wint_t wc)80251ddd709SJohn Marino iswdigit
80351ddd709SJohn Marino #   endif
80451ddd709SJohn Marino          (wint_t wc)
80551ddd709SJohn Marino {
80651ddd709SJohn Marino   return wc >= '0' && wc <= '9';
80751ddd709SJohn Marino }
80851ddd709SJohn Marino 
80951ddd709SJohn Marino _GL_WCTYPE_INLINE int
81051ddd709SJohn Marino #   if 0
81151ddd709SJohn Marino rpl_iswgraph
81251ddd709SJohn Marino #   else
iswgraph(wint_t wc)81351ddd709SJohn Marino iswgraph
81451ddd709SJohn Marino #   endif
81551ddd709SJohn Marino          (wint_t wc)
81651ddd709SJohn Marino {
81751ddd709SJohn Marino   return wc >= '!' && wc <= '~';
81851ddd709SJohn Marino }
81951ddd709SJohn Marino 
82051ddd709SJohn Marino _GL_WCTYPE_INLINE int
82151ddd709SJohn Marino #   if 0
82251ddd709SJohn Marino rpl_iswlower
82351ddd709SJohn Marino #   else
iswlower(wint_t wc)82451ddd709SJohn Marino iswlower
82551ddd709SJohn Marino #   endif
82651ddd709SJohn Marino          (wint_t wc)
82751ddd709SJohn Marino {
82851ddd709SJohn Marino   return wc >= 'a' && wc <= 'z';
82951ddd709SJohn Marino }
83051ddd709SJohn Marino 
83151ddd709SJohn Marino _GL_WCTYPE_INLINE int
83251ddd709SJohn Marino #   if 0
83351ddd709SJohn Marino rpl_iswprint
83451ddd709SJohn Marino #   else
iswprint(wint_t wc)83551ddd709SJohn Marino iswprint
83651ddd709SJohn Marino #   endif
83751ddd709SJohn Marino          (wint_t wc)
83851ddd709SJohn Marino {
83951ddd709SJohn Marino   return wc >= ' ' && wc <= '~';
84051ddd709SJohn Marino }
84151ddd709SJohn Marino 
84251ddd709SJohn Marino _GL_WCTYPE_INLINE int
84351ddd709SJohn Marino #   if 0
84451ddd709SJohn Marino rpl_iswpunct
84551ddd709SJohn Marino #   else
iswpunct(wint_t wc)84651ddd709SJohn Marino iswpunct
84751ddd709SJohn Marino #   endif
84851ddd709SJohn Marino          (wint_t wc)
84951ddd709SJohn Marino {
85051ddd709SJohn Marino   return (wc >= '!' && wc <= '~'
85151ddd709SJohn Marino           && !((wc >= '0' && wc <= '9')
85251ddd709SJohn Marino                || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
85351ddd709SJohn Marino }
85451ddd709SJohn Marino 
85551ddd709SJohn Marino _GL_WCTYPE_INLINE int
85651ddd709SJohn Marino #   if 0
85751ddd709SJohn Marino rpl_iswspace
85851ddd709SJohn Marino #   else
iswspace(wint_t wc)85951ddd709SJohn Marino iswspace
86051ddd709SJohn Marino #   endif
86151ddd709SJohn Marino          (wint_t wc)
86251ddd709SJohn Marino {
86351ddd709SJohn Marino   return (wc == ' ' || wc == '\t'
86451ddd709SJohn Marino           || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
86551ddd709SJohn Marino }
86651ddd709SJohn Marino 
86751ddd709SJohn Marino _GL_WCTYPE_INLINE int
86851ddd709SJohn Marino #   if 0
86951ddd709SJohn Marino rpl_iswupper
87051ddd709SJohn Marino #   else
iswupper(wint_t wc)87151ddd709SJohn Marino iswupper
87251ddd709SJohn Marino #   endif
87351ddd709SJohn Marino          (wint_t wc)
87451ddd709SJohn Marino {
87551ddd709SJohn Marino   return wc >= 'A' && wc <= 'Z';
87651ddd709SJohn Marino }
87751ddd709SJohn Marino 
87851ddd709SJohn Marino _GL_WCTYPE_INLINE int
87951ddd709SJohn Marino #   if 0
88051ddd709SJohn Marino rpl_iswxdigit
88151ddd709SJohn Marino #   else
iswxdigit(wint_t wc)88251ddd709SJohn Marino iswxdigit
88351ddd709SJohn Marino #   endif
88451ddd709SJohn Marino           (wint_t wc)
88551ddd709SJohn Marino {
88651ddd709SJohn Marino   return ((wc >= '0' && wc <= '9')
88751ddd709SJohn Marino           || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
88851ddd709SJohn Marino }
88951ddd709SJohn Marino 
89051ddd709SJohn Marino _GL_WCTYPE_INLINE wint_t
89151ddd709SJohn Marino #   if 0
89251ddd709SJohn Marino rpl_towlower
89351ddd709SJohn Marino #   else
towlower(wint_t wc)89451ddd709SJohn Marino towlower
89551ddd709SJohn Marino #   endif
89651ddd709SJohn Marino          (wint_t wc)
89751ddd709SJohn Marino {
89851ddd709SJohn Marino   return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc);
89951ddd709SJohn Marino }
90051ddd709SJohn Marino 
90151ddd709SJohn Marino _GL_WCTYPE_INLINE wint_t
90251ddd709SJohn Marino #   if 0
90351ddd709SJohn Marino rpl_towupper
90451ddd709SJohn Marino #   else
towupper(wint_t wc)90551ddd709SJohn Marino towupper
90651ddd709SJohn Marino #   endif
90751ddd709SJohn Marino          (wint_t wc)
90851ddd709SJohn Marino {
90951ddd709SJohn Marino   return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
91051ddd709SJohn Marino }
91151ddd709SJohn Marino 
912*4ce1b016SDaniel Fojt #  endif
913*4ce1b016SDaniel Fojt 
91451ddd709SJohn Marino # elif 1 && (! 1 || 0)
91551ddd709SJohn Marino /* Only the iswblank function is missing.  */
91651ddd709SJohn Marino 
91751ddd709SJohn Marino #  if 0
91851ddd709SJohn Marino #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
91951ddd709SJohn Marino #    define iswblank rpl_iswblank
92051ddd709SJohn Marino #   endif
92151ddd709SJohn Marino _GL_FUNCDECL_RPL (iswblank, int, (wint_t wc));
92251ddd709SJohn Marino #  else
92351ddd709SJohn Marino _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
92451ddd709SJohn Marino #  endif
92551ddd709SJohn Marino 
92651ddd709SJohn Marino # endif
92751ddd709SJohn Marino 
928*4ce1b016SDaniel Fojt # if defined __MINGW32__ && !0
92951ddd709SJohn Marino 
93051ddd709SJohn Marino /* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t.
93151ddd709SJohn Marino    The functions towlower and towupper are implemented in the MSVCRT library
93251ddd709SJohn Marino    to take a wchar_t argument and return a wchar_t result.  mingw declares
93351ddd709SJohn Marino    these functions to take a wint_t argument and return a wint_t result.
93451ddd709SJohn Marino    This means that:
93551ddd709SJohn Marino    1. When the user passes an argument outside the range 0x0000..0xFFFF, the
93651ddd709SJohn Marino       function will look only at the lower 16 bits.  This is allowed according
93751ddd709SJohn Marino       to POSIX.
93851ddd709SJohn Marino    2. The return value is returned in the lower 16 bits of the result register.
93951ddd709SJohn Marino       The upper 16 bits are random: whatever happened to be in that part of the
94051ddd709SJohn Marino       result register.  We need to fix this by adding a zero-extend from
94151ddd709SJohn Marino       wchar_t to wint_t after the call.  */
94251ddd709SJohn Marino 
94351ddd709SJohn Marino _GL_WCTYPE_INLINE wint_t
rpl_towlower(wint_t wc)94451ddd709SJohn Marino rpl_towlower (wint_t wc)
94551ddd709SJohn Marino {
94651ddd709SJohn Marino   return (wint_t) (wchar_t) towlower (wc);
94751ddd709SJohn Marino }
94851ddd709SJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
94951ddd709SJohn Marino #   define towlower rpl_towlower
95051ddd709SJohn Marino #  endif
95151ddd709SJohn Marino 
95251ddd709SJohn Marino _GL_WCTYPE_INLINE wint_t
rpl_towupper(wint_t wc)95351ddd709SJohn Marino rpl_towupper (wint_t wc)
95451ddd709SJohn Marino {
95551ddd709SJohn Marino   return (wint_t) (wchar_t) towupper (wc);
95651ddd709SJohn Marino }
95751ddd709SJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
95851ddd709SJohn Marino #   define towupper rpl_towupper
95951ddd709SJohn Marino #  endif
96051ddd709SJohn Marino 
961*4ce1b016SDaniel Fojt # endif /* __MINGW32__ && !0 */
96251ddd709SJohn Marino 
96351ddd709SJohn Marino # define GNULIB_defined_wctype_functions 1
96451ddd709SJohn Marino #endif
96551ddd709SJohn Marino 
96651ddd709SJohn Marino #if 0
96751ddd709SJohn Marino _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc));
96851ddd709SJohn Marino _GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc));
96951ddd709SJohn Marino _GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc));
97051ddd709SJohn Marino _GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc));
97151ddd709SJohn Marino _GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc));
97251ddd709SJohn Marino _GL_CXXALIAS_RPL (iswlower, int, (wint_t wc));
97351ddd709SJohn Marino _GL_CXXALIAS_RPL (iswprint, int, (wint_t wc));
97451ddd709SJohn Marino _GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc));
97551ddd709SJohn Marino _GL_CXXALIAS_RPL (iswspace, int, (wint_t wc));
97651ddd709SJohn Marino _GL_CXXALIAS_RPL (iswupper, int, (wint_t wc));
97751ddd709SJohn Marino _GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc));
97851ddd709SJohn Marino #else
97951ddd709SJohn Marino _GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
98051ddd709SJohn Marino _GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
98151ddd709SJohn Marino _GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc));
98251ddd709SJohn Marino _GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc));
98351ddd709SJohn Marino _GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc));
98451ddd709SJohn Marino _GL_CXXALIAS_SYS (iswlower, int, (wint_t wc));
98551ddd709SJohn Marino _GL_CXXALIAS_SYS (iswprint, int, (wint_t wc));
98651ddd709SJohn Marino _GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc));
98751ddd709SJohn Marino _GL_CXXALIAS_SYS (iswspace, int, (wint_t wc));
98851ddd709SJohn Marino _GL_CXXALIAS_SYS (iswupper, int, (wint_t wc));
98951ddd709SJohn Marino _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc));
99051ddd709SJohn Marino #endif
991*4ce1b016SDaniel Fojt #if __GLIBC__ >= 2
99251ddd709SJohn Marino _GL_CXXALIASWARN (iswalnum);
99351ddd709SJohn Marino _GL_CXXALIASWARN (iswalpha);
99451ddd709SJohn Marino _GL_CXXALIASWARN (iswcntrl);
99551ddd709SJohn Marino _GL_CXXALIASWARN (iswdigit);
99651ddd709SJohn Marino _GL_CXXALIASWARN (iswgraph);
99751ddd709SJohn Marino _GL_CXXALIASWARN (iswlower);
99851ddd709SJohn Marino _GL_CXXALIASWARN (iswprint);
99951ddd709SJohn Marino _GL_CXXALIASWARN (iswpunct);
100051ddd709SJohn Marino _GL_CXXALIASWARN (iswspace);
100151ddd709SJohn Marino _GL_CXXALIASWARN (iswupper);
100251ddd709SJohn Marino _GL_CXXALIASWARN (iswxdigit);
1003*4ce1b016SDaniel Fojt #endif
100451ddd709SJohn Marino 
100551ddd709SJohn Marino #if 1
100651ddd709SJohn Marino # if 0 || 0
100751ddd709SJohn Marino _GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
100851ddd709SJohn Marino # else
100951ddd709SJohn Marino _GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
101051ddd709SJohn Marino # endif
1011*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2
101251ddd709SJohn Marino _GL_CXXALIASWARN (iswblank);
101351ddd709SJohn Marino # endif
1014*4ce1b016SDaniel Fojt #endif
101551ddd709SJohn Marino 
101651ddd709SJohn Marino #if !1
101751ddd709SJohn Marino # if !GNULIB_defined_wctype_t
101851ddd709SJohn Marino typedef void * wctype_t;
101951ddd709SJohn Marino #  define GNULIB_defined_wctype_t 1
102051ddd709SJohn Marino # endif
102151ddd709SJohn Marino #endif
102251ddd709SJohn Marino 
102351ddd709SJohn Marino /* Get a descriptor for a wide character property.  */
102451ddd709SJohn Marino #if 0
102551ddd709SJohn Marino # if !1
102651ddd709SJohn Marino _GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name));
102751ddd709SJohn Marino # endif
102851ddd709SJohn Marino _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
1029*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2
103051ddd709SJohn Marino _GL_CXXALIASWARN (wctype);
1031*4ce1b016SDaniel Fojt # endif
103251ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK
103351ddd709SJohn Marino # undef wctype
103451ddd709SJohn Marino # if HAVE_RAW_DECL_WCTYPE
103551ddd709SJohn Marino _GL_WARN_ON_USE (wctype, "wctype is unportable - "
103651ddd709SJohn Marino                  "use gnulib module wctype for portability");
103751ddd709SJohn Marino # endif
103851ddd709SJohn Marino #endif
103951ddd709SJohn Marino 
104051ddd709SJohn Marino /* Test whether a wide character has a given property.
104151ddd709SJohn Marino    The argument WC must be either a wchar_t value or WEOF.
104251ddd709SJohn Marino    The argument DESC must have been returned by the wctype() function.  */
104351ddd709SJohn Marino #if 1
1044*4ce1b016SDaniel Fojt # if 0
1045*4ce1b016SDaniel Fojt #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1046*4ce1b016SDaniel Fojt #   undef iswctype
1047*4ce1b016SDaniel Fojt #   define iswctype rpl_iswctype
1048*4ce1b016SDaniel Fojt #  endif
1049*4ce1b016SDaniel Fojt _GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc));
1050*4ce1b016SDaniel Fojt _GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc));
1051*4ce1b016SDaniel Fojt # else
105251ddd709SJohn Marino #  if !1
105351ddd709SJohn Marino _GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc));
105451ddd709SJohn Marino #  endif
105551ddd709SJohn Marino _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
1056*4ce1b016SDaniel Fojt # endif
1057*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2
105851ddd709SJohn Marino _GL_CXXALIASWARN (iswctype);
1059*4ce1b016SDaniel Fojt # endif
106051ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK
106151ddd709SJohn Marino # undef iswctype
106251ddd709SJohn Marino # if HAVE_RAW_DECL_ISWCTYPE
106351ddd709SJohn Marino _GL_WARN_ON_USE (iswctype, "iswctype is unportable - "
106451ddd709SJohn Marino                  "use gnulib module iswctype for portability");
106551ddd709SJohn Marino # endif
106651ddd709SJohn Marino #endif
106751ddd709SJohn Marino 
106851ddd709SJohn Marino #if 0 || defined __MINGW32__
106951ddd709SJohn Marino _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc));
107051ddd709SJohn Marino _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
107151ddd709SJohn Marino #else
107251ddd709SJohn Marino _GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc));
107351ddd709SJohn Marino _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc));
107451ddd709SJohn Marino #endif
1075*4ce1b016SDaniel Fojt #if __GLIBC__ >= 2
107651ddd709SJohn Marino _GL_CXXALIASWARN (towlower);
107751ddd709SJohn Marino _GL_CXXALIASWARN (towupper);
1078*4ce1b016SDaniel Fojt #endif
107951ddd709SJohn Marino 
108051ddd709SJohn Marino #if !1
108151ddd709SJohn Marino # if !GNULIB_defined_wctrans_t
108251ddd709SJohn Marino typedef void * wctrans_t;
108351ddd709SJohn Marino #  define GNULIB_defined_wctrans_t 1
108451ddd709SJohn Marino # endif
108551ddd709SJohn Marino #endif
108651ddd709SJohn Marino 
108751ddd709SJohn Marino /* Get a descriptor for a wide character case conversion.  */
108851ddd709SJohn Marino #if 0
108951ddd709SJohn Marino # if !1
109051ddd709SJohn Marino _GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name));
109151ddd709SJohn Marino # endif
109251ddd709SJohn Marino _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
1093*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2
109451ddd709SJohn Marino _GL_CXXALIASWARN (wctrans);
1095*4ce1b016SDaniel Fojt # endif
109651ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK
109751ddd709SJohn Marino # undef wctrans
109851ddd709SJohn Marino # if HAVE_RAW_DECL_WCTRANS
109951ddd709SJohn Marino _GL_WARN_ON_USE (wctrans, "wctrans is unportable - "
110051ddd709SJohn Marino                  "use gnulib module wctrans for portability");
110151ddd709SJohn Marino # endif
110251ddd709SJohn Marino #endif
110351ddd709SJohn Marino 
110451ddd709SJohn Marino /* Perform a given case conversion on a wide character.
110551ddd709SJohn Marino    The argument WC must be either a wchar_t value or WEOF.
110651ddd709SJohn Marino    The argument DESC must have been returned by the wctrans() function.  */
110751ddd709SJohn Marino #if 0
110851ddd709SJohn Marino # if !1
110951ddd709SJohn Marino _GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
111051ddd709SJohn Marino # endif
111151ddd709SJohn Marino _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
1112*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2
111351ddd709SJohn Marino _GL_CXXALIASWARN (towctrans);
1114*4ce1b016SDaniel Fojt # endif
111551ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK
111651ddd709SJohn Marino # undef towctrans
111751ddd709SJohn Marino # if HAVE_RAW_DECL_TOWCTRANS
111851ddd709SJohn Marino _GL_WARN_ON_USE (towctrans, "towctrans is unportable - "
111951ddd709SJohn Marino                  "use gnulib module towctrans for portability");
112051ddd709SJohn Marino # endif
112151ddd709SJohn Marino #endif
112251ddd709SJohn Marino 
112351ddd709SJohn Marino _GL_INLINE_HEADER_END
112451ddd709SJohn Marino 
112551ddd709SJohn Marino #endif /* _GL_WCTYPE_H */
112651ddd709SJohn Marino #endif /* _GL_WCTYPE_H */
1127*4ce1b016SDaniel Fojt #endif
1128