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 using ::fwprintf; 155 #if !defined(__OpenBSD__) 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 using ::swprintf; 167 #if !defined(__OpenBSD__) 168 using ::swscanf; 169 #endif 170 using ::ungetwc; 171 using ::vfwprintf; 172 #if _GLIBCXX_HAVE_VFWSCANF 173 using ::vfwscanf; 174 #endif 175 using ::vswprintf; 176 #if _GLIBCXX_HAVE_VSWSCANF 177 using ::vswscanf; 178 #endif 179 using ::vwprintf; 180 #if _GLIBCXX_HAVE_VWSCANF 181 using ::vwscanf; 182 #endif 183 using ::wcrtomb; 184 using ::wcscat; 185 using ::wcscmp; 186 using ::wcscoll; 187 using ::wcscpy; 188 using ::wcscspn; 189 #if !defined(__OpenBSD__) 190 using ::wcsftime; 191 #endif 192 using ::wcslen; 193 using ::wcsncat; 194 using ::wcsncmp; 195 using ::wcsncpy; 196 using ::wcsrtombs; 197 using ::wcsspn; 198 using ::wcstod; 199 #if _GLIBCXX_HAVE_WCSTOF 200 using ::wcstof; 201 #endif 202 using ::wcstok; 203 using ::wcstol; 204 using ::wcstoul; 205 using ::wcsxfrm; 206 using ::wctob; 207 using ::wmemcmp; 208 using ::wmemcpy; 209 using ::wmemmove; 210 using ::wmemset; 211 using ::wprintf; 212 #if !defined(__OpenBSD__) 213 using ::wscanf; 214 #endif 215 216 using ::wcschr; 217 218 inline wchar_t* 219 wcschr(wchar_t* __p, wchar_t __c) 220 { return wcschr(const_cast<const wchar_t*>(__p), __c); } 221 222 using ::wcspbrk; 223 224 inline wchar_t* 225 wcspbrk(wchar_t* __s1, const wchar_t* __s2) 226 { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); } 227 228 using ::wcsrchr; 229 230 inline wchar_t* 231 wcsrchr(wchar_t* __p, wchar_t __c) 232 { return wcsrchr(const_cast<const wchar_t*>(__p), __c); } 233 234 using ::wcsstr; 235 236 inline wchar_t* 237 wcsstr(wchar_t* __s1, const wchar_t* __s2) 238 { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); } 239 240 using ::wmemchr; 241 242 inline wchar_t* 243 wmemchr(wchar_t* __p, wchar_t __c, size_t __n) 244 { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); } 245 246 _GLIBCXX_END_NAMESPACE 247 248 #if _GLIBCXX_USE_C99 249 250 #undef wcstold 251 #undef wcstoll 252 #undef wcstoull 253 254 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) 255 256 #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC 257 extern "C" long double 258 (wcstold)(const wchar_t * restrict, wchar_t ** restrict); 259 #endif 260 #if !_GLIBCXX_USE_C99_DYNAMIC 261 using ::wcstold; 262 #endif 263 #if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC 264 extern "C" long long int 265 (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int); 266 extern "C" unsigned long long int 267 (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int); 268 #endif 269 #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC 270 using ::wcstoll; 271 using ::wcstoull; 272 #endif 273 274 _GLIBCXX_END_NAMESPACE 275 276 _GLIBCXX_BEGIN_NAMESPACE(std) 277 278 using ::__gnu_cxx::wcstold; 279 using ::__gnu_cxx::wcstoll; 280 using ::__gnu_cxx::wcstoull; 281 282 _GLIBCXX_END_NAMESPACE 283 284 #endif 285 286 #endif //_GLIBCXX_USE_WCHAR_T 287 288 #endif 289