1 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
3 Copyright (C) 2007-2012 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
10 This program 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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
18 /* Written by Eric Blake. */
21 * ISO C 99 <wchar.h> for platforms that have issues.
22 * <http://www.opengroup.org/susv3xbd/wchar.h.html>
24 * For now, this just ensures proper prerequisite inclusion order and
25 * the declaration of wcwidth().
29 @PRAGMA_SYSTEM_HEADER@
33 #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
34 /* Special invocation convention:
35 - Inside glibc and uClibc header files.
36 - On HP-UX 11.00 we have a sequence of nested includes
37 <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
38 once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
39 and once directly. In both situations 'wint_t' is not yet defined,
40 therefore we cannot provide the function overrides; instead include only
41 the system's <wchar.h>.
42 - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
43 the latter includes <wchar.h>. But here, we have no way to detect whether
44 <wctype.h> is completely included or is still being included. */
46 #@INCLUDE_NEXT@ @NEXT_WCHAR_H@
49 /* Normal invocation convention. */
51 #ifndef _@GUARD_PREFIX@_WCHAR_H
53 #define _GL_ALREADY_INCLUDING_WCHAR_H
56 # include <features.h> /* for __GLIBC__ */
59 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
61 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
62 included before <wchar.h>.
63 In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
65 But avoid namespace pollution on glibc systems. */
66 #if !(defined __GLIBC__ && !defined __UCLIBC__)
74 /* Include the original <wchar.h> if it exists.
75 Some builds of uClibc lack it. */
76 /* The include_next requires a split double-inclusion guard. */
78 # @INCLUDE_NEXT@ @NEXT_WCHAR_H@
81 #undef _GL_ALREADY_INCLUDING_WCHAR_H
83 #ifndef _@GUARD_PREFIX@_WCHAR_H
84 #define _@GUARD_PREFIX@_WCHAR_H
86 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
88 /* The definition of _GL_ARG_NONNULL is copied here. */
90 /* The definition of _GL_WARN_ON_USE is copied here. */
93 /* Define wint_t and WEOF. (Also done in wctype.in.h.) */
94 #if !@HAVE_WINT_T@ && !defined wint_t
100 /* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>.
101 This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
102 "unchanged by default argument promotions". Override it. */
103 # if defined _MSC_VER
104 # if !GNULIB_defined_wint_t
105 # include <crtdefs.h>
106 typedef unsigned int rpl_wint_t;
108 # define wint_t rpl_wint_t
109 # define GNULIB_defined_wint_t 1
113 # define WEOF ((wint_t) -1)
118 /* Override mbstate_t if it is too small.
119 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
120 implementing mbrtowc for encodings like UTF-8. */
121 #if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
122 # if !GNULIB_defined_mbstate_t
123 typedef int rpl_mbstate_t;
125 # define mbstate_t rpl_mbstate_t
126 # define GNULIB_defined_mbstate_t 1
131 /* Convert a single-byte character to a wide character. */
134 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
136 # define btowc rpl_btowc
138 _GL_FUNCDECL_RPL (btowc, wint_t, (int c));
139 _GL_CXXALIAS_RPL (btowc, wint_t, (int c));
142 _GL_FUNCDECL_SYS (btowc, wint_t, (int c));
144 _GL_CXXALIAS_SYS (btowc, wint_t, (int c));
146 _GL_CXXALIASWARN (btowc);
147 #elif defined GNULIB_POSIXCHECK
149 # if HAVE_RAW_DECL_BTOWC
150 _GL_WARN_ON_USE (btowc, "btowc is unportable - "
151 "use gnulib module btowc for portability");
156 /* Convert a wide character to a single-byte character. */
159 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
161 # define wctob rpl_wctob
163 _GL_FUNCDECL_RPL (wctob, int, (wint_t wc));
164 _GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
166 # if !defined wctob && !@HAVE_DECL_WCTOB@
167 /* wctob is provided by gnulib, or wctob exists but is not declared. */
168 _GL_FUNCDECL_SYS (wctob, int, (wint_t wc));
170 _GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
172 _GL_CXXALIASWARN (wctob);
173 #elif defined GNULIB_POSIXCHECK
175 # if HAVE_RAW_DECL_WCTOB
176 _GL_WARN_ON_USE (wctob, "wctob is unportable - "
177 "use gnulib module wctob for portability");
182 /* Test whether *PS is in the initial state. */
184 # if @REPLACE_MBSINIT@
185 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
187 # define mbsinit rpl_mbsinit
189 _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
190 _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
193 _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
195 _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
197 _GL_CXXALIASWARN (mbsinit);
198 #elif defined GNULIB_POSIXCHECK
200 # if HAVE_RAW_DECL_MBSINIT
201 _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
202 "use gnulib module mbsinit for portability");
207 /* Convert a multibyte character to a wide character. */
209 # if @REPLACE_MBRTOWC@
210 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
212 # define mbrtowc rpl_mbrtowc
214 _GL_FUNCDECL_RPL (mbrtowc, size_t,
215 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
216 _GL_CXXALIAS_RPL (mbrtowc, size_t,
217 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
220 _GL_FUNCDECL_SYS (mbrtowc, size_t,
221 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
223 _GL_CXXALIAS_SYS (mbrtowc, size_t,
224 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
226 _GL_CXXALIASWARN (mbrtowc);
227 #elif defined GNULIB_POSIXCHECK
229 # if HAVE_RAW_DECL_MBRTOWC
230 _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
231 "use gnulib module mbrtowc for portability");
236 /* Recognize a multibyte character. */
238 # if @REPLACE_MBRLEN@
239 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
241 # define mbrlen rpl_mbrlen
243 _GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
244 _GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
247 _GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
249 _GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
251 _GL_CXXALIASWARN (mbrlen);
252 #elif defined GNULIB_POSIXCHECK
254 # if HAVE_RAW_DECL_MBRLEN
255 _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
256 "use gnulib module mbrlen for portability");
261 /* Convert a string to a wide string. */
262 #if @GNULIB_MBSRTOWCS@
263 # if @REPLACE_MBSRTOWCS@
264 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
266 # define mbsrtowcs rpl_mbsrtowcs
268 _GL_FUNCDECL_RPL (mbsrtowcs, size_t,
269 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
270 _GL_ARG_NONNULL ((2)));
271 _GL_CXXALIAS_RPL (mbsrtowcs, size_t,
272 (wchar_t *dest, const char **srcp, size_t len,
275 # if !@HAVE_MBSRTOWCS@
276 _GL_FUNCDECL_SYS (mbsrtowcs, size_t,
277 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
278 _GL_ARG_NONNULL ((2)));
280 _GL_CXXALIAS_SYS (mbsrtowcs, size_t,
281 (wchar_t *dest, const char **srcp, size_t len,
284 _GL_CXXALIASWARN (mbsrtowcs);
285 #elif defined GNULIB_POSIXCHECK
287 # if HAVE_RAW_DECL_MBSRTOWCS
288 _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
289 "use gnulib module mbsrtowcs for portability");
294 /* Convert a string to a wide string. */
295 #if @GNULIB_MBSNRTOWCS@
296 # if @REPLACE_MBSNRTOWCS@
297 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
299 # define mbsnrtowcs rpl_mbsnrtowcs
301 _GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
302 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
304 _GL_ARG_NONNULL ((2)));
305 _GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
306 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
309 # if !@HAVE_MBSNRTOWCS@
310 _GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
311 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
313 _GL_ARG_NONNULL ((2)));
315 _GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
316 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
319 _GL_CXXALIASWARN (mbsnrtowcs);
320 #elif defined GNULIB_POSIXCHECK
322 # if HAVE_RAW_DECL_MBSNRTOWCS
323 _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
324 "use gnulib module mbsnrtowcs for portability");
329 /* Convert a wide character to a multibyte character. */
331 # if @REPLACE_WCRTOMB@
332 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
334 # define wcrtomb rpl_wcrtomb
336 _GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
337 _GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
340 _GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
342 _GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
344 _GL_CXXALIASWARN (wcrtomb);
345 #elif defined GNULIB_POSIXCHECK
347 # if HAVE_RAW_DECL_WCRTOMB
348 _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
349 "use gnulib module wcrtomb for portability");
354 /* Convert a wide string to a string. */
355 #if @GNULIB_WCSRTOMBS@
356 # if @REPLACE_WCSRTOMBS@
357 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
359 # define wcsrtombs rpl_wcsrtombs
361 _GL_FUNCDECL_RPL (wcsrtombs, size_t,
362 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
363 _GL_ARG_NONNULL ((2)));
364 _GL_CXXALIAS_RPL (wcsrtombs, size_t,
365 (char *dest, const wchar_t **srcp, size_t len,
368 # if !@HAVE_WCSRTOMBS@
369 _GL_FUNCDECL_SYS (wcsrtombs, size_t,
370 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
371 _GL_ARG_NONNULL ((2)));
373 _GL_CXXALIAS_SYS (wcsrtombs, size_t,
374 (char *dest, const wchar_t **srcp, size_t len,
377 _GL_CXXALIASWARN (wcsrtombs);
378 #elif defined GNULIB_POSIXCHECK
380 # if HAVE_RAW_DECL_WCSRTOMBS
381 _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
382 "use gnulib module wcsrtombs for portability");
387 /* Convert a wide string to a string. */
388 #if @GNULIB_WCSNRTOMBS@
389 # if @REPLACE_WCSNRTOMBS@
390 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
392 # define wcsnrtombs rpl_wcsnrtombs
394 _GL_FUNCDECL_RPL (wcsnrtombs, size_t,
395 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
397 _GL_ARG_NONNULL ((2)));
398 _GL_CXXALIAS_RPL (wcsnrtombs, size_t,
399 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
402 # if !@HAVE_WCSNRTOMBS@
403 _GL_FUNCDECL_SYS (wcsnrtombs, size_t,
404 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
406 _GL_ARG_NONNULL ((2)));
408 _GL_CXXALIAS_SYS (wcsnrtombs, size_t,
409 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
412 _GL_CXXALIASWARN (wcsnrtombs);
413 #elif defined GNULIB_POSIXCHECK
415 # if HAVE_RAW_DECL_WCSNRTOMBS
416 _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
417 "use gnulib module wcsnrtombs for portability");
422 /* Return the number of screen columns needed for WC. */
424 # if @REPLACE_WCWIDTH@
425 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
427 # define wcwidth rpl_wcwidth
429 _GL_FUNCDECL_RPL (wcwidth, int, (wchar_t));
430 _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
432 # if !@HAVE_DECL_WCWIDTH@
433 /* wcwidth exists but is not declared. */
434 _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t));
436 _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
438 _GL_CXXALIASWARN (wcwidth);
439 #elif defined GNULIB_POSIXCHECK
441 # if HAVE_RAW_DECL_WCWIDTH
442 _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
443 "use gnulib module wcwidth for portability");
448 /* Search N wide characters of S for C. */
451 _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
453 /* On some systems, this function is defined as an overloaded function:
455 const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
456 wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
458 _GL_CXXALIAS_SYS_CAST2 (wmemchr,
459 wchar_t *, (const wchar_t *, wchar_t, size_t),
460 const wchar_t *, (const wchar_t *, wchar_t, size_t));
461 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
462 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
463 _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
464 _GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
465 (const wchar_t *s, wchar_t c, size_t n));
467 _GL_CXXALIASWARN (wmemchr);
469 #elif defined GNULIB_POSIXCHECK
471 # if HAVE_RAW_DECL_WMEMCHR
472 _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
473 "use gnulib module wmemchr for portability");
478 /* Compare N wide characters of S1 and S2. */
481 _GL_FUNCDECL_SYS (wmemcmp, int,
482 (const wchar_t *s1, const wchar_t *s2, size_t n));
484 _GL_CXXALIAS_SYS (wmemcmp, int,
485 (const wchar_t *s1, const wchar_t *s2, size_t n));
486 _GL_CXXALIASWARN (wmemcmp);
487 #elif defined GNULIB_POSIXCHECK
489 # if HAVE_RAW_DECL_WMEMCMP
490 _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
491 "use gnulib module wmemcmp for portability");
496 /* Copy N wide characters of SRC to DEST. */
499 _GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
500 (wchar_t *dest, const wchar_t *src, size_t n));
502 _GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
503 (wchar_t *dest, const wchar_t *src, size_t n));
504 _GL_CXXALIASWARN (wmemcpy);
505 #elif defined GNULIB_POSIXCHECK
507 # if HAVE_RAW_DECL_WMEMCPY
508 _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
509 "use gnulib module wmemcpy for portability");
514 /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
515 overlapping memory areas. */
516 #if @GNULIB_WMEMMOVE@
517 # if !@HAVE_WMEMMOVE@
518 _GL_FUNCDECL_SYS (wmemmove, wchar_t *,
519 (wchar_t *dest, const wchar_t *src, size_t n));
521 _GL_CXXALIAS_SYS (wmemmove, wchar_t *,
522 (wchar_t *dest, const wchar_t *src, size_t n));
523 _GL_CXXALIASWARN (wmemmove);
524 #elif defined GNULIB_POSIXCHECK
526 # if HAVE_RAW_DECL_WMEMMOVE
527 _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
528 "use gnulib module wmemmove for portability");
533 /* Set N wide characters of S to C. */
536 _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
538 _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
539 _GL_CXXALIASWARN (wmemset);
540 #elif defined GNULIB_POSIXCHECK
542 # if HAVE_RAW_DECL_WMEMSET
543 _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
544 "use gnulib module wmemset for portability");
549 /* Return the number of wide characters in S. */
552 _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s));
554 _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
555 _GL_CXXALIASWARN (wcslen);
556 #elif defined GNULIB_POSIXCHECK
558 # if HAVE_RAW_DECL_WCSLEN
559 _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
560 "use gnulib module wcslen for portability");
565 /* Return the number of wide characters in S, but at most MAXLEN. */
568 _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
570 _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
571 _GL_CXXALIASWARN (wcsnlen);
572 #elif defined GNULIB_POSIXCHECK
574 # if HAVE_RAW_DECL_WCSNLEN
575 _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
576 "use gnulib module wcsnlen for portability");
581 /* Copy SRC to DEST. */
584 _GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
586 _GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
587 _GL_CXXALIASWARN (wcscpy);
588 #elif defined GNULIB_POSIXCHECK
590 # if HAVE_RAW_DECL_WCSCPY
591 _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
592 "use gnulib module wcscpy for portability");
597 /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
600 _GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
602 _GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
603 _GL_CXXALIASWARN (wcpcpy);
604 #elif defined GNULIB_POSIXCHECK
606 # if HAVE_RAW_DECL_WCPCPY
607 _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
608 "use gnulib module wcpcpy for portability");
613 /* Copy no more than N wide characters of SRC to DEST. */
616 _GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
617 (wchar_t *dest, const wchar_t *src, size_t n));
619 _GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
620 (wchar_t *dest, const wchar_t *src, size_t n));
621 _GL_CXXALIASWARN (wcsncpy);
622 #elif defined GNULIB_POSIXCHECK
624 # if HAVE_RAW_DECL_WCSNCPY
625 _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
626 "use gnulib module wcsncpy for portability");
631 /* Copy no more than N characters of SRC to DEST, returning the address of
632 the last character written into DEST. */
635 _GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
636 (wchar_t *dest, const wchar_t *src, size_t n));
638 _GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
639 (wchar_t *dest, const wchar_t *src, size_t n));
640 _GL_CXXALIASWARN (wcpncpy);
641 #elif defined GNULIB_POSIXCHECK
643 # if HAVE_RAW_DECL_WCPNCPY
644 _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
645 "use gnulib module wcpncpy for portability");
650 /* Append SRC onto DEST. */
653 _GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
655 _GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
656 _GL_CXXALIASWARN (wcscat);
657 #elif defined GNULIB_POSIXCHECK
659 # if HAVE_RAW_DECL_WCSCAT
660 _GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
661 "use gnulib module wcscat for portability");
666 /* Append no more than N wide characters of SRC onto DEST. */
669 _GL_FUNCDECL_SYS (wcsncat, wchar_t *,
670 (wchar_t *dest, const wchar_t *src, size_t n));
672 _GL_CXXALIAS_SYS (wcsncat, wchar_t *,
673 (wchar_t *dest, const wchar_t *src, size_t n));
674 _GL_CXXALIASWARN (wcsncat);
675 #elif defined GNULIB_POSIXCHECK
677 # if HAVE_RAW_DECL_WCSNCAT
678 _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
679 "use gnulib module wcsncat for portability");
684 /* Compare S1 and S2. */
687 _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
689 _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
690 _GL_CXXALIASWARN (wcscmp);
691 #elif defined GNULIB_POSIXCHECK
693 # if HAVE_RAW_DECL_WCSCMP
694 _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
695 "use gnulib module wcscmp for portability");
700 /* Compare no more than N wide characters of S1 and S2. */
703 _GL_FUNCDECL_SYS (wcsncmp, int,
704 (const wchar_t *s1, const wchar_t *s2, size_t n));
706 _GL_CXXALIAS_SYS (wcsncmp, int,
707 (const wchar_t *s1, const wchar_t *s2, size_t n));
708 _GL_CXXALIASWARN (wcsncmp);
709 #elif defined GNULIB_POSIXCHECK
711 # if HAVE_RAW_DECL_WCSNCMP
712 _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
713 "use gnulib module wcsncmp for portability");
718 /* Compare S1 and S2, ignoring case. */
719 #if @GNULIB_WCSCASECMP@
720 # if !@HAVE_WCSCASECMP@
721 _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
723 _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
724 _GL_CXXALIASWARN (wcscasecmp);
725 #elif defined GNULIB_POSIXCHECK
727 # if HAVE_RAW_DECL_WCSCASECMP
728 _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
729 "use gnulib module wcscasecmp for portability");
734 /* Compare no more than N chars of S1 and S2, ignoring case. */
735 #if @GNULIB_WCSNCASECMP@
736 # if !@HAVE_WCSNCASECMP@
737 _GL_FUNCDECL_SYS (wcsncasecmp, int,
738 (const wchar_t *s1, const wchar_t *s2, size_t n));
740 _GL_CXXALIAS_SYS (wcsncasecmp, int,
741 (const wchar_t *s1, const wchar_t *s2, size_t n));
742 _GL_CXXALIASWARN (wcsncasecmp);
743 #elif defined GNULIB_POSIXCHECK
745 # if HAVE_RAW_DECL_WCSNCASECMP
746 _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
747 "use gnulib module wcsncasecmp for portability");
752 /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
753 category of the current locale. */
756 _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
758 _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
759 _GL_CXXALIASWARN (wcscoll);
760 #elif defined GNULIB_POSIXCHECK
762 # if HAVE_RAW_DECL_WCSCOLL
763 _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
764 "use gnulib module wcscoll for portability");
769 /* Transform S2 into array pointed to by S1 such that if wcscmp is applied
770 to two transformed strings the result is the as applying 'wcscoll' to the
774 _GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
776 _GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
777 _GL_CXXALIASWARN (wcsxfrm);
778 #elif defined GNULIB_POSIXCHECK
780 # if HAVE_RAW_DECL_WCSXFRM
781 _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
782 "use gnulib module wcsxfrm for portability");
787 /* Duplicate S, returning an identical malloc'd string. */
790 _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
792 _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
793 _GL_CXXALIASWARN (wcsdup);
794 #elif defined GNULIB_POSIXCHECK
796 # if HAVE_RAW_DECL_WCSDUP
797 _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
798 "use gnulib module wcsdup for portability");
803 /* Find the first occurrence of WC in WCS. */
806 _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
808 /* On some systems, this function is defined as an overloaded function:
810 const wchar_t * std::wcschr (const wchar_t *, wchar_t);
811 wchar_t * std::wcschr (wchar_t *, wchar_t);
813 _GL_CXXALIAS_SYS_CAST2 (wcschr,
814 wchar_t *, (const wchar_t *, wchar_t),
815 const wchar_t *, (const wchar_t *, wchar_t));
816 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
817 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
818 _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
819 _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
821 _GL_CXXALIASWARN (wcschr);
823 #elif defined GNULIB_POSIXCHECK
825 # if HAVE_RAW_DECL_WCSCHR
826 _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
827 "use gnulib module wcschr for portability");
832 /* Find the last occurrence of WC in WCS. */
835 _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
837 /* On some systems, this function is defined as an overloaded function:
839 const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
840 wchar_t * std::wcsrchr (wchar_t *, wchar_t);
842 _GL_CXXALIAS_SYS_CAST2 (wcsrchr,
843 wchar_t *, (const wchar_t *, wchar_t),
844 const wchar_t *, (const wchar_t *, wchar_t));
845 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
846 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
847 _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
848 _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
850 _GL_CXXALIASWARN (wcsrchr);
852 #elif defined GNULIB_POSIXCHECK
854 # if HAVE_RAW_DECL_WCSRCHR
855 _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
856 "use gnulib module wcsrchr for portability");
861 /* Return the length of the initial segmet of WCS which consists entirely
862 of wide characters not in REJECT. */
865 _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
867 _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
868 _GL_CXXALIASWARN (wcscspn);
869 #elif defined GNULIB_POSIXCHECK
871 # if HAVE_RAW_DECL_WCSCSPN
872 _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
873 "use gnulib module wcscspn for portability");
878 /* Return the length of the initial segmet of WCS which consists entirely
879 of wide characters in ACCEPT. */
882 _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
884 _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
885 _GL_CXXALIASWARN (wcsspn);
886 #elif defined GNULIB_POSIXCHECK
888 # if HAVE_RAW_DECL_WCSSPN
889 _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
890 "use gnulib module wcsspn for portability");
895 /* Find the first occurrence in WCS of any character in ACCEPT. */
898 _GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
899 (const wchar_t *wcs, const wchar_t *accept));
901 /* On some systems, this function is defined as an overloaded function:
903 const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
904 wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
906 _GL_CXXALIAS_SYS_CAST2 (wcspbrk,
907 wchar_t *, (const wchar_t *, const wchar_t *),
908 const wchar_t *, (const wchar_t *, const wchar_t *));
909 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
910 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
911 _GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
912 (wchar_t *wcs, const wchar_t *accept));
913 _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
914 (const wchar_t *wcs, const wchar_t *accept));
916 _GL_CXXALIASWARN (wcspbrk);
918 #elif defined GNULIB_POSIXCHECK
920 # if HAVE_RAW_DECL_WCSPBRK
921 _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
922 "use gnulib module wcspbrk for portability");
927 /* Find the first occurrence of NEEDLE in HAYSTACK. */
930 _GL_FUNCDECL_SYS (wcsstr, wchar_t *,
931 (const wchar_t *haystack, const wchar_t *needle));
933 /* On some systems, this function is defined as an overloaded function:
935 const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
936 wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
938 _GL_CXXALIAS_SYS_CAST2 (wcsstr,
939 wchar_t *, (const wchar_t *, const wchar_t *),
940 const wchar_t *, (const wchar_t *, const wchar_t *));
941 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
942 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
943 _GL_CXXALIASWARN1 (wcsstr, wchar_t *,
944 (wchar_t *haystack, const wchar_t *needle));
945 _GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
946 (const wchar_t *haystack, const wchar_t *needle));
948 _GL_CXXALIASWARN (wcsstr);
950 #elif defined GNULIB_POSIXCHECK
952 # if HAVE_RAW_DECL_WCSSTR
953 _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
954 "use gnulib module wcsstr for portability");
959 /* Divide WCS into tokens separated by characters in DELIM. */
962 _GL_FUNCDECL_SYS (wcstok, wchar_t *,
963 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
965 _GL_CXXALIAS_SYS (wcstok, wchar_t *,
966 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
967 _GL_CXXALIASWARN (wcstok);
968 #elif defined GNULIB_POSIXCHECK
970 # if HAVE_RAW_DECL_WCSTOK
971 _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
972 "use gnulib module wcstok for portability");
977 /* Determine number of column positions required for first N wide
978 characters (or fewer if S ends before this) in S. */
979 #if @GNULIB_WCSWIDTH@
980 # if @REPLACE_WCSWIDTH@
981 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
983 # define wcswidth rpl_wcswidth
985 _GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n));
986 _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
988 # if !@HAVE_WCSWIDTH@
989 _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n));
991 _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
993 _GL_CXXALIASWARN (wcswidth);
994 #elif defined GNULIB_POSIXCHECK
996 # if HAVE_RAW_DECL_WCSWIDTH
997 _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
998 "use gnulib module wcswidth for portability");
1003 #endif /* _@GUARD_PREFIX@_WCHAR_H */
1004 #endif /* _@GUARD_PREFIX@_WCHAR_H */