# globals_locale.cc

    00001 // Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
    00002 //
    00003 // This file is part of the GNU ISO C++ Library.  This library is free
    00004 // software; you can redistribute it and/or modify it under the
    00005 // terms of the GNU General Public License as published by the
    00006 // Free Software Foundation; either version 2, or (at your option)
    00007 // any later version.
    00008
    00009 // This library is distributed in the hope that it will be useful,
    00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012 // GNU General Public License for more details.
    00013
    00014 // You should have received a copy of the GNU General Public License along
    00015 // with this library; see the file COPYING.  If not, write to the Free
    00016 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    00017 // USA.
    00018
    00019 // As a special exception, you may use this file as part of a free software
    00020 // library without restriction.  Specifically, if other files instantiate
    00021 // templates or use macros or inline functions from this file, or you compile
    00022 // this file and link it with other files to produce an executable, this
    00023 // file does not by itself cause the resulting executable to be covered by
    00024 // the GNU General Public License.  This exception does not however
    00025 // invalidate any other reasons why the executable file might be covered by
    00026 // the GNU General Public License.
    00027
    00028 #include <locale>
    00029
    00030 // On AIX, and perhaps other systems, library initialization order is
    00031 // not guaranteed.  For example, the static initializers for the main
    00032 // program might run before the static initializers for this library.
    00033 // That means that we cannot rely on static initialization in the
    00034 // library; there is no guarantee that things will get initialized in
    00035 // time.  This file contains definitions of all global variables that
    00036 // require initialization as arrays of characters.
    00037
    00038 // NB: asm directives can rename these non-exported, namespace
    00039 // __gnu_cxx symbols into exported, namespace std symbols with the
    00040 // appropriate symbol version name.
    00041 // The rename syntax is
    00042 //   asm (".symver currentname,oldname@@GLIBCXX_3.2")
    00043 // In macro form:
    00044 // _GLIBCXX_ASM_SYMVER(currentname, oldname, GLIBCXX_3.2)
    00045
    00046 namespace __gnu_internal
    00047 {
    00048   using namespace std;
    00049
    00050   typedef char fake_locale_Impl[sizeof(locale::_Impl)]
    00051   __attribute__ ((aligned(__alignof__(locale::_Impl))));
    00052   fake_locale_Impl c_locale_impl;
    00053
    00054   typedef char fake_locale[sizeof(locale)]
    00055   __attribute__ ((aligned(__alignof__(locale))));
    00056   fake_locale c_locale;
    00057
    00058   typedef char fake_name_vec[sizeof(char*)]
    00059   __attribute__ ((aligned(__alignof__(char*))));
    00060   fake_name_vec name_vec[6 + _GLIBCXX_NUM_CATEGORIES];
    00061
    00062   typedef char fake_names[sizeof(char[2])]
    00063   __attribute__ ((aligned(__alignof__(char[2]))));
    00064   fake_names name_c[6 + _GLIBCXX_NUM_CATEGORIES];
    00065
    00066   typedef char fake_facet_vec[sizeof(locale::facet*)]
    00067   __attribute__ ((aligned(__alignof__(locale::facet*))));
    00068   fake_facet_vec facet_vec[_GLIBCXX_NUM_FACETS];
    00069
    00070   typedef char fake_cache_vec[sizeof(locale::facet*)]
    00071   __attribute__ ((aligned(__alignof__(locale::facet*))));
    00072   fake_cache_vec cache_vec[_GLIBCXX_NUM_FACETS];
    00073
    00074   typedef char fake_ctype_c[sizeof(std::ctype<char>)]
    00075   __attribute__ ((aligned(__alignof__(std::ctype<char>))));
    00076   fake_ctype_c ctype_c;
    00077
    00078   typedef char fake_collate_c[sizeof(std::collate<char>)]
    00079   __attribute__ ((aligned(__alignof__(std::collate<char>))));
    00080   fake_collate_c collate_c;
    00081
    00082   typedef char fake_numpunct_c[sizeof(numpunct<char>)]
    00083   __attribute__ ((aligned(__alignof__(numpunct<char>))));
    00084   fake_numpunct_c numpunct_c;
    00085
    00086   typedef char fake_num_get_c[sizeof(num_get<char>)]
    00087   __attribute__ ((aligned(__alignof__(num_get<char>))));
    00088   fake_num_get_c num_get_c;
    00089
    00090   typedef char fake_num_put_c[sizeof(num_put<char>)]
    00091   __attribute__ ((aligned(__alignof__(num_put<char>))));
    00092   fake_num_put_c num_put_c;
    00093
    00094   typedef char fake_codecvt_c[sizeof(codecvt<char, char, mbstate_t>)]
    00095   __attribute__ ((aligned(__alignof__(codecvt<char, char, mbstate_t>))));
    00096   fake_codecvt_c codecvt_c;
    00097
    00098   typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)]
    00099   __attribute__ ((aligned(__alignof__(moneypunct<char, true>))));
    00100   fake_moneypunct_c moneypunct_ct;
    00101   fake_moneypunct_c moneypunct_cf;
    00102
    00103   typedef char fake_money_get_c[sizeof(money_get<char>)]
    00104   __attribute__ ((aligned(__alignof__(money_get<char>))));
    00105   fake_money_get_c money_get_c;
    00106
    00107   typedef char fake_money_put_c[sizeof(money_put<char>)]
    00108   __attribute__ ((aligned(__alignof__(money_put<char>))));
    00109   fake_money_put_c money_put_c;
    00110
    00111   typedef char fake_timepunct_c[sizeof(__timepunct<char>)]
    00112   __attribute__ ((aligned(__alignof__(__timepunct<char>))));
    00113   fake_timepunct_c timepunct_c;
    00114
    00115   typedef char fake_time_get_c[sizeof(time_get<char>)]
    00116   __attribute__ ((aligned(__alignof__(time_get<char>))));
    00117   fake_time_get_c time_get_c;
    00118
    00119   typedef char fake_time_put_c[sizeof(time_put<char>)]
    00120   __attribute__ ((aligned(__alignof__(time_put<char>))));
    00121   fake_time_put_c time_put_c;
    00122
    00123   typedef char fake_messages_c[sizeof(messages<char>)]
    00124   __attribute__ ((aligned(__alignof__(messages<char>))));
    00125   fake_messages_c messages_c;
    00126
    00127 #ifdef  _GLIBCXX_USE_WCHAR_T
    00128   typedef char fake_wtype_w[sizeof(std::ctype<wchar_t>)]
    00129   __attribute__ ((aligned(__alignof__(std::ctype<wchar_t>))));
    00130   fake_wtype_w ctype_w;
    00131
    00132   typedef char fake_wollate_w[sizeof(std::collate<wchar_t>)]
    00133   __attribute__ ((aligned(__alignof__(std::collate<wchar_t>))));
    00134   fake_wollate_w collate_w;
    00135
    00136   typedef char fake_numpunct_w[sizeof(numpunct<wchar_t>)]
    00137   __attribute__ ((aligned(__alignof__(numpunct<wchar_t>))));
    00138   fake_numpunct_w numpunct_w;
    00139
    00140   typedef char fake_num_get_w[sizeof(num_get<wchar_t>)]
    00141   __attribute__ ((aligned(__alignof__(num_get<wchar_t>))));
    00142   fake_num_get_w num_get_w;
    00143
    00144   typedef char fake_num_put_w[sizeof(num_put<wchar_t>)]
    00145   __attribute__ ((aligned(__alignof__(num_put<wchar_t>))));
    00146   fake_num_put_w num_put_w;
    00147
    00148   typedef char fake_wodecvt_w[sizeof(codecvt<wchar_t, char, mbstate_t>)]
    00149   __attribute__ ((aligned(__alignof__(codecvt<wchar_t, char, mbstate_t>))));
    00150   fake_wodecvt_w codecvt_w;
    00151
    00152   typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)]
    00153   __attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>))));
    00154   fake_moneypunct_w moneypunct_wt;
    00155   fake_moneypunct_w moneypunct_wf;
    00156
    00157   typedef char fake_money_get_w[sizeof(money_get<wchar_t>)]
    00158   __attribute__ ((aligned(__alignof__(money_get<wchar_t>))));
    00159   fake_money_get_w money_get_w;
    00160
    00161   typedef char fake_money_put_w[sizeof(money_put<wchar_t>)]
    00162   __attribute__ ((aligned(__alignof__(money_put<wchar_t>))));
    00163   fake_money_put_w money_put_w;
    00164
    00165   typedef char fake_timepunct_w[sizeof(__timepunct<wchar_t>)]
    00166   __attribute__ ((aligned(__alignof__(__timepunct<wchar_t>))));
    00167   fake_timepunct_w timepunct_w;
    00168
    00169   typedef char fake_time_get_w[sizeof(time_get<wchar_t>)]
    00170   __attribute__ ((aligned(__alignof__(time_get<wchar_t>))));
    00171   fake_time_get_w time_get_w;
    00172
    00173   typedef char fake_time_put_w[sizeof(time_put<wchar_t>)]
    00174   __attribute__ ((aligned(__alignof__(time_put<wchar_t>))));
    00175   fake_time_put_w time_put_w;
    00176
    00177   typedef char fake_messages_w[sizeof(messages<wchar_t>)]
    00178   __attribute__ ((aligned(__alignof__(messages<wchar_t>))));
    00179   fake_messages_w messages_w;
    00180 #endif
    00181
    00182   // Storage for "C" locale caches.
    00183   typedef char fake_num_cache_c[sizeof(std::__numpunct_cache<char>)]
    00184   __attribute__ ((aligned(__alignof__(std::__numpunct_cache<char>))));
    00185   fake_num_cache_c numpunct_cache_c;
    00186
    00187   typedef char fake_money_cache_c[sizeof(std::__moneypunct_cache<char, true>)]
    00188   __attribute__ ((aligned(__alignof__(std::__moneypunct_cache<char, true>))));
    00189   fake_money_cache_c moneypunct_cache_ct;
    00190   fake_money_cache_c moneypunct_cache_cf;
    00191
    00192   typedef char fake_time_cache_c[sizeof(std::__timepunct_cache<char>)]
    00193   __attribute__ ((aligned(__alignof__(std::__timepunct_cache<char>))));
    00194   fake_time_cache_c timepunct_cache_c;
    00195
    00196 #ifdef _GLIBCXX_USE_WCHAR_T
    00197   typedef char fake_num_cache_w[sizeof(std::__numpunct_cache<wchar_t>)]
    00198   __attribute__ ((aligned(__alignof__(std::__numpunct_cache<wchar_t>))));
    00199   fake_num_cache_w numpunct_cache_w;
    00200
    00201   typedef char fake_money_cache_w[sizeof(std::__moneypunct_cache<wchar_t,true>)]
    00202   __attribute__ ((aligned(__alignof__(std::__moneypunct_cache<wchar_t,true>))));
    00203   fake_money_cache_w moneypunct_cache_wt;
    00204   fake_money_cache_w moneypunct_cache_wf;
    00205
    00206   typedef char fake_time_cache_w[sizeof(std::__timepunct_cache<wchar_t>)]
    00207   __attribute__ ((aligned(__alignof__(std::__timepunct_cache<wchar_t>))));
    00208   fake_time_cache_w timepunct_cache_w;
    00209 #endif
    00210 } // namespace __gnu_internal