1 // -*- C++ -*- forwarding header.
2 
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
4 // Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library.  This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
10 // any later version.
11 
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 // GNU General Public License for more details.
16 
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING.  If not, write to the Free
19 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 // USA.
21 
22 // As a special exception, you may use this file as part of a free software
23 // library without restriction.  Specifically, if other files instantiate
24 // templates or use macros or inline functions from this file, or you compile
25 // this file and link it with other files to produce an executable, this
26 // file does not by itself cause the resulting executable to be covered by
27 // the GNU General Public License.  This exception does not however
28 // invalidate any other reasons why the executable file might be covered by
29 // the GNU General Public License.
30 
31 /** @file include/cwchar
32  *  This is a Standard C++ Library file.  You should @c #include this file
33  *  in your programs, rather than any of the "*.h" implementation files.
34  *
35  *  This is the C++ version of the Standard C Library header @c wchar.h,
36  *  and its contents are (mostly) the same as that header, but are all
37  *  contained in the namespace @c std (except for names which are defined
38  *  as macros in C).
39  */
40 
41 //
42 // ISO C++ 14882: 21.4
43 //
44 
45 #ifndef _GLIBCXX_CWCHAR
46 #define _GLIBCXX_CWCHAR 1
47 
48 #pragma GCC system_header
49 
50 #include <bits/c++config.h>
51 #include <cstddef>
52 #include <ctime>
53 
54 #if _GLIBCXX_HAVE_WCHAR_H
55 #include <wchar.h>
56 #endif
57 
58 // Need to do a bit of trickery here with mbstate_t as char_traits
59 // assumes it is in wchar.h, regardless of wchar_t specializations.
60 #ifndef _GLIBCXX_HAVE_MBSTATE_T
61 extern "C"
62 {
63   typedef struct
64   {
65     int __fill[6];
66   } mbstate_t;
67 }
68 #endif
69 
70 _GLIBCXX_BEGIN_NAMESPACE(std)
71 
72   using ::mbstate_t;
73 
74 _GLIBCXX_END_NAMESPACE
75 
76 // Get rid of those macros defined in <wchar.h> in lieu of real functions.
77 #undef btowc
78 #undef fgetwc
79 #undef fgetws
80 #undef fputwc
81 #undef fputws
82 #undef fwide
83 #undef fwprintf
84 #undef fwscanf
85 #undef getwc
86 #undef getwchar
87 #undef mbrlen
88 #undef mbrtowc
89 #undef mbsinit
90 #undef mbsrtowcs
91 #undef putwc
92 #undef putwchar
93 #undef swprintf
94 #undef swscanf
95 #undef ungetwc
96 #undef vfwprintf
97 #if _GLIBCXX_HAVE_VFWSCANF
98 # undef vfwscanf
99 #endif
100 #undef vswprintf
101 #if _GLIBCXX_HAVE_VSWSCANF
102 # undef vswscanf
103 #endif
104 #undef vwprintf
105 #if _GLIBCXX_HAVE_VWSCANF
106 # undef vwscanf
107 #endif
108 #undef wcrtomb
109 #undef wcscat
110 #undef wcschr
111 #undef wcscmp
112 #undef wcscoll
113 #undef wcscpy
114 #undef wcscspn
115 #undef wcsftime
116 #undef wcslen
117 #undef wcsncat
118 #undef wcsncmp
119 #undef wcsncpy
120 #undef wcspbrk
121 #undef wcsrchr
122 #undef wcsrtombs
123 #undef wcsspn
124 #undef wcsstr
125 #undef wcstod
126 #if _GLIBCXX_HAVE_WCSTOF
127 # undef wcstof
128 #endif
129 #undef wcstok
130 #undef wcstol
131 #undef wcstoul
132 #undef wcsxfrm
133 #undef wctob
134 #undef wmemchr
135 #undef wmemcmp
136 #undef wmemcpy
137 #undef wmemmove
138 #undef wmemset
139 #undef wprintf
140 #undef wscanf
141 
142 #if _GLIBCXX_USE_WCHAR_T
143 
144 _GLIBCXX_BEGIN_NAMESPACE(std)
145 
146   using ::wint_t;
147 
148   using ::btowc;
149   using ::fgetwc;
150   using ::fgetws;
151   using ::fputwc;
152   using ::fputws;
153   using ::fwide;
154 #if !defined(__OpenBSD__)
155   using ::fwprintf;
156   using ::fwscanf;
157 #endif
158   using ::getwc;
159   using ::getwchar;
160   using ::mbrlen;
161   using ::mbrtowc;
162   using ::mbsinit;
163   using ::mbsrtowcs;
164   using ::putwc;
165   using ::putwchar;
166 #if !defined(__OpenBSD__)
167   using ::swprintf;
168   using ::swscanf;
169 #endif
170   using ::ungetwc;
171 #if !defined(__OpenBSD__)
172   using ::vfwprintf;
173 #endif
174 #if _GLIBCXX_HAVE_VFWSCANF
175   using ::vfwscanf;
176 #endif
177 #if !defined(__OpenBSD__)
178   using ::vswprintf;
179 #endif
180 #if _GLIBCXX_HAVE_VSWSCANF
181   using ::vswscanf;
182 #endif
183 #if !defined(__OpenBSD__)
184   using ::vwprintf;
185 #endif
186 #if _GLIBCXX_HAVE_VWSCANF
187   using ::vwscanf;
188 #endif
189   using ::wcrtomb;
190   using ::wcscat;
191   using ::wcscmp;
192   using ::wcscoll;
193   using ::wcscpy;
194   using ::wcscspn;
195 #if !defined(__OpenBSD__)
196   using ::wcsftime;
197 #endif
198   using ::wcslen;
199   using ::wcsncat;
200   using ::wcsncmp;
201   using ::wcsncpy;
202   using ::wcsrtombs;
203   using ::wcsspn;
204   using ::wcstod;
205 #if _GLIBCXX_HAVE_WCSTOF
206   using ::wcstof;
207 #endif
208   using ::wcstok;
209   using ::wcstol;
210   using ::wcstoul;
211   using ::wcsxfrm;
212   using ::wctob;
213   using ::wmemcmp;
214   using ::wmemcpy;
215   using ::wmemmove;
216   using ::wmemset;
217 #if !defined(__OpenBSD__)
218   using ::wprintf;
219   using ::wscanf;
220 #endif
221 
222   using ::wcschr;
223 
224   inline wchar_t*
225   wcschr(wchar_t* __p, wchar_t __c)
226   { return wcschr(const_cast<const wchar_t*>(__p), __c); }
227 
228   using ::wcspbrk;
229 
230   inline wchar_t*
231   wcspbrk(wchar_t* __s1, const wchar_t* __s2)
232   { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
233 
234   using ::wcsrchr;
235 
236   inline wchar_t*
237   wcsrchr(wchar_t* __p, wchar_t __c)
238   { return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
239 
240   using ::wcsstr;
241 
242   inline wchar_t*
243   wcsstr(wchar_t* __s1, const wchar_t* __s2)
244   { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
245 
246   using ::wmemchr;
247 
248   inline wchar_t*
249   wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
250   { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
251 
252 _GLIBCXX_END_NAMESPACE
253 
254 #if _GLIBCXX_USE_C99
255 
256 #undef wcstold
257 #undef wcstoll
258 #undef wcstoull
259 
260 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
261 
262 #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
263   extern "C" long double
264     (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
265 #endif
266 #if !_GLIBCXX_USE_C99_DYNAMIC
267   using ::wcstold;
268 #endif
269 #if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
270   extern "C" long long int
271     (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int);
272   extern "C" unsigned long long int
273     (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);
274 #endif
275 #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
276   using ::wcstoll;
277   using ::wcstoull;
278 #endif
279 
280 _GLIBCXX_END_NAMESPACE
281 
282 _GLIBCXX_BEGIN_NAMESPACE(std)
283 
284   using ::__gnu_cxx::wcstold;
285   using ::__gnu_cxx::wcstoll;
286   using ::__gnu_cxx::wcstoull;
287 
288 _GLIBCXX_END_NAMESPACE
289 
290 #endif
291 
292 #endif //_GLIBCXX_USE_WCHAR_T
293 
294 #endif
295