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