* stdlib/tst-setcontext.c (main): If makecontext does nothing,
[glibc.git] / wcsmbs / wchar.h
blob9b2f721076aed778abaab733b372aed9bb7aeb98
1 /* Copyright (C) 1995-99,2000,01,02 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, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
20 * ISO C99 Standard: 7.24
21 * Extended multibyte and wide character utilities <wchar.h>
24 #ifndef _WCHAR_H
26 #ifndef __need_mbstate_t
27 # define _WCHAR_H 1
28 # include <features.h>
29 #endif
31 #ifdef _WCHAR_H
32 /* Get FILE definition. */
33 # define __need___FILE
34 # ifdef __USE_UNIX98
35 # define __need_FILE
36 # endif
37 # include <stdio.h>
38 /* Get va_list definition. */
39 # define __need___va_list
40 # include <stdarg.h>
42 /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */
43 # define __need_size_t
44 # define __need_wchar_t
45 # define __need_NULL
46 #endif
47 #define __need_wint_t
48 #include <stddef.h>
50 #include <bits/wchar.h>
52 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
53 there. So define it ourselves if it remains undefined. */
54 #ifndef _WINT_T
55 /* Integral type unchanged by default argument promotions that can
56 hold any value corresponding to members of the extended character
57 set, as well as at least one value that does not correspond to any
58 member of the extended character set. */
59 # define _WINT_T
60 typedef unsigned int wint_t;
61 #else
62 # ifdef __USE_GNU
63 __USING_NAMESPACE_STD(wint_t)
64 # endif
65 #endif
68 #ifndef __mbstate_t_defined
69 # define __mbstate_t_defined 1
70 /* Conversion state information. */
71 typedef struct
73 int __count;
74 union
76 wint_t __wch;
77 char __wchb[4];
78 } __value; /* Value so far. */
79 } __mbstate_t;
80 #endif
81 #undef __need_mbstate_t
84 /* The rest of the file is only used if used if __need_mbstate_t is not
85 defined. */
86 #ifdef _WCHAR_H
88 __BEGIN_NAMESPACE_C99
89 /* Public type. */
90 typedef __mbstate_t mbstate_t;
91 __END_NAMESPACE_C99
92 #ifdef __USE_GNU
93 __USING_NAMESPACE_C99(mbstate_t)
94 #endif
96 #ifndef WCHAR_MIN
97 /* These constants might also be defined in <inttypes.h>. */
98 # define WCHAR_MIN __WCHAR_MIN
99 # define WCHAR_MAX __WCHAR_MAX
100 #endif
102 #ifndef WEOF
103 # define WEOF (0xffffffffu)
104 #endif
106 /* For XPG4 compliance we have to define the stuff from <wctype.h> here
107 as well. */
108 #if defined __USE_XOPEN && !defined __USE_UNIX98
109 # include <wctype.h>
110 #endif
113 __BEGIN_DECLS
115 __BEGIN_NAMESPACE_STD
116 /* This incomplete type is defined in <time.h> but needed here because
117 of `wcsftime'. */
118 struct tm;
119 /* XXX We have to clean this up at some point. Since tm is in the std
120 namespace but wcsftime is in __c99 the type wouldn't be found
121 without inserting it in the global namespace. */
122 __USING_NAMESPACE_STD(tm)
123 __END_NAMESPACE_STD
126 __BEGIN_NAMESPACE_C99
127 /* Copy SRC to DEST. */
128 extern wchar_t *wcscpy (wchar_t *__restrict __dest,
129 __const wchar_t *__restrict __src) __THROW;
130 /* Copy no more than N wide-characters of SRC to DEST. */
131 extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
132 __const wchar_t *__restrict __src, size_t __n)
133 __THROW;
135 /* Append SRC onto DEST. */
136 extern wchar_t *wcscat (wchar_t *__restrict __dest,
137 __const wchar_t *__restrict __src) __THROW;
138 /* Append no more than N wide-characters of SRC onto DEST. */
139 extern wchar_t *wcsncat (wchar_t *__restrict __dest,
140 __const wchar_t *__restrict __src, size_t __n)
141 __THROW;
143 /* Compare S1 and S2. */
144 extern int wcscmp (__const wchar_t *__s1, __const wchar_t *__s2)
145 __THROW __attribute_pure__;
146 /* Compare N wide-characters of S1 and S2. */
147 extern int wcsncmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n)
148 __THROW __attribute_pure__;
149 __END_NAMESPACE_C99
151 #ifdef __USE_GNU
152 /* Compare S1 and S2, ignoring case. */
153 extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
155 /* Compare no more than N chars of S1 and S2, ignoring case. */
156 extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
157 size_t __n) __THROW;
159 /* Similar to the two functions above but take the information from
160 the provided locale and not the global locale. */
161 # include <xlocale.h>
163 extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
164 __locale_t __loc) __THROW;
166 extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
167 size_t __n, __locale_t __loc) __THROW;
168 #endif
170 __BEGIN_NAMESPACE_C99
171 /* Compare S1 and S2, both interpreted as appropriate to the
172 LC_COLLATE category of the current locale. */
173 extern int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
174 /* Transform S2 into array pointed to by S1 such that if wcscmp is
175 applied to two transformed strings the result is the as applying
176 `wcscoll' to the original strings. */
177 extern size_t wcsxfrm (wchar_t *__restrict __s1,
178 __const wchar_t *__restrict __s2, size_t __n) __THROW;
179 __END_NAMESPACE_C99
181 #ifdef __USE_GNU
182 /* Similar to the two functions above but take the information from
183 the provided locale and not the global locale. */
185 /* Compare S1 and S2, both interpreted as appropriate to the
186 LC_COLLATE category of the given locale. */
187 extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
188 __locale_t __loc) __THROW;
190 /* Transform S2 into array pointed to by S1 such that if wcscmp is
191 applied to two transformed strings the result is the as applying
192 `wcscoll' to the original strings. */
193 extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
194 size_t __n, __locale_t __loc) __THROW;
196 /* Duplicate S, returning an identical malloc'd string. */
197 extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__;
198 #endif
200 __BEGIN_NAMESPACE_C99
201 /* Find the first occurrence of WC in WCS. */
202 extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
203 __THROW __attribute_pure__;
204 /* Find the last occurrence of WC in WCS. */
205 extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc)
206 __THROW __attribute_pure__;
207 __END_NAMESPACE_C99
209 #ifdef __USE_GNU
210 /* This function is similar to `wcschr'. But it returns a pointer to
211 the closing NUL wide character in case C is not found in S. */
212 extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc)
213 __THROW __attribute_pure__;
214 #endif
216 __BEGIN_NAMESPACE_C99
217 /* Return the length of the initial segmet of WCS which
218 consists entirely of wide characters not in REJECT. */
219 extern size_t wcscspn (__const wchar_t *__wcs, __const wchar_t *__reject)
220 __THROW __attribute_pure__;
221 /* Return the length of the initial segmet of WCS which
222 consists entirely of wide characters in ACCEPT. */
223 extern size_t wcsspn (__const wchar_t *__wcs, __const wchar_t *__accept)
224 __THROW __attribute_pure__;
225 /* Find the first occurrence in WCS of any character in ACCEPT. */
226 extern wchar_t *wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept)
227 __THROW __attribute_pure__;
228 /* Find the first occurrence of NEEDLE in HAYSTACK. */
229 extern wchar_t *wcsstr (__const wchar_t *__haystack, __const wchar_t *__needle)
230 __THROW __attribute_pure__;
232 /* Divide WCS into tokens separated by characters in DELIM. */
233 extern wchar_t *wcstok (wchar_t *__restrict __s,
234 __const wchar_t *__restrict __delim,
235 wchar_t **__restrict __ptr) __THROW;
237 /* Return the number of wide characters in S. */
238 extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__;
239 __END_NAMESPACE_C99
241 #ifdef __USE_XOPEN
242 /* Another name for `wcsstr' from XPG4. */
243 extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle)
244 __THROW __attribute_pure__;
245 #endif
247 #ifdef __USE_GNU
248 /* Return the number of wide characters in S, but at most MAXLEN. */
249 extern size_t wcsnlen (__const wchar_t *__s, size_t __maxlen)
250 __THROW __attribute_pure__;
251 #endif
254 __BEGIN_NAMESPACE_C99
255 /* Search N wide characters of S for C. */
256 extern wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n)
257 __THROW __attribute_pure__;
259 /* Compare N wide characters of S1 and S2. */
260 extern int wmemcmp (__const wchar_t *__restrict __s1,
261 __const wchar_t *__restrict __s2, size_t __n)
262 __THROW __attribute_pure__;
264 /* Copy N wide characters of SRC to DEST. */
265 extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
266 __const wchar_t *__restrict __s2, size_t __n) __THROW;
268 /* Copy N wide characters of SRC to DEST, guaranteeing
269 correct behavior for overlapping strings. */
270 extern wchar_t *wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n)
271 __THROW;
273 /* Set N wide characters of S to C. */
274 extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
275 __END_NAMESPACE_C99
277 #ifdef __USE_GNU
278 /* Copy N wide characters of SRC to DEST and return pointer to following
279 wide character. */
280 extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
281 __const wchar_t *__restrict __s2, size_t __n)
282 __THROW;
283 #endif
286 __BEGIN_NAMESPACE_C99
287 /* Determine whether C constitutes a valid (one-byte) multibyte
288 character. */
289 extern wint_t btowc (int __c) __THROW;
291 /* Determine whether C corresponds to a member of the extended
292 character set whose multibyte representation is a single byte. */
293 extern int wctob (wint_t __c) __THROW;
295 /* Determine whether PS points to an object representing the initial
296 state. */
297 extern int mbsinit (__const mbstate_t *__ps) __THROW __attribute_pure__;
299 /* Write wide character representation of multibyte character pointed
300 to by S to PWC. */
301 extern size_t mbrtowc (wchar_t *__restrict __pwc,
302 __const char *__restrict __s, size_t __n,
303 mbstate_t *__p) __THROW;
305 /* Write multibyte representation of wide character WC to S. */
306 extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
307 mbstate_t *__restrict __ps) __THROW;
309 /* Return number of bytes in multibyte character pointed to by S. */
310 extern size_t __mbrlen (__const char *__restrict __s, size_t __n,
311 mbstate_t *__restrict __ps) __THROW;
312 extern size_t mbrlen (__const char *__restrict __s, size_t __n,
313 mbstate_t *__restrict __ps) __THROW;
314 __END_NAMESPACE_C99
316 #ifdef __USE_EXTERN_INLINES
317 /* Define inline function as optimization. */
318 extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n,
319 mbstate_t *__restrict __ps) __THROW
320 { return (__ps != NULL
321 ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
322 #endif
324 __BEGIN_NAMESPACE_C99
325 /* Write wide character representation of multibyte character string
326 SRC to DST. */
327 extern size_t mbsrtowcs (wchar_t *__restrict __dst,
328 __const char **__restrict __src, size_t __len,
329 mbstate_t *__restrict __ps) __THROW;
331 /* Write multibyte character representation of wide character string
332 SRC to DST. */
333 extern size_t wcsrtombs (char *__restrict __dst,
334 __const wchar_t **__restrict __src, size_t __len,
335 mbstate_t *__restrict __ps) __THROW;
336 __END_NAMESPACE_C99
339 #ifdef __USE_GNU
340 /* Write wide character representation of at most NMC bytes of the
341 multibyte character string SRC to DST. */
342 extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
343 __const char **__restrict __src, size_t __nmc,
344 size_t __len, mbstate_t *__restrict __ps) __THROW;
346 /* Write multibyte character representation of at most NWC characters
347 from the wide character string SRC to DST. */
348 extern size_t wcsnrtombs (char *__restrict __dst,
349 __const wchar_t **__restrict __src,
350 size_t __nwc, size_t __len,
351 mbstate_t *__restrict __ps) __THROW;
352 #endif /* use GNU */
355 /* The following functions are extensions found in X/Open CAE. */
356 #ifdef __USE_XOPEN
357 /* Determine number of column positions required for C. */
358 extern int wcwidth (wchar_t __c) __THROW;
360 /* Determine number of column positions required for first N wide
361 characters (or fewer if S ends before this) in S. */
362 extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW;
363 #endif /* Use X/Open. */
366 __BEGIN_NAMESPACE_C99
367 /* Convert initial portion of the wide string NPTR to `double'
368 representation. */
369 extern double wcstod (__const wchar_t *__restrict __nptr,
370 wchar_t **__restrict __endptr) __THROW;
372 #ifdef __USE_ISOC99
373 /* Likewise for `float' and `long double' sizes of floating-point numbers. */
374 extern float wcstof (__const wchar_t *__restrict __nptr,
375 wchar_t **__restrict __endptr) __THROW;
376 extern long double wcstold (__const wchar_t *__restrict __nptr,
377 wchar_t **__restrict __endptr) __THROW;
378 #endif /* C99 */
381 /* Convert initial portion of wide string NPTR to `long int'
382 representation. */
383 extern long int wcstol (__const wchar_t *__restrict __nptr,
384 wchar_t **__restrict __endptr, int __base) __THROW;
386 /* Convert initial portion of wide string NPTR to `unsigned long int'
387 representation. */
388 extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
389 wchar_t **__restrict __endptr, int __base)
390 __THROW;
392 #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
393 /* Convert initial portion of wide string NPTR to `long int'
394 representation. */
395 __extension__
396 extern long long int wcstoll (__const wchar_t *__restrict __nptr,
397 wchar_t **__restrict __endptr, int __base)
398 __THROW;
400 /* Convert initial portion of wide string NPTR to `unsigned long long int'
401 representation. */
402 __extension__
403 extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr,
404 wchar_t **__restrict __endptr,
405 int __base) __THROW;
406 #endif /* ISO C99 or GCC and GNU. */
407 __END_NAMESPACE_C99
409 #if defined __GNUC__ && defined __USE_GNU
410 /* Convert initial portion of wide string NPTR to `long int'
411 representation. */
412 __extension__
413 extern long long int wcstoq (__const wchar_t *__restrict __nptr,
414 wchar_t **__restrict __endptr, int __base)
415 __THROW;
417 /* Convert initial portion of wide string NPTR to `unsigned long long int'
418 representation. */
419 __extension__
420 extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr,
421 wchar_t **__restrict __endptr,
422 int __base) __THROW;
423 #endif /* GCC and use GNU. */
425 #ifdef __USE_GNU
426 /* The concept of one static locale per category is not very well
427 thought out. Many applications will need to process its data using
428 information from several different locales. Another application is
429 the implementation of the internationalization handling in the
430 upcoming ISO C++ standard library. To support this another set of
431 the functions using locale data exist which have an additional
432 argument.
434 Attention: all these functions are *not* standardized in any form.
435 This is a proof-of-concept implementation. */
437 /* Structure for reentrant locale using functions. This is an
438 (almost) opaque type for the user level programs. */
439 # include <xlocale.h>
441 /* Special versions of the functions above which take the locale to
442 use as an additional parameter. */
443 extern long int wcstol_l (__const wchar_t *__restrict __nptr,
444 wchar_t **__restrict __endptr, int __base,
445 __locale_t __loc) __THROW;
447 extern unsigned long int wcstoul_l (__const wchar_t *__restrict __nptr,
448 wchar_t **__restrict __endptr,
449 int __base, __locale_t __loc) __THROW;
451 __extension__
452 extern long long int wcstoll_l (__const wchar_t *__restrict __nptr,
453 wchar_t **__restrict __endptr,
454 int __base, __locale_t __loc) __THROW;
456 __extension__
457 extern unsigned long long int wcstoull_l (__const wchar_t *__restrict __nptr,
458 wchar_t **__restrict __endptr,
459 int __base, __locale_t __loc)
460 __THROW;
462 extern double wcstod_l (__const wchar_t *__restrict __nptr,
463 wchar_t **__restrict __endptr, __locale_t __loc)
464 __THROW;
466 extern float wcstof_l (__const wchar_t *__restrict __nptr,
467 wchar_t **__restrict __endptr, __locale_t __loc)
468 __THROW;
470 extern long double wcstold_l (__const wchar_t *__restrict __nptr,
471 wchar_t **__restrict __endptr,
472 __locale_t __loc) __THROW;
473 #endif /* GNU */
476 /* The internal entry points for `wcstoX' take an extra flag argument
477 saying whether or not to parse locale-dependent number grouping. */
478 extern double __wcstod_internal (__const wchar_t *__restrict __nptr,
479 wchar_t **__restrict __endptr, int __group)
480 __THROW;
481 extern float __wcstof_internal (__const wchar_t *__restrict __nptr,
482 wchar_t **__restrict __endptr, int __group)
483 __THROW;
484 extern long double __wcstold_internal (__const wchar_t *__restrict __nptr,
485 wchar_t **__restrict __endptr,
486 int __group) __THROW;
488 #ifndef __wcstol_internal_defined
489 extern long int __wcstol_internal (__const wchar_t *__restrict __nptr,
490 wchar_t **__restrict __endptr,
491 int __base, int __group) __THROW;
492 # define __wcstol_internal_defined 1
493 #endif
494 #ifndef __wcstoul_internal_defined
495 extern unsigned long int __wcstoul_internal (__const wchar_t *__restrict __npt,
496 wchar_t **__restrict __endptr,
497 int __base, int __group) __THROW;
498 # define __wcstoul_internal_defined 1
499 #endif
500 #ifndef __wcstoll_internal_defined
501 __extension__
502 extern long long int __wcstoll_internal (__const wchar_t *__restrict __nptr,
503 wchar_t **__restrict __endptr,
504 int __base, int __group) __THROW;
505 # define __wcstoll_internal_defined 1
506 #endif
507 #ifndef __wcstoull_internal_defined
508 __extension__
509 extern unsigned long long int __wcstoull_internal (__const wchar_t *
510 __restrict __nptr,
511 wchar_t **
512 __restrict __endptr,
513 int __base,
514 int __group) __THROW;
515 # define __wcstoull_internal_defined 1
516 #endif
519 #if defined __OPTIMIZE__ && __GNUC__ >= 2
520 /* Define inline functions which call the internal entry points. */
521 __BEGIN_NAMESPACE_C99
523 extern __inline double wcstod (__const wchar_t *__restrict __nptr,
524 wchar_t **__restrict __endptr) __THROW
525 { return __wcstod_internal (__nptr, __endptr, 0); }
526 extern __inline long int wcstol (__const wchar_t *__restrict __nptr,
527 wchar_t **__restrict __endptr,
528 int __base) __THROW
529 { return __wcstol_internal (__nptr, __endptr, __base, 0); }
530 extern __inline unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
531 wchar_t **__restrict __endptr,
532 int __base) __THROW
533 { return __wcstoul_internal (__nptr, __endptr, __base, 0); }
534 __END_NAMESPACE_C99
536 # ifdef __USE_GNU
537 extern __inline float wcstof (__const wchar_t *__restrict __nptr,
538 wchar_t **__restrict __endptr) __THROW
539 { return __wcstof_internal (__nptr, __endptr, 0); }
540 extern __inline long double wcstold (__const wchar_t *__restrict __nptr,
541 wchar_t **__restrict __endptr) __THROW
542 { return __wcstold_internal (__nptr, __endptr, 0); }
545 __extension__
546 extern __inline long long int wcstoq (__const wchar_t *__restrict __nptr,
547 wchar_t **__restrict __endptr,
548 int __base) __THROW
549 { return __wcstoll_internal (__nptr, __endptr, __base, 0); }
550 __extension__
551 extern __inline unsigned long long int wcstouq (__const wchar_t *
552 __restrict __nptr,
553 wchar_t **__restrict __endptr,
554 int __base) __THROW
555 { return __wcstoull_internal (__nptr, __endptr, __base, 0); }
556 # endif /* Use GNU. */
557 #endif /* Optimizing GCC >=2. */
560 #ifdef __USE_GNU
561 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
562 DEST. */
563 extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW;
565 /* Copy no more than N characters of SRC to DEST, returning the address of
566 the last character written into DEST. */
567 extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
568 __THROW;
569 #endif /* use GNU */
572 /* Wide character I/O functions. */
573 #if defined __USE_ISOC99 || defined __USE_UNIX98
574 __BEGIN_NAMESPACE_C99
576 /* Select orientation for stream. */
577 extern int fwide (__FILE *__fp, int __mode) __THROW;
580 /* Write formatted output to STREAM. */
581 extern int fwprintf (__FILE *__restrict __stream,
582 __const wchar_t *__restrict __format, ...)
583 __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
584 /* Write formatted output to stdout. */
585 extern int wprintf (__const wchar_t *__restrict __format, ...)
586 __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
587 /* Write formatted output of at most N characters to S. */
588 extern int swprintf (wchar_t *__restrict __s, size_t __n,
589 __const wchar_t *__restrict __format, ...)
590 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
592 /* Write formatted output to S from argument list ARG. */
593 extern int vfwprintf (__FILE *__restrict __s,
594 __const wchar_t *__restrict __format,
595 __gnuc_va_list __arg)
596 __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
597 /* Write formatted output to stdout from argument list ARG. */
598 extern int vwprintf (__const wchar_t *__restrict __format,
599 __gnuc_va_list __arg)
600 __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
601 /* Write formatted output of at most N character to S from argument
602 list ARG. */
603 extern int vswprintf (wchar_t *__restrict __s, size_t __n,
604 __const wchar_t *__restrict __format,
605 __gnuc_va_list __arg)
606 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
609 /* Read formatted input from STREAM. */
610 extern int fwscanf (__FILE *__restrict __stream,
611 __const wchar_t *__restrict __format, ...)
612 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
613 /* Read formatted input from stdin. */
614 extern int wscanf (__const wchar_t *__restrict __format, ...)
615 __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
616 /* Read formatted input from S. */
617 extern int swscanf (__const wchar_t *__restrict __s,
618 __const wchar_t *__restrict __format, ...)
619 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
621 __END_NAMESPACE_C99
622 #endif /* Use ISO C99 and Unix98. */
624 #ifdef __USE_ISOC99
625 __BEGIN_NAMESPACE_C99
627 /* Read formatted input from S into argument list ARG. */
628 extern int vfwscanf (__FILE *__restrict __s,
629 __const wchar_t *__restrict __format,
630 __gnuc_va_list __arg)
631 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
632 /* Read formatted input from stdin into argument list ARG. */
633 extern int vwscanf (__const wchar_t *__restrict __format,
634 __gnuc_va_list __arg)
635 __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
636 /* Read formatted input from S into argument list ARG. */
637 extern int vswscanf (__const wchar_t *__restrict __s,
638 __const wchar_t *__restrict __format,
639 __gnuc_va_list __arg)
640 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
642 __END_NAMESPACE_C99
643 #endif /* Use ISO C99. */
646 __BEGIN_NAMESPACE_C99
647 /* Read a character from STREAM. */
648 extern wint_t fgetwc (__FILE *__stream) __THROW;
649 extern wint_t getwc (__FILE *__stream) __THROW;
651 /* Read a character from stdin. */
652 extern wint_t getwchar (void) __THROW;
655 /* Write a character to STREAM. */
656 extern wint_t fputwc (wchar_t __wc, __FILE *__stream) __THROW;
657 extern wint_t putwc (wchar_t __wc, __FILE *__stream) __THROW;
659 /* Write a character to stdout. */
660 extern wint_t putwchar (wchar_t __wc) __THROW;
663 /* Get a newline-terminated wide character string of finite length
664 from STREAM. */
665 extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
666 __FILE *__restrict __stream) __THROW;
668 /* Write a string to STREAM. */
669 extern int fputws (__const wchar_t *__restrict __ws,
670 __FILE *__restrict __stream) __THROW;
673 /* Push a character back onto the input buffer of STREAM. */
674 extern wint_t ungetwc (wint_t __wc, __FILE *__stream) __THROW;
675 __END_NAMESPACE_C99
678 #ifdef __USE_GNU
679 /* These are defined to be equivalent to the `char' functions defined
680 in POSIX.1:1996. */
681 extern wint_t getwc_unlocked (__FILE *__stream) __THROW;
682 extern wint_t getwchar_unlocked (void) __THROW;
684 /* This is the wide character version of a GNU extension. */
685 extern wint_t fgetwc_unlocked (__FILE *__stream) __THROW;
687 /* Faster version when locking is not necessary. */
688 extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream) __THROW;
690 /* These are defined to be equivalent to the `char' functions defined
691 in POSIX.1:1996. */
692 extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream) __THROW;
693 extern wint_t putwchar_unlocked (wchar_t __wc) __THROW;
696 /* This function does the same as `fgetws' but does not lock the stream. */
697 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
698 __FILE *__restrict __stream) __THROW;
700 /* This function does the same as `fputws' but does not lock the stream. */
701 extern int fputws_unlocked (__const wchar_t *__restrict __ws,
702 __FILE *__restrict __stream) __THROW;
703 #endif
706 __BEGIN_NAMESPACE_C99
707 /* Format TP into S according to FORMAT.
708 Write no more than MAXSIZE wide characters and return the number
709 of wide characters written, or 0 if it would exceed MAXSIZE. */
710 extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
711 __const wchar_t *__restrict __format,
712 __const struct tm *__restrict __tp) __THROW;
713 __END_NAMESPACE_C99
715 # ifdef __USE_GNU
716 # include <xlocale.h>
718 /* Similar to `wcsftime' but takes the information from
719 the provided locale and not the global locale. */
720 extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
721 __const wchar_t *__restrict __format,
722 __const struct tm *__restrict __tp,
723 __locale_t __loc) __THROW;
724 # endif
726 /* The X/Open standard demands that most of the functions defined in
727 the <wctype.h> header must also appear here. This is probably
728 because some X/Open members wrote their implementation before the
729 ISO C standard was published and introduced the better solution.
730 We have to provide these definitions for compliance reasons but we
731 do this nonsense only if really necessary. */
732 #if defined __USE_UNIX98 && !defined __USE_GNU
733 # define __need_iswxxx
734 # include <wctype.h>
735 #endif
737 __END_DECLS
739 #endif /* _WCHAR_H defined */
741 #endif /* wchar.h */