]> git.proxmox.com Git - wasi-libc.git/blob - libc-top-half/musl/include/wchar.h
Update to musl 1.1.22.
[wasi-libc.git] / libc-top-half / musl / include / wchar.h
1 #ifndef _WCHAR_H
2 #define _WCHAR_H
3
4 #ifdef __cplusplus
5 extern "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
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
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
43 #ifdef __wasilibc_unmodified_upstream /* Use the compiler's definition of NULL */
44 #ifdef __cplusplus
45 #define NULL 0L
46 #else
47 #define NULL ((void*)0)
48 #endif
49 #else
50 #define __need_NULL
51 #include <stddef.h>
52 #endif
53
54 #undef WEOF
55 #define WEOF 0xffffffffU
56
57 wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
58 wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
59
60 wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
61 wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t);
62
63 int wcscmp (const wchar_t *, const wchar_t *);
64 int wcsncmp (const wchar_t *, const wchar_t *, size_t);
65
66 int wcscoll(const wchar_t *, const wchar_t *);
67 size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t);
68
69 wchar_t *wcschr (const wchar_t *, wchar_t);
70 wchar_t *wcsrchr (const wchar_t *, wchar_t);
71
72 size_t wcscspn (const wchar_t *, const wchar_t *);
73 size_t wcsspn (const wchar_t *, const wchar_t *);
74 wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
75
76 wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict);
77
78 size_t wcslen (const wchar_t *);
79
80 wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
81 wchar_t *wcswcs (const wchar_t *, const wchar_t *);
82
83 wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
84 int wmemcmp (const wchar_t *, const wchar_t *, size_t);
85 wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
86 wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
87 wchar_t *wmemset (wchar_t *, wchar_t, size_t);
88
89 wint_t btowc (int);
90 int wctob (wint_t);
91
92 int mbsinit (const mbstate_t *);
93 size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
94 size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
95
96 size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
97
98 size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict);
99 size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict);
100
101 float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
102 double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
103 long double wcstold (const wchar_t *__restrict, wchar_t **__restrict);
104
105 long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
106 unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int);
107
108 long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int);
109 unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int);
110
111
112
113 int fwide (FILE *, int);
114
115
116 int wprintf (const wchar_t *__restrict, ...);
117 int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...);
118 int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...);
119
120 int vwprintf (const wchar_t *__restrict, __isoc_va_list);
121 int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
122 int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, __isoc_va_list);
123
124 int wscanf (const wchar_t *__restrict, ...);
125 int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...);
126 int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...);
127
128 int vwscanf (const wchar_t *__restrict, __isoc_va_list);
129 int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
130 int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, __isoc_va_list);
131
132 wint_t fgetwc (FILE *);
133 wint_t getwc (FILE *);
134 wint_t getwchar (void);
135
136 wint_t fputwc (wchar_t, FILE *);
137 wint_t putwc (wchar_t, FILE *);
138 wint_t putwchar (wchar_t);
139
140 wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict);
141 int fputws (const wchar_t *__restrict, FILE *__restrict);
142
143 wint_t ungetwc (wint_t, FILE *);
144
145 struct tm;
146 size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict);
147
148 #undef iswdigit
149
150 #if defined(_GNU_SOURCE)
151 wint_t fgetwc_unlocked (FILE *);
152 wint_t getwc_unlocked (FILE *);
153 wint_t getwchar_unlocked (void);
154 wint_t fputwc_unlocked (wchar_t, FILE *);
155 wint_t putwc_unlocked (wchar_t, FILE *);
156 wint_t putwchar_unlocked (wchar_t);
157 wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict);
158 int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict);
159 #endif
160
161 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
162 size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t);
163 #endif
164
165 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
166 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
167 FILE *open_wmemstream(wchar_t **, size_t *);
168 size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict);
169 size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict);
170 wchar_t *wcsdup(const wchar_t *);
171 size_t wcsnlen (const wchar_t *, size_t);
172 wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict);
173 wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
174 int wcscasecmp(const wchar_t *, const wchar_t *);
175 int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
176 int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
177 int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
178 int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
179 size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t, locale_t);
180 #endif
181
182 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
183 int wcwidth (wchar_t);
184 int wcswidth (const wchar_t *, size_t);
185 int iswalnum(wint_t);
186 int iswalpha(wint_t);
187 int iswblank(wint_t);
188 int iswcntrl(wint_t);
189 int iswdigit(wint_t);
190 int iswgraph(wint_t);
191 int iswlower(wint_t);
192 int iswprint(wint_t);
193 int iswpunct(wint_t);
194 int iswspace(wint_t);
195 int iswupper(wint_t);
196 int iswxdigit(wint_t);
197 int iswctype(wint_t, wctype_t);
198 wint_t towlower(wint_t);
199 wint_t towupper(wint_t);
200 wctype_t wctype(const char *);
201
202 #ifndef __cplusplus
203 #undef iswdigit
204 #define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
205 #endif
206 #endif
207
208 #ifdef __cplusplus
209 }
210 #endif
211
212 #endif