]> git.ipfire.org Git - thirdparty/glibc.git/blame - include/wchar.h
manual: Remove '.info' suffix in manual names passed to @ref [BZ #32962].
[thirdparty/glibc.git] / include / wchar.h
CommitLineData
6796bc80 1#ifndef _WCHAR_H
86005fdb
PM
2
3/* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */
4# include <bits/floatn.h>
e2239af3 5# if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
86005fdb
PM
6# if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
7# pragma GCC system_header
8# endif
9# endif
10
199fc19d 11# include <wcsmbs/wchar.h>
31341567 12# ifndef _ISOMAC
509d1b68 13
45f39d45 14#include <bits/floatn.h>
04d85feb 15#include <bits/wchar2-decl.h>
64924422 16#include <stdbool.h>
45f39d45 17
da4cfe38
RM
18extern __typeof (wcscasecmp_l) __wcscasecmp_l;
19extern __typeof (wcsncasecmp_l) __wcsncasecmp_l;
20extern __typeof (wcscoll_l) __wcscoll_l;
21extern __typeof (wcsxfrm_l) __wcsxfrm_l;
22extern __typeof (wcstol_l) __wcstol_l;
23extern __typeof (wcstoul_l) __wcstoul_l;
24extern __typeof (wcstoll_l) __wcstoll_l;
25extern __typeof (wcstoull_l) __wcstoull_l;
26extern __typeof (wcstod_l) __wcstod_l;
27extern __typeof (wcstof_l) __wcstof_l;
28extern __typeof (wcstold_l) __wcstold_l;
29extern __typeof (wcsftime_l) __wcsftime_l;
773e305e
RM
30libc_hidden_proto (__wcstol_l)
31libc_hidden_proto (__wcstoul_l)
32libc_hidden_proto (__wcstoll_l)
33libc_hidden_proto (__wcstoull_l)
34libc_hidden_proto (__wcstod_l)
35libc_hidden_proto (__wcstof_l)
36libc_hidden_proto (__wcstold_l)
ee2a5ae8 37libc_hidden_proto (__wcsftime_l)
da4cfe38 38
64924422
JM
39extern __typeof (wcstol) __isoc23_wcstol __attribute_copy__ (wcstol);
40extern __typeof (wcstoul) __isoc23_wcstoul __attribute_copy__ (wcstoul);
41extern __typeof (wcstoll) __isoc23_wcstoll __attribute_copy__ (wcstoll);
42extern __typeof (wcstoull) __isoc23_wcstoull __attribute_copy__ (wcstoull);
43extern __typeof (wcstol_l) __isoc23_wcstol_l __attribute_copy__ (wcstol_l);
44extern __typeof (wcstoul_l) __isoc23_wcstoul_l __attribute_copy__ (wcstoul_l);
45extern __typeof (wcstoll_l) __isoc23_wcstoll_l __attribute_copy__ (wcstoll_l);
46extern __typeof (wcstoull_l) __isoc23_wcstoull_l __attribute_copy__ (wcstoull_l);
47libc_hidden_proto (__isoc23_wcstol)
48libc_hidden_proto (__isoc23_wcstoul)
49libc_hidden_proto (__isoc23_wcstoll)
50libc_hidden_proto (__isoc23_wcstoull)
51libc_hidden_proto (__isoc23_wcstol_l)
52libc_hidden_proto (__isoc23_wcstoul_l)
53libc_hidden_proto (__isoc23_wcstoll_l)
54libc_hidden_proto (__isoc23_wcstoull_l)
55
42cc619d
JM
56#if __GLIBC_USE (C23_STRTOL)
57/* Redirect internal uses of these functions to the C23 versions; the
64924422
JM
58 redirection in the installed header does not work with
59 libc_hidden_proto. */
60# undef wcstol
61# define wcstol __isoc23_wcstol
62# undef wcstoul
63# define wcstoul __isoc23_wcstoul
64# undef wcstoll
65# define wcstoll __isoc23_wcstoll
66# undef wcstoull
67# define wcstoull __isoc23_wcstoull
68# undef wcstol_l
69# define wcstol_l __isoc23_wcstol_l
70# undef wcstoul_l
71# define wcstoul_l __isoc23_wcstoul_l
72# undef wcstoll_l
73# define wcstoll_l __isoc23_wcstoll_l
74# undef wcstoull_l
75# define wcstoull_l __isoc23_wcstoull_l
76#endif
77
da4cfe38 78
a784e502 79extern double __wcstod_internal (const wchar_t *__restrict __nptr,
9b2e9577
UD
80 wchar_t **__restrict __endptr, int __group)
81 __THROW;
a784e502 82extern float __wcstof_internal (const wchar_t *__restrict __nptr,
9b2e9577
UD
83 wchar_t **__restrict __endptr, int __group)
84 __THROW;
a784e502 85extern long double __wcstold_internal (const wchar_t *__restrict __nptr,
9b2e9577
UD
86 wchar_t **__restrict __endptr,
87 int __group) __THROW;
a784e502 88extern long int __wcstol_internal (const wchar_t *__restrict __nptr,
9b2e9577
UD
89 wchar_t **__restrict __endptr,
90 int __base, int __group) __THROW;
a784e502 91extern unsigned long int __wcstoul_internal (const wchar_t *__restrict __npt,
9b2e9577
UD
92 wchar_t **__restrict __endptr,
93 int __base, int __group) __THROW;
94__extension__
a784e502 95extern long long int __wcstoll_internal (const wchar_t *__restrict __nptr,
9b2e9577
UD
96 wchar_t **__restrict __endptr,
97 int __base, int __group) __THROW;
98__extension__
a784e502 99extern unsigned long long int __wcstoull_internal (const wchar_t *
9b2e9577
UD
100 __restrict __nptr,
101 wchar_t **
102 __restrict __endptr,
103 int __base,
104 int __group) __THROW;
e02cabec
JM
105extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
106 wchar_t **, int, int,
64924422 107 bool, locale_t);
509d1b68
RM
108libc_hidden_proto (__wcstof_internal)
109libc_hidden_proto (__wcstod_internal)
110libc_hidden_proto (__wcstold_internal)
111libc_hidden_proto (__wcstol_internal)
112libc_hidden_proto (__wcstoll_internal)
113libc_hidden_proto (__wcstoul_internal)
114libc_hidden_proto (__wcstoull_internal)
773e305e
RM
115libc_hidden_proto (wcstof)
116libc_hidden_proto (wcstod)
45ae17dd 117libc_hidden_ldbl_proto (wcstold)
773e305e
RM
118libc_hidden_proto (wcstol)
119libc_hidden_proto (wcstoll)
120libc_hidden_proto (wcstoul)
121libc_hidden_proto (wcstoull)
509d1b68 122
c26dd7c6
L
123extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
124 locale_t) attribute_hidden;
125extern double ____wcstod_l_internal (const wchar_t *, wchar_t **, int,
126 locale_t) attribute_hidden;
127extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **,
128 int, locale_t) attribute_hidden;
129extern long int ____wcstol_l_internal (const wchar_t *, wchar_t **, int,
64924422 130 int, bool, locale_t) attribute_hidden;
c26dd7c6
L
131extern unsigned long int ____wcstoul_l_internal (const wchar_t *,
132 wchar_t **,
64924422 133 int, int, bool, locale_t)
c26dd7c6
L
134 attribute_hidden;
135extern long long int ____wcstoll_l_internal (const wchar_t *, wchar_t **,
64924422 136 int, int, bool, locale_t)
c26dd7c6
L
137 attribute_hidden;
138extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
139 wchar_t **, int, int,
64924422 140 bool, locale_t)
c26dd7c6
L
141 attribute_hidden;
142
45f39d45
PM
143#if __HAVE_DISTINCT_FLOAT128
144extern __typeof (wcstof128_l) __wcstof128_l;
145libc_hidden_proto (__wcstof128_l)
146extern _Float128 __wcstof128_internal (const wchar_t *__restrict __nptr,
147 wchar_t **__restrict __endptr,
148 int __group) __THROW;
149
c26dd7c6
L
150extern _Float128 ____wcstof128_l_internal (const wchar_t *, wchar_t **, int,
151 locale_t) attribute_hidden;
152
45f39d45
PM
153libc_hidden_proto (__wcstof128_internal)
154libc_hidden_proto (wcstof128)
155#endif
156
509d1b68
RM
157libc_hidden_proto (__wcscasecmp_l)
158libc_hidden_proto (__wcsncasecmp_l)
159
ccadf7b5
UD
160libc_hidden_proto (__wcscoll_l)
161libc_hidden_proto (__wcsxfrm_l)
162
3ba06713
UD
163libc_hidden_proto (fputws_unlocked)
164libc_hidden_proto (putwc_unlocked)
b9b91868 165libc_hidden_proto (putwc)
3ba06713 166
9b0b40d3 167libc_hidden_proto (mbrtowc)
8784cc18 168libc_hidden_proto (wcrtomb)
64f98575
FB
169libc_hidden_proto (__wcrtomb_chk)
170
2f44ee08
JM
171extern int __wcscmp (const wchar_t *__s1, const wchar_t *__s2)
172 __THROW __attribute_pure__;
173libc_hidden_proto (__wcscmp)
8784cc18
RM
174libc_hidden_proto (wcsftime)
175libc_hidden_proto (wcsspn)
176libc_hidden_proto (wcschr)
2cfbdb9a
JM
177/* The C++ overloading of wcschr means we have to repeat the type to
178 declare __wcschr instead of using typeof, to avoid errors in C++
2f44ee08
JM
179 tests; in addition, __THROW cannot be used with a function type
180 from typeof in C++. The same applies to __wmemchr and, as regards
181 __THROW, to __wcscmp and __wcscoll. */
2cfbdb9a
JM
182extern wchar_t *__wcschr (const wchar_t *__wcs, wchar_t __wc)
183 __THROW __attribute_pure__;
184libc_hidden_proto (__wcschr)
2f44ee08
JM
185extern int __wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
186libc_hidden_proto (__wcscoll)
8784cc18 187libc_hidden_proto (wcspbrk)
509d1b68 188
6b4a158e 189extern __typeof (wmemset) __wmemset;
aca6ea65
JM
190extern wchar_t *__wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
191 __THROW __attribute_pure__;
9b0b40d3 192libc_hidden_proto (wmemchr)
aca6ea65 193libc_hidden_proto (__wmemchr)
9b0b40d3 194libc_hidden_proto (wmemset)
01cad84e 195libc_hidden_proto (__wmemset)
65f7767a
AS
196extern int __wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
197 __THROW __attribute_pure__;
9b0b40d3 198
bdbf022d 199/* Now define the internal interfaces. */
a784e502 200extern int __wcscasecmp (const wchar_t *__s1, const wchar_t *__s2)
fb4dfa0c 201 __attribute_pure__;
a784e502 202extern int __wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
fb4dfa0c
AJ
203 size_t __n)
204 __attribute_pure__;
a784e502
UD
205extern size_t __wcslen (const wchar_t *__s) __attribute_pure__;
206extern size_t __wcsnlen (const wchar_t *__s, size_t __maxlen)
80eb52e3
SL
207 __attribute_pure__;
208extern wchar_t *__wcscat (wchar_t *dest, const wchar_t *src);
b54e5d1c
FW
209extern __typeof (wcslcat) __wcslcat;
210libc_hidden_proto (__wcslcat)
44af8a32 211extern wint_t __btowc (int __c) attribute_hidden;
a784e502 212extern int __mbsinit (const __mbstate_t *__ps);
fe559c5e 213extern size_t __mbrtowc (wchar_t *__restrict __pwc,
a784e502 214 const char *__restrict __s, size_t __n,
c19559b0 215 __mbstate_t *__restrict __p);
37ba7d66
UD
216libc_hidden_proto (__mbrtowc)
217libc_hidden_proto (__mbrlen)
fe559c5e 218extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc,
44af8a32 219 __mbstate_t *__restrict __ps) attribute_hidden;
9bcd12d2
SP
220extern size_t __wcrtomb_internal (char *__restrict __s, wchar_t __wc,
221 __mbstate_t *__restrict __ps,
222 size_t __s_size)
223 attribute_hidden;
fe559c5e 224extern size_t __mbsrtowcs (wchar_t *__restrict __dst,
a784e502 225 const char **__restrict __src,
44af8a32
L
226 size_t __len, __mbstate_t *__restrict __ps)
227 attribute_hidden;
fe559c5e 228extern size_t __wcsrtombs (char *__restrict __dst,
a784e502 229 const wchar_t **__restrict __src,
44af8a32
L
230 size_t __len, __mbstate_t *__restrict __ps)
231 attribute_hidden;
fe559c5e 232extern size_t __mbsnrtowcs (wchar_t *__restrict __dst,
a784e502 233 const char **__restrict __src, size_t __nmc,
44af8a32
L
234 size_t __len, __mbstate_t *__restrict __ps)
235 attribute_hidden;
fe559c5e 236extern size_t __wcsnrtombs (char *__restrict __dst,
a784e502 237 const wchar_t **__restrict __src,
fe559c5e 238 size_t __nwc, size_t __len,
44af8a32
L
239 __mbstate_t *__restrict __ps)
240 attribute_hidden;
81a14439
AZ
241extern wchar_t *__wcscpy (wchar_t *__restrict __dest,
242 const wchar_t *__restrict __src)
243 attribute_hidden __nonnull ((1, 2));
244libc_hidden_proto (__wcscpy)
b54e5d1c
FW
245extern __typeof (wcslcpy) __wcslcpy;
246libc_hidden_proto (__wcslcpy)
8215c9ec 247extern wchar_t *__wcsncpy (wchar_t *__restrict __dest,
80eb52e3 248 const wchar_t *__restrict __src, size_t __n);
b54e5d1c 249
a784e502
UD
250extern wchar_t *__wcpcpy (wchar_t *__dest, const wchar_t *__src);
251extern wchar_t *__wcpncpy (wchar_t *__dest, const wchar_t *__src,
80eb52e3 252 size_t __n);
a784e502 253extern wchar_t *__wmemcpy (wchar_t *__s1, const wchar_t *s2,
44af8a32 254 size_t __n) attribute_hidden;
fe559c5e 255extern wchar_t *__wmempcpy (wchar_t *__restrict __s1,
a784e502 256 const wchar_t *__restrict __s2,
44af8a32 257 size_t __n) attribute_hidden;
a784e502 258extern wchar_t *__wmemmove (wchar_t *__s1, const wchar_t *__s2,
44af8a32 259 size_t __n) attribute_hidden;
a784e502 260extern wchar_t *__wcschrnul (const wchar_t *__s, wchar_t __wc)
80eb52e3 261 __attribute_pure__;
d64b6ad0 262
ef9c4cb6
L
263extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
264 size_t __ns) __THROW;
64f98575 265libc_hidden_builtin_proto (__wmemset_chk)
ef9c4cb6 266
d1646309 267extern int __vfwscanf (__FILE *__restrict __s,
a784e502 268 const wchar_t *__restrict __format,
c19559b0 269 __gnuc_va_list __arg)
44af8a32 270 attribute_hidden
c19559b0 271 /* __attribute__ ((__format__ (__wscanf__, 2, 0)) */;
64f98575
FB
272
273extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
274 int __flag, size_t __s_len,
275 const wchar_t *__restrict __format, ...)
276 __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
277
51028f34 278extern int __fwprintf (__FILE *__restrict __s,
a784e502 279 const wchar_t *__restrict __format, ...)
44af8a32 280 attribute_hidden
c6251f03 281 /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
64f98575
FB
282extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
283 ...);
c6251f03
RM
284extern int __vfwprintf_chk (FILE *__restrict __s, int __flag,
285 const wchar_t *__restrict __format,
286 __gnuc_va_list __arg)
51028f34 287 /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
8215c9ec
UD
288extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
289 int __flag, size_t __s_len,
a784e502 290 const wchar_t *__restrict __format,
8215c9ec
UD
291 __gnuc_va_list __arg)
292 /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
64f98575
FB
293extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
294 const wchar_t *__restrict __format, ...);
295extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
296 __gnuc_va_list __ap);
8215c9ec 297
874aa523 298extern int __isoc99_fwscanf (__FILE *__restrict __stream,
a784e502
UD
299 const wchar_t *__restrict __format, ...);
300extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
301extern int __isoc99_swscanf (const wchar_t *__restrict __s,
302 const wchar_t *__restrict __format, ...)
874aa523
UD
303 __THROW;
304extern int __isoc99_vfwscanf (__FILE *__restrict __s,
a784e502 305 const wchar_t *__restrict __format,
874aa523 306 __gnuc_va_list __arg);
a784e502 307extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
874aa523 308 __gnuc_va_list __arg);
a784e502
UD
309extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
310 const wchar_t *__restrict __format,
874aa523 311 __gnuc_va_list __arg) __THROW;
dee2bea0
JM
312extern int __isoc23_fwscanf (__FILE *__restrict __stream,
313 const wchar_t *__restrict __format, ...);
314extern int __isoc23_wscanf (const wchar_t *__restrict __format, ...);
315extern int __isoc23_swscanf (const wchar_t *__restrict __s,
316 const wchar_t *__restrict __format, ...)
317 __THROW;
318extern int __isoc23_vfwscanf (__FILE *__restrict __s,
319 const wchar_t *__restrict __format,
320 __gnuc_va_list __arg);
321extern int __isoc23_vwscanf (const wchar_t *__restrict __format,
322 __gnuc_va_list __arg);
323extern int __isoc23_vswscanf (const wchar_t *__restrict __s,
324 const wchar_t *__restrict __format,
325 __gnuc_va_list __arg) __THROW;
874aa523
UD
326libc_hidden_proto (__isoc99_vswscanf)
327libc_hidden_proto (__isoc99_vfwscanf)
dee2bea0
JM
328libc_hidden_proto (__isoc23_vswscanf)
329libc_hidden_proto (__isoc23_vfwscanf)
874aa523 330
01beb5b9
UD
331/* Internal functions. */
332extern size_t __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len,
af85385f 333 mbstate_t *ps, locale_t l) attribute_hidden;
2def8764
UD
334
335/* Special version. We know that all uses of mbsinit inside the libc
336 have a non-NULL parameter. And certainly we can access the
337 internals of the data structure directly. */
338# define mbsinit(state) ((state)->__count == 0)
339# define __mbsinit(state) ((state)->__count == 0)
340
d64b6ad0 341# endif
6796bc80 342#endif