OSDN Git Service

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