Update.
[glibc.git] / wcsmbs / wchar.h
blobaa2d1955bce545470ee79ec6383cac3d55467f1f
1 /* Copyright (C) 1995-1999, 2000, 2001 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 # 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 #endif
64 #ifndef __mbstate_t_defined
65 # define __mbstate_t_defined 1
66 /* Conversion state information. */
67 typedef struct
69 int __count;
70 union
72 wint_t __wch;
73 char __wchb[4];
74 } __value; /* Value so far. */
75 } __mbstate_t;
76 #endif
77 #undef __need_mbstate_t
80 /* The rest of the file is only used if used if __need_mbstate_t is not
81 defined. */
82 #ifdef _WCHAR_H
84 /* Public type. */
85 typedef __mbstate_t mbstate_t;
87 #ifndef WCHAR_MIN
88 /* These constants might also be defined in <inttypes.h>. */
89 # define WCHAR_MIN __WCHAR_MIN
90 # define WCHAR_MAX __WCHAR_MAX
91 #endif
93 #ifndef WEOF
94 # define WEOF (0xffffffffu)
95 #endif
97 /* For XPG4 compliance we have to define the stuff from <wctype.h> here
98 as well. */
99 #if defined __USE_XOPEN && !defined __USE_UNIX98
100 # include <wctype.h>
101 #endif
103 /* This incomplete type is defined in <time.h> but needed here because
104 of `wcsftime'. */
105 struct tm;
108 __BEGIN_DECLS
110 /* Copy SRC to DEST. */
111 extern wchar_t *wcscpy (wchar_t *__restrict __dest,
112 __const wchar_t *__restrict __src) __THROW;
113 /* Copy no more than N wide-characters of SRC to DEST. */
114 extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
115 __const wchar_t *__restrict __src, size_t __n)
116 __THROW;
118 /* Append SRC onto DEST. */
119 extern wchar_t *wcscat (wchar_t *__restrict __dest,
120 __const wchar_t *__restrict __src) __THROW;
121 /* Append no more than N wide-characters of SRC onto DEST. */
122 extern wchar_t *wcsncat (wchar_t *__restrict __dest,
123 __const wchar_t *__restrict __src, size_t __n)
124 __THROW;
126 /* Compare S1 and S2. */
127 extern int wcscmp (__const wchar_t *__s1, __const wchar_t *__s2)
128 __THROW __attribute_pure__;
129 /* Compare N wide-characters of S1 and S2. */
130 extern int wcsncmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n)
131 __THROW __attribute_pure__;
133 #ifdef __USE_GNU
134 /* Compare S1 and S2, ignoring case. */
135 extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
137 /* Compare no more than N chars of S1 and S2, ignoring case. */
138 extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
139 size_t __n) __THROW;
141 /* Similar to the two functions above but take the information from
142 the provided locale and not the global locale. */
143 # include <xlocale.h>
145 extern int __wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
146 __locale_t __loc) __THROW;
148 extern int __wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
149 size_t __n, __locale_t __loc) __THROW;
150 #endif
152 /* Compare S1 and S2, both interpreted as appropriate to the
153 LC_COLLATE category of the current locale. */
154 extern int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
155 /* Transform S2 into array pointed to by S1 such that if wcscmp is
156 applied to two transformed strings the result is the as applying
157 `wcscoll' to the original strings. */
158 extern size_t wcsxfrm (wchar_t *__restrict __s1,
159 __const wchar_t *__restrict __s2, size_t __n) __THROW;
161 #ifdef __USE_GNU
162 /* Similar to the two functions above but take the information from
163 the provided locale and not the global locale. */
165 /* Compare S1 and S2, both interpreted as appropriate to the
166 LC_COLLATE category of the given locale. */
167 extern int __wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
168 __locale_t __loc) __THROW;
169 /* Transform S2 into array pointed to by S1 such that if wcscmp is
170 applied to two transformed strings the result is the as applying
171 `wcscoll' to the original strings. */
172 extern size_t __wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
173 size_t __n, __locale_t __loc) __THROW;
175 /* Duplicate S, returning an identical malloc'd string. */
176 extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__;
177 #endif
179 /* Find the first occurrence of WC in WCS. */
180 extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
181 __THROW __attribute_pure__;
182 /* Find the last occurrence of WC in WCS. */
183 extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc)
184 __THROW __attribute_pure__;
186 #ifdef __USE_GNU
187 /* This funciton is similar to `wcschr'. But it returns a pointer to
188 the closing NUL wide character in case C is not found in S. */
189 extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc)
190 __THROW __attribute_pure__;
191 #endif
193 /* Return the length of the initial segmet of WCS which
194 consists entirely of wide characters not in REJECT. */
195 extern size_t wcscspn (__const wchar_t *__wcs, __const wchar_t *__reject)
196 __THROW __attribute_pure__;
197 /* Return the length of the initial segmet of WCS which
198 consists entirely of wide characters in ACCEPT. */
199 extern size_t wcsspn (__const wchar_t *__wcs, __const wchar_t *__accept)
200 __THROW __attribute_pure__;
201 /* Find the first occurrence in WCS of any character in ACCEPT. */
202 extern wchar_t *wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept)
203 __THROW __attribute_pure__;
204 /* Find the first occurrence of NEEDLE in HAYSTACK. */
205 extern wchar_t *wcsstr (__const wchar_t *__haystack, __const wchar_t *__needle)
206 __THROW __attribute_pure__;
208 #ifdef __USE_XOPEN
209 /* Another name for `wcsstr' from XPG4. */
210 extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle)
211 __THROW __attribute_pure__;
212 #endif
214 /* Divide WCS into tokens separated by characters in DELIM. */
215 extern wchar_t *wcstok (wchar_t *__restrict __s,
216 __const wchar_t *__restrict __delim,
217 wchar_t **__restrict __ptr) __THROW;
219 /* Return the number of wide characters in S. */
220 extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__;
222 #ifdef __USE_GNU
223 /* Return the number of wide characters in S, but at most MAXLEN. */
224 extern size_t wcsnlen (__const wchar_t *__s, size_t __maxlen)
225 __THROW __attribute_pure__;
226 #endif
229 /* Search N wide characters of S for C. */
230 extern wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n)
231 __THROW __attribute_pure__;
233 /* Compare N wide characters of S1 and S2. */
234 extern int wmemcmp (__const wchar_t *__restrict __s1,
235 __const wchar_t *__restrict __s2, size_t __n)
236 __THROW __attribute_pure__;
238 /* Copy N wide characters of SRC to DEST. */
239 extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
240 __const wchar_t *__restrict __s2, size_t __n) __THROW;
242 /* Copy N wide characters of SRC to DEST, guaranteeing
243 correct behavior for overlapping strings. */
244 extern wchar_t *wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n)
245 __THROW;
247 /* Set N wide characters of S to C. */
248 extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
250 #ifdef __USE_GNU
251 /* Copy N wide characters of SRC to DEST and return pointer to following
252 wide character. */
253 extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
254 __const wchar_t *__restrict __s2, size_t __n)
255 __THROW;
256 #endif
259 /* Determine whether C constitutes a valid (one-byte) multibyte
260 character. */
261 extern wint_t btowc (int __c) __THROW;
263 /* Determine whether C corresponds to a member of the extended
264 character set whose multibyte representation is a single byte. */
265 extern int wctob (wint_t __c) __THROW;
267 /* Determine whether PS points to an object representing the initial
268 state. */
269 extern int mbsinit (__const mbstate_t *__ps) __THROW;
271 /* Write wide character representation of multibyte character pointed
272 to by S to PWC. */
273 extern size_t mbrtowc (wchar_t *__restrict __pwc,
274 __const char *__restrict __s, size_t __n,
275 mbstate_t *__p) __THROW;
277 /* Write multibyte representation of wide character WC to S. */
278 extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
279 mbstate_t *__restrict __ps) __THROW;
281 /* Return number of bytes in multibyte character pointed to by S. */
282 extern size_t __mbrlen (__const char *__restrict __s, size_t __n,
283 mbstate_t *__restrict __ps) __THROW;
284 extern size_t mbrlen (__const char *__restrict __s, size_t __n,
285 mbstate_t *__restrict __ps) __THROW;
287 #if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \
288 && defined __USE_EXTERN_INLINES
289 /* Define inline function as optimization. */
290 extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n,
291 mbstate_t *__restrict __ps) __THROW
292 { return (__ps != NULL
293 ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
294 #endif
296 /* Write wide character representation of multibyte character string
297 SRC to DST. */
298 extern size_t mbsrtowcs (wchar_t *__restrict __dst,
299 __const char **__restrict __src, size_t __len,
300 mbstate_t *__restrict __ps) __THROW;
302 /* Write multibyte character representation of wide character string
303 SRC to DST. */
304 extern size_t wcsrtombs (char *__restrict __dst,
305 __const wchar_t **__restrict __src, size_t __len,
306 mbstate_t *__restrict __ps) __THROW;
309 #ifdef __USE_GNU
310 /* Write wide character representation of at most NMC bytes of the
311 multibyte character string SRC to DST. */
312 extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
313 __const char **__restrict __src, size_t __nmc,
314 size_t __len, mbstate_t *__restrict __ps) __THROW;
316 /* Write multibyte character representation of at most NWC characters
317 from the wide character string SRC to DST. */
318 extern size_t wcsnrtombs (char *__restrict __dst,
319 __const wchar_t **__restrict __src,
320 size_t __nwc, size_t __len,
321 mbstate_t *__restrict __ps) __THROW;
322 #endif /* use GNU */
325 /* The following functions are extensions found in X/Open CAE. */
326 #ifdef __USE_XOPEN
327 /* Determine number of column positions required for C. */
328 extern int wcwidth (wint_t __c) __THROW;
330 /* Determine number of column positions required for first N wide
331 characters (or fewer if S ends before this) in S. */
332 extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW;
333 #endif /* Use X/Open. */
336 /* Convert initial portion of the wide string NPTR to `double'
337 representation. */
338 extern double wcstod (__const wchar_t *__restrict __nptr,
339 wchar_t **__restrict __endptr) __THROW;
341 #ifdef __USE_ISOC99
342 /* Likewise for `float' and `long double' sizes of floating-point numbers. */
343 extern float wcstof (__const wchar_t *__restrict __nptr,
344 wchar_t **__restrict __endptr) __THROW;
345 extern long double wcstold (__const wchar_t *__restrict __nptr,
346 wchar_t **__restrict __endptr) __THROW;
347 #endif /* C99 */
350 /* Convert initial portion of wide string NPTR to `long int'
351 representation. */
352 extern long int wcstol (__const wchar_t *__restrict __nptr,
353 wchar_t **__restrict __endptr, int __base) __THROW;
355 /* Convert initial portion of wide string NPTR to `unsigned long int'
356 representation. */
357 extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
358 wchar_t **__restrict __endptr, int __base)
359 __THROW;
361 #if defined __GNUC__ && defined __USE_GNU
362 /* Convert initial portion of wide string NPTR to `long int'
363 representation. */
364 __extension__
365 extern long long int wcstoq (__const wchar_t *__restrict __nptr,
366 wchar_t **__restrict __endptr, int __base)
367 __THROW;
369 /* Convert initial portion of wide string NPTR to `unsigned long long int'
370 representation. */
371 __extension__
372 extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr,
373 wchar_t **__restrict __endptr,
374 int __base) __THROW;
375 #endif /* GCC and use GNU. */
377 #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
378 /* Convert initial portion of wide string NPTR to `long int'
379 representation. */
380 __extension__
381 extern long long int wcstoll (__const wchar_t *__restrict __nptr,
382 wchar_t **__restrict __endptr, int __base)
383 __THROW;
385 /* Convert initial portion of wide string NPTR to `unsigned long long int'
386 representation. */
387 __extension__
388 extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr,
389 wchar_t **__restrict __endptr,
390 int __base) __THROW;
391 #endif /* ISO C99 or GCC and GNU. */
393 #ifdef __USE_GNU
394 /* The concept of one static locale per category is not very well
395 thought out. Many applications will need to process its data using
396 information from several different locales. Another application is
397 the implementation of the internationalization handling in the
398 upcoming ISO C++ standard library. To support this another set of
399 the functions using locale data exist which have an additional
400 argument.
402 Attention: all these functions are *not* standardized in any form.
403 This is a proof-of-concept implementation. */
405 /* Structure for reentrant locale using functions. This is an
406 (almost) opaque type for the user level programs. */
407 # include <xlocale.h>
409 /* Special versions of the functions above which take the locale to
410 use as an additional parameter. */
411 extern long int __wcstol_l (__const wchar_t *__restrict __nptr,
412 wchar_t **__restrict __endptr, int __base,
413 __locale_t __loc) __THROW;
415 extern unsigned long int __wcstoul_l (__const wchar_t *__restrict __nptr,
416 wchar_t **__restrict __endptr,
417 int __base, __locale_t __loc) __THROW;
419 __extension__
420 extern long long int __wcstoll_l (__const wchar_t *__restrict __nptr,
421 wchar_t **__restrict __endptr,
422 int __base, __locale_t __loc) __THROW;
424 __extension__
425 extern unsigned long long int __wcstoull_l (__const wchar_t *__restrict __nptr,
426 wchar_t **__restrict __endptr,
427 int __base, __locale_t __loc)
428 __THROW;
430 extern double __wcstod_l (__const wchar_t *__restrict __nptr,
431 wchar_t **__restrict __endptr, __locale_t __loc)
432 __THROW;
434 extern float __wcstof_l (__const wchar_t *__restrict __nptr,
435 wchar_t **__restrict __endptr, __locale_t __loc)
436 __THROW;
438 extern long double __wcstold_l (__const wchar_t *__restrict __nptr,
439 wchar_t **__restrict __endptr,
440 __locale_t __loc) __THROW;
441 #endif /* GNU */
444 /* The internal entry points for `wcstoX' take an extra flag argument
445 saying whether or not to parse locale-dependent number grouping. */
446 extern double __wcstod_internal (__const wchar_t *__restrict __nptr,
447 wchar_t **__restrict __endptr, int __group)
448 __THROW;
449 extern float __wcstof_internal (__const wchar_t *__restrict __nptr,
450 wchar_t **__restrict __endptr, int __group)
451 __THROW;
452 extern long double __wcstold_internal (__const wchar_t *__restrict __nptr,
453 wchar_t **__restrict __endptr,
454 int __group) __THROW;
456 #ifndef __wcstol_internal_defined
457 extern long int __wcstol_internal (__const wchar_t *__restrict __nptr,
458 wchar_t **__restrict __endptr,
459 int __base, int __group) __THROW;
460 # define __wcstol_internal_defined 1
461 #endif
462 #ifndef __wcstoul_internal_defined
463 extern unsigned long int __wcstoul_internal (__const wchar_t *__restrict __npt,
464 wchar_t **__restrict __endptr,
465 int __base, int __group) __THROW;
466 # define __wcstoul_internal_defined 1
467 #endif
468 #ifndef __wcstoll_internal_defined
469 __extension__
470 extern long long int __wcstoll_internal (__const wchar_t *__restrict __nptr,
471 wchar_t **__restrict __endptr,
472 int __base, int __group) __THROW;
473 # define __wcstoll_internal_defined 1
474 #endif
475 #ifndef __wcstoull_internal_defined
476 __extension__
477 extern unsigned long long int __wcstoull_internal (__const wchar_t *
478 __restrict __nptr,
479 wchar_t **
480 __restrict __endptr,
481 int __base,
482 int __group) __THROW;
483 # define __wcstoull_internal_defined 1
484 #endif
487 #if defined __OPTIMIZE__ && __GNUC__ >= 2
488 /* Define inline functions which call the internal entry points. */
490 extern __inline double wcstod (__const wchar_t *__restrict __nptr,
491 wchar_t **__restrict __endptr) __THROW
492 { return __wcstod_internal (__nptr, __endptr, 0); }
493 extern __inline long int wcstol (__const wchar_t *__restrict __nptr,
494 wchar_t **__restrict __endptr,
495 int __base) __THROW
496 { return __wcstol_internal (__nptr, __endptr, __base, 0); }
497 extern __inline unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
498 wchar_t **__restrict __endptr,
499 int __base) __THROW
500 { return __wcstoul_internal (__nptr, __endptr, __base, 0); }
502 # ifdef __USE_GNU
503 extern __inline float wcstof (__const wchar_t *__restrict __nptr,
504 wchar_t **__restrict __endptr) __THROW
505 { return __wcstof_internal (__nptr, __endptr, 0); }
506 extern __inline long double wcstold (__const wchar_t *__restrict __nptr,
507 wchar_t **__restrict __endptr) __THROW
508 { return __wcstold_internal (__nptr, __endptr, 0); }
511 __extension__
512 extern __inline long long int wcstoq (__const wchar_t *__restrict __nptr,
513 wchar_t **__restrict __endptr,
514 int __base) __THROW
515 { return __wcstoll_internal (__nptr, __endptr, __base, 0); }
516 __extension__
517 extern __inline unsigned long long int wcstouq (__const wchar_t *
518 __restrict __nptr,
519 wchar_t **__restrict __endptr,
520 int __base) __THROW
521 { return __wcstoull_internal (__nptr, __endptr, __base, 0); }
522 # endif /* Use GNU. */
523 #endif /* Optimizing GCC >=2. */
526 #ifdef __USE_GNU
527 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
528 DEST. */
529 extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW;
531 /* Copy no more than N characters of SRC to DEST, returning the address of
532 the last character written into DEST. */
533 extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
534 __THROW;
535 #endif /* use GNU */
538 /* Wide character I/O functions. */
539 #if defined __USE_ISOC99 || defined __USE_UNIX98
541 /* Select orientation for stream. */
542 extern int fwide (__FILE *__fp, int __mode) __THROW;
545 /* Write formatted output to STREAM. */
546 extern int fwprintf (__FILE *__restrict __stream,
547 __const wchar_t *__restrict __format, ...)
548 __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
549 /* Write formatted output to stdout. */
550 extern int wprintf (__const wchar_t *__restrict __format, ...)
551 __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
552 /* Write formatted output of at most N characters to S. */
553 extern int swprintf (wchar_t *__restrict __s, size_t __n,
554 __const wchar_t *__restrict __format, ...)
555 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
557 /* Write formatted output to S from argument list ARG. */
558 extern int vfwprintf (__FILE *__restrict __s,
559 __const wchar_t *__restrict __format,
560 __gnuc_va_list __arg)
561 __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
562 /* Write formatted output to stdout from argument list ARG. */
563 extern int vwprintf (__const wchar_t *__restrict __format,
564 __gnuc_va_list __arg)
565 __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
566 /* Write formatted output of at most N character to S from argument
567 list ARG. */
568 extern int vswprintf (wchar_t *__restrict __s, size_t __n,
569 __const wchar_t *__restrict __format,
570 __gnuc_va_list __arg)
571 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
574 /* Read formatted input from STREAM. */
575 extern int fwscanf (__FILE *__restrict __stream,
576 __const wchar_t *__restrict __format, ...)
577 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
578 /* Read formatted input from stdin. */
579 extern int wscanf (__const wchar_t *__restrict __format, ...)
580 __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
581 /* Read formatted input from S. */
582 extern int swscanf (__const wchar_t *__restrict __s,
583 __const wchar_t *__restrict __format, ...)
584 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
585 #endif /* Use ISO C99 and Unix98. */
587 #ifdef __USE_ISOC99
588 /* Read formatted input from S into argument list ARG. */
589 extern int vfwscanf (__FILE *__restrict __s,
590 __const wchar_t *__restrict __format,
591 __gnuc_va_list __arg)
592 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
593 /* Read formatted input from stdin into argument list ARG. */
594 extern int vwscanf (__const wchar_t *__restrict __format,
595 __gnuc_va_list __arg)
596 __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
597 /* Read formatted input from S into argument list ARG. */
598 extern int vswscanf (__const wchar_t *__restrict __s,
599 __const wchar_t *__restrict __format,
600 __gnuc_va_list __arg)
601 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
602 #endif /* Use ISO C99. */
605 /* Read a character from STREAM. */
606 extern wint_t fgetwc (__FILE *__stream);
607 extern wint_t getwc (__FILE *__stream);
609 /* Read a character from stdin. */
610 extern wint_t getwchar (void);
613 /* Write a character to STREAM. */
614 extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
615 extern wint_t putwc (wchar_t __wc, __FILE *__stream);
617 /* Write a character to stdout. */
618 extern wint_t putwchar (wchar_t __wc);
621 /* Get a newline-terminated wide character string of finite length
622 from STREAM. */
623 extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
624 __FILE *__restrict __stream);
626 /* Write a string to STREAM. */
627 extern int fputws (__const wchar_t *__restrict __ws,
628 __FILE *__restrict __stream);
631 /* Push a character back onto the input buffer of STREAM. */
632 extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
635 #ifdef __USE_GNU
636 /* These are defined to be equivalent to the `char' functions defined
637 in POSIX.1:1996. */
638 extern wint_t getwc_unlocked (__FILE *__stream);
639 extern wint_t getwchar_unlocked (void);
641 /* This is the wide character version of a GNU extension. */
642 extern wint_t fgetwc_unlocked (__FILE *__stream);
644 /* Faster version when locking is not necessary. */
645 extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
647 /* These are defined to be equivalent to the `char' functions defined
648 in POSIX.1:1996. */
649 extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
650 extern wint_t putwchar_unlocked (wchar_t __wc);
653 /* This function does the same as `fgetws' but does not lock the stream. */
654 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
655 __FILE *__restrict __stream);
657 /* This function does the same as `fputws' but does not lock the stream. */
658 extern int fputws_unlocked (__const wchar_t *__restrict __ws,
659 __FILE *__restrict __stream);
660 #endif
663 /* Format TP into S according to FORMAT.
664 Write no more than MAXSIZE wide characters and return the number
665 of wide characters written, or 0 if it would exceed MAXSIZE. */
666 extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
667 __const wchar_t *__restrict __format,
668 __const struct tm *__restrict __tp);
670 /* The X/Open standard demands that most of the functions defined in
671 the <wctype.h> header must also appear here. This is probably
672 because some X/Open members wrote their implementation before the
673 ISO C standard was published and introduced the better solution.
674 We have to provide these definitions for compliance reasons but we
675 do this nonsense only if really necessary. */
676 #if defined __USE_UNIX98 && !defined __USE_GNU
677 # define __need_iswxxx
678 # include <wctype.h>
679 #endif
681 __END_DECLS
683 #endif /* _WCHAR_H defined */
685 #endif /* wchar.h */