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