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