OSDN Git Service

2002-01-16 Benjamin Kosnik <bkoz@redhat.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / include / c_std / std_cwchar.h
1 // -*- C++ -*- forwarding header.
2
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001 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.4
32 //
33
34 #ifndef _CPP_CWCHAR
35 #define _CPP_CWCHAR 1
36
37 #include <bits/c++config.h>
38 #include <cstddef>
39 #include <ctime>
40
41 #if _GLIBCPP_HAVE_WCHAR_H
42 #pragma GCC system_header
43 #include <wchar.h>
44 #endif
45
46 // Need to do a bit of trickery here with mbstate_t as char_traits
47 // assumes it is in wchar.h, regardless of wchar_t specializations.
48 #ifndef _GLIBCPP_HAVE_MBSTATE_T
49 extern "C" 
50 {
51   typedef struct 
52   {
53     int __fill[6];
54   } mbstate_t;
55 }
56 #endif
57
58 namespace std 
59 {
60   using ::mbstate_t;
61 }
62
63 // Get rid of those macros defined in <wchar.h> in lieu of real functions.
64 #undef btowc
65 #undef fgetwc
66 #undef fgetws
67 #undef fputwc
68 #undef fputws
69 #undef fwide
70 #undef fwprintf
71 #undef fwscanf
72 #undef getwc
73 #undef getwchar
74 #undef mbrlen
75 #undef mbrtowc
76 #undef mbsinit
77 #undef mbsrtowcs
78 #undef putwc
79 #undef putwchar
80 #undef swprintf
81 #undef swscanf
82 #undef ungetwc
83 #undef vfwprintf
84 #undef vfwscanf
85 #undef vswprintf
86 #undef vswscanf
87 #undef vwprintf
88 #undef vwscanf
89 #undef wcrtomb
90 #undef wcscat
91 #undef wcschr
92 #undef wcscmp
93 #undef wcscoll
94 #undef wcscpy
95 #undef wcscspn
96 #undef wcsftime
97 #undef wcslen
98 #undef wcsncat
99 #undef wcsncmp
100 #undef wcsncpy
101 #undef wcspbrk
102 #undef wcsrchr
103 #undef wcsrtombs
104 #undef wcsspn
105 #undef wcsstr
106 #undef wcstod
107 #undef wcstof
108 #undef wcstok
109 #undef wcstol
110 #undef wcstoul
111 #undef wcsxfrm
112 #undef wctob
113 #undef wmemchr
114 #undef wmemcmp
115 #undef wmemcpy
116 #undef wmemmove
117 #undef wmemset
118 #undef wprintf
119 #undef wscanf
120
121 #if _GLIBCPP_USE_WCHAR_T
122 namespace std
123 {
124   using ::wint_t;
125
126   using ::btowc;
127   using ::fgetwc;
128   using ::fgetws;
129   using ::fputwc;
130   using ::fputws;
131   using ::fwide;
132   using ::fwprintf;
133   using ::fwscanf;
134   using ::getwc;
135   using ::getwchar;
136   using ::mbrlen;
137   using ::mbrtowc;
138   using ::mbsinit;
139   using ::mbsrtowcs;
140   using ::putwc;
141   using ::putwchar;
142   using ::swprintf;
143   using ::swscanf;
144   using ::ungetwc;
145   using ::vfwprintf;
146   using ::vfwscanf;
147   using ::vswprintf;
148   using ::vswscanf;
149   using ::vwprintf;
150   using ::vwscanf;
151   using ::wcrtomb;
152   using ::wcscat;
153   using ::wcscmp;
154   using ::wcscoll;
155   using ::wcscpy;
156   using ::wcscspn;
157   using ::wcsftime;
158   using ::wcslen;
159   using ::wcsncat;
160   using ::wcsncmp;
161   using ::wcsncpy;
162   using ::wcsrtombs;
163   using ::wcsspn;
164   using ::wcstod;
165   using ::wcstof;
166   using ::wcstok;
167   using ::wcstol;
168   using ::wcstoul;
169   using ::wcsxfrm;
170   using ::wctob;
171   using ::wmemcmp;
172   using ::wmemcpy;
173   using ::wmemmove;
174   using ::wmemset;
175   using ::wprintf;
176   using ::wscanf;
177
178   using ::wcschr;
179
180   inline wchar_t*
181   wcschr(wchar_t* __p, wchar_t __c)
182   { return wcschr(const_cast<const wchar_t*>(__p), __c); }
183
184   using ::wcspbrk;
185
186   inline wchar_t*
187   wcspbrk(wchar_t* __s1, wchar_t* __s2)
188   { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
189
190   using ::wcsrchr;
191
192   inline wchar_t*
193   wcsrchr(wchar_t* __p, wchar_t __c)
194   { return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
195
196   using ::wcsstr;
197
198   inline wchar_t*
199   wcsstr(wchar_t* __s1, wchar_t* __s2)
200   { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
201
202   using ::wmemchr;
203
204   inline wchar_t*
205   wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
206   { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
207 }
208
209 #if _GLIBCPP_USE_C99
210
211 #undef wcstold
212 #undef wcstoll
213 #undef wcstoull
214
215 namespace __gnu_cxx
216 {
217   using ::wcstold;
218   using ::wcstoll;
219   using ::wcstoull;
220 }
221
222 namespace std
223 {
224   using __gnu_cxx::wcstold;
225   using __gnu_cxx::wcstoll;
226   using __gnu_cxx::wcstoull;
227 }
228 #endif
229
230 #endif //_GLIBCPP_USE_WCHAR_T
231
232 #endif