_num_get.c 20 KB

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