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