home *** CD-ROM | disk | FTP | other *** search
/ Beginning C++ Through Gam…rogramming (2nd Edition) / BCGP2E.ISO / bloodshed / devcpp-4.9.9.2_setup.exe / cwchar < prev    next >
Text File  |  2005-01-29  |  6KB  |  274 lines

  1. // -*- C++ -*- forwarding header.
  2.  
  3. // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
  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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  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. //
  32. // ISO C++ 14882: 21.4
  33. //
  34.  
  35. /** @file cwchar
  36.  *  This is a Standard C++ Library file.  You should @c #include this file
  37.  *  in your programs, rather than any of the "*.h" implementation files.
  38.  *
  39.  *  This is the C++ version of the Standard C Library header @c wchar.h,
  40.  *  and its contents are (mostly) the same as that header, but are all
  41.  *  contained in the namespace @c std.
  42.  */
  43.  
  44. #ifndef _GLIBCXX_CWCHAR
  45. #define _GLIBCXX_CWCHAR 1
  46.  
  47. #pragma GCC system_header
  48.  
  49. #include <bits/c++config.h>
  50. #include <cstddef>
  51. #include <ctime>
  52.  
  53. #if _GLIBCXX_HAVE_WCHAR_H
  54. #include <wchar.h>
  55. #endif
  56.  
  57. // Need to do a bit of trickery here with mbstate_t as char_traits
  58. // assumes it is in wchar.h, regardless of wchar_t specializations.
  59. #ifndef _GLIBCXX_HAVE_MBSTATE_T
  60. extern "C"
  61. {
  62.   typedef struct
  63.   {
  64.     int __fill[6];
  65.   } mbstate_t;
  66. }
  67. #endif
  68.  
  69. namespace std
  70. {
  71.   using ::mbstate_t;
  72. }
  73.  
  74. // Get rid of those macros defined in <wchar.h> in lieu of real functions.
  75. #undef btowc
  76. #undef fgetwc
  77. #undef fgetws
  78. #undef fputwc
  79. #undef fputws
  80. #undef fwide
  81. #undef fwprintf
  82. #undef fwscanf
  83. #undef getwc
  84. #undef getwchar
  85. #undef mbrlen
  86. #undef mbrtowc
  87. #undef mbsinit
  88. #undef mbsrtowcs
  89. #undef putwc
  90. #undef putwchar
  91. #undef swprintf
  92. #undef swscanf
  93. #undef ungetwc
  94. #undef vfwprintf
  95. #if _GLIBCXX_HAVE_VFWSCANF
  96. # undef vfwscanf
  97. #endif
  98. #undef vswprintf
  99. #if _GLIBCXX_HAVE_VSWSCANF
  100. # undef vswscanf
  101. #endif
  102. #undef vwprintf
  103. #if _GLIBCXX_HAVE_VWSCANF
  104. # undef vwscanf
  105. #endif
  106. #undef wcrtomb
  107. #undef wcscat
  108. #undef wcschr
  109. #undef wcscmp
  110. #undef wcscoll
  111. #undef wcscpy
  112. #undef wcscspn
  113. #undef wcsftime
  114. #undef wcslen
  115. #undef wcsncat
  116. #undef wcsncmp
  117. #undef wcsncpy
  118. #undef wcspbrk
  119. #undef wcsrchr
  120. #undef wcsrtombs
  121. #undef wcsspn
  122. #undef wcsstr
  123. #undef wcstod
  124. #if _GLIBCXX_HAVE_WCSTOF
  125. # undef wcstof
  126. #endif
  127. #undef wcstok
  128. #undef wcstol
  129. #undef wcstoul
  130. #undef wcsxfrm
  131. #undef wctob
  132. #undef wmemchr
  133. #undef wmemcmp
  134. #undef wmemcpy
  135. #undef wmemmove
  136. #undef wmemset
  137. #undef wprintf
  138. #undef wscanf
  139.  
  140. #if _GLIBCXX_USE_WCHAR_T || _GLIBCXX_USE_WSTRING
  141. namespace std
  142. {
  143.   using ::wint_t;
  144.  
  145.   using ::btowc;
  146.   using ::fgetwc;
  147.   using ::fgetws;
  148.   using ::fputwc;
  149.   using ::fputws;
  150.   using ::fwide;
  151.   using ::fwprintf;
  152.   using ::fwscanf;
  153.   using ::getwc;
  154.   using ::getwchar;
  155.   using ::mbrlen;
  156.   using ::mbrtowc;
  157.   using ::mbsinit;
  158.   using ::mbsrtowcs;
  159.   using ::putwc;
  160.   using ::putwchar;
  161.   using ::swprintf;
  162.   using ::swscanf;
  163.   using ::ungetwc;
  164.   using ::vfwprintf;
  165. #if _GLIBCXX_HAVE_VFWSCANF
  166.   using ::vfwscanf;
  167. #endif
  168.   using ::vswprintf;
  169. #if _GLIBCXX_HAVE_VSWSCANF
  170.   using ::vswscanf;
  171. #endif
  172.   using ::vwprintf;
  173. #if _GLIBCXX_HAVE_VWSCANF
  174.   using ::vwscanf;
  175. #endif
  176.   using ::wcrtomb;
  177.   using ::wcscat;
  178.   using ::wcscmp;
  179.   using ::wcscoll;
  180.   using ::wcscpy;
  181.   using ::wcscspn;
  182.   using ::wcsftime;
  183.   using ::wcslen;
  184.   using ::wcsncat;
  185.   using ::wcsncmp;
  186.   using ::wcsncpy;
  187.   using ::wcsrtombs;
  188.   using ::wcsspn;
  189.   using ::wcstod;
  190. #if _GLIBCXX_HAVE_WCSTOF
  191.   using ::wcstof;
  192. #endif
  193.   using ::wcstok;
  194.   using ::wcstol;
  195.   using ::wcstoul;
  196.   using ::wcsxfrm;
  197.   using ::wctob;
  198.   using ::wmemcmp;
  199.   using ::wmemcpy;
  200.   using ::wmemmove;
  201.   using ::wmemset;
  202.   using ::wprintf;
  203.   using ::wscanf;
  204.  
  205.   using ::wcschr;
  206.  
  207.   inline wchar_t*
  208.   wcschr(wchar_t* __p, wchar_t __c)
  209.   { return wcschr(const_cast<const wchar_t*>(__p), __c); }
  210.  
  211.   using ::wcspbrk;
  212.  
  213.   inline wchar_t*
  214.   wcspbrk(wchar_t* __s1, wchar_t* __s2)
  215.   { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
  216.  
  217.   using ::wcsrchr;
  218.  
  219.   inline wchar_t*
  220.   wcsrchr(wchar_t* __p, wchar_t __c)
  221.   { return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
  222.  
  223.   using ::wcsstr;
  224.  
  225.   inline wchar_t*
  226.   wcsstr(wchar_t* __s1, const wchar_t* __s2)
  227.   { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
  228.  
  229.   using ::wmemchr;
  230.  
  231.   inline wchar_t*
  232.   wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
  233.   { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
  234. }
  235.  
  236. #if _GLIBCXX_USE_C99
  237.  
  238. #undef wcstold
  239. #undef wcstoll
  240. #undef wcstoull
  241.  
  242. namespace __gnu_cxx
  243. {
  244. #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
  245.   extern "C" long double
  246.     (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
  247. #endif
  248. #if !_GLIBCXX_USE_C99_DYNAMIC
  249.   using ::wcstold;
  250. #endif
  251. #if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
  252.   extern "C" long long int
  253.     (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int);
  254.   extern "C" unsigned long long int
  255.     (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);
  256. #endif
  257. #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
  258.   using ::wcstoll;
  259.   using ::wcstoull;
  260. #endif
  261. }
  262.  
  263. namespace std
  264. {
  265.   using __gnu_cxx::wcstold;
  266.   using __gnu_cxx::wcstoll;
  267.   using __gnu_cxx::wcstoull;
  268. }
  269. #endif
  270.  
  271. #endif //_GLIBCXX_USE_WCHAR_T
  272.  
  273. #endif
  274.