williamr@2: /*
williamr@2:  * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
williamr@2:  * Copyright (c) 1999
williamr@2:  * Boris Fomitchev
williamr@2:  *
williamr@2:  * This material is provided "as is", with absolutely no warranty expressed
williamr@2:  * or implied. Any use is at your own risk.
williamr@2:  *
williamr@2:  * Permission to use or copy this software for any purpose is hereby granted 
williamr@2:  * without fee, provided the above notices are retained on all copies.
williamr@2:  * Permission to modify the code and to distribute modified code is granted,
williamr@2:  * provided the above notices are retained, and a notice that the code was
williamr@2:  * modified is included with the above copyright notice.
williamr@2:  *
williamr@2:  */
williamr@2: 
williamr@2: #ifndef _STLP_CWCHAR_H
williamr@2: # define _STLP_CWCHAR_H
williamr@2: 
williamr@2: #ifndef _STLP_NO_WCHAR_T
williamr@2: #ifdef __cplusplus
williamr@2: # include <cwchar>
williamr@2: #else
williamr@2: # include <wchar.h>
williamr@2: #endif
williamr@2: #endif
williamr@2: 
williamr@2: # if defined (__MRC__) || defined (__SC__) || defined (__BORLANDC__) || defined(__FreeBSD__) || (defined (__GNUC__) && defined (__APPLE__) || defined( __Lynx__ )) || defined (_STLP_NO_WCHAR_T)
williamr@2: 
williamr@2: #ifdef __SYMBIAN32__
williamr@2: #  include <stddef.h>
williamr@2: #else
williamr@2: # include _STLP_NATIVE_C_HEADER(stddef.h)
williamr@2: #endif
williamr@2: #  if defined (__FreeBSD__) || defined (__Lynx__)
williamr@2: #   ifndef _WINT_T
williamr@2: typedef long int wint_t;
williamr@2: #    define _WINT_T
williamr@2: #   endif /* _WINT_T */
williamr@2: #  endif
williamr@2: # endif
williamr@2: 
williamr@2: # if defined ( _STLP_OWN_IOSTREAMS ) && defined (_STLP_NO_NATIVE_MBSTATE_T) && ! defined (_STLP_NO_MBSTATE_T) && ! defined (_MBSTATE_T) && ! defined (__mbstate_t_defined)
williamr@2: #  define _STLP_USE_OWN_MBSTATE_T
williamr@2: #  define _MBSTATE_T
williamr@2: # endif
williamr@2: 
williamr@2: # ifdef _STLP_USE_OWN_MBSTATE_T
williamr@2: 
williamr@2: #ifndef __SYMBIAN32__ //no more using the structure __stl_mbstate_t. usinfg _mb_state_t from _types.h.
williamr@2: // to be compatible across different SUN platforms
williamr@2: #ifdef __sun
williamr@2: # define __stl_mbstate_t __mbstate_t
williamr@2: #endif
williamr@2: 
williamr@2: struct __stl_mbstate_t;
williamr@2: 
williamr@2: # ifdef __cplusplus
williamr@2: struct __stl_mbstate_t { 
williamr@2:   __stl_mbstate_t( long __st = 0 ) { _M_state[0] = __st ; }
williamr@2:   __stl_mbstate_t& operator=(const long __st) {
williamr@2:     _M_state[0] = __st;              
williamr@2:     return *this;
williamr@2:   } 
williamr@2:   __stl_mbstate_t(const __stl_mbstate_t& __x) {_M_state[0]= __x._M_state[0]; }         
williamr@2:   __stl_mbstate_t& operator=(const __stl_mbstate_t& __x) {
williamr@2:     _M_state[0]= __x._M_state[0];              
williamr@2:     return *this;
williamr@2:   }
williamr@2: # if defined (__sun)
williamr@2: #  ifdef _LP64
williamr@2:   long _M_state[4];
williamr@2: #  else
williamr@2:   int _M_state[6];
williamr@2: #  endif
williamr@2: # else       
williamr@2:   long _M_state[1];
williamr@2: # endif
williamr@2: };          
williamr@2: 
williamr@2: inline bool operator==(const __stl_mbstate_t& __x, const __stl_mbstate_t& __y) {
williamr@2:   return ( __x._M_state[0] == __y._M_state[0] );
williamr@2: }
williamr@2: 
williamr@2: inline bool operator!=(const __stl_mbstate_t& __x, const __stl_mbstate_t& __y) {
williamr@2:   return ( __x._M_state[0] == __y._M_state[0] );
williamr@2: }
williamr@2: # endif
williamr@2: 
williamr@2: 
williamr@2: #endif //#if __SYMBIAN32__
williamr@2: _STLP_BEGIN_NAMESPACE
williamr@2: //typedef __mbstate_t __stl_mbstate_t;
williamr@2: //typedef __mbstate_t mbstate_t;
williamr@2: 
williamr@2: _STLP_END_NAMESPACE
williamr@2: 
williamr@2: # endif /* _STLP_USE_OWN_MBSTATE_T */
williamr@2: 
williamr@2: #if !defined (_STLP_NO_WCHAR_T)
williamr@2: # ifndef WCHAR_MIN
williamr@2: #  define WCHAR_MIN 0
williamr@2: // SUNpro has some bugs with casts. wchar_t is size of int there anyway.
williamr@2: #  if defined (__SUNPRO_CC) || defined (__DJGPP)
williamr@2: #   define WCHAR_MAX (~0)
williamr@2: #  else
williamr@2: #   define WCHAR_MAX ((wchar_t)~0)
williamr@2: #  endif
williamr@2: # endif
williamr@2: #endif
williamr@2: 
williamr@2: # if defined  (_STLP_IMPORT_VENDOR_CSTD) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
williamr@2: _STLP_BEGIN_NAMESPACE  
williamr@2: using namespace _STLP_VENDOR_CSTD;
williamr@2: _STLP_END_NAMESPACE
williamr@2: #endif /* _STLP_IMPORT_VENDOR_CSTD */
williamr@2: 
williamr@2: #endif /* _STLP_CWCHAR_H */
williamr@2: