xref: /openbsd-src/gnu/gcc/libstdc++-v3/include/c_std/std_cwchar.h (revision 6570f8749eb85e92180967d0b1ee9911b31bfb63)
1404b540aSrobert // -*- C++ -*- forwarding header.
2404b540aSrobert 
3404b540aSrobert // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
4404b540aSrobert // Free Software Foundation, Inc.
5404b540aSrobert //
6404b540aSrobert // This file is part of the GNU ISO C++ Library.  This library is free
7404b540aSrobert // software; you can redistribute it and/or modify it under the
8404b540aSrobert // terms of the GNU General Public License as published by the
9404b540aSrobert // Free Software Foundation; either version 2, or (at your option)
10404b540aSrobert // any later version.
11404b540aSrobert 
12404b540aSrobert // This library is distributed in the hope that it will be useful,
13404b540aSrobert // but WITHOUT ANY WARRANTY; without even the implied warranty of
14404b540aSrobert // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15404b540aSrobert // GNU General Public License for more details.
16404b540aSrobert 
17404b540aSrobert // You should have received a copy of the GNU General Public License along
18404b540aSrobert // with this library; see the file COPYING.  If not, write to the Free
19404b540aSrobert // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20404b540aSrobert // USA.
21404b540aSrobert 
22404b540aSrobert // As a special exception, you may use this file as part of a free software
23404b540aSrobert // library without restriction.  Specifically, if other files instantiate
24404b540aSrobert // templates or use macros or inline functions from this file, or you compile
25404b540aSrobert // this file and link it with other files to produce an executable, this
26404b540aSrobert // file does not by itself cause the resulting executable to be covered by
27404b540aSrobert // the GNU General Public License.  This exception does not however
28404b540aSrobert // invalidate any other reasons why the executable file might be covered by
29404b540aSrobert // the GNU General Public License.
30404b540aSrobert 
31404b540aSrobert /** @file include/cwchar
32404b540aSrobert  *  This is a Standard C++ Library file.  You should @c #include this file
33404b540aSrobert  *  in your programs, rather than any of the "*.h" implementation files.
34404b540aSrobert  *
35404b540aSrobert  *  This is the C++ version of the Standard C Library header @c wchar.h,
36404b540aSrobert  *  and its contents are (mostly) the same as that header, but are all
37404b540aSrobert  *  contained in the namespace @c std (except for names which are defined
38404b540aSrobert  *  as macros in C).
39404b540aSrobert  */
40404b540aSrobert 
41404b540aSrobert //
42404b540aSrobert // ISO C++ 14882: 21.4
43404b540aSrobert //
44404b540aSrobert 
45404b540aSrobert #ifndef _GLIBCXX_CWCHAR
46404b540aSrobert #define _GLIBCXX_CWCHAR 1
47404b540aSrobert 
48404b540aSrobert #pragma GCC system_header
49404b540aSrobert 
50404b540aSrobert #include <bits/c++config.h>
51404b540aSrobert #include <cstddef>
52404b540aSrobert #include <ctime>
53404b540aSrobert 
54404b540aSrobert #if _GLIBCXX_HAVE_WCHAR_H
55404b540aSrobert #include <wchar.h>
56404b540aSrobert #endif
57404b540aSrobert 
58404b540aSrobert // Need to do a bit of trickery here with mbstate_t as char_traits
59404b540aSrobert // assumes it is in wchar.h, regardless of wchar_t specializations.
60404b540aSrobert #ifndef _GLIBCXX_HAVE_MBSTATE_T
61404b540aSrobert extern "C"
62404b540aSrobert {
63404b540aSrobert   typedef struct
64404b540aSrobert   {
65404b540aSrobert     int __fill[6];
66404b540aSrobert   } mbstate_t;
67404b540aSrobert }
68404b540aSrobert #endif
69404b540aSrobert 
70404b540aSrobert _GLIBCXX_BEGIN_NAMESPACE(std)
71404b540aSrobert 
72404b540aSrobert   using ::mbstate_t;
73404b540aSrobert 
74404b540aSrobert _GLIBCXX_END_NAMESPACE
75404b540aSrobert 
76404b540aSrobert // Get rid of those macros defined in <wchar.h> in lieu of real functions.
77404b540aSrobert #undef btowc
78404b540aSrobert #undef fgetwc
79404b540aSrobert #undef fgetws
80404b540aSrobert #undef fputwc
81404b540aSrobert #undef fputws
82404b540aSrobert #undef fwide
83404b540aSrobert #undef fwprintf
84404b540aSrobert #undef fwscanf
85404b540aSrobert #undef getwc
86404b540aSrobert #undef getwchar
87404b540aSrobert #undef mbrlen
88404b540aSrobert #undef mbrtowc
89404b540aSrobert #undef mbsinit
90404b540aSrobert #undef mbsrtowcs
91404b540aSrobert #undef putwc
92404b540aSrobert #undef putwchar
93404b540aSrobert #undef swprintf
94404b540aSrobert #undef swscanf
95404b540aSrobert #undef ungetwc
96404b540aSrobert #undef vfwprintf
97404b540aSrobert #if _GLIBCXX_HAVE_VFWSCANF
98404b540aSrobert # undef vfwscanf
99404b540aSrobert #endif
100404b540aSrobert #undef vswprintf
101404b540aSrobert #if _GLIBCXX_HAVE_VSWSCANF
102404b540aSrobert # undef vswscanf
103404b540aSrobert #endif
104404b540aSrobert #undef vwprintf
105404b540aSrobert #if _GLIBCXX_HAVE_VWSCANF
106404b540aSrobert # undef vwscanf
107404b540aSrobert #endif
108404b540aSrobert #undef wcrtomb
109404b540aSrobert #undef wcscat
110404b540aSrobert #undef wcschr
111404b540aSrobert #undef wcscmp
112404b540aSrobert #undef wcscoll
113404b540aSrobert #undef wcscpy
114404b540aSrobert #undef wcscspn
115404b540aSrobert #undef wcsftime
116404b540aSrobert #undef wcslen
117404b540aSrobert #undef wcsncat
118404b540aSrobert #undef wcsncmp
119404b540aSrobert #undef wcsncpy
120404b540aSrobert #undef wcspbrk
121404b540aSrobert #undef wcsrchr
122404b540aSrobert #undef wcsrtombs
123404b540aSrobert #undef wcsspn
124404b540aSrobert #undef wcsstr
125404b540aSrobert #undef wcstod
126404b540aSrobert #if _GLIBCXX_HAVE_WCSTOF
127404b540aSrobert # undef wcstof
128404b540aSrobert #endif
129404b540aSrobert #undef wcstok
130404b540aSrobert #undef wcstol
131404b540aSrobert #undef wcstoul
132404b540aSrobert #undef wcsxfrm
133404b540aSrobert #undef wctob
134404b540aSrobert #undef wmemchr
135404b540aSrobert #undef wmemcmp
136404b540aSrobert #undef wmemcpy
137404b540aSrobert #undef wmemmove
138404b540aSrobert #undef wmemset
139404b540aSrobert #undef wprintf
140404b540aSrobert #undef wscanf
141404b540aSrobert 
142404b540aSrobert #if _GLIBCXX_USE_WCHAR_T
143404b540aSrobert 
144404b540aSrobert _GLIBCXX_BEGIN_NAMESPACE(std)
145404b540aSrobert 
146404b540aSrobert   using ::wint_t;
147404b540aSrobert 
148404b540aSrobert   using ::btowc;
149404b540aSrobert   using ::fgetwc;
150404b540aSrobert   using ::fgetws;
151404b540aSrobert   using ::fputwc;
152404b540aSrobert   using ::fputws;
153404b540aSrobert   using ::fwide;
1544a0f1ee6Sstsp   using ::fwprintf;
155404b540aSrobert   using ::fwscanf;
156404b540aSrobert   using ::getwc;
157404b540aSrobert   using ::getwchar;
158404b540aSrobert   using ::mbrlen;
159404b540aSrobert   using ::mbrtowc;
160404b540aSrobert   using ::mbsinit;
161404b540aSrobert   using ::mbsrtowcs;
162404b540aSrobert   using ::putwc;
163404b540aSrobert   using ::putwchar;
1644a0f1ee6Sstsp   using ::swprintf;
165404b540aSrobert   using ::swscanf;
166404b540aSrobert   using ::ungetwc;
167404b540aSrobert   using ::vfwprintf;
168404b540aSrobert #if _GLIBCXX_HAVE_VFWSCANF
169404b540aSrobert   using ::vfwscanf;
170404b540aSrobert #endif
171404b540aSrobert   using ::vswprintf;
172404b540aSrobert #if _GLIBCXX_HAVE_VSWSCANF
173404b540aSrobert   using ::vswscanf;
174404b540aSrobert #endif
175404b540aSrobert   using ::vwprintf;
176404b540aSrobert #if _GLIBCXX_HAVE_VWSCANF
177404b540aSrobert   using ::vwscanf;
178404b540aSrobert #endif
179404b540aSrobert   using ::wcrtomb;
180404b540aSrobert   using ::wcscat;
181404b540aSrobert   using ::wcscmp;
182404b540aSrobert   using ::wcscoll;
183404b540aSrobert   using ::wcscpy;
184404b540aSrobert   using ::wcscspn;
185404b540aSrobert   using ::wcsftime;
186404b540aSrobert   using ::wcslen;
187404b540aSrobert   using ::wcsncat;
188404b540aSrobert   using ::wcsncmp;
189404b540aSrobert   using ::wcsncpy;
190404b540aSrobert   using ::wcsrtombs;
191404b540aSrobert   using ::wcsspn;
192404b540aSrobert   using ::wcstod;
193404b540aSrobert #if _GLIBCXX_HAVE_WCSTOF
194404b540aSrobert   using ::wcstof;
195404b540aSrobert #endif
196404b540aSrobert   using ::wcstok;
197404b540aSrobert   using ::wcstol;
198404b540aSrobert   using ::wcstoul;
199404b540aSrobert   using ::wcsxfrm;
200404b540aSrobert   using ::wctob;
201404b540aSrobert   using ::wmemcmp;
202404b540aSrobert   using ::wmemcpy;
203404b540aSrobert   using ::wmemmove;
204404b540aSrobert   using ::wmemset;
2054a0f1ee6Sstsp   using ::wprintf;
206404b540aSrobert   using ::wscanf;
207404b540aSrobert 
208404b540aSrobert   using ::wcschr;
209404b540aSrobert 
210404b540aSrobert   inline wchar_t*
wcschr(wchar_t * __p,wchar_t __c)211404b540aSrobert   wcschr(wchar_t* __p, wchar_t __c)
212404b540aSrobert   { return wcschr(const_cast<const wchar_t*>(__p), __c); }
213404b540aSrobert 
214404b540aSrobert   using ::wcspbrk;
215404b540aSrobert 
216404b540aSrobert   inline wchar_t*
wcspbrk(wchar_t * __s1,const wchar_t * __s2)217404b540aSrobert   wcspbrk(wchar_t* __s1, const wchar_t* __s2)
218404b540aSrobert   { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
219404b540aSrobert 
220404b540aSrobert   using ::wcsrchr;
221404b540aSrobert 
222404b540aSrobert   inline wchar_t*
wcsrchr(wchar_t * __p,wchar_t __c)223404b540aSrobert   wcsrchr(wchar_t* __p, wchar_t __c)
224404b540aSrobert   { return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
225404b540aSrobert 
226404b540aSrobert   using ::wcsstr;
227404b540aSrobert 
228404b540aSrobert   inline wchar_t*
wcsstr(wchar_t * __s1,const wchar_t * __s2)229404b540aSrobert   wcsstr(wchar_t* __s1, const wchar_t* __s2)
230404b540aSrobert   { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
231404b540aSrobert 
232404b540aSrobert   using ::wmemchr;
233404b540aSrobert 
234404b540aSrobert   inline wchar_t*
wmemchr(wchar_t * __p,wchar_t __c,size_t __n)235404b540aSrobert   wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
236404b540aSrobert   { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
237404b540aSrobert 
238404b540aSrobert _GLIBCXX_END_NAMESPACE
239404b540aSrobert 
240404b540aSrobert #if _GLIBCXX_USE_C99
241404b540aSrobert 
242404b540aSrobert #undef wcstold
243404b540aSrobert #undef wcstoll
244404b540aSrobert #undef wcstoull
245404b540aSrobert 
246404b540aSrobert _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
247404b540aSrobert 
248404b540aSrobert #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
249404b540aSrobert   extern "C" long double
250*6570f874Spascal     (wcstold)(const wchar_t * __restrict, wchar_t ** __restrict);
251404b540aSrobert #endif
252404b540aSrobert #if !_GLIBCXX_USE_C99_DYNAMIC
253404b540aSrobert   using ::wcstold;
254404b540aSrobert #endif
255404b540aSrobert #if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
256404b540aSrobert   extern "C" long long int
257*6570f874Spascal     (wcstoll)(const wchar_t * __restrict, wchar_t ** __restrict, int);
258404b540aSrobert   extern "C" unsigned long long int
259*6570f874Spascal     (wcstoull)(const wchar_t * __restrict, wchar_t ** __restrict, int);
260404b540aSrobert #endif
261404b540aSrobert #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
262404b540aSrobert   using ::wcstoll;
263404b540aSrobert   using ::wcstoull;
264404b540aSrobert #endif
265404b540aSrobert 
266404b540aSrobert _GLIBCXX_END_NAMESPACE
267404b540aSrobert 
268404b540aSrobert _GLIBCXX_BEGIN_NAMESPACE(std)
269404b540aSrobert 
270404b540aSrobert   using ::__gnu_cxx::wcstold;
271404b540aSrobert   using ::__gnu_cxx::wcstoll;
272404b540aSrobert   using ::__gnu_cxx::wcstoull;
273404b540aSrobert 
274404b540aSrobert _GLIBCXX_END_NAMESPACE
275404b540aSrobert 
276404b540aSrobert #endif
277404b540aSrobert 
278404b540aSrobert #endif //_GLIBCXX_USE_WCHAR_T
279404b540aSrobert 
280404b540aSrobert #endif
281