13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   Copyright (C) 2006-2012 Free Software Foundation, Inc.
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   This program is free software; you can redistribute it and/or modify
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   it under the terms of the GNU General Public License as published by
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   the Free Software Foundation; either version 3, or (at your option)
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   any later version.
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   This program is distributed in the hope that it will be useful,
123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   but WITHOUT ANY WARRANTY; without even the implied warranty of
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   GNU General Public License for more details.
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   You should have received a copy of the GNU General Public License
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* Written by Bruno Haible and Paul Eggert.  */
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ISO C 99 <wctype.h> for platforms that lack it.
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * <http://www.opengroup.org/susv3xbd/wctype.h.html>
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * iswctype, towctrans, towlower, towupper, wctrans, wctype,
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * wctrans_t, and wctype_t are not yet implemented.
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry */
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _GL_WCTYPE_H
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#if __GNUC__ >= 3
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#pragma GCC system_header
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#if 1
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   <wchar.h>.
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   included before <wchar.h>.  */
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# include <stddef.h>
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# include <stdio.h>
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# include <time.h>
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# include <wchar.h>
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* Include the original <wctype.h> if it exists.
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   BeOS 5 has the functions but no <wctype.h>.  */
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* The include_next requires a split double-inclusion guard.  */
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#if 1
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# include_next <wctype.h>
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _GL_WCTYPE_H
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _GL_WCTYPE_H
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry_GL_INLINE_HEADER_BEGIN
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _GL_WCTYPE_INLINE
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_WCTYPE_INLINE _GL_INLINE
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _GL_CXXDEFS_H
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _GL_CXXDEFS_H
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* The three most frequent use cases of these macros are:
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   * For providing a substitute for a function that is missing on some
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     platforms, but is declared and works fine on the platforms on which
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     it exists:
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #if @GNULIB_FOO@
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       # if !@HAVE_FOO@
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       _GL_FUNCDECL_SYS (foo, ...);
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       # endif
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       _GL_CXXALIAS_SYS (foo, ...);
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       _GL_CXXALIASWARN (foo);
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #elif defined GNULIB_POSIXCHECK
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       ...
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #endif
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   * For providing a replacement for a function that exists on all platforms,
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     but is broken/insufficient and needs to be replaced on some platforms:
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #if @GNULIB_FOO@
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       # if @REPLACE_FOO@
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #   undef foo
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #   define foo rpl_foo
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #  endif
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       _GL_FUNCDECL_RPL (foo, ...);
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       _GL_CXXALIAS_RPL (foo, ...);
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       # else
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       _GL_CXXALIAS_SYS (foo, ...);
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       # endif
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       _GL_CXXALIASWARN (foo);
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #elif defined GNULIB_POSIXCHECK
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       ...
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #endif
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   * For providing a replacement for a function that exists on some platforms
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     but is broken/insufficient and needs to be replaced on some of them and
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     is additionally either missing or undeclared on some other platforms:
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #if @GNULIB_FOO@
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       # if @REPLACE_FOO@
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #   undef foo
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #   define foo rpl_foo
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #  endif
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       _GL_FUNCDECL_RPL (foo, ...);
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       _GL_CXXALIAS_RPL (foo, ...);
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       # else
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       _GL_FUNCDECL_SYS (foo, ...);
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #  endif
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       _GL_CXXALIAS_SYS (foo, ...);
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       # endif
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       _GL_CXXALIASWARN (foo);
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #elif defined GNULIB_POSIXCHECK
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       ...
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       #endif
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry*/
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* _GL_EXTERN_C declaration;
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   performs the declaration with C linkage.  */
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#if defined __cplusplus
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_EXTERN_C extern "C"
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#else
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_EXTERN_C extern
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   declares a replacement function, named rpl_func, with the given prototype,
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   consisting of return type, parameters, and attributes.
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   Example:
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry                                  _GL_ARG_NONNULL ((1)));
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry */
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   declares the system function, named func, with the given prototype,
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   consisting of return type, parameters, and attributes.
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   Example:
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry                                  _GL_ARG_NONNULL ((1)));
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry */
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry  _GL_EXTERN_C rettype func parameters_and_attributes
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* _GL_CXXALIAS_RPL (func, rettype, parameters);
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   declares a C++ alias called GNULIB_NAMESPACE::func
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   Example:
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry */
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#if defined __cplusplus && defined GNULIB_NAMESPACE
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    namespace GNULIB_NAMESPACE                                \
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    {                                                         \
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry      rettype (*const func) parameters = ::rpl_func;          \
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    }                                                         \
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_EXTERN_C int _gl_cxxalias_dummy
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#else
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_EXTERN_C int _gl_cxxalias_dummy
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   except that the C function rpl_func may have a slightly different
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   declaration.  A cast is used to silence the "invalid conversion" error
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   that would otherwise occur.  */
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#if defined __cplusplus && defined GNULIB_NAMESPACE
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    namespace GNULIB_NAMESPACE                                     \
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    {                                                              \
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry      rettype (*const func) parameters =                           \
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry        reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    }                                                              \
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_EXTERN_C int _gl_cxxalias_dummy
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#else
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_EXTERN_C int _gl_cxxalias_dummy
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* _GL_CXXALIAS_SYS (func, rettype, parameters);
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   declares a C++ alias called GNULIB_NAMESPACE::func
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   that redirects to the system provided function func, if GNULIB_NAMESPACE
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   is defined.
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   Example:
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry */
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#if defined __cplusplus && defined GNULIB_NAMESPACE
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry  /* If we were to write
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry       rettype (*const func) parameters = ::func;
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     better (remove an indirection through a 'static' pointer variable),
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     but then the _GL_CXXALIASWARN macro below would cause a warning not only
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    namespace GNULIB_NAMESPACE                     \
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    {                                              \
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry      static rettype (*func) parameters = ::func;  \
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    }                                              \
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_EXTERN_C int _gl_cxxalias_dummy
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#else
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_EXTERN_C int _gl_cxxalias_dummy
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   except that the C function func may have a slightly different declaration.
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   A cast is used to silence the "invalid conversion" error that would
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   otherwise occur.  */
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#if defined __cplusplus && defined GNULIB_NAMESPACE
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    namespace GNULIB_NAMESPACE                          \
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    {                                                   \
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry      static rettype (*func) parameters =               \
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry        reinterpret_cast<rettype(*)parameters>(::func); \
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    }                                                   \
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_EXTERN_C int _gl_cxxalias_dummy
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#else
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_EXTERN_C int _gl_cxxalias_dummy
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   except that the C function is picked among a set of overloaded functions,
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   namely the one with rettype2 and parameters2.  Two consecutive casts
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   are used to silence the "cannot find a match" and "invalid conversion"
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   errors that would otherwise occur.  */
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#if defined __cplusplus && defined GNULIB_NAMESPACE
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry  /* The outer cast must be a reinterpret_cast.
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     The inner cast: When the function is defined as a set of overloaded
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     functions, it works as a static_cast<>, choosing the designated variant.
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     When the function is defined as a single variant, it works as a
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    namespace GNULIB_NAMESPACE                                                \
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    {                                                                         \
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry      static rettype (*func) parameters =                                     \
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry        reinterpret_cast<rettype(*)parameters>(                               \
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry          (rettype2(*)parameters2)(::func));                                  \
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    }                                                                         \
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_EXTERN_C int _gl_cxxalias_dummy
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#else
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_EXTERN_C int _gl_cxxalias_dummy
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* _GL_CXXALIASWARN (func);
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   causes a warning to be emitted when ::func is used but not when
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   variants.  */
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#if defined __cplusplus && defined GNULIB_NAMESPACE
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIASWARN(func) \
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIASWARN_1(func,namespace) \
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   _GL_CXXALIASWARN_2 (func, namespace)
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   we enable the warning only when not optimizing.  */
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# if !__OPTIMIZE__
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#  define _GL_CXXALIASWARN_2(func,namespace) \
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_WARN_ON_USE (func, \
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry                     "The symbol ::" #func " refers to the system function. " \
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry                     "Use " #namespace "::" #func " instead.")
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#  define _GL_CXXALIASWARN_2(func,namespace) \
2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     extern __typeof__ (func) func
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# else
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#  define _GL_CXXALIASWARN_2(func,namespace) \
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     _GL_EXTERN_C int _gl_cxxalias_dummy
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# endif
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#else
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIASWARN(func) \
2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_EXTERN_C int _gl_cxxalias_dummy
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   causes a warning to be emitted when the given overloaded variant of ::func
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   is used but not when GNULIB_NAMESPACE::func is used.  */
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#if defined __cplusplus && defined GNULIB_NAMESPACE
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry                        GNULIB_NAMESPACE)
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   we enable the warning only when not optimizing.  */
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# if !__OPTIMIZE__
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry                         "The symbol ::" #func " refers to the system function. " \
3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry                         "Use " #namespace "::" #func " instead.")
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     extern __typeof__ (func) func
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# else
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     _GL_EXTERN_C int _gl_cxxalias_dummy
3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# endif
3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#else
3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry    _GL_EXTERN_C int _gl_cxxalias_dummy
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif /* _GL_CXXDEFS_H */
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* The definition of _GL_WARN_ON_USE is copied here.  */
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _GL_WARN_ON_USE
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#  define _GL_WARN_ON_USE(function, message) \
3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyryextern __typeof__ (function) function __attribute__ ((__warning__ (message)))
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* Verify the existence of the function.  */
3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#  define _GL_WARN_ON_USE(function, message) \
3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyryextern __typeof__ (function) function
3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# else /* Unsupported.  */
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#  define _GL_WARN_ON_USE(function, message) \
3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry_GL_WARN_EXTERN_C int _gl_warn_on_use
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# endif
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   is like _GL_WARN_ON_USE (function, "string"), except that the function is
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   declared with the given prototype, consisting of return type, parameters,
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   and attributes.
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry   not work in this case.  */
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _GL_WARN_ON_USE_CXX
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyryextern rettype function parameters_and_attributes \
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry     __attribute__ ((__warning__ (msg)))
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* Verify the existence of the function.  */
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyryextern 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