aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2011-04-21 12:12:13 -0700
committerPaul Eggert2011-04-21 12:12:13 -0700
commita8a2bb29e2ea28dce51bb3a8680bfe2bd6945365 (patch)
treef382d740123da83c6f212cae2ecfcbd6555060e4 /lib
parentd78050d6bab1f1add4284163b8fc474495ac6580 (diff)
downloademacs-a8a2bb29e2ea28dce51bb3a8680bfe2bd6945365.tar.gz
emacs-a8a2bb29e2ea28dce51bb3a8680bfe2bd6945365.zip
* Makefile.in (GNULIB_MODULES): Add strtoumax.
Diffstat (limited to 'lib')
-rw-r--r--lib/gnulib.mk224
-rw-r--r--lib/inttypes.h1165
-rw-r--r--lib/inttypes.in.h1108
-rw-r--r--lib/strtoimax.c75
-rw-r--r--lib/strtol.c434
-rw-r--r--lib/strtoll.c33
-rw-r--r--lib/strtoul.c19
-rw-r--r--lib/strtoull.c26
-rw-r--r--lib/strtoumax.c2
-rw-r--r--lib/verify.h202
-rw-r--r--lib/wchar.h1306
-rw-r--r--lib/wchar.in.h994
12 files changed, 5587 insertions, 1 deletions
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 868249dda27..e53dcba62e0 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -9,7 +9,7 @@
9# the same distribution terms as the rest of that program. 9# the same distribution terms as the rest of that program.
10# 10#
11# Generated by gnulib-tool. 11# Generated by gnulib-tool.
12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files careadlinkat crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink socklen stdio strftime symlink sys_stat 12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files careadlinkat crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink socklen stdio strftime strtoumax symlink sys_stat
13 13
14 14
15MOSTLYCLEANFILES += core *.stackdump 15MOSTLYCLEANFILES += core *.stackdump
@@ -174,6 +174,48 @@ EXTRA_DIST += intprops.h
174 174
175## end gnulib module intprops 175## end gnulib module intprops
176 176
177## begin gnulib module inttypes
178
179BUILT_SOURCES += inttypes.h
180
181# We need the following in order to create <inttypes.h> when the system
182# doesn't have one that works with the given compiler.
183inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H)
184 $(AM_V_GEN)rm -f $@-t $@ && \
185 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
186 sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
187 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
188 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
189 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
190 -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \
191 -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \
192 -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
193 -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
194 -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
195 -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \
196 -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \
197 -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \
198 -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \
199 -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \
200 -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \
201 -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
202 -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
203 -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
204 -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \
205 -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \
206 -e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \
207 -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \
208 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
209 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
210 < $(srcdir)/inttypes.in.h; \
211 } > $@-t && \
212 mv $@-t $@
213MOSTLYCLEANFILES += inttypes.h inttypes.h-t
214
215EXTRA_DIST += inttypes.in.h
216
217## end gnulib module inttypes
218
177## begin gnulib module lstat 219## begin gnulib module lstat
178 220
179 221
@@ -532,6 +574,60 @@ EXTRA_libgnu_a_SOURCES += strftime.c
532 574
533## end gnulib module strftime 575## end gnulib module strftime
534 576
577## begin gnulib module strtoimax
578
579
580EXTRA_DIST += strtoimax.c
581
582EXTRA_libgnu_a_SOURCES += strtoimax.c
583
584## end gnulib module strtoimax
585
586## begin gnulib module strtol
587
588
589EXTRA_DIST += strtol.c
590
591EXTRA_libgnu_a_SOURCES += strtol.c
592
593## end gnulib module strtol
594
595## begin gnulib module strtoll
596
597
598EXTRA_DIST += strtoll.c
599
600EXTRA_libgnu_a_SOURCES += strtoll.c
601
602## end gnulib module strtoll
603
604## begin gnulib module strtoul
605
606
607EXTRA_DIST += strtoul.c
608
609EXTRA_libgnu_a_SOURCES += strtoul.c
610
611## end gnulib module strtoul
612
613## begin gnulib module strtoull
614
615
616EXTRA_DIST += strtoull.c
617
618EXTRA_libgnu_a_SOURCES += strtoull.c
619
620## end gnulib module strtoull
621
622## begin gnulib module strtoumax
623
624
625EXTRA_DIST += strtoumax.c
626
627EXTRA_libgnu_a_SOURCES += strtoumax.c
628
629## end gnulib module strtoumax
630
535## begin gnulib module symlink 631## begin gnulib module symlink
536 632
537 633
@@ -785,6 +881,12 @@ EXTRA_DIST += unistd.in.h
785 881
786## end gnulib module unistd 882## end gnulib module unistd
787 883
884## begin gnulib module verify
885
886libgnu_a_SOURCES += verify.h
887
888## end gnulib module verify
889
788## begin gnulib module warn-on-use 890## begin gnulib module warn-on-use
789 891
790BUILT_SOURCES += warn-on-use.h 892BUILT_SOURCES += warn-on-use.h
@@ -804,6 +906,126 @@ EXTRA_DIST += $(top_srcdir)/./warn-on-use.h
804 906
805## end gnulib module warn-on-use 907## end gnulib module warn-on-use
806 908
909## begin gnulib module wchar
910
911BUILT_SOURCES += wchar.h
912
913# We need the following in order to create <wchar.h> when the system
914# version does not work standalone.
915wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
916 $(AM_V_GEN)rm -f $@-t $@ && \
917 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
918 sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
919 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
920 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
921 -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
922 -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
923 -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
924 -e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \
925 -e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \
926 -e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \
927 -e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \
928 -e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \
929 -e 's|@''GNULIB_MBSRTOWCS''@|$(GNULIB_MBSRTOWCS)|g' \
930 -e 's|@''GNULIB_MBSNRTOWCS''@|$(GNULIB_MBSNRTOWCS)|g' \
931 -e 's|@''GNULIB_WCRTOMB''@|$(GNULIB_WCRTOMB)|g' \
932 -e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \
933 -e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \
934 -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
935 -e 's|@''GNULIB_WMEMCHR''@|$(GNULIB_WMEMCHR)|g' \
936 -e 's|@''GNULIB_WMEMCMP''@|$(GNULIB_WMEMCMP)|g' \
937 -e 's|@''GNULIB_WMEMCPY''@|$(GNULIB_WMEMCPY)|g' \
938 -e 's|@''GNULIB_WMEMMOVE''@|$(GNULIB_WMEMMOVE)|g' \
939 -e 's|@''GNULIB_WMEMSET''@|$(GNULIB_WMEMSET)|g' \
940 -e 's|@''GNULIB_WCSLEN''@|$(GNULIB_WCSLEN)|g' \
941 -e 's|@''GNULIB_WCSNLEN''@|$(GNULIB_WCSNLEN)|g' \
942 -e 's|@''GNULIB_WCSCPY''@|$(GNULIB_WCSCPY)|g' \
943 -e 's|@''GNULIB_WCPCPY''@|$(GNULIB_WCPCPY)|g' \
944 -e 's|@''GNULIB_WCSNCPY''@|$(GNULIB_WCSNCPY)|g' \
945 -e 's|@''GNULIB_WCPNCPY''@|$(GNULIB_WCPNCPY)|g' \
946 -e 's|@''GNULIB_WCSCAT''@|$(GNULIB_WCSCAT)|g' \
947 -e 's|@''GNULIB_WCSNCAT''@|$(GNULIB_WCSNCAT)|g' \
948 -e 's|@''GNULIB_WCSCMP''@|$(GNULIB_WCSCMP)|g' \
949 -e 's|@''GNULIB_WCSNCMP''@|$(GNULIB_WCSNCMP)|g' \
950 -e 's|@''GNULIB_WCSCASECMP''@|$(GNULIB_WCSCASECMP)|g' \
951 -e 's|@''GNULIB_WCSNCASECMP''@|$(GNULIB_WCSNCASECMP)|g' \
952 -e 's|@''GNULIB_WCSCOLL''@|$(GNULIB_WCSCOLL)|g' \
953 -e 's|@''GNULIB_WCSXFRM''@|$(GNULIB_WCSXFRM)|g' \
954 -e 's|@''GNULIB_WCSDUP''@|$(GNULIB_WCSDUP)|g' \
955 -e 's|@''GNULIB_WCSCHR''@|$(GNULIB_WCSCHR)|g' \
956 -e 's|@''GNULIB_WCSRCHR''@|$(GNULIB_WCSRCHR)|g' \
957 -e 's|@''GNULIB_WCSCSPN''@|$(GNULIB_WCSCSPN)|g' \
958 -e 's|@''GNULIB_WCSSPN''@|$(GNULIB_WCSSPN)|g' \
959 -e 's|@''GNULIB_WCSPBRK''@|$(GNULIB_WCSPBRK)|g' \
960 -e 's|@''GNULIB_WCSSTR''@|$(GNULIB_WCSSTR)|g' \
961 -e 's|@''GNULIB_WCSTOK''@|$(GNULIB_WCSTOK)|g' \
962 -e 's|@''GNULIB_WCSWIDTH''@|$(GNULIB_WCSWIDTH)|g' \
963 < $(srcdir)/wchar.in.h | \
964 sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
965 -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
966 -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \
967 -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \
968 -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \
969 -e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \
970 -e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \
971 -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \
972 -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \
973 -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \
974 -e 's|@''HAVE_WMEMCHR''@|$(HAVE_WMEMCHR)|g' \
975 -e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \
976 -e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \
977 -e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \
978 -e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \
979 -e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \
980 -e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \
981 -e 's|@''HAVE_WCSCPY''@|$(HAVE_WCSCPY)|g' \
982 -e 's|@''HAVE_WCPCPY''@|$(HAVE_WCPCPY)|g' \
983 -e 's|@''HAVE_WCSNCPY''@|$(HAVE_WCSNCPY)|g' \
984 -e 's|@''HAVE_WCPNCPY''@|$(HAVE_WCPNCPY)|g' \
985 -e 's|@''HAVE_WCSCAT''@|$(HAVE_WCSCAT)|g' \
986 -e 's|@''HAVE_WCSNCAT''@|$(HAVE_WCSNCAT)|g' \
987 -e 's|@''HAVE_WCSCMP''@|$(HAVE_WCSCMP)|g' \
988 -e 's|@''HAVE_WCSNCMP''@|$(HAVE_WCSNCMP)|g' \
989 -e 's|@''HAVE_WCSCASECMP''@|$(HAVE_WCSCASECMP)|g' \
990 -e 's|@''HAVE_WCSNCASECMP''@|$(HAVE_WCSNCASECMP)|g' \
991 -e 's|@''HAVE_WCSCOLL''@|$(HAVE_WCSCOLL)|g' \
992 -e 's|@''HAVE_WCSXFRM''@|$(HAVE_WCSXFRM)|g' \
993 -e 's|@''HAVE_WCSDUP''@|$(HAVE_WCSDUP)|g' \
994 -e 's|@''HAVE_WCSCHR''@|$(HAVE_WCSCHR)|g' \
995 -e 's|@''HAVE_WCSRCHR''@|$(HAVE_WCSRCHR)|g' \
996 -e 's|@''HAVE_WCSCSPN''@|$(HAVE_WCSCSPN)|g' \
997 -e 's|@''HAVE_WCSSPN''@|$(HAVE_WCSSPN)|g' \
998 -e 's|@''HAVE_WCSPBRK''@|$(HAVE_WCSPBRK)|g' \
999 -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \
1000 -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \
1001 -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \
1002 -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \
1003 -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
1004 | \
1005 sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \
1006 -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \
1007 -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \
1008 -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \
1009 -e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \
1010 -e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \
1011 -e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \
1012 -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \
1013 -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \
1014 -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
1015 -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
1016 -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
1017 -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \
1018 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
1019 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
1020 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
1021 } > $@-t && \
1022 mv $@-t $@
1023MOSTLYCLEANFILES += wchar.h wchar.h-t
1024
1025EXTRA_DIST += wchar.in.h
1026
1027## end gnulib module wchar
1028
807 1029
808mostlyclean-local: mostlyclean-generic 1030mostlyclean-local: mostlyclean-generic
809 @for dir in '' $(MOSTLYCLEANDIRS); do \ 1031 @for dir in '' $(MOSTLYCLEANDIRS); do \
diff --git a/lib/inttypes.h b/lib/inttypes.h
new file mode 100644
index 00000000000..8e09e8a63c3
--- /dev/null
+++ b/lib/inttypes.h
@@ -0,0 +1,1165 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Copyright (C) 2006-2011 Free Software Foundation, Inc.
3 Written by Paul Eggert, Bruno Haible, Derek Price.
4 This file is part of gnulib.
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19/*
20 * ISO C 99 <inttypes.h> for platforms that lack it.
21 * <http://www.opengroup.org/susv3xbd/inttypes.h.html>
22 */
23
24#if __GNUC__ >= 3
25#pragma GCC system_header
26#endif
27
28
29/* Include the original <inttypes.h> if it exists, and if this file
30 has not been included yet or if this file includes gnulib stdint.h
31 which in turn includes this file.
32 The include_next requires a split double-inclusion guard. */
33#if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
34# if 1
35# include_next <inttypes.h>
36# endif
37#endif
38
39#if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
40#define INTTYPES_H
41
42/* Include <stdint.h> or the gnulib replacement.
43 But avoid namespace pollution on glibc systems. */
44#ifndef __GLIBC__
45# include <stdint.h>
46#endif
47/* Get CHAR_BIT. */
48#include <limits.h>
49
50#if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX)
51# error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
52#endif
53
54/* The definition of _GL_ARG_NONNULL is copied here. */
55/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
56 that the values passed as arguments n, ..., m must be non-NULL pointers.
57 n = 1 stands for the first argument, n = 2 for the second argument etc. */
58#ifndef _GL_ARG_NONNULL
59# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
60# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
61# else
62# define _GL_ARG_NONNULL(params)
63# endif
64#endif
65
66/* The definition of _GL_WARN_ON_USE is copied here. */
67#ifndef _GL_WARN_ON_USE
68
69# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
70/* A compiler attribute is available in gcc versions 4.3.0 and later. */
71# define _GL_WARN_ON_USE(function, message) \
72extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
73# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
74/* Verify the existence of the function. */
75# define _GL_WARN_ON_USE(function, message) \
76extern __typeof__ (function) function
77# else /* Unsupported. */
78# define _GL_WARN_ON_USE(function, message) \
79_GL_WARN_EXTERN_C int _gl_warn_on_use
80# endif
81#endif
82
83/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
84 is like _GL_WARN_ON_USE (function, "string"), except that the function is
85 declared with the given prototype, consisting of return type, parameters,
86 and attributes.
87 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
88 not work in this case. */
89#ifndef _GL_WARN_ON_USE_CXX
90# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
91# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
92extern rettype function parameters_and_attributes \
93 __attribute__ ((__warning__ (msg)))
94# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
95/* Verify the existence of the function. */
96# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
97extern rettype function parameters_and_attributes
98# else /* Unsupported. */
99# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
100_GL_WARN_EXTERN_C int _gl_warn_on_use
101# endif
102#endif
103
104/* _GL_WARN_EXTERN_C declaration;
105 performs the declaration with C linkage. */
106#ifndef _GL_WARN_EXTERN_C
107# if defined __cplusplus
108# define _GL_WARN_EXTERN_C extern "C"
109# else
110# define _GL_WARN_EXTERN_C extern
111# endif
112#endif
113
114/* 7.8.1 Macros for format specifiers */
115
116#if ! defined __cplusplus || defined __STDC_FORMAT_MACROS
117
118# if defined _TNS_R_TARGET
119 /* Tandem NonStop R series and compatible platforms released before
120 July 2005 support %Ld but not %lld. */
121# define _LONG_LONG_FORMAT_PREFIX "L"
122# else
123# define _LONG_LONG_FORMAT_PREFIX "ll"
124# endif
125
126# if !defined PRId8 || 0
127# undef PRId8
128# ifdef INT8_MAX
129# define PRId8 "d"
130# endif
131# endif
132# if !defined PRIi8 || 0
133# undef PRIi8
134# ifdef INT8_MAX
135# define PRIi8 "i"
136# endif
137# endif
138# if !defined PRIo8 || 0
139# undef PRIo8
140# ifdef UINT8_MAX
141# define PRIo8 "o"
142# endif
143# endif
144# if !defined PRIu8 || 0
145# undef PRIu8
146# ifdef UINT8_MAX
147# define PRIu8 "u"
148# endif
149# endif
150# if !defined PRIx8 || 0
151# undef PRIx8
152# ifdef UINT8_MAX
153# define PRIx8 "x"
154# endif
155# endif
156# if !defined PRIX8 || 0
157# undef PRIX8
158# ifdef UINT8_MAX
159# define PRIX8 "X"
160# endif
161# endif
162# if !defined PRId16 || 0
163# undef PRId16
164# ifdef INT16_MAX
165# define PRId16 "d"
166# endif
167# endif
168# if !defined PRIi16 || 0
169# undef PRIi16
170# ifdef INT16_MAX
171# define PRIi16 "i"
172# endif
173# endif
174# if !defined PRIo16 || 0
175# undef PRIo16
176# ifdef UINT16_MAX
177# define PRIo16 "o"
178# endif
179# endif
180# if !defined PRIu16 || 0
181# undef PRIu16
182# ifdef UINT16_MAX
183# define PRIu16 "u"
184# endif
185# endif
186# if !defined PRIx16 || 0
187# undef PRIx16
188# ifdef UINT16_MAX
189# define PRIx16 "x"
190# endif
191# endif
192# if !defined PRIX16 || 0
193# undef PRIX16
194# ifdef UINT16_MAX
195# define PRIX16 "X"
196# endif
197# endif
198# if !defined PRId32 || 0
199# undef PRId32
200# ifdef INT32_MAX
201# define PRId32 "d"
202# endif
203# endif
204# if !defined PRIi32 || 0
205# undef PRIi32
206# ifdef INT32_MAX
207# define PRIi32 "i"
208# endif
209# endif
210# if !defined PRIo32 || 0
211# undef PRIo32
212# ifdef UINT32_MAX
213# define PRIo32 "o"
214# endif
215# endif
216# if !defined PRIu32 || 0
217# undef PRIu32
218# ifdef UINT32_MAX
219# define PRIu32 "u"
220# endif
221# endif
222# if !defined PRIx32 || 0
223# undef PRIx32
224# ifdef UINT32_MAX
225# define PRIx32 "x"
226# endif
227# endif
228# if !defined PRIX32 || 0
229# undef PRIX32
230# ifdef UINT32_MAX
231# define PRIX32 "X"
232# endif
233# endif
234# ifdef INT64_MAX
235# if (0 ? defined _LP64 : 1)
236# define _PRI64_PREFIX "l"
237# elif defined _MSC_VER || defined __MINGW32__
238# define _PRI64_PREFIX "I64"
239# elif 1 && LONG_MAX >> 30 == 1
240# define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX
241# endif
242# if !defined PRId64 || 0
243# undef PRId64
244# define PRId64 _PRI64_PREFIX "d"
245# endif
246# if !defined PRIi64 || 0
247# undef PRIi64
248# define PRIi64 _PRI64_PREFIX "i"
249# endif
250# endif
251# ifdef UINT64_MAX
252# if (0 ? defined _LP64 : 1)
253# define _PRIu64_PREFIX "l"
254# elif defined _MSC_VER || defined __MINGW32__
255# define _PRIu64_PREFIX "I64"
256# elif 1 && ULONG_MAX >> 31 == 1
257# define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX
258# endif
259# if !defined PRIo64 || 0
260# undef PRIo64
261# define PRIo64 _PRIu64_PREFIX "o"
262# endif
263# if !defined PRIu64 || 0
264# undef PRIu64
265# define PRIu64 _PRIu64_PREFIX "u"
266# endif
267# if !defined PRIx64 || 0
268# undef PRIx64
269# define PRIx64 _PRIu64_PREFIX "x"
270# endif
271# if !defined PRIX64 || 0
272# undef PRIX64
273# define PRIX64 _PRIu64_PREFIX "X"
274# endif
275# endif
276
277# if !defined PRIdLEAST8 || 0
278# undef PRIdLEAST8
279# define PRIdLEAST8 "d"
280# endif
281# if !defined PRIiLEAST8 || 0
282# undef PRIiLEAST8
283# define PRIiLEAST8 "i"
284# endif
285# if !defined PRIoLEAST8 || 0
286# undef PRIoLEAST8
287# define PRIoLEAST8 "o"
288# endif
289# if !defined PRIuLEAST8 || 0
290# undef PRIuLEAST8
291# define PRIuLEAST8 "u"
292# endif
293# if !defined PRIxLEAST8 || 0
294# undef PRIxLEAST8
295# define PRIxLEAST8 "x"
296# endif
297# if !defined PRIXLEAST8 || 0
298# undef PRIXLEAST8
299# define PRIXLEAST8 "X"
300# endif
301# if !defined PRIdLEAST16 || 0
302# undef PRIdLEAST16
303# define PRIdLEAST16 "d"
304# endif
305# if !defined PRIiLEAST16 || 0
306# undef PRIiLEAST16
307# define PRIiLEAST16 "i"
308# endif
309# if !defined PRIoLEAST16 || 0
310# undef PRIoLEAST16
311# define PRIoLEAST16 "o"
312# endif
313# if !defined PRIuLEAST16 || 0
314# undef PRIuLEAST16
315# define PRIuLEAST16 "u"
316# endif
317# if !defined PRIxLEAST16 || 0
318# undef PRIxLEAST16
319# define PRIxLEAST16 "x"
320# endif
321# if !defined PRIXLEAST16 || 0
322# undef PRIXLEAST16
323# define PRIXLEAST16 "X"
324# endif
325# if !defined PRIdLEAST32 || 0
326# undef PRIdLEAST32
327# define PRIdLEAST32 "d"
328# endif
329# if !defined PRIiLEAST32 || 0
330# undef PRIiLEAST32
331# define PRIiLEAST32 "i"
332# endif
333# if !defined PRIoLEAST32 || 0
334# undef PRIoLEAST32
335# define PRIoLEAST32 "o"
336# endif
337# if !defined PRIuLEAST32 || 0
338# undef PRIuLEAST32
339# define PRIuLEAST32 "u"
340# endif
341# if !defined PRIxLEAST32 || 0
342# undef PRIxLEAST32
343# define PRIxLEAST32 "x"
344# endif
345# if !defined PRIXLEAST32 || 0
346# undef PRIXLEAST32
347# define PRIXLEAST32 "X"
348# endif
349# ifdef INT64_MAX
350# if !defined PRIdLEAST64 || 0
351# undef PRIdLEAST64
352# define PRIdLEAST64 PRId64
353# endif
354# if !defined PRIiLEAST64 || 0
355# undef PRIiLEAST64
356# define PRIiLEAST64 PRIi64
357# endif
358# endif
359# ifdef UINT64_MAX
360# if !defined PRIoLEAST64 || 0
361# undef PRIoLEAST64
362# define PRIoLEAST64 PRIo64
363# endif
364# if !defined PRIuLEAST64 || 0
365# undef PRIuLEAST64
366# define PRIuLEAST64 PRIu64
367# endif
368# if !defined PRIxLEAST64 || 0
369# undef PRIxLEAST64
370# define PRIxLEAST64 PRIx64
371# endif
372# if !defined PRIXLEAST64 || 0
373# undef PRIXLEAST64
374# define PRIXLEAST64 PRIX64
375# endif
376# endif
377
378# if !defined PRIdFAST8 || 0
379# undef PRIdFAST8
380# if INT_FAST8_MAX > INT32_MAX
381# define PRIdFAST8 PRId64
382# else
383# define PRIdFAST8 "d"
384# endif
385# endif
386# if !defined PRIiFAST8 || 0
387# undef PRIiFAST8
388# if INT_FAST8_MAX > INT32_MAX
389# define PRIiFAST8 PRIi64
390# else
391# define PRIiFAST8 "i"
392# endif
393# endif
394# if !defined PRIoFAST8 || 0
395# undef PRIoFAST8
396# if UINT_FAST8_MAX > UINT32_MAX
397# define PRIoFAST8 PRIo64
398# else
399# define PRIoFAST8 "o"
400# endif
401# endif
402# if !defined PRIuFAST8 || 0
403# undef PRIuFAST8
404# if UINT_FAST8_MAX > UINT32_MAX
405# define PRIuFAST8 PRIu64
406# else
407# define PRIuFAST8 "u"
408# endif
409# endif
410# if !defined PRIxFAST8 || 0
411# undef PRIxFAST8
412# if UINT_FAST8_MAX > UINT32_MAX
413# define PRIxFAST8 PRIx64
414# else
415# define PRIxFAST8 "x"
416# endif
417# endif
418# if !defined PRIXFAST8 || 0
419# undef PRIXFAST8
420# if UINT_FAST8_MAX > UINT32_MAX
421# define PRIXFAST8 PRIX64
422# else
423# define PRIXFAST8 "X"
424# endif
425# endif
426# if !defined PRIdFAST16 || 0
427# undef PRIdFAST16
428# if INT_FAST16_MAX > INT32_MAX
429# define PRIdFAST16 PRId64
430# else
431# define PRIdFAST16 "d"
432# endif
433# endif
434# if !defined PRIiFAST16 || 0
435# undef PRIiFAST16
436# if INT_FAST16_MAX > INT32_MAX
437# define PRIiFAST16 PRIi64
438# else
439# define PRIiFAST16 "i"
440# endif
441# endif
442# if !defined PRIoFAST16 || 0
443# undef PRIoFAST16
444# if UINT_FAST16_MAX > UINT32_MAX
445# define PRIoFAST16 PRIo64
446# else
447# define PRIoFAST16 "o"
448# endif
449# endif
450# if !defined PRIuFAST16 || 0
451# undef PRIuFAST16
452# if UINT_FAST16_MAX > UINT32_MAX
453# define PRIuFAST16 PRIu64
454# else
455# define PRIuFAST16 "u"
456# endif
457# endif
458# if !defined PRIxFAST16 || 0
459# undef PRIxFAST16
460# if UINT_FAST16_MAX > UINT32_MAX
461# define PRIxFAST16 PRIx64
462# else
463# define PRIxFAST16 "x"
464# endif
465# endif
466# if !defined PRIXFAST16 || 0
467# undef PRIXFAST16
468# if UINT_FAST16_MAX > UINT32_MAX
469# define PRIXFAST16 PRIX64
470# else
471# define PRIXFAST16 "X"
472# endif
473# endif
474# if !defined PRIdFAST32 || 0
475# undef PRIdFAST32
476# if INT_FAST32_MAX > INT32_MAX
477# define PRIdFAST32 PRId64
478# else
479# define PRIdFAST32 "d"
480# endif
481# endif
482# if !defined PRIiFAST32 || 0
483# undef PRIiFAST32
484# if INT_FAST32_MAX > INT32_MAX
485# define PRIiFAST32 PRIi64
486# else
487# define PRIiFAST32 "i"
488# endif
489# endif
490# if !defined PRIoFAST32 || 0
491# undef PRIoFAST32
492# if UINT_FAST32_MAX > UINT32_MAX
493# define PRIoFAST32 PRIo64
494# else
495# define PRIoFAST32 "o"
496# endif
497# endif
498# if !defined PRIuFAST32 || 0
499# undef PRIuFAST32
500# if UINT_FAST32_MAX > UINT32_MAX
501# define PRIuFAST32 PRIu64
502# else
503# define PRIuFAST32 "u"
504# endif
505# endif
506# if !defined PRIxFAST32 || 0
507# undef PRIxFAST32
508# if UINT_FAST32_MAX > UINT32_MAX
509# define PRIxFAST32 PRIx64
510# else
511# define PRIxFAST32 "x"
512# endif
513# endif
514# if !defined PRIXFAST32 || 0
515# undef PRIXFAST32
516# if UINT_FAST32_MAX > UINT32_MAX
517# define PRIXFAST32 PRIX64
518# else
519# define PRIXFAST32 "X"
520# endif
521# endif
522# ifdef INT64_MAX
523# if !defined PRIdFAST64 || 0
524# undef PRIdFAST64
525# define PRIdFAST64 PRId64
526# endif
527# if !defined PRIiFAST64 || 0
528# undef PRIiFAST64
529# define PRIiFAST64 PRIi64
530# endif
531# endif
532# ifdef UINT64_MAX
533# if !defined PRIoFAST64 || 0
534# undef PRIoFAST64
535# define PRIoFAST64 PRIo64
536# endif
537# if !defined PRIuFAST64 || 0
538# undef PRIuFAST64
539# define PRIuFAST64 PRIu64
540# endif
541# if !defined PRIxFAST64 || 0
542# undef PRIxFAST64
543# define PRIxFAST64 PRIx64
544# endif
545# if !defined PRIXFAST64 || 0
546# undef PRIXFAST64
547# define PRIXFAST64 PRIX64
548# endif
549# endif
550
551# if !defined PRIdMAX || 0
552# undef PRIdMAX
553# if 1
554# define PRIdMAX PRId64
555# else
556# define PRIdMAX "ld"
557# endif
558# endif
559# if !defined PRIiMAX || 0
560# undef PRIiMAX
561# if 1
562# define PRIiMAX PRIi64
563# else
564# define PRIiMAX "li"
565# endif
566# endif
567# if !defined PRIoMAX || 0
568# undef PRIoMAX
569# if 1
570# define PRIoMAX PRIo64
571# else
572# define PRIoMAX "lo"
573# endif
574# endif
575# if !defined PRIuMAX || 0
576# undef PRIuMAX
577# if 1
578# define PRIuMAX PRIu64
579# else
580# define PRIuMAX "lu"
581# endif
582# endif
583# if !defined PRIxMAX || 0
584# undef PRIxMAX
585# if 1
586# define PRIxMAX PRIx64
587# else
588# define PRIxMAX "lx"
589# endif
590# endif
591# if !defined PRIXMAX || 0
592# undef PRIXMAX
593# if 1
594# define PRIXMAX PRIX64
595# else
596# define PRIXMAX "lX"
597# endif
598# endif
599
600# if !defined PRIdPTR || 0
601# undef PRIdPTR
602# ifdef INTPTR_MAX
603# define PRIdPTR "l" "d"
604# endif
605# endif
606# if !defined PRIiPTR || 0
607# undef PRIiPTR
608# ifdef INTPTR_MAX
609# define PRIiPTR "l" "i"
610# endif
611# endif
612# if !defined PRIoPTR || 0
613# undef PRIoPTR
614# ifdef UINTPTR_MAX
615# define PRIoPTR "l" "o"
616# endif
617# endif
618# if !defined PRIuPTR || 0
619# undef PRIuPTR
620# ifdef UINTPTR_MAX
621# define PRIuPTR "l" "u"
622# endif
623# endif
624# if !defined PRIxPTR || 0
625# undef PRIxPTR
626# ifdef UINTPTR_MAX
627# define PRIxPTR "l" "x"
628# endif
629# endif
630# if !defined PRIXPTR || 0
631# undef PRIXPTR
632# ifdef UINTPTR_MAX
633# define PRIXPTR "l" "X"
634# endif
635# endif
636
637# if !defined SCNd8 || 0
638# undef SCNd8
639# ifdef INT8_MAX
640# define SCNd8 "hhd"
641# endif
642# endif
643# if !defined SCNi8 || 0
644# undef SCNi8
645# ifdef INT8_MAX
646# define SCNi8 "hhi"
647# endif
648# endif
649# if !defined SCNo8 || 0
650# undef SCNo8
651# ifdef UINT8_MAX
652# define SCNo8 "hho"
653# endif
654# endif
655# if !defined SCNu8 || 0
656# undef SCNu8
657# ifdef UINT8_MAX
658# define SCNu8 "hhu"
659# endif
660# endif
661# if !defined SCNx8 || 0
662# undef SCNx8
663# ifdef UINT8_MAX
664# define SCNx8 "hhx"
665# endif
666# endif
667# if !defined SCNd16 || 0
668# undef SCNd16
669# ifdef INT16_MAX
670# define SCNd16 "hd"
671# endif
672# endif
673# if !defined SCNi16 || 0
674# undef SCNi16
675# ifdef INT16_MAX
676# define SCNi16 "hi"
677# endif
678# endif
679# if !defined SCNo16 || 0
680# undef SCNo16
681# ifdef UINT16_MAX
682# define SCNo16 "ho"
683# endif
684# endif
685# if !defined SCNu16 || 0
686# undef SCNu16
687# ifdef UINT16_MAX
688# define SCNu16 "hu"
689# endif
690# endif
691# if !defined SCNx16 || 0
692# undef SCNx16
693# ifdef UINT16_MAX
694# define SCNx16 "hx"
695# endif
696# endif
697# if !defined SCNd32 || 0
698# undef SCNd32
699# ifdef INT32_MAX
700# define SCNd32 "d"
701# endif
702# endif
703# if !defined SCNi32 || 0
704# undef SCNi32
705# ifdef INT32_MAX
706# define SCNi32 "i"
707# endif
708# endif
709# if !defined SCNo32 || 0
710# undef SCNo32
711# ifdef UINT32_MAX
712# define SCNo32 "o"
713# endif
714# endif
715# if !defined SCNu32 || 0
716# undef SCNu32
717# ifdef UINT32_MAX
718# define SCNu32 "u"
719# endif
720# endif
721# if !defined SCNx32 || 0
722# undef SCNx32
723# ifdef UINT32_MAX
724# define SCNx32 "x"
725# endif
726# endif
727# ifdef INT64_MAX
728# if (0 ? defined _LP64 : 1)
729# define _SCN64_PREFIX "l"
730# elif defined _MSC_VER || defined __MINGW32__
731# define _SCN64_PREFIX "I64"
732# elif 1 && LONG_MAX >> 30 == 1
733# define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX
734# endif
735# if !defined SCNd64 || 0
736# undef SCNd64
737# define SCNd64 _SCN64_PREFIX "d"
738# endif
739# if !defined SCNi64 || 0
740# undef SCNi64
741# define SCNi64 _SCN64_PREFIX "i"
742# endif
743# endif
744# ifdef UINT64_MAX
745# if (0 ? defined _LP64 : 1)
746# define _SCNu64_PREFIX "l"
747# elif defined _MSC_VER || defined __MINGW32__
748# define _SCNu64_PREFIX "I64"
749# elif 1 && ULONG_MAX >> 31 == 1
750# define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX
751# endif
752# if !defined SCNo64 || 0
753# undef SCNo64
754# define SCNo64 _SCNu64_PREFIX "o"
755# endif
756# if !defined SCNu64 || 0
757# undef SCNu64
758# define SCNu64 _SCNu64_PREFIX "u"
759# endif
760# if !defined SCNx64 || 0
761# undef SCNx64
762# define SCNx64 _SCNu64_PREFIX "x"
763# endif
764# endif
765
766# if !defined SCNdLEAST8 || 0
767# undef SCNdLEAST8
768# define SCNdLEAST8 "hhd"
769# endif
770# if !defined SCNiLEAST8 || 0
771# undef SCNiLEAST8
772# define SCNiLEAST8 "hhi"
773# endif
774# if !defined SCNoLEAST8 || 0
775# undef SCNoLEAST8
776# define SCNoLEAST8 "hho"
777# endif
778# if !defined SCNuLEAST8 || 0
779# undef SCNuLEAST8
780# define SCNuLEAST8 "hhu"
781# endif
782# if !defined SCNxLEAST8 || 0
783# undef SCNxLEAST8
784# define SCNxLEAST8 "hhx"
785# endif
786# if !defined SCNdLEAST16 || 0
787# undef SCNdLEAST16
788# define SCNdLEAST16 "hd"
789# endif
790# if !defined SCNiLEAST16 || 0
791# undef SCNiLEAST16
792# define SCNiLEAST16 "hi"
793# endif
794# if !defined SCNoLEAST16 || 0
795# undef SCNoLEAST16
796# define SCNoLEAST16 "ho"
797# endif
798# if !defined SCNuLEAST16 || 0
799# undef SCNuLEAST16
800# define SCNuLEAST16 "hu"
801# endif
802# if !defined SCNxLEAST16 || 0
803# undef SCNxLEAST16
804# define SCNxLEAST16 "hx"
805# endif
806# if !defined SCNdLEAST32 || 0
807# undef SCNdLEAST32
808# define SCNdLEAST32 "d"
809# endif
810# if !defined SCNiLEAST32 || 0
811# undef SCNiLEAST32
812# define SCNiLEAST32 "i"
813# endif
814# if !defined SCNoLEAST32 || 0
815# undef SCNoLEAST32
816# define SCNoLEAST32 "o"
817# endif
818# if !defined SCNuLEAST32 || 0
819# undef SCNuLEAST32
820# define SCNuLEAST32 "u"
821# endif
822# if !defined SCNxLEAST32 || 0
823# undef SCNxLEAST32
824# define SCNxLEAST32 "x"
825# endif
826# ifdef INT64_MAX
827# if !defined SCNdLEAST64 || 0
828# undef SCNdLEAST64
829# define SCNdLEAST64 SCNd64
830# endif
831# if !defined SCNiLEAST64 || 0
832# undef SCNiLEAST64
833# define SCNiLEAST64 SCNi64
834# endif
835# endif
836# ifdef UINT64_MAX
837# if !defined SCNoLEAST64 || 0
838# undef SCNoLEAST64
839# define SCNoLEAST64 SCNo64
840# endif
841# if !defined SCNuLEAST64 || 0
842# undef SCNuLEAST64
843# define SCNuLEAST64 SCNu64
844# endif
845# if !defined SCNxLEAST64 || 0
846# undef SCNxLEAST64
847# define SCNxLEAST64 SCNx64
848# endif
849# endif
850
851# if !defined SCNdFAST8 || 0
852# undef SCNdFAST8
853# if INT_FAST8_MAX > INT32_MAX
854# define SCNdFAST8 SCNd64
855# elif INT_FAST8_MAX == 0x7fff
856# define SCNdFAST8 "hd"
857# elif INT_FAST8_MAX == 0x7f
858# define SCNdFAST8 "hhd"
859# else
860# define SCNdFAST8 "d"
861# endif
862# endif
863# if !defined SCNiFAST8 || 0
864# undef SCNiFAST8
865# if INT_FAST8_MAX > INT32_MAX
866# define SCNiFAST8 SCNi64
867# elif INT_FAST8_MAX == 0x7fff
868# define SCNiFAST8 "hi"
869# elif INT_FAST8_MAX == 0x7f
870# define SCNiFAST8 "hhi"
871# else
872# define SCNiFAST8 "i"
873# endif
874# endif
875# if !defined SCNoFAST8 || 0
876# undef SCNoFAST8
877# if UINT_FAST8_MAX > UINT32_MAX
878# define SCNoFAST8 SCNo64
879# elif UINT_FAST8_MAX == 0xffff
880# define SCNoFAST8 "ho"
881# elif UINT_FAST8_MAX == 0xff
882# define SCNoFAST8 "hho"
883# else
884# define SCNoFAST8 "o"
885# endif
886# endif
887# if !defined SCNuFAST8 || 0
888# undef SCNuFAST8
889# if UINT_FAST8_MAX > UINT32_MAX
890# define SCNuFAST8 SCNu64
891# elif UINT_FAST8_MAX == 0xffff
892# define SCNuFAST8 "hu"
893# elif UINT_FAST8_MAX == 0xff
894# define SCNuFAST8 "hhu"
895# else
896# define SCNuFAST8 "u"
897# endif
898# endif
899# if !defined SCNxFAST8 || 0
900# undef SCNxFAST8
901# if UINT_FAST8_MAX > UINT32_MAX
902# define SCNxFAST8 SCNx64
903# elif UINT_FAST8_MAX == 0xffff
904# define SCNxFAST8 "hx"
905# elif UINT_FAST8_MAX == 0xff
906# define SCNxFAST8 "hhx"
907# else
908# define SCNxFAST8 "x"
909# endif
910# endif
911# if !defined SCNdFAST16 || 0
912# undef SCNdFAST16
913# if INT_FAST16_MAX > INT32_MAX
914# define SCNdFAST16 SCNd64
915# elif INT_FAST16_MAX == 0x7fff
916# define SCNdFAST16 "hd"
917# else
918# define SCNdFAST16 "d"
919# endif
920# endif
921# if !defined SCNiFAST16 || 0
922# undef SCNiFAST16
923# if INT_FAST16_MAX > INT32_MAX
924# define SCNiFAST16 SCNi64
925# elif INT_FAST16_MAX == 0x7fff
926# define SCNiFAST16 "hi"
927# else
928# define SCNiFAST16 "i"
929# endif
930# endif
931# if !defined SCNoFAST16 || 0
932# undef SCNoFAST16
933# if UINT_FAST16_MAX > UINT32_MAX
934# define SCNoFAST16 SCNo64
935# elif UINT_FAST16_MAX == 0xffff
936# define SCNoFAST16 "ho"
937# else
938# define SCNoFAST16 "o"
939# endif
940# endif
941# if !defined SCNuFAST16 || 0
942# undef SCNuFAST16
943# if UINT_FAST16_MAX > UINT32_MAX
944# define SCNuFAST16 SCNu64
945# elif UINT_FAST16_MAX == 0xffff
946# define SCNuFAST16 "hu"
947# else
948# define SCNuFAST16 "u"
949# endif
950# endif
951# if !defined SCNxFAST16 || 0
952# undef SCNxFAST16
953# if UINT_FAST16_MAX > UINT32_MAX
954# define SCNxFAST16 SCNx64
955# elif UINT_FAST16_MAX == 0xffff
956# define SCNxFAST16 "hx"
957# else
958# define SCNxFAST16 "x"
959# endif
960# endif
961# if !defined SCNdFAST32 || 0
962# undef SCNdFAST32
963# if INT_FAST32_MAX > INT32_MAX
964# define SCNdFAST32 SCNd64
965# else
966# define SCNdFAST32 "d"
967# endif
968# endif
969# if !defined SCNiFAST32 || 0
970# undef SCNiFAST32
971# if INT_FAST32_MAX > INT32_MAX
972# define SCNiFAST32 SCNi64
973# else
974# define SCNiFAST32 "i"
975# endif
976# endif
977# if !defined SCNoFAST32 || 0
978# undef SCNoFAST32
979# if UINT_FAST32_MAX > UINT32_MAX
980# define SCNoFAST32 SCNo64
981# else
982# define SCNoFAST32 "o"
983# endif
984# endif
985# if !defined SCNuFAST32 || 0
986# undef SCNuFAST32
987# if UINT_FAST32_MAX > UINT32_MAX
988# define SCNuFAST32 SCNu64
989# else
990# define SCNuFAST32 "u"
991# endif
992# endif
993# if !defined SCNxFAST32 || 0
994# undef SCNxFAST32
995# if UINT_FAST32_MAX > UINT32_MAX
996# define SCNxFAST32 SCNx64
997# else
998# define SCNxFAST32 "x"
999# endif
1000# endif
1001# ifdef INT64_MAX
1002# if !defined SCNdFAST64 || 0
1003# undef SCNdFAST64
1004# define SCNdFAST64 SCNd64
1005# endif
1006# if !defined SCNiFAST64 || 0
1007# undef SCNiFAST64
1008# define SCNiFAST64 SCNi64
1009# endif
1010# endif
1011# ifdef UINT64_MAX
1012# if !defined SCNoFAST64 || 0
1013# undef SCNoFAST64
1014# define SCNoFAST64 SCNo64
1015# endif
1016# if !defined SCNuFAST64 || 0
1017# undef SCNuFAST64
1018# define SCNuFAST64 SCNu64
1019# endif
1020# if !defined SCNxFAST64 || 0
1021# undef SCNxFAST64
1022# define SCNxFAST64 SCNx64
1023# endif
1024# endif
1025
1026# if !defined SCNdMAX || 0
1027# undef SCNdMAX
1028# if 1
1029# define SCNdMAX SCNd64
1030# else
1031# define SCNdMAX "ld"
1032# endif
1033# endif
1034# if !defined SCNiMAX || 0
1035# undef SCNiMAX
1036# if 1
1037# define SCNiMAX SCNi64
1038# else
1039# define SCNiMAX "li"
1040# endif
1041# endif
1042# if !defined SCNoMAX || 0
1043# undef SCNoMAX
1044# if 1
1045# define SCNoMAX SCNo64
1046# else
1047# define SCNoMAX "lo"
1048# endif
1049# endif
1050# if !defined SCNuMAX || 0
1051# undef SCNuMAX
1052# if 1
1053# define SCNuMAX SCNu64
1054# else
1055# define SCNuMAX "lu"
1056# endif
1057# endif
1058# if !defined SCNxMAX || 0
1059# undef SCNxMAX
1060# if 1
1061# define SCNxMAX SCNx64
1062# else
1063# define SCNxMAX "lx"
1064# endif
1065# endif
1066
1067# if !defined SCNdPTR || 0
1068# undef SCNdPTR
1069# ifdef INTPTR_MAX
1070# define SCNdPTR "l" "d"
1071# endif
1072# endif
1073# if !defined SCNiPTR || 0
1074# undef SCNiPTR
1075# ifdef INTPTR_MAX
1076# define SCNiPTR "l" "i"
1077# endif
1078# endif
1079# if !defined SCNoPTR || 0
1080# undef SCNoPTR
1081# ifdef UINTPTR_MAX
1082# define SCNoPTR "l" "o"
1083# endif
1084# endif
1085# if !defined SCNuPTR || 0
1086# undef SCNuPTR
1087# ifdef UINTPTR_MAX
1088# define SCNuPTR "l" "u"
1089# endif
1090# endif
1091# if !defined SCNxPTR || 0
1092# undef SCNxPTR
1093# ifdef UINTPTR_MAX
1094# define SCNxPTR "l" "x"
1095# endif
1096# endif
1097
1098#endif
1099
1100/* 7.8.2 Functions for greatest-width integer types */
1101
1102#ifdef __cplusplus
1103extern "C" {
1104#endif
1105
1106#if 0
1107# if !1
1108extern intmax_t imaxabs (intmax_t);
1109# endif
1110#elif defined GNULIB_POSIXCHECK
1111# undef imaxabs
1112# if HAVE_RAW_DECL_IMAXABS
1113_GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - "
1114 "use gnulib module imaxabs for portability");
1115# endif
1116#endif
1117
1118#if 0
1119# if !1
1120# if !GNULIB_defined_imaxdiv_t
1121typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t;
1122# define GNULIB_defined_imaxdiv_t 1
1123# endif
1124extern imaxdiv_t imaxdiv (intmax_t, intmax_t);
1125# endif
1126#elif defined GNULIB_POSIXCHECK
1127# undef imaxdiv
1128# if HAVE_RAW_DECL_IMAXDIV
1129_GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
1130 "use gnulib module imaxdiv for portability");
1131# endif
1132#endif
1133
1134#if 1
1135# if !1
1136extern intmax_t strtoimax (const char *, char **, int) _GL_ARG_NONNULL ((1));
1137# endif
1138#elif defined GNULIB_POSIXCHECK
1139# undef strtoimax
1140# if HAVE_RAW_DECL_STRTOIMAX
1141_GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
1142 "use gnulib module strtoimax for portability");
1143# endif
1144#endif
1145
1146#if 1
1147# if !1
1148extern uintmax_t strtoumax (const char *, char **, int) _GL_ARG_NONNULL ((1));
1149# endif
1150#elif defined GNULIB_POSIXCHECK
1151# undef strtoumax
1152# if HAVE_RAW_DECL_STRTOUMAX
1153_GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - "
1154 "use gnulib module strtoumax for portability");
1155# endif
1156#endif
1157
1158/* Don't bother defining or declaring wcstoimax and wcstoumax, since
1159 wide-character functions like this are hardly ever useful. */
1160
1161#ifdef __cplusplus
1162}
1163#endif
1164
1165#endif /* !defined INTTYPES_H && !defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H */
diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h
new file mode 100644
index 00000000000..6a8f46dddc2
--- /dev/null
+++ b/lib/inttypes.in.h
@@ -0,0 +1,1108 @@
1/* Copyright (C) 2006-2011 Free Software Foundation, Inc.
2 Written by Paul Eggert, Bruno Haible, Derek Price.
3 This file is part of gnulib.
4
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 of the License, or
8 (at your option) any later version.
9
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.
14
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/>. */
17
18/*
19 * ISO C 99 <inttypes.h> for platforms that lack it.
20 * <http://www.opengroup.org/susv3xbd/inttypes.h.html>
21 */
22
23#if __GNUC__ >= 3
24@PRAGMA_SYSTEM_HEADER@
25#endif
26@PRAGMA_COLUMNS@
27
28/* Include the original <inttypes.h> if it exists, and if this file
29 has not been included yet or if this file includes gnulib stdint.h
30 which in turn includes this file.
31 The include_next requires a split double-inclusion guard. */
32#if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
33# if @HAVE_INTTYPES_H@
34# @INCLUDE_NEXT@ @NEXT_INTTYPES_H@
35# endif
36#endif
37
38#if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
39#define INTTYPES_H
40
41/* Include <stdint.h> or the gnulib replacement.
42 But avoid namespace pollution on glibc systems. */
43#ifndef __GLIBC__
44# include <stdint.h>
45#endif
46/* Get CHAR_BIT. */
47#include <limits.h>
48
49#if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX)
50# error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
51#endif
52
53/* The definition of _GL_ARG_NONNULL is copied here. */
54
55/* The definition of _GL_WARN_ON_USE is copied here. */
56
57/* 7.8.1 Macros for format specifiers */
58
59#if ! defined __cplusplus || defined __STDC_FORMAT_MACROS
60
61# if defined _TNS_R_TARGET
62 /* Tandem NonStop R series and compatible platforms released before
63 July 2005 support %Ld but not %lld. */
64# define _LONG_LONG_FORMAT_PREFIX "L"
65# else
66# define _LONG_LONG_FORMAT_PREFIX "ll"
67# endif
68
69# if !defined PRId8 || @PRI_MACROS_BROKEN@
70# undef PRId8
71# ifdef INT8_MAX
72# define PRId8 "d"
73# endif
74# endif
75# if !defined PRIi8 || @PRI_MACROS_BROKEN@
76# undef PRIi8
77# ifdef INT8_MAX
78# define PRIi8 "i"
79# endif
80# endif
81# if !defined PRIo8 || @PRI_MACROS_BROKEN@
82# undef PRIo8
83# ifdef UINT8_MAX
84# define PRIo8 "o"
85# endif
86# endif
87# if !defined PRIu8 || @PRI_MACROS_BROKEN@
88# undef PRIu8
89# ifdef UINT8_MAX
90# define PRIu8 "u"
91# endif
92# endif
93# if !defined PRIx8 || @PRI_MACROS_BROKEN@
94# undef PRIx8
95# ifdef UINT8_MAX
96# define PRIx8 "x"
97# endif
98# endif
99# if !defined PRIX8 || @PRI_MACROS_BROKEN@
100# undef PRIX8
101# ifdef UINT8_MAX
102# define PRIX8 "X"
103# endif
104# endif
105# if !defined PRId16 || @PRI_MACROS_BROKEN@
106# undef PRId16
107# ifdef INT16_MAX
108# define PRId16 "d"
109# endif
110# endif
111# if !defined PRIi16 || @PRI_MACROS_BROKEN@
112# undef PRIi16
113# ifdef INT16_MAX
114# define PRIi16 "i"
115# endif
116# endif
117# if !defined PRIo16 || @PRI_MACROS_BROKEN@
118# undef PRIo16
119# ifdef UINT16_MAX
120# define PRIo16 "o"
121# endif
122# endif
123# if !defined PRIu16 || @PRI_MACROS_BROKEN@
124# undef PRIu16
125# ifdef UINT16_MAX
126# define PRIu16 "u"
127# endif
128# endif
129# if !defined PRIx16 || @PRI_MACROS_BROKEN@
130# undef PRIx16
131# ifdef UINT16_MAX
132# define PRIx16 "x"
133# endif
134# endif
135# if !defined PRIX16 || @PRI_MACROS_BROKEN@
136# undef PRIX16
137# ifdef UINT16_MAX
138# define PRIX16 "X"
139# endif
140# endif
141# if !defined PRId32 || @PRI_MACROS_BROKEN@
142# undef PRId32
143# ifdef INT32_MAX
144# define PRId32 "d"
145# endif
146# endif
147# if !defined PRIi32 || @PRI_MACROS_BROKEN@
148# undef PRIi32
149# ifdef INT32_MAX
150# define PRIi32 "i"
151# endif
152# endif
153# if !defined PRIo32 || @PRI_MACROS_BROKEN@
154# undef PRIo32
155# ifdef UINT32_MAX
156# define PRIo32 "o"
157# endif
158# endif
159# if !defined PRIu32 || @PRI_MACROS_BROKEN@
160# undef PRIu32
161# ifdef UINT32_MAX
162# define PRIu32 "u"
163# endif
164# endif
165# if !defined PRIx32 || @PRI_MACROS_BROKEN@
166# undef PRIx32
167# ifdef UINT32_MAX
168# define PRIx32 "x"
169# endif
170# endif
171# if !defined PRIX32 || @PRI_MACROS_BROKEN@
172# undef PRIX32
173# ifdef UINT32_MAX
174# define PRIX32 "X"
175# endif
176# endif
177# ifdef INT64_MAX
178# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
179# define _PRI64_PREFIX "l"
180# elif defined _MSC_VER || defined __MINGW32__
181# define _PRI64_PREFIX "I64"
182# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
183# define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX
184# endif
185# if !defined PRId64 || @PRI_MACROS_BROKEN@
186# undef PRId64
187# define PRId64 _PRI64_PREFIX "d"
188# endif
189# if !defined PRIi64 || @PRI_MACROS_BROKEN@
190# undef PRIi64
191# define PRIi64 _PRI64_PREFIX "i"
192# endif
193# endif
194# ifdef UINT64_MAX
195# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
196# define _PRIu64_PREFIX "l"
197# elif defined _MSC_VER || defined __MINGW32__
198# define _PRIu64_PREFIX "I64"
199# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
200# define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX
201# endif
202# if !defined PRIo64 || @PRI_MACROS_BROKEN@
203# undef PRIo64
204# define PRIo64 _PRIu64_PREFIX "o"
205# endif
206# if !defined PRIu64 || @PRI_MACROS_BROKEN@
207# undef PRIu64
208# define PRIu64 _PRIu64_PREFIX "u"
209# endif
210# if !defined PRIx64 || @PRI_MACROS_BROKEN@
211# undef PRIx64
212# define PRIx64 _PRIu64_PREFIX "x"
213# endif
214# if !defined PRIX64 || @PRI_MACROS_BROKEN@
215# undef PRIX64
216# define PRIX64 _PRIu64_PREFIX "X"
217# endif
218# endif
219
220# if !defined PRIdLEAST8 || @PRI_MACROS_BROKEN@
221# undef PRIdLEAST8
222# define PRIdLEAST8 "d"
223# endif
224# if !defined PRIiLEAST8 || @PRI_MACROS_BROKEN@
225# undef PRIiLEAST8
226# define PRIiLEAST8 "i"
227# endif
228# if !defined PRIoLEAST8 || @PRI_MACROS_BROKEN@
229# undef PRIoLEAST8
230# define PRIoLEAST8 "o"
231# endif
232# if !defined PRIuLEAST8 || @PRI_MACROS_BROKEN@
233# undef PRIuLEAST8
234# define PRIuLEAST8 "u"
235# endif
236# if !defined PRIxLEAST8 || @PRI_MACROS_BROKEN@
237# undef PRIxLEAST8
238# define PRIxLEAST8 "x"
239# endif
240# if !defined PRIXLEAST8 || @PRI_MACROS_BROKEN@
241# undef PRIXLEAST8
242# define PRIXLEAST8 "X"
243# endif
244# if !defined PRIdLEAST16 || @PRI_MACROS_BROKEN@
245# undef PRIdLEAST16
246# define PRIdLEAST16 "d"
247# endif
248# if !defined PRIiLEAST16 || @PRI_MACROS_BROKEN@
249# undef PRIiLEAST16
250# define PRIiLEAST16 "i"
251# endif
252# if !defined PRIoLEAST16 || @PRI_MACROS_BROKEN@
253# undef PRIoLEAST16
254# define PRIoLEAST16 "o"
255# endif
256# if !defined PRIuLEAST16 || @PRI_MACROS_BROKEN@
257# undef PRIuLEAST16
258# define PRIuLEAST16 "u"
259# endif
260# if !defined PRIxLEAST16 || @PRI_MACROS_BROKEN@
261# undef PRIxLEAST16
262# define PRIxLEAST16 "x"
263# endif
264# if !defined PRIXLEAST16 || @PRI_MACROS_BROKEN@
265# undef PRIXLEAST16
266# define PRIXLEAST16 "X"
267# endif
268# if !defined PRIdLEAST32 || @PRI_MACROS_BROKEN@
269# undef PRIdLEAST32
270# define PRIdLEAST32 "d"
271# endif
272# if !defined PRIiLEAST32 || @PRI_MACROS_BROKEN@
273# undef PRIiLEAST32
274# define PRIiLEAST32 "i"
275# endif
276# if !defined PRIoLEAST32 || @PRI_MACROS_BROKEN@
277# undef PRIoLEAST32
278# define PRIoLEAST32 "o"
279# endif
280# if !defined PRIuLEAST32 || @PRI_MACROS_BROKEN@
281# undef PRIuLEAST32
282# define PRIuLEAST32 "u"
283# endif
284# if !defined PRIxLEAST32 || @PRI_MACROS_BROKEN@
285# undef PRIxLEAST32
286# define PRIxLEAST32 "x"
287# endif
288# if !defined PRIXLEAST32 || @PRI_MACROS_BROKEN@
289# undef PRIXLEAST32
290# define PRIXLEAST32 "X"
291# endif
292# ifdef INT64_MAX
293# if !defined PRIdLEAST64 || @PRI_MACROS_BROKEN@
294# undef PRIdLEAST64
295# define PRIdLEAST64 PRId64
296# endif
297# if !defined PRIiLEAST64 || @PRI_MACROS_BROKEN@
298# undef PRIiLEAST64
299# define PRIiLEAST64 PRIi64
300# endif
301# endif
302# ifdef UINT64_MAX
303# if !defined PRIoLEAST64 || @PRI_MACROS_BROKEN@
304# undef PRIoLEAST64
305# define PRIoLEAST64 PRIo64
306# endif
307# if !defined PRIuLEAST64 || @PRI_MACROS_BROKEN@
308# undef PRIuLEAST64
309# define PRIuLEAST64 PRIu64
310# endif
311# if !defined PRIxLEAST64 || @PRI_MACROS_BROKEN@
312# undef PRIxLEAST64
313# define PRIxLEAST64 PRIx64
314# endif
315# if !defined PRIXLEAST64 || @PRI_MACROS_BROKEN@
316# undef PRIXLEAST64
317# define PRIXLEAST64 PRIX64
318# endif
319# endif
320
321# if !defined PRIdFAST8 || @PRI_MACROS_BROKEN@
322# undef PRIdFAST8
323# if INT_FAST8_MAX > INT32_MAX
324# define PRIdFAST8 PRId64
325# else
326# define PRIdFAST8 "d"
327# endif
328# endif
329# if !defined PRIiFAST8 || @PRI_MACROS_BROKEN@
330# undef PRIiFAST8
331# if INT_FAST8_MAX > INT32_MAX
332# define PRIiFAST8 PRIi64
333# else
334# define PRIiFAST8 "i"
335# endif
336# endif
337# if !defined PRIoFAST8 || @PRI_MACROS_BROKEN@
338# undef PRIoFAST8
339# if UINT_FAST8_MAX > UINT32_MAX
340# define PRIoFAST8 PRIo64
341# else
342# define PRIoFAST8 "o"
343# endif
344# endif
345# if !defined PRIuFAST8 || @PRI_MACROS_BROKEN@
346# undef PRIuFAST8
347# if UINT_FAST8_MAX > UINT32_MAX
348# define PRIuFAST8 PRIu64
349# else
350# define PRIuFAST8 "u"
351# endif
352# endif
353# if !defined PRIxFAST8 || @PRI_MACROS_BROKEN@
354# undef PRIxFAST8
355# if UINT_FAST8_MAX > UINT32_MAX
356# define PRIxFAST8 PRIx64
357# else
358# define PRIxFAST8 "x"
359# endif
360# endif
361# if !defined PRIXFAST8 || @PRI_MACROS_BROKEN@
362# undef PRIXFAST8
363# if UINT_FAST8_MAX > UINT32_MAX
364# define PRIXFAST8 PRIX64
365# else
366# define PRIXFAST8 "X"
367# endif
368# endif
369# if !defined PRIdFAST16 || @PRI_MACROS_BROKEN@
370# undef PRIdFAST16
371# if INT_FAST16_MAX > INT32_MAX
372# define PRIdFAST16 PRId64
373# else
374# define PRIdFAST16 "d"
375# endif
376# endif
377# if !defined PRIiFAST16 || @PRI_MACROS_BROKEN@
378# undef PRIiFAST16
379# if INT_FAST16_MAX > INT32_MAX
380# define PRIiFAST16 PRIi64
381# else
382# define PRIiFAST16 "i"
383# endif
384# endif
385# if !defined PRIoFAST16 || @PRI_MACROS_BROKEN@
386# undef PRIoFAST16
387# if UINT_FAST16_MAX > UINT32_MAX
388# define PRIoFAST16 PRIo64
389# else
390# define PRIoFAST16 "o"
391# endif
392# endif
393# if !defined PRIuFAST16 || @PRI_MACROS_BROKEN@
394# undef PRIuFAST16
395# if UINT_FAST16_MAX > UINT32_MAX
396# define PRIuFAST16 PRIu64
397# else
398# define PRIuFAST16 "u"
399# endif
400# endif
401# if !defined PRIxFAST16 || @PRI_MACROS_BROKEN@
402# undef PRIxFAST16
403# if UINT_FAST16_MAX > UINT32_MAX
404# define PRIxFAST16 PRIx64
405# else
406# define PRIxFAST16 "x"
407# endif
408# endif
409# if !defined PRIXFAST16 || @PRI_MACROS_BROKEN@
410# undef PRIXFAST16
411# if UINT_FAST16_MAX > UINT32_MAX
412# define PRIXFAST16 PRIX64
413# else
414# define PRIXFAST16 "X"
415# endif
416# endif
417# if !defined PRIdFAST32 || @PRI_MACROS_BROKEN@
418# undef PRIdFAST32
419# if INT_FAST32_MAX > INT32_MAX
420# define PRIdFAST32 PRId64
421# else
422# define PRIdFAST32 "d"
423# endif
424# endif
425# if !defined PRIiFAST32 || @PRI_MACROS_BROKEN@
426# undef PRIiFAST32
427# if INT_FAST32_MAX > INT32_MAX
428# define PRIiFAST32 PRIi64
429# else
430# define PRIiFAST32 "i"
431# endif
432# endif
433# if !defined PRIoFAST32 || @PRI_MACROS_BROKEN@
434# undef PRIoFAST32
435# if UINT_FAST32_MAX > UINT32_MAX
436# define PRIoFAST32 PRIo64
437# else
438# define PRIoFAST32 "o"
439# endif
440# endif
441# if !defined PRIuFAST32 || @PRI_MACROS_BROKEN@
442# undef PRIuFAST32
443# if UINT_FAST32_MAX > UINT32_MAX
444# define PRIuFAST32 PRIu64
445# else
446# define PRIuFAST32 "u"
447# endif
448# endif
449# if !defined PRIxFAST32 || @PRI_MACROS_BROKEN@
450# undef PRIxFAST32
451# if UINT_FAST32_MAX > UINT32_MAX
452# define PRIxFAST32 PRIx64
453# else
454# define PRIxFAST32 "x"
455# endif
456# endif
457# if !defined PRIXFAST32 || @PRI_MACROS_BROKEN@
458# undef PRIXFAST32
459# if UINT_FAST32_MAX > UINT32_MAX
460# define PRIXFAST32 PRIX64
461# else
462# define PRIXFAST32 "X"
463# endif
464# endif
465# ifdef INT64_MAX
466# if !defined PRIdFAST64 || @PRI_MACROS_BROKEN@
467# undef PRIdFAST64
468# define PRIdFAST64 PRId64
469# endif
470# if !defined PRIiFAST64 || @PRI_MACROS_BROKEN@
471# undef PRIiFAST64
472# define PRIiFAST64 PRIi64
473# endif
474# endif
475# ifdef UINT64_MAX
476# if !defined PRIoFAST64 || @PRI_MACROS_BROKEN@
477# undef PRIoFAST64
478# define PRIoFAST64 PRIo64
479# endif
480# if !defined PRIuFAST64 || @PRI_MACROS_BROKEN@
481# undef PRIuFAST64
482# define PRIuFAST64 PRIu64
483# endif
484# if !defined PRIxFAST64 || @PRI_MACROS_BROKEN@
485# undef PRIxFAST64
486# define PRIxFAST64 PRIx64
487# endif
488# if !defined PRIXFAST64 || @PRI_MACROS_BROKEN@
489# undef PRIXFAST64
490# define PRIXFAST64 PRIX64
491# endif
492# endif
493
494# if !defined PRIdMAX || @PRI_MACROS_BROKEN@
495# undef PRIdMAX
496# if @INT32_MAX_LT_INTMAX_MAX@
497# define PRIdMAX PRId64
498# else
499# define PRIdMAX "ld"
500# endif
501# endif
502# if !defined PRIiMAX || @PRI_MACROS_BROKEN@
503# undef PRIiMAX
504# if @INT32_MAX_LT_INTMAX_MAX@
505# define PRIiMAX PRIi64
506# else
507# define PRIiMAX "li"
508# endif
509# endif
510# if !defined PRIoMAX || @PRI_MACROS_BROKEN@
511# undef PRIoMAX
512# if @UINT32_MAX_LT_UINTMAX_MAX@
513# define PRIoMAX PRIo64
514# else
515# define PRIoMAX "lo"
516# endif
517# endif
518# if !defined PRIuMAX || @PRI_MACROS_BROKEN@
519# undef PRIuMAX
520# if @UINT32_MAX_LT_UINTMAX_MAX@
521# define PRIuMAX PRIu64
522# else
523# define PRIuMAX "lu"
524# endif
525# endif
526# if !defined PRIxMAX || @PRI_MACROS_BROKEN@
527# undef PRIxMAX
528# if @UINT32_MAX_LT_UINTMAX_MAX@
529# define PRIxMAX PRIx64
530# else
531# define PRIxMAX "lx"
532# endif
533# endif
534# if !defined PRIXMAX || @PRI_MACROS_BROKEN@
535# undef PRIXMAX
536# if @UINT32_MAX_LT_UINTMAX_MAX@
537# define PRIXMAX PRIX64
538# else
539# define PRIXMAX "lX"
540# endif
541# endif
542
543# if !defined PRIdPTR || @PRI_MACROS_BROKEN@
544# undef PRIdPTR
545# ifdef INTPTR_MAX
546# define PRIdPTR @PRIPTR_PREFIX@ "d"
547# endif
548# endif
549# if !defined PRIiPTR || @PRI_MACROS_BROKEN@
550# undef PRIiPTR
551# ifdef INTPTR_MAX
552# define PRIiPTR @PRIPTR_PREFIX@ "i"
553# endif
554# endif
555# if !defined PRIoPTR || @PRI_MACROS_BROKEN@
556# undef PRIoPTR
557# ifdef UINTPTR_MAX
558# define PRIoPTR @PRIPTR_PREFIX@ "o"
559# endif
560# endif
561# if !defined PRIuPTR || @PRI_MACROS_BROKEN@
562# undef PRIuPTR
563# ifdef UINTPTR_MAX
564# define PRIuPTR @PRIPTR_PREFIX@ "u"
565# endif
566# endif
567# if !defined PRIxPTR || @PRI_MACROS_BROKEN@
568# undef PRIxPTR
569# ifdef UINTPTR_MAX
570# define PRIxPTR @PRIPTR_PREFIX@ "x"
571# endif
572# endif
573# if !defined PRIXPTR || @PRI_MACROS_BROKEN@
574# undef PRIXPTR
575# ifdef UINTPTR_MAX
576# define PRIXPTR @PRIPTR_PREFIX@ "X"
577# endif
578# endif
579
580# if !defined SCNd8 || @PRI_MACROS_BROKEN@
581# undef SCNd8
582# ifdef INT8_MAX
583# define SCNd8 "hhd"
584# endif
585# endif
586# if !defined SCNi8 || @PRI_MACROS_BROKEN@
587# undef SCNi8
588# ifdef INT8_MAX
589# define SCNi8 "hhi"
590# endif
591# endif
592# if !defined SCNo8 || @PRI_MACROS_BROKEN@
593# undef SCNo8
594# ifdef UINT8_MAX
595# define SCNo8 "hho"
596# endif
597# endif
598# if !defined SCNu8 || @PRI_MACROS_BROKEN@
599# undef SCNu8
600# ifdef UINT8_MAX
601# define SCNu8 "hhu"
602# endif
603# endif
604# if !defined SCNx8 || @PRI_MACROS_BROKEN@
605# undef SCNx8
606# ifdef UINT8_MAX
607# define SCNx8 "hhx"
608# endif
609# endif
610# if !defined SCNd16 || @PRI_MACROS_BROKEN@
611# undef SCNd16
612# ifdef INT16_MAX
613# define SCNd16 "hd"
614# endif
615# endif
616# if !defined SCNi16 || @PRI_MACROS_BROKEN@
617# undef SCNi16
618# ifdef INT16_MAX
619# define SCNi16 "hi"
620# endif
621# endif
622# if !defined SCNo16 || @PRI_MACROS_BROKEN@
623# undef SCNo16
624# ifdef UINT16_MAX
625# define SCNo16 "ho"
626# endif
627# endif
628# if !defined SCNu16 || @PRI_MACROS_BROKEN@
629# undef SCNu16
630# ifdef UINT16_MAX
631# define SCNu16 "hu"
632# endif
633# endif
634# if !defined SCNx16 || @PRI_MACROS_BROKEN@
635# undef SCNx16
636# ifdef UINT16_MAX
637# define SCNx16 "hx"
638# endif
639# endif
640# if !defined SCNd32 || @PRI_MACROS_BROKEN@
641# undef SCNd32
642# ifdef INT32_MAX
643# define SCNd32 "d"
644# endif
645# endif
646# if !defined SCNi32 || @PRI_MACROS_BROKEN@
647# undef SCNi32
648# ifdef INT32_MAX
649# define SCNi32 "i"
650# endif
651# endif
652# if !defined SCNo32 || @PRI_MACROS_BROKEN@
653# undef SCNo32
654# ifdef UINT32_MAX
655# define SCNo32 "o"
656# endif
657# endif
658# if !defined SCNu32 || @PRI_MACROS_BROKEN@
659# undef SCNu32
660# ifdef UINT32_MAX
661# define SCNu32 "u"
662# endif
663# endif
664# if !defined SCNx32 || @PRI_MACROS_BROKEN@
665# undef SCNx32
666# ifdef UINT32_MAX
667# define SCNx32 "x"
668# endif
669# endif
670# ifdef INT64_MAX
671# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
672# define _SCN64_PREFIX "l"
673# elif defined _MSC_VER || defined __MINGW32__
674# define _SCN64_PREFIX "I64"
675# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
676# define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX
677# endif
678# if !defined SCNd64 || @PRI_MACROS_BROKEN@
679# undef SCNd64
680# define SCNd64 _SCN64_PREFIX "d"
681# endif
682# if !defined SCNi64 || @PRI_MACROS_BROKEN@
683# undef SCNi64
684# define SCNi64 _SCN64_PREFIX "i"
685# endif
686# endif
687# ifdef UINT64_MAX
688# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
689# define _SCNu64_PREFIX "l"
690# elif defined _MSC_VER || defined __MINGW32__
691# define _SCNu64_PREFIX "I64"
692# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
693# define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX
694# endif
695# if !defined SCNo64 || @PRI_MACROS_BROKEN@
696# undef SCNo64
697# define SCNo64 _SCNu64_PREFIX "o"
698# endif
699# if !defined SCNu64 || @PRI_MACROS_BROKEN@
700# undef SCNu64
701# define SCNu64 _SCNu64_PREFIX "u"
702# endif
703# if !defined SCNx64 || @PRI_MACROS_BROKEN@
704# undef SCNx64
705# define SCNx64 _SCNu64_PREFIX "x"
706# endif
707# endif
708
709# if !defined SCNdLEAST8 || @PRI_MACROS_BROKEN@
710# undef SCNdLEAST8
711# define SCNdLEAST8 "hhd"
712# endif
713# if !defined SCNiLEAST8 || @PRI_MACROS_BROKEN@
714# undef SCNiLEAST8
715# define SCNiLEAST8 "hhi"
716# endif
717# if !defined SCNoLEAST8 || @PRI_MACROS_BROKEN@
718# undef SCNoLEAST8
719# define SCNoLEAST8 "hho"
720# endif
721# if !defined SCNuLEAST8 || @PRI_MACROS_BROKEN@
722# undef SCNuLEAST8
723# define SCNuLEAST8 "hhu"
724# endif
725# if !defined SCNxLEAST8 || @PRI_MACROS_BROKEN@
726# undef SCNxLEAST8
727# define SCNxLEAST8 "hhx"
728# endif
729# if !defined SCNdLEAST16 || @PRI_MACROS_BROKEN@
730# undef SCNdLEAST16
731# define SCNdLEAST16 "hd"
732# endif
733# if !defined SCNiLEAST16 || @PRI_MACROS_BROKEN@
734# undef SCNiLEAST16
735# define SCNiLEAST16 "hi"
736# endif
737# if !defined SCNoLEAST16 || @PRI_MACROS_BROKEN@
738# undef SCNoLEAST16
739# define SCNoLEAST16 "ho"
740# endif
741# if !defined SCNuLEAST16 || @PRI_MACROS_BROKEN@
742# undef SCNuLEAST16
743# define SCNuLEAST16 "hu"
744# endif
745# if !defined SCNxLEAST16 || @PRI_MACROS_BROKEN@
746# undef SCNxLEAST16
747# define SCNxLEAST16 "hx"
748# endif
749# if !defined SCNdLEAST32 || @PRI_MACROS_BROKEN@
750# undef SCNdLEAST32
751# define SCNdLEAST32 "d"
752# endif
753# if !defined SCNiLEAST32 || @PRI_MACROS_BROKEN@
754# undef SCNiLEAST32
755# define SCNiLEAST32 "i"
756# endif
757# if !defined SCNoLEAST32 || @PRI_MACROS_BROKEN@
758# undef SCNoLEAST32
759# define SCNoLEAST32 "o"
760# endif
761# if !defined SCNuLEAST32 || @PRI_MACROS_BROKEN@
762# undef SCNuLEAST32
763# define SCNuLEAST32 "u"
764# endif
765# if !defined SCNxLEAST32 || @PRI_MACROS_BROKEN@
766# undef SCNxLEAST32
767# define SCNxLEAST32 "x"
768# endif
769# ifdef INT64_MAX
770# if !defined SCNdLEAST64 || @PRI_MACROS_BROKEN@
771# undef SCNdLEAST64
772# define SCNdLEAST64 SCNd64
773# endif
774# if !defined SCNiLEAST64 || @PRI_MACROS_BROKEN@
775# undef SCNiLEAST64
776# define SCNiLEAST64 SCNi64
777# endif
778# endif
779# ifdef UINT64_MAX
780# if !defined SCNoLEAST64 || @PRI_MACROS_BROKEN@
781# undef SCNoLEAST64
782# define SCNoLEAST64 SCNo64
783# endif
784# if !defined SCNuLEAST64 || @PRI_MACROS_BROKEN@
785# undef SCNuLEAST64
786# define SCNuLEAST64 SCNu64
787# endif
788# if !defined SCNxLEAST64 || @PRI_MACROS_BROKEN@
789# undef SCNxLEAST64
790# define SCNxLEAST64 SCNx64
791# endif
792# endif
793
794# if !defined SCNdFAST8 || @PRI_MACROS_BROKEN@
795# undef SCNdFAST8
796# if INT_FAST8_MAX > INT32_MAX
797# define SCNdFAST8 SCNd64
798# elif INT_FAST8_MAX == 0x7fff
799# define SCNdFAST8 "hd"
800# elif INT_FAST8_MAX == 0x7f
801# define SCNdFAST8 "hhd"
802# else
803# define SCNdFAST8 "d"
804# endif
805# endif
806# if !defined SCNiFAST8 || @PRI_MACROS_BROKEN@
807# undef SCNiFAST8
808# if INT_FAST8_MAX > INT32_MAX
809# define SCNiFAST8 SCNi64
810# elif INT_FAST8_MAX == 0x7fff
811# define SCNiFAST8 "hi"
812# elif INT_FAST8_MAX == 0x7f
813# define SCNiFAST8 "hhi"
814# else
815# define SCNiFAST8 "i"
816# endif
817# endif
818# if !defined SCNoFAST8 || @PRI_MACROS_BROKEN@
819# undef SCNoFAST8
820# if UINT_FAST8_MAX > UINT32_MAX
821# define SCNoFAST8 SCNo64
822# elif UINT_FAST8_MAX == 0xffff
823# define SCNoFAST8 "ho"
824# elif UINT_FAST8_MAX == 0xff
825# define SCNoFAST8 "hho"
826# else
827# define SCNoFAST8 "o"
828# endif
829# endif
830# if !defined SCNuFAST8 || @PRI_MACROS_BROKEN@
831# undef SCNuFAST8
832# if UINT_FAST8_MAX > UINT32_MAX
833# define SCNuFAST8 SCNu64
834# elif UINT_FAST8_MAX == 0xffff
835# define SCNuFAST8 "hu"
836# elif UINT_FAST8_MAX == 0xff
837# define SCNuFAST8 "hhu"
838# else
839# define SCNuFAST8 "u"
840# endif
841# endif
842# if !defined SCNxFAST8 || @PRI_MACROS_BROKEN@
843# undef SCNxFAST8
844# if UINT_FAST8_MAX > UINT32_MAX
845# define SCNxFAST8 SCNx64
846# elif UINT_FAST8_MAX == 0xffff
847# define SCNxFAST8 "hx"
848# elif UINT_FAST8_MAX == 0xff
849# define SCNxFAST8 "hhx"
850# else
851# define SCNxFAST8 "x"
852# endif
853# endif
854# if !defined SCNdFAST16 || @PRI_MACROS_BROKEN@
855# undef SCNdFAST16
856# if INT_FAST16_MAX > INT32_MAX
857# define SCNdFAST16 SCNd64
858# elif INT_FAST16_MAX == 0x7fff
859# define SCNdFAST16 "hd"
860# else
861# define SCNdFAST16 "d"
862# endif
863# endif
864# if !defined SCNiFAST16 || @PRI_MACROS_BROKEN@
865# undef SCNiFAST16
866# if INT_FAST16_MAX > INT32_MAX
867# define SCNiFAST16 SCNi64
868# elif INT_FAST16_MAX == 0x7fff
869# define SCNiFAST16 "hi"
870# else
871# define SCNiFAST16 "i"
872# endif
873# endif
874# if !defined SCNoFAST16 || @PRI_MACROS_BROKEN@
875# undef SCNoFAST16
876# if UINT_FAST16_MAX > UINT32_MAX
877# define SCNoFAST16 SCNo64
878# elif UINT_FAST16_MAX == 0xffff
879# define SCNoFAST16 "ho"
880# else
881# define SCNoFAST16 "o"
882# endif
883# endif
884# if !defined SCNuFAST16 || @PRI_MACROS_BROKEN@
885# undef SCNuFAST16
886# if UINT_FAST16_MAX > UINT32_MAX
887# define SCNuFAST16 SCNu64
888# elif UINT_FAST16_MAX == 0xffff
889# define SCNuFAST16 "hu"
890# else
891# define SCNuFAST16 "u"
892# endif
893# endif
894# if !defined SCNxFAST16 || @PRI_MACROS_BROKEN@
895# undef SCNxFAST16
896# if UINT_FAST16_MAX > UINT32_MAX
897# define SCNxFAST16 SCNx64
898# elif UINT_FAST16_MAX == 0xffff
899# define SCNxFAST16 "hx"
900# else
901# define SCNxFAST16 "x"
902# endif
903# endif
904# if !defined SCNdFAST32 || @PRI_MACROS_BROKEN@
905# undef SCNdFAST32
906# if INT_FAST32_MAX > INT32_MAX
907# define SCNdFAST32 SCNd64
908# else
909# define SCNdFAST32 "d"
910# endif
911# endif
912# if !defined SCNiFAST32 || @PRI_MACROS_BROKEN@
913# undef SCNiFAST32
914# if INT_FAST32_MAX > INT32_MAX
915# define SCNiFAST32 SCNi64
916# else
917# define SCNiFAST32 "i"
918# endif
919# endif
920# if !defined SCNoFAST32 || @PRI_MACROS_BROKEN@
921# undef SCNoFAST32
922# if UINT_FAST32_MAX > UINT32_MAX
923# define SCNoFAST32 SCNo64
924# else
925# define SCNoFAST32 "o"
926# endif
927# endif
928# if !defined SCNuFAST32 || @PRI_MACROS_BROKEN@
929# undef SCNuFAST32
930# if UINT_FAST32_MAX > UINT32_MAX
931# define SCNuFAST32 SCNu64
932# else
933# define SCNuFAST32 "u"
934# endif
935# endif
936# if !defined SCNxFAST32 || @PRI_MACROS_BROKEN@
937# undef SCNxFAST32
938# if UINT_FAST32_MAX > UINT32_MAX
939# define SCNxFAST32 SCNx64
940# else
941# define SCNxFAST32 "x"
942# endif
943# endif
944# ifdef INT64_MAX
945# if !defined SCNdFAST64 || @PRI_MACROS_BROKEN@
946# undef SCNdFAST64
947# define SCNdFAST64 SCNd64
948# endif
949# if !defined SCNiFAST64 || @PRI_MACROS_BROKEN@
950# undef SCNiFAST64
951# define SCNiFAST64 SCNi64
952# endif
953# endif
954# ifdef UINT64_MAX
955# if !defined SCNoFAST64 || @PRI_MACROS_BROKEN@
956# undef SCNoFAST64
957# define SCNoFAST64 SCNo64
958# endif
959# if !defined SCNuFAST64 || @PRI_MACROS_BROKEN@
960# undef SCNuFAST64
961# define SCNuFAST64 SCNu64
962# endif
963# if !defined SCNxFAST64 || @PRI_MACROS_BROKEN@
964# undef SCNxFAST64
965# define SCNxFAST64 SCNx64
966# endif
967# endif
968
969# if !defined SCNdMAX || @PRI_MACROS_BROKEN@
970# undef SCNdMAX
971# if @INT32_MAX_LT_INTMAX_MAX@
972# define SCNdMAX SCNd64
973# else
974# define SCNdMAX "ld"
975# endif
976# endif
977# if !defined SCNiMAX || @PRI_MACROS_BROKEN@
978# undef SCNiMAX
979# if @INT32_MAX_LT_INTMAX_MAX@
980# define SCNiMAX SCNi64
981# else
982# define SCNiMAX "li"
983# endif
984# endif
985# if !defined SCNoMAX || @PRI_MACROS_BROKEN@
986# undef SCNoMAX
987# if @UINT32_MAX_LT_UINTMAX_MAX@
988# define SCNoMAX SCNo64
989# else
990# define SCNoMAX "lo"
991# endif
992# endif
993# if !defined SCNuMAX || @PRI_MACROS_BROKEN@
994# undef SCNuMAX
995# if @UINT32_MAX_LT_UINTMAX_MAX@
996# define SCNuMAX SCNu64
997# else
998# define SCNuMAX "lu"
999# endif
1000# endif
1001# if !defined SCNxMAX || @PRI_MACROS_BROKEN@
1002# undef SCNxMAX
1003# if @UINT32_MAX_LT_UINTMAX_MAX@
1004# define SCNxMAX SCNx64
1005# else
1006# define SCNxMAX "lx"
1007# endif
1008# endif
1009
1010# if !defined SCNdPTR || @PRI_MACROS_BROKEN@
1011# undef SCNdPTR
1012# ifdef INTPTR_MAX
1013# define SCNdPTR @PRIPTR_PREFIX@ "d"
1014# endif
1015# endif
1016# if !defined SCNiPTR || @PRI_MACROS_BROKEN@
1017# undef SCNiPTR
1018# ifdef INTPTR_MAX
1019# define SCNiPTR @PRIPTR_PREFIX@ "i"
1020# endif
1021# endif
1022# if !defined SCNoPTR || @PRI_MACROS_BROKEN@
1023# undef SCNoPTR
1024# ifdef UINTPTR_MAX
1025# define SCNoPTR @PRIPTR_PREFIX@ "o"
1026# endif
1027# endif
1028# if !defined SCNuPTR || @PRI_MACROS_BROKEN@
1029# undef SCNuPTR
1030# ifdef UINTPTR_MAX
1031# define SCNuPTR @PRIPTR_PREFIX@ "u"
1032# endif
1033# endif
1034# if !defined SCNxPTR || @PRI_MACROS_BROKEN@
1035# undef SCNxPTR
1036# ifdef UINTPTR_MAX
1037# define SCNxPTR @PRIPTR_PREFIX@ "x"
1038# endif
1039# endif
1040
1041#endif
1042
1043/* 7.8.2 Functions for greatest-width integer types */
1044
1045#ifdef __cplusplus
1046extern "C" {
1047#endif
1048
1049#if @GNULIB_IMAXABS@
1050# if !@HAVE_DECL_IMAXABS@
1051extern intmax_t imaxabs (intmax_t);
1052# endif
1053#elif defined GNULIB_POSIXCHECK
1054# undef imaxabs
1055# if HAVE_RAW_DECL_IMAXABS
1056_GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - "
1057 "use gnulib module imaxabs for portability");
1058# endif
1059#endif
1060
1061#if @GNULIB_IMAXDIV@
1062# if !@HAVE_DECL_IMAXDIV@
1063# if !GNULIB_defined_imaxdiv_t
1064typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t;
1065# define GNULIB_defined_imaxdiv_t 1
1066# endif
1067extern imaxdiv_t imaxdiv (intmax_t, intmax_t);
1068# endif
1069#elif defined GNULIB_POSIXCHECK
1070# undef imaxdiv
1071# if HAVE_RAW_DECL_IMAXDIV
1072_GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
1073 "use gnulib module imaxdiv for portability");
1074# endif
1075#endif
1076
1077#if @GNULIB_STRTOIMAX@
1078# if !@HAVE_DECL_STRTOIMAX@
1079extern intmax_t strtoimax (const char *, char **, int) _GL_ARG_NONNULL ((1));
1080# endif
1081#elif defined GNULIB_POSIXCHECK
1082# undef strtoimax
1083# if HAVE_RAW_DECL_STRTOIMAX
1084_GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
1085 "use gnulib module strtoimax for portability");
1086# endif
1087#endif
1088
1089#if @GNULIB_STRTOUMAX@
1090# if !@HAVE_DECL_STRTOUMAX@
1091extern uintmax_t strtoumax (const char *, char **, int) _GL_ARG_NONNULL ((1));
1092# endif
1093#elif defined GNULIB_POSIXCHECK
1094# undef strtoumax
1095# if HAVE_RAW_DECL_STRTOUMAX
1096_GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - "
1097 "use gnulib module strtoumax for portability");
1098# endif
1099#endif
1100
1101/* Don't bother defining or declaring wcstoimax and wcstoumax, since
1102 wide-character functions like this are hardly ever useful. */
1103
1104#ifdef __cplusplus
1105}
1106#endif
1107
1108#endif /* !defined INTTYPES_H && !defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H */
diff --git a/lib/strtoimax.c b/lib/strtoimax.c
new file mode 100644
index 00000000000..497d15585ce
--- /dev/null
+++ b/lib/strtoimax.c
@@ -0,0 +1,75 @@
1/* Convert string representation of a number into an intmax_t value.
2
3 Copyright (C) 1999, 2001-2004, 2006, 2009-2011 Free Software Foundation,
4 Inc.
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19/* Written by Paul Eggert. */
20
21#include <config.h>
22
23/* Verify interface. */
24#include <inttypes.h>
25
26#include <stdlib.h>
27
28#include "verify.h"
29
30#ifdef UNSIGNED
31# ifndef HAVE_DECL_STRTOULL
32"this configure-time declaration test was not run"
33# endif
34# if !HAVE_DECL_STRTOULL && HAVE_UNSIGNED_LONG_LONG_INT
35unsigned long long int strtoull (char const *, char **, int);
36# endif
37
38#else
39
40# ifndef HAVE_DECL_STRTOLL
41"this configure-time declaration test was not run"
42# endif
43# if !HAVE_DECL_STRTOLL && HAVE_LONG_LONG_INT
44long long int strtoll (char const *, char **, int);
45# endif
46#endif
47
48#ifdef UNSIGNED
49# define Have_long_long HAVE_UNSIGNED_LONG_LONG_INT
50# define Int uintmax_t
51# define Unsigned unsigned
52# define strtoimax strtoumax
53# define strtol strtoul
54# define strtoll strtoull
55#else
56# define Have_long_long HAVE_LONG_LONG_INT
57# define Int intmax_t
58# define Unsigned
59#endif
60
61Int
62strtoimax (char const *ptr, char **endptr, int base)
63{
64#if Have_long_long
65 verify (sizeof (Int) == sizeof (Unsigned long int)
66 || sizeof (Int) == sizeof (Unsigned long long int));
67
68 if (sizeof (Int) != sizeof (Unsigned long int))
69 return strtoll (ptr, endptr, base);
70#else
71 verify (sizeof (Int) == sizeof (Unsigned long int));
72#endif
73
74 return strtol (ptr, endptr, base);
75}
diff --git a/lib/strtol.c b/lib/strtol.c
new file mode 100644
index 00000000000..b6a761ecb9c
--- /dev/null
+++ b/lib/strtol.c
@@ -0,0 +1,434 @@
1/* Convert string representation of a number into an integer value.
2
3 Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2011 Free Software
4 Foundation, Inc.
5
6 NOTE: The canonical source of this file is maintained with the GNU C
7 Library. Bugs can be reported to bug-glibc@gnu.org.
8
9 This program is free software: you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by the
11 Free Software Foundation; either version 3 of the License, or any
12 later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22#ifdef _LIBC
23# define USE_NUMBER_GROUPING
24#else
25# include <config.h>
26#endif
27
28#include <ctype.h>
29#include <errno.h>
30#ifndef __set_errno
31# define __set_errno(Val) errno = (Val)
32#endif
33
34#include <limits.h>
35#include <stddef.h>
36#include <stdlib.h>
37#include <string.h>
38
39#ifdef USE_NUMBER_GROUPING
40# include "../locale/localeinfo.h"
41#endif
42
43/* Nonzero if we are defining `strtoul' or `strtoull', operating on
44 unsigned integers. */
45#ifndef UNSIGNED
46# define UNSIGNED 0
47# define INT LONG int
48#else
49# define INT unsigned LONG int
50#endif
51
52/* Determine the name. */
53#ifdef USE_IN_EXTENDED_LOCALE_MODEL
54# if UNSIGNED
55# ifdef USE_WIDE_CHAR
56# ifdef QUAD
57# define strtol __wcstoull_l
58# else
59# define strtol __wcstoul_l
60# endif
61# else
62# ifdef QUAD
63# define strtol __strtoull_l
64# else
65# define strtol __strtoul_l
66# endif
67# endif
68# else
69# ifdef USE_WIDE_CHAR
70# ifdef QUAD
71# define strtol __wcstoll_l
72# else
73# define strtol __wcstol_l
74# endif
75# else
76# ifdef QUAD
77# define strtol __strtoll_l
78# else
79# define strtol __strtol_l
80# endif
81# endif
82# endif
83#else
84# if UNSIGNED
85# ifdef USE_WIDE_CHAR
86# ifdef QUAD
87# define strtol wcstoull
88# else
89# define strtol wcstoul
90# endif
91# else
92# ifdef QUAD
93# define strtol strtoull
94# else
95# define strtol strtoul
96# endif
97# endif
98# else
99# ifdef USE_WIDE_CHAR
100# ifdef QUAD
101# define strtol wcstoll
102# else
103# define strtol wcstol
104# endif
105# else
106# ifdef QUAD
107# define strtol strtoll
108# endif
109# endif
110# endif
111#endif
112
113/* If QUAD is defined, we are defining `strtoll' or `strtoull',
114 operating on `long long int's. */
115#ifdef QUAD
116# define LONG long long
117# define STRTOL_LONG_MIN LLONG_MIN
118# define STRTOL_LONG_MAX LLONG_MAX
119# define STRTOL_ULONG_MAX ULLONG_MAX
120
121/* The extra casts in the following macros work around compiler bugs,
122 e.g., in Cray C 5.0.3.0. */
123
124/* True if negative values of the signed integer type T use two's
125 complement, ones' complement, or signed magnitude representation,
126 respectively. Much GNU code assumes two's complement, but some
127 people like to be portable to all possible C hosts. */
128# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
129# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
130# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
131
132/* True if the arithmetic type T is signed. */
133# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
134
135/* The maximum and minimum values for the integer type T. These
136 macros have undefined behavior if T is signed and has padding bits.
137 If this is a problem for you, please let us know how to fix it for
138 your host. */
139# define TYPE_MINIMUM(t) \
140 ((t) (! TYPE_SIGNED (t) \
141 ? (t) 0 \
142 : TYPE_SIGNED_MAGNITUDE (t) \
143 ? ~ (t) 0 \
144 : ~ TYPE_MAXIMUM (t)))
145# define TYPE_MAXIMUM(t) \
146 ((t) (! TYPE_SIGNED (t) \
147 ? (t) -1 \
148 : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
149
150# ifndef ULLONG_MAX
151# define ULLONG_MAX TYPE_MAXIMUM (unsigned long long)
152# endif
153# ifndef LLONG_MAX
154# define LLONG_MAX TYPE_MAXIMUM (long long int)
155# endif
156# ifndef LLONG_MIN
157# define LLONG_MIN TYPE_MINIMUM (long long int)
158# endif
159
160# if __GNUC__ == 2 && __GNUC_MINOR__ < 7
161 /* Work around gcc bug with using this constant. */
162 static const unsigned long long int maxquad = ULLONG_MAX;
163# undef STRTOL_ULONG_MAX
164# define STRTOL_ULONG_MAX maxquad
165# endif
166#else
167# define LONG long
168# define STRTOL_LONG_MIN LONG_MIN
169# define STRTOL_LONG_MAX LONG_MAX
170# define STRTOL_ULONG_MAX ULONG_MAX
171#endif
172
173
174/* We use this code also for the extended locale handling where the
175 function gets as an additional argument the locale which has to be
176 used. To access the values we have to redefine the _NL_CURRENT
177 macro. */
178#ifdef USE_IN_EXTENDED_LOCALE_MODEL
179# undef _NL_CURRENT
180# define _NL_CURRENT(category, item) \
181 (current->values[_NL_ITEM_INDEX (item)].string)
182# define LOCALE_PARAM , loc
183# define LOCALE_PARAM_PROTO , __locale_t loc
184#else
185# define LOCALE_PARAM
186# define LOCALE_PARAM_PROTO
187#endif
188
189#include <wchar.h>
190
191#ifdef USE_WIDE_CHAR
192# include <wctype.h>
193# define L_(Ch) L##Ch
194# define UCHAR_TYPE wint_t
195# define STRING_TYPE wchar_t
196# ifdef USE_IN_EXTENDED_LOCALE_MODEL
197# define ISSPACE(Ch) __iswspace_l ((Ch), loc)
198# define ISALPHA(Ch) __iswalpha_l ((Ch), loc)
199# define TOUPPER(Ch) __towupper_l ((Ch), loc)
200# else
201# define ISSPACE(Ch) iswspace (Ch)
202# define ISALPHA(Ch) iswalpha (Ch)
203# define TOUPPER(Ch) towupper (Ch)
204# endif
205#else
206# define L_(Ch) Ch
207# define UCHAR_TYPE unsigned char
208# define STRING_TYPE char
209# ifdef USE_IN_EXTENDED_LOCALE_MODEL
210# define ISSPACE(Ch) __isspace_l ((Ch), loc)
211# define ISALPHA(Ch) __isalpha_l ((Ch), loc)
212# define TOUPPER(Ch) __toupper_l ((Ch), loc)
213# else
214# define ISSPACE(Ch) isspace (Ch)
215# define ISALPHA(Ch) isalpha (Ch)
216# define TOUPPER(Ch) toupper (Ch)
217# endif
218#endif
219
220#define INTERNAL(X) INTERNAL1(X)
221#define INTERNAL1(X) __##X##_internal
222#define WEAKNAME(X) WEAKNAME1(X)
223
224#ifdef USE_NUMBER_GROUPING
225/* This file defines a function to check for correct grouping. */
226# include "grouping.h"
227#endif
228
229
230
231/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
232 If BASE is 0 the base is determined by the presence of a leading
233 zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
234 If BASE is < 2 or > 36, it is reset to 10.
235 If ENDPTR is not NULL, a pointer to the character after the last
236 one converted is stored in *ENDPTR. */
237
238INT
239INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
240 int base, int group LOCALE_PARAM_PROTO)
241{
242 int negative;
243 register unsigned LONG int cutoff;
244 register unsigned int cutlim;
245 register unsigned LONG int i;
246 register const STRING_TYPE *s;
247 register UCHAR_TYPE c;
248 const STRING_TYPE *save, *end;
249 int overflow;
250
251#ifdef USE_NUMBER_GROUPING
252# ifdef USE_IN_EXTENDED_LOCALE_MODEL
253 struct locale_data *current = loc->__locales[LC_NUMERIC];
254# endif
255 /* The thousands character of the current locale. */
256 wchar_t thousands = L'\0';
257 /* The numeric grouping specification of the current locale,
258 in the format described in <locale.h>. */
259 const char *grouping;
260
261 if (group)
262 {
263 grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
264 if (*grouping <= 0 || *grouping == CHAR_MAX)
265 grouping = NULL;
266 else
267 {
268 /* Figure out the thousands separator character. */
269# if defined _LIBC || defined _HAVE_BTOWC
270 thousands = __btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP));
271 if (thousands == WEOF)
272 thousands = L'\0';
273# endif
274 if (thousands == L'\0')
275 grouping = NULL;
276 }
277 }
278 else
279 grouping = NULL;
280#endif
281
282 if (base < 0 || base == 1 || base > 36)
283 {
284 __set_errno (EINVAL);
285 return 0;
286 }
287
288 save = s = nptr;
289
290 /* Skip white space. */
291 while (ISSPACE (*s))
292 ++s;
293 if (*s == L_('\0'))
294 goto noconv;
295
296 /* Check for a sign. */
297 if (*s == L_('-'))
298 {
299 negative = 1;
300 ++s;
301 }
302 else if (*s == L_('+'))
303 {
304 negative = 0;
305 ++s;
306 }
307 else
308 negative = 0;
309
310 /* Recognize number prefix and if BASE is zero, figure it out ourselves. */
311 if (*s == L_('0'))
312 {
313 if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X'))
314 {
315 s += 2;
316 base = 16;
317 }
318 else if (base == 0)
319 base = 8;
320 }
321 else if (base == 0)
322 base = 10;
323
324 /* Save the pointer so we can check later if anything happened. */
325 save = s;
326
327#ifdef USE_NUMBER_GROUPING
328 if (group)
329 {
330 /* Find the end of the digit string and check its grouping. */
331 end = s;
332 for (c = *end; c != L_('\0'); c = *++end)
333 if ((wchar_t) c != thousands
334 && ((wchar_t) c < L_('0') || (wchar_t) c > L_('9'))
335 && (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base))
336 break;
337 if (*s == thousands)
338 end = s;
339 else
340 end = correctly_grouped_prefix (s, end, thousands, grouping);
341 }
342 else
343#endif
344 end = NULL;
345
346 cutoff = STRTOL_ULONG_MAX / (unsigned LONG int) base;
347 cutlim = STRTOL_ULONG_MAX % (unsigned LONG int) base;
348
349 overflow = 0;
350 i = 0;
351 for (c = *s; c != L_('\0'); c = *++s)
352 {
353 if (s == end)
354 break;
355 if (c >= L_('0') && c <= L_('9'))
356 c -= L_('0');
357 else if (ISALPHA (c))
358 c = TOUPPER (c) - L_('A') + 10;
359 else
360 break;
361 if ((int) c >= base)
362 break;
363 /* Check for overflow. */
364 if (i > cutoff || (i == cutoff && c > cutlim))
365 overflow = 1;
366 else
367 {
368 i *= (unsigned LONG int) base;
369 i += c;
370 }
371 }
372
373 /* Check if anything actually happened. */
374 if (s == save)
375 goto noconv;
376
377 /* Store in ENDPTR the address of one character
378 past the last character we converted. */
379 if (endptr != NULL)
380 *endptr = (STRING_TYPE *) s;
381
382#if !UNSIGNED
383 /* Check for a value that is within the range of
384 `unsigned LONG int', but outside the range of `LONG int'. */
385 if (overflow == 0
386 && i > (negative
387 ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1
388 : (unsigned LONG int) STRTOL_LONG_MAX))
389 overflow = 1;
390#endif
391
392 if (overflow)
393 {
394 __set_errno (ERANGE);
395#if UNSIGNED
396 return STRTOL_ULONG_MAX;
397#else
398 return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX;
399#endif
400 }
401
402 /* Return the result of the appropriate sign. */
403 return negative ? -i : i;
404
405noconv:
406 /* We must handle a special case here: the base is 0 or 16 and the
407 first two characters are '0' and 'x', but the rest are no
408 hexadecimal digits. This is no error case. We return 0 and
409 ENDPTR points to the `x`. */
410 if (endptr != NULL)
411 {
412 if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')
413 && save[-2] == L_('0'))
414 *endptr = (STRING_TYPE *) &save[-1];
415 else
416 /* There was no number to convert. */
417 *endptr = (STRING_TYPE *) nptr;
418 }
419
420 return 0L;
421}
422
423/* External user entry point. */
424
425
426INT
427#ifdef weak_function
428weak_function
429#endif
430strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr,
431 int base LOCALE_PARAM_PROTO)
432{
433 return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM);
434}
diff --git a/lib/strtoll.c b/lib/strtoll.c
new file mode 100644
index 00000000000..75afa4d9bc9
--- /dev/null
+++ b/lib/strtoll.c
@@ -0,0 +1,33 @@
1/* Function to parse a `long long int' from text.
2 Copyright (C) 1995-1997, 1999, 2001, 2009-2011 Free Software Foundation,
3 Inc.
4 This file is part of the GNU C Library.
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19#define QUAD 1
20
21#include <strtol.c>
22
23#ifdef _LIBC
24# ifdef SHARED
25# include <shlib-compat.h>
26
27# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
28compat_symbol (libc, __strtoll_internal, __strtoq_internal, GLIBC_2_0);
29# endif
30
31# endif
32weak_alias (strtoll, strtoq)
33#endif
diff --git a/lib/strtoul.c b/lib/strtoul.c
new file mode 100644
index 00000000000..6fa6d0c2e01
--- /dev/null
+++ b/lib/strtoul.c
@@ -0,0 +1,19 @@
1/* Copyright (C) 1991, 1997, 2009-2011 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
16
17#define UNSIGNED 1
18
19#include "strtol.c"
diff --git a/lib/strtoull.c b/lib/strtoull.c
new file mode 100644
index 00000000000..bf259958d6e
--- /dev/null
+++ b/lib/strtoull.c
@@ -0,0 +1,26 @@
1/* Function to parse an `unsigned long long int' from text.
2 Copyright (C) 1995-1997, 1999, 2009-2011 Free Software Foundation, Inc.
3 NOTE: The canonical source of this file is maintained with the GNU C
4 Library. Bugs can be reported to bug-glibc@gnu.org.
5
6 This program is free software: you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 3 of the License, or any
9 later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19#define QUAD 1
20
21#include "strtoul.c"
22
23#ifdef _LIBC
24strong_alias (__strtoull_internal, __strtouq_internal)
25weak_alias (strtoull, strtouq)
26#endif
diff --git a/lib/strtoumax.c b/lib/strtoumax.c
new file mode 100644
index 00000000000..dc395d626ab
--- /dev/null
+++ b/lib/strtoumax.c
@@ -0,0 +1,2 @@
1#define UNSIGNED 1
2#include "strtoimax.c"
diff --git a/lib/verify.h b/lib/verify.h
new file mode 100644
index 00000000000..6bca43f6a9b
--- /dev/null
+++ b/lib/verify.h
@@ -0,0 +1,202 @@
1/* Compile-time assert-like macros.
2
3 Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc.
4
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 of the License, or
8 (at your option) any later version.
9
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.
14
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/>. */
17
18/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */
19
20#ifndef VERIFY_H
21# define VERIFY_H 1
22
23/* Define HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the
24 C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and
25 later, in C mode, and its use here generates easier-to-read diagnostics
26 when verify (R) fails.
27
28 Define HAVE_STATIC_ASSERT to 1 if static_assert works as per the
29 C1X draft N1548 section 7.2 or the C++0X draft N3242 section 7.(4).
30 This will likely be supported by future GCC versions, in C++ mode.
31
32 For now, use this only with GCC. Eventually whether _Static_assert
33 and static_assert works should be determined by 'configure'. */
34# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus
35# define HAVE__STATIC_ASSERT 1
36# endif
37/* The condition (99 < __GNUC__) is temporary, until we know about the
38 first G++ release that supports static_assert. */
39# if (99 < __GNUC__) && defined __cplusplus
40# define HAVE_STATIC_ASSERT 1
41# endif
42
43/* Each of these macros verifies that its argument R is nonzero. To
44 be portable, R should be an integer constant expression. Unlike
45 assert (R), there is no run-time overhead.
46
47 There are two macros, since no single macro can be used in all
48 contexts in C. verify_true (R) is for scalar contexts, including
49 integer constant expression contexts. verify (R) is for declaration
50 contexts, e.g., the top level.
51
52 Symbols ending in "__" are private to this header.
53
54 If _Static_assert works, verify (R) uses it directly. Similarly,
55 verify_true (R) works by packaging a _Static_assert inside a struct
56 that is an operand of sizeof.
57
58 The code below uses several ideas for C++ compilers, and for C
59 compilers that do not support _Static_assert:
60
61 * The first step is ((R) ? 1 : -1). Given an expression R, of
62 integral or boolean or floating-point type, this yields an
63 expression of integral type, whose value is later verified to be
64 constant and nonnegative.
65
66 * Next this expression W is wrapped in a type
67 struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }.
68 If W is negative, this yields a compile-time error. No compiler can
69 deal with a bit-field of negative size.
70
71 One might think that an array size check would have the same
72 effect, that is, that the type struct { unsigned int dummy[W]; }
73 would work as well. However, inside a function, some compilers
74 (such as C++ compilers and GNU C) allow local parameters and
75 variables inside array size expressions. With these compilers,
76 an array size check would not properly diagnose this misuse of
77 the verify macro:
78
79 void function (int n) { verify (n < 0); }
80
81 * For the verify macro, the struct verify_type__ will need to
82 somehow be embedded into a declaration. To be portable, this
83 declaration must declare an object, a constant, a function, or a
84 typedef name. If the declared entity uses the type directly,
85 such as in
86
87 struct dummy {...};
88 typedef struct {...} dummy;
89 extern struct {...} *dummy;
90 extern void dummy (struct {...} *);
91 extern struct {...} *dummy (void);
92
93 two uses of the verify macro would yield colliding declarations
94 if the entity names are not disambiguated. A workaround is to
95 attach the current line number to the entity name:
96
97 #define _GL_CONCAT0(x, y) x##y
98 #define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
99 extern struct {...} * _GL_CONCAT (dummy, __LINE__);
100
101 But this has the problem that two invocations of verify from
102 within the same macro would collide, since the __LINE__ value
103 would be the same for both invocations. (The GCC __COUNTER__
104 macro solves this problem, but is not portable.)
105
106 A solution is to use the sizeof operator. It yields a number,
107 getting rid of the identity of the type. Declarations like
108
109 extern int dummy [sizeof (struct {...})];
110 extern void dummy (int [sizeof (struct {...})]);
111 extern int (*dummy (void)) [sizeof (struct {...})];
112
113 can be repeated.
114
115 * Should the implementation use a named struct or an unnamed struct?
116 Which of the following alternatives can be used?
117
118 extern int dummy [sizeof (struct {...})];
119 extern int dummy [sizeof (struct verify_type__ {...})];
120 extern void dummy (int [sizeof (struct {...})]);
121 extern void dummy (int [sizeof (struct verify_type__ {...})]);
122 extern int (*dummy (void)) [sizeof (struct {...})];
123 extern int (*dummy (void)) [sizeof (struct verify_type__ {...})];
124
125 In the second and sixth case, the struct type is exported to the
126 outer scope; two such declarations therefore collide. GCC warns
127 about the first, third, and fourth cases. So the only remaining
128 possibility is the fifth case:
129
130 extern int (*dummy (void)) [sizeof (struct {...})];
131
132 * GCC warns about duplicate declarations of the dummy function if
133 -Wredundant_decls is used. GCC 4.3 and later have a builtin
134 __COUNTER__ macro that can let us generate unique identifiers for
135 each dummy function, to suppress this warning.
136
137 * This implementation exploits the fact that older versions of GCC,
138 which do not support _Static_assert, also do not warn about the
139 last declaration mentioned above.
140
141 * In C++, any struct definition inside sizeof is invalid.
142 Use a template type to work around the problem. */
143
144/* Concatenate two preprocessor tokens. */
145# define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
146# define _GL_CONCAT0(x, y) x##y
147
148/* _GL_COUNTER is an integer, preferably one that changes each time we
149 use it. Use __COUNTER__ if it works, falling back on __LINE__
150 otherwise. __LINE__ isn't perfect, but it's better than a
151 constant. */
152# if defined __COUNTER__ && __COUNTER__ != __COUNTER__
153# define _GL_COUNTER __COUNTER__
154# else
155# define _GL_COUNTER __LINE__
156# endif
157
158/* Generate a symbol with the given prefix, making it unique if
159 possible. */
160# define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
161
162/* Verify requirement R at compile-time, as an integer constant expression.
163 Return 1. */
164
165# ifdef __cplusplus
166template <int w>
167 struct verify_type__ { unsigned int verify_error_if_negative_size__: w; };
168# define verify_true(R) \
169 (!!sizeof (verify_type__<(R) ? 1 : -1>))
170# elif HAVE__STATIC_ASSERT
171# define verify_true(R) \
172 (!!sizeof \
173 (struct { \
174 _Static_assert (R, "verify_true (" #R ")"); \
175 int verify_dummy__; \
176 }))
177# elif HAVE_STATIC_ASSERT
178# define verify_true(R) \
179 (!!sizeof \
180 (struct { \
181 static_assert (R, "verify_true (" #R ")"); \
182 int verify_dummy__; \
183 }))
184# else
185# define verify_true(R) \
186 (!!sizeof \
187 (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; }))
188# endif
189
190/* Verify requirement R at compile-time, as a declaration without a
191 trailing ';'. */
192
193# if HAVE__STATIC_ASSERT
194# define verify(R) _Static_assert (R, "verify (" #R ")")
195# elif HAVE_STATIC_ASSERT
196# define verify(R) static_assert (R, "verify (" #R ")")
197# else
198# define verify(R) \
199 extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)]
200# endif
201
202#endif
diff --git a/lib/wchar.h b/lib/wchar.h
new file mode 100644
index 00000000000..b0949e1ea4e
--- /dev/null
+++ b/lib/wchar.h
@@ -0,0 +1,1306 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
3
4 Copyright (C) 2007-2011 Free Software Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19
20/* Written by Eric Blake. */
21
22/*
23 * ISO C 99 <wchar.h> for platforms that have issues.
24 * <http://www.opengroup.org/susv3xbd/wchar.h.html>
25 *
26 * For now, this just ensures proper prerequisite inclusion order and
27 * the declaration of wcwidth().
28 */
29
30#if __GNUC__ >= 3
31#pragma GCC system_header
32#endif
33
34
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. */
47
48#include_next <wchar.h>
49
50#else
51/* Normal invocation convention. */
52
53#ifndef _GL_WCHAR_H
54
55#define _GL_ALREADY_INCLUDING_WCHAR_H
56
57#if 1
58# include <features.h> /* for __GLIBC__ */
59#endif
60
61/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
62 <wchar.h>.
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
66 by <stddef.h>.
67 But avoid namespace pollution on glibc systems. */
68#if !(defined __GLIBC__ && !defined __UCLIBC__)
69# include <stddef.h>
70#endif
71#ifndef __GLIBC__
72# include <stdio.h>
73# include <time.h>
74#endif
75
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. */
79#if 1
80# include_next <wchar.h>
81#endif
82
83#undef _GL_ALREADY_INCLUDING_WCHAR_H
84
85#ifndef _GL_WCHAR_H
86#define _GL_WCHAR_H
87
88/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
89#ifndef _GL_CXXDEFS_H
90#define _GL_CXXDEFS_H
91
92/* The three most frequent use cases of these macros are:
93
94 * For providing a substitute for a function that is missing on some
95 platforms, but is declared and works fine on the platforms on which
96 it exists:
97
98 #if @GNULIB_FOO@
99 # if !@HAVE_FOO@
100 _GL_FUNCDECL_SYS (foo, ...);
101 # endif
102 _GL_CXXALIAS_SYS (foo, ...);
103 _GL_CXXALIASWARN (foo);
104 #elif defined GNULIB_POSIXCHECK
105 ...
106 #endif
107
108 * For providing a replacement for a function that exists on all platforms,
109 but is broken/insufficient and needs to be replaced on some platforms:
110
111 #if @GNULIB_FOO@
112 # if @REPLACE_FOO@
113 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
114 # undef foo
115 # define foo rpl_foo
116 # endif
117 _GL_FUNCDECL_RPL (foo, ...);
118 _GL_CXXALIAS_RPL (foo, ...);
119 # else
120 _GL_CXXALIAS_SYS (foo, ...);
121 # endif
122 _GL_CXXALIASWARN (foo);
123 #elif defined GNULIB_POSIXCHECK
124 ...
125 #endif
126
127 * For providing a replacement for a function that exists on some platforms
128 but is broken/insufficient and needs to be replaced on some of them and
129 is additionally either missing or undeclared on some other platforms:
130
131 #if @GNULIB_FOO@
132 # if @REPLACE_FOO@
133 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
134 # undef foo
135 # define foo rpl_foo
136 # endif
137 _GL_FUNCDECL_RPL (foo, ...);
138 _GL_CXXALIAS_RPL (foo, ...);
139 # else
140 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
141 _GL_FUNCDECL_SYS (foo, ...);
142 # endif
143 _GL_CXXALIAS_SYS (foo, ...);
144 # endif
145 _GL_CXXALIASWARN (foo);
146 #elif defined GNULIB_POSIXCHECK
147 ...
148 #endif
149*/
150
151/* _GL_EXTERN_C declaration;
152 performs the declaration with C linkage. */
153#if defined __cplusplus
154# define _GL_EXTERN_C extern "C"
155#else
156# define _GL_EXTERN_C extern
157#endif
158
159/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
160 declares a replacement function, named rpl_func, with the given prototype,
161 consisting of return type, parameters, and attributes.
162 Example:
163 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
164 _GL_ARG_NONNULL ((1)));
165 */
166#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
167 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
168#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
169 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
170
171/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
172 declares the system function, named func, with the given prototype,
173 consisting of return type, parameters, and attributes.
174 Example:
175 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
176 _GL_ARG_NONNULL ((1)));
177 */
178#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
179 _GL_EXTERN_C rettype func parameters_and_attributes
180
181/* _GL_CXXALIAS_RPL (func, rettype, parameters);
182 declares a C++ alias called GNULIB_NAMESPACE::func
183 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
184 Example:
185 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
186 */
187#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
188 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
189#if defined __cplusplus && defined GNULIB_NAMESPACE
190# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
191 namespace GNULIB_NAMESPACE \
192 { \
193 rettype (*const func) parameters = ::rpl_func; \
194 } \
195 _GL_EXTERN_C int _gl_cxxalias_dummy
196#else
197# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
198 _GL_EXTERN_C int _gl_cxxalias_dummy
199#endif
200
201/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
202 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
203 except that the C function rpl_func may have a slightly different
204 declaration. A cast is used to silence the "invalid conversion" error
205 that would otherwise occur. */
206#if defined __cplusplus && defined GNULIB_NAMESPACE
207# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
208 namespace GNULIB_NAMESPACE \
209 { \
210 rettype (*const func) parameters = \
211 reinterpret_cast<rettype(*)parameters>(::rpl_func); \
212 } \
213 _GL_EXTERN_C int _gl_cxxalias_dummy
214#else
215# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
216 _GL_EXTERN_C int _gl_cxxalias_dummy
217#endif
218
219/* _GL_CXXALIAS_SYS (func, rettype, parameters);
220 declares a C++ alias called GNULIB_NAMESPACE::func
221 that redirects to the system provided function func, if GNULIB_NAMESPACE
222 is defined.
223 Example:
224 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
225 */
226#if defined __cplusplus && defined GNULIB_NAMESPACE
227 /* If we were to write
228 rettype (*const func) parameters = ::func;
229 like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
230 better (remove an indirection through a 'static' pointer variable),
231 but then the _GL_CXXALIASWARN macro below would cause a warning not only
232 for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
233# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
234 namespace GNULIB_NAMESPACE \
235 { \
236 static rettype (*func) parameters = ::func; \
237 } \
238 _GL_EXTERN_C int _gl_cxxalias_dummy
239#else
240# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
241 _GL_EXTERN_C int _gl_cxxalias_dummy
242#endif
243
244/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
245 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
246 except that the C function func may have a slightly different declaration.
247 A cast is used to silence the "invalid conversion" error that would
248 otherwise occur. */
249#if defined __cplusplus && defined GNULIB_NAMESPACE
250# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
251 namespace GNULIB_NAMESPACE \
252 { \
253 static rettype (*func) parameters = \
254 reinterpret_cast<rettype(*)parameters>(::func); \
255 } \
256 _GL_EXTERN_C int _gl_cxxalias_dummy
257#else
258# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
259 _GL_EXTERN_C int _gl_cxxalias_dummy
260#endif
261
262/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
263 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
264 except that the C function is picked among a set of overloaded functions,
265 namely the one with rettype2 and parameters2. Two consecutive casts
266 are used to silence the "cannot find a match" and "invalid conversion"
267 errors that would otherwise occur. */
268#if defined __cplusplus && defined GNULIB_NAMESPACE
269 /* The outer cast must be a reinterpret_cast.
270 The inner cast: When the function is defined as a set of overloaded
271 functions, it works as a static_cast<>, choosing the designated variant.
272 When the function is defined as a single variant, it works as a
273 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
274# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
275 namespace GNULIB_NAMESPACE \
276 { \
277 static rettype (*func) parameters = \
278 reinterpret_cast<rettype(*)parameters>( \
279 (rettype2(*)parameters2)(::func)); \
280 } \
281 _GL_EXTERN_C int _gl_cxxalias_dummy
282#else
283# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
284 _GL_EXTERN_C int _gl_cxxalias_dummy
285#endif
286
287/* _GL_CXXALIASWARN (func);
288 causes a warning to be emitted when ::func is used but not when
289 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
290 variants. */
291#if defined __cplusplus && defined GNULIB_NAMESPACE
292# define _GL_CXXALIASWARN(func) \
293 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
294# define _GL_CXXALIASWARN_1(func,namespace) \
295 _GL_CXXALIASWARN_2 (func, namespace)
296/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
297 we enable the warning only when not optimizing. */
298# if !__OPTIMIZE__
299# define _GL_CXXALIASWARN_2(func,namespace) \
300 _GL_WARN_ON_USE (func, \
301 "The symbol ::" #func " refers to the system function. " \
302 "Use " #namespace "::" #func " instead.")
303# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
304# define _GL_CXXALIASWARN_2(func,namespace) \
305 extern __typeof__ (func) func
306# else
307# define _GL_CXXALIASWARN_2(func,namespace) \
308 _GL_EXTERN_C int _gl_cxxalias_dummy
309# endif
310#else
311# define _GL_CXXALIASWARN(func) \
312 _GL_EXTERN_C int _gl_cxxalias_dummy
313#endif
314
315/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
316 causes a warning to be emitted when the given overloaded variant of ::func
317 is used but not when GNULIB_NAMESPACE::func is used. */
318#if defined __cplusplus && defined GNULIB_NAMESPACE
319# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
320 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
321 GNULIB_NAMESPACE)
322# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
323 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
324/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
325 we enable the warning only when not optimizing. */
326# if !__OPTIMIZE__
327# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
328 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
329 "The symbol ::" #func " refers to the system function. " \
330 "Use " #namespace "::" #func " instead.")
331# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
332# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
333 extern __typeof__ (func) func
334# else
335# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
336 _GL_EXTERN_C int _gl_cxxalias_dummy
337# endif
338#else
339# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
340 _GL_EXTERN_C int _gl_cxxalias_dummy
341#endif
342
343#endif /* _GL_CXXDEFS_H */
344
345/* The definition of _GL_ARG_NONNULL is copied here. */
346/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
347 that the values passed as arguments n, ..., m must be non-NULL pointers.
348 n = 1 stands for the first argument, n = 2 for the second argument etc. */
349#ifndef _GL_ARG_NONNULL
350# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
351# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
352# else
353# define _GL_ARG_NONNULL(params)
354# endif
355#endif
356
357/* The definition of _GL_WARN_ON_USE is copied here. */
358#ifndef _GL_WARN_ON_USE
359
360# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
361/* A compiler attribute is available in gcc versions 4.3.0 and later. */
362# define _GL_WARN_ON_USE(function, message) \
363extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
364# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
365/* Verify the existence of the function. */
366# define _GL_WARN_ON_USE(function, message) \
367extern __typeof__ (function) function
368# else /* Unsupported. */
369# define _GL_WARN_ON_USE(function, message) \
370_GL_WARN_EXTERN_C int _gl_warn_on_use
371# endif
372#endif
373
374/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
375 is like _GL_WARN_ON_USE (function, "string"), except that the function is
376 declared with the given prototype, consisting of return type, parameters,
377 and attributes.
378 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
379 not work in this case. */
380#ifndef _GL_WARN_ON_USE_CXX
381# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
382# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
383extern rettype function parameters_and_attributes \
384 __attribute__ ((__warning__ (msg)))
385# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
386/* Verify the existence of the function. */
387# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
388extern rettype function parameters_and_attributes
389# else /* Unsupported. */
390# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
391_GL_WARN_EXTERN_C int _gl_warn_on_use
392# endif
393#endif
394
395/* _GL_WARN_EXTERN_C declaration;
396 performs the declaration with C linkage. */
397#ifndef _GL_WARN_EXTERN_C
398# if defined __cplusplus
399# define _GL_WARN_EXTERN_C extern "C"
400# else
401# define _GL_WARN_EXTERN_C extern
402# endif
403#endif
404
405
406/* Define wint_t and WEOF. (Also done in wctype.in.h.) */
407#if !1 && !defined wint_t
408# define wint_t int
409# ifndef WEOF
410# define WEOF -1
411# endif
412#else
413# ifndef WEOF
414# define WEOF ((wint_t) -1)
415# endif
416#endif
417
418
419/* Override mbstate_t if it is too small.
420 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
421 implementing mbrtowc for encodings like UTF-8. */
422#if !(1 && 1) || 0
423# if !GNULIB_defined_mbstate_t
424typedef int rpl_mbstate_t;
425# undef mbstate_t
426# define mbstate_t rpl_mbstate_t
427# define GNULIB_defined_mbstate_t 1
428# endif
429#endif
430
431
432/* Convert a single-byte character to a wide character. */
433#if 0
434# if 0
435# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
436# undef btowc
437# define btowc rpl_btowc
438# endif
439_GL_FUNCDECL_RPL (btowc, wint_t, (int c));
440_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
441# else
442# if !1
443_GL_FUNCDECL_SYS (btowc, wint_t, (int c));
444# endif
445_GL_CXXALIAS_SYS (btowc, wint_t, (int c));
446# endif
447_GL_CXXALIASWARN (btowc);
448#elif defined GNULIB_POSIXCHECK
449# undef btowc
450# if HAVE_RAW_DECL_BTOWC
451_GL_WARN_ON_USE (btowc, "btowc is unportable - "
452 "use gnulib module btowc for portability");
453# endif
454#endif
455
456
457/* Convert a wide character to a single-byte character. */
458#if 0
459# if 0
460# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
461# undef wctob
462# define wctob rpl_wctob
463# endif
464_GL_FUNCDECL_RPL (wctob, int, (wint_t wc));
465_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
466# else
467# if !defined wctob && !1
468/* wctob is provided by gnulib, or wctob exists but is not declared. */
469_GL_FUNCDECL_SYS (wctob, int, (wint_t wc));
470# endif
471_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
472# endif
473_GL_CXXALIASWARN (wctob);
474#elif defined GNULIB_POSIXCHECK
475# undef wctob
476# if HAVE_RAW_DECL_WCTOB
477_GL_WARN_ON_USE (wctob, "wctob is unportable - "
478 "use gnulib module wctob for portability");
479# endif
480#endif
481
482
483/* Test whether *PS is in the initial state. */
484#if 0
485# if 0
486# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
487# undef mbsinit
488# define mbsinit rpl_mbsinit
489# endif
490_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
491_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
492# else
493# if !1
494_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
495# endif
496_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
497# endif
498_GL_CXXALIASWARN (mbsinit);
499#elif defined GNULIB_POSIXCHECK
500# undef mbsinit
501# if HAVE_RAW_DECL_MBSINIT
502_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
503 "use gnulib module mbsinit for portability");
504# endif
505#endif
506
507
508/* Convert a multibyte character to a wide character. */
509#if 0
510# if 0
511# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
512# undef mbrtowc
513# define mbrtowc rpl_mbrtowc
514# endif
515_GL_FUNCDECL_RPL (mbrtowc, size_t,
516 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
517_GL_CXXALIAS_RPL (mbrtowc, size_t,
518 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
519# else
520# if !1
521_GL_FUNCDECL_SYS (mbrtowc, size_t,
522 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
523# endif
524_GL_CXXALIAS_SYS (mbrtowc, size_t,
525 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
526# endif
527_GL_CXXALIASWARN (mbrtowc);
528#elif defined GNULIB_POSIXCHECK
529# undef mbrtowc
530# if HAVE_RAW_DECL_MBRTOWC
531_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
532 "use gnulib module mbrtowc for portability");
533# endif
534#endif
535
536
537/* Recognize a multibyte character. */
538#if 0
539# if 0
540# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
541# undef mbrlen
542# define mbrlen rpl_mbrlen
543# endif
544_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
545_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
546# else
547# if !1
548_GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
549# endif
550_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
551# endif
552_GL_CXXALIASWARN (mbrlen);
553#elif defined GNULIB_POSIXCHECK
554# undef mbrlen
555# if HAVE_RAW_DECL_MBRLEN
556_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
557 "use gnulib module mbrlen for portability");
558# endif
559#endif
560
561
562/* Convert a string to a wide string. */
563#if 0
564# if 0
565# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
566# undef mbsrtowcs
567# define mbsrtowcs rpl_mbsrtowcs
568# endif
569_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
570 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
571 _GL_ARG_NONNULL ((2)));
572_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
573 (wchar_t *dest, const char **srcp, size_t len,
574 mbstate_t *ps));
575# else
576# if !1
577_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
578 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
579 _GL_ARG_NONNULL ((2)));
580# endif
581_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
582 (wchar_t *dest, const char **srcp, size_t len,
583 mbstate_t *ps));
584# endif
585_GL_CXXALIASWARN (mbsrtowcs);
586#elif defined GNULIB_POSIXCHECK
587# undef mbsrtowcs
588# if HAVE_RAW_DECL_MBSRTOWCS
589_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
590 "use gnulib module mbsrtowcs for portability");
591# endif
592#endif
593
594
595/* Convert a string to a wide string. */
596#if 0
597# if 0
598# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
599# undef mbsnrtowcs
600# define mbsnrtowcs rpl_mbsnrtowcs
601# endif
602_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
603 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
604 mbstate_t *ps)
605 _GL_ARG_NONNULL ((2)));
606_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
607 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
608 mbstate_t *ps));
609# else
610# if !1
611_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
612 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
613 mbstate_t *ps)
614 _GL_ARG_NONNULL ((2)));
615# endif
616_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
617 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
618 mbstate_t *ps));
619# endif
620_GL_CXXALIASWARN (mbsnrtowcs);
621#elif defined GNULIB_POSIXCHECK
622# undef mbsnrtowcs
623# if HAVE_RAW_DECL_MBSNRTOWCS
624_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
625 "use gnulib module mbsnrtowcs for portability");
626# endif
627#endif
628
629
630/* Convert a wide character to a multibyte character. */
631#if 0
632# if 0
633# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
634# undef wcrtomb
635# define wcrtomb rpl_wcrtomb
636# endif
637_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
638_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
639# else
640# if !1
641_GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
642# endif
643_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
644# endif
645_GL_CXXALIASWARN (wcrtomb);
646#elif defined GNULIB_POSIXCHECK
647# undef wcrtomb
648# if HAVE_RAW_DECL_WCRTOMB
649_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
650 "use gnulib module wcrtomb for portability");
651# endif
652#endif
653
654
655/* Convert a wide string to a string. */
656#if 0
657# if 0
658# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
659# undef wcsrtombs
660# define wcsrtombs rpl_wcsrtombs
661# endif
662_GL_FUNCDECL_RPL (wcsrtombs, size_t,
663 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
664 _GL_ARG_NONNULL ((2)));
665_GL_CXXALIAS_RPL (wcsrtombs, size_t,
666 (char *dest, const wchar_t **srcp, size_t len,
667 mbstate_t *ps));
668# else
669# if !1
670_GL_FUNCDECL_SYS (wcsrtombs, size_t,
671 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
672 _GL_ARG_NONNULL ((2)));
673# endif
674_GL_CXXALIAS_SYS (wcsrtombs, size_t,
675 (char *dest, const wchar_t **srcp, size_t len,
676 mbstate_t *ps));
677# endif
678_GL_CXXALIASWARN (wcsrtombs);
679#elif defined GNULIB_POSIXCHECK
680# undef wcsrtombs
681# if HAVE_RAW_DECL_WCSRTOMBS
682_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
683 "use gnulib module wcsrtombs for portability");
684# endif
685#endif
686
687
688/* Convert a wide string to a string. */
689#if 0
690# if 0
691# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
692# undef wcsnrtombs
693# define wcsnrtombs rpl_wcsnrtombs
694# endif
695_GL_FUNCDECL_RPL (wcsnrtombs, size_t,
696 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
697 mbstate_t *ps)
698 _GL_ARG_NONNULL ((2)));
699_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
700 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
701 mbstate_t *ps));
702# else
703# if !1
704_GL_FUNCDECL_SYS (wcsnrtombs, size_t,
705 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
706 mbstate_t *ps)
707 _GL_ARG_NONNULL ((2)));
708# endif
709_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
710 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
711 mbstate_t *ps));
712# endif
713_GL_CXXALIASWARN (wcsnrtombs);
714#elif defined GNULIB_POSIXCHECK
715# undef wcsnrtombs
716# if HAVE_RAW_DECL_WCSNRTOMBS
717_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
718 "use gnulib module wcsnrtombs for portability");
719# endif
720#endif
721
722
723/* Return the number of screen columns needed for WC. */
724#if 0
725# if 0
726# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
727# undef wcwidth
728# define wcwidth rpl_wcwidth
729# endif
730_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t));
731_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
732# else
733# if !1
734/* wcwidth exists but is not declared. */
735_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t));
736# endif
737_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
738# endif
739_GL_CXXALIASWARN (wcwidth);
740#elif defined GNULIB_POSIXCHECK
741# undef wcwidth
742# if HAVE_RAW_DECL_WCWIDTH
743_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
744 "use gnulib module wcwidth for portability");
745# endif
746#endif
747
748
749/* Search N wide characters of S for C. */
750#if 0
751# if !1
752_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
753# endif
754 /* On some systems, this function is defined as an overloaded function:
755 extern "C++" {
756 const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
757 wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
758 } */
759_GL_CXXALIAS_SYS_CAST2 (wmemchr,
760 wchar_t *, (const wchar_t *, wchar_t, size_t),
761 const wchar_t *, (const wchar_t *, wchar_t, size_t));
762# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
763 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
764_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
765_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
766 (const wchar_t *s, wchar_t c, size_t n));
767# else
768_GL_CXXALIASWARN (wmemchr);
769# endif
770#elif defined GNULIB_POSIXCHECK
771# undef wmemchr
772# if HAVE_RAW_DECL_WMEMCHR
773_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
774 "use gnulib module wmemchr for portability");
775# endif
776#endif
777
778
779/* Compare N wide characters of S1 and S2. */
780#if 0
781# if !1
782_GL_FUNCDECL_SYS (wmemcmp, int,
783 (const wchar_t *s1, const wchar_t *s2, size_t n));
784# endif
785_GL_CXXALIAS_SYS (wmemcmp, int,
786 (const wchar_t *s1, const wchar_t *s2, size_t n));
787_GL_CXXALIASWARN (wmemcmp);
788#elif defined GNULIB_POSIXCHECK
789# undef wmemcmp
790# if HAVE_RAW_DECL_WMEMCMP
791_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
792 "use gnulib module wmemcmp for portability");
793# endif
794#endif
795
796
797/* Copy N wide characters of SRC to DEST. */
798#if 0
799# if !1
800_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
801 (wchar_t *dest, const wchar_t *src, size_t n));
802# endif
803_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
804 (wchar_t *dest, const wchar_t *src, size_t n));
805_GL_CXXALIASWARN (wmemcpy);
806#elif defined GNULIB_POSIXCHECK
807# undef wmemcpy
808# if HAVE_RAW_DECL_WMEMCPY
809_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
810 "use gnulib module wmemcpy for portability");
811# endif
812#endif
813
814
815/* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
816 overlapping memory areas. */
817#if 0
818# if !1
819_GL_FUNCDECL_SYS (wmemmove, wchar_t *,
820 (wchar_t *dest, const wchar_t *src, size_t n));
821# endif
822_GL_CXXALIAS_SYS (wmemmove, wchar_t *,
823 (wchar_t *dest, const wchar_t *src, size_t n));
824_GL_CXXALIASWARN (wmemmove);
825#elif defined GNULIB_POSIXCHECK
826# undef wmemmove
827# if HAVE_RAW_DECL_WMEMMOVE
828_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
829 "use gnulib module wmemmove for portability");
830# endif
831#endif
832
833
834/* Set N wide characters of S to C. */
835#if 0
836# if !1
837_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
838# endif
839_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
840_GL_CXXALIASWARN (wmemset);
841#elif defined GNULIB_POSIXCHECK
842# undef wmemset
843# if HAVE_RAW_DECL_WMEMSET
844_GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
845 "use gnulib module wmemset for portability");
846# endif
847#endif
848
849
850/* Return the number of wide characters in S. */
851#if 0
852# if !1
853_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s));
854# endif
855_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
856_GL_CXXALIASWARN (wcslen);
857#elif defined GNULIB_POSIXCHECK
858# undef wcslen
859# if HAVE_RAW_DECL_WCSLEN
860_GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
861 "use gnulib module wcslen for portability");
862# endif
863#endif
864
865
866/* Return the number of wide characters in S, but at most MAXLEN. */
867#if 0
868# if !1
869_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
870# endif
871_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
872_GL_CXXALIASWARN (wcsnlen);
873#elif defined GNULIB_POSIXCHECK
874# undef wcsnlen
875# if HAVE_RAW_DECL_WCSNLEN
876_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
877 "use gnulib module wcsnlen for portability");
878# endif
879#endif
880
881
882/* Copy SRC to DEST. */
883#if 0
884# if !1
885_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
886# endif
887_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
888_GL_CXXALIASWARN (wcscpy);
889#elif defined GNULIB_POSIXCHECK
890# undef wcscpy
891# if HAVE_RAW_DECL_WCSCPY
892_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
893 "use gnulib module wcscpy for portability");
894# endif
895#endif
896
897
898/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
899#if 0
900# if !1
901_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
902# endif
903_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
904_GL_CXXALIASWARN (wcpcpy);
905#elif defined GNULIB_POSIXCHECK
906# undef wcpcpy
907# if HAVE_RAW_DECL_WCPCPY
908_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
909 "use gnulib module wcpcpy for portability");
910# endif
911#endif
912
913
914/* Copy no more than N wide characters of SRC to DEST. */
915#if 0
916# if !1
917_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
918 (wchar_t *dest, const wchar_t *src, size_t n));
919# endif
920_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
921 (wchar_t *dest, const wchar_t *src, size_t n));
922_GL_CXXALIASWARN (wcsncpy);
923#elif defined GNULIB_POSIXCHECK
924# undef wcsncpy
925# if HAVE_RAW_DECL_WCSNCPY
926_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
927 "use gnulib module wcsncpy for portability");
928# endif
929#endif
930
931
932/* Copy no more than N characters of SRC to DEST, returning the address of
933 the last character written into DEST. */
934#if 0
935# if !1
936_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
937 (wchar_t *dest, const wchar_t *src, size_t n));
938# endif
939_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
940 (wchar_t *dest, const wchar_t *src, size_t n));
941_GL_CXXALIASWARN (wcpncpy);
942#elif defined GNULIB_POSIXCHECK
943# undef wcpncpy
944# if HAVE_RAW_DECL_WCPNCPY
945_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
946 "use gnulib module wcpncpy for portability");
947# endif
948#endif
949
950
951/* Append SRC onto DEST. */
952#if 0
953# if !1
954_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
955# endif
956_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
957_GL_CXXALIASWARN (wcscat);
958#elif defined GNULIB_POSIXCHECK
959# undef wcscat
960# if HAVE_RAW_DECL_WCSCAT
961_GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
962 "use gnulib module wcscat for portability");
963# endif
964#endif
965
966
967/* Append no more than N wide characters of SRC onto DEST. */
968#if 0
969# if !1
970_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
971 (wchar_t *dest, const wchar_t *src, size_t n));
972# endif
973_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
974 (wchar_t *dest, const wchar_t *src, size_t n));
975_GL_CXXALIASWARN (wcsncat);
976#elif defined GNULIB_POSIXCHECK
977# undef wcsncat
978# if HAVE_RAW_DECL_WCSNCAT
979_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
980 "use gnulib module wcsncat for portability");
981# endif
982#endif
983
984
985/* Compare S1 and S2. */
986#if 0
987# if !1
988_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
989# endif
990_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
991_GL_CXXALIASWARN (wcscmp);
992#elif defined GNULIB_POSIXCHECK
993# undef wcscmp
994# if HAVE_RAW_DECL_WCSCMP
995_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
996 "use gnulib module wcscmp for portability");
997# endif
998#endif
999
1000
1001/* Compare no more than N wide characters of S1 and S2. */
1002#if 0
1003# if !1
1004_GL_FUNCDECL_SYS (wcsncmp, int,
1005 (const wchar_t *s1, const wchar_t *s2, size_t n));
1006# endif
1007_GL_CXXALIAS_SYS (wcsncmp, int,
1008 (const wchar_t *s1, const wchar_t *s2, size_t n));
1009_GL_CXXALIASWARN (wcsncmp);
1010#elif defined GNULIB_POSIXCHECK
1011# undef wcsncmp
1012# if HAVE_RAW_DECL_WCSNCMP
1013_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
1014 "use gnulib module wcsncmp for portability");
1015# endif
1016#endif
1017
1018
1019/* Compare S1 and S2, ignoring case. */
1020#if 0
1021# if !1
1022_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
1023# endif
1024_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
1025_GL_CXXALIASWARN (wcscasecmp);
1026#elif defined GNULIB_POSIXCHECK
1027# undef wcscasecmp
1028# if HAVE_RAW_DECL_WCSCASECMP
1029_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
1030 "use gnulib module wcscasecmp for portability");
1031# endif
1032#endif
1033
1034
1035/* Compare no more than N chars of S1 and S2, ignoring case. */
1036#if 0
1037# if !1
1038_GL_FUNCDECL_SYS (wcsncasecmp, int,
1039 (const wchar_t *s1, const wchar_t *s2, size_t n));
1040# endif
1041_GL_CXXALIAS_SYS (wcsncasecmp, int,
1042 (const wchar_t *s1, const wchar_t *s2, size_t n));
1043_GL_CXXALIASWARN (wcsncasecmp);
1044#elif defined GNULIB_POSIXCHECK
1045# undef wcsncasecmp
1046# if HAVE_RAW_DECL_WCSNCASECMP
1047_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
1048 "use gnulib module wcsncasecmp for portability");
1049# endif
1050#endif
1051
1052
1053/* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
1054 category of the current locale. */
1055#if 0
1056# if !1
1057_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
1058# endif
1059_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
1060_GL_CXXALIASWARN (wcscoll);
1061#elif defined GNULIB_POSIXCHECK
1062# undef wcscoll
1063# if HAVE_RAW_DECL_WCSCOLL
1064_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
1065 "use gnulib module wcscoll for portability");
1066# endif
1067#endif
1068
1069
1070/* Transform S2 into array pointed to by S1 such that if wcscmp is applied
1071 to two transformed strings the result is the as applying 'wcscoll' to the
1072 original strings. */
1073#if 0
1074# if !1
1075_GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
1076# endif
1077_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
1078_GL_CXXALIASWARN (wcsxfrm);
1079#elif defined GNULIB_POSIXCHECK
1080# undef wcsxfrm
1081# if HAVE_RAW_DECL_WCSXFRM
1082_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
1083 "use gnulib module wcsxfrm for portability");
1084# endif
1085#endif
1086
1087
1088/* Duplicate S, returning an identical malloc'd string. */
1089#if 0
1090# if !1
1091_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
1092# endif
1093_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
1094_GL_CXXALIASWARN (wcsdup);
1095#elif defined GNULIB_POSIXCHECK
1096# undef wcsdup
1097# if HAVE_RAW_DECL_WCSDUP
1098_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
1099 "use gnulib module wcsdup for portability");
1100# endif
1101#endif
1102
1103
1104/* Find the first occurrence of WC in WCS. */
1105#if 0
1106# if !1
1107_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
1108# endif
1109 /* On some systems, this function is defined as an overloaded function:
1110 extern "C++" {
1111 const wchar_t * std::wcschr (const wchar_t *, wchar_t);
1112 wchar_t * std::wcschr (wchar_t *, wchar_t);
1113 } */
1114_GL_CXXALIAS_SYS_CAST2 (wcschr,
1115 wchar_t *, (const wchar_t *, wchar_t),
1116 const wchar_t *, (const wchar_t *, wchar_t));
1117# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1118 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1119_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
1120_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
1121# else
1122_GL_CXXALIASWARN (wcschr);
1123# endif
1124#elif defined GNULIB_POSIXCHECK
1125# undef wcschr
1126# if HAVE_RAW_DECL_WCSCHR
1127_GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
1128 "use gnulib module wcschr for portability");
1129# endif
1130#endif
1131
1132
1133/* Find the last occurrence of WC in WCS. */
1134#if 0
1135# if !1
1136_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
1137# endif
1138 /* On some systems, this function is defined as an overloaded function:
1139 extern "C++" {
1140 const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
1141 wchar_t * std::wcsrchr (wchar_t *, wchar_t);
1142 } */
1143_GL_CXXALIAS_SYS_CAST2 (wcsrchr,
1144 wchar_t *, (const wchar_t *, wchar_t),
1145 const wchar_t *, (const wchar_t *, wchar_t));
1146# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1147 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1148_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
1149_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
1150# else
1151_GL_CXXALIASWARN (wcsrchr);
1152# endif
1153#elif defined GNULIB_POSIXCHECK
1154# undef wcsrchr
1155# if HAVE_RAW_DECL_WCSRCHR
1156_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
1157 "use gnulib module wcsrchr for portability");
1158# endif
1159#endif
1160
1161
1162/* Return the length of the initial segmet of WCS which consists entirely
1163 of wide characters not in REJECT. */
1164#if 0
1165# if !1
1166_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
1167# endif
1168_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
1169_GL_CXXALIASWARN (wcscspn);
1170#elif defined GNULIB_POSIXCHECK
1171# undef wcscspn
1172# if HAVE_RAW_DECL_WCSCSPN
1173_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
1174 "use gnulib module wcscspn for portability");
1175# endif
1176#endif
1177
1178
1179/* Return the length of the initial segmet of WCS which consists entirely
1180 of wide characters in ACCEPT. */
1181#if 0
1182# if !1
1183_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
1184# endif
1185_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
1186_GL_CXXALIASWARN (wcsspn);
1187#elif defined GNULIB_POSIXCHECK
1188# undef wcsspn
1189# if HAVE_RAW_DECL_WCSSPN
1190_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
1191 "use gnulib module wcsspn for portability");
1192# endif
1193#endif
1194
1195
1196/* Find the first occurrence in WCS of any character in ACCEPT. */
1197#if 0
1198# if !1
1199_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
1200 (const wchar_t *wcs, const wchar_t *accept));
1201# endif
1202 /* On some systems, this function is defined as an overloaded function:
1203 extern "C++" {
1204 const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
1205 wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
1206 } */
1207_GL_CXXALIAS_SYS_CAST2 (wcspbrk,
1208 wchar_t *, (const wchar_t *, const wchar_t *),
1209 const wchar_t *, (const wchar_t *, const wchar_t *));
1210# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1211 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1212_GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
1213 (wchar_t *wcs, const wchar_t *accept));
1214_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
1215 (const wchar_t *wcs, const wchar_t *accept));
1216# else
1217_GL_CXXALIASWARN (wcspbrk);
1218# endif
1219#elif defined GNULIB_POSIXCHECK
1220# undef wcspbrk
1221# if HAVE_RAW_DECL_WCSPBRK
1222_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
1223 "use gnulib module wcspbrk for portability");
1224# endif
1225#endif
1226
1227
1228/* Find the first occurrence of NEEDLE in HAYSTACK. */
1229#if 0
1230# if !1
1231_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
1232 (const wchar_t *haystack, const wchar_t *needle));
1233# endif
1234 /* On some systems, this function is defined as an overloaded function:
1235 extern "C++" {
1236 const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
1237 wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
1238 } */
1239_GL_CXXALIAS_SYS_CAST2 (wcsstr,
1240 wchar_t *, (const wchar_t *, const wchar_t *),
1241 const wchar_t *, (const wchar_t *, const wchar_t *));
1242# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1243 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1244_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
1245 (wchar_t *haystack, const wchar_t *needle));
1246_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
1247 (const wchar_t *haystack, const wchar_t *needle));
1248# else
1249_GL_CXXALIASWARN (wcsstr);
1250# endif
1251#elif defined GNULIB_POSIXCHECK
1252# undef wcsstr
1253# if HAVE_RAW_DECL_WCSSTR
1254_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
1255 "use gnulib module wcsstr for portability");
1256# endif
1257#endif
1258
1259
1260/* Divide WCS into tokens separated by characters in DELIM. */
1261#if 0
1262# if !1
1263_GL_FUNCDECL_SYS (wcstok, wchar_t *,
1264 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
1265# endif
1266_GL_CXXALIAS_SYS (wcstok, wchar_t *,
1267 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
1268_GL_CXXALIASWARN (wcstok);
1269#elif defined GNULIB_POSIXCHECK
1270# undef wcstok
1271# if HAVE_RAW_DECL_WCSTOK
1272_GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
1273 "use gnulib module wcstok for portability");
1274# endif
1275#endif
1276
1277
1278/* Determine number of column positions required for first N wide
1279 characters (or fewer if S ends before this) in S. */
1280#if 0
1281# if 0
1282# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1283# undef wcswidth
1284# define wcswidth rpl_wcswidth
1285# endif
1286_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n));
1287_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
1288# else
1289# if !1
1290_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n));
1291# endif
1292_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
1293# endif
1294_GL_CXXALIASWARN (wcswidth);
1295#elif defined GNULIB_POSIXCHECK
1296# undef wcswidth
1297# if HAVE_RAW_DECL_WCSWIDTH
1298_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
1299 "use gnulib module wcswidth for portability");
1300# endif
1301#endif
1302
1303
1304#endif /* _GL_WCHAR_H */
1305#endif /* _GL_WCHAR_H */
1306#endif
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
new file mode 100644
index 00000000000..da55f6e3de9
--- /dev/null
+++ b/lib/wchar.in.h
@@ -0,0 +1,994 @@
1/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
2
3 Copyright (C) 2007-2011 Free Software Foundation, Inc.
4
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)
8 any later version.
9
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.
14
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,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18
19/* Written by Eric Blake. */
20
21/*
22 * ISO C 99 <wchar.h> for platforms that have issues.
23 * <http://www.opengroup.org/susv3xbd/wchar.h.html>
24 *
25 * For now, this just ensures proper prerequisite inclusion order and
26 * the declaration of wcwidth().
27 */
28
29#if __GNUC__ >= 3
30@PRAGMA_SYSTEM_HEADER@
31#endif
32@PRAGMA_COLUMNS@
33
34#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
35/* Special invocation convention:
36 - Inside glibc and uClibc header files.
37 - On HP-UX 11.00 we have a sequence of nested includes
38 <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
39 once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
40 and once directly. In both situations 'wint_t' is not yet defined,
41 therefore we cannot provide the function overrides; instead include only
42 the system's <wchar.h>.
43 - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
44 the latter includes <wchar.h>. But here, we have no way to detect whether
45 <wctype.h> is completely included or is still being included. */
46
47#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
48
49#else
50/* Normal invocation convention. */
51
52#ifndef _GL_WCHAR_H
53
54#define _GL_ALREADY_INCLUDING_WCHAR_H
55
56#if @HAVE_FEATURES_H@
57# include <features.h> /* for __GLIBC__ */
58#endif
59
60/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
61 <wchar.h>.
62 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
63 included before <wchar.h>.
64 In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
65 by <stddef.h>.
66 But avoid namespace pollution on glibc systems. */
67#if !(defined __GLIBC__ && !defined __UCLIBC__)
68# include <stddef.h>
69#endif
70#ifndef __GLIBC__
71# include <stdio.h>
72# include <time.h>
73#endif
74
75/* Include the original <wchar.h> if it exists.
76 Some builds of uClibc lack it. */
77/* The include_next requires a split double-inclusion guard. */
78#if @HAVE_WCHAR_H@
79# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
80#endif
81
82#undef _GL_ALREADY_INCLUDING_WCHAR_H
83
84#ifndef _GL_WCHAR_H
85#define _GL_WCHAR_H
86
87/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
88
89/* The definition of _GL_ARG_NONNULL is copied here. */
90
91/* The definition of _GL_WARN_ON_USE is copied here. */
92
93
94/* Define wint_t and WEOF. (Also done in wctype.in.h.) */
95#if !@HAVE_WINT_T@ && !defined wint_t
96# define wint_t int
97# ifndef WEOF
98# define WEOF -1
99# endif
100#else
101# ifndef WEOF
102# define WEOF ((wint_t) -1)
103# endif
104#endif
105
106
107/* Override mbstate_t if it is too small.
108 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
109 implementing mbrtowc for encodings like UTF-8. */
110#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
111# if !GNULIB_defined_mbstate_t
112typedef int rpl_mbstate_t;
113# undef mbstate_t
114# define mbstate_t rpl_mbstate_t
115# define GNULIB_defined_mbstate_t 1
116# endif
117#endif
118
119
120/* Convert a single-byte character to a wide character. */
121#if @GNULIB_BTOWC@
122# if @REPLACE_BTOWC@
123# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
124# undef btowc
125# define btowc rpl_btowc
126# endif
127_GL_FUNCDECL_RPL (btowc, wint_t, (int c));
128_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
129# else
130# if !@HAVE_BTOWC@
131_GL_FUNCDECL_SYS (btowc, wint_t, (int c));
132# endif
133_GL_CXXALIAS_SYS (btowc, wint_t, (int c));
134# endif
135_GL_CXXALIASWARN (btowc);
136#elif defined GNULIB_POSIXCHECK
137# undef btowc
138# if HAVE_RAW_DECL_BTOWC
139_GL_WARN_ON_USE (btowc, "btowc is unportable - "
140 "use gnulib module btowc for portability");
141# endif
142#endif
143
144
145/* Convert a wide character to a single-byte character. */
146#if @GNULIB_WCTOB@
147# if @REPLACE_WCTOB@
148# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
149# undef wctob
150# define wctob rpl_wctob
151# endif
152_GL_FUNCDECL_RPL (wctob, int, (wint_t wc));
153_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
154# else
155# if !defined wctob && !@HAVE_DECL_WCTOB@
156/* wctob is provided by gnulib, or wctob exists but is not declared. */
157_GL_FUNCDECL_SYS (wctob, int, (wint_t wc));
158# endif
159_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
160# endif
161_GL_CXXALIASWARN (wctob);
162#elif defined GNULIB_POSIXCHECK
163# undef wctob
164# if HAVE_RAW_DECL_WCTOB
165_GL_WARN_ON_USE (wctob, "wctob is unportable - "
166 "use gnulib module wctob for portability");
167# endif
168#endif
169
170
171/* Test whether *PS is in the initial state. */
172#if @GNULIB_MBSINIT@
173# if @REPLACE_MBSINIT@
174# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
175# undef mbsinit
176# define mbsinit rpl_mbsinit
177# endif
178_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
179_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
180# else
181# if !@HAVE_MBSINIT@
182_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
183# endif
184_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
185# endif
186_GL_CXXALIASWARN (mbsinit);
187#elif defined GNULIB_POSIXCHECK
188# undef mbsinit
189# if HAVE_RAW_DECL_MBSINIT
190_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
191 "use gnulib module mbsinit for portability");
192# endif
193#endif
194
195
196/* Convert a multibyte character to a wide character. */
197#if @GNULIB_MBRTOWC@
198# if @REPLACE_MBRTOWC@
199# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
200# undef mbrtowc
201# define mbrtowc rpl_mbrtowc
202# endif
203_GL_FUNCDECL_RPL (mbrtowc, size_t,
204 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
205_GL_CXXALIAS_RPL (mbrtowc, size_t,
206 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
207# else
208# if !@HAVE_MBRTOWC@
209_GL_FUNCDECL_SYS (mbrtowc, size_t,
210 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
211# endif
212_GL_CXXALIAS_SYS (mbrtowc, size_t,
213 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
214# endif
215_GL_CXXALIASWARN (mbrtowc);
216#elif defined GNULIB_POSIXCHECK
217# undef mbrtowc
218# if HAVE_RAW_DECL_MBRTOWC
219_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
220 "use gnulib module mbrtowc for portability");
221# endif
222#endif
223
224
225/* Recognize a multibyte character. */
226#if @GNULIB_MBRLEN@
227# if @REPLACE_MBRLEN@
228# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
229# undef mbrlen
230# define mbrlen rpl_mbrlen
231# endif
232_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
233_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
234# else
235# if !@HAVE_MBRLEN@
236_GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
237# endif
238_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
239# endif
240_GL_CXXALIASWARN (mbrlen);
241#elif defined GNULIB_POSIXCHECK
242# undef mbrlen
243# if HAVE_RAW_DECL_MBRLEN
244_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
245 "use gnulib module mbrlen for portability");
246# endif
247#endif
248
249
250/* Convert a string to a wide string. */
251#if @GNULIB_MBSRTOWCS@
252# if @REPLACE_MBSRTOWCS@
253# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
254# undef mbsrtowcs
255# define mbsrtowcs rpl_mbsrtowcs
256# endif
257_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
258 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
259 _GL_ARG_NONNULL ((2)));
260_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
261 (wchar_t *dest, const char **srcp, size_t len,
262 mbstate_t *ps));
263# else
264# if !@HAVE_MBSRTOWCS@
265_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
266 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
267 _GL_ARG_NONNULL ((2)));
268# endif
269_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
270 (wchar_t *dest, const char **srcp, size_t len,
271 mbstate_t *ps));
272# endif
273_GL_CXXALIASWARN (mbsrtowcs);
274#elif defined GNULIB_POSIXCHECK
275# undef mbsrtowcs
276# if HAVE_RAW_DECL_MBSRTOWCS
277_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
278 "use gnulib module mbsrtowcs for portability");
279# endif
280#endif
281
282
283/* Convert a string to a wide string. */
284#if @GNULIB_MBSNRTOWCS@
285# if @REPLACE_MBSNRTOWCS@
286# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
287# undef mbsnrtowcs
288# define mbsnrtowcs rpl_mbsnrtowcs
289# endif
290_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
291 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
292 mbstate_t *ps)
293 _GL_ARG_NONNULL ((2)));
294_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
295 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
296 mbstate_t *ps));
297# else
298# if !@HAVE_MBSNRTOWCS@
299_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
300 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
301 mbstate_t *ps)
302 _GL_ARG_NONNULL ((2)));
303# endif
304_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
305 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
306 mbstate_t *ps));
307# endif
308_GL_CXXALIASWARN (mbsnrtowcs);
309#elif defined GNULIB_POSIXCHECK
310# undef mbsnrtowcs
311# if HAVE_RAW_DECL_MBSNRTOWCS
312_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
313 "use gnulib module mbsnrtowcs for portability");
314# endif
315#endif
316
317
318/* Convert a wide character to a multibyte character. */
319#if @GNULIB_WCRTOMB@
320# if @REPLACE_WCRTOMB@
321# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
322# undef wcrtomb
323# define wcrtomb rpl_wcrtomb
324# endif
325_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
326_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
327# else
328# if !@HAVE_WCRTOMB@
329_GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
330# endif
331_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
332# endif
333_GL_CXXALIASWARN (wcrtomb);
334#elif defined GNULIB_POSIXCHECK
335# undef wcrtomb
336# if HAVE_RAW_DECL_WCRTOMB
337_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
338 "use gnulib module wcrtomb for portability");
339# endif
340#endif
341
342
343/* Convert a wide string to a string. */
344#if @GNULIB_WCSRTOMBS@
345# if @REPLACE_WCSRTOMBS@
346# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
347# undef wcsrtombs
348# define wcsrtombs rpl_wcsrtombs
349# endif
350_GL_FUNCDECL_RPL (wcsrtombs, size_t,
351 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
352 _GL_ARG_NONNULL ((2)));
353_GL_CXXALIAS_RPL (wcsrtombs, size_t,
354 (char *dest, const wchar_t **srcp, size_t len,
355 mbstate_t *ps));
356# else
357# if !@HAVE_WCSRTOMBS@
358_GL_FUNCDECL_SYS (wcsrtombs, size_t,
359 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
360 _GL_ARG_NONNULL ((2)));
361# endif
362_GL_CXXALIAS_SYS (wcsrtombs, size_t,
363 (char *dest, const wchar_t **srcp, size_t len,
364 mbstate_t *ps));
365# endif
366_GL_CXXALIASWARN (wcsrtombs);
367#elif defined GNULIB_POSIXCHECK
368# undef wcsrtombs
369# if HAVE_RAW_DECL_WCSRTOMBS
370_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
371 "use gnulib module wcsrtombs for portability");
372# endif
373#endif
374
375
376/* Convert a wide string to a string. */
377#if @GNULIB_WCSNRTOMBS@
378# if @REPLACE_WCSNRTOMBS@
379# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
380# undef wcsnrtombs
381# define wcsnrtombs rpl_wcsnrtombs
382# endif
383_GL_FUNCDECL_RPL (wcsnrtombs, size_t,
384 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
385 mbstate_t *ps)
386 _GL_ARG_NONNULL ((2)));
387_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
388 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
389 mbstate_t *ps));
390# else
391# if !@HAVE_WCSNRTOMBS@
392_GL_FUNCDECL_SYS (wcsnrtombs, size_t,
393 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
394 mbstate_t *ps)
395 _GL_ARG_NONNULL ((2)));
396# endif
397_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
398 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
399 mbstate_t *ps));
400# endif
401_GL_CXXALIASWARN (wcsnrtombs);
402#elif defined GNULIB_POSIXCHECK
403# undef wcsnrtombs
404# if HAVE_RAW_DECL_WCSNRTOMBS
405_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
406 "use gnulib module wcsnrtombs for portability");
407# endif
408#endif
409
410
411/* Return the number of screen columns needed for WC. */
412#if @GNULIB_WCWIDTH@
413# if @REPLACE_WCWIDTH@
414# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
415# undef wcwidth
416# define wcwidth rpl_wcwidth
417# endif
418_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t));
419_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
420# else
421# if !@HAVE_DECL_WCWIDTH@
422/* wcwidth exists but is not declared. */
423_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t));
424# endif
425_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
426# endif
427_GL_CXXALIASWARN (wcwidth);
428#elif defined GNULIB_POSIXCHECK
429# undef wcwidth
430# if HAVE_RAW_DECL_WCWIDTH
431_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
432 "use gnulib module wcwidth for portability");
433# endif
434#endif
435
436
437/* Search N wide characters of S for C. */
438#if @GNULIB_WMEMCHR@
439# if !@HAVE_WMEMCHR@
440_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
441# endif
442 /* On some systems, this function is defined as an overloaded function:
443 extern "C++" {
444 const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
445 wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
446 } */
447_GL_CXXALIAS_SYS_CAST2 (wmemchr,
448 wchar_t *, (const wchar_t *, wchar_t, size_t),
449 const wchar_t *, (const wchar_t *, wchar_t, size_t));
450# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
451 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
452_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
453_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
454 (const wchar_t *s, wchar_t c, size_t n));
455# else
456_GL_CXXALIASWARN (wmemchr);
457# endif
458#elif defined GNULIB_POSIXCHECK
459# undef wmemchr
460# if HAVE_RAW_DECL_WMEMCHR
461_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
462 "use gnulib module wmemchr for portability");
463# endif
464#endif
465
466
467/* Compare N wide characters of S1 and S2. */
468#if @GNULIB_WMEMCMP@
469# if !@HAVE_WMEMCMP@
470_GL_FUNCDECL_SYS (wmemcmp, int,
471 (const wchar_t *s1, const wchar_t *s2, size_t n));
472# endif
473_GL_CXXALIAS_SYS (wmemcmp, int,
474 (const wchar_t *s1, const wchar_t *s2, size_t n));
475_GL_CXXALIASWARN (wmemcmp);
476#elif defined GNULIB_POSIXCHECK
477# undef wmemcmp
478# if HAVE_RAW_DECL_WMEMCMP
479_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
480 "use gnulib module wmemcmp for portability");
481# endif
482#endif
483
484
485/* Copy N wide characters of SRC to DEST. */
486#if @GNULIB_WMEMCPY@
487# if !@HAVE_WMEMCPY@
488_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
489 (wchar_t *dest, const wchar_t *src, size_t n));
490# endif
491_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
492 (wchar_t *dest, const wchar_t *src, size_t n));
493_GL_CXXALIASWARN (wmemcpy);
494#elif defined GNULIB_POSIXCHECK
495# undef wmemcpy
496# if HAVE_RAW_DECL_WMEMCPY
497_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
498 "use gnulib module wmemcpy for portability");
499# endif
500#endif
501
502
503/* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
504 overlapping memory areas. */
505#if @GNULIB_WMEMMOVE@
506# if !@HAVE_WMEMMOVE@
507_GL_FUNCDECL_SYS (wmemmove, wchar_t *,
508 (wchar_t *dest, const wchar_t *src, size_t n));
509# endif
510_GL_CXXALIAS_SYS (wmemmove, wchar_t *,
511 (wchar_t *dest, const wchar_t *src, size_t n));
512_GL_CXXALIASWARN (wmemmove);
513#elif defined GNULIB_POSIXCHECK
514# undef wmemmove
515# if HAVE_RAW_DECL_WMEMMOVE
516_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
517 "use gnulib module wmemmove for portability");
518# endif
519#endif
520
521
522/* Set N wide characters of S to C. */
523#if @GNULIB_WMEMSET@
524# if !@HAVE_WMEMSET@
525_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
526# endif
527_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
528_GL_CXXALIASWARN (wmemset);
529#elif defined GNULIB_POSIXCHECK
530# undef wmemset
531# if HAVE_RAW_DECL_WMEMSET
532_GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
533 "use gnulib module wmemset for portability");
534# endif
535#endif
536
537
538/* Return the number of wide characters in S. */
539#if @GNULIB_WCSLEN@
540# if !@HAVE_WCSLEN@
541_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s));
542# endif
543_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
544_GL_CXXALIASWARN (wcslen);
545#elif defined GNULIB_POSIXCHECK
546# undef wcslen
547# if HAVE_RAW_DECL_WCSLEN
548_GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
549 "use gnulib module wcslen for portability");
550# endif
551#endif
552
553
554/* Return the number of wide characters in S, but at most MAXLEN. */
555#if @GNULIB_WCSNLEN@
556# if !@HAVE_WCSNLEN@
557_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
558# endif
559_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
560_GL_CXXALIASWARN (wcsnlen);
561#elif defined GNULIB_POSIXCHECK
562# undef wcsnlen
563# if HAVE_RAW_DECL_WCSNLEN
564_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
565 "use gnulib module wcsnlen for portability");
566# endif
567#endif
568
569
570/* Copy SRC to DEST. */
571#if @GNULIB_WCSCPY@
572# if !@HAVE_WCSCPY@
573_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
574# endif
575_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
576_GL_CXXALIASWARN (wcscpy);
577#elif defined GNULIB_POSIXCHECK
578# undef wcscpy
579# if HAVE_RAW_DECL_WCSCPY
580_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
581 "use gnulib module wcscpy for portability");
582# endif
583#endif
584
585
586/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
587#if @GNULIB_WCPCPY@
588# if !@HAVE_WCPCPY@
589_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
590# endif
591_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
592_GL_CXXALIASWARN (wcpcpy);
593#elif defined GNULIB_POSIXCHECK
594# undef wcpcpy
595# if HAVE_RAW_DECL_WCPCPY
596_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
597 "use gnulib module wcpcpy for portability");
598# endif
599#endif
600
601
602/* Copy no more than N wide characters of SRC to DEST. */
603#if @GNULIB_WCSNCPY@
604# if !@HAVE_WCSNCPY@
605_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
606 (wchar_t *dest, const wchar_t *src, size_t n));
607# endif
608_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
609 (wchar_t *dest, const wchar_t *src, size_t n));
610_GL_CXXALIASWARN (wcsncpy);
611#elif defined GNULIB_POSIXCHECK
612# undef wcsncpy
613# if HAVE_RAW_DECL_WCSNCPY
614_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
615 "use gnulib module wcsncpy for portability");
616# endif
617#endif
618
619
620/* Copy no more than N characters of SRC to DEST, returning the address of
621 the last character written into DEST. */
622#if @GNULIB_WCPNCPY@
623# if !@HAVE_WCPNCPY@
624_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
625 (wchar_t *dest, const wchar_t *src, size_t n));
626# endif
627_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
628 (wchar_t *dest, const wchar_t *src, size_t n));
629_GL_CXXALIASWARN (wcpncpy);
630#elif defined GNULIB_POSIXCHECK
631# undef wcpncpy
632# if HAVE_RAW_DECL_WCPNCPY
633_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
634 "use gnulib module wcpncpy for portability");
635# endif
636#endif
637
638
639/* Append SRC onto DEST. */
640#if @GNULIB_WCSCAT@
641# if !@HAVE_WCSCAT@
642_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
643# endif
644_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
645_GL_CXXALIASWARN (wcscat);
646#elif defined GNULIB_POSIXCHECK
647# undef wcscat
648# if HAVE_RAW_DECL_WCSCAT
649_GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
650 "use gnulib module wcscat for portability");
651# endif
652#endif
653
654
655/* Append no more than N wide characters of SRC onto DEST. */
656#if @GNULIB_WCSNCAT@
657# if !@HAVE_WCSNCAT@
658_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
659 (wchar_t *dest, const wchar_t *src, size_t n));
660# endif
661_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
662 (wchar_t *dest, const wchar_t *src, size_t n));
663_GL_CXXALIASWARN (wcsncat);
664#elif defined GNULIB_POSIXCHECK
665# undef wcsncat
666# if HAVE_RAW_DECL_WCSNCAT
667_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
668 "use gnulib module wcsncat for portability");
669# endif
670#endif
671
672
673/* Compare S1 and S2. */
674#if @GNULIB_WCSCMP@
675# if !@HAVE_WCSCMP@
676_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
677# endif
678_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
679_GL_CXXALIASWARN (wcscmp);
680#elif defined GNULIB_POSIXCHECK
681# undef wcscmp
682# if HAVE_RAW_DECL_WCSCMP
683_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
684 "use gnulib module wcscmp for portability");
685# endif
686#endif
687
688
689/* Compare no more than N wide characters of S1 and S2. */
690#if @GNULIB_WCSNCMP@
691# if !@HAVE_WCSNCMP@
692_GL_FUNCDECL_SYS (wcsncmp, int,
693 (const wchar_t *s1, const wchar_t *s2, size_t n));
694# endif
695_GL_CXXALIAS_SYS (wcsncmp, int,
696 (const wchar_t *s1, const wchar_t *s2, size_t n));
697_GL_CXXALIASWARN (wcsncmp);
698#elif defined GNULIB_POSIXCHECK
699# undef wcsncmp
700# if HAVE_RAW_DECL_WCSNCMP
701_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
702 "use gnulib module wcsncmp for portability");
703# endif
704#endif
705
706
707/* Compare S1 and S2, ignoring case. */
708#if @GNULIB_WCSCASECMP@
709# if !@HAVE_WCSCASECMP@
710_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
711# endif
712_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
713_GL_CXXALIASWARN (wcscasecmp);
714#elif defined GNULIB_POSIXCHECK
715# undef wcscasecmp
716# if HAVE_RAW_DECL_WCSCASECMP
717_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
718 "use gnulib module wcscasecmp for portability");
719# endif
720#endif
721
722
723/* Compare no more than N chars of S1 and S2, ignoring case. */
724#if @GNULIB_WCSNCASECMP@
725# if !@HAVE_WCSNCASECMP@
726_GL_FUNCDECL_SYS (wcsncasecmp, int,
727 (const wchar_t *s1, const wchar_t *s2, size_t n));
728# endif
729_GL_CXXALIAS_SYS (wcsncasecmp, int,
730 (const wchar_t *s1, const wchar_t *s2, size_t n));
731_GL_CXXALIASWARN (wcsncasecmp);
732#elif defined GNULIB_POSIXCHECK
733# undef wcsncasecmp
734# if HAVE_RAW_DECL_WCSNCASECMP
735_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
736 "use gnulib module wcsncasecmp for portability");
737# endif
738#endif
739
740
741/* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
742 category of the current locale. */
743#if @GNULIB_WCSCOLL@
744# if !@HAVE_WCSCOLL@
745_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
746# endif
747_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
748_GL_CXXALIASWARN (wcscoll);
749#elif defined GNULIB_POSIXCHECK
750# undef wcscoll
751# if HAVE_RAW_DECL_WCSCOLL
752_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
753 "use gnulib module wcscoll for portability");
754# endif
755#endif
756
757
758/* Transform S2 into array pointed to by S1 such that if wcscmp is applied
759 to two transformed strings the result is the as applying 'wcscoll' to the
760 original strings. */
761#if @GNULIB_WCSXFRM@
762# if !@HAVE_WCSXFRM@
763_GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
764# endif
765_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
766_GL_CXXALIASWARN (wcsxfrm);
767#elif defined GNULIB_POSIXCHECK
768# undef wcsxfrm
769# if HAVE_RAW_DECL_WCSXFRM
770_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
771 "use gnulib module wcsxfrm for portability");
772# endif
773#endif
774
775
776/* Duplicate S, returning an identical malloc'd string. */
777#if @GNULIB_WCSDUP@
778# if !@HAVE_WCSDUP@
779_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
780# endif
781_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
782_GL_CXXALIASWARN (wcsdup);
783#elif defined GNULIB_POSIXCHECK
784# undef wcsdup
785# if HAVE_RAW_DECL_WCSDUP
786_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
787 "use gnulib module wcsdup for portability");
788# endif
789#endif
790
791
792/* Find the first occurrence of WC in WCS. */
793#if @GNULIB_WCSCHR@
794# if !@HAVE_WCSCHR@
795_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
796# endif
797 /* On some systems, this function is defined as an overloaded function:
798 extern "C++" {
799 const wchar_t * std::wcschr (const wchar_t *, wchar_t);
800 wchar_t * std::wcschr (wchar_t *, wchar_t);
801 } */
802_GL_CXXALIAS_SYS_CAST2 (wcschr,
803 wchar_t *, (const wchar_t *, wchar_t),
804 const wchar_t *, (const wchar_t *, wchar_t));
805# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
806 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
807_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
808_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
809# else
810_GL_CXXALIASWARN (wcschr);
811# endif
812#elif defined GNULIB_POSIXCHECK
813# undef wcschr
814# if HAVE_RAW_DECL_WCSCHR
815_GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
816 "use gnulib module wcschr for portability");
817# endif
818#endif
819
820
821/* Find the last occurrence of WC in WCS. */
822#if @GNULIB_WCSRCHR@
823# if !@HAVE_WCSRCHR@
824_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
825# endif
826 /* On some systems, this function is defined as an overloaded function:
827 extern "C++" {
828 const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
829 wchar_t * std::wcsrchr (wchar_t *, wchar_t);
830 } */
831_GL_CXXALIAS_SYS_CAST2 (wcsrchr,
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 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
837_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
838# else
839_GL_CXXALIASWARN (wcsrchr);
840# endif
841#elif defined GNULIB_POSIXCHECK
842# undef wcsrchr
843# if HAVE_RAW_DECL_WCSRCHR
844_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
845 "use gnulib module wcsrchr for portability");
846# endif
847#endif
848
849
850/* Return the length of the initial segmet of WCS which consists entirely
851 of wide characters not in REJECT. */
852#if @GNULIB_WCSCSPN@
853# if !@HAVE_WCSCSPN@
854_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
855# endif
856_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
857_GL_CXXALIASWARN (wcscspn);
858#elif defined GNULIB_POSIXCHECK
859# undef wcscspn
860# if HAVE_RAW_DECL_WCSCSPN
861_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
862 "use gnulib module wcscspn for portability");
863# endif
864#endif
865
866
867/* Return the length of the initial segmet of WCS which consists entirely
868 of wide characters in ACCEPT. */
869#if @GNULIB_WCSSPN@
870# if !@HAVE_WCSSPN@
871_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
872# endif
873_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
874_GL_CXXALIASWARN (wcsspn);
875#elif defined GNULIB_POSIXCHECK
876# undef wcsspn
877# if HAVE_RAW_DECL_WCSSPN
878_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
879 "use gnulib module wcsspn for portability");
880# endif
881#endif
882
883
884/* Find the first occurrence in WCS of any character in ACCEPT. */
885#if @GNULIB_WCSPBRK@
886# if !@HAVE_WCSPBRK@
887_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
888 (const wchar_t *wcs, const wchar_t *accept));
889# endif
890 /* On some systems, this function is defined as an overloaded function:
891 extern "C++" {
892 const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
893 wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
894 } */
895_GL_CXXALIAS_SYS_CAST2 (wcspbrk,
896 wchar_t *, (const wchar_t *, const wchar_t *),
897 const wchar_t *, (const wchar_t *, const wchar_t *));
898# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
899 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
900_GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
901 (wchar_t *wcs, const wchar_t *accept));
902_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
903 (const wchar_t *wcs, const wchar_t *accept));
904# else
905_GL_CXXALIASWARN (wcspbrk);
906# endif
907#elif defined GNULIB_POSIXCHECK
908# undef wcspbrk
909# if HAVE_RAW_DECL_WCSPBRK
910_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
911 "use gnulib module wcspbrk for portability");
912# endif
913#endif
914
915
916/* Find the first occurrence of NEEDLE in HAYSTACK. */
917#if @GNULIB_WCSSTR@
918# if !@HAVE_WCSSTR@
919_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
920 (const wchar_t *haystack, const wchar_t *needle));
921# endif
922 /* On some systems, this function is defined as an overloaded function:
923 extern "C++" {
924 const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
925 wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
926 } */
927_GL_CXXALIAS_SYS_CAST2 (wcsstr,
928 wchar_t *, (const wchar_t *, const wchar_t *),
929 const wchar_t *, (const wchar_t *, const wchar_t *));
930# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
931 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
932_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
933 (wchar_t *haystack, const wchar_t *needle));
934_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
935 (const wchar_t *haystack, const wchar_t *needle));
936# else
937_GL_CXXALIASWARN (wcsstr);
938# endif
939#elif defined GNULIB_POSIXCHECK
940# undef wcsstr
941# if HAVE_RAW_DECL_WCSSTR
942_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
943 "use gnulib module wcsstr for portability");
944# endif
945#endif
946
947
948/* Divide WCS into tokens separated by characters in DELIM. */
949#if @GNULIB_WCSTOK@
950# if !@HAVE_WCSTOK@
951_GL_FUNCDECL_SYS (wcstok, wchar_t *,
952 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
953# endif
954_GL_CXXALIAS_SYS (wcstok, wchar_t *,
955 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
956_GL_CXXALIASWARN (wcstok);
957#elif defined GNULIB_POSIXCHECK
958# undef wcstok
959# if HAVE_RAW_DECL_WCSTOK
960_GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
961 "use gnulib module wcstok for portability");
962# endif
963#endif
964
965
966/* Determine number of column positions required for first N wide
967 characters (or fewer if S ends before this) in S. */
968#if @GNULIB_WCSWIDTH@
969# if @REPLACE_WCSWIDTH@
970# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
971# undef wcswidth
972# define wcswidth rpl_wcswidth
973# endif
974_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n));
975_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
976# else
977# if !@HAVE_WCSWIDTH@
978_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n));
979# endif
980_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
981# endif
982_GL_CXXALIASWARN (wcswidth);
983#elif defined GNULIB_POSIXCHECK
984# undef wcswidth
985# if HAVE_RAW_DECL_WCSWIDTH
986_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
987 "use gnulib module wcswidth for portability");
988# endif
989#endif
990
991
992#endif /* _GL_WCHAR_H */
993#endif /* _GL_WCHAR_H */
994#endif