Update.
[glibc.git] / wcsmbs / wchar.h
blob8bab0ddd7bcb5e670aa0cc9049472d7139b12cc2
1 /* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU 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.
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.
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. */
20 * ISO C99 Standard: 7.24
21 * Extended multibyte and wide character utilities <wchar.h>
24 #ifndef _WCHAR_H
26 #ifndef __need_mbstate_t
27 # define _WCHAR_H 1
28 # include <features.h>
29 #endif
31 #ifdef _WCHAR_H
32 /* Get FILE definition. */
33 # define __need___FILE
34 # ifdef __USE_UNIX98
35 # define __need_FILE
36 # endif
37 # include <stdio.h>
38 /* Get va_list definition. */
39 # define __need___va_list
40 # include <stdarg.h>
42 /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */
43 # define __need_size_t
44 # define __need_wchar_t
45 # define __need_NULL
46 #endif
47 #define __need_wint_t
48 #include <stddef.h>
50 #include <bits/wchar.h>
52 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
53 there. So define it ourselves if it remains undefined. */
54 #ifndef _WINT_T
55 /* Integral type unchanged by default argument promotions that can
56 hold any value corresponding to members of the extended character
57 set, as well as at least one value that does not correspond to any
58 member of the extended character set. */
59 # define _WINT_T
60 typedef unsigned int wint_t;
61 #else
62 /* Work around problems with the <stddef.h> file which doesn't put
63 wint_t in the std namespace. */
64 # if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \
65 && defined __WINT_TYPE__
66 __BEGIN_NAMESPACE_STD
67 typedef __WINT_TYPE__ wint_t;
68 __END_NAMESPACE_STD
69 # endif
70 #endif
73 #ifndef __mbstate_t_defined
74 # define __mbstate_t_defined 1
75 /* Conversion state information. */
76 typedef struct
78 int __count;
79 union
81 wint_t __wch;
82 char __wchb[4];
83 } __value; /* Value so far. */
84 } __mbstate_t;
85 #endif
86 #undef __need_mbstate_t
89 /* The rest of the file is only used if used if __need_mbstate_t is not
90 defined. */
91 #ifdef _WCHAR_H
93 __BEGIN_NAMESPACE_C99
94 /* Public type. */
95 typedef __mbstate_t mbstate_t;
96 __END_NAMESPACE_C99
97 #ifdef __USE_GNU
98 __USING_NAMESPACE_C99(mbstate_t)
99 #endif
101 #ifndef WCHAR_MIN
102 /* These constants might also be defined in <inttypes.h>. */
103 # define WCHAR_MIN __WCHAR_MIN
104 # define WCHAR_MAX __WCHAR_MAX
105 #endif
107 #ifndef WEOF
108 # define WEOF (0xffffffffu)
109 #endif
111 /* For XPG4 compliance we have to define the stuff from <wctype.h> here
112 as well. */
113 #if defined __USE_XOPEN && !defined __USE_UNIX98
114 # include <wctype.h>
115 #endif
118 __BEGIN_DECLS
120 __BEGIN_NAMESPACE_STD
121 /* This incomplete type is defined in <time.h> but needed here because
122 of `wcsftime'. */
123 struct tm;
124 /* XXX We have to clean this up at some point. Since tm is in the std
125 namespace but wcsftime is in __c99 the type wouldn't be found
126 without inserting it in the global namespace. */
127 __USING_NAMESPACE_STD(tm)
128 __END_NAMESPACE_STD
131 __BEGIN_NAMESPACE_C99
132 /* Copy SRC to DEST. */
133 extern wchar_t *wcscpy (wchar_t *__restrict __dest,
134 __const wchar_t *__restrict __src) __THROW;
135 /* Copy no more than N wide-characters of SRC to DEST. */
136 extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
137 __const wchar_t *__restrict __src, size_t __n)
138 __THROW;
140 /* Append SRC onto DEST. */
141 extern wchar_t *wcscat (wchar_t *__restrict __dest,
142 __const wchar_t *__restrict __src) __THROW;
143 /* Append no more than N wide-characters of SRC onto DEST. */
144 extern wchar_t *wcsncat (wchar_t *__restrict __dest,
145 __const wchar_t *__restrict __src, size_t __n)
146 __THROW;
148 /* Compare S1 and S2. */
149 extern int wcscmp (__const wchar_t *__s1, __const wchar_t *__s2)
150 __THROW __attribute_pure__;
151 /* Compare N wide-characters of S1 and S2. */
152 extern int wcsncmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n)
153 __THROW __attribute_pure__;
154 __END_NAMESPACE_C99
156 #ifdef __USE_GNU
157 /* Compare S1 and S2, ignoring case. */
158 extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
160 /* Compare no more than N chars of S1 and S2, ignoring case. */
161 extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
162 size_t __n) __THROW;
164 /* Similar to the two functions above but take the information from
165 the provided locale and not the global locale. */
166 # include <xlocale.h>
168 extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
169 __locale_t __loc) __THROW;
171 extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
172 size_t __n, __locale_t __loc) __THROW;
173 #endif
175 __BEGIN_NAMESPACE_C99
176 /* Compare S1 and S2, both interpreted as appropriate to the
177 LC_COLLATE category of the current locale. */
178 extern int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
179 /* Transform S2 into array pointed to by S1 such that if wcscmp is
180 applied to two transformed strings the result is the as applying
181 `wcscoll' to the original strings. */
182 extern size_t wcsxfrm (wchar_t *__restrict __s1,
183 __const wchar_t *__restrict __s2, size_t __n) __THROW;
184 __END_NAMESPACE_C99
186 #ifdef __USE_GNU
187 /* Similar to the two functions above but take the information from
188 the provided locale and not the global locale. */
190 /* Compare S1 and S2, both interpreted as appropriate to the
191 LC_COLLATE category of the given locale. */
192 extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
193 __locale_t __loc) __THROW;
195 /* Transform S2 into array pointed to by S1 such that if wcscmp is
196 applied to two transformed strings the result is the as applying
197 `wcscoll' to the original strings. */
198 extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
199 size_t __n, __locale_t __loc) __THROW;
201 /* Duplicate S, returning an identical malloc'd string. */
202 extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__;
203 #endif
205 __BEGIN_NAMESPACE_C99
206 /* Find the first occurrence of WC in WCS. */
207 extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
208 __THROW __attribute_pure__;
209 /* Find the last occurrence of WC in WCS. */
210 extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc)
211 __THROW __attribute_pure__;
212 __END_NAMESPACE_C99
214 #ifdef __USE_GNU
215 /* This function is similar to `wcschr'. But it returns a pointer to
216 the closing NUL wide character in case C is not found in S. */
217 extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc)
218 __THROW __attribute_pure__;
219 #endif
221 __BEGIN_NAMESPACE_C99
222 /* Return the length of the initial segmet of WCS which
223 consists entirely of wide characters not in REJECT. */
224 extern size_t wcscspn (__const wchar_t *__wcs, __const wchar_t *__reject)
225 __THROW __attribute_pure__;
226 /* Return the length of the initial segmet of WCS which
227 consists entirely of wide characters in ACCEPT. */
228 extern size_t wcsspn (__const wchar_t *__wcs, __const wchar_t *__accept)
229 __THROW __attribute_pure__;
230 /* Find the first occurrence in WCS of any character in ACCEPT. */
231 extern wchar_t *wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept)
232 __THROW __attribute_pure__;
233 /* Find the first occurrence of NEEDLE in HAYSTACK. */
234 extern wchar_t *wcsstr (__const wchar_t *__haystack, __const wchar_t *__needle)
235 __THROW __attribute_pure__;
237 /* Divide WCS into tokens separated by characters in DELIM. */
238 extern wchar_t *wcstok (wchar_t *__restrict __s,
239 __const wchar_t *__restrict __delim,
240 wchar_t **__restrict __ptr) __THROW;
242 /* Return the number of wide characters in S. */
243 extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__;
244 __END_NAMESPACE_C99
246 #ifdef __USE_XOPEN
247 /* Another name for `wcsstr' from XPG4. */
248 extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle)
249 __THROW __attribute_pure__;
250 #endif
252 #ifdef __USE_GNU
253 /* Return the number of wide characters in S, but at most MAXLEN. */
254 extern size_t wcsnlen (__const wchar_t *__s, size_t __maxlen)
255 __THROW __attribute_pure__;
256 #endif
259 __BEGIN_NAMESPACE_C99
260 /* Search N wide characters of S for C. */
261 extern wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n)
262 __THROW __attribute_pure__;
264 /* Compare N wide characters of S1 and S2. */
265 extern int wmemcmp (__const wchar_t *__restrict __s1,
266 __const wchar_t *__restrict __s2, size_t __n)
267 __THROW __attribute_pure__;
269 /* Copy N wide characters of SRC to DEST. */
270 extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
271 __const wchar_t *__restrict __s2, size_t __n) __THROW;
273 /* Copy N wide characters of SRC to DEST, guaranteeing
274 correct behavior for overlapping strings. */
275 extern wchar_t *wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n)
276 __THROW;
278 /* Set N wide characters of S to C. */
279 extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
280 __END_NAMESPACE_C99
282 #ifdef __USE_GNU
283 /* Copy N wide characters of SRC to DEST and return pointer to following
284 wide character. */
285 extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
286 __const wchar_t *__restrict __s2, size_t __n)
287 __THROW;
288 #endif
291 __BEGIN_NAMESPACE_C99
292 /* Determine whether C constitutes a valid (one-byte) multibyte
293 character. */
294 extern wint_t btowc (int __c) __THROW;
296 /* Determine whether C corresponds to a member of the extended
297 character set whose multibyte representation is a single byte. */
298 extern int wctob (wint_t __c) __THROW;
300 /* Determine whether PS points to an object representing the initial
301 state. */
302 extern int mbsinit (__const mbstate_t *__ps) __THROW __attribute_pure__;
304 /* Write wide character representation of multibyte character pointed
305 to by S to PWC. */
306 extern size_t mbrtowc (wchar_t *__restrict __pwc,
307 __const char *__restrict __s, size_t __n,
308 mbstate_t *__p) __THROW;
310 /* Write multibyte representation of wide character WC to S. */
311 extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
312 mbstate_t *__restrict __ps) __THROW;
314 /* Return number of bytes in multibyte character pointed to by S. */
315 extern size_t __mbrlen (__const char *__restrict __s, size_t __n,
316 mbstate_t *__restrict __ps) __THROW;
317 extern size_t mbrlen (__const char *__restrict __s, size_t __n,
318 mbstate_t *__restrict __ps) __THROW;
319 __END_NAMESPACE_C99
321 #ifdef __USE_EXTERN_INLINES
322 /* Define inline function as optimization. */
323 extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n,
324 mbstate_t *__restrict __ps) __THROW
325 { return (__ps != NULL
326 ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
327 #endif
329 __BEGIN_NAMESPACE_C99
330 /* Write wide character representation of multibyte character string
331 SRC to DST. */
332 extern size_t mbsrtowcs (wchar_t *__restrict __dst,
333 __const char **__restrict __src, size_t __len,
334 mbstate_t *__restrict __ps) __THROW;
336 /* Write multibyte character representation of wide character string
337 SRC to DST. */
338 extern size_t wcsrtombs (char *__restrict __dst,
339 __const wchar_t **__restrict __src, size_t __len,
340 mbstate_t *__restrict __ps) __THROW;
341 __END_NAMESPACE_C99
344 #ifdef __USE_GNU
345 /* Write wide character representation of at most NMC bytes of the
346 multibyte character string SRC to DST. */
347 extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
348 __const char **__restrict __src, size_t __nmc,
349 size_t __len, mbstate_t *__restrict __ps) __THROW;
351 /* Write multibyte character representation of at most NWC characters
352 from the wide character string SRC to DST. */
353 extern size_t wcsnrtombs (char *__restrict __dst,
354 __const wchar_t **__restrict __src,
355 size_t __nwc, size_t __len,
356 mbstate_t *__restrict __ps) __THROW;
357 #endif /* use GNU */
360 /* The following functions are extensions found in X/Open CAE. */
361 #ifdef __USE_XOPEN
362 /* Determine number of column positions required for C. */
363 extern int wcwidth (wchar_t __c) __THROW;
365 /* Determine number of column positions required for first N wide
366 characters (or fewer if S ends before this) in S. */
367 extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW;
368 #endif /* Use X/Open. */
371 __BEGIN_NAMESPACE_C99
372 /* Convert initial portion of the wide string NPTR to `double'
373 representation. */
374 extern double wcstod (__const wchar_t *__restrict __nptr,
375 wchar_t **__restrict __endptr) __THROW;
377 #ifdef __USE_ISOC99
378 /* Likewise for `float' and `long double' sizes of floating-point numbers. */
379 extern float wcstof (__const wchar_t *__restrict __nptr,
380 wchar_t **__restrict __endptr) __THROW;
381 extern long double wcstold (__const wchar_t *__restrict __nptr,
382 wchar_t **__restrict __endptr) __THROW;
383 #endif /* C99 */
386 /* Convert initial portion of wide string NPTR to `long int'
387 representation. */
388 extern long int wcstol (__const wchar_t *__restrict __nptr,
389 wchar_t **__restrict __endptr, int __base) __THROW;
391 /* Convert initial portion of wide string NPTR to `unsigned long int'
392 representation. */
393 extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
394 wchar_t **__restrict __endptr, int __base)
395 __THROW;
397 #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
398 /* Convert initial portion of wide string NPTR to `long int'
399 representation. */
400 __extension__
401 extern long long int wcstoll (__const wchar_t *__restrict __nptr,
402 wchar_t **__restrict __endptr, int __base)
403 __THROW;
405 /* Convert initial portion of wide string NPTR to `unsigned long long int'
406 representation. */
407 __extension__
408 extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr,
409 wchar_t **__restrict __endptr,
410 int __base) __THROW;
411 #endif /* ISO C99 or GCC and GNU. */
412 __END_NAMESPACE_C99
414 #if defined __GNUC__ && defined __USE_GNU
415 /* Convert initial portion of wide string NPTR to `long int'
416 representation. */
417 __extension__
418 extern long long int wcstoq (__const wchar_t *__restrict __nptr,
419 wchar_t **__restrict __endptr, int __base)
420 __THROW;
422 /* Convert initial portion of wide string NPTR to `unsigned long long int'
423 representation. */
424 __extension__
425 extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr,
426 wchar_t **__restrict __endptr,
427 int __base) __THROW;
428 #endif /* GCC and use GNU. */
430 #ifdef __USE_GNU
431 /* The concept of one static locale per category is not very well
432 thought out. Many applications will need to process its data using
433 information from several different locales. Another application is
434 the implementation of the internationalization handling in the
435 upcoming ISO C++ standard library. To support this another set of
436 the functions using locale data exist which have an additional
437 argument.
439 Attention: all these functions are *not* standardized in any form.
440 This is a proof-of-concept implementation. */
442 /* Structure for reentrant locale using functions. This is an
443 (almost) opaque type for the user level programs. */
444 # include <xlocale.h>
446 /* Special versions of the functions above which take the locale to
447 use as an additional parameter. */
448 extern long int wcstol_l (__const wchar_t *__restrict __nptr,
449 wchar_t **__restrict __endptr, int __base,
450 __locale_t __loc) __THROW;
452 extern unsigned long int wcstoul_l (__const wchar_t *__restrict __nptr,
453 wchar_t **__restrict __endptr,
454 int __base, __locale_t __loc) __THROW;
456 __extension__
457 extern long long int wcstoll_l (__const wchar_t *__restrict __nptr,
458 wchar_t **__restrict __endptr,
459 int __base, __locale_t __loc) __THROW;
461 __extension__
462 extern unsigned long long int wcstoull_l (__const wchar_t *__restrict __nptr,
463 wchar_t **__restrict __endptr,
464 int __base, __locale_t __loc)
465 __THROW;
467 extern double wcstod_l (__const wchar_t *__restrict __nptr,
468 wchar_t **__restrict __endptr, __locale_t __loc)
469 __THROW;
471 extern float wcstof_l (__const wchar_t *__restrict __nptr,
472 wchar_t **__restrict __endptr, __locale_t __loc)
473 __THROW;
475 extern long double wcstold_l (__const wchar_t *__restrict __nptr,
476 wchar_t **__restrict __endptr,
477 __locale_t __loc) __THROW;
478 #endif /* GNU */
481 /* The internal entry points for `wcstoX' take an extra flag argument
482 saying whether or not to parse locale-dependent number grouping. */
483 extern double __wcstod_internal (__const wchar_t *__restrict __nptr,
484 wchar_t **__restrict __endptr, int __group)
485 __THROW;
486 extern float __wcstof_internal (__const wchar_t *__restrict __nptr,
487 wchar_t **__restrict __endptr, int __group)
488 __THROW;
489 extern long double __wcstold_internal (__const wchar_t *__restrict __nptr,
490 wchar_t **__restrict __endptr,
491 int __group) __THROW;
493 #ifndef __wcstol_internal_defined
494 extern long int __wcstol_internal (__const wchar_t *__restrict __nptr,
495 wchar_t **__restrict __endptr,
496 int __base, int __group) __THROW;
497 # define __wcstol_internal_defined 1
498 #endif
499 #ifndef __wcstoul_internal_defined
500 extern unsigned long int __wcstoul_internal (__const wchar_t *__restrict __npt,
501 wchar_t **__restrict __endptr,
502 int __base, int __group) __THROW;
503 # define __wcstoul_internal_defined 1
504 #endif
505 #ifndef __wcstoll_internal_defined
506 __extension__
507 extern long long int __wcstoll_internal (__const wchar_t *__restrict __nptr,
508 wchar_t **__restrict __endptr,
509 int __base, int __group) __THROW;
510 # define __wcstoll_internal_defined 1
511 #endif
512 #ifndef __wcstoull_internal_defined
513 __extension__
514 extern unsigned long long int __wcstoull_internal (__const wchar_t *
515 __restrict __nptr,
516 wchar_t **
517 __restrict __endptr,
518 int __base,
519 int __group) __THROW;
520 # define __wcstoull_internal_defined 1
521 #endif
524 #if defined __OPTIMIZE__ && __GNUC__ >= 2
525 /* Define inline functions which call the internal entry points. */
526 __BEGIN_NAMESPACE_C99
528 extern __inline double wcstod (__const wchar_t *__restrict __nptr,
529 wchar_t **__restrict __endptr) __THROW
530 { return __wcstod_internal (__nptr, __endptr, 0); }
531 extern __inline long int wcstol (__const wchar_t *__restrict __nptr,
532 wchar_t **__restrict __endptr,
533 int __base) __THROW
534 { return __wcstol_internal (__nptr, __endptr, __base, 0); }
535 extern __inline unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
536 wchar_t **__restrict __endptr,
537 int __base) __THROW
538 { return __wcstoul_internal (__nptr, __endptr, __base, 0); }
539 __END_NAMESPACE_C99
541 # ifdef __USE_GNU
542 extern __inline float wcstof (__const wchar_t *__restrict __nptr,
543 wchar_t **__restrict __endptr) __THROW
544 { return __wcstof_internal (__nptr, __endptr, 0); }
545 extern __inline long double wcstold (__const wchar_t *__restrict __nptr,
546 wchar_t **__restrict __endptr) __THROW
547 { return __wcstold_internal (__nptr, __endptr, 0); }
550 __extension__
551 extern __inline long long int wcstoq (__const wchar_t *__restrict __nptr,
552 wchar_t **__restrict __endptr,
553 int __base) __THROW
554 { return __wcstoll_internal (__nptr, __endptr, __base, 0); }
555 __extension__
556 extern __inline unsigned long long int wcstouq (__const wchar_t *
557 __restrict __nptr,
558 wchar_t **__restrict __endptr,
559 int __base) __THROW
560 { return __wcstoull_internal (__nptr, __endptr, __base, 0); }
561 # endif /* Use GNU. */
562 #endif /* Optimizing GCC >=2. */
565 #ifdef __USE_GNU
566 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
567 DEST. */
568 extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW;
570 /* Copy no more than N characters of SRC to DEST, returning the address of
571 the last character written into DEST. */
572 extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
573 __THROW;
574 #endif /* use GNU */
577 /* Wide character I/O functions. */
578 #if defined __USE_ISOC99 || defined __USE_UNIX98
579 __BEGIN_NAMESPACE_C99
581 /* Select orientation for stream. */
582 extern int fwide (__FILE *__fp, int __mode) __THROW;
585 /* Write formatted output to STREAM.
587 This function is a possible cancellation point and therefore not
588 marked with __THROW. */
589 extern int fwprintf (__FILE *__restrict __stream,
590 __const wchar_t *__restrict __format, ...)
591 /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
592 /* Write formatted output to stdout.
594 This function is a possible cancellation point and therefore not
595 marked with __THROW. */
596 extern int wprintf (__const wchar_t *__restrict __format, ...)
597 /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
598 /* Write formatted output of at most N characters to S. */
599 extern int swprintf (wchar_t *__restrict __s, size_t __n,
600 __const wchar_t *__restrict __format, ...)
601 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
603 /* Write formatted output to S from argument list ARG.
605 This function is a possible cancellation point and therefore not
606 marked with __THROW. */
607 extern int vfwprintf (__FILE *__restrict __s,
608 __const wchar_t *__restrict __format,
609 __gnuc_va_list __arg)
610 /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
611 /* Write formatted output to stdout from argument list ARG.
613 This function is a possible cancellation point and therefore not
614 marked with __THROW. */
615 extern int vwprintf (__const wchar_t *__restrict __format,
616 __gnuc_va_list __arg)
617 /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
618 /* Write formatted output of at most N character to S from argument
619 list ARG. */
620 extern int vswprintf (wchar_t *__restrict __s, size_t __n,
621 __const wchar_t *__restrict __format,
622 __gnuc_va_list __arg)
623 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
626 /* Read formatted input from STREAM.
628 This function is a possible cancellation point and therefore not
629 marked with __THROW. */
630 extern int fwscanf (__FILE *__restrict __stream,
631 __const wchar_t *__restrict __format, ...)
632 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
633 /* Read formatted input from stdin.
635 This function is a possible cancellation point and therefore not
636 marked with __THROW. */
637 extern int wscanf (__const wchar_t *__restrict __format, ...)
638 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
639 /* Read formatted input from S. */
640 extern int swscanf (__const wchar_t *__restrict __s,
641 __const wchar_t *__restrict __format, ...)
642 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
644 __END_NAMESPACE_C99
645 #endif /* Use ISO C99 and Unix98. */
647 #ifdef __USE_ISOC99
648 __BEGIN_NAMESPACE_C99
650 /* Read formatted input from S into argument list ARG.
652 This function is a possible cancellation point and therefore not
653 marked with __THROW. */
654 extern int vfwscanf (__FILE *__restrict __s,
655 __const wchar_t *__restrict __format,
656 __gnuc_va_list __arg)
657 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
658 /* Read formatted input from stdin into argument list ARG.
660 This function is a possible cancellation point and therefore not
661 marked with __THROW. */
662 extern int vwscanf (__const wchar_t *__restrict __format,
663 __gnuc_va_list __arg)
664 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
665 /* Read formatted input from S into argument list ARG. */
666 extern int vswscanf (__const wchar_t *__restrict __s,
667 __const wchar_t *__restrict __format,
668 __gnuc_va_list __arg)
669 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
671 __END_NAMESPACE_C99
672 #endif /* Use ISO C99. */
675 __BEGIN_NAMESPACE_C99
676 /* Read a character from STREAM.
678 These functions are possible cancellation points and therefore not
679 marked with __THROW. */
680 extern wint_t fgetwc (__FILE *__stream);
681 extern wint_t getwc (__FILE *__stream);
683 /* Read a character from stdin.
685 This function is a possible cancellation point and therefore not
686 marked with __THROW. */
687 extern wint_t getwchar (void);
690 /* Write a character to STREAM.
692 These functions are possible cancellation points and therefore not
693 marked with __THROW. */
694 extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
695 extern wint_t putwc (wchar_t __wc, __FILE *__stream);
697 /* Write a character to stdout.
699 This function is a possible cancellation points and therefore not
700 marked with __THROW. */
701 extern wint_t putwchar (wchar_t __wc);
704 /* Get a newline-terminated wide character string of finite length
705 from STREAM.
707 This function is a possible cancellation points and therefore not
708 marked with __THROW. */
709 extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
710 __FILE *__restrict __stream);
712 /* Write a string to STREAM.
714 This function is a possible cancellation points and therefore not
715 marked with __THROW. */
716 extern int fputws (__const wchar_t *__restrict __ws,
717 __FILE *__restrict __stream);
720 /* Push a character back onto the input buffer of STREAM.
722 This function is a possible cancellation points and therefore not
723 marked with __THROW. */
724 extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
725 __END_NAMESPACE_C99
728 #ifdef __USE_GNU
729 /* These are defined to be equivalent to the `char' functions defined
730 in POSIX.1:1996.
732 These functions are not part of POSIX and therefore no official
733 cancellation point. But due to similarity with an POSIX interface
734 or due to the implementation they are cancellation points and
735 therefore not marked with __THROW. */
736 extern wint_t getwc_unlocked (__FILE *__stream);
737 extern wint_t getwchar_unlocked (void);
739 /* This is the wide character version of a GNU extension.
741 This function is not part of POSIX and therefore no official
742 cancellation point. But due to similarity with an POSIX interface
743 or due to the implementation it is a cancellation point and
744 therefore not marked with __THROW. */
745 extern wint_t fgetwc_unlocked (__FILE *__stream);
747 /* Faster version when locking is not necessary.
749 This function is not part of POSIX and therefore no official
750 cancellation point. But due to similarity with an POSIX interface
751 or due to the implementation it is a cancellation point and
752 therefore not marked with __THROW. */
753 extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
755 /* These are defined to be equivalent to the `char' functions defined
756 in POSIX.1:1996.
758 These functions are not part of POSIX and therefore no official
759 cancellation point. But due to similarity with an POSIX interface
760 or due to the implementation they are cancellation points and
761 therefore not marked with __THROW. */
762 extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
763 extern wint_t putwchar_unlocked (wchar_t __wc);
766 /* This function does the same as `fgetws' but does not lock the stream.
768 This function is not part of POSIX and therefore no official
769 cancellation point. But due to similarity with an POSIX interface
770 or due to the implementation it is a cancellation point and
771 therefore not marked with __THROW. */
772 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
773 __FILE *__restrict __stream);
775 /* This function does the same as `fputws' but does not lock the stream.
777 This function is not part of POSIX and therefore no official
778 cancellation point. But due to similarity with an POSIX interface
779 or due to the implementation it is a cancellation point and
780 therefore not marked with __THROW. */
781 extern int fputws_unlocked (__const wchar_t *__restrict __ws,
782 __FILE *__restrict __stream);
783 #endif
786 __BEGIN_NAMESPACE_C99
787 /* Format TP into S according to FORMAT.
788 Write no more than MAXSIZE wide characters and return the number
789 of wide characters written, or 0 if it would exceed MAXSIZE. */
790 extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
791 __const wchar_t *__restrict __format,
792 __const struct tm *__restrict __tp) __THROW;
793 __END_NAMESPACE_C99
795 # ifdef __USE_GNU
796 # include <xlocale.h>
798 /* Similar to `wcsftime' but takes the information from
799 the provided locale and not the global locale. */
800 extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
801 __const wchar_t *__restrict __format,
802 __const struct tm *__restrict __tp,
803 __locale_t __loc) __THROW;
804 # endif
806 /* The X/Open standard demands that most of the functions defined in
807 the <wctype.h> header must also appear here. This is probably
808 because some X/Open members wrote their implementation before the
809 ISO C standard was published and introduced the better solution.
810 We have to provide these definitions for compliance reasons but we
811 do this nonsense only if really necessary. */
812 #if defined __USE_UNIX98 && !defined __USE_GNU
813 # define __need_iswxxx
814 # include <wctype.h>
815 #endif
817 __END_DECLS
819 #endif /* _WCHAR_H defined */
821 #endif /* wchar.h */