1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
5 Copyright (C) 2007-2013 Free Software Foundation, Inc.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, see <http://www.gnu.org/licenses/>. */
20 /* Written by Eric Blake. */
23 * ISO C 99 <wchar.h> for platforms that have issues.
24 * <http://www.opengroup.org/susv3xbd/wchar.h.html>
26 * For now, this just ensures proper prerequisite inclusion order and
27 * the declaration of wcwidth().
31 @PRAGMA_SYSTEM_HEADER@
35 #if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
36 /* Special invocation convention:
37 - Inside glibc and uClibc header files.
38 - On HP-UX 11.00 we have a sequence of nested includes
39 <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
40 once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
41 and once directly. In both situations 'wint_t' is not yet defined,
42 therefore we cannot provide the function overrides; instead include only
43 the system's <wchar.h>.
44 - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
45 the latter includes <wchar.h>. But here, we have no way to detect whether
46 <wctype.h> is completely included or is still being included. */
48 #@INCLUDE_NEXT@ @NEXT_WCHAR_H@
51 /* Normal invocation convention. */
53 #ifndef _@GUARD_PREFIX@_WCHAR_H
55 #define _GL_ALREADY_INCLUDING_WCHAR_H
58 # include <features.h> /* for __GLIBC__ */
61 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
63 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
64 included before <wchar.h>.
65 In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
67 But avoid namespace pollution on glibc systems. */
68 #if !(defined __GLIBC__ && !defined __UCLIBC__)
76 /* Include the original <wchar.h> if it exists.
77 Some builds of uClibc lack it. */
78 /* The include_next requires a split double-inclusion guard. */
80 # @INCLUDE_NEXT@ @NEXT_WCHAR_H@
83 #undef _GL_ALREADY_INCLUDING_WCHAR_H
85 #ifndef _@GUARD_PREFIX@_WCHAR_H
86 #define _@GUARD_PREFIX@_WCHAR_H
88 /* The __attribute__ feature is available in gcc versions 2.5 and later.
89 The attribute __pure__ was added in gcc 2.96. */
90 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
91 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
93 # define _GL_ATTRIBUTE_PURE /* empty */
96 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
98 /* The definition of _GL_ARG_NONNULL is copied here. */
100 /* The definition of _GL_WARN_ON_USE is copied here. */
103 /* Define wint_t and WEOF. (Also done in wctype.in.h.) */
104 #if !@HAVE_WINT_T@ && !defined wint_t
110 /* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>.
111 This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
112 "unchanged by default argument promotions". Override it. */
113 # if defined _MSC_VER
114 # if !GNULIB_defined_wint_t
115 # include <crtdefs.h>
116 typedef unsigned int rpl_wint_t;
118 # define wint_t rpl_wint_t
119 # define GNULIB_defined_wint_t 1
123 # define WEOF ((wint_t) -1)
128 /* Override mbstate_t if it is too small.
129 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
130 implementing mbrtowc for encodings like UTF-8. */
131 #if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
132 # if !GNULIB_defined_mbstate_t
133 typedef int rpl_mbstate_t;
135 # define mbstate_t rpl_mbstate_t
136 # define GNULIB_defined_mbstate_t 1
141 /* Convert a single-byte character to a wide character. */
144 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
146 # define btowc rpl_btowc
148 _GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
149 _GL_CXXALIAS_RPL (btowc, wint_t, (int c));
152 _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
154 _GL_CXXALIAS_SYS (btowc, wint_t, (int c));
156 _GL_CXXALIASWARN (btowc);
157 #elif defined GNULIB_POSIXCHECK
159 # if HAVE_RAW_DECL_BTOWC
160 _GL_WARN_ON_USE (btowc, "btowc is unportable - "
161 "use gnulib module btowc for portability");
166 /* Convert a wide character to a single-byte character. */
169 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
171 # define wctob rpl_wctob
173 _GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
174 _GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
176 # if !defined wctob && !@HAVE_DECL_WCTOB@
177 /* wctob is provided by gnulib, or wctob exists but is not declared. */
178 _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
180 _GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
182 _GL_CXXALIASWARN (wctob);
183 #elif defined GNULIB_POSIXCHECK
185 # if HAVE_RAW_DECL_WCTOB
186 _GL_WARN_ON_USE (wctob, "wctob is unportable - "
187 "use gnulib module wctob for portability");
192 /* Test whether *PS is in the initial state. */
194 # if @REPLACE_MBSINIT@
195 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
197 # define mbsinit rpl_mbsinit
199 _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
200 _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
203 _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
205 _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
207 _GL_CXXALIASWARN (mbsinit);
208 #elif defined GNULIB_POSIXCHECK
210 # if HAVE_RAW_DECL_MBSINIT
211 _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
212 "use gnulib module mbsinit for portability");
217 /* Convert a multibyte character to a wide character. */
219 # if @REPLACE_MBRTOWC@
220 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
222 # define mbrtowc rpl_mbrtowc
224 _GL_FUNCDECL_RPL (mbrtowc, size_t,
225 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
226 _GL_CXXALIAS_RPL (mbrtowc, size_t,
227 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
230 _GL_FUNCDECL_SYS (mbrtowc, size_t,
231 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
233 _GL_CXXALIAS_SYS (mbrtowc, size_t,
234 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
236 _GL_CXXALIASWARN (mbrtowc);
237 #elif defined GNULIB_POSIXCHECK
239 # if HAVE_RAW_DECL_MBRTOWC
240 _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
241 "use gnulib module mbrtowc for portability");
246 /* Recognize a multibyte character. */
248 # if @REPLACE_MBRLEN@
249 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
251 # define mbrlen rpl_mbrlen
253 _GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
254 _GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
257 _GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
259 _GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
261 _GL_CXXALIASWARN (mbrlen);
262 #elif defined GNULIB_POSIXCHECK
264 # if HAVE_RAW_DECL_MBRLEN
265 _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
266 "use gnulib module mbrlen for portability");
271 /* Convert a string to a wide string. */
272 #if @GNULIB_MBSRTOWCS@
273 # if @REPLACE_MBSRTOWCS@
274 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
276 # define mbsrtowcs rpl_mbsrtowcs
278 _GL_FUNCDECL_RPL (mbsrtowcs, size_t,
279 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
280 _GL_ARG_NONNULL ((2)));
281 _GL_CXXALIAS_RPL (mbsrtowcs, size_t,
282 (wchar_t *dest, const char **srcp, size_t len,
285 # if !@HAVE_MBSRTOWCS@
286 _GL_FUNCDECL_SYS (mbsrtowcs, size_t,
287 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
288 _GL_ARG_NONNULL ((2)));
290 _GL_CXXALIAS_SYS (mbsrtowcs, size_t,
291 (wchar_t *dest, const char **srcp, size_t len,
294 _GL_CXXALIASWARN (mbsrtowcs);
295 #elif defined GNULIB_POSIXCHECK
297 # if HAVE_RAW_DECL_MBSRTOWCS
298 _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
299 "use gnulib module mbsrtowcs for portability");
304 /* Convert a string to a wide string. */
305 #if @GNULIB_MBSNRTOWCS@
306 # if @REPLACE_MBSNRTOWCS@
307 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
309 # define mbsnrtowcs rpl_mbsnrtowcs
311 _GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
312 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
314 _GL_ARG_NONNULL ((2)));
315 _GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
316 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
319 # if !@HAVE_MBSNRTOWCS@
320 _GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
321 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
323 _GL_ARG_NONNULL ((2)));
325 _GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
326 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
329 _GL_CXXALIASWARN (mbsnrtowcs);
330 #elif defined GNULIB_POSIXCHECK
332 # if HAVE_RAW_DECL_MBSNRTOWCS
333 _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
334 "use gnulib module mbsnrtowcs for portability");
339 /* Convert a wide character to a multibyte character. */
341 # if @REPLACE_WCRTOMB@
342 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
344 # define wcrtomb rpl_wcrtomb
346 _GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
347 _GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
350 _GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
352 _GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
354 _GL_CXXALIASWARN (wcrtomb);
355 #elif defined GNULIB_POSIXCHECK
357 # if HAVE_RAW_DECL_WCRTOMB
358 _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
359 "use gnulib module wcrtomb for portability");
364 /* Convert a wide string to a string. */
365 #if @GNULIB_WCSRTOMBS@
366 # if @REPLACE_WCSRTOMBS@
367 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
369 # define wcsrtombs rpl_wcsrtombs
371 _GL_FUNCDECL_RPL (wcsrtombs, size_t,
372 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
373 _GL_ARG_NONNULL ((2)));
374 _GL_CXXALIAS_RPL (wcsrtombs, size_t,
375 (char *dest, const wchar_t **srcp, size_t len,
378 # if !@HAVE_WCSRTOMBS@
379 _GL_FUNCDECL_SYS (wcsrtombs, size_t,
380 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
381 _GL_ARG_NONNULL ((2)));
383 _GL_CXXALIAS_SYS (wcsrtombs, size_t,
384 (char *dest, const wchar_t **srcp, size_t len,
387 _GL_CXXALIASWARN (wcsrtombs);
388 #elif defined GNULIB_POSIXCHECK
390 # if HAVE_RAW_DECL_WCSRTOMBS
391 _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
392 "use gnulib module wcsrtombs for portability");
397 /* Convert a wide string to a string. */
398 #if @GNULIB_WCSNRTOMBS@
399 # if @REPLACE_WCSNRTOMBS@
400 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
402 # define wcsnrtombs rpl_wcsnrtombs
404 _GL_FUNCDECL_RPL (wcsnrtombs, size_t,
405 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
407 _GL_ARG_NONNULL ((2)));
408 _GL_CXXALIAS_RPL (wcsnrtombs, size_t,
409 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
412 # if !@HAVE_WCSNRTOMBS@
413 _GL_FUNCDECL_SYS (wcsnrtombs, size_t,
414 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
416 _GL_ARG_NONNULL ((2)));
418 _GL_CXXALIAS_SYS (wcsnrtombs, size_t,
419 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
422 _GL_CXXALIASWARN (wcsnrtombs);
423 #elif defined GNULIB_POSIXCHECK
425 # if HAVE_RAW_DECL_WCSNRTOMBS
426 _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
427 "use gnulib module wcsnrtombs for portability");
432 /* Return the number of screen columns needed for WC. */
434 # if @REPLACE_WCWIDTH@
435 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
437 # define wcwidth rpl_wcwidth
439 _GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
440 _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
442 # if !@HAVE_DECL_WCWIDTH@
443 /* wcwidth exists but is not declared. */
444 _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
446 _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
448 _GL_CXXALIASWARN (wcwidth);
449 #elif defined GNULIB_POSIXCHECK
451 # if HAVE_RAW_DECL_WCWIDTH
452 _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
453 "use gnulib module wcwidth for portability");
458 /* Search N wide characters of S for C. */
461 _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
464 /* On some systems, this function is defined as an overloaded function:
466 const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
467 wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
469 _GL_CXXALIAS_SYS_CAST2 (wmemchr,
470 wchar_t *, (const wchar_t *, wchar_t, size_t),
471 const wchar_t *, (const wchar_t *, wchar_t, size_t));
472 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
473 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
474 _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
475 _GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
476 (const wchar_t *s, wchar_t c, size_t n));
478 _GL_CXXALIASWARN (wmemchr);
480 #elif defined GNULIB_POSIXCHECK
482 # if HAVE_RAW_DECL_WMEMCHR
483 _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
484 "use gnulib module wmemchr for portability");
489 /* Compare N wide characters of S1 and S2. */
492 _GL_FUNCDECL_SYS (wmemcmp, int,
493 (const wchar_t *s1, const wchar_t *s2, size_t n)
496 _GL_CXXALIAS_SYS (wmemcmp, int,
497 (const wchar_t *s1, const wchar_t *s2, size_t n));
498 _GL_CXXALIASWARN (wmemcmp);
499 #elif defined GNULIB_POSIXCHECK
501 # if HAVE_RAW_DECL_WMEMCMP
502 _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
503 "use gnulib module wmemcmp for portability");
508 /* Copy N wide characters of SRC to DEST. */
511 _GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
512 (wchar_t *dest, const wchar_t *src, size_t n));
514 _GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
515 (wchar_t *dest, const wchar_t *src, size_t n));
516 _GL_CXXALIASWARN (wmemcpy);
517 #elif defined GNULIB_POSIXCHECK
519 # if HAVE_RAW_DECL_WMEMCPY
520 _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
521 "use gnulib module wmemcpy for portability");
526 /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
527 overlapping memory areas. */
528 #if @GNULIB_WMEMMOVE@
529 # if !@HAVE_WMEMMOVE@
530 _GL_FUNCDECL_SYS (wmemmove, wchar_t *,
531 (wchar_t *dest, const wchar_t *src, size_t n));
533 _GL_CXXALIAS_SYS (wmemmove, wchar_t *,
534 (wchar_t *dest, const wchar_t *src, size_t n));
535 _GL_CXXALIASWARN (wmemmove);
536 #elif defined GNULIB_POSIXCHECK
538 # if HAVE_RAW_DECL_WMEMMOVE
539 _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
540 "use gnulib module wmemmove for portability");
545 /* Set N wide characters of S to C. */
548 _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
550 _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
551 _GL_CXXALIASWARN (wmemset);
552 #elif defined GNULIB_POSIXCHECK
554 # if HAVE_RAW_DECL_WMEMSET
555 _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
556 "use gnulib module wmemset for portability");
561 /* Return the number of wide characters in S. */
564 _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
566 _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
567 _GL_CXXALIASWARN (wcslen);
568 #elif defined GNULIB_POSIXCHECK
570 # if HAVE_RAW_DECL_WCSLEN
571 _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
572 "use gnulib module wcslen for portability");
577 /* Return the number of wide characters in S, but at most MAXLEN. */
580 _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)
583 _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
584 _GL_CXXALIASWARN (wcsnlen);
585 #elif defined GNULIB_POSIXCHECK
587 # if HAVE_RAW_DECL_WCSNLEN
588 _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
589 "use gnulib module wcsnlen for portability");
594 /* Copy SRC to DEST. */
597 _GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
599 _GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
600 _GL_CXXALIASWARN (wcscpy);
601 #elif defined GNULIB_POSIXCHECK
603 # if HAVE_RAW_DECL_WCSCPY
604 _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
605 "use gnulib module wcscpy for portability");
610 /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
613 _GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
615 _GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
616 _GL_CXXALIASWARN (wcpcpy);
617 #elif defined GNULIB_POSIXCHECK
619 # if HAVE_RAW_DECL_WCPCPY
620 _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
621 "use gnulib module wcpcpy for portability");
626 /* Copy no more than N wide characters of SRC to DEST. */
629 _GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
630 (wchar_t *dest, const wchar_t *src, size_t n));
632 _GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
633 (wchar_t *dest, const wchar_t *src, size_t n));
634 _GL_CXXALIASWARN (wcsncpy);
635 #elif defined GNULIB_POSIXCHECK
637 # if HAVE_RAW_DECL_WCSNCPY
638 _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
639 "use gnulib module wcsncpy for portability");
644 /* Copy no more than N characters of SRC to DEST, returning the address of
645 the last character written into DEST. */
648 _GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
649 (wchar_t *dest, const wchar_t *src, size_t n));
651 _GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
652 (wchar_t *dest, const wchar_t *src, size_t n));
653 _GL_CXXALIASWARN (wcpncpy);
654 #elif defined GNULIB_POSIXCHECK
656 # if HAVE_RAW_DECL_WCPNCPY
657 _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
658 "use gnulib module wcpncpy for portability");
663 /* Append SRC onto DEST. */
666 _GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
668 _GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
669 _GL_CXXALIASWARN (wcscat);
670 #elif defined GNULIB_POSIXCHECK
672 # if HAVE_RAW_DECL_WCSCAT
673 _GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
674 "use gnulib module wcscat for portability");
679 /* Append no more than N wide characters of SRC onto DEST. */
682 _GL_FUNCDECL_SYS (wcsncat, wchar_t *,
683 (wchar_t *dest, const wchar_t *src, size_t n));
685 _GL_CXXALIAS_SYS (wcsncat, wchar_t *,
686 (wchar_t *dest, const wchar_t *src, size_t n));
687 _GL_CXXALIASWARN (wcsncat);
688 #elif defined GNULIB_POSIXCHECK
690 # if HAVE_RAW_DECL_WCSNCAT
691 _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
692 "use gnulib module wcsncat for portability");
697 /* Compare S1 and S2. */
700 _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
703 _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
704 _GL_CXXALIASWARN (wcscmp);
705 #elif defined GNULIB_POSIXCHECK
707 # if HAVE_RAW_DECL_WCSCMP
708 _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
709 "use gnulib module wcscmp for portability");
714 /* Compare no more than N wide characters of S1 and S2. */
717 _GL_FUNCDECL_SYS (wcsncmp, int,
718 (const wchar_t *s1, const wchar_t *s2, size_t n)
721 _GL_CXXALIAS_SYS (wcsncmp, int,
722 (const wchar_t *s1, const wchar_t *s2, size_t n));
723 _GL_CXXALIASWARN (wcsncmp);
724 #elif defined GNULIB_POSIXCHECK
726 # if HAVE_RAW_DECL_WCSNCMP
727 _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
728 "use gnulib module wcsncmp for portability");
733 /* Compare S1 and S2, ignoring case. */
734 #if @GNULIB_WCSCASECMP@
735 # if !@HAVE_WCSCASECMP@
736 _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)
739 _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
740 _GL_CXXALIASWARN (wcscasecmp);
741 #elif defined GNULIB_POSIXCHECK
743 # if HAVE_RAW_DECL_WCSCASECMP
744 _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
745 "use gnulib module wcscasecmp for portability");
750 /* Compare no more than N chars of S1 and S2, ignoring case. */
751 #if @GNULIB_WCSNCASECMP@
752 # if !@HAVE_WCSNCASECMP@
753 _GL_FUNCDECL_SYS (wcsncasecmp, int,
754 (const wchar_t *s1, const wchar_t *s2, size_t n)
757 _GL_CXXALIAS_SYS (wcsncasecmp, int,
758 (const wchar_t *s1, const wchar_t *s2, size_t n));
759 _GL_CXXALIASWARN (wcsncasecmp);
760 #elif defined GNULIB_POSIXCHECK
762 # if HAVE_RAW_DECL_WCSNCASECMP
763 _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
764 "use gnulib module wcsncasecmp for portability");
769 /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
770 category of the current locale. */
773 _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
775 _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
776 _GL_CXXALIASWARN (wcscoll);
777 #elif defined GNULIB_POSIXCHECK
779 # if HAVE_RAW_DECL_WCSCOLL
780 _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
781 "use gnulib module wcscoll for portability");
786 /* Transform S2 into array pointed to by S1 such that if wcscmp is applied
787 to two transformed strings the result is the as applying 'wcscoll' to the
791 _GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
793 _GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
794 _GL_CXXALIASWARN (wcsxfrm);
795 #elif defined GNULIB_POSIXCHECK
797 # if HAVE_RAW_DECL_WCSXFRM
798 _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
799 "use gnulib module wcsxfrm for portability");
804 /* Duplicate S, returning an identical malloc'd string. */
807 _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
809 _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
810 _GL_CXXALIASWARN (wcsdup);
811 #elif defined GNULIB_POSIXCHECK
813 # if HAVE_RAW_DECL_WCSDUP
814 _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
815 "use gnulib module wcsdup for portability");
820 /* Find the first occurrence of WC in WCS. */
823 _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
826 /* On some systems, this function is defined as an overloaded function:
828 const wchar_t * std::wcschr (const wchar_t *, wchar_t);
829 wchar_t * std::wcschr (wchar_t *, wchar_t);
831 _GL_CXXALIAS_SYS_CAST2 (wcschr,
832 wchar_t *, (const wchar_t *, wchar_t),
833 const wchar_t *, (const wchar_t *, wchar_t));
834 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
835 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
836 _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
837 _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
839 _GL_CXXALIASWARN (wcschr);
841 #elif defined GNULIB_POSIXCHECK
843 # if HAVE_RAW_DECL_WCSCHR
844 _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
845 "use gnulib module wcschr for portability");
850 /* Find the last occurrence of WC in WCS. */
853 _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
856 /* On some systems, this function is defined as an overloaded function:
858 const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
859 wchar_t * std::wcsrchr (wchar_t *, wchar_t);
861 _GL_CXXALIAS_SYS_CAST2 (wcsrchr,
862 wchar_t *, (const wchar_t *, wchar_t),
863 const wchar_t *, (const wchar_t *, wchar_t));
864 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
865 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
866 _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
867 _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
869 _GL_CXXALIASWARN (wcsrchr);
871 #elif defined GNULIB_POSIXCHECK
873 # if HAVE_RAW_DECL_WCSRCHR
874 _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
875 "use gnulib module wcsrchr for portability");
880 /* Return the length of the initial segmet of WCS which consists entirely
881 of wide characters not in REJECT. */
884 _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
887 _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
888 _GL_CXXALIASWARN (wcscspn);
889 #elif defined GNULIB_POSIXCHECK
891 # if HAVE_RAW_DECL_WCSCSPN
892 _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
893 "use gnulib module wcscspn for portability");
898 /* Return the length of the initial segmet of WCS which consists entirely
899 of wide characters in ACCEPT. */
902 _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
905 _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
906 _GL_CXXALIASWARN (wcsspn);
907 #elif defined GNULIB_POSIXCHECK
909 # if HAVE_RAW_DECL_WCSSPN
910 _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
911 "use gnulib module wcsspn for portability");
916 /* Find the first occurrence in WCS of any character in ACCEPT. */
919 _GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
920 (const wchar_t *wcs, const wchar_t *accept)
923 /* On some systems, this function is defined as an overloaded function:
925 const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
926 wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
928 _GL_CXXALIAS_SYS_CAST2 (wcspbrk,
929 wchar_t *, (const wchar_t *, const wchar_t *),
930 const wchar_t *, (const wchar_t *, const wchar_t *));
931 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
932 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
933 _GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
934 (wchar_t *wcs, const wchar_t *accept));
935 _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
936 (const wchar_t *wcs, const wchar_t *accept));
938 _GL_CXXALIASWARN (wcspbrk);
940 #elif defined GNULIB_POSIXCHECK
942 # if HAVE_RAW_DECL_WCSPBRK
943 _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
944 "use gnulib module wcspbrk for portability");
949 /* Find the first occurrence of NEEDLE in HAYSTACK. */
952 _GL_FUNCDECL_SYS (wcsstr, wchar_t *,
953 (const wchar_t *haystack, const wchar_t *needle)
956 /* On some systems, this function is defined as an overloaded function:
958 const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
959 wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
961 _GL_CXXALIAS_SYS_CAST2 (wcsstr,
962 wchar_t *, (const wchar_t *, const wchar_t *),
963 const wchar_t *, (const wchar_t *, const wchar_t *));
964 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
965 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
966 _GL_CXXALIASWARN1 (wcsstr, wchar_t *,
967 (wchar_t *haystack, const wchar_t *needle));
968 _GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
969 (const wchar_t *haystack, const wchar_t *needle));
971 _GL_CXXALIASWARN (wcsstr);
973 #elif defined GNULIB_POSIXCHECK
975 # if HAVE_RAW_DECL_WCSSTR
976 _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
977 "use gnulib module wcsstr for portability");
982 /* Divide WCS into tokens separated by characters in DELIM. */
985 _GL_FUNCDECL_SYS (wcstok, wchar_t *,
986 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
988 _GL_CXXALIAS_SYS (wcstok, wchar_t *,
989 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
990 _GL_CXXALIASWARN (wcstok);
991 #elif defined GNULIB_POSIXCHECK
993 # if HAVE_RAW_DECL_WCSTOK
994 _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
995 "use gnulib module wcstok for portability");
1000 /* Determine number of column positions required for first N wide
1001 characters (or fewer if S ends before this) in S. */
1002 #if @GNULIB_WCSWIDTH@
1003 # if @REPLACE_WCSWIDTH@
1004 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1006 # define wcswidth rpl_wcswidth
1008 _GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)
1009 _GL_ATTRIBUTE_PURE);
1010 _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
1012 # if !@HAVE_WCSWIDTH@
1013 _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
1014 _GL_ATTRIBUTE_PURE);
1016 _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
1018 _GL_CXXALIASWARN (wcswidth);
1019 #elif defined GNULIB_POSIXCHECK
1021 # if HAVE_RAW_DECL_WCSWIDTH
1022 _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
1023 "use gnulib module wcswidth for portability");
1028 #endif /* _@GUARD_PREFIX@_WCHAR_H */
1029 #endif /* _@GUARD_PREFIX@_WCHAR_H */