// Copyright (C) 2014-2018 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // . // Instantiate the facets using old std::string ABI. #define _GLIBCXX_USE_CXX11_ABI 0 #include #if ! _GLIBCXX_USE_DUAL_ABI # error This file should not be compiled for this configuration. #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace { typedef char fake_collate_c[sizeof(std::collate)] __attribute__ ((aligned(__alignof__(std::collate)))); fake_collate_c collate_c; typedef char fake_numpunct_c[sizeof(numpunct)] __attribute__ ((aligned(__alignof__(numpunct)))); fake_numpunct_c numpunct_c; typedef char fake_moneypunct_c[sizeof(moneypunct)] __attribute__ ((aligned(__alignof__(moneypunct)))); fake_moneypunct_c moneypunct_ct; fake_moneypunct_c moneypunct_cf; typedef char fake_money_get_c[sizeof(money_get)] __attribute__ ((aligned(__alignof__(money_get)))); fake_money_get_c money_get_c; typedef char fake_money_put_c[sizeof(money_put)] __attribute__ ((aligned(__alignof__(money_put)))); fake_money_put_c money_put_c; typedef char fake_time_get_c[sizeof(time_get)] __attribute__ ((aligned(__alignof__(time_get)))); fake_time_get_c time_get_c; typedef char fake_messages_c[sizeof(messages)] __attribute__ ((aligned(__alignof__(messages)))); fake_messages_c messages_c; #ifdef _GLIBCXX_USE_WCHAR_T typedef char fake_wollate_w[sizeof(std::collate)] __attribute__ ((aligned(__alignof__(std::collate)))); fake_wollate_w collate_w; typedef char fake_numpunct_w[sizeof(numpunct)] __attribute__ ((aligned(__alignof__(numpunct)))); fake_numpunct_w numpunct_w; typedef char fake_moneypunct_w[sizeof(moneypunct)] __attribute__ ((aligned(__alignof__(moneypunct)))); fake_moneypunct_w moneypunct_wt; fake_moneypunct_w moneypunct_wf; typedef char fake_money_get_w[sizeof(money_get)] __attribute__ ((aligned(__alignof__(money_get)))); fake_money_get_w money_get_w; typedef char fake_money_put_w[sizeof(money_put)] __attribute__ ((aligned(__alignof__(money_put)))); fake_money_put_w money_put_w; typedef char fake_time_get_w[sizeof(time_get)] __attribute__ ((aligned(__alignof__(time_get)))); fake_time_get_w time_get_w; typedef char fake_messages_w[sizeof(messages)] __attribute__ ((aligned(__alignof__(messages)))); fake_messages_w messages_w; #endif } // anonymous namespace void locale::_Impl::_M_init_extra(facet** caches) { auto __npc = static_cast<__numpunct_cache*>(caches[0]); auto __mpcf = static_cast<__moneypunct_cache*>(caches[1]); auto __mpct = static_cast<__moneypunct_cache*>(caches[2]); _M_init_facet_unchecked(new (&numpunct_c) numpunct(__npc, 1)); _M_init_facet_unchecked(new (&collate_c) std::collate(1)); _M_init_facet_unchecked(new (&moneypunct_cf) moneypunct(__mpcf, 1)); _M_init_facet_unchecked(new (&moneypunct_ct) moneypunct(__mpct, 1)); _M_init_facet_unchecked(new (&money_get_c) money_get(1)); _M_init_facet_unchecked(new (&money_put_c) money_put(1)); _M_init_facet_unchecked(new (&time_get_c) time_get(1)); _M_init_facet_unchecked(new (&messages_c) std::messages(1)); #ifdef _GLIBCXX_USE_WCHAR_T auto __npw = static_cast<__numpunct_cache*>(caches[3]); auto __mpwf = static_cast<__moneypunct_cache*>(caches[4]); auto __mpwt = static_cast<__moneypunct_cache*>(caches[5]); _M_init_facet_unchecked(new (&numpunct_w) numpunct(__npw, 1)); _M_init_facet_unchecked(new (&collate_w) std::collate(1)); _M_init_facet_unchecked(new (&moneypunct_wf) moneypunct(__mpwf, 1)); _M_init_facet_unchecked(new (&moneypunct_wt) moneypunct(__mpwt, 1)); _M_init_facet_unchecked(new (&money_get_w) money_get(1)); _M_init_facet_unchecked(new (&money_put_w) money_put(1)); _M_init_facet_unchecked(new (&time_get_w) time_get(1)); _M_init_facet_unchecked(new (&messages_w) std::messages(1)); #endif _M_caches[numpunct::id._M_id()] = __npc; _M_caches[moneypunct::id._M_id()] = __mpcf; _M_caches[moneypunct::id._M_id()] = __mpct; #ifdef _GLIBCXX_USE_WCHAR_T _M_caches[numpunct::id._M_id()] = __npw; _M_caches[moneypunct::id._M_id()] = __mpwf; _M_caches[moneypunct::id._M_id()] = __mpwt; #endif } void locale::_Impl::_M_init_extra(void* cloc, void* clocm, const char* __s, const char* __smon) { auto& __cloc = *static_cast<__c_locale*>(cloc); _M_init_facet_unchecked(new numpunct(__cloc)); _M_init_facet_unchecked(new std::collate(__cloc)); _M_init_facet_unchecked(new moneypunct(__cloc, 0)); _M_init_facet_unchecked(new moneypunct(__cloc, 0)); _M_init_facet_unchecked(new money_get); _M_init_facet_unchecked(new money_put); _M_init_facet_unchecked(new time_get); _M_init_facet_unchecked(new std::messages(__cloc, __s)); #ifdef _GLIBCXX_USE_WCHAR_T auto& __clocm = *static_cast<__c_locale*>(clocm); _M_init_facet_unchecked(new numpunct(__cloc)); _M_init_facet_unchecked(new std::collate(__cloc)); _M_init_facet_unchecked(new moneypunct(__clocm, __smon)); _M_init_facet_unchecked(new moneypunct(__clocm, __smon)); _M_init_facet_unchecked(new money_get); _M_init_facet_unchecked(new money_put); _M_init_facet_unchecked(new time_get); _M_init_facet_unchecked(new std::messages(__cloc, __s)); #endif } // TODO should be in another file string locale::name() const { string __ret; if (!_M_impl->_M_names[0]) __ret = '*'; else if (_M_impl->_M_check_same_name()) __ret = _M_impl->_M_names[0]; else { __ret.reserve(128); __ret += _S_categories[0]; __ret += '='; __ret += _M_impl->_M_names[0]; for (size_t __i = 1; __i < _S_categories_size; ++__i) { __ret += ';'; __ret += _S_categories[__i]; __ret += '='; __ret += _M_impl->_M_names[__i]; } } return __ret; } _GLIBCXX_END_NAMESPACE_VERSION }