epoc32/include/tools/stlport/stl/_cwchar.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2  * Copyright (c) 1999
     3  * Boris Fomitchev
     4  *
     5  * This material is provided "as is", with absolutely no warranty expressed
     6  * or implied. Any use is at your own risk.
     7  *
     8  * Permission to use or copy this software for any purpose is hereby granted
     9  * without fee, provided the above notices are retained on all copies.
    10  * Permission to modify the code and to distribute modified code is granted,
    11  * provided the above notices are retained, and a notice that the code was
    12  * modified is included with the above copyright notice.
    13  *
    14  */
    15 
    16 #ifndef _STLP_INTERNAL_CWCHAR
    17 #define _STLP_INTERNAL_CWCHAR
    18 
    19 #if defined (_STLP_WCE_EVC3)
    20 #  ifndef _STLP_INTERNAL_MBSTATE_T
    21 #    include <stl/_mbstate_t.h>
    22 #  endif
    23 #else
    24 #  if defined (__GNUC__)
    25 #    include _STLP_NATIVE_CPP_C_HEADER(cstddef)
    26 #  endif
    27 
    28 #  if !defined (_STLP_NO_CWCHAR) && defined (_STLP_USE_NEW_C_HEADERS)
    29 #    include _STLP_NATIVE_CPP_C_HEADER(cwchar)
    30 #    if defined (__OpenBSD__)
    31 typedef _BSD_WINT_T_ wint_t;
    32 #    endif /* __OpenBSD__ */
    33 
    34 #  elif defined (_STLP_NO_WCHAR_T) || defined (__MRC__) || (defined (__SC__) && !defined (__DMC__)) || \
    35        (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) || \
    36         defined (__OpenBSD__) || defined (__FreeBSD__) || \
    37        (defined (__GNUC__) && (defined (__APPLE__) || defined ( __Lynx__ )))
    38 #    include _STLP_NATIVE_C_HEADER(stddef.h)
    39 #    if defined (__Lynx__)
    40 #      ifndef _WINT_T
    41 typedef long int wint_t;
    42 #        define _WINT_T
    43 #      endif /* _WINT_T */
    44 #    endif
    45 #    if defined(__OpenBSD__)
    46 typedef _BSD_WINT_T_ wint_t;
    47 #    endif /* __OpenBSD__ */
    48 #  elif defined (__MWERKS__) && defined (N_PLAT_NLM)
    49 #    include <wchar.h>
    50 #  else
    51 #    include _STLP_NATIVE_C_HEADER(wchar.h)
    52 
    53 #    if defined (__sun) && (defined (_XOPEN_SOURCE) || (_XOPEN_VERSION - 0 == 4))
    54 extern wint_t   btowc();
    55 extern int      fwprintf();
    56 extern int      fwscanf();
    57 extern int      fwide();
    58 extern int      mbsinit();
    59 extern size_t   mbrlen();
    60 extern size_t   mbrtowc();
    61 extern size_t   mbsrtowcs();
    62 extern int      swprintf();
    63 extern int      swscanf();
    64 extern int      vfwprintf();
    65 extern int      vwprintf();
    66 extern int      vswprintf();
    67 extern size_t   wcrtomb();
    68 extern size_t   wcsrtombs();
    69 extern wchar_t  *wcsstr();
    70 extern int      wctob();
    71 extern wchar_t  *wmemchr();
    72 extern int      wmemcmp();
    73 extern wchar_t  *wmemcpy();
    74 extern wchar_t  *wmemmove();
    75 extern wchar_t  *wmemset();
    76 extern int      wprintf();
    77 extern int      wscanf();
    78 #    endif
    79 #  endif
    80 
    81 #  if defined (__MSL__) && (__MSL__ <= 0x51FF)  /* dwa 2/28/99 - not yet implemented by MSL  */
    82 #    define _STLP_WCHAR_MSL_EXCLUDE 1
    83 namespace std {
    84   extern "C" size_t wcsftime(wchar_t * str, size_t max_size, const wchar_t * format_str, const struct tm * timeptr);
    85 }
    86 #    define _STLP_NO_MBSTATE_T 1
    87 #  elif defined (__BORLANDC__)
    88 #    if !defined (_STLP_USE_NO_IOSTREAMS)
    89 #      define _STLP_NO_NATIVE_MBSTATE_T
    90 #    endif
    91 #    define _STLP_WCHAR_BORLAND_EXCLUDE 1
    92 #  endif
    93 
    94 #  ifndef _STLP_INTERNAL_MBSTATE_T
    95 #    include <stl/_mbstate_t.h>
    96 #  endif
    97 
    98 #  if !defined (_STLP_NO_WCHAR_T)
    99 #    ifndef WCHAR_MIN
   100 #      define WCHAR_MIN 0
   101 /* SUNpro has some bugs with casts. wchar_t is size of int there anyway. */
   102 #      if defined (__SUNPRO_CC) || defined (__DJGPP)
   103 #        define WCHAR_MAX (~0)
   104 #      else
   105 #        define WCHAR_MAX ((wchar_t)~0)
   106 #      endif
   107 #    endif
   108 #    if defined (__GNUC__) && defined (__alpha__)
   109 /* Definition of WCHAR_MIN and MAX are wrong for alpha platform
   110  * as gcc consider wchar_t as an unsigned type. Static assertion are
   111  * here to check that a future alpha SDK or a future gcc won't change the
   112  * situation making this workaround useless.
   113  */
   114 _STLP_STATIC_ASSERT(((wchar_t)-1 > 0) && (WCHAR_MIN < 0))
   115 #      undef WCHAR_MIN
   116 #      define WCHAR_MIN 0
   117 #      undef WCHAR_MAX
   118 #      define WCHAR_MAX ((wchar_t)~0)
   119 #    endif
   120 #    if defined(__HP_aCC) && (__HP_aCC >= 60000)
   121 /* Starting with B.11.31, HP-UX/ia64 provides C99-compliant definitions
   122  * of WCHAR_MIN/MAX macros without having to define
   123  * _INCLUDE_STDC__SOURCE_199901 macro (which aCC compiler does not
   124  * predefine). Let STLport provide B.11.31 definitions on any version of
   125  * HP-UX/ia64.
   126  */
   127 #      undef WCHAR_MIN
   128 #      define WCHAR_MIN 0
   129 #      undef WCHAR_MAX
   130 #      define WCHAR_MAX UINT_MAX 
   131 #    endif
   132 #  endif
   133 
   134 #  if defined (_STLP_IMPORT_VENDOR_CSTD)
   135 
   136 #    if defined (__SUNPRO_CC) && !defined (_STLP_HAS_NO_NEW_C_HEADERS)
   137 using _STLP_VENDOR_CSTD::wint_t;
   138 #    endif
   139 
   140 _STLP_BEGIN_NAMESPACE
   141 #    if defined (_STLP_NO_WCHAR_T)
   142 typedef int wint_t;
   143 #    else
   144 // gcc 3.0 has a glitch : wint_t only sucked into the global namespace if _GLIBCPP_USE_WCHAR_T is defined
   145 // __MWERKS__ has definition in wchar_t.h (MSL C++), but ones differ from definition
   146 // in stdio.h; I prefer settings from last file.
   147 #      if (defined (__GNUC__) && ! defined (_GLIBCPP_USE_WCHAR_T)) // || (defined(__MWERKS__) && defined(N_PLAT_NLM))
   148 using ::wint_t;
   149 #      else
   150 using _STLP_VENDOR_CSTD::wint_t;
   151 #      endif
   152 #    endif
   153 
   154 using _STLP_VENDOR_CSTD::size_t;
   155 
   156 #    if !defined (_STLP_NO_NATIVE_MBSTATE_T) && !defined (_STLP_USE_OWN_MBSTATE_T)
   157 using _STLP_VENDOR_MB_NAMESPACE::mbstate_t;
   158 
   159 #      if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && \
   160          (!defined(__MSL__) || __MSL__ > 0x6001)
   161 #        if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \
   162           !(defined (__KCC) || defined (__GNUC__)) && !defined(_STLP_WCE_NET) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
   163 using _STLP_VENDOR_MB_NAMESPACE::btowc;
   164 #          if (!defined(__MSL__) || __MSL__ > 0x7001)
   165 using _STLP_VENDOR_MB_NAMESPACE::mbsinit;
   166 #          endif
   167 #        endif
   168 #        if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \
   169            !defined (__GNUC__) && !defined(_STLP_WCE_NET) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
   170 using _STLP_VENDOR_MB_NAMESPACE::mbrlen;
   171 using _STLP_VENDOR_MB_NAMESPACE::mbrtowc;
   172 using _STLP_VENDOR_MB_NAMESPACE::mbsrtowcs;
   173 using _STLP_VENDOR_MB_NAMESPACE::wcrtomb;
   174 using _STLP_VENDOR_MB_NAMESPACE::wcsrtombs;
   175 #        endif
   176 #      endif /* BORLAND && !__MSL__ || __MSL__ > 0x6001 */
   177 
   178 #    endif /* _STLP_NO_NATIVE_MBSTATE_T */
   179 
   180 #    if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
   181 
   182 #      if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
   183 using _STLP_VENDOR_CSTD::fgetwc;
   184 using _STLP_VENDOR_CSTD::fgetws;
   185 using _STLP_VENDOR_CSTD::fputwc;
   186 using _STLP_VENDOR_CSTD::fputws;
   187 #      endif
   188 
   189 #      if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \
   190             defined(_STLP_WCHAR_HPACC_EXCLUDE) || (defined(__MWERKS__) && defined(N_PLAT_NLM)))
   191 #        if !defined (__DECCXX)
   192 using _STLP_VENDOR_CSTD::fwide;
   193 #        endif
   194 using _STLP_VENDOR_CSTD::fwprintf;
   195 using _STLP_VENDOR_CSTD::fwscanf;
   196 using _STLP_VENDOR_CSTD::getwchar;
   197 #      endif
   198 
   199 #      if !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
   200 #        ifndef _STLP_WCE_NET
   201 using _STLP_VENDOR_CSTD::getwc;
   202 #        endif
   203 using _STLP_VENDOR_CSTD::ungetwc;
   204 #        ifndef _STLP_WCE_NET
   205 using _STLP_VENDOR_CSTD::putwc;
   206 #        endif
   207 using _STLP_VENDOR_CSTD::putwchar;
   208 #      endif
   209 
   210 #      if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \
   211             defined (_STLP_WCHAR_HPACC_EXCLUDE) || (defined (__MWERKS__) && defined (N_PLAT_NLM)))
   212 #        if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB <= 1300) || \
   213             defined (__MINGW32__)
   214 #          undef swprintf
   215 #          define swprintf _snwprintf
   216 #          undef vswprintf
   217 #          define vswprintf _vsnwprintf
   218 using ::swprintf;
   219 using ::vswprintf;
   220 #        else
   221 using _STLP_VENDOR_CSTD::swprintf;
   222 using _STLP_VENDOR_CSTD::vswprintf;
   223 #        endif
   224 using _STLP_VENDOR_CSTD::swscanf;
   225 using _STLP_VENDOR_CSTD::vfwprintf;
   226 using _STLP_VENDOR_CSTD::vwprintf;
   227 
   228 #        if (!defined(__MSL__) || __MSL__ > 0x7001 ) && !defined(_STLP_WCE_NET) && \
   229              !defined(_STLP_USE_UCLIBC) /* at least in uClibc 0.9.26 */
   230 
   231 using _STLP_VENDOR_CSTD::wcsftime;
   232 #        endif
   233 using _STLP_VENDOR_CSTD::wcstok;
   234 
   235 #      endif
   236 
   237 #      if !(defined(__MWERKS__) && defined(N_PLAT_NLM))
   238 #        if !defined (_STLP_WCE_NET)
   239 using _STLP_VENDOR_CSTD::wcscoll;
   240 using _STLP_VENDOR_CSTD::wcsxfrm;
   241 #        endif
   242 using _STLP_VENDOR_CSTD::wcscat;
   243 using _STLP_VENDOR_CSTD::wcsrchr;
   244 using _STLP_VENDOR_CSTD::wcscmp;
   245 
   246 using _STLP_VENDOR_CSTD::wcscpy;
   247 using _STLP_VENDOR_CSTD::wcscspn;
   248 
   249 using _STLP_VENDOR_CSTD::wcslen;
   250 using _STLP_VENDOR_CSTD::wcsncat;
   251 using _STLP_VENDOR_CSTD::wcsncmp;
   252 using _STLP_VENDOR_CSTD::wcsncpy;
   253 using _STLP_VENDOR_CSTD::wcspbrk;
   254 using _STLP_VENDOR_CSTD::wcschr;
   255 
   256 using _STLP_VENDOR_CSTD::wcsspn;
   257 #      endif
   258 
   259 #      if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
   260 using _STLP_VENDOR_CSTD::wcstod;
   261 using _STLP_VENDOR_CSTD::wcstol;
   262 #      endif
   263 
   264 #      if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_HPACC_EXCLUDE) || \
   265             (defined (__MWERKS__) && defined (N_PLAT_NLM)))
   266 using _STLP_VENDOR_CSTD::wcsstr;
   267 using _STLP_VENDOR_CSTD::wmemchr;
   268 
   269 #        if !defined (_STLP_WCHAR_BORLAND_EXCLUDE)
   270 #            if !defined (_STLP_WCE_NET)
   271 using _STLP_VENDOR_CSTD::wctob;
   272 #            endif
   273 #          if !defined (__DMC__)
   274 using _STLP_VENDOR_CSTD::wmemcmp;
   275 using _STLP_VENDOR_CSTD::wmemmove;
   276 #          endif
   277 using _STLP_VENDOR_CSTD::wprintf;
   278 using _STLP_VENDOR_CSTD::wscanf;
   279 #        endif
   280 
   281 #        if defined (__BORLANDC__)
   282 inline wchar_t* _STLP_wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n)
   283 { return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::wmemcpy(__wdst, __wsrc, __n)); }
   284 inline wchar_t* _STLP_wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
   285 { return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::memset(__wdst, __wc, __n)); }
   286 #          undef wmemcpy
   287 #          undef wmemset
   288 inline wchar_t* wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n)
   289 { return _STLP_wmemcpy(__wdst, __wsrc, __n); }
   290 inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
   291 { return _STLP_wmemset(__wdst, __wc, __n); }
   292 #        elif defined (__DMC__)
   293 inline wchar_t* wmemcpy(wchar_t* __RESTRICT __wdst, const wchar_t* __RESTRICT __wsrc, size_t __n)
   294 { return __STATIC_CAST(wchar_t*, memcpy(__wdst, __wsrc, __n * sizeof(wchar_t))); }
   295 inline wchar_t* wmemmove(wchar_t* __RESTRICT __wdst, const wchar_t * __RESTRICT __wc, size_t __n)
   296 { return __STATIC_CAST(wchar_t*, memmove(__wdst, __wc, __n * sizeof(wchar_t))); }
   297 inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
   298 { for (size_t i = 0; i < __n; i++) __wdst[i] = __wc; return __wdst; }
   299 #        else
   300 using _STLP_VENDOR_CSTD::wmemcpy;
   301 using _STLP_VENDOR_CSTD::wmemset;
   302 #        endif
   303 #      endif
   304 
   305 #    elif defined (__MWERKS__) && defined (N_PLAT_NLM) /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */
   306 using _STLP_VENDOR_CSTD::wcslen;
   307 using _STLP_VENDOR_CSTD::wcscmp;
   308 using _STLP_VENDOR_CSTD::wcscpy;
   309 using _STLP_VENDOR_CSTD::wcsstr;
   310 using _STLP_VENDOR_CSTD::wcschr;
   311 using _STLP_VENDOR_CSTD::wcsrchr;
   312 using _STLP_VENDOR_CSTD::wcspbrk;
   313 #    endif /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */
   314 _STLP_END_NAMESPACE
   315 
   316 #  endif /* _STLP_IMPORT_VENDOR_CSTD */
   317 
   318 #  undef _STLP_WCHAR_SUNPRO_EXCLUDE
   319 #  undef _STLP_WCHAR_MSL_EXCLUDE
   320 
   321 #  endif /* !defined(_STLP_WCE_EVC3) */
   322 
   323 #endif /* _STLP_INTERNAL_CWCHAR */