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