further use of _Noreturn, for non-plain-C functions
[musl] / include / wchar.h
1 #ifndef _WCHAR_H
2 #define _WCHAR_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #if __STDC_VERSION__ >= 199901L
9 #define __restrict restrict
10 #elif !defined(__GNUC__)
11 #define __restrict
12 #endif
13
14 #define __NEED_FILE
15 #define __NEED_va_list
16 #define __NEED_size_t
17 #define __NEED_wchar_t
18 #define __NEED_wint_t
19
20 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
21  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
22 #define __NEED_locale_t
23 #endif
24
25 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
26 #define __NEED_wctype_t
27 #endif
28
29 #include <bits/alltypes.h>
30
31 #include <bits/wchar.h>
32
33 #undef NULL
34 #ifdef __cplusplus
35 #define NULL 0
36 #else
37 #define NULL ((void*)0)
38 #endif
39
40 #undef WEOF
41 #define WEOF (-1)
42
43 typedef struct
44 {
45         unsigned __opaque1, __opaque2;
46 } mbstate_t;
47
48 wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
49 wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
50
51 wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
52 wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t);
53
54 int wcscmp (const wchar_t *, const wchar_t *);
55 int wcsncmp (const wchar_t *, const wchar_t *, size_t);
56
57 int wcscoll(const wchar_t *, const wchar_t *);
58 size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t n);
59
60 wchar_t *wcschr (const wchar_t *, wchar_t);
61 wchar_t *wcsrchr (const wchar_t *, wchar_t);
62
63 size_t wcscspn (const wchar_t *, const wchar_t *);
64 size_t wcsspn (const wchar_t *, const wchar_t *);
65 wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
66
67 wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict);
68
69 size_t wcslen (const wchar_t *);
70
71 wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
72 wchar_t *wcswcs (const wchar_t *, const wchar_t *);
73
74 wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
75 int wmemcmp (const wchar_t *, const wchar_t *, size_t);
76 wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
77 wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
78 wchar_t *wmemset (wchar_t *, wchar_t, size_t);
79
80 wint_t btowc (int);
81 int wctob (wint_t);
82
83 int mbsinit (const mbstate_t *);
84 size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
85 size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
86
87 size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
88
89 size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict);
90 size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict);
91
92 float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
93 double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
94 long double wcstold (const wchar_t *__restrict, wchar_t **__restrict);
95
96 long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
97 unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int);
98
99 long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int);
100 unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int);
101
102
103
104 int fwide (FILE *, int);
105
106
107 int wprintf (const wchar_t *__restrict, ...);
108 int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...);
109 int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...);
110
111 int vwprintf (const wchar_t *__restrict, va_list);
112 int vfwprintf (FILE *__restrict, const wchar_t *__restrict, va_list);
113 int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, va_list);
114
115 int wscanf (const wchar_t *__restrict, ...);
116 int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...);
117 int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...);
118
119 int vwscanf (const wchar_t *__restrict, va_list);
120 int vfwscanf (FILE *__restrict, const wchar_t *__restrict, va_list);
121 int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, va_list);
122
123 wint_t fgetwc (FILE *);
124 wint_t getwc (FILE *);
125 wint_t getwchar (void);
126
127 wint_t fputwc (wchar_t, FILE *);
128 wint_t putwc (wchar_t, FILE *);
129 wint_t putwchar (wchar_t);
130
131 wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict);
132 int fputws (const wchar_t *__restrict, FILE *__restrict);
133
134 wint_t ungetwc (wint_t, FILE *);
135
136 struct tm;
137 size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict);
138
139 #undef iswdigit
140
141 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
142  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
143 FILE *open_wmemstream(wchar_t **, size_t *);
144 size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict);
145 size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict);
146 wchar_t *wcsdup(const wchar_t *);
147 size_t wcsnlen (const wchar_t *, size_t);
148 wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict);
149 wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
150 int wcscasecmp(const wchar_t *, const wchar_t *);
151 int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
152 int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
153 int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
154 int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
155 size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t n, locale_t);
156 #endif
157
158 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
159 int wcwidth (wchar_t);
160 int wcswidth (const wchar_t *, size_t);
161 int       iswalnum(wint_t);
162 int       iswalpha(wint_t);
163 int       iswblank(wint_t);
164 int       iswcntrl(wint_t);
165 int       iswdigit(wint_t);
166 int       iswgraph(wint_t);
167 int       iswlower(wint_t);
168 int       iswprint(wint_t);
169 int       iswpunct(wint_t);
170 int       iswspace(wint_t);
171 int       iswupper(wint_t);
172 int       iswxdigit(wint_t);
173 int       iswctype(wint_t, wctype_t);
174 wint_t    towlower(wint_t);
175 wint_t    towupper(wint_t);
176 wctype_t  wctype(const char *);
177 #undef iswdigit
178 #define iswdigit(a) ((unsigned)(a)-'0' < 10)
179 #endif
180
181 #ifdef __cplusplus
182 }
183 #endif
184
185 #endif