• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 1999
3  * Silicon Graphics Computer Systems, Inc.
4  *
5  * Copyright (c) 1999
6  * Boris Fomitchev
7  *
8  * This material is provided "as is", with absolutely no warranty expressed
9  * or implied. Any use is at your own risk.
10  *
11  * Permission to use or copy this software for any purpose is hereby granted
12  * without fee, provided the above notices are retained on all copies.
13  * Permission to modify the code and to distribute modified code is granted,
14  * provided the above notices are retained, and a notice that the code was
15  * modified is included with the above copyright notice.
16  *
17  */
18 #ifndef _STLP_NUM_GET_C
19 #define _STLP_NUM_GET_C
20 
21 #ifndef _STLP_INTERNAL_NUM_GET_H
22 #  include <stl/_num_get.h>
23 #endif
24 
25 #ifndef _STLP_INTERNAL_LIMITS
26 #  include <stl/_limits.h>
27 #endif
28 
29 _STLP_BEGIN_NAMESPACE
30 
31 _STLP_MOVE_TO_PRIV_NAMESPACE
32 
33 _STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned);
34 _STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms();
35 
36 // __do_get_integer, __do_get_float and its helper functions.
37 
__get_fdigit(char __c,const char *)38 inline bool _STLP_CALL __get_fdigit(char __c, const char*)
39 { return __c >= '0' && __c <= '9'; }
40 
__get_fdigit_or_sep(char & __c,char __sep,const char * __digits)41 inline bool _STLP_CALL __get_fdigit_or_sep(char& __c, char __sep, const char *__digits) {
42   if (__c == __sep) {
43     __c = ',' ;
44     return true ;
45   }
46   else
47     return  __get_fdigit(__c, __digits);
48 }
49 
50 inline int _STLP_CALL
__get_digit_from_table(unsigned __index)51 __get_digit_from_table(unsigned __index)
52 { return (__index > 127 ? 0xFF : __digit_val_table(__index)); }
53 
54 template <class _InputIter, class _CharT>
55 int
__get_base_or_zero(_InputIter & __in_ite,_InputIter & __end,ios_base::fmtflags __flags,const ctype<_CharT> & __c_type)56 __get_base_or_zero(_InputIter& __in_ite, _InputIter& __end,
57                    ios_base::fmtflags __flags, const ctype<_CharT>& __c_type) {
58   _CharT __atoms[5];
59   __c_type.widen(__narrow_atoms(), __narrow_atoms() + 5, __atoms);
60 
61   bool __negative = false;
62   _CharT __c = *__in_ite;
63 
64   if (__c == __atoms[1] /* __xminus_char */ ) {
65     __negative = true;
66     ++__in_ite;
67   }
68   else if (__c == __atoms[0] /* __xplus_char */ )
69     ++__in_ite;
70 
71   int __base;
72   int __valid_zero = 0;
73 
74   ios_base::fmtflags __basefield = __flags & ios_base::basefield;
75 
76   switch (__basefield) {
77   case ios_base::oct:
78     __base = 8;
79     break;
80   case ios_base::dec:
81     __base = 10;
82     break;
83   case ios_base::hex:
84     __base = 16;
85     if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
86       ++__in_ite;
87       if (__in_ite != __end &&
88           (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ ))
89         ++__in_ite;
90       else
91         __valid_zero = 1; // That zero is valid by itself.
92     }
93     break;
94   default:
95     if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
96       ++__in_ite;
97       if (__in_ite != __end &&
98           (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) {
99         ++__in_ite;
100         __base = 16;
101       }
102       else
103         {
104           __base = 8;
105           __valid_zero = 1; // That zero is still valid by itself.
106         }
107     }
108     else
109       __base = 10;
110     break;
111   }
112   return (__base << 2) | ((int)__negative << 1) | __valid_zero;
113 }
114 
115 
116 template <class _InputIter, class _Integer, class _CharT>
117 bool _STLP_CALL
__get_integer(_InputIter & __first,_InputIter & __last,int __base,_Integer & __val,int __got,bool __is_negative,_CharT __separator,const string & __grouping,const __true_type &)118 __get_integer(_InputIter& __first, _InputIter& __last,
119               int __base, _Integer& __val,
120               int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __true_type& /*_IsSigned*/) {
121   bool __ovflow = false;
122   _Integer __result = 0;
123   bool __is_group = !__grouping.empty();
124   char __group_sizes[64];
125   char __current_group_size = 0;
126   char* __group_sizes_end = __group_sizes;
127 
128   _Integer __over_base = (numeric_limits<_Integer>::min)() / __STATIC_CAST(_Integer, __base);
129 
130    for ( ; __first != __last ; ++__first) {
131 
132      const _CharT __c = *__first;
133 
134      if (__is_group && __c == __separator) {
135        *__group_sizes_end++ = __current_group_size;
136        __current_group_size = 0;
137        continue;
138      }
139 
140      int __n = __get_digit_from_table(__c);
141 
142      if (__n >= __base)
143        break;
144 
145      ++__got;
146      ++__current_group_size;
147 
148      if (__result < __over_base)
149        __ovflow = true;  // don't need to keep accumulating
150      else {
151        _Integer __next = __STATIC_CAST(_Integer, __base * __result - __n);
152        if (__result != 0)
153          __ovflow = __ovflow || __next >= __result;
154        __result = __next;
155      }
156    }
157 
158    if ((__result == (numeric_limits<_Integer>::min)()) && !__is_negative)
159      __ovflow = true;
160 
161    if (__is_group && __group_sizes_end != __group_sizes) {
162      *__group_sizes_end++ = __current_group_size;
163    }
164 
165    // fbp : added to not modify value if nothing was read
166    if (__got > 0) {
167        __val = __ovflow ? __is_negative ? (numeric_limits<_Integer>::min)()
168                                         : (numeric_limits<_Integer>::max)()
169                         : __is_negative ? __result
170                                         : __STATIC_CAST(_Integer, -__result);
171    }
172   // overflow is being treated as failure
173   return ((__got > 0) && !__ovflow) &&
174           (__is_group == 0 ||
175            __valid_grouping(__group_sizes, __group_sizes_end,
176                             __grouping.data(), __grouping.data()+ __grouping.size()));
177 }
178 
179 template <class _InputIter, class _Integer, class _CharT>
180 bool _STLP_CALL
__get_integer(_InputIter & __first,_InputIter & __last,int __base,_Integer & __val,int __got,bool __is_negative,_CharT __separator,const string & __grouping,const __false_type &)181 __get_integer(_InputIter& __first, _InputIter& __last,
182               int __base, _Integer& __val,
183               int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __false_type& /*_IsSigned*/) {
184   bool __ovflow = false;
185   _Integer __result = 0;
186   bool __is_group = !__grouping.empty();
187   char __group_sizes[64];
188   char __current_group_size = 0;
189   char* __group_sizes_end = __group_sizes;
190 
191   _Integer  __over_base = (numeric_limits<_Integer>::max)() / __STATIC_CAST(_Integer, __base);
192 
193   for ( ; __first != __last ; ++__first) {
194 
195     const _CharT __c = *__first;
196 
197     if (__is_group && __c == __separator) {
198       *__group_sizes_end++ = __current_group_size;
199       __current_group_size = 0;
200       continue;
201     }
202 
203     int __n = __get_digit_from_table(__c);
204 
205     if (__n >= __base)
206       break;
207 
208     ++__got;
209     ++__current_group_size;
210 
211     if (__result > __over_base)
212       __ovflow = true;  //don't need to keep accumulating
213     else {
214       _Integer __next = __STATIC_CAST(_Integer, __base * __result + __n);
215       if (__result != 0)
216         __ovflow = __ovflow || __next <= __result;
217         __result = __next;
218       }
219   }
220 
221   if (__is_group && __group_sizes_end != __group_sizes) {
222       *__group_sizes_end++ = __current_group_size;
223   }
224 
225   // fbp : added to not modify value if nothing was read
226   if (__got > 0) {
227       __val = __ovflow ? (numeric_limits<_Integer>::max)()
228                        : (__is_negative ? __STATIC_CAST(_Integer, -__result)
229                                         : __result);
230   }
231 
232   // overflow is being treated as failure
233   return ((__got > 0) && !__ovflow) &&
234           (__is_group == 0 ||
235            __valid_grouping(__group_sizes, __group_sizes_end,
236                             __grouping.data(), __grouping.data()+ __grouping.size()));
237 }
238 
239 
240 template <class _InputIter, class _Integer, class _CharT>
241 bool _STLP_CALL
__get_decimal_integer(_InputIter & __first,_InputIter & __last,_Integer & __val,_CharT *)242 __get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT* /*dummy*/) {
243   string __grp;
244   //Here there is no grouping so separator is not important, we just pass the default character.
245   return __get_integer(__first, __last, 10, __val, 0, false, _CharT() /*separator*/, __grp, __false_type());
246 }
247 
248 template <class _InputIter, class _Integer, class _CharT>
249 _InputIter _STLP_CALL
__do_get_integer(_InputIter & __in_ite,_InputIter & __end,ios_base & __str,ios_base::iostate & __err,_Integer & __val,_CharT *)250 __do_get_integer(_InputIter& __in_ite, _InputIter& __end, ios_base& __str,
251                  ios_base::iostate& __err, _Integer& __val, _CharT* /*__pc*/) {
252   locale __loc = __str.getloc();
253   const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
254 
255 #if defined (__HP_aCC) && (__HP_aCC == 1)
256   bool _IsSigned = !((_Integer)(-1) > 0);
257 #else
258   typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
259 #endif
260 
261   const int __base_or_zero = __get_base_or_zero(__in_ite, __end, __str.flags(), __ctype);
262   int  __got = __base_or_zero & 1;
263 
264   bool __result;
265 
266   if (__in_ite == __end) {      // We may have already read a 0.  If so,
267 
268     if (__got > 0) {       // the result is 0 even if we're at eof.
269       __val = 0;
270       __result = true;
271     }
272     else
273       __result = false;
274   }
275   else {
276     const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
277     const bool __negative = (__base_or_zero & 2) != 0;
278     const int __base = __base_or_zero >> 2;
279 
280 #if defined (__HP_aCC) && (__HP_aCC == 1)
281     if (_IsSigned)
282       __result = __get_integer(__in_ite, __end, __base,  __val, __got, __negative, __np.thousands_sep(), __np.grouping(), __true_type() );
283     else
284       __result = __get_integer(__in_ite, __end, __base,  __val, __got, __negative, __np.thousands_sep(), __np.grouping(), __false_type() );
285 #else
286     __result = __get_integer(__in_ite, __end, __base,  __val, __got, __negative, __np.thousands_sep(), __np.grouping(), _IsSigned());
287 # endif
288   }
289 
290   __err = __STATIC_CAST(ios_base::iostate, __result ? ios_base::goodbit : ios_base::failbit);
291 
292   if (__in_ite == __end)
293     __err |= ios_base::eofbit;
294   return __in_ite;
295 }
296 
297 // __read_float and its helper functions.
298 template <class _InputIter, class _CharT>
299 _InputIter  _STLP_CALL
__copy_sign(_InputIter __first,_InputIter __last,__iostring & __v,_CharT __xplus,_CharT __xminus)300 __copy_sign(_InputIter __first, _InputIter __last, __iostring& __v,
301             _CharT __xplus, _CharT __xminus) {
302   if (__first != __last) {
303     _CharT __c = *__first;
304     if (__c == __xplus)
305       ++__first;
306     else if (__c == __xminus) {
307       __v.push_back('-');
308       ++__first;
309     }
310   }
311   return __first;
312 }
313 
314 
315 template <class _InputIter, class _CharT>
316 bool _STLP_CALL
__copy_digits(_InputIter & __first,_InputIter __last,__iostring & __v,const _CharT * __digits)317 __copy_digits(_InputIter& __first, _InputIter __last,
318               __iostring& __v, const _CharT* __digits) {
319   bool __ok = false;
320 
321   for ( ; __first != __last; ++__first) {
322     _CharT __c = *__first;
323     if (__get_fdigit(__c, __digits)) {
324       __v.push_back((char)__c);
325       __ok = true;
326     }
327     else
328       break;
329   }
330   return __ok;
331 }
332 
333 template <class _InputIter, class _CharT>
334 bool _STLP_CALL
__copy_grouped_digits(_InputIter & __first,_InputIter __last,__iostring & __v,const _CharT * __digits,_CharT __sep,const string & __grouping,bool & __grouping_ok)335 __copy_grouped_digits(_InputIter& __first, _InputIter __last,
336                       __iostring& __v, const _CharT * __digits,
337                       _CharT __sep, const string& __grouping,
338                       bool& __grouping_ok) {
339   bool __ok = false;
340   char __group_sizes[64];
341   char*__group_sizes_end = __group_sizes;
342   char __current_group_size = 0;
343 
344   for ( ; __first != __last; ++__first) {
345     _CharT __c = *__first;
346     bool __tmp = __get_fdigit_or_sep(__c, __sep, __digits);
347     if (__tmp) {
348       if (__c == ',') {
349         *__group_sizes_end++ = __current_group_size;
350         __current_group_size = 0;
351       }
352       else {
353         __ok = true;
354         __v.push_back((char)__c);
355         ++__current_group_size;
356       }
357     }
358     else
359       break;
360   }
361 
362   if (__group_sizes_end != __group_sizes)
363     *__group_sizes_end++ = __current_group_size;
364   __grouping_ok = __valid_grouping(__group_sizes, __group_sizes_end, __grouping.data(), __grouping.data() + __grouping.size());
365   return __ok;
366 }
367 
368 
369 template <class _InputIter, class _CharT>
370 bool _STLP_CALL
__read_float(__iostring & __buf,_InputIter & __in_ite,_InputIter & __end,const ctype<_CharT> & __ct,const numpunct<_CharT> & __numpunct)371 __read_float(__iostring& __buf, _InputIter& __in_ite, _InputIter& __end,
372              const ctype<_CharT> &__ct, const numpunct<_CharT> &__numpunct) {
373   // Create a string, copying characters of the form
374   // [+-]? [0-9]* .? [0-9]* ([eE] [+-]? [0-9]+)?
375 
376   string __grouping = __numpunct.grouping();
377   bool __digits_before_dot /* = false */;
378   bool __digits_after_dot = false;
379   bool __ok;
380 
381   bool   __grouping_ok = true;
382 
383   _CharT __dot = __numpunct.decimal_point();
384   _CharT __sep = __numpunct.thousands_sep();
385 
386   _CharT __digits[10];
387   _CharT __xplus;
388   _CharT __xminus;
389 
390   _CharT __pow_e;
391   _CharT __pow_E;
392 
393   _Initialize_get_float(__ct, __xplus, __xminus, __pow_e, __pow_E, __digits);
394 
395   // Get an optional sign
396   __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
397 
398   // Get an optional string of digits.
399   if (!__grouping.empty())
400     __digits_before_dot = __copy_grouped_digits(__in_ite, __end, __buf, __digits,
401                                                 __sep, __grouping, __grouping_ok);
402   else
403     __digits_before_dot = __copy_digits(__in_ite, __end, __buf, __digits);
404 
405   // Get an optional decimal point, and an optional string of digits.
406   if (__in_ite != __end && *__in_ite == __dot) {
407     __buf.push_back('.');
408     ++__in_ite;
409     __digits_after_dot = __copy_digits(__in_ite, __end, __buf, __digits);
410   }
411 
412   // There have to be some digits, somewhere.
413   __ok = __digits_before_dot || __digits_after_dot;
414 
415   // Get an optional exponent.
416   if (__ok && __in_ite != __end && (*__in_ite == __pow_e || *__in_ite == __pow_E)) {
417     __buf.push_back('e');
418     ++__in_ite;
419     __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
420     __ok = __copy_digits(__in_ite, __end, __buf, __digits);
421     // If we have an exponent then the sign
422     // is optional but the digits aren't.
423   }
424 
425   return __ok;
426 }
427 
428 template <class _InputIter, class _Float, class _CharT>
429 _InputIter _STLP_CALL
__do_get_float(_InputIter & __in_ite,_InputIter & __end,ios_base & __str,ios_base::iostate & __err,_Float & __val,_CharT *)430 __do_get_float(_InputIter& __in_ite, _InputIter& __end, ios_base& __str,
431                ios_base::iostate& __err, _Float& __val, _CharT* /*__pc*/) {
432   locale __loc = __str.getloc();
433   const ctype<_CharT> &__ctype = use_facet<ctype<_CharT> >(__loc);
434   const numpunct<_CharT> &__numpunct = use_facet<numpunct<_CharT> >(__loc);
435 
436   __iostring __buf ;
437   bool __ok = __read_float(__buf, __in_ite, __end, __ctype, __numpunct);
438   if (__ok) {
439     __string_to_float(__buf, __val);
440     __err = ios_base::goodbit;
441   }
442   else {
443     __err = ios_base::failbit;
444   }
445   if (__in_ite == __end)
446     __err |= ios_base::eofbit;
447   return __in_ite;
448 }
449 
450 template <class _InputIter, class _CharT>
451 _InputIter _STLP_CALL
__do_get_alphabool(_InputIter & __in_ite,_InputIter & __end,ios_base & __str,ios_base::iostate & __err,bool & __x,_CharT *)452 __do_get_alphabool(_InputIter& __in_ite, _InputIter& __end, ios_base& __str,
453                    ios_base::iostate& __err, bool& __x, _CharT* /*__pc*/) {
454   const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__str.getloc());
455   const basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > __truename  = __np.truename();
456   const basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > __falsename = __np.falsename();
457   bool __true_ok  = true;
458   bool __false_ok = true;
459 
460   size_t __n = 0;
461   for ( ; __in_ite != __end; ++__in_ite) {
462     _CharT __c = *__in_ite;
463     __true_ok  = __true_ok  && (__c == __truename[__n]);
464     __false_ok = __false_ok && (__c == __falsename[__n]);
465     ++__n;
466 
467     if ((!__true_ok && !__false_ok) ||
468         (__true_ok  && __n >= __truename.size()) ||
469         (__false_ok && __n >= __falsename.size())) {
470       ++__in_ite;
471       break;
472     }
473   }
474   if (__true_ok  && __n < __truename.size())  __true_ok  = false;
475   if (__false_ok && __n < __falsename.size()) __false_ok = false;
476 
477   if (__true_ok || __false_ok) {
478     __err = ios_base::goodbit;
479     __x = __true_ok;
480   }
481   else
482     __err = ios_base::failbit;
483 
484   if (__in_ite == __end)
485     __err |= ios_base::eofbit;
486 
487   return __in_ite;
488 }
489 
490 _STLP_MOVE_TO_STD_NAMESPACE
491 
492 //
493 // num_get<>, num_put<>
494 //
495 
496 template <class _CharT, class _InputIterator>
497 locale::id num_get<_CharT, _InputIterator>::id;
498 
499 #if !defined (_STLP_NO_BOOL)
500 template <class _CharT, class _InputIter>
501 _InputIter
do_get(_InputIter __in_ite,_InputIter __end,ios_base & __s,ios_base::iostate & __err,bool & __x)502 num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end,
503                                     ios_base& __s, ios_base::iostate& __err, bool& __x) const {
504   if (__s.flags() & ios_base::boolalpha) {
505     return _STLP_PRIV __do_get_alphabool(__in_ite, __end, __s, __err, __x, (_CharT*)0);
506   }
507   else {
508     long __lx;
509     _InputIter __tmp = _STLP_PRIV __do_get_integer(__in_ite, __end, __s, __err, __lx, (_CharT*)0 );
510     if (!(__err & ios_base::failbit)) {
511       if (__lx == 0)
512         __x = false;
513       else if (__lx == 1)
514         __x = true;
515       else
516         __err |= ios_base::failbit;
517     }
518     return __tmp;
519   }
520 }
521 #endif
522 
523 #if defined (_STLP_FIX_LIBRARY_ISSUES)
524 template <class _CharT, class _InputIter>
525 _InputIter
do_get(_InputIter __in_ite,_InputIter __end,ios_base & __str,ios_base::iostate & __err,short & __val)526 num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
527                                     ios_base::iostate& __err, short& __val) const
528 { return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
529 
530 template <class _CharT, class _InputIter>
531 _InputIter
do_get(_InputIter __in_ite,_InputIter __end,ios_base & __str,ios_base::iostate & __err,int & __val)532 num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
533                                     ios_base::iostate& __err, int& __val) const
534 { return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
535 
536 #endif
537 
538 template <class _CharT, class _InputIter>
539 _InputIter
do_get(_InputIter __in_ite,_InputIter __end,ios_base & __str,ios_base::iostate & __err,long & __val)540 num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
541                                     ios_base::iostate& __err, long& __val) const
542 { return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
543 
544 template <class _CharT, class _InputIter>
545 _InputIter
do_get(_InputIter __in_ite,_InputIter __end,ios_base & __str,ios_base::iostate & __err,unsigned short & __val)546 num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
547                                     ios_base::iostate& __err,
548                                     unsigned short& __val) const
549 { return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
550 
551 template <class _CharT, class _InputIter>
552 _InputIter
do_get(_InputIter __in_ite,_InputIter __end,ios_base & __str,ios_base::iostate & __err,unsigned int & __val)553 num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
554                                     ios_base::iostate& __err,
555                                     unsigned int& __val) const
556 { return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
557 
558 template <class _CharT, class _InputIter>
559 _InputIter
do_get(_InputIter __in_ite,_InputIter __end,ios_base & __str,ios_base::iostate & __err,unsigned long & __val)560 num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
561                                     ios_base::iostate& __err,
562                                     unsigned long& __val) const
563 { return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
564 
565 template <class _CharT, class _InputIter>
566 _InputIter
do_get(_InputIter __in_ite,_InputIter __end,ios_base & __str,ios_base::iostate & __err,float & __val)567 num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
568                                     ios_base::iostate& __err,
569                                     float& __val) const
570 { return _STLP_PRIV __do_get_float(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
571 
572 template <class _CharT, class _InputIter>
573 _InputIter
do_get(_InputIter __in_ite,_InputIter __end,ios_base & __str,ios_base::iostate & __err,double & __val)574 num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
575                                     ios_base::iostate& __err,
576                                     double& __val) const
577 { return _STLP_PRIV __do_get_float(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
578 
579 #if !defined (_STLP_NO_LONG_DOUBLE)
580 template <class _CharT, class _InputIter>
581 _InputIter
do_get(_InputIter __in_ite,_InputIter __end,ios_base & __str,ios_base::iostate & __err,long double & __val)582 num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
583                                     ios_base::iostate& __err,
584                                     long double& __val) const
585 { return _STLP_PRIV __do_get_float(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
586 #endif
587 
588 template <class _CharT, class _InputIter>
589 _InputIter
do_get(_InputIter __in_ite,_InputIter __end,ios_base & __str,ios_base::iostate & __err,void * & __p)590 num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
591                                     ios_base::iostate& __err,
592                                     void*& __p) const {
593 #if defined (_STLP_LONG_LONG) && !defined (__MRC__)    //*ty 12/07/2001 - MrCpp can not cast from long long to void*
594   unsigned _STLP_LONG_LONG __val;
595 #else
596   unsigned long __val;
597 #endif
598   iter_type __tmp = _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 );
599   if (!(__err & ios_base::failbit))
600     __p = __REINTERPRET_CAST(void*, __val);
601   return __tmp;
602 }
603 
604 #if defined (_STLP_LONG_LONG)
605 template <class _CharT, class _InputIter>
606 _InputIter
do_get(_InputIter __in_ite,_InputIter __end,ios_base & __str,ios_base::iostate & __err,_STLP_LONG_LONG & __val)607 num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
608                                     ios_base::iostate& __err,
609                                     _STLP_LONG_LONG& __val) const
610 { return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
611 
612 template <class _CharT, class _InputIter>
613 _InputIter
do_get(_InputIter __in_ite,_InputIter __end,ios_base & __str,ios_base::iostate & __err,unsigned _STLP_LONG_LONG & __val)614 num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
615                                     ios_base::iostate& __err,
616                                     unsigned _STLP_LONG_LONG& __val) const
617 { return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
618 #endif
619 
620 _STLP_END_NAMESPACE
621 
622 #endif /* _STLP_NUMERIC_FACETS_C */
623 
624 // Local Variables:
625 // mode:C++
626 // End:
627