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