summaryrefslogtreecommitdiffstats
path: root/gl/wchar.in.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/wchar.in.h')
-rw-r--r--gl/wchar.in.h636
1 files changed, 618 insertions, 18 deletions
diff --git a/gl/wchar.in.h b/gl/wchar.in.h
index 88d47db..b6e4362 100644
--- a/gl/wchar.in.h
+++ b/gl/wchar.in.h
@@ -1,6 +1,6 @@
1/* A substitute for ISO C99 <wchar.h>, for platforms that have issues. 1/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
2 2
3 Copyright (C) 2007-2010 Free Software Foundation, Inc. 3 Copyright (C) 2007-2013 Free Software Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -13,8 +13,7 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation, 16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 17
19/* Written by Eric Blake. */ 18/* Written by Eric Blake. */
20 19
@@ -29,6 +28,7 @@
29#if __GNUC__ >= 3 28#if __GNUC__ >= 3
30@PRAGMA_SYSTEM_HEADER@ 29@PRAGMA_SYSTEM_HEADER@
31#endif 30#endif
31@PRAGMA_COLUMNS@
32 32
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 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: 34/* Special invocation convention:
@@ -48,17 +48,25 @@
48#else 48#else
49/* Normal invocation convention. */ 49/* Normal invocation convention. */
50 50
51#ifndef _GL_WCHAR_H 51#ifndef _@GUARD_PREFIX@_WCHAR_H
52 52
53#define _GL_ALREADY_INCLUDING_WCHAR_H 53#define _GL_ALREADY_INCLUDING_WCHAR_H
54 54
55#if @HAVE_FEATURES_H@
56# include <features.h> /* for __GLIBC__ */
57#endif
58
55/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before 59/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
56 <wchar.h>. 60 <wchar.h>.
57 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be 61 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
58 included before <wchar.h>. 62 included before <wchar.h>.
63 In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
64 by <stddef.h>.
59 But avoid namespace pollution on glibc systems. */ 65 But avoid namespace pollution on glibc systems. */
60#ifndef __GLIBC__ 66#if !(defined __GLIBC__ && !defined __UCLIBC__)
61# include <stddef.h> 67# include <stddef.h>
68#endif
69#ifndef __GLIBC__
62# include <stdio.h> 70# include <stdio.h>
63# include <time.h> 71# include <time.h>
64#endif 72#endif
@@ -72,8 +80,16 @@
72 80
73#undef _GL_ALREADY_INCLUDING_WCHAR_H 81#undef _GL_ALREADY_INCLUDING_WCHAR_H
74 82
75#ifndef _GL_WCHAR_H 83#ifndef _@GUARD_PREFIX@_WCHAR_H
76#define _GL_WCHAR_H 84#define _@GUARD_PREFIX@_WCHAR_H
85
86/* The __attribute__ feature is available in gcc versions 2.5 and later.
87 The attribute __pure__ was added in gcc 2.96. */
88#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
89# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
90#else
91# define _GL_ATTRIBUTE_PURE /* empty */
92#endif
77 93
78/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 94/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
79 95
@@ -89,6 +105,18 @@
89# define WEOF -1 105# define WEOF -1
90# endif 106# endif
91#else 107#else
108/* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>.
109 This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
110 "unchanged by default argument promotions". Override it. */
111# if defined _MSC_VER
112# if !GNULIB_defined_wint_t
113# include <crtdefs.h>
114typedef unsigned int rpl_wint_t;
115# undef wint_t
116# define wint_t rpl_wint_t
117# define GNULIB_defined_wint_t 1
118# endif
119# endif
92# ifndef WEOF 120# ifndef WEOF
93# define WEOF ((wint_t) -1) 121# define WEOF ((wint_t) -1)
94# endif 122# endif
@@ -99,10 +127,12 @@
99 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for 127 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
100 implementing mbrtowc for encodings like UTF-8. */ 128 implementing mbrtowc for encodings like UTF-8. */
101#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ 129#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
130# if !GNULIB_defined_mbstate_t
102typedef int rpl_mbstate_t; 131typedef int rpl_mbstate_t;
103# undef mbstate_t 132# undef mbstate_t
104# define mbstate_t rpl_mbstate_t 133# define mbstate_t rpl_mbstate_t
105# define GNULIB_defined_mbstate_t 1 134# define GNULIB_defined_mbstate_t 1
135# endif
106#endif 136#endif
107 137
108 138
@@ -113,11 +143,11 @@ typedef int rpl_mbstate_t;
113# undef btowc 143# undef btowc
114# define btowc rpl_btowc 144# define btowc rpl_btowc
115# endif 145# endif
116_GL_FUNCDECL_RPL (btowc, wint_t, (int c)); 146_GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
117_GL_CXXALIAS_RPL (btowc, wint_t, (int c)); 147_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
118# else 148# else
119# if !@HAVE_BTOWC@ 149# if !@HAVE_BTOWC@
120_GL_FUNCDECL_SYS (btowc, wint_t, (int c)); 150_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
121# endif 151# endif
122_GL_CXXALIAS_SYS (btowc, wint_t, (int c)); 152_GL_CXXALIAS_SYS (btowc, wint_t, (int c));
123# endif 153# endif
@@ -138,12 +168,12 @@ _GL_WARN_ON_USE (btowc, "btowc is unportable - "
138# undef wctob 168# undef wctob
139# define wctob rpl_wctob 169# define wctob rpl_wctob
140# endif 170# endif
141_GL_FUNCDECL_RPL (wctob, int, (wint_t wc)); 171_GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
142_GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); 172_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
143# else 173# else
144# if !defined wctob && !@HAVE_DECL_WCTOB@ 174# if !defined wctob && !@HAVE_DECL_WCTOB@
145/* wctob is provided by gnulib, or wctob exists but is not declared. */ 175/* wctob is provided by gnulib, or wctob exists but is not declared. */
146_GL_FUNCDECL_SYS (wctob, int, (wint_t wc)); 176_GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
147# endif 177# endif
148_GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); 178_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
149# endif 179# endif
@@ -404,12 +434,12 @@ _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
404# undef wcwidth 434# undef wcwidth
405# define wcwidth rpl_wcwidth 435# define wcwidth rpl_wcwidth
406# endif 436# endif
407_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t)); 437_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
408_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); 438_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
409# else 439# else
410# if !@HAVE_DECL_WCWIDTH@ 440# if !@HAVE_DECL_WCWIDTH@
411/* wcwidth exists but is not declared. */ 441/* wcwidth exists but is not declared. */
412_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t)); 442_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
413# endif 443# endif
414_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); 444_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
415# endif 445# endif
@@ -423,6 +453,576 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
423#endif 453#endif
424 454
425 455
426#endif /* _GL_WCHAR_H */ 456/* Search N wide characters of S for C. */
427#endif /* _GL_WCHAR_H */ 457#if @GNULIB_WMEMCHR@
458# if !@HAVE_WMEMCHR@
459_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
460 _GL_ATTRIBUTE_PURE);
461# endif
462 /* On some systems, this function is defined as an overloaded function:
463 extern "C++" {
464 const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
465 wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
466 } */
467_GL_CXXALIAS_SYS_CAST2 (wmemchr,
468 wchar_t *, (const wchar_t *, wchar_t, size_t),
469 const wchar_t *, (const wchar_t *, wchar_t, size_t));
470# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
471 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
472_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
473_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
474 (const wchar_t *s, wchar_t c, size_t n));
475# else
476_GL_CXXALIASWARN (wmemchr);
477# endif
478#elif defined GNULIB_POSIXCHECK
479# undef wmemchr
480# if HAVE_RAW_DECL_WMEMCHR
481_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
482 "use gnulib module wmemchr for portability");
483# endif
484#endif
485
486
487/* Compare N wide characters of S1 and S2. */
488#if @GNULIB_WMEMCMP@
489# if !@HAVE_WMEMCMP@
490_GL_FUNCDECL_SYS (wmemcmp, int,
491 (const wchar_t *s1, const wchar_t *s2, size_t n)
492 _GL_ATTRIBUTE_PURE);
493# endif
494_GL_CXXALIAS_SYS (wmemcmp, int,
495 (const wchar_t *s1, const wchar_t *s2, size_t n));
496_GL_CXXALIASWARN (wmemcmp);
497#elif defined GNULIB_POSIXCHECK
498# undef wmemcmp
499# if HAVE_RAW_DECL_WMEMCMP
500_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
501 "use gnulib module wmemcmp for portability");
502# endif
503#endif
504
505
506/* Copy N wide characters of SRC to DEST. */
507#if @GNULIB_WMEMCPY@
508# if !@HAVE_WMEMCPY@
509_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
510 (wchar_t *dest, const wchar_t *src, size_t n));
511# endif
512_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
513 (wchar_t *dest, const wchar_t *src, size_t n));
514_GL_CXXALIASWARN (wmemcpy);
515#elif defined GNULIB_POSIXCHECK
516# undef wmemcpy
517# if HAVE_RAW_DECL_WMEMCPY
518_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
519 "use gnulib module wmemcpy for portability");
520# endif
521#endif
522
523
524/* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
525 overlapping memory areas. */
526#if @GNULIB_WMEMMOVE@
527# if !@HAVE_WMEMMOVE@
528_GL_FUNCDECL_SYS (wmemmove, wchar_t *,
529 (wchar_t *dest, const wchar_t *src, size_t n));
530# endif
531_GL_CXXALIAS_SYS (wmemmove, wchar_t *,
532 (wchar_t *dest, const wchar_t *src, size_t n));
533_GL_CXXALIASWARN (wmemmove);
534#elif defined GNULIB_POSIXCHECK
535# undef wmemmove
536# if HAVE_RAW_DECL_WMEMMOVE
537_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
538 "use gnulib module wmemmove for portability");
539# endif
540#endif
541
542
543/* Set N wide characters of S to C. */
544#if @GNULIB_WMEMSET@
545# if !@HAVE_WMEMSET@
546_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
547# endif
548_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
549_GL_CXXALIASWARN (wmemset);
550#elif defined GNULIB_POSIXCHECK
551# undef wmemset
552# if HAVE_RAW_DECL_WMEMSET
553_GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
554 "use gnulib module wmemset for portability");
555# endif
556#endif
557
558
559/* Return the number of wide characters in S. */
560#if @GNULIB_WCSLEN@
561# if !@HAVE_WCSLEN@
562_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
563# endif
564_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
565_GL_CXXALIASWARN (wcslen);
566#elif defined GNULIB_POSIXCHECK
567# undef wcslen
568# if HAVE_RAW_DECL_WCSLEN
569_GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
570 "use gnulib module wcslen for portability");
571# endif
572#endif
573
574
575/* Return the number of wide characters in S, but at most MAXLEN. */
576#if @GNULIB_WCSNLEN@
577# if !@HAVE_WCSNLEN@
578_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)
579 _GL_ATTRIBUTE_PURE);
580# endif
581_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
582_GL_CXXALIASWARN (wcsnlen);
583#elif defined GNULIB_POSIXCHECK
584# undef wcsnlen
585# if HAVE_RAW_DECL_WCSNLEN
586_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
587 "use gnulib module wcsnlen for portability");
588# endif
589#endif
590
591
592/* Copy SRC to DEST. */
593#if @GNULIB_WCSCPY@
594# if !@HAVE_WCSCPY@
595_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
596# endif
597_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
598_GL_CXXALIASWARN (wcscpy);
599#elif defined GNULIB_POSIXCHECK
600# undef wcscpy
601# if HAVE_RAW_DECL_WCSCPY
602_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
603 "use gnulib module wcscpy for portability");
604# endif
605#endif
606
607
608/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
609#if @GNULIB_WCPCPY@
610# if !@HAVE_WCPCPY@
611_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
612# endif
613_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
614_GL_CXXALIASWARN (wcpcpy);
615#elif defined GNULIB_POSIXCHECK
616# undef wcpcpy
617# if HAVE_RAW_DECL_WCPCPY
618_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
619 "use gnulib module wcpcpy for portability");
620# endif
621#endif
622
623
624/* Copy no more than N wide characters of SRC to DEST. */
625#if @GNULIB_WCSNCPY@
626# if !@HAVE_WCSNCPY@
627_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
628 (wchar_t *dest, const wchar_t *src, size_t n));
629# endif
630_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
631 (wchar_t *dest, const wchar_t *src, size_t n));
632_GL_CXXALIASWARN (wcsncpy);
633#elif defined GNULIB_POSIXCHECK
634# undef wcsncpy
635# if HAVE_RAW_DECL_WCSNCPY
636_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
637 "use gnulib module wcsncpy for portability");
638# endif
639#endif
640
641
642/* Copy no more than N characters of SRC to DEST, returning the address of
643 the last character written into DEST. */
644#if @GNULIB_WCPNCPY@
645# if !@HAVE_WCPNCPY@
646_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
647 (wchar_t *dest, const wchar_t *src, size_t n));
648# endif
649_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
650 (wchar_t *dest, const wchar_t *src, size_t n));
651_GL_CXXALIASWARN (wcpncpy);
652#elif defined GNULIB_POSIXCHECK
653# undef wcpncpy
654# if HAVE_RAW_DECL_WCPNCPY
655_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
656 "use gnulib module wcpncpy for portability");
657# endif
658#endif
659
660
661/* Append SRC onto DEST. */
662#if @GNULIB_WCSCAT@
663# if !@HAVE_WCSCAT@
664_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
665# endif
666_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
667_GL_CXXALIASWARN (wcscat);
668#elif defined GNULIB_POSIXCHECK
669# undef wcscat
670# if HAVE_RAW_DECL_WCSCAT
671_GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
672 "use gnulib module wcscat for portability");
673# endif
674#endif
675
676
677/* Append no more than N wide characters of SRC onto DEST. */
678#if @GNULIB_WCSNCAT@
679# if !@HAVE_WCSNCAT@
680_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
681 (wchar_t *dest, const wchar_t *src, size_t n));
682# endif
683_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
684 (wchar_t *dest, const wchar_t *src, size_t n));
685_GL_CXXALIASWARN (wcsncat);
686#elif defined GNULIB_POSIXCHECK
687# undef wcsncat
688# if HAVE_RAW_DECL_WCSNCAT
689_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
690 "use gnulib module wcsncat for portability");
691# endif
692#endif
693
694
695/* Compare S1 and S2. */
696#if @GNULIB_WCSCMP@
697# if !@HAVE_WCSCMP@
698_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
699 _GL_ATTRIBUTE_PURE);
700# endif
701_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
702_GL_CXXALIASWARN (wcscmp);
703#elif defined GNULIB_POSIXCHECK
704# undef wcscmp
705# if HAVE_RAW_DECL_WCSCMP
706_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
707 "use gnulib module wcscmp for portability");
708# endif
709#endif
710
711
712/* Compare no more than N wide characters of S1 and S2. */
713#if @GNULIB_WCSNCMP@
714# if !@HAVE_WCSNCMP@
715_GL_FUNCDECL_SYS (wcsncmp, int,
716 (const wchar_t *s1, const wchar_t *s2, size_t n)
717 _GL_ATTRIBUTE_PURE);
718# endif
719_GL_CXXALIAS_SYS (wcsncmp, int,
720 (const wchar_t *s1, const wchar_t *s2, size_t n));
721_GL_CXXALIASWARN (wcsncmp);
722#elif defined GNULIB_POSIXCHECK
723# undef wcsncmp
724# if HAVE_RAW_DECL_WCSNCMP
725_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
726 "use gnulib module wcsncmp for portability");
727# endif
728#endif
729
730
731/* Compare S1 and S2, ignoring case. */
732#if @GNULIB_WCSCASECMP@
733# if !@HAVE_WCSCASECMP@
734_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)
735 _GL_ATTRIBUTE_PURE);
736# endif
737_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
738_GL_CXXALIASWARN (wcscasecmp);
739#elif defined GNULIB_POSIXCHECK
740# undef wcscasecmp
741# if HAVE_RAW_DECL_WCSCASECMP
742_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
743 "use gnulib module wcscasecmp for portability");
744# endif
745#endif
746
747
748/* Compare no more than N chars of S1 and S2, ignoring case. */
749#if @GNULIB_WCSNCASECMP@
750# if !@HAVE_WCSNCASECMP@
751_GL_FUNCDECL_SYS (wcsncasecmp, int,
752 (const wchar_t *s1, const wchar_t *s2, size_t n)
753 _GL_ATTRIBUTE_PURE);
754# endif
755_GL_CXXALIAS_SYS (wcsncasecmp, int,
756 (const wchar_t *s1, const wchar_t *s2, size_t n));
757_GL_CXXALIASWARN (wcsncasecmp);
758#elif defined GNULIB_POSIXCHECK
759# undef wcsncasecmp
760# if HAVE_RAW_DECL_WCSNCASECMP
761_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
762 "use gnulib module wcsncasecmp for portability");
763# endif
764#endif
765
766
767/* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
768 category of the current locale. */
769#if @GNULIB_WCSCOLL@
770# if !@HAVE_WCSCOLL@
771_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
772# endif
773_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
774_GL_CXXALIASWARN (wcscoll);
775#elif defined GNULIB_POSIXCHECK
776# undef wcscoll
777# if HAVE_RAW_DECL_WCSCOLL
778_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
779 "use gnulib module wcscoll for portability");
780# endif
781#endif
782
783
784/* Transform S2 into array pointed to by S1 such that if wcscmp is applied
785 to two transformed strings the result is the as applying 'wcscoll' to the
786 original strings. */
787#if @GNULIB_WCSXFRM@
788# if !@HAVE_WCSXFRM@
789_GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
790# endif
791_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
792_GL_CXXALIASWARN (wcsxfrm);
793#elif defined GNULIB_POSIXCHECK
794# undef wcsxfrm
795# if HAVE_RAW_DECL_WCSXFRM
796_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
797 "use gnulib module wcsxfrm for portability");
798# endif
799#endif
800
801
802/* Duplicate S, returning an identical malloc'd string. */
803#if @GNULIB_WCSDUP@
804# if !@HAVE_WCSDUP@
805_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
806# endif
807_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
808_GL_CXXALIASWARN (wcsdup);
809#elif defined GNULIB_POSIXCHECK
810# undef wcsdup
811# if HAVE_RAW_DECL_WCSDUP
812_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
813 "use gnulib module wcsdup for portability");
814# endif
815#endif
816
817
818/* Find the first occurrence of WC in WCS. */
819#if @GNULIB_WCSCHR@
820# if !@HAVE_WCSCHR@
821_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
822 _GL_ATTRIBUTE_PURE);
823# endif
824 /* On some systems, this function is defined as an overloaded function:
825 extern "C++" {
826 const wchar_t * std::wcschr (const wchar_t *, wchar_t);
827 wchar_t * std::wcschr (wchar_t *, wchar_t);
828 } */
829_GL_CXXALIAS_SYS_CAST2 (wcschr,
830 wchar_t *, (const wchar_t *, wchar_t),
831 const wchar_t *, (const wchar_t *, wchar_t));
832# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
833 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
834_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
835_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
836# else
837_GL_CXXALIASWARN (wcschr);
838# endif
839#elif defined GNULIB_POSIXCHECK
840# undef wcschr
841# if HAVE_RAW_DECL_WCSCHR
842_GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
843 "use gnulib module wcschr for portability");
844# endif
845#endif
846
847
848/* Find the last occurrence of WC in WCS. */
849#if @GNULIB_WCSRCHR@
850# if !@HAVE_WCSRCHR@
851_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
852 _GL_ATTRIBUTE_PURE);
853# endif
854 /* On some systems, this function is defined as an overloaded function:
855 extern "C++" {
856 const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
857 wchar_t * std::wcsrchr (wchar_t *, wchar_t);
858 } */
859_GL_CXXALIAS_SYS_CAST2 (wcsrchr,
860 wchar_t *, (const wchar_t *, wchar_t),
861 const wchar_t *, (const wchar_t *, wchar_t));
862# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
863 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
864_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
865_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
866# else
867_GL_CXXALIASWARN (wcsrchr);
868# endif
869#elif defined GNULIB_POSIXCHECK
870# undef wcsrchr
871# if HAVE_RAW_DECL_WCSRCHR
872_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
873 "use gnulib module wcsrchr for portability");
874# endif
875#endif
876
877
878/* Return the length of the initial segmet of WCS which consists entirely
879 of wide characters not in REJECT. */
880#if @GNULIB_WCSCSPN@
881# if !@HAVE_WCSCSPN@
882_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
883 _GL_ATTRIBUTE_PURE);
884# endif
885_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
886_GL_CXXALIASWARN (wcscspn);
887#elif defined GNULIB_POSIXCHECK
888# undef wcscspn
889# if HAVE_RAW_DECL_WCSCSPN
890_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
891 "use gnulib module wcscspn for portability");
892# endif
893#endif
894
895
896/* Return the length of the initial segmet of WCS which consists entirely
897 of wide characters in ACCEPT. */
898#if @GNULIB_WCSSPN@
899# if !@HAVE_WCSSPN@
900_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
901 _GL_ATTRIBUTE_PURE);
902# endif
903_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
904_GL_CXXALIASWARN (wcsspn);
905#elif defined GNULIB_POSIXCHECK
906# undef wcsspn
907# if HAVE_RAW_DECL_WCSSPN
908_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
909 "use gnulib module wcsspn for portability");
910# endif
911#endif
912
913
914/* Find the first occurrence in WCS of any character in ACCEPT. */
915#if @GNULIB_WCSPBRK@
916# if !@HAVE_WCSPBRK@
917_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
918 (const wchar_t *wcs, const wchar_t *accept)
919 _GL_ATTRIBUTE_PURE);
920# endif
921 /* On some systems, this function is defined as an overloaded function:
922 extern "C++" {
923 const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
924 wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
925 } */
926_GL_CXXALIAS_SYS_CAST2 (wcspbrk,
927 wchar_t *, (const wchar_t *, const wchar_t *),
928 const wchar_t *, (const wchar_t *, const wchar_t *));
929# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
930 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
931_GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
932 (wchar_t *wcs, const wchar_t *accept));
933_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
934 (const wchar_t *wcs, const wchar_t *accept));
935# else
936_GL_CXXALIASWARN (wcspbrk);
937# endif
938#elif defined GNULIB_POSIXCHECK
939# undef wcspbrk
940# if HAVE_RAW_DECL_WCSPBRK
941_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
942 "use gnulib module wcspbrk for portability");
943# endif
944#endif
945
946
947/* Find the first occurrence of NEEDLE in HAYSTACK. */
948#if @GNULIB_WCSSTR@
949# if !@HAVE_WCSSTR@
950_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
951 (const wchar_t *haystack, const wchar_t *needle)
952 _GL_ATTRIBUTE_PURE);
953# endif
954 /* On some systems, this function is defined as an overloaded function:
955 extern "C++" {
956 const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
957 wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
958 } */
959_GL_CXXALIAS_SYS_CAST2 (wcsstr,
960 wchar_t *, (const wchar_t *, const wchar_t *),
961 const wchar_t *, (const wchar_t *, const wchar_t *));
962# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
963 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
964_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
965 (wchar_t *haystack, const wchar_t *needle));
966_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
967 (const wchar_t *haystack, const wchar_t *needle));
968# else
969_GL_CXXALIASWARN (wcsstr);
970# endif
971#elif defined GNULIB_POSIXCHECK
972# undef wcsstr
973# if HAVE_RAW_DECL_WCSSTR
974_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
975 "use gnulib module wcsstr for portability");
976# endif
977#endif
978
979
980/* Divide WCS into tokens separated by characters in DELIM. */
981#if @GNULIB_WCSTOK@
982# if !@HAVE_WCSTOK@
983_GL_FUNCDECL_SYS (wcstok, wchar_t *,
984 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
985# endif
986_GL_CXXALIAS_SYS (wcstok, wchar_t *,
987 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
988_GL_CXXALIASWARN (wcstok);
989#elif defined GNULIB_POSIXCHECK
990# undef wcstok
991# if HAVE_RAW_DECL_WCSTOK
992_GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
993 "use gnulib module wcstok for portability");
994# endif
995#endif
996
997
998/* Determine number of column positions required for first N wide
999 characters (or fewer if S ends before this) in S. */
1000#if @GNULIB_WCSWIDTH@
1001# if @REPLACE_WCSWIDTH@
1002# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1003# undef wcswidth
1004# define wcswidth rpl_wcswidth
1005# endif
1006_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)
1007 _GL_ATTRIBUTE_PURE);
1008_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
1009# else
1010# if !@HAVE_WCSWIDTH@
1011_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
1012 _GL_ATTRIBUTE_PURE);
1013# endif
1014_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
1015# endif
1016_GL_CXXALIASWARN (wcswidth);
1017#elif defined GNULIB_POSIXCHECK
1018# undef wcswidth
1019# if HAVE_RAW_DECL_WCSWIDTH
1020_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
1021 "use gnulib module wcswidth for portability");
1022# endif
1023#endif
1024
1025
1026#endif /* _@GUARD_PREFIX@_WCHAR_H */
1027#endif /* _@GUARD_PREFIX@_WCHAR_H */
428#endif 1028#endif