This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] add uselocale hooks
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 22 Mar 2002 17:53:20 -0800
- Subject: [v3] add uselocale hooks
tested x86/linux
2002-03-22 Benjamin Kosnik <bkoz@redhat.com>
* config/locale/gnu/messages_members.h: Add __uselocale bits.
* config/locale/gnu/messages_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
Index: config/locale/gnu/messages_members.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/messages_members.cc,v
retrieving revision 1.1
diff -c -p -r1.1 messages_members.cc
*** messages_members.cc 2002/03/09 02:16:33 1.1
--- messages_members.cc 2002/03/23 01:50:07
*************** namespace std
*** 42,52 ****
string
messages<char>::do_get(catalog, int, int, const string& __dfault) const
{
! #if 0
! // Requires glibc 2.3
! __c_locale __old = uselocale(_M_c_locale_messages);
const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
! uselocale(__old);
return string(__msg);
#else
const char* __old = setlocale(LC_ALL, _M_name_messages);
--- 42,51 ----
string
messages<char>::do_get(catalog, int, int, const string& __dfault) const
{
! #if __GLIBC__ >= 2 && __GLIBC_MINOR__ > 2
! __c_locale __old = __uselocale(_M_c_locale_messages);
const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
! __uselocale(__old);
return string(__msg);
#else
const char* __old = setlocale(LC_ALL, _M_name_messages);
Index: config/locale/gnu/messages_members.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/messages_members.h,v
retrieving revision 1.1
diff -c -p -r1.1 messages_members.h
*** messages_members.h 2002/03/09 02:16:33 1.1
--- messages_members.h 2002/03/23 01:50:07
***************
*** 59,69 ****
messages<_CharT>::do_get(catalog, int, int,
const string_type& __dfault) const
{
! #if 0
! // Requires glibc 2.3
! __c_locale __old = uselocale(_M_c_locale_messages);
char* __msg = gettext(_M_convert_to_char(__dfault));
! uselocale(__old);
return _M_convert_from_char(__msg);
#else
const char* __old = setlocale(LC_ALL, _M_name_messages);
--- 59,68 ----
messages<_CharT>::do_get(catalog, int, int,
const string_type& __dfault) const
{
! #if __GLIBC__ >= 2 && __GLIBC_MINOR__ > 2
! __c_locale __old = __uselocale(_M_c_locale_messages);
char* __msg = gettext(_M_convert_to_char(__dfault));
! __uselocale(__old);
return _M_convert_from_char(__msg);
#else
const char* __old = setlocale(LC_ALL, _M_name_messages);
Index: config/locale/gnu/time_members.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/time_members.cc,v
retrieving revision 1.1
diff -c -p -r1.1 time_members.cc
*** time_members.cc 2002/03/09 02:16:33 1.1
--- time_members.cc 2002/03/23 01:50:09
*************** namespace std
*** 44,51 ****
_M_put_helper(char* __s, size_t __maxlen, const char* __format,
const tm* __tm) const
{
! #if 0
! // Requires glibc 2.3
if (_M_c_locale_timepunct)
__strftime_l(__s, __maxlen, _M_c_locale_timepunct, __format, __tm);
else
--- 44,50 ----
_M_put_helper(char* __s, size_t __maxlen, const char* __format,
const tm* __tm) const
{
! #if __GLIBC__ >= 2 && __GLIBC_MINOR__ > 2
if (_M_c_locale_timepunct)
__strftime_l(__s, __maxlen, _M_c_locale_timepunct, __format, __tm);
else
*************** namespace std
*** 189,196 ****
_M_put_helper(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
const tm* __tm) const
{
! #if 0
! // Requires glibc 2.3
if (_M_c_locale_timepunct)
__wcsftime_l(__s, __maxlen, _M_c_locale_timepunct, __format, __tm);
else
--- 188,194 ----
_M_put_helper(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
const tm* __tm) const
{
! #if __GLIBC__ >= 2 && __GLIBC_MINOR__ > 2
if (_M_c_locale_timepunct)
__wcsftime_l(__s, __maxlen, _M_c_locale_timepunct, __format, __tm);
else