1.1 --- a/epoc32/include/stdapis/stlport/stl/_num_put.c Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,673 +0,0 @@
1.4 -/*
1.5 - * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
1.6 - *
1.7 - * Copyright (c) 1999
1.8 - * Silicon Graphics Computer Systems, Inc.
1.9 - *
1.10 - * Copyright (c) 1999
1.11 - * Boris Fomitchev
1.12 - *
1.13 - * This material is provided "as is", with absolutely no warranty expressed
1.14 - * or implied. Any use is at your own risk.
1.15 - *
1.16 - * Permission to use or copy this software for any purpose is hereby granted
1.17 - * without fee, provided the above notices are retained on all copies.
1.18 - * Permission to modify the code and to distribute modified code is granted,
1.19 - * provided the above notices are retained, and a notice that the code was
1.20 - * modified is included with the above copyright notice.
1.21 - *
1.22 - */
1.23 -#ifndef _STLP_NUM_PUT_C
1.24 -#define _STLP_NUM_PUT_C
1.25 -
1.26 -#ifndef _STLP_INTERNAL_NUM_PUT_H
1.27 -# include <stl/_num_put.h>
1.28 -#endif
1.29 -
1.30 -# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
1.31 -
1.32 -#ifndef _STLP_LIMITS_H
1.33 -# include <stl/_limits.h>
1.34 -#endif
1.35 -
1.36 -_STLP_BEGIN_NAMESPACE
1.37 -
1.38 -// _M_do_put_float and its helper functions. Strategy: write the output
1.39 -// to a buffer of char, transform the buffer to _CharT, and then copy
1.40 -// it to the output.
1.41 -
1.42 -template <class _CharT, class _OutputIter,class _Float>
1.43 -_OutputIter _STLP_CALL
1.44 -_M_do_put_float(_OutputIter __s, ios_base& __f, _CharT __fill,_Float __x);
1.45 -
1.46 -
1.47 -//----------------------------------------------------------------------
1.48 -// num_put facet
1.49 -
1.50 -template <class _CharT, class _OutputIter>
1.51 -_OutputIter _STLP_CALL
1.52 -__copy_float_and_fill(const _CharT* __first, const _CharT* __last,
1.53 - _OutputIter __stl_out,
1.54 - ios_base::fmtflags __flags,
1.55 - streamsize __width, _CharT __fill,
1.56 - _CharT __xplus, _CharT __xminus) {
1.57 - if (__width <= __last - __first)
1.58 - return copy(__first, __last, __stl_out);
1.59 - else {
1.60 - streamsize __pad = __width - (__last - __first);
1.61 - ios_base::fmtflags __dir = __flags & ios_base::adjustfield;
1.62 -
1.63 - if (__dir == ios_base::left) {
1.64 - __stl_out = copy(__first, __last, __stl_out);
1.65 - return fill_n(__stl_out, __pad, __fill);
1.66 - }
1.67 - else if (__dir == ios_base::internal && __first != __last &&
1.68 - (*__first == __xplus || *__first == __xminus)) {
1.69 - *__stl_out++ = *__first++;
1.70 - __stl_out = fill_n(__stl_out, __pad, __fill);
1.71 - return copy(__first, __last, __stl_out);
1.72 - }
1.73 - else {
1.74 - __stl_out = fill_n(__stl_out, __pad, __fill);
1.75 - return copy(__first, __last, __stl_out);
1.76 - }
1.77 - }
1.78 -}
1.79 -
1.80 -#ifndef _STLP_NO_WCHAR_T
1.81 -// Helper routine for wchar_t
1.82 -template <class _OutputIter>
1.83 -_OutputIter _STLP_CALL
1.84 -__put_float(char* __ibuf, char* __iend, _OutputIter __stl_out,
1.85 - ios_base& __f, wchar_t __fill,
1.86 - wchar_t __decimal_point,
1.87 - wchar_t __sep, const string& __grouping)
1.88 -{
1.89 - //const ctype<wchar_t>& __ct = *(ctype<wchar_t>*)__f._M_ctype_facet() ;
1.90 - const ctype<wchar_t>& __ct = use_facet< ctype<wchar_t> >(__f.getloc());
1.91 -
1.92 - // wchar_t __wbuf[128]; //stdcxx fix
1.93 - wchar_t __wbuf[256+10];
1.94 - wchar_t* __eend = __convert_float_buffer(__ibuf, __iend, __wbuf,
1.95 - __ct, __decimal_point);
1.96 - if (!__grouping.empty()) {
1.97 - // In order to do separator-insertion only to the left of the
1.98 - // decimal point, we adjust the size of the first (right-most)
1.99 - // group. We need to be careful if there is only one entry in
1.100 - // grouping: in this case we need to duplicate the first entry.
1.101 -
1.102 - string __new_grouping = __grouping;
1.103 - wchar_t* __decimal_pos = find(__wbuf, __eend, __decimal_point);
1.104 - if (__grouping.size() == 1)
1.105 - __new_grouping.push_back(__grouping[0]);
1.106 -
1.107 - // dwa 1/24/00 - try as I might, there doesn't seem to be a way
1.108 - // to suppress the warning
1.109 - __new_grouping[0] += __STATIC_CAST(char, __eend - __decimal_pos);
1.110 - ptrdiff_t __len = __insert_grouping(__wbuf, __eend, __new_grouping,
1.111 - __sep,
1.112 - __ct.widen('+'), __ct.widen('-'),
1.113 - 0);
1.114 - __eend = __wbuf + __len;
1.115 - }
1.116 -
1.117 - return __copy_float_and_fill(__wbuf, __eend, __stl_out,
1.118 - __f.flags(), __f.width(0), __fill,
1.119 - __ct.widen('+'), __ct.widen('-'));
1.120 -}
1.121 -# endif /* WCHAR_T */
1.122 -
1.123 -#ifdef __SYMBIAN32__
1.124 -template<class _CharT>
1.125 -ptrdiff_t _STLP_CALL
1.126 -__insert_grouping(_CharT * first, _CharT * last, const string& grouping,
1.127 - _CharT separator, _CharT Plus, _CharT Minus, int basechars)
1.128 -{
1.129 - int length = last-first;
1.130 - ptrdiff_t res;
1.131 - char* str = new char(length+64); //morespace for seperators
1.132 - memset(str,'\0',length+64);
1.133 - memcpy(str,first, length);
1.134 - char _separator = (char)separator;
1.135 - char _Plus = (char)Plus;
1.136 - char _Minus = (char)Minus;
1.137 -
1.138 - res = __insert_grouping(str, str+length, grouping,
1.139 - _separator, _Plus, _Minus, basechars);
1.140 - memcpy(first,str,res);
1.141 - delete str;
1.142 - return res;
1.143 -
1.144 -}
1.145 -
1.146 -#endif
1.147 -// Helper routine for char
1.148 -template <class _OutputIter>
1.149 -_OutputIter _STLP_CALL
1.150 -__put_float(char* __ibuf, char* __iend, _OutputIter __stl_out,
1.151 - ios_base& __f, char __fill,
1.152 - char __decimal_point,
1.153 - char __sep, const string& __grouping)
1.154 -{
1.155 - __adjust_float_buffer(__ibuf, __iend, __decimal_point);
1.156 - if (!__grouping.empty()) {
1.157 - string __new_grouping = __grouping;
1.158 - const char * __decimal_pos = find(__ibuf, __iend, __decimal_point);
1.159 - if (__grouping.size() == 1)
1.160 - __new_grouping.push_back(__grouping[0]);
1.161 - __new_grouping[0] += __STATIC_CAST(char, (__iend - __decimal_pos));
1.162 - ptrdiff_t __len = __insert_grouping(__ibuf, __iend, __new_grouping,
1.163 - __sep, '+', '-', 0);
1.164 - __iend = __ibuf + __len;
1.165 - }
1.166 -
1.167 - return __copy_float_and_fill(__ibuf, __iend, __stl_out,
1.168 - __f.flags(), __f.width(0), __fill, '+', '-');
1.169 -}
1.170 -
1.171 -#ifdef __SYMBIAN32__
1.172 -
1.173 -template <class _CharT, class _OutputIter>
1.174 -_OutputIter _STLP_CALL
1.175 -__put_float(char* __ibuf, char* __iend, _OutputIter __stl_out,
1.176 - ios_base& __f, _CharT __fill,
1.177 - _CharT __decimal_point,
1.178 - _CharT __sep, const string& __grouping)
1.179 -{
1.180 - __adjust_float_buffer(__ibuf, __iend, __decimal_point);
1.181 - if (!__grouping.empty()) {
1.182 - string __new_grouping = __grouping;
1.183 - const char * __decimal_pos = find(__ibuf, __iend, __decimal_point);
1.184 - if (__grouping.size() == 1)
1.185 - __new_grouping.push_back(__grouping[0]);
1.186 - __new_grouping[0] += __STATIC_CAST(char, (__iend - __decimal_pos));
1.187 - ptrdiff_t __len = __insert_grouping(__ibuf, __iend, __new_grouping,
1.188 - __sep, '+', '-', 0);
1.189 - __iend = __ibuf + __len;
1.190 - }
1.191 -
1.192 - _CharT __wbuf[64];
1.193 - locale __loc = __f.getloc();
1.194 - const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
1.195 - __ct.widen(__ibuf, __iend, __wbuf);
1.196 -
1.197 - ptrdiff_t __len = __iend - __ibuf;
1.198 - return __copy_float_and_fill(__wbuf, __wbuf+__len, __stl_out,
1.199 - __f.flags(), __f.width(0), __fill, (_CharT)'+', (_CharT)'-');
1.200 -}
1.201 -
1.202 -
1.203 -#endif
1.204 -template <class _CharT, class _OutputIter, class _Float>
1.205 -_OutputIter _STLP_CALL
1.206 -_M_do_put_float(_OutputIter __s, ios_base& __f,
1.207 - _CharT __fill, _Float __x)
1.208 -{
1.209 - string __buf;
1.210 - __buf.reserve(256+10); //+2 - 10/1/07
1.211 - __write_float(__buf, __f.flags(), (int)__f.precision(), __x);
1.212 -
1.213 - //const numpunct<_CharT>& __np = *(const numpunct<_CharT>*)__f._M_numpunct_facet();
1.214 - const numpunct<_CharT>& __np = use_facet< numpunct<_CharT> >(__f.getloc());
1.215 -
1.216 - return __put_float(__CONST_CAST(char*, __buf.c_str()),
1.217 - __CONST_CAST(char*, __buf.c_str()) + __buf.size(),
1.218 - __s, __f, __fill,
1.219 - __np.decimal_point(),
1.220 - // __np.thousands_sep(), __f._M_grouping()); //stdcxx fix - 17/1/07
1.221 - __np.thousands_sep(), __np.grouping());
1.222 -}
1.223 -
1.224 -// _M_do_put_integer and its helper functions.
1.225 -
1.226 -template <class _CharT, class _OutputIter>
1.227 -_OutputIter _STLP_CALL
1.228 -__copy_integer_and_fill(const _CharT* __buf, ptrdiff_t __len,
1.229 - _OutputIter __stl_out,
1.230 - ios_base::fmtflags __flg, streamsize __wid, _CharT __fill,
1.231 - _CharT __xplus, _CharT __xminus)
1.232 -{
1.233 - if (__len >= __wid)
1.234 - return copy(__buf, __buf + __len, __stl_out);
1.235 - else {
1.236 - ptrdiff_t __pad = __wid - __len;
1.237 - ios_base::fmtflags __dir = __flg & ios_base::adjustfield;
1.238 -
1.239 - if (__dir == ios_base::left) {
1.240 - __stl_out = copy(__buf, __buf + __len, __stl_out);
1.241 - return fill_n(__stl_out, __pad, __fill);
1.242 - }
1.243 - else if (__dir == ios_base::internal && __len != 0 &&
1.244 - (__buf[0] == __xplus || __buf[0] == __xminus)) {
1.245 - *__stl_out++ = __buf[0];
1.246 - __stl_out = fill_n(__stl_out, __pad, __fill);
1.247 - return copy(__buf + 1, __buf + __len, __stl_out);
1.248 - }
1.249 - else if (__dir == ios_base::internal && __len >= 2 &&
1.250 - (__flg & ios_base::showbase) &&
1.251 - (__flg & ios_base::basefield) == ios_base::hex) {
1.252 - *__stl_out++ = __buf[0];
1.253 - *__stl_out++ = __buf[1];
1.254 - __stl_out = fill_n(__stl_out, __pad, __fill);
1.255 - return copy(__buf + 2, __buf + __len, __stl_out);
1.256 - }
1.257 - else {
1.258 - __stl_out = fill_n(__stl_out, __pad, __fill);
1.259 - return copy(__buf, __buf + __len, __stl_out);
1.260 - }
1.261 - }
1.262 -}
1.263 -
1.264 -#ifndef _STLP_NO_WCHAR_T
1.265 -// Helper function for wchar_t
1.266 -template <class _OutputIter>
1.267 -_OutputIter _STLP_CALL
1.268 -__put_integer(char* __buf, char* __iend, _OutputIter __s,
1.269 - ios_base& __f,
1.270 - ios_base::fmtflags __flags, wchar_t __fill)
1.271 -{
1.272 - locale __loc = __f.getloc();
1.273 - const ctype<wchar_t>& __ct = use_facet<ctype<wchar_t> >(__loc);
1.274 - //const ctype<wchar_t>& __ct = *(const ctype<wchar_t>*)__f._M_ctype_facet();
1.275 -
1.276 - wchar_t __xplus = __ct.widen('+');
1.277 - wchar_t __xminus = __ct.widen('-');
1.278 -
1.279 - wchar_t __wbuf[64];
1.280 - __ct.widen(__buf, __iend, __wbuf);
1.281 - ptrdiff_t __len = __iend - __buf;
1.282 - wchar_t* __eend = __wbuf + __len;
1.283 -
1.284 - const numpunct<wchar_t>& __np = use_facet<numpunct<wchar_t> >(__loc);
1.285 - const string& __grouping = __np.grouping();
1.286 -
1.287 - //const numpunct<wchar_t>& __np = *(const numpunct<wchar_t>*)__f._M_numpunct_facet();
1.288 - // const string& __grouping = __f._M_grouping();
1.289 -
1.290 - if (!__grouping.empty()) {
1.291 - int __basechars;
1.292 - if (__flags & ios_base::showbase)
1.293 - switch (__flags & ios_base::basefield) {
1.294 - case ios_base::hex: __basechars = 2; break;
1.295 - case ios_base::oct: __basechars = 1; break;
1.296 - default: __basechars = 0;
1.297 - }
1.298 - else
1.299 - __basechars = 0;
1.300 -
1.301 - __len = __insert_grouping(__wbuf, __eend, __grouping, __np.thousands_sep(),
1.302 - __xplus, __xminus, __basechars);
1.303 - }
1.304 -
1.305 - return __copy_integer_and_fill((wchar_t*)__wbuf, __len, __s,
1.306 - __flags, __f.width(0), __fill, __xplus, __xminus);
1.307 -}
1.308 -#endif
1.309 -
1.310 -#ifdef __SYMBIAN32__
1.311 -template <class _CharT, class _OutputIter>
1.312 -_OutputIter _STLP_CALL
1.313 -__put_integer(char* __buf, char* __iend, _OutputIter __s,
1.314 - ios_base& __f,
1.315 - ios_base::fmtflags __flags, _CharT __fill)
1.316 -{
1.317 - locale __loc = __f.getloc();
1.318 - const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
1.319 - //const ctype<wchar_t>& __ct = *(const ctype<wchar_t>*)__f._M_ctype_facet();
1.320 -
1.321 - _CharT __xplus = '+';
1.322 - _CharT __xminus = '-';
1.323 -
1.324 - _CharT __wbuf[64];
1.325 -
1.326 - ptrdiff_t __len = __iend - __buf;
1.327 - _CharT* __eend = __wbuf + __len;
1.328 -
1.329 -
1.330 - const numpunct<char>& __np = use_facet<numpunct<char> >(__loc);
1.331 - const string& __grouping = __np.grouping();
1.332 -
1.333 - //const numpunct<wchar_t>& __np = *(const numpunct<wchar_t>*)__f._M_numpunct_facet();
1.334 - // const string& __grouping = __f._M_grouping();
1.335 -
1.336 - if (!__grouping.empty()) {
1.337 - int __basechars;
1.338 - if (__flags & ios_base::showbase)
1.339 - switch (__flags & ios_base::basefield) {
1.340 - case ios_base::hex: __basechars = 2; break;
1.341 - case ios_base::oct: __basechars = 1; break;
1.342 - default: __basechars = 0;
1.343 - }
1.344 - else
1.345 - __basechars = 0;
1.346 -
1.347 - __len = __insert_grouping(__buf, __iend, __grouping, __np.thousands_sep(),
1.348 - __ct.narrow( __xplus, '+'), __ct.narrow(__xminus, '-'), __basechars);
1.349 - __ct.widen(__buf, __iend, __wbuf);
1.350 -
1.351 - }
1.352 -
1.353 - return __copy_integer_and_fill(__wbuf, __len, __s,
1.354 - __flags, __f.width(0), __fill, __xplus, __xminus);
1.355 -}
1.356 -
1.357 -
1.358 -#endif
1.359 -// Helper function for char
1.360 -template <class _OutputIter>
1.361 -_OutputIter _STLP_CALL
1.362 -__put_integer(char* __buf, char* __iend, _OutputIter __s,
1.363 - ios_base& __f, ios_base::fmtflags __flags, char __fill)
1.364 -{
1.365 - ptrdiff_t __len = __iend - __buf;
1.366 - char __grpbuf[64];
1.367 -
1.368 - // const numpunct<char>& __np = use_facet<numpunct<char> >(__f.getloc());
1.369 - // const string& __grouping = __np.grouping();
1.370 -
1.371 - const numpunct<char>& __np = *(const numpunct<char>*)__f._M_numpunct_facet();
1.372 -// const string& __grouping = __f._M_grouping(); //stdcxx fix, 17/1/07
1.373 - const string& __grouping = __np.grouping();
1.374 -
1.375 - if (!__grouping.empty()) {
1.376 - int __basechars;
1.377 - if (__flags & ios_base::showbase)
1.378 - switch (__flags & ios_base::basefield) {
1.379 - case ios_base::hex: __basechars = 2; break;
1.380 - case ios_base::oct: __basechars = 1; break;
1.381 - default: __basechars = 0;
1.382 - }
1.383 - else
1.384 - __basechars = 0;
1.385 -
1.386 - // make sure there is room at the end of the buffer
1.387 - // we pass to __insert_grouping
1.388 -
1.389 - copy(__buf, __iend, (char *) __grpbuf);
1.390 - __buf = __grpbuf;
1.391 - __iend = __grpbuf + __len;
1.392 - __len = __insert_grouping(__buf, __iend, __grouping, __np.thousands_sep(),
1.393 - '+', '-', __basechars);
1.394 - }
1.395 -
1.396 - return __copy_integer_and_fill(__buf, __len, __s, __flags, __f.width(0), __fill, '+', '-');
1.397 -}
1.398 -
1.399 -#ifdef _STLP_LONG_LONG
1.400 -typedef _STLP_LONG_LONG __max_int_t;
1.401 -typedef unsigned _STLP_LONG_LONG __umax_int_t;
1.402 -#else
1.403 -typedef long __max_int_t;
1.404 -typedef unsigned long __umax_int_t;
1.405 -#endif
1.406 -
1.407 -extern _STLP_DECLSPEC const char* get_hex_char_table_lo();
1.408 -extern _STLP_DECLSPEC const char* get_hex_char_table_hi();
1.409 -
1.410 -template <class _Integer>
1.411 -inline char* _STLP_CALL
1.412 -__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __true_type& /* is_signed */)
1.413 -{
1.414 - const bool __negative = __x < 0 ;
1.415 - __max_int_t __temp = __x;
1.416 - __umax_int_t __utemp = __negative?-__temp:__temp;
1.417 -
1.418 - for (; __utemp != 0; __utemp /= 10)
1.419 - *--__ptr = (int)(__utemp % 10) + '0';
1.420 - // put sign if needed or requested
1.421 - if (__negative)
1.422 - *--__ptr = '-';
1.423 - else if (__flags & ios_base::showpos)
1.424 - *--__ptr = '+';
1.425 - return __ptr;
1.426 -}
1.427 -
1.428 -template <class _Integer>
1.429 -inline char* _STLP_CALL
1.430 -__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __false_type& /* is_signed */)
1.431 -{
1.432 - for (; __x != 0; __x /= 10)
1.433 - *--__ptr = (int)(__x % 10) + '0';
1.434 - // put sign if requested
1.435 - if (__flags & ios_base::showpos)
1.436 - *--__ptr = '+';
1.437 - return __ptr;
1.438 -}
1.439 -
1.440 -template <class _Integer>
1.441 -char* _STLP_CALL
1.442 -__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x)
1.443 -{
1.444 - char* __ptr = __buf;
1.445 - __umax_int_t __temp;
1.446 -
1.447 - if (__x == 0) {
1.448 - *--__ptr = '0';
1.449 - if ((__flags & ios_base::showpos) && ( (__flags & (ios_base::hex | ios_base::oct)) == 0 ))
1.450 - *--__ptr = '+';
1.451 - }
1.452 - else {
1.453 -
1.454 - switch (__flags & ios_base::basefield) {
1.455 - case ios_base::oct:
1.456 - __temp = __x;
1.457 - // if the size of integer is less than 8, clear upper part
1.458 - if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 )
1.459 - __temp &= 0xFFFFFFFF;
1.460 -
1.461 - for (; __temp != 0; __temp >>=3)
1.462 - *--__ptr = (((unsigned)__temp)& 0x7) + '0';
1.463 -
1.464 - // put leading '0' is showbase is set
1.465 - if (__flags & ios_base::showbase)
1.466 - *--__ptr = '0';
1.467 - break;
1.468 - case ios_base::hex:
1.469 - {
1.470 - const char* __table_ptr = (__flags & ios_base::uppercase) ?
1.471 - get_hex_char_table_hi() : get_hex_char_table_lo();
1.472 - __temp = __x;
1.473 - // if the size of integer is less than 8, clear upper part
1.474 - if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 )
1.475 - __temp &= 0xFFFFFFFF;
1.476 -
1.477 - for (; __temp != 0; __temp >>=4)
1.478 - *--__ptr = __table_ptr[((unsigned)__temp & 0xF)];
1.479 -
1.480 - if (__flags & ios_base::showbase) {
1.481 - *--__ptr = __table_ptr[16];
1.482 - *--__ptr = '0';
1.483 - }
1.484 - }
1.485 - break;
1.486 - default:
1.487 - {
1.488 -#if defined(__HP_aCC) && (__HP_aCC == 1)
1.489 - bool _IsSigned = !((_Integer)-1 > 0);
1.490 - if (_IsSigned)
1.491 - __ptr = __write_decimal_backward(__ptr, __x, __flags, __true_type() );
1.492 - else
1.493 - __ptr = __write_decimal_backward(__ptr, __x, __flags, __false_type() );
1.494 -#else
1.495 - typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
1.496 - __ptr = __write_decimal_backward(__ptr, __x, __flags, _IsSigned());
1.497 -# endif
1.498 - }
1.499 - break;
1.500 - }
1.501 - }
1.502 - // return pointer to beginning of the string
1.503 - return __ptr;
1.504 -}
1.505 -
1.506 -//
1.507 -// num_put<>
1.508 -//
1.509 -
1.510 -# if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
1.511 -# if !defined(__LIBSTD_CPP_SYMBIAN32_WSD__) && !defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
1.512 -template <class _CharT, class _OutputIterator>
1.513 -locale::id num_put<_CharT, _OutputIterator>::id;
1.514 -#endif
1.515 -# else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
1.516 -
1.517 -typedef num_put<char, const char*> num_put_char;
1.518 -typedef num_put<char, char*> num_put_char_2;
1.519 -typedef num_put<char, ostreambuf_iterator<char, char_traits<char> > > num_put_char_3;
1.520 -typedef num_put<char, back_insert_iterator<string> > num_put_char_4;
1.521 -
1.522 -#ifndef __SYMBIAN32__
1.523 -__DECLARE_INSTANCE(locale::id, num_put_char::id, );
1.524 -__DECLARE_INSTANCE(locale::id, num_put_char_2::id, );
1.525 -__DECLARE_INSTANCE(locale::id, num_put_char_3::id, );
1.526 -#endif
1.527 -
1.528 -# ifndef _STLP_NO_WCHAR_T
1.529 -
1.530 -typedef num_put<wchar_t, const wchar_t*> num_put_wchar_t;
1.531 -typedef num_put<wchar_t, wchar_t*> num_put_wchar_t_2;
1.532 -typedef num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > num_put_wchar_t_3;
1.533 -
1.534 -#ifndef __SYMBIAN32__
1.535 -__DECLARE_INSTANCE(locale::id, num_put_wchar_t::id, );
1.536 -__DECLARE_INSTANCE(locale::id, num_put_wchar_t_2::id, );
1.537 -__DECLARE_INSTANCE(locale::id, num_put_wchar_t_3::id, );
1.538 -#endif
1.539 -
1.540 -# endif
1.541 -
1.542 -# endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
1.543 -
1.544 -// issue 118
1.545 -
1.546 -# ifndef _STLP_NO_BOOL
1.547 -
1.548 -template <class _CharT, class _OutputIter>
1.549 -_OutputIter
1.550 -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f,
1.551 - char_type __fill, bool __val) const {
1.552 - if (!(__f.flags() & ios_base::boolalpha))
1.553 - return this->do_put(__s, __f, __fill, __STATIC_CAST(long,__val));
1.554 -
1.555 - locale __loc = __f.getloc();
1.556 - typedef numpunct<_CharT> _Punct;
1.557 - const _Punct& __np = use_facet<_Punct>(__loc);
1.558 -
1.559 - //const numpunct<_CharT>& __np = *(const numpunct<_CharT>*)__f._M_numpunct_facet();
1.560 -
1.561 - basic_string<_CharT> __str = __val ? __np.truename() : __np.falsename();
1.562 -
1.563 - // Reuse __copy_integer_and_fill. Since internal padding makes no
1.564 - // sense for bool, though, make sure we use something else instead.
1.565 - // The last two argument to __copy_integer_and_fill are dummies.
1.566 - ios_base::fmtflags __flags = __f.flags();
1.567 - if ((__flags & ios_base::adjustfield) == ios_base::internal)
1.568 - __flags = (__flags & ~ios_base::adjustfield) | ios_base::right;
1.569 -
1.570 - return __copy_integer_and_fill(__str.c_str(), __str.size(), __s,
1.571 - __flags, __f.width(0), __fill,
1.572 - (_CharT) 0, (_CharT) 0);
1.573 -}
1.574 -
1.575 -# endif
1.576 -
1.577 -template <class _CharT, class _OutputIter>
1.578 -_OutputIter
1.579 -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
1.580 - long __val) const {
1.581 -
1.582 - char __buf[64]; // Large enough for a base 8 64-bit integer,
1.583 - // plus any necessary grouping.
1.584 - ios_base::fmtflags __flags = __f.flags();
1.585 - char* __ibeg = __write_integer_backward((char*)__buf+64, __flags, __val);
1.586 - return __put_integer(__ibeg, (char*)__buf+64, __s, __f, __flags, __fill);
1.587 -}
1.588 -
1.589 -
1.590 -template <class _CharT, class _OutputIter>
1.591 -_OutputIter
1.592 -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
1.593 - unsigned long __val) const {
1.594 - char __buf[64]; // Large enough for a base 8 64-bit integer,
1.595 - // plus any necessary grouping.
1.596 -
1.597 - ios_base::fmtflags __flags = __f.flags();
1.598 - char* __ibeg = __write_integer_backward((char*)__buf+64, __flags, __val);
1.599 - return __put_integer(__ibeg, (char*)__buf+64, __s, __f, __flags, __fill);
1.600 -}
1.601 -
1.602 -template <class _CharT, class _OutputIter>
1.603 -_OutputIter
1.604 -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
1.605 - double __val) const {
1.606 - return _M_do_put_float(__s, __f, __fill, __val);
1.607 -}
1.608 -
1.609 -#ifndef _STLP_NO_LONG_DOUBLE
1.610 -template <class _CharT, class _OutputIter>
1.611 -_OutputIter
1.612 -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
1.613 - long double __val) const {
1.614 - return _M_do_put_float(__s, __f, __fill, __val);
1.615 -}
1.616 -#endif
1.617 -
1.618 -#ifdef _STLP_LONG_LONG
1.619 -template <class _CharT, class _OutputIter>
1.620 -_OutputIter
1.621 -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
1.622 - _STLP_LONG_LONG __val) const {
1.623 - char __buf[64]; // Large enough for a base 8 64-bit integer,
1.624 - // plus any necessary grouping.
1.625 -
1.626 - ios_base::fmtflags __flags = __f.flags();
1.627 - char* __ibeg = __write_integer_backward((char*)__buf+64, __flags, __val);
1.628 - return __put_integer(__ibeg, (char*)__buf+64, __s, __f, __flags, __fill);
1.629 -}
1.630 -
1.631 -template <class _CharT, class _OutputIter>
1.632 -_OutputIter
1.633 -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
1.634 - unsigned _STLP_LONG_LONG __val) const {
1.635 - char __buf[64]; // Large enough for a base 8 64-bit integer,
1.636 - // plus any necessary grouping.
1.637 -
1.638 - ios_base::fmtflags __flags = __f.flags();
1.639 - char* __ibeg = __write_integer_backward((char*)__buf+64, __flags, __val);
1.640 - return __put_integer(__ibeg, (char*)__buf+64, __s, __f, __flags, __fill);
1.641 -}
1.642 -
1.643 -#endif /* _STLP_LONG_LONG */
1.644 -
1.645 -
1.646 -// lib.facet.num.put.virtuals "12 For conversion from void* the specifier is %p."
1.647 -template <class _CharT, class _OutputIter>
1.648 -_OutputIter
1.649 -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT /*__fill*/,
1.650 - const void* __val) const {
1.651 - //const ctype<_CharT>& __c_type = *(const ctype<_CharT>*)__f._M_ctype_facet();
1.652 - const ctype<_CharT>& __c_type = use_facet< ctype<_CharT> >(__f.getloc());
1.653 - ios_base::fmtflags __save_flags = __f.flags();
1.654 -
1.655 - __f.setf(ios_base::hex, ios_base::basefield);
1.656 - __f.setf(ios_base::showbase);
1.657 - __f.setf(ios_base::internal, ios_base::adjustfield);
1.658 - //__f.width((sizeof(void*) * 2) + 2); // digits in pointer type plus '0x' prefix //making output equal to linux.
1.659 -# if defined(_STLP_LONG_LONG) && !defined(__MRC__) //*ty 11/24/2001 - MrCpp can not cast from void* to long long
1.660 - _OutputIter result = this->do_put(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned _STLP_LONG_LONG,__val));
1.661 -# else
1.662 - _OutputIter result = this->do_put(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned long,__val));
1.663 -# endif
1.664 - __f.flags(__save_flags);
1.665 - return result;
1.666 -}
1.667 -
1.668 -_STLP_END_NAMESPACE
1.669 -
1.670 -# endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
1.671 -
1.672 -#endif /* _STLP_NUM_PUT_C */
1.673 -
1.674 -// Local Variables:
1.675 -// mode:C++
1.676 -// End: