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