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 __wcrtomb_internal (char *__restrict __s, wchar_t __wc,
176 				  __mbstate_t *__restrict __ps,
177 				  size_t __s_size)
178      attribute_hidden;
179 extern size_t __mbsrtowcs (wchar_t *__restrict __dst,
180 			   const char **__restrict __src,
181 			   size_t __len, __mbstate_t *__restrict __ps)
182      attribute_hidden;
183 extern size_t __wcsrtombs (char *__restrict __dst,
184 			   const wchar_t **__restrict __src,
185 			   size_t __len, __mbstate_t *__restrict __ps)
186      attribute_hidden;
187 extern size_t __mbsnrtowcs (wchar_t *__restrict __dst,
188 			    const char **__restrict __src, size_t __nmc,
189 			    size_t __len, __mbstate_t *__restrict __ps)
190      attribute_hidden;
191 extern size_t __wcsnrtombs (char *__restrict __dst,
192 			    const wchar_t **__restrict __src,
193 			    size_t __nwc, size_t __len,
194 			    __mbstate_t *__restrict __ps)
195      attribute_hidden;
196 extern wchar_t *__wcscpy (wchar_t *__restrict __dest,
197 			  const wchar_t *__restrict __src)
198 			  attribute_hidden __nonnull ((1, 2));
199 libc_hidden_proto (__wcscpy)
200 extern wchar_t *__wcsncpy (wchar_t *__restrict __dest,
201 			   const wchar_t *__restrict __src, size_t __n);
202 extern wchar_t *__wcpcpy (wchar_t *__dest, const wchar_t *__src);
203 extern wchar_t *__wcpncpy (wchar_t *__dest, const wchar_t *__src,
204 			   size_t __n);
205 extern wchar_t *__wmemcpy (wchar_t *__s1, const wchar_t *s2,
206 			   size_t __n) attribute_hidden;
207 extern wchar_t *__wmempcpy (wchar_t *__restrict __s1,
208 			    const wchar_t *__restrict __s2,
209 			    size_t __n) attribute_hidden;
210 extern wchar_t *__wmemmove (wchar_t *__s1, const wchar_t *__s2,
211 			    size_t __n) attribute_hidden;
212 extern wchar_t *__wcschrnul (const wchar_t *__s, wchar_t __wc)
213      __attribute_pure__;
214 
215 extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
216 			       size_t __ns) __THROW;
217 
218 extern int __vfwscanf (__FILE *__restrict __s,
219 		       const wchar_t *__restrict __format,
220 		       __gnuc_va_list __arg)
221      attribute_hidden
222      /* __attribute__ ((__format__ (__wscanf__, 2, 0)) */;
223 extern int __fwprintf (__FILE *__restrict __s,
224 		       const wchar_t *__restrict __format, ...)
225      attribute_hidden
226      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
227 extern int __vfwprintf_chk (FILE *__restrict __s, int __flag,
228 			    const wchar_t *__restrict __format,
229 			    __gnuc_va_list __arg)
230      /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
231 extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
232 			    int __flag, size_t __s_len,
233 			    const wchar_t *__restrict __format,
234 			    __gnuc_va_list __arg)
235      /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
236 
237 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
238 			     const wchar_t *__restrict __format, ...);
239 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
240 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
241 			     const wchar_t *__restrict __format, ...)
242      __THROW;
243 extern int __isoc99_vfwscanf (__FILE *__restrict __s,
244 			      const wchar_t *__restrict __format,
245 			      __gnuc_va_list __arg);
246 extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
247 			     __gnuc_va_list __arg);
248 extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
249 			      const wchar_t *__restrict __format,
250 			      __gnuc_va_list __arg) __THROW;
251 libc_hidden_proto (__isoc99_vswscanf)
252 libc_hidden_proto (__isoc99_vfwscanf)
253 
254 /* Internal functions.  */
255 extern size_t __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len,
256 			     mbstate_t *ps, locale_t l) attribute_hidden;
257 
258 /* Special version.  We know that all uses of mbsinit inside the libc
259    have a non-NULL parameter.  And certainly we can access the
260    internals of the data structure directly.  */
261 #  define mbsinit(state) ((state)->__count == 0)
262 #  define __mbsinit(state) ((state)->__count == 0)
263 
264 # endif
265 #endif
266