OSDN Git Service

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