epoc32/include/stdapis/stlportv5/stl/_num_put.c
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/stdapis/stlportv5/stl/_num_put.c	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_num_put.c	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,274 +1,205 @@
     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_NUM_PUT_C
    1.28  #define _STLP_NUM_PUT_C
    1.29  
    1.30  #ifndef _STLP_INTERNAL_NUM_PUT_H
    1.31 -# include <stl/_num_put.h>
    1.32 +#  include <stl/_num_put.h>
    1.33  #endif
    1.34  
    1.35 -# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
    1.36 -
    1.37 -#ifndef _STLP_LIMITS_H
    1.38 -# include <stl/_limits.h>
    1.39 +#ifndef _STLP_INTERNAL_LIMITS
    1.40 +#  include <stl/_limits.h>
    1.41  #endif
    1.42  
    1.43  _STLP_BEGIN_NAMESPACE
    1.44  
    1.45 -// _M_do_put_float and its helper functions.  Strategy: write the output
    1.46 +_STLP_MOVE_TO_PRIV_NAMESPACE
    1.47 +
    1.48 +// __do_put_float and its helper functions.  Strategy: write the output
    1.49  // to a buffer of char, transform the buffer to _CharT, and then copy
    1.50  // it to the output.
    1.51  
    1.52 -template <class _CharT, class _OutputIter,class _Float>
    1.53 -_OutputIter _STLP_CALL
    1.54 -_M_do_put_float(_OutputIter __s, ios_base& __f, _CharT __fill,_Float    __x);
    1.55 -
    1.56 -
    1.57  //----------------------------------------------------------------------
    1.58  // num_put facet
    1.59  
    1.60  template <class _CharT, class _OutputIter>
    1.61  _OutputIter  _STLP_CALL
    1.62  __copy_float_and_fill(const _CharT* __first, const _CharT* __last,
    1.63 -                      _OutputIter __stl_out,
    1.64 +                      _OutputIter __oi,
    1.65                        ios_base::fmtflags __flags,
    1.66                        streamsize __width, _CharT __fill,
    1.67                        _CharT __xplus, _CharT __xminus) {
    1.68    if (__width <= __last - __first)
    1.69 -    return copy(__first, __last, __stl_out);
    1.70 +    return copy(__first, __last, __oi);
    1.71    else {
    1.72      streamsize __pad = __width - (__last - __first);
    1.73      ios_base::fmtflags __dir = __flags & ios_base::adjustfield;
    1.74  
    1.75      if (__dir == ios_base::left) {
    1.76 -      __stl_out = copy(__first, __last, __stl_out);
    1.77 -      return fill_n(__stl_out, __pad, __fill);
    1.78 +      __oi = copy(__first, __last, __oi);
    1.79 +      return __fill_n(__oi, __pad, __fill);
    1.80      }
    1.81      else if (__dir == ios_base::internal && __first != __last &&
    1.82               (*__first == __xplus || *__first == __xminus)) {
    1.83 -      *__stl_out++ = *__first++;
    1.84 -      __stl_out = fill_n(__stl_out, __pad, __fill);
    1.85 -      return copy(__first, __last, __stl_out);
    1.86 +      *__oi++ = *__first++;
    1.87 +      __oi = __fill_n(__oi, __pad, __fill);
    1.88 +      return copy(__first, __last, __oi);
    1.89      }
    1.90      else {
    1.91 -      __stl_out = fill_n(__stl_out, __pad, __fill);
    1.92 -      return copy(__first, __last, __stl_out);
    1.93 +      __oi = __fill_n(__oi, __pad, __fill);
    1.94 +      return copy(__first, __last, __oi);
    1.95      }
    1.96    }
    1.97  }
    1.98  
    1.99 -#ifndef _STLP_NO_WCHAR_T
   1.100 +#if !defined (_STLP_NO_WCHAR_T)
   1.101  // Helper routine for wchar_t
   1.102  template <class _OutputIter>
   1.103  _OutputIter  _STLP_CALL
   1.104 -__put_float(char* __ibuf, char* __iend, _OutputIter __stl_out,
   1.105 +__put_float(__iostring &__str, _OutputIter __oi,
   1.106              ios_base& __f, wchar_t __fill,
   1.107 -            wchar_t __decimal_point,
   1.108 -            wchar_t __sep, const string& __grouping)
   1.109 -{
   1.110 -  //const ctype<wchar_t>& __ct = *(ctype<wchar_t>*)__f._M_ctype_facet() ;
   1.111 -    const ctype<wchar_t>& __ct  = use_facet< ctype<wchar_t> >(__f.getloc());
   1.112 +            wchar_t __decimal_point, wchar_t __sep,
   1.113 +            size_t __group_pos, const string& __grouping) {
   1.114 +  const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __f._M_ctype_facet());
   1.115  
   1.116 - // wchar_t __wbuf[128]; //stdcxx fix
   1.117 -  wchar_t __wbuf[256+10];
   1.118 -  wchar_t* __eend = __convert_float_buffer(__ibuf, __iend, __wbuf,
   1.119 -                                           __ct, __decimal_point);
   1.120 +  __iowstring __wbuf;
   1.121 +  __convert_float_buffer(__str, __wbuf, __ct, __decimal_point);
   1.122 +
   1.123    if (!__grouping.empty()) {
   1.124 -    // In order to do separator-insertion only to the left of the
   1.125 -    // decimal point, we adjust the size of the first (right-most)
   1.126 -    // group.  We need to be careful if there is only one entry in
   1.127 -    // grouping:  in this case we need to duplicate the first entry.
   1.128 -
   1.129 -    string __new_grouping = __grouping;
   1.130 -    wchar_t* __decimal_pos = find(__wbuf, __eend, __decimal_point);
   1.131 -    if (__grouping.size() == 1)
   1.132 -      __new_grouping.push_back(__grouping[0]);
   1.133 -
   1.134 -	// dwa 1/24/00 - try as I might, there doesn't seem to be a way
   1.135 -    // to suppress the warning
   1.136 -    __new_grouping[0] += __STATIC_CAST(char, __eend - __decimal_pos);
   1.137 -    ptrdiff_t __len = __insert_grouping(__wbuf, __eend, __new_grouping,
   1.138 -					__sep,
   1.139 -					__ct.widen('+'), __ct.widen('-'),
   1.140 -					0);
   1.141 -    __eend = __wbuf + __len;
   1.142 +    __insert_grouping(__wbuf, __group_pos, __grouping,
   1.143 +                      __sep, __ct.widen('+'), __ct.widen('-'), 0);
   1.144    }
   1.145  
   1.146 -  return __copy_float_and_fill(__wbuf, __eend, __stl_out,
   1.147 -                               __f.flags(), __f.width(0), __fill,
   1.148 -                               __ct.widen('+'), __ct.widen('-')); 
   1.149 +  return __copy_float_and_fill(__CONST_CAST(wchar_t*, __wbuf.data()),
   1.150 +                               __CONST_CAST(wchar_t*, __wbuf.data()) + __wbuf.size(), __oi,
   1.151 +                               __f.flags(), __f.width(0), __fill, __ct.widen('+'), __ct.widen('-'));
   1.152  }
   1.153 -# endif /* WCHAR_T */
   1.154 +#endif /* WCHAR_T */
   1.155  
   1.156 -#ifdef __SYMBIAN32__
   1.157 -template<class _CharT>
   1.158 -ptrdiff_t _STLP_CALL
   1.159 -__insert_grouping(_CharT * first, _CharT * last, const string& grouping,
   1.160 -		  _CharT separator, _CharT Plus, _CharT Minus, int basechars)
   1.161 -{
   1.162 -	int length = last-first;
   1.163 -	ptrdiff_t res;	
   1.164 -	char*	str = new char(length+64); //morespace for seperators
   1.165 -	memset(str,'\0',length+64);
   1.166 -	memcpy(str,first, length);
   1.167 -	char _separator = (char)separator;
   1.168 -	char _Plus = (char)Plus;
   1.169 -	char _Minus = (char)Minus;
   1.170 -	
   1.171 -  	res = __insert_grouping(str, str+length, grouping, 
   1.172 -			       _separator, _Plus, _Minus, basechars);
   1.173 -	memcpy(first,str,res);
   1.174 -	delete str;
   1.175 -	return res;
   1.176 -	
   1.177 -}
   1.178 -
   1.179 -#endif
   1.180  // Helper routine for char
   1.181  template <class _OutputIter>
   1.182  _OutputIter  _STLP_CALL
   1.183 -__put_float(char* __ibuf, char* __iend, _OutputIter __stl_out,
   1.184 +__put_float(__iostring &__str, _OutputIter __oi,
   1.185              ios_base& __f, char __fill,
   1.186 -            char __decimal_point,
   1.187 -            char __sep, const string& __grouping)
   1.188 -{
   1.189 -  __adjust_float_buffer(__ibuf, __iend, __decimal_point);
   1.190 -  if (!__grouping.empty()) {
   1.191 -    string __new_grouping = __grouping;
   1.192 -    const char * __decimal_pos = find(__ibuf, __iend, __decimal_point);
   1.193 -    if (__grouping.size() == 1)
   1.194 -      __new_grouping.push_back(__grouping[0]);
   1.195 -    __new_grouping[0] += __STATIC_CAST(char, (__iend - __decimal_pos));
   1.196 -    ptrdiff_t __len = __insert_grouping(__ibuf, __iend, __new_grouping,
   1.197 -					__sep, '+', '-', 0);
   1.198 -    __iend = __ibuf + __len;
   1.199 +            char __decimal_point, char __sep,
   1.200 +            size_t __group_pos, const string& __grouping) {
   1.201 +  if ((__group_pos < __str.size()) && (__str[__group_pos] == '.')) {
   1.202 +    __str[__group_pos] = __decimal_point;
   1.203    }
   1.204  
   1.205 -  return __copy_float_and_fill(__ibuf, __iend, __stl_out,
   1.206 +  if (!__grouping.empty()) {
   1.207 +    __insert_grouping(__str, __group_pos,
   1.208 +                      __grouping, __sep, '+', '-', 0);
   1.209 +  }
   1.210 +
   1.211 +  return __copy_float_and_fill(__CONST_CAST(char*, __str.data()),
   1.212 +                               __CONST_CAST(char*, __str.data()) + __str.size(), __oi,
   1.213                                 __f.flags(), __f.width(0), __fill, '+', '-');
   1.214  }
   1.215  
   1.216 -#ifdef __SYMBIAN32__
   1.217 +template <class _CharT, class _OutputIter, class _Float>
   1.218 +_OutputIter _STLP_CALL
   1.219 +__do_put_float(_OutputIter __s, ios_base& __f,
   1.220 +                _CharT __fill, _Float __x) {
   1.221 +  __iostring __buf;
   1.222  
   1.223 -template <class _CharT, class _OutputIter>
   1.224 -_OutputIter  _STLP_CALL
   1.225 -__put_float(char* __ibuf, char* __iend, _OutputIter __stl_out,
   1.226 -            ios_base& __f, _CharT __fill,
   1.227 -            _CharT __decimal_point,
   1.228 -            _CharT __sep, const string& __grouping)
   1.229 -{
   1.230 -  __adjust_float_buffer(__ibuf, __iend, __decimal_point);
   1.231 -  if (!__grouping.empty()) {
   1.232 -    string __new_grouping = __grouping;
   1.233 -    const char * __decimal_pos = find(__ibuf, __iend, __decimal_point);
   1.234 -    if (__grouping.size() == 1)
   1.235 -      __new_grouping.push_back(__grouping[0]);
   1.236 -    __new_grouping[0] += __STATIC_CAST(char, (__iend - __decimal_pos));
   1.237 -    ptrdiff_t __len = __insert_grouping(__ibuf, __iend, __new_grouping,
   1.238 -					__sep, '+', '-', 0);
   1.239 -    __iend = __ibuf + __len;
   1.240 -  }
   1.241 +  size_t __group_pos = __write_float(__buf, __f.flags(), (int)__f.precision(), __x);
   1.242  
   1.243 -	_CharT __wbuf[64];
   1.244 -	locale __loc = __f.getloc();
   1.245 -	const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
   1.246 -	__ct.widen(__ibuf, __iend, __wbuf);
   1.247 -	
   1.248 - 	ptrdiff_t __len  =  __iend - __ibuf; 
   1.249 -  return __copy_float_and_fill(__wbuf, __wbuf+__len, __stl_out,
   1.250 -                               __f.flags(), __f.width(0), __fill, (_CharT)'+', (_CharT)'-');
   1.251 +  const numpunct<_CharT>& __np = *__STATIC_CAST(const numpunct<_CharT>*, __f._M_numpunct_facet());
   1.252 +
   1.253 +  return __put_float(__buf, __s, __f, __fill,
   1.254 +                     __np.decimal_point(), __np.thousands_sep(),
   1.255 +                     __group_pos, __f._M_grouping());
   1.256  }
   1.257  
   1.258 +inline void __get_money_digits_aux (__iostring &__buf, ios_base &, _STLP_LONGEST_FLOAT_TYPE __x)
   1.259 +{ __get_floor_digits(__buf, __x); }
   1.260  
   1.261 +#if !defined (_STLP_NO_WCHAR_T)
   1.262 +inline void __get_money_digits_aux (__iowstring &__wbuf, ios_base &__f, _STLP_LONGEST_FLOAT_TYPE __x) {
   1.263 +  __iostring __buf;
   1.264 +  __get_floor_digits(__buf, __x);
   1.265 +
   1.266 +  const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __f._M_ctype_facet());
   1.267 +  __convert_float_buffer(__buf, __wbuf, __ct, wchar_t(0), false);
   1.268 +}
   1.269  #endif
   1.270 -template <class _CharT, class _OutputIter, class _Float>
   1.271 -_OutputIter _STLP_CALL
   1.272 -_M_do_put_float(_OutputIter __s, ios_base& __f,
   1.273 -                _CharT __fill, _Float __x)
   1.274 -{
   1.275 -  string __buf;
   1.276 -  __buf.reserve(256+10); //+2 - 10/1/07
   1.277 -  __write_float(__buf, __f.flags(), (int)__f.precision(), __x);
   1.278  
   1.279 -  //const numpunct<_CharT>& __np = *(const numpunct<_CharT>*)__f._M_numpunct_facet();
   1.280 -  const numpunct<_CharT>& __np = use_facet< numpunct<_CharT> >(__f.getloc());
   1.281 -  
   1.282 -  return __put_float(__CONST_CAST(char*, __buf.c_str()), 
   1.283 -                     __CONST_CAST(char*, __buf.c_str()) + __buf.size(),
   1.284 -                     __s, __f, __fill,
   1.285 -                     __np.decimal_point(),
   1.286 -	//	                 __np.thousands_sep(), __f._M_grouping()); //stdcxx fix - 17/1/07
   1.287 -			__np.thousands_sep(), __np.grouping());
   1.288 -}
   1.289 +template <class _CharT>
   1.290 +void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT) &__buf, ios_base& __f, _STLP_LONGEST_FLOAT_TYPE __x)
   1.291 +{ __get_money_digits_aux(__buf, __f, __x); }
   1.292  
   1.293  // _M_do_put_integer and its helper functions.
   1.294  
   1.295  template <class _CharT, class _OutputIter>
   1.296  _OutputIter _STLP_CALL
   1.297  __copy_integer_and_fill(const _CharT* __buf, ptrdiff_t __len,
   1.298 -                        _OutputIter __stl_out,
   1.299 +                        _OutputIter __oi,
   1.300                          ios_base::fmtflags __flg, streamsize __wid, _CharT __fill,
   1.301 -                        _CharT __xplus, _CharT __xminus)
   1.302 -{
   1.303 +                        _CharT __xplus, _CharT __xminus) {
   1.304    if (__len >= __wid)
   1.305 -    return copy(__buf, __buf + __len, __stl_out);
   1.306 +    return copy(__buf, __buf + __len, __oi);
   1.307    else {
   1.308 -    ptrdiff_t __pad = __wid - __len;
   1.309 +    //casting numeric_limits<ptrdiff_t>::max to streamsize only works is ptrdiff_t is signed or streamsize representation
   1.310 +    //is larger than ptrdiff_t one.
   1.311 +    _STLP_STATIC_ASSERT((sizeof(streamsize) > sizeof(ptrdiff_t)) ||
   1.312 +                        (sizeof(streamsize) == sizeof(ptrdiff_t)) && numeric_limits<ptrdiff_t>::is_signed)
   1.313 +    ptrdiff_t __pad = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()),
   1.314 +                                                      __STATIC_CAST(streamsize, __wid - __len)));
   1.315      ios_base::fmtflags __dir = __flg & ios_base::adjustfield;
   1.316  
   1.317      if (__dir == ios_base::left) {
   1.318 -      __stl_out = copy(__buf, __buf + __len, __stl_out);
   1.319 -      return fill_n(__stl_out, __pad, __fill);
   1.320 +      __oi = copy(__buf, __buf + __len, __oi);
   1.321 +      return __fill_n(__oi, __pad, __fill);
   1.322      }
   1.323      else if (__dir == ios_base::internal && __len != 0 &&
   1.324               (__buf[0] == __xplus || __buf[0] == __xminus)) {
   1.325 -      *__stl_out++ = __buf[0];
   1.326 -      __stl_out = fill_n(__stl_out, __pad, __fill);
   1.327 -      return copy(__buf + 1, __buf + __len, __stl_out);
   1.328 +      *__oi++ = __buf[0];
   1.329 +      __oi = __fill_n(__oi, __pad, __fill);
   1.330 +      return copy(__buf + 1, __buf + __len, __oi);
   1.331      }
   1.332 -    else if (__dir == ios_base::internal && __len >= 2 &&
   1.333 +    else if (__dir == ios_base::internal && __len >= 2  &&
   1.334               (__flg & ios_base::showbase) &&
   1.335               (__flg & ios_base::basefield) == ios_base::hex) {
   1.336 -      *__stl_out++ = __buf[0];
   1.337 -      *__stl_out++ = __buf[1];
   1.338 -      __stl_out = fill_n(__stl_out, __pad, __fill);
   1.339 -      return copy(__buf + 2, __buf + __len, __stl_out);
   1.340 +      *__oi++ = __buf[0];
   1.341 +      *__oi++ = __buf[1];
   1.342 +      __oi = __fill_n(__oi, __pad, __fill);
   1.343 +      return copy(__buf + 2, __buf + __len, __oi);
   1.344      }
   1.345      else {
   1.346 -      __stl_out = fill_n(__stl_out, __pad, __fill);
   1.347 -      return copy(__buf, __buf + __len, __stl_out);
   1.348 +      __oi = __fill_n(__oi, __pad, __fill);
   1.349 +      return copy(__buf, __buf + __len, __oi);
   1.350      }
   1.351    }
   1.352  }
   1.353  
   1.354 -#ifndef _STLP_NO_WCHAR_T
   1.355 +#if !defined (_STLP_NO_WCHAR_T)
   1.356  // Helper function for wchar_t
   1.357  template <class _OutputIter>
   1.358  _OutputIter _STLP_CALL
   1.359  __put_integer(char* __buf, char* __iend, _OutputIter __s,
   1.360                ios_base& __f,
   1.361 -              ios_base::fmtflags __flags, wchar_t __fill)
   1.362 -{
   1.363 +              ios_base::fmtflags __flags, wchar_t __fill) {
   1.364    locale __loc = __f.getloc();
   1.365 -   const ctype<wchar_t>& __ct = use_facet<ctype<wchar_t> >(__loc);
   1.366 -  //const ctype<wchar_t>& __ct = *(const ctype<wchar_t>*)__f._M_ctype_facet();
   1.367 +  //  const ctype<wchar_t>& __ct = use_facet<ctype<wchar_t> >(__loc);
   1.368 +  const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __f._M_ctype_facet());
   1.369  
   1.370    wchar_t __xplus  = __ct.widen('+');
   1.371    wchar_t __xminus = __ct.widen('-');
   1.372 @@ -278,25 +209,25 @@
   1.373    ptrdiff_t __len = __iend - __buf;
   1.374    wchar_t* __eend = __wbuf + __len;
   1.375  
   1.376 -    const numpunct<wchar_t>& __np = use_facet<numpunct<wchar_t> >(__loc);
   1.377 -    const string& __grouping = __np.grouping();
   1.378 +  //  const numpunct<wchar_t>& __np = use_facet<numpunct<wchar_t> >(__loc);
   1.379 +  //  const string& __grouping = __np.grouping();
   1.380  
   1.381 -  //const numpunct<wchar_t>& __np = *(const numpunct<wchar_t>*)__f._M_numpunct_facet();
   1.382 - // const string& __grouping = __f._M_grouping();
   1.383 +  const numpunct<wchar_t>& __np = *__STATIC_CAST(const numpunct<wchar_t>*, __f._M_numpunct_facet());
   1.384 +  const string& __grouping = __f._M_grouping();
   1.385  
   1.386    if (!__grouping.empty()) {
   1.387      int __basechars;
   1.388      if (__flags & ios_base::showbase)
   1.389        switch (__flags & ios_base::basefield) {
   1.390 -	case ios_base::hex: __basechars = 2; break;
   1.391 -	case ios_base::oct: __basechars = 1; break;
   1.392 -	default: __basechars = 0;
   1.393 +        case ios_base::hex: __basechars = 2; break;
   1.394 +        case ios_base::oct: __basechars = 1; break;
   1.395 +        default: __basechars = 0;
   1.396        }
   1.397      else
   1.398        __basechars = 0;
   1.399  
   1.400      __len = __insert_grouping(__wbuf, __eend, __grouping, __np.thousands_sep(),
   1.401 -			      __xplus, __xminus, __basechars);
   1.402 +                              __xplus, __xminus, __basechars);
   1.403    }
   1.404  
   1.405    return __copy_integer_and_fill((wchar_t*)__wbuf, __len, __s,
   1.406 @@ -304,96 +235,44 @@
   1.407  }
   1.408  #endif
   1.409  
   1.410 -#ifdef	__SYMBIAN32__
   1.411 -template <class _CharT, class _OutputIter>
   1.412 +// Helper function for char
   1.413 +template <class _OutputIter>
   1.414  _OutputIter _STLP_CALL
   1.415  __put_integer(char* __buf, char* __iend, _OutputIter __s,
   1.416 -              ios_base& __f,
   1.417 -              ios_base::fmtflags __flags, _CharT __fill)
   1.418 -{
   1.419 -  locale __loc = __f.getloc();
   1.420 -   const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
   1.421 -  //const ctype<wchar_t>& __ct = *(const ctype<wchar_t>*)__f._M_ctype_facet();
   1.422 +              ios_base& __f, ios_base::fmtflags __flags, char __fill) {
   1.423 +  char __grpbuf[64];
   1.424 +  ptrdiff_t __len = __iend - __buf;
   1.425  
   1.426 -  _CharT __xplus  = '+';
   1.427 -  _CharT __xminus = '-';
   1.428 +  //  const numpunct<char>& __np = use_facet<numpunct<char> >(__f.getloc());
   1.429 +  //  const string& __grouping = __np.grouping();
   1.430  
   1.431 -  _CharT __wbuf[64];
   1.432 -  
   1.433 -  ptrdiff_t __len = __iend - __buf;
   1.434 -  _CharT* __eend = __wbuf + __len;
   1.435 -
   1.436 -
   1.437 -    const numpunct<char>& __np = use_facet<numpunct<char> >(__loc);
   1.438 -    const string& __grouping = __np.grouping();
   1.439 -
   1.440 -  //const numpunct<wchar_t>& __np = *(const numpunct<wchar_t>*)__f._M_numpunct_facet();
   1.441 - // const string& __grouping = __f._M_grouping();
   1.442 +  const numpunct<char>& __np = *__STATIC_CAST(const numpunct<char>*, __f._M_numpunct_facet());
   1.443 +  const string& __grouping = __f._M_grouping();
   1.444  
   1.445    if (!__grouping.empty()) {
   1.446      int __basechars;
   1.447      if (__flags & ios_base::showbase)
   1.448        switch (__flags & ios_base::basefield) {
   1.449 -	case ios_base::hex: __basechars = 2; break;
   1.450 -	case ios_base::oct: __basechars = 1; break;
   1.451 -	default: __basechars = 0;
   1.452 +        case ios_base::hex: __basechars = 2; break;
   1.453 +        case ios_base::oct: __basechars = 1; break;
   1.454 +        default: __basechars = 0;
   1.455        }
   1.456      else
   1.457        __basechars = 0;
   1.458  
   1.459 +     // make sure there is room at the end of the buffer
   1.460 +     // we pass to __insert_grouping
   1.461 +    copy(__buf, __iend, (char *) __grpbuf);
   1.462 +    __buf = __grpbuf;
   1.463 +    __iend = __grpbuf + __len;
   1.464      __len = __insert_grouping(__buf, __iend, __grouping, __np.thousands_sep(),
   1.465 -			     __ct.narrow( __xplus, '+'), __ct.narrow(__xminus, '-'), __basechars);
   1.466 -	__ct.widen(__buf, __iend, __wbuf);
   1.467 -	
   1.468 +                              '+', '-', __basechars);
   1.469    }
   1.470  
   1.471 -  return __copy_integer_and_fill(__wbuf, __len, __s,
   1.472 -                                 __flags, __f.width(0), __fill, __xplus, __xminus);
   1.473 -}
   1.474 -
   1.475 -
   1.476 -#endif
   1.477 -// Helper function for char
   1.478 -template <class _OutputIter>
   1.479 -_OutputIter _STLP_CALL
   1.480 -__put_integer(char* __buf, char* __iend, _OutputIter __s,
   1.481 -              ios_base& __f, ios_base::fmtflags __flags, char __fill)
   1.482 -{
   1.483 -  ptrdiff_t __len = __iend - __buf;
   1.484 -  char __grpbuf[64];
   1.485 -
   1.486 -  //  const numpunct<char>& __np = use_facet<numpunct<char> >(__f.getloc());
   1.487 -  //  const string& __grouping = __np.grouping();
   1.488 -
   1.489 -  const numpunct<char>& __np = *(const numpunct<char>*)__f._M_numpunct_facet();
   1.490 -//  const string& __grouping = __f._M_grouping(); //stdcxx fix, 17/1/07
   1.491 -  const string& __grouping = __np.grouping();
   1.492 -
   1.493 -  if (!__grouping.empty()) {
   1.494 -    int __basechars;
   1.495 -    if (__flags & ios_base::showbase)
   1.496 -      switch (__flags & ios_base::basefield) {
   1.497 -	case ios_base::hex: __basechars = 2; break;
   1.498 -	case ios_base::oct: __basechars = 1; break;
   1.499 -	default: __basechars = 0;
   1.500 -      }
   1.501 -    else
   1.502 -      __basechars = 0;
   1.503 - 
   1.504 -     // make sure there is room at the end of the buffer
   1.505 -     // we pass to __insert_grouping
   1.506 -
   1.507 -    copy(__buf, __iend, (char *) __grpbuf);
   1.508 -    __buf = __grpbuf;
   1.509 -    __iend = __grpbuf + __len; 
   1.510 -    __len = __insert_grouping(__buf, __iend, __grouping, __np.thousands_sep(), 
   1.511 -                              '+', '-', __basechars);
   1.512 -  }
   1.513 -  
   1.514    return __copy_integer_and_fill(__buf, __len, __s, __flags, __f.width(0), __fill, '+', '-');
   1.515  }
   1.516  
   1.517 -#ifdef _STLP_LONG_LONG
   1.518 +#if defined (_STLP_LONG_LONG)
   1.519  typedef _STLP_LONG_LONG __max_int_t;
   1.520  typedef unsigned _STLP_LONG_LONG __umax_int_t;
   1.521  #else
   1.522 @@ -401,19 +280,18 @@
   1.523  typedef unsigned long __umax_int_t;
   1.524  #endif
   1.525  
   1.526 -extern _STLP_DECLSPEC const char* get_hex_char_table_lo();
   1.527 -extern _STLP_DECLSPEC const char* get_hex_char_table_hi();
   1.528 +_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_lo();
   1.529 +_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_hi();
   1.530  
   1.531  template <class _Integer>
   1.532  inline char* _STLP_CALL
   1.533 -__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __true_type& /* is_signed */)
   1.534 -{
   1.535 +__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __true_type& /* is_signed */) {
   1.536    const bool __negative = __x < 0 ;
   1.537    __max_int_t __temp = __x;
   1.538    __umax_int_t __utemp = __negative?-__temp:__temp;
   1.539  
   1.540    for (; __utemp != 0; __utemp /= 10)
   1.541 -    *--__ptr = (int)(__utemp % 10) + '0';	  
   1.542 +    *--__ptr = (char)((int)(__utemp % 10) + '0');
   1.543    // put sign if needed or requested
   1.544    if (__negative)
   1.545      *--__ptr = '-';
   1.546 @@ -424,10 +302,9 @@
   1.547  
   1.548  template <class _Integer>
   1.549  inline char* _STLP_CALL
   1.550 -__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __false_type& /* is_signed */)
   1.551 -{
   1.552 +__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __false_type& /* is_signed */) {
   1.553    for (; __x != 0; __x /= 10)
   1.554 -    *--__ptr = (int)(__x % 10) + '0';
   1.555 +    *--__ptr = (char)((int)(__x % 10) + '0');
   1.556    // put sign if requested
   1.557    if (__flags & ios_base::showpos)
   1.558      *--__ptr = '+';
   1.559 @@ -436,124 +313,179 @@
   1.560  
   1.561  template <class _Integer>
   1.562  char* _STLP_CALL
   1.563 -__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x)
   1.564 -{
   1.565 +__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x) {
   1.566    char* __ptr = __buf;
   1.567 -  __umax_int_t __temp;
   1.568  
   1.569    if (__x == 0) {
   1.570      *--__ptr = '0';
   1.571 -    if ((__flags & ios_base::showpos) && ( (__flags & (ios_base::hex | ios_base::oct)) == 0 ))
   1.572 +    if ((__flags & ios_base::showpos) && ((__flags & (ios_base::oct | ios_base::hex)) == 0))
   1.573        *--__ptr = '+';
   1.574 +    // oct or hex base shall not be added to the 0 value (see '#' flag in C formating strings)
   1.575    }
   1.576    else {
   1.577 -    
   1.578      switch (__flags & ios_base::basefield) {
   1.579 -    case ios_base::oct:
   1.580 -      __temp = __x;
   1.581 -      // if the size of integer is less than 8, clear upper part
   1.582 -      if ( sizeof(__x) < 8  && sizeof(__umax_int_t) >= 8 )
   1.583 -        __temp &= 0xFFFFFFFF;
   1.584 +      case ios_base::oct:
   1.585 +        {
   1.586 +          __umax_int_t __temp = __x;
   1.587 +          // if the size of integer is less than 8, clear upper part
   1.588 +          if ( sizeof(__x) < 8  && sizeof(__umax_int_t) >= 8 )
   1.589 +            __temp &= 0xFFFFFFFF;
   1.590  
   1.591 -      for (; __temp != 0; __temp >>=3)
   1.592 -        *--__ptr = (((unsigned)__temp)& 0x7) + '0';
   1.593 -      
   1.594 -      // put leading '0' is showbase is set
   1.595 -      if (__flags & ios_base::showbase)
   1.596 -        *--__ptr = '0';
   1.597 -      break;
   1.598 -    case ios_base::hex: 
   1.599 -      {
   1.600 -        const char* __table_ptr = (__flags & ios_base::uppercase) ? 
   1.601 -          get_hex_char_table_hi() : get_hex_char_table_lo();
   1.602 -      __temp = __x;
   1.603 -      // if the size of integer is less than 8, clear upper part
   1.604 -      if ( sizeof(__x) < 8  && sizeof(__umax_int_t) >= 8 )
   1.605 -        __temp &= 0xFFFFFFFF;
   1.606 +          for (; __temp != 0; __temp >>=3)
   1.607 +            *--__ptr = (char)((((unsigned)__temp)& 0x7) + '0');
   1.608  
   1.609 -        for (; __temp != 0; __temp >>=4)
   1.610 -          *--__ptr = __table_ptr[((unsigned)__temp & 0xF)];
   1.611 -        
   1.612 -        if (__flags & ios_base::showbase) {
   1.613 -          *--__ptr = __table_ptr[16];
   1.614 -          *--__ptr = '0';
   1.615 +          // put leading '0' if showbase is set
   1.616 +          if (__flags & ios_base::showbase)
   1.617 +            *--__ptr = '0';
   1.618          }
   1.619 -      }
   1.620 -      break;
   1.621 -    default: 
   1.622 -      {
   1.623 +        break;
   1.624 +      case ios_base::hex:
   1.625 +        {
   1.626 +          const char* __table_ptr = (__flags & ios_base::uppercase) ?
   1.627 +            __hex_char_table_hi() : __hex_char_table_lo();
   1.628 +          __umax_int_t __temp = __x;
   1.629 +          // if the size of integer is less than 8, clear upper part
   1.630 +          if ( sizeof(__x) < 8  && sizeof(__umax_int_t) >= 8 )
   1.631 +            __temp &= 0xFFFFFFFF;
   1.632 +
   1.633 +          for (; __temp != 0; __temp >>=4)
   1.634 +            *--__ptr = __table_ptr[((unsigned)__temp & 0xF)];
   1.635 +
   1.636 +          if (__flags & ios_base::showbase) {
   1.637 +            *--__ptr = __table_ptr[16];
   1.638 +            *--__ptr = '0';
   1.639 +          }
   1.640 +        }
   1.641 +        break;
   1.642 +      //case ios_base::dec:
   1.643 +      default:
   1.644 +        {
   1.645  #if defined(__HP_aCC) && (__HP_aCC == 1)
   1.646 -        bool _IsSigned = !((_Integer)-1 > 0);
   1.647 -	if (_IsSigned)
   1.648 -	  __ptr = __write_decimal_backward(__ptr, __x, __flags, __true_type() );
   1.649 -        else
   1.650 -	  __ptr = __write_decimal_backward(__ptr, __x, __flags, __false_type() );
   1.651 +          bool _IsSigned = !((_Integer)-1 > 0);
   1.652 +          if (_IsSigned)
   1.653 +            __ptr = __write_decimal_backward(__ptr, __x, __flags, __true_type() );
   1.654 +          else
   1.655 +            __ptr = __write_decimal_backward(__ptr, __x, __flags, __false_type() );
   1.656  #else
   1.657 -	typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
   1.658 -	__ptr = __write_decimal_backward(__ptr, __x, __flags, _IsSigned());
   1.659 -# endif
   1.660 -      }
   1.661 -      break;
   1.662 -    }  
   1.663 +          typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
   1.664 +          __ptr = __write_decimal_backward(__ptr, __x, __flags, _IsSigned());
   1.665 +#endif
   1.666 +        }
   1.667 +        break;
   1.668 +    }
   1.669    }
   1.670 +
   1.671    // return pointer to beginning of the string
   1.672    return __ptr;
   1.673  }
   1.674  
   1.675 +template <class _CharT, class _OutputIter, class _Integer>
   1.676 +_OutputIter _STLP_CALL
   1.677 +__do_put_integer(_OutputIter __s, ios_base& __f, _CharT __fill, _Integer __x) {
   1.678 +  // buffer size = number of bytes * number of digit necessary in the smallest Standard base (base 8, 3 digits/byte)
   1.679 +  //               plus the longest base representation '0x'
   1.680 +  // Do not use __buf_size to define __buf static buffer, some compilers (HP aCC) do not accept const variable as
   1.681 +  // the specification of a static buffer size.
   1.682 +  char __buf[sizeof(_Integer) * 3 + 2];
   1.683 +  const ptrdiff_t __buf_size = sizeof(__buf) / sizeof(char);
   1.684 +  ios_base::fmtflags __flags = __f.flags();
   1.685 +  char* __ibeg = __write_integer_backward((char*)__buf+__buf_size, __flags, __x);
   1.686 +  return __put_integer(__ibeg, (char*)__buf+__buf_size, __s, __f, __flags, __fill);
   1.687 +}
   1.688 +
   1.689 +_STLP_MOVE_TO_STD_NAMESPACE
   1.690 +
   1.691  //
   1.692  // num_put<>
   1.693  //
   1.694  
   1.695 -# if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
   1.696 -# if !defined(__LIBSTD_CPP_SYMBIAN32_WSD__) && !defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
   1.697 +#if (_STLP_STATIC_TEMPLATE_DATA > 0)
   1.698 +# if !defined(__SYMBIAN32__WSD__)
   1.699 +#  if !defined (__BORLANDC__) && defined (__SYMBIAN32__) && defined(_STLP_DESIGNATED_DLL)
   1.700  template <class _CharT, class _OutputIterator>
   1.701  locale::id num_put<_CharT, _OutputIterator>::id;
   1.702 -#endif
   1.703 -# else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
   1.704 +#  endif
   1.705  
   1.706 -typedef num_put<char, const char*> num_put_char;
   1.707 -typedef num_put<char, char*> num_put_char_2;
   1.708 -typedef num_put<char, ostreambuf_iterator<char, char_traits<char> > > num_put_char_3;
   1.709 -typedef num_put<char, back_insert_iterator<string> > num_put_char_4;
   1.710 +#  if ((defined (__CYGWIN__) || defined (__MINGW32__)) && \
   1.711 +       defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)) || (defined (__SYMBIAN32__) && defined(_STLP_DESIGNATED_DLL))
   1.712 +/*
   1.713 + * Under cygwin, when STLport is used as a shared library, the id needs
   1.714 + * to be specified as imported otherwise they will be duplicated in the
   1.715 + * calling executable.
   1.716 + */
   1.717 +#    if defined(__SYMBIAN32__)
   1.718 +template <>
   1.719 +locale::id num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id; //data should not be exported in symbian
   1.720 +/*
   1.721 +template <>
   1.722 +_STLP_DECLSPEC locale::id num_put<char, char*>::id;
   1.723 +*/
   1.724  
   1.725 -#ifndef __SYMBIAN32__
   1.726 -__DECLARE_INSTANCE(locale::id, num_put_char::id, );
   1.727 +#    if !defined (_STLP_NO_WCHAR_T)
   1.728 +template <>
   1.729 +locale::id num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
   1.730 +/*
   1.731 +template <>
   1.732 +_STLP_DECLSPEC locale::id num_put<wchar_t, wchar_t*>::id;
   1.733 +*/
   1.734 +#    endif
   1.735 +
   1.736 +#    else
   1.737 +template <>
   1.738 +_STLP_DECLSPEC locale::id num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
   1.739 +/*
   1.740 +template <>
   1.741 +_STLP_DECLSPEC locale::id num_put<char, char*>::id;
   1.742 +*/
   1.743 +
   1.744 +#    if !defined (_STLP_NO_WCHAR_T)
   1.745 +template <>
   1.746 +_STLP_DECLSPEC locale::id num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
   1.747 +/*
   1.748 +template <>
   1.749 +_STLP_DECLSPEC locale::id num_put<wchar_t, wchar_t*>::id;
   1.750 +*/
   1.751 +#    endif
   1.752 +
   1.753 +#    endif //__SYMBIAN32__
   1.754 +
   1.755 +#  endif /* __CYGWIN__ && _STLP_USE_DYNAMIC_LIB */
   1.756 +#endif /*__SYMBIAN32__WSD__ */
   1.757 +#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
   1.758 +
   1.759 +//typedef num_put<char, char*> num_put_char;
   1.760 +typedef num_put<char, ostreambuf_iterator<char, char_traits<char> > > num_put_char_2;
   1.761 +
   1.762 +//__DECLARE_INSTANCE(locale::id, num_put_char::id, );
   1.763  __DECLARE_INSTANCE(locale::id, num_put_char_2::id, );
   1.764 -__DECLARE_INSTANCE(locale::id, num_put_char_3::id, );
   1.765 -#endif
   1.766  
   1.767 -# ifndef _STLP_NO_WCHAR_T
   1.768 +#  if !defined (_STLP_NO_WCHAR_T)
   1.769  
   1.770 -typedef num_put<wchar_t, const wchar_t*> num_put_wchar_t;
   1.771 -typedef num_put<wchar_t, wchar_t*> num_put_wchar_t_2;
   1.772 -typedef num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > num_put_wchar_t_3;
   1.773 +//typedef num_put<wchar_t, wchar_t*> num_put_wchar_t;
   1.774 +typedef num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > num_put_wchar_t_2;
   1.775  
   1.776 -#ifndef __SYMBIAN32__
   1.777 -__DECLARE_INSTANCE(locale::id, num_put_wchar_t::id, );
   1.778 +//__DECLARE_INSTANCE(locale::id, num_put_wchar_t::id, );
   1.779  __DECLARE_INSTANCE(locale::id, num_put_wchar_t_2::id, );
   1.780 -__DECLARE_INSTANCE(locale::id, num_put_wchar_t_3::id, );
   1.781 -#endif
   1.782  
   1.783 -# endif
   1.784 +#  endif
   1.785  
   1.786 -# endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
   1.787 +#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
   1.788  
   1.789  // issue 118
   1.790  
   1.791 -# ifndef _STLP_NO_BOOL
   1.792 -
   1.793 -template <class _CharT, class _OutputIter>  
   1.794 -_OutputIter 
   1.795 -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, 
   1.796 +#if !defined (_STLP_NO_BOOL)
   1.797 +template <class _CharT, class _OutputIter>
   1.798 +_OutputIter
   1.799 +num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f,
   1.800                                       char_type __fill,  bool __val) const {
   1.801    if (!(__f.flags() & ios_base::boolalpha))
   1.802      return this->do_put(__s, __f, __fill, __STATIC_CAST(long,__val));
   1.803  
   1.804    locale __loc = __f.getloc();
   1.805 -    typedef numpunct<_CharT> _Punct;
   1.806 -    const _Punct& __np = use_facet<_Punct>(__loc);
   1.807 +  //  typedef numpunct<_CharT> _Punct;
   1.808 +  //  const _Punct& __np = use_facet<_Punct>(__loc);
   1.809  
   1.810 -  //const numpunct<_CharT>& __np = *(const numpunct<_CharT>*)__f._M_numpunct_facet();
   1.811 +  const numpunct<_CharT>& __np = *__STATIC_CAST(const numpunct<_CharT>*, __f._M_numpunct_facet());
   1.812  
   1.813    basic_string<_CharT> __str = __val ? __np.truename() : __np.falsename();
   1.814  
   1.815 @@ -564,79 +496,51 @@
   1.816    if ((__flags & ios_base::adjustfield) == ios_base::internal)
   1.817      __flags = (__flags & ~ios_base::adjustfield) | ios_base::right;
   1.818  
   1.819 -  return __copy_integer_and_fill(__str.c_str(), __str.size(), __s,
   1.820 -                                 __flags, __f.width(0), __fill,
   1.821 -                                 (_CharT) 0, (_CharT) 0);
   1.822 +  return _STLP_PRIV __copy_integer_and_fill(__str.c_str(), __str.size(), __s,
   1.823 +                                            __flags, __f.width(0), __fill,
   1.824 +                                            (_CharT) 0, (_CharT) 0);
   1.825  }
   1.826  
   1.827 -# endif
   1.828 +#endif
   1.829  
   1.830  template <class _CharT, class _OutputIter>
   1.831 -_OutputIter 
   1.832 +_OutputIter
   1.833  num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
   1.834 -                                     long __val) const {
   1.835 +                                     long __val) const
   1.836 +{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
   1.837  
   1.838 -  char __buf[64];               // Large enough for a base 8 64-bit integer,
   1.839 -                                // plus any necessary grouping.  
   1.840 -  ios_base::fmtflags __flags = __f.flags();
   1.841 -  char* __ibeg = __write_integer_backward((char*)__buf+64, __flags, __val);  
   1.842 -  return __put_integer(__ibeg, (char*)__buf+64, __s, __f, __flags, __fill);
   1.843 -}
   1.844 +template <class _CharT, class _OutputIter>
   1.845 +_OutputIter
   1.846 +num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
   1.847 +                                     unsigned long __val) const
   1.848 +{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
   1.849  
   1.850 +template <class _CharT, class _OutputIter>
   1.851 +_OutputIter
   1.852 +num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
   1.853 +                                     double __val) const
   1.854 +{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); }
   1.855  
   1.856 -template <class _CharT, class _OutputIter>  
   1.857 -_OutputIter 
   1.858 +#if !defined (_STLP_NO_LONG_DOUBLE)
   1.859 +template <class _CharT, class _OutputIter>
   1.860 +_OutputIter
   1.861  num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
   1.862 -				     unsigned long __val) const {
   1.863 -  char __buf[64];               // Large enough for a base 8 64-bit integer,
   1.864 -                                // plus any necessary grouping.
   1.865 -  
   1.866 -  ios_base::fmtflags __flags = __f.flags();
   1.867 -  char* __ibeg = __write_integer_backward((char*)__buf+64, __flags, __val);
   1.868 -  return __put_integer(__ibeg, (char*)__buf+64, __s, __f, __flags, __fill);
   1.869 -}
   1.870 -
   1.871 -template <class _CharT, class _OutputIter>  
   1.872 -_OutputIter 
   1.873 -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
   1.874 -                                     double __val) const {
   1.875 -  return _M_do_put_float(__s, __f, __fill, __val);
   1.876 -}
   1.877 -
   1.878 -#ifndef _STLP_NO_LONG_DOUBLE
   1.879 -template <class _CharT, class _OutputIter>  
   1.880 -_OutputIter 
   1.881 -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
   1.882 -                                     long double __val) const {
   1.883 -  return _M_do_put_float(__s, __f, __fill, __val);
   1.884 -}
   1.885 +                                     long double __val) const
   1.886 +{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); }
   1.887  #endif
   1.888  
   1.889 -#ifdef _STLP_LONG_LONG
   1.890 -template <class _CharT, class _OutputIter>  
   1.891 -_OutputIter 
   1.892 +#if defined (_STLP_LONG_LONG)
   1.893 +template <class _CharT, class _OutputIter>
   1.894 +_OutputIter
   1.895  num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
   1.896 -                                     _STLP_LONG_LONG __val) const {
   1.897 -  char __buf[64];               // Large enough for a base 8 64-bit integer,
   1.898 -                                // plus any necessary grouping.
   1.899 -  
   1.900 -  ios_base::fmtflags __flags = __f.flags();
   1.901 -  char* __ibeg = __write_integer_backward((char*)__buf+64, __flags, __val);
   1.902 -  return __put_integer(__ibeg, (char*)__buf+64, __s, __f, __flags, __fill);
   1.903 -}
   1.904 +                                     _STLP_LONG_LONG __val) const
   1.905 +{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
   1.906  
   1.907 -template <class _CharT, class _OutputIter>  
   1.908 -_OutputIter 
   1.909 +template <class _CharT, class _OutputIter>
   1.910 +_OutputIter
   1.911  num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
   1.912 -                                     unsigned _STLP_LONG_LONG __val) const {
   1.913 -  char __buf[64];               // Large enough for a base 8 64-bit integer,
   1.914 -                                // plus any necessary grouping.
   1.915 -  
   1.916 -  ios_base::fmtflags __flags = __f.flags();
   1.917 -  char* __ibeg = __write_integer_backward((char*)__buf+64, __flags, __val);  
   1.918 -  return __put_integer(__ibeg, (char*)__buf+64, __s, __f, __flags, __fill);
   1.919 -}
   1.920 -
   1.921 +                                     unsigned _STLP_LONG_LONG __val) const
   1.922 +{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
   1.923  #endif /* _STLP_LONG_LONG */
   1.924  
   1.925  
   1.926 @@ -644,15 +548,14 @@
   1.927  template <class _CharT, class _OutputIter>
   1.928  _OutputIter
   1.929  num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT /*__fill*/,
   1.930 -				     const void* __val) const {
   1.931 -  //const ctype<_CharT>& __c_type = *(const ctype<_CharT>*)__f._M_ctype_facet();
   1.932 -  const ctype<_CharT>& __c_type  = use_facet< ctype<_CharT> >(__f.getloc());
   1.933 +                                     const void* __val) const {
   1.934 +  const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __f._M_ctype_facet());
   1.935    ios_base::fmtflags __save_flags = __f.flags();
   1.936  
   1.937    __f.setf(ios_base::hex, ios_base::basefield);
   1.938    __f.setf(ios_base::showbase);
   1.939    __f.setf(ios_base::internal, ios_base::adjustfield);
   1.940 -  //__f.width((sizeof(void*) * 2) + 2); // digits in pointer type plus '0x' prefix //making output equal to linux.
   1.941 +  __f.width((sizeof(void*) * 2) + 2); // digits in pointer type plus '0x' prefix
   1.942  # if defined(_STLP_LONG_LONG) && !defined(__MRC__) //*ty 11/24/2001 - MrCpp can not cast from void* to long long
   1.943    _OutputIter result = this->do_put(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned _STLP_LONG_LONG,__val));
   1.944  # else
   1.945 @@ -664,8 +567,6 @@
   1.946  
   1.947  _STLP_END_NAMESPACE
   1.948  
   1.949 -# endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
   1.950 -
   1.951  #endif /* _STLP_NUM_PUT_C */
   1.952  
   1.953  // Local Variables: