Update.
[glibc.git] / wcsmbs / wchar.h
blob92aa5db4700ef15b53af7693960a951fd4376556
1 /* Copyright (C) 1995-1999, 2000 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 Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 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 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 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 # include <stdio.h>
35 /* Get va_list definition. */
36 # define __need___va_list
37 # include <stdarg.h>
39 /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */
40 # define __need_size_t
41 # define __need_wchar_t
42 # define __need_NULL
43 #endif
44 #define __need_wint_t
45 #include <stddef.h>
47 #include <bits/wchar.h>
49 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
50 there. So define it ourselves if it remains undefined. */
51 #ifndef _WINT_T
52 /* Integral type unchanged by default argument promotions that can
53 hold any value corresponding to members of the extended character
54 set, as well as at least one value that does not correspond to any
55 member of the extended character set. */
56 # define _WINT_T
57 typedef unsigned int wint_t;
58 #endif
61 #ifndef __mbstate_t_defined
62 # define __mbstate_t_defined 1
63 /* Conversion state information. */
64 typedef struct
66 int __count;
67 union
69 wint_t __wch;
70 char __wchb[4];
71 } __value; /* Value so far. */
72 } __mbstate_t;
73 #endif
74 #undef __need_mbstate_t
77 /* The rest of the file is only used if used if __need_mbstate_t is not
78 defined. */
79 #ifdef _WCHAR_H
81 /* Public type. */
82 typedef __mbstate_t mbstate_t;
84 #ifndef WCHAR_MIN
85 /* These constants might also be defined in <inttypes.h>. */
86 # define WCHAR_MIN __WCHAR_MIN
87 # define WCHAR_MAX __WCHAR_MAX
88 #endif
90 #ifndef WEOF
91 # define WEOF (0xffffffffu)
92 #endif
94 /* For XPG4 compliance we have to define the stuff from <wctype.h> here
95 as well. */
96 #if defined __USE_XOPEN && !defined __USE_UNIX98
97 # include <wctype.h>
98 #endif
100 /* This incomplete type is defined in <time.h> but needed here because
101 of `wcsftime'. */
102 struct tm;
105 __BEGIN_DECLS
107 /* Copy SRC to DEST. */
108 extern wchar_t *wcscpy (wchar_t *__restrict __dest,
109 __const wchar_t *__restrict __src) __THROW;
110 /* Copy no more than N wide-characters of SRC to DEST. */
111 extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
112 __const wchar_t *__restrict __src, size_t __n)
113 __THROW;
115 /* Append SRC onto DEST. */
116 extern wchar_t *wcscat (wchar_t *__restrict __dest,
117 __const wchar_t *__restrict __src) __THROW;
118 /* Append no more than N wide-characters of SRC onto DEST. */
119 extern wchar_t *wcsncat (wchar_t *__restrict __dest,
120 __const wchar_t *__restrict __src, size_t __n)
121 __THROW;
123 /* Compare S1 and S2. */
124 extern int wcscmp (__const wchar_t *__s1, __const wchar_t *__s2)
125 __THROW __attribute_pure__;
126 /* Compare N wide-characters of S1 and S2. */
127 extern int wcsncmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n)
128 __THROW __attribute_pure__;
130 #ifdef __USE_GNU
131 /* Compare S1 and S2, ignoring case. */
132 extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
134 /* Compare no more than N chars of S1 and S2, ignoring case. */
135 extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
136 size_t __n) __THROW;
138 /* Similar to the two functions above but take the information from
139 the provided locale and not the global locale. */
140 # include <xlocale.h>
142 extern int __wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
143 __locale_t __loc) __THROW;
145 extern int __wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
146 size_t __n, __locale_t __loc) __THROW;
147 #endif
149 /* Compare S1 and S2, both interpreted as appropriate to the
150 LC_COLLATE category of the current locale. */
151 extern int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
152 /* Transform S2 into array pointed to by S1 such that if wcscmp is
153 applied to two transformed strings the result is the as applying
154 `wcscoll' to the original strings. */
155 extern size_t wcsxfrm (wchar_t *__restrict __s1,
156 __const wchar_t *__restrict __s2, size_t __n) __THROW;
158 #ifdef __USE_GNU
159 /* Similar to the two functions above but take the information from
160 the provided locale and not the global locale. */
162 /* Compare S1 and S2, both interpreted as appropriate to the
163 LC_COLLATE category of the given locale. */
164 extern int __wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
165 __locale_t __loc) __THROW;
166 /* Transform S2 into array pointed to by S1 such that if wcscmp is
167 applied to two transformed strings the result is the as applying
168 `wcscoll' to the original strings. */
169 extern size_t __wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
170 size_t __n, __locale_t __loc) __THROW;
172 /* Duplicate S, returning an identical malloc'd string. */
173 extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__;
174 #endif
176 /* Find the first occurrence of WC in WCS. */
177 extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
178 __THROW __attribute_pure__;
179 /* Find the last occurrence of WC in WCS. */
180 extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc)
181 __THROW __attribute_pure__;
183 #ifdef __USE_GNU
184 /* This funciton is similar to `wcschr'. But it returns a pointer to
185 the closing NUL wide character in case C is not found in S. */
186 extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc)
187 __THROW __attribute_pure__;
188 #endif
190 /* Return the length of the initial segmet of WCS which
191 consists entirely of wide characters not in REJECT. */
192 extern size_t wcscspn (__const wchar_t *__wcs, __const wchar_t *__reject)
193 __THROW __attribute_pure__;
194 /* Return the length of the initial segmet of WCS which
195 consists entirely of wide characters in ACCEPT. */
196 extern size_t wcsspn (__const wchar_t *__wcs, __const wchar_t *__accept)
197 __THROW __attribute_pure__;
198 /* Find the first occurrence in WCS of any character in ACCEPT. */
199 extern wchar_t *wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept)
200 __THROW __attribute_pure__;
201 /* Find the first occurrence of NEEDLE in HAYSTACK. */
202 extern wchar_t *wcsstr (__const wchar_t *__haystack, __const wchar_t *__needle)
203 __THROW __attribute_pure__;
205 #ifdef __USE_XOPEN
206 /* Another name for `wcsstr' from XPG4. */
207 extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle)
208 __THROW __attribute_pure__;
209 #endif
211 /* Divide WCS into tokens separated by characters in DELIM. */
212 extern wchar_t *wcstok (wchar_t *__restrict __s,
213 __const wchar_t *__restrict __delim,
214 wchar_t **__restrict __ptr) __THROW;
216 /* Return the number of wide characters in S. */
217 extern size_t __wcslen (__const wchar_t *__s) __THROW __attribute_pure__;
218 extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__;
220 #ifdef __USE_GNU
221 /* Return the number of wide characters in S, but at most MAXLEN. */
222 extern size_t wcsnlen (__const wchar_t *__s, size_t __maxlen)
223 __THROW __attribute_pure__;
224 #endif
227 /* Search N wide characters of S for C. */
228 extern wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n)
229 __THROW __attribute_pure__;
231 /* Compare N wide characters of S1 and S2. */
232 extern int wmemcmp (__const wchar_t *__restrict __s1,
233 __const wchar_t *__restrict __s2, size_t __n)
234 __THROW __attribute_pure__;
236 /* Copy N wide characters of SRC to DEST. */
237 extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
238 __const wchar_t *__restrict __s2, size_t __n) __THROW;
240 /* Copy N wide characters of SRC to DEST, guaranteeing
241 correct behavior for overlapping strings. */
242 extern wchar_t *wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n)
243 __THROW;
245 /* Set N wide characters of S to C. */
246 extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
248 #ifdef __USE_GNU
249 /* Copy N wide characters of SRC to DEST and return pointer to following
250 wide character. */
251 extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
252 __const wchar_t *__restrict __s2, size_t __n)
253 __THROW;
254 #endif
257 /* Determine whether C constitutes a valid (one-byte) multibyte
258 character. */
259 extern wint_t btowc (int __c) __THROW;
261 /* Determine whether C corresponds to a member of the extended
262 character set whose multibyte representation is a single byte. */
263 extern int wctob (wint_t __c) __THROW;
265 /* Determine whether PS points to an object representing the initial
266 state. */
267 extern int mbsinit (__const mbstate_t *__ps) __THROW;
269 /* Write wide character representation of multibyte character pointed
270 to by S to PWC. */
271 extern size_t mbrtowc (wchar_t *__restrict __pwc,
272 __const char *__restrict __s, size_t __n,
273 mbstate_t *__p) __THROW;
275 /* Write multibyte representation of wide character WC to S. */
276 extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
277 mbstate_t *__restrict __ps) __THROW;
279 /* Return number of bytes in multibyte character pointed to by S. */
280 extern size_t __mbrlen (__const char *__restrict __s, size_t __n,
281 mbstate_t *__restrict __ps) __THROW;
282 extern size_t mbrlen (__const char *__restrict __s, size_t __n,
283 mbstate_t *__restrict __ps) __THROW;
285 #if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \
286 && defined __USE_EXTERN_INLINES
287 /* Define inline function as optimization. */
288 extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n,
289 mbstate_t *__restrict __ps) __THROW
290 { return (__ps != NULL
291 ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
292 #endif
294 /* Write wide character representation of multibyte character string
295 SRC to DST. */
296 extern size_t mbsrtowcs (wchar_t *__restrict __dst,
297 __const char **__restrict __src, size_t __len,
298 mbstate_t *__restrict __ps) __THROW;
300 /* Write multibyte character representation of wide character string
301 SRC to DST. */
302 extern size_t wcsrtombs (char *__restrict __dst,
303 __const wchar_t **__restrict __src, size_t __len,
304 mbstate_t *__restrict __ps) __THROW;
307 #ifdef __USE_GNU
308 /* Write wide character representation of at most NMC bytes of the
309 multibyte character string SRC to DST. */
310 extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
311 __const char **__restrict __src, size_t __nmc,
312 size_t __len, mbstate_t *__restrict __ps) __THROW;
314 /* Write multibyte character representation of at most NWC characters
315 from the wide character string SRC to DST. */
316 extern size_t wcsnrtombs (char *__restrict __dst,
317 __const wchar_t **__restrict __src,
318 size_t __nwc, size_t __len,
319 mbstate_t *__restrict __ps) __THROW;
320 #endif /* use GNU */
323 /* The following functions are extensions found in X/Open CAE. */
324 #ifdef __USE_XOPEN
325 /* Determine number of column positions required for C. */
326 extern int wcwidth (wint_t __c) __THROW;
328 /* Determine number of column positions required for first N wide
329 characters (or fewer if S ends before this) in S. */
330 extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW;
331 #endif /* Use X/Open. */
334 /* Convert initial portion of the wide string NPTR to `double'
335 representation. */
336 extern double wcstod (__const wchar_t *__restrict __nptr,
337 wchar_t **__restrict __endptr) __THROW;
339 #ifdef __USE_ISOC99
340 /* Likewise for `float' and `long double' sizes of floating-point numbers. */
341 extern float wcstof (__const wchar_t *__restrict __nptr,
342 wchar_t **__restrict __endptr) __THROW;
343 extern long double wcstold (__const wchar_t *__restrict __nptr,
344 wchar_t **__restrict __endptr) __THROW;
345 #endif /* C99 */
348 /* Convert initial portion of wide string NPTR to `long int'
349 representation. */
350 extern long int wcstol (__const wchar_t *__restrict __nptr,
351 wchar_t **__restrict __endptr, int __base) __THROW;
353 /* Convert initial portion of wide string NPTR to `unsigned long int'
354 representation. */
355 extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
356 wchar_t **__restrict __endptr, int __base)
357 __THROW;
359 #if defined __GNUC__ && defined __USE_GNU
360 /* Convert initial portion of wide string NPTR to `long int'
361 representation. */
362 __extension__
363 extern long long int wcstoq (__const wchar_t *__restrict __nptr,
364 wchar_t **__restrict __endptr, int __base)
365 __THROW;
367 /* Convert initial portion of wide string NPTR to `unsigned long long int'
368 representation. */
369 __extension__
370 extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr,
371 wchar_t **__restrict __endptr,
372 int __base) __THROW;
373 #endif /* GCC and use GNU. */
375 #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
376 /* Convert initial portion of wide string NPTR to `long int'
377 representation. */
378 __extension__
379 extern long long int wcstoll (__const wchar_t *__restrict __nptr,
380 wchar_t **__restrict __endptr, int __base)
381 __THROW;
383 /* Convert initial portion of wide string NPTR to `unsigned long long int'
384 representation. */
385 __extension__
386 extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr,
387 wchar_t **__restrict __endptr,
388 int __base) __THROW;
389 #endif /* ISO C99 or GCC and GNU. */
391 #ifdef __USE_GNU
392 /* The concept of one static locale per category is not very well
393 thought out. Many applications will need to process its data using
394 information from several different locales. Another application is
395 the implementation of the internationalization handling in the
396 upcoming ISO C++ standard library. To support this another set of
397 the functions using locale data exist which have an additional
398 argument.
400 Attention: all these functions are *not* standardized in any form.
401 This is a proof-of-concept implementation. */
403 /* Structure for reentrant locale using functions. This is an
404 (almost) opaque type for the user level programs. */
405 # include <xlocale.h>
407 /* Special versions of the functions above which take the locale to
408 use as an additional parameter. */
409 extern long int __wcstol_l (__const wchar_t *__restrict __nptr,
410 wchar_t **__restrict __endptr, int __base,
411 __locale_t __loc) __THROW;
413 extern unsigned long int __wcstoul_l (__const wchar_t *__restrict __nptr,
414 wchar_t **__restrict __endptr,
415 int __base, __locale_t __loc) __THROW;
417 __extension__
418 extern long long int __wcstoll_l (__const wchar_t *__restrict __nptr,
419 wchar_t **__restrict __endptr,
420 int __base, __locale_t __loc) __THROW;
422 __extension__
423 extern unsigned long long int __wcstoull_l (__const wchar_t *__restrict __nptr,
424 wchar_t **__restrict __endptr,
425 int __base, __locale_t __loc)
426 __THROW;
428 extern double __wcstod_l (__const wchar_t *__restrict __nptr,
429 wchar_t **__restrict __endptr, __locale_t __loc)
430 __THROW;
432 extern float __wcstof_l (__const wchar_t *__restrict __nptr,
433 wchar_t **__restrict __endptr, __locale_t __loc)
434 __THROW;
436 extern long double __wcstold_l (__const wchar_t *__restrict __nptr,
437 wchar_t **__restrict __endptr,
438 __locale_t __loc) __THROW;
439 #endif /* GNU */
442 /* The internal entry points for `wcstoX' take an extra flag argument
443 saying whether or not to parse locale-dependent number grouping. */
444 extern double __wcstod_internal (__const wchar_t *__restrict __nptr,
445 wchar_t **__restrict __endptr, int __group)
446 __THROW;
447 extern float __wcstof_internal (__const wchar_t *__restrict __nptr,
448 wchar_t **__restrict __endptr, int __group)
449 __THROW;
450 extern long double __wcstold_internal (__const wchar_t *__restrict __nptr,
451 wchar_t **__restrict __endptr,
452 int __group) __THROW;
454 #ifndef __wcstol_internal_defined
455 extern long int __wcstol_internal (__const wchar_t *__restrict __nptr,
456 wchar_t **__restrict __endptr,
457 int __base, int __group) __THROW;
458 # define __wcstol_internal_defined 1
459 #endif
460 #ifndef __wcstoul_internal_defined
461 extern unsigned long int __wcstoul_internal (__const wchar_t *__restrict __npt,
462 wchar_t **__restrict __endptr,
463 int __base, int __group) __THROW;
464 # define __wcstoul_internal_defined 1
465 #endif
466 #ifndef __wcstoll_internal_defined
467 __extension__
468 extern long long int __wcstoll_internal (__const wchar_t *__restrict __nptr,
469 wchar_t **__restrict __endptr,
470 int __base, int __group) __THROW;
471 # define __wcstoll_internal_defined 1
472 #endif
473 #ifndef __wcstoull_internal_defined
474 __extension__
475 extern unsigned long long int __wcstoull_internal (__const wchar_t *
476 __restrict __nptr,
477 wchar_t **
478 __restrict __endptr,
479 int __base,
480 int __group) __THROW;
481 # define __wcstoull_internal_defined 1
482 #endif
485 #if defined __OPTIMIZE__ && __GNUC__ >= 2
486 /* Define inline functions which call the internal entry points. */
488 extern __inline double wcstod (__const wchar_t *__restrict __nptr,
489 wchar_t **__restrict __endptr) __THROW
490 { return __wcstod_internal (__nptr, __endptr, 0); }
491 extern __inline long int wcstol (__const wchar_t *__restrict __nptr,
492 wchar_t **__restrict __endptr,
493 int __base) __THROW
494 { return __wcstol_internal (__nptr, __endptr, __base, 0); }
495 extern __inline unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
496 wchar_t **__restrict __endptr,
497 int __base) __THROW
498 { return __wcstoul_internal (__nptr, __endptr, __base, 0); }
500 # ifdef __USE_GNU
501 extern __inline float wcstof (__const wchar_t *__restrict __nptr,
502 wchar_t **__restrict __endptr) __THROW
503 { return __wcstof_internal (__nptr, __endptr, 0); }
504 extern __inline long double wcstold (__const wchar_t *__restrict __nptr,
505 wchar_t **__restrict __endptr) __THROW
506 { return __wcstold_internal (__nptr, __endptr, 0); }
509 __extension__
510 extern __inline long long int wcstoq (__const wchar_t *__restrict __nptr,
511 wchar_t **__restrict __endptr,
512 int __base) __THROW
513 { return __wcstoll_internal (__nptr, __endptr, __base, 0); }
514 __extension__
515 extern __inline unsigned long long int wcstouq (__const wchar_t *
516 __restrict __nptr,
517 wchar_t **__restrict __endptr,
518 int __base) __THROW
519 { return __wcstoull_internal (__nptr, __endptr, __base, 0); }
520 # endif /* Use GNU. */
521 #endif /* Optimizing GCC >=2. */
524 #ifdef __USE_GNU
525 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
526 DEST. */
527 extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW;
529 /* Copy no more than N characters of SRC to DEST, returning the address of
530 the last character written into DEST. */
531 extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
532 __THROW;
533 #endif /* use GNU */
536 /* Wide character I/O functions. */
537 #if defined __USE_ISOC99 || defined __USE_UNIX98
539 /* Select orientation for stream. */
540 extern int fwide (__FILE *__fp, int __mode) __THROW;
543 /* Write formatted output to STREAM. */
544 extern int fwprintf (__FILE *__restrict __stream,
545 __const wchar_t *__restrict __format, ...)
546 __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
547 /* Write formatted output to stdout. */
548 extern int wprintf (__const wchar_t *__restrict __format, ...)
549 __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
550 /* Write formatted output of at most N characters to S. */
551 extern int swprintf (wchar_t *__restrict __s, size_t __n,
552 __const wchar_t *__restrict __format, ...)
553 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
555 /* Write formatted output to S from argument list ARG. */
556 extern int vfwprintf (__FILE *__restrict __s,
557 __const wchar_t *__restrict __format,
558 __gnuc_va_list __arg)
559 __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
560 /* Write formatted output to stdout from argument list ARG. */
561 extern int vwprintf (__const wchar_t *__restrict __format,
562 __gnuc_va_list __arg)
563 __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
564 /* Write formatted output of at most N character to S from argument
565 list ARG. */
566 extern int vswprintf (wchar_t *__restrict __s, size_t __n,
567 __const wchar_t *__restrict __format,
568 __gnuc_va_list __arg)
569 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
572 /* Read formatted input from STREAM. */
573 extern int fwscanf (__FILE *__restrict __stream,
574 __const wchar_t *__restrict __format, ...)
575 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
576 /* Read formatted input from stdin. */
577 extern int wscanf (__const wchar_t *__restrict __format, ...)
578 __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
579 /* Read formatted input from S. */
580 extern int swscanf (__const wchar_t *__restrict __s,
581 __const wchar_t *__restrict __format, ...)
582 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
583 #endif /* Use ISO C99 and Unix98. */
585 #ifdef __USE_ISOC99
586 /* Read formatted input from S into argument list ARG. */
587 extern int vfwscanf (__FILE *__restrict __s,
588 __const wchar_t *__restrict __format,
589 __gnuc_va_list __arg)
590 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
591 /* Read formatted input from stdin into argument list ARG. */
592 extern int vwscanf (__const wchar_t *__restrict __format,
593 __gnuc_va_list __arg)
594 __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
595 /* Read formatted input from S into argument list ARG. */
596 extern int vswscanf (__const wchar_t *__restrict __s,
597 __const wchar_t *__restrict __format,
598 __gnuc_va_list __arg)
599 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
600 #endif /* Use ISO C99. */
603 /* Read a character from STREAM. */
604 extern wint_t fgetwc (__FILE *__stream);
605 extern wint_t getwc (__FILE *__stream);
607 /* Read a character from stdin. */
608 extern wint_t getwchar (void);
611 /* Write a character to STREAM. */
612 extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
613 extern wint_t putwc (wchar_t __wc, __FILE *__stream);
615 /* Write a character to stdout. */
616 extern wint_t putwchar (wchar_t __wc);
619 /* Get a newline-terminated wide character string of finite length
620 from STREAM. */
621 extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
622 __FILE *__restrict __stream);
624 /* Write a string to STREAM. */
625 extern int fputws (__const wchar_t *__restrict __ws,
626 __FILE *__restrict __stream);
629 /* Push a character back onto the input buffer of STREAM. */
630 extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
633 #ifdef __USE_GNU
634 /* These are defined to be equivalent to the `char' functions defined
635 in POSIX.1:1996. */
636 extern wint_t getwc_unlocked (__FILE *__stream);
637 extern wint_t getwchar_unlocked (void);
639 /* This is the wide character version of a GNU extension. */
640 extern wint_t fgetwc_unlocked (__FILE *__stream);
642 /* Faster version when locking is not necessary. */
643 extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
645 /* These are defined to be equivalent to the `char' functions defined
646 in POSIX.1:1996. */
647 extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
648 extern wint_t putwchar_unlocked (wchar_t __wc);
651 /* This function does the same as `fgetws' but does not lock the stream. */
652 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
653 __FILE *__restrict __stream);
655 /* This function does the same as `fputws' but does not lock the stream. */
656 extern int fputws_unlocked (__const wchar_t *__restrict __ws,
657 __FILE *__restrict __stream);
658 #endif
661 /* Format TP into S according to FORMAT.
662 Write no more than MAXSIZE wide characters and return the number
663 of wide characters written, or 0 if it would exceed MAXSIZE. */
664 extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
665 __const wchar_t *__restrict __format,
666 __const struct tm *__restrict __tp);
668 /* The X/Open standard demands that most of the functions defined in
669 the <wctype.h> header must also appear here. This is probably
670 because some X/Open members wrote their implementation before the
671 ISO C standard was published and introduced the better solution.
672 We have to provide these definitions for compliance reasons but we
673 do this nonsense only if really necessary. */
674 #if defined __USE_UNIX98 && !defined __USE_GNU
675 # define __need_iswxxx
676 # include <wctype.h>
677 #endif
679 __END_DECLS
681 #endif /* _WCHAR_H defined */
683 #endif /* wchar.h */