3 * Silicon Graphics Computer Systems, Inc.
8 * This material is provided "as is", with absolutely no warranty expressed
9 * or implied. Any use is at your own risk.
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.
18 #include "stlport_prefix.h"
25 _STLP_MOVE_TO_PRIV_NAMESPACE
27 // __valid_grouping compares two strings, one representing the
28 // group sizes encountered when reading an integer, and the other
29 // representing the valid group sizes as returned by the numpunct
30 // grouping() member function. Both are interpreted right-to-left.
31 // The grouping string is treated as if it were extended indefinitely
32 // with its last value. For a grouping to be valid, each term in
33 // the first string must be equal to the corresponding term in the
34 // second, except for the last, which must be less than or equal.
36 // boris : this takes reversed first string !
38 __valid_grouping(const char * first1, const char * last1,
39 const char * first2, const char * last2) {
40 if (first1 == last1 || first2 == last2) return true;
44 while (first1 != last1) {
45 if (*last1 != *first2)
48 if (first2 != last2) ++first2;
51 return *last1 <= *first2;
54 _STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned __index) {
55 static const unsigned char __val_table[128] = {
56 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
57 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
58 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
59 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
60 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
61 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
62 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
63 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
66 return __val_table[__index];
69 _STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms()
72 // index is actually a char
74 #if !defined (_STLP_NO_WCHAR_T)
76 // Similar, except return the character itself instead of the numeric
77 // value. Used for floating-point input.
78 bool _STLP_CALL __get_fdigit(wchar_t& c, const wchar_t* digits) {
79 const wchar_t* p = find(digits, digits + 10, c);
80 if (p != digits + 10) {
81 c = (char)('0' + (p - digits));
88 bool _STLP_CALL __get_fdigit_or_sep(wchar_t& c, wchar_t sep,
89 const wchar_t * digits) {
95 return __get_fdigit(c, digits);
100 _STLP_MOVE_TO_STD_NAMESPACE
102 #if !defined(_STLP_NO_FORCE_INSTANTIATE)
103 //----------------------------------------------------------------------
104 // Force instantiation of of num_get<>
105 template class _STLP_CLASS_DECLSPEC istreambuf_iterator<char, char_traits<char> >;
106 // template class num_get<char, const char*>;
107 template class num_get<char, istreambuf_iterator<char, char_traits<char> > >;
109 # if !defined (_STLP_NO_WCHAR_T)
110 template class _STLP_CLASS_DECLSPEC istreambuf_iterator<wchar_t, char_traits<wchar_t> >;
111 template class num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
112 // template class num_get<wchar_t, const wchar_t*>;