+2002-07-02 Benjamin Kosnik <bkoz@redhat.com>
+
+ PR libstdc++/6410
+ * include/bits/locale_facets.h (moneypunct::moneypunct): Add const
+ char* name parameter.
+ * config/locale/gnu/monetary_members.cc: Use it.
+ * config/locale/generic/monetary_members.cc: Same.
+ * src/localename.cc (_Impl::_Impl(const char*, size_t)): Use it.
+
+ * include/backward/strstream.h: Update date.
+
2002-07-02 Paolo Carlini <pcarlini@unitus.it>
PR libstdc++/6642
template<>
void
- moneypunct<char, true>::_M_initialize_moneypunct(__c_locale)
+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*)
{
// "C" locale
_M_decimal_point = '.';
template<>
void
- moneypunct<char, false>::_M_initialize_moneypunct(__c_locale)
+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*)
{
// "C" locale
_M_decimal_point = '.';
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
void
- moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale)
+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale,
+ const char*)
{
// "C" locale
_M_decimal_point = L'.';
template<>
void
- moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale)
+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale,
+ const char*)
{
// "C" locale
_M_decimal_point = L'.';
template<>
void
- moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc)
+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
+ const char*)
{
if (__cloc == _S_c_locale)
{
template<>
void
- moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc)
+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
+ const char*)
{
if (__cloc == _S_c_locale)
{
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
void
- moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc)
+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
+ const char* __name)
{
if (__cloc == _S_c_locale)
{
else
{
// Named locale.
+ // XXX Fix me. Switch to named locale so that mbsrtowcs will work.
+ char* __old = strdup(setlocale(LC_ALL, NULL));
+ setlocale(LC_ALL, __name);
+
_M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
_M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
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);
+
+ // XXX
+ setlocale(LC_ALL, __old);
+ free(__old);
}
}
template<>
void
- moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc)
+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
+ const char* __name)
{
if (__cloc == _S_c_locale)
{
else
{
// Named locale.
+ // XXX Fix me. Switch to named locale so that mbsrtowcs will work.
+ char* __old = strdup(setlocale(LC_ALL, NULL));
+ setlocale(LC_ALL, __name);
+
_M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
_M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
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);
+
+ // XXX
+ setlocale(LC_ALL, __old);
+ free(__old);
}
}
// Backward-compat support -*- C++ -*-
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2000, 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
{ _M_initialize_moneypunct(); }
explicit
- moneypunct(__c_locale __cloc, size_t __refs = 0) : locale::facet(__refs)
- { _M_initialize_moneypunct(__cloc); }
+ moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0)
+ : locale::facet(__refs)
+ { _M_initialize_moneypunct(__cloc, __s); }
char_type
decimal_point() const
// For use at construction time only.
void
- _M_initialize_moneypunct(__c_locale __cloc = _S_c_locale);
+ _M_initialize_moneypunct(__c_locale __cloc = _S_c_locale,
+ const char* __name = NULL);
};
template<typename _CharT, bool _Intl>
template<>
void
- moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc);
+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*);
template<>
void
- moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc);
+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*);
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
template<>
void
- moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc);
+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale,
+ const char*);
template<>
void
- moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc);
+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale,
+ const char*);
#endif
template<typename _CharT, bool _Intl>
_M_init_facet(new num_get<char>);
_M_init_facet(new num_put<char>);
_M_init_facet(new std::collate<char>(__cloc));
- _M_init_facet(new moneypunct<char, false>(__cloc));
- _M_init_facet(new moneypunct<char, true>(__cloc));
+ _M_init_facet(new moneypunct<char, false>(__cloc, __s));
+ _M_init_facet(new moneypunct<char, true>(__cloc, __s));
_M_init_facet(new money_get<char>);
_M_init_facet(new money_put<char>);
_M_init_facet(new __timepunct<char>(__cloc, __s));
_M_init_facet(new num_get<wchar_t>);
_M_init_facet(new num_put<wchar_t>);
_M_init_facet(new std::collate<wchar_t>(__cloc));
- _M_init_facet(new moneypunct<wchar_t, false>(__cloc));
- _M_init_facet(new moneypunct<wchar_t, true>(__cloc));
+ _M_init_facet(new moneypunct<wchar_t, false>(__cloc, __s));
+ _M_init_facet(new moneypunct<wchar_t, true>(__cloc, __s));
_M_init_facet(new money_get<wchar_t>);
_M_init_facet(new money_put<wchar_t>);
_M_init_facet(new __timepunct<wchar_t>(__cloc, __s));