]> git.ipfire.org Git - thirdparty/glibc.git/blame - wcsmbs/wchar.h
Regenerate libc.pot
[thirdparty/glibc.git] / wcsmbs / wchar.h
CommitLineData
6d7e8eda 1/* Copyright (C) 1995-2023 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 14 You should have received a copy of the GNU Lesser General Public
59ba27a6 15 License along with the GNU C Library; if not, see
5a82c748 16 <https://www.gnu.org/licenses/>. */
30de3b18
RM
17
18/*
d1646309
UD
19 * ISO C99 Standard: 7.24
20 * Extended multibyte and wide character utilities <wchar.h>
30de3b18
RM
21 */
22
23#ifndef _WCHAR_H
199fc19d 24#define _WCHAR_H 1
5107cf1d 25
199fc19d
ZW
26#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
27#include <bits/libc-header-start.h>
30de3b18 28
45f39d45
PM
29/* Gather machine dependent type support. */
30#include <bits/floatn.h>
31
199fc19d
ZW
32#define __need_size_t
33#define __need_wchar_t
34#define __need_NULL
35#include <stddef.h>
30de3b18 36
199fc19d
ZW
37#define __need___va_list
38#include <stdarg.h>
7b503bcc 39
a363f707
AZ
40#if defined __USE_XOPEN2K || defined __USE_XOPEN2K8
41# ifdef __GNUC__
42# ifndef _VA_LIST_DEFINED
43typedef __gnuc_va_list va_list;
44# define _VA_LIST_DEFINED
45# endif
46# else
47# include <stdarg.h>
48# endif
49#endif
50
199fc19d
ZW
51#include <bits/wchar.h>
52#include <bits/types/wint_t.h>
53#include <bits/types/mbstate_t.h>
54#include <bits/types/__FILE.h>
9ac9129d 55
199fc19d
ZW
56#if defined __USE_UNIX98 || defined __USE_XOPEN2K
57# include <bits/types/FILE.h>
71a40c74 58#endif
f0be25b6
ZW
59#ifdef __USE_XOPEN2K8
60# include <bits/types/locale_t.h>
61#endif
71a40c74 62
199fc19d
ZW
63/* Tell the caller that we provide correct C++ prototypes. */
64#if defined __cplusplus && __GNUC_PREREQ (4, 4)
65# define __CORRECT_ISO_CPP_WCHAR_H_PROTO
d64b6ad0 66#endif
db6af3eb 67
cc3fa755
UD
68#ifndef WCHAR_MIN
69/* These constants might also be defined in <inttypes.h>. */
417bafec
UD
70# define WCHAR_MIN __WCHAR_MIN
71# define WCHAR_MAX __WCHAR_MAX
cc3fa755 72#endif
30de3b18
RM
73
74#ifndef WEOF
75# define WEOF (0xffffffffu)
76#endif
77
199fc19d
ZW
78/* All versions of XPG prior to the publication of ISO C99 required
79 the bulk of <wctype.h>'s declarations to appear in this header
80 (because <wctype.h> did not exist prior to C99). In POSIX.1-2001
81 those declarations were marked as XSI extensions; in -2008 they
82 were additionally marked as obsolescent. _GNU_SOURCE mode
83 anticipates the removal of these declarations in the next revision
84 of POSIX. */
85#if (defined __USE_XOPEN && !defined __USE_GNU \
86 && !(defined __USE_XOPEN2K && !defined __USE_XOPEN2KXSI))
87# include <bits/wctype-wchar.h>
e918a7fe
UD
88#endif
89
7a5affeb
UD
90__BEGIN_DECLS
91
9756dfe1
UD
92/* This incomplete type is defined in <time.h> but needed here because
93 of `wcsftime'. */
94struct tm;
95
96
30de3b18 97/* Copy SRC to DEST. */
c1422e5b 98extern wchar_t *wcscpy (wchar_t *__restrict __dest,
a6ab6ccd
DM
99 const wchar_t *__restrict __src)
100 __THROW __nonnull ((1, 2));
101
30de3b18 102/* Copy no more than N wide-characters of SRC to DEST. */
c1422e5b 103extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
a784e502 104 const wchar_t *__restrict __src, size_t __n)
a6ab6ccd 105 __THROW __nonnull ((1, 2));
30de3b18 106
b54e5d1c
FW
107#ifdef __USE_MISC
108/* Copy at most N - 1 characters from SRC to DEST. */
109extern size_t wcslcpy (wchar_t *__restrict __dest,
110 const wchar_t *__restrict __src, size_t __n)
111 __THROW __nonnull ((1, 2)) __attr_access ((__write_only__, 1, 3));
112
113/* Append SRC to DEST, possibly with truncation to keep the total size
114 below N. */
115extern size_t wcslcat (wchar_t *__restrict __dest,
116 const wchar_t *__restrict __src, size_t __n)
117 __THROW __nonnull ((1, 2)) __attr_access ((__read_write__, 1, 3));
118#endif
119
30de3b18 120/* Append SRC onto DEST. */
c1422e5b 121extern wchar_t *wcscat (wchar_t *__restrict __dest,
aeb47bbc
DM
122 const wchar_t *__restrict __src)
123 __THROW __nonnull ((1, 2));
30de3b18 124/* Append no more than N wide-characters of SRC onto DEST. */
c1422e5b 125extern wchar_t *wcsncat (wchar_t *__restrict __dest,
a784e502 126 const wchar_t *__restrict __src, size_t __n)
aeb47bbc 127 __THROW __nonnull ((1, 2));
30de3b18
RM
128
129/* Compare S1 and S2. */
a784e502 130extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2)
aeb47bbc 131 __THROW __attribute_pure__ __nonnull ((1, 2));
30de3b18 132/* Compare N wide-characters of S1 and S2. */
a784e502 133extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
aeb47bbc 134 __THROW __attribute_pure__ __nonnull ((1, 2));
30de3b18 135
6cbe890a 136#ifdef __USE_XOPEN2K8
2f6d1f1b 137/* Compare S1 and S2, ignoring case. */
a784e502 138extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) __THROW;
2f6d1f1b
UD
139
140/* Compare no more than N chars of S1 and S2, ignoring case. */
a784e502 141extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
c1422e5b 142 size_t __n) __THROW;
0501d603
UD
143
144/* Similar to the two functions above but take the information from
145 the provided locale and not the global locale. */
a784e502 146extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
af85385f 147 locale_t __loc) __THROW;
0501d603 148
a784e502 149extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
af85385f 150 size_t __n, locale_t __loc) __THROW;
2f6d1f1b
UD
151#endif
152
75cd5204
RM
153/* Compare S1 and S2, both interpreted as appropriate to the
154 LC_COLLATE category of the current locale. */
a784e502 155extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
75cd5204
RM
156/* Transform S2 into array pointed to by S1 such that if wcscmp is
157 applied to two transformed strings the result is the as applying
158 `wcscoll' to the original strings. */
c1422e5b 159extern size_t wcsxfrm (wchar_t *__restrict __s1,
a784e502 160 const wchar_t *__restrict __s2, size_t __n) __THROW;
75cd5204 161
6cbe890a 162#ifdef __USE_XOPEN2K8
c84142e8
UD
163/* Similar to the two functions above but take the information from
164 the provided locale and not the global locale. */
c84142e8
UD
165
166/* Compare S1 and S2, both interpreted as appropriate to the
167 LC_COLLATE category of the given locale. */
a784e502 168extern int wcscoll_l (const wchar_t *__s1, const wchar_t *__s2,
af85385f 169 locale_t __loc) __THROW;
1ab62b32 170
c84142e8
UD
171/* Transform S2 into array pointed to by S1 such that if wcscmp is
172 applied to two transformed strings the result is the as applying
173 `wcscoll' to the original strings. */
a784e502 174extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2,
af85385f 175 size_t __n, locale_t __loc) __THROW;
c84142e8 176
30de3b18 177/* Duplicate S, returning an identical malloc'd string. */
c1760eaf
MS
178extern wchar_t *wcsdup (const wchar_t *__s) __THROW
179 __attribute_malloc__ __attr_dealloc_free;
1618c590 180#endif
30de3b18 181
6d52618b 182/* Find the first occurrence of WC in WCS. */
d8387c7b
UD
183#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
184extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc)
185 __THROW __asm ("wcschr") __attribute_pure__;
a784e502 186extern "C++" const wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
9ac9129d 187 __THROW __asm ("wcschr") __attribute_pure__;
d8387c7b 188#else
a784e502 189extern wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
fb4dfa0c 190 __THROW __attribute_pure__;
d8387c7b 191#endif
6d52618b 192/* Find the last occurrence of WC in WCS. */
d8387c7b
UD
193#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
194extern "C++" wchar_t *wcsrchr (wchar_t *__wcs, wchar_t __wc)
195 __THROW __asm ("wcsrchr") __attribute_pure__;
a784e502 196extern "C++" const wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
d8387c7b
UD
197 __THROW __asm ("wcsrchr") __attribute_pure__;
198#else
a784e502 199extern wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
fb4dfa0c 200 __THROW __attribute_pure__;
d8387c7b 201#endif
30de3b18 202
d64b6ad0 203#ifdef __USE_GNU
557a9213 204/* This function is similar to `wcschr'. But it returns a pointer to
d64b6ad0 205 the closing NUL wide character in case C is not found in S. */
a784e502 206extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc)
fb4dfa0c 207 __THROW __attribute_pure__;
d64b6ad0
UD
208#endif
209
30de3b18 210/* Return the length of the initial segmet of WCS which
1618c590 211 consists entirely of wide characters not in REJECT. */
a784e502 212extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject)
fb4dfa0c 213 __THROW __attribute_pure__;
30de3b18 214/* Return the length of the initial segmet of WCS which
1618c590 215 consists entirely of wide characters in ACCEPT. */
a784e502 216extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept)
fb4dfa0c 217 __THROW __attribute_pure__;
6d52618b 218/* Find the first occurrence in WCS of any character in ACCEPT. */
d8387c7b 219#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
a784e502 220extern "C++" wchar_t *wcspbrk (wchar_t *__wcs, const wchar_t *__accept)
d8387c7b 221 __THROW __asm ("wcspbrk") __attribute_pure__;
a784e502
UD
222extern "C++" const wchar_t *wcspbrk (const wchar_t *__wcs,
223 const wchar_t *__accept)
d8387c7b
UD
224 __THROW __asm ("wcspbrk") __attribute_pure__;
225#else
a784e502 226extern wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept)
fb4dfa0c 227 __THROW __attribute_pure__;
d8387c7b 228#endif
6d52618b 229/* Find the first occurrence of NEEDLE in HAYSTACK. */
d8387c7b 230#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
a784e502 231extern "C++" wchar_t *wcsstr (wchar_t *__haystack, const wchar_t *__needle)
d8387c7b 232 __THROW __asm ("wcsstr") __attribute_pure__;
a784e502
UD
233extern "C++" const wchar_t *wcsstr (const wchar_t *__haystack,
234 const wchar_t *__needle)
d8387c7b
UD
235 __THROW __asm ("wcsstr") __attribute_pure__;
236#else
a784e502 237extern wchar_t *wcsstr (const wchar_t *__haystack, const wchar_t *__needle)
fb4dfa0c 238 __THROW __attribute_pure__;
d8387c7b 239#endif
e918a7fe 240
30de3b18 241/* Divide WCS into tokens separated by characters in DELIM. */
c1422e5b 242extern wchar_t *wcstok (wchar_t *__restrict __s,
a784e502 243 const wchar_t *__restrict __delim,
c1422e5b 244 wchar_t **__restrict __ptr) __THROW;
30de3b18 245
1618c590 246/* Return the number of wide characters in S. */
a784e502 247extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__;
7a5affeb
UD
248
249#ifdef __USE_XOPEN
250/* Another name for `wcsstr' from XPG4. */
d8387c7b 251# ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
a784e502 252extern "C++" wchar_t *wcswcs (wchar_t *__haystack, const wchar_t *__needle)
d8387c7b 253 __THROW __asm ("wcswcs") __attribute_pure__;
a784e502
UD
254extern "C++" const wchar_t *wcswcs (const wchar_t *__haystack,
255 const wchar_t *__needle)
d8387c7b
UD
256 __THROW __asm ("wcswcs") __attribute_pure__;
257# else
a784e502 258extern wchar_t *wcswcs (const wchar_t *__haystack, const wchar_t *__needle)
7a5affeb 259 __THROW __attribute_pure__;
d8387c7b 260# endif
7a5affeb 261#endif
30de3b18 262
6cbe890a 263#ifdef __USE_XOPEN2K8
4bca4c17 264/* Return the number of wide characters in S, but at most MAXLEN. */
a784e502 265extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen)
fb4dfa0c 266 __THROW __attribute_pure__;
4bca4c17
UD
267#endif
268
30de3b18 269
1618c590 270/* Search N wide characters of S for C. */
d8387c7b
UD
271#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
272extern "C++" wchar_t *wmemchr (wchar_t *__s, wchar_t __c, size_t __n)
273 __THROW __asm ("wmemchr") __attribute_pure__;
a784e502
UD
274extern "C++" const wchar_t *wmemchr (const wchar_t *__s, wchar_t __c,
275 size_t __n)
d8387c7b
UD
276 __THROW __asm ("wmemchr") __attribute_pure__;
277#else
a784e502 278extern wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
fb4dfa0c 279 __THROW __attribute_pure__;
d8387c7b 280#endif
30de3b18 281
1618c590 282/* Compare N wide characters of S1 and S2. */
a784e502 283extern int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
fb4dfa0c 284 __THROW __attribute_pure__;
30de3b18 285
1618c590 286/* Copy N wide characters of SRC to DEST. */
c1422e5b 287extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
a784e502 288 const wchar_t *__restrict __s2, size_t __n) __THROW;
30de3b18 289
1618c590 290/* Copy N wide characters of SRC to DEST, guaranteeing
30de3b18 291 correct behavior for overlapping strings. */
a784e502 292extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)
c1422e5b 293 __THROW;
30de3b18 294
1618c590 295/* Set N wide characters of S to C. */
c1422e5b 296extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
30de3b18 297
d64b6ad0
UD
298#ifdef __USE_GNU
299/* Copy N wide characters of SRC to DEST and return pointer to following
300 wide character. */
c1422e5b 301extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
a784e502 302 const wchar_t *__restrict __s2, size_t __n)
c1422e5b 303 __THROW;
d64b6ad0
UD
304#endif
305
30de3b18
RM
306
307/* Determine whether C constitutes a valid (one-byte) multibyte
308 character. */
c1422e5b 309extern wint_t btowc (int __c) __THROW;
30de3b18
RM
310
311/* Determine whether C corresponds to a member of the extended
312 character set whose multibyte representation is a single byte. */
c1422e5b 313extern int wctob (wint_t __c) __THROW;
30de3b18
RM
314
315/* Determine whether PS points to an object representing the initial
316 state. */
a784e502 317extern int mbsinit (const mbstate_t *__ps) __THROW __attribute_pure__;
30de3b18 318
30de3b18
RM
319/* Write wide character representation of multibyte character pointed
320 to by S to PWC. */
c1422e5b 321extern size_t mbrtowc (wchar_t *__restrict __pwc,
a784e502 322 const char *__restrict __s, size_t __n,
dadebdae 323 mbstate_t *__restrict __p) __THROW;
30de3b18
RM
324
325/* Write multibyte representation of wide character WC to S. */
c1422e5b
UD
326extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
327 mbstate_t *__restrict __ps) __THROW;
30de3b18 328
07a4742f 329/* Return number of bytes in multibyte character pointed to by S. */
a784e502 330extern size_t __mbrlen (const char *__restrict __s, size_t __n,
c1422e5b 331 mbstate_t *__restrict __ps) __THROW;
a784e502 332extern size_t mbrlen (const char *__restrict __s, size_t __n,
c1422e5b 333 mbstate_t *__restrict __ps) __THROW;
07a4742f 334
07c416ed 335#ifdef __USE_EXTERN_INLINES
07a4742f 336/* Define inline function as optimization. */
91682d70
UD
337
338/* We can use the BTOWC and WCTOB optimizations since we know that all
339 locales must use ASCII encoding for the values in the ASCII range
340 and because the wchar_t encoding is always ISO 10646. */
341extern wint_t __btowc_alias (int __c) __asm ("btowc");
b037a293 342__extern_inline wint_t
91682d70
UD
343__NTH (btowc (int __c))
344{ return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f'
345 ? (wint_t) __c : __btowc_alias (__c)); }
346
347extern int __wctob_alias (wint_t __c) __asm ("wctob");
b037a293 348__extern_inline int
91682d70
UD
349__NTH (wctob (wint_t __wc))
350{ return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
351 ? (int) __wc : __wctob_alias (__wc)); }
352
b037a293 353__extern_inline size_t
a784e502 354__NTH (mbrlen (const char *__restrict __s, size_t __n,
f377d022 355 mbstate_t *__restrict __ps))
2f6d1f1b 356{ return (__ps != NULL
bdbf022d 357 ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
07a4742f
RM
358#endif
359
036cc82f
RM
360/* Write wide character representation of multibyte character string
361 SRC to DST. */
c1422e5b 362extern size_t mbsrtowcs (wchar_t *__restrict __dst,
a784e502 363 const char **__restrict __src, size_t __len,
c1422e5b 364 mbstate_t *__restrict __ps) __THROW;
30de3b18
RM
365
366/* Write multibyte character representation of wide character string
367 SRC to DST. */
c1422e5b 368extern size_t wcsrtombs (char *__restrict __dst,
a784e502 369 const wchar_t **__restrict __src, size_t __len,
c1422e5b 370 mbstate_t *__restrict __ps) __THROW;
30de3b18 371
75cd5204 372
6cbe890a 373#ifdef __USE_XOPEN2K8
036cc82f
RM
374/* Write wide character representation of at most NMC bytes of the
375 multibyte character string SRC to DST. */
c1422e5b 376extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
a784e502 377 const char **__restrict __src, size_t __nmc,
c1422e5b 378 size_t __len, mbstate_t *__restrict __ps) __THROW;
036cc82f
RM
379
380/* Write multibyte character representation of at most NWC characters
381 from the wide character string SRC to DST. */
c1422e5b 382extern size_t wcsnrtombs (char *__restrict __dst,
a784e502 383 const wchar_t **__restrict __src,
c1422e5b
UD
384 size_t __nwc, size_t __len,
385 mbstate_t *__restrict __ps) __THROW;
6cbe890a 386#endif /* use POSIX 2008 */
e34b0f29 387
036cc82f 388
75cd5204 389/* The following functions are extensions found in X/Open CAE. */
9756dfe1 390#ifdef __USE_XOPEN
75cd5204 391/* Determine number of column positions required for C. */
b6d64fb0 392extern int wcwidth (wchar_t __c) __THROW;
75cd5204
RM
393
394/* Determine number of column positions required for first N wide
395 characters (or fewer if S ends before this) in S. */
a784e502 396extern int wcswidth (const wchar_t *__s, size_t __n) __THROW;
9756dfe1 397#endif /* Use X/Open. */
75cd5204
RM
398
399
400/* Convert initial portion of the wide string NPTR to `double'
401 representation. */
a784e502 402extern double wcstod (const wchar_t *__restrict __nptr,
c1422e5b 403 wchar_t **__restrict __endptr) __THROW;
75cd5204 404
ec751a23 405#ifdef __USE_ISOC99
75cd5204 406/* Likewise for `float' and `long double' sizes of floating-point numbers. */
a784e502 407extern float wcstof (const wchar_t *__restrict __nptr,
c1422e5b 408 wchar_t **__restrict __endptr) __THROW;
a784e502 409extern long double wcstold (const wchar_t *__restrict __nptr,
c1422e5b 410 wchar_t **__restrict __endptr) __THROW;
91bc38d0 411#endif /* C99 */
75cd5204 412
9e2ff880 413#if __GLIBC_USE (IEC_60559_TYPES_EXT) && __GLIBC_USE (ISOC2X)
43ddff2e
JM
414/* Likewise for `_FloatN' and `_FloatNx' when support is enabled. */
415
9e2ff880 416# if __HAVE_FLOAT16
43ddff2e
JM
417extern _Float16 wcstof16 (const wchar_t *__restrict __nptr,
418 wchar_t **__restrict __endptr) __THROW;
9e2ff880 419# endif
43ddff2e 420
9e2ff880 421# if __HAVE_FLOAT32
43ddff2e
JM
422extern _Float32 wcstof32 (const wchar_t *__restrict __nptr,
423 wchar_t **__restrict __endptr) __THROW;
9e2ff880 424# endif
43ddff2e 425
9e2ff880 426# if __HAVE_FLOAT64
43ddff2e
JM
427extern _Float64 wcstof64 (const wchar_t *__restrict __nptr,
428 wchar_t **__restrict __endptr) __THROW;
9e2ff880 429# endif
43ddff2e 430
9e2ff880 431# if __HAVE_FLOAT128
45f39d45
PM
432extern _Float128 wcstof128 (const wchar_t *__restrict __nptr,
433 wchar_t **__restrict __endptr) __THROW;
9e2ff880 434# endif
45f39d45 435
9e2ff880 436# if __HAVE_FLOAT32X
43ddff2e
JM
437extern _Float32x wcstof32x (const wchar_t *__restrict __nptr,
438 wchar_t **__restrict __endptr) __THROW;
9e2ff880 439# endif
43ddff2e 440
9e2ff880 441# if __HAVE_FLOAT64X
43ddff2e
JM
442extern _Float64x wcstof64x (const wchar_t *__restrict __nptr,
443 wchar_t **__restrict __endptr) __THROW;
9e2ff880 444# endif
43ddff2e 445
9e2ff880 446# if __HAVE_FLOAT128X
43ddff2e
JM
447extern _Float128x wcstof128x (const wchar_t *__restrict __nptr,
448 wchar_t **__restrict __endptr) __THROW;
9e2ff880
JM
449# endif
450#endif /* __GLIBC_USE (IEC_60559_TYPES_EXT) && __GLIBC_USE (ISOC2X) */
43ddff2e 451
75cd5204
RM
452
453/* Convert initial portion of wide string NPTR to `long int'
454 representation. */
a784e502 455extern long int wcstol (const wchar_t *__restrict __nptr,
c1422e5b 456 wchar_t **__restrict __endptr, int __base) __THROW;
75cd5204
RM
457
458/* Convert initial portion of wide string NPTR to `unsigned long int'
459 representation. */
a784e502 460extern unsigned long int wcstoul (const wchar_t *__restrict __nptr,
c1422e5b
UD
461 wchar_t **__restrict __endptr, int __base)
462 __THROW;
75cd5204 463
fed0faa1 464#ifdef __USE_ISOC99
9e6e344e 465/* Convert initial portion of wide string NPTR to `long long int'
75cd5204 466 representation. */
7782d0bf 467__extension__
a784e502 468extern long long int wcstoll (const wchar_t *__restrict __nptr,
7a5affeb 469 wchar_t **__restrict __endptr, int __base)
c1422e5b 470 __THROW;
75cd5204
RM
471
472/* Convert initial portion of wide string NPTR to `unsigned long long int'
473 representation. */
7782d0bf 474__extension__
a784e502 475extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr,
7a5affeb
UD
476 wchar_t **__restrict __endptr,
477 int __base) __THROW;
fed0faa1 478#endif /* ISO C99. */
75cd5204 479
fed0faa1 480#ifdef __USE_GNU
9e6e344e 481/* Convert initial portion of wide string NPTR to `long long int'
2f6d1f1b 482 representation. */
7782d0bf 483__extension__
a784e502 484extern long long int wcstoq (const wchar_t *__restrict __nptr,
7a5affeb 485 wchar_t **__restrict __endptr, int __base)
c1422e5b 486 __THROW;
2f6d1f1b
UD
487
488/* Convert initial portion of wide string NPTR to `unsigned long long int'
489 representation. */
7782d0bf 490__extension__
a784e502 491extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr,
7a5affeb
UD
492 wchar_t **__restrict __endptr,
493 int __base) __THROW;
fed0faa1 494#endif /* Use GNU. */
2f6d1f1b 495
64924422
JM
496/* Versions of the above functions that handle '0b' and '0B' prefixes
497 in base 0 or 2. */
498#if __GLIBC_USE (C2X_STRTOL)
499# ifdef __REDIRECT
500extern long int __REDIRECT_NTH (wcstol, (const wchar_t *__restrict __nptr,
501 wchar_t **__restrict __endptr,
502 int __base), __isoc23_wcstol);
503extern unsigned long int __REDIRECT_NTH (wcstoul,
504 (const wchar_t *__restrict __nptr,
505 wchar_t **__restrict __endptr,
506 int __base), __isoc23_wcstoul);
507__extension__
508extern long long int __REDIRECT_NTH (wcstoll,
509 (const wchar_t *__restrict __nptr,
510 wchar_t **__restrict __endptr,
511 int __base), __isoc23_wcstoll);
512__extension__
513extern unsigned long long int __REDIRECT_NTH (wcstoull,
514 (const wchar_t *__restrict __nptr,
515 wchar_t **__restrict __endptr,
516 int __base), __isoc23_wcstoull);
517# ifdef __USE_GNU
518__extension__
519extern long long int __REDIRECT_NTH (wcstoq, (const wchar_t *__restrict __nptr,
520 wchar_t **__restrict __endptr,
521 int __base), __isoc23_wcstoll);
522__extension__
523extern unsigned long long int __REDIRECT_NTH (wcstouq,
524 (const wchar_t *__restrict __nptr,
525 wchar_t **__restrict __endptr,
526 int __base), __isoc23_wcstoull);
527# endif
528# else
529extern long int __isoc23_wcstol (const wchar_t *__restrict __nptr,
530 wchar_t **__restrict __endptr, int __base)
531 __THROW;
532extern unsigned long int __isoc23_wcstoul (const wchar_t *__restrict __nptr,
533 wchar_t **__restrict __endptr,
534 int __base)
535 __THROW;
536__extension__
537extern long long int __isoc23_wcstoll (const wchar_t *__restrict __nptr,
538 wchar_t **__restrict __endptr,
539 int __base)
540 __THROW;
541__extension__
542extern unsigned long long int __isoc23_wcstoull (const wchar_t *__restrict __nptr,
543 wchar_t **__restrict __endptr,
544 int __base)
545 __THROW;
546# define wcstol __isoc23_wcstol
547# define wcstoul __isoc23_wcstoul
548# define wcstoll __isoc23_wcstoll
549# define wcstoull __isoc23_wcstoull
550# ifdef __USE_GNU
551# define wcstoq __isoc23_wcstoll
552# define wcstouq __isoc23_wcstoull
553# endif
554# endif
555#endif
556
0501d603 557#ifdef __USE_GNU
f0be25b6
ZW
558/* Parallel versions of the functions above which take the locale to
559 use as an additional parameter. These are GNU extensions inspired
560 by the POSIX.1-2008 extended locale API. */
a784e502 561extern long int wcstol_l (const wchar_t *__restrict __nptr,
1ab62b32 562 wchar_t **__restrict __endptr, int __base,
af85385f 563 locale_t __loc) __THROW;
0501d603 564
a784e502 565extern unsigned long int wcstoul_l (const wchar_t *__restrict __nptr,
1ab62b32 566 wchar_t **__restrict __endptr,
af85385f 567 int __base, locale_t __loc) __THROW;
0501d603 568
7782d0bf 569__extension__
a784e502 570extern long long int wcstoll_l (const wchar_t *__restrict __nptr,
1ab62b32 571 wchar_t **__restrict __endptr,
af85385f 572 int __base, locale_t __loc) __THROW;
0501d603 573
7782d0bf 574__extension__
a784e502 575extern unsigned long long int wcstoull_l (const wchar_t *__restrict __nptr,
1ab62b32 576 wchar_t **__restrict __endptr,
af85385f 577 int __base, locale_t __loc)
1ab62b32 578 __THROW;
0501d603 579
64924422
JM
580/* Versions of the above functions that handle '0b' and '0B' prefixes
581 in base 0 or 2. */
582# if __GLIBC_USE (C2X_STRTOL)
583# ifdef __REDIRECT
584extern long int __REDIRECT_NTH (wcstol_l, (const wchar_t *__restrict __nptr,
585 wchar_t **__restrict __endptr,
586 int __base, locale_t __loc),
587 __isoc23_wcstol_l);
588extern unsigned long int __REDIRECT_NTH (wcstoul_l,
589 (const wchar_t *__restrict __nptr,
590 wchar_t **__restrict __endptr,
591 int __base, locale_t __loc),
592 __isoc23_wcstoul_l);
593__extension__
594extern long long int __REDIRECT_NTH (wcstoll_l,
595 (const wchar_t *__restrict __nptr,
596 wchar_t **__restrict __endptr,
597 int __base, locale_t __loc),
598 __isoc23_wcstoll_l);
599__extension__
600extern unsigned long long int __REDIRECT_NTH (wcstoull_l,
601 (const wchar_t *__restrict __nptr,
602 wchar_t **__restrict __endptr,
603 int __base, locale_t __loc),
604 __isoc23_wcstoull_l);
605# else
606extern long int __isoc23_wcstol_l (const wchar_t *__restrict __nptr,
607 wchar_t **__restrict __endptr, int __base,
608 locale_t __loc) __THROW;
609extern unsigned long int __isoc23_wcstoul_l (const wchar_t *__restrict __nptr,
610 wchar_t **__restrict __endptr,
611 int __base, locale_t __loc)
612 __THROW;
613__extension__
614extern long long int __isoc23_wcstoll_l (const wchar_t *__restrict __nptr,
615 wchar_t **__restrict __endptr,
616 int __base, locale_t __loc)
617 __THROW;
618__extension__
619extern unsigned long long int __isoc23_wcstoull_l (const wchar_t *__restrict __nptr,
620 wchar_t **__restrict __endptr,
621 int __base, locale_t __loc)
622 __THROW;
623# define wcstol_l __isoc23_wcstol_l
624# define wcstoul_l __isoc23_wcstoul_l
625# define wcstoll_l __isoc23_wcstoll_l
626# define wcstoull_l __isoc23_wcstoull_l
627# endif
628# endif
629
a784e502 630extern double wcstod_l (const wchar_t *__restrict __nptr,
af85385f 631 wchar_t **__restrict __endptr, locale_t __loc)
1ab62b32 632 __THROW;
0501d603 633
a784e502 634extern float wcstof_l (const wchar_t *__restrict __nptr,
af85385f 635 wchar_t **__restrict __endptr, locale_t __loc)
1ab62b32 636 __THROW;
0501d603 637
a784e502 638extern long double wcstold_l (const wchar_t *__restrict __nptr,
1ab62b32 639 wchar_t **__restrict __endptr,
af85385f 640 locale_t __loc) __THROW;
45f39d45 641
43ddff2e
JM
642# if __HAVE_FLOAT16
643extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
644 wchar_t **__restrict __endptr,
645 locale_t __loc) __THROW;
646# endif
647
648# if __HAVE_FLOAT32
649extern _Float32 wcstof32_l (const wchar_t *__restrict __nptr,
650 wchar_t **__restrict __endptr,
651 locale_t __loc) __THROW;
652# endif
653
654# if __HAVE_FLOAT64
655extern _Float64 wcstof64_l (const wchar_t *__restrict __nptr,
656 wchar_t **__restrict __endptr,
657 locale_t __loc) __THROW;
658# endif
659
45f39d45
PM
660# if __HAVE_FLOAT128
661extern _Float128 wcstof128_l (const wchar_t *__restrict __nptr,
662 wchar_t **__restrict __endptr,
af85385f 663 locale_t __loc) __THROW;
45f39d45 664# endif
43ddff2e
JM
665
666# if __HAVE_FLOAT32X
667extern _Float32x wcstof32x_l (const wchar_t *__restrict __nptr,
668 wchar_t **__restrict __endptr,
669 locale_t __loc) __THROW;
670# endif
671
672# if __HAVE_FLOAT64X
673extern _Float64x wcstof64x_l (const wchar_t *__restrict __nptr,
674 wchar_t **__restrict __endptr,
675 locale_t __loc) __THROW;
676# endif
677
678# if __HAVE_FLOAT128X
679extern _Float128x wcstof128x_l (const wchar_t *__restrict __nptr,
680 wchar_t **__restrict __endptr,
681 locale_t __loc) __THROW;
682# endif
8593482f 683#endif /* use GNU */
0501d603 684
75cd5204 685
8593482f 686#ifdef __USE_XOPEN2K8
75cd5204
RM
687/* Copy SRC to DEST, returning the address of the terminating L'\0' in
688 DEST. */
4f197237 689extern wchar_t *wcpcpy (wchar_t *__restrict __dest,
a784e502 690 const wchar_t *__restrict __src) __THROW;
75cd5204
RM
691
692/* Copy no more than N characters of SRC to DEST, returning the address of
693 the last character written into DEST. */
4f197237 694extern wchar_t *wcpncpy (wchar_t *__restrict __dest,
a784e502 695 const wchar_t *__restrict __src, size_t __n)
c1422e5b 696 __THROW;
48789000 697#endif
75cd5204
RM
698
699
d64b6ad0 700/* Wide character I/O functions. */
1c31aa79 701
48789000 702#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
c1760eaf
MS
703# ifndef __attr_dealloc_fclose
704# if defined __has_builtin
705# if __has_builtin (__builtin_fclose)
706/* If the attribute macro hasn't been defined yet (by <stdio.h>) and
707 fclose is a built-in, use it. */
708# define __attr_dealloc_fclose __attr_dealloc (__builtin_fclose, 1)
709# endif
710# endif
711# endif
712# ifndef __attr_dealloc_fclose
713# define __attr_dealloc_fclose /* empty */
714# endif
715
1c31aa79
UD
716/* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces
717 a wide character string. */
c1760eaf
MS
718extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
719 __attribute_malloc__ __attr_dealloc_fclose;
1c31aa79
UD
720#endif
721
087722b8 722#if defined __USE_ISOC95 || defined __USE_UNIX98
d64b6ad0
UD
723
724/* Select orientation for stream. */
d1646309 725extern int fwide (__FILE *__fp, int __mode) __THROW;
d64b6ad0
UD
726
727
2c008571
UD
728/* Write formatted output to STREAM.
729
730 This function is a possible cancellation point and therefore not
731 marked with __THROW. */
d1646309 732extern int fwprintf (__FILE *__restrict __stream,
a784e502 733 const wchar_t *__restrict __format, ...)
2c008571
UD
734 /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
735/* Write formatted output to stdout.
736
737 This function is a possible cancellation point and therefore not
738 marked with __THROW. */
a784e502 739extern int wprintf (const wchar_t *__restrict __format, ...)
2c008571 740 /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
d64b6ad0 741/* Write formatted output of at most N characters to S. */
c1422e5b 742extern int swprintf (wchar_t *__restrict __s, size_t __n,
a784e502 743 const wchar_t *__restrict __format, ...)
c1422e5b 744 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
d64b6ad0 745
2c008571
UD
746/* Write formatted output to S from argument list ARG.
747
748 This function is a possible cancellation point and therefore not
749 marked with __THROW. */
d1646309 750extern int vfwprintf (__FILE *__restrict __s,
a784e502 751 const wchar_t *__restrict __format,
c1422e5b 752 __gnuc_va_list __arg)
2c008571
UD
753 /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
754/* Write formatted output to stdout from argument list ARG.
755
756 This function is a possible cancellation point and therefore not
757 marked with __THROW. */
a784e502 758extern int vwprintf (const wchar_t *__restrict __format,
c1422e5b 759 __gnuc_va_list __arg)
2c008571 760 /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
d64b6ad0
UD
761/* Write formatted output of at most N character to S from argument
762 list ARG. */
c1422e5b 763extern int vswprintf (wchar_t *__restrict __s, size_t __n,
a784e502 764 const wchar_t *__restrict __format,
c1422e5b
UD
765 __gnuc_va_list __arg)
766 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
d64b6ad0
UD
767
768
2c008571
UD
769/* Read formatted input from STREAM.
770
771 This function is a possible cancellation point and therefore not
772 marked with __THROW. */
d1646309 773extern int fwscanf (__FILE *__restrict __stream,
a784e502 774 const wchar_t *__restrict __format, ...)
2c008571
UD
775 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
776/* Read formatted input from stdin.
777
778 This function is a possible cancellation point and therefore not
779 marked with __THROW. */
a784e502 780extern int wscanf (const wchar_t *__restrict __format, ...)
2c008571 781 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
d64b6ad0 782/* Read formatted input from S. */
a784e502
UD
783extern int swscanf (const wchar_t *__restrict __s,
784 const wchar_t *__restrict __format, ...)
c1422e5b 785 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
7a5affeb 786
03992356 787/* For historical reasons, the C99-compliant versions of the scanf
e4a39992 788 functions are at alternative names. When __LDBL_COMPAT or
e2239af3 789 __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
e4a39992 790 bits/wchar-ldbl.h. */
dee2bea0 791# if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
e2239af3 792 && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
dee2bea0
JM
793# if __GLIBC_USE (C2X_STRTOL)
794# ifdef __REDIRECT
795extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
796 const wchar_t *__restrict __format, ...),
797 __isoc23_fwscanf)
798 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
799extern int __REDIRECT (wscanf, (const wchar_t *__restrict __format, ...),
800 __isoc23_wscanf)
801 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
802extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
803 const wchar_t *__restrict __format,
804 ...), __isoc23_swscanf)
805 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
806# else
807extern int __isoc23_fwscanf (__FILE *__restrict __stream,
808 const wchar_t *__restrict __format, ...);
809extern int __isoc23_wscanf (const wchar_t *__restrict __format, ...);
810extern int __isoc23_swscanf (const wchar_t *__restrict __s,
811 const wchar_t *__restrict __format, ...)
812 __THROW;
813# define fwscanf __isoc23_fwscanf
814# define wscanf __isoc23_wscanf
815# define swscanf __isoc23_swscanf
816# endif
817# else
818# ifdef __REDIRECT
874aa523 819extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
a784e502 820 const wchar_t *__restrict __format, ...),
874aa523
UD
821 __isoc99_fwscanf)
822 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
a784e502 823extern int __REDIRECT (wscanf, (const wchar_t *__restrict __format, ...),
874aa523
UD
824 __isoc99_wscanf)
825 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
a784e502
UD
826extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
827 const wchar_t *__restrict __format,
f32f2869
JJ
828 ...), __isoc99_swscanf)
829 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
dee2bea0 830# else
874aa523 831extern int __isoc99_fwscanf (__FILE *__restrict __stream,
a784e502
UD
832 const wchar_t *__restrict __format, ...);
833extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
834extern int __isoc99_swscanf (const wchar_t *__restrict __s,
835 const wchar_t *__restrict __format, ...)
874aa523 836 __THROW;
dee2bea0
JM
837# define fwscanf __isoc99_fwscanf
838# define wscanf __isoc99_wscanf
839# define swscanf __isoc99_swscanf
840# endif
874aa523
UD
841# endif
842# endif
843
087722b8 844#endif /* Use ISO C95, C99 and Unix98. */
d64b6ad0 845
91bc38d0 846#ifdef __USE_ISOC99
2c008571
UD
847/* Read formatted input from S into argument list ARG.
848
849 This function is a possible cancellation point and therefore not
850 marked with __THROW. */
d1646309 851extern int vfwscanf (__FILE *__restrict __s,
a784e502 852 const wchar_t *__restrict __format,
c1422e5b 853 __gnuc_va_list __arg)
2c008571
UD
854 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
855/* Read formatted input from stdin into argument list ARG.
856
857 This function is a possible cancellation point and therefore not
858 marked with __THROW. */
a784e502 859extern int vwscanf (const wchar_t *__restrict __format,
c1422e5b 860 __gnuc_va_list __arg)
2c008571 861 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
d64b6ad0 862/* Read formatted input from S into argument list ARG. */
a784e502
UD
863extern int vswscanf (const wchar_t *__restrict __s,
864 const wchar_t *__restrict __format,
c1422e5b
UD
865 __gnuc_va_list __arg)
866 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
7a5affeb 867
93486ba5
GG
868/* Same redirection as above for the v*wscanf family. */
869# if !__GLIBC_USE (DEPRECATED_SCANF) \
874aa523 870 && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
e4a39992 871 && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
e2239af3 872 && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
dee2bea0
JM
873# if __GLIBC_USE (C2X_STRTOL)
874# ifdef __REDIRECT
875extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
876 const wchar_t *__restrict __format,
877 __gnuc_va_list __arg), __isoc23_vfwscanf)
878 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
879extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
880 __gnuc_va_list __arg), __isoc23_vwscanf)
881 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
882extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
883 const wchar_t *__restrict __format,
884 __gnuc_va_list __arg), __isoc23_vswscanf)
885 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
886# else
887extern int __isoc23_vfwscanf (__FILE *__restrict __s,
888 const wchar_t *__restrict __format,
889 __gnuc_va_list __arg);
890extern int __isoc23_vwscanf (const wchar_t *__restrict __format,
891 __gnuc_va_list __arg);
892extern int __isoc23_vswscanf (const wchar_t *__restrict __s,
893 const wchar_t *__restrict __format,
894 __gnuc_va_list __arg) __THROW;
895# define vfwscanf __isoc23_vfwscanf
896# define vwscanf __isoc23_vwscanf
897# define vswscanf __isoc23_vswscanf
898# endif
899# else
900# ifdef __REDIRECT
874aa523 901extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
a784e502 902 const wchar_t *__restrict __format,
874aa523
UD
903 __gnuc_va_list __arg), __isoc99_vfwscanf)
904 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
a784e502 905extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
874aa523
UD
906 __gnuc_va_list __arg), __isoc99_vwscanf)
907 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
a784e502
UD
908extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
909 const wchar_t *__restrict __format,
f32f2869
JJ
910 __gnuc_va_list __arg), __isoc99_vswscanf)
911 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
dee2bea0 912# else
874aa523 913extern int __isoc99_vfwscanf (__FILE *__restrict __s,
a784e502 914 const wchar_t *__restrict __format,
874aa523 915 __gnuc_va_list __arg);
a784e502 916extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
874aa523 917 __gnuc_va_list __arg);
a784e502
UD
918extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
919 const wchar_t *__restrict __format,
874aa523 920 __gnuc_va_list __arg) __THROW;
dee2bea0
JM
921# define vfwscanf __isoc99_vfwscanf
922# define vwscanf __isoc99_vwscanf
923# define vswscanf __isoc99_vswscanf
924# endif
874aa523
UD
925# endif
926# endif
927
91bc38d0 928#endif /* Use ISO C99. */
d64b6ad0
UD
929
930
2c008571
UD
931/* Read a character from STREAM.
932
933 These functions are possible cancellation points and therefore not
934 marked with __THROW. */
935extern wint_t fgetwc (__FILE *__stream);
936extern wint_t getwc (__FILE *__stream);
d64b6ad0 937
2c008571 938/* Read a character from stdin.
d64b6ad0 939
2c008571
UD
940 This function is a possible cancellation point and therefore not
941 marked with __THROW. */
942extern wint_t getwchar (void);
d64b6ad0 943
d64b6ad0 944
2c008571
UD
945/* Write a character to STREAM.
946
947 These functions are possible cancellation points and therefore not
948 marked with __THROW. */
949extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
950extern wint_t putwc (wchar_t __wc, __FILE *__stream);
951
952/* Write a character to stdout.
953
4c1423ed 954 This function is a possible cancellation point and therefore not
2c008571
UD
955 marked with __THROW. */
956extern wint_t putwchar (wchar_t __wc);
d64b6ad0 957
91bc38d0
UD
958
959/* Get a newline-terminated wide character string of finite length
2c008571
UD
960 from STREAM.
961
4c1423ed 962 This function is a possible cancellation point and therefore not
2c008571 963 marked with __THROW. */
91bc38d0 964extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
2c008571
UD
965 __FILE *__restrict __stream);
966
967/* Write a string to STREAM.
91bc38d0 968
4c1423ed 969 This function is a possible cancellation point and therefore not
2c008571 970 marked with __THROW. */
a784e502 971extern int fputws (const wchar_t *__restrict __ws,
2c008571
UD
972 __FILE *__restrict __stream);
973
91bc38d0 974
2c008571 975/* Push a character back onto the input buffer of STREAM.
91bc38d0 976
4c1423ed 977 This function is a possible cancellation point and therefore not
2c008571
UD
978 marked with __THROW. */
979extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
91bc38d0
UD
980
981
d64b6ad0 982#ifdef __USE_GNU
91bc38d0 983/* These are defined to be equivalent to the `char' functions defined
2c008571 984 in POSIX.1:1996.
91bc38d0 985
2c008571
UD
986 These functions are not part of POSIX and therefore no official
987 cancellation point. But due to similarity with an POSIX interface
988 or due to the implementation they are cancellation points and
989 therefore not marked with __THROW. */
990extern wint_t getwc_unlocked (__FILE *__stream);
991extern wint_t getwchar_unlocked (void);
91bc38d0 992
2c008571
UD
993/* This is the wide character version of a GNU extension.
994
995 This function is not part of POSIX and therefore no official
996 cancellation point. But due to similarity with an POSIX interface
997 or due to the implementation it is a cancellation point and
998 therefore not marked with __THROW. */
999extern wint_t fgetwc_unlocked (__FILE *__stream);
1000
1001/* Faster version when locking is not necessary.
1002
1003 This function is not part of POSIX and therefore no official
1004 cancellation point. But due to similarity with an POSIX interface
1005 or due to the implementation it is a cancellation point and
1006 therefore not marked with __THROW. */
1007extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
d64b6ad0
UD
1008
1009/* These are defined to be equivalent to the `char' functions defined
2c008571 1010 in POSIX.1:1996.
d64b6ad0 1011
2c008571
UD
1012 These functions are not part of POSIX and therefore no official
1013 cancellation point. But due to similarity with an POSIX interface
1014 or due to the implementation they are cancellation points and
1015 therefore not marked with __THROW. */
1016extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
1017extern wint_t putwchar_unlocked (wchar_t __wc);
d64b6ad0 1018
2c008571
UD
1019
1020/* This function does the same as `fgetws' but does not lock the stream.
1021
1022 This function is not part of POSIX and therefore no official
1023 cancellation point. But due to similarity with an POSIX interface
1024 or due to the implementation it is a cancellation point and
1025 therefore not marked with __THROW. */
c1422e5b 1026extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
2c008571
UD
1027 __FILE *__restrict __stream);
1028
1029/* This function does the same as `fputws' but does not lock the stream.
d64b6ad0 1030
2c008571
UD
1031 This function is not part of POSIX and therefore no official
1032 cancellation point. But due to similarity with an POSIX interface
1033 or due to the implementation it is a cancellation point and
1034 therefore not marked with __THROW. */
a784e502 1035extern int fputws_unlocked (const wchar_t *__restrict __ws,
2c008571 1036 __FILE *__restrict __stream);
d64b6ad0
UD
1037#endif
1038
1039
d64b6ad0
UD
1040/* Format TP into S according to FORMAT.
1041 Write no more than MAXSIZE wide characters and return the number
1042 of wide characters written, or 0 if it would exceed MAXSIZE. */
c1422e5b 1043extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
a784e502
UD
1044 const wchar_t *__restrict __format,
1045 const struct tm *__restrict __tp) __THROW;
d64b6ad0 1046
c4d6f155 1047# ifdef __USE_GNU
c4d6f155
RM
1048/* Similar to `wcsftime' but takes the information from
1049 the provided locale and not the global locale. */
c4d6f155 1050extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
a784e502
UD
1051 const wchar_t *__restrict __format,
1052 const struct tm *__restrict __tp,
af85385f 1053 locale_t __loc) __THROW;
c4d6f155
RM
1054# endif
1055
8215c9ec 1056/* Define some macros helping to catch buffer overflows. */
5ac3ea17 1057#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
c7509d49
RMZ
1058/* Declare all functions from bits/wchar2-decl.h first. */
1059# include <bits/wchar2-decl.h>
8215c9ec
UD
1060#endif
1061
c7509d49
RMZ
1062/* The following headers provide asm redirections. These redirections must
1063 appear before the first usage of these functions, e.g. in bits/wchar.h. */
e2239af3 1064#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
54e98f69
RM
1065# include <bits/wchar-ldbl.h>
1066#endif
1067
c7509d49
RMZ
1068#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
1069/* Now include the function definitions and redirects too. */
1070# include <bits/wchar2.h>
1071#endif
1072
30de3b18
RM
1073__END_DECLS
1074
0f2ae55c 1075#endif /* wchar.h */