re PR libstdc++/6410 (Trouble with non-Ascii monetary symbols and wchar_t)
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. From-SVN: r55203
This commit is contained in:
parent
c3b7d16939
commit
fdf7e80975
6 changed files with 57 additions and 20 deletions
|
@ -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
|
||||
|
|
|
@ -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'.';
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Add table
Reference in a new issue