summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstdc++-v3/ChangeLog11
-rw-r--r--libstdc++-v3/config/locale/generic/monetary_members.cc10
-rw-r--r--libstdc++-v3/config/locale/gnu/monetary_members.cc28
-rw-r--r--libstdc++-v3/include/backward/strstream.h2
-rw-r--r--libstdc++-v3/include/bits/locale_facets.h18
-rw-r--r--libstdc++-v3/src/localename.cc8
6 files changed, 57 insertions, 20 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 873c59b30a6..4bfd86ae277 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,14 @@
+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
diff --git a/libstdc++-v3/config/locale/generic/monetary_members.cc b/libstdc++-v3/config/locale/generic/monetary_members.cc
index 7c2e13b62df..1921f46e98c 100644
--- a/libstdc++-v3/config/locale/generic/monetary_members.cc
+++ b/libstdc++-v3/config/locale/generic/monetary_members.cc
@@ -45,7 +45,7 @@ namespace std
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 = '.';
@@ -61,7 +61,7 @@ namespace std
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 = '.';
@@ -86,7 +86,8 @@ namespace std
#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'.';
@@ -102,7 +103,8 @@ namespace std
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'.';
diff --git a/libstdc++-v3/config/locale/gnu/monetary_members.cc b/libstdc++-v3/config/locale/gnu/monetary_members.cc
index bf9b50cbb95..6a797ffbc25 100644
--- a/libstdc++-v3/config/locale/gnu/monetary_members.cc
+++ b/libstdc++-v3/config/locale/gnu/monetary_members.cc
@@ -216,7 +216,8 @@ namespace std
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)
{
@@ -260,7 +261,8 @@ namespace std
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)
{
@@ -313,7 +315,8 @@ namespace std
#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)
{
@@ -331,6 +334,10 @@ namespace std
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);
@@ -391,12 +398,17 @@ namespace std
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)
{
@@ -414,6 +426,10 @@ namespace std
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);
@@ -473,6 +489,10 @@ namespace std
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);
}
}
diff --git a/libstdc++-v3/include/backward/strstream.h b/libstdc++-v3/include/backward/strstream.h
index c96ca768ab0..c20812e3d54 100644
--- a/libstdc++-v3/include/backward/strstream.h
+++ b/libstdc++-v3/include/backward/strstream.h
@@ -1,6 +1,6 @@
// 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
diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h
index d63eb5dd2d5..241c4655dc2 100644
--- a/libstdc++-v3/include/bits/locale_facets.h
+++ b/libstdc++-v3/include/bits/locale_facets.h
@@ -1357,8 +1357,9 @@ namespace std
{ _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
@@ -1438,7 +1439,8 @@ namespace std
// 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>
@@ -1455,11 +1457,11 @@ namespace std
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<>
@@ -1470,11 +1472,13 @@ namespace std
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>
diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc
index 824d9790cef..8fa91189170 100644
--- a/libstdc++-v3/src/localename.cc
+++ b/libstdc++-v3/src/localename.cc
@@ -132,8 +132,8 @@ namespace std
_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));
@@ -148,8 +148,8 @@ namespace std
_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));