* config/locale/generic/c++locale_internal.h: New header.
* config/locale/gnu/c++locale_internal.h: New header.
* config/locale/gnu/c_locale.cc: Include it.
* config/locale/gnu/collate_members.cc: Include it.
* config/locale/gnu/ctype_members.cc: Include it.
* config/locale/gnu/messages_members.cc: Include it.
* config/locale/gnu/monetary_members.cc: Include it.
* config/locale/gnu/numeric_members.cc: Include it.
* config/locale/gnu/time_members.cc: Include it.
(_M_put): Reorder __strftime_l and __wcsftime_l arguments to match
glibc.
(_M_initialize_timepunct): Initialize _M_c_locale_timepunct for
C locale.
* acinclude.m4: Include string.h when testing strcoll_l.
For glibc 2.3 provide __-prefixed prototypes.
(CLOCALE_INTERNAL_H): Set, add AC_LINK_FILES line.
* aclocal.m4, configure: Rebuilt.
* include/bits/locale_facets.h: Add declaration of specialization
here.
* config/locale/gnu/messages_members.cc: Add specialization for
messages<wchar_t>.
* config/locale/gnu/messages_members.h: Remove generic definition
of do_get.
From-SVN: r56837
+2002-09-05 Jakub Jelinek <jakub@redhat.com>
+
+ * config/locale/generic/c++locale_internal.h: New header.
+ * config/locale/gnu/c++locale_internal.h: New header.
+ * config/locale/gnu/c_locale.cc: Include it.
+ * config/locale/gnu/collate_members.cc: Include it.
+ * config/locale/gnu/ctype_members.cc: Include it.
+ * config/locale/gnu/messages_members.cc: Include it.
+ * config/locale/gnu/monetary_members.cc: Include it.
+ * config/locale/gnu/numeric_members.cc: Include it.
+ * config/locale/gnu/time_members.cc: Include it.
+ (_M_put): Reorder __strftime_l and __wcsftime_l arguments to match
+ glibc.
+ (_M_initialize_timepunct): Initialize _M_c_locale_timepunct for
+ C locale.
+ * acinclude.m4: Include string.h when testing strcoll_l.
+ For glibc 2.3 provide __-prefixed prototypes.
+ (CLOCALE_INTERNAL_H): Set, add AC_LINK_FILES line.
+ * aclocal.m4, configure: Rebuilt.
+
+2002-09-05 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/bits/locale_facets.h: Add declaration of specialization
+ here.
+ * config/locale/gnu/messages_members.cc: Add specialization for
+ messages<wchar_t>.
+ * config/locale/gnu/messages_members.h: Remove generic definition
+ of do_get.
+
2002-09-04 Richard Henderson <rth@redhat.com>
* include/std/std_limits.h (__glibcpp_f32_infinity_bytes,
AC_TRY_RUN([
#define _GNU_SOURCE 1
#include <locale.h>
+ #include <string.h>
+ #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+ extern __typeof(newlocale) __newlocale;
+ extern __typeof(duplocale) __duplocale;
+ extern __typeof(strcoll_l) __strcoll_l;
+ #endif
int main()
{
const char __one[] = "Äuglein Augmen";
CMONEY_CC=config/locale/generic/monetary_members.cc
CNUMERIC_CC=config/locale/generic/numeric_members.cc
CTIME_CC=config/locale/generic/time_members.cc
+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
;;
xgnu)
AC_MSG_RESULT(gnu)
CMONEY_CC=config/locale/gnu/monetary_members.cc
CNUMERIC_CC=config/locale/gnu/numeric_members.cc
CTIME_CC=config/locale/gnu/time_members.cc
+ CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
;;
xieee_1003.1-2001)
AC_MSG_RESULT(generic)
CMONEY_CC=config/locale/generic/monetary_members.cc
CNUMERIC_CC=config/locale/generic/numeric_members.cc
CTIME_CC=config/locale/generic/time_members.cc
+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
;;
*)
echo "$enable_clocale is an unknown locale package" 1>&2
AC_LINK_FILES($CMONEY_CC, src/monetary.cc)
AC_LINK_FILES($CNUMERIC_CC, src/numeric.cc)
AC_LINK_FILES($CTIME_CC, src/time.cc)
+ AC_LINK_FILES($CLOCALE_INTERNAL_H, src/c++locale_internal.h)
])
AC_TRY_RUN([
#define _GNU_SOURCE 1
#include <locale.h>
+ #include <string.h>
+ #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+ extern __typeof(newlocale) __newlocale;
+ extern __typeof(duplocale) __duplocale;
+ extern __typeof(strcoll_l) __strcoll_l;
+ #endif
int main()
{
const char __one[] = "Äuglein Augmen";
CMONEY_CC=config/locale/generic/monetary_members.cc
CNUMERIC_CC=config/locale/generic/numeric_members.cc
CTIME_CC=config/locale/generic/time_members.cc
+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
;;
xgnu)
AC_MSG_RESULT(gnu)
CMONEY_CC=config/locale/gnu/monetary_members.cc
CNUMERIC_CC=config/locale/gnu/numeric_members.cc
CTIME_CC=config/locale/gnu/time_members.cc
+ CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
;;
xieee_1003.1-2001)
AC_MSG_RESULT(generic)
CMONEY_CC=config/locale/generic/monetary_members.cc
CNUMERIC_CC=config/locale/generic/numeric_members.cc
CTIME_CC=config/locale/generic/time_members.cc
+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
;;
*)
echo "$enable_clocale is an unknown locale package" 1>&2
AC_LINK_FILES($CMONEY_CC, src/monetary.cc)
AC_LINK_FILES($CNUMERIC_CC, src/numeric.cc)
AC_LINK_FILES($CTIME_CC, src/time.cc)
+ AC_LINK_FILES($CLOCALE_INTERNAL_H, src/c++locale_internal.h)
])
--- /dev/null
+// Locale internal implementation header -*- C++ -*-
+
+// Copyright (C) 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// The generic locale code doesn't need to do anything here (yet)
--- /dev/null
+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
+
+// Copyright (C) 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Jakub Jelinek <jakub@redhat.com>
+
+#include <clocale>
+
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+
+extern "C" __typeof(iswctype_l) __iswctype_l;
+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
+extern "C" __typeof(strcoll_l) __strcoll_l;
+extern "C" __typeof(strftime_l) __strftime_l;
+extern "C" __typeof(strtod_l) __strtod_l;
+extern "C" __typeof(strtof_l) __strtof_l;
+extern "C" __typeof(strtold_l) __strtold_l;
+extern "C" __typeof(strtol_l) __strtol_l;
+extern "C" __typeof(strtoll_l) __strtoll_l;
+extern "C" __typeof(strtoul_l) __strtoul_l;
+extern "C" __typeof(strtoull_l) __strtoull_l;
+extern "C" __typeof(strxfrm_l) __strxfrm_l;
+extern "C" __typeof(towlower_l) __towlower_l;
+extern "C" __typeof(towupper_l) __towupper_l;
+extern "C" __typeof(wcscoll_l) __wcscoll_l;
+extern "C" __typeof(wcsftime_l) __wcsftime_l;
+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
+extern "C" __typeof(wctype_l) __wctype_l;
+extern "C" __typeof(newlocale) __newlocale;
+extern "C" __typeof(freelocale) __freelocale;
+extern "C" __typeof(duplocale) __duplocale;
+extern "C" __typeof(uselocale) __uselocale;
+
+#endif // GLIBC 2.3 and later
#include <locale>
#include <stdexcept>
#include <langinfo.h>
+#include "c++locale_internal.h"
namespace std
{
// std::collate implementation details, GNU version -*- C++ -*-
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// 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
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <locale>
+#include "c++locale_internal.h"
namespace std
{
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <locale>
+#include "c++locale_internal.h"
namespace std
{
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <locale>
+#include "c++locale_internal.h"
namespace std
{
return string(__msg);
#endif
}
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ wstring
+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
+ {
+# if __GLIBC__ > 2 || (__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
+ char* __old = strdup(setlocale(LC_ALL, NULL));
+ setlocale(LC_ALL, _M_name_messages);
+ char* __msg = gettext(_M_convert_to_char(__dfault));
+ setlocale(LC_ALL, __old);
+ free(__old);
+ return _M_convert_from_char(__msg);
+# endif
+ }
+#endif
}
return 0;
}
- template<typename _CharT>
- typename messages<_CharT>::string_type
- messages<_CharT>::do_get(catalog, int, int,
- const string_type& __dfault) const
- {
-#if __GLIBC__ > 2 || (__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
- char* __old = strdup(setlocale(LC_ALL, NULL));
- setlocale(LC_ALL, _M_name_messages);
- char* __msg = gettext(_M_convert_to_char(__dfault));
- setlocale(LC_ALL, __old);
- free(__old);
- return _M_convert_from_char(__msg);
-#endif
- }
-
template<typename _CharT>
void
messages<_CharT>::do_close(catalog) const
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <locale>
+#include "c++locale_internal.h"
namespace std
{
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <locale>
+#include "c++locale_internal.h"
namespace std
{
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <locale>
+#include "c++locale_internal.h"
namespace std
{
const tm* __tm) const
{
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
- __strftime_l(__s, __maxlen, _M_c_locale_timepunct, __format, __tm);
+ __strftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
#else
char* __old = strdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, _M_name_timepunct);
if (__cloc == _S_c_locale)
{
// "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";
const tm* __tm) const
{
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
- __wcsftime_l(__s, __maxlen, _M_c_locale_timepunct, __format, __tm);
+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
#else
char* __old = strdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, _M_name_timepunct);
if (__cloc == _S_c_locale)
{
// "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";
#define _GNU_SOURCE 1
#include <locale.h>
+ #include <string.h>
+ #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+ extern __typeof(newlocale) __newlocale;
+ extern __typeof(duplocale) __duplocale;
+ extern __typeof(strcoll_l) __strcoll_l;
+ #endif
int main()
{
const char __one[] = "Äuglein Augmen";
CMONEY_CC=config/locale/generic/monetary_members.cc
CNUMERIC_CC=config/locale/generic/numeric_members.cc
CTIME_CC=config/locale/generic/time_members.cc
+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
;;
xgnu)
echo "$ac_t""gnu" 1>&6
CMONEY_CC=config/locale/gnu/monetary_members.cc
CNUMERIC_CC=config/locale/gnu/numeric_members.cc
CTIME_CC=config/locale/gnu/time_members.cc
+ CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
;;
xieee_1003.1-2001)
echo "$ac_t""generic" 1>&6
CMONEY_CC=config/locale/generic/monetary_members.cc
CNUMERIC_CC=config/locale/generic/numeric_members.cc
CTIME_CC=config/locale/generic/time_members.cc
+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
;;
*)
echo "$enable_clocale is an unknown locale package" 1>&2
EOF
cat >> $CONFIG_STATUS <<EOF
-ac_sources="$BASIC_FILE_CC $CLOCALE_CC $CCOLLATE_CC $CCTYPE_CC $CMESSAGES_CC $CMONEY_CC $CNUMERIC_CC $CTIME_CC $LINKER_MAP"
-ac_dests="src/basic_file.cc src/c++locale.cc src/collate.cc src/ctype.cc src/messages.cc src/monetary.cc src/numeric.cc src/time.cc src/linker.map"
+ac_sources="$BASIC_FILE_CC $CLOCALE_CC $CCOLLATE_CC $CCTYPE_CC $CMESSAGES_CC $CMONEY_CC $CNUMERIC_CC $CTIME_CC $CLOCALE_INTERNAL_H $LINKER_MAP"
+ac_dests="src/basic_file.cc src/c++locale.cc src/collate.cc src/ctype.cc src/messages.cc src/monetary.cc src/numeric.cc src/time.cc src/c++locale_internal.h src/linker.map"
EOF
cat >> $CONFIG_STATUS <<\EOF
string
messages<char>::do_get(catalog, int, int, const string&) const;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ wstring
+ messages<wchar_t>::do_get(catalog, int, int, const wstring&) const;
+#endif
+
// Include host and configuration specific messages virtual functions.
#include <bits/messages_members.h>