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