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 #define __need___va_list
15 #include <stdarg.h>
16 
17 /* For _mbstate_t definition. */
18 #include <sys/_types.h>
19 #include <sys/cdefs.h>
20 /* For __STDC_ISO_10646__ */
21 #include <sys/features.h>
22 
23 #ifndef WEOF
24 # define WEOF ((wint_t)-1)
25 #endif
26 
27 /* This must match definition in <stdint.h> */
28 #ifndef WCHAR_MIN
29 #ifdef __WCHAR_MIN__
30 #define WCHAR_MIN __WCHAR_MIN__
31 #elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
32 #define WCHAR_MIN (0 + L'\0')
33 #else
34 #define WCHAR_MIN (-0x7fffffff - 1 + L'\0')
35 #endif
36 #endif
37 
38 /* This must match definition in <stdint.h> */
39 #ifndef WCHAR_MAX
40 #ifdef __WCHAR_MAX__
41 #define WCHAR_MAX __WCHAR_MAX__
42 #elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
43 #define WCHAR_MAX (0xffffffffu + L'\0')
44 #else
45 #define WCHAR_MAX (0x7fffffff + L'\0')
46 #endif
47 #endif
48 
49 _BEGIN_STD_C
50 
51 /* As in stdio.h, <sys/reent.h> defines __FILE. */
52 #if !defined(__FILE_defined)
53 typedef __FILE FILE;
54 # define __FILE_defined
55 #endif
56 
57 /* As required by POSIX.1-2008, declare tm as incomplete type.
58    The actual definition is in time.h. */
59 struct tm;
60 
61 #ifndef _MBSTATE_T
62 #define _MBSTATE_T
63 typedef _mbstate_t mbstate_t;
64 #endif /* _MBSTATE_T */
65 
66 wint_t	_EXFUN(btowc, (int));
67 int	_EXFUN(wctob, (wint_t));
68 size_t	_EXFUN(mbrlen, (const char *__restrict, size_t, mbstate_t *__restrict));
69 size_t	_EXFUN(mbrtowc, (wchar_t *__restrict, const char *__restrict, size_t,
70 						mbstate_t *__restrict));
71 size_t	_EXFUN(_mbrtowc_r, (struct _reent *, wchar_t * , const char * ,
72 			size_t, mbstate_t *));
73 int	_EXFUN(mbsinit, (const mbstate_t *));
74 size_t	_EXFUN(mbsnrtowcs, (wchar_t *__restrict, const char **__restrict,
75 				size_t, size_t, mbstate_t *__restrict));
76 size_t	_EXFUN(_mbsnrtowcs_r, (struct _reent *, wchar_t * , const char ** ,
77 			size_t, size_t, mbstate_t *));
78 size_t	_EXFUN(mbsrtowcs, (wchar_t *__restrict, const char **__restrict, size_t,
79 				mbstate_t *__restrict));
80 size_t	_EXFUN(_mbsrtowcs_r, (struct _reent *, wchar_t * , const char ** , size_t, mbstate_t *));
81 size_t	_EXFUN(wcrtomb, (char *__restrict, wchar_t, mbstate_t *__restrict));
82 size_t	_EXFUN(_wcrtomb_r, (struct _reent *, char * , wchar_t, mbstate_t *));
83 size_t	_EXFUN(wcsnrtombs, (char *__restrict, const wchar_t **__restrict,
84 				size_t, size_t, mbstate_t *__restrict));
85 size_t	_EXFUN(_wcsnrtombs_r, (struct _reent *, char * , const wchar_t ** ,
86 			size_t, size_t, mbstate_t *));
87 size_t	_EXFUN(wcsrtombs, (char *__restrict, const wchar_t **__restrict,
88 				size_t, mbstate_t *__restrict));
89 size_t	_EXFUN(_wcsrtombs_r, (struct _reent *, char * , const wchar_t ** ,
90 			size_t, mbstate_t *));
91 int	_EXFUN(wcscasecmp, (const wchar_t *, const wchar_t *));
92 wchar_t	*_EXFUN(wcscat, (wchar_t *__restrict, const wchar_t *__restrict));
93 wchar_t	*_EXFUN(wcschr, (const wchar_t *, wchar_t));
94 int	_EXFUN(wcscmp, (const wchar_t *, const wchar_t *));
95 int	_EXFUN(wcscoll, (const wchar_t *, const wchar_t *));
96 wchar_t	*_EXFUN(wcscpy, (wchar_t *__restrict, const wchar_t *__restrict));
97 wchar_t	*_EXFUN(wcpcpy, (wchar_t *__restrict,
98 				 const wchar_t *__restrict));
99 wchar_t	*_EXFUN(wcsdup, (const wchar_t *));
100 wchar_t	*_EXFUN(_wcsdup_r, (struct _reent *, const wchar_t * ));
101 size_t	_EXFUN(wcscspn, (const wchar_t *, const wchar_t *));
102 size_t  _EXFUN(wcsftime, (wchar_t *__restrict, size_t,
103 				const wchar_t *__restrict, const struct tm *__restrict));
104 size_t	_EXFUN(wcslcat, (wchar_t *, const wchar_t *, size_t));
105 size_t	_EXFUN(wcslcpy, (wchar_t *, const wchar_t *, size_t));
106 size_t	_EXFUN(wcslen, (const wchar_t *));
107 int	_EXFUN(wcsncasecmp, (const wchar_t *, const wchar_t *, size_t));
108 wchar_t	*_EXFUN(wcsncat, (wchar_t *__restrict,
109 				 const wchar_t *__restrict, size_t));
110 int	_EXFUN(wcsncmp, (const wchar_t *, const wchar_t *, size_t));
111 wchar_t	*_EXFUN(wcsncpy, (wchar_t *__restrict,
112 				 const wchar_t *__restrict, size_t));
113 wchar_t	*_EXFUN(wcpncpy, (wchar_t *__restrict,
114 				 const wchar_t *__restrict, size_t));
115 size_t	_EXFUN(wcsnlen, (const wchar_t *, size_t));
116 wchar_t	*_EXFUN(wcspbrk, (const wchar_t *, const wchar_t *));
117 wchar_t	*_EXFUN(wcsrchr, (const wchar_t *, wchar_t));
118 size_t	_EXFUN(wcsspn, (const wchar_t *, const wchar_t *));
119 wchar_t	*_EXFUN(wcsstr, (const wchar_t *__restrict,
120 				 const wchar_t *__restrict));
121 wchar_t	*_EXFUN(wcstok, (wchar_t *__restrict, const wchar_t *__restrict,
122 				 wchar_t **__restrict));
123 double _EXFUN(wcstod, (const wchar_t *__restrict, wchar_t **__restrict));
124 double _EXFUN(_wcstod_r, (struct _reent *, const wchar_t *, wchar_t **));
125 float _EXFUN(wcstof, (const wchar_t *__restrict, wchar_t **__restrict));
126 float _EXFUN(_wcstof_r, (struct _reent *, const wchar_t *, wchar_t **));
127 int	_EXFUN(wcswidth, (const wchar_t *, size_t));
128 size_t	_EXFUN(wcsxfrm, (wchar_t *__restrict, const wchar_t *__restrict,
129 				size_t));
130 int	_EXFUN(wcwidth, (const wchar_t));
131 wchar_t	*_EXFUN(wmemchr, (const wchar_t *, wchar_t, size_t));
132 int	_EXFUN(wmemcmp, (const wchar_t *, const wchar_t *, size_t));
133 wchar_t	*_EXFUN(wmemcpy, (wchar_t *__restrict, const wchar_t *__restrict,
134 				 size_t));
135 wchar_t	*_EXFUN(wmemmove, (wchar_t *, const wchar_t *, size_t));
136 wchar_t	*_EXFUN(wmemset, (wchar_t *, wchar_t, size_t));
137 
138 long    _EXFUN(wcstol, (const wchar_t *__restrict, wchar_t **__restrict, int));
139 long long _EXFUN(wcstoll, (const wchar_t *__restrict, wchar_t **__restrict,
140 				  int));
141 unsigned long _EXFUN(wcstoul, (const wchar_t *__restrict, wchar_t **__restrict,
142 					  int));
143 unsigned long long _EXFUN(wcstoull, (const wchar_t *__restrict,
144 						   wchar_t **__restrict, int));
145 long    _EXFUN(_wcstol_r, (struct _reent *, const wchar_t *, wchar_t **, int));
146 long long _EXFUN(_wcstoll_r, (struct _reent *, const wchar_t *, wchar_t **, int));
147 unsigned long _EXFUN(_wcstoul_r, (struct _reent *, const wchar_t *, wchar_t **, int));
148 unsigned long long _EXFUN(_wcstoull_r, (struct _reent *, const wchar_t *, wchar_t **, int));
149 long double _EXFUN(wcstold, (const wchar_t *, wchar_t **));
150 
151 wint_t _EXFUN(fgetwc, (__FILE *));
152 wchar_t *_EXFUN(fgetws, (wchar_t *__restrict, int, __FILE *__restrict));
153 wint_t _EXFUN(fputwc, (wchar_t, __FILE *));
154 int _EXFUN(fputws, (const wchar_t *__restrict, __FILE *__restrict));
155 int _EXFUN (fwide, (__FILE *, int));
156 wint_t _EXFUN (getwc, (__FILE *));
157 wint_t _EXFUN (getwchar, (void));
158 wint_t _EXFUN(putwc, (wchar_t, __FILE *));
159 wint_t _EXFUN(putwchar, (wchar_t));
160 wint_t _EXFUN (ungetwc, (wint_t wc, __FILE *));
161 
162 wint_t _EXFUN(_fgetwc_r, (struct _reent *, __FILE *));
163 wint_t _EXFUN(_fgetwc_unlocked_r, (struct _reent *, __FILE *));
164 wchar_t *_EXFUN(_fgetws_r, (struct _reent *, wchar_t *, int, __FILE *));
165 wchar_t *_EXFUN(_fgetws_unlocked_r, (struct _reent *, wchar_t *, int, __FILE *));
166 wint_t _EXFUN(_fputwc_r, (struct _reent *, wchar_t, __FILE *));
167 wint_t _EXFUN(_fputwc_unlocked_r, (struct _reent *, wchar_t, __FILE *));
168 int _EXFUN(_fputws_r, (struct _reent *, const wchar_t *, __FILE *));
169 int _EXFUN(_fputws_unlocked_r, (struct _reent *, const wchar_t *, __FILE *));
170 int _EXFUN (_fwide_r, (struct _reent *, __FILE *, int));
171 wint_t _EXFUN (_getwc_r, (struct _reent *, __FILE *));
172 wint_t _EXFUN (_getwc_unlocked_r, (struct _reent *, __FILE *));
173 wint_t _EXFUN (_getwchar_r, (struct _reent *ptr));
174 wint_t _EXFUN (_getwchar_unlocked_r, (struct _reent *ptr));
175 wint_t _EXFUN(_putwc_r, (struct _reent *, wchar_t, __FILE *));
176 wint_t _EXFUN(_putwc_unlocked_r, (struct _reent *, wchar_t, __FILE *));
177 wint_t _EXFUN(_putwchar_r, (struct _reent *, wchar_t));
178 wint_t _EXFUN(_putwchar_unlocked_r, (struct _reent *, wchar_t));
179 wint_t _EXFUN (_ungetwc_r, (struct _reent *, wint_t wc, __FILE *));
180 
181 #if __GNU_VISIBLE
182 wint_t _EXFUN(fgetwc_unlocked, (__FILE *));
183 wchar_t *_EXFUN(fgetws_unlocked, (wchar_t *__restrict, int, __FILE *__restrict));
184 wint_t _EXFUN(fputwc_unlocked, (wchar_t, __FILE *));
185 int _EXFUN(fputws_unlocked, (const wchar_t *__restrict, __FILE *__restrict));
186 wint_t _EXFUN(getwc_unlocked, (__FILE *));
187 wint_t _EXFUN(getwchar_unlocked, (void));
188 wint_t _EXFUN(putwc_unlocked, (wchar_t, __FILE *));
189 wint_t _EXFUN(putwchar_unlocked, (wchar_t));
190 #endif
191 
192 #if __POSIX_VISIBLE >= 200809
193 __FILE *_EXFUN (open_wmemstream, (wchar_t **, size_t *));
194 #endif
195 __FILE *_EXFUN (_open_wmemstream_r, (struct _reent *, wchar_t **, size_t *));
196 
197 #ifndef __VALIST
198 #ifdef __GNUC__
199 #define __VALIST __gnuc_va_list
200 #else
201 #define __VALIST char*
202 #endif
203 #endif
204 
205 int	_EXFUN(fwprintf, (__FILE *__restrict, const wchar_t *__restrict, ...));
206 int	_EXFUN(swprintf, (wchar_t *__restrict, size_t,
207 			const wchar_t *__restrict, ...));
208 int	_EXFUN(vfwprintf, (__FILE *__restrict, const wchar_t *__restrict,
209 			__VALIST));
210 int	_EXFUN(vswprintf, (wchar_t *__restrict, size_t,
211 			const wchar_t *__restrict, __VALIST));
212 int	_EXFUN(vwprintf, (const wchar_t *__restrict, __VALIST));
213 int	_EXFUN(wprintf, (const wchar_t *__restrict, ...));
214 
215 int	_EXFUN(_fwprintf_r, (struct _reent *, __FILE *, const wchar_t *, ...));
216 int	_EXFUN(_swprintf_r, (struct _reent *, wchar_t *, size_t, const wchar_t *, ...));
217 int	_EXFUN(_vfwprintf_r, (struct _reent *, __FILE *, const wchar_t *, __VALIST));
218 int	_EXFUN(_vswprintf_r, (struct _reent *, wchar_t *, size_t, const wchar_t *, __VALIST));
219 int	_EXFUN(_vwprintf_r, (struct _reent *, const wchar_t *, __VALIST));
220 int	_EXFUN(_wprintf_r, (struct _reent *, const wchar_t *, ...));
221 
222 int	_EXFUN(fwscanf, (__FILE *__restrict, const wchar_t *__restrict, ...));
223 int	_EXFUN(swscanf, (const wchar_t *__restrict,
224 			const wchar_t *__restrict, ...));
225 int	_EXFUN(vfwscanf, (__FILE *__restrict, const wchar_t *__restrict,
226 			__VALIST));
227 int	_EXFUN(vswscanf, (const wchar_t *__restrict, const wchar_t *__restrict,
228 			__VALIST));
229 int	_EXFUN(vwscanf, (const wchar_t *__restrict, __VALIST));
230 int	_EXFUN(wscanf, (const wchar_t *__restrict, ...));
231 
232 int	_EXFUN(_fwscanf_r, (struct _reent *, __FILE *, const wchar_t *, ...));
233 int	_EXFUN(_swscanf_r, (struct _reent *, const wchar_t *, const wchar_t *, ...));
234 int	_EXFUN(_vfwscanf_r, (struct _reent *, __FILE *, const wchar_t *, __VALIST));
235 int	_EXFUN(_vswscanf_r, (struct _reent *, const wchar_t *, const wchar_t *, __VALIST));
236 int	_EXFUN(_vwscanf_r, (struct _reent *, const wchar_t *, __VALIST));
237 int	_EXFUN(_wscanf_r, (struct _reent *, const wchar_t *, ...));
238 
239 #define getwc(fp)	fgetwc(fp)
240 #define putwc(wc,fp)	fputwc((wc), (fp))
241 #define getwchar()	fgetwc(_REENT->_stdin)
242 #define putwchar(wc)	fputwc((wc), _REENT->_stdout)
243 
244 #if __GNU_VISIBLE
245 #define getwc_unlocked(fp)	fgetwc_unlocked(fp)
246 #define putwc_unlocked(wc,fp)	fputwc_unlocked((wc), (fp))
247 #define getwchar_unlocked()	fgetwc_unlocked(_REENT->_stdin)
248 #define putwchar_unlocked(wc)	fputwc_unlocked((wc), _REENT->_stdout)
249 #endif
250 
251 _END_STD_C
252 
253 #endif /* _WCHAR_H_ */
254