]>
Commit | Line | Data |
---|---|---|
22aef514 BK |
1 | // -*- C++ -*- header wrapper. |
2 | ||
3 | // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. | |
4 | // | |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
8 | // Free Software Foundation; either version 2, or (at your option) | |
9 | // any later version. | |
10 | ||
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | ||
16 | // You should have received a copy of the GNU General Public License along | |
17 | // with this library; see the file COPYING. If not, write to the Free | |
18 | // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
19 | // USA. | |
20 | ||
21 | // As a special exception, you may use this file as part of a free software | |
22 | // library without restriction. Specifically, if other files instantiate | |
23 | // templates or use macros or inline functions from this file, or you compile | |
24 | // this file and link it with other files to produce an executable, this | |
25 | // file does not by itself cause the resulting executable to be covered by | |
26 | // the GNU General Public License. This exception does not however | |
27 | // invalidate any other reasons why the executable file might be covered by | |
28 | // the GNU General Public License. | |
29 | ||
30 | // | |
31 | // ISO C++ 14882: 21 | |
32 | ||
33 | #ifndef _CPP_CWCHAR | |
34 | # define _CPP_CWCHAR 1 | |
35 | ||
36 | # ifdef _IN_C_LEGACY_ /* sub-included by a C header */ | |
37 | // get out of the "legacy" | |
38 | } // close extern "C" | |
39 | } // close namespace _C_legacy:: | |
40 | # undef _IN_C_LEGACY_ /* sub-included by a C header */ | |
41 | # define _WCHAR_NEED_C_LEGACY_ | |
42 | # endif | |
43 | ||
44 | # include <bits/std_cstdio.h> | |
45 | ||
46 | namespace _C_legacy { | |
47 | extern "C" { | |
48 | # define _IN_C_LEGACY_ | |
49 | # pragma GCC system_header | |
50 | # include_next <wchar.h> | |
51 | } | |
52 | ||
53 | #if 0 | |
54 | // XXX | |
55 | inline int | |
56 | fwprintf(FILE* __stream, const wchar_t* __format, ...); | |
57 | ||
58 | inline int | |
59 | fwscanf(FILE* __stream, const wchar_t* __format, ...); | |
60 | ||
61 | inline int | |
62 | vfwprintf(FILE* __stream, const wchar_t* __format, va_list __arg); | |
63 | ||
64 | inline int | |
65 | vfwscanf(FILE* __stream, const wchar_t* __format, va_list __arg); | |
66 | ||
67 | inline wint_t | |
68 | _CPP_fgetwc_capture(FILE* __stream) | |
69 | { return fgetwc(__stream); } | |
70 | ||
71 | inline wchar_t* | |
72 | _CPP_fgetws_capture(wchar_t* __s, int __n, FILE* __stream) | |
73 | { return fgetws(__s, __n, __stream); } | |
74 | ||
75 | inline wint_t | |
76 | _CPP_fputwc_capture(wchar_t __c, FILE* __stream) | |
77 | { return fputwc(__c, __stream); } | |
78 | ||
79 | inline int | |
80 | _CPP_fputws_capture(const wchar_t* __s, FILE* __stream) | |
81 | { return fputws(__s, __stream); } | |
82 | ||
83 | inline int | |
84 | _CPP_fwide_capture(FILE* __stream, int __mode) | |
85 | { return fwide(__stream, __mode); } | |
86 | ||
87 | inline wint_t | |
88 | _CPP_fgetwc_capture(FILE* __stream) | |
89 | { return fgetwc(__stream); } | |
90 | ||
91 | inline wint_t | |
92 | _CPP_putwc_capture(wchar_t __c, FILE* __stream) | |
93 | { return putwc(__c, __stream); } | |
94 | ||
95 | inline wint_t | |
96 | _CPP_ungetwc_capture(wint_t __c, FILE* __stream) | |
97 | { return ungetwc(__c, __stream); } | |
98 | #endif | |
99 | } // namespace _C_legacy | |
100 | ||
101 | # undef wint_t | |
102 | # undef mbstate_t | |
103 | ||
104 | # undef fwprintf | |
105 | # undef fwscanf | |
106 | # undef swprintf | |
107 | # undef swscanf | |
108 | # undef vfwprintf | |
109 | # undef vfwscanf | |
110 | # undef vswprintf | |
111 | # undef vswscanf | |
112 | # undef vwprintf | |
113 | # undef vwscanf | |
114 | # undef wprintf | |
115 | # undef wscanf | |
116 | # undef fgetwc | |
117 | # undef fgetws | |
118 | # undef fputwc | |
119 | # undef fputws | |
120 | # undef fwide | |
121 | # undef getwc | |
122 | # undef getwchar | |
123 | # undef putwc | |
124 | # undef putwchar | |
125 | # undef ungetwc | |
126 | # undef wcstod | |
127 | # undef wcstof | |
128 | # undef wcstold | |
129 | # undef wcstol | |
130 | # undef wcstoll | |
131 | # undef wcstoul | |
132 | # undef wcstoull | |
133 | # undef wcscpy | |
134 | # undef wcsncpy | |
135 | # undef wcscat | |
136 | # undef wcsncat | |
137 | # undef wcsmp | |
138 | # undef wcscoll | |
139 | # undef wcsncmp | |
140 | # undef wcsxfrm | |
141 | # undef wcschr | |
142 | # undef wcscspn | |
143 | # undef wcslen | |
144 | # undef wcspbrk | |
145 | # undef wcsrchr | |
146 | # undef wcsspn | |
147 | # undef wcsstr | |
148 | # undef wcstok | |
149 | # undef wmemchr | |
150 | # undef wmemcmp | |
151 | # undef wmemcpy | |
152 | # undef wmemmove | |
153 | # undef wmemset | |
154 | # undef wcsftime | |
155 | # undef btowc | |
156 | # undef wctob | |
157 | # undef mbsinit | |
158 | # undef mbrlen | |
159 | # undef mbrtowc | |
160 | # undef wcrtomb | |
161 | # undef mbsrtowcs | |
162 | # undef wcsrtombs | |
163 | ||
164 | namespace std { | |
165 | using _C_legacy::wint_t; | |
166 | using _C_legacy::mbstate_t; | |
167 | ||
168 | #if 0 | |
169 | using _C_legacy::swprintf; | |
170 | using _C_legacy::swscanf; | |
171 | using _C_legacy::vswprintf; | |
172 | using _C_legacy::vswscanf; | |
173 | using _C_legacy::vwprintf; | |
174 | using _C_legacy::vwscanf; | |
175 | using _C_legacy::wprintf; | |
176 | using _C_legacy::wscanf; | |
177 | using _C_legacy::getwchar; | |
178 | using _C_legacy::putwchar; | |
179 | #endif | |
180 | ||
181 | using _C_legacy::wcstod; | |
182 | using _C_legacy::wcstof; | |
183 | using _C_legacy::wcstold; | |
184 | using _C_legacy::wcstol; | |
185 | using _C_legacy::wcstoll; | |
186 | using _C_legacy::wcstoul; | |
187 | using _C_legacy::wcstoull; | |
188 | using _C_legacy::wcscpy; | |
189 | using _C_legacy::wcsncpy; | |
190 | using _C_legacy::wcscat; | |
191 | using _C_legacy::wcsncat; | |
192 | ||
193 | #if 0 | |
194 | using _C_legacy::wcsmp; | |
195 | #endif | |
196 | ||
197 | using _C_legacy::wcscoll; | |
198 | using _C_legacy::wcsncmp; | |
199 | using _C_legacy::wcsxfrm; | |
200 | using _C_legacy::wcschr; | |
201 | using _C_legacy::wcscspn; | |
202 | using _C_legacy::wcslen; | |
203 | using _C_legacy::wcspbrk; | |
204 | using _C_legacy::wcsrchr; | |
205 | using _C_legacy::wcsspn; | |
206 | using _C_legacy::wcsstr; | |
207 | using _C_legacy::wcstok; | |
208 | using _C_legacy::wmemchr; | |
209 | using _C_legacy::wmemcmp; | |
210 | using _C_legacy::wmemcpy; | |
211 | using _C_legacy::wmemmove; | |
212 | using _C_legacy::wmemset; | |
213 | ||
214 | #if 0 | |
215 | using _C_legacy::wcsftime; | |
216 | #endif | |
217 | ||
218 | using _C_legacy::btowc; | |
219 | using _C_legacy::wctob; | |
220 | using _C_legacy::mbsinit; | |
221 | using _C_legacy::mbrlen; | |
222 | using _C_legacy::mbrtowc; | |
223 | using _C_legacy::wcrtomb; | |
224 | using _C_legacy::mbsrtowcs; | |
225 | using _C_legacy::wcsrtombs; | |
226 | ||
227 | #if 0 | |
228 | // XXX | |
229 | inline int | |
230 | fwprintf(FILE* __stream, const wchar_t* __format, ...); | |
231 | ||
232 | inline int | |
233 | fwscanf(FILE* __stream, const wchar_t* __format, ...); | |
234 | ||
235 | inline int | |
236 | vfwprintf(FILE* __stream, const wchar_t* __format, va_list __arg); | |
237 | ||
238 | inline int | |
239 | vfwscanf(FILE* __stream, const wchar_t* __format, va_list __arg); | |
240 | ||
241 | inline wint_t | |
242 | fgetwc(FILE* __stream) | |
243 | { return _C_legacy::_CPP_fgetwc_capture(__stream); } | |
244 | ||
245 | inline wchar_t* | |
246 | fgetws(wchar_t* __s, int __n, FILE* __stream) | |
247 | { return _C_legacy::_CPP_fgetws_capture(__s, __n, __stream); } | |
248 | ||
249 | inline wint_t | |
250 | fputwc(wchar_t __c, FILE* __stream) | |
251 | { return _C_legacy::_CPP_fputwc_capture(__c, __stream); } | |
252 | ||
253 | inline int | |
254 | fputws(const wchar_t* __s, FILE* __stream) | |
255 | { return _C_legacy::_CPP_fputws_capture(__s, __stream); } | |
256 | ||
257 | inline int | |
258 | fwide(FILE* __stream, int __mode) | |
259 | { return _C_legacy::_CPP_fwide_capture(__stream, __mode); } | |
260 | ||
261 | inline wint_t | |
262 | getwc(FILE* __stream) | |
263 | { return _C_legacy::_CPP_getwc_capture(__stream); } | |
264 | ||
265 | inline wint_t | |
266 | putwc(wchar_t __c, FILE* __stream) | |
267 | { return _C_legacy::_CPP_putwc_capture(__c, __stream); } | |
268 | ||
269 | inline wint_t | |
270 | ungetwc(wint_t __c, FILE* __stream) | |
271 | { return _C_legacy::_CPP_ungetwc_capture(__c, __stream); } | |
272 | #endif | |
273 | } | |
274 | ||
275 | # undef _IN_C_LEGACY_ | |
276 | ||
277 | // Expose global C names, including non-standard ones, but shadow | |
278 | // some names and types with the std:: C++ version. | |
279 | using std::wint_t; | |
280 | using std::mbstate_t; | |
281 | ||
282 | #if 0 | |
283 | using std::fwprintf; | |
284 | using std::fwscanf; | |
285 | using std::swprintf; | |
286 | using std::swscanf; | |
287 | using std::vfwprintf; | |
288 | using std::vfwscanf; | |
289 | using std::vswprintf; | |
290 | using std::vswscanf; | |
291 | using std::vwprintf; | |
292 | using std::vwscanf; | |
293 | using std::wprintf; | |
294 | using std::wscanf; | |
295 | using std::fgetwc; | |
296 | using std::fgetws; | |
297 | using std::fputwc; | |
298 | using std::fputws; | |
299 | using std::fwide; | |
300 | using std::getwc; | |
301 | using std::getwchar; | |
302 | using std::putwc; | |
303 | using std::putwchar; | |
304 | using std::ungetwc; | |
305 | #endif | |
306 | ||
307 | using std::wcstod; | |
308 | using std::wcstof; | |
309 | using std::wcstold; | |
310 | using std::wcstol; | |
311 | using std::wcstoll; | |
312 | using std::wcstoul; | |
313 | using std::wcstoull; | |
314 | using std::wcscpy; | |
315 | using std::wcsncpy; | |
316 | using std::wcscat; | |
317 | using std::wcsncat; | |
318 | ||
319 | #if 0 | |
320 | using std::wcsmp; | |
321 | #endif | |
322 | ||
323 | using std::wcscoll; | |
324 | using std::wcsncmp; | |
325 | using std::wcsxfrm; | |
326 | using std::wcschr; | |
327 | using std::wcscspn; | |
328 | using std::wcslen; | |
329 | using std::wcspbrk; | |
330 | using std::wcsrchr; | |
331 | using std::wcsspn; | |
332 | using std::wcsstr; | |
333 | using std::wcstok; | |
334 | using std::wmemchr; | |
335 | using std::wmemcmp; | |
336 | using std::wmemcpy; | |
337 | using std::wmemmove; | |
338 | using std::wmemset; | |
339 | ||
340 | #if 0 | |
341 | using std::wcsftime; | |
342 | #endif | |
343 | ||
344 | using std::btowc; | |
345 | using std::wctob; | |
346 | using std::mbsinit; | |
347 | using std::mbrlen; | |
348 | using std::mbrtowc; | |
349 | using std::wcrtomb; | |
350 | using std::mbsrtowcs; | |
351 | using std::wcsrtombs; | |
352 | ||
353 | # ifdef _WCHAR_NEED_C_LEGACY_ | |
354 | // dive back into the "swamp" | |
355 | namespace _C_legacy { | |
356 | extern "C" { | |
357 | # define _IN_C_LEGACY_ | |
358 | # undef _WCHAR_NEED_C_LEGACY_ | |
359 | # endif /* _WCHAR_NEED_C_LEGACY_ */ | |
360 | ||
361 | #endif /*_CPP_CWCHAR*/ | |
362 | ||
363 | ||
364 | ||
365 | ||
366 |