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