misc: Reformat Makefile.
[glibc.git] / include / wchar.h
blobfafe7c8e9bba53ea3068347bc5ad5bb718a12173
1 #ifndef _WCHAR_H
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
11 # include <wcsmbs/wchar.h>
12 # ifndef _ISOMAC
14 #include <bits/floatn.h>
15 #include <stdbool.h>
17 extern __typeof (wcscasecmp_l) __wcscasecmp_l;
18 extern __typeof (wcsncasecmp_l) __wcsncasecmp_l;
19 extern __typeof (wcscoll_l) __wcscoll_l;
20 extern __typeof (wcsxfrm_l) __wcsxfrm_l;
21 extern __typeof (wcstol_l) __wcstol_l;
22 extern __typeof (wcstoul_l) __wcstoul_l;
23 extern __typeof (wcstoll_l) __wcstoll_l;
24 extern __typeof (wcstoull_l) __wcstoull_l;
25 extern __typeof (wcstod_l) __wcstod_l;
26 extern __typeof (wcstof_l) __wcstof_l;
27 extern __typeof (wcstold_l) __wcstold_l;
28 extern __typeof (wcsftime_l) __wcsftime_l;
29 libc_hidden_proto (__wcstol_l)
30 libc_hidden_proto (__wcstoul_l)
31 libc_hidden_proto (__wcstoll_l)
32 libc_hidden_proto (__wcstoull_l)
33 libc_hidden_proto (__wcstod_l)
34 libc_hidden_proto (__wcstof_l)
35 libc_hidden_proto (__wcstold_l)
36 libc_hidden_proto (__wcsftime_l)
38 extern __typeof (wcstol) __isoc23_wcstol __attribute_copy__ (wcstol);
39 extern __typeof (wcstoul) __isoc23_wcstoul __attribute_copy__ (wcstoul);
40 extern __typeof (wcstoll) __isoc23_wcstoll __attribute_copy__ (wcstoll);
41 extern __typeof (wcstoull) __isoc23_wcstoull __attribute_copy__ (wcstoull);
42 extern __typeof (wcstol_l) __isoc23_wcstol_l __attribute_copy__ (wcstol_l);
43 extern __typeof (wcstoul_l) __isoc23_wcstoul_l __attribute_copy__ (wcstoul_l);
44 extern __typeof (wcstoll_l) __isoc23_wcstoll_l __attribute_copy__ (wcstoll_l);
45 extern __typeof (wcstoull_l) __isoc23_wcstoull_l __attribute_copy__ (wcstoull_l);
46 libc_hidden_proto (__isoc23_wcstol)
47 libc_hidden_proto (__isoc23_wcstoul)
48 libc_hidden_proto (__isoc23_wcstoll)
49 libc_hidden_proto (__isoc23_wcstoull)
50 libc_hidden_proto (__isoc23_wcstol_l)
51 libc_hidden_proto (__isoc23_wcstoul_l)
52 libc_hidden_proto (__isoc23_wcstoll_l)
53 libc_hidden_proto (__isoc23_wcstoull_l)
55 #if __GLIBC_USE (C2X_STRTOL)
56 /* Redirect internal uses of these functions to the C2X versions; the
57 redirection in the installed header does not work with
58 libc_hidden_proto. */
59 # undef wcstol
60 # define wcstol __isoc23_wcstol
61 # undef wcstoul
62 # define wcstoul __isoc23_wcstoul
63 # undef wcstoll
64 # define wcstoll __isoc23_wcstoll
65 # undef wcstoull
66 # define wcstoull __isoc23_wcstoull
67 # undef wcstol_l
68 # define wcstol_l __isoc23_wcstol_l
69 # undef wcstoul_l
70 # define wcstoul_l __isoc23_wcstoul_l
71 # undef wcstoll_l
72 # define wcstoll_l __isoc23_wcstoll_l
73 # undef wcstoull_l
74 # define wcstoull_l __isoc23_wcstoull_l
75 #endif
78 extern double __wcstod_internal (const wchar_t *__restrict __nptr,
79 wchar_t **__restrict __endptr, int __group)
80 __THROW;
81 extern float __wcstof_internal (const wchar_t *__restrict __nptr,
82 wchar_t **__restrict __endptr, int __group)
83 __THROW;
84 extern long double __wcstold_internal (const wchar_t *__restrict __nptr,
85 wchar_t **__restrict __endptr,
86 int __group) __THROW;
87 extern long int __wcstol_internal (const wchar_t *__restrict __nptr,
88 wchar_t **__restrict __endptr,
89 int __base, int __group) __THROW;
90 extern unsigned long int __wcstoul_internal (const wchar_t *__restrict __npt,
91 wchar_t **__restrict __endptr,
92 int __base, int __group) __THROW;
93 __extension__
94 extern long long int __wcstoll_internal (const wchar_t *__restrict __nptr,
95 wchar_t **__restrict __endptr,
96 int __base, int __group) __THROW;
97 __extension__
98 extern unsigned long long int __wcstoull_internal (const wchar_t *
99 __restrict __nptr,
100 wchar_t **
101 __restrict __endptr,
102 int __base,
103 int __group) __THROW;
104 extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
105 wchar_t **, int, int,
106 bool, locale_t);
107 libc_hidden_proto (__wcstof_internal)
108 libc_hidden_proto (__wcstod_internal)
109 libc_hidden_proto (__wcstold_internal)
110 libc_hidden_proto (__wcstol_internal)
111 libc_hidden_proto (__wcstoll_internal)
112 libc_hidden_proto (__wcstoul_internal)
113 libc_hidden_proto (__wcstoull_internal)
114 libc_hidden_proto (wcstof)
115 libc_hidden_proto (wcstod)
116 libc_hidden_ldbl_proto (wcstold)
117 libc_hidden_proto (wcstol)
118 libc_hidden_proto (wcstoll)
119 libc_hidden_proto (wcstoul)
120 libc_hidden_proto (wcstoull)
122 extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
123 locale_t) attribute_hidden;
124 extern double ____wcstod_l_internal (const wchar_t *, wchar_t **, int,
125 locale_t) attribute_hidden;
126 extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **,
127 int, locale_t) attribute_hidden;
128 extern long int ____wcstol_l_internal (const wchar_t *, wchar_t **, int,
129 int, bool, locale_t) attribute_hidden;
130 extern unsigned long int ____wcstoul_l_internal (const wchar_t *,
131 wchar_t **,
132 int, int, bool, locale_t)
133 attribute_hidden;
134 extern long long int ____wcstoll_l_internal (const wchar_t *, wchar_t **,
135 int, int, bool, locale_t)
136 attribute_hidden;
137 extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
138 wchar_t **, int, int,
139 bool, locale_t)
140 attribute_hidden;
142 #if __HAVE_DISTINCT_FLOAT128
143 extern __typeof (wcstof128_l) __wcstof128_l;
144 libc_hidden_proto (__wcstof128_l)
145 extern _Float128 __wcstof128_internal (const wchar_t *__restrict __nptr,
146 wchar_t **__restrict __endptr,
147 int __group) __THROW;
149 extern _Float128 ____wcstof128_l_internal (const wchar_t *, wchar_t **, int,
150 locale_t) attribute_hidden;
152 libc_hidden_proto (__wcstof128_internal)
153 libc_hidden_proto (wcstof128)
154 #endif
156 libc_hidden_proto (__wcscasecmp_l)
157 libc_hidden_proto (__wcsncasecmp_l)
159 libc_hidden_proto (__wcscoll_l)
160 libc_hidden_proto (__wcsxfrm_l)
162 libc_hidden_proto (fputws_unlocked)
163 libc_hidden_proto (putwc_unlocked)
164 libc_hidden_proto (putwc)
166 libc_hidden_proto (mbrtowc)
167 libc_hidden_proto (wcrtomb)
168 extern int __wcscmp (const wchar_t *__s1, const wchar_t *__s2)
169 __THROW __attribute_pure__;
170 libc_hidden_proto (__wcscmp)
171 libc_hidden_proto (wcsftime)
172 libc_hidden_proto (wcsspn)
173 libc_hidden_proto (wcschr)
174 /* The C++ overloading of wcschr means we have to repeat the type to
175 declare __wcschr instead of using typeof, to avoid errors in C++
176 tests; in addition, __THROW cannot be used with a function type
177 from typeof in C++. The same applies to __wmemchr and, as regards
178 __THROW, to __wcscmp and __wcscoll. */
179 extern wchar_t *__wcschr (const wchar_t *__wcs, wchar_t __wc)
180 __THROW __attribute_pure__;
181 libc_hidden_proto (__wcschr)
182 extern int __wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
183 libc_hidden_proto (__wcscoll)
184 libc_hidden_proto (wcspbrk)
186 extern __typeof (wmemset) __wmemset;
187 extern wchar_t *__wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
188 __THROW __attribute_pure__;
189 libc_hidden_proto (wmemchr)
190 libc_hidden_proto (__wmemchr)
191 libc_hidden_proto (wmemset)
192 libc_hidden_proto (__wmemset)
193 extern int __wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
194 __THROW __attribute_pure__;
196 /* Now define the internal interfaces. */
197 extern int __wcscasecmp (const wchar_t *__s1, const wchar_t *__s2)
198 __attribute_pure__;
199 extern int __wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
200 size_t __n)
201 __attribute_pure__;
202 extern size_t __wcslen (const wchar_t *__s) __attribute_pure__;
203 extern size_t __wcsnlen (const wchar_t *__s, size_t __maxlen)
204 __attribute_pure__;
205 extern wchar_t *__wcscat (wchar_t *dest, const wchar_t *src);
206 extern wint_t __btowc (int __c) attribute_hidden;
207 extern int __mbsinit (const __mbstate_t *__ps);
208 extern size_t __mbrtowc (wchar_t *__restrict __pwc,
209 const char *__restrict __s, size_t __n,
210 __mbstate_t *__restrict __p);
211 libc_hidden_proto (__mbrtowc)
212 libc_hidden_proto (__mbrlen)
213 extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc,
214 __mbstate_t *__restrict __ps) attribute_hidden;
215 extern size_t __wcrtomb_internal (char *__restrict __s, wchar_t __wc,
216 __mbstate_t *__restrict __ps,
217 size_t __s_size)
218 attribute_hidden;
219 extern size_t __mbsrtowcs (wchar_t *__restrict __dst,
220 const char **__restrict __src,
221 size_t __len, __mbstate_t *__restrict __ps)
222 attribute_hidden;
223 extern size_t __wcsrtombs (char *__restrict __dst,
224 const wchar_t **__restrict __src,
225 size_t __len, __mbstate_t *__restrict __ps)
226 attribute_hidden;
227 extern size_t __mbsnrtowcs (wchar_t *__restrict __dst,
228 const char **__restrict __src, size_t __nmc,
229 size_t __len, __mbstate_t *__restrict __ps)
230 attribute_hidden;
231 extern size_t __wcsnrtombs (char *__restrict __dst,
232 const wchar_t **__restrict __src,
233 size_t __nwc, size_t __len,
234 __mbstate_t *__restrict __ps)
235 attribute_hidden;
236 extern wchar_t *__wcscpy (wchar_t *__restrict __dest,
237 const wchar_t *__restrict __src)
238 attribute_hidden __nonnull ((1, 2));
239 libc_hidden_proto (__wcscpy)
240 extern wchar_t *__wcsncpy (wchar_t *__restrict __dest,
241 const wchar_t *__restrict __src, size_t __n);
242 extern wchar_t *__wcpcpy (wchar_t *__dest, const wchar_t *__src);
243 extern wchar_t *__wcpncpy (wchar_t *__dest, const wchar_t *__src,
244 size_t __n);
245 extern wchar_t *__wmemcpy (wchar_t *__s1, const wchar_t *s2,
246 size_t __n) attribute_hidden;
247 extern wchar_t *__wmempcpy (wchar_t *__restrict __s1,
248 const wchar_t *__restrict __s2,
249 size_t __n) attribute_hidden;
250 extern wchar_t *__wmemmove (wchar_t *__s1, const wchar_t *__s2,
251 size_t __n) attribute_hidden;
252 extern wchar_t *__wcschrnul (const wchar_t *__s, wchar_t __wc)
253 __attribute_pure__;
255 extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
256 size_t __ns) __THROW;
258 extern int __vfwscanf (__FILE *__restrict __s,
259 const wchar_t *__restrict __format,
260 __gnuc_va_list __arg)
261 attribute_hidden
262 /* __attribute__ ((__format__ (__wscanf__, 2, 0)) */;
263 extern int __fwprintf (__FILE *__restrict __s,
264 const wchar_t *__restrict __format, ...)
265 attribute_hidden
266 /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
267 extern int __vfwprintf_chk (FILE *__restrict __s, int __flag,
268 const wchar_t *__restrict __format,
269 __gnuc_va_list __arg)
270 /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
271 extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
272 int __flag, size_t __s_len,
273 const wchar_t *__restrict __format,
274 __gnuc_va_list __arg)
275 /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
277 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
278 const wchar_t *__restrict __format, ...);
279 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
280 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
281 const wchar_t *__restrict __format, ...)
282 __THROW;
283 extern int __isoc99_vfwscanf (__FILE *__restrict __s,
284 const wchar_t *__restrict __format,
285 __gnuc_va_list __arg);
286 extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
287 __gnuc_va_list __arg);
288 extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
289 const wchar_t *__restrict __format,
290 __gnuc_va_list __arg) __THROW;
291 extern int __isoc23_fwscanf (__FILE *__restrict __stream,
292 const wchar_t *__restrict __format, ...);
293 extern int __isoc23_wscanf (const wchar_t *__restrict __format, ...);
294 extern int __isoc23_swscanf (const wchar_t *__restrict __s,
295 const wchar_t *__restrict __format, ...)
296 __THROW;
297 extern int __isoc23_vfwscanf (__FILE *__restrict __s,
298 const wchar_t *__restrict __format,
299 __gnuc_va_list __arg);
300 extern int __isoc23_vwscanf (const wchar_t *__restrict __format,
301 __gnuc_va_list __arg);
302 extern int __isoc23_vswscanf (const wchar_t *__restrict __s,
303 const wchar_t *__restrict __format,
304 __gnuc_va_list __arg) __THROW;
305 libc_hidden_proto (__isoc99_vswscanf)
306 libc_hidden_proto (__isoc99_vfwscanf)
307 libc_hidden_proto (__isoc23_vswscanf)
308 libc_hidden_proto (__isoc23_vfwscanf)
310 /* Internal functions. */
311 extern size_t __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len,
312 mbstate_t *ps, locale_t l) attribute_hidden;
314 /* Special version. We know that all uses of mbsinit inside the libc
315 have a non-NULL parameter. And certainly we can access the
316 internals of the data structure directly. */
317 # define mbsinit(state) ((state)->__count == 0)
318 # define __mbsinit(state) ((state)->__count == 0)
320 # endif
321 #endif