1 #ifndef _WCHAR_H
2 
3 /* Workaround PR90731 with GCC 9 when using ldbl redirects in C++.  */
4 # include <bits/floatn.h>
5 # if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
6 #  if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
7 #   pragma GCC system_header
8 #  endif
9 # endif
10 
11 # include <wcsmbs/wchar.h>
12 # ifndef _ISOMAC
13 
14 #include <bits/floatn.h>
15 
16 extern __typeof (wcscasecmp_l) __wcscasecmp_l;
17 extern __typeof (wcsncasecmp_l) __wcsncasecmp_l;
18 extern __typeof (wcscoll_l) __wcscoll_l;
19 extern __typeof (wcsxfrm_l) __wcsxfrm_l;
20 extern __typeof (wcstol_l) __wcstol_l;
21 extern __typeof (wcstoul_l) __wcstoul_l;
22 extern __typeof (wcstoll_l) __wcstoll_l;
23 extern __typeof (wcstoull_l) __wcstoull_l;
24 extern __typeof (wcstod_l) __wcstod_l;
25 extern __typeof (wcstof_l) __wcstof_l;
26 extern __typeof (wcstold_l) __wcstold_l;
27 extern __typeof (wcsftime_l) __wcsftime_l;
28 libc_hidden_proto (__wcstol_l)
29 libc_hidden_proto (__wcstoul_l)
30 libc_hidden_proto (__wcstoll_l)
31 libc_hidden_proto (__wcstoull_l)
32 libc_hidden_proto (__wcstod_l)
33 libc_hidden_proto (__wcstof_l)
34 libc_hidden_proto (__wcstold_l)
35 libc_hidden_proto (__wcsftime_l)
36 
37 
38 extern double __wcstod_internal (const wchar_t *__restrict __nptr,
39 				 wchar_t **__restrict __endptr, int __group)
40      __THROW;
41 extern float __wcstof_internal (const wchar_t *__restrict __nptr,
42 				wchar_t **__restrict __endptr, int __group)
43      __THROW;
44 extern long double __wcstold_internal (const wchar_t *__restrict __nptr,
45 				       wchar_t **__restrict __endptr,
46 				       int __group) __THROW;
47 extern long int __wcstol_internal (const wchar_t *__restrict __nptr,
48 				   wchar_t **__restrict __endptr,
49 				   int __base, int __group) __THROW;
50 extern unsigned long int __wcstoul_internal (const wchar_t *__restrict __npt,
51 					     wchar_t **__restrict __endptr,
52 					     int __base, int __group) __THROW;
53 __extension__
54 extern long long int __wcstoll_internal (const wchar_t *__restrict __nptr,
55 					 wchar_t **__restrict __endptr,
56 					 int __base, int __group) __THROW;
57 __extension__
58 extern unsigned long long int __wcstoull_internal (const wchar_t *
59 						   __restrict __nptr,
60 						   wchar_t **
61 						   __restrict __endptr,
62 						   int __base,
63 						   int __group) __THROW;
64 extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
65 						       wchar_t **, int, int,
66 						       locale_t);
67 libc_hidden_proto (__wcstof_internal)
68 libc_hidden_proto (__wcstod_internal)
69 libc_hidden_proto (__wcstold_internal)
70 libc_hidden_proto (__wcstol_internal)
71 libc_hidden_proto (__wcstoll_internal)
72 libc_hidden_proto (__wcstoul_internal)
73 libc_hidden_proto (__wcstoull_internal)
74 libc_hidden_proto (wcstof)
75 libc_hidden_proto (wcstod)
76 libc_hidden_ldbl_proto (wcstold)
77 libc_hidden_proto (wcstol)
78 libc_hidden_proto (wcstoll)
79 libc_hidden_proto (wcstoul)
80 libc_hidden_proto (wcstoull)
81 
82 extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
83 				    locale_t) attribute_hidden;
84 extern double ____wcstod_l_internal (const wchar_t *, wchar_t **, int,
85 				     locale_t) attribute_hidden;
86 extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **,
87 					   int, locale_t) attribute_hidden;
88 extern long int ____wcstol_l_internal (const wchar_t *, wchar_t **, int,
89 				       int, locale_t) attribute_hidden;
90 extern unsigned long int ____wcstoul_l_internal (const wchar_t *,
91 						 wchar_t **,
92 						 int, int, locale_t)
93      attribute_hidden;
94 extern long long int ____wcstoll_l_internal (const wchar_t *, wchar_t **,
95 					     int, int, locale_t)
96      attribute_hidden;
97 extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
98 						       wchar_t **, int, int,
99 						       locale_t)
100      attribute_hidden;
101 
102 #if __HAVE_DISTINCT_FLOAT128
103 extern __typeof (wcstof128_l) __wcstof128_l;
104 libc_hidden_proto (__wcstof128_l)
105 extern _Float128 __wcstof128_internal (const wchar_t *__restrict __nptr,
106 				       wchar_t **__restrict __endptr,
107 				       int __group) __THROW;
108 
109 extern _Float128 ____wcstof128_l_internal (const wchar_t *, wchar_t **, int,
110 					   locale_t) attribute_hidden;
111 
112 libc_hidden_proto (__wcstof128_internal)
113 libc_hidden_proto (wcstof128)
114 #endif
115 
116 libc_hidden_proto (__wcscasecmp_l)
117 libc_hidden_proto (__wcsncasecmp_l)
118 
119 libc_hidden_proto (__wcscoll_l)
120 libc_hidden_proto (__wcsxfrm_l)
121 
122 libc_hidden_proto (fputws_unlocked)
123 libc_hidden_proto (putwc_unlocked)
124 libc_hidden_proto (putwc)
125 
126 libc_hidden_proto (mbrtowc)
127 libc_hidden_proto (wcrtomb)
128 extern int __wcscmp (const wchar_t *__s1, const wchar_t *__s2)
129      __THROW __attribute_pure__;
130 libc_hidden_proto (__wcscmp)
131 libc_hidden_proto (wcsftime)
132 libc_hidden_proto (wcsspn)
133 libc_hidden_proto (wcschr)
134 /* The C++ overloading of wcschr means we have to repeat the type to
135    declare __wcschr instead of using typeof, to avoid errors in C++
136    tests; in addition, __THROW cannot be used with a function type
137    from typeof in C++.  The same applies to __wmemchr and, as regards
138    __THROW, to __wcscmp and __wcscoll.  */
139 extern wchar_t *__wcschr (const wchar_t *__wcs, wchar_t __wc)
140      __THROW __attribute_pure__;
141 libc_hidden_proto (__wcschr)
142 extern int __wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
143 libc_hidden_proto (__wcscoll)
144 libc_hidden_proto (wcspbrk)
145 
146 extern __typeof (wmemset) __wmemset;
147 extern wchar_t *__wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
148      __THROW __attribute_pure__;
149 libc_hidden_proto (wmemchr)
150 libc_hidden_proto (__wmemchr)
151 libc_hidden_proto (wmemset)
152 libc_hidden_proto (__wmemset)
153 extern int __wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
154      __THROW __attribute_pure__;
155 
156 /* Now define the internal interfaces.  */
157 extern int __wcscasecmp (const wchar_t *__s1, const wchar_t *__s2)
158      __attribute_pure__;
159 extern int __wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
160 			  size_t __n)
161      __attribute_pure__;
162 extern size_t __wcslen (const wchar_t *__s) __attribute_pure__;
163 extern size_t __wcsnlen (const wchar_t *__s, size_t __maxlen)
164      __attribute_pure__;
165 extern wchar_t *__wcscat (wchar_t *dest, const wchar_t *src);
166 extern wint_t __btowc (int __c) attribute_hidden;
167 extern int __mbsinit (const __mbstate_t *__ps);
168 extern size_t __mbrtowc (wchar_t *__restrict __pwc,
169 			 const char *__restrict __s, size_t __n,
170 			 __mbstate_t *__restrict __p);
171 libc_hidden_proto (__mbrtowc)
172 libc_hidden_proto (__mbrlen)
173 extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc,
174 			 __mbstate_t *__restrict __ps) attribute_hidden;
175 extern size_t __mbsrtowcs (wchar_t *__restrict __dst,
176 			   const char **__restrict __src,
177 			   size_t __len, __mbstate_t *__restrict __ps)
178      attribute_hidden;
179 extern size_t __wcsrtombs (char *__restrict __dst,
180 			   const wchar_t **__restrict __src,
181 			   size_t __len, __mbstate_t *__restrict __ps)
182      attribute_hidden;
183 extern size_t __mbsnrtowcs (wchar_t *__restrict __dst,
184 			    const char **__restrict __src, size_t __nmc,
185 			    size_t __len, __mbstate_t *__restrict __ps)
186      attribute_hidden;
187 extern size_t __wcsnrtombs (char *__restrict __dst,
188 			    const wchar_t **__restrict __src,
189 			    size_t __nwc, size_t __len,
190 			    __mbstate_t *__restrict __ps)
191      attribute_hidden;
192 extern wchar_t *__wcscpy (wchar_t *__restrict __dest,
193 			  const wchar_t *__restrict __src)
194 			  attribute_hidden __nonnull ((1, 2));
195 libc_hidden_proto (__wcscpy)
196 extern wchar_t *__wcsncpy (wchar_t *__restrict __dest,
197 			   const wchar_t *__restrict __src, size_t __n);
198 extern wchar_t *__wcpcpy (wchar_t *__dest, const wchar_t *__src);
199 extern wchar_t *__wcpncpy (wchar_t *__dest, const wchar_t *__src,
200 			   size_t __n);
201 extern wchar_t *__wmemcpy (wchar_t *__s1, const wchar_t *s2,
202 			   size_t __n) attribute_hidden;
203 extern wchar_t *__wmempcpy (wchar_t *__restrict __s1,
204 			    const wchar_t *__restrict __s2,
205 			    size_t __n) attribute_hidden;
206 extern wchar_t *__wmemmove (wchar_t *__s1, const wchar_t *__s2,
207 			    size_t __n) attribute_hidden;
208 extern wchar_t *__wcschrnul (const wchar_t *__s, wchar_t __wc)
209      __attribute_pure__;
210 
211 extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
212 			       size_t __ns) __THROW;
213 
214 extern int __vfwscanf (__FILE *__restrict __s,
215 		       const wchar_t *__restrict __format,
216 		       __gnuc_va_list __arg)
217      attribute_hidden
218      /* __attribute__ ((__format__ (__wscanf__, 2, 0)) */;
219 extern int __fwprintf (__FILE *__restrict __s,
220 		       const wchar_t *__restrict __format, ...)
221      attribute_hidden
222      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
223 extern int __vfwprintf_chk (FILE *__restrict __s, int __flag,
224 			    const wchar_t *__restrict __format,
225 			    __gnuc_va_list __arg)
226      /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
227 extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
228 			    int __flag, size_t __s_len,
229 			    const wchar_t *__restrict __format,
230 			    __gnuc_va_list __arg)
231      /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
232 
233 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
234 			     const wchar_t *__restrict __format, ...);
235 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
236 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
237 			     const wchar_t *__restrict __format, ...)
238      __THROW;
239 extern int __isoc99_vfwscanf (__FILE *__restrict __s,
240 			      const wchar_t *__restrict __format,
241 			      __gnuc_va_list __arg);
242 extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
243 			     __gnuc_va_list __arg);
244 extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
245 			      const wchar_t *__restrict __format,
246 			      __gnuc_va_list __arg) __THROW;
247 libc_hidden_proto (__isoc99_vswscanf)
248 libc_hidden_proto (__isoc99_vfwscanf)
249 
250 /* Internal functions.  */
251 extern size_t __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len,
252 			     mbstate_t *ps, locale_t l) attribute_hidden;
253 
254 /* Special version.  We know that all uses of mbsinit inside the libc
255    have a non-NULL parameter.  And certainly we can access the
256    internals of the data structure directly.  */
257 #  define mbsinit(state) ((state)->__count == 0)
258 #  define __mbsinit(state) ((state)->__count == 0)
259 
260 # endif
261 #endif
262