michael@0: /* michael@0: * Copyright (c) 1999 michael@0: * Silicon Graphics Computer Systems, Inc. michael@0: * michael@0: * Copyright (c) 1999 michael@0: * Boris Fomitchev michael@0: * michael@0: * This material is provided "as is", with absolutely no warranty expressed michael@0: * or implied. Any use is at your own risk. michael@0: * michael@0: * Permission to use or copy this software for any purpose is hereby granted michael@0: * without fee, provided the above notices are retained on all copies. michael@0: * Permission to modify the code and to distribute modified code is granted, michael@0: * provided the above notices are retained, and a notice that the code was michael@0: * modified is included with the above copyright notice. michael@0: * michael@0: */ michael@0: #include "stlport_prefix.h" michael@0: michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: _STLP_BEGIN_NAMESPACE michael@0: _STLP_MOVE_TO_PRIV_NAMESPACE michael@0: michael@0: // __valid_grouping compares two strings, one representing the michael@0: // group sizes encountered when reading an integer, and the other michael@0: // representing the valid group sizes as returned by the numpunct michael@0: // grouping() member function. Both are interpreted right-to-left. michael@0: // The grouping string is treated as if it were extended indefinitely michael@0: // with its last value. For a grouping to be valid, each term in michael@0: // the first string must be equal to the corresponding term in the michael@0: // second, except for the last, which must be less than or equal. michael@0: michael@0: // boris : this takes reversed first string ! michael@0: bool _STLP_CALL michael@0: __valid_grouping(const char * first1, const char * last1, michael@0: const char * first2, const char * last2) { michael@0: if (first1 == last1 || first2 == last2) return true; michael@0: michael@0: --last1; --last2; michael@0: michael@0: while (first1 != last1) { michael@0: if (*last1 != *first2) michael@0: return false; michael@0: --last1; michael@0: if (first2 != last2) ++first2; michael@0: } michael@0: michael@0: return *last1 <= *first2; michael@0: } michael@0: michael@0: _STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned __index) { michael@0: static const unsigned char __val_table[128] = { michael@0: 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, michael@0: 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, michael@0: 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, michael@0: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, michael@0: 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, michael@0: 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, michael@0: 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, michael@0: 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF michael@0: }; michael@0: michael@0: return __val_table[__index]; michael@0: } michael@0: michael@0: _STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms() michael@0: { return "+-0xX"; } michael@0: michael@0: // index is actually a char michael@0: michael@0: #if !defined (_STLP_NO_WCHAR_T) michael@0: michael@0: // Similar, except return the character itself instead of the numeric michael@0: // value. Used for floating-point input. michael@0: bool _STLP_CALL __get_fdigit(wchar_t& c, const wchar_t* digits) { michael@0: const wchar_t* p = find(digits, digits + 10, c); michael@0: if (p != digits + 10) { michael@0: c = (char)('0' + (p - digits)); michael@0: return true; michael@0: } michael@0: else michael@0: return false; michael@0: } michael@0: michael@0: bool _STLP_CALL __get_fdigit_or_sep(wchar_t& c, wchar_t sep, michael@0: const wchar_t * digits) { michael@0: if (c == sep) { michael@0: c = (char)','; michael@0: return true; michael@0: } michael@0: else michael@0: return __get_fdigit(c, digits); michael@0: } michael@0: michael@0: #endif michael@0: michael@0: _STLP_MOVE_TO_STD_NAMESPACE michael@0: michael@0: #if !defined(_STLP_NO_FORCE_INSTANTIATE) michael@0: //---------------------------------------------------------------------- michael@0: // Force instantiation of num_get<> michael@0: template class _STLP_CLASS_DECLSPEC istreambuf_iterator >; michael@0: // template class num_get; michael@0: template class num_get > >; michael@0: michael@0: # if !defined (_STLP_NO_WCHAR_T) michael@0: template class _STLP_CLASS_DECLSPEC istreambuf_iterator >; michael@0: template class num_get > >; michael@0: // template class num_get; michael@0: # endif michael@0: #endif michael@0: michael@0: _STLP_END_NAMESPACE michael@0: michael@0: // Local Variables: michael@0: // mode:C++ michael@0: // End: