OSDN Git Service

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