Update contrib.
2 * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
5 * Silicon Graphics Computer Systems, Inc.
10 * This material is provided "as is", with absolutely no warranty expressed
11 * or implied. Any use is at your own risk.
13 * Permission to use or copy this software for any purpose is hereby granted
14 * without fee, provided the above notices are retained on all copies.
15 * Permission to modify the code and to distribute modified code is granted,
16 * provided the above notices are retained, and a notice that the code was
17 * modified is included with the above copyright notice.
20 #include "stlport_prefix.h"
26 #ifdef __SYMBIAN32__WSD__
27 #include <libstdcppwsd.h>
28 #endif //__SYMBIAN32__WSD__
31 _STLP_MOVE_TO_PRIV_NAMESPACE
33 // __valid_grouping compares two strings, one representing the
34 // group sizes encountered when reading an integer, and the other
35 // representing the valid group sizes as returned by the numpunct
36 // grouping() member function. Both are interpreted right-to-left.
37 // The grouping string is treated as if it were extended indefinitely
38 // with its last value. For a grouping to be valid, each term in
39 // the first string must be equal to the corresponding term in the
40 // second, except for the last, which must be less than or equal.
42 // boris : this takes reversed first string !
43 _STLP_DECLSPEC bool _STLP_CALL
44 __valid_grouping(const char * first1, const char * last1,
45 const char * first2, const char * last2) {
46 if (first1 == last1 || first2 == last2) return true;
50 while (first1 != last1) {
51 if (*last1 != *first2)
54 if (first2 != last2) ++first2;
57 return *last1 <= *first2;
60 _STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned __index) {
61 static const unsigned char __val_table[128] = {
62 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,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,
64 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
65 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
66 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
67 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
68 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
69 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
72 return __val_table[__index];
75 _STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms()
78 // index is actually a char
80 #if !defined (_STLP_NO_WCHAR_T)
82 // Similar, except return the character itself instead of the numeric
83 // value. Used for floating-point input.
84 _STLP_DECLSPEC bool _STLP_CALL __get_fdigit(wchar_t& c, const wchar_t* digits) {
85 const wchar_t* p = find(digits, digits + 10, c);
86 if (p != digits + 10) {
87 c = (char)('0' + (p - digits));
94 _STLP_DECLSPEC bool _STLP_CALL __get_fdigit_or_sep(wchar_t& c, wchar_t sep,
95 const wchar_t * digits) {
101 return __get_fdigit(c, digits);
106 _STLP_MOVE_TO_STD_NAMESPACE
108 #if defined (__SYMBIAN32__WSD__)
110 _STLP_DECLSPEC locale::id& num_get<char, istreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId()
112 return get_libcpp_wsd().num_get_char_istreambuf_iterator_id;
114 # ifndef _STLP_NO_WCHAR_T
116 _STLP_DECLSPEC locale::id& num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId()
118 return get_libcpp_wsd().num_get_wchar_istreambuf_iterator_id;
120 # endif /* _STLP_NO_WCHAR_T */
121 #endif /* __SYMBIAN32__WSD__ */
123 #if !defined(_STLP_NO_FORCE_INSTANTIATE)
124 //----------------------------------------------------------------------
125 // Force instantiation of of num_get<>
126 template class _STLP_CLASS_DECLSPEC istreambuf_iterator<char, char_traits<char> >;
127 // template class num_get<char, const char*>;
128 template class num_get<char, istreambuf_iterator<char, char_traits<char> > >;
130 # if !defined (_STLP_NO_WCHAR_T)
131 template class _STLP_CLASS_DECLSPEC istreambuf_iterator<wchar_t, char_traits<wchar_t> >;
132 template class num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
133 // template class num_get<wchar_t, const wchar_t*>;
137 #if defined(__EPOC32__)
139 locale::id num_get<char, istreambuf_iterator<char, char_traits<char> > >::id={12};
141 # if !defined (STLP_NO_WCHAR_T)
143 locale::id num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id={31};