epoc32/include/stdapis/stlportv5/stl/_time_facets.c
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/stdapis/stlportv5/stl/_time_facets.c	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_time_facets.c	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,135 +1,194 @@
     1.4  /*
     1.5 - * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
     1.6 + * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
     1.7   *
     1.8   * Copyright (c) 1999
     1.9   * Silicon Graphics Computer Systems, Inc.
    1.10   *
    1.11 - * Copyright (c) 1999 
    1.12 + * Copyright (c) 1999
    1.13   * Boris Fomitchev
    1.14   *
    1.15   * This material is provided "as is", with absolutely no warranty expressed
    1.16   * or implied. Any use is at your own risk.
    1.17   *
    1.18 - * Permission to use or copy this software for any purpose is hereby granted 
    1.19 + * Permission to use or copy this software for any purpose is hereby granted
    1.20   * without fee, provided the above notices are retained on all copies.
    1.21   * Permission to modify the code and to distribute modified code is granted,
    1.22   * provided the above notices are retained, and a notice that the code was
    1.23   * modified is included with the above copyright notice.
    1.24   *
    1.25 - */ 
    1.26 + */
    1.27  #ifndef _STLP_TIME_FACETS_C
    1.28  #define _STLP_TIME_FACETS_C
    1.29  
    1.30  #ifndef _STLP_INTERNAL_TIME_FACETS_H
    1.31 -# include <stl/_time_facets.h>
    1.32 +#  include <stl/_time_facets.h>
    1.33  #endif
    1.34  
    1.35 -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
    1.36 -
    1.37  #ifndef _STLP_INTERNAL_NUM_PUT_H
    1.38 -# include <stl/_num_put.h>
    1.39 +#  include <stl/_num_put.h>
    1.40  #endif
    1.41  
    1.42  #ifndef _STLP_INTERNAL_NUM_GET_H
    1.43 -# include <stl/_num_get.h>
    1.44 +#  include <stl/_num_get.h>
    1.45  #endif
    1.46  
    1.47  _STLP_BEGIN_NAMESPACE
    1.48  
    1.49  //----------------------------------------------------------------------
    1.50  // Declarations of static template members.
    1.51 -# if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
    1.52 -# if !defined(__LIBSTD_CPP_SYMBIAN32_WSD__) && !defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
    1.53 +#if (_STLP_STATIC_TEMPLATE_DATA > 0)
    1.54 +# if !defined(__SYMBIAN32__WSD__) 
    1.55 +#  if !defined (__BORLANDC__)  &&  (defined (__SYMBIAN32__) && defined(_STLP_DESIGNATED_DLL))
    1.56  template <class _CharT, class _InputIterator>
    1.57  locale::id time_get<_CharT, _InputIterator>::id;
    1.58  
    1.59  template <class _CharT, class _OutputIterator>
    1.60  locale::id time_put<_CharT, _OutputIterator>::id;
    1.61 -#endif
    1.62 +#  endif
    1.63  
    1.64 -# else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
    1.65 +#  if ((defined (__CYGWIN__) || defined (__MINGW32__)) && \
    1.66 +       defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)) || (defined (__SYMBIAN32__) && defined(_STLP_DESIGNATED_DLL))
    1.67 +/*
    1.68 + * Under cygwin, when STLport is used as a shared library, the id needs
    1.69 + * to be specified as imported otherwise they will be duplicated in the
    1.70 + * calling executable.
    1.71 + */
    1.72 +#      if defined (__SYMBIAN32__)
    1.73 +template <>
    1.74 +locale::id time_get<char, istreambuf_iterator<char, char_traits<char> > >::id; //_STLP_DECLSPEC removed. data should not be exported in symbian
    1.75 +/*
    1.76 +template <>
    1.77 +_STLP_DECLSPEC locale::id time_get<char, const char*>::id; 
    1.78 +*/
    1.79  
    1.80 -typedef time_get<char, const char*> time_get_char;
    1.81 -typedef time_get<char, char*> time_get_char_2;
    1.82 -typedef time_get<char, istreambuf_iterator<char, char_traits<char> > > time_get_char_3;
    1.83 -typedef time_put<char, const char*> time_put_char;
    1.84 -typedef time_put<char, char*> time_put_char_2;
    1.85 -typedef time_put<char, ostreambuf_iterator<char, char_traits<char> > > time_put_char_3;
    1.86 +template <>
    1.87 +locale::id time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
    1.88 +/*
    1.89 +template <>
    1.90 +_STLP_DECLSPEC locale::id time_put<char, char*>::id;
    1.91 +*/
    1.92  
    1.93 -#ifndef __SYMBIAN32__
    1.94 -__DECLARE_INSTANCE(locale::id, time_get_char::id, );
    1.95 +#      ifndef _STLP_NO_WCHAR_T
    1.96 +template <>
    1.97 +locale::id time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
    1.98 +/*
    1.99 +template <>
   1.100 +_STLP_DECLSPEC locale::id time_get<wchar_t, const wchar_t*>::id;
   1.101 +*/
   1.102 +
   1.103 +template <>
   1.104 +locale::id time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
   1.105 +/*
   1.106 +template <>
   1.107 +_STLP_DECLSPEC locale::id time_put<wchar_t, wchar_t*>::id;
   1.108 +*/
   1.109 +#        endif /* _STLP_NO_WCHAR_T */
   1.110 +
   1.111 +#      else
   1.112 +template <>
   1.113 +_STLP_DECLSPEC locale::id time_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
   1.114 +/*
   1.115 +template <>
   1.116 +_STLP_DECLSPEC locale::id time_get<char, const char*>::id;
   1.117 +*/
   1.118 +
   1.119 +template <>
   1.120 +_STLP_DECLSPEC locale::id time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
   1.121 +/*
   1.122 +template <>
   1.123 +_STLP_DECLSPEC locale::id time_put<char, char*>::id;
   1.124 +*/
   1.125 +
   1.126 +#    ifndef _STLP_NO_WCHAR_T
   1.127 +template <>
   1.128 +_STLP_DECLSPEC locale::id time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
   1.129 +/*
   1.130 +template <>
   1.131 +_STLP_DECLSPEC locale::id time_get<wchar_t, const wchar_t*>::id;
   1.132 +*/
   1.133 +
   1.134 +template <>
   1.135 +_STLP_DECLSPEC locale::id time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
   1.136 +/*
   1.137 +template <>
   1.138 +_STLP_DECLSPEC locale::id time_put<wchar_t, wchar_t*>::id;
   1.139 +*/
   1.140 +#        endif /* _STLP_NO_WCHAR_T */
   1.141 +
   1.142 +#      endif //__SYMBIAN32__
   1.143 +#    endif /* _STLP_NO_WCHAR_T */
   1.144 +#  endif /* __CUGWIN__ && _STLP_USE_DYNAMIC_LIB */
   1.145 +
   1.146 +#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
   1.147 +
   1.148 +//typedef time_get<char, const char*> time_get_char;
   1.149 +typedef time_get<char, istreambuf_iterator<char, char_traits<char> > > time_get_char_2;
   1.150 +//typedef time_put<char, char*> time_put_char;
   1.151 +typedef time_put<char, ostreambuf_iterator<char, char_traits<char> > > time_put_char_2;
   1.152 +
   1.153 +//__DECLARE_INSTANCE(locale::id, time_get_char::id, );
   1.154  __DECLARE_INSTANCE(locale::id, time_get_char_2::id, );
   1.155 -__DECLARE_INSTANCE(locale::id, time_get_char_3::id, );
   1.156 -__DECLARE_INSTANCE(locale::id, time_put_char::id, );
   1.157 +//__DECLARE_INSTANCE(locale::id, time_put_char::id, );
   1.158  __DECLARE_INSTANCE(locale::id, time_put_char_2::id, );
   1.159 -__DECLARE_INSTANCE(locale::id, time_put_char_3::id, );
   1.160 -#endif
   1.161  
   1.162 -# ifndef _STLP_NO_WCHAR_T
   1.163 +#  if !defined (_STLP_NO_WCHAR_T)
   1.164  
   1.165 -typedef time_get<wchar_t, const wchar_t*> time_get_wchar_t;
   1.166 -typedef time_get<wchar_t, wchar_t*> time_get_wchar_t_2;
   1.167 -typedef time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > time_get_wchar_t_3;
   1.168 -typedef time_put<wchar_t, const wchar_t*> time_put_wchar_t;
   1.169 -typedef time_put<wchar_t, wchar_t*> time_put_wchar_t_2;
   1.170 -typedef time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > time_put_wchar_t_3;
   1.171 +//typedef time_get<wchar_t, const wchar_t*> time_get_wchar_t;
   1.172 +typedef time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > time_get_wchar_t_2;
   1.173 +//typedef time_put<wchar_t, wchar_t*> time_put_wchar_t;
   1.174 +typedef time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > time_put_wchar_t_2;
   1.175  
   1.176 -#ifndef __SYMBIAN32__
   1.177 -__DECLARE_INSTANCE(locale::id, time_get_wchar_t::id, );
   1.178 +//__DECLARE_INSTANCE(locale::id, time_get_wchar_t::id, );
   1.179  __DECLARE_INSTANCE(locale::id, time_get_wchar_t_2::id, );
   1.180 -__DECLARE_INSTANCE(locale::id, time_get_wchar_t_3::id, );
   1.181 -__DECLARE_INSTANCE(locale::id, time_put_wchar_t::id, );
   1.182 +//__DECLARE_INSTANCE(locale::id, time_put_wchar_t::id, );
   1.183  __DECLARE_INSTANCE(locale::id, time_put_wchar_t_2::id, );
   1.184 -__DECLARE_INSTANCE(locale::id, time_put_wchar_t_3::id, );
   1.185 -#endif
   1.186  
   1.187 -# endif
   1.188 +#  endif
   1.189  
   1.190 -# endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
   1.191 +#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
   1.192  
   1.193 -template <class _InIt, class _RAIt, class _DiffType>
   1.194 -_RAIt _STLP_CALL
   1.195 -__match(_InIt& __first, _InIt& __last, _RAIt __name, _RAIt __name_end, _DiffType*) {
   1.196 -  typedef _DiffType difference_type;
   1.197 +_STLP_MOVE_TO_PRIV_NAMESPACE
   1.198 +
   1.199 +template <class _InIt, class _CharT>
   1.200 +const string* _STLP_CALL
   1.201 +__match(_InIt& __first, _InIt& __last, const string *__name, const string *__name_end,
   1.202 +        const ctype<_CharT>& __ct) {
   1.203 +  typedef ptrdiff_t difference_type;
   1.204    difference_type __n = __name_end - __name;
   1.205 -  size_t __max_pos = 0;
   1.206    difference_type __i;
   1.207 -  difference_type __pos = 0;
   1.208 +  size_t __pos = 0;
   1.209    difference_type __check_count = __n;
   1.210    bool __do_check[_MAXNAMES];
   1.211 -  _RAIt __matching_name[_MAX_NAME_LENGTH];
   1.212 -
   1.213 -  for (__i = 0; __i < __n; ++__i)
   1.214 -    __max_pos = (max)(__max_pos,  __name[__i].size());
   1.215 +  const string* __matching_name[_MAX_NAME_LENGTH];
   1.216  
   1.217    for (__i = 0; __i < _MAXNAMES; ++__i)
   1.218      __do_check[__i] = true;
   1.219  
   1.220 -
   1.221 -
   1.222    for (__i = 0; __i < _MAX_NAME_LENGTH; ++__i)
   1.223      __matching_name[__i] = __name_end;
   1.224  
   1.225    while (__first != __last) {
   1.226 -    for (__i = 0; __i < __n; ++__i)
   1.227 -      if (__do_check[__i])
   1.228 -        if (*__first == __name[__i][__pos]) {
   1.229 -          if (__pos == _DiffType(__name[__i].size()) - 1) {
   1.230 +    for (__i = 0; __i < __n; ++__i) {
   1.231 +      if (__do_check[__i]) {
   1.232 +        if (*__first == __ct.widen(__name[__i][__pos])) {
   1.233 +          if (__pos == (__name[__i].size() - 1)) {
   1.234              __do_check[__i] = 0;
   1.235 -            __matching_name[__pos+1] = __name + __i;
   1.236 +            __matching_name[__pos + 1] = __name + __i;
   1.237              --__check_count;
   1.238              if (__check_count == 0) {
   1.239 -              ++__first; 
   1.240 -	      return __name + __i;
   1.241 -	    }
   1.242 +              ++__first;
   1.243 +              return __name + __i;
   1.244 +            }
   1.245            }
   1.246          }
   1.247          else {
   1.248            __do_check[__i] = 0;
   1.249            --__check_count;
   1.250 -          if (__check_count == 0) 
   1.251 +          if (__check_count == 0)
   1.252              return __matching_name[__pos];
   1.253          }
   1.254 +      }
   1.255 +    }
   1.256  
   1.257      ++__first; ++__pos;
   1.258    }
   1.259 @@ -137,12 +196,6 @@
   1.260    return __matching_name[__pos];
   1.261  }
   1.262  
   1.263 -template <class _InIt, class _RAIt>
   1.264 -_RAIt _STLP_CALL
   1.265 -__match(_InIt& __first, _InIt& __last, _RAIt __name, _RAIt __name_end) {
   1.266 -  return __match((_InIt&)__first, (_InIt&)__last, __name, __name_end, _STLP_DISTANCE_TYPE(__name, _InIt));
   1.267 -}
   1.268 -
   1.269  // __get_formatted_time reads input that is assumed to be formatted
   1.270  // according to the rules for the C strftime function (C standard,
   1.271  // 7.12.3.5).  This function is used to implement the do_get_time
   1.272 @@ -164,133 +217,132 @@
   1.273  
   1.274  // Note that the antepenultimate parameter is being used only to determine
   1.275  // the correct overloading for the calls to __get_integer_nogroup.
   1.276 -
   1.277 -template <class _InIt1, class _InIt2 /* , class _Ch */ >
   1.278 -_InIt2 _STLP_CALL
   1.279 +template <class _InIt1, class _Ch>
   1.280 +string::const_iterator _STLP_CALL
   1.281  __get_formatted_time _STLP_WEAK (_InIt1 __first,  _InIt1 __last,
   1.282 -                     _InIt2 __format, _InIt2 __format_end,
   1.283 -				 /* _Ch, */ const _Time_Info& __table,
   1.284 -		     ios_base::iostate& __err,
   1.285 -                     tm*         __t) {
   1.286 -  while(__first != __last && __format != __format_end) {
   1.287 +                                 string::const_iterator __format, string::const_iterator __format_end,
   1.288 +                                 _Ch*, const _Time_Info& __table,
   1.289 +                                 const ios_base& __s, ios_base::iostate& __err, tm* __t) {
   1.290 +  const ctype<_Ch>& __ct = *__STATIC_CAST(const ctype<_Ch>*, __s._M_ctype_facet());
   1.291 +  while (__first != __last && __format != __format_end) {
   1.292      if (*__format == '%') {
   1.293        ++__format;
   1.294        char __c = *__format;
   1.295 +      if (__c == '#') { //MS extension
   1.296 +        ++__format;
   1.297 +        __c = *__format;
   1.298 +      }
   1.299 +
   1.300        switch (__c) {
   1.301          case 'a': {
   1.302 -          const string* __pr =
   1.303 -            __match(__first, __last,
   1.304 -		    (string*)__table._M_dayname + 0 , (string*)__table._M_dayname + 7);
   1.305 -            if (__pr == (string*)__table._M_dayname + 7)
   1.306 -              return __format;
   1.307 -            __t->tm_wday = (int)(__pr - (string*)__table._M_dayname);
   1.308 -            break;
   1.309 +          const string* __pr = __match(__first, __last,
   1.310 +                                       __table._M_dayname + 0, __table._M_dayname + 7,
   1.311 +                                       __ct);
   1.312 +          if (__pr == __table._M_dayname + 7)
   1.313 +            return __format;
   1.314 +          __t->tm_wday = __STATIC_CAST(int, __pr - __table._M_dayname);
   1.315 +          break;
   1.316          }
   1.317  
   1.318          case 'A': {
   1.319 -          const string* __pr =
   1.320 -            __match(__first, __last,
   1.321 -		    (string*)__table._M_dayname + 7, (string*)__table._M_dayname + 14);
   1.322 -            if (__pr == (string*)__table._M_dayname + 14)
   1.323 -              return __format;
   1.324 -            __t->tm_wday = (int)(__pr - (string*)__table._M_dayname - 7);
   1.325 -            break;
   1.326 +          const string* __pr = __match(__first, __last,
   1.327 +                                       __table._M_dayname + 7, __table._M_dayname + 14,
   1.328 +                                       __ct);
   1.329 +          if (__pr == __table._M_dayname + 14)
   1.330 +            return __format;
   1.331 +          __t->tm_wday = __STATIC_CAST(int, __pr - __table._M_dayname - 7);
   1.332 +          break;
   1.333          }
   1.334  
   1.335          case 'b': {
   1.336 -          const string* __pr =
   1.337 -            __match(__first, __last,
   1.338 -		    (string*)__table._M_monthname + 0, (string*)__table._M_monthname + 12);
   1.339 -            if (__pr == (string*)__table._M_monthname + 12)
   1.340 -              return __format;
   1.341 -            __t->tm_mon = (int)(__pr - (string*)__table._M_monthname);
   1.342 -            break;
   1.343 +          const string* __pr = __match(__first, __last,
   1.344 +                                       __table._M_monthname + 0, __table._M_monthname + 12,
   1.345 +                                       __ct);
   1.346 +          if (__pr == __table._M_monthname + 12)
   1.347 +            return __format;
   1.348 +          __t->tm_mon = __STATIC_CAST(int, __pr - __table._M_monthname);
   1.349 +          break;
   1.350          }
   1.351  
   1.352          case 'B': {
   1.353 -          const string* __pr =
   1.354 -            __match(__first, __last,
   1.355 -		    (string*)__table._M_monthname + 12, (string*)__table._M_monthname + 24);
   1.356 -            if (__pr == (string*)__table._M_monthname + 24)
   1.357 -              return __format;
   1.358 -            __t->tm_mon = (int)(__pr - (string*)__table._M_monthname - 12);
   1.359 -            break;
   1.360 +          const string* __pr = __match(__first, __last,
   1.361 +                                       __table._M_monthname + 12, __table._M_monthname + 24,
   1.362 +                                       __ct);
   1.363 +          if (__pr == __table._M_monthname + 24)
   1.364 +            return __format;
   1.365 +          __t->tm_mon = __STATIC_CAST(int, __pr - __table._M_monthname - 12);
   1.366 +          break;
   1.367          }
   1.368  
   1.369          case 'd': {
   1.370 -          bool __pr =
   1.371 -            __get_decimal_integer(__first, __last, __t->tm_mday);
   1.372 +          bool __pr = __get_decimal_integer(__first, __last, __t->tm_mday, __STATIC_CAST(_Ch*, 0));
   1.373            if (!__pr || __t->tm_mday < 1 || __t->tm_mday > 31) {
   1.374 -	    __err |= ios_base::failbit;
   1.375 +            __err |= ios_base::failbit;
   1.376              return __format;
   1.377 -	  }
   1.378 +          }
   1.379            break;
   1.380          }
   1.381 -        
   1.382 +
   1.383          case 'H': case 'I': {
   1.384 -          bool __pr =
   1.385 -            __get_decimal_integer(__first, __last, __t->tm_hour);
   1.386 -            if (!__pr)
   1.387 -              return __format;
   1.388 -            break;
   1.389 +          bool __pr = __get_decimal_integer(__first, __last, __t->tm_hour, __STATIC_CAST(_Ch*, 0));
   1.390 +          if (!__pr)
   1.391 +            return __format;
   1.392 +          break;
   1.393          }
   1.394  
   1.395          case 'j': {
   1.396 -          bool __pr =
   1.397 -            __get_decimal_integer(__first, __last, __t->tm_yday);
   1.398 +          bool __pr = __get_decimal_integer(__first, __last, __t->tm_yday, __STATIC_CAST(_Ch*, 0));
   1.399            if (!__pr)
   1.400              return __format;
   1.401            break;
   1.402          }
   1.403  
   1.404          case 'm': {
   1.405 -          bool __pr =
   1.406 -            __get_decimal_integer(__first, __last, __t->tm_mon);
   1.407 -	    --__t->tm_mon;
   1.408 +          bool __pr = __get_decimal_integer(__first, __last, __t->tm_mon, __STATIC_CAST(_Ch*, 0));
   1.409 +          --__t->tm_mon;
   1.410            if (!__pr || __t->tm_mon < 0 || __t->tm_mon > 11) {
   1.411 -	    __err |= ios_base::failbit;
   1.412 +            __err |= ios_base::failbit;
   1.413              return __format;
   1.414 -	  }
   1.415 +          }
   1.416            break;
   1.417          }
   1.418  
   1.419          case 'M': {
   1.420 -          bool __pr =
   1.421 -            __get_decimal_integer(__first, __last, __t->tm_min);
   1.422 +          bool __pr = __get_decimal_integer(__first, __last, __t->tm_min, __STATIC_CAST(_Ch*, 0));
   1.423            if (!__pr)
   1.424              return __format;
   1.425            break;
   1.426          }
   1.427  
   1.428          case 'p': {
   1.429 -          const string* __pr =
   1.430 -            __match(__first, __last, (string*)__table._M_am_pm + 0, (string*)__table._M_am_pm + 2);
   1.431 -          if (__pr == (string*)__table._M_am_pm + 2)
   1.432 +          const string* __pr = __match(__first, __last,
   1.433 +                                       __table._M_am_pm + 0, __table._M_am_pm + 2, __ct);
   1.434 +          if (__pr == __table._M_am_pm + 2)
   1.435              return __format;
   1.436 -          if (__pr == (string*)__table._M_am_pm + 1)
   1.437 +          // 12:00 PM <=> 12:00, 12:00 AM <=> 00:00
   1.438 +          if (__pr == __table._M_am_pm + 1 && __t->tm_hour != 12 )
   1.439              __t->tm_hour += 12;
   1.440 +          if (__pr == __table._M_am_pm && __t->tm_hour == 12 )
   1.441 +            __t->tm_hour = 0;
   1.442            break;
   1.443          }
   1.444  
   1.445          case 'S': {
   1.446 -          bool __pr =
   1.447 -            __get_decimal_integer(__first, __last, __t->tm_sec);
   1.448 +          bool __pr = __get_decimal_integer(__first, __last, __t->tm_sec, __STATIC_CAST(_Ch*, 0));
   1.449            if (!__pr)
   1.450              return __format;
   1.451            break;
   1.452          }
   1.453  
   1.454 -	case 'y': {
   1.455 -	  bool __pr =
   1.456 -	    __get_decimal_integer(__first, __last, __t->tm_year);
   1.457 -	  if (!__pr)
   1.458 -	    return __format;
   1.459 -	  break;
   1.460 +        case 'y': {
   1.461 +          bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0));
   1.462 +          if (!__pr)
   1.463 +            return __format;
   1.464 +          break;
   1.465          }
   1.466  
   1.467          case 'Y': {
   1.468 -	  bool __pr =
   1.469 -            __get_decimal_integer(__first, __last, __t->tm_year);
   1.470 +          bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0));
   1.471            __t->tm_year -= 1900;
   1.472            if (!__pr)
   1.473              return __format;
   1.474 @@ -300,86 +352,67 @@
   1.475          default:
   1.476            break;
   1.477        }
   1.478 -
   1.479      }
   1.480      else {
   1.481 -      if (*__first != *__format) 
   1.482 -	  	break;
   1.483 -	 __first++;
   1.484 +      if (*__first++ != __ct.widen(*__format)) break;
   1.485      }
   1.486 -    
   1.487 +
   1.488      ++__format;
   1.489    }
   1.490  
   1.491    return __format;
   1.492  }
   1.493  
   1.494 -template <class _InIt>
   1.495 +template <class _InIt, class _CharT>
   1.496  bool _STLP_CALL
   1.497 -__get_short_or_long_dayname(_InIt& __first, _InIt& __last,
   1.498 +__get_short_or_long_dayname(_InIt& __first, _InIt& __last, const ctype<_CharT>& __ct,
   1.499                              const _Time_Info& __table, tm* __t) {
   1.500    const string* __pr =
   1.501 -    __match(__first, __last, __table._M_dayname + 0, __table._M_dayname + 14);
   1.502 -  __t->tm_wday = (int)(__pr - __table._M_dayname) % 7;
   1.503 +    __match(__first, __last, __table._M_dayname + 0, __table._M_dayname + 14, __ct);
   1.504 +  __t->tm_wday = __STATIC_CAST(int, (__pr - __table._M_dayname) % 7);
   1.505    return __pr != __table._M_dayname + 14;
   1.506  }
   1.507  
   1.508 -template <class _InIt>
   1.509 +template <class _InIt, class _CharT>
   1.510  bool _STLP_CALL
   1.511 -__get_short_or_long_monthname(_InIt& __first, _InIt& __last,
   1.512 +__get_short_or_long_monthname(_InIt& __first, _InIt& __last, const ctype<_CharT>& __ct,
   1.513                                const _Time_Info& __table, tm* __t) {
   1.514    const string* __pr =
   1.515 -    __match(__first, __last, (string*)__table._M_monthname + 0, (string*)__table._M_monthname + 24);
   1.516 -  __t->tm_mon = (int)(__pr - __table._M_monthname) % 12;
   1.517 +    __match(__first, __last, __table._M_monthname + 0, __table._M_monthname + 24, __ct);
   1.518 +  __t->tm_mon = __STATIC_CAST(int, (__pr - __table._M_monthname) % 12);
   1.519    return __pr != __table._M_monthname + 24;
   1.520  }
   1.521  
   1.522 -# ifndef _STLP_NO_WCHAR_T
   1.523 +#if !defined (_STLP_NO_WCHAR_T)
   1.524  template <class _OuIt>
   1.525  _OuIt _STLP_CALL
   1.526 -__put_time(char * __first, char * __last, _OuIt __stl_out,
   1.527 +__put_time(char * __first, char * __last, _OuIt __out_ite,
   1.528             const ios_base& __s, wchar_t) {
   1.529 -    //const ctype<wchar_t>& __ct = *(ctype<wchar_t>*)__s._M_ctype_facet();
   1.530 -    const ctype<wchar_t>& __ct = use_facet< ctype<wchar_t> >(__s.getloc());
   1.531 +    const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __s._M_ctype_facet());
   1.532      wchar_t __wbuf[64];
   1.533      __ct.widen(__first, __last, __wbuf);
   1.534      ptrdiff_t __len = __last - __first;
   1.535      wchar_t * __eend = __wbuf + __len;
   1.536 -    return copy((wchar_t*)__wbuf, __eend, __stl_out);
   1.537 +    return copy((wchar_t*)__wbuf, __eend, __out_ite);
   1.538  }
   1.539 -# endif
   1.540 +#endif
   1.541  
   1.542 -#ifdef	__SYMBIAN32__
   1.543 -template <class _CharT, class _OuIt>
   1.544 -_OuIt _STLP_CALL
   1.545 -__put_time(char * __first, char * __last, _OuIt __stl_out,
   1.546 -           const ios_base& __s, _CharT) {
   1.547 -    //const ctype<wchar_t>& __ct = *(ctype<wchar_t>*)__s._M_ctype_facet();
   1.548 -    const ctype<_CharT>& __ct = use_facet< ctype<_CharT> >(__s.getloc());
   1.549 -    _CharT __wbuf[64];
   1.550 -    __ct.widen(__first, __last, __wbuf);
   1.551 -    ptrdiff_t __len = __last - __first;
   1.552 -    _CharT * __eend = __wbuf + __len;
   1.553 -    return copy((_CharT*)__wbuf, __eend, __stl_out);
   1.554 -}
   1.555 +_STLP_MOVE_TO_STD_NAMESPACE
   1.556  
   1.557 -#endif
   1.558  template <class _Ch, class _InIt>
   1.559  _InIt
   1.560  time_get<_Ch, _InIt>::do_get_date(_InIt __s, _InIt  __end,
   1.561 -				  ios_base& /* __str */, ios_base::iostate&  __err,
   1.562 -				  tm* __t) const 
   1.563 -{
   1.564 +                                  ios_base& __str, ios_base::iostate&  __err,
   1.565 +                                  tm* __t) const {
   1.566    typedef string::const_iterator string_iterator;
   1.567  
   1.568 -  string_iterator __format
   1.569 -    = _M_timeinfo._M_date_format.begin();
   1.570 -  string_iterator __format_end
   1.571 -    = _M_timeinfo._M_date_format.end();
   1.572 -  
   1.573 +  string_iterator __format = _M_timeinfo._M_date_format.begin();
   1.574 +  string_iterator __format_end = _M_timeinfo._M_date_format.end();
   1.575 +
   1.576    string_iterator __result
   1.577 -    = __get_formatted_time(__s, __end, __format, __format_end,
   1.578 -                           /* _Ch() ,*/  _M_timeinfo, __err, __t);
   1.579 +    = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end,
   1.580 +                                      __STATIC_CAST(_Ch*, 0), _M_timeinfo,
   1.581 +                                      __str, __err, __t);
   1.582    if (__result == __format_end)
   1.583      __err = ios_base::goodbit;
   1.584    else {
   1.585 @@ -393,20 +426,18 @@
   1.586  template <class _Ch, class _InIt>
   1.587  _InIt
   1.588  time_get<_Ch, _InIt>::do_get_time(_InIt __s, _InIt  __end,
   1.589 -				  ios_base& /* __str */, ios_base::iostate&  __err,
   1.590 -				  tm* __t) const 
   1.591 -{
   1.592 +                                  ios_base& __str, ios_base::iostate&  __err,
   1.593 +                                  tm* __t) const {
   1.594    typedef string::const_iterator string_iterator;
   1.595 -  string_iterator __format
   1.596 -    = _M_timeinfo._M_time_format.begin();
   1.597 -  string_iterator __format_end
   1.598 -    = _M_timeinfo._M_time_format.end();
   1.599 -  
   1.600 +  string_iterator __format = _M_timeinfo._M_time_format.begin();
   1.601 +  string_iterator __format_end = _M_timeinfo._M_time_format.end();
   1.602 +
   1.603    string_iterator __result
   1.604 -    = __get_formatted_time(__s, __end, __format, __format_end,
   1.605 -			   /* _Ch() , */ _M_timeinfo, __err, __t);
   1.606 -  __err = __result == __format_end ? ios_base::goodbit 
   1.607 -    : ios_base::failbit;
   1.608 +    = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end,
   1.609 +                                      __STATIC_CAST(_Ch*, 0), _M_timeinfo,
   1.610 +                                      __str, __err, __t);
   1.611 +  __err = __result == __format_end ? ios_base::goodbit
   1.612 +                                   : ios_base::failbit;
   1.613    if (__s == __end)
   1.614      __err |= ios_base::eofbit;
   1.615    return __s;
   1.616 @@ -415,53 +446,48 @@
   1.617  template <class _Ch, class _InIt>
   1.618  _InIt
   1.619  time_get<_Ch, _InIt>::do_get_year(_InIt __s, _InIt  __end,
   1.620 -				  ios_base&, 
   1.621 -				  ios_base::iostate&  __err,
   1.622 -				  tm* __t) const
   1.623 -{
   1.624 -  
   1.625 +                                  ios_base&, ios_base::iostate&  __err,
   1.626 +                                  tm* __t) const {
   1.627    if (__s == __end) {
   1.628      __err = ios_base::failbit | ios_base::eofbit;
   1.629      return __s;
   1.630    }
   1.631 -  
   1.632 -  bool __pr =  __get_decimal_integer(__s, __end, __t->tm_year);
   1.633 +
   1.634 +  bool __pr =  _STLP_PRIV __get_decimal_integer(__s, __end, __t->tm_year, __STATIC_CAST(_Ch*, 0));
   1.635    __t->tm_year -= 1900;
   1.636    __err = __pr ? ios_base::goodbit : ios_base::failbit;
   1.637    if (__s == __end)
   1.638      __err |= ios_base::eofbit;
   1.639 -  
   1.640 +
   1.641    return __s;
   1.642  }
   1.643  
   1.644  template <class _Ch, class _InIt>
   1.645  _InIt
   1.646  time_get<_Ch, _InIt>::do_get_weekday(_InIt __s, _InIt  __end,
   1.647 -				     ios_base& /* __str */, 
   1.648 -				     ios_base::iostate&  __err,
   1.649 -				     tm* __t) const 
   1.650 -{
   1.651 -    bool __result =
   1.652 -      __get_short_or_long_dayname(__s, __end, _M_timeinfo, __t);
   1.653 -    if (__result)
   1.654 -      __err = ios_base::goodbit;
   1.655 -    else {
   1.656 -      __err = ios_base::failbit;
   1.657 -      if (__s == __end)
   1.658 -        __err |= ios_base::eofbit;
   1.659 -    }
   1.660 -    return __s;
   1.661 +                                     ios_base &__str, ios_base::iostate &__err,
   1.662 +                                     tm *__t) const {
   1.663 +  const ctype<_Ch>& __ct = *__STATIC_CAST(const ctype<_Ch>*, __str._M_ctype_facet());
   1.664 +  bool __result =
   1.665 +    _STLP_PRIV __get_short_or_long_dayname(__s, __end, __ct, _M_timeinfo, __t);
   1.666 +  if (__result)
   1.667 +    __err = ios_base::goodbit;
   1.668 +  else {
   1.669 +    __err = ios_base::failbit;
   1.670 +    if (__s == __end)
   1.671 +      __err |= ios_base::eofbit;
   1.672 +  }
   1.673 +  return __s;
   1.674  }
   1.675  
   1.676  template <class _Ch, class _InIt>
   1.677  _InIt
   1.678  time_get<_Ch, _InIt>::do_get_monthname(_InIt __s, _InIt  __end,
   1.679 -				       ios_base& /* __str */, 
   1.680 -				       ios_base::iostate&  __err,
   1.681 -				       tm* __t) const 
   1.682 -{
   1.683 +                                       ios_base &__str, ios_base::iostate &__err,
   1.684 +                                       tm *__t) const {
   1.685 +  const ctype<_Ch>& __ct = *__STATIC_CAST(const ctype<_Ch>*, __str._M_ctype_facet());
   1.686    bool __result =
   1.687 -    __get_short_or_long_monthname(__s, __end, _M_timeinfo, __t);
   1.688 +    _STLP_PRIV __get_short_or_long_monthname(__s, __end, __ct, _M_timeinfo, __t);
   1.689    if (__result)
   1.690      __err = ios_base::goodbit;
   1.691    else {
   1.692 @@ -475,19 +501,18 @@
   1.693  template<class _Ch, class _OutputIter>
   1.694  _OutputIter
   1.695  time_put<_Ch,_OutputIter>::put(_OutputIter __s, ios_base& __f, _Ch __fill,
   1.696 -			       const tm* __tmb,
   1.697 -			       const _Ch* __pat, const _Ch* __pat_end) const 
   1.698 -{
   1.699 -    locale __loc = __f.getloc();
   1.700 -    const ctype<_Ch>& _Ct = use_facet<ctype<_Ch> >(__loc); 
   1.701 - // const ctype<_Ch>& _Ct = *(ctype<_Ch>*)__f._M_ctype_facet(); 
   1.702 +                               const tm* __tmb, const _Ch* __pat,
   1.703 +                               const _Ch* __pat_end) const {
   1.704 +  //  locale __loc = __f.getloc();
   1.705 +  //  const ctype<_Ch>& _Ct = use_facet<ctype<_Ch> >(__loc);
   1.706 +  const ctype<_Ch>& _Ct = *__STATIC_CAST(const ctype<_Ch>*, __f._M_ctype_facet());
   1.707    while (__pat != __pat_end) {
   1.708      char __c = _Ct.narrow(*__pat, 0);
   1.709      if (__c == '%') {
   1.710        char __mod = 0;
   1.711        ++__pat;
   1.712        __c = _Ct.narrow(*__pat++, 0);
   1.713 -      if(__c == '#') { // MS extension
   1.714 +      if (__c == '#') { // MS extension
   1.715          __mod = __c;
   1.716          __c = _Ct.narrow(*__pat++, 0);
   1.717        }
   1.718 @@ -501,20 +526,18 @@
   1.719  
   1.720  template<class _Ch, class _OutputIter>
   1.721  _OutputIter
   1.722 -time_put<_Ch,_OutputIter>::do_put(_OutputIter __s, ios_base& __f, _Ch     /* __fill */ ,
   1.723 -				  const tm* __tmb,
   1.724 -				  char __format, char __modifier ) const 
   1.725 -{
   1.726 +time_put<_Ch,_OutputIter>::do_put(_OutputIter __s, ios_base& __f, _Ch /* __fill */,
   1.727 +                                  const tm* __tmb, char __format,
   1.728 +                                  char __modifier ) const {
   1.729    char __buf[64];
   1.730 -  char * __iend = __write_formatted_time(__buf, __format, __modifier,
   1.731 -					 _M_timeinfo, __tmb);
   1.732 +  char * __iend = _STLP_PRIV __write_formatted_time(_STLP_ARRAY_AND_SIZE(__buf),
   1.733 +                                                    __format, __modifier, _M_timeinfo, __tmb);
   1.734    //  locale __loc = __f.getloc();
   1.735 -  return __put_time(__buf, __iend, __s, __f, _Ch());
   1.736 +  return _STLP_PRIV __put_time(__buf, __iend, __s, __f, _Ch());
   1.737  }
   1.738  
   1.739  _STLP_END_NAMESPACE
   1.740  
   1.741 -# endif /* defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) */
   1.742  #endif /* _STLP_TIME_FACETS_C */
   1.743  
   1.744  // Local Variables: