Home | History | Annotate | Line # | Download | only in import
wchar.in.h revision 1.1
      1  1.1  christos /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
      2  1.1  christos 
      3  1.1  christos    Copyright (C) 2007-2020 Free Software Foundation, Inc.
      4  1.1  christos 
      5  1.1  christos    This program is free software; you can redistribute it and/or modify
      6  1.1  christos    it under the terms of the GNU General Public License as published by
      7  1.1  christos    the Free Software Foundation; either version 3, or (at your option)
      8  1.1  christos    any later version.
      9  1.1  christos 
     10  1.1  christos    This program is distributed in the hope that it will be useful,
     11  1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13  1.1  christos    GNU General Public License for more details.
     14  1.1  christos 
     15  1.1  christos    You should have received a copy of the GNU General Public License
     16  1.1  christos    along with this program; if not, see <https://www.gnu.org/licenses/>.  */
     17  1.1  christos 
     18  1.1  christos /* Written by Eric Blake.  */
     19  1.1  christos 
     20  1.1  christos /*
     21  1.1  christos  * ISO C 99 <wchar.h> for platforms that have issues.
     22  1.1  christos  * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html>
     23  1.1  christos  *
     24  1.1  christos  * For now, this just ensures proper prerequisite inclusion order and
     25  1.1  christos  * the declaration of wcwidth().
     26  1.1  christos  */
     27  1.1  christos 
     28  1.1  christos #if __GNUC__ >= 3
     29  1.1  christos @PRAGMA_SYSTEM_HEADER@
     30  1.1  christos #endif
     31  1.1  christos @PRAGMA_COLUMNS@
     32  1.1  christos 
     33  1.1  christos #if (((defined __need_mbstate_t || defined __need_wint_t)               \
     34  1.1  christos       && !defined __MINGW32__)                                          \
     35  1.1  christos      || (defined __hpux                                                 \
     36  1.1  christos          && ((defined _INTTYPES_INCLUDED                                \
     37  1.1  christos               && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H)     \
     38  1.1  christos              || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H))               \
     39  1.1  christos      || (defined __MINGW32__ && defined __STRING_H_SOURCED__)           \
     40  1.1  christos      || defined _GL_ALREADY_INCLUDING_WCHAR_H)
     41  1.1  christos /* Special invocation convention:
     42  1.1  christos    - Inside glibc and uClibc header files, but not MinGW.
     43  1.1  christos    - On HP-UX 11.00 we have a sequence of nested includes
     44  1.1  christos      <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
     45  1.1  christos      once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
     46  1.1  christos      and once directly.  In both situations 'wint_t' is not yet defined,
     47  1.1  christos      therefore we cannot provide the function overrides; instead include only
     48  1.1  christos      the system's <wchar.h>.
     49  1.1  christos    - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of
     50  1.1  christos      <wchar.h> is actually processed, and that doesn't include 'mbstate_t'.
     51  1.1  christos    - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
     52  1.1  christos      the latter includes <wchar.h>.  But here, we have no way to detect whether
     53  1.1  christos      <wctype.h> is completely included or is still being included.  */
     54  1.1  christos 
     55  1.1  christos #@INCLUDE_NEXT@ @NEXT_WCHAR_H@
     56  1.1  christos 
     57  1.1  christos #else
     58  1.1  christos /* Normal invocation convention.  */
     59  1.1  christos 
     60  1.1  christos #ifndef _@GUARD_PREFIX@_WCHAR_H
     61  1.1  christos 
     62  1.1  christos #define _GL_ALREADY_INCLUDING_WCHAR_H
     63  1.1  christos 
     64  1.1  christos #if @HAVE_FEATURES_H@
     65  1.1  christos # include <features.h> /* for __GLIBC__ */
     66  1.1  christos #endif
     67  1.1  christos 
     68  1.1  christos /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
     69  1.1  christos    <wchar.h>.
     70  1.1  christos    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
     71  1.1  christos    included before <wchar.h>.
     72  1.1  christos    In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
     73  1.1  christos    by <stddef.h>.
     74  1.1  christos    But avoid namespace pollution on glibc systems.  */
     75  1.1  christos #if !(defined __GLIBC__ && !defined __UCLIBC__)
     76  1.1  christos # include <stddef.h>
     77  1.1  christos #endif
     78  1.1  christos #ifndef __GLIBC__
     79  1.1  christos # include <stdio.h>
     80  1.1  christos # include <time.h>
     81  1.1  christos #endif
     82  1.1  christos 
     83  1.1  christos /* Include the original <wchar.h> if it exists.
     84  1.1  christos    Some builds of uClibc lack it.  */
     85  1.1  christos /* The include_next requires a split double-inclusion guard.  */
     86  1.1  christos #if @HAVE_WCHAR_H@
     87  1.1  christos # @INCLUDE_NEXT@ @NEXT_WCHAR_H@
     88  1.1  christos #endif
     89  1.1  christos 
     90  1.1  christos #undef _GL_ALREADY_INCLUDING_WCHAR_H
     91  1.1  christos 
     92  1.1  christos #ifndef _@GUARD_PREFIX@_WCHAR_H
     93  1.1  christos #define _@GUARD_PREFIX@_WCHAR_H
     94  1.1  christos 
     95  1.1  christos /* The __attribute__ feature is available in gcc versions 2.5 and later.
     96  1.1  christos    The attribute __pure__ was added in gcc 2.96.  */
     97  1.1  christos #ifndef _GL_ATTRIBUTE_PURE
     98  1.1  christos # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
     99  1.1  christos #  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
    100  1.1  christos # else
    101  1.1  christos #  define _GL_ATTRIBUTE_PURE /* empty */
    102  1.1  christos # endif
    103  1.1  christos #endif
    104  1.1  christos 
    105  1.1  christos /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
    106  1.1  christos 
    107  1.1  christos /* The definition of _GL_ARG_NONNULL is copied here.  */
    108  1.1  christos 
    109  1.1  christos /* The definition of _GL_WARN_ON_USE is copied here.  */
    110  1.1  christos 
    111  1.1  christos 
    112  1.1  christos /* Define wint_t and WEOF.  (Also done in wctype.in.h.)  */
    113  1.1  christos #if !@HAVE_WINT_T@ && !defined wint_t
    114  1.1  christos # define wint_t int
    115  1.1  christos # ifndef WEOF
    116  1.1  christos #  define WEOF -1
    117  1.1  christos # endif
    118  1.1  christos #else
    119  1.1  christos /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
    120  1.1  christos    <stddef.h>.  This is too small: ISO C 99 section 7.24.1.(2) says that
    121  1.1  christos    wint_t must be "unchanged by default argument promotions".  Override it.  */
    122  1.1  christos # if @GNULIB_OVERRIDES_WINT_T@
    123  1.1  christos #  if !GNULIB_defined_wint_t
    124  1.1  christos #   if @HAVE_CRTDEFS_H@
    125  1.1  christos #    include <crtdefs.h>
    126  1.1  christos #   else
    127  1.1  christos #    include <stddef.h>
    128  1.1  christos #   endif
    129  1.1  christos typedef unsigned int rpl_wint_t;
    130  1.1  christos #   undef wint_t
    131  1.1  christos #   define wint_t rpl_wint_t
    132  1.1  christos #   define GNULIB_defined_wint_t 1
    133  1.1  christos #  endif
    134  1.1  christos # endif
    135  1.1  christos # ifndef WEOF
    136  1.1  christos #  define WEOF ((wint_t) -1)
    137  1.1  christos # endif
    138  1.1  christos #endif
    139  1.1  christos 
    140  1.1  christos 
    141  1.1  christos /* Override mbstate_t if it is too small.
    142  1.1  christos    On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
    143  1.1  christos    implementing mbrtowc for encodings like UTF-8.
    144  1.1  christos    On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is
    145  1.1  christos    large enough and overriding it would cause problems in C++ mode.  */
    146  1.1  christos #if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
    147  1.1  christos # if !GNULIB_defined_mbstate_t
    148  1.1  christos #  if !(defined _AIX || defined _MSC_VER)
    149  1.1  christos typedef int rpl_mbstate_t;
    150  1.1  christos #   undef mbstate_t
    151  1.1  christos #   define mbstate_t rpl_mbstate_t
    152  1.1  christos #  endif
    153  1.1  christos #  define GNULIB_defined_mbstate_t 1
    154  1.1  christos # endif
    155  1.1  christos #endif
    156  1.1  christos 
    157  1.1  christos 
    158  1.1  christos /* Convert a single-byte character to a wide character.  */
    159  1.1  christos #if @GNULIB_BTOWC@
    160  1.1  christos # if @REPLACE_BTOWC@
    161  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    162  1.1  christos #   undef btowc
    163  1.1  christos #   define btowc rpl_btowc
    164  1.1  christos #  endif
    165  1.1  christos _GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
    166  1.1  christos _GL_CXXALIAS_RPL (btowc, wint_t, (int c));
    167  1.1  christos # else
    168  1.1  christos #  if !@HAVE_BTOWC@
    169  1.1  christos _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
    170  1.1  christos #  endif
    171  1.1  christos /* Need to cast, because on mingw, the return type is 'unsigned short'.  */
    172  1.1  christos _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
    173  1.1  christos # endif
    174  1.1  christos # if __GLIBC__ >= 2
    175  1.1  christos _GL_CXXALIASWARN (btowc);
    176  1.1  christos # endif
    177  1.1  christos #elif defined GNULIB_POSIXCHECK
    178  1.1  christos # undef btowc
    179  1.1  christos # if HAVE_RAW_DECL_BTOWC
    180  1.1  christos _GL_WARN_ON_USE (btowc, "btowc is unportable - "
    181  1.1  christos                  "use gnulib module btowc for portability");
    182  1.1  christos # endif
    183  1.1  christos #endif
    184  1.1  christos 
    185  1.1  christos 
    186  1.1  christos /* Convert a wide character to a single-byte character.  */
    187  1.1  christos #if @GNULIB_WCTOB@
    188  1.1  christos # if @REPLACE_WCTOB@
    189  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    190  1.1  christos #   undef wctob
    191  1.1  christos #   define wctob rpl_wctob
    192  1.1  christos #  endif
    193  1.1  christos _GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
    194  1.1  christos _GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
    195  1.1  christos # else
    196  1.1  christos #  if !defined wctob && !@HAVE_DECL_WCTOB@
    197  1.1  christos /* wctob is provided by gnulib, or wctob exists but is not declared.  */
    198  1.1  christos _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
    199  1.1  christos #  endif
    200  1.1  christos _GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
    201  1.1  christos # endif
    202  1.1  christos # if __GLIBC__ >= 2
    203  1.1  christos _GL_CXXALIASWARN (wctob);
    204  1.1  christos # endif
    205  1.1  christos #elif defined GNULIB_POSIXCHECK
    206  1.1  christos # undef wctob
    207  1.1  christos # if HAVE_RAW_DECL_WCTOB
    208  1.1  christos _GL_WARN_ON_USE (wctob, "wctob is unportable - "
    209  1.1  christos                  "use gnulib module wctob for portability");
    210  1.1  christos # endif
    211  1.1  christos #endif
    212  1.1  christos 
    213  1.1  christos 
    214  1.1  christos /* Test whether *PS is in the initial state.  */
    215  1.1  christos #if @GNULIB_MBSINIT@
    216  1.1  christos # if @REPLACE_MBSINIT@
    217  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    218  1.1  christos #   undef mbsinit
    219  1.1  christos #   define mbsinit rpl_mbsinit
    220  1.1  christos #  endif
    221  1.1  christos _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
    222  1.1  christos _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
    223  1.1  christos # else
    224  1.1  christos #  if !@HAVE_MBSINIT@
    225  1.1  christos _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
    226  1.1  christos #  endif
    227  1.1  christos _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
    228  1.1  christos # endif
    229  1.1  christos # if __GLIBC__ >= 2
    230  1.1  christos _GL_CXXALIASWARN (mbsinit);
    231  1.1  christos # endif
    232  1.1  christos #elif defined GNULIB_POSIXCHECK
    233  1.1  christos # undef mbsinit
    234  1.1  christos # if HAVE_RAW_DECL_MBSINIT
    235  1.1  christos _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
    236  1.1  christos                  "use gnulib module mbsinit for portability");
    237  1.1  christos # endif
    238  1.1  christos #endif
    239  1.1  christos 
    240  1.1  christos 
    241  1.1  christos /* Convert a multibyte character to a wide character.  */
    242  1.1  christos #if @GNULIB_MBRTOWC@
    243  1.1  christos # if @REPLACE_MBRTOWC@
    244  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    245  1.1  christos #   undef mbrtowc
    246  1.1  christos #   define mbrtowc rpl_mbrtowc
    247  1.1  christos #  endif
    248  1.1  christos _GL_FUNCDECL_RPL (mbrtowc, size_t,
    249  1.1  christos                   (wchar_t *restrict pwc, const char *restrict s, size_t n,
    250  1.1  christos                    mbstate_t *restrict ps));
    251  1.1  christos _GL_CXXALIAS_RPL (mbrtowc, size_t,
    252  1.1  christos                   (wchar_t *restrict pwc, const char *restrict s, size_t n,
    253  1.1  christos                    mbstate_t *restrict ps));
    254  1.1  christos # else
    255  1.1  christos #  if !@HAVE_MBRTOWC@
    256  1.1  christos _GL_FUNCDECL_SYS (mbrtowc, size_t,
    257  1.1  christos                   (wchar_t *restrict pwc, const char *restrict s, size_t n,
    258  1.1  christos                    mbstate_t *restrict ps));
    259  1.1  christos #  endif
    260  1.1  christos _GL_CXXALIAS_SYS (mbrtowc, size_t,
    261  1.1  christos                   (wchar_t *restrict pwc, const char *restrict s, size_t n,
    262  1.1  christos                    mbstate_t *restrict ps));
    263  1.1  christos # endif
    264  1.1  christos # if __GLIBC__ >= 2
    265  1.1  christos _GL_CXXALIASWARN (mbrtowc);
    266  1.1  christos # endif
    267  1.1  christos #elif defined GNULIB_POSIXCHECK
    268  1.1  christos # undef mbrtowc
    269  1.1  christos # if HAVE_RAW_DECL_MBRTOWC
    270  1.1  christos _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
    271  1.1  christos                  "use gnulib module mbrtowc for portability");
    272  1.1  christos # endif
    273  1.1  christos #endif
    274  1.1  christos 
    275  1.1  christos 
    276  1.1  christos /* Recognize a multibyte character.  */
    277  1.1  christos #if @GNULIB_MBRLEN@
    278  1.1  christos # if @REPLACE_MBRLEN@
    279  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    280  1.1  christos #   undef mbrlen
    281  1.1  christos #   define mbrlen rpl_mbrlen
    282  1.1  christos #  endif
    283  1.1  christos _GL_FUNCDECL_RPL (mbrlen, size_t,
    284  1.1  christos                   (const char *restrict s, size_t n, mbstate_t *restrict ps));
    285  1.1  christos _GL_CXXALIAS_RPL (mbrlen, size_t,
    286  1.1  christos                   (const char *restrict s, size_t n, mbstate_t *restrict ps));
    287  1.1  christos # else
    288  1.1  christos #  if !@HAVE_MBRLEN@
    289  1.1  christos _GL_FUNCDECL_SYS (mbrlen, size_t,
    290  1.1  christos                   (const char *restrict s, size_t n, mbstate_t *restrict ps));
    291  1.1  christos #  endif
    292  1.1  christos _GL_CXXALIAS_SYS (mbrlen, size_t,
    293  1.1  christos                   (const char *restrict s, size_t n, mbstate_t *restrict ps));
    294  1.1  christos # endif
    295  1.1  christos # if __GLIBC__ >= 2
    296  1.1  christos _GL_CXXALIASWARN (mbrlen);
    297  1.1  christos # endif
    298  1.1  christos #elif defined GNULIB_POSIXCHECK
    299  1.1  christos # undef mbrlen
    300  1.1  christos # if HAVE_RAW_DECL_MBRLEN
    301  1.1  christos _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
    302  1.1  christos                  "use gnulib module mbrlen for portability");
    303  1.1  christos # endif
    304  1.1  christos #endif
    305  1.1  christos 
    306  1.1  christos 
    307  1.1  christos /* Convert a string to a wide string.  */
    308  1.1  christos #if @GNULIB_MBSRTOWCS@
    309  1.1  christos # if @REPLACE_MBSRTOWCS@
    310  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    311  1.1  christos #   undef mbsrtowcs
    312  1.1  christos #   define mbsrtowcs rpl_mbsrtowcs
    313  1.1  christos #  endif
    314  1.1  christos _GL_FUNCDECL_RPL (mbsrtowcs, size_t,
    315  1.1  christos                   (wchar_t *restrict dest,
    316  1.1  christos                    const char **restrict srcp, size_t len,
    317  1.1  christos                    mbstate_t *restrict ps)
    318  1.1  christos                   _GL_ARG_NONNULL ((2)));
    319  1.1  christos _GL_CXXALIAS_RPL (mbsrtowcs, size_t,
    320  1.1  christos                   (wchar_t *restrict dest,
    321  1.1  christos                    const char **restrict srcp, size_t len,
    322  1.1  christos                    mbstate_t *restrict ps));
    323  1.1  christos # else
    324  1.1  christos #  if !@HAVE_MBSRTOWCS@
    325  1.1  christos _GL_FUNCDECL_SYS (mbsrtowcs, size_t,
    326  1.1  christos                   (wchar_t *restrict dest,
    327  1.1  christos                    const char **restrict srcp, size_t len,
    328  1.1  christos                    mbstate_t *restrict ps)
    329  1.1  christos                   _GL_ARG_NONNULL ((2)));
    330  1.1  christos #  endif
    331  1.1  christos _GL_CXXALIAS_SYS (mbsrtowcs, size_t,
    332  1.1  christos                   (wchar_t *restrict dest,
    333  1.1  christos                    const char **restrict srcp, size_t len,
    334  1.1  christos                    mbstate_t *restrict ps));
    335  1.1  christos # endif
    336  1.1  christos # if __GLIBC__ >= 2
    337  1.1  christos _GL_CXXALIASWARN (mbsrtowcs);
    338  1.1  christos # endif
    339  1.1  christos #elif defined GNULIB_POSIXCHECK
    340  1.1  christos # undef mbsrtowcs
    341  1.1  christos # if HAVE_RAW_DECL_MBSRTOWCS
    342  1.1  christos _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
    343  1.1  christos                  "use gnulib module mbsrtowcs for portability");
    344  1.1  christos # endif
    345  1.1  christos #endif
    346  1.1  christos 
    347  1.1  christos 
    348  1.1  christos /* Convert a string to a wide string.  */
    349  1.1  christos #if @GNULIB_MBSNRTOWCS@
    350  1.1  christos # if @REPLACE_MBSNRTOWCS@
    351  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    352  1.1  christos #   undef mbsnrtowcs
    353  1.1  christos #   define mbsnrtowcs rpl_mbsnrtowcs
    354  1.1  christos #  endif
    355  1.1  christos _GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
    356  1.1  christos                   (wchar_t *restrict dest,
    357  1.1  christos                    const char **restrict srcp, size_t srclen, size_t len,
    358  1.1  christos                    mbstate_t *restrict ps)
    359  1.1  christos                   _GL_ARG_NONNULL ((2)));
    360  1.1  christos _GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
    361  1.1  christos                   (wchar_t *restrict dest,
    362  1.1  christos                    const char **restrict srcp, size_t srclen, size_t len,
    363  1.1  christos                    mbstate_t *restrict ps));
    364  1.1  christos # else
    365  1.1  christos #  if !@HAVE_MBSNRTOWCS@
    366  1.1  christos _GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
    367  1.1  christos                   (wchar_t *restrict dest,
    368  1.1  christos                    const char **restrict srcp, size_t srclen, size_t len,
    369  1.1  christos                    mbstate_t *restrict ps)
    370  1.1  christos                   _GL_ARG_NONNULL ((2)));
    371  1.1  christos #  endif
    372  1.1  christos _GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
    373  1.1  christos                   (wchar_t *restrict dest,
    374  1.1  christos                    const char **restrict srcp, size_t srclen, size_t len,
    375  1.1  christos                    mbstate_t *restrict ps));
    376  1.1  christos # endif
    377  1.1  christos _GL_CXXALIASWARN (mbsnrtowcs);
    378  1.1  christos #elif defined GNULIB_POSIXCHECK
    379  1.1  christos # undef mbsnrtowcs
    380  1.1  christos # if HAVE_RAW_DECL_MBSNRTOWCS
    381  1.1  christos _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
    382  1.1  christos                  "use gnulib module mbsnrtowcs for portability");
    383  1.1  christos # endif
    384  1.1  christos #endif
    385  1.1  christos 
    386  1.1  christos 
    387  1.1  christos /* Convert a wide character to a multibyte character.  */
    388  1.1  christos #if @GNULIB_WCRTOMB@
    389  1.1  christos # if @REPLACE_WCRTOMB@
    390  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    391  1.1  christos #   undef wcrtomb
    392  1.1  christos #   define wcrtomb rpl_wcrtomb
    393  1.1  christos #  endif
    394  1.1  christos _GL_FUNCDECL_RPL (wcrtomb, size_t,
    395  1.1  christos                   (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
    396  1.1  christos _GL_CXXALIAS_RPL (wcrtomb, size_t,
    397  1.1  christos                   (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
    398  1.1  christos # else
    399  1.1  christos #  if !@HAVE_WCRTOMB@
    400  1.1  christos _GL_FUNCDECL_SYS (wcrtomb, size_t,
    401  1.1  christos                   (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
    402  1.1  christos #  endif
    403  1.1  christos _GL_CXXALIAS_SYS (wcrtomb, size_t,
    404  1.1  christos                   (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
    405  1.1  christos # endif
    406  1.1  christos # if __GLIBC__ >= 2
    407  1.1  christos _GL_CXXALIASWARN (wcrtomb);
    408  1.1  christos # endif
    409  1.1  christos #elif defined GNULIB_POSIXCHECK
    410  1.1  christos # undef wcrtomb
    411  1.1  christos # if HAVE_RAW_DECL_WCRTOMB
    412  1.1  christos _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
    413  1.1  christos                  "use gnulib module wcrtomb for portability");
    414  1.1  christos # endif
    415  1.1  christos #endif
    416  1.1  christos 
    417  1.1  christos 
    418  1.1  christos /* Convert a wide string to a string.  */
    419  1.1  christos #if @GNULIB_WCSRTOMBS@
    420  1.1  christos # if @REPLACE_WCSRTOMBS@
    421  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    422  1.1  christos #   undef wcsrtombs
    423  1.1  christos #   define wcsrtombs rpl_wcsrtombs
    424  1.1  christos #  endif
    425  1.1  christos _GL_FUNCDECL_RPL (wcsrtombs, size_t,
    426  1.1  christos                   (char *restrict dest, const wchar_t **restrict srcp,
    427  1.1  christos                    size_t len,
    428  1.1  christos                    mbstate_t *restrict ps)
    429  1.1  christos                   _GL_ARG_NONNULL ((2)));
    430  1.1  christos _GL_CXXALIAS_RPL (wcsrtombs, size_t,
    431  1.1  christos                   (char *restrict dest, const wchar_t **restrict srcp,
    432  1.1  christos                    size_t len,
    433  1.1  christos                    mbstate_t *restrict ps));
    434  1.1  christos # else
    435  1.1  christos #  if !@HAVE_WCSRTOMBS@
    436  1.1  christos _GL_FUNCDECL_SYS (wcsrtombs, size_t,
    437  1.1  christos                   (char *restrict dest, const wchar_t **restrict srcp,
    438  1.1  christos                    size_t len,
    439  1.1  christos                    mbstate_t *restrict ps)
    440  1.1  christos                   _GL_ARG_NONNULL ((2)));
    441  1.1  christos #  endif
    442  1.1  christos _GL_CXXALIAS_SYS (wcsrtombs, size_t,
    443  1.1  christos                   (char *restrict dest, const wchar_t **restrict srcp,
    444  1.1  christos                    size_t len,
    445  1.1  christos                    mbstate_t *restrict ps));
    446  1.1  christos # endif
    447  1.1  christos # if __GLIBC__ >= 2
    448  1.1  christos _GL_CXXALIASWARN (wcsrtombs);
    449  1.1  christos # endif
    450  1.1  christos #elif defined GNULIB_POSIXCHECK
    451  1.1  christos # undef wcsrtombs
    452  1.1  christos # if HAVE_RAW_DECL_WCSRTOMBS
    453  1.1  christos _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
    454  1.1  christos                  "use gnulib module wcsrtombs for portability");
    455  1.1  christos # endif
    456  1.1  christos #endif
    457  1.1  christos 
    458  1.1  christos 
    459  1.1  christos /* Convert a wide string to a string.  */
    460  1.1  christos #if @GNULIB_WCSNRTOMBS@
    461  1.1  christos # if @REPLACE_WCSNRTOMBS@
    462  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    463  1.1  christos #   undef wcsnrtombs
    464  1.1  christos #   define wcsnrtombs rpl_wcsnrtombs
    465  1.1  christos #  endif
    466  1.1  christos _GL_FUNCDECL_RPL (wcsnrtombs, size_t,
    467  1.1  christos                   (char *restrict dest,
    468  1.1  christos                    const wchar_t **restrict srcp, size_t srclen,
    469  1.1  christos                    size_t len,
    470  1.1  christos                    mbstate_t *restrict ps)
    471  1.1  christos                   _GL_ARG_NONNULL ((2)));
    472  1.1  christos _GL_CXXALIAS_RPL (wcsnrtombs, size_t,
    473  1.1  christos                   (char *restrict dest,
    474  1.1  christos                    const wchar_t **restrict srcp, size_t srclen,
    475  1.1  christos                    size_t len,
    476  1.1  christos                    mbstate_t *restrict ps));
    477  1.1  christos # else
    478  1.1  christos #  if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun)
    479  1.1  christos _GL_FUNCDECL_SYS (wcsnrtombs, size_t,
    480  1.1  christos                   (char *restrict dest,
    481  1.1  christos                    const wchar_t **restrict srcp, size_t srclen,
    482  1.1  christos                    size_t len,
    483  1.1  christos                    mbstate_t *restrict ps)
    484  1.1  christos                   _GL_ARG_NONNULL ((2)));
    485  1.1  christos #  endif
    486  1.1  christos _GL_CXXALIAS_SYS (wcsnrtombs, size_t,
    487  1.1  christos                   (char *restrict dest,
    488  1.1  christos                    const wchar_t **restrict srcp, size_t srclen,
    489  1.1  christos                    size_t len,
    490  1.1  christos                    mbstate_t *restrict ps));
    491  1.1  christos # endif
    492  1.1  christos # if __GLIBC__ >= 2
    493  1.1  christos _GL_CXXALIASWARN (wcsnrtombs);
    494  1.1  christos # endif
    495  1.1  christos #elif defined GNULIB_POSIXCHECK
    496  1.1  christos # undef wcsnrtombs
    497  1.1  christos # if HAVE_RAW_DECL_WCSNRTOMBS
    498  1.1  christos _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
    499  1.1  christos                  "use gnulib module wcsnrtombs for portability");
    500  1.1  christos # endif
    501  1.1  christos #endif
    502  1.1  christos 
    503  1.1  christos 
    504  1.1  christos /* Return the number of screen columns needed for WC.  */
    505  1.1  christos #if @GNULIB_WCWIDTH@
    506  1.1  christos # if @REPLACE_WCWIDTH@
    507  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    508  1.1  christos #   undef wcwidth
    509  1.1  christos #   define wcwidth rpl_wcwidth
    510  1.1  christos #  endif
    511  1.1  christos _GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
    512  1.1  christos _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
    513  1.1  christos # else
    514  1.1  christos #  if !@HAVE_DECL_WCWIDTH@
    515  1.1  christos /* wcwidth exists but is not declared.  */
    516  1.1  christos _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
    517  1.1  christos #  endif
    518  1.1  christos _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
    519  1.1  christos # endif
    520  1.1  christos # if __GLIBC__ >= 2
    521  1.1  christos _GL_CXXALIASWARN (wcwidth);
    522  1.1  christos # endif
    523  1.1  christos #elif defined GNULIB_POSIXCHECK
    524  1.1  christos # undef wcwidth
    525  1.1  christos # if HAVE_RAW_DECL_WCWIDTH
    526  1.1  christos _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
    527  1.1  christos                  "use gnulib module wcwidth for portability");
    528  1.1  christos # endif
    529  1.1  christos #endif
    530  1.1  christos 
    531  1.1  christos 
    532  1.1  christos /* Search N wide characters of S for C.  */
    533  1.1  christos #if @GNULIB_WMEMCHR@
    534  1.1  christos # if !@HAVE_WMEMCHR@
    535  1.1  christos _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
    536  1.1  christos                                       _GL_ATTRIBUTE_PURE);
    537  1.1  christos # endif
    538  1.1  christos   /* On some systems, this function is defined as an overloaded function:
    539  1.1  christos        extern "C++" {
    540  1.1  christos          const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
    541  1.1  christos          wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
    542  1.1  christos        }  */
    543  1.1  christos _GL_CXXALIAS_SYS_CAST2 (wmemchr,
    544  1.1  christos                         wchar_t *, (const wchar_t *, wchar_t, size_t),
    545  1.1  christos                         const wchar_t *, (const wchar_t *, wchar_t, size_t));
    546  1.1  christos # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
    547  1.1  christos      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
    548  1.1  christos _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
    549  1.1  christos _GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
    550  1.1  christos                    (const wchar_t *s, wchar_t c, size_t n));
    551  1.1  christos # elif __GLIBC__ >= 2
    552  1.1  christos _GL_CXXALIASWARN (wmemchr);
    553  1.1  christos # endif
    554  1.1  christos #elif defined GNULIB_POSIXCHECK
    555  1.1  christos # undef wmemchr
    556  1.1  christos # if HAVE_RAW_DECL_WMEMCHR
    557  1.1  christos _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
    558  1.1  christos                  "use gnulib module wmemchr for portability");
    559  1.1  christos # endif
    560  1.1  christos #endif
    561  1.1  christos 
    562  1.1  christos 
    563  1.1  christos /* Compare N wide characters of S1 and S2.  */
    564  1.1  christos #if @GNULIB_WMEMCMP@
    565  1.1  christos # if !@HAVE_WMEMCMP@
    566  1.1  christos _GL_FUNCDECL_SYS (wmemcmp, int,
    567  1.1  christos                   (const wchar_t *s1, const wchar_t *s2, size_t n)
    568  1.1  christos                   _GL_ATTRIBUTE_PURE);
    569  1.1  christos # endif
    570  1.1  christos _GL_CXXALIAS_SYS (wmemcmp, int,
    571  1.1  christos                   (const wchar_t *s1, const wchar_t *s2, size_t n));
    572  1.1  christos # if __GLIBC__ >= 2
    573  1.1  christos _GL_CXXALIASWARN (wmemcmp);
    574  1.1  christos # endif
    575  1.1  christos #elif defined GNULIB_POSIXCHECK
    576  1.1  christos # undef wmemcmp
    577  1.1  christos # if HAVE_RAW_DECL_WMEMCMP
    578  1.1  christos _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
    579  1.1  christos                  "use gnulib module wmemcmp for portability");
    580  1.1  christos # endif
    581  1.1  christos #endif
    582  1.1  christos 
    583  1.1  christos 
    584  1.1  christos /* Copy N wide characters of SRC to DEST.  */
    585  1.1  christos #if @GNULIB_WMEMCPY@
    586  1.1  christos # if !@HAVE_WMEMCPY@
    587  1.1  christos _GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
    588  1.1  christos                   (wchar_t *restrict dest,
    589  1.1  christos                    const wchar_t *restrict src, size_t n));
    590  1.1  christos # endif
    591  1.1  christos _GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
    592  1.1  christos                   (wchar_t *restrict dest,
    593  1.1  christos                    const wchar_t *restrict src, size_t n));
    594  1.1  christos # if __GLIBC__ >= 2
    595  1.1  christos _GL_CXXALIASWARN (wmemcpy);
    596  1.1  christos # endif
    597  1.1  christos #elif defined GNULIB_POSIXCHECK
    598  1.1  christos # undef wmemcpy
    599  1.1  christos # if HAVE_RAW_DECL_WMEMCPY
    600  1.1  christos _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
    601  1.1  christos                  "use gnulib module wmemcpy for portability");
    602  1.1  christos # endif
    603  1.1  christos #endif
    604  1.1  christos 
    605  1.1  christos 
    606  1.1  christos /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
    607  1.1  christos    overlapping memory areas.  */
    608  1.1  christos #if @GNULIB_WMEMMOVE@
    609  1.1  christos # if !@HAVE_WMEMMOVE@
    610  1.1  christos _GL_FUNCDECL_SYS (wmemmove, wchar_t *,
    611  1.1  christos                   (wchar_t *dest, const wchar_t *src, size_t n));
    612  1.1  christos # endif
    613  1.1  christos _GL_CXXALIAS_SYS (wmemmove, wchar_t *,
    614  1.1  christos                   (wchar_t *dest, const wchar_t *src, size_t n));
    615  1.1  christos # if __GLIBC__ >= 2
    616  1.1  christos _GL_CXXALIASWARN (wmemmove);
    617  1.1  christos # endif
    618  1.1  christos #elif defined GNULIB_POSIXCHECK
    619  1.1  christos # undef wmemmove
    620  1.1  christos # if HAVE_RAW_DECL_WMEMMOVE
    621  1.1  christos _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
    622  1.1  christos                  "use gnulib module wmemmove for portability");
    623  1.1  christos # endif
    624  1.1  christos #endif
    625  1.1  christos 
    626  1.1  christos 
    627  1.1  christos /* Copy N wide characters of SRC to DEST.
    628  1.1  christos    Return pointer to wide characters after the last written wide character.  */
    629  1.1  christos #if @GNULIB_WMEMPCPY@
    630  1.1  christos # if !@HAVE_WMEMPCPY@
    631  1.1  christos _GL_FUNCDECL_SYS (wmempcpy, wchar_t *,
    632  1.1  christos                   (wchar_t *restrict dest,
    633  1.1  christos                    const wchar_t *restrict src, size_t n));
    634  1.1  christos # endif
    635  1.1  christos _GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
    636  1.1  christos                   (wchar_t *restrict dest,
    637  1.1  christos                    const wchar_t *restrict src, size_t n));
    638  1.1  christos # if __GLIBC__ >= 2
    639  1.1  christos _GL_CXXALIASWARN (wmempcpy);
    640  1.1  christos # endif
    641  1.1  christos #elif defined GNULIB_POSIXCHECK
    642  1.1  christos # undef wmempcpy
    643  1.1  christos # if HAVE_RAW_DECL_WMEMPCPY
    644  1.1  christos _GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
    645  1.1  christos                  "use gnulib module wmempcpy for portability");
    646  1.1  christos # endif
    647  1.1  christos #endif
    648  1.1  christos 
    649  1.1  christos 
    650  1.1  christos /* Set N wide characters of S to C.  */
    651  1.1  christos #if @GNULIB_WMEMSET@
    652  1.1  christos # if !@HAVE_WMEMSET@
    653  1.1  christos _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
    654  1.1  christos # endif
    655  1.1  christos _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
    656  1.1  christos # if __GLIBC__ >= 2
    657  1.1  christos _GL_CXXALIASWARN (wmemset);
    658  1.1  christos # endif
    659  1.1  christos #elif defined GNULIB_POSIXCHECK
    660  1.1  christos # undef wmemset
    661  1.1  christos # if HAVE_RAW_DECL_WMEMSET
    662  1.1  christos _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
    663  1.1  christos                  "use gnulib module wmemset for portability");
    664  1.1  christos # endif
    665  1.1  christos #endif
    666  1.1  christos 
    667  1.1  christos 
    668  1.1  christos /* Return the number of wide characters in S.  */
    669  1.1  christos #if @GNULIB_WCSLEN@
    670  1.1  christos # if !@HAVE_WCSLEN@
    671  1.1  christos _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
    672  1.1  christos # endif
    673  1.1  christos _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
    674  1.1  christos # if __GLIBC__ >= 2
    675  1.1  christos _GL_CXXALIASWARN (wcslen);
    676  1.1  christos # endif
    677  1.1  christos #elif defined GNULIB_POSIXCHECK
    678  1.1  christos # undef wcslen
    679  1.1  christos # if HAVE_RAW_DECL_WCSLEN
    680  1.1  christos _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
    681  1.1  christos                  "use gnulib module wcslen for portability");
    682  1.1  christos # endif
    683  1.1  christos #endif
    684  1.1  christos 
    685  1.1  christos 
    686  1.1  christos /* Return the number of wide characters in S, but at most MAXLEN.  */
    687  1.1  christos #if @GNULIB_WCSNLEN@
    688  1.1  christos # if !@HAVE_WCSNLEN@
    689  1.1  christos _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)
    690  1.1  christos                                    _GL_ATTRIBUTE_PURE);
    691  1.1  christos # endif
    692  1.1  christos _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
    693  1.1  christos _GL_CXXALIASWARN (wcsnlen);
    694  1.1  christos #elif defined GNULIB_POSIXCHECK
    695  1.1  christos # undef wcsnlen
    696  1.1  christos # if HAVE_RAW_DECL_WCSNLEN
    697  1.1  christos _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
    698  1.1  christos                  "use gnulib module wcsnlen for portability");
    699  1.1  christos # endif
    700  1.1  christos #endif
    701  1.1  christos 
    702  1.1  christos 
    703  1.1  christos /* Copy SRC to DEST.  */
    704  1.1  christos #if @GNULIB_WCSCPY@
    705  1.1  christos # if !@HAVE_WCSCPY@
    706  1.1  christos _GL_FUNCDECL_SYS (wcscpy, wchar_t *,
    707  1.1  christos                   (wchar_t *restrict dest, const wchar_t *restrict src));
    708  1.1  christos # endif
    709  1.1  christos _GL_CXXALIAS_SYS (wcscpy, wchar_t *,
    710  1.1  christos                   (wchar_t *restrict dest, const wchar_t *restrict src));
    711  1.1  christos # if __GLIBC__ >= 2
    712  1.1  christos _GL_CXXALIASWARN (wcscpy);
    713  1.1  christos # endif
    714  1.1  christos #elif defined GNULIB_POSIXCHECK
    715  1.1  christos # undef wcscpy
    716  1.1  christos # if HAVE_RAW_DECL_WCSCPY
    717  1.1  christos _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
    718  1.1  christos                  "use gnulib module wcscpy for portability");
    719  1.1  christos # endif
    720  1.1  christos #endif
    721  1.1  christos 
    722  1.1  christos 
    723  1.1  christos /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST.  */
    724  1.1  christos #if @GNULIB_WCPCPY@
    725  1.1  christos # if !@HAVE_WCPCPY@
    726  1.1  christos _GL_FUNCDECL_SYS (wcpcpy, wchar_t *,
    727  1.1  christos                   (wchar_t *restrict dest, const wchar_t *restrict src));
    728  1.1  christos # endif
    729  1.1  christos _GL_CXXALIAS_SYS (wcpcpy, wchar_t *,
    730  1.1  christos                   (wchar_t *restrict dest, const wchar_t *restrict src));
    731  1.1  christos _GL_CXXALIASWARN (wcpcpy);
    732  1.1  christos #elif defined GNULIB_POSIXCHECK
    733  1.1  christos # undef wcpcpy
    734  1.1  christos # if HAVE_RAW_DECL_WCPCPY
    735  1.1  christos _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
    736  1.1  christos                  "use gnulib module wcpcpy for portability");
    737  1.1  christos # endif
    738  1.1  christos #endif
    739  1.1  christos 
    740  1.1  christos 
    741  1.1  christos /* Copy no more than N wide characters of SRC to DEST.  */
    742  1.1  christos #if @GNULIB_WCSNCPY@
    743  1.1  christos # if !@HAVE_WCSNCPY@
    744  1.1  christos _GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
    745  1.1  christos                   (wchar_t *restrict dest,
    746  1.1  christos                    const wchar_t *restrict src, size_t n));
    747  1.1  christos # endif
    748  1.1  christos _GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
    749  1.1  christos                   (wchar_t *restrict dest,
    750  1.1  christos                    const wchar_t *restrict src, size_t n));
    751  1.1  christos # if __GLIBC__ >= 2
    752  1.1  christos _GL_CXXALIASWARN (wcsncpy);
    753  1.1  christos # endif
    754  1.1  christos #elif defined GNULIB_POSIXCHECK
    755  1.1  christos # undef wcsncpy
    756  1.1  christos # if HAVE_RAW_DECL_WCSNCPY
    757  1.1  christos _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
    758  1.1  christos                  "use gnulib module wcsncpy for portability");
    759  1.1  christos # endif
    760  1.1  christos #endif
    761  1.1  christos 
    762  1.1  christos 
    763  1.1  christos /* Copy no more than N characters of SRC to DEST, returning the address of
    764  1.1  christos    the last character written into DEST.  */
    765  1.1  christos #if @GNULIB_WCPNCPY@
    766  1.1  christos # if !@HAVE_WCPNCPY@
    767  1.1  christos _GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
    768  1.1  christos                   (wchar_t *restrict dest,
    769  1.1  christos                    const wchar_t *restrict src, size_t n));
    770  1.1  christos # endif
    771  1.1  christos _GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
    772  1.1  christos                   (wchar_t *restrict dest,
    773  1.1  christos                    const wchar_t *restrict src, size_t n));
    774  1.1  christos _GL_CXXALIASWARN (wcpncpy);
    775  1.1  christos #elif defined GNULIB_POSIXCHECK
    776  1.1  christos # undef wcpncpy
    777  1.1  christos # if HAVE_RAW_DECL_WCPNCPY
    778  1.1  christos _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
    779  1.1  christos                  "use gnulib module wcpncpy for portability");
    780  1.1  christos # endif
    781  1.1  christos #endif
    782  1.1  christos 
    783  1.1  christos 
    784  1.1  christos /* Append SRC onto DEST.  */
    785  1.1  christos #if @GNULIB_WCSCAT@
    786  1.1  christos # if !@HAVE_WCSCAT@
    787  1.1  christos _GL_FUNCDECL_SYS (wcscat, wchar_t *,
    788  1.1  christos                   (wchar_t *restrict dest, const wchar_t *restrict src));
    789  1.1  christos # endif
    790  1.1  christos _GL_CXXALIAS_SYS (wcscat, wchar_t *,
    791  1.1  christos                   (wchar_t *restrict dest, const wchar_t *restrict src));
    792  1.1  christos # if __GLIBC__ >= 2
    793  1.1  christos _GL_CXXALIASWARN (wcscat);
    794  1.1  christos # endif
    795  1.1  christos #elif defined GNULIB_POSIXCHECK
    796  1.1  christos # undef wcscat
    797  1.1  christos # if HAVE_RAW_DECL_WCSCAT
    798  1.1  christos _GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
    799  1.1  christos                  "use gnulib module wcscat for portability");
    800  1.1  christos # endif
    801  1.1  christos #endif
    802  1.1  christos 
    803  1.1  christos 
    804  1.1  christos /* Append no more than N wide characters of SRC onto DEST.  */
    805  1.1  christos #if @GNULIB_WCSNCAT@
    806  1.1  christos # if !@HAVE_WCSNCAT@
    807  1.1  christos _GL_FUNCDECL_SYS (wcsncat, wchar_t *,
    808  1.1  christos                   (wchar_t *restrict dest, const wchar_t *restrict src,
    809  1.1  christos                    size_t n));
    810  1.1  christos # endif
    811  1.1  christos _GL_CXXALIAS_SYS (wcsncat, wchar_t *,
    812  1.1  christos                   (wchar_t *restrict dest, const wchar_t *restrict src,
    813  1.1  christos                    size_t n));
    814  1.1  christos # if __GLIBC__ >= 2
    815  1.1  christos _GL_CXXALIASWARN (wcsncat);
    816  1.1  christos # endif
    817  1.1  christos #elif defined GNULIB_POSIXCHECK
    818  1.1  christos # undef wcsncat
    819  1.1  christos # if HAVE_RAW_DECL_WCSNCAT
    820  1.1  christos _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
    821  1.1  christos                  "use gnulib module wcsncat for portability");
    822  1.1  christos # endif
    823  1.1  christos #endif
    824  1.1  christos 
    825  1.1  christos 
    826  1.1  christos /* Compare S1 and S2.  */
    827  1.1  christos #if @GNULIB_WCSCMP@
    828  1.1  christos # if !@HAVE_WCSCMP@
    829  1.1  christos _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
    830  1.1  christos                                _GL_ATTRIBUTE_PURE);
    831  1.1  christos # endif
    832  1.1  christos _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
    833  1.1  christos # if __GLIBC__ >= 2
    834  1.1  christos _GL_CXXALIASWARN (wcscmp);
    835  1.1  christos # endif
    836  1.1  christos #elif defined GNULIB_POSIXCHECK
    837  1.1  christos # undef wcscmp
    838  1.1  christos # if HAVE_RAW_DECL_WCSCMP
    839  1.1  christos _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
    840  1.1  christos                  "use gnulib module wcscmp for portability");
    841  1.1  christos # endif
    842  1.1  christos #endif
    843  1.1  christos 
    844  1.1  christos 
    845  1.1  christos /* Compare no more than N wide characters of S1 and S2.  */
    846  1.1  christos #if @GNULIB_WCSNCMP@
    847  1.1  christos # if !@HAVE_WCSNCMP@
    848  1.1  christos _GL_FUNCDECL_SYS (wcsncmp, int,
    849  1.1  christos                   (const wchar_t *s1, const wchar_t *s2, size_t n)
    850  1.1  christos                   _GL_ATTRIBUTE_PURE);
    851  1.1  christos # endif
    852  1.1  christos _GL_CXXALIAS_SYS (wcsncmp, int,
    853  1.1  christos                   (const wchar_t *s1, const wchar_t *s2, size_t n));
    854  1.1  christos # if __GLIBC__ >= 2
    855  1.1  christos _GL_CXXALIASWARN (wcsncmp);
    856  1.1  christos # endif
    857  1.1  christos #elif defined GNULIB_POSIXCHECK
    858  1.1  christos # undef wcsncmp
    859  1.1  christos # if HAVE_RAW_DECL_WCSNCMP
    860  1.1  christos _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
    861  1.1  christos                  "use gnulib module wcsncmp for portability");
    862  1.1  christos # endif
    863  1.1  christos #endif
    864  1.1  christos 
    865  1.1  christos 
    866  1.1  christos /* Compare S1 and S2, ignoring case.  */
    867  1.1  christos #if @GNULIB_WCSCASECMP@
    868  1.1  christos # if !@HAVE_WCSCASECMP@
    869  1.1  christos _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)
    870  1.1  christos                                    _GL_ATTRIBUTE_PURE);
    871  1.1  christos # endif
    872  1.1  christos _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
    873  1.1  christos _GL_CXXALIASWARN (wcscasecmp);
    874  1.1  christos #elif defined GNULIB_POSIXCHECK
    875  1.1  christos # undef wcscasecmp
    876  1.1  christos # if HAVE_RAW_DECL_WCSCASECMP
    877  1.1  christos _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
    878  1.1  christos                  "use gnulib module wcscasecmp for portability");
    879  1.1  christos # endif
    880  1.1  christos #endif
    881  1.1  christos 
    882  1.1  christos 
    883  1.1  christos /* Compare no more than N chars of S1 and S2, ignoring case.  */
    884  1.1  christos #if @GNULIB_WCSNCASECMP@
    885  1.1  christos # if !@HAVE_WCSNCASECMP@
    886  1.1  christos _GL_FUNCDECL_SYS (wcsncasecmp, int,
    887  1.1  christos                   (const wchar_t *s1, const wchar_t *s2, size_t n)
    888  1.1  christos                   _GL_ATTRIBUTE_PURE);
    889  1.1  christos # endif
    890  1.1  christos _GL_CXXALIAS_SYS (wcsncasecmp, int,
    891  1.1  christos                   (const wchar_t *s1, const wchar_t *s2, size_t n));
    892  1.1  christos _GL_CXXALIASWARN (wcsncasecmp);
    893  1.1  christos #elif defined GNULIB_POSIXCHECK
    894  1.1  christos # undef wcsncasecmp
    895  1.1  christos # if HAVE_RAW_DECL_WCSNCASECMP
    896  1.1  christos _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
    897  1.1  christos                  "use gnulib module wcsncasecmp for portability");
    898  1.1  christos # endif
    899  1.1  christos #endif
    900  1.1  christos 
    901  1.1  christos 
    902  1.1  christos /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
    903  1.1  christos    category of the current locale.  */
    904  1.1  christos #if @GNULIB_WCSCOLL@
    905  1.1  christos # if !@HAVE_WCSCOLL@
    906  1.1  christos _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
    907  1.1  christos # endif
    908  1.1  christos _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
    909  1.1  christos # if __GLIBC__ >= 2
    910  1.1  christos _GL_CXXALIASWARN (wcscoll);
    911  1.1  christos # endif
    912  1.1  christos #elif defined GNULIB_POSIXCHECK
    913  1.1  christos # undef wcscoll
    914  1.1  christos # if HAVE_RAW_DECL_WCSCOLL
    915  1.1  christos _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
    916  1.1  christos                  "use gnulib module wcscoll for portability");
    917  1.1  christos # endif
    918  1.1  christos #endif
    919  1.1  christos 
    920  1.1  christos 
    921  1.1  christos /* Transform S2 into array pointed to by S1 such that if wcscmp is applied
    922  1.1  christos    to two transformed strings the result is the as applying 'wcscoll' to the
    923  1.1  christos    original strings.  */
    924  1.1  christos #if @GNULIB_WCSXFRM@
    925  1.1  christos # if !@HAVE_WCSXFRM@
    926  1.1  christos _GL_FUNCDECL_SYS (wcsxfrm, size_t,
    927  1.1  christos                   (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
    928  1.1  christos # endif
    929  1.1  christos _GL_CXXALIAS_SYS (wcsxfrm, size_t,
    930  1.1  christos                   (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
    931  1.1  christos # if __GLIBC__ >= 2
    932  1.1  christos _GL_CXXALIASWARN (wcsxfrm);
    933  1.1  christos # endif
    934  1.1  christos #elif defined GNULIB_POSIXCHECK
    935  1.1  christos # undef wcsxfrm
    936  1.1  christos # if HAVE_RAW_DECL_WCSXFRM
    937  1.1  christos _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
    938  1.1  christos                  "use gnulib module wcsxfrm for portability");
    939  1.1  christos # endif
    940  1.1  christos #endif
    941  1.1  christos 
    942  1.1  christos 
    943  1.1  christos /* Duplicate S, returning an identical malloc'd string.  */
    944  1.1  christos #if @GNULIB_WCSDUP@
    945  1.1  christos # if !@HAVE_WCSDUP@
    946  1.1  christos _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
    947  1.1  christos # endif
    948  1.1  christos _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
    949  1.1  christos _GL_CXXALIASWARN (wcsdup);
    950  1.1  christos #elif defined GNULIB_POSIXCHECK
    951  1.1  christos # undef wcsdup
    952  1.1  christos # if HAVE_RAW_DECL_WCSDUP
    953  1.1  christos _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
    954  1.1  christos                  "use gnulib module wcsdup for portability");
    955  1.1  christos # endif
    956  1.1  christos #endif
    957  1.1  christos 
    958  1.1  christos 
    959  1.1  christos /* Find the first occurrence of WC in WCS.  */
    960  1.1  christos #if @GNULIB_WCSCHR@
    961  1.1  christos # if !@HAVE_WCSCHR@
    962  1.1  christos _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
    963  1.1  christos                                      _GL_ATTRIBUTE_PURE);
    964  1.1  christos # endif
    965  1.1  christos   /* On some systems, this function is defined as an overloaded function:
    966  1.1  christos        extern "C++" {
    967  1.1  christos          const wchar_t * std::wcschr (const wchar_t *, wchar_t);
    968  1.1  christos          wchar_t * std::wcschr (wchar_t *, wchar_t);
    969  1.1  christos        }  */
    970  1.1  christos _GL_CXXALIAS_SYS_CAST2 (wcschr,
    971  1.1  christos                         wchar_t *, (const wchar_t *, wchar_t),
    972  1.1  christos                         const wchar_t *, (const wchar_t *, wchar_t));
    973  1.1  christos # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
    974  1.1  christos      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
    975  1.1  christos _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
    976  1.1  christos _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
    977  1.1  christos # elif __GLIBC__ >= 2
    978  1.1  christos _GL_CXXALIASWARN (wcschr);
    979  1.1  christos # endif
    980  1.1  christos #elif defined GNULIB_POSIXCHECK
    981  1.1  christos # undef wcschr
    982  1.1  christos # if HAVE_RAW_DECL_WCSCHR
    983  1.1  christos _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
    984  1.1  christos                  "use gnulib module wcschr for portability");
    985  1.1  christos # endif
    986  1.1  christos #endif
    987  1.1  christos 
    988  1.1  christos 
    989  1.1  christos /* Find the last occurrence of WC in WCS.  */
    990  1.1  christos #if @GNULIB_WCSRCHR@
    991  1.1  christos # if !@HAVE_WCSRCHR@
    992  1.1  christos _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
    993  1.1  christos                                       _GL_ATTRIBUTE_PURE);
    994  1.1  christos # endif
    995  1.1  christos   /* On some systems, this function is defined as an overloaded function:
    996  1.1  christos        extern "C++" {
    997  1.1  christos          const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
    998  1.1  christos          wchar_t * std::wcsrchr (wchar_t *, wchar_t);
    999  1.1  christos        }  */
   1000  1.1  christos _GL_CXXALIAS_SYS_CAST2 (wcsrchr,
   1001  1.1  christos                         wchar_t *, (const wchar_t *, wchar_t),
   1002  1.1  christos                         const wchar_t *, (const wchar_t *, wchar_t));
   1003  1.1  christos # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
   1004  1.1  christos      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
   1005  1.1  christos _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
   1006  1.1  christos _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
   1007  1.1  christos # elif __GLIBC__ >= 2
   1008  1.1  christos _GL_CXXALIASWARN (wcsrchr);
   1009  1.1  christos # endif
   1010  1.1  christos #elif defined GNULIB_POSIXCHECK
   1011  1.1  christos # undef wcsrchr
   1012  1.1  christos # if HAVE_RAW_DECL_WCSRCHR
   1013  1.1  christos _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
   1014  1.1  christos                  "use gnulib module wcsrchr for portability");
   1015  1.1  christos # endif
   1016  1.1  christos #endif
   1017  1.1  christos 
   1018  1.1  christos 
   1019  1.1  christos /* Return the length of the initial segmet of WCS which consists entirely
   1020  1.1  christos    of wide characters not in REJECT.  */
   1021  1.1  christos #if @GNULIB_WCSCSPN@
   1022  1.1  christos # if !@HAVE_WCSCSPN@
   1023  1.1  christos _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
   1024  1.1  christos                                    _GL_ATTRIBUTE_PURE);
   1025  1.1  christos # endif
   1026  1.1  christos _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
   1027  1.1  christos # if __GLIBC__ >= 2
   1028  1.1  christos _GL_CXXALIASWARN (wcscspn);
   1029  1.1  christos # endif
   1030  1.1  christos #elif defined GNULIB_POSIXCHECK
   1031  1.1  christos # undef wcscspn
   1032  1.1  christos # if HAVE_RAW_DECL_WCSCSPN
   1033  1.1  christos _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
   1034  1.1  christos                  "use gnulib module wcscspn for portability");
   1035  1.1  christos # endif
   1036  1.1  christos #endif
   1037  1.1  christos 
   1038  1.1  christos 
   1039  1.1  christos /* Return the length of the initial segmet of WCS which consists entirely
   1040  1.1  christos    of wide characters in ACCEPT.  */
   1041  1.1  christos #if @GNULIB_WCSSPN@
   1042  1.1  christos # if !@HAVE_WCSSPN@
   1043  1.1  christos _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
   1044  1.1  christos                                   _GL_ATTRIBUTE_PURE);
   1045  1.1  christos # endif
   1046  1.1  christos _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
   1047  1.1  christos # if __GLIBC__ >= 2
   1048  1.1  christos _GL_CXXALIASWARN (wcsspn);
   1049  1.1  christos # endif
   1050  1.1  christos #elif defined GNULIB_POSIXCHECK
   1051  1.1  christos # undef wcsspn
   1052  1.1  christos # if HAVE_RAW_DECL_WCSSPN
   1053  1.1  christos _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
   1054  1.1  christos                  "use gnulib module wcsspn for portability");
   1055  1.1  christos # endif
   1056  1.1  christos #endif
   1057  1.1  christos 
   1058  1.1  christos 
   1059  1.1  christos /* Find the first occurrence in WCS of any character in ACCEPT.  */
   1060  1.1  christos #if @GNULIB_WCSPBRK@
   1061  1.1  christos # if !@HAVE_WCSPBRK@
   1062  1.1  christos _GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
   1063  1.1  christos                   (const wchar_t *wcs, const wchar_t *accept)
   1064  1.1  christos                   _GL_ATTRIBUTE_PURE);
   1065  1.1  christos # endif
   1066  1.1  christos   /* On some systems, this function is defined as an overloaded function:
   1067  1.1  christos        extern "C++" {
   1068  1.1  christos          const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
   1069  1.1  christos          wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
   1070  1.1  christos        }  */
   1071  1.1  christos _GL_CXXALIAS_SYS_CAST2 (wcspbrk,
   1072  1.1  christos                         wchar_t *, (const wchar_t *, const wchar_t *),
   1073  1.1  christos                         const wchar_t *, (const wchar_t *, const wchar_t *));
   1074  1.1  christos # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
   1075  1.1  christos      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
   1076  1.1  christos _GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
   1077  1.1  christos                    (wchar_t *wcs, const wchar_t *accept));
   1078  1.1  christos _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
   1079  1.1  christos                    (const wchar_t *wcs, const wchar_t *accept));
   1080  1.1  christos # elif __GLIBC__ >= 2
   1081  1.1  christos _GL_CXXALIASWARN (wcspbrk);
   1082  1.1  christos # endif
   1083  1.1  christos #elif defined GNULIB_POSIXCHECK
   1084  1.1  christos # undef wcspbrk
   1085  1.1  christos # if HAVE_RAW_DECL_WCSPBRK
   1086  1.1  christos _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
   1087  1.1  christos                  "use gnulib module wcspbrk for portability");
   1088  1.1  christos # endif
   1089  1.1  christos #endif
   1090  1.1  christos 
   1091  1.1  christos 
   1092  1.1  christos /* Find the first occurrence of NEEDLE in HAYSTACK.  */
   1093  1.1  christos #if @GNULIB_WCSSTR@
   1094  1.1  christos # if !@HAVE_WCSSTR@
   1095  1.1  christos _GL_FUNCDECL_SYS (wcsstr, wchar_t *,
   1096  1.1  christos                   (const wchar_t *restrict haystack,
   1097  1.1  christos                    const wchar_t *restrict needle)
   1098  1.1  christos                   _GL_ATTRIBUTE_PURE);
   1099  1.1  christos # endif
   1100  1.1  christos   /* On some systems, this function is defined as an overloaded function:
   1101  1.1  christos        extern "C++" {
   1102  1.1  christos          const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
   1103  1.1  christos          wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
   1104  1.1  christos        }  */
   1105  1.1  christos _GL_CXXALIAS_SYS_CAST2 (wcsstr,
   1106  1.1  christos                         wchar_t *,
   1107  1.1  christos                         (const wchar_t *restrict, const wchar_t *restrict),
   1108  1.1  christos                         const wchar_t *,
   1109  1.1  christos                         (const wchar_t *restrict, const wchar_t *restrict));
   1110  1.1  christos # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
   1111  1.1  christos      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
   1112  1.1  christos _GL_CXXALIASWARN1 (wcsstr, wchar_t *,
   1113  1.1  christos                    (wchar_t *restrict haystack,
   1114  1.1  christos                     const wchar_t *restrict needle));
   1115  1.1  christos _GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
   1116  1.1  christos                    (const wchar_t *restrict haystack,
   1117  1.1  christos                     const wchar_t *restrict needle));
   1118  1.1  christos # elif __GLIBC__ >= 2
   1119  1.1  christos _GL_CXXALIASWARN (wcsstr);
   1120  1.1  christos # endif
   1121  1.1  christos #elif defined GNULIB_POSIXCHECK
   1122  1.1  christos # undef wcsstr
   1123  1.1  christos # if HAVE_RAW_DECL_WCSSTR
   1124  1.1  christos _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
   1125  1.1  christos                  "use gnulib module wcsstr for portability");
   1126  1.1  christos # endif
   1127  1.1  christos #endif
   1128  1.1  christos 
   1129  1.1  christos 
   1130  1.1  christos /* Divide WCS into tokens separated by characters in DELIM.  */
   1131  1.1  christos #if @GNULIB_WCSTOK@
   1132  1.1  christos # if @REPLACE_WCSTOK@
   1133  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1134  1.1  christos #   undef wcstok
   1135  1.1  christos #   define wcstok rpl_wcstok
   1136  1.1  christos #  endif
   1137  1.1  christos _GL_FUNCDECL_RPL (wcstok, wchar_t *,
   1138  1.1  christos                   (wchar_t *restrict wcs, const wchar_t *restrict delim,
   1139  1.1  christos                    wchar_t **restrict ptr));
   1140  1.1  christos _GL_CXXALIAS_RPL (wcstok, wchar_t *,
   1141  1.1  christos                   (wchar_t *restrict wcs, const wchar_t *restrict delim,
   1142  1.1  christos                    wchar_t **restrict ptr));
   1143  1.1  christos # else
   1144  1.1  christos #  if !@HAVE_WCSTOK@
   1145  1.1  christos _GL_FUNCDECL_SYS (wcstok, wchar_t *,
   1146  1.1  christos                   (wchar_t *restrict wcs, const wchar_t *restrict delim,
   1147  1.1  christos                    wchar_t **restrict ptr));
   1148  1.1  christos #  endif
   1149  1.1  christos _GL_CXXALIAS_SYS (wcstok, wchar_t *,
   1150  1.1  christos                   (wchar_t *restrict wcs, const wchar_t *restrict delim,
   1151  1.1  christos                    wchar_t **restrict ptr));
   1152  1.1  christos # endif
   1153  1.1  christos # if __GLIBC__ >= 2
   1154  1.1  christos _GL_CXXALIASWARN (wcstok);
   1155  1.1  christos # endif
   1156  1.1  christos #elif defined GNULIB_POSIXCHECK
   1157  1.1  christos # undef wcstok
   1158  1.1  christos # if HAVE_RAW_DECL_WCSTOK
   1159  1.1  christos _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
   1160  1.1  christos                  "use gnulib module wcstok for portability");
   1161  1.1  christos # endif
   1162  1.1  christos #endif
   1163  1.1  christos 
   1164  1.1  christos 
   1165  1.1  christos /* Determine number of column positions required for first N wide
   1166  1.1  christos    characters (or fewer if S ends before this) in S.  */
   1167  1.1  christos #if @GNULIB_WCSWIDTH@
   1168  1.1  christos # if @REPLACE_WCSWIDTH@
   1169  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1170  1.1  christos #   undef wcswidth
   1171  1.1  christos #   define wcswidth rpl_wcswidth
   1172  1.1  christos #  endif
   1173  1.1  christos _GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)
   1174  1.1  christos                                  _GL_ATTRIBUTE_PURE);
   1175  1.1  christos _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
   1176  1.1  christos # else
   1177  1.1  christos #  if !@HAVE_WCSWIDTH@
   1178  1.1  christos _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
   1179  1.1  christos                                  _GL_ATTRIBUTE_PURE);
   1180  1.1  christos #  endif
   1181  1.1  christos _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
   1182  1.1  christos # endif
   1183  1.1  christos # if __GLIBC__ >= 2
   1184  1.1  christos _GL_CXXALIASWARN (wcswidth);
   1185  1.1  christos # endif
   1186  1.1  christos #elif defined GNULIB_POSIXCHECK
   1187  1.1  christos # undef wcswidth
   1188  1.1  christos # if HAVE_RAW_DECL_WCSWIDTH
   1189  1.1  christos _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
   1190  1.1  christos                  "use gnulib module wcswidth for portability");
   1191  1.1  christos # endif
   1192  1.1  christos #endif
   1193  1.1  christos 
   1194  1.1  christos 
   1195  1.1  christos /* Convert *TP to a date and time wide string.  See
   1196  1.1  christos    <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>.  */
   1197  1.1  christos #if @GNULIB_WCSFTIME@
   1198  1.1  christos # if @REPLACE_WCSFTIME@
   1199  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1200  1.1  christos #   undef wcsftime
   1201  1.1  christos #   define wcsftime rpl_wcsftime
   1202  1.1  christos #  endif
   1203  1.1  christos _GL_FUNCDECL_RPL (wcsftime, size_t,
   1204  1.1  christos                   (wchar_t *restrict __buf, size_t __bufsize,
   1205  1.1  christos                    const wchar_t *restrict __fmt,
   1206  1.1  christos                    const struct tm *restrict __tp)
   1207  1.1  christos                   _GL_ARG_NONNULL ((1, 3, 4)));
   1208  1.1  christos _GL_CXXALIAS_RPL (wcsftime, size_t,
   1209  1.1  christos                   (wchar_t *restrict __buf, size_t __bufsize,
   1210  1.1  christos                    const wchar_t *restrict __fmt,
   1211  1.1  christos                    const struct tm *restrict __tp));
   1212  1.1  christos # else
   1213  1.1  christos #  if !@HAVE_WCSFTIME@
   1214  1.1  christos _GL_FUNCDECL_SYS (wcsftime, size_t,
   1215  1.1  christos                   (wchar_t *restrict __buf, size_t __bufsize,
   1216  1.1  christos                    const wchar_t *restrict __fmt,
   1217  1.1  christos                    const struct tm *restrict __tp)
   1218  1.1  christos                   _GL_ARG_NONNULL ((1, 3, 4)));
   1219  1.1  christos #  endif
   1220  1.1  christos _GL_CXXALIAS_SYS (wcsftime, size_t,
   1221  1.1  christos                   (wchar_t *restrict __buf, size_t __bufsize,
   1222  1.1  christos                    const wchar_t *restrict __fmt,
   1223  1.1  christos                    const struct tm *restrict __tp));
   1224  1.1  christos # endif
   1225  1.1  christos # if __GLIBC__ >= 2
   1226  1.1  christos _GL_CXXALIASWARN (wcsftime);
   1227  1.1  christos # endif
   1228  1.1  christos #elif defined GNULIB_POSIXCHECK
   1229  1.1  christos # undef wcsftime
   1230  1.1  christos # if HAVE_RAW_DECL_WCSFTIME
   1231  1.1  christos _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - "
   1232  1.1  christos                  "use gnulib module wcsftime for portability");
   1233  1.1  christos # endif
   1234  1.1  christos #endif
   1235  1.1  christos 
   1236  1.1  christos 
   1237  1.1  christos #endif /* _@GUARD_PREFIX@_WCHAR_H */
   1238  1.1  christos #endif /* _@GUARD_PREFIX@_WCHAR_H */
   1239  1.1  christos #endif
   1240