xref: /haiku/src/system/libroot/posix/glibc/wcsmbs/wchar.h (revision 7749d0bb0c358a3279b1b9cc76d8376e900130a5)
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 #ifdef _WCHAR_H
32 /* Get FILE definition.  */
33 # define __need___FILE
34 # ifdef __USE_UNIX98
35 #  define __need_FILE
36 # endif
37 # include <libio/stdio.h>
38 /* Get va_list definition.  */
39 # define __need___va_list
40 # include <stdarg.h>
41 
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>
49 
50 #include <bits/wchar.h>
51 
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
62 
63 
64 #ifndef __mbstate_t_defined
65 # define __mbstate_t_defined	1
66 /* Conversion state information.  */
67 typedef struct
68 {
69   int __count;
70   union
71   {
72     wint_t __wch;
73     char __wchb[4];
74   } __value;		/* Value so far.  */
75 } __mbstate_t;
76 #endif
77 #undef __need_mbstate_t
78 
79 
80 /* The rest of the file is only used if used if __need_mbstate_t is not
81    defined.  */
82 #ifdef _WCHAR_H
83 
84 /* Public type.  */
85 typedef __mbstate_t mbstate_t;
86 
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
92 
93 #ifndef WEOF
94 # define WEOF (0xffffffffu)
95 #endif
96 
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
102 
103 /* This incomplete type is defined in <time.h> but needed here because
104    of `wcsftime'.  */
105 struct tm;
106 
107 
108 __BEGIN_DECLS
109 
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;
117 
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;
125 
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__;
132 
133 #ifdef __USE_GNU
134 /* Compare S1 and S2, ignoring case.  */
135 extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
136 
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;
140 
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>
144 
145 extern int __wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
146 			   __locale_t __loc) __THROW;
147 
148 extern int __wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
149 			    size_t __n, __locale_t __loc) __THROW;
150 #endif
151 
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;
160 
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.  */
164 
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;
174 
175 /* Duplicate S, returning an identical malloc'd string.  */
176 extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__;
177 #endif
178 
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__;
185 
186 #ifdef __USE_GNU
187 /* This function 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
192 
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__;
207 
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
213 
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;
218 
219 /* Return the number of wide characters in S.  */
220 extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__;
221 
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
227 
228 
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__;
232 
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__;
237 
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;
241 
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;
246 
247 /* Set N wide characters of S to C.  */
248 extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
249 
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
257 
258 
259 /* Determine whether C constitutes a valid (one-byte) multibyte
260    character.  */
261 extern wint_t btowc (int __c) __THROW;
262 
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;
266 
267 /* Determine whether PS points to an object representing the initial
268    state.  */
269 extern int mbsinit (__const mbstate_t *__ps) __THROW __attribute_pure__;
270 
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;
276 
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;
280 
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;
286 
287 #ifdef __USE_EXTERN_INLINES
288 /* Define inline function as optimization.  */
289 extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n,
290 			       mbstate_t *__restrict __ps) __THROW
291 { return (__ps != NULL
292 	  ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
293 #endif
294 
295 /* Write wide character representation of multibyte character string
296    SRC to DST.  */
297 extern size_t mbsrtowcs (wchar_t *__restrict __dst,
298 			 __const char **__restrict __src, size_t __len,
299 			 mbstate_t *__restrict __ps) __THROW;
300 
301 /* Write multibyte character representation of wide character string
302    SRC to DST.  */
303 extern size_t wcsrtombs (char *__restrict __dst,
304 			 __const wchar_t **__restrict __src, size_t __len,
305 			 mbstate_t *__restrict __ps) __THROW;
306 
307 
308 #ifdef	__USE_GNU
309 /* Write wide character representation of at most NMC bytes of the
310    multibyte character string SRC to DST.  */
311 extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
312 			  __const char **__restrict __src, size_t __nmc,
313 			  size_t __len, mbstate_t *__restrict __ps) __THROW;
314 
315 /* Write multibyte character representation of at most NWC characters
316    from the wide character string SRC to DST.  */
317 extern size_t wcsnrtombs (char *__restrict __dst,
318 			  __const wchar_t **__restrict __src,
319 			  size_t __nwc, size_t __len,
320 			  mbstate_t *__restrict __ps) __THROW;
321 #endif	/* use GNU */
322 
323 
324 /* The following functions are extensions found in X/Open CAE.  */
325 #ifdef __USE_XOPEN
326 /* Determine number of column positions required for C.  */
327 extern int wcwidth (wchar_t __c) __THROW;
328 
329 /* Determine number of column positions required for first N wide
330    characters (or fewer if S ends before this) in S.  */
331 extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW;
332 #endif	/* Use X/Open.  */
333 
334 
335 /* Convert initial portion of the wide string NPTR to `double'
336    representation.  */
337 extern double wcstod (__const wchar_t *__restrict __nptr,
338 		      wchar_t **__restrict __endptr) __THROW;
339 
340 #ifdef __USE_ISOC99
341 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
342 extern float wcstof (__const wchar_t *__restrict __nptr,
343 		     wchar_t **__restrict __endptr) __THROW;
344 extern long double wcstold (__const wchar_t *__restrict __nptr,
345 			    wchar_t **__restrict __endptr) __THROW;
346 #endif /* C99 */
347 
348 
349 /* Convert initial portion of wide string NPTR to `long int'
350    representation.  */
351 extern long int wcstol (__const wchar_t *__restrict __nptr,
352 			wchar_t **__restrict __endptr, int __base) __THROW;
353 
354 /* Convert initial portion of wide string NPTR to `unsigned long int'
355    representation.  */
356 extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
357 				  wchar_t **__restrict __endptr, int __base)
358      __THROW;
359 
360 #if defined __GNUC__ && defined __USE_GNU
361 /* Convert initial portion of wide string NPTR to `long int'
362    representation.  */
363 __extension__
364 extern long long int wcstoq (__const wchar_t *__restrict __nptr,
365 			     wchar_t **__restrict __endptr, int __base)
366      __THROW;
367 
368 /* Convert initial portion of wide string NPTR to `unsigned long long int'
369    representation.  */
370 __extension__
371 extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr,
372 				       wchar_t **__restrict __endptr,
373 				       int __base) __THROW;
374 #endif /* GCC and use GNU.  */
375 
376 #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
377 /* Convert initial portion of wide string NPTR to `long int'
378    representation.  */
379 __extension__
380 extern long long int wcstoll (__const wchar_t *__restrict __nptr,
381 			      wchar_t **__restrict __endptr, int __base)
382      __THROW;
383 
384 /* Convert initial portion of wide string NPTR to `unsigned long long int'
385    representation.  */
386 __extension__
387 extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr,
388 					wchar_t **__restrict __endptr,
389 					int __base) __THROW;
390 #endif /* ISO C99 or GCC and GNU.  */
391 
392 #ifdef __USE_GNU
393 /* The concept of one static locale per category is not very well
394    thought out.  Many applications will need to process its data using
395    information from several different locales.  Another application is
396    the implementation of the internationalization handling in the
397    upcoming ISO C++ standard library.  To support this another set of
398    the functions using locale data exist which have an additional
399    argument.
400 
401    Attention: all these functions are *not* standardized in any form.
402    This is a proof-of-concept implementation.  */
403 
404 /* Structure for reentrant locale using functions.  This is an
405    (almost) opaque type for the user level programs.  */
406 # include <xlocale.h>
407 
408 /* Special versions of the functions above which take the locale to
409    use as an additional parameter.  */
410 extern long int __wcstol_l (__const wchar_t *__restrict __nptr,
411 			    wchar_t **__restrict __endptr, int __base,
412 			    __locale_t __loc) __THROW;
413 
414 extern unsigned long int __wcstoul_l (__const wchar_t *__restrict __nptr,
415 				      wchar_t **__restrict __endptr,
416 				      int __base, __locale_t __loc) __THROW;
417 
418 __extension__
419 extern long long int __wcstoll_l (__const wchar_t *__restrict __nptr,
420 				  wchar_t **__restrict __endptr,
421 				  int __base, __locale_t __loc) __THROW;
422 
423 __extension__
424 extern unsigned long long int __wcstoull_l (__const wchar_t *__restrict __nptr,
425 					    wchar_t **__restrict __endptr,
426 					    int __base, __locale_t __loc)
427      __THROW;
428 
429 extern double __wcstod_l (__const wchar_t *__restrict __nptr,
430 			  wchar_t **__restrict __endptr, __locale_t __loc)
431      __THROW;
432 
433 extern float __wcstof_l (__const wchar_t *__restrict __nptr,
434 			 wchar_t **__restrict __endptr, __locale_t __loc)
435      __THROW;
436 
437 extern long double __wcstold_l (__const wchar_t *__restrict __nptr,
438 				wchar_t **__restrict __endptr,
439 				__locale_t __loc) __THROW;
440 #endif /* GNU */
441 
442 
443 /* The internal entry points for `wcstoX' take an extra flag argument
444    saying whether or not to parse locale-dependent number grouping.  */
445 extern double __wcstod_internal (__const wchar_t *__restrict __nptr,
446 				 wchar_t **__restrict __endptr, int __group)
447      __THROW;
448 extern float __wcstof_internal (__const wchar_t *__restrict __nptr,
449 				wchar_t **__restrict __endptr, int __group)
450      __THROW;
451 extern long double __wcstold_internal (__const wchar_t *__restrict __nptr,
452 				       wchar_t **__restrict __endptr,
453 				       int __group) __THROW;
454 
455 #ifndef __wcstol_internal_defined
456 extern long int __wcstol_internal (__const wchar_t *__restrict __nptr,
457 				   wchar_t **__restrict __endptr,
458 				   int __base, int __group) __THROW;
459 # define __wcstol_internal_defined	1
460 #endif
461 #ifndef __wcstoul_internal_defined
462 extern unsigned long int __wcstoul_internal (__const wchar_t *__restrict __npt,
463 					     wchar_t **__restrict __endptr,
464 					     int __base, int __group) __THROW;
465 # define __wcstoul_internal_defined	1
466 #endif
467 #ifndef __wcstoll_internal_defined
468 __extension__
469 extern long long int __wcstoll_internal (__const wchar_t *__restrict __nptr,
470 					 wchar_t **__restrict __endptr,
471 					 int __base, int __group) __THROW;
472 # define __wcstoll_internal_defined	1
473 #endif
474 #ifndef __wcstoull_internal_defined
475 __extension__
476 extern unsigned long long int __wcstoull_internal (__const wchar_t *
477 						   __restrict __nptr,
478 						   wchar_t **
479 						   __restrict __endptr,
480 						   int __base,
481 						   int __group) __THROW;
482 # define __wcstoull_internal_defined	1
483 #endif
484 
485 
486 #if defined __OPTIMIZE__ && __GNUC__ >= 2
487 /* Define inline functions which call the internal entry points.  */
488 
489 extern __inline double wcstod (__const wchar_t *__restrict __nptr,
490 			       wchar_t **__restrict __endptr) __THROW
491 { return __wcstod_internal (__nptr, __endptr, 0); }
492 extern __inline long int wcstol (__const wchar_t *__restrict __nptr,
493                                  wchar_t **__restrict __endptr,
494 				 int __base) __THROW
495 { return __wcstol_internal (__nptr, __endptr, __base, 0); }
496 extern __inline unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
497                                            wchar_t **__restrict __endptr,
498 					   int __base) __THROW
499 { return __wcstoul_internal (__nptr, __endptr, __base, 0); }
500 
501 # ifdef __USE_GNU
502 extern __inline float wcstof (__const wchar_t *__restrict __nptr,
503 			      wchar_t **__restrict __endptr) __THROW
504 { return __wcstof_internal (__nptr, __endptr, 0); }
505 extern __inline long double wcstold (__const wchar_t *__restrict __nptr,
506 				     wchar_t **__restrict __endptr) __THROW
507 { return __wcstold_internal (__nptr, __endptr, 0); }
508 
509 
510 __extension__
511 extern __inline long long int wcstoq (__const wchar_t *__restrict __nptr,
512 				      wchar_t **__restrict __endptr,
513 				      int __base) __THROW
514 { return __wcstoll_internal (__nptr, __endptr, __base, 0); }
515 __extension__
516 extern __inline unsigned long long int wcstouq (__const wchar_t *
517 						__restrict __nptr,
518 						wchar_t **__restrict __endptr,
519 						int __base) __THROW
520 { return __wcstoull_internal (__nptr, __endptr, __base, 0); }
521 # endif /* Use GNU.  */
522 #endif /* Optimizing GCC >=2.  */
523 
524 
525 #ifdef	__USE_GNU
526 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
527    DEST.  */
528 extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW;
529 
530 /* Copy no more than N characters of SRC to DEST, returning the address of
531    the last character written into DEST.  */
532 extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
533      __THROW;
534 #endif	/* use GNU */
535 
536 
537 /* Wide character I/O functions.  */
538 #if defined __USE_ISOC99 || defined __USE_UNIX98
539 
540 /* Select orientation for stream.  */
541 extern int fwide (__FILE *__fp, int __mode) __THROW;
542 
543 
544 /* Write formatted output to STREAM.  */
545 extern int fwprintf (__FILE *__restrict __stream,
546 		     __const wchar_t *__restrict __format, ...)
547      __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
548 /* Write formatted output to stdout.  */
549 extern int wprintf (__const wchar_t *__restrict __format, ...)
550      __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
551 /* Write formatted output of at most N characters to S.  */
552 extern int swprintf (wchar_t *__restrict __s, size_t __n,
553 		     __const wchar_t *__restrict __format, ...)
554      __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
555 
556 /* Write formatted output to S from argument list ARG.  */
557 extern int vfwprintf (__FILE *__restrict __s,
558 		      __const wchar_t *__restrict __format,
559 		      __gnuc_va_list __arg)
560      __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
561 /* Write formatted output to stdout from argument list ARG.  */
562 extern int vwprintf (__const wchar_t *__restrict __format,
563 		     __gnuc_va_list __arg)
564      __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
565 /* Write formatted output of at most N character to S from argument
566    list ARG.  */
567 extern int vswprintf (wchar_t *__restrict __s, size_t __n,
568 		      __const wchar_t *__restrict __format,
569 		      __gnuc_va_list __arg)
570      __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
571 
572 
573 /* Read formatted input from STREAM.  */
574 extern int fwscanf (__FILE *__restrict __stream,
575 		    __const wchar_t *__restrict __format, ...)
576      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
577 /* Read formatted input from stdin.  */
578 extern int wscanf (__const wchar_t *__restrict __format, ...)
579      __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
580 /* Read formatted input from S.  */
581 extern int swscanf (__const wchar_t *__restrict __s,
582 		    __const wchar_t *__restrict __format, ...)
583      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
584 #endif /* Use ISO C99 and Unix98. */
585 
586 #ifdef __USE_ISOC99
587 /* Read formatted input from S into argument list ARG.  */
588 extern int vfwscanf (__FILE *__restrict __s,
589 		     __const wchar_t *__restrict __format,
590 		     __gnuc_va_list __arg)
591      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
592 /* Read formatted input from stdin into argument list ARG.  */
593 extern int vwscanf (__const wchar_t *__restrict __format,
594 		    __gnuc_va_list __arg)
595      __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
596 /* Read formatted input from S into argument list ARG.  */
597 extern int vswscanf (__const wchar_t *__restrict __s,
598 		     __const wchar_t *__restrict __format,
599 		     __gnuc_va_list __arg)
600      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
601 #endif /* Use ISO C99. */
602 
603 
604 /* Read a character from STREAM.  */
605 extern wint_t fgetwc (__FILE *__stream) __THROW;
606 extern wint_t getwc (__FILE *__stream) __THROW;
607 
608 /* Read a character from stdin.  */
609 extern wint_t getwchar (void) __THROW;
610 
611 
612 /* Write a character to STREAM.  */
613 extern wint_t fputwc (wchar_t __wc, __FILE *__stream) __THROW;
614 extern wint_t putwc (wchar_t __wc, __FILE *__stream) __THROW;
615 
616 /* Write a character to stdout.  */
617 extern wint_t putwchar (wchar_t __wc) __THROW;
618 
619 
620 /* Get a newline-terminated wide character string of finite length
621    from STREAM.  */
622 extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
623 			__FILE *__restrict __stream) __THROW;
624 
625 /* Write a string to STREAM.  */
626 extern int fputws (__const wchar_t *__restrict __ws,
627 		   __FILE *__restrict __stream) __THROW;
628 
629 
630 /* Push a character back onto the input buffer of STREAM.  */
631 extern wint_t ungetwc (wint_t __wc, __FILE *__stream) __THROW;
632 
633 
634 #ifdef __USE_GNU
635 /* These are defined to be equivalent to the `char' functions defined
636    in POSIX.1:1996.  */
637 extern wint_t getwc_unlocked (__FILE *__stream) __THROW;
638 extern wint_t getwchar_unlocked (void) __THROW;
639 
640 /* This is the wide character version of a GNU extension.  */
641 extern wint_t fgetwc_unlocked (__FILE *__stream) __THROW;
642 
643 /* Faster version when locking is not necessary.  */
644 extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream) __THROW;
645 
646 /* These are defined to be equivalent to the `char' functions defined
647    in POSIX.1:1996.  */
648 extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream) __THROW;
649 extern wint_t putwchar_unlocked (wchar_t __wc) __THROW;
650 
651 
652 /* This function does the same as `fgetws' but does not lock the stream.  */
653 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
654 				 __FILE *__restrict __stream) __THROW;
655 
656 /* This function does the same as `fputws' but does not lock the stream.  */
657 extern int fputws_unlocked (__const wchar_t *__restrict __ws,
658 			    __FILE *__restrict __stream) __THROW;
659 #endif
660 
661 
662 /* Format TP into S according to FORMAT.
663    Write no more than MAXSIZE wide characters and return the number
664    of wide characters written, or 0 if it would exceed MAXSIZE.  */
665 extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
666 			__const wchar_t *__restrict __format,
667 			__const struct tm *__restrict __tp) __THROW;
668 
669 /* The X/Open standard demands that most of the functions defined in
670    the <wctype.h> header must also appear here.  This is probably
671    because some X/Open members wrote their implementation before the
672    ISO C standard was published and introduced the better solution.
673    We have to provide these definitions for compliance reasons but we
674    do this nonsense only if really necessary.  */
675 #if defined __USE_UNIX98 && !defined __USE_GNU
676 # define __need_iswxxx
677 # include <wctype.h>
678 #endif
679 
680 __END_DECLS
681 
682 #endif	/* _WCHAR_H defined */
683 
684 #endif /* wchar.h  */
685