xref: /utopia/UTPA2-700.0.x/projects/tools/lint/mips-linux-gnu_include/wchar.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 /* Copyright (C) 1995-2004,2005,2006,2007 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 #if !defined __need_mbstate_t && !defined __need_wint_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 # if defined __USE_UNIX98 || defined __USE_XOPEN2K
35 #  define __need_FILE
36 # endif
37 # include <stdio.h>
38 /* Get va_list definition.  */
39 # define __need___va_list
40 # include <stdarg.h>
41 
42 # include <bits/wchar.h>
43 
44 /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>.  */
45 # define __need_size_t
46 # define __need_wchar_t
47 # define __need_NULL
48 #endif
49 #if defined _WCHAR_H || defined __need_wint_t || !defined __WINT_TYPE__
50 # undef __need_wint_t
51 # define __need_wint_t
52 # include <stddef.h>
53 
54 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
55    there.  So define it ourselves if it remains undefined.  */
56 # ifndef _WINT_T
57 /* Integral type unchanged by default argument promotions that can
58    hold any value corresponding to members of the extended character
59    set, as well as at least one value that does not correspond to any
60    member of the extended character set.  */
61 #  define _WINT_T
62 typedef unsigned int wint_t;
63 # else
64 /* Work around problems with the <stddef.h> file which doesn't put
65    wint_t in the std namespace.  */
66 #  if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \
67       && defined __WINT_TYPE__
68 __BEGIN_NAMESPACE_STD
69 typedef __WINT_TYPE__ wint_t;
70 __END_NAMESPACE_STD
71 #  endif
72 # endif
73 #endif
74 
75 #if (defined _WCHAR_H || defined __need_mbstate_t) && !defined __mbstate_t_defined
76 # define __mbstate_t_defined	1
77 /* Conversion state information.  */
78 typedef struct
79 {
80   int __count;
81   union
82   {
83 # ifdef __WINT_TYPE__
84     __WINT_TYPE__ __wch;
85 # else
86     wint_t __wch;
87 # endif
88     char __wchb[4];
89   } __value;		/* Value so far.  */
90 } __mbstate_t;
91 #endif
92 #undef __need_mbstate_t
93 
94 
95 /* The rest of the file is only used if used if __need_mbstate_t is not
96    defined.  */
97 #ifdef _WCHAR_H
98 
99 __BEGIN_NAMESPACE_C99
100 /* Public type.  */
101 typedef __mbstate_t mbstate_t;
102 __END_NAMESPACE_C99
103 #ifdef __USE_GNU
104 __USING_NAMESPACE_C99(mbstate_t)
105 #endif
106 
107 #ifndef WCHAR_MIN
108 /* These constants might also be defined in <inttypes.h>.  */
109 # define WCHAR_MIN __WCHAR_MIN
110 # define WCHAR_MAX __WCHAR_MAX
111 #endif
112 
113 #ifndef WEOF
114 # define WEOF (0xffffffffu)
115 #endif
116 
117 /* For XPG4 compliance we have to define the stuff from <wctype.h> here
118    as well.  */
119 #if defined __USE_XOPEN && !defined __USE_UNIX98
120 # include <wctype.h>
121 #endif
122 
123 
124 __BEGIN_DECLS
125 
126 __BEGIN_NAMESPACE_STD
127 /* This incomplete type is defined in <time.h> but needed here because
128    of `wcsftime'.  */
129 struct tm;
130 __END_NAMESPACE_STD
131 /* XXX We have to clean this up at some point.  Since tm is in the std
132    namespace but wcsftime is in __c99 the type wouldn't be found
133    without inserting it in the global namespace.  */
134 __USING_NAMESPACE_STD(tm)
135 
136 
137 __BEGIN_NAMESPACE_STD
138 /* Copy SRC to DEST.  */
139 extern wchar_t *wcscpy (wchar_t *__restrict __dest,
140 			__const wchar_t *__restrict __src) __THROW;
141 /* Copy no more than N wide-characters of SRC to DEST.  */
142 extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
143 			 __const wchar_t *__restrict __src, size_t __n)
144      __THROW;
145 
146 /* Append SRC onto DEST.  */
147 extern wchar_t *wcscat (wchar_t *__restrict __dest,
148 			__const wchar_t *__restrict __src) __THROW;
149 /* Append no more than N wide-characters of SRC onto DEST.  */
150 extern wchar_t *wcsncat (wchar_t *__restrict __dest,
151 			 __const wchar_t *__restrict __src, size_t __n)
152      __THROW;
153 
154 /* Compare S1 and S2.  */
155 extern int wcscmp (__const wchar_t *__s1, __const wchar_t *__s2)
156      __THROW __attribute_pure__;
157 /* Compare N wide-characters of S1 and S2.  */
158 extern int wcsncmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n)
159      __THROW __attribute_pure__;
160 __END_NAMESPACE_STD
161 
162 #ifdef __USE_GNU
163 /* Compare S1 and S2, ignoring case.  */
164 extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
165 
166 /* Compare no more than N chars of S1 and S2, ignoring case.  */
167 extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
168 			size_t __n) __THROW;
169 
170 /* Similar to the two functions above but take the information from
171    the provided locale and not the global locale.  */
172 # include <xlocale.h>
173 
174 extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
175 			 __locale_t __loc) __THROW;
176 
177 extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
178 			  size_t __n, __locale_t __loc) __THROW;
179 #endif
180 
181 __BEGIN_NAMESPACE_STD
182 /* Compare S1 and S2, both interpreted as appropriate to the
183    LC_COLLATE category of the current locale.  */
184 extern int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
185 /* Transform S2 into array pointed to by S1 such that if wcscmp is
186    applied to two transformed strings the result is the as applying
187    `wcscoll' to the original strings.  */
188 extern size_t wcsxfrm (wchar_t *__restrict __s1,
189 		       __const wchar_t *__restrict __s2, size_t __n) __THROW;
190 __END_NAMESPACE_STD
191 
192 #ifdef __USE_GNU
193 /* Similar to the two functions above but take the information from
194    the provided locale and not the global locale.  */
195 
196 /* Compare S1 and S2, both interpreted as appropriate to the
197    LC_COLLATE category of the given locale.  */
198 extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
199 		      __locale_t __loc) __THROW;
200 
201 /* Transform S2 into array pointed to by S1 such that if wcscmp is
202    applied to two transformed strings the result is the as applying
203    `wcscoll' to the original strings.  */
204 extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
205 			 size_t __n, __locale_t __loc) __THROW;
206 
207 /* Duplicate S, returning an identical malloc'd string.  */
208 extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__;
209 #endif
210 
211 __BEGIN_NAMESPACE_STD
212 /* Find the first occurrence of WC in WCS.  */
213 extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
214      __THROW __attribute_pure__;
215 /* Find the last occurrence of WC in WCS.  */
216 extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc)
217      __THROW __attribute_pure__;
218 __END_NAMESPACE_STD
219 
220 #ifdef __USE_GNU
221 /* This function is similar to `wcschr'.  But it returns a pointer to
222    the closing NUL wide character in case C is not found in S.  */
223 extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc)
224      __THROW __attribute_pure__;
225 #endif
226 
227 __BEGIN_NAMESPACE_STD
228 /* Return the length of the initial segmet of WCS which
229    consists entirely of wide characters not in REJECT.  */
230 extern size_t wcscspn (__const wchar_t *__wcs, __const wchar_t *__reject)
231      __THROW __attribute_pure__;
232 /* Return the length of the initial segmet of WCS which
233    consists entirely of wide characters in  ACCEPT.  */
234 extern size_t wcsspn (__const wchar_t *__wcs, __const wchar_t *__accept)
235      __THROW __attribute_pure__;
236 /* Find the first occurrence in WCS of any character in ACCEPT.  */
237 extern wchar_t *wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept)
238      __THROW __attribute_pure__;
239 /* Find the first occurrence of NEEDLE in HAYSTACK.  */
240 extern wchar_t *wcsstr (__const wchar_t *__haystack, __const wchar_t *__needle)
241      __THROW __attribute_pure__;
242 
243 /* Divide WCS into tokens separated by characters in DELIM.  */
244 extern wchar_t *wcstok (wchar_t *__restrict __s,
245 			__const wchar_t *__restrict __delim,
246 			wchar_t **__restrict __ptr) __THROW;
247 
248 /* Return the number of wide characters in S.  */
249 extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__;
250 __END_NAMESPACE_STD
251 
252 #ifdef __USE_XOPEN
253 /* Another name for `wcsstr' from XPG4.  */
254 extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle)
255      __THROW __attribute_pure__;
256 #endif
257 
258 #ifdef __USE_GNU
259 /* Return the number of wide characters in S, but at most MAXLEN.  */
260 extern size_t wcsnlen (__const wchar_t *__s, size_t __maxlen)
261      __THROW __attribute_pure__;
262 #endif
263 
264 
265 __BEGIN_NAMESPACE_STD
266 /* Search N wide characters of S for C.  */
267 extern wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n)
268      __THROW __attribute_pure__;
269 
270 /* Compare N wide characters of S1 and S2.  */
271 extern int wmemcmp (__const wchar_t *__restrict __s1,
272 		    __const wchar_t *__restrict __s2, size_t __n)
273      __THROW __attribute_pure__;
274 
275 /* Copy N wide characters of SRC to DEST.  */
276 extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
277 			 __const wchar_t *__restrict __s2, size_t __n) __THROW;
278 
279 /* Copy N wide characters of SRC to DEST, guaranteeing
280    correct behavior for overlapping strings.  */
281 extern wchar_t *wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n)
282      __THROW;
283 
284 /* Set N wide characters of S to C.  */
285 extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
286 __END_NAMESPACE_STD
287 
288 #ifdef __USE_GNU
289 /* Copy N wide characters of SRC to DEST and return pointer to following
290    wide character.  */
291 extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
292 			  __const wchar_t *__restrict __s2, size_t __n)
293      __THROW;
294 #endif
295 
296 
297 __BEGIN_NAMESPACE_STD
298 /* Determine whether C constitutes a valid (one-byte) multibyte
299    character.  */
300 extern wint_t btowc (int __c) __THROW;
301 
302 /* Determine whether C corresponds to a member of the extended
303    character set whose multibyte representation is a single byte.  */
304 extern int wctob (wint_t __c) __THROW;
305 
306 /* Determine whether PS points to an object representing the initial
307    state.  */
308 extern int mbsinit (__const mbstate_t *__ps) __THROW __attribute_pure__;
309 
310 /* Write wide character representation of multibyte character pointed
311    to by S to PWC.  */
312 extern size_t mbrtowc (wchar_t *__restrict __pwc,
313 		       __const char *__restrict __s, size_t __n,
314 		       mbstate_t *__p) __THROW;
315 
316 /* Write multibyte representation of wide character WC to S.  */
317 extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
318 		       mbstate_t *__restrict __ps) __THROW;
319 
320 /* Return number of bytes in multibyte character pointed to by S.  */
321 extern size_t __mbrlen (__const char *__restrict __s, size_t __n,
322 			mbstate_t *__restrict __ps) __THROW;
323 extern size_t mbrlen (__const char *__restrict __s, size_t __n,
324 		      mbstate_t *__restrict __ps) __THROW;
325 __END_NAMESPACE_STD
326 
327 #ifdef __USE_EXTERN_INLINES
328 /* Define inline function as optimization.  */
329 
330 /* We can use the BTOWC and WCTOB optimizations since we know that all
331    locales must use ASCII encoding for the values in the ASCII range
332    and because the wchar_t encoding is always ISO 10646.  */
333 extern wint_t __btowc_alias (int __c) __asm ("btowc");
334 __extern_inline wint_t
__NTH(btowc (int __c))335 __NTH (btowc (int __c))
336 { return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f'
337 	  ? (wint_t) __c : __btowc_alias (__c)); }
338 
339 extern int __wctob_alias (wint_t __c) __asm ("wctob");
340 __extern_inline int
__NTH(wctob (wint_t __wc))341 __NTH (wctob (wint_t __wc))
342 { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
343 	  ? (int) __wc : __wctob_alias (__wc)); }
344 
345 __extern_inline size_t
__NTH(mbrlen (__const char * __restrict __s,size_t __n,mbstate_t * __restrict __ps))346 __NTH (mbrlen (__const char *__restrict __s, size_t __n,
347 	       mbstate_t *__restrict __ps))
348 { return (__ps != NULL
349 	  ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
350 #endif
351 
352 __BEGIN_NAMESPACE_STD
353 /* Write wide character representation of multibyte character string
354    SRC to DST.  */
355 extern size_t mbsrtowcs (wchar_t *__restrict __dst,
356 			 __const char **__restrict __src, size_t __len,
357 			 mbstate_t *__restrict __ps) __THROW;
358 
359 /* Write multibyte character representation of wide character string
360    SRC to DST.  */
361 extern size_t wcsrtombs (char *__restrict __dst,
362 			 __const wchar_t **__restrict __src, size_t __len,
363 			 mbstate_t *__restrict __ps) __THROW;
364 __END_NAMESPACE_STD
365 
366 
367 #ifdef	__USE_GNU
368 /* Write wide character representation of at most NMC bytes of the
369    multibyte character string SRC to DST.  */
370 extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
371 			  __const char **__restrict __src, size_t __nmc,
372 			  size_t __len, mbstate_t *__restrict __ps) __THROW;
373 
374 /* Write multibyte character representation of at most NWC characters
375    from the wide character string SRC to DST.  */
376 extern size_t wcsnrtombs (char *__restrict __dst,
377 			  __const wchar_t **__restrict __src,
378 			  size_t __nwc, size_t __len,
379 			  mbstate_t *__restrict __ps) __THROW;
380 #endif	/* use GNU */
381 
382 
383 /* The following functions are extensions found in X/Open CAE.  */
384 #ifdef __USE_XOPEN
385 /* Determine number of column positions required for C.  */
386 extern int wcwidth (wchar_t __c) __THROW;
387 
388 /* Determine number of column positions required for first N wide
389    characters (or fewer if S ends before this) in S.  */
390 extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW;
391 #endif	/* Use X/Open.  */
392 
393 
394 __BEGIN_NAMESPACE_STD
395 /* Convert initial portion of the wide string NPTR to `double'
396    representation.  */
397 extern double wcstod (__const wchar_t *__restrict __nptr,
398 		      wchar_t **__restrict __endptr) __THROW;
399 __END_NAMESPACE_STD
400 
401 #ifdef __USE_ISOC99
402 __BEGIN_NAMESPACE_C99
403 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
404 extern float wcstof (__const wchar_t *__restrict __nptr,
405 		     wchar_t **__restrict __endptr) __THROW;
406 extern long double wcstold (__const wchar_t *__restrict __nptr,
407 			    wchar_t **__restrict __endptr) __THROW;
408 __END_NAMESPACE_C99
409 #endif /* C99 */
410 
411 
412 __BEGIN_NAMESPACE_STD
413 /* Convert initial portion of wide string NPTR to `long int'
414    representation.  */
415 extern long int wcstol (__const wchar_t *__restrict __nptr,
416 			wchar_t **__restrict __endptr, int __base) __THROW;
417 
418 /* Convert initial portion of wide string NPTR to `unsigned long int'
419    representation.  */
420 extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
421 				  wchar_t **__restrict __endptr, int __base)
422      __THROW;
423 __END_NAMESPACE_STD
424 
425 #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
426 __BEGIN_NAMESPACE_C99
427 /* Convert initial portion of wide string NPTR to `long long int'
428    representation.  */
429 __extension__
430 extern long long int wcstoll (__const wchar_t *__restrict __nptr,
431 			      wchar_t **__restrict __endptr, int __base)
432      __THROW;
433 
434 /* Convert initial portion of wide string NPTR to `unsigned long long int'
435    representation.  */
436 __extension__
437 extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr,
438 					wchar_t **__restrict __endptr,
439 					int __base) __THROW;
440 __END_NAMESPACE_C99
441 #endif /* ISO C99 or GCC and GNU.  */
442 
443 #if defined __GNUC__ && defined __USE_GNU
444 /* Convert initial portion of wide string NPTR to `long long int'
445    representation.  */
446 __extension__
447 extern long long int wcstoq (__const wchar_t *__restrict __nptr,
448 			     wchar_t **__restrict __endptr, int __base)
449      __THROW;
450 
451 /* Convert initial portion of wide string NPTR to `unsigned long long int'
452    representation.  */
453 __extension__
454 extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr,
455 				       wchar_t **__restrict __endptr,
456 				       int __base) __THROW;
457 #endif /* GCC and use GNU.  */
458 
459 #ifdef __USE_GNU
460 /* The concept of one static locale per category is not very well
461    thought out.  Many applications will need to process its data using
462    information from several different locales.  Another application is
463    the implementation of the internationalization handling in the
464    upcoming ISO C++ standard library.  To support this another set of
465    the functions using locale data exist which have an additional
466    argument.
467 
468    Attention: all these functions are *not* standardized in any form.
469    This is a proof-of-concept implementation.  */
470 
471 /* Structure for reentrant locale using functions.  This is an
472    (almost) opaque type for the user level programs.  */
473 # include <xlocale.h>
474 
475 /* Special versions of the functions above which take the locale to
476    use as an additional parameter.  */
477 extern long int wcstol_l (__const wchar_t *__restrict __nptr,
478 			  wchar_t **__restrict __endptr, int __base,
479 			  __locale_t __loc) __THROW;
480 
481 extern unsigned long int wcstoul_l (__const wchar_t *__restrict __nptr,
482 				    wchar_t **__restrict __endptr,
483 				    int __base, __locale_t __loc) __THROW;
484 
485 __extension__
486 extern long long int wcstoll_l (__const wchar_t *__restrict __nptr,
487 				wchar_t **__restrict __endptr,
488 				int __base, __locale_t __loc) __THROW;
489 
490 __extension__
491 extern unsigned long long int wcstoull_l (__const wchar_t *__restrict __nptr,
492 					  wchar_t **__restrict __endptr,
493 					  int __base, __locale_t __loc)
494      __THROW;
495 
496 extern double wcstod_l (__const wchar_t *__restrict __nptr,
497 			wchar_t **__restrict __endptr, __locale_t __loc)
498      __THROW;
499 
500 extern float wcstof_l (__const wchar_t *__restrict __nptr,
501 		       wchar_t **__restrict __endptr, __locale_t __loc)
502      __THROW;
503 
504 extern long double wcstold_l (__const wchar_t *__restrict __nptr,
505 			      wchar_t **__restrict __endptr,
506 			      __locale_t __loc) __THROW;
507 #endif /* GNU */
508 
509 
510 #ifdef	__USE_GNU
511 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
512    DEST.  */
513 extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW;
514 
515 /* Copy no more than N characters of SRC to DEST, returning the address of
516    the last character written into DEST.  */
517 extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
518      __THROW;
519 #endif	/* use GNU */
520 
521 
522 /* Wide character I/O functions.  */
523 
524 #ifdef	__USE_GNU
525 /* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces
526    a wide character string.  */
527 extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW;
528 #endif
529 
530 #if defined __USE_ISOC95 || defined __USE_UNIX98
531 __BEGIN_NAMESPACE_STD
532 
533 /* Select orientation for stream.  */
534 extern int fwide (__FILE *__fp, int __mode) __THROW;
535 
536 
537 /* Write formatted output to STREAM.
538 
539    This function is a possible cancellation point and therefore not
540    marked with __THROW.  */
541 extern int fwprintf (__FILE *__restrict __stream,
542 		     __const wchar_t *__restrict __format, ...)
543      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
544 /* Write formatted output to stdout.
545 
546    This function is a possible cancellation point and therefore not
547    marked with __THROW.  */
548 extern int wprintf (__const wchar_t *__restrict __format, ...)
549      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
550 /* Write formatted output of at most N characters to S.  */
551 extern int swprintf (wchar_t *__restrict __s, size_t __n,
552 		     __const wchar_t *__restrict __format, ...)
553      __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
554 
555 /* Write formatted output to S from argument list ARG.
556 
557    This function is a possible cancellation point and therefore not
558    marked with __THROW.  */
559 extern int vfwprintf (__FILE *__restrict __s,
560 		      __const wchar_t *__restrict __format,
561 		      __gnuc_va_list __arg)
562      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
563 /* Write formatted output to stdout from argument list ARG.
564 
565    This function is a possible cancellation point and therefore not
566    marked with __THROW.  */
567 extern int vwprintf (__const wchar_t *__restrict __format,
568 		     __gnuc_va_list __arg)
569      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
570 /* Write formatted output of at most N character to S from argument
571    list ARG.  */
572 extern int vswprintf (wchar_t *__restrict __s, size_t __n,
573 		      __const wchar_t *__restrict __format,
574 		      __gnuc_va_list __arg)
575      __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
576 
577 
578 /* Read formatted input from STREAM.
579 
580    This function is a possible cancellation point and therefore not
581    marked with __THROW.  */
582 extern int fwscanf (__FILE *__restrict __stream,
583 		    __const wchar_t *__restrict __format, ...)
584      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
585 /* Read formatted input from stdin.
586 
587    This function is a possible cancellation point and therefore not
588    marked with __THROW.  */
589 extern int wscanf (__const wchar_t *__restrict __format, ...)
590      /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
591 /* Read formatted input from S.  */
592 extern int swscanf (__const wchar_t *__restrict __s,
593 		    __const wchar_t *__restrict __format, ...)
594      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
595 
596 # if defined __USE_ISOC99 && !defined __USE_GNU \
597      && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
598      && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
599 #  ifdef __REDIRECT
600 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
601    GNU extension which conflicts with valid %a followed by letter
602    s, S or [.  */
603 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
604 				 __const wchar_t *__restrict __format, ...),
605 		       __isoc99_fwscanf)
606      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
607 extern int __REDIRECT (wscanf, (__const wchar_t *__restrict __format, ...),
608 		       __isoc99_wscanf)
609      /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
610 extern int __REDIRECT (swscanf, (__const wchar_t *__restrict __s,
611 				 __const wchar_t *__restrict __format, ...),
612 		       __isoc99_swscanf)
613      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
614 #  else
615 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
616 			     __const wchar_t *__restrict __format, ...);
617 extern int __isoc99_wscanf (__const wchar_t *__restrict __format, ...);
618 extern int __isoc99_swscanf (__const wchar_t *__restrict __s,
619 			     __const wchar_t *__restrict __format, ...)
620      __THROW;
621 #   define fwscanf __isoc99_fwscanf
622 #   define wscanf __isoc99_wscanf
623 #   define swscanf __isoc99_swscanf
624 #  endif
625 # endif
626 
627 __END_NAMESPACE_STD
628 #endif /* Use ISO C95, C99 and Unix98. */
629 
630 #ifdef __USE_ISOC99
631 __BEGIN_NAMESPACE_C99
632 /* Read formatted input from S into argument list ARG.
633 
634    This function is a possible cancellation point and therefore not
635    marked with __THROW.  */
636 extern int vfwscanf (__FILE *__restrict __s,
637 		     __const wchar_t *__restrict __format,
638 		     __gnuc_va_list __arg)
639      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
640 /* Read formatted input from stdin into argument list ARG.
641 
642    This function is a possible cancellation point and therefore not
643    marked with __THROW.  */
644 extern int vwscanf (__const wchar_t *__restrict __format,
645 		    __gnuc_va_list __arg)
646      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
647 /* Read formatted input from S into argument list ARG.  */
648 extern int vswscanf (__const wchar_t *__restrict __s,
649 		     __const wchar_t *__restrict __format,
650 		     __gnuc_va_list __arg)
651      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
652 
653 # if !defined __USE_GNU \
654      && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
655      && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
656 #  ifdef __REDIRECT
657 extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
658 				  __const wchar_t *__restrict __format,
659 				  __gnuc_va_list __arg), __isoc99_vfwscanf)
660      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
661 extern int __REDIRECT (vwscanf, (__const wchar_t *__restrict __format,
662 				 __gnuc_va_list __arg), __isoc99_vwscanf)
663      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
664 extern int __REDIRECT (vswscanf, (__const wchar_t *__restrict __s,
665 				  __const wchar_t *__restrict __format,
666 				  __gnuc_va_list __arg), __isoc99_vswscanf)
667      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
668 #  else
669 extern int __isoc99_vfwscanf (__FILE *__restrict __s,
670 			      __const wchar_t *__restrict __format,
671 			      __gnuc_va_list __arg);
672 extern int __isoc99_vwscanf (__const wchar_t *__restrict __format,
673 			     __gnuc_va_list __arg);
674 extern int __isoc99_vswscanf (__const wchar_t *__restrict __s,
675 			      __const wchar_t *__restrict __format,
676 			      __gnuc_va_list __arg) __THROW;
677 #   define vfwscanf __isoc99_vfwscanf
678 #   define vwscanf __isoc99_vwscanf
679 #   define vswscanf __isoc99_vswscanf
680 #  endif
681 # endif
682 
683 __END_NAMESPACE_C99
684 #endif /* Use ISO C99. */
685 
686 
687 __BEGIN_NAMESPACE_STD
688 /* Read a character from STREAM.
689 
690    These functions are possible cancellation points and therefore not
691    marked with __THROW.  */
692 extern wint_t fgetwc (__FILE *__stream);
693 extern wint_t getwc (__FILE *__stream);
694 
695 /* Read a character from stdin.
696 
697    This function is a possible cancellation point and therefore not
698    marked with __THROW.  */
699 extern wint_t getwchar (void);
700 
701 
702 /* Write a character to STREAM.
703 
704    These functions are possible cancellation points and therefore not
705    marked with __THROW.  */
706 extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
707 extern wint_t putwc (wchar_t __wc, __FILE *__stream);
708 
709 /* Write a character to stdout.
710 
711    This function is a possible cancellation points and therefore not
712    marked with __THROW.  */
713 extern wint_t putwchar (wchar_t __wc);
714 
715 
716 /* Get a newline-terminated wide character string of finite length
717    from STREAM.
718 
719    This function is a possible cancellation points and therefore not
720    marked with __THROW.  */
721 extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
722 			__FILE *__restrict __stream);
723 
724 /* Write a string to STREAM.
725 
726    This function is a possible cancellation points and therefore not
727    marked with __THROW.  */
728 extern int fputws (__const wchar_t *__restrict __ws,
729 		   __FILE *__restrict __stream);
730 
731 
732 /* Push a character back onto the input buffer of STREAM.
733 
734    This function is a possible cancellation points and therefore not
735    marked with __THROW.  */
736 extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
737 __END_NAMESPACE_STD
738 
739 
740 #ifdef __USE_GNU
741 /* These are defined to be equivalent to the `char' functions defined
742    in POSIX.1:1996.
743 
744    These functions are not part of POSIX and therefore no official
745    cancellation point.  But due to similarity with an POSIX interface
746    or due to the implementation they are cancellation points and
747    therefore not marked with __THROW.  */
748 extern wint_t getwc_unlocked (__FILE *__stream);
749 extern wint_t getwchar_unlocked (void);
750 
751 /* This is the wide character version of a GNU extension.
752 
753    This function is not part of POSIX and therefore no official
754    cancellation point.  But due to similarity with an POSIX interface
755    or due to the implementation it is a cancellation point and
756    therefore not marked with __THROW.  */
757 extern wint_t fgetwc_unlocked (__FILE *__stream);
758 
759 /* Faster version when locking is not necessary.
760 
761    This function is not part of POSIX and therefore no official
762    cancellation point.  But due to similarity with an POSIX interface
763    or due to the implementation it is a cancellation point and
764    therefore not marked with __THROW.  */
765 extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
766 
767 /* These are defined to be equivalent to the `char' functions defined
768    in POSIX.1:1996.
769 
770    These functions are not part of POSIX and therefore no official
771    cancellation point.  But due to similarity with an POSIX interface
772    or due to the implementation they are cancellation points and
773    therefore not marked with __THROW.  */
774 extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
775 extern wint_t putwchar_unlocked (wchar_t __wc);
776 
777 
778 /* This function does the same as `fgetws' but does not lock the stream.
779 
780    This function is not part of POSIX and therefore no official
781    cancellation point.  But due to similarity with an POSIX interface
782    or due to the implementation it is a cancellation point and
783    therefore not marked with __THROW.  */
784 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
785 				 __FILE *__restrict __stream);
786 
787 /* This function does the same as `fputws' but does not lock the stream.
788 
789    This function is not part of POSIX and therefore no official
790    cancellation point.  But due to similarity with an POSIX interface
791    or due to the implementation it is a cancellation point and
792    therefore not marked with __THROW.  */
793 extern int fputws_unlocked (__const wchar_t *__restrict __ws,
794 			    __FILE *__restrict __stream);
795 #endif
796 
797 
798 __BEGIN_NAMESPACE_C99
799 /* Format TP into S according to FORMAT.
800    Write no more than MAXSIZE wide characters and return the number
801    of wide characters written, or 0 if it would exceed MAXSIZE.  */
802 extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
803 			__const wchar_t *__restrict __format,
804 			__const struct tm *__restrict __tp) __THROW;
805 __END_NAMESPACE_C99
806 
807 # ifdef __USE_GNU
808 # include <xlocale.h>
809 
810 /* Similar to `wcsftime' but takes the information from
811    the provided locale and not the global locale.  */
812 extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
813 			  __const wchar_t *__restrict __format,
814 			  __const struct tm *__restrict __tp,
815 			  __locale_t __loc) __THROW;
816 # endif
817 
818 /* The X/Open standard demands that most of the functions defined in
819    the <wctype.h> header must also appear here.  This is probably
820    because some X/Open members wrote their implementation before the
821    ISO C standard was published and introduced the better solution.
822    We have to provide these definitions for compliance reasons but we
823    do this nonsense only if really necessary.  */
824 #if defined __USE_UNIX98 && !defined __USE_GNU
825 # define __need_iswxxx
826 # include <wctype.h>
827 #endif
828 
829 /* Define some macros helping to catch buffer overflows.  */
830 #if __USE_FORTIFY_LEVEL > 0 && defined __extern_always_inline
831 # include <bits/wchar2.h>
832 #endif
833 
834 #ifdef __LDBL_COMPAT
835 # include <bits/wchar-ldbl.h>
836 #endif
837 
838 __END_DECLS
839 
840 #endif	/* _WCHAR_H defined */
841 
842 /* Undefined all __need_* constants in case we are included to get those
843    constants but the whole file was already read.  */
844 #undef __need_mbstate_t
845 #undef __need_wint_t
846 
847 #endif /* wchar.h  */
848