1*e4b17023SJohn Marino // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2*e4b17023SJohn Marino // 2006, 2007, 2008, 2009, 2010 3*e4b17023SJohn Marino // Free Software Foundation, Inc. 4*e4b17023SJohn Marino // 5*e4b17023SJohn Marino // This file is part of the GNU ISO C++ Library. This library is free 6*e4b17023SJohn Marino // software; you can redistribute it and/or modify it under the 7*e4b17023SJohn Marino // terms of the GNU General Public License as published by the 8*e4b17023SJohn Marino // Free Software Foundation; either version 3, or (at your option) 9*e4b17023SJohn Marino // any later version. 10*e4b17023SJohn Marino 11*e4b17023SJohn Marino // This library is distributed in the hope that it will be useful, 12*e4b17023SJohn Marino // but WITHOUT ANY WARRANTY; without even the implied warranty of 13*e4b17023SJohn Marino // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*e4b17023SJohn Marino // GNU General Public License for more details. 15*e4b17023SJohn Marino 16*e4b17023SJohn Marino // Under Section 7 of GPL version 3, you are granted additional 17*e4b17023SJohn Marino // permissions described in the GCC Runtime Library Exception, version 18*e4b17023SJohn Marino // 3.1, as published by the Free Software Foundation. 19*e4b17023SJohn Marino 20*e4b17023SJohn Marino // You should have received a copy of the GNU General Public License and 21*e4b17023SJohn Marino // a copy of the GCC Runtime Library Exception along with this program; 22*e4b17023SJohn Marino // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23*e4b17023SJohn Marino // <http://www.gnu.org/licenses/>. 24*e4b17023SJohn Marino 25*e4b17023SJohn Marino #include <locale> 26*e4b17023SJohn Marino 27*e4b17023SJohn Marino namespace std _GLIBCXX_VISIBILITY(default) 28*e4b17023SJohn Marino { 29*e4b17023SJohn Marino _GLIBCXX_BEGIN_NAMESPACE_VERSION 30*e4b17023SJohn Marino 31*e4b17023SJohn Marino // Definitions for static const data members of time_base. 32*e4b17023SJohn Marino template<> 33*e4b17023SJohn Marino const char* 34*e4b17023SJohn Marino __timepunct_cache<char>::_S_timezones[14] = 35*e4b17023SJohn Marino { 36*e4b17023SJohn Marino "GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET", 37*e4b17023SJohn Marino "IST", "EET", "CST", "JST" 38*e4b17023SJohn Marino }; 39*e4b17023SJohn Marino 40*e4b17023SJohn Marino #ifdef _GLIBCXX_USE_WCHAR_T 41*e4b17023SJohn Marino template<> 42*e4b17023SJohn Marino const wchar_t* 43*e4b17023SJohn Marino __timepunct_cache<wchar_t>::_S_timezones[14] = 44*e4b17023SJohn Marino { 45*e4b17023SJohn Marino L"GMT", L"HST", L"AKST", L"PST", L"MST", L"CST", L"EST", L"AST", 46*e4b17023SJohn Marino L"NST", L"CET", L"IST", L"EET", L"CST", L"JST" 47*e4b17023SJohn Marino }; 48*e4b17023SJohn Marino #endif 49*e4b17023SJohn Marino 50*e4b17023SJohn Marino // Definitions for static const data members of money_base. 51*e4b17023SJohn Marino const money_base::pattern 52*e4b17023SJohn Marino money_base::_S_default_pattern = { {symbol, sign, none, value} }; 53*e4b17023SJohn Marino 54*e4b17023SJohn Marino const char* money_base::_S_atoms = "-0123456789"; 55*e4b17023SJohn Marino 56*e4b17023SJohn Marino const char* __num_base::_S_atoms_in = "-+xX0123456789abcdefABCDEF"; 57*e4b17023SJohn Marino const char* __num_base::_S_atoms_out ="-+xX0123456789abcdef0123456789ABCDEF"; 58*e4b17023SJohn Marino 59*e4b17023SJohn Marino // _GLIBCXX_RESOLVE_LIB_DEFECTS 60*e4b17023SJohn Marino // According to the resolution of DR 231, about 22.2.2.2.2, p11, 61*e4b17023SJohn Marino // "str.precision() is specified in the conversion specification". 62*e4b17023SJohn Marino void _S_format_float(const ios_base & __io,char * __fptr,char __mod)63*e4b17023SJohn Marino __num_base::_S_format_float(const ios_base& __io, char* __fptr, 64*e4b17023SJohn Marino char __mod) throw() 65*e4b17023SJohn Marino { 66*e4b17023SJohn Marino ios_base::fmtflags __flags = __io.flags(); 67*e4b17023SJohn Marino *__fptr++ = '%'; 68*e4b17023SJohn Marino // [22.2.2.2.2] Table 60 69*e4b17023SJohn Marino if (__flags & ios_base::showpos) 70*e4b17023SJohn Marino *__fptr++ = '+'; 71*e4b17023SJohn Marino if (__flags & ios_base::showpoint) 72*e4b17023SJohn Marino *__fptr++ = '#'; 73*e4b17023SJohn Marino 74*e4b17023SJohn Marino // As per DR 231: _always_, not only when 75*e4b17023SJohn Marino // __flags & ios_base::fixed || __prec > 0 76*e4b17023SJohn Marino *__fptr++ = '.'; 77*e4b17023SJohn Marino *__fptr++ = '*'; 78*e4b17023SJohn Marino 79*e4b17023SJohn Marino if (__mod) 80*e4b17023SJohn Marino *__fptr++ = __mod; 81*e4b17023SJohn Marino ios_base::fmtflags __fltfield = __flags & ios_base::floatfield; 82*e4b17023SJohn Marino // [22.2.2.2.2] Table 58 83*e4b17023SJohn Marino if (__fltfield == ios_base::fixed) 84*e4b17023SJohn Marino *__fptr++ = 'f'; 85*e4b17023SJohn Marino else if (__fltfield == ios_base::scientific) 86*e4b17023SJohn Marino *__fptr++ = (__flags & ios_base::uppercase) ? 'E' : 'e'; 87*e4b17023SJohn Marino else 88*e4b17023SJohn Marino *__fptr++ = (__flags & ios_base::uppercase) ? 'G' : 'g'; 89*e4b17023SJohn Marino *__fptr = '\0'; 90*e4b17023SJohn Marino } 91*e4b17023SJohn Marino 92*e4b17023SJohn Marino bool __verify_grouping(const char * __grouping,size_t __grouping_size,const string & __grouping_tmp)93*e4b17023SJohn Marino __verify_grouping(const char* __grouping, size_t __grouping_size, 94*e4b17023SJohn Marino const string& __grouping_tmp) throw() 95*e4b17023SJohn Marino { 96*e4b17023SJohn Marino const size_t __n = __grouping_tmp.size() - 1; 97*e4b17023SJohn Marino const size_t __min = std::min(__n, size_t(__grouping_size - 1)); 98*e4b17023SJohn Marino size_t __i = __n; 99*e4b17023SJohn Marino bool __test = true; 100*e4b17023SJohn Marino 101*e4b17023SJohn Marino // Parsed number groupings have to match the 102*e4b17023SJohn Marino // numpunct::grouping string exactly, starting at the 103*e4b17023SJohn Marino // right-most point of the parsed sequence of elements ... 104*e4b17023SJohn Marino for (size_t __j = 0; __j < __min && __test; --__i, ++__j) 105*e4b17023SJohn Marino __test = __grouping_tmp[__i] == __grouping[__j]; 106*e4b17023SJohn Marino for (; __i && __test; --__i) 107*e4b17023SJohn Marino __test = __grouping_tmp[__i] == __grouping[__min]; 108*e4b17023SJohn Marino // ... but the first parsed grouping can be <= numpunct 109*e4b17023SJohn Marino // grouping (only do the check if the numpunct char is > 0 110*e4b17023SJohn Marino // because <= 0 means any size is ok). 111*e4b17023SJohn Marino if (static_cast<signed char>(__grouping[__min]) > 0 112*e4b17023SJohn Marino && __grouping[__min] != __gnu_cxx::__numeric_traits<char>::__max) 113*e4b17023SJohn Marino __test &= __grouping_tmp[0] <= __grouping[__min]; 114*e4b17023SJohn Marino return __test; 115*e4b17023SJohn Marino } 116*e4b17023SJohn Marino 117*e4b17023SJohn Marino _GLIBCXX_END_NAMESPACE_VERSION 118*e4b17023SJohn Marino } // namespace 119