This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] __moneypunct_cache, __timepunct_cache
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 17 Jul 2003 22:16:15 -0400 (EDT)
- Subject: [v3] __moneypunct_cache, __timepunct_cache
Adds data cache abstraction for money and time facets. Later, we'll
actually make use of it, but this patch is already quite large.
tested x86/linux
tested x86/linux --enable-clocale=generic
2003-07-17 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Add __moneypunct_cache, __timepunct_cache.
* config/locale/generic/messages_members.h: Tweaks.
* config/locale/generic/monetary_members.cc
(moneypunct::_M_initialize_moneypunct): Use cache.
(moneypunct::~moneypunct): Delete cache.
* config/locale/generic/time_members.cc:
(__timepunct::_M_initialize_timepunct): Use cache.
* config/locale/generic/time_members.h:
(__timepunct::~__timepunct): Delete cache.
(__timepunct::__timepunct): Set cache.
* config/locale/gnu/messages_members.h: Tweaks.
* config/locale/gnu/monetary_members.cc:
(moneypunct::_M_initialize_moneypunct): Use cache.
(moneypunct::~moneypunct): Delete cache.
* config/locale/gnu/time_members.cc:
(__timepunct::_M_initialize_timepunct): Use cache.
* config/locale/gnu/time_members.h:
(__timepunct::~__timepunct): Delete cache.
(__timepunct::__timepunct): Set cache.
* include/bits/locale_facets.h (__timepunct_cache): New.
(__moneypunct_cache): New.
* include/bits/locale_facets.tcc: Tweak.
* src/locale.cc (__timepunct::_S_timezones): Adjust for cache.
* src/locale-inst.cc: Instantiate caches.
* src/globals.cc: Add "C" caches.
* src/localename.cc: Use external "C" caches.
Index: config/linker-map.gnu
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/linker-map.gnu,v
retrieving revision 1.44
diff -c -p -r1.44 linker-map.gnu
*** config/linker-map.gnu 11 Jul 2003 04:04:48 -0000 1.44
--- config/linker-map.gnu 18 Jul 2003 02:13:59 -0000
*************** GLIBCXX_3.4 {
*** 55,61 ****
std::__num_base::_S_format_int*;
std::__num_base::_S_atoms_in;
std::__num_base::_S_atoms_out;
! std::__numpunct_cache*
};
# Names not in an 'extern' block are mangled names.
--- 55,63 ----
std::__num_base::_S_format_int*;
std::__num_base::_S_atoms_in;
std::__num_base::_S_atoms_out;
! std::__moneypunct_cache*;
! std::__numpunct_cache*;
! std::__timepunct_cache*
};
# Names not in an 'extern' block are mangled names.
Index: config/locale/generic/messages_members.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/generic/messages_members.h,v
retrieving revision 1.4
diff -c -p -r1.4 messages_members.h
*** config/locale/generic/messages_members.h 28 Feb 2003 05:15:06 -0000 1.4
--- config/locale/generic/messages_members.h 18 Jul 2003 02:13:59 -0000
***************
*** 36,47 ****
// Non-virtual member functions.
template<typename _CharT>
messages<_CharT>::messages(size_t __refs)
! : locale::facet(__refs)
{ _M_c_locale_messages = _S_c_locale; }
template<typename _CharT>
messages<_CharT>::messages(__c_locale, const char*, size_t __refs)
! : locale::facet(__refs)
{ _M_c_locale_messages = _S_c_locale; }
template<typename _CharT>
--- 36,47 ----
// Non-virtual member functions.
template<typename _CharT>
messages<_CharT>::messages(size_t __refs)
! : facet(__refs)
{ _M_c_locale_messages = _S_c_locale; }
template<typename _CharT>
messages<_CharT>::messages(__c_locale, const char*, size_t __refs)
! : facet(__refs)
{ _M_c_locale_messages = _S_c_locale; }
template<typename _CharT>
Index: config/locale/generic/monetary_members.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/generic/monetary_members.cc,v
retrieving revision 1.4
diff -c -p -r1.4 monetary_members.cc
*** config/locale/generic/monetary_members.cc 5 Jul 2003 04:05:30 -0000 1.4
--- config/locale/generic/monetary_members.cc 18 Jul 2003 02:14:01 -0000
***************
*** 1,6 ****
// std::moneypunct implementation details, generic version -*- C++ -*-
! // Copyright (C) 2001, 2002 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
--- 1,6 ----
// std::moneypunct implementation details, generic version -*- C++ -*-
! // Copyright (C) 2001, 2002, 2003 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
*************** namespace std
*** 47,87 ****
void
moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*)
{
! // "C" locale
! _M_decimal_point = '.';
! _M_thousands_sep = ',';
! _M_grouping = "";
! _M_curr_symbol = "";
! _M_positive_sign = "";
! _M_negative_sign = "";
! _M_frac_digits = 0;
! _M_pos_format = money_base::_S_default_pattern;
! _M_neg_format = money_base::_S_default_pattern;
}
template<>
void
moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*)
{
! // "C" locale
! _M_decimal_point = '.';
! _M_thousands_sep = ',';
! _M_grouping = "";
! _M_curr_symbol = "";
! _M_positive_sign = "";
! _M_negative_sign = "";
! _M_frac_digits = 0;
! _M_pos_format = money_base::_S_default_pattern;
! _M_neg_format = money_base::_S_default_pattern;
}
template<>
moneypunct<char, true>::~moneypunct()
! { }
template<>
moneypunct<char, false>::~moneypunct()
! { }
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
--- 47,93 ----
void
moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*)
{
! // "C" locale.
! if (!_M_data)
! _M_data = new __moneypunct_cache<char>;
!
! _M_data->_M_decimal_point = '.';
! _M_data->_M_thousands_sep = ',';
! _M_data->_M_grouping = "";
! _M_data->_M_curr_symbol = "";
! _M_data->_M_positive_sign = "";
! _M_data->_M_negative_sign = "";
! _M_data->_M_frac_digits = 0;
! _M_data->_M_pos_format = money_base::_S_default_pattern;
! _M_data->_M_neg_format = money_base::_S_default_pattern;
}
template<>
void
moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*)
{
! // "C" locale.
! if (!_M_data)
! _M_data = new __moneypunct_cache<char>;
!
! _M_data->_M_decimal_point = '.';
! _M_data->_M_thousands_sep = ',';
! _M_data->_M_grouping = "";
! _M_data->_M_curr_symbol = "";
! _M_data->_M_positive_sign = "";
! _M_data->_M_negative_sign = "";
! _M_data->_M_frac_digits = 0;
! _M_data->_M_pos_format = money_base::_S_default_pattern;
! _M_data->_M_neg_format = money_base::_S_default_pattern;
}
template<>
moneypunct<char, true>::~moneypunct()
! { delete _M_data; }
template<>
moneypunct<char, false>::~moneypunct()
! { delete _M_data; }
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
*************** namespace std
*** 90,104 ****
const char*)
{
// "C" locale
! _M_decimal_point = L'.';
! _M_thousands_sep = L',';
! _M_grouping = "";
! _M_curr_symbol = L"";
! _M_positive_sign = L"";
! _M_negative_sign = L"";
! _M_frac_digits = 0;
! _M_pos_format = money_base::_S_default_pattern;
! _M_neg_format = money_base::_S_default_pattern;
}
template<>
--- 96,113 ----
const char*)
{
// "C" locale
! if (!_M_data)
! _M_data = new __moneypunct_cache<wchar_t>;
!
! _M_data->_M_decimal_point = L'.';
! _M_data->_M_thousands_sep = L',';
! _M_data->_M_grouping = "";
! _M_data->_M_curr_symbol = L"";
! _M_data->_M_positive_sign = L"";
! _M_data->_M_negative_sign = L"";
! _M_data->_M_frac_digits = 0;
! _M_data->_M_pos_format = money_base::_S_default_pattern;
! _M_data->_M_neg_format = money_base::_S_default_pattern;
}
template<>
*************** namespace std
*** 107,129 ****
const char*)
{
// "C" locale
! _M_decimal_point = L'.';
! _M_thousands_sep = L',';
! _M_grouping = "";
! _M_curr_symbol = L"";
! _M_positive_sign = L"";
! _M_negative_sign = L"";
! _M_frac_digits = 0;
! _M_pos_format = money_base::_S_default_pattern;
! _M_neg_format = money_base::_S_default_pattern;
}
template<>
moneypunct<wchar_t, true>::~moneypunct()
! { }
template<>
moneypunct<wchar_t, false>::~moneypunct()
! { }
#endif
}
--- 116,141 ----
const char*)
{
// "C" locale
! if (!_M_data)
! _M_data = new __moneypunct_cache<wchar_t>;
!
! _M_data->_M_decimal_point = L'.';
! _M_data->_M_thousands_sep = L',';
! _M_data->_M_grouping = "";
! _M_data->_M_curr_symbol = L"";
! _M_data->_M_positive_sign = L"";
! _M_data->_M_negative_sign = L"";
! _M_data->_M_frac_digits = 0;
! _M_data->_M_pos_format = money_base::_S_default_pattern;
! _M_data->_M_neg_format = money_base::_S_default_pattern;
}
template<>
moneypunct<wchar_t, true>::~moneypunct()
! { delete _M_data; }
template<>
moneypunct<wchar_t, false>::~moneypunct()
! { delete _M_data; }
#endif
}
Index: config/locale/generic/time_members.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/generic/time_members.cc,v
retrieving revision 1.8
diff -c -p -r1.8 time_members.cc
*** config/locale/generic/time_members.cc 5 Jul 2003 04:05:30 -0000 1.8
--- config/locale/generic/time_members.cc 18 Jul 2003 02:14:01 -0000
***************
*** 1,6 ****
// std::time_get, std::time_put implementation, generic version -*- C++ -*-
! // Copyright (C) 2001, 2002 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
--- 1,6 ----
// std::time_get, std::time_put implementation, generic version -*- C++ -*-
! // Copyright (C) 2001, 2002, 2003 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
*************** namespace std
*** 55,116 ****
void
__timepunct<char>::_M_initialize_timepunct(__c_locale)
{
! // "C" locale
! _M_date_format = "%m/%d/%y";
! _M_date_era_format = "%m/%d/%y";
! _M_time_format = "%H:%M:%S";
! _M_time_era_format = "%H:%M:%S";
! _M_date_time_format = "";
! _M_date_time_era_format = "";
! _M_am = "AM";
! _M_pm = "PM";
! _M_am_pm_format = "";
// Day names, starting with "C"'s Sunday.
! _M_day1 = "Sunday";
! _M_day2 = "Monday";
! _M_day3 = "Tuesday";
! _M_day4 = "Wednesday";
! _M_day5 = "Thursday";
! _M_day6 = "Friday";
! _M_day7 = "Saturday";
// Abbreviated day names, starting with "C"'s Sun.
! _M_day_a1 = "Sun";
! _M_day_a2 = "Mon";
! _M_day_a3 = "Tue";
! _M_day_a4 = "Wed";
! _M_day_a5 = "Thu";
! _M_day_a6 = "Fri";
! _M_day_a7 = "Sat";
// Month names, starting with "C"'s January.
! _M_month01 = "January";
! _M_month02 = "February";
! _M_month03 = "March";
! _M_month04 = "April";
! _M_month05 = "May";
! _M_month06 = "June";
! _M_month07 = "July";
! _M_month08 = "August";
! _M_month09 = "September";
! _M_month10 = "October";
! _M_month11 = "November";
! _M_month12 = "December";
// Abbreviated month names, starting with "C"'s Jan.
! _M_month_a01 = "Jan";
! _M_month_a02 = "Feb";
! _M_month_a03 = "Mar";
! _M_month_a04 = "Apr";
! _M_month_a05 = "May";
! _M_month_a06 = "Jun";
! _M_month_a07 = "July";
! _M_month_a08 = "Aug";
! _M_month_a09 = "Sep";
! _M_month_a10 = "Oct";
! _M_month_a11 = "Nov";
! _M_month_a12 = "Dec";
}
#ifdef _GLIBCXX_USE_WCHAR_T
--- 55,119 ----
void
__timepunct<char>::_M_initialize_timepunct(__c_locale)
{
! // "C" locale.
! if (!_M_data)
! _M_data = new __timepunct_cache<char>;
!
! _M_data->_M_date_format = "%m/%d/%y";
! _M_data->_M_date_era_format = "%m/%d/%y";
! _M_data->_M_time_format = "%H:%M:%S";
! _M_data->_M_time_era_format = "%H:%M:%S";
! _M_data->_M_date_time_format = "";
! _M_data->_M_date_time_era_format = "";
! _M_data->_M_am = "AM";
! _M_data->_M_pm = "PM";
! _M_data->_M_am_pm_format = "";
// Day names, starting with "C"'s Sunday.
! _M_data->_M_day1 = "Sunday";
! _M_data->_M_day2 = "Monday";
! _M_data->_M_day3 = "Tuesday";
! _M_data->_M_day4 = "Wednesday";
! _M_data->_M_day5 = "Thursday";
! _M_data->_M_day6 = "Friday";
! _M_data->_M_day7 = "Saturday";
// Abbreviated day names, starting with "C"'s Sun.
! _M_data->_M_aday1 = "Sun";
! _M_data->_M_aday2 = "Mon";
! _M_data->_M_aday3 = "Tue";
! _M_data->_M_aday4 = "Wed";
! _M_data->_M_aday5 = "Thu";
! _M_data->_M_aday6 = "Fri";
! _M_data->_M_aday7 = "Sat";
// Month names, starting with "C"'s January.
! _M_data->_M_month01 = "January";
! _M_data->_M_month02 = "February";
! _M_data->_M_month03 = "March";
! _M_data->_M_month04 = "April";
! _M_data->_M_month05 = "May";
! _M_data->_M_month06 = "June";
! _M_data->_M_month07 = "July";
! _M_data->_M_month08 = "August";
! _M_data->_M_month09 = "September";
! _M_data->_M_month10 = "October";
! _M_data->_M_month11 = "November";
! _M_data->_M_month12 = "December";
// Abbreviated month names, starting with "C"'s Jan.
! _M_data->_M_amonth01 = "Jan";
! _M_data->_M_amonth02 = "Feb";
! _M_data->_M_amonth03 = "Mar";
! _M_data->_M_amonth04 = "Apr";
! _M_data->_M_amonth05 = "May";
! _M_data->_M_amonth06 = "Jun";
! _M_data->_M_amonth07 = "July";
! _M_data->_M_amonth08 = "Aug";
! _M_data->_M_amonth09 = "Sep";
! _M_data->_M_amonth10 = "Oct";
! _M_data->_M_amonth11 = "Nov";
! _M_data->_M_amonth12 = "Dec";
}
#ifdef _GLIBCXX_USE_WCHAR_T
*************** namespace std
*** 131,192 ****
void
__timepunct<wchar_t>::_M_initialize_timepunct(__c_locale)
{
! // "C" locale
! _M_date_format = L"%m/%d/%y";
! _M_date_era_format = L"%m/%d/%y";
! _M_time_format = L"%H:%M:%S";
! _M_time_era_format = L"%H:%M:%S";
! _M_date_time_format = L"";
! _M_date_time_era_format = L"";
! _M_am = L"AM";
! _M_pm = L"PM";
! _M_am_pm_format = L"";
// Day names, starting with "C"'s Sunday.
! _M_day1 = L"Sunday";
! _M_day2 = L"Monday";
! _M_day3 = L"Tuesday";
! _M_day4 = L"Wednesday";
! _M_day5 = L"Thursday";
! _M_day6 = L"Friday";
! _M_day7 = L"Saturday";
// Abbreviated day names, starting with "C"'s Sun.
! _M_day_a1 = L"Sun";
! _M_day_a2 = L"Mon";
! _M_day_a3 = L"Tue";
! _M_day_a4 = L"Wed";
! _M_day_a5 = L"Thu";
! _M_day_a6 = L"Fri";
! _M_day_a7 = L"Sat";
// Month names, starting with "C"'s January.
! _M_month01 = L"January";
! _M_month02 = L"February";
! _M_month03 = L"March";
! _M_month04 = L"April";
! _M_month05 = L"May";
! _M_month06 = L"June";
! _M_month07 = L"July";
! _M_month08 = L"August";
! _M_month09 = L"September";
! _M_month10 = L"October";
! _M_month11 = L"November";
! _M_month12 = L"December";
// Abbreviated month names, starting with "C"'s Jan.
! _M_month_a01 = L"Jan";
! _M_month_a02 = L"Feb";
! _M_month_a03 = L"Mar";
! _M_month_a04 = L"Apr";
! _M_month_a05 = L"May";
! _M_month_a06 = L"Jun";
! _M_month_a07 = L"July";
! _M_month_a08 = L"Aug";
! _M_month_a09 = L"Sep";
! _M_month_a10 = L"Oct";
! _M_month_a11 = L"Nov";
! _M_month_a12 = L"Dec";
}
#endif
}
--- 134,198 ----
void
__timepunct<wchar_t>::_M_initialize_timepunct(__c_locale)
{
! // "C" locale.
! if (!_M_data)
! _M_data = new __timepunct_cache<wchar_t>;
!
! _M_data->_M_date_format = L"%m/%d/%y";
! _M_data->_M_date_era_format = L"%m/%d/%y";
! _M_data->_M_time_format = L"%H:%M:%S";
! _M_data->_M_time_era_format = L"%H:%M:%S";
! _M_data->_M_date_time_format = L"";
! _M_data->_M_date_time_era_format = L"";
! _M_data->_M_am = L"AM";
! _M_data->_M_pm = L"PM";
! _M_data->_M_am_pm_format = L"";
// Day names, starting with "C"'s Sunday.
! _M_data->_M_day1 = L"Sunday";
! _M_data->_M_day2 = L"Monday";
! _M_data->_M_day3 = L"Tuesday";
! _M_data->_M_day4 = L"Wednesday";
! _M_data->_M_day5 = L"Thursday";
! _M_data->_M_day6 = L"Friday";
! _M_data->_M_day7 = L"Saturday";
// Abbreviated day names, starting with "C"'s Sun.
! _M_data->_M_aday1 = L"Sun";
! _M_data->_M_aday2 = L"Mon";
! _M_data->_M_aday3 = L"Tue";
! _M_data->_M_aday4 = L"Wed";
! _M_data->_M_aday5 = L"Thu";
! _M_data->_M_aday6 = L"Fri";
! _M_data->_M_aday7 = L"Sat";
// Month names, starting with "C"'s January.
! _M_data->_M_month01 = L"January";
! _M_data->_M_month02 = L"February";
! _M_data->_M_month03 = L"March";
! _M_data->_M_month04 = L"April";
! _M_data->_M_month05 = L"May";
! _M_data->_M_month06 = L"June";
! _M_data->_M_month07 = L"July";
! _M_data->_M_month08 = L"August";
! _M_data->_M_month09 = L"September";
! _M_data->_M_month10 = L"October";
! _M_data->_M_month11 = L"November";
! _M_data->_M_month12 = L"December";
// Abbreviated month names, starting with "C"'s Jan.
! _M_data->_M_amonth01 = L"Jan";
! _M_data->_M_amonth02 = L"Feb";
! _M_data->_M_amonth03 = L"Mar";
! _M_data->_M_amonth04 = L"Apr";
! _M_data->_M_amonth05 = L"May";
! _M_data->_M_amonth06 = L"Jun";
! _M_data->_M_amonth07 = L"July";
! _M_data->_M_amonth08 = L"Aug";
! _M_data->_M_amonth09 = L"Sep";
! _M_data->_M_amonth10 = L"Oct";
! _M_data->_M_amonth11 = L"Nov";
! _M_data->_M_amonth12 = L"Dec";
}
#endif
}
Index: config/locale/generic/time_members.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/generic/time_members.h,v
retrieving revision 1.1
diff -c -p -r1.1 time_members.h
*** config/locale/generic/time_members.h 6 Jan 2003 21:22:56 -0000 1.1
--- config/locale/generic/time_members.h 18 Jul 2003 02:14:01 -0000
***************
*** 36,42 ****
template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs)
! : locale::facet(__refs)
{
_M_name_timepunct = _S_c_name;
_M_initialize_timepunct();
--- 36,50 ----
template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs)
! : facet(__refs), _M_data(NULL)
! {
! _M_name_timepunct = _S_c_name;
! _M_initialize_timepunct();
! }
!
! template<typename _CharT>
! __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
! : facet(__refs), _M_data(__cache)
{
_M_name_timepunct = _S_c_name;
_M_initialize_timepunct();
***************
*** 45,51 ****
template<typename _CharT>
__timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
size_t __refs)
! : locale::facet(__refs)
{
_M_name_timepunct = new char[strlen(__s) + 1];
strcpy(_M_name_timepunct, __s);
--- 53,59 ----
template<typename _CharT>
__timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
size_t __refs)
! : facet(__refs), _M_data(NULL)
{
_M_name_timepunct = new char[strlen(__s) + 1];
strcpy(_M_name_timepunct, __s);
***************
*** 57,61 ****
--- 65,70 ----
{
if (_S_c_name != _M_name_timepunct)
delete [] _M_name_timepunct;
+ delete _M_data;
_S_destroy_c_locale(_M_c_locale_timepunct);
}
Index: config/locale/gnu/messages_members.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/messages_members.h,v
retrieving revision 1.7
diff -c -p -r1.7 messages_members.h
*** config/locale/gnu/messages_members.h 16 Jan 2003 20:30:20 -0000 1.7
--- config/locale/gnu/messages_members.h 18 Jul 2003 02:14:01 -0000
***************
*** 36,42 ****
// Non-virtual member functions.
template<typename _CharT>
messages<_CharT>::messages(size_t __refs)
! : locale::facet(__refs)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_messages = _S_c_name;
--- 36,42 ----
// Non-virtual member functions.
template<typename _CharT>
messages<_CharT>::messages(size_t __refs)
! : facet(__refs)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_messages = _S_c_name;
***************
*** 48,54 ****
messages<_CharT>::messages(__c_locale __cloc,
const char* __s __attribute__ ((__unused__)),
size_t __refs)
! : locale::facet(__refs)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_messages = new char[strlen(__s) + 1];
--- 48,54 ----
messages<_CharT>::messages(__c_locale __cloc,
const char* __s __attribute__ ((__unused__)),
size_t __refs)
! : facet(__refs)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_messages = new char[strlen(__s) + 1];
Index: config/locale/gnu/monetary_members.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/monetary_members.cc,v
retrieving revision 1.10
diff -c -p -r1.10 monetary_members.cc
*** config/locale/gnu/monetary_members.cc 5 Jul 2003 04:05:30 -0000 1.10
--- config/locale/gnu/monetary_members.cc 18 Jul 2003 02:14:01 -0000
***************
*** 1,6 ****
// std::moneypunct implementation details, GNU version -*- C++ -*-
! // Copyright (C) 2001, 2002 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
--- 1,6 ----
// std::moneypunct implementation details, GNU version -*- C++ -*-
! // Copyright (C) 2001, 2002, 2003 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
*************** namespace std
*** 220,262 ****
moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
const char*)
{
if (!__cloc)
{
// "C" locale
! _M_decimal_point = '.';
! _M_thousands_sep = ',';
! _M_grouping = "";
! _M_curr_symbol = "";
! _M_positive_sign = "";
! _M_negative_sign = "";
! _M_frac_digits = 0;
! _M_pos_format = money_base::_S_default_pattern;
! _M_neg_format = money_base::_S_default_pattern;
}
else
{
// Named locale.
! _M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, __cloc));
! _M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, __cloc));
! _M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
! _M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
if (!__nposn)
! _M_negative_sign = "()";
else
! _M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
// _Intl == true
! _M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
! _M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, __cloc));
char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
! _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn);
char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
! _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);
}
}
--- 220,271 ----
moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
const char*)
{
+ if (!_M_data)
+ _M_data = new __moneypunct_cache<char>;
+
if (!__cloc)
{
// "C" locale
! _M_data->_M_decimal_point = '.';
! _M_data->_M_thousands_sep = ',';
! _M_data->_M_grouping = "";
! _M_data->_M_curr_symbol = "";
! _M_data->_M_positive_sign = "";
! _M_data->_M_negative_sign = "";
! _M_data->_M_frac_digits = 0;
! _M_data->_M_pos_format = money_base::_S_default_pattern;
! _M_data->_M_neg_format = money_base::_S_default_pattern;
}
else
{
// Named locale.
! _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
! __cloc));
! _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
! __cloc));
! _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
! _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
if (!__nposn)
! _M_data->_M_negative_sign = "()";
else
! _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
! __cloc);
// _Intl == true
! _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
! _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
! __cloc));
char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
! _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
! __pposn);
char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
! _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
! __nposn);
}
}
*************** namespace std
*** 265,317 ****
moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
const char*)
{
if (!__cloc)
{
// "C" locale
! _M_decimal_point = '.';
! _M_thousands_sep = ',';
! _M_grouping = "";
! _M_curr_symbol = "";
! _M_positive_sign = "";
! _M_negative_sign = "";
! _M_frac_digits = 0;
! _M_pos_format = money_base::_S_default_pattern;
! _M_neg_format = money_base::_S_default_pattern;
}
else
{
// Named locale.
! _M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, __cloc));
! _M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, __cloc));
! _M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
! _M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
if (!__nposn)
! _M_negative_sign = "()";
else
! _M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
// _Intl == false
! _M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
! _M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
! _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn);
char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
! _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);
}
}
template<>
moneypunct<char, true>::~moneypunct()
! { }
template<>
moneypunct<char, false>::~moneypunct()
! { }
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
--- 274,334 ----
moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
const char*)
{
+ if (!_M_data)
+ _M_data = new __moneypunct_cache<char>;
+
if (!__cloc)
{
// "C" locale
! _M_data->_M_decimal_point = '.';
! _M_data->_M_thousands_sep = ',';
! _M_data->_M_grouping = "";
! _M_data->_M_curr_symbol = "";
! _M_data->_M_positive_sign = "";
! _M_data->_M_negative_sign = "";
! _M_data->_M_frac_digits = 0;
! _M_data->_M_pos_format = money_base::_S_default_pattern;
! _M_data->_M_neg_format = money_base::_S_default_pattern;
}
else
{
// Named locale.
! _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
! __cloc));
! _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
! __cloc));
! _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
! _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
if (!__nposn)
! _M_data->_M_negative_sign = "()";
else
! _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
! __cloc);
// _Intl == false
! _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
! _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
! _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
! __pposn);
char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
! _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
! __nposn);
}
}
template<>
moneypunct<char, true>::~moneypunct()
! { delete _M_data; }
template<>
moneypunct<char, false>::~moneypunct()
! { delete _M_data; }
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
*************** namespace std
*** 323,340 ****
const char* __name)
#endif
{
if (!__cloc)
{
// "C" locale
! _M_decimal_point = L'.';
! _M_thousands_sep = L',';
! _M_grouping = "";
! _M_curr_symbol = L"";
! _M_positive_sign = L"";
! _M_negative_sign = L"";
! _M_frac_digits = 0;
! _M_pos_format = money_base::_S_default_pattern;
! _M_neg_format = money_base::_S_default_pattern;
}
else
{
--- 340,360 ----
const char* __name)
#endif
{
+ if (!_M_data)
+ _M_data = new __moneypunct_cache<wchar_t>;
+
if (!__cloc)
{
// "C" locale
! _M_data->_M_decimal_point = L'.';
! _M_data->_M_thousands_sep = L',';
! _M_data->_M_grouping = "";
! _M_data->_M_curr_symbol = L"";
! _M_data->_M_positive_sign = L"";
! _M_data->_M_negative_sign = L"";
! _M_data->_M_frac_digits = 0;
! _M_data->_M_pos_format = money_base::_S_default_pattern;
! _M_data->_M_neg_format = money_base::_S_default_pattern;
}
else
{
*************** namespace std
*** 349,359 ****
union __s_and_w { const char *__s; unsigned int __w; } __u;
__u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
! _M_decimal_point = static_cast<wchar_t>(__u.__w);
__u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
! _M_thousands_sep = static_cast<wchar_t>(__u.__w);
! _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
--- 369,379 ----
union __s_and_w { const char *__s; unsigned int __w; } __u;
__u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
! _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w);
__u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
! _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w);
! _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
*************** namespace std
*** 367,391 ****
memset(&__state, 0, sizeof(mbstate_t));
wchar_t* __wcs = new wchar_t[__len];
mbsrtowcs(__wcs, &__cpossign, __len, &__state);
! _M_positive_sign = __wcs;
}
else
! _M_positive_sign = L"";
char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
__len = strlen(__cnegsign);
if (!__nposn)
! _M_negative_sign = L"()";
else if (__len)
{
++__len;
memset(&__state, 0, sizeof(mbstate_t));
wchar_t* __wcs = new wchar_t[__len];
mbsrtowcs(__wcs, &__cnegsign, __len, &__state);
! _M_negative_sign = __wcs;
}
else
! _M_negative_sign = L"";
// _Intl == true.
__len = strlen(__ccurr);
--- 387,411 ----
memset(&__state, 0, sizeof(mbstate_t));
wchar_t* __wcs = new wchar_t[__len];
mbsrtowcs(__wcs, &__cpossign, __len, &__state);
! _M_data->_M_positive_sign = __wcs;
}
else
! _M_data->_M_positive_sign = L"";
char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
__len = strlen(__cnegsign);
if (!__nposn)
! _M_data->_M_negative_sign = L"()";
else if (__len)
{
++__len;
memset(&__state, 0, sizeof(mbstate_t));
wchar_t* __wcs = new wchar_t[__len];
mbsrtowcs(__wcs, &__cnegsign, __len, &__state);
! _M_data->_M_negative_sign = __wcs;
}
else
! _M_data->_M_negative_sign = L"";
// _Intl == true.
__len = strlen(__ccurr);
*************** namespace std
*** 395,413 ****
memset(&__state, 0, sizeof(mbstate_t));
wchar_t* __wcs = new wchar_t[__len];
mbsrtowcs(__wcs, &__ccurr, __len, &__state);
! _M_curr_symbol = __wcs;
}
else
! _M_curr_symbol = L"";
! _M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, __cloc));
char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
! _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn);
char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
! _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__uselocale(__old);
--- 415,436 ----
memset(&__state, 0, sizeof(mbstate_t));
wchar_t* __wcs = new wchar_t[__len];
mbsrtowcs(__wcs, &__ccurr, __len, &__state);
! _M_data->_M_curr_symbol = __wcs;
}
else
! _M_data->_M_curr_symbol = L"";
! _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
! __cloc));
char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
! _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
! __pposn);
char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
! _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
! __nposn);
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__uselocale(__old);
*************** namespace std
*** 427,444 ****
const char* __name)
#endif
{
if (!__cloc)
{
// "C" locale
! _M_decimal_point = L'.';
! _M_thousands_sep = L',';
! _M_grouping = "";
! _M_curr_symbol = L"";
! _M_positive_sign = L"";
! _M_negative_sign = L"";
! _M_frac_digits = 0;
! _M_pos_format = money_base::_S_default_pattern;
! _M_neg_format = money_base::_S_default_pattern;
}
else
{
--- 450,470 ----
const char* __name)
#endif
{
+ if (!_M_data)
+ _M_data = new __moneypunct_cache<wchar_t>;
+
if (!__cloc)
{
// "C" locale
! _M_data->_M_decimal_point = L'.';
! _M_data->_M_thousands_sep = L',';
! _M_data->_M_grouping = "";
! _M_data->_M_curr_symbol = L"";
! _M_data->_M_positive_sign = L"";
! _M_data->_M_negative_sign = L"";
! _M_data->_M_frac_digits = 0;
! _M_data->_M_pos_format = money_base::_S_default_pattern;
! _M_data->_M_neg_format = money_base::_S_default_pattern;
}
else
{
*************** namespace std
*** 453,463 ****
union __s_and_w { const char *__s; unsigned int __w; } __u;
__u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
! _M_decimal_point = static_cast<wchar_t>(__u.__w);
__u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
! _M_thousands_sep = static_cast<wchar_t>(__u.__w);
! _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
--- 479,489 ----
union __s_and_w { const char *__s; unsigned int __w; } __u;
__u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
! _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w);
__u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
! _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w);
! _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
*************** namespace std
*** 472,496 ****
memset(&__state, 0, sizeof(mbstate_t));
wchar_t* __wcs = new wchar_t[__len];
mbsrtowcs(__wcs, &__cpossign, __len, &__state);
! _M_positive_sign = __wcs;
}
else
! _M_positive_sign = L"";
char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
__len = strlen(__cnegsign);
if (!__nposn)
! _M_negative_sign = L"()";
else if (__len)
{
++__len;
memset(&__state, 0, sizeof(mbstate_t));
wchar_t* __wcs = new wchar_t[__len];
mbsrtowcs(__wcs, &__cnegsign, __len, &__state);
! _M_negative_sign = __wcs;
}
else
! _M_negative_sign = L"";
// _Intl == true.
__len = strlen(__ccurr);
--- 498,522 ----
memset(&__state, 0, sizeof(mbstate_t));
wchar_t* __wcs = new wchar_t[__len];
mbsrtowcs(__wcs, &__cpossign, __len, &__state);
! _M_data->_M_positive_sign = __wcs;
}
else
! _M_data->_M_positive_sign = L"";
char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
__len = strlen(__cnegsign);
if (!__nposn)
! _M_data->_M_negative_sign = L"()";
else if (__len)
{
++__len;
memset(&__state, 0, sizeof(mbstate_t));
wchar_t* __wcs = new wchar_t[__len];
mbsrtowcs(__wcs, &__cnegsign, __len, &__state);
! _M_data->_M_negative_sign = __wcs;
}
else
! _M_data->_M_negative_sign = L"";
// _Intl == true.
__len = strlen(__ccurr);
*************** namespace std
*** 500,518 ****
memset(&__state, 0, sizeof(mbstate_t));
wchar_t* __wcs = new wchar_t[__len];
mbsrtowcs(__wcs, &__ccurr, __len, &__state);
! _M_curr_symbol = __wcs;
}
else
! _M_curr_symbol = L"";
! _M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
! _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn);
char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
! _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__uselocale(__old);
--- 526,546 ----
memset(&__state, 0, sizeof(mbstate_t));
wchar_t* __wcs = new wchar_t[__len];
mbsrtowcs(__wcs, &__ccurr, __len, &__state);
! _M_data->_M_curr_symbol = __wcs;
}
else
! _M_data->_M_curr_symbol = L"";
! _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
! _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
! __pposn);
char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
! _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
! __nposn);
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__uselocale(__old);
*************** namespace std
*** 526,548 ****
template<>
moneypunct<wchar_t, true>::~moneypunct()
{
! if (wcslen(_M_positive_sign))
! delete [] _M_positive_sign;
! if (wcslen(_M_negative_sign) && (wcscmp(_M_negative_sign, L"()") != 0))
! delete [] _M_negative_sign;
! if (wcslen(_M_curr_symbol))
! delete [] _M_curr_symbol;
}
template<>
moneypunct<wchar_t, false>::~moneypunct()
{
! if (wcslen(_M_positive_sign))
! delete [] _M_positive_sign;
! if (wcslen(_M_negative_sign) && (wcscmp(_M_negative_sign, L"()") != 0))
! delete [] _M_negative_sign;
! if (wcslen(_M_curr_symbol))
! delete [] _M_curr_symbol;
}
#endif
}
--- 554,580 ----
template<>
moneypunct<wchar_t, true>::~moneypunct()
{
! if (wcslen(_M_data->_M_positive_sign))
! delete [] _M_data->_M_positive_sign;
! if (wcslen(_M_data->_M_negative_sign)
! && (wcscmp(_M_data->_M_negative_sign, L"()") != 0))
! delete [] _M_data->_M_negative_sign;
! if (wcslen(_M_data->_M_curr_symbol))
! delete [] _M_data->_M_curr_symbol;
! delete _M_data;
}
template<>
moneypunct<wchar_t, false>::~moneypunct()
{
! if (wcslen(_M_data->_M_positive_sign))
! delete [] _M_data->_M_positive_sign;
! if (wcslen(_M_data->_M_negative_sign)
! && (wcscmp(_M_data->_M_negative_sign, L"()") != 0))
! delete [] _M_data->_M_negative_sign;
! if (wcslen(_M_data->_M_curr_symbol))
! delete [] _M_data->_M_curr_symbol;
! delete _M_data;
}
#endif
}
Index: config/locale/gnu/time_members.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/time_members.cc,v
retrieving revision 1.10
diff -c -p -r1.10 time_members.cc
*** config/locale/gnu/time_members.cc 5 Jul 2003 04:05:30 -0000 1.10
--- config/locale/gnu/time_members.cc 18 Jul 2003 02:14:01 -0000
***************
*** 1,6 ****
// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
! // Copyright (C) 2001, 2002 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
--- 1,6 ----
// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
! // Copyright (C) 2001, 2002, 2003 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
*************** namespace std
*** 60,185 ****
void
__timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
{
if (!__cloc)
{
// "C" locale
_M_c_locale_timepunct = _S_c_locale;
! _M_date_format = "%m/%d/%y";
! _M_date_era_format = "%m/%d/%y";
! _M_time_format = "%H:%M:%S";
! _M_time_era_format = "%H:%M:%S";
! _M_date_time_format = "";
! _M_date_time_era_format = "";
! _M_am = "AM";
! _M_pm = "PM";
! _M_am_pm_format = "";
// Day names, starting with "C"'s Sunday.
! _M_day1 = "Sunday";
! _M_day2 = "Monday";
! _M_day3 = "Tuesday";
! _M_day4 = "Wednesday";
! _M_day5 = "Thursday";
! _M_day6 = "Friday";
! _M_day7 = "Saturday";
// Abbreviated day names, starting with "C"'s Sun.
! _M_day_a1 = "Sun";
! _M_day_a2 = "Mon";
! _M_day_a3 = "Tue";
! _M_day_a4 = "Wed";
! _M_day_a5 = "Thu";
! _M_day_a6 = "Fri";
! _M_day_a7 = "Sat";
// Month names, starting with "C"'s January.
! _M_month01 = "January";
! _M_month02 = "February";
! _M_month03 = "March";
! _M_month04 = "April";
! _M_month05 = "May";
! _M_month06 = "June";
! _M_month07 = "July";
! _M_month08 = "August";
! _M_month09 = "September";
! _M_month10 = "October";
! _M_month11 = "November";
! _M_month12 = "December";
// Abbreviated month names, starting with "C"'s Jan.
! _M_month_a01 = "Jan";
! _M_month_a02 = "Feb";
! _M_month_a03 = "Mar";
! _M_month_a04 = "Apr";
! _M_month_a05 = "May";
! _M_month_a06 = "Jun";
! _M_month_a07 = "July";
! _M_month_a08 = "Aug";
! _M_month_a09 = "Sep";
! _M_month_a10 = "Oct";
! _M_month_a11 = "Nov";
! _M_month_a12 = "Dec";
}
else
{
_M_c_locale_timepunct = _S_clone_c_locale(__cloc);
! _M_date_format = __nl_langinfo_l(D_FMT, __cloc);
! _M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
! _M_time_format = __nl_langinfo_l(T_FMT, __cloc);
! _M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
! _M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
! _M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, __cloc);
! _M_am = __nl_langinfo_l(AM_STR, __cloc);
! _M_pm = __nl_langinfo_l(PM_STR, __cloc);
! _M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
// Day names, starting with "C"'s Sunday.
! _M_day1 = __nl_langinfo_l(DAY_1, __cloc);
! _M_day2 = __nl_langinfo_l(DAY_2, __cloc);
! _M_day3 = __nl_langinfo_l(DAY_3, __cloc);
! _M_day4 = __nl_langinfo_l(DAY_4, __cloc);
! _M_day5 = __nl_langinfo_l(DAY_5, __cloc);
! _M_day6 = __nl_langinfo_l(DAY_6, __cloc);
! _M_day7 = __nl_langinfo_l(DAY_7, __cloc);
// Abbreviated day names, starting with "C"'s Sun.
! _M_day_a1 = __nl_langinfo_l(ABDAY_1, __cloc);
! _M_day_a2 = __nl_langinfo_l(ABDAY_2, __cloc);
! _M_day_a3 = __nl_langinfo_l(ABDAY_3, __cloc);
! _M_day_a4 = __nl_langinfo_l(ABDAY_4, __cloc);
! _M_day_a5 = __nl_langinfo_l(ABDAY_5, __cloc);
! _M_day_a6 = __nl_langinfo_l(ABDAY_6, __cloc);
! _M_day_a7 = __nl_langinfo_l(ABDAY_7, __cloc);
// Month names, starting with "C"'s January.
! _M_month01 = __nl_langinfo_l(MON_1, __cloc);
! _M_month02 = __nl_langinfo_l(MON_2, __cloc);
! _M_month03 = __nl_langinfo_l(MON_3, __cloc);
! _M_month04 = __nl_langinfo_l(MON_4, __cloc);
! _M_month05 = __nl_langinfo_l(MON_5, __cloc);
! _M_month06 = __nl_langinfo_l(MON_6, __cloc);
! _M_month07 = __nl_langinfo_l(MON_7, __cloc);
! _M_month08 = __nl_langinfo_l(MON_8, __cloc);
! _M_month09 = __nl_langinfo_l(MON_9, __cloc);
! _M_month10 = __nl_langinfo_l(MON_10, __cloc);
! _M_month11 = __nl_langinfo_l(MON_11, __cloc);
! _M_month12 = __nl_langinfo_l(MON_12, __cloc);
// Abbreviated month names, starting with "C"'s Jan.
! _M_month_a01 = __nl_langinfo_l(ABMON_1, __cloc);
! _M_month_a02 = __nl_langinfo_l(ABMON_2, __cloc);
! _M_month_a03 = __nl_langinfo_l(ABMON_3, __cloc);
! _M_month_a04 = __nl_langinfo_l(ABMON_4, __cloc);
! _M_month_a05 = __nl_langinfo_l(ABMON_5, __cloc);
! _M_month_a06 = __nl_langinfo_l(ABMON_6, __cloc);
! _M_month_a07 = __nl_langinfo_l(ABMON_7, __cloc);
! _M_month_a08 = __nl_langinfo_l(ABMON_8, __cloc);
! _M_month_a09 = __nl_langinfo_l(ABMON_9, __cloc);
! _M_month_a10 = __nl_langinfo_l(ABMON_10, __cloc);
! _M_month_a11 = __nl_langinfo_l(ABMON_11, __cloc);
! _M_month_a12 = __nl_langinfo_l(ABMON_12, __cloc);
}
}
--- 60,188 ----
void
__timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
{
+ if (!_M_data)
+ _M_data = new __timepunct_cache<char>;
+
if (!__cloc)
{
// "C" locale
_M_c_locale_timepunct = _S_c_locale;
! _M_data->_M_date_format = "%m/%d/%y";
! _M_data->_M_date_era_format = "%m/%d/%y";
! _M_data->_M_time_format = "%H:%M:%S";
! _M_data->_M_time_era_format = "%H:%M:%S";
! _M_data->_M_date_time_format = "";
! _M_data->_M_date_time_era_format = "";
! _M_data->_M_am = "AM";
! _M_data->_M_pm = "PM";
! _M_data->_M_am_pm_format = "";
// Day names, starting with "C"'s Sunday.
! _M_data->_M_day1 = "Sunday";
! _M_data->_M_day2 = "Monday";
! _M_data->_M_day3 = "Tuesday";
! _M_data->_M_day4 = "Wednesday";
! _M_data->_M_day5 = "Thursday";
! _M_data->_M_day6 = "Friday";
! _M_data->_M_day7 = "Saturday";
// Abbreviated day names, starting with "C"'s Sun.
! _M_data->_M_aday1 = "Sun";
! _M_data->_M_aday2 = "Mon";
! _M_data->_M_aday3 = "Tue";
! _M_data->_M_aday4 = "Wed";
! _M_data->_M_aday5 = "Thu";
! _M_data->_M_aday6 = "Fri";
! _M_data->_M_aday7 = "Sat";
// Month names, starting with "C"'s January.
! _M_data->_M_month01 = "January";
! _M_data->_M_month02 = "February";
! _M_data->_M_month03 = "March";
! _M_data->_M_month04 = "April";
! _M_data->_M_month05 = "May";
! _M_data->_M_month06 = "June";
! _M_data->_M_month07 = "July";
! _M_data->_M_month08 = "August";
! _M_data->_M_month09 = "September";
! _M_data->_M_month10 = "October";
! _M_data->_M_month11 = "November";
! _M_data->_M_month12 = "December";
// Abbreviated month names, starting with "C"'s Jan.
! _M_data->_M_amonth01 = "Jan";
! _M_data->_M_amonth02 = "Feb";
! _M_data->_M_amonth03 = "Mar";
! _M_data->_M_amonth04 = "Apr";
! _M_data->_M_amonth05 = "May";
! _M_data->_M_amonth06 = "Jun";
! _M_data->_M_amonth07 = "July";
! _M_data->_M_amonth08 = "Aug";
! _M_data->_M_amonth09 = "Sep";
! _M_data->_M_amonth10 = "Oct";
! _M_data->_M_amonth11 = "Nov";
! _M_data->_M_amonth12 = "Dec";
}
else
{
_M_c_locale_timepunct = _S_clone_c_locale(__cloc);
! _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
! _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
! _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
! _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
! _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
! _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, __cloc);
! _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
! _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
! _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
// Day names, starting with "C"'s Sunday.
! _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
! _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
! _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
! _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
! _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
! _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
! _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
// Abbreviated day names, starting with "C"'s Sun.
! _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
! _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
! _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
! _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
! _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
! _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
! _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
// Month names, starting with "C"'s January.
! _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
! _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
! _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
! _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
! _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
! _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
! _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
! _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
! _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
! _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
! _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
! _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
// Abbreviated month names, starting with "C"'s Jan.
! _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
! _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
! _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
! _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
! _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
! _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
! _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
! _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
! _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
! _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
! _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
! _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
}
}
*************** namespace std
*** 205,330 ****
void
__timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
{
if (!__cloc)
{
// "C" locale
_M_c_locale_timepunct = _S_c_locale;
! _M_date_format = L"%m/%d/%y";
! _M_date_era_format = L"%m/%d/%y";
! _M_time_format = L"%H:%M:%S";
! _M_time_era_format = L"%H:%M:%S";
! _M_date_time_format = L"";
! _M_date_time_era_format = L"";
! _M_am = L"AM";
! _M_pm = L"PM";
! _M_am_pm_format = L"";
// Day names, starting with "C"'s Sunday.
! _M_day1 = L"Sunday";
! _M_day2 = L"Monday";
! _M_day3 = L"Tuesday";
! _M_day4 = L"Wednesday";
! _M_day5 = L"Thursday";
! _M_day6 = L"Friday";
! _M_day7 = L"Saturday";
// Abbreviated day names, starting with "C"'s Sun.
! _M_day_a1 = L"Sun";
! _M_day_a2 = L"Mon";
! _M_day_a3 = L"Tue";
! _M_day_a4 = L"Wed";
! _M_day_a5 = L"Thu";
! _M_day_a6 = L"Fri";
! _M_day_a7 = L"Sat";
// Month names, starting with "C"'s January.
! _M_month01 = L"January";
! _M_month02 = L"February";
! _M_month03 = L"March";
! _M_month04 = L"April";
! _M_month05 = L"May";
! _M_month06 = L"June";
! _M_month07 = L"July";
! _M_month08 = L"August";
! _M_month09 = L"September";
! _M_month10 = L"October";
! _M_month11 = L"November";
! _M_month12 = L"December";
// Abbreviated month names, starting with "C"'s Jan.
! _M_month_a01 = L"Jan";
! _M_month_a02 = L"Feb";
! _M_month_a03 = L"Mar";
! _M_month_a04 = L"Apr";
! _M_month_a05 = L"May";
! _M_month_a06 = L"Jun";
! _M_month_a07 = L"July";
! _M_month_a08 = L"Aug";
! _M_month_a09 = L"Sep";
! _M_month_a10 = L"Oct";
! _M_month_a11 = L"Nov";
! _M_month_a12 = L"Dec";
}
else
{
_M_c_locale_timepunct = _S_clone_c_locale(__cloc);
! _M_date_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_FMT, __cloc));
! _M_date_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_FMT, __cloc));
! _M_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT, __cloc));
! _M_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_T_FMT, __cloc));
! _M_date_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_T_FMT, __cloc));
! _M_date_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc));
! _M_am = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WAM_STR, __cloc));
! _M_pm = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WPM_STR, __cloc));
! _M_am_pm_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc));
// Day names, starting with "C"'s Sunday.
! _M_day1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_1, __cloc));
! _M_day2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_2, __cloc));
! _M_day3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_3, __cloc));
! _M_day4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_4, __cloc));
! _M_day5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_5, __cloc));
! _M_day6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_6, __cloc));
! _M_day7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_7, __cloc));
// Abbreviated day names, starting with "C"'s Sun.
! _M_day_a1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_1, __cloc));
! _M_day_a2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_2, __cloc));
! _M_day_a3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_3, __cloc));
! _M_day_a4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_4, __cloc));
! _M_day_a5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_5, __cloc));
! _M_day_a6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_6, __cloc));
! _M_day_a7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_7, __cloc));
// Month names, starting with "C"'s January.
! _M_month01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_1, __cloc));
! _M_month02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_2, __cloc));
! _M_month03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_3, __cloc));
! _M_month04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_4, __cloc));
! _M_month05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_5, __cloc));
! _M_month06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_6, __cloc));
! _M_month07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_7, __cloc));
! _M_month08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_8, __cloc));
! _M_month09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_9, __cloc));
! _M_month10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_10, __cloc));
! _M_month11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_11, __cloc));
! _M_month12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_12, __cloc));
// Abbreviated month names, starting with "C"'s Jan.
! _M_month_a01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_1, __cloc));
! _M_month_a02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_2, __cloc));
! _M_month_a03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_3, __cloc));
! _M_month_a04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_4, __cloc));
! _M_month_a05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_5, __cloc));
! _M_month_a06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_6, __cloc));
! _M_month_a07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_7, __cloc));
! _M_month_a08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_8, __cloc));
! _M_month_a09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_9, __cloc));
! _M_month_a10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_10, __cloc));
! _M_month_a11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_11, __cloc));
! _M_month_a12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_12, __cloc));
}
}
#endif
--- 208,336 ----
void
__timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
{
+ if (!_M_data)
+ _M_data = new __timepunct_cache<wchar_t>;
+
if (!__cloc)
{
// "C" locale
_M_c_locale_timepunct = _S_c_locale;
! _M_data->_M_date_format = L"%m/%d/%y";
! _M_data->_M_date_era_format = L"%m/%d/%y";
! _M_data->_M_time_format = L"%H:%M:%S";
! _M_data->_M_time_era_format = L"%H:%M:%S";
! _M_data->_M_date_time_format = L"";
! _M_data->_M_date_time_era_format = L"";
! _M_data->_M_am = L"AM";
! _M_data->_M_pm = L"PM";
! _M_data->_M_am_pm_format = L"";
// Day names, starting with "C"'s Sunday.
! _M_data->_M_day1 = L"Sunday";
! _M_data->_M_day2 = L"Monday";
! _M_data->_M_day3 = L"Tuesday";
! _M_data->_M_day4 = L"Wednesday";
! _M_data->_M_day5 = L"Thursday";
! _M_data->_M_day6 = L"Friday";
! _M_data->_M_day7 = L"Saturday";
// Abbreviated day names, starting with "C"'s Sun.
! _M_data->_M_aday1 = L"Sun";
! _M_data->_M_aday2 = L"Mon";
! _M_data->_M_aday3 = L"Tue";
! _M_data->_M_aday4 = L"Wed";
! _M_data->_M_aday5 = L"Thu";
! _M_data->_M_aday6 = L"Fri";
! _M_data->_M_aday7 = L"Sat";
// Month names, starting with "C"'s January.
! _M_data->_M_month01 = L"January";
! _M_data->_M_month02 = L"February";
! _M_data->_M_month03 = L"March";
! _M_data->_M_month04 = L"April";
! _M_data->_M_month05 = L"May";
! _M_data->_M_month06 = L"June";
! _M_data->_M_month07 = L"July";
! _M_data->_M_month08 = L"August";
! _M_data->_M_month09 = L"September";
! _M_data->_M_month10 = L"October";
! _M_data->_M_month11 = L"November";
! _M_data->_M_month12 = L"December";
// Abbreviated month names, starting with "C"'s Jan.
! _M_data->_M_amonth01 = L"Jan";
! _M_data->_M_amonth02 = L"Feb";
! _M_data->_M_amonth03 = L"Mar";
! _M_data->_M_amonth04 = L"Apr";
! _M_data->_M_amonth05 = L"May";
! _M_data->_M_amonth06 = L"Jun";
! _M_data->_M_amonth07 = L"July";
! _M_data->_M_amonth08 = L"Aug";
! _M_data->_M_amonth09 = L"Sep";
! _M_data->_M_amonth10 = L"Oct";
! _M_data->_M_amonth11 = L"Nov";
! _M_data->_M_amonth12 = L"Dec";
}
else
{
_M_c_locale_timepunct = _S_clone_c_locale(__cloc);
! _M_data->_M_date_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_FMT, __cloc));
! _M_data->_M_date_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_FMT, __cloc));
! _M_data->_M_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT, __cloc));
! _M_data->_M_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_T_FMT, __cloc));
! _M_data->_M_date_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_T_FMT, __cloc));
! _M_data->_M_date_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc));
! _M_data->_M_am = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WAM_STR, __cloc));
! _M_data->_M_pm = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WPM_STR, __cloc));
! _M_data->_M_am_pm_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc));
// Day names, starting with "C"'s Sunday.
! _M_data->_M_day1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_1, __cloc));
! _M_data->_M_day2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_2, __cloc));
! _M_data->_M_day3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_3, __cloc));
! _M_data->_M_day4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_4, __cloc));
! _M_data->_M_day5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_5, __cloc));
! _M_data->_M_day6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_6, __cloc));
! _M_data->_M_day7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_7, __cloc));
// Abbreviated day names, starting with "C"'s Sun.
! _M_data->_M_aday1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_1, __cloc));
! _M_data->_M_aday2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_2, __cloc));
! _M_data->_M_aday3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_3, __cloc));
! _M_data->_M_aday4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_4, __cloc));
! _M_data->_M_aday5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_5, __cloc));
! _M_data->_M_aday6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_6, __cloc));
! _M_data->_M_aday7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_7, __cloc));
// Month names, starting with "C"'s January.
! _M_data->_M_month01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_1, __cloc));
! _M_data->_M_month02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_2, __cloc));
! _M_data->_M_month03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_3, __cloc));
! _M_data->_M_month04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_4, __cloc));
! _M_data->_M_month05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_5, __cloc));
! _M_data->_M_month06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_6, __cloc));
! _M_data->_M_month07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_7, __cloc));
! _M_data->_M_month08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_8, __cloc));
! _M_data->_M_month09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_9, __cloc));
! _M_data->_M_month10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_10, __cloc));
! _M_data->_M_month11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_11, __cloc));
! _M_data->_M_month12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_12, __cloc));
// Abbreviated month names, starting with "C"'s Jan.
! _M_data->_M_amonth01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_1, __cloc));
! _M_data->_M_amonth02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_2, __cloc));
! _M_data->_M_amonth03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_3, __cloc));
! _M_data->_M_amonth04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_4, __cloc));
! _M_data->_M_amonth05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_5, __cloc));
! _M_data->_M_amonth06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_6, __cloc));
! _M_data->_M_amonth07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_7, __cloc));
! _M_data->_M_amonth08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_8, __cloc));
! _M_data->_M_amonth09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_9, __cloc));
! _M_data->_M_amonth10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_10, __cloc));
! _M_data->_M_amonth11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_11, __cloc));
! _M_data->_M_amonth12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_12, __cloc));
}
}
#endif
Index: config/locale/gnu/time_members.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/time_members.h,v
retrieving revision 1.1
diff -c -p -r1.1 time_members.h
*** config/locale/gnu/time_members.h 6 Jan 2003 21:22:56 -0000 1.1
--- config/locale/gnu/time_members.h 18 Jul 2003 02:14:01 -0000
***************
*** 36,42 ****
template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs)
! : locale::facet(__refs)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_timepunct = _S_c_name;
--- 36,52 ----
template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs)
! : facet(__refs), _M_data(NULL)
! {
! #if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
! _M_name_timepunct = _S_c_name;
! #endif
! _M_initialize_timepunct();
! }
!
! template<typename _CharT>
! __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
! : facet(__refs), _M_data(__cache)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_timepunct = _S_c_name;
***************
*** 48,54 ****
__timepunct<_CharT>::__timepunct(__c_locale __cloc,
const char* __s __attribute__ ((__unused__)),
size_t __refs)
! : locale::facet(__refs)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_timepunct = new char[strlen(__s) + 1];
--- 58,64 ----
__timepunct<_CharT>::__timepunct(__c_locale __cloc,
const char* __s __attribute__ ((__unused__)),
size_t __refs)
! : facet(__refs), _M_data(NULL)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_timepunct = new char[strlen(__s) + 1];
***************
*** 64,68 ****
--- 74,79 ----
if (_S_c_name != _M_name_timepunct)
delete [] _M_name_timepunct;
#endif
+ delete _M_data;
_S_destroy_c_locale(_M_c_locale_timepunct);
}
Index: include/bits/locale_facets.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/locale_facets.h,v
retrieving revision 1.63
diff -c -p -r1.63 locale_facets.h
*** include/bits/locale_facets.h 17 Jul 2003 01:54:43 -0000 1.63
--- include/bits/locale_facets.h 18 Jul 2003 02:14:02 -0000
*************** namespace std
*** 225,231 ****
protected:
explicit
! __ctype_abstract_base(size_t __refs = 0): locale::facet(__refs) { }
virtual
~__ctype_abstract_base() { }
--- 225,231 ----
protected:
explicit
! __ctype_abstract_base(size_t __refs = 0): facet(__refs) { }
virtual
~__ctype_abstract_base() { }
*************** namespace std
*** 602,608 ****
bool _M_allocated;
! __numpunct_cache(size_t __refs = 0) : locale::facet(__refs),
_M_grouping(NULL), _M_use_grouping(false), _M_truename(NULL),
_M_falsename(NULL), _M_decimal_point(_CharT()),
_M_thousands_sep(_CharT()), _M_allocated(false)
--- 602,608 ----
bool _M_allocated;
! __numpunct_cache(size_t __refs = 0) : facet(__refs),
_M_grouping(NULL), _M_use_grouping(false), _M_truename(NULL),
_M_falsename(NULL), _M_decimal_point(_CharT()),
_M_thousands_sep(_CharT()), _M_allocated(false)
*************** namespace std
*** 692,698 ****
explicit
numpunct(__c_locale __cloc, size_t __refs = 0)
! : locale::facet(__refs), _M_data(NULL)
{ _M_initialize_numpunct(__cloc); }
char_type
--- 692,698 ----
explicit
numpunct(__c_locale __cloc, size_t __refs = 0)
! : facet(__refs), _M_data(NULL)
{ _M_initialize_numpunct(__cloc); }
char_type
*************** namespace std
*** 798,804 ****
static locale::id id;
explicit
! num_get(size_t __refs = 0) : locale::facet(__refs) { }
iter_type
get(iter_type __in, iter_type __end, ios_base& __io,
--- 798,804 ----
static locale::id id;
explicit
! num_get(size_t __refs = 0) : facet(__refs) { }
iter_type
get(iter_type __in, iter_type __end, ios_base& __io,
*************** namespace std
*** 944,950 ****
static locale::id id;
explicit
! num_put(size_t __refs = 0) : locale::facet(__refs) { }
iter_type
put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const
--- 944,950 ----
static locale::id id;
explicit
! num_put(size_t __refs = 0) : facet(__refs) { }
iter_type
put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const
*************** namespace std
*** 1061,1072 ****
explicit
collate(size_t __refs = 0)
! : locale::facet(__refs)
{ _M_c_locale_collate = _S_c_locale; }
explicit
collate(__c_locale __cloc, size_t __refs = 0)
! : locale::facet(__refs)
{ _M_c_locale_collate = _S_clone_c_locale(__cloc); }
int
--- 1061,1072 ----
explicit
collate(size_t __refs = 0)
! : facet(__refs)
{ _M_c_locale_collate = _S_c_locale; }
explicit
collate(__c_locale __cloc, size_t __refs = 0)
! : facet(__refs)
{ _M_c_locale_collate = _S_clone_c_locale(__cloc); }
int
*************** namespace std
*** 1155,1175 ****
};
template<typename _CharT>
! class __timepunct : public locale::facet
{
- public:
- // Types:
- typedef _CharT __char_type;
- typedef basic_string<_CharT> __string_type;
-
- static locale::id id;
-
// List of all known timezones, with GMT first.
static const _CharT* _S_timezones[14];
- protected:
- __c_locale _M_c_locale_timepunct;
- char* _M_name_timepunct;
const _CharT* _M_date_format;
const _CharT* _M_date_era_format;
const _CharT* _M_time_format;
--- 1155,1165 ----
};
template<typename _CharT>
! struct __timepunct_cache : public locale::facet
{
// List of all known timezones, with GMT first.
static const _CharT* _S_timezones[14];
const _CharT* _M_date_format;
const _CharT* _M_date_era_format;
const _CharT* _M_time_format;
*************** namespace std
*** 1190,1202 ****
const _CharT* _M_day7;
// Abbreviated day names, starting with "C"'s Sun.
! const _CharT* _M_day_a1;
! const _CharT* _M_day_a2;
! const _CharT* _M_day_a3;
! const _CharT* _M_day_a4;
! const _CharT* _M_day_a5;
! const _CharT* _M_day_a6;
! const _CharT* _M_day_a7;
// Month names, starting with "C"'s January.
const _CharT* _M_month01;
--- 1180,1192 ----
const _CharT* _M_day7;
// Abbreviated day names, starting with "C"'s Sun.
! const _CharT* _M_aday1;
! const _CharT* _M_aday2;
! const _CharT* _M_aday3;
! const _CharT* _M_aday4;
! const _CharT* _M_aday5;
! const _CharT* _M_aday6;
! const _CharT* _M_aday7;
// Month names, starting with "C"'s January.
const _CharT* _M_month01;
*************** namespace std
*** 1213,1236 ****
const _CharT* _M_month12;
// Abbreviated month names, starting with "C"'s Jan.
! const _CharT* _M_month_a01;
! const _CharT* _M_month_a02;
! const _CharT* _M_month_a03;
! const _CharT* _M_month_a04;
! const _CharT* _M_month_a05;
! const _CharT* _M_month_a06;
! const _CharT* _M_month_a07;
! const _CharT* _M_month_a08;
! const _CharT* _M_month_a09;
! const _CharT* _M_month_a10;
! const _CharT* _M_month_a11;
! const _CharT* _M_month_a12;
public:
explicit
__timepunct(size_t __refs = 0);
explicit
__timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0);
void
--- 1203,1294 ----
const _CharT* _M_month12;
// Abbreviated month names, starting with "C"'s Jan.
! const _CharT* _M_amonth01;
! const _CharT* _M_amonth02;
! const _CharT* _M_amonth03;
! const _CharT* _M_amonth04;
! const _CharT* _M_amonth05;
! const _CharT* _M_amonth06;
! const _CharT* _M_amonth07;
! const _CharT* _M_amonth08;
! const _CharT* _M_amonth09;
! const _CharT* _M_amonth10;
! const _CharT* _M_amonth11;
! const _CharT* _M_amonth12;
!
! bool _M_allocated;
!
! __timepunct_cache(size_t __refs = 0) : facet(__refs),
! _M_date_format(NULL), _M_date_era_format(NULL), _M_time_format(NULL),
! _M_time_era_format(NULL), _M_date_time_format(NULL),
! _M_date_time_era_format(NULL), _M_am(NULL), _M_pm(NULL),
! _M_am_pm_format(NULL), _M_day1(NULL), _M_day2(NULL), _M_day3(NULL),
! _M_day4(NULL), _M_day5(NULL), _M_day6(NULL), _M_day7(NULL),
! _M_aday1(NULL), _M_aday2(NULL), _M_aday3(NULL), _M_aday4(NULL),
! _M_aday5(NULL), _M_aday6(NULL), _M_aday7(NULL), _M_month01(NULL),
! _M_month02(NULL), _M_month03(NULL), _M_month04(NULL), _M_month05(NULL),
! _M_month06(NULL), _M_month07(NULL), _M_month08(NULL), _M_month09(NULL),
! _M_month10(NULL), _M_month11(NULL), _M_month12(NULL), _M_amonth01(NULL),
! _M_amonth02(NULL), _M_amonth03(NULL), _M_amonth04(NULL),
! _M_amonth05(NULL), _M_amonth06(NULL), _M_amonth07(NULL),
! _M_amonth08(NULL), _M_amonth09(NULL), _M_amonth10(NULL),
! _M_amonth11(NULL), _M_amonth12(NULL), _M_allocated(false)
! { }
!
! ~__timepunct_cache();
!
! void
! _M_cache(const locale& __loc);
! };
!
! template<typename _CharT>
! __timepunct_cache<_CharT>::~__timepunct_cache()
! {
! if (_M_allocated)
! {
! // XXX.
! }
! }
!
! // Specializations.
! template<>
! const char*
! __timepunct_cache<char>::_S_timezones[14];
!
! #ifdef _GLIBCXX_USE_WCHAR_T
! template<>
! const wchar_t*
! __timepunct_cache<wchar_t>::_S_timezones[14];
! #endif
!
! // Generic.
! template<typename _CharT>
! const _CharT* __timepunct_cache<_CharT>::_S_timezones[14];
!
! template<typename _CharT>
! class __timepunct : public locale::facet
! {
! public:
! // Types:
! typedef _CharT __char_type;
! typedef basic_string<_CharT> __string_type;
! typedef __timepunct_cache<_CharT> __cache_type;
!
! protected:
! __cache_type* _M_data;
! __c_locale _M_c_locale_timepunct;
! char* _M_name_timepunct;
public:
+ static locale::id id;
+
explicit
__timepunct(size_t __refs = 0);
explicit
+ __timepunct(__cache_type* __cache, size_t __refs = 0);
+
+ explicit
__timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0);
void
*************** namespace std
*** 1241,1329 ****
_M_date_formats(const _CharT** __date) const
{
// Always have default first.
! __date[0] = _M_date_format;
! __date[1] = _M_date_era_format;
}
void
_M_time_formats(const _CharT** __time) const
{
// Always have default first.
! __time[0] = _M_time_format;
! __time[1] = _M_time_era_format;
}
void
_M_ampm(const _CharT** __ampm) const
{
! __ampm[0] = _M_am;
! __ampm[1] = _M_pm;
}
void
_M_date_time_formats(const _CharT** __dt) const
{
// Always have default first.
! __dt[0] = _M_date_time_format;
! __dt[1] = _M_date_time_era_format;
}
void
_M_days(const _CharT** __days) const
{
! __days[0] = _M_day1;
! __days[1] = _M_day2;
! __days[2] = _M_day3;
! __days[3] = _M_day4;
! __days[4] = _M_day5;
! __days[5] = _M_day6;
! __days[6] = _M_day7;
}
void
_M_days_abbreviated(const _CharT** __days) const
{
! __days[0] = _M_day_a1;
! __days[1] = _M_day_a2;
! __days[2] = _M_day_a3;
! __days[3] = _M_day_a4;
! __days[4] = _M_day_a5;
! __days[5] = _M_day_a6;
! __days[6] = _M_day_a7;
}
void
_M_months(const _CharT** __months) const
{
! __months[0] = _M_month01;
! __months[1] = _M_month02;
! __months[2] = _M_month03;
! __months[3] = _M_month04;
! __months[4] = _M_month05;
! __months[5] = _M_month06;
! __months[6] = _M_month07;
! __months[7] = _M_month08;
! __months[8] = _M_month09;
! __months[9] = _M_month10;
! __months[10] = _M_month11;
! __months[11] = _M_month12;
}
void
_M_months_abbreviated(const _CharT** __months) const
{
! __months[0] = _M_month_a01;
! __months[1] = _M_month_a02;
! __months[2] = _M_month_a03;
! __months[3] = _M_month_a04;
! __months[4] = _M_month_a05;
! __months[5] = _M_month_a06;
! __months[6] = _M_month_a07;
! __months[7] = _M_month_a08;
! __months[8] = _M_month_a09;
! __months[9] = _M_month_a10;
! __months[10] = _M_month_a11;
! __months[11] = _M_month_a12;
}
protected:
--- 1299,1387 ----
_M_date_formats(const _CharT** __date) const
{
// Always have default first.
! __date[0] = _M_data->_M_date_format;
! __date[1] = _M_data->_M_date_era_format;
}
void
_M_time_formats(const _CharT** __time) const
{
// Always have default first.
! __time[0] = _M_data->_M_time_format;
! __time[1] = _M_data->_M_time_era_format;
}
void
_M_ampm(const _CharT** __ampm) const
{
! __ampm[0] = _M_data->_M_am;
! __ampm[1] = _M_data->_M_pm;
}
void
_M_date_time_formats(const _CharT** __dt) const
{
// Always have default first.
! __dt[0] = _M_data->_M_date_time_format;
! __dt[1] = _M_data->_M_date_time_era_format;
}
void
_M_days(const _CharT** __days) const
{
! __days[0] = _M_data->_M_day1;
! __days[1] = _M_data->_M_day2;
! __days[2] = _M_data->_M_day3;
! __days[3] = _M_data->_M_day4;
! __days[4] = _M_data->_M_day5;
! __days[5] = _M_data->_M_day6;
! __days[6] = _M_data->_M_day7;
}
void
_M_days_abbreviated(const _CharT** __days) const
{
! __days[0] = _M_data->_M_aday1;
! __days[1] = _M_data->_M_aday2;
! __days[2] = _M_data->_M_aday3;
! __days[3] = _M_data->_M_aday4;
! __days[4] = _M_data->_M_aday5;
! __days[5] = _M_data->_M_aday6;
! __days[6] = _M_data->_M_aday7;
}
void
_M_months(const _CharT** __months) const
{
! __months[0] = _M_data->_M_month01;
! __months[1] = _M_data->_M_month02;
! __months[2] = _M_data->_M_month03;
! __months[3] = _M_data->_M_month04;
! __months[4] = _M_data->_M_month05;
! __months[5] = _M_data->_M_month06;
! __months[6] = _M_data->_M_month07;
! __months[7] = _M_data->_M_month08;
! __months[8] = _M_data->_M_month09;
! __months[9] = _M_data->_M_month10;
! __months[10] = _M_data->_M_month11;
! __months[11] = _M_data->_M_month12;
}
void
_M_months_abbreviated(const _CharT** __months) const
{
! __months[0] = _M_data->_M_amonth01;
! __months[1] = _M_data->_M_amonth02;
! __months[2] = _M_data->_M_amonth03;
! __months[3] = _M_data->_M_amonth04;
! __months[4] = _M_data->_M_amonth05;
! __months[5] = _M_data->_M_amonth06;
! __months[6] = _M_data->_M_amonth07;
! __months[7] = _M_data->_M_amonth08;
! __months[8] = _M_data->_M_amonth09;
! __months[9] = _M_data->_M_amonth10;
! __months[10] = _M_data->_M_amonth11;
! __months[11] = _M_data->_M_amonth12;
}
protected:
*************** namespace std
*** 1340,1349 ****
// Specializations.
template<>
- const char*
- __timepunct<char>::_S_timezones[14];
-
- template<>
void
__timepunct<char>::_M_initialize_timepunct(__c_locale __cloc);
--- 1398,1403 ----
*************** namespace std
*** 1353,1362 ****
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
- const wchar_t*
- __timepunct<wchar_t>::_S_timezones[14];
-
- template<>
void
__timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc);
--- 1407,1412 ----
*************** namespace std
*** 1366,1375 ****
const tm*) const;
#endif
- // Generic.
- template<typename _CharT>
- const _CharT* __timepunct<_CharT>::_S_timezones[14];
-
// Include host and configuration specific timepunct functions.
#include <bits/time_members.h>
--- 1416,1421 ----
*************** namespace std
*** 1386,1392 ****
explicit
time_get(size_t __refs = 0)
! : locale::facet (__refs) { }
dateorder
date_order() const
--- 1432,1438 ----
explicit
time_get(size_t __refs = 0)
! : facet (__refs) { }
dateorder
date_order() const
*************** namespace std
*** 1497,1503 ****
explicit
time_put(size_t __refs = 0)
! : locale::facet(__refs) { }
iter_type
put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm,
--- 1543,1549 ----
explicit
time_put(size_t __refs = 0)
! : facet(__refs) { }
iter_type
put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm,
*************** namespace std
*** 1554,1589 ****
_S_construct_pattern(char __precedes, char __space, char __posn);
};
template<typename _CharT, bool _Intl>
class moneypunct : public locale::facet, public money_base
{
public:
// Types:
! typedef _CharT char_type;
typedef basic_string<_CharT> string_type;
static const bool intl = _Intl;
static locale::id id;
! private:
! const char* _M_grouping;
! char_type _M_decimal_point;
! char_type _M_thousands_sep;
! const char_type* _M_curr_symbol;
! const char_type* _M_positive_sign;
! const char_type* _M_negative_sign;
! int _M_frac_digits;
! pattern _M_pos_format;
! pattern _M_neg_format;
- public:
explicit
! moneypunct(size_t __refs = 0) : locale::facet(__refs)
{ _M_initialize_moneypunct(); }
explicit
moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0)
! : locale::facet(__refs)
{ _M_initialize_moneypunct(__cloc, __s); }
char_type
--- 1600,1672 ----
_S_construct_pattern(char __precedes, char __space, char __posn);
};
+ template<typename _CharT>
+ struct __moneypunct_cache : public locale::facet
+ {
+ const char* _M_grouping;
+ bool _M_use_grouping;
+ _CharT _M_decimal_point;
+ _CharT _M_thousands_sep;
+ const _CharT* _M_curr_symbol;
+ const _CharT* _M_positive_sign;
+ const _CharT* _M_negative_sign;
+ int _M_frac_digits;
+ money_base::pattern _M_pos_format;
+ money_base::pattern _M_neg_format;
+
+ bool _M_allocated;
+
+ __moneypunct_cache(size_t __refs = 0) : facet(__refs),
+ _M_grouping(NULL), _M_use_grouping(false), _M_decimal_point(_CharT()),
+ _M_thousands_sep(_CharT()), _M_curr_symbol(NULL), _M_positive_sign(NULL),
+ _M_negative_sign(NULL), _M_frac_digits(0),
+ _M_pos_format(money_base::pattern()),
+ _M_neg_format(money_base::pattern()), _M_allocated(false)
+ { }
+
+ ~__moneypunct_cache();
+
+ void
+ _M_cache(const locale& __loc);
+ };
+
+ template<typename _CharT>
+ __moneypunct_cache<_CharT>::~__moneypunct_cache()
+ {
+ if (_M_allocated)
+ {
+ // XXX.
+ }
+ }
+
template<typename _CharT, bool _Intl>
class moneypunct : public locale::facet, public money_base
{
public:
// Types:
! typedef _CharT char_type;
typedef basic_string<_CharT> string_type;
+ typedef __moneypunct_cache<_CharT> __cache_type;
+
+ private:
+ __cache_type* _M_data;
+ public:
static const bool intl = _Intl;
static locale::id id;
! explicit
! moneypunct(size_t __refs = 0) : facet(__refs), _M_data(NULL)
! { _M_initialize_moneypunct(); }
explicit
! moneypunct(__cache_type* __cache, size_t __refs = 0)
! : facet(__refs), _M_data(__cache)
{ _M_initialize_moneypunct(); }
explicit
moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0)
! : facet(__refs), _M_data(NULL)
{ _M_initialize_moneypunct(__cloc, __s); }
char_type
*************** namespace std
*** 1628,1666 ****
virtual char_type
do_decimal_point() const
! { return _M_decimal_point; }
virtual char_type
do_thousands_sep() const
! { return _M_thousands_sep; }
virtual string
do_grouping() const
! { return _M_grouping; }
virtual string_type
do_curr_symbol() const
! { return _M_curr_symbol; }
virtual string_type
do_positive_sign() const
! { return _M_positive_sign; }
virtual string_type
do_negative_sign() const
! { return _M_negative_sign; }
virtual int
do_frac_digits() const
! { return _M_frac_digits; }
virtual pattern
do_pos_format() const
! { return _M_pos_format; }
virtual pattern
do_neg_format() const
! { return _M_neg_format; }
// For use at construction time only.
void
--- 1711,1749 ----
virtual char_type
do_decimal_point() const
! { return _M_data->_M_decimal_point; }
virtual char_type
do_thousands_sep() const
! { return _M_data->_M_thousands_sep; }
virtual string
do_grouping() const
! { return _M_data->_M_grouping; }
virtual string_type
do_curr_symbol() const
! { return _M_data->_M_curr_symbol; }
virtual string_type
do_positive_sign() const
! { return _M_data->_M_positive_sign; }
virtual string_type
do_negative_sign() const
! { return _M_data->_M_negative_sign; }
virtual int
do_frac_digits() const
! { return _M_data->_M_frac_digits; }
virtual pattern
do_pos_format() const
! { return _M_data->_M_pos_format; }
virtual pattern
do_neg_format() const
! { return _M_data->_M_neg_format; }
// For use at construction time only.
void
*************** namespace std
*** 1746,1752 ****
static locale::id id;
explicit
! money_get(size_t __refs = 0) : locale::facet(__refs) { }
iter_type
get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
--- 1829,1835 ----
static locale::id id;
explicit
! money_get(size_t __refs = 0) : facet(__refs) { }
iter_type
get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
*************** namespace std
*** 1785,1791 ****
static locale::id id;
explicit
! money_put(size_t __refs = 0) : locale::facet(__refs) { }
iter_type
put(iter_type __s, bool __intl, ios_base& __io,
--- 1868,1874 ----
static locale::id id;
explicit
! money_put(size_t __refs = 0) : facet(__refs) { }
iter_type
put(iter_type __s, bool __intl, ios_base& __io,
Index: include/bits/locale_facets.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/locale_facets.tcc,v
retrieving revision 1.109
diff -c -p -r1.109 locale_facets.tcc
*** include/bits/locale_facets.tcc 17 Jul 2003 01:54:43 -0000 1.109
--- include/bits/locale_facets.tcc 18 Jul 2003 02:14:03 -0000
*************** namespace std
*** 1701,1707 ****
{
int __tmp;
_M_extract_name(__beg, __end, __tmp,
! __timepunct<_CharT>::_S_timezones,
14, __err);
// GMT requires special effort.
--- 1701,1707 ----
{
int __tmp;
_M_extract_name(__beg, __end, __tmp,
! __timepunct_cache<_CharT>::_S_timezones,
14, __err);
// GMT requires special effort.
Index: src/globals.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/globals.cc,v
retrieving revision 1.19
diff -c -p -r1.19 globals.cc
*** src/globals.cc 5 Jul 2003 04:05:42 -0000 1.19
--- src/globals.cc 18 Jul 2003 02:14:04 -0000
*************** namespace __gnu_cxx
*** 157,164 ****
typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<char, true>))));
! fake_moneypunct_c moneypunct_tc;
! fake_moneypunct_c moneypunct_fc;
typedef char fake_money_get_c[sizeof(money_get<char>)]
__attribute__ ((aligned(__alignof__(money_get<char>))));
--- 157,164 ----
typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<char, true>))));
! fake_moneypunct_c moneypunct_ct;
! fake_moneypunct_c moneypunct_cf;
typedef char fake_money_get_c[sizeof(money_get<char>)]
__attribute__ ((aligned(__alignof__(money_get<char>))));
*************** namespace __gnu_cxx
*** 211,218 ****
typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>))));
! fake_moneypunct_w moneypunct_tw;
! fake_moneypunct_w moneypunct_fw;
typedef char fake_money_get_w[sizeof(money_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(money_get<wchar_t>))));
--- 211,218 ----
typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>))));
! fake_moneypunct_w moneypunct_wt;
! fake_moneypunct_w moneypunct_wf;
typedef char fake_money_get_w[sizeof(money_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(money_get<wchar_t>))));
*************** namespace __gnu_cxx
*** 239,253 ****
fake_messages_w messages_w;
#endif
! // Storage for C locale caches
! typedef char fake_locale_cache_c[sizeof(std::__numpunct_cache<char>)]
__attribute__ ((aligned(__alignof__(std::__numpunct_cache<char>))));
! fake_locale_cache_c numpunct_cache_c;
#ifdef _GLIBCXX_USE_WCHAR_T
! typedef char fake_locale_cache_w[sizeof(std::__numpunct_cache<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::__numpunct_cache<wchar_t>))));
! fake_locale_cache_w numpunct_cache_w;
#endif
// Globals for once-only runtime initialization of mutex objects. This
--- 239,271 ----
fake_messages_w messages_w;
#endif
! // Storage for "C" locale caches.
! typedef char fake_num_cache_c[sizeof(std::__numpunct_cache<char>)]
__attribute__ ((aligned(__alignof__(std::__numpunct_cache<char>))));
! fake_num_cache_c numpunct_cache_c;
!
! typedef char fake_money_cache_c[sizeof(std::__moneypunct_cache<char>)]
! __attribute__ ((aligned(__alignof__(std::__moneypunct_cache<char>))));
! fake_money_cache_c moneypunct_cache_ct;
! fake_money_cache_c moneypunct_cache_cf;
!
! typedef char fake_time_cache_c[sizeof(std::__timepunct_cache<char>)]
! __attribute__ ((aligned(__alignof__(std::__timepunct_cache<char>))));
! fake_time_cache_c timepunct_cache_c;
#ifdef _GLIBCXX_USE_WCHAR_T
! typedef char fake_num_cache_w[sizeof(std::__numpunct_cache<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::__numpunct_cache<wchar_t>))));
! fake_num_cache_w numpunct_cache_w;
!
! typedef char fake_money_cache_w[sizeof(std::__moneypunct_cache<wchar_t>)]
! __attribute__ ((aligned(__alignof__(std::__moneypunct_cache<wchar_t>))));
! fake_money_cache_w moneypunct_cache_wt;
! fake_money_cache_w moneypunct_cache_wf;
!
! typedef char fake_time_cache_w[sizeof(std::__timepunct_cache<wchar_t>)]
! __attribute__ ((aligned(__alignof__(std::__timepunct_cache<wchar_t>))));
! fake_time_cache_w timepunct_cache_w;
#endif
// Globals for once-only runtime initialization of mutex objects. This
Index: src/locale-inst.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/locale-inst.cc,v
retrieving revision 1.41
diff -c -p -r1.41 locale-inst.cc
*** src/locale-inst.cc 17 Jul 2003 01:54:44 -0000 1.41
--- src/locale-inst.cc 18 Jul 2003 02:14:04 -0000
*************** namespace std
*** 41,46 ****
--- 41,47 ----
// moneypunct, money_get, and money_put
template class moneypunct<char, false>;
template class moneypunct<char, true>;
+ template struct __moneypunct_cache<char>;
template class moneypunct_byname<char, false>;
template class moneypunct_byname<char, true>;
template class money_get<char, istreambuf_iterator<char> >;
*************** namespace std
*** 49,54 ****
--- 50,56 ----
#ifdef _GLIBCXX_USE_WCHAR_T
template class moneypunct<wchar_t, false>;
template class moneypunct<wchar_t, true>;
+ template struct __moneypunct_cache<wchar_t>;
template class moneypunct_byname<wchar_t, false>;
template class moneypunct_byname<wchar_t, true>;
template class money_get<wchar_t, istreambuf_iterator<wchar_t> >;
*************** namespace std
*** 147,152 ****
--- 149,155 ----
// time_get and time_put
template class __timepunct<char>;
+ template struct __timepunct_cache<char>;
template class time_put<char, ostreambuf_iterator<char> >;
template class time_put_byname<char, ostreambuf_iterator<char> >;
template class time_get<char, istreambuf_iterator<char> >;
*************** namespace std
*** 154,159 ****
--- 157,163 ----
#ifdef _GLIBCXX_USE_WCHAR_T
template class __timepunct<wchar_t>;
+ template struct __timepunct_cache<wchar_t>;
template class time_put<wchar_t, ostreambuf_iterator<wchar_t> >;
template class time_put_byname<wchar_t, ostreambuf_iterator<wchar_t> >;
template class time_get<wchar_t, istreambuf_iterator<wchar_t> >;
Index: src/locale.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/locale.cc,v
retrieving revision 1.91
diff -c -p -r1.91 locale.cc
*** src/locale.cc 17 Jul 2003 01:54:44 -0000 1.91
--- src/locale.cc 18 Jul 2003 02:14:05 -0000
*************** namespace std
*** 455,461 ****
// Definitions for static const data members of time_base.
template<>
const char*
! __timepunct<char>::_S_timezones[14] =
{
"GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET",
"IST", "EET", "CST", "JST"
--- 455,461 ----
// Definitions for static const data members of time_base.
template<>
const char*
! __timepunct_cache<char>::_S_timezones[14] =
{
"GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET",
"IST", "EET", "CST", "JST"
*************** namespace std
*** 464,470 ****
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
const wchar_t*
! __timepunct<wchar_t>::_S_timezones[14] =
{
L"GMT", L"HST", L"AKST", L"PST", L"MST", L"CST", L"EST", L"AST",
L"NST", L"CET", L"IST", L"EET", L"CST", L"JST"
--- 464,470 ----
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
const wchar_t*
! __timepunct_cache<wchar_t>::_S_timezones[14] =
{
L"GMT", L"HST", L"AKST", L"PST", L"MST", L"CST", L"EST", L"AST",
L"NST", L"CET", L"IST", L"EET", L"CST", L"JST"
Index: src/localename.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/localename.cc,v
retrieving revision 1.42
diff -c -p -r1.42 localename.cc
*** src/localename.cc 6 Jul 2003 09:37:11 -0000 1.42
--- src/localename.cc 18 Jul 2003 02:14:05 -0000
*************** namespace __gnu_cxx
*** 43,52 ****
extern std::collate<char> collate_c;
extern numpunct<char> numpunct_c;
extern num_get<char> num_get_c;
! extern num_put<char> num_put_c;
! extern codecvt<char, char, mbstate_t> codecvt_c;
! extern moneypunct<char, false> moneypunct_fc;
! extern moneypunct<char, true> moneypunct_tc;
extern money_get<char> money_get_c;
extern money_put<char> money_put_c;
extern __timepunct<char> timepunct_c;
--- 43,52 ----
extern std::collate<char> collate_c;
extern numpunct<char> numpunct_c;
extern num_get<char> num_get_c;
! extern num_put<char> num_put_c;
! extern codecvt<char, char, mbstate_t> codecvt_c;
! extern moneypunct<char, false> moneypunct_cf;
! extern moneypunct<char, true> moneypunct_ct;
extern money_get<char> money_get_c;
extern money_put<char> money_put_c;
extern __timepunct<char> timepunct_c;
*************** namespace __gnu_cxx
*** 60,67 ****
extern num_get<wchar_t> num_get_w;
extern num_put<wchar_t> num_put_w;
extern codecvt<wchar_t, char, mbstate_t> codecvt_w;
! extern moneypunct<wchar_t, false> moneypunct_fw;
! extern moneypunct<wchar_t, true> moneypunct_tw;
extern money_get<wchar_t> money_get_w;
extern money_put<wchar_t> money_put_w;
extern __timepunct<wchar_t> timepunct_w;
--- 60,67 ----
extern num_get<wchar_t> num_get_w;
extern num_put<wchar_t> num_put_w;
extern codecvt<wchar_t, char, mbstate_t> codecvt_w;
! extern moneypunct<wchar_t, false> moneypunct_wf;
! extern moneypunct<wchar_t, true> moneypunct_wt;
extern money_get<wchar_t> money_get_w;
extern money_put<wchar_t> money_put_w;
extern __timepunct<wchar_t> timepunct_w;
*************** namespace __gnu_cxx
*** 70,79 ****
extern std::messages<wchar_t> messages_w;
#endif
extern locale::facet* cache_vec[_GLIBCXX_NUM_FACETS];
! extern std::__numpunct_cache<char> numpunct_cache_c;
#ifdef _GLIBCXX_USE_WCHAR_T
! extern std::__numpunct_cache<wchar_t> numpunct_cache_w;
#endif
} // namespace __gnu_cxx
--- 70,86 ----
extern std::messages<wchar_t> messages_w;
#endif
+ // And the caches....
extern locale::facet* cache_vec[_GLIBCXX_NUM_FACETS];
! extern __numpunct_cache<char> numpunct_cache_c;
! extern __moneypunct_cache<char> moneypunct_cache_cf;
! extern __moneypunct_cache<char> moneypunct_cache_ct;
! extern __timepunct_cache<char> timepunct_cache_c;
#ifdef _GLIBCXX_USE_WCHAR_T
! extern __numpunct_cache<wchar_t> numpunct_cache_w;
! extern __moneypunct_cache<wchar_t> moneypunct_cache_wf;
! extern __moneypunct_cache<wchar_t> moneypunct_cache_wt;
! extern __timepunct_cache<wchar_t> timepunct_cache_w;
#endif
} // namespace __gnu_cxx
*************** namespace std
*** 296,302 ****
_M_init_facet(new (&ctype_c) std::ctype<char>(0, false, 1));
_M_init_facet(new (&codecvt_c) codecvt<char, char, mbstate_t>(1));
- // Safe to cache this.
typedef __numpunct_cache<char> num_cache_c;
num_cache_c* __npc = new (&numpunct_cache_c) num_cache_c(2);
_M_init_facet(new (&numpunct_c) numpunct<char>(__npc, 1));
--- 303,308 ----
*************** namespace std
*** 304,314 ****
_M_init_facet(new (&num_get_c) num_get<char>(1));
_M_init_facet(new (&num_put_c) num_put<char>(1));
_M_init_facet(new (&collate_c) std::collate<char>(1));
! _M_init_facet(new (&moneypunct_fc) moneypunct<char, false>(1));
! _M_init_facet(new (&moneypunct_tc) moneypunct<char, true>(1));
_M_init_facet(new (&money_get_c) money_get<char>(1));
_M_init_facet(new (&money_put_c) money_put<char>(1));
! _M_init_facet(new (&timepunct_c) __timepunct<char>(1));
_M_init_facet(new (&time_get_c) time_get<char>(1));
_M_init_facet(new (&time_put_c) time_put<char>(1));
_M_init_facet(new (&messages_c) std::messages<char>(1));
--- 310,329 ----
_M_init_facet(new (&num_get_c) num_get<char>(1));
_M_init_facet(new (&num_put_c) num_put<char>(1));
_M_init_facet(new (&collate_c) std::collate<char>(1));
!
! typedef __moneypunct_cache<char> money_cache_c;
! money_cache_c* __mpcf = new (&moneypunct_cache_cf) money_cache_c(2);
! _M_init_facet(new (&moneypunct_cf) moneypunct<char, false>(__mpcf, 1));
! money_cache_c* __mpct = new (&moneypunct_cache_ct) money_cache_c(2);
! _M_init_facet(new (&moneypunct_ct) moneypunct<char, true>(__mpct, 1));
!
_M_init_facet(new (&money_get_c) money_get<char>(1));
_M_init_facet(new (&money_put_c) money_put<char>(1));
!
! typedef __timepunct_cache<char> time_cache_c;
! time_cache_c* __tpc = new (&timepunct_cache_c) time_cache_c(2);
! _M_init_facet(new (&timepunct_c) __timepunct<char>(__tpc, 1));
!
_M_init_facet(new (&time_get_c) time_get<char>(1));
_M_init_facet(new (&time_put_c) time_put<char>(1));
_M_init_facet(new (&messages_c) std::messages<char>(1));
*************** namespace std
*** 324,344 ****
_M_init_facet(new (&num_get_w) num_get<wchar_t>(1));
_M_init_facet(new (&num_put_w) num_put<wchar_t>(1));
_M_init_facet(new (&collate_w) std::collate<wchar_t>(1));
! _M_init_facet(new (&moneypunct_fw) moneypunct<wchar_t, false>(1));
! _M_init_facet(new (&moneypunct_tw) moneypunct<wchar_t, true>(1));
_M_init_facet(new (&money_get_w) money_get<wchar_t>(1));
_M_init_facet(new (&money_put_w) money_put<wchar_t>(1));
! _M_init_facet(new (&timepunct_w) __timepunct<wchar_t>(1));
_M_init_facet(new (&time_get_w) time_get<wchar_t>(1));
_M_init_facet(new (&time_put_w) time_put<wchar_t>(1));
_M_init_facet(new (&messages_w) std::messages<wchar_t>(1));
#endif
// This locale is safe to pre-cache, after all the facets have
! // been installed.
_M_caches[numpunct<char>::id._M_id()] = __npc;
#ifdef _GLIBCXX_USE_WCHAR_T
_M_caches[numpunct<wchar_t>::id._M_id()] = __npw;
#endif
}
--- 339,374 ----
_M_init_facet(new (&num_get_w) num_get<wchar_t>(1));
_M_init_facet(new (&num_put_w) num_put<wchar_t>(1));
_M_init_facet(new (&collate_w) std::collate<wchar_t>(1));
!
! typedef __moneypunct_cache<wchar_t> money_cache_w;
! money_cache_w* __mpwf = new (&moneypunct_cache_wf) money_cache_w(2);
! _M_init_facet(new (&moneypunct_wf) moneypunct<wchar_t, false>(__mpwf, 1));
! money_cache_w* __mpwt = new (&moneypunct_cache_wt) money_cache_w(2);
! _M_init_facet(new (&moneypunct_wt) moneypunct<wchar_t, true>(__mpwt, 1));
!
_M_init_facet(new (&money_get_w) money_get<wchar_t>(1));
_M_init_facet(new (&money_put_w) money_put<wchar_t>(1));
!
! typedef __timepunct_cache<wchar_t> time_cache_w;
! time_cache_w* __tpw = new (&timepunct_cache_w) time_cache_w(2);
! _M_init_facet(new (&timepunct_w) __timepunct<wchar_t>(__tpw, 1));
!
_M_init_facet(new (&time_get_w) time_get<wchar_t>(1));
_M_init_facet(new (&time_put_w) time_put<wchar_t>(1));
_M_init_facet(new (&messages_w) std::messages<wchar_t>(1));
#endif
// This locale is safe to pre-cache, after all the facets have
! // been created and installed.
_M_caches[numpunct<char>::id._M_id()] = __npc;
+ _M_caches[moneypunct<char, false>::id._M_id()] = __mpcf;
+ _M_caches[moneypunct<char, true>::id._M_id()] = __mpct;
+ _M_caches[__timepunct<char>::id._M_id()] = __tpc;
#ifdef _GLIBCXX_USE_WCHAR_T
_M_caches[numpunct<wchar_t>::id._M_id()] = __npw;
+ _M_caches[moneypunct<wchar_t, false>::id._M_id()] = __mpwf;
+ _M_caches[moneypunct<wchar_t, true>::id._M_id()] = __mpwt;
+ _M_caches[__timepunct<wchar_t>::id._M_id()] = __tpw;
#endif
}