]> git.proxmox.com Git - wasi-libc.git/blame - libc-top-half/musl/include/wchar.h
bump version to 0.0~git20240411.9e8c542-3~bpo12+pve1
[wasi-libc.git] / libc-top-half / musl / include / wchar.h
CommitLineData
320054e8
DG
1#ifndef _WCHAR_H
2#define _WCHAR_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#define __NEED_FILE
11#define __NEED___isoc_va_list
12#define __NEED_size_t
13#define __NEED_wchar_t
14#define __NEED_wint_t
15#define __NEED_mbstate_t
16
f41256b6
DG
17#ifdef __wasilibc_unmodified_upstream /* WASI doesn't need to define FILE as a complete type */
18#if __STDC_VERSION__ < 201112L
19#define __NEED_struct__IO_FILE
20#endif
21#endif
22
320054e8
DG
23#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
24 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
25#define __NEED_locale_t
26#define __NEED_va_list
27#endif
28
29#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
30#define __NEED_wctype_t
31#endif
32
33#include <bits/alltypes.h>
34
35#if L'\0'-1 > 0
36#define WCHAR_MAX (0xffffffffu+L'\0')
37#define WCHAR_MIN (0+L'\0')
38#else
39#define WCHAR_MAX (0x7fffffff+L'\0')
40#define WCHAR_MIN (-1-0x7fffffff+L'\0')
41#endif
42
e5f14be3 43#ifdef __wasilibc_unmodified_upstream /* Use the compiler's definition of NULL */
5d8a1409
DG
44#if __cplusplus >= 201103L
45#define NULL nullptr
46#elif defined(__cplusplus)
320054e8
DG
47#define NULL 0L
48#else
49#define NULL ((void*)0)
50#endif
51#else
52#define __need_NULL
53#include <stddef.h>
54#endif
55
56#undef WEOF
57#define WEOF 0xffffffffU
58
59wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
60wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
61
62wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
63wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t);
64
65int wcscmp (const wchar_t *, const wchar_t *);
66int wcsncmp (const wchar_t *, const wchar_t *, size_t);
67
68int wcscoll(const wchar_t *, const wchar_t *);
69size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t);
70
71wchar_t *wcschr (const wchar_t *, wchar_t);
72wchar_t *wcsrchr (const wchar_t *, wchar_t);
73
74size_t wcscspn (const wchar_t *, const wchar_t *);
75size_t wcsspn (const wchar_t *, const wchar_t *);
76wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
77
78wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict);
79
80size_t wcslen (const wchar_t *);
81
82wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
83wchar_t *wcswcs (const wchar_t *, const wchar_t *);
84
85wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
86int wmemcmp (const wchar_t *, const wchar_t *, size_t);
87wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
88wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
89wchar_t *wmemset (wchar_t *, wchar_t, size_t);
90
91wint_t btowc (int);
92int wctob (wint_t);
93
94int mbsinit (const mbstate_t *);
95size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
96size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
97
98size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
99
100size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict);
101size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict);
102
103float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
104double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
105long double wcstold (const wchar_t *__restrict, wchar_t **__restrict);
106
107long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
108unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int);
109
110long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int);
111unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int);
112
113
114
115int fwide (FILE *, int);
116
117
118int wprintf (const wchar_t *__restrict, ...);
119int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...);
120int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...);
121
122int vwprintf (const wchar_t *__restrict, __isoc_va_list);
123int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
124int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, __isoc_va_list);
125
126int wscanf (const wchar_t *__restrict, ...);
127int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...);
128int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...);
129
130int vwscanf (const wchar_t *__restrict, __isoc_va_list);
131int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
132int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, __isoc_va_list);
133
134wint_t fgetwc (FILE *);
135wint_t getwc (FILE *);
136wint_t getwchar (void);
137
138wint_t fputwc (wchar_t, FILE *);
139wint_t putwc (wchar_t, FILE *);
140wint_t putwchar (wchar_t);
141
142wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict);
143int fputws (const wchar_t *__restrict, FILE *__restrict);
144
145wint_t ungetwc (wint_t, FILE *);
146
147struct tm;
148size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict);
149
150#undef iswdigit
151
152#if defined(_GNU_SOURCE)
153wint_t fgetwc_unlocked (FILE *);
154wint_t getwc_unlocked (FILE *);
155wint_t getwchar_unlocked (void);
156wint_t fputwc_unlocked (wchar_t, FILE *);
157wint_t putwc_unlocked (wchar_t, FILE *);
158wint_t putwchar_unlocked (wchar_t);
159wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict);
160int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict);
161#endif
162
163#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
164size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t);
165#endif
166
167#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
168 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
169FILE *open_wmemstream(wchar_t **, size_t *);
170size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict);
171size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict);
172wchar_t *wcsdup(const wchar_t *);
173size_t wcsnlen (const wchar_t *, size_t);
174wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict);
175wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
176int wcscasecmp(const wchar_t *, const wchar_t *);
177int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
178int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
179int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
180int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
181size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t, locale_t);
182#endif
183
184#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
185int wcwidth (wchar_t);
186int wcswidth (const wchar_t *, size_t);
187int iswalnum(wint_t);
188int iswalpha(wint_t);
189int iswblank(wint_t);
190int iswcntrl(wint_t);
191int iswdigit(wint_t);
192int iswgraph(wint_t);
193int iswlower(wint_t);
194int iswprint(wint_t);
195int iswpunct(wint_t);
196int iswspace(wint_t);
197int iswupper(wint_t);
198int iswxdigit(wint_t);
199int iswctype(wint_t, wctype_t);
200wint_t towlower(wint_t);
201wint_t towupper(wint_t);
202wctype_t wctype(const char *);
203
204#ifndef __cplusplus
205#undef iswdigit
206#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
207#endif
208#endif
209
210#ifdef __cplusplus
211}
212#endif
213
214#endif