105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Copyright (C) 2006-2012 Free Software Foundation, Inc.
405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This program is free software; you can redistribute it and/or modify
605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   it under the terms of the GNU General Public License as published by
705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   the Free Software Foundation; either version 3, or (at your option)
805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   any later version.
905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
1005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This program is distributed in the hope that it will be useful,
1105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   but WITHOUT ANY WARRANTY; without even the implied warranty of
1205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   GNU General Public License for more details.
1405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
1505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   You should have received a copy of the GNU General Public License
1605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
1705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
1805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Written by Bruno Haible and Paul Eggert.  */
1905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
2005436638acc7c010349a69c3395f1a57c642dc62Ying Wang/*
2105436638acc7c010349a69c3395f1a57c642dc62Ying Wang * ISO C 99 <wctype.h> for platforms that lack it.
2205436638acc7c010349a69c3395f1a57c642dc62Ying Wang * <http://www.opengroup.org/susv3xbd/wctype.h.html>
2305436638acc7c010349a69c3395f1a57c642dc62Ying Wang *
2405436638acc7c010349a69c3395f1a57c642dc62Ying Wang * iswctype, towctrans, towlower, towupper, wctrans, wctype,
2505436638acc7c010349a69c3395f1a57c642dc62Ying Wang * wctrans_t, and wctype_t are not yet implemented.
2605436638acc7c010349a69c3395f1a57c642dc62Ying Wang */
2705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
2805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _@GUARD_PREFIX@_WCTYPE_H
2905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
3005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if __GNUC__ >= 3
3105436638acc7c010349a69c3395f1a57c642dc62Ying Wang@PRAGMA_SYSTEM_HEADER@
3205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
3305436638acc7c010349a69c3395f1a57c642dc62Ying Wang@PRAGMA_COLUMNS@
3405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
3505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if @HAVE_WINT_T@
3605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
3705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
3805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   <wchar.h>.
3905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
4005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   included before <wchar.h>.  */
4105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# include <stddef.h>
4205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# include <stdio.h>
4305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# include <time.h>
4405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# include <wchar.h>
4505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
4605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
4705436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Include the original <wctype.h> if it exists.
4805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   BeOS 5 has the functions but no <wctype.h>.  */
4905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The include_next requires a split double-inclusion guard.  */
5005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if @HAVE_WCTYPE_H@
5105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# @INCLUDE_NEXT@ @NEXT_WCTYPE_H@
5205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
5305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
5405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _@GUARD_PREFIX@_WCTYPE_H
5505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _@GUARD_PREFIX@_WCTYPE_H
5605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
5705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_INLINE_HEADER_BEGIN
5805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_WCTYPE_INLINE
5905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_WCTYPE_INLINE _GL_INLINE
6005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
6105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
6205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
6305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
6405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The definition of _GL_WARN_ON_USE is copied here.  */
6505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
6605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which
6705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   #defines a number of identifiers in the application namespace.  Revert
6805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   these #defines.  */
6905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifdef __sun
7005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef multibyte
7105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef eucw1
7205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef eucw2
7305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef eucw3
7405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef scrw1
7505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef scrw2
7605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef scrw3
7705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
7805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
7905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Define wint_t and WEOF.  (Also done in wchar.in.h.)  */
8005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if !@HAVE_WINT_T@ && !defined wint_t
8105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define wint_t int
8205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# ifndef WEOF
8305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define WEOF -1
8405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
8505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
8605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>.
8705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
8805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   "unchanged by default argument promotions".  Override it.  */
8905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if defined _MSC_VER
9005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !GNULIB_defined_wint_t
9105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   include <crtdefs.h>
9205436638acc7c010349a69c3395f1a57c642dc62Ying Wangtypedef unsigned int rpl_wint_t;
9305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef wint_t
9405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define wint_t rpl_wint_t
9505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define GNULIB_defined_wint_t 1
9605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
9705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
9805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# ifndef WEOF
9905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define WEOF ((wint_t) -1)
10005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
10105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
10205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
10305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
10405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if !GNULIB_defined_wctype_functions
10505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
10605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
10705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Linux libc5 has <wctype.h> and the functions but they are broken.
10805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Assume all 11 functions (all isw* except iswblank) are implemented the
10905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   same way, or not at all.  */
11005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
11105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
11205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* IRIX 5.3 has macros but no functions, its isw* macros refer to an
11305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   undefined variable _ctmp_ and to <ctype.h> macros like _P, and they
11405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   refer to system functions like _iswctype that are not in the
11505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   standard C library.  Rather than try to get ancient buggy
11605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   implementations like this to work, just disable them.  */
11705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef iswalnum
11805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef iswalpha
11905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef iswblank
12005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef iswcntrl
12105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef iswdigit
12205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef iswgraph
12305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef iswlower
12405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef iswprint
12505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef iswpunct
12605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef iswspace
12705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef iswupper
12805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef iswxdigit
12905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef towlower
13005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef towupper
13105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
13205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Linux libc5 has <wctype.h> and the functions but they are broken.  */
13305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWCNTRL@
13405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
13505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define iswalnum rpl_iswalnum
13605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define iswalpha rpl_iswalpha
13705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define iswblank rpl_iswblank
13805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define iswcntrl rpl_iswcntrl
13905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define iswdigit rpl_iswdigit
14005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define iswgraph rpl_iswgraph
14105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define iswlower rpl_iswlower
14205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define iswprint rpl_iswprint
14305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define iswpunct rpl_iswpunct
14405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define iswspace rpl_iswspace
14505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define iswupper rpl_iswupper
14605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define iswxdigit rpl_iswxdigit
14705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   endif
14805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
14905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_TOWLOWER@
15005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
15105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define towlower rpl_towlower
15205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define towupper rpl_towupper
15305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   endif
15405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
15505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
15605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE int
15705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWCNTRL@
15805436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_iswalnum
15905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
16005436638acc7c010349a69c3395f1a57c642dc62Ying Wangiswalnum
16105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
16205436638acc7c010349a69c3395f1a57c642dc62Ying Wang         (wint_t wc)
16305436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
16405436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return ((wc >= '0' && wc <= '9')
16505436638acc7c010349a69c3395f1a57c642dc62Ying Wang          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
16605436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
16705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
16805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE int
16905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWCNTRL@
17005436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_iswalpha
17105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
17205436638acc7c010349a69c3395f1a57c642dc62Ying Wangiswalpha
17305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
17405436638acc7c010349a69c3395f1a57c642dc62Ying Wang         (wint_t wc)
17505436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
17605436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
17705436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
17805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
17905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE int
18005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWCNTRL@
18105436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_iswblank
18205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
18305436638acc7c010349a69c3395f1a57c642dc62Ying Wangiswblank
18405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
18505436638acc7c010349a69c3395f1a57c642dc62Ying Wang         (wint_t wc)
18605436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
18705436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return wc == ' ' || wc == '\t';
18805436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
18905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
19005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE int
19105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWCNTRL@
19205436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_iswcntrl
19305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
19405436638acc7c010349a69c3395f1a57c642dc62Ying Wangiswcntrl
19505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
19605436638acc7c010349a69c3395f1a57c642dc62Ying Wang        (wint_t wc)
19705436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
19805436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return (wc & ~0x1f) == 0 || wc == 0x7f;
19905436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
20005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
20105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE int
20205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWCNTRL@
20305436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_iswdigit
20405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
20505436638acc7c010349a69c3395f1a57c642dc62Ying Wangiswdigit
20605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
20705436638acc7c010349a69c3395f1a57c642dc62Ying Wang         (wint_t wc)
20805436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
20905436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return wc >= '0' && wc <= '9';
21005436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
21105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
21205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE int
21305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWCNTRL@
21405436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_iswgraph
21505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
21605436638acc7c010349a69c3395f1a57c642dc62Ying Wangiswgraph
21705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
21805436638acc7c010349a69c3395f1a57c642dc62Ying Wang         (wint_t wc)
21905436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
22005436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return wc >= '!' && wc <= '~';
22105436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
22205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
22305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE int
22405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWCNTRL@
22505436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_iswlower
22605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
22705436638acc7c010349a69c3395f1a57c642dc62Ying Wangiswlower
22805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
22905436638acc7c010349a69c3395f1a57c642dc62Ying Wang         (wint_t wc)
23005436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
23105436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return wc >= 'a' && wc <= 'z';
23205436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
23305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
23405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE int
23505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWCNTRL@
23605436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_iswprint
23705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
23805436638acc7c010349a69c3395f1a57c642dc62Ying Wangiswprint
23905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
24005436638acc7c010349a69c3395f1a57c642dc62Ying Wang         (wint_t wc)
24105436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
24205436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return wc >= ' ' && wc <= '~';
24305436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
24405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
24505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE int
24605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWCNTRL@
24705436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_iswpunct
24805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
24905436638acc7c010349a69c3395f1a57c642dc62Ying Wangiswpunct
25005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
25105436638acc7c010349a69c3395f1a57c642dc62Ying Wang         (wint_t wc)
25205436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
25305436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return (wc >= '!' && wc <= '~'
25405436638acc7c010349a69c3395f1a57c642dc62Ying Wang          && !((wc >= '0' && wc <= '9')
25505436638acc7c010349a69c3395f1a57c642dc62Ying Wang               || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
25605436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
25705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
25805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE int
25905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWCNTRL@
26005436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_iswspace
26105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
26205436638acc7c010349a69c3395f1a57c642dc62Ying Wangiswspace
26305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
26405436638acc7c010349a69c3395f1a57c642dc62Ying Wang         (wint_t wc)
26505436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
26605436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return (wc == ' ' || wc == '\t'
26705436638acc7c010349a69c3395f1a57c642dc62Ying Wang          || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
26805436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
26905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
27005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE int
27105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWCNTRL@
27205436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_iswupper
27305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
27405436638acc7c010349a69c3395f1a57c642dc62Ying Wangiswupper
27505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
27605436638acc7c010349a69c3395f1a57c642dc62Ying Wang         (wint_t wc)
27705436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
27805436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return wc >= 'A' && wc <= 'Z';
27905436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
28005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
28105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE int
28205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWCNTRL@
28305436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_iswxdigit
28405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
28505436638acc7c010349a69c3395f1a57c642dc62Ying Wangiswxdigit
28605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
28705436638acc7c010349a69c3395f1a57c642dc62Ying Wang          (wint_t wc)
28805436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
28905436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return ((wc >= '0' && wc <= '9')
29005436638acc7c010349a69c3395f1a57c642dc62Ying Wang          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
29105436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
29205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
29305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE wint_t
29405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_TOWLOWER@
29505436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_towlower
29605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
29705436638acc7c010349a69c3395f1a57c642dc62Ying Wangtowlower
29805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
29905436638acc7c010349a69c3395f1a57c642dc62Ying Wang         (wint_t wc)
30005436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
30105436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc);
30205436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
30305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
30405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE wint_t
30505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_TOWLOWER@
30605436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_towupper
30705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
30805436638acc7c010349a69c3395f1a57c642dc62Ying Wangtowupper
30905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
31005436638acc7c010349a69c3395f1a57c642dc62Ying Wang         (wint_t wc)
31105436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
31205436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
31305436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
31405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
31505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# elif @GNULIB_ISWBLANK@ && (! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@)
31605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Only the iswblank function is missing.  */
31705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
31805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if @REPLACE_ISWBLANK@
31905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
32005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#    define iswblank rpl_iswblank
32105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   endif
32205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc));
32305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  else
32405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
32505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
32605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
32705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
32805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
32905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if defined __MINGW32__
33005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
33105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t.
33205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The functions towlower and towupper are implemented in the MSVCRT library
33305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   to take a wchar_t argument and return a wchar_t result.  mingw declares
33405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   these functions to take a wint_t argument and return a wint_t result.
33505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This means that:
33605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   1. When the user passes an argument outside the range 0x0000..0xFFFF, the
33705436638acc7c010349a69c3395f1a57c642dc62Ying Wang      function will look only at the lower 16 bits.  This is allowed according
33805436638acc7c010349a69c3395f1a57c642dc62Ying Wang      to POSIX.
33905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   2. The return value is returned in the lower 16 bits of the result register.
34005436638acc7c010349a69c3395f1a57c642dc62Ying Wang      The upper 16 bits are random: whatever happened to be in that part of the
34105436638acc7c010349a69c3395f1a57c642dc62Ying Wang      result register.  We need to fix this by adding a zero-extend from
34205436638acc7c010349a69c3395f1a57c642dc62Ying Wang      wchar_t to wint_t after the call.  */
34305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
34405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE wint_t
34505436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_towlower (wint_t wc)
34605436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
34705436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return (wint_t) (wchar_t) towlower (wc);
34805436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
34905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
35005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define towlower rpl_towlower
35105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
35205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
35305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WCTYPE_INLINE wint_t
35405436638acc7c010349a69c3395f1a57c642dc62Ying Wangrpl_towupper (wint_t wc)
35505436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
35605436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return (wint_t) (wchar_t) towupper (wc);
35705436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
35805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
35905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define towupper rpl_towupper
36005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
36105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
36205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif /* __MINGW32__ */
36305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
36405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define GNULIB_defined_wctype_functions 1
36505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
36605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
36705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if @REPLACE_ISWCNTRL@
36805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc));
36905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc));
37005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc));
37105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc));
37205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc));
37305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (iswlower, int, (wint_t wc));
37405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (iswprint, int, (wint_t wc));
37505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc));
37605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (iswspace, int, (wint_t wc));
37705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (iswupper, int, (wint_t wc));
37805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc));
37905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
38005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
38105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
38205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc));
38305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc));
38405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc));
38505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (iswlower, int, (wint_t wc));
38605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (iswprint, int, (wint_t wc));
38705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc));
38805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (iswspace, int, (wint_t wc));
38905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (iswupper, int, (wint_t wc));
39005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc));
39105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
39205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (iswalnum);
39305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (iswalpha);
39405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (iswcntrl);
39505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (iswdigit);
39605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (iswgraph);
39705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (iswlower);
39805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (iswprint);
39905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (iswpunct);
40005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (iswspace);
40105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (iswupper);
40205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (iswxdigit);
40305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
40405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if @GNULIB_ISWBLANK@
40505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if @REPLACE_ISWCNTRL@ || @REPLACE_ISWBLANK@
40605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
40705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
40805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
40905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
41005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (iswblank);
41105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
41205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
41305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if !@HAVE_WCTYPE_T@
41405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !GNULIB_defined_wctype_t
41505436638acc7c010349a69c3395f1a57c642dc62Ying Wangtypedef void * wctype_t;
41605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define GNULIB_defined_wctype_t 1
41705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
41805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
41905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
42005436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Get a descriptor for a wide character property.  */
42105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if @GNULIB_WCTYPE@
42205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !@HAVE_WCTYPE_T@
42305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name));
42405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
42505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
42605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wctype);
42705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
42805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wctype
42905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCTYPE
43005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wctype, "wctype is unportable - "
43105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wctype for portability");
43205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
43305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
43405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
43505436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Test whether a wide character has a given property.
43605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The argument WC must be either a wchar_t value or WEOF.
43705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The argument DESC must have been returned by the wctype() function.  */
43805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if @GNULIB_ISWCTYPE@
43905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !@HAVE_WCTYPE_T@
44005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc));
44105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
44205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
44305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (iswctype);
44405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
44505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef iswctype
44605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_ISWCTYPE
44705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (iswctype, "iswctype is unportable - "
44805436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module iswctype for portability");
44905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
45005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
45105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
45205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if @REPLACE_TOWLOWER@ || defined __MINGW32__
45305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc));
45405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
45505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
45605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc));
45705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc));
45805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
45905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (towlower);
46005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (towupper);
46105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
46205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if !@HAVE_WCTRANS_T@
46305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !GNULIB_defined_wctrans_t
46405436638acc7c010349a69c3395f1a57c642dc62Ying Wangtypedef void * wctrans_t;
46505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define GNULIB_defined_wctrans_t 1
46605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
46705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
46805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
46905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Get a descriptor for a wide character case conversion.  */
47005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if @GNULIB_WCTRANS@
47105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !@HAVE_WCTRANS_T@
47205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name));
47305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
47405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
47505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wctrans);
47605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
47705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wctrans
47805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCTRANS
47905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wctrans, "wctrans is unportable - "
48005436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wctrans for portability");
48105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
48205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
48305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
48405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Perform a given case conversion on a wide character.
48505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The argument WC must be either a wchar_t value or WEOF.
48605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The argument DESC must have been returned by the wctrans() function.  */
48705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if @GNULIB_TOWCTRANS@
48805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !@HAVE_WCTRANS_T@
48905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
49005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
49105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
49205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (towctrans);
49305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
49405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef towctrans
49505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_TOWCTRANS
49605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (towctrans, "towctrans is unportable - "
49705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module towctrans for portability");
49805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
49905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
50005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
50105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_INLINE_HEADER_END
50205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
50305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif /* _@GUARD_PREFIX@_WCTYPE_H */
50405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif /* _@GUARD_PREFIX@_WCTYPE_H */
505