1 | /* Copyright (C) 1995-2024 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. |
3 | |
4 | The GNU C Library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2.1 of the License, or (at your option) any later version. |
8 | |
9 | The GNU C Library 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 GNU |
12 | Lesser General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Lesser General Public |
15 | License along with the GNU C Library; if not, see |
16 | <https://www.gnu.org/licenses/>. */ |
17 | |
18 | /* |
19 | * ISO C99 Standard: 7.24 |
20 | * Extended multibyte and wide character utilities <wchar.h> |
21 | */ |
22 | |
23 | #ifndef _WCHAR_H |
24 | #define _WCHAR_H 1 |
25 | |
26 | #define |
27 | #include <bits/libc-header-start.h> |
28 | |
29 | /* Gather machine dependent type support. */ |
30 | #include <bits/floatn.h> |
31 | |
32 | #define __need_size_t |
33 | #define __need_wchar_t |
34 | #define __need_NULL |
35 | #include <stddef.h> |
36 | |
37 | #define __need___va_list |
38 | #include <stdarg.h> |
39 | |
40 | #if defined __USE_XOPEN2K || defined __USE_XOPEN2K8 |
41 | # ifdef __GNUC__ |
42 | # ifndef _VA_LIST_DEFINED |
43 | typedef __gnuc_va_list va_list; |
44 | # define _VA_LIST_DEFINED |
45 | # endif |
46 | # else |
47 | # include <stdarg.h> |
48 | # endif |
49 | #endif |
50 | |
51 | #include <bits/wchar.h> |
52 | #include <bits/types/wint_t.h> |
53 | #include <bits/types/mbstate_t.h> |
54 | #include <bits/types/__FILE.h> |
55 | |
56 | #if defined __USE_UNIX98 || defined __USE_XOPEN2K |
57 | # include <bits/types/FILE.h> |
58 | #endif |
59 | #ifdef __USE_XOPEN2K8 |
60 | # include <bits/types/locale_t.h> |
61 | #endif |
62 | |
63 | /* Tell the caller that we provide correct C++ prototypes. */ |
64 | #if defined __cplusplus && __GNUC_PREREQ (4, 4) |
65 | # define __CORRECT_ISO_CPP_WCHAR_H_PROTO |
66 | #endif |
67 | |
68 | #ifndef WCHAR_MIN |
69 | /* These constants might also be defined in <inttypes.h>. */ |
70 | # define WCHAR_MIN __WCHAR_MIN |
71 | # define WCHAR_MAX __WCHAR_MAX |
72 | #endif |
73 | |
74 | #ifndef WEOF |
75 | # define WEOF (0xffffffffu) |
76 | #endif |
77 | |
78 | /* All versions of XPG prior to the publication of ISO C99 required |
79 | the bulk of <wctype.h>'s declarations to appear in this header |
80 | (because <wctype.h> did not exist prior to C99). In POSIX.1-2001 |
81 | those declarations were marked as XSI extensions; in -2008 they |
82 | were additionally marked as obsolescent. _GNU_SOURCE mode |
83 | anticipates the removal of these declarations in the next revision |
84 | of POSIX. */ |
85 | #if (defined __USE_XOPEN && !defined __USE_GNU \ |
86 | && !(defined __USE_XOPEN2K && !defined __USE_XOPEN2KXSI)) |
87 | # include <bits/wctype-wchar.h> |
88 | #endif |
89 | |
90 | __BEGIN_DECLS |
91 | |
92 | /* This incomplete type is defined in <time.h> but needed here because |
93 | of `wcsftime'. */ |
94 | struct tm; |
95 | |
96 | |
97 | /* Copy SRC to DEST. */ |
98 | extern wchar_t *wcscpy (wchar_t *__restrict __dest, |
99 | const wchar_t *__restrict __src) |
100 | __THROW __nonnull ((1, 2)); |
101 | |
102 | /* Copy no more than N wide-characters of SRC to DEST. */ |
103 | extern wchar_t *wcsncpy (wchar_t *__restrict __dest, |
104 | const wchar_t *__restrict __src, size_t __n) |
105 | __THROW __nonnull ((1, 2)); |
106 | |
107 | #ifdef __USE_MISC |
108 | /* Copy at most N - 1 characters from SRC to DEST. */ |
109 | extern size_t wcslcpy (wchar_t *__restrict __dest, |
110 | const wchar_t *__restrict __src, size_t __n) |
111 | __THROW __nonnull ((1, 2)) __attr_access ((__write_only__, 1, 3)); |
112 | |
113 | /* Append SRC to DEST, possibly with truncation to keep the total size |
114 | below N. */ |
115 | extern size_t wcslcat (wchar_t *__restrict __dest, |
116 | const wchar_t *__restrict __src, size_t __n) |
117 | __THROW __nonnull ((1, 2)) __attr_access ((__read_write__, 1, 3)); |
118 | #endif |
119 | |
120 | /* Append SRC onto DEST. */ |
121 | extern wchar_t *wcscat (wchar_t *__restrict __dest, |
122 | const wchar_t *__restrict __src) |
123 | __THROW __nonnull ((1, 2)); |
124 | /* Append no more than N wide-characters of SRC onto DEST. */ |
125 | extern wchar_t *wcsncat (wchar_t *__restrict __dest, |
126 | const wchar_t *__restrict __src, size_t __n) |
127 | __THROW __nonnull ((1, 2)); |
128 | |
129 | /* Compare S1 and S2. */ |
130 | extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2) |
131 | __THROW __attribute_pure__ __nonnull ((1, 2)); |
132 | /* Compare N wide-characters of S1 and S2. */ |
133 | extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) |
134 | __THROW __attribute_pure__ __nonnull ((1, 2)); |
135 | |
136 | #ifdef __USE_XOPEN2K8 |
137 | /* Compare S1 and S2, ignoring case. */ |
138 | extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) __THROW; |
139 | |
140 | /* Compare no more than N chars of S1 and S2, ignoring case. */ |
141 | extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2, |
142 | size_t __n) __THROW; |
143 | |
144 | /* Similar to the two functions above but take the information from |
145 | the provided locale and not the global locale. */ |
146 | extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2, |
147 | locale_t __loc) __THROW; |
148 | |
149 | extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2, |
150 | size_t __n, locale_t __loc) __THROW; |
151 | #endif |
152 | |
153 | /* Compare S1 and S2, both interpreted as appropriate to the |
154 | LC_COLLATE category of the current locale. */ |
155 | extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW; |
156 | /* Transform S2 into array pointed to by S1 such that if wcscmp is |
157 | applied to two transformed strings the result is the as applying |
158 | `wcscoll' to the original strings. */ |
159 | extern size_t wcsxfrm (wchar_t *__restrict __s1, |
160 | const wchar_t *__restrict __s2, size_t __n) __THROW; |
161 | |
162 | #ifdef __USE_XOPEN2K8 |
163 | /* Similar to the two functions above but take the information from |
164 | the provided locale and not the global locale. */ |
165 | |
166 | /* Compare S1 and S2, both interpreted as appropriate to the |
167 | LC_COLLATE category of the given locale. */ |
168 | extern int wcscoll_l (const wchar_t *__s1, const wchar_t *__s2, |
169 | locale_t __loc) __THROW; |
170 | |
171 | /* Transform S2 into array pointed to by S1 such that if wcscmp is |
172 | applied to two transformed strings the result is the as applying |
173 | `wcscoll' to the original strings. */ |
174 | extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2, |
175 | size_t __n, locale_t __loc) __THROW; |
176 | |
177 | /* Duplicate S, returning an identical malloc'd string. */ |
178 | extern wchar_t *wcsdup (const wchar_t *__s) __THROW |
179 | __attribute_malloc__ __attr_dealloc_free; |
180 | #endif |
181 | |
182 | /* Find the first occurrence of WC in WCS. */ |
183 | #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO |
184 | extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc) |
185 | __THROW __asm ("wcschr" ) __attribute_pure__; |
186 | extern "C++" const wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc) |
187 | __THROW __asm ("wcschr" ) __attribute_pure__; |
188 | #else |
189 | extern wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc) |
190 | __THROW __attribute_pure__; |
191 | #endif |
192 | /* Find the last occurrence of WC in WCS. */ |
193 | #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO |
194 | extern "C++" wchar_t *wcsrchr (wchar_t *__wcs, wchar_t __wc) |
195 | __THROW __asm ("wcsrchr" ) __attribute_pure__; |
196 | extern "C++" const wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc) |
197 | __THROW __asm ("wcsrchr" ) __attribute_pure__; |
198 | #else |
199 | extern wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc) |
200 | __THROW __attribute_pure__; |
201 | #endif |
202 | |
203 | #ifdef __USE_GNU |
204 | /* This function is similar to `wcschr'. But it returns a pointer to |
205 | the closing NUL wide character in case C is not found in S. */ |
206 | extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc) |
207 | __THROW __attribute_pure__; |
208 | #endif |
209 | |
210 | /* Return the length of the initial segmet of WCS which |
211 | consists entirely of wide characters not in REJECT. */ |
212 | extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject) |
213 | __THROW __attribute_pure__; |
214 | /* Return the length of the initial segmet of WCS which |
215 | consists entirely of wide characters in ACCEPT. */ |
216 | extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept) |
217 | __THROW __attribute_pure__; |
218 | /* Find the first occurrence in WCS of any character in ACCEPT. */ |
219 | #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO |
220 | extern "C++" wchar_t *wcspbrk (wchar_t *__wcs, const wchar_t *__accept) |
221 | __THROW __asm ("wcspbrk" ) __attribute_pure__; |
222 | extern "C++" const wchar_t *wcspbrk (const wchar_t *__wcs, |
223 | const wchar_t *__accept) |
224 | __THROW __asm ("wcspbrk" ) __attribute_pure__; |
225 | #else |
226 | extern wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept) |
227 | __THROW __attribute_pure__; |
228 | #endif |
229 | /* Find the first occurrence of NEEDLE in HAYSTACK. */ |
230 | #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO |
231 | extern "C++" wchar_t *wcsstr (wchar_t *__haystack, const wchar_t *__needle) |
232 | __THROW __asm ("wcsstr" ) __attribute_pure__; |
233 | extern "C++" const wchar_t *wcsstr (const wchar_t *__haystack, |
234 | const wchar_t *__needle) |
235 | __THROW __asm ("wcsstr" ) __attribute_pure__; |
236 | #else |
237 | extern wchar_t *wcsstr (const wchar_t *__haystack, const wchar_t *__needle) |
238 | __THROW __attribute_pure__; |
239 | #endif |
240 | |
241 | /* Divide WCS into tokens separated by characters in DELIM. */ |
242 | extern wchar_t *wcstok (wchar_t *__restrict __s, |
243 | const wchar_t *__restrict __delim, |
244 | wchar_t **__restrict __ptr) __THROW; |
245 | |
246 | /* Return the number of wide characters in S. */ |
247 | extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__; |
248 | |
249 | #ifdef __USE_XOPEN |
250 | /* Another name for `wcsstr' from XPG4. */ |
251 | # ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO |
252 | extern "C++" wchar_t *wcswcs (wchar_t *__haystack, const wchar_t *__needle) |
253 | __THROW __asm ("wcswcs" ) __attribute_pure__; |
254 | extern "C++" const wchar_t *wcswcs (const wchar_t *__haystack, |
255 | const wchar_t *__needle) |
256 | __THROW __asm ("wcswcs" ) __attribute_pure__; |
257 | # else |
258 | extern wchar_t *wcswcs (const wchar_t *__haystack, const wchar_t *__needle) |
259 | __THROW __attribute_pure__; |
260 | # endif |
261 | #endif |
262 | |
263 | #ifdef __USE_XOPEN2K8 |
264 | /* Return the number of wide characters in S, but at most MAXLEN. */ |
265 | extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen) |
266 | __THROW __attribute_pure__; |
267 | #endif |
268 | |
269 | |
270 | /* Search N wide characters of S for C. */ |
271 | #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO |
272 | extern "C++" wchar_t *wmemchr (wchar_t *__s, wchar_t __c, size_t __n) |
273 | __THROW __asm ("wmemchr" ) __attribute_pure__; |
274 | extern "C++" const wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, |
275 | size_t __n) |
276 | __THROW __asm ("wmemchr" ) __attribute_pure__; |
277 | #else |
278 | extern wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n) |
279 | __THROW __attribute_pure__; |
280 | #endif |
281 | |
282 | /* Compare N wide characters of S1 and S2. */ |
283 | extern int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) |
284 | __THROW __attribute_pure__; |
285 | |
286 | /* Copy N wide characters of SRC to DEST. */ |
287 | extern wchar_t *wmemcpy (wchar_t *__restrict __s1, |
288 | const wchar_t *__restrict __s2, size_t __n) __THROW; |
289 | |
290 | /* Copy N wide characters of SRC to DEST, guaranteeing |
291 | correct behavior for overlapping strings. */ |
292 | extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n) |
293 | __THROW; |
294 | |
295 | /* Set N wide characters of S to C. */ |
296 | extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW; |
297 | |
298 | #ifdef __USE_GNU |
299 | /* Copy N wide characters of SRC to DEST and return pointer to following |
300 | wide character. */ |
301 | extern wchar_t *wmempcpy (wchar_t *__restrict __s1, |
302 | const wchar_t *__restrict __s2, size_t __n) |
303 | __THROW; |
304 | #endif |
305 | |
306 | |
307 | /* Determine whether C constitutes a valid (one-byte) multibyte |
308 | character. */ |
309 | extern wint_t btowc (int __c) __THROW; |
310 | |
311 | /* Determine whether C corresponds to a member of the extended |
312 | character set whose multibyte representation is a single byte. */ |
313 | extern int wctob (wint_t __c) __THROW; |
314 | |
315 | /* Determine whether PS points to an object representing the initial |
316 | state. */ |
317 | extern int mbsinit (const mbstate_t *__ps) __THROW __attribute_pure__; |
318 | |
319 | /* Write wide character representation of multibyte character pointed |
320 | to by S to PWC. */ |
321 | extern size_t mbrtowc (wchar_t *__restrict __pwc, |
322 | const char *__restrict __s, size_t __n, |
323 | mbstate_t *__restrict __p) __THROW; |
324 | |
325 | /* Write multibyte representation of wide character WC to S. */ |
326 | extern size_t wcrtomb (char *__restrict __s, wchar_t __wc, |
327 | mbstate_t *__restrict __ps) __THROW; |
328 | |
329 | /* Return number of bytes in multibyte character pointed to by S. */ |
330 | extern size_t __mbrlen (const char *__restrict __s, size_t __n, |
331 | mbstate_t *__restrict __ps) __THROW; |
332 | extern size_t mbrlen (const char *__restrict __s, size_t __n, |
333 | mbstate_t *__restrict __ps) __THROW; |
334 | |
335 | #ifdef __USE_EXTERN_INLINES |
336 | /* Define inline function as optimization. */ |
337 | |
338 | /* We can use the BTOWC and WCTOB optimizations since we know that all |
339 | locales must use ASCII encoding for the values in the ASCII range |
340 | and because the wchar_t encoding is always ISO 10646. */ |
341 | extern wint_t __btowc_alias (int __c) __asm ("btowc" ); |
342 | __extern_inline wint_t |
343 | __NTH (btowc (int __c)) |
344 | { return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f' |
345 | ? (wint_t) __c : __btowc_alias (__c)); } |
346 | |
347 | extern int __wctob_alias (wint_t __c) __asm ("wctob" ); |
348 | __extern_inline int |
349 | __NTH (wctob (wint_t __wc)) |
350 | { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f' |
351 | ? (int) __wc : __wctob_alias (__wc)); } |
352 | |
353 | __extern_inline size_t |
354 | __NTH (mbrlen (const char *__restrict __s, size_t __n, |
355 | mbstate_t *__restrict __ps)) |
356 | { return (__ps != NULL |
357 | ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); } |
358 | #endif |
359 | |
360 | /* Write wide character representation of multibyte character string |
361 | SRC to DST. */ |
362 | extern size_t mbsrtowcs (wchar_t *__restrict __dst, |
363 | const char **__restrict __src, size_t __len, |
364 | mbstate_t *__restrict __ps) __THROW; |
365 | |
366 | /* Write multibyte character representation of wide character string |
367 | SRC to DST. */ |
368 | extern size_t wcsrtombs (char *__restrict __dst, |
369 | const wchar_t **__restrict __src, size_t __len, |
370 | mbstate_t *__restrict __ps) __THROW; |
371 | |
372 | |
373 | #ifdef __USE_XOPEN2K8 |
374 | /* Write wide character representation of at most NMC bytes of the |
375 | multibyte character string SRC to DST. */ |
376 | extern size_t mbsnrtowcs (wchar_t *__restrict __dst, |
377 | const char **__restrict __src, size_t __nmc, |
378 | size_t __len, mbstate_t *__restrict __ps) __THROW; |
379 | |
380 | /* Write multibyte character representation of at most NWC characters |
381 | from the wide character string SRC to DST. */ |
382 | extern size_t wcsnrtombs (char *__restrict __dst, |
383 | const wchar_t **__restrict __src, |
384 | size_t __nwc, size_t __len, |
385 | mbstate_t *__restrict __ps) __THROW; |
386 | #endif /* use POSIX 2008 */ |
387 | |
388 | |
389 | /* The following functions are extensions found in X/Open CAE. */ |
390 | #ifdef __USE_XOPEN |
391 | /* Determine number of column positions required for C. */ |
392 | extern int wcwidth (wchar_t __c) __THROW; |
393 | |
394 | /* Determine number of column positions required for first N wide |
395 | characters (or fewer if S ends before this) in S. */ |
396 | extern int wcswidth (const wchar_t *__s, size_t __n) __THROW; |
397 | #endif /* Use X/Open. */ |
398 | |
399 | |
400 | /* Convert initial portion of the wide string NPTR to `double' |
401 | representation. */ |
402 | extern double wcstod (const wchar_t *__restrict __nptr, |
403 | wchar_t **__restrict __endptr) __THROW; |
404 | |
405 | #ifdef __USE_ISOC99 |
406 | /* Likewise for `float' and `long double' sizes of floating-point numbers. */ |
407 | extern float wcstof (const wchar_t *__restrict __nptr, |
408 | wchar_t **__restrict __endptr) __THROW; |
409 | extern long double wcstold (const wchar_t *__restrict __nptr, |
410 | wchar_t **__restrict __endptr) __THROW; |
411 | #endif /* C99 */ |
412 | |
413 | #if __GLIBC_USE (IEC_60559_TYPES_EXT) && __GLIBC_USE (ISOC2X) |
414 | /* Likewise for `_FloatN' and `_FloatNx' when support is enabled. */ |
415 | |
416 | # if __HAVE_FLOAT16 |
417 | extern _Float16 wcstof16 (const wchar_t *__restrict __nptr, |
418 | wchar_t **__restrict __endptr) __THROW; |
419 | # endif |
420 | |
421 | # if __HAVE_FLOAT32 |
422 | extern _Float32 wcstof32 (const wchar_t *__restrict __nptr, |
423 | wchar_t **__restrict __endptr) __THROW; |
424 | # endif |
425 | |
426 | # if __HAVE_FLOAT64 |
427 | extern _Float64 wcstof64 (const wchar_t *__restrict __nptr, |
428 | wchar_t **__restrict __endptr) __THROW; |
429 | # endif |
430 | |
431 | # if __HAVE_FLOAT128 |
432 | extern _Float128 wcstof128 (const wchar_t *__restrict __nptr, |
433 | wchar_t **__restrict __endptr) __THROW; |
434 | # endif |
435 | |
436 | # if __HAVE_FLOAT32X |
437 | extern _Float32x wcstof32x (const wchar_t *__restrict __nptr, |
438 | wchar_t **__restrict __endptr) __THROW; |
439 | # endif |
440 | |
441 | # if __HAVE_FLOAT64X |
442 | extern _Float64x wcstof64x (const wchar_t *__restrict __nptr, |
443 | wchar_t **__restrict __endptr) __THROW; |
444 | # endif |
445 | |
446 | # if __HAVE_FLOAT128X |
447 | extern _Float128x wcstof128x (const wchar_t *__restrict __nptr, |
448 | wchar_t **__restrict __endptr) __THROW; |
449 | # endif |
450 | #endif /* __GLIBC_USE (IEC_60559_TYPES_EXT) && __GLIBC_USE (ISOC2X) */ |
451 | |
452 | |
453 | /* Convert initial portion of wide string NPTR to `long int' |
454 | representation. */ |
455 | extern long int wcstol (const wchar_t *__restrict __nptr, |
456 | wchar_t **__restrict __endptr, int __base) __THROW; |
457 | |
458 | /* Convert initial portion of wide string NPTR to `unsigned long int' |
459 | representation. */ |
460 | extern unsigned long int wcstoul (const wchar_t *__restrict __nptr, |
461 | wchar_t **__restrict __endptr, int __base) |
462 | __THROW; |
463 | |
464 | #ifdef __USE_ISOC99 |
465 | /* Convert initial portion of wide string NPTR to `long long int' |
466 | representation. */ |
467 | __extension__ |
468 | extern long long int wcstoll (const wchar_t *__restrict __nptr, |
469 | wchar_t **__restrict __endptr, int __base) |
470 | __THROW; |
471 | |
472 | /* Convert initial portion of wide string NPTR to `unsigned long long int' |
473 | representation. */ |
474 | __extension__ |
475 | extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr, |
476 | wchar_t **__restrict __endptr, |
477 | int __base) __THROW; |
478 | #endif /* ISO C99. */ |
479 | |
480 | #ifdef __USE_GNU |
481 | /* Convert initial portion of wide string NPTR to `long long int' |
482 | representation. */ |
483 | __extension__ |
484 | extern long long int wcstoq (const wchar_t *__restrict __nptr, |
485 | wchar_t **__restrict __endptr, int __base) |
486 | __THROW; |
487 | |
488 | /* Convert initial portion of wide string NPTR to `unsigned long long int' |
489 | representation. */ |
490 | __extension__ |
491 | extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr, |
492 | wchar_t **__restrict __endptr, |
493 | int __base) __THROW; |
494 | #endif /* Use GNU. */ |
495 | |
496 | /* Versions of the above functions that handle '0b' and '0B' prefixes |
497 | in base 0 or 2. */ |
498 | #if __GLIBC_USE (C2X_STRTOL) |
499 | # ifdef __REDIRECT |
500 | extern long int __REDIRECT_NTH (wcstol, (const wchar_t *__restrict __nptr, |
501 | wchar_t **__restrict __endptr, |
502 | int __base), __isoc23_wcstol); |
503 | extern unsigned long int __REDIRECT_NTH (wcstoul, |
504 | (const wchar_t *__restrict __nptr, |
505 | wchar_t **__restrict __endptr, |
506 | int __base), __isoc23_wcstoul); |
507 | __extension__ |
508 | extern long long int __REDIRECT_NTH (wcstoll, |
509 | (const wchar_t *__restrict __nptr, |
510 | wchar_t **__restrict __endptr, |
511 | int __base), __isoc23_wcstoll); |
512 | __extension__ |
513 | extern unsigned long long int __REDIRECT_NTH (wcstoull, |
514 | (const wchar_t *__restrict __nptr, |
515 | wchar_t **__restrict __endptr, |
516 | int __base), __isoc23_wcstoull); |
517 | # ifdef __USE_GNU |
518 | __extension__ |
519 | extern long long int __REDIRECT_NTH (wcstoq, (const wchar_t *__restrict __nptr, |
520 | wchar_t **__restrict __endptr, |
521 | int __base), __isoc23_wcstoll); |
522 | __extension__ |
523 | extern unsigned long long int __REDIRECT_NTH (wcstouq, |
524 | (const wchar_t *__restrict __nptr, |
525 | wchar_t **__restrict __endptr, |
526 | int __base), __isoc23_wcstoull); |
527 | # endif |
528 | # else |
529 | extern long int __isoc23_wcstol (const wchar_t *__restrict __nptr, |
530 | wchar_t **__restrict __endptr, int __base) |
531 | __THROW; |
532 | extern unsigned long int __isoc23_wcstoul (const wchar_t *__restrict __nptr, |
533 | wchar_t **__restrict __endptr, |
534 | int __base) |
535 | __THROW; |
536 | __extension__ |
537 | extern long long int __isoc23_wcstoll (const wchar_t *__restrict __nptr, |
538 | wchar_t **__restrict __endptr, |
539 | int __base) |
540 | __THROW; |
541 | __extension__ |
542 | extern unsigned long long int __isoc23_wcstoull (const wchar_t *__restrict __nptr, |
543 | wchar_t **__restrict __endptr, |
544 | int __base) |
545 | __THROW; |
546 | # define wcstol __isoc23_wcstol |
547 | # define wcstoul __isoc23_wcstoul |
548 | # define wcstoll __isoc23_wcstoll |
549 | # define wcstoull __isoc23_wcstoull |
550 | # ifdef __USE_GNU |
551 | # define wcstoq __isoc23_wcstoll |
552 | # define wcstouq __isoc23_wcstoull |
553 | # endif |
554 | # endif |
555 | #endif |
556 | |
557 | #ifdef __USE_GNU |
558 | /* Parallel versions of the functions above which take the locale to |
559 | use as an additional parameter. These are GNU extensions inspired |
560 | by the POSIX.1-2008 extended locale API. */ |
561 | extern long int wcstol_l (const wchar_t *__restrict __nptr, |
562 | wchar_t **__restrict __endptr, int __base, |
563 | locale_t __loc) __THROW; |
564 | |
565 | extern unsigned long int wcstoul_l (const wchar_t *__restrict __nptr, |
566 | wchar_t **__restrict __endptr, |
567 | int __base, locale_t __loc) __THROW; |
568 | |
569 | __extension__ |
570 | extern long long int wcstoll_l (const wchar_t *__restrict __nptr, |
571 | wchar_t **__restrict __endptr, |
572 | int __base, locale_t __loc) __THROW; |
573 | |
574 | __extension__ |
575 | extern unsigned long long int wcstoull_l (const wchar_t *__restrict __nptr, |
576 | wchar_t **__restrict __endptr, |
577 | int __base, locale_t __loc) |
578 | __THROW; |
579 | |
580 | /* Versions of the above functions that handle '0b' and '0B' prefixes |
581 | in base 0 or 2. */ |
582 | # if __GLIBC_USE (C2X_STRTOL) |
583 | # ifdef __REDIRECT |
584 | extern long int __REDIRECT_NTH (wcstol_l, (const wchar_t *__restrict __nptr, |
585 | wchar_t **__restrict __endptr, |
586 | int __base, locale_t __loc), |
587 | __isoc23_wcstol_l); |
588 | extern unsigned long int __REDIRECT_NTH (wcstoul_l, |
589 | (const wchar_t *__restrict __nptr, |
590 | wchar_t **__restrict __endptr, |
591 | int __base, locale_t __loc), |
592 | __isoc23_wcstoul_l); |
593 | __extension__ |
594 | extern long long int __REDIRECT_NTH (wcstoll_l, |
595 | (const wchar_t *__restrict __nptr, |
596 | wchar_t **__restrict __endptr, |
597 | int __base, locale_t __loc), |
598 | __isoc23_wcstoll_l); |
599 | __extension__ |
600 | extern unsigned long long int __REDIRECT_NTH (wcstoull_l, |
601 | (const wchar_t *__restrict __nptr, |
602 | wchar_t **__restrict __endptr, |
603 | int __base, locale_t __loc), |
604 | __isoc23_wcstoull_l); |
605 | # else |
606 | extern long int __isoc23_wcstol_l (const wchar_t *__restrict __nptr, |
607 | wchar_t **__restrict __endptr, int __base, |
608 | locale_t __loc) __THROW; |
609 | extern unsigned long int __isoc23_wcstoul_l (const wchar_t *__restrict __nptr, |
610 | wchar_t **__restrict __endptr, |
611 | int __base, locale_t __loc) |
612 | __THROW; |
613 | __extension__ |
614 | extern long long int __isoc23_wcstoll_l (const wchar_t *__restrict __nptr, |
615 | wchar_t **__restrict __endptr, |
616 | int __base, locale_t __loc) |
617 | __THROW; |
618 | __extension__ |
619 | extern unsigned long long int __isoc23_wcstoull_l (const wchar_t *__restrict __nptr, |
620 | wchar_t **__restrict __endptr, |
621 | int __base, locale_t __loc) |
622 | __THROW; |
623 | # define wcstol_l __isoc23_wcstol_l |
624 | # define wcstoul_l __isoc23_wcstoul_l |
625 | # define wcstoll_l __isoc23_wcstoll_l |
626 | # define wcstoull_l __isoc23_wcstoull_l |
627 | # endif |
628 | # endif |
629 | |
630 | extern double wcstod_l (const wchar_t *__restrict __nptr, |
631 | wchar_t **__restrict __endptr, locale_t __loc) |
632 | __THROW; |
633 | |
634 | extern float wcstof_l (const wchar_t *__restrict __nptr, |
635 | wchar_t **__restrict __endptr, locale_t __loc) |
636 | __THROW; |
637 | |
638 | extern long double wcstold_l (const wchar_t *__restrict __nptr, |
639 | wchar_t **__restrict __endptr, |
640 | locale_t __loc) __THROW; |
641 | |
642 | # if __HAVE_FLOAT16 |
643 | extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr, |
644 | wchar_t **__restrict __endptr, |
645 | locale_t __loc) __THROW; |
646 | # endif |
647 | |
648 | # if __HAVE_FLOAT32 |
649 | extern _Float32 wcstof32_l (const wchar_t *__restrict __nptr, |
650 | wchar_t **__restrict __endptr, |
651 | locale_t __loc) __THROW; |
652 | # endif |
653 | |
654 | # if __HAVE_FLOAT64 |
655 | extern _Float64 wcstof64_l (const wchar_t *__restrict __nptr, |
656 | wchar_t **__restrict __endptr, |
657 | locale_t __loc) __THROW; |
658 | # endif |
659 | |
660 | # if __HAVE_FLOAT128 |
661 | extern _Float128 wcstof128_l (const wchar_t *__restrict __nptr, |
662 | wchar_t **__restrict __endptr, |
663 | locale_t __loc) __THROW; |
664 | # endif |
665 | |
666 | # if __HAVE_FLOAT32X |
667 | extern _Float32x wcstof32x_l (const wchar_t *__restrict __nptr, |
668 | wchar_t **__restrict __endptr, |
669 | locale_t __loc) __THROW; |
670 | # endif |
671 | |
672 | # if __HAVE_FLOAT64X |
673 | extern _Float64x wcstof64x_l (const wchar_t *__restrict __nptr, |
674 | wchar_t **__restrict __endptr, |
675 | locale_t __loc) __THROW; |
676 | # endif |
677 | |
678 | # if __HAVE_FLOAT128X |
679 | extern _Float128x wcstof128x_l (const wchar_t *__restrict __nptr, |
680 | wchar_t **__restrict __endptr, |
681 | locale_t __loc) __THROW; |
682 | # endif |
683 | #endif /* use GNU */ |
684 | |
685 | |
686 | #ifdef __USE_XOPEN2K8 |
687 | /* Copy SRC to DEST, returning the address of the terminating L'\0' in |
688 | DEST. */ |
689 | extern wchar_t *wcpcpy (wchar_t *__restrict __dest, |
690 | const wchar_t *__restrict __src) __THROW; |
691 | |
692 | /* Copy no more than N characters of SRC to DEST, returning the address of |
693 | the last character written into DEST. */ |
694 | extern wchar_t *wcpncpy (wchar_t *__restrict __dest, |
695 | const wchar_t *__restrict __src, size_t __n) |
696 | __THROW; |
697 | #endif |
698 | |
699 | |
700 | /* Wide character I/O functions. */ |
701 | |
702 | #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) |
703 | # ifndef __attr_dealloc_fclose |
704 | # if defined __has_builtin |
705 | # if __has_builtin (__builtin_fclose) |
706 | /* If the attribute macro hasn't been defined yet (by <stdio.h>) and |
707 | fclose is a built-in, use it. */ |
708 | # define __attr_dealloc_fclose __attr_dealloc (__builtin_fclose, 1) |
709 | # endif |
710 | # endif |
711 | # endif |
712 | # ifndef __attr_dealloc_fclose |
713 | # define __attr_dealloc_fclose /* empty */ |
714 | # endif |
715 | |
716 | /* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces |
717 | a wide character string. */ |
718 | extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW |
719 | __attribute_malloc__ __attr_dealloc_fclose; |
720 | #endif |
721 | |
722 | #if defined __USE_ISOC95 || defined __USE_UNIX98 |
723 | |
724 | /* Select orientation for stream. */ |
725 | extern int fwide (__FILE *__fp, int __mode) __THROW; |
726 | |
727 | |
728 | /* Write formatted output to STREAM. |
729 | |
730 | This function is a possible cancellation point and therefore not |
731 | marked with __THROW. */ |
732 | extern int fwprintf (__FILE *__restrict __stream, |
733 | const wchar_t *__restrict __format, ...) |
734 | /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; |
735 | /* Write formatted output to stdout. |
736 | |
737 | This function is a possible cancellation point and therefore not |
738 | marked with __THROW. */ |
739 | extern int wprintf (const wchar_t *__restrict __format, ...) |
740 | /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */; |
741 | /* Write formatted output of at most N characters to S. */ |
742 | extern int swprintf (wchar_t *__restrict __s, size_t __n, |
743 | const wchar_t *__restrict __format, ...) |
744 | __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */; |
745 | |
746 | /* Write formatted output to S from argument list ARG. |
747 | |
748 | This function is a possible cancellation point and therefore not |
749 | marked with __THROW. */ |
750 | extern int vfwprintf (__FILE *__restrict __s, |
751 | const wchar_t *__restrict __format, |
752 | __gnuc_va_list __arg) |
753 | /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */; |
754 | /* Write formatted output to stdout from argument list ARG. |
755 | |
756 | This function is a possible cancellation point and therefore not |
757 | marked with __THROW. */ |
758 | extern int vwprintf (const wchar_t *__restrict __format, |
759 | __gnuc_va_list __arg) |
760 | /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */; |
761 | /* Write formatted output of at most N character to S from argument |
762 | list ARG. */ |
763 | extern int vswprintf (wchar_t *__restrict __s, size_t __n, |
764 | const wchar_t *__restrict __format, |
765 | __gnuc_va_list __arg) |
766 | __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; |
767 | |
768 | |
769 | /* Read formatted input from STREAM. |
770 | |
771 | This function is a possible cancellation point and therefore not |
772 | marked with __THROW. */ |
773 | extern int fwscanf (__FILE *__restrict __stream, |
774 | const wchar_t *__restrict __format, ...) |
775 | /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; |
776 | /* Read formatted input from stdin. |
777 | |
778 | This function is a possible cancellation point and therefore not |
779 | marked with __THROW. */ |
780 | extern int wscanf (const wchar_t *__restrict __format, ...) |
781 | /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; |
782 | /* Read formatted input from S. */ |
783 | extern int swscanf (const wchar_t *__restrict __s, |
784 | const wchar_t *__restrict __format, ...) |
785 | __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; |
786 | |
787 | /* For historical reasons, the C99-compliant versions of the scanf |
788 | functions are at alternative names. When __LDBL_COMPAT or |
789 | __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in |
790 | bits/wchar-ldbl.h. */ |
791 | # if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \ |
792 | && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 |
793 | # if __GLIBC_USE (C2X_STRTOL) |
794 | # ifdef __REDIRECT |
795 | extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream, |
796 | const wchar_t *__restrict __format, ...), |
797 | __isoc23_fwscanf) |
798 | /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; |
799 | extern int __REDIRECT (wscanf, (const wchar_t *__restrict __format, ...), |
800 | __isoc23_wscanf) |
801 | /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; |
802 | extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s, |
803 | const wchar_t *__restrict __format, |
804 | ...), __isoc23_swscanf) |
805 | /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; |
806 | # else |
807 | extern int __isoc23_fwscanf (__FILE *__restrict __stream, |
808 | const wchar_t *__restrict __format, ...); |
809 | extern int __isoc23_wscanf (const wchar_t *__restrict __format, ...); |
810 | extern int __isoc23_swscanf (const wchar_t *__restrict __s, |
811 | const wchar_t *__restrict __format, ...) |
812 | __THROW; |
813 | # define fwscanf __isoc23_fwscanf |
814 | # define wscanf __isoc23_wscanf |
815 | # define swscanf __isoc23_swscanf |
816 | # endif |
817 | # else |
818 | # ifdef __REDIRECT |
819 | extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream, |
820 | const wchar_t *__restrict __format, ...), |
821 | __isoc99_fwscanf) |
822 | /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; |
823 | extern int __REDIRECT (wscanf, (const wchar_t *__restrict __format, ...), |
824 | __isoc99_wscanf) |
825 | /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; |
826 | extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s, |
827 | const wchar_t *__restrict __format, |
828 | ...), __isoc99_swscanf) |
829 | /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; |
830 | # else |
831 | extern int __isoc99_fwscanf (__FILE *__restrict __stream, |
832 | const wchar_t *__restrict __format, ...); |
833 | extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...); |
834 | extern int __isoc99_swscanf (const wchar_t *__restrict __s, |
835 | const wchar_t *__restrict __format, ...) |
836 | __THROW; |
837 | # define fwscanf __isoc99_fwscanf |
838 | # define wscanf __isoc99_wscanf |
839 | # define swscanf __isoc99_swscanf |
840 | # endif |
841 | # endif |
842 | # endif |
843 | |
844 | #endif /* Use ISO C95, C99 and Unix98. */ |
845 | |
846 | #ifdef __USE_ISOC99 |
847 | /* Read formatted input from S into argument list ARG. |
848 | |
849 | This function is a possible cancellation point and therefore not |
850 | marked with __THROW. */ |
851 | extern int vfwscanf (__FILE *__restrict __s, |
852 | const wchar_t *__restrict __format, |
853 | __gnuc_va_list __arg) |
854 | /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; |
855 | /* Read formatted input from stdin into argument list ARG. |
856 | |
857 | This function is a possible cancellation point and therefore not |
858 | marked with __THROW. */ |
859 | extern int vwscanf (const wchar_t *__restrict __format, |
860 | __gnuc_va_list __arg) |
861 | /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; |
862 | /* Read formatted input from S into argument list ARG. */ |
863 | extern int vswscanf (const wchar_t *__restrict __s, |
864 | const wchar_t *__restrict __format, |
865 | __gnuc_va_list __arg) |
866 | __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; |
867 | |
868 | /* Same redirection as above for the v*wscanf family. */ |
869 | # if !__GLIBC_USE (DEPRECATED_SCANF) \ |
870 | && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ |
871 | && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \ |
872 | && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 |
873 | # if __GLIBC_USE (C2X_STRTOL) |
874 | # ifdef __REDIRECT |
875 | extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s, |
876 | const wchar_t *__restrict __format, |
877 | __gnuc_va_list __arg), __isoc23_vfwscanf) |
878 | /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; |
879 | extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format, |
880 | __gnuc_va_list __arg), __isoc23_vwscanf) |
881 | /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; |
882 | extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s, |
883 | const wchar_t *__restrict __format, |
884 | __gnuc_va_list __arg), __isoc23_vswscanf) |
885 | /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; |
886 | # else |
887 | extern int __isoc23_vfwscanf (__FILE *__restrict __s, |
888 | const wchar_t *__restrict __format, |
889 | __gnuc_va_list __arg); |
890 | extern int __isoc23_vwscanf (const wchar_t *__restrict __format, |
891 | __gnuc_va_list __arg); |
892 | extern int __isoc23_vswscanf (const wchar_t *__restrict __s, |
893 | const wchar_t *__restrict __format, |
894 | __gnuc_va_list __arg) __THROW; |
895 | # define vfwscanf __isoc23_vfwscanf |
896 | # define vwscanf __isoc23_vwscanf |
897 | # define vswscanf __isoc23_vswscanf |
898 | # endif |
899 | # else |
900 | # ifdef __REDIRECT |
901 | extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s, |
902 | const wchar_t *__restrict __format, |
903 | __gnuc_va_list __arg), __isoc99_vfwscanf) |
904 | /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; |
905 | extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format, |
906 | __gnuc_va_list __arg), __isoc99_vwscanf) |
907 | /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; |
908 | extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s, |
909 | const wchar_t *__restrict __format, |
910 | __gnuc_va_list __arg), __isoc99_vswscanf) |
911 | /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; |
912 | # else |
913 | extern int __isoc99_vfwscanf (__FILE *__restrict __s, |
914 | const wchar_t *__restrict __format, |
915 | __gnuc_va_list __arg); |
916 | extern int __isoc99_vwscanf (const wchar_t *__restrict __format, |
917 | __gnuc_va_list __arg); |
918 | extern int __isoc99_vswscanf (const wchar_t *__restrict __s, |
919 | const wchar_t *__restrict __format, |
920 | __gnuc_va_list __arg) __THROW; |
921 | # define vfwscanf __isoc99_vfwscanf |
922 | # define vwscanf __isoc99_vwscanf |
923 | # define vswscanf __isoc99_vswscanf |
924 | # endif |
925 | # endif |
926 | # endif |
927 | |
928 | #endif /* Use ISO C99. */ |
929 | |
930 | |
931 | /* Read a character from STREAM. |
932 | |
933 | These functions are possible cancellation points and therefore not |
934 | marked with __THROW. */ |
935 | extern wint_t fgetwc (__FILE *__stream); |
936 | extern wint_t getwc (__FILE *__stream); |
937 | |
938 | /* Read a character from stdin. |
939 | |
940 | This function is a possible cancellation point and therefore not |
941 | marked with __THROW. */ |
942 | extern wint_t getwchar (void); |
943 | |
944 | |
945 | /* Write a character to STREAM. |
946 | |
947 | These functions are possible cancellation points and therefore not |
948 | marked with __THROW. */ |
949 | extern wint_t fputwc (wchar_t __wc, __FILE *__stream); |
950 | extern wint_t putwc (wchar_t __wc, __FILE *__stream); |
951 | |
952 | /* Write a character to stdout. |
953 | |
954 | This function is a possible cancellation point and therefore not |
955 | marked with __THROW. */ |
956 | extern wint_t putwchar (wchar_t __wc); |
957 | |
958 | |
959 | /* Get a newline-terminated wide character string of finite length |
960 | from STREAM. |
961 | |
962 | This function is a possible cancellation point and therefore not |
963 | marked with __THROW. */ |
964 | extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n, |
965 | __FILE *__restrict __stream); |
966 | |
967 | /* Write a string to STREAM. |
968 | |
969 | This function is a possible cancellation point and therefore not |
970 | marked with __THROW. */ |
971 | extern int fputws (const wchar_t *__restrict __ws, |
972 | __FILE *__restrict __stream); |
973 | |
974 | |
975 | /* Push a character back onto the input buffer of STREAM. |
976 | |
977 | This function is a possible cancellation point and therefore not |
978 | marked with __THROW. */ |
979 | extern wint_t ungetwc (wint_t __wc, __FILE *__stream); |
980 | |
981 | |
982 | #ifdef __USE_GNU |
983 | /* These are defined to be equivalent to the `char' functions defined |
984 | in POSIX.1:1996. |
985 | |
986 | These functions are not part of POSIX and therefore no official |
987 | cancellation point. But due to similarity with an POSIX interface |
988 | or due to the implementation they are cancellation points and |
989 | therefore not marked with __THROW. */ |
990 | extern wint_t getwc_unlocked (__FILE *__stream); |
991 | extern wint_t getwchar_unlocked (void); |
992 | |
993 | /* This is the wide character version of a GNU extension. |
994 | |
995 | This function is not part of POSIX and therefore no official |
996 | cancellation point. But due to similarity with an POSIX interface |
997 | or due to the implementation it is a cancellation point and |
998 | therefore not marked with __THROW. */ |
999 | extern wint_t fgetwc_unlocked (__FILE *__stream); |
1000 | |
1001 | /* Faster version when locking is not necessary. |
1002 | |
1003 | This function is not part of POSIX and therefore no official |
1004 | cancellation point. But due to similarity with an POSIX interface |
1005 | or due to the implementation it is a cancellation point and |
1006 | therefore not marked with __THROW. */ |
1007 | extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream); |
1008 | |
1009 | /* These are defined to be equivalent to the `char' functions defined |
1010 | in POSIX.1:1996. |
1011 | |
1012 | These functions are not part of POSIX and therefore no official |
1013 | cancellation point. But due to similarity with an POSIX interface |
1014 | or due to the implementation they are cancellation points and |
1015 | therefore not marked with __THROW. */ |
1016 | extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream); |
1017 | extern wint_t putwchar_unlocked (wchar_t __wc); |
1018 | |
1019 | |
1020 | /* This function does the same as `fgetws' but does not lock the stream. |
1021 | |
1022 | This function is not part of POSIX and therefore no official |
1023 | cancellation point. But due to similarity with an POSIX interface |
1024 | or due to the implementation it is a cancellation point and |
1025 | therefore not marked with __THROW. */ |
1026 | extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n, |
1027 | __FILE *__restrict __stream); |
1028 | |
1029 | /* This function does the same as `fputws' but does not lock the stream. |
1030 | |
1031 | This function is not part of POSIX and therefore no official |
1032 | cancellation point. But due to similarity with an POSIX interface |
1033 | or due to the implementation it is a cancellation point and |
1034 | therefore not marked with __THROW. */ |
1035 | extern int fputws_unlocked (const wchar_t *__restrict __ws, |
1036 | __FILE *__restrict __stream); |
1037 | #endif |
1038 | |
1039 | |
1040 | /* Format TP into S according to FORMAT. |
1041 | Write no more than MAXSIZE wide characters and return the number |
1042 | of wide characters written, or 0 if it would exceed MAXSIZE. */ |
1043 | extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize, |
1044 | const wchar_t *__restrict __format, |
1045 | const struct tm *__restrict __tp) __THROW; |
1046 | |
1047 | # ifdef __USE_GNU |
1048 | /* Similar to `wcsftime' but takes the information from |
1049 | the provided locale and not the global locale. */ |
1050 | extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, |
1051 | const wchar_t *__restrict __format, |
1052 | const struct tm *__restrict __tp, |
1053 | locale_t __loc) __THROW; |
1054 | # endif |
1055 | |
1056 | /* Define some macros helping to catch buffer overflows. */ |
1057 | #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function |
1058 | /* Declare all functions from bits/wchar2-decl.h first. */ |
1059 | # include <bits/wchar2-decl.h> |
1060 | #endif |
1061 | |
1062 | /* The following headers provide asm redirections. These redirections must |
1063 | appear before the first usage of these functions, e.g. in bits/wchar.h. */ |
1064 | #if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 |
1065 | # include <bits/wchar-ldbl.h> |
1066 | #endif |
1067 | |
1068 | #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function |
1069 | /* Now include the function definitions and redirects too. */ |
1070 | # include <bits/wchar2.h> |
1071 | #endif |
1072 | |
1073 | __END_DECLS |
1074 | |
1075 | #endif /* wchar.h */ |
1076 | |