1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/tools/stlport/stl/_num_get.c Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,679 @@
1.4 +/*
1.5 + * Copyright (c) 1999
1.6 + * Silicon Graphics Computer Systems, Inc.
1.7 + *
1.8 + * Copyright (c) 1999
1.9 + * Boris Fomitchev
1.10 + *
1.11 + * This material is provided "as is", with absolutely no warranty expressed
1.12 + * or implied. Any use is at your own risk.
1.13 + *
1.14 + * Permission to use or copy this software for any purpose is hereby granted
1.15 + * without fee, provided the above notices are retained on all copies.
1.16 + * Permission to modify the code and to distribute modified code is granted,
1.17 + * provided the above notices are retained, and a notice that the code was
1.18 + * modified is included with the above copyright notice.
1.19 + *
1.20 + */
1.21 +#ifndef _STLP_NUM_GET_C
1.22 +#define _STLP_NUM_GET_C
1.23 +
1.24 +#ifndef _STLP_INTERNAL_NUM_GET_H
1.25 +# include <stl/_num_get.h>
1.26 +#endif
1.27 +
1.28 +#ifndef _STLP_INTERNAL_LIMITS
1.29 +# include <stl/_limits.h>
1.30 +#endif
1.31 +
1.32 +_STLP_BEGIN_NAMESPACE
1.33 +
1.34 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.35 +
1.36 +_STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned);
1.37 +_STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms();
1.38 +
1.39 +template < class _InputIter, class _Integer, class _CharT>
1.40 +_InputIter _STLP_CALL
1.41 +__do_get_integer(_InputIter&, _InputIter&, ios_base&, ios_base::iostate&, _Integer&, _CharT*);
1.42 +
1.43 +// __do_get_integer and its helper functions.
1.44 +
1.45 +inline bool _STLP_CALL __get_fdigit(char __c, const char*)
1.46 +{ return __c >= '0' && __c <= '9'; }
1.47 +
1.48 +inline bool _STLP_CALL __get_fdigit_or_sep(char& __c, char __sep, const char *__digits) {
1.49 + if (__c == __sep) {
1.50 + __c = ',' ;
1.51 + return true ;
1.52 + }
1.53 + else
1.54 + return __get_fdigit(__c, __digits);
1.55 +}
1.56 +
1.57 +inline int _STLP_CALL
1.58 +__get_digit_from_table(unsigned __index)
1.59 +{ return (__index > 127 ? 0xFF : __digit_val_table(__index)); }
1.60 +
1.61 +template <class _InputIter, class _CharT>
1.62 +int
1.63 +__get_base_or_zero(_InputIter& __in_ite, _InputIter& __end, ios_base& __str, _CharT*) {
1.64 + _CharT __atoms[5];
1.65 + const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __str._M_ctype_facet());
1.66 +
1.67 + __c_type.widen(__narrow_atoms(), __narrow_atoms() + 5, __atoms);
1.68 +
1.69 + bool __negative = false;
1.70 + _CharT __c = *__in_ite;
1.71 +
1.72 + if (__c == __atoms[1] /* __xminus_char */ ) {
1.73 + __negative = true;
1.74 + ++__in_ite;
1.75 + }
1.76 + else if (__c == __atoms[0] /* __xplus_char */ )
1.77 + ++__in_ite;
1.78 +
1.79 + int __base;
1.80 + int __valid_zero = 0;
1.81 +
1.82 + ios_base::fmtflags __basefield = __str.flags() & ios_base::basefield;
1.83 +
1.84 + switch (__basefield) {
1.85 + case ios_base::oct:
1.86 + __base = 8;
1.87 + break;
1.88 + case ios_base::dec:
1.89 + __base = 10;
1.90 + break;
1.91 + case ios_base::hex:
1.92 + __base = 16;
1.93 + if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
1.94 + ++__in_ite;
1.95 + if (__in_ite != __end &&
1.96 + (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ ))
1.97 + ++__in_ite;
1.98 + else
1.99 + __valid_zero = 1; // That zero is valid by itself.
1.100 + }
1.101 + break;
1.102 + default:
1.103 + if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
1.104 + ++__in_ite;
1.105 + if (__in_ite != __end &&
1.106 + (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) {
1.107 + ++__in_ite;
1.108 + __base = 16;
1.109 + }
1.110 + else
1.111 + {
1.112 + __base = 8;
1.113 + __valid_zero = 1; // That zero is still valid by itself.
1.114 + }
1.115 + }
1.116 + else
1.117 + __base = 10;
1.118 + break;
1.119 + }
1.120 + return (__base << 2) | ((int)__negative << 1) | __valid_zero;
1.121 +}
1.122 +
1.123 +
1.124 +template <class _InputIter, class _Integer, class _CharT>
1.125 +bool _STLP_CALL
1.126 +__get_integer(_InputIter& __first, _InputIter& __last,
1.127 + int __base, _Integer& __val,
1.128 + int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __true_type& /*_IsSigned*/) {
1.129 + bool __ovflow = false;
1.130 + _Integer __result = 0;
1.131 + bool __is_group = !__grouping.empty();
1.132 + char __group_sizes[64];
1.133 + char __current_group_size = 0;
1.134 + char* __group_sizes_end = __group_sizes;
1.135 +
1.136 + _Integer __over_base = (numeric_limits<_Integer>::min)() / __STATIC_CAST(_Integer, __base);
1.137 +
1.138 + for ( ; __first != __last ; ++__first) {
1.139 +
1.140 + const _CharT __c = *__first;
1.141 +
1.142 + if (__is_group && __c == __separator) {
1.143 + *__group_sizes_end++ = __current_group_size;
1.144 + __current_group_size = 0;
1.145 + continue;
1.146 + }
1.147 +
1.148 + int __n = __get_digit_from_table(__c);
1.149 +
1.150 + if (__n >= __base)
1.151 + break;
1.152 +
1.153 + ++__got;
1.154 + ++__current_group_size;
1.155 +
1.156 + if (__result < __over_base)
1.157 + __ovflow = true; // don't need to keep accumulating
1.158 + else {
1.159 + _Integer __next = __STATIC_CAST(_Integer, __base * __result - __n);
1.160 + if (__result != 0)
1.161 + __ovflow = __ovflow || __next >= __result;
1.162 + __result = __next;
1.163 + }
1.164 + }
1.165 +
1.166 + if (__is_group && __group_sizes_end != __group_sizes) {
1.167 + *__group_sizes_end++ = __current_group_size;
1.168 + }
1.169 +
1.170 + // fbp : added to not modify value if nothing was read
1.171 + if (__got > 0) {
1.172 + __val = __ovflow ? __is_negative ? (numeric_limits<_Integer>::min)()
1.173 + : (numeric_limits<_Integer>::max)()
1.174 + : __is_negative ? __result
1.175 + : __STATIC_CAST(_Integer, -__result);
1.176 + }
1.177 + // overflow is being treated as failure
1.178 + return ((__got > 0) && !__ovflow) &&
1.179 + (__is_group == 0 ||
1.180 + __valid_grouping(__group_sizes, __group_sizes_end,
1.181 + __grouping.data(), __grouping.data()+ __grouping.size()));
1.182 +}
1.183 +
1.184 +template <class _InputIter, class _Integer, class _CharT>
1.185 +bool _STLP_CALL
1.186 +__get_integer(_InputIter& __first, _InputIter& __last,
1.187 + int __base, _Integer& __val,
1.188 + int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __false_type& /*_IsSigned*/) {
1.189 + bool __ovflow = false;
1.190 + _Integer __result = 0;
1.191 + bool __is_group = !__grouping.empty();
1.192 + char __group_sizes[64];
1.193 + char __current_group_size = 0;
1.194 + char* __group_sizes_end = __group_sizes;
1.195 +
1.196 + _Integer __over_base = (numeric_limits<_Integer>::max)() / __STATIC_CAST(_Integer, __base);
1.197 +
1.198 + for ( ; __first != __last ; ++__first) {
1.199 +
1.200 + const _CharT __c = *__first;
1.201 +
1.202 + if (__is_group && __c == __separator) {
1.203 + *__group_sizes_end++ = __current_group_size;
1.204 + __current_group_size = 0;
1.205 + continue;
1.206 + }
1.207 +
1.208 + int __n = __get_digit_from_table(__c);
1.209 +
1.210 + if (__n >= __base)
1.211 + break;
1.212 +
1.213 + ++__got;
1.214 + ++__current_group_size;
1.215 +
1.216 + if (__result > __over_base)
1.217 + __ovflow = true; //don't need to keep accumulating
1.218 + else {
1.219 + _Integer __next = __STATIC_CAST(_Integer, __base * __result + __n);
1.220 + if (__result != 0)
1.221 + __ovflow = __ovflow || __next <= __result;
1.222 + __result = __next;
1.223 + }
1.224 + }
1.225 +
1.226 + if (__is_group && __group_sizes_end != __group_sizes) {
1.227 + *__group_sizes_end++ = __current_group_size;
1.228 + }
1.229 +
1.230 + // fbp : added to not modify value if nothing was read
1.231 + if (__got > 0) {
1.232 + __val = __ovflow ? (numeric_limits<_Integer>::max)()
1.233 + : (__is_negative ? __STATIC_CAST(_Integer, -__result)
1.234 + : __result);
1.235 + }
1.236 +
1.237 + // overflow is being treated as failure
1.238 + return ((__got > 0) && !__ovflow) &&
1.239 + (__is_group == 0 ||
1.240 + __valid_grouping(__group_sizes, __group_sizes_end,
1.241 + __grouping.data(), __grouping.data()+ __grouping.size()));
1.242 +}
1.243 +
1.244 +
1.245 +template <class _InputIter, class _Integer, class _CharT>
1.246 +bool _STLP_CALL
1.247 +__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT* /*dummy*/) {
1.248 + string __grp;
1.249 + //Here there is no grouping so separator is not important, we just pass the default charater.
1.250 + return __get_integer(__first, __last, 10, __val, 0, false, _CharT() /*separator*/, __grp, __false_type());
1.251 +}
1.252 +
1.253 +template <class _InputIter, class _Integer, class _CharT>
1.254 +_InputIter _STLP_CALL
1.255 +__do_get_integer(_InputIter& __in_ite, _InputIter& __end, ios_base& __str,
1.256 + ios_base::iostate& __err, _Integer& __val, _CharT* __pc) {
1.257 +#if defined (__HP_aCC) && (__HP_aCC == 1)
1.258 + bool _IsSigned = !((_Integer)(-1) > 0);
1.259 +#else
1.260 + typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
1.261 +#endif
1.262 +
1.263 + const numpunct<_CharT>& __numpunct = *__STATIC_CAST(const numpunct<_CharT>*, __str._M_numpunct_facet());
1.264 + const string& __grouping = __str._M_grouping(); // cached copy
1.265 +
1.266 + const int __base_or_zero = __get_base_or_zero(__in_ite, __end, __str, __pc);
1.267 + int __got = __base_or_zero & 1;
1.268 +
1.269 + bool __result;
1.270 +
1.271 + if (__in_ite == __end) { // We may have already read a 0. If so,
1.272 +
1.273 + if (__got > 0) { // the result is 0 even if we're at eof.
1.274 + __val = 0;
1.275 + __result = true;
1.276 + }
1.277 + else
1.278 + __result = false;
1.279 + }
1.280 + else {
1.281 + const bool __negative = (__base_or_zero & 2) != 0;
1.282 + const int __base = __base_or_zero >> 2;
1.283 +
1.284 +#if defined (__HP_aCC) && (__HP_aCC == 1)
1.285 + if (_IsSigned)
1.286 + __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, __true_type() );
1.287 + else
1.288 + __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, __false_type() );
1.289 +#else
1.290 + __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, _IsSigned());
1.291 +# endif
1.292 + }
1.293 +
1.294 + __err = __STATIC_CAST(ios_base::iostate, __result ? ios_base::goodbit : ios_base::failbit);
1.295 +
1.296 + if (__in_ite == __end)
1.297 + __err |= ios_base::eofbit;
1.298 + return __in_ite;
1.299 +}
1.300 +
1.301 +// __read_float and its helper functions.
1.302 +template <class _InputIter, class _CharT>
1.303 +_InputIter _STLP_CALL
1.304 +__copy_sign(_InputIter __first, _InputIter __last, __iostring& __v,
1.305 + _CharT __xplus, _CharT __xminus) {
1.306 + if (__first != __last) {
1.307 + _CharT __c = *__first;
1.308 + if (__c == __xplus)
1.309 + ++__first;
1.310 + else if (__c == __xminus) {
1.311 + __v.push_back('-');
1.312 + ++__first;
1.313 + }
1.314 + }
1.315 + return __first;
1.316 +}
1.317 +
1.318 +
1.319 +template <class _InputIter, class _CharT>
1.320 +bool _STLP_CALL
1.321 +__copy_digits(_InputIter& __first, _InputIter __last,
1.322 + __iostring& __v, const _CharT* __digits) {
1.323 + bool __ok = false;
1.324 +
1.325 + for ( ; __first != __last; ++__first) {
1.326 + _CharT __c = *__first;
1.327 + if (__get_fdigit(__c, __digits)) {
1.328 + __v.push_back((char)__c);
1.329 + __ok = true;
1.330 + }
1.331 + else
1.332 + break;
1.333 + }
1.334 + return __ok;
1.335 +}
1.336 +
1.337 +template <class _InputIter, class _CharT>
1.338 +bool _STLP_CALL
1.339 +__copy_grouped_digits(_InputIter& __first, _InputIter __last,
1.340 + __iostring& __v, const _CharT * __digits,
1.341 + _CharT __sep, const string& __grouping,
1.342 + bool& __grouping_ok) {
1.343 + bool __ok = false;
1.344 + char __group_sizes[64];
1.345 + char*__group_sizes_end = __group_sizes;
1.346 + char __current_group_size = 0;
1.347 +
1.348 + for ( ; __first != __last; ++__first) {
1.349 + _CharT __c = *__first;
1.350 + bool __tmp = __get_fdigit_or_sep(__c, __sep, __digits);
1.351 + if (__tmp) {
1.352 + if (__c == ',') {
1.353 + *__group_sizes_end++ = __current_group_size;
1.354 + __current_group_size = 0;
1.355 + }
1.356 + else {
1.357 + __ok = true;
1.358 + __v.push_back((char)__c);
1.359 + ++__current_group_size;
1.360 + }
1.361 + }
1.362 + else
1.363 + break;
1.364 + }
1.365 +
1.366 + if (__group_sizes_end != __group_sizes)
1.367 + *__group_sizes_end++ = __current_group_size;
1.368 + __grouping_ok = __valid_grouping(__group_sizes, __group_sizes_end, __grouping.data(), __grouping.data() + __grouping.size());
1.369 + return __ok;
1.370 +}
1.371 +
1.372 +
1.373 +template <class _InputIter, class _CharT>
1.374 +bool _STLP_CALL
1.375 +__read_float(__iostring& __buf, _InputIter& __in_ite, _InputIter& __end, ios_base& __s, _CharT*) {
1.376 + // Create a string, copying characters of the form
1.377 + // [+-]? [0-9]* .? [0-9]* ([eE] [+-]? [0-9]+)?
1.378 +
1.379 + bool __digits_before_dot /* = false */;
1.380 + bool __digits_after_dot = false;
1.381 + bool __ok;
1.382 +
1.383 + bool __grouping_ok = true;
1.384 +
1.385 + const ctype<_CharT>& __ct = *__STATIC_CAST(const ctype<_CharT>*, __s._M_ctype_facet());
1.386 + const numpunct<_CharT>& __numpunct = *__STATIC_CAST(const numpunct<_CharT>*, __s._M_numpunct_facet());
1.387 + const string& __grouping = __s._M_grouping(); // cached copy
1.388 +
1.389 + _CharT __dot = __numpunct.decimal_point();
1.390 + _CharT __sep = __numpunct.thousands_sep();
1.391 +
1.392 + _CharT __digits[10];
1.393 + _CharT __xplus;
1.394 + _CharT __xminus;
1.395 +
1.396 + _CharT __pow_e;
1.397 + _CharT __pow_E;
1.398 +
1.399 + _Initialize_get_float(__ct, __xplus, __xminus, __pow_e, __pow_E, __digits);
1.400 +
1.401 + // Get an optional sign
1.402 + __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
1.403 +
1.404 + // Get an optional string of digits.
1.405 + if (!__grouping.empty())
1.406 + __digits_before_dot = __copy_grouped_digits(__in_ite, __end, __buf, __digits,
1.407 + __sep, __grouping, __grouping_ok);
1.408 + else
1.409 + __digits_before_dot = __copy_digits(__in_ite, __end, __buf, __digits);
1.410 +
1.411 + // Get an optional decimal point, and an optional string of digits.
1.412 + if (__in_ite != __end && *__in_ite == __dot) {
1.413 + __buf.push_back('.');
1.414 + ++__in_ite;
1.415 + __digits_after_dot = __copy_digits(__in_ite, __end, __buf, __digits);
1.416 + }
1.417 +
1.418 + // There have to be some digits, somewhere.
1.419 + __ok = __digits_before_dot || __digits_after_dot;
1.420 +
1.421 + // Get an optional exponent.
1.422 + if (__ok && __in_ite != __end && (*__in_ite == __pow_e || *__in_ite == __pow_E)) {
1.423 + __buf.push_back('e');
1.424 + ++__in_ite;
1.425 + __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
1.426 + __ok = __copy_digits(__in_ite, __end, __buf, __digits);
1.427 + // If we have an exponent then the sign
1.428 + // is optional but the digits aren't.
1.429 + }
1.430 +
1.431 + return __ok;
1.432 +}
1.433 +
1.434 +_STLP_MOVE_TO_STD_NAMESPACE
1.435 +
1.436 +//
1.437 +// num_get<>, num_put<>
1.438 +//
1.439 +
1.440 +#if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
1.441 +# if !defined (__BORLANDC__)
1.442 +template <class _CharT, class _InputIterator>
1.443 +locale::id num_get<_CharT, _InputIterator>::id;
1.444 +# endif
1.445 +
1.446 +# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \
1.447 + defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)
1.448 +/*
1.449 + * Under cygwin, when STLport is used as a shared library, the id needs
1.450 + * to be specified as imported otherwise they will be duplicated in the
1.451 + * calling executable.
1.452 + */
1.453 +template <>
1.454 +_STLP_DECLSPEC locale::id num_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
1.455 +/*
1.456 +template <>
1.457 +_STLP_DECLSPEC locale::id num_get<char, const char*>::id;
1.458 +*/
1.459 +
1.460 +# if !defined (STLP_NO_WCHAR_T)
1.461 +template <>
1.462 +_STLP_DECLSPEC locale::id num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.463 +/*
1.464 +template <>
1.465 +_STLP_DECLSPEC locale::id num_get<wchar_t, const wchar_t*>::id;
1.466 +*/
1.467 +# endif
1.468 +
1.469 +# endif /* __CYGWIN__ && _STLP_USE_DYNAMIC_LIB */
1.470 +
1.471 +#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
1.472 +
1.473 +//typedef num_get<char, const char*> num_get_char;
1.474 +typedef num_get<char, istreambuf_iterator<char, char_traits<char> > > num_get_char_2;
1.475 +
1.476 +//__DECLARE_INSTANCE(locale::id, num_get_char::id, );
1.477 +__DECLARE_INSTANCE(locale::id, num_get_char_2::id, );
1.478 +
1.479 +# if !defined (_STLP_NO_WCHAR_T)
1.480 +
1.481 +//typedef num_get<wchar_t, const wchar_t*> num_get_wchar_t;
1.482 +typedef num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > num_get_wchar_t_2;
1.483 +
1.484 +//__DECLARE_INSTANCE(locale::id, num_get_wchar_t::id, );
1.485 +__DECLARE_INSTANCE(locale::id, num_get_wchar_t_2::id, );
1.486 +
1.487 +# endif
1.488 +
1.489 +#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
1.490 +
1.491 +#if !defined (_STLP_NO_BOOL)
1.492 +template <class _CharT, class _InputIter>
1.493 +_InputIter
1.494 +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end,
1.495 + ios_base& __s,
1.496 + ios_base::iostate& __err, bool& __x) const {
1.497 + if (__s.flags() & ios_base::boolalpha) {
1.498 + locale __loc = __s.getloc();
1.499 + const _Numpunct& __np = *__STATIC_CAST(const _Numpunct*, __s._M_numpunct_facet());
1.500 + // const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc) ;
1.501 +// const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc) ;
1.502 +
1.503 + const basic_string<_CharT> __truename = __np.truename();
1.504 + const basic_string<_CharT> __falsename = __np.falsename();
1.505 + bool __true_ok = true;
1.506 + bool __false_ok = true;
1.507 +
1.508 + size_t __n = 0;
1.509 + for ( ; __in_ite != __end; ++__in_ite) {
1.510 + _CharT __c = *__in_ite;
1.511 + __true_ok = __true_ok && (__c == __truename[__n]);
1.512 + __false_ok = __false_ok && (__c == __falsename[__n]);
1.513 + ++__n;
1.514 +
1.515 + if ((!__true_ok && !__false_ok) ||
1.516 + (__true_ok && __n >= __truename.size()) ||
1.517 + (__false_ok && __n >= __falsename.size())) {
1.518 + ++__in_ite;
1.519 + break;
1.520 + }
1.521 + }
1.522 + if (__true_ok && __n < __truename.size()) __true_ok = false;
1.523 + if (__false_ok && __n < __falsename.size()) __false_ok = false;
1.524 +
1.525 + if (__true_ok || __false_ok) {
1.526 + __err = ios_base::goodbit;
1.527 + __x = __true_ok;
1.528 + }
1.529 + else
1.530 + __err = ios_base::failbit;
1.531 +
1.532 + if (__in_ite == __end)
1.533 + __err |= ios_base::eofbit;
1.534 +
1.535 + return __in_ite;
1.536 + }
1.537 +
1.538 + else {
1.539 + long __lx;
1.540 + _InputIter __tmp = this->do_get(__in_ite, __end, __s, __err, __lx);
1.541 + if (!(__err & ios_base::failbit)) {
1.542 + if (__lx == 0)
1.543 + __x = false;
1.544 + else if (__lx == 1)
1.545 + __x = true;
1.546 + else
1.547 + __err |= ios_base::failbit;
1.548 + }
1.549 + return __tmp;
1.550 + }
1.551 +}
1.552 +
1.553 +#endif /* _STLP_NO_BOOL */
1.554 +
1.555 +#if defined (_STLP_FIX_LIBRARY_ISSUES)
1.556 +template <class _CharT, class _InputIter>
1.557 +_InputIter
1.558 +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
1.559 + ios_base::iostate& __err, short& __val) const
1.560 +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
1.561 +
1.562 +template <class _CharT, class _InputIter>
1.563 +_InputIter
1.564 +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
1.565 + ios_base::iostate& __err, int& __val) const
1.566 +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
1.567 +
1.568 +#endif
1.569 +
1.570 +template <class _CharT, class _InputIter>
1.571 +_InputIter
1.572 +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
1.573 + ios_base::iostate& __err, long& __val) const
1.574 +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
1.575 +
1.576 +template <class _CharT, class _InputIter>
1.577 +_InputIter
1.578 +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
1.579 + ios_base::iostate& __err,
1.580 + unsigned short& __val) const
1.581 +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
1.582 +
1.583 +template <class _CharT, class _InputIter>
1.584 +_InputIter
1.585 +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
1.586 + ios_base::iostate& __err,
1.587 + unsigned int& __val) const
1.588 +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
1.589 +
1.590 +template <class _CharT, class _InputIter>
1.591 +_InputIter
1.592 +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
1.593 + ios_base::iostate& __err,
1.594 + unsigned long& __val) const
1.595 +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
1.596 +
1.597 +
1.598 +template <class _CharT, class _InputIter>
1.599 +_InputIter
1.600 +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
1.601 + ios_base::iostate& __err,
1.602 + float& __val) const {
1.603 + _STLP_PRIV __iostring __buf ;
1.604 + bool __ok = _STLP_PRIV __read_float(__buf, __in_ite, __end, __str, (_CharT*)0 );
1.605 + _STLP_PRIV __string_to_float(__buf, __val);
1.606 + __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit);
1.607 + if (__in_ite == __end)
1.608 + __err |= ios_base::eofbit;
1.609 + return __in_ite;
1.610 +}
1.611 +
1.612 +template <class _CharT, class _InputIter>
1.613 +_InputIter
1.614 +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
1.615 + ios_base::iostate& __err,
1.616 + double& __val) const {
1.617 + _STLP_PRIV __iostring __buf ;
1.618 + bool __ok = _STLP_PRIV __read_float(__buf, __in_ite, __end, __str, (_CharT*)0 );
1.619 + _STLP_PRIV __string_to_float(__buf, __val);
1.620 + __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit);
1.621 + if (__in_ite == __end)
1.622 + __err |= ios_base::eofbit;
1.623 + return __in_ite;
1.624 +}
1.625 +
1.626 +#if !defined (_STLP_NO_LONG_DOUBLE)
1.627 +template <class _CharT, class _InputIter>
1.628 +_InputIter
1.629 +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
1.630 + ios_base::iostate& __err,
1.631 + long double& __val) const {
1.632 + _STLP_PRIV __iostring __buf ;
1.633 + bool __ok = _STLP_PRIV __read_float(__buf, __in_ite, __end, __str, (_CharT*)0 );
1.634 + _STLP_PRIV __string_to_float(__buf, __val);
1.635 + __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit);
1.636 + if (__in_ite == __end)
1.637 + __err |= ios_base::eofbit;
1.638 + return __in_ite;
1.639 +}
1.640 +#endif /* _STLP_NO_LONG_DOUBLE */
1.641 +
1.642 +template <class _CharT, class _InputIter>
1.643 +_InputIter
1.644 +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
1.645 + ios_base::iostate& __err,
1.646 + void*& __p) const {
1.647 +#if defined (_STLP_LONG_LONG) && !defined (__MRC__) //*ty 12/07/2001 - MrCpp can not cast from long long to void*
1.648 + unsigned _STLP_LONG_LONG __val;
1.649 +#else
1.650 + unsigned long __val;
1.651 +#endif
1.652 + iter_type __tmp = _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 );
1.653 + if (!(__err & ios_base::failbit))
1.654 + __p = __REINTERPRET_CAST(void*,__val);
1.655 + return __tmp;
1.656 + }
1.657 +
1.658 +#if defined (_STLP_LONG_LONG)
1.659 +template <class _CharT, class _InputIter>
1.660 +_InputIter
1.661 +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
1.662 + ios_base::iostate& __err,
1.663 + _STLP_LONG_LONG& __val) const {
1.664 + return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 );
1.665 +}
1.666 +
1.667 +template <class _CharT, class _InputIter>
1.668 +_InputIter
1.669 +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
1.670 + ios_base::iostate& __err,
1.671 + unsigned _STLP_LONG_LONG& __val) const {
1.672 + return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 );
1.673 +}
1.674 +#endif /* _STLP_LONG_LONG */
1.675 +
1.676 +_STLP_END_NAMESPACE
1.677 +
1.678 +#endif /* _STLP_NUMERIC_FACETS_C */
1.679 +
1.680 +// Local Variables:
1.681 +// mode:C++
1.682 +// End: