/home/ntakagi/work/STLport-5.1.5/stlport/stl/_cwchar.hGo to the documentation of this file.00001 /* 00002 * Copyright (c) 1999 00003 * Boris Fomitchev 00004 * 00005 * This material is provided "as is", with absolutely no warranty expressed 00006 * or implied. Any use is at your own risk. 00007 * 00008 * Permission to use or copy this software for any purpose is hereby granted 00009 * without fee, provided the above notices are retained on all copies. 00010 * Permission to modify the code and to distribute modified code is granted, 00011 * provided the above notices are retained, and a notice that the code was 00012 * modified is included with the above copyright notice. 00013 * 00014 */ 00015 00016 #ifndef _STLP_INTERNAL_CWCHAR 00017 #define _STLP_INTERNAL_CWCHAR 00018 00019 #if defined (_STLP_WCE_EVC3) 00020 # ifndef _STLP_INTERNAL_MBSTATE_T 00021 # include <stl/_mbstate_t.h> 00022 # endif 00023 #else 00024 # if defined (__GNUC__) 00025 # include _STLP_NATIVE_CPP_C_HEADER(cstddef) 00026 # endif 00027 00028 # if !defined (_STLP_NO_CWCHAR) && defined (_STLP_USE_NEW_C_HEADERS) 00029 # include _STLP_NATIVE_CPP_C_HEADER(cwchar) 00030 # if defined (__OpenBSD__) 00031 typedef _BSD_WINT_T_ wint_t; 00032 # endif /* __OpenBSD__ */ 00033 00034 # elif defined (_STLP_NO_WCHAR_T) || defined (__MRC__) || (defined (__SC__) && !defined (__DMC__)) || \ 00035 (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) || \ 00036 defined (__OpenBSD__) || defined (__FreeBSD__) || \ 00037 (defined (__GNUC__) && (defined (__APPLE__) || defined ( __Lynx__ ))) 00038 # include _STLP_NATIVE_C_HEADER(stddef.h) 00039 # if defined (__Lynx__) 00040 # ifndef _WINT_T 00041 typedef long int wint_t; 00042 # define _WINT_T 00043 # endif /* _WINT_T */ 00044 # endif 00045 # if defined(__OpenBSD__) 00046 typedef _BSD_WINT_T_ wint_t; 00047 # endif /* __OpenBSD__ */ 00048 # elif defined (__MWERKS__) && defined (N_PLAT_NLM) 00049 # include <wchar.h> 00050 # else 00051 # include _STLP_NATIVE_C_HEADER(wchar.h) 00052 00053 # if defined (__sun) && (defined (_XOPEN_SOURCE) || (_XOPEN_VERSION - 0 == 4)) 00054 extern wint_t btowc(); 00055 extern int fwprintf(); 00056 extern int fwscanf(); 00057 extern int fwide(); 00058 extern int mbsinit(); 00059 extern size_t mbrlen(); 00060 extern size_t mbrtowc(); 00061 extern size_t mbsrtowcs(); 00062 extern int swprintf(); 00063 extern int swscanf(); 00064 extern int vfwprintf(); 00065 extern int vwprintf(); 00066 extern int vswprintf(); 00067 extern size_t wcrtomb(); 00068 extern size_t wcsrtombs(); 00069 extern wchar_t *wcsstr(); 00070 extern int wctob(); 00071 extern wchar_t *wmemchr(); 00072 extern int wmemcmp(); 00073 extern wchar_t *wmemcpy(); 00074 extern wchar_t *wmemmove(); 00075 extern wchar_t *wmemset(); 00076 extern int wprintf(); 00077 extern int wscanf(); 00078 # endif 00079 # endif 00080 00081 # if defined (__MSL__) && (__MSL__ <= 0x51FF) /* dwa 2/28/99 - not yet implemented by MSL */ 00082 # define _STLP_WCHAR_MSL_EXCLUDE 1 00083 namespace std { 00084 extern "C" size_t wcsftime(wchar_t * str, size_t max_size, const wchar_t * format_str, const struct tm * timeptr); 00085 } 00086 # define _STLP_NO_MBSTATE_T 1 00087 # elif defined (__BORLANDC__) 00088 # if !defined (_STLP_USE_NO_IOSTREAMS) 00089 # define _STLP_NO_NATIVE_MBSTATE_T 00090 # endif 00091 # define _STLP_WCHAR_BORLAND_EXCLUDE 1 00092 # endif 00093 00094 # ifndef _STLP_INTERNAL_MBSTATE_T 00095 # include <stl/_mbstate_t.h> 00096 # endif 00097 00098 # if !defined (_STLP_NO_WCHAR_T) 00099 # ifndef WCHAR_MIN 00100 # define WCHAR_MIN 0 00101 /* SUNpro has some bugs with casts. wchar_t is size of int there anyway. */ 00102 # if defined (__SUNPRO_CC) || defined (__DJGPP) 00103 # define WCHAR_MAX (~0) 00104 # else 00105 # define WCHAR_MAX ((wchar_t)~0) 00106 # endif 00107 # endif 00108 # if defined (__GNUC__) && defined (__alpha__) 00109 /* Definition of WCHAR_MIN and MAX are wrong for alpha platform 00110 * as gcc consider wchar_t as an unsigned type. Static assertion are 00111 * here to check that a future alpha SDK or a future gcc won't change the 00112 * situation making this workaround useless. 00113 */ 00114 _STLP_STATIC_ASSERT(((wchar_t)-1 > 0) && (WCHAR_MIN < 0)) 00115 # undef WCHAR_MIN 00116 # define WCHAR_MIN 0 00117 # undef WCHAR_MAX 00118 # define WCHAR_MAX ((wchar_t)~0) 00119 # endif 00120 # if defined(__HP_aCC) && (__HP_aCC >= 60000) 00121 /* Starting with B.11.31, HP-UX/ia64 provides C99-compliant definitions 00122 * of WCHAR_MIN/MAX macros without having to define 00123 * _INCLUDE_STDC__SOURCE_199901 macro (which aCC compiler does not 00124 * predefine). Let STLport provide B.11.31 definitions on any version of 00125 * HP-UX/ia64. 00126 */ 00127 # undef WCHAR_MIN 00128 # define WCHAR_MIN 0 00129 # undef WCHAR_MAX 00130 # define WCHAR_MAX UINT_MAX 00131 # endif 00132 # endif 00133 00134 # if defined (_STLP_IMPORT_VENDOR_CSTD) 00135 00136 # if defined (__SUNPRO_CC) && !defined (_STLP_HAS_NO_NEW_C_HEADERS) 00137 using _STLP_VENDOR_CSTD::wint_t; 00138 # endif 00139 00140 _STLP_BEGIN_NAMESPACE 00141 # if defined (_STLP_NO_WCHAR_T) 00142 typedef int wint_t; 00143 # else 00144 // gcc 3.0 has a glitch : wint_t only sucked into the global namespace if _GLIBCPP_USE_WCHAR_T is defined 00145 // __MWERKS__ has definition in wchar_t.h (MSL C++), but ones differ from definition 00146 // in stdio.h; I prefer settings from last file. 00147 # if (defined (__GNUC__) && ! defined (_GLIBCPP_USE_WCHAR_T)) // || (defined(__MWERKS__) && defined(N_PLAT_NLM)) 00148 using ::wint_t; 00149 # else 00150 using _STLP_VENDOR_CSTD::wint_t; 00151 # endif 00152 # endif 00153 00154 using _STLP_VENDOR_CSTD::size_t; 00155 00156 # if !defined (_STLP_NO_NATIVE_MBSTATE_T) && !defined (_STLP_USE_OWN_MBSTATE_T) 00157 using _STLP_VENDOR_MB_NAMESPACE::mbstate_t; 00158 00159 # if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && \ 00160 (!defined(__MSL__) || __MSL__ > 0x6001) 00161 # if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \ 00162 !(defined (__KCC) || defined (__GNUC__)) && !defined(_STLP_WCE_NET) && !(defined(__MWERKS__) && defined(N_PLAT_NLM)) 00163 using _STLP_VENDOR_MB_NAMESPACE::btowc; 00164 # if (!defined(__MSL__) || __MSL__ > 0x7001) 00165 using _STLP_VENDOR_MB_NAMESPACE::mbsinit; 00166 # endif 00167 # endif 00168 # if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \ 00169 !defined (__GNUC__) && !defined(_STLP_WCE_NET) && !(defined(__MWERKS__) && defined(N_PLAT_NLM)) 00170 using _STLP_VENDOR_MB_NAMESPACE::mbrlen; 00171 using _STLP_VENDOR_MB_NAMESPACE::mbrtowc; 00172 using _STLP_VENDOR_MB_NAMESPACE::mbsrtowcs; 00173 using _STLP_VENDOR_MB_NAMESPACE::wcrtomb; 00174 using _STLP_VENDOR_MB_NAMESPACE::wcsrtombs; 00175 # endif 00176 # endif /* BORLAND && !__MSL__ || __MSL__ > 0x6001 */ 00177 00178 # endif /* _STLP_NO_NATIVE_MBSTATE_T */ 00179 00180 # if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) 00181 00182 # if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !(defined(__MWERKS__) && defined(N_PLAT_NLM)) 00183 using _STLP_VENDOR_CSTD::fgetwc; 00184 using _STLP_VENDOR_CSTD::fgetws; 00185 using _STLP_VENDOR_CSTD::fputwc; 00186 using _STLP_VENDOR_CSTD::fputws; 00187 # endif 00188 00189 # if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \ 00190 defined(_STLP_WCHAR_HPACC_EXCLUDE) || (defined(__MWERKS__) && defined(N_PLAT_NLM))) 00191 # if !defined (__DECCXX) 00192 using _STLP_VENDOR_CSTD::fwide; 00193 # endif 00194 using _STLP_VENDOR_CSTD::fwprintf; 00195 using _STLP_VENDOR_CSTD::fwscanf; 00196 using _STLP_VENDOR_CSTD::getwchar; 00197 # endif 00198 00199 # if !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && !(defined(__MWERKS__) && defined(N_PLAT_NLM)) 00200 # ifndef _STLP_WCE_NET 00201 using _STLP_VENDOR_CSTD::getwc; 00202 # endif 00203 using _STLP_VENDOR_CSTD::ungetwc; 00204 # ifndef _STLP_WCE_NET 00205 using _STLP_VENDOR_CSTD::putwc; 00206 # endif 00207 using _STLP_VENDOR_CSTD::putwchar; 00208 # endif 00209 00210 # if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \ 00211 defined (_STLP_WCHAR_HPACC_EXCLUDE) || (defined (__MWERKS__) && defined (N_PLAT_NLM))) 00212 # if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB <= 1300) || \ 00213 defined (__MINGW32__) 00214 # undef swprintf 00215 # define swprintf _snwprintf 00216 # undef vswprintf 00217 # define vswprintf _vsnwprintf 00218 using ::swprintf; 00219 using ::vswprintf; 00220 # else 00221 using _STLP_VENDOR_CSTD::swprintf; 00222 using _STLP_VENDOR_CSTD::vswprintf; 00223 # endif 00224 using _STLP_VENDOR_CSTD::swscanf; 00225 using _STLP_VENDOR_CSTD::vfwprintf; 00226 using _STLP_VENDOR_CSTD::vwprintf; 00227 00228 # if (!defined(__MSL__) || __MSL__ > 0x7001 ) && !defined(_STLP_WCE_NET) && \ 00229 !defined(_STLP_USE_UCLIBC) /* at least in uClibc 0.9.26 */ 00230 00231 using _STLP_VENDOR_CSTD::wcsftime; 00232 # endif 00233 using _STLP_VENDOR_CSTD::wcstok; 00234 00235 # endif 00236 00237 # if !(defined(__MWERKS__) && defined(N_PLAT_NLM)) 00238 # if !defined (_STLP_WCE_NET) 00239 using _STLP_VENDOR_CSTD::wcscoll; 00240 using _STLP_VENDOR_CSTD::wcsxfrm; 00241 # endif 00242 using _STLP_VENDOR_CSTD::wcscat; 00243 using _STLP_VENDOR_CSTD::wcsrchr; 00244 using _STLP_VENDOR_CSTD::wcscmp; 00245 00246 using _STLP_VENDOR_CSTD::wcscpy; 00247 using _STLP_VENDOR_CSTD::wcscspn; 00248 00249 using _STLP_VENDOR_CSTD::wcslen; 00250 using _STLP_VENDOR_CSTD::wcsncat; 00251 using _STLP_VENDOR_CSTD::wcsncmp; 00252 using _STLP_VENDOR_CSTD::wcsncpy; 00253 using _STLP_VENDOR_CSTD::wcspbrk; 00254 using _STLP_VENDOR_CSTD::wcschr; 00255 00256 using _STLP_VENDOR_CSTD::wcsspn; 00257 # endif 00258 00259 # if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && !(defined(__MWERKS__) && defined(N_PLAT_NLM)) 00260 using _STLP_VENDOR_CSTD::wcstod; 00261 using _STLP_VENDOR_CSTD::wcstol; 00262 # endif 00263 00264 # if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_HPACC_EXCLUDE) || \ 00265 (defined (__MWERKS__) && defined (N_PLAT_NLM))) 00266 using _STLP_VENDOR_CSTD::wcsstr; 00267 using _STLP_VENDOR_CSTD::wmemchr; 00268 00269 # if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) 00270 # if !defined (_STLP_WCE_NET) 00271 using _STLP_VENDOR_CSTD::wctob; 00272 # endif 00273 # if !defined (__DMC__) 00274 using _STLP_VENDOR_CSTD::wmemcmp; 00275 using _STLP_VENDOR_CSTD::wmemmove; 00276 # endif 00277 using _STLP_VENDOR_CSTD::wprintf; 00278 using _STLP_VENDOR_CSTD::wscanf; 00279 # endif 00280 00281 # if defined (__BORLANDC__) 00282 inline wchar_t* _STLP_wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n) 00283 { return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::wmemcpy(__wdst, __wsrc, __n)); } 00284 inline wchar_t* _STLP_wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n) 00285 { return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::memset(__wdst, __wc, __n)); } 00286 # undef wmemcpy 00287 # undef wmemset 00288 inline wchar_t* wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n) 00289 { return _STLP_wmemcpy(__wdst, __wsrc, __n); } 00290 inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n) 00291 { return _STLP_wmemset(__wdst, __wc, __n); } 00292 # elif defined (__DMC__) 00293 inline wchar_t* wmemcpy(wchar_t* __RESTRICT __wdst, const wchar_t* __RESTRICT __wsrc, size_t __n) 00294 { return __STATIC_CAST(wchar_t*, memcpy(__wdst, __wsrc, __n * sizeof(wchar_t))); } 00295 inline wchar_t* wmemmove(wchar_t* __RESTRICT __wdst, const wchar_t * __RESTRICT __wc, size_t __n) 00296 { return __STATIC_CAST(wchar_t*, memmove(__wdst, __wc, __n * sizeof(wchar_t))); } 00297 inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n) 00298 { for (size_t i = 0; i < __n; i++) __wdst[i] = __wc; return __wdst; } 00299 # else 00300 using _STLP_VENDOR_CSTD::wmemcpy; 00301 using _STLP_VENDOR_CSTD::wmemset; 00302 # endif 00303 # endif 00304 00305 # elif defined (__MWERKS__) && defined (N_PLAT_NLM) /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */ 00306 using _STLP_VENDOR_CSTD::wcslen; 00307 using _STLP_VENDOR_CSTD::wcscmp; 00308 using _STLP_VENDOR_CSTD::wcscpy; 00309 using _STLP_VENDOR_CSTD::wcsstr; 00310 using _STLP_VENDOR_CSTD::wcschr; 00311 using _STLP_VENDOR_CSTD::wcsrchr; 00312 using _STLP_VENDOR_CSTD::wcspbrk; 00313 # endif /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */ 00314 _STLP_END_NAMESPACE 00315 00316 # endif /* _STLP_IMPORT_VENDOR_CSTD */ 00317 00318 # undef _STLP_WCHAR_SUNPRO_EXCLUDE 00319 # undef _STLP_WCHAR_MSL_EXCLUDE 00320 00321 # endif /* !defined(_STLP_WCE_EVC3) */ 00322 00323 #endif /* _STLP_INTERNAL_CWCHAR */
Generated on Mon Mar 10 15:32:20 2008 by ![]() |