iconv: add aliases for GBK
[musl.git] / include / wchar.h
blobed5d774dfa96870f46749be827dea12513d45f9f
1 #ifndef _WCHAR_H
2 #define _WCHAR_H
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
8 #include <features.h>
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
17 #if __STDC_VERSION__ < 201112L
18 #define __NEED_struct__IO_FILE
19 #endif
21 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
22 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
23 #define __NEED_locale_t
24 #define __NEED_va_list
25 #endif
27 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
28 #define __NEED_wctype_t
29 #endif
31 #include <bits/alltypes.h>
33 #if L'\0'-1 > 0
34 #define WCHAR_MAX (0xffffffffu+L'\0')
35 #define WCHAR_MIN (0+L'\0')
36 #else
37 #define WCHAR_MAX (0x7fffffff+L'\0')
38 #define WCHAR_MIN (-1-0x7fffffff+L'\0')
39 #endif
41 #if __cplusplus >= 201103L
42 #define NULL nullptr
43 #elif defined(__cplusplus)
44 #define NULL 0L
45 #else
46 #define NULL ((void*)0)
47 #endif
49 #undef WEOF
50 #define WEOF 0xffffffffU
52 wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
53 wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
55 wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
56 wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t);
58 int wcscmp (const wchar_t *, const wchar_t *);
59 int wcsncmp (const wchar_t *, const wchar_t *, size_t);
61 int wcscoll(const wchar_t *, const wchar_t *);
62 size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t);
64 wchar_t *wcschr (const wchar_t *, wchar_t);
65 wchar_t *wcsrchr (const wchar_t *, wchar_t);
67 size_t wcscspn (const wchar_t *, const wchar_t *);
68 size_t wcsspn (const wchar_t *, const wchar_t *);
69 wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
71 wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict);
73 size_t wcslen (const wchar_t *);
75 wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
76 wchar_t *wcswcs (const wchar_t *, const wchar_t *);
78 wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
79 int wmemcmp (const wchar_t *, const wchar_t *, size_t);
80 wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
81 wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
82 wchar_t *wmemset (wchar_t *, wchar_t, size_t);
84 wint_t btowc (int);
85 int wctob (wint_t);
87 int mbsinit (const mbstate_t *);
88 size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
89 size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
91 size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
93 size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict);
94 size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict);
96 float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
97 double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
98 long double wcstold (const wchar_t *__restrict, wchar_t **__restrict);
100 long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
101 unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int);
103 long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int);
104 unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int);
108 int fwide (FILE *, int);
111 int wprintf (const wchar_t *__restrict, ...);
112 int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...);
113 int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...);
115 int vwprintf (const wchar_t *__restrict, __isoc_va_list);
116 int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
117 int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, __isoc_va_list);
119 int wscanf (const wchar_t *__restrict, ...);
120 int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...);
121 int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...);
123 int vwscanf (const wchar_t *__restrict, __isoc_va_list);
124 int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
125 int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, __isoc_va_list);
127 wint_t fgetwc (FILE *);
128 wint_t getwc (FILE *);
129 wint_t getwchar (void);
131 wint_t fputwc (wchar_t, FILE *);
132 wint_t putwc (wchar_t, FILE *);
133 wint_t putwchar (wchar_t);
135 wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict);
136 int fputws (const wchar_t *__restrict, FILE *__restrict);
138 wint_t ungetwc (wint_t, FILE *);
140 struct tm;
141 size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict);
143 #undef iswdigit
145 #if defined(_GNU_SOURCE)
146 wint_t fgetwc_unlocked (FILE *);
147 wint_t getwc_unlocked (FILE *);
148 wint_t getwchar_unlocked (void);
149 wint_t fputwc_unlocked (wchar_t, FILE *);
150 wint_t putwc_unlocked (wchar_t, FILE *);
151 wint_t putwchar_unlocked (wchar_t);
152 wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict);
153 int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict);
154 #endif
156 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
157 size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t);
158 #endif
160 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
161 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
162 FILE *open_wmemstream(wchar_t **, size_t *);
163 size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict);
164 size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict);
165 wchar_t *wcsdup(const wchar_t *);
166 size_t wcsnlen (const wchar_t *, size_t);
167 wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict);
168 wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
169 int wcscasecmp(const wchar_t *, const wchar_t *);
170 int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
171 int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
172 int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
173 int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
174 size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t, locale_t);
175 #endif
177 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
178 int wcwidth (wchar_t);
179 int wcswidth (const wchar_t *, size_t);
180 int iswalnum(wint_t);
181 int iswalpha(wint_t);
182 int iswblank(wint_t);
183 int iswcntrl(wint_t);
184 int iswdigit(wint_t);
185 int iswgraph(wint_t);
186 int iswlower(wint_t);
187 int iswprint(wint_t);
188 int iswpunct(wint_t);
189 int iswspace(wint_t);
190 int iswupper(wint_t);
191 int iswxdigit(wint_t);
192 int iswctype(wint_t, wctype_t);
193 wint_t towlower(wint_t);
194 wint_t towupper(wint_t);
195 wctype_t wctype(const char *);
197 #ifndef __cplusplus
198 #undef iswdigit
199 #define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
200 #endif
201 #endif
203 #ifdef __cplusplus
205 #endif
207 #endif