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