1 | #ifndef _WCHAR_H_ |
---|
2 | #define _WCHAR_H_ |
---|
3 | |
---|
4 | #include <_ansi.h> |
---|
5 | |
---|
6 | #include <sys/reent.h> |
---|
7 | |
---|
8 | #define __need_size_t |
---|
9 | #define __need_wchar_t |
---|
10 | #define __need_wint_t |
---|
11 | #define __need_NULL |
---|
12 | #include <stddef.h> |
---|
13 | |
---|
14 | /* For _mbstate_t definition. */ |
---|
15 | #include <sys/_types.h> |
---|
16 | #include <sys/cdefs.h> |
---|
17 | /* For __STDC_ISO_10646__ */ |
---|
18 | #include <sys/features.h> |
---|
19 | |
---|
20 | /* typedef only __gnuc_va_list, used throughout the header */ |
---|
21 | #define __need___va_list |
---|
22 | #include <stdarg.h> |
---|
23 | |
---|
24 | /* typedef va_list only when required */ |
---|
25 | #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE |
---|
26 | #ifdef __GNUC__ |
---|
27 | #ifndef _VA_LIST_DEFINED |
---|
28 | typedef __gnuc_va_list va_list; |
---|
29 | #define _VA_LIST_DEFINED |
---|
30 | #endif |
---|
31 | #else /* !__GNUC__ */ |
---|
32 | #include <stdarg.h> |
---|
33 | #endif |
---|
34 | #endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ |
---|
35 | |
---|
36 | #if __XSI_VISIBLE /* && __XSI_VISIBLE < 800 */ && !__GNU_VISIBLE |
---|
37 | #include <wctype.h> |
---|
38 | #endif |
---|
39 | |
---|
40 | #ifndef WEOF |
---|
41 | # define WEOF ((wint_t)-1) |
---|
42 | #endif |
---|
43 | |
---|
44 | /* This must match definition in <stdint.h> */ |
---|
45 | #ifndef WCHAR_MIN |
---|
46 | #ifdef __WCHAR_MIN__ |
---|
47 | #define WCHAR_MIN __WCHAR_MIN__ |
---|
48 | #elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0) |
---|
49 | #define WCHAR_MIN (0 + L'\0') |
---|
50 | #else |
---|
51 | #define WCHAR_MIN (-0x7fffffff - 1 + L'\0') |
---|
52 | #endif |
---|
53 | #endif |
---|
54 | |
---|
55 | /* This must match definition in <stdint.h> */ |
---|
56 | #ifndef WCHAR_MAX |
---|
57 | #ifdef __WCHAR_MAX__ |
---|
58 | #define WCHAR_MAX __WCHAR_MAX__ |
---|
59 | #elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0) |
---|
60 | #define WCHAR_MAX (0xffffffffu + L'\0') |
---|
61 | #else |
---|
62 | #define WCHAR_MAX (0x7fffffff + L'\0') |
---|
63 | #endif |
---|
64 | #endif |
---|
65 | |
---|
66 | #if __POSIX_VISIBLE >= 200809 |
---|
67 | #include <xlocale.h> |
---|
68 | #endif |
---|
69 | |
---|
70 | _BEGIN_STD_C |
---|
71 | |
---|
72 | #if __POSIX_VISIBLE >= 200809 || _XSI_VISIBLE |
---|
73 | /* As in stdio.h, <sys/reent.h> defines __FILE. */ |
---|
74 | #if !defined(__FILE_defined) |
---|
75 | typedef __FILE FILE; |
---|
76 | # define __FILE_defined |
---|
77 | #endif |
---|
78 | #endif |
---|
79 | |
---|
80 | /* As required by POSIX.1-2008, declare tm as incomplete type. |
---|
81 | The actual definition is in time.h. */ |
---|
82 | struct tm; |
---|
83 | |
---|
84 | #ifndef _MBSTATE_T |
---|
85 | #define _MBSTATE_T |
---|
86 | typedef _mbstate_t mbstate_t; |
---|
87 | #endif /* _MBSTATE_T */ |
---|
88 | |
---|
89 | wint_t btowc (int); |
---|
90 | int wctob (wint_t); |
---|
91 | size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict); |
---|
92 | size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, |
---|
93 | mbstate_t *__restrict); |
---|
94 | size_t _mbrtowc_r (struct _reent *, wchar_t * , const char * , |
---|
95 | size_t, mbstate_t *); |
---|
96 | int mbsinit (const mbstate_t *); |
---|
97 | #if __POSIX_VISIBLE >= 200809 |
---|
98 | size_t mbsnrtowcs (wchar_t *__restrict, const char **__restrict, |
---|
99 | size_t, size_t, mbstate_t *__restrict); |
---|
100 | #endif |
---|
101 | size_t _mbsnrtowcs_r (struct _reent *, wchar_t * , const char ** , |
---|
102 | size_t, size_t, mbstate_t *); |
---|
103 | size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, |
---|
104 | mbstate_t *__restrict); |
---|
105 | size_t _mbsrtowcs_r (struct _reent *, wchar_t * , const char ** , size_t, mbstate_t *); |
---|
106 | size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict); |
---|
107 | size_t _wcrtomb_r (struct _reent *, char * , wchar_t, mbstate_t *); |
---|
108 | #if __POSIX_VISIBLE >= 200809 |
---|
109 | size_t wcsnrtombs (char *__restrict, const wchar_t **__restrict, |
---|
110 | size_t, size_t, mbstate_t *__restrict); |
---|
111 | #endif |
---|
112 | size_t _wcsnrtombs_r (struct _reent *, char * , const wchar_t ** , |
---|
113 | size_t, size_t, mbstate_t *); |
---|
114 | size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, |
---|
115 | size_t, mbstate_t *__restrict); |
---|
116 | size_t _wcsrtombs_r (struct _reent *, char * , const wchar_t ** , |
---|
117 | size_t, mbstate_t *); |
---|
118 | #if __POSIX_VISIBLE >= 200809 |
---|
119 | int wcscasecmp (const wchar_t *, const wchar_t *); |
---|
120 | #endif |
---|
121 | wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict); |
---|
122 | wchar_t *wcschr (const wchar_t *, wchar_t); |
---|
123 | int wcscmp (const wchar_t *, const wchar_t *); |
---|
124 | int wcscoll (const wchar_t *, const wchar_t *); |
---|
125 | wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict); |
---|
126 | #if __POSIX_VISIBLE >= 200809 |
---|
127 | wchar_t *wcpcpy (wchar_t *__restrict, |
---|
128 | const wchar_t *__restrict); |
---|
129 | wchar_t *wcsdup (const wchar_t *); |
---|
130 | #endif |
---|
131 | wchar_t *_wcsdup_r (struct _reent *, const wchar_t * ); |
---|
132 | size_t wcscspn (const wchar_t *, const wchar_t *); |
---|
133 | size_t wcsftime (wchar_t *__restrict, size_t, |
---|
134 | const wchar_t *__restrict, const struct tm *__restrict); |
---|
135 | #if __GNU_VISIBLE |
---|
136 | size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, |
---|
137 | const struct tm *__restrict, locale_t); |
---|
138 | #endif |
---|
139 | size_t wcslcat (wchar_t *, const wchar_t *, size_t); |
---|
140 | size_t wcslcpy (wchar_t *, const wchar_t *, size_t); |
---|
141 | size_t wcslen (const wchar_t *); |
---|
142 | #if __POSIX_VISIBLE >= 200809 |
---|
143 | int wcsncasecmp (const wchar_t *, const wchar_t *, size_t); |
---|
144 | #endif |
---|
145 | wchar_t *wcsncat (wchar_t *__restrict, |
---|
146 | const wchar_t *__restrict, size_t); |
---|
147 | int wcsncmp (const wchar_t *, const wchar_t *, size_t); |
---|
148 | wchar_t *wcsncpy (wchar_t *__restrict, |
---|
149 | const wchar_t *__restrict, size_t); |
---|
150 | #if __POSIX_VISIBLE >= 200809 |
---|
151 | wchar_t *wcpncpy (wchar_t *__restrict, |
---|
152 | const wchar_t *__restrict, size_t); |
---|
153 | size_t wcsnlen (const wchar_t *, size_t); |
---|
154 | #endif |
---|
155 | wchar_t *wcspbrk (const wchar_t *, const wchar_t *); |
---|
156 | wchar_t *wcsrchr (const wchar_t *, wchar_t); |
---|
157 | size_t wcsspn (const wchar_t *, const wchar_t *); |
---|
158 | wchar_t *wcsstr (const wchar_t *__restrict, |
---|
159 | const wchar_t *__restrict); |
---|
160 | wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, |
---|
161 | wchar_t **__restrict); |
---|
162 | double wcstod (const wchar_t *__restrict, wchar_t **__restrict); |
---|
163 | double _wcstod_r (struct _reent *, const wchar_t *, wchar_t **); |
---|
164 | #if __ISO_C_VISIBLE >= 1999 |
---|
165 | float wcstof (const wchar_t *__restrict, wchar_t **__restrict); |
---|
166 | #endif |
---|
167 | float _wcstof_r (struct _reent *, const wchar_t *, wchar_t **); |
---|
168 | #if __XSI_VISIBLE |
---|
169 | int wcswidth (const wchar_t *, size_t); |
---|
170 | #endif |
---|
171 | size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, |
---|
172 | size_t); |
---|
173 | #if __POSIX_VISIBLE >= 200809 |
---|
174 | extern int wcscasecmp_l (const wchar_t *, const wchar_t *, locale_t); |
---|
175 | extern int wcsncasecmp_l (const wchar_t *, const wchar_t *, size_t, locale_t); |
---|
176 | extern int wcscoll_l (const wchar_t *, const wchar_t *, locale_t); |
---|
177 | extern size_t wcsxfrm_l (wchar_t *__restrict, const wchar_t *__restrict, size_t, |
---|
178 | locale_t); |
---|
179 | #endif |
---|
180 | |
---|
181 | #if __XSI_VISIBLE |
---|
182 | int wcwidth (const wchar_t); |
---|
183 | #endif |
---|
184 | wchar_t *wmemchr (const wchar_t *, wchar_t, size_t); |
---|
185 | int wmemcmp (const wchar_t *, const wchar_t *, size_t); |
---|
186 | wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, |
---|
187 | size_t); |
---|
188 | wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t); |
---|
189 | #if __GNU_VISIBLE |
---|
190 | wchar_t *wmempcpy (wchar_t *__restrict, const wchar_t *__restrict, |
---|
191 | size_t); |
---|
192 | #endif |
---|
193 | wchar_t *wmemset (wchar_t *, wchar_t, size_t); |
---|
194 | |
---|
195 | long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int); |
---|
196 | #if __ISO_C_VISIBLE >= 1999 |
---|
197 | long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, |
---|
198 | int); |
---|
199 | #endif |
---|
200 | unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, |
---|
201 | int); |
---|
202 | #if __ISO_C_VISIBLE >= 1999 |
---|
203 | unsigned long long wcstoull (const wchar_t *__restrict, |
---|
204 | wchar_t **__restrict, int); |
---|
205 | #endif |
---|
206 | long _wcstol_r (struct _reent *, const wchar_t *, wchar_t **, int); |
---|
207 | long long _wcstoll_r (struct _reent *, const wchar_t *, wchar_t **, int); |
---|
208 | unsigned long _wcstoul_r (struct _reent *, const wchar_t *, wchar_t **, int); |
---|
209 | unsigned long long _wcstoull_r (struct _reent *, const wchar_t *, wchar_t **, int); |
---|
210 | #if __ISO_C_VISIBLE >= 1999 |
---|
211 | long double wcstold (const wchar_t *, wchar_t **); |
---|
212 | #endif |
---|
213 | |
---|
214 | #if __GNU_VISIBLE |
---|
215 | long wcstol_l (const wchar_t *__restrict, wchar_t **__restrict, int, locale_t); |
---|
216 | long long wcstoll_l (const wchar_t *__restrict, wchar_t **__restrict, int, |
---|
217 | locale_t); |
---|
218 | unsigned long wcstoul_l (const wchar_t *__restrict, wchar_t **__restrict, int, |
---|
219 | locale_t); |
---|
220 | unsigned long long wcstoull_l (const wchar_t *__restrict, wchar_t **__restrict, |
---|
221 | int, locale_t); |
---|
222 | double wcstod_l (const wchar_t *, wchar_t **, locale_t); |
---|
223 | float wcstof_l (const wchar_t *, wchar_t **, locale_t); |
---|
224 | long double wcstold_l (const wchar_t *, wchar_t **, locale_t); |
---|
225 | #endif |
---|
226 | |
---|
227 | wint_t fgetwc (__FILE *); |
---|
228 | wchar_t *fgetws (wchar_t *__restrict, int, __FILE *__restrict); |
---|
229 | wint_t fputwc (wchar_t, __FILE *); |
---|
230 | int fputws (const wchar_t *__restrict, __FILE *__restrict); |
---|
231 | #if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500 |
---|
232 | int fwide (__FILE *, int); |
---|
233 | #endif |
---|
234 | wint_t getwc (__FILE *); |
---|
235 | wint_t getwchar (void); |
---|
236 | wint_t putwc (wchar_t, __FILE *); |
---|
237 | wint_t putwchar (wchar_t); |
---|
238 | wint_t ungetwc (wint_t wc, __FILE *); |
---|
239 | |
---|
240 | wint_t _fgetwc_r (struct _reent *, __FILE *); |
---|
241 | wint_t _fgetwc_unlocked_r (struct _reent *, __FILE *); |
---|
242 | wchar_t *_fgetws_r (struct _reent *, wchar_t *, int, __FILE *); |
---|
243 | wchar_t *_fgetws_unlocked_r (struct _reent *, wchar_t *, int, __FILE *); |
---|
244 | wint_t _fputwc_r (struct _reent *, wchar_t, __FILE *); |
---|
245 | wint_t _fputwc_unlocked_r (struct _reent *, wchar_t, __FILE *); |
---|
246 | int _fputws_r (struct _reent *, const wchar_t *, __FILE *); |
---|
247 | int _fputws_unlocked_r (struct _reent *, const wchar_t *, __FILE *); |
---|
248 | int _fwide_r (struct _reent *, __FILE *, int); |
---|
249 | wint_t _getwc_r (struct _reent *, __FILE *); |
---|
250 | wint_t _getwc_unlocked_r (struct _reent *, __FILE *); |
---|
251 | wint_t _getwchar_r (struct _reent *ptr); |
---|
252 | wint_t _getwchar_unlocked_r (struct _reent *ptr); |
---|
253 | wint_t _putwc_r (struct _reent *, wchar_t, __FILE *); |
---|
254 | wint_t _putwc_unlocked_r (struct _reent *, wchar_t, __FILE *); |
---|
255 | wint_t _putwchar_r (struct _reent *, wchar_t); |
---|
256 | wint_t _putwchar_unlocked_r (struct _reent *, wchar_t); |
---|
257 | wint_t _ungetwc_r (struct _reent *, wint_t wc, __FILE *); |
---|
258 | |
---|
259 | #if __GNU_VISIBLE |
---|
260 | wint_t fgetwc_unlocked (__FILE *); |
---|
261 | wchar_t *fgetws_unlocked (wchar_t *__restrict, int, __FILE *__restrict); |
---|
262 | wint_t fputwc_unlocked (wchar_t, __FILE *); |
---|
263 | int fputws_unlocked (const wchar_t *__restrict, __FILE *__restrict); |
---|
264 | wint_t getwc_unlocked (__FILE *); |
---|
265 | wint_t getwchar_unlocked (void); |
---|
266 | wint_t putwc_unlocked (wchar_t, __FILE *); |
---|
267 | wint_t putwchar_unlocked (wchar_t); |
---|
268 | #endif |
---|
269 | |
---|
270 | #if __POSIX_VISIBLE >= 200809 |
---|
271 | __FILE *open_wmemstream (wchar_t **, size_t *); |
---|
272 | #endif |
---|
273 | __FILE *_open_wmemstream_r (struct _reent *, wchar_t **, size_t *); |
---|
274 | |
---|
275 | #ifndef __VALIST |
---|
276 | #ifdef __GNUC__ |
---|
277 | #define __VALIST __gnuc_va_list |
---|
278 | #else |
---|
279 | #define __VALIST char* |
---|
280 | #endif |
---|
281 | #endif |
---|
282 | |
---|
283 | #if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500 |
---|
284 | int fwprintf (__FILE *__restrict, const wchar_t *__restrict, ...); |
---|
285 | int swprintf (wchar_t *__restrict, size_t, |
---|
286 | const wchar_t *__restrict, ...); |
---|
287 | int vfwprintf (__FILE *__restrict, const wchar_t *__restrict, |
---|
288 | __VALIST); |
---|
289 | int vswprintf (wchar_t *__restrict, size_t, |
---|
290 | const wchar_t *__restrict, __VALIST); |
---|
291 | int vwprintf (const wchar_t *__restrict, __VALIST); |
---|
292 | int wprintf (const wchar_t *__restrict, ...); |
---|
293 | #endif |
---|
294 | |
---|
295 | int _fwprintf_r (struct _reent *, __FILE *, const wchar_t *, ...); |
---|
296 | int _swprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, ...); |
---|
297 | int _vfwprintf_r (struct _reent *, __FILE *, const wchar_t *, __VALIST); |
---|
298 | int _vswprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, __VALIST); |
---|
299 | int _vwprintf_r (struct _reent *, const wchar_t *, __VALIST); |
---|
300 | int _wprintf_r (struct _reent *, const wchar_t *, ...); |
---|
301 | |
---|
302 | #if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500 |
---|
303 | int fwscanf (__FILE *__restrict, const wchar_t *__restrict, ...); |
---|
304 | int swscanf (const wchar_t *__restrict, |
---|
305 | const wchar_t *__restrict, ...); |
---|
306 | int vfwscanf (__FILE *__restrict, const wchar_t *__restrict, |
---|
307 | __VALIST); |
---|
308 | int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, |
---|
309 | __VALIST); |
---|
310 | int vwscanf (const wchar_t *__restrict, __VALIST); |
---|
311 | int wscanf (const wchar_t *__restrict, ...); |
---|
312 | #endif |
---|
313 | |
---|
314 | int _fwscanf_r (struct _reent *, __FILE *, const wchar_t *, ...); |
---|
315 | int _swscanf_r (struct _reent *, const wchar_t *, const wchar_t *, ...); |
---|
316 | int _vfwscanf_r (struct _reent *, __FILE *, const wchar_t *, __VALIST); |
---|
317 | int _vswscanf_r (struct _reent *, const wchar_t *, const wchar_t *, __VALIST); |
---|
318 | int _vwscanf_r (struct _reent *, const wchar_t *, __VALIST); |
---|
319 | int _wscanf_r (struct _reent *, const wchar_t *, ...); |
---|
320 | |
---|
321 | #define getwc(fp) fgetwc(fp) |
---|
322 | #define putwc(wc,fp) fputwc((wc), (fp)) |
---|
323 | #define getwchar() fgetwc(_REENT->_stdin) |
---|
324 | #define putwchar(wc) fputwc((wc), _REENT->_stdout) |
---|
325 | |
---|
326 | #if __GNU_VISIBLE |
---|
327 | #define getwc_unlocked(fp) fgetwc_unlocked(fp) |
---|
328 | #define putwc_unlocked(wc,fp) fputwc_unlocked((wc), (fp)) |
---|
329 | #define getwchar_unlocked() fgetwc_unlocked(_REENT->_stdin) |
---|
330 | #define putwchar_unlocked(wc) fputwc_unlocked((wc), _REENT->_stdout) |
---|
331 | #endif |
---|
332 | |
---|
333 | _END_STD_C |
---|
334 | |
---|
335 | #if __SSP_FORTIFY_LEVEL > 0 |
---|
336 | #include <ssp/wchar.h> |
---|
337 | #endif |
---|
338 | |
---|
339 | #endif /* _WCHAR_H_ */ |
---|