PowerPC: Fix multiarch hypotf PPC64 path
[glibc.git] / wcsmbs / wchar.h
blob29340fdaa2ec011a8c3e6ca8dec74af82aaf3ca7
1 /* Copyright (C) 1995-2014 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
25 #if !defined __need_mbstate_t && !defined __need_wint_t
26 # define _WCHAR_H 1
27 # include <features.h>
28 #endif
30 #ifdef _WCHAR_H
31 /* Get FILE definition. */
32 # define __need___FILE
33 # if defined __USE_UNIX98 || defined __USE_XOPEN2K
34 # define __need_FILE
35 # endif
36 # include <stdio.h>
37 /* Get va_list definition. */
38 # define __need___va_list
39 # include <stdarg.h>
41 # include <bits/wchar.h>
43 /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */
44 # define __need_size_t
45 # define __need_wchar_t
46 # define __need_NULL
47 #endif
48 #if defined _WCHAR_H || defined __need_wint_t || !defined __WINT_TYPE__
49 # undef __need_wint_t
50 # define __need_wint_t
51 # include <stddef.h>
53 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
54 there. So define it ourselves if it remains undefined. */
55 # ifndef _WINT_T
56 /* Integral type unchanged by default argument promotions that can
57 hold any value corresponding to members of the extended character
58 set, as well as at least one value that does not correspond to any
59 member of the extended character set. */
60 # define _WINT_T
61 typedef unsigned int wint_t;
62 # else
63 /* Work around problems with the <stddef.h> file which doesn't put
64 wint_t in the std namespace. */
65 # if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \
66 && defined __WINT_TYPE__
67 __BEGIN_NAMESPACE_STD
68 typedef __WINT_TYPE__ wint_t;
69 __END_NAMESPACE_STD
70 # endif
71 # endif
73 /* Tell the caller that we provide correct C++ prototypes. */
74 # if defined __cplusplus && __GNUC_PREREQ (4, 4)
75 # define __CORRECT_ISO_CPP_WCHAR_H_PROTO
76 # endif
77 #endif
79 #if (defined _WCHAR_H || defined __need_mbstate_t) && !defined ____mbstate_t_defined
80 # define ____mbstate_t_defined 1
81 /* Conversion state information. */
82 typedef struct
84 int __count;
85 union
87 # ifdef __WINT_TYPE__
88 __WINT_TYPE__ __wch;
89 # else
90 wint_t __wch;
91 # endif
92 char __wchb[4];
93 } __value; /* Value so far. */
94 } __mbstate_t;
95 #endif
96 #undef __need_mbstate_t
99 /* The rest of the file is only used if used if __need_mbstate_t is not
100 defined. */
101 #ifdef _WCHAR_H
103 # ifndef __mbstate_t_defined
104 __BEGIN_NAMESPACE_C99
105 /* Public type. */
106 typedef __mbstate_t mbstate_t;
107 __END_NAMESPACE_C99
108 # define __mbstate_t_defined 1
109 # endif
111 #ifdef __USE_GNU
112 __USING_NAMESPACE_C99(mbstate_t)
113 #endif
115 #ifndef WCHAR_MIN
116 /* These constants might also be defined in <inttypes.h>. */
117 # define WCHAR_MIN __WCHAR_MIN
118 # define WCHAR_MAX __WCHAR_MAX
119 #endif
121 #ifndef WEOF
122 # define WEOF (0xffffffffu)
123 #endif
125 /* For XPG4 compliance we have to define the stuff from <wctype.h> here
126 as well. */
127 #if defined __USE_XOPEN && !defined __USE_UNIX98
128 # include <wctype.h>
129 #endif
132 __BEGIN_DECLS
134 __BEGIN_NAMESPACE_STD
135 /* This incomplete type is defined in <time.h> but needed here because
136 of `wcsftime'. */
137 struct tm;
138 __END_NAMESPACE_STD
139 /* XXX We have to clean this up at some point. Since tm is in the std
140 namespace but wcsftime is in __c99 the type wouldn't be found
141 without inserting it in the global namespace. */
142 __USING_NAMESPACE_STD(tm)
145 __BEGIN_NAMESPACE_STD
146 /* Copy SRC to DEST. */
147 extern wchar_t *wcscpy (wchar_t *__restrict __dest,
148 const wchar_t *__restrict __src) __THROW;
149 /* Copy no more than N wide-characters of SRC to DEST. */
150 extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
151 const wchar_t *__restrict __src, size_t __n)
152 __THROW;
154 /* Append SRC onto DEST. */
155 extern wchar_t *wcscat (wchar_t *__restrict __dest,
156 const wchar_t *__restrict __src) __THROW;
157 /* Append no more than N wide-characters of SRC onto DEST. */
158 extern wchar_t *wcsncat (wchar_t *__restrict __dest,
159 const wchar_t *__restrict __src, size_t __n)
160 __THROW;
162 /* Compare S1 and S2. */
163 extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2)
164 __THROW __attribute_pure__;
165 /* Compare N wide-characters of S1 and S2. */
166 extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
167 __THROW __attribute_pure__;
168 __END_NAMESPACE_STD
170 #ifdef __USE_XOPEN2K8
171 /* Compare S1 and S2, ignoring case. */
172 extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) __THROW;
174 /* Compare no more than N chars of S1 and S2, ignoring case. */
175 extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
176 size_t __n) __THROW;
178 /* Similar to the two functions above but take the information from
179 the provided locale and not the global locale. */
180 # include <xlocale.h>
182 extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
183 __locale_t __loc) __THROW;
185 extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
186 size_t __n, __locale_t __loc) __THROW;
187 #endif
189 __BEGIN_NAMESPACE_STD
190 /* Compare S1 and S2, both interpreted as appropriate to the
191 LC_COLLATE category of the current locale. */
192 extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
193 /* Transform S2 into array pointed to by S1 such that if wcscmp is
194 applied to two transformed strings the result is the as applying
195 `wcscoll' to the original strings. */
196 extern size_t wcsxfrm (wchar_t *__restrict __s1,
197 const wchar_t *__restrict __s2, size_t __n) __THROW;
198 __END_NAMESPACE_STD
200 #ifdef __USE_XOPEN2K8
201 /* Similar to the two functions above but take the information from
202 the provided locale and not the global locale. */
204 /* Compare S1 and S2, both interpreted as appropriate to the
205 LC_COLLATE category of the given locale. */
206 extern int wcscoll_l (const wchar_t *__s1, const wchar_t *__s2,
207 __locale_t __loc) __THROW;
209 /* Transform S2 into array pointed to by S1 such that if wcscmp is
210 applied to two transformed strings the result is the as applying
211 `wcscoll' to the original strings. */
212 extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2,
213 size_t __n, __locale_t __loc) __THROW;
215 /* Duplicate S, returning an identical malloc'd string. */
216 extern wchar_t *wcsdup (const wchar_t *__s) __THROW __attribute_malloc__;
217 #endif
219 __BEGIN_NAMESPACE_STD
220 /* Find the first occurrence of WC in WCS. */
221 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
222 extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc)
223 __THROW __asm ("wcschr") __attribute_pure__;
224 extern "C++" const wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
225 __THROW __asm ("wcschr") __attribute_pure__;
226 #else
227 extern wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
228 __THROW __attribute_pure__;
229 #endif
230 /* Find the last occurrence of WC in WCS. */
231 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
232 extern "C++" wchar_t *wcsrchr (wchar_t *__wcs, wchar_t __wc)
233 __THROW __asm ("wcsrchr") __attribute_pure__;
234 extern "C++" const wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
235 __THROW __asm ("wcsrchr") __attribute_pure__;
236 #else
237 extern wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
238 __THROW __attribute_pure__;
239 #endif
240 __END_NAMESPACE_STD
242 #ifdef __USE_GNU
243 /* This function is similar to `wcschr'. But it returns a pointer to
244 the closing NUL wide character in case C is not found in S. */
245 extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc)
246 __THROW __attribute_pure__;
247 #endif
249 __BEGIN_NAMESPACE_STD
250 /* Return the length of the initial segmet of WCS which
251 consists entirely of wide characters not in REJECT. */
252 extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject)
253 __THROW __attribute_pure__;
254 /* Return the length of the initial segmet of WCS which
255 consists entirely of wide characters in ACCEPT. */
256 extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept)
257 __THROW __attribute_pure__;
258 /* Find the first occurrence in WCS of any character in ACCEPT. */
259 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
260 extern "C++" wchar_t *wcspbrk (wchar_t *__wcs, const wchar_t *__accept)
261 __THROW __asm ("wcspbrk") __attribute_pure__;
262 extern "C++" const wchar_t *wcspbrk (const wchar_t *__wcs,
263 const wchar_t *__accept)
264 __THROW __asm ("wcspbrk") __attribute_pure__;
265 #else
266 extern wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept)
267 __THROW __attribute_pure__;
268 #endif
269 /* Find the first occurrence of NEEDLE in HAYSTACK. */
270 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
271 extern "C++" wchar_t *wcsstr (wchar_t *__haystack, const wchar_t *__needle)
272 __THROW __asm ("wcsstr") __attribute_pure__;
273 extern "C++" const wchar_t *wcsstr (const wchar_t *__haystack,
274 const wchar_t *__needle)
275 __THROW __asm ("wcsstr") __attribute_pure__;
276 #else
277 extern wchar_t *wcsstr (const wchar_t *__haystack, const wchar_t *__needle)
278 __THROW __attribute_pure__;
279 #endif
281 /* Divide WCS into tokens separated by characters in DELIM. */
282 extern wchar_t *wcstok (wchar_t *__restrict __s,
283 const wchar_t *__restrict __delim,
284 wchar_t **__restrict __ptr) __THROW;
286 /* Return the number of wide characters in S. */
287 extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__;
288 __END_NAMESPACE_STD
290 #ifdef __USE_XOPEN
291 /* Another name for `wcsstr' from XPG4. */
292 # ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
293 extern "C++" wchar_t *wcswcs (wchar_t *__haystack, const wchar_t *__needle)
294 __THROW __asm ("wcswcs") __attribute_pure__;
295 extern "C++" const wchar_t *wcswcs (const wchar_t *__haystack,
296 const wchar_t *__needle)
297 __THROW __asm ("wcswcs") __attribute_pure__;
298 # else
299 extern wchar_t *wcswcs (const wchar_t *__haystack, const wchar_t *__needle)
300 __THROW __attribute_pure__;
301 # endif
302 #endif
304 #ifdef __USE_XOPEN2K8
305 /* Return the number of wide characters in S, but at most MAXLEN. */
306 extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen)
307 __THROW __attribute_pure__;
308 #endif
311 __BEGIN_NAMESPACE_STD
312 /* Search N wide characters of S for C. */
313 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
314 extern "C++" wchar_t *wmemchr (wchar_t *__s, wchar_t __c, size_t __n)
315 __THROW __asm ("wmemchr") __attribute_pure__;
316 extern "C++" const wchar_t *wmemchr (const wchar_t *__s, wchar_t __c,
317 size_t __n)
318 __THROW __asm ("wmemchr") __attribute_pure__;
319 #else
320 extern wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
321 __THROW __attribute_pure__;
322 #endif
324 /* Compare N wide characters of S1 and S2. */
325 extern int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
326 __THROW __attribute_pure__;
328 /* Copy N wide characters of SRC to DEST. */
329 extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
330 const wchar_t *__restrict __s2, size_t __n) __THROW;
332 /* Copy N wide characters of SRC to DEST, guaranteeing
333 correct behavior for overlapping strings. */
334 extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)
335 __THROW;
337 /* Set N wide characters of S to C. */
338 extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
339 __END_NAMESPACE_STD
341 #ifdef __USE_GNU
342 /* Copy N wide characters of SRC to DEST and return pointer to following
343 wide character. */
344 extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
345 const wchar_t *__restrict __s2, size_t __n)
346 __THROW;
347 #endif
350 __BEGIN_NAMESPACE_STD
351 /* Determine whether C constitutes a valid (one-byte) multibyte
352 character. */
353 extern wint_t btowc (int __c) __THROW;
355 /* Determine whether C corresponds to a member of the extended
356 character set whose multibyte representation is a single byte. */
357 extern int wctob (wint_t __c) __THROW;
359 /* Determine whether PS points to an object representing the initial
360 state. */
361 extern int mbsinit (const mbstate_t *__ps) __THROW __attribute_pure__;
363 /* Write wide character representation of multibyte character pointed
364 to by S to PWC. */
365 extern size_t mbrtowc (wchar_t *__restrict __pwc,
366 const char *__restrict __s, size_t __n,
367 mbstate_t *__restrict __p) __THROW;
369 /* Write multibyte representation of wide character WC to S. */
370 extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
371 mbstate_t *__restrict __ps) __THROW;
373 /* Return number of bytes in multibyte character pointed to by S. */
374 extern size_t __mbrlen (const char *__restrict __s, size_t __n,
375 mbstate_t *__restrict __ps) __THROW;
376 extern size_t mbrlen (const char *__restrict __s, size_t __n,
377 mbstate_t *__restrict __ps) __THROW;
378 __END_NAMESPACE_STD
380 #ifdef __USE_EXTERN_INLINES
381 /* Define inline function as optimization. */
383 /* We can use the BTOWC and WCTOB optimizations since we know that all
384 locales must use ASCII encoding for the values in the ASCII range
385 and because the wchar_t encoding is always ISO 10646. */
386 extern wint_t __btowc_alias (int __c) __asm ("btowc");
387 __extern_inline wint_t
388 __NTH (btowc (int __c))
389 { return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f'
390 ? (wint_t) __c : __btowc_alias (__c)); }
392 extern int __wctob_alias (wint_t __c) __asm ("wctob");
393 __extern_inline int
394 __NTH (wctob (wint_t __wc))
395 { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
396 ? (int) __wc : __wctob_alias (__wc)); }
398 __extern_inline size_t
399 __NTH (mbrlen (const char *__restrict __s, size_t __n,
400 mbstate_t *__restrict __ps))
401 { return (__ps != NULL
402 ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
403 #endif
405 __BEGIN_NAMESPACE_STD
406 /* Write wide character representation of multibyte character string
407 SRC to DST. */
408 extern size_t mbsrtowcs (wchar_t *__restrict __dst,
409 const char **__restrict __src, size_t __len,
410 mbstate_t *__restrict __ps) __THROW;
412 /* Write multibyte character representation of wide character string
413 SRC to DST. */
414 extern size_t wcsrtombs (char *__restrict __dst,
415 const wchar_t **__restrict __src, size_t __len,
416 mbstate_t *__restrict __ps) __THROW;
417 __END_NAMESPACE_STD
420 #ifdef __USE_XOPEN2K8
421 /* Write wide character representation of at most NMC bytes of the
422 multibyte character string SRC to DST. */
423 extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
424 const char **__restrict __src, size_t __nmc,
425 size_t __len, mbstate_t *__restrict __ps) __THROW;
427 /* Write multibyte character representation of at most NWC characters
428 from the wide character string SRC to DST. */
429 extern size_t wcsnrtombs (char *__restrict __dst,
430 const wchar_t **__restrict __src,
431 size_t __nwc, size_t __len,
432 mbstate_t *__restrict __ps) __THROW;
433 #endif /* use POSIX 2008 */
436 /* The following functions are extensions found in X/Open CAE. */
437 #ifdef __USE_XOPEN
438 /* Determine number of column positions required for C. */
439 extern int wcwidth (wchar_t __c) __THROW;
441 /* Determine number of column positions required for first N wide
442 characters (or fewer if S ends before this) in S. */
443 extern int wcswidth (const wchar_t *__s, size_t __n) __THROW;
444 #endif /* Use X/Open. */
447 __BEGIN_NAMESPACE_STD
448 /* Convert initial portion of the wide string NPTR to `double'
449 representation. */
450 extern double wcstod (const wchar_t *__restrict __nptr,
451 wchar_t **__restrict __endptr) __THROW;
452 __END_NAMESPACE_STD
454 #ifdef __USE_ISOC99
455 __BEGIN_NAMESPACE_C99
456 /* Likewise for `float' and `long double' sizes of floating-point numbers. */
457 extern float wcstof (const wchar_t *__restrict __nptr,
458 wchar_t **__restrict __endptr) __THROW;
459 extern long double wcstold (const wchar_t *__restrict __nptr,
460 wchar_t **__restrict __endptr) __THROW;
461 __END_NAMESPACE_C99
462 #endif /* C99 */
465 __BEGIN_NAMESPACE_STD
466 /* Convert initial portion of wide string NPTR to `long int'
467 representation. */
468 extern long int wcstol (const wchar_t *__restrict __nptr,
469 wchar_t **__restrict __endptr, int __base) __THROW;
471 /* Convert initial portion of wide string NPTR to `unsigned long int'
472 representation. */
473 extern unsigned long int wcstoul (const wchar_t *__restrict __nptr,
474 wchar_t **__restrict __endptr, int __base)
475 __THROW;
476 __END_NAMESPACE_STD
478 #ifdef __USE_ISOC99
479 __BEGIN_NAMESPACE_C99
480 /* Convert initial portion of wide string NPTR to `long long int'
481 representation. */
482 __extension__
483 extern long long int wcstoll (const wchar_t *__restrict __nptr,
484 wchar_t **__restrict __endptr, int __base)
485 __THROW;
487 /* Convert initial portion of wide string NPTR to `unsigned long long int'
488 representation. */
489 __extension__
490 extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr,
491 wchar_t **__restrict __endptr,
492 int __base) __THROW;
493 __END_NAMESPACE_C99
494 #endif /* ISO C99. */
496 #ifdef __USE_GNU
497 /* Convert initial portion of wide string NPTR to `long long int'
498 representation. */
499 __extension__
500 extern long long int wcstoq (const wchar_t *__restrict __nptr,
501 wchar_t **__restrict __endptr, int __base)
502 __THROW;
504 /* Convert initial portion of wide string NPTR to `unsigned long long int'
505 representation. */
506 __extension__
507 extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr,
508 wchar_t **__restrict __endptr,
509 int __base) __THROW;
510 #endif /* Use GNU. */
512 #ifdef __USE_GNU
513 /* The concept of one static locale per category is not very well
514 thought out. Many applications will need to process its data using
515 information from several different locales. Another application is
516 the implementation of the internationalization handling in the
517 upcoming ISO C++ standard library. To support this another set of
518 the functions using locale data exist which have an additional
519 argument.
521 Attention: all these functions are *not* standardized in any form.
522 This is a proof-of-concept implementation. */
524 /* Structure for reentrant locale using functions. This is an
525 (almost) opaque type for the user level programs. */
526 # include <xlocale.h>
528 /* Special versions of the functions above which take the locale to
529 use as an additional parameter. */
530 extern long int wcstol_l (const wchar_t *__restrict __nptr,
531 wchar_t **__restrict __endptr, int __base,
532 __locale_t __loc) __THROW;
534 extern unsigned long int wcstoul_l (const wchar_t *__restrict __nptr,
535 wchar_t **__restrict __endptr,
536 int __base, __locale_t __loc) __THROW;
538 __extension__
539 extern long long int wcstoll_l (const wchar_t *__restrict __nptr,
540 wchar_t **__restrict __endptr,
541 int __base, __locale_t __loc) __THROW;
543 __extension__
544 extern unsigned long long int wcstoull_l (const wchar_t *__restrict __nptr,
545 wchar_t **__restrict __endptr,
546 int __base, __locale_t __loc)
547 __THROW;
549 extern double wcstod_l (const wchar_t *__restrict __nptr,
550 wchar_t **__restrict __endptr, __locale_t __loc)
551 __THROW;
553 extern float wcstof_l (const wchar_t *__restrict __nptr,
554 wchar_t **__restrict __endptr, __locale_t __loc)
555 __THROW;
557 extern long double wcstold_l (const wchar_t *__restrict __nptr,
558 wchar_t **__restrict __endptr,
559 __locale_t __loc) __THROW;
560 #endif /* use GNU */
563 #ifdef __USE_XOPEN2K8
564 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
565 DEST. */
566 extern wchar_t *wcpcpy (wchar_t *__restrict __dest,
567 const wchar_t *__restrict __src) __THROW;
569 /* Copy no more than N characters of SRC to DEST, returning the address of
570 the last character written into DEST. */
571 extern wchar_t *wcpncpy (wchar_t *__restrict __dest,
572 const wchar_t *__restrict __src, size_t __n)
573 __THROW;
576 /* Wide character I/O functions. */
578 /* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces
579 a wide character string. */
580 extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW;
581 #endif
583 #if defined __USE_ISOC95 || defined __USE_UNIX98
584 __BEGIN_NAMESPACE_STD
586 /* Select orientation for stream. */
587 extern int fwide (__FILE *__fp, int __mode) __THROW;
590 /* Write formatted output to STREAM.
592 This function is a possible cancellation point and therefore not
593 marked with __THROW. */
594 extern int fwprintf (__FILE *__restrict __stream,
595 const wchar_t *__restrict __format, ...)
596 /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
597 /* Write formatted output to stdout.
599 This function is a possible cancellation point and therefore not
600 marked with __THROW. */
601 extern int wprintf (const wchar_t *__restrict __format, ...)
602 /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
603 /* Write formatted output of at most N characters to S. */
604 extern int swprintf (wchar_t *__restrict __s, size_t __n,
605 const wchar_t *__restrict __format, ...)
606 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
608 /* Write formatted output to S from argument list ARG.
610 This function is a possible cancellation point and therefore not
611 marked with __THROW. */
612 extern int vfwprintf (__FILE *__restrict __s,
613 const wchar_t *__restrict __format,
614 __gnuc_va_list __arg)
615 /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
616 /* Write formatted output to stdout from argument list ARG.
618 This function is a possible cancellation point and therefore not
619 marked with __THROW. */
620 extern int vwprintf (const wchar_t *__restrict __format,
621 __gnuc_va_list __arg)
622 /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
623 /* Write formatted output of at most N character to S from argument
624 list ARG. */
625 extern int vswprintf (wchar_t *__restrict __s, size_t __n,
626 const wchar_t *__restrict __format,
627 __gnuc_va_list __arg)
628 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
631 /* Read formatted input from STREAM.
633 This function is a possible cancellation point and therefore not
634 marked with __THROW. */
635 extern int fwscanf (__FILE *__restrict __stream,
636 const wchar_t *__restrict __format, ...)
637 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
638 /* Read formatted input from stdin.
640 This function is a possible cancellation point and therefore not
641 marked with __THROW. */
642 extern int wscanf (const wchar_t *__restrict __format, ...)
643 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
644 /* Read formatted input from S. */
645 extern int swscanf (const wchar_t *__restrict __s,
646 const wchar_t *__restrict __format, ...)
647 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
649 # if defined __USE_ISOC99 && !defined __USE_GNU \
650 && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
651 && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
652 # ifdef __REDIRECT
653 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
654 GNU extension which conflicts with valid %a followed by letter
655 s, S or [. */
656 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
657 const wchar_t *__restrict __format, ...),
658 __isoc99_fwscanf)
659 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
660 extern int __REDIRECT (wscanf, (const wchar_t *__restrict __format, ...),
661 __isoc99_wscanf)
662 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
663 extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
664 const wchar_t *__restrict __format,
665 ...), __isoc99_swscanf)
666 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
667 # else
668 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
669 const wchar_t *__restrict __format, ...);
670 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
671 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
672 const wchar_t *__restrict __format, ...)
673 __THROW;
674 # define fwscanf __isoc99_fwscanf
675 # define wscanf __isoc99_wscanf
676 # define swscanf __isoc99_swscanf
677 # endif
678 # endif
680 __END_NAMESPACE_STD
681 #endif /* Use ISO C95, C99 and Unix98. */
683 #ifdef __USE_ISOC99
684 __BEGIN_NAMESPACE_C99
685 /* Read formatted input from S into argument list ARG.
687 This function is a possible cancellation point and therefore not
688 marked with __THROW. */
689 extern int vfwscanf (__FILE *__restrict __s,
690 const wchar_t *__restrict __format,
691 __gnuc_va_list __arg)
692 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
693 /* Read formatted input from stdin into argument list ARG.
695 This function is a possible cancellation point and therefore not
696 marked with __THROW. */
697 extern int vwscanf (const wchar_t *__restrict __format,
698 __gnuc_va_list __arg)
699 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
700 /* Read formatted input from S into argument list ARG. */
701 extern int vswscanf (const wchar_t *__restrict __s,
702 const wchar_t *__restrict __format,
703 __gnuc_va_list __arg)
704 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
706 # if !defined __USE_GNU \
707 && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
708 && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
709 # ifdef __REDIRECT
710 extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
711 const wchar_t *__restrict __format,
712 __gnuc_va_list __arg), __isoc99_vfwscanf)
713 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
714 extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
715 __gnuc_va_list __arg), __isoc99_vwscanf)
716 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
717 extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
718 const wchar_t *__restrict __format,
719 __gnuc_va_list __arg), __isoc99_vswscanf)
720 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
721 # else
722 extern int __isoc99_vfwscanf (__FILE *__restrict __s,
723 const wchar_t *__restrict __format,
724 __gnuc_va_list __arg);
725 extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
726 __gnuc_va_list __arg);
727 extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
728 const wchar_t *__restrict __format,
729 __gnuc_va_list __arg) __THROW;
730 # define vfwscanf __isoc99_vfwscanf
731 # define vwscanf __isoc99_vwscanf
732 # define vswscanf __isoc99_vswscanf
733 # endif
734 # endif
736 __END_NAMESPACE_C99
737 #endif /* Use ISO C99. */
740 __BEGIN_NAMESPACE_STD
741 /* Read a character from STREAM.
743 These functions are possible cancellation points and therefore not
744 marked with __THROW. */
745 extern wint_t fgetwc (__FILE *__stream);
746 extern wint_t getwc (__FILE *__stream);
748 /* Read a character from stdin.
750 This function is a possible cancellation point and therefore not
751 marked with __THROW. */
752 extern wint_t getwchar (void);
755 /* Write a character to STREAM.
757 These functions are possible cancellation points and therefore not
758 marked with __THROW. */
759 extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
760 extern wint_t putwc (wchar_t __wc, __FILE *__stream);
762 /* Write a character to stdout.
764 This function is a possible cancellation point and therefore not
765 marked with __THROW. */
766 extern wint_t putwchar (wchar_t __wc);
769 /* Get a newline-terminated wide character string of finite length
770 from STREAM.
772 This function is a possible cancellation point and therefore not
773 marked with __THROW. */
774 extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
775 __FILE *__restrict __stream);
777 /* Write a string to STREAM.
779 This function is a possible cancellation point and therefore not
780 marked with __THROW. */
781 extern int fputws (const wchar_t *__restrict __ws,
782 __FILE *__restrict __stream);
785 /* Push a character back onto the input buffer of STREAM.
787 This function is a possible cancellation point and therefore not
788 marked with __THROW. */
789 extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
790 __END_NAMESPACE_STD
793 #ifdef __USE_GNU
794 /* These are defined to be equivalent to the `char' functions defined
795 in POSIX.1:1996.
797 These functions are not part of POSIX and therefore no official
798 cancellation point. But due to similarity with an POSIX interface
799 or due to the implementation they are cancellation points and
800 therefore not marked with __THROW. */
801 extern wint_t getwc_unlocked (__FILE *__stream);
802 extern wint_t getwchar_unlocked (void);
804 /* This is the wide character version of a GNU extension.
806 This function is not part of POSIX and therefore no official
807 cancellation point. But due to similarity with an POSIX interface
808 or due to the implementation it is a cancellation point and
809 therefore not marked with __THROW. */
810 extern wint_t fgetwc_unlocked (__FILE *__stream);
812 /* Faster version when locking is not necessary.
814 This function is not part of POSIX and therefore no official
815 cancellation point. But due to similarity with an POSIX interface
816 or due to the implementation it is a cancellation point and
817 therefore not marked with __THROW. */
818 extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
820 /* These are defined to be equivalent to the `char' functions defined
821 in POSIX.1:1996.
823 These functions are not part of POSIX and therefore no official
824 cancellation point. But due to similarity with an POSIX interface
825 or due to the implementation they are cancellation points and
826 therefore not marked with __THROW. */
827 extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
828 extern wint_t putwchar_unlocked (wchar_t __wc);
831 /* This function does the same as `fgetws' but does not lock the stream.
833 This function is not part of POSIX and therefore no official
834 cancellation point. But due to similarity with an POSIX interface
835 or due to the implementation it is a cancellation point and
836 therefore not marked with __THROW. */
837 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
838 __FILE *__restrict __stream);
840 /* This function does the same as `fputws' but does not lock the stream.
842 This function is not part of POSIX and therefore no official
843 cancellation point. But due to similarity with an POSIX interface
844 or due to the implementation it is a cancellation point and
845 therefore not marked with __THROW. */
846 extern int fputws_unlocked (const wchar_t *__restrict __ws,
847 __FILE *__restrict __stream);
848 #endif
851 __BEGIN_NAMESPACE_C99
852 /* Format TP into S according to FORMAT.
853 Write no more than MAXSIZE wide characters and return the number
854 of wide characters written, or 0 if it would exceed MAXSIZE. */
855 extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
856 const wchar_t *__restrict __format,
857 const struct tm *__restrict __tp) __THROW;
858 __END_NAMESPACE_C99
860 # ifdef __USE_GNU
861 # include <xlocale.h>
863 /* Similar to `wcsftime' but takes the information from
864 the provided locale and not the global locale. */
865 extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
866 const wchar_t *__restrict __format,
867 const struct tm *__restrict __tp,
868 __locale_t __loc) __THROW;
869 # endif
871 /* The X/Open standard demands that most of the functions defined in
872 the <wctype.h> header must also appear here. This is probably
873 because some X/Open members wrote their implementation before the
874 ISO C standard was published and introduced the better solution.
875 We have to provide these definitions for compliance reasons but we
876 do this nonsense only if really necessary. */
877 #if defined __USE_UNIX98 && !defined __USE_GNU
878 # define __need_iswxxx
879 # include <wctype.h>
880 #endif
882 /* Define some macros helping to catch buffer overflows. */
883 #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
884 # include <bits/wchar2.h>
885 #endif
887 #ifdef __LDBL_COMPAT
888 # include <bits/wchar-ldbl.h>
889 #endif
891 __END_DECLS
893 #endif /* _WCHAR_H defined */
895 #endif /* wchar.h */
897 /* Undefine all __need_* constants in case we are included to get those
898 constants but the whole file was already read. */
899 #undef __need_mbstate_t
900 #undef __need_wint_t