Linux: Consolidate {RTLD_}SINGLE_THREAD_P definition
[glibc.git] / wcsmbs / wchar.h
blob4f16f98b1dc460b562ed02836f35b7a06133f842
1 /* Copyright (C) 1995-2017 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
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 <http://www.gnu.org/licenses/>. */
19 * ISO C99 Standard: 7.24
20 * Extended multibyte and wide character utilities <wchar.h>
23 #ifndef _WCHAR_H
24 #define _WCHAR_H 1
26 #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
27 #include <bits/libc-header-start.h>
29 /* Gather machine dependent type support. */
30 #include <bits/floatn.h>
32 #define __need_size_t
33 #define __need_wchar_t
34 #define __need_NULL
35 #include <stddef.h>
37 #define __need___va_list
38 #include <stdarg.h>
40 #include <bits/wchar.h>
41 #include <bits/types/wint_t.h>
42 #include <bits/types/mbstate_t.h>
43 #include <bits/types/__FILE.h>
45 #if defined __USE_UNIX98 || defined __USE_XOPEN2K
46 # include <bits/types/FILE.h>
47 #endif
48 #ifdef __USE_XOPEN2K8
49 # include <bits/types/locale_t.h>
50 #endif
52 /* Tell the caller that we provide correct C++ prototypes. */
53 #if defined __cplusplus && __GNUC_PREREQ (4, 4)
54 # define __CORRECT_ISO_CPP_WCHAR_H_PROTO
55 #endif
57 #ifndef WCHAR_MIN
58 /* These constants might also be defined in <inttypes.h>. */
59 # define WCHAR_MIN __WCHAR_MIN
60 # define WCHAR_MAX __WCHAR_MAX
61 #endif
63 #ifndef WEOF
64 # define WEOF (0xffffffffu)
65 #endif
67 /* All versions of XPG prior to the publication of ISO C99 required
68 the bulk of <wctype.h>'s declarations to appear in this header
69 (because <wctype.h> did not exist prior to C99). In POSIX.1-2001
70 those declarations were marked as XSI extensions; in -2008 they
71 were additionally marked as obsolescent. _GNU_SOURCE mode
72 anticipates the removal of these declarations in the next revision
73 of POSIX. */
74 #if (defined __USE_XOPEN && !defined __USE_GNU \
75 && !(defined __USE_XOPEN2K && !defined __USE_XOPEN2KXSI))
76 # include <bits/wctype-wchar.h>
77 #endif
79 __BEGIN_DECLS
81 /* This incomplete type is defined in <time.h> but needed here because
82 of `wcsftime'. */
83 struct tm;
86 /* Copy SRC to DEST. */
87 extern wchar_t *wcscpy (wchar_t *__restrict __dest,
88 const wchar_t *__restrict __src)
89 __THROW __nonnull ((1, 2));
91 /* Copy no more than N wide-characters of SRC to DEST. */
92 extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
93 const wchar_t *__restrict __src, size_t __n)
94 __THROW __nonnull ((1, 2));
96 /* Append SRC onto DEST. */
97 extern wchar_t *wcscat (wchar_t *__restrict __dest,
98 const wchar_t *__restrict __src)
99 __THROW __nonnull ((1, 2));
100 /* Append no more than N wide-characters of SRC onto DEST. */
101 extern wchar_t *wcsncat (wchar_t *__restrict __dest,
102 const wchar_t *__restrict __src, size_t __n)
103 __THROW __nonnull ((1, 2));
105 /* Compare S1 and S2. */
106 extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2)
107 __THROW __attribute_pure__ __nonnull ((1, 2));
108 /* Compare N wide-characters of S1 and S2. */
109 extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
110 __THROW __attribute_pure__ __nonnull ((1, 2));
112 #ifdef __USE_XOPEN2K8
113 /* Compare S1 and S2, ignoring case. */
114 extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) __THROW;
116 /* Compare no more than N chars of S1 and S2, ignoring case. */
117 extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
118 size_t __n) __THROW;
120 /* Similar to the two functions above but take the information from
121 the provided locale and not the global locale. */
122 extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
123 locale_t __loc) __THROW;
125 extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
126 size_t __n, locale_t __loc) __THROW;
127 #endif
129 /* Compare S1 and S2, both interpreted as appropriate to the
130 LC_COLLATE category of the current locale. */
131 extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
132 /* Transform S2 into array pointed to by S1 such that if wcscmp is
133 applied to two transformed strings the result is the as applying
134 `wcscoll' to the original strings. */
135 extern size_t wcsxfrm (wchar_t *__restrict __s1,
136 const wchar_t *__restrict __s2, size_t __n) __THROW;
138 #ifdef __USE_XOPEN2K8
139 /* Similar to the two functions above but take the information from
140 the provided locale and not the global locale. */
142 /* Compare S1 and S2, both interpreted as appropriate to the
143 LC_COLLATE category of the given locale. */
144 extern int wcscoll_l (const wchar_t *__s1, const wchar_t *__s2,
145 locale_t __loc) __THROW;
147 /* Transform S2 into array pointed to by S1 such that if wcscmp is
148 applied to two transformed strings the result is the as applying
149 `wcscoll' to the original strings. */
150 extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2,
151 size_t __n, locale_t __loc) __THROW;
153 /* Duplicate S, returning an identical malloc'd string. */
154 extern wchar_t *wcsdup (const wchar_t *__s) __THROW __attribute_malloc__;
155 #endif
157 /* Find the first occurrence of WC in WCS. */
158 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
159 extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc)
160 __THROW __asm ("wcschr") __attribute_pure__;
161 extern "C++" const wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
162 __THROW __asm ("wcschr") __attribute_pure__;
163 #else
164 extern wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
165 __THROW __attribute_pure__;
166 #endif
167 /* Find the last occurrence of WC in WCS. */
168 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
169 extern "C++" wchar_t *wcsrchr (wchar_t *__wcs, wchar_t __wc)
170 __THROW __asm ("wcsrchr") __attribute_pure__;
171 extern "C++" const wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
172 __THROW __asm ("wcsrchr") __attribute_pure__;
173 #else
174 extern wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
175 __THROW __attribute_pure__;
176 #endif
178 #ifdef __USE_GNU
179 /* This function is similar to `wcschr'. But it returns a pointer to
180 the closing NUL wide character in case C is not found in S. */
181 extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc)
182 __THROW __attribute_pure__;
183 #endif
185 /* Return the length of the initial segmet of WCS which
186 consists entirely of wide characters not in REJECT. */
187 extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject)
188 __THROW __attribute_pure__;
189 /* Return the length of the initial segmet of WCS which
190 consists entirely of wide characters in ACCEPT. */
191 extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept)
192 __THROW __attribute_pure__;
193 /* Find the first occurrence in WCS of any character in ACCEPT. */
194 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
195 extern "C++" wchar_t *wcspbrk (wchar_t *__wcs, const wchar_t *__accept)
196 __THROW __asm ("wcspbrk") __attribute_pure__;
197 extern "C++" const wchar_t *wcspbrk (const wchar_t *__wcs,
198 const wchar_t *__accept)
199 __THROW __asm ("wcspbrk") __attribute_pure__;
200 #else
201 extern wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept)
202 __THROW __attribute_pure__;
203 #endif
204 /* Find the first occurrence of NEEDLE in HAYSTACK. */
205 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
206 extern "C++" wchar_t *wcsstr (wchar_t *__haystack, const wchar_t *__needle)
207 __THROW __asm ("wcsstr") __attribute_pure__;
208 extern "C++" const wchar_t *wcsstr (const wchar_t *__haystack,
209 const wchar_t *__needle)
210 __THROW __asm ("wcsstr") __attribute_pure__;
211 #else
212 extern wchar_t *wcsstr (const wchar_t *__haystack, const wchar_t *__needle)
213 __THROW __attribute_pure__;
214 #endif
216 /* Divide WCS into tokens separated by characters in DELIM. */
217 extern wchar_t *wcstok (wchar_t *__restrict __s,
218 const wchar_t *__restrict __delim,
219 wchar_t **__restrict __ptr) __THROW;
221 /* Return the number of wide characters in S. */
222 extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__;
224 #ifdef __USE_XOPEN
225 /* Another name for `wcsstr' from XPG4. */
226 # ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
227 extern "C++" wchar_t *wcswcs (wchar_t *__haystack, const wchar_t *__needle)
228 __THROW __asm ("wcswcs") __attribute_pure__;
229 extern "C++" const wchar_t *wcswcs (const wchar_t *__haystack,
230 const wchar_t *__needle)
231 __THROW __asm ("wcswcs") __attribute_pure__;
232 # else
233 extern wchar_t *wcswcs (const wchar_t *__haystack, const wchar_t *__needle)
234 __THROW __attribute_pure__;
235 # endif
236 #endif
238 #ifdef __USE_XOPEN2K8
239 /* Return the number of wide characters in S, but at most MAXLEN. */
240 extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen)
241 __THROW __attribute_pure__;
242 #endif
245 /* Search N wide characters of S for C. */
246 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
247 extern "C++" wchar_t *wmemchr (wchar_t *__s, wchar_t __c, size_t __n)
248 __THROW __asm ("wmemchr") __attribute_pure__;
249 extern "C++" const wchar_t *wmemchr (const wchar_t *__s, wchar_t __c,
250 size_t __n)
251 __THROW __asm ("wmemchr") __attribute_pure__;
252 #else
253 extern wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
254 __THROW __attribute_pure__;
255 #endif
257 /* Compare N wide characters of S1 and S2. */
258 extern int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
259 __THROW __attribute_pure__;
261 /* Copy N wide characters of SRC to DEST. */
262 extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
263 const wchar_t *__restrict __s2, size_t __n) __THROW;
265 /* Copy N wide characters of SRC to DEST, guaranteeing
266 correct behavior for overlapping strings. */
267 extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)
268 __THROW;
270 /* Set N wide characters of S to C. */
271 extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
273 #ifdef __USE_GNU
274 /* Copy N wide characters of SRC to DEST and return pointer to following
275 wide character. */
276 extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
277 const wchar_t *__restrict __s2, size_t __n)
278 __THROW;
279 #endif
282 /* Determine whether C constitutes a valid (one-byte) multibyte
283 character. */
284 extern wint_t btowc (int __c) __THROW;
286 /* Determine whether C corresponds to a member of the extended
287 character set whose multibyte representation is a single byte. */
288 extern int wctob (wint_t __c) __THROW;
290 /* Determine whether PS points to an object representing the initial
291 state. */
292 extern int mbsinit (const mbstate_t *__ps) __THROW __attribute_pure__;
294 /* Write wide character representation of multibyte character pointed
295 to by S to PWC. */
296 extern size_t mbrtowc (wchar_t *__restrict __pwc,
297 const char *__restrict __s, size_t __n,
298 mbstate_t *__restrict __p) __THROW;
300 /* Write multibyte representation of wide character WC to S. */
301 extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
302 mbstate_t *__restrict __ps) __THROW;
304 /* Return number of bytes in multibyte character pointed to by S. */
305 extern size_t __mbrlen (const char *__restrict __s, size_t __n,
306 mbstate_t *__restrict __ps) __THROW;
307 extern size_t mbrlen (const char *__restrict __s, size_t __n,
308 mbstate_t *__restrict __ps) __THROW;
310 #ifdef __USE_EXTERN_INLINES
311 /* Define inline function as optimization. */
313 /* We can use the BTOWC and WCTOB optimizations since we know that all
314 locales must use ASCII encoding for the values in the ASCII range
315 and because the wchar_t encoding is always ISO 10646. */
316 extern wint_t __btowc_alias (int __c) __asm ("btowc");
317 __extern_inline wint_t
318 __NTH (btowc (int __c))
319 { return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f'
320 ? (wint_t) __c : __btowc_alias (__c)); }
322 extern int __wctob_alias (wint_t __c) __asm ("wctob");
323 __extern_inline int
324 __NTH (wctob (wint_t __wc))
325 { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
326 ? (int) __wc : __wctob_alias (__wc)); }
328 __extern_inline size_t
329 __NTH (mbrlen (const char *__restrict __s, size_t __n,
330 mbstate_t *__restrict __ps))
331 { return (__ps != NULL
332 ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
333 #endif
335 /* Write wide character representation of multibyte character string
336 SRC to DST. */
337 extern size_t mbsrtowcs (wchar_t *__restrict __dst,
338 const char **__restrict __src, size_t __len,
339 mbstate_t *__restrict __ps) __THROW;
341 /* Write multibyte character representation of wide character string
342 SRC to DST. */
343 extern size_t wcsrtombs (char *__restrict __dst,
344 const wchar_t **__restrict __src, size_t __len,
345 mbstate_t *__restrict __ps) __THROW;
348 #ifdef __USE_XOPEN2K8
349 /* Write wide character representation of at most NMC bytes of the
350 multibyte character string SRC to DST. */
351 extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
352 const char **__restrict __src, size_t __nmc,
353 size_t __len, mbstate_t *__restrict __ps) __THROW;
355 /* Write multibyte character representation of at most NWC characters
356 from the wide character string SRC to DST. */
357 extern size_t wcsnrtombs (char *__restrict __dst,
358 const wchar_t **__restrict __src,
359 size_t __nwc, size_t __len,
360 mbstate_t *__restrict __ps) __THROW;
361 #endif /* use POSIX 2008 */
364 /* The following functions are extensions found in X/Open CAE. */
365 #ifdef __USE_XOPEN
366 /* Determine number of column positions required for C. */
367 extern int wcwidth (wchar_t __c) __THROW;
369 /* Determine number of column positions required for first N wide
370 characters (or fewer if S ends before this) in S. */
371 extern int wcswidth (const wchar_t *__s, size_t __n) __THROW;
372 #endif /* Use X/Open. */
375 /* Convert initial portion of the wide string NPTR to `double'
376 representation. */
377 extern double wcstod (const wchar_t *__restrict __nptr,
378 wchar_t **__restrict __endptr) __THROW;
380 #ifdef __USE_ISOC99
381 /* Likewise for `float' and `long double' sizes of floating-point numbers. */
382 extern float wcstof (const wchar_t *__restrict __nptr,
383 wchar_t **__restrict __endptr) __THROW;
384 extern long double wcstold (const wchar_t *__restrict __nptr,
385 wchar_t **__restrict __endptr) __THROW;
386 #endif /* C99 */
388 /* Likewise for `_Float128' when support is enabled. */
389 #if __HAVE_FLOAT128 && defined __USE_GNU
390 extern _Float128 wcstof128 (const wchar_t *__restrict __nptr,
391 wchar_t **__restrict __endptr) __THROW;
392 #endif
395 /* Convert initial portion of wide string NPTR to `long int'
396 representation. */
397 extern long int wcstol (const wchar_t *__restrict __nptr,
398 wchar_t **__restrict __endptr, int __base) __THROW;
400 /* Convert initial portion of wide string NPTR to `unsigned long int'
401 representation. */
402 extern unsigned long int wcstoul (const wchar_t *__restrict __nptr,
403 wchar_t **__restrict __endptr, int __base)
404 __THROW;
406 #ifdef __USE_ISOC99
407 /* Convert initial portion of wide string NPTR to `long long int'
408 representation. */
409 __extension__
410 extern long long int wcstoll (const wchar_t *__restrict __nptr,
411 wchar_t **__restrict __endptr, int __base)
412 __THROW;
414 /* Convert initial portion of wide string NPTR to `unsigned long long int'
415 representation. */
416 __extension__
417 extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr,
418 wchar_t **__restrict __endptr,
419 int __base) __THROW;
420 #endif /* ISO C99. */
422 #ifdef __USE_GNU
423 /* Convert initial portion of wide string NPTR to `long long int'
424 representation. */
425 __extension__
426 extern long long int wcstoq (const wchar_t *__restrict __nptr,
427 wchar_t **__restrict __endptr, int __base)
428 __THROW;
430 /* Convert initial portion of wide string NPTR to `unsigned long long int'
431 representation. */
432 __extension__
433 extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr,
434 wchar_t **__restrict __endptr,
435 int __base) __THROW;
436 #endif /* Use GNU. */
438 #ifdef __USE_GNU
439 /* Parallel versions of the functions above which take the locale to
440 use as an additional parameter. These are GNU extensions inspired
441 by the POSIX.1-2008 extended locale API. */
442 extern long int wcstol_l (const wchar_t *__restrict __nptr,
443 wchar_t **__restrict __endptr, int __base,
444 locale_t __loc) __THROW;
446 extern unsigned long int wcstoul_l (const wchar_t *__restrict __nptr,
447 wchar_t **__restrict __endptr,
448 int __base, locale_t __loc) __THROW;
450 __extension__
451 extern long long int wcstoll_l (const wchar_t *__restrict __nptr,
452 wchar_t **__restrict __endptr,
453 int __base, locale_t __loc) __THROW;
455 __extension__
456 extern unsigned long long int wcstoull_l (const wchar_t *__restrict __nptr,
457 wchar_t **__restrict __endptr,
458 int __base, locale_t __loc)
459 __THROW;
461 extern double wcstod_l (const wchar_t *__restrict __nptr,
462 wchar_t **__restrict __endptr, locale_t __loc)
463 __THROW;
465 extern float wcstof_l (const wchar_t *__restrict __nptr,
466 wchar_t **__restrict __endptr, locale_t __loc)
467 __THROW;
469 extern long double wcstold_l (const wchar_t *__restrict __nptr,
470 wchar_t **__restrict __endptr,
471 locale_t __loc) __THROW;
473 # if __HAVE_FLOAT128
474 extern _Float128 wcstof128_l (const wchar_t *__restrict __nptr,
475 wchar_t **__restrict __endptr,
476 locale_t __loc) __THROW;
477 # endif
478 #endif /* use GNU */
481 #ifdef __USE_XOPEN2K8
482 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
483 DEST. */
484 extern wchar_t *wcpcpy (wchar_t *__restrict __dest,
485 const wchar_t *__restrict __src) __THROW;
487 /* Copy no more than N characters of SRC to DEST, returning the address of
488 the last character written into DEST. */
489 extern wchar_t *wcpncpy (wchar_t *__restrict __dest,
490 const wchar_t *__restrict __src, size_t __n)
491 __THROW;
492 #endif
495 /* Wide character I/O functions. */
497 #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
498 /* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces
499 a wide character string. */
500 extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW;
501 #endif
503 #if defined __USE_ISOC95 || defined __USE_UNIX98
505 /* Select orientation for stream. */
506 extern int fwide (__FILE *__fp, int __mode) __THROW;
509 /* Write formatted output to STREAM.
511 This function is a possible cancellation point and therefore not
512 marked with __THROW. */
513 extern int fwprintf (__FILE *__restrict __stream,
514 const wchar_t *__restrict __format, ...)
515 /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
516 /* Write formatted output to stdout.
518 This function is a possible cancellation point and therefore not
519 marked with __THROW. */
520 extern int wprintf (const wchar_t *__restrict __format, ...)
521 /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
522 /* Write formatted output of at most N characters to S. */
523 extern int swprintf (wchar_t *__restrict __s, size_t __n,
524 const wchar_t *__restrict __format, ...)
525 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
527 /* Write formatted output to S from argument list ARG.
529 This function is a possible cancellation point and therefore not
530 marked with __THROW. */
531 extern int vfwprintf (__FILE *__restrict __s,
532 const wchar_t *__restrict __format,
533 __gnuc_va_list __arg)
534 /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
535 /* Write formatted output to stdout from argument list ARG.
537 This function is a possible cancellation point and therefore not
538 marked with __THROW. */
539 extern int vwprintf (const wchar_t *__restrict __format,
540 __gnuc_va_list __arg)
541 /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
542 /* Write formatted output of at most N character to S from argument
543 list ARG. */
544 extern int vswprintf (wchar_t *__restrict __s, size_t __n,
545 const wchar_t *__restrict __format,
546 __gnuc_va_list __arg)
547 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
550 /* Read formatted input from STREAM.
552 This function is a possible cancellation point and therefore not
553 marked with __THROW. */
554 extern int fwscanf (__FILE *__restrict __stream,
555 const wchar_t *__restrict __format, ...)
556 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
557 /* Read formatted input from stdin.
559 This function is a possible cancellation point and therefore not
560 marked with __THROW. */
561 extern int wscanf (const wchar_t *__restrict __format, ...)
562 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
563 /* Read formatted input from S. */
564 extern int swscanf (const wchar_t *__restrict __s,
565 const wchar_t *__restrict __format, ...)
566 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
568 # if defined __USE_ISOC99 && !defined __USE_GNU \
569 && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
570 && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
571 # ifdef __REDIRECT
572 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
573 GNU extension which conflicts with valid %a followed by letter
574 s, S or [. */
575 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
576 const wchar_t *__restrict __format, ...),
577 __isoc99_fwscanf)
578 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
579 extern int __REDIRECT (wscanf, (const wchar_t *__restrict __format, ...),
580 __isoc99_wscanf)
581 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
582 extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
583 const wchar_t *__restrict __format,
584 ...), __isoc99_swscanf)
585 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
586 # else
587 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
588 const wchar_t *__restrict __format, ...);
589 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
590 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
591 const wchar_t *__restrict __format, ...)
592 __THROW;
593 # define fwscanf __isoc99_fwscanf
594 # define wscanf __isoc99_wscanf
595 # define swscanf __isoc99_swscanf
596 # endif
597 # endif
599 #endif /* Use ISO C95, C99 and Unix98. */
601 #ifdef __USE_ISOC99
602 /* Read formatted input from S into argument list ARG.
604 This function is a possible cancellation point and therefore not
605 marked with __THROW. */
606 extern int vfwscanf (__FILE *__restrict __s,
607 const wchar_t *__restrict __format,
608 __gnuc_va_list __arg)
609 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
610 /* Read formatted input from stdin into argument list ARG.
612 This function is a possible cancellation point and therefore not
613 marked with __THROW. */
614 extern int vwscanf (const wchar_t *__restrict __format,
615 __gnuc_va_list __arg)
616 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
617 /* Read formatted input from S into argument list ARG. */
618 extern int vswscanf (const wchar_t *__restrict __s,
619 const wchar_t *__restrict __format,
620 __gnuc_va_list __arg)
621 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
623 # if !defined __USE_GNU \
624 && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
625 && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
626 # ifdef __REDIRECT
627 extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
628 const wchar_t *__restrict __format,
629 __gnuc_va_list __arg), __isoc99_vfwscanf)
630 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
631 extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
632 __gnuc_va_list __arg), __isoc99_vwscanf)
633 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
634 extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
635 const wchar_t *__restrict __format,
636 __gnuc_va_list __arg), __isoc99_vswscanf)
637 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
638 # else
639 extern int __isoc99_vfwscanf (__FILE *__restrict __s,
640 const wchar_t *__restrict __format,
641 __gnuc_va_list __arg);
642 extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
643 __gnuc_va_list __arg);
644 extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
645 const wchar_t *__restrict __format,
646 __gnuc_va_list __arg) __THROW;
647 # define vfwscanf __isoc99_vfwscanf
648 # define vwscanf __isoc99_vwscanf
649 # define vswscanf __isoc99_vswscanf
650 # endif
651 # endif
653 #endif /* Use ISO C99. */
656 /* Read a character from STREAM.
658 These functions are possible cancellation points and therefore not
659 marked with __THROW. */
660 extern wint_t fgetwc (__FILE *__stream);
661 extern wint_t getwc (__FILE *__stream);
663 /* Read a character from stdin.
665 This function is a possible cancellation point and therefore not
666 marked with __THROW. */
667 extern wint_t getwchar (void);
670 /* Write a character to STREAM.
672 These functions are possible cancellation points and therefore not
673 marked with __THROW. */
674 extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
675 extern wint_t putwc (wchar_t __wc, __FILE *__stream);
677 /* Write a character to stdout.
679 This function is a possible cancellation point and therefore not
680 marked with __THROW. */
681 extern wint_t putwchar (wchar_t __wc);
684 /* Get a newline-terminated wide character string of finite length
685 from STREAM.
687 This function is a possible cancellation point and therefore not
688 marked with __THROW. */
689 extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
690 __FILE *__restrict __stream);
692 /* Write a string to STREAM.
694 This function is a possible cancellation point and therefore not
695 marked with __THROW. */
696 extern int fputws (const wchar_t *__restrict __ws,
697 __FILE *__restrict __stream);
700 /* Push a character back onto the input buffer of STREAM.
702 This function is a possible cancellation point and therefore not
703 marked with __THROW. */
704 extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
707 #ifdef __USE_GNU
708 /* These are defined to be equivalent to the `char' functions defined
709 in POSIX.1:1996.
711 These functions are not part of POSIX and therefore no official
712 cancellation point. But due to similarity with an POSIX interface
713 or due to the implementation they are cancellation points and
714 therefore not marked with __THROW. */
715 extern wint_t getwc_unlocked (__FILE *__stream);
716 extern wint_t getwchar_unlocked (void);
718 /* This is the wide character version of a GNU extension.
720 This function is not part of POSIX and therefore no official
721 cancellation point. But due to similarity with an POSIX interface
722 or due to the implementation it is a cancellation point and
723 therefore not marked with __THROW. */
724 extern wint_t fgetwc_unlocked (__FILE *__stream);
726 /* Faster version when locking is not necessary.
728 This function is not part of POSIX and therefore no official
729 cancellation point. But due to similarity with an POSIX interface
730 or due to the implementation it is a cancellation point and
731 therefore not marked with __THROW. */
732 extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
734 /* These are defined to be equivalent to the `char' functions defined
735 in POSIX.1:1996.
737 These functions are not part of POSIX and therefore no official
738 cancellation point. But due to similarity with an POSIX interface
739 or due to the implementation they are cancellation points and
740 therefore not marked with __THROW. */
741 extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
742 extern wint_t putwchar_unlocked (wchar_t __wc);
745 /* This function does the same as `fgetws' but does not lock the stream.
747 This function is not part of POSIX and therefore no official
748 cancellation point. But due to similarity with an POSIX interface
749 or due to the implementation it is a cancellation point and
750 therefore not marked with __THROW. */
751 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
752 __FILE *__restrict __stream);
754 /* This function does the same as `fputws' but does not lock the stream.
756 This function is not part of POSIX and therefore no official
757 cancellation point. But due to similarity with an POSIX interface
758 or due to the implementation it is a cancellation point and
759 therefore not marked with __THROW. */
760 extern int fputws_unlocked (const wchar_t *__restrict __ws,
761 __FILE *__restrict __stream);
762 #endif
765 /* Format TP into S according to FORMAT.
766 Write no more than MAXSIZE wide characters and return the number
767 of wide characters written, or 0 if it would exceed MAXSIZE. */
768 extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
769 const wchar_t *__restrict __format,
770 const struct tm *__restrict __tp) __THROW;
772 # ifdef __USE_GNU
773 /* Similar to `wcsftime' but takes the information from
774 the provided locale and not the global locale. */
775 extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
776 const wchar_t *__restrict __format,
777 const struct tm *__restrict __tp,
778 locale_t __loc) __THROW;
779 # endif
781 /* Define some macros helping to catch buffer overflows. */
782 #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
783 # include <bits/wchar2.h>
784 #endif
786 #ifdef __LDBL_COMPAT
787 # include <bits/wchar-ldbl.h>
788 #endif
790 __END_DECLS
792 #endif /* wchar.h */