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