1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/tools/stlport/stl/_cwchar.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,323 @@
1.4 +/*
1.5 + * Copyright (c) 1999
1.6 + * Boris Fomitchev
1.7 + *
1.8 + * This material is provided "as is", with absolutely no warranty expressed
1.9 + * or implied. Any use is at your own risk.
1.10 + *
1.11 + * Permission to use or copy this software for any purpose is hereby granted
1.12 + * without fee, provided the above notices are retained on all copies.
1.13 + * Permission to modify the code and to distribute modified code is granted,
1.14 + * provided the above notices are retained, and a notice that the code was
1.15 + * modified is included with the above copyright notice.
1.16 + *
1.17 + */
1.18 +
1.19 +#ifndef _STLP_INTERNAL_CWCHAR
1.20 +#define _STLP_INTERNAL_CWCHAR
1.21 +
1.22 +#if defined (_STLP_WCE_EVC3)
1.23 +# ifndef _STLP_INTERNAL_MBSTATE_T
1.24 +# include <stl/_mbstate_t.h>
1.25 +# endif
1.26 +#else
1.27 +# if defined (__GNUC__)
1.28 +# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
1.29 +# endif
1.30 +
1.31 +# if !defined (_STLP_NO_CWCHAR) && defined (_STLP_USE_NEW_C_HEADERS)
1.32 +# include _STLP_NATIVE_CPP_C_HEADER(cwchar)
1.33 +# if defined (__OpenBSD__)
1.34 +typedef _BSD_WINT_T_ wint_t;
1.35 +# endif /* __OpenBSD__ */
1.36 +
1.37 +# elif defined (_STLP_NO_WCHAR_T) || defined (__MRC__) || (defined (__SC__) && !defined (__DMC__)) || \
1.38 + (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) || \
1.39 + defined (__OpenBSD__) || defined (__FreeBSD__) || \
1.40 + (defined (__GNUC__) && (defined (__APPLE__) || defined ( __Lynx__ )))
1.41 +# include _STLP_NATIVE_C_HEADER(stddef.h)
1.42 +# if defined (__Lynx__)
1.43 +# ifndef _WINT_T
1.44 +typedef long int wint_t;
1.45 +# define _WINT_T
1.46 +# endif /* _WINT_T */
1.47 +# endif
1.48 +# if defined(__OpenBSD__)
1.49 +typedef _BSD_WINT_T_ wint_t;
1.50 +# endif /* __OpenBSD__ */
1.51 +# elif defined (__MWERKS__) && defined (N_PLAT_NLM)
1.52 +# include <wchar.h>
1.53 +# else
1.54 +# include _STLP_NATIVE_C_HEADER(wchar.h)
1.55 +
1.56 +# if defined (__sun) && (defined (_XOPEN_SOURCE) || (_XOPEN_VERSION - 0 == 4))
1.57 +extern wint_t btowc();
1.58 +extern int fwprintf();
1.59 +extern int fwscanf();
1.60 +extern int fwide();
1.61 +extern int mbsinit();
1.62 +extern size_t mbrlen();
1.63 +extern size_t mbrtowc();
1.64 +extern size_t mbsrtowcs();
1.65 +extern int swprintf();
1.66 +extern int swscanf();
1.67 +extern int vfwprintf();
1.68 +extern int vwprintf();
1.69 +extern int vswprintf();
1.70 +extern size_t wcrtomb();
1.71 +extern size_t wcsrtombs();
1.72 +extern wchar_t *wcsstr();
1.73 +extern int wctob();
1.74 +extern wchar_t *wmemchr();
1.75 +extern int wmemcmp();
1.76 +extern wchar_t *wmemcpy();
1.77 +extern wchar_t *wmemmove();
1.78 +extern wchar_t *wmemset();
1.79 +extern int wprintf();
1.80 +extern int wscanf();
1.81 +# endif
1.82 +# endif
1.83 +
1.84 +# if defined (__MSL__) && (__MSL__ <= 0x51FF) /* dwa 2/28/99 - not yet implemented by MSL */
1.85 +# define _STLP_WCHAR_MSL_EXCLUDE 1
1.86 +namespace std {
1.87 + extern "C" size_t wcsftime(wchar_t * str, size_t max_size, const wchar_t * format_str, const struct tm * timeptr);
1.88 +}
1.89 +# define _STLP_NO_MBSTATE_T 1
1.90 +# elif defined (__BORLANDC__)
1.91 +# if !defined (_STLP_USE_NO_IOSTREAMS)
1.92 +# define _STLP_NO_NATIVE_MBSTATE_T
1.93 +# endif
1.94 +# define _STLP_WCHAR_BORLAND_EXCLUDE 1
1.95 +# endif
1.96 +
1.97 +# ifndef _STLP_INTERNAL_MBSTATE_T
1.98 +# include <stl/_mbstate_t.h>
1.99 +# endif
1.100 +
1.101 +# if !defined (_STLP_NO_WCHAR_T)
1.102 +# ifndef WCHAR_MIN
1.103 +# define WCHAR_MIN 0
1.104 +/* SUNpro has some bugs with casts. wchar_t is size of int there anyway. */
1.105 +# if defined (__SUNPRO_CC) || defined (__DJGPP)
1.106 +# define WCHAR_MAX (~0)
1.107 +# else
1.108 +# define WCHAR_MAX ((wchar_t)~0)
1.109 +# endif
1.110 +# endif
1.111 +# if defined (__GNUC__) && defined (__alpha__)
1.112 +/* Definition of WCHAR_MIN and MAX are wrong for alpha platform
1.113 + * as gcc consider wchar_t as an unsigned type. Static assertion are
1.114 + * here to check that a future alpha SDK or a future gcc won't change the
1.115 + * situation making this workaround useless.
1.116 + */
1.117 +_STLP_STATIC_ASSERT(((wchar_t)-1 > 0) && (WCHAR_MIN < 0))
1.118 +# undef WCHAR_MIN
1.119 +# define WCHAR_MIN 0
1.120 +# undef WCHAR_MAX
1.121 +# define WCHAR_MAX ((wchar_t)~0)
1.122 +# endif
1.123 +# if defined(__HP_aCC) && (__HP_aCC >= 60000)
1.124 +/* Starting with B.11.31, HP-UX/ia64 provides C99-compliant definitions
1.125 + * of WCHAR_MIN/MAX macros without having to define
1.126 + * _INCLUDE_STDC__SOURCE_199901 macro (which aCC compiler does not
1.127 + * predefine). Let STLport provide B.11.31 definitions on any version of
1.128 + * HP-UX/ia64.
1.129 + */
1.130 +# undef WCHAR_MIN
1.131 +# define WCHAR_MIN 0
1.132 +# undef WCHAR_MAX
1.133 +# define WCHAR_MAX UINT_MAX
1.134 +# endif
1.135 +# endif
1.136 +
1.137 +# if defined (_STLP_IMPORT_VENDOR_CSTD)
1.138 +
1.139 +# if defined (__SUNPRO_CC) && !defined (_STLP_HAS_NO_NEW_C_HEADERS)
1.140 +using _STLP_VENDOR_CSTD::wint_t;
1.141 +# endif
1.142 +
1.143 +_STLP_BEGIN_NAMESPACE
1.144 +# if defined (_STLP_NO_WCHAR_T)
1.145 +typedef int wint_t;
1.146 +# else
1.147 +// gcc 3.0 has a glitch : wint_t only sucked into the global namespace if _GLIBCPP_USE_WCHAR_T is defined
1.148 +// __MWERKS__ has definition in wchar_t.h (MSL C++), but ones differ from definition
1.149 +// in stdio.h; I prefer settings from last file.
1.150 +# if (defined (__GNUC__) && ! defined (_GLIBCPP_USE_WCHAR_T)) // || (defined(__MWERKS__) && defined(N_PLAT_NLM))
1.151 +using ::wint_t;
1.152 +# else
1.153 +using _STLP_VENDOR_CSTD::wint_t;
1.154 +# endif
1.155 +# endif
1.156 +
1.157 +using _STLP_VENDOR_CSTD::size_t;
1.158 +
1.159 +# if !defined (_STLP_NO_NATIVE_MBSTATE_T) && !defined (_STLP_USE_OWN_MBSTATE_T)
1.160 +using _STLP_VENDOR_MB_NAMESPACE::mbstate_t;
1.161 +
1.162 +# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && \
1.163 + (!defined(__MSL__) || __MSL__ > 0x6001)
1.164 +# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \
1.165 + !(defined (__KCC) || defined (__GNUC__)) && !defined(_STLP_WCE_NET) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
1.166 +using _STLP_VENDOR_MB_NAMESPACE::btowc;
1.167 +# if (!defined(__MSL__) || __MSL__ > 0x7001)
1.168 +using _STLP_VENDOR_MB_NAMESPACE::mbsinit;
1.169 +# endif
1.170 +# endif
1.171 +# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \
1.172 + !defined (__GNUC__) && !defined(_STLP_WCE_NET) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
1.173 +using _STLP_VENDOR_MB_NAMESPACE::mbrlen;
1.174 +using _STLP_VENDOR_MB_NAMESPACE::mbrtowc;
1.175 +using _STLP_VENDOR_MB_NAMESPACE::mbsrtowcs;
1.176 +using _STLP_VENDOR_MB_NAMESPACE::wcrtomb;
1.177 +using _STLP_VENDOR_MB_NAMESPACE::wcsrtombs;
1.178 +# endif
1.179 +# endif /* BORLAND && !__MSL__ || __MSL__ > 0x6001 */
1.180 +
1.181 +# endif /* _STLP_NO_NATIVE_MBSTATE_T */
1.182 +
1.183 +# if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
1.184 +
1.185 +# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
1.186 +using _STLP_VENDOR_CSTD::fgetwc;
1.187 +using _STLP_VENDOR_CSTD::fgetws;
1.188 +using _STLP_VENDOR_CSTD::fputwc;
1.189 +using _STLP_VENDOR_CSTD::fputws;
1.190 +# endif
1.191 +
1.192 +# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \
1.193 + defined(_STLP_WCHAR_HPACC_EXCLUDE) || (defined(__MWERKS__) && defined(N_PLAT_NLM)))
1.194 +# if !defined (__DECCXX)
1.195 +using _STLP_VENDOR_CSTD::fwide;
1.196 +# endif
1.197 +using _STLP_VENDOR_CSTD::fwprintf;
1.198 +using _STLP_VENDOR_CSTD::fwscanf;
1.199 +using _STLP_VENDOR_CSTD::getwchar;
1.200 +# endif
1.201 +
1.202 +# if !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
1.203 +# ifndef _STLP_WCE_NET
1.204 +using _STLP_VENDOR_CSTD::getwc;
1.205 +# endif
1.206 +using _STLP_VENDOR_CSTD::ungetwc;
1.207 +# ifndef _STLP_WCE_NET
1.208 +using _STLP_VENDOR_CSTD::putwc;
1.209 +# endif
1.210 +using _STLP_VENDOR_CSTD::putwchar;
1.211 +# endif
1.212 +
1.213 +# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \
1.214 + defined (_STLP_WCHAR_HPACC_EXCLUDE) || (defined (__MWERKS__) && defined (N_PLAT_NLM)))
1.215 +# if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB <= 1300) || \
1.216 + defined (__MINGW32__)
1.217 +# undef swprintf
1.218 +# define swprintf _snwprintf
1.219 +# undef vswprintf
1.220 +# define vswprintf _vsnwprintf
1.221 +using ::swprintf;
1.222 +using ::vswprintf;
1.223 +# else
1.224 +using _STLP_VENDOR_CSTD::swprintf;
1.225 +using _STLP_VENDOR_CSTD::vswprintf;
1.226 +# endif
1.227 +using _STLP_VENDOR_CSTD::swscanf;
1.228 +using _STLP_VENDOR_CSTD::vfwprintf;
1.229 +using _STLP_VENDOR_CSTD::vwprintf;
1.230 +
1.231 +# if (!defined(__MSL__) || __MSL__ > 0x7001 ) && !defined(_STLP_WCE_NET) && \
1.232 + !defined(_STLP_USE_UCLIBC) /* at least in uClibc 0.9.26 */
1.233 +
1.234 +using _STLP_VENDOR_CSTD::wcsftime;
1.235 +# endif
1.236 +using _STLP_VENDOR_CSTD::wcstok;
1.237 +
1.238 +# endif
1.239 +
1.240 +# if !(defined(__MWERKS__) && defined(N_PLAT_NLM))
1.241 +# if !defined (_STLP_WCE_NET)
1.242 +using _STLP_VENDOR_CSTD::wcscoll;
1.243 +using _STLP_VENDOR_CSTD::wcsxfrm;
1.244 +# endif
1.245 +using _STLP_VENDOR_CSTD::wcscat;
1.246 +using _STLP_VENDOR_CSTD::wcsrchr;
1.247 +using _STLP_VENDOR_CSTD::wcscmp;
1.248 +
1.249 +using _STLP_VENDOR_CSTD::wcscpy;
1.250 +using _STLP_VENDOR_CSTD::wcscspn;
1.251 +
1.252 +using _STLP_VENDOR_CSTD::wcslen;
1.253 +using _STLP_VENDOR_CSTD::wcsncat;
1.254 +using _STLP_VENDOR_CSTD::wcsncmp;
1.255 +using _STLP_VENDOR_CSTD::wcsncpy;
1.256 +using _STLP_VENDOR_CSTD::wcspbrk;
1.257 +using _STLP_VENDOR_CSTD::wcschr;
1.258 +
1.259 +using _STLP_VENDOR_CSTD::wcsspn;
1.260 +# endif
1.261 +
1.262 +# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
1.263 +using _STLP_VENDOR_CSTD::wcstod;
1.264 +using _STLP_VENDOR_CSTD::wcstol;
1.265 +# endif
1.266 +
1.267 +# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_HPACC_EXCLUDE) || \
1.268 + (defined (__MWERKS__) && defined (N_PLAT_NLM)))
1.269 +using _STLP_VENDOR_CSTD::wcsstr;
1.270 +using _STLP_VENDOR_CSTD::wmemchr;
1.271 +
1.272 +# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE)
1.273 +# if !defined (_STLP_WCE_NET)
1.274 +using _STLP_VENDOR_CSTD::wctob;
1.275 +# endif
1.276 +# if !defined (__DMC__)
1.277 +using _STLP_VENDOR_CSTD::wmemcmp;
1.278 +using _STLP_VENDOR_CSTD::wmemmove;
1.279 +# endif
1.280 +using _STLP_VENDOR_CSTD::wprintf;
1.281 +using _STLP_VENDOR_CSTD::wscanf;
1.282 +# endif
1.283 +
1.284 +# if defined (__BORLANDC__)
1.285 +inline wchar_t* _STLP_wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n)
1.286 +{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::wmemcpy(__wdst, __wsrc, __n)); }
1.287 +inline wchar_t* _STLP_wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
1.288 +{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::memset(__wdst, __wc, __n)); }
1.289 +# undef wmemcpy
1.290 +# undef wmemset
1.291 +inline wchar_t* wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n)
1.292 +{ return _STLP_wmemcpy(__wdst, __wsrc, __n); }
1.293 +inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
1.294 +{ return _STLP_wmemset(__wdst, __wc, __n); }
1.295 +# elif defined (__DMC__)
1.296 +inline wchar_t* wmemcpy(wchar_t* __RESTRICT __wdst, const wchar_t* __RESTRICT __wsrc, size_t __n)
1.297 +{ return __STATIC_CAST(wchar_t*, memcpy(__wdst, __wsrc, __n * sizeof(wchar_t))); }
1.298 +inline wchar_t* wmemmove(wchar_t* __RESTRICT __wdst, const wchar_t * __RESTRICT __wc, size_t __n)
1.299 +{ return __STATIC_CAST(wchar_t*, memmove(__wdst, __wc, __n * sizeof(wchar_t))); }
1.300 +inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
1.301 +{ for (size_t i = 0; i < __n; i++) __wdst[i] = __wc; return __wdst; }
1.302 +# else
1.303 +using _STLP_VENDOR_CSTD::wmemcpy;
1.304 +using _STLP_VENDOR_CSTD::wmemset;
1.305 +# endif
1.306 +# endif
1.307 +
1.308 +# elif defined (__MWERKS__) && defined (N_PLAT_NLM) /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */
1.309 +using _STLP_VENDOR_CSTD::wcslen;
1.310 +using _STLP_VENDOR_CSTD::wcscmp;
1.311 +using _STLP_VENDOR_CSTD::wcscpy;
1.312 +using _STLP_VENDOR_CSTD::wcsstr;
1.313 +using _STLP_VENDOR_CSTD::wcschr;
1.314 +using _STLP_VENDOR_CSTD::wcsrchr;
1.315 +using _STLP_VENDOR_CSTD::wcspbrk;
1.316 +# endif /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */
1.317 +_STLP_END_NAMESPACE
1.318 +
1.319 +# endif /* _STLP_IMPORT_VENDOR_CSTD */
1.320 +
1.321 +# undef _STLP_WCHAR_SUNPRO_EXCLUDE
1.322 +# undef _STLP_WCHAR_MSL_EXCLUDE
1.323 +
1.324 +# endif /* !defined(_STLP_WCE_EVC3) */
1.325 +
1.326 +#endif /* _STLP_INTERNAL_CWCHAR */