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