epoc32/include/stdapis/stlport/stl/_num_get.c
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2  * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
     3  * Copyright (c) 1999
     4  * Silicon Graphics Computer Systems, Inc.
     5  *
     6  * Copyright (c) 1999
     7  * Boris Fomitchev
     8  *
     9  * This material is provided "as is", with absolutely no warranty expressed
    10  * or implied. Any use is at your own risk.
    11  *
    12  * Permission to use or copy this software for any purpose is hereby granted
    13  * without fee, provided the above notices are retained on all copies.
    14  * Permission to modify the code and to distribute modified code is granted,
    15  * provided the above notices are retained, and a notice that the code was
    16  * modified is included with the above copyright notice.
    17  *
    18  */
    19 #ifndef _STLP_NUM_GET_C
    20 #define _STLP_NUM_GET_C
    21 
    22 #ifndef _STLP_INTERNAL_NUM_GET_H
    23 # include <stl/_num_get.h>
    24 #endif
    25 
    26 # if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
    27 
    28 #ifndef _STLP_LIMITS_H
    29 # include <stl/_limits.h>
    30 #endif
    31 
    32 _STLP_DECLSPEC  unsigned char*  __get_digit_val_table(void);
    33 _STLP_DECLSPEC  char*  __get_narrow_atoms(void);
    34 _STLP_BEGIN_NAMESPACE
    35 
    36 extern const unsigned char __digit_val_table[];
    37 
    38 template < class _InputIter, class _Integer, class _CharT>
    39 _InputIter _STLP_CALL
    40 _M_do_get_integer(_InputIter&, _InputIter&, ios_base&, ios_base::iostate&, _Integer&, _CharT*);
    41 
    42 // _M_do_get_integer and its helper functions.
    43 
    44 #ifdef	__SYMBIAN32__
    45 template<class _CharT>
    46 inline bool _STLP_CALL __get_fdigit(_CharT& c, const _CharT* digits)
    47   { 
    48 
    49   const _CharT* p = find(digits, digits + 10, c);
    50   if (p != digits + 10) {
    51     c = (_CharT)( (_CharT)'0' + (p - digits));
    52     return true;
    53   }
    54   else
    55     return false;
    56 }
    57 
    58 #endif
    59 inline bool _STLP_CALL __get_fdigit(char& __c, const char*)
    60   { return __c >= '0' && __c <= '9'; }
    61 
    62 inline bool _STLP_CALL __get_fdigit_or_sep(char& __c, char __sep, const char *)
    63 {
    64   if (__c == __sep) {
    65     __c = ',' ;
    66     return true ;
    67   } else
    68     return  ( __c >= '0' && __c <= '9');
    69 }
    70 
    71 # ifndef _STLP_NO_WCHAR_T
    72 
    73 // Similar, except return the character itself instead of the numeric
    74 // value.  Used for floating-point input.
    75 inline bool  _STLP_CALL __get_fdigit(wchar_t& c, const wchar_t* digits)
    76 {
    77   const wchar_t* p = find(digits, digits + 10, c);
    78   if (p != digits + 10) {
    79     c = (char)('0' + (p - digits));
    80     return true;
    81   }
    82   else
    83     return false;
    84 }
    85 
    86 inline bool  _STLP_CALL __get_fdigit_or_sep(wchar_t& c, wchar_t sep,
    87                                      const wchar_t * digits)
    88 {
    89   if (c == sep) {
    90     c = (char)',';
    91     return true;
    92   }
    93   else
    94     return __get_fdigit(c, digits);
    95 }
    96 #ifdef __SYMBIAN32__
    97 template <class _CharT>
    98 inline bool  _STLP_CALL __get_fdigit_or_sep(_CharT& c, _CharT sep,
    99                                      const _CharT * digits)
   100 {
   101   if (c == sep) {
   102     c = (_CharT)',';
   103     return true;
   104   }
   105   else
   106     return __get_fdigit(c, digits);
   107 }
   108 
   109 
   110 
   111 #endif
   112 #endif
   113 inline int _STLP_CALL
   114 __get_digit_from_table(unsigned __index)
   115 {
   116   return (__index > 127 ? 0xFF : __get_digit_val_table()[__index]);
   117 }
   118 
   119 extern const char __narrow_atoms[];
   120 
   121 template <class _InputIter, class _CharT>
   122 int
   123 _M_get_base_or_zero(_InputIter& __stl_in, _InputIter& __end, ios_base& __str, _CharT*)
   124 {
   125   _CharT __atoms[5];
   126   const ctype<_CharT>& __c_type = use_facet< ctype<_CharT> >(__str.getloc());
   127   // const ctype<_CharT>& __c_type = *(const ctype<_CharT>*)__str._M_ctype_facet();
   128 
   129   __c_type.widen(__get_narrow_atoms(), __get_narrow_atoms() + 5, __atoms);
   130 
   131   bool __negative = false;
   132   _CharT __c = *__stl_in;
   133 
   134   if (__c == __atoms[1] /* __xminus_char */ ) {
   135     __negative = true;
   136     ++__stl_in;
   137   }
   138   else if (__c == __atoms[0] /* __xplus_char */ )
   139     ++__stl_in;
   140 
   141 
   142   int __base;
   143   int __valid_zero = 0;
   144 
   145   ios_base::fmtflags __basefield = __str.flags() & ios_base::basefield;
   146 
   147   switch (__basefield) {
   148   case ios_base::oct:
   149     __base = 8;
   150     break;
   151   case ios_base::dec:
   152     __base = 10;
   153     break;
   154   case ios_base::hex:
   155     __base = 16;
   156     if (__stl_in != __end && *__stl_in == __atoms[2] /* __zero_char */ ) {
   157       ++__stl_in;
   158       if (__stl_in != __end &&
   159           (*__stl_in == __atoms[3] /* __x_char */ || *__stl_in == __atoms[4] /* __X_char */ ))
   160         ++__stl_in;
   161       else
   162         __valid_zero = 1; // That zero is valid by itself.
   163     }
   164     break;
   165   default:
   166     if (__stl_in != __end && *__stl_in == __atoms[2] /* __zero_char */ ) {
   167       ++__stl_in;
   168       if (__stl_in != __end &&
   169           (*__stl_in == __atoms[3] /* __x_char */ || *__stl_in == __atoms[4] /* __X_char */ )) {
   170         ++__stl_in;
   171         __base = 16;
   172       }
   173       else
   174         {
   175           __base = 8;
   176           __valid_zero = 1; // That zero is still valid by itself.
   177         }
   178     }
   179     else
   180       __base = 10;
   181     break;
   182   }
   183   return (__base << 2) | ((int)__negative << 1) | __valid_zero;
   184 }
   185 
   186 
   187 template <class _InputIter, class _Integer>
   188 bool _STLP_CALL
   189 __get_integer(_InputIter& __first, _InputIter& __last,
   190 	      int __base, _Integer& __val,
   191 	      int __got, bool __is_negative, char __separator, const string& __grouping, const __true_type&)
   192 {
   193   bool __ovflow = false;
   194   bool __valid_group = true;
   195 
   196   _Integer __result = 0;
   197   bool __is_group = !__grouping.empty();
   198 //  char __group_sizes[64];
   199   char __group_sizes[256] = {0}; //group sizes can be more
   200 #ifdef	__SYMBIAN32__
   201 int __current_group_size = __got;
   202 #else
   203   int __current_group_size = 0;
   204 #endif
   205   char* __group_sizes_end = __group_sizes;
   206    int prv_got = 0;
   207    
   208    
   209   _Integer __over_base = (numeric_limits<_Integer>::min)() / __STATIC_CAST(_Integer, __base);
   210 
   211    for ( ; __first != __last ; ++__first) {
   212 
   213      const char __c = *__first;
   214 
   215      if (__is_group && __c == __separator) {
   216 	 if (prv_got == __got) //no successive seperators
   217 	 	return false;
   218 	 prv_got = __got;
   219        *__group_sizes_end++ = __current_group_size;       
   220        __current_group_size = 0;
   221        continue;
   222      }
   223 
   224      int __n = __get_digit_from_table(__c);
   225 
   226      if (__n >= __base)
   227 	 	break;
   228 
   229      ++__got;
   230      ++__current_group_size;
   231 
   232      if (__result < __over_base)
   233        __ovflow = true;  // don't need to keep accumulating
   234      else {
   235        _Integer __next = __STATIC_CAST(_Integer, __base * __result - __n);
   236        if (__result != 0)
   237 #ifdef	__SYMBIAN32__
   238 	if (__is_negative)
   239 		__ovflow = __ovflow || __next >= __result;
   240 	else
   241 		__ovflow = __ovflow || (__next-1) >= __result; //For signed char, the ranges are -128 to 127, 
   242 #else
   243 	 __ovflow = __ovflow || __next >= __result;
   244 #endif
   245        __result = __next;
   246      }
   247    }
   248 
   249    if (__is_group && __group_sizes_end != __group_sizes) {
   250      *__group_sizes_end++ = __current_group_size;
   251      
   252    }
   253 
   254    // fbp : added to not modify value if nothing was read
   255    if (__got > 0) {
   256        __val = __ovflow
   257 	 ? __is_negative ? (numeric_limits<_Integer>::min)()
   258 	 : (numeric_limits<_Integer>::max)()
   259 	 : (__is_negative ? __result : __STATIC_CAST(_Integer, -__result));
   260    }
   261    __valid_group = __valid_grouping(__group_sizes, __group_sizes_end,
   262 									    __grouping.data(), __grouping.data()+ __grouping.size());
   263 
   264 	if (__valid_group == false)
   265 	__val = 0;
   266 
   267   // overflow is being treated as failure
   268   return ((__got > 0) && !__ovflow) && (__is_group == 0 || __valid_group) ;
   269 }
   270 
   271 template <class _InputIter, class _Integer>
   272 bool _STLP_CALL
   273 __get_integer(_InputIter& __first, _InputIter& __last,
   274 	      int __base, _Integer& __val,
   275 	      int __got, bool __is_negative, char __separator, const string& __grouping, const __false_type&)
   276 {
   277   bool __ovflow = false;
   278   bool __valid_group = true;
   279   _Integer __result = 0;
   280   bool __is_group = !__grouping.empty();
   281 //  char __group_sizes[64];
   282   char __group_sizes[256] = {0};//group sizes can be more
   283   int __current_group_size = 0;
   284   char* __group_sizes_end = __group_sizes;
   285      int prv_got = 0;
   286 
   287  
   288   _Integer  __over_base = (numeric_limits<_Integer>::max)() / __STATIC_CAST(_Integer, __base);
   289 
   290   for ( ; __first != __last ; ++__first) {
   291 
   292     const char __c = *__first;
   293 /*
   294     //if (__is_group && __c == __separator) { //no seperator at the start of number.
   295     if (__is_group && __c == __separator && __got) {
   296       // seperator should come after extracting some digits
   297       	if (!__current_group_size)
   298       		break;
   299      *__group_sizes_end++ = __current_group_size;    
   300       __current_group_size = 0;
   301       continue;
   302     }
   303 */
   304 	if (__is_group && __c == __separator) {
   305 	 if (prv_got == __got) //no successive seperators
   306 	 	return false;
   307 	 	prv_got = __got;
   308        *__group_sizes_end++ = __current_group_size;       
   309        __current_group_size = 0;
   310        continue;
   311      }
   312     int __n = __get_digit_from_table(__c);
   313 
   314     if (__n >= __base)
   315     	break;
   316 
   317     ++__got;
   318     ++__current_group_size;
   319 
   320     if (__result > __over_base)
   321       __ovflow = true;  //don't need to keep accumulating
   322     else {
   323       _Integer __next = __STATIC_CAST(_Integer, __base * __result + __n);
   324 	if (__result != 0)
   325 	  __ovflow = __ovflow || __next <= __result;
   326 	__result = __next;
   327       }
   328   }
   329 
   330   if (__is_group && __group_sizes_end != __group_sizes) {
   331       *__group_sizes_end++ = __current_group_size;     
   332   }
   333 
   334   // fbp : added to not modify value if nothing was read
   335   if (__got > 0) {
   336       __val = __ovflow
   337 	? (numeric_limits<_Integer>::max)()
   338 	: (__is_negative ? __STATIC_CAST(_Integer, -__result) : __result);
   339   }
   340   __valid_group =  __valid_grouping(__group_sizes, __group_sizes_end,
   341 					 __grouping.data(), __grouping.data()+ __grouping.size());
   342 
   343 	if (__valid_group == false)
   344 	__val = 0;
   345 
   346   // overflow is being treated as failure
   347   return ((__got > 0) && !__ovflow) &&
   348     (__is_group == 0 ||__valid_group) ;
   349 }
   350 
   351 
   352 template <class _InputIter, class _Integer>
   353 bool _STLP_CALL
   354 __get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val)
   355 {
   356   string __grp;
   357   return __get_integer(__first, __last, 10, __val, 0, false, ' ', __grp, __false_type());
   358 }
   359 
   360 template <class _InputIter, class _Integer, class _CharT>
   361 _InputIter _STLP_CALL
   362 _M_do_get_integer(_InputIter& __stl_in, _InputIter& __end, ios_base& __str,
   363                   ios_base::iostate& __err, _Integer& __val, _CharT* __pc)
   364 {
   365 
   366 #if defined(__HP_aCC) && (__HP_aCC == 1)
   367   bool _IsSigned = !((_Integer)(-1) > 0);
   368 #else
   369   typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
   370 #endif
   371 
   372   //const numpunct<_CharT>& __numpunct = *(const numpunct<_CharT>*)__str._M_numpunct_facet();
   373   const numpunct<_CharT>& __numpunct = use_facet< numpunct<_CharT> >(__str.getloc());
   374 //  const string& __grouping = __str._M_grouping(); // cached copy //stdcxx fix - 11/1/06
   375   const string& __grouping = __numpunct.grouping();
   376 
   377 
   378   const int __base_or_zero = _M_get_base_or_zero(__stl_in, __end, __str, __pc);
   379   int  __got = __base_or_zero & 1;
   380 
   381   bool __result;
   382 
   383   if (__stl_in == __end) {      // We may have already read a 0.  If so,
   384 
   385     if (__got > 0) {       // the result is 0 even if we're at eof.
   386       __val = 0;
   387       __result = true;
   388     }
   389     else
   390       __result = false;
   391   } else {
   392 
   393     const bool __negative = __base_or_zero & 2;
   394     const int __base = __base_or_zero >> 2;
   395 
   396 #if defined(__HP_aCC) && (__HP_aCC == 1)
   397      if (_IsSigned)
   398        __result = __get_integer(__stl_in, __end, __base,  __val, __got, __negative, __numpunct.thousands_sep(), __grouping, __true_type() );
   399      else
   400       __result = __get_integer(__stl_in, __end, __base,  __val, __got, __negative, __numpunct.thousands_sep(), __grouping, __false_type() );
   401 #else
   402 #ifdef __SYMBIAN32__
   403     _Integer __tval;
   404     __result = __get_integer(__stl_in, __end, __base,  __tval, __got, __negative, __numpunct.thousands_sep(), __grouping, _IsSigned());
   405     if(__result)
   406         __val = __tval;
   407 #else
   408     __result = __get_integer(__stl_in, __end, __base,  __val, __got, __negative, __numpunct.thousands_sep(), __grouping, _IsSigned());
   409 #endif    
   410 # endif
   411   }
   412 
   413   __err = __STATIC_CAST(ios_base::iostate, __result ? ios_base::goodbit : ios_base::failbit);
   414 
   415   if (__stl_in == __end)
   416     __err |= ios_base::eofbit;
   417   return __stl_in;
   418 }
   419 
   420 // _M_read_float and its helper functions.
   421 template <class _InputIter, class _CharT>
   422 _InputIter  _STLP_CALL
   423 __copy_sign(_InputIter __first, _InputIter __last, string& __v,
   424             _CharT __xplus, _CharT __xminus) {
   425     if (__first != __last) {
   426     _CharT __c = *__first;
   427     if (__c == __xplus)
   428       ++__first;
   429     else if (__c == __xminus) {
   430       __v.push_back('-');
   431       ++__first;
   432     }
   433   }
   434   return __first;
   435 }
   436 
   437 
   438 template <class _InputIter, class _CharT>
   439 bool _STLP_CALL
   440 __copy_digits(_InputIter& __first, _InputIter& __last,
   441               string& __v, const _CharT* __digits)
   442 {
   443   bool __ok = false;
   444 
   445   for ( ; __first != __last; ++__first) {
   446     _CharT __c = *__first;
   447     if (__get_fdigit(__c, __digits)) {
   448       __v.push_back((char)__c);
   449       __ok = true;
   450     }
   451     else
   452       break;
   453   }
   454   return __ok;
   455 }
   456 
   457 template <class _InputIter, class _CharT>
   458 bool _STLP_CALL
   459 __copy_grouped_digits(_InputIter& __first, _InputIter& __last,
   460 		      string& __v, const _CharT * __digits,
   461 		      _CharT __sep, const string& __grouping,
   462 		      bool& __grouping_ok)
   463 {
   464   bool __ok = false;
   465 //  char __group_sizes[64];
   466   char __group_sizes[256] = {0};//group sizes can be more
   467   char*__group_sizes_end = __group_sizes;
   468   char __current_group_size = 0;
   469 
   470   for ( ; __first != __last; ++__first) {
   471     _CharT __c = *__first;
   472     bool __tmp = __get_fdigit_or_sep(__c, __sep, __digits);
   473     if (__tmp) {
   474       if (__c == ',') { 
   475       	// seperator should come after extracting some digits
   476       	if (!__current_group_size)
   477       		break;
   478       	
   479         *__group_sizes_end++ = __current_group_size;        
   480         __current_group_size = 0;
   481       }
   482       else {
   483         __ok = true;
   484         __v.push_back((char)__c);
   485         ++__current_group_size;
   486       }
   487     }
   488     else
   489       break;
   490   }
   491 
   492   if (__group_sizes_end != __group_sizes)
   493     *__group_sizes_end++ = __current_group_size;    
   494   __grouping_ok = __valid_grouping(__group_sizes, __group_sizes_end, __grouping.data(), __grouping.data() + __grouping.size());
   495   __ok = __ok & __grouping_ok; //Added, to check for valid grouping. If not valid grouping should return false.
   496   return __ok;
   497 }
   498 
   499 
   500 template <class _InputIter, class _CharT>
   501 bool _STLP_CALL
   502 _M_read_float(string& __buf, _InputIter& __stl_in, _InputIter& __end, ios_base& __s, _CharT*)
   503 {
   504   // Create a string, copying characters of the form
   505   // [+-]? [0-9]* .? [0-9]* ([eE] [+-]? [0-9]+)?
   506 
   507   bool __digits_before_dot /* = false */;
   508   bool __digits_after_dot = false;
   509   bool __ok;
   510 
   511   bool   __grouping_ok = true;
   512 
   513   const ctype<_CharT>& __ct = use_facet< ctype<_CharT> >(__s.getloc());
   514   // const ctype<_CharT>& __ct = *(const ctype<_CharT>*)__s._M_ctype_facet();
   515   //const numpunct<_CharT>& __numpunct = *(const numpunct<_CharT>*)__s._M_numpunct_facet();
   516   const numpunct<_CharT>& __numpunct = use_facet< numpunct<_CharT> >(__s.getloc());
   517 //  const string& __grouping = __s._M_grouping(); // cached copy //stdcxx fix - 11/1/06
   518     const string& __grouping = __numpunct.grouping();
   519 
   520   _CharT __dot = __numpunct.decimal_point();
   521   _CharT __sep = __numpunct.thousands_sep();
   522 
   523   _CharT __digits[10];
   524   _CharT __xplus;
   525   _CharT __xminus;
   526 
   527   _CharT __pow_e;
   528   _CharT __pow_E;
   529 
   530   _Initialize_get_float(__ct, __xplus, __xminus, __pow_e, __pow_E, __digits);
   531 
   532   // Get an optional sign
   533   __stl_in = __copy_sign(__stl_in, __end, __buf, __xplus, __xminus);
   534 
   535   // Get an optional string of digits.
   536   if (__grouping.size() != 0)
   537     __digits_before_dot = __copy_grouped_digits(__stl_in, __end, __buf, __digits,
   538 						__sep, __grouping, __grouping_ok);
   539   else
   540     __digits_before_dot = __copy_digits(__stl_in, __end, __buf, __digits);
   541 
   542   // Get an optional decimal point, and an optional string of digits.
   543   if (__stl_in != __end && *__stl_in == __dot) {
   544     __buf.push_back('.');
   545     ++__stl_in;
   546     __digits_after_dot = __copy_digits(__stl_in, __end, __buf, __digits);
   547   }
   548 
   549   // There have to be some digits, somewhere.
   550   __ok = __digits_before_dot || __digits_after_dot;
   551 
   552   // Get an optional exponent.
   553   if (__ok && __stl_in != __end && (*__stl_in == __pow_e || *__stl_in == __pow_E)) {
   554     __buf.push_back('e');
   555     ++__stl_in;
   556     __stl_in = __copy_sign(__stl_in, __end, __buf, __xplus, __xminus);
   557     __ok = __copy_digits(__stl_in, __end, __buf, __digits);
   558     // If we have an exponent then the sign
   559     // is optional but the digits aren't.
   560   }
   561 
   562   return __ok;
   563 }
   564 
   565 //
   566 // num_get<>, num_put<>
   567 //
   568 
   569 # if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
   570 # if !defined(__LIBSTD_CPP_SYMBIAN32_WSD__) && !defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
   571 template <class _CharT, class _InputIterator>
   572 locale::id num_get<_CharT, _InputIterator>::id;
   573 #endif
   574 # else
   575 
   576 typedef num_get<char, const char*> num_get_char;
   577 typedef num_get<char, istreambuf_iterator<char, char_traits<char> > > num_get_char_2;
   578 
   579 #ifndef __SYMBIAN32__
   580 __DECLARE_INSTANCE(locale::id, num_get_char::id, );
   581 __DECLARE_INSTANCE(locale::id, num_get_char_2::id, );
   582 #endif
   583 
   584 # ifndef _STLP_NO_WCHAR_T
   585 
   586 typedef num_get<wchar_t, const wchar_t*> num_get_wchar_t;
   587 typedef num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > num_get_wchar_t_2;
   588 
   589 #ifndef __SYMBIAN32__
   590 __DECLARE_INSTANCE(locale::id, num_get_wchar_t::id, );
   591 __DECLARE_INSTANCE(locale::id, num_get_wchar_t_2::id, );
   592 #endif
   593 
   594 # endif
   595 
   596 # endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
   597 
   598 # ifndef _STLP_NO_BOOL
   599 template <class _CharT, class _InputIter>
   600 _InputIter
   601 num_get<_CharT, _InputIter>::do_get(_InputIter __stl_in, _InputIter __end,
   602                                     ios_base& __s,
   603                                     ios_base::iostate& __err, bool& __x) const
   604 {
   605   if (__s.flags() & ios_base::boolalpha) {
   606     locale __loc = __s.getloc();
   607     //const _Numpunct& __np = *(const _Numpunct*)__s._M_numpunct_facet();
   608         const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc) ;
   609 //    const ctype<_CharT>& __ct =    use_facet<ctype<_CharT> >(__loc) ;
   610 
   611     const basic_string<_CharT> __truename  = __np.truename();
   612     const basic_string<_CharT> __falsename = __np.falsename();
   613     bool __true_ok  = true;
   614     bool __false_ok = true;
   615 
   616     size_t __n = 0;
   617     for ( ; __stl_in != __end; ++__stl_in) {
   618       _CharT __c = *__stl_in;
   619       __true_ok  = __true_ok  && (__c == __truename[__n]);
   620       __false_ok = __false_ok && (__c == __falsename[__n]);
   621       ++__n;
   622 
   623       if ((!__true_ok && !__false_ok) ||
   624           (__true_ok  && __n >= __truename.size()) ||
   625           (__false_ok && __n >= __falsename.size())) {
   626           
   627           if (__true_ok || __false_ok)  //if anything OK then increment, else, break
   628 		++__stl_in;
   629         break;
   630       }
   631     }
   632 	// stdcxx fix, Changed to check for complete true,false string
   633     if (__true_ok  && __n < __truename.size()) 
   634    {
   635 	for ( ; __stl_in != __end; ++__stl_in) {
   636       		_CharT __c = *__stl_in;
   637       		__true_ok  = __true_ok  && (__c == __truename[__n]);
   638 		++__n;  
   639 		 if ((!__true_ok) ||(__true_ok  && __n >= __truename.size()) )
   640 		 {
   641 		 	if(__true_ok)
   642 		 		++__stl_in;
   643           		break;
   644 		 }
   645 		 	
   646 	}
   647 	 if (__true_ok  && __n < __truename.size()) 
   648 	   	__true_ok  = false;
   649     }
   650     if (__false_ok && __n < __falsename.size())
   651    {
   652 
   653    		for ( ; __stl_in != __end; ++__stl_in) {
   654       		_CharT __c = *__stl_in;
   655       		__false_ok  = __false_ok  && (__c == __falsename[__n]);
   656 		++__n;  
   657 		 if ((!__false_ok) ||(__false_ok  && __n >= __falsename.size()) )         
   658           	{
   659 			if(__false_ok)
   660 				++__stl_in;
   661           		break;
   662 		 }
   663 		 	
   664 		}
   665 		if (__false_ok && __n < __falsename.size())
   666    			__false_ok = false;
   667     }
   668 
   669     if (__true_ok || __false_ok) {
   670       __err = ios_base::goodbit;
   671       __x = __true_ok;
   672     }
   673     else
   674       __err = ios_base::failbit;
   675 
   676     if (__stl_in == __end)
   677       __err |= ios_base::eofbit;
   678 
   679     return __stl_in;
   680   }
   681 
   682   else {
   683     long __lx;
   684     _InputIter __tmp = this->do_get(__stl_in, __end, __s, __err, __lx);
   685     if (!(__err & ios_base::failbit)) {
   686       if (__lx == 0)
   687         __x = false;
   688       else if (__lx == 1)
   689         __x = true;
   690       else
   691         __err |= ios_base::failbit;
   692     }
   693     return __tmp;
   694   }
   695 }
   696 
   697 # endif /* _STLP_NO_BOOL */
   698 
   699 //# ifdef _STLP_FIX_LIBRARY_ISSUES
   700 template <class _CharT, class _InputIter>
   701 _InputIter
   702 num_get<_CharT, _InputIter>::do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   703                                     ios_base::iostate& __err, short& __val) const {
   704   return _M_do_get_integer(__stl_in, __end, __str, __err, __val, (_CharT*)0 );
   705 }
   706 
   707 template <class _CharT, class _InputIter>
   708 _InputIter
   709 num_get<_CharT, _InputIter>::do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   710                                     ios_base::iostate& __err, int& __val) const {
   711   return _M_do_get_integer(__stl_in, __end, __str, __err, __val, (_CharT*)0 );
   712 }
   713 
   714 //# endif
   715 
   716 template <class _CharT, class _InputIter>
   717 _InputIter
   718 num_get<_CharT, _InputIter>::do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   719                                     ios_base::iostate& __err, long& __val) const {
   720   return _M_do_get_integer(__stl_in, __end, __str, __err, __val, (_CharT*)0 );
   721 }
   722 
   723 template <class _CharT, class _InputIter>
   724 _InputIter
   725 num_get<_CharT, _InputIter>::do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   726                                     ios_base::iostate& __err,
   727                                     unsigned short& __val) const {
   728   return _M_do_get_integer(__stl_in, __end, __str, __err, __val, (_CharT*)0 );
   729 }
   730 
   731 template <class _CharT, class _InputIter>
   732 _InputIter
   733 num_get<_CharT, _InputIter>::do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   734                                     ios_base::iostate& __err,
   735                                     unsigned int& __val) const {
   736   return _M_do_get_integer(__stl_in, __end, __str, __err, __val, (_CharT*)0 );
   737 }
   738 
   739 template <class _CharT, class _InputIter>
   740 _InputIter
   741 num_get<_CharT, _InputIter>::do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   742                                     ios_base::iostate& __err,
   743                                     unsigned long& __val) const {
   744   return _M_do_get_integer(__stl_in, __end, __str, __err, __val, (_CharT*)0 );
   745 }
   746 
   747 
   748 template <class _CharT, class _InputIter>
   749 _InputIter
   750 num_get<_CharT, _InputIter>::do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   751                                     ios_base::iostate& __err,
   752                                     float& __val) const {
   753   string __buf ;
   754   bool __ok = _M_read_float(__buf, __stl_in, __end, __str, (_CharT*)0 );
   755   if(__ok) //If success reading float then convert it.
   756   {
   757 #ifdef __SYMBIAN32__
   758     float __tval;
   759     __ok = __string_to_float(__buf, __tval);
   760     if(__ok)
   761         __val = __tval;
   762 #else
   763     __string_to_float(__buf, __val);
   764 #endif    
   765   }
   766   __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit);
   767   if (__stl_in == __end)
   768     __err |= ios_base::eofbit;
   769   return __stl_in;
   770 }
   771 
   772 template <class _CharT, class _InputIter>
   773 _InputIter
   774 num_get<_CharT, _InputIter>::do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   775                                     ios_base::iostate& __err,
   776                                     double& __val) const {
   777   string __buf ;
   778   bool __ok = _M_read_float(__buf, __stl_in, __end, __str, (_CharT*)0 );
   779   if(__ok) //If success reading float then convert it.
   780   {
   781 #ifdef __SYMBIAN32__
   782     double __tval;
   783     __ok = __string_to_float(__buf, __tval);
   784     if(__ok)
   785         __val = __tval;
   786 #else
   787     __string_to_float(__buf, __val);
   788 #endif    
   789   }
   790   __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit);
   791   if (__stl_in == __end)
   792     __err |= ios_base::eofbit;
   793   return __stl_in;
   794 }
   795 
   796 #ifndef _STLP_NO_LONG_DOUBLE
   797 template <class _CharT, class _InputIter>
   798 _InputIter
   799 num_get<_CharT, _InputIter>::do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   800 				    ios_base::iostate& __err,
   801                                     long double& __val) const {
   802   string __buf ;
   803   bool __ok = _M_read_float(__buf, __stl_in, __end, __str, (_CharT*)0 );
   804   if(__ok) //If success reading float then convert it.
   805   {
   806 #ifdef __SYMBIAN32__
   807     long double __tval;
   808     __ok = __string_to_float(__buf, __tval);
   809     if(__ok)
   810         __val = __tval;
   811 #else
   812     __string_to_float(__buf, __val);
   813 #endif    
   814   }
   815   __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit);
   816   if (__stl_in == __end)
   817     __err |= ios_base::eofbit;
   818   return __stl_in;
   819 }
   820 #endif /* _STLP_NO_LONG_DOUBLE */
   821 
   822 template <class _CharT, class _InputIter>
   823 _InputIter
   824 num_get<_CharT, _InputIter>::do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   825                            ios_base::iostate& __err,
   826                            void*& __p) const {
   827 #ifdef	__SYMBIAN32__
   828 	unsigned long __val;	//using only long
   829 #else
   830 # if defined(_STLP_LONG_LONG)&&!defined(__MRC__)		//*ty 12/07/2001 - MrCpp can not cast from long long to void*
   831   unsigned _STLP_LONG_LONG __val;
   832 # else
   833   unsigned long __val;
   834 # endif
   835 #endif //__SYMBIAN32__
   836 #ifdef __SYMBIAN32__
   837     ios_base::fmtflags __save_flags = __str.flags();
   838 
   839     __str.setf(ios_base::hex, ios_base::basefield);
   840     __str.setf(ios_base::showbase);
   841     __str.setf(ios_base::internal, ios_base::adjustfield);
   842     __str.width((sizeof(void*) * 2) + 2);
   843 #endif // __SYMBIAN32__
   844     iter_type __tmp = _M_do_get_integer(__stl_in, __end, __str, __err, __val, (_CharT*)0 );
   845     if (!(__err & ios_base::failbit))
   846       __p = __REINTERPRET_CAST(void*,(long)__val);
   847 #ifdef __SYMBIAN32__
   848     __str.flags(__save_flags);
   849 #endif //__SYMBIAN32__
   850     return __tmp;
   851   }
   852 
   853 
   854 #ifdef _STLP_LONG_LONG
   855 
   856 template <class _CharT, class _InputIter>
   857 _InputIter
   858 num_get<_CharT, _InputIter>::do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   859                                     ios_base::iostate& __err,
   860                                     _STLP_LONG_LONG& __val) const {
   861   return _M_do_get_integer(__stl_in, __end, __str, __err, __val, (_CharT*)0 );
   862 }
   863 
   864 template <class _CharT, class _InputIter>
   865 _InputIter
   866 num_get<_CharT, _InputIter>::do_get(_InputIter __stl_in, _InputIter __end, ios_base& __str,
   867                                     ios_base::iostate& __err,
   868                                     unsigned _STLP_LONG_LONG& __val) const {
   869   return _M_do_get_integer(__stl_in, __end, __str, __err, __val, (_CharT*)0 );
   870 }
   871 
   872 #endif /* _STLP_LONG_LONG */
   873 
   874 _STLP_END_NAMESPACE
   875 
   876 # endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
   877 
   878 #endif /* _STLP_NUMERIC_FACETS_C */
   879 
   880 // Local Variables:
   881 // mode:C++
   882 // End: