summaryrefslogtreecommitdiff
path: root/libstdc++-v3/config
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-08 02:49:01 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-08 02:49:01 +0000
commitc099f5df0aee1ee411c47a26f3bbd1fad340fbec (patch)
tree206d2f141f8a0aeeee16600fe3735d0bec5f1ffc /libstdc++-v3/config
parent5475a1654d48bc8a96067a11299abb874ee38495 (diff)
downloadgcc-c099f5df0aee1ee411c47a26f3bbd1fad340fbec.tar.gz
2001-08-07 Benjamin Kosnik <bkoz@redhat.com>
Implement std::messages. Make config a fully-nested directory. * config/locale: New directory. * config/c_locale_generic.cc: Move into locale subdirectory. * config/c_locale_generic.h: Same. * config/c_locale_gnu.cc: Same. * config/c_locale_gnu.h: Same. * config/c_locale_ieee_1003.1-200x.cc: Same. * config/c_locale_ieee_1003.1-200x_.h: Same. * config/codecvt_specializations_generic.h: Same. * config/codecvt_specializations_ieee_1003.1-200x.h: Same. * config/messages_members_gnu.h: Same. * config/messaages_members_gnu.cc: Same. * config/messages_members_generic.h: Same. * config/messaages_members_generic.cc: Same. * config/messages_members_ieee_1003.1-200x.h: Same. * config/messaages_members_ieee_1003.1-200x.cc: Same. * config/io: New directory. * config/basic_file_libio.h: Move into io subdirectory. * config/basic_file_libio.cc: Same. * config/c_io_libio.h: Same. * config/c_io_libio_codecvt.c: Same. * config/basic_file_stdio.h: Same. * config/basic_file_stdio.cc: Same. * config/c_io_stdio.h: Same. * po: New directory. * po/POTFILES.in: New file. * po/Makefile.am: New file. * po/Makefile.in: New file. * po/libstdc++.pot: Generic translation file. * po/fr.po: Preliminary French translation. * po/de.po: Preliminary German translation. * intl: New directory. * intl/Makefile.am: New file. * intl/Makefile.in: New file. * intl/string_literals.cc: New file. * acinclude.m4 (GLIBCPP_CONFIGURE): Bump VERSION to 3.1.0. Add requisite setup for gettext. Re-arrange. * aclocal.m4: Regenerate. * configure.in: Don't call GLIBCPP_CHECK_COMPILER_VERSION. Output Makefile bits for po and intl. * configure: Regenerate. * Makefile.am (SUBDIRS): Add intl, po. Add rule for dist. * Makefile.in: Regenerate. * acconfig.h: Add ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY. * config.h.in: Regenerate. * acinclude.m4 (AC_REPLACE_STRINGFUNCS): Remove. * include/Makefile.am (install-data-local): Don't install Makefile. * include/Makefile.in: Regenerate. * include/bits/locale_facet.h (locale::facet::_S_clone_c_locale): Add member. * config/locale/c_locale_gnu.cc (_S_clone_c_locale): Add definition. * config/locale/c_locale_generic.cc: Same. * config/locale/c_locale_ieee_1003.1-200x.cc: Same. * include/bits/codecvt.h: Excise non-standard, non-required bits. This includes __enc_traits, and partial specializations of codecvt for __enc_traits. * src/codecvt.cc (__enc_traits::_S_max_size): Guard * config/codecvt_partials_ieee_1003.1-200x.h: New file. * config/codecvt_partials_generic.h: New file. * include/Makefile.am (allstamps): Add stamp-codecvt_model. (stamp-codecvt_model): Add. * include/Makefile.in: Regenerate. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): Add in codecvt configury. * aclocal.m4: Regenerate. * configure: Regenerate. * testsuite/22_locale/codecvt_unicode_wchar_t.cc: Use macro guard. * testsuite/22_locale/codecvt_unicode_char.cc: Same. * testsuite/22_locale/ctor_copy_dtor.cc: And here. * include/bits/localefwd.h (class locale::facet): Add __enc_traits as a friend for _S_*_c_locale functions. * include/bits/codecvt.h (__enc_traits::__enc_traits): Add locale argument to default constructor so that CODESET information can be deduced. * include/bits/locale_facets.h (messages_byname): Re-implement. Remove specializations. * src/locale.cc (messages_byname<char>): Remove specialization. (messages_byname<wchar_t>): Same. * config/locale/c_locale_ieee_1003.1-200x.cc: New file. * config/locale/c_locale_ieee_1003.1-200x.h: New file. * config/locale/messages_members_ieee_1003.1-200x.cc: New file. * config/locale/messages_members_ieee_1003.1-200x.h: New file. * config/locale/messages_members_gnu.cc: New file. * config/locale/messages_members_gnu.h: New file. * config/locale/messages_members_generic.cc: New file. * config/locale/messages_members_generic.h: New file. * docs/html/configopts.html: Add documentation for new locale model, ieee_1003.1. Adjust other flags for current defaults. * docs/html/22_locale/locale.html: Update. * docs/html/22_locale/howto.html: Add link to messages.html. Organize. * docs/html/22_locale/messages.html: New. * src/Makefile.am (sources): Add messages_virtuals.cc. * src/Makefile.in: Regenerate. * include/Makefile.am (allstamps): Add stamp-messages_model. (stamp-messages_model): Add. * include/Makefile.in: Regenerate. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): Add in messages configury. * aclocal.m4: Regenerate. * configure: Regenerate. * testsuite_flags.in (--cxxflags): Add LOCALEDIR. * testsuite/lib/libstdc++-v3-dg.exp: Remove broken LD_LIBRARY_PATH bits for Irix. * acinclude (GLIBCPP_ENABLE_CLOCALE): Set glibcpp_localedir to the build directories message catalog base directory, and export. Eventually this should probably be made to deal with build and install directories. For now, punt on this as the library itself doesn't use message catalogs (yet). * testsuite/22_locale/messages.cc: New file. * testsuite/22_locale/messages_char_members.cc: New file. * testsuite/22_locale/messages_byname.cc: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44702 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/config')
-rw-r--r--libstdc++-v3/config/io/basic_file_libio.cc (renamed from libstdc++-v3/config/basic_file_libio.cc)0
-rw-r--r--libstdc++-v3/config/io/basic_file_libio.h (renamed from libstdc++-v3/config/basic_file_libio.h)0
-rw-r--r--libstdc++-v3/config/io/basic_file_stdio.cc (renamed from libstdc++-v3/config/basic_file_stdio.cc)0
-rw-r--r--libstdc++-v3/config/io/basic_file_stdio.h (renamed from libstdc++-v3/config/basic_file_stdio.h)0
-rw-r--r--libstdc++-v3/config/io/c_io_libio.h (renamed from libstdc++-v3/config/c_io_libio.h)0
-rw-r--r--libstdc++-v3/config/io/c_io_libio_codecvt.c (renamed from libstdc++-v3/config/c_io_libio_codecvt.c)0
-rw-r--r--libstdc++-v3/config/io/c_io_stdio.h (renamed from libstdc++-v3/config/c_io_stdio.h)0
-rw-r--r--libstdc++-v3/config/locale/c_locale_generic.cc (renamed from libstdc++-v3/config/c_locale_generic.cc)17
-rw-r--r--libstdc++-v3/config/locale/c_locale_generic.h (renamed from libstdc++-v3/config/c_locale_generic.h)0
-rw-r--r--libstdc++-v3/config/locale/c_locale_gnu.cc (renamed from libstdc++-v3/config/c_locale_gnu.cc)4
-rw-r--r--libstdc++-v3/config/locale/c_locale_gnu.h (renamed from libstdc++-v3/config/c_locale_gnu.h)8
-rw-r--r--libstdc++-v3/config/locale/c_locale_ieee_1003.1-200x.cc112
-rw-r--r--libstdc++-v3/config/locale/c_locale_ieee_1003.1-200x.h49
-rw-r--r--libstdc++-v3/config/locale/codecvt_specializations_generic.h38
-rw-r--r--libstdc++-v3/config/locale/codecvt_specializations_ieee_1003.1-200x.h453
-rw-r--r--libstdc++-v3/config/locale/messages_members_generic.cc45
-rw-r--r--libstdc++-v3/config/locale/messages_members_generic.h62
-rw-r--r--libstdc++-v3/config/locale/messages_members_gnu.cc57
-rw-r--r--libstdc++-v3/config/locale/messages_members_gnu.h93
-rw-r--r--libstdc++-v3/config/locale/messages_members_ieee_1003.1-200x.cc49
-rw-r--r--libstdc++-v3/config/locale/messages_members_ieee_1003.1-200x.h70
21 files changed, 1051 insertions, 6 deletions
diff --git a/libstdc++-v3/config/basic_file_libio.cc b/libstdc++-v3/config/io/basic_file_libio.cc
index 60eb006a847..60eb006a847 100644
--- a/libstdc++-v3/config/basic_file_libio.cc
+++ b/libstdc++-v3/config/io/basic_file_libio.cc
diff --git a/libstdc++-v3/config/basic_file_libio.h b/libstdc++-v3/config/io/basic_file_libio.h
index 4c6591fd9f6..4c6591fd9f6 100644
--- a/libstdc++-v3/config/basic_file_libio.h
+++ b/libstdc++-v3/config/io/basic_file_libio.h
diff --git a/libstdc++-v3/config/basic_file_stdio.cc b/libstdc++-v3/config/io/basic_file_stdio.cc
index 0bfd1c4acf9..0bfd1c4acf9 100644
--- a/libstdc++-v3/config/basic_file_stdio.cc
+++ b/libstdc++-v3/config/io/basic_file_stdio.cc
diff --git a/libstdc++-v3/config/basic_file_stdio.h b/libstdc++-v3/config/io/basic_file_stdio.h
index edf4d98baa9..edf4d98baa9 100644
--- a/libstdc++-v3/config/basic_file_stdio.h
+++ b/libstdc++-v3/config/io/basic_file_stdio.h
diff --git a/libstdc++-v3/config/c_io_libio.h b/libstdc++-v3/config/io/c_io_libio.h
index 59267985f96..59267985f96 100644
--- a/libstdc++-v3/config/c_io_libio.h
+++ b/libstdc++-v3/config/io/c_io_libio.h
diff --git a/libstdc++-v3/config/c_io_libio_codecvt.c b/libstdc++-v3/config/io/c_io_libio_codecvt.c
index 38d8b55e0c2..38d8b55e0c2 100644
--- a/libstdc++-v3/config/c_io_libio_codecvt.c
+++ b/libstdc++-v3/config/io/c_io_libio_codecvt.c
diff --git a/libstdc++-v3/config/c_io_stdio.h b/libstdc++-v3/config/io/c_io_stdio.h
index 1ea8b3081fc..1ea8b3081fc 100644
--- a/libstdc++-v3/config/c_io_stdio.h
+++ b/libstdc++-v3/config/io/c_io_stdio.h
diff --git a/libstdc++-v3/config/c_locale_generic.cc b/libstdc++-v3/config/locale/c_locale_generic.cc
index 98069257f28..493ac014208 100644
--- a/libstdc++-v3/config/c_locale_generic.cc
+++ b/libstdc++-v3/config/locale/c_locale_generic.cc
@@ -38,16 +38,20 @@
namespace std
{
void
- locale::facet::_S_create_c_locale(__c_locale& /*__cloc*/, const char*)
+ locale::facet::_S_create_c_locale(__c_locale&, const char*)
{ }
void
- locale::facet::_S_destroy_c_locale(__c_locale& /*__cloc*/)
+ locale::facet::_S_destroy_c_locale(__c_locale&)
{ }
+ __c_locale
+ locale::facet::_S_clone_c_locale(__c_locale&)
+ { return __c_locale(); }
+
template<>
void
- numpunct<char>::_M_initialize_numpunct(__c_locale /*__cloc*/)
+ numpunct<char>::_M_initialize_numpunct(__c_locale)
{
// "C" locale
_M_decimal_point = '.';
@@ -60,7 +64,7 @@ namespace std
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
void
- numpunct<wchar_t>::_M_initialize_numpunct(__c_locale /*__cloc*/)
+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale)
{
// "C" locale
_M_decimal_point = L'.';
@@ -73,7 +77,7 @@ namespace std
template<>
void
- moneypunct<char>::_M_initialize_moneypunct(__c_locale /*__cloc*/)
+ moneypunct<char>::_M_initialize_moneypunct(__c_locale)
{
// "C" locale
_M_decimal_point = '.';
@@ -90,7 +94,7 @@ namespace std
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
void
- moneypunct<wchar_t>::_M_initialize_moneypunct(__c_locale /*__cloc*/)
+ moneypunct<wchar_t>::_M_initialize_moneypunct(__c_locale)
{
// "C" locale
_M_decimal_point = L'.';
@@ -105,3 +109,4 @@ namespace std
}
#endif
} // namespace std
+
diff --git a/libstdc++-v3/config/c_locale_generic.h b/libstdc++-v3/config/locale/c_locale_generic.h
index 4c205297f56..4c205297f56 100644
--- a/libstdc++-v3/config/c_locale_generic.h
+++ b/libstdc++-v3/config/locale/c_locale_generic.h
diff --git a/libstdc++-v3/config/c_locale_gnu.cc b/libstdc++-v3/config/locale/c_locale_gnu.cc
index 4013941cfb8..a003c330687 100644
--- a/libstdc++-v3/config/c_locale_gnu.cc
+++ b/libstdc++-v3/config/locale/c_locale_gnu.cc
@@ -61,6 +61,10 @@ namespace std
__freelocale(__cloc);
}
+ __c_locale
+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
+ { return __duplocale(__cloc); }
+
template<>
void
numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
diff --git a/libstdc++-v3/config/c_locale_gnu.h b/libstdc++-v3/config/locale/c_locale_gnu.h
index 72124ae837b..f3c68023882 100644
--- a/libstdc++-v3/config/c_locale_gnu.h
+++ b/libstdc++-v3/config/locale/c_locale_gnu.h
@@ -34,8 +34,16 @@
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <clocale>
+#include <langinfo.h> // For codecvt
+#include <iconv.h> // For codecvt using iconv, iconv_t
+#include <libintl.h> // For messages
namespace std
{
typedef __locale_t __c_locale;
}
+
+
+
+
+
diff --git a/libstdc++-v3/config/locale/c_locale_ieee_1003.1-200x.cc b/libstdc++-v3/config/locale/c_locale_ieee_1003.1-200x.cc
new file mode 100644
index 00000000000..493ac014208
--- /dev/null
+++ b/libstdc++-v3/config/locale/c_locale_ieee_1003.1-200x.cc
@@ -0,0 +1,112 @@
+// Wrapper for underlying C-language localization -*- C++ -*-
+
+// Copyright (C) 2001 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.
+
+//
+// ISO C++ 14882: 22.8 Standard locale categories.
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <locale>
+
+namespace std
+{
+ void
+ locale::facet::_S_create_c_locale(__c_locale&, const char*)
+ { }
+
+ void
+ locale::facet::_S_destroy_c_locale(__c_locale&)
+ { }
+
+ __c_locale
+ locale::facet::_S_clone_c_locale(__c_locale&)
+ { return __c_locale(); }
+
+ template<>
+ void
+ numpunct<char>::_M_initialize_numpunct(__c_locale)
+ {
+ // "C" locale
+ _M_decimal_point = '.';
+ _M_thousands_sep = ',';
+ _M_grouping = "";
+ _M_truename = "true";
+ _M_falsename = "false";
+ }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ void
+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale)
+ {
+ // "C" locale
+ _M_decimal_point = L'.';
+ _M_thousands_sep = L',';
+ _M_grouping = "";
+ _M_truename = L"true";
+ _M_falsename = L"false";
+ }
+#endif
+
+ template<>
+ void
+ moneypunct<char>::_M_initialize_moneypunct(__c_locale)
+ {
+ // "C" locale
+ _M_decimal_point = '.';
+ _M_thousands_sep = ',';
+ _M_grouping = "";
+ _M_curr_symbol = string_type();
+ _M_positive_sign = string_type();
+ _M_negative_sign = string_type();
+ _M_frac_digits = 0;
+ _M_pos_format = money_base::_S_default_pattern;
+ _M_neg_format = money_base::_S_default_pattern;
+ }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ void
+ moneypunct<wchar_t>::_M_initialize_moneypunct(__c_locale)
+ {
+ // "C" locale
+ _M_decimal_point = L'.';
+ _M_thousands_sep = L',';
+ _M_grouping = "";
+ _M_curr_symbol = string_type();
+ _M_positive_sign = string_type();
+ _M_negative_sign = string_type();
+ _M_frac_digits = 0;
+ _M_pos_format = money_base::_S_default_pattern;
+ _M_neg_format = money_base::_S_default_pattern;
+ }
+#endif
+} // namespace std
+
diff --git a/libstdc++-v3/config/locale/c_locale_ieee_1003.1-200x.h b/libstdc++-v3/config/locale/c_locale_ieee_1003.1-200x.h
new file mode 100644
index 00000000000..bbfb85eb9e6
--- /dev/null
+++ b/libstdc++-v3/config/locale/c_locale_ieee_1003.1-200x.h
@@ -0,0 +1,49 @@
+// Wrapper for underlying C-language localization -*- C++ -*-
+
+// Copyright (C) 2001 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.
+
+//
+// ISO C++ 14882: 22.8 Standard locale categories.
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <clocale>
+#include <langinfo.h> // For codecvt
+#include <iconv.h> // For codecvt using iconv, iconv_t
+#include <nl_types.h> // For messages
+
+namespace std
+{
+ typedef __locale_t __c_locale;
+}
+
+
+
+
+
diff --git a/libstdc++-v3/config/locale/codecvt_specializations_generic.h b/libstdc++-v3/config/locale/codecvt_specializations_generic.h
new file mode 100644
index 00000000000..24db4c84dc2
--- /dev/null
+++ b/libstdc++-v3/config/locale/codecvt_specializations_generic.h
@@ -0,0 +1,38 @@
+// Locale support (codecvt) -*- C++ -*-
+
+// Copyright (C) 2000, 2001 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.
+
+//
+// ISO C++ 14882: 22.2.1.5 Template class codecvt
+//
+
+// Warning: this file is not meant for user inclusion. Use <locale>.
+
+// Written by Benjamin Kosnik <bkoz@cygnus.com>
+
+// XXX dummy file
diff --git a/libstdc++-v3/config/locale/codecvt_specializations_ieee_1003.1-200x.h b/libstdc++-v3/config/locale/codecvt_specializations_ieee_1003.1-200x.h
new file mode 100644
index 00000000000..3fe261cb621
--- /dev/null
+++ b/libstdc++-v3/config/locale/codecvt_specializations_ieee_1003.1-200x.h
@@ -0,0 +1,453 @@
+// Locale support (codecvt) -*- C++ -*-
+
+// Copyright (C) 2000, 2001 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.
+
+//
+// ISO C++ 14882: 22.2.1.5 Template class codecvt
+//
+
+// Warning: this file is not meant for user inclusion. Use <locale>.
+
+// Written by Benjamin Kosnik <bkoz@cygnus.com>
+
+ // XXX
+ // __enc_traits may need to move up the locale header hierarchy,
+ // depending on if ctype ends up using it.
+
+ // Extensions to use icov for dealing with character encodings,
+ // including conversions and comparisons between various character
+ // sets. This object encapsulates data that may need to be shared between
+ // char_traits, codecvt and ctype.
+
+#if _GLIBCPP_USE_SHADOW_HEADERS
+ using _C_legacy::CODESET;
+#endif
+
+ // XXX
+ // Define this here to codecvt.cc can have _S_max_size definition.
+#define _GLIBCPP_USE___ENC_TRAITS 1
+
+ class __enc_traits
+ {
+ public:
+ // Types:
+ // NB: A conversion descriptor subsumes and enhances the
+ // functionality of a simple state type such as mbstate_t.
+ typedef iconv_t __desc_type;
+
+ protected:
+ // Data Members:
+ // Max size of charset encoding name
+ static const int _S_max_size = 32;
+ // Name of internal character set encoding.
+ char _M_int_enc[_S_max_size];
+ // Name of external character set encoding.
+ char _M_ext_enc[_S_max_size];
+
+ // Conversion descriptor between external encoding to internal encoding.
+ __desc_type _M_in_desc;
+ // Conversion descriptor between internal encoding to external encoding.
+ __desc_type _M_out_desc;
+
+ // Details the byte-order marker for the external encoding, if necessary.
+ int _M_ext_bom;
+
+ // Details the byte-order marker for the internal encoding, if necessary.
+ int _M_int_bom;
+
+ public:
+ __enc_traits(const locale& __loc = locale())
+ : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0)
+ {
+ // __intc_end = whatever we are using internally, which is
+ // UCS4 (linux)
+ // UCS2 == UNICODE (microsoft, java, aix, whatever...)
+ // XXX Currently don't know how to get this data from target system...
+ strcpy(_M_int_enc, "UCS4");
+
+ // __extc_end = external codeset in current locale
+ // XXX There has got to be a better way to do this.
+ __c_locale __cloc;
+ locale::facet::_S_create_c_locale(__cloc, __loc.name().c_str());
+ strcpy(_M_ext_enc, __nl_langinfo_l(CODESET, __cloc));
+ locale::facet::_S_destroy_c_locale(__cloc);
+ }
+
+ __enc_traits(const char* __int, const char* __ext, int __ibom = 0,
+ int __ebom = 0)
+ : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0)
+ {
+ strncpy(_M_int_enc, __int, _S_max_size);
+ strncpy(_M_ext_enc, __ext, _S_max_size);
+ }
+
+ // 21.1.2 traits typedefs
+ // p4
+ // typedef STATE_T state_type
+ // requires: state_type shall meet the requirements of
+ // CopyConstructible types (20.1.3)
+ __enc_traits(const __enc_traits& __obj)
+ {
+ strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size);
+ strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size);
+ _M_ext_bom = __obj._M_ext_bom;
+ _M_int_bom = __obj._M_int_bom;
+ }
+
+ ~__enc_traits()
+ {
+ iconv_close(_M_in_desc);
+ iconv_close(_M_out_desc);
+ }
+
+ // Initializes
+ void
+ _M_init()
+ {
+ _M_in_desc = iconv_open(_M_int_enc, _M_ext_enc);
+ _M_out_desc = iconv_open(_M_ext_enc, _M_int_enc);
+ if (_M_out_desc == iconv_t(-1) || _M_in_desc == iconv_t(-1))
+ {
+ // XXX Extended error checking.
+ }
+ }
+
+ bool
+ _M_good()
+ {
+ return _M_out_desc && _M_in_desc
+ && _M_out_desc != iconv_t(-1) && _M_in_desc != iconv_t(-1);
+ }
+
+ const __desc_type*
+ _M_get_in_descriptor()
+ { return &_M_in_desc; }
+
+ const __desc_type*
+ _M_get_out_descriptor()
+ { return &_M_out_desc; }
+
+ const char*
+ _M_get_internal_enc()
+ { return _M_int_enc; }
+
+ const char*
+ _M_get_external_enc()
+ { return _M_ext_enc; }
+
+ int
+ _M_get_external_bom()
+ { return _M_ext_bom; }
+
+ int
+ _M_get_internal_bom()
+ { return _M_int_bom; }
+ };
+
+ // Partial specialization
+ // This specialization takes advantage of iconv to provide code
+ // conversions between a large number of character encodings.
+ template<typename _InternT, typename _ExternT>
+ class codecvt<_InternT, _ExternT, __enc_traits>
+ : public __codecvt_abstract_base<_InternT, _ExternT, __enc_traits>
+ {
+ public:
+ // Types:
+ typedef codecvt_base::result result;
+ typedef _InternT intern_type;
+ typedef _ExternT extern_type;
+ typedef __enc_traits state_type;
+ typedef __enc_traits::__desc_type __desc_type;
+ typedef __enc_traits __enc_type;
+
+ // Data Members:
+ static locale::id id;
+
+ explicit
+ codecvt(size_t __refs = 0)
+ : __codecvt_abstract_base<intern_type, extern_type, state_type>(__refs)
+ { }
+
+ explicit
+ codecvt(__enc_type* __enc, size_t __refs = 0)
+ : __codecvt_abstract_base<intern_type, extern_type, state_type>(__refs)
+ { }
+
+ protected:
+ virtual
+ ~codecvt() { }
+
+ virtual result
+ do_out(state_type& __state, const intern_type* __from,
+ const intern_type* __from_end, const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_end,
+ extern_type*& __to_next) const;
+
+ virtual result
+ do_unshift(state_type& __state, extern_type* __to,
+ extern_type* __to_end, extern_type*& __to_next) const;
+
+ virtual result
+ do_in(state_type& __state, const extern_type* __from,
+ const extern_type* __from_end, const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_end,
+ intern_type*& __to_next) const;
+
+ virtual int
+ do_encoding() const throw();
+
+ virtual bool
+ do_always_noconv() const throw();
+
+ virtual int
+ do_length(const state_type&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const;
+
+ virtual int
+ do_max_length() const throw();
+ };
+
+ template<typename _InternT, typename _ExternT>
+ locale::id
+ codecvt<_InternT, _ExternT, __enc_traits>::id;
+
+ // This adaptor works around the signature problems of the second
+ // argument to iconv(): SUSv2 and others use 'const char**', but glibc 2.2
+ // uses 'char**', which is what the standard is (apparently) due to use
+ // in the future. Using this adaptor, g++ will do the work for us.
+ template<typename _T>
+ inline size_t
+ __iconv_adaptor(size_t(*iconv_func)(iconv_t, _T, size_t*, char**, size_t*),
+ iconv_t cd, char** inbuf, size_t* inbytesleft,
+ char** outbuf, size_t* outbytesleft)
+ {
+ return iconv_func(cd, (_T)inbuf, inbytesleft, outbuf, outbytesleft);
+ }
+
+ template<typename _InternT, typename _ExternT>
+ codecvt_base::result
+ codecvt<_InternT, _ExternT, __enc_traits>::
+ do_out(state_type& __state, const intern_type* __from,
+ const intern_type* __from_end, const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_end,
+ extern_type*& __to_next) const
+ {
+ result __ret = error;
+ if (__state._M_good())
+ {
+ typedef state_type::__desc_type __desc_type;
+ const __desc_type* __desc = __state._M_get_out_descriptor();
+ const size_t __fmultiple = sizeof(intern_type) / sizeof(char);
+ size_t __flen = __fmultiple * (__from_end - __from);
+ const size_t __tmultiple = sizeof(extern_type) / sizeof(char);
+ size_t __tlen = __tmultiple * (__to_end - __to);
+
+ // Argument list for iconv specifies a byte sequence. Thus,
+ // all to/from arrays must be brutally casted to char*.
+ char* __cto = reinterpret_cast<char*>(__to);
+ char* __cfrom;
+ size_t __conv;
+
+ // Some encodings need a byte order marker as the first item
+ // in the byte stream, to designate endian-ness. The default
+ // value for the byte order marker is NULL, so if this is
+ // the case, it's not necessary and we can just go on our
+ // merry way.
+ int __int_bom = __state._M_get_internal_bom();
+ if (__int_bom)
+ {
+ size_t __size = __from_end - __from;
+ intern_type* __cfixed = static_cast<intern_type*>(__builtin_alloca(sizeof(intern_type) * (__size + 1)));
+ __cfixed[0] = static_cast<intern_type>(__int_bom);
+ char_traits<intern_type>::copy(__cfixed + 1, __from, __size);
+ __cfrom = reinterpret_cast<char*>(__cfixed);
+ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom,
+ &__flen, &__cto, &__tlen);
+ }
+ else
+ {
+ intern_type* __cfixed = const_cast<intern_type*>(__from);
+ __cfrom = reinterpret_cast<char*>(__cfixed);
+ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom,
+ &__flen, &__cto, &__tlen);
+ }
+
+ if (__conv != size_t(-1))
+ {
+ __from_next = reinterpret_cast<const intern_type*>(__cfrom);
+ __to_next = reinterpret_cast<extern_type*>(__cto);
+ __ret = ok;
+ }
+ else
+ {
+ if (__flen < static_cast<size_t>(__from_end - __from))
+ {
+ __from_next = reinterpret_cast<const intern_type*>(__cfrom);
+ __to_next = reinterpret_cast<extern_type*>(__cto);
+ __ret = partial;
+ }
+ else
+ __ret = error;
+ }
+ }
+ return __ret;
+ }
+
+ template<typename _InternT, typename _ExternT>
+ codecvt_base::result
+ codecvt<_InternT, _ExternT, __enc_traits>::
+ do_unshift(state_type& __state, extern_type* __to,
+ extern_type* __to_end, extern_type*& __to_next) const
+ {
+ result __ret = error;
+ if (__state._M_good())
+ {
+ typedef state_type::__desc_type __desc_type;
+ const __desc_type* __desc = __state._M_get_in_descriptor();
+ const size_t __tmultiple = sizeof(intern_type) / sizeof(char);
+ size_t __tlen = __tmultiple * (__to_end - __to);
+
+ // Argument list for iconv specifies a byte sequence. Thus,
+ // all to/from arrays must be brutally casted to char*.
+ char* __cto = reinterpret_cast<char*>(__to);
+ size_t __conv = __iconv_adaptor(iconv,*__desc, NULL, NULL,
+ &__cto, &__tlen);
+
+ if (__conv != size_t(-1))
+ {
+ __to_next = reinterpret_cast<extern_type*>(__cto);
+ if (__tlen == __tmultiple * (__to_end - __to))
+ __ret = noconv;
+ else if (__tlen == 0)
+ __ret = ok;
+ else
+ __ret = partial;
+ }
+ else
+ __ret = error;
+ }
+ return __ret;
+ }
+
+ template<typename _InternT, typename _ExternT>
+ codecvt_base::result
+ codecvt<_InternT, _ExternT, __enc_traits>::
+ do_in(state_type& __state, const extern_type* __from,
+ const extern_type* __from_end, const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_end,
+ intern_type*& __to_next) const
+ {
+ result __ret = error;
+ if (__state._M_good())
+ {
+ typedef state_type::__desc_type __desc_type;
+ const __desc_type* __desc = __state._M_get_in_descriptor();
+ const size_t __fmultiple = sizeof(extern_type) / sizeof(char);
+ size_t __flen = __fmultiple * (__from_end - __from);
+ const size_t __tmultiple = sizeof(intern_type) / sizeof(char);
+ size_t __tlen = __tmultiple * (__to_end - __to);
+
+ // Argument list for iconv specifies a byte sequence. Thus,
+ // all to/from arrays must be brutally casted to char*.
+ char* __cto = reinterpret_cast<char*>(__to);
+ char* __cfrom;
+ size_t __conv;
+
+ // Some encodings need a byte order marker as the first item
+ // in the byte stream, to designate endian-ness. The default
+ // value for the byte order marker is NULL, so if this is
+ // the case, it's not necessary and we can just go on our
+ // merry way.
+ int __ext_bom = __state._M_get_external_bom();
+ if (__ext_bom)
+ {
+ size_t __size = __from_end - __from;
+ extern_type* __cfixed = static_cast<extern_type*>(__builtin_alloca(sizeof(extern_type) * (__size + 1)));
+ __cfixed[0] = static_cast<extern_type>(__ext_bom);
+ char_traits<extern_type>::copy(__cfixed + 1, __from, __size);
+ __cfrom = reinterpret_cast<char*>(__cfixed);
+ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom,
+ &__flen, &__cto, &__tlen);
+ }
+ else
+ {
+ extern_type* __cfixed = const_cast<extern_type*>(__from);
+ __cfrom = reinterpret_cast<char*>(__cfixed);
+ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom,
+ &__flen, &__cto, &__tlen);
+ }
+
+
+ if (__conv != size_t(-1))
+ {
+ __from_next = reinterpret_cast<const extern_type*>(__cfrom);
+ __to_next = reinterpret_cast<intern_type*>(__cto);
+ __ret = ok;
+ }
+ else
+ {
+ if (__flen < static_cast<size_t>(__from_end - __from))
+ {
+ __from_next = reinterpret_cast<const extern_type*>(__cfrom);
+ __to_next = reinterpret_cast<intern_type*>(__cto);
+ __ret = partial;
+ }
+ else
+ __ret = error;
+ }
+ }
+ return __ret;
+ }
+
+ template<typename _InternT, typename _ExternT>
+ int
+ codecvt<_InternT, _ExternT, __enc_traits>::
+ do_encoding() const throw()
+ { return 0; }
+
+ template<typename _InternT, typename _ExternT>
+ bool
+ codecvt<_InternT, _ExternT, __enc_traits>::
+ do_always_noconv() const throw()
+ { return false; }
+
+ template<typename _InternT, typename _ExternT>
+ int
+ codecvt<_InternT, _ExternT, __enc_traits>::
+ do_length(const state_type&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const
+ { return min(__max, static_cast<size_t>(__end - __from)); }
+
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+// 74. Garbled text for codecvt::do_max_length
+ template<typename _InternT, typename _ExternT>
+ int
+ codecvt<_InternT, _ExternT, __enc_traits>::
+ do_max_length() const throw()
+ { return 1; }
+#endif
diff --git a/libstdc++-v3/config/locale/messages_members_generic.cc b/libstdc++-v3/config/locale/messages_members_generic.cc
new file mode 100644
index 00000000000..480ab88d824
--- /dev/null
+++ b/libstdc++-v3/config/locale/messages_members_generic.cc
@@ -0,0 +1,45 @@
+// std::messages implementation details, generic version -*- C++ -*-
+
+// Copyright (C) 2001 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.
+
+//
+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <locale>
+
+namespace std
+{
+ // Specializations
+ template<>
+ string
+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
+ { return __dfault; }
+}
diff --git a/libstdc++-v3/config/locale/messages_members_generic.h b/libstdc++-v3/config/locale/messages_members_generic.h
new file mode 100644
index 00000000000..43f23ae64ec
--- /dev/null
+++ b/libstdc++-v3/config/locale/messages_members_generic.h
@@ -0,0 +1,62 @@
+// std::messages implementation details, generic version -*- C++ -*-
+
+// Copyright (C) 2001 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.
+
+//
+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+ // Non-virtual member functions.
+ template<typename _CharT>
+ messages<_CharT>::catalog
+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
+ const char*) const
+ { return this->do_open(__s, __loc); }
+
+ // Virtual member functions.
+ template<typename _CharT>
+ messages<_CharT>::~messages()
+ { }
+
+ template<typename _CharT>
+ messages<_CharT>::catalog
+ messages<_CharT>::do_open(const basic_string<char>&, const locale&) const
+ { return 0; }
+
+ template<typename _CharT>
+ messages<_CharT>::string_type
+ messages<_CharT>::do_get(catalog, int, int,
+ const string_type& __dfault) const
+ { return __dfault; }
+
+ template<typename _CharT>
+ void
+ messages<_CharT>::do_close(catalog) const
+ { }
diff --git a/libstdc++-v3/config/locale/messages_members_gnu.cc b/libstdc++-v3/config/locale/messages_members_gnu.cc
new file mode 100644
index 00000000000..ef1a5a360eb
--- /dev/null
+++ b/libstdc++-v3/config/locale/messages_members_gnu.cc
@@ -0,0 +1,57 @@
+// std::messages implementation details, GNU version -*- C++ -*-
+
+// Copyright (C) 2001 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.
+
+//
+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <locale>
+
+namespace std
+{
+ // Specializations
+ template<>
+ 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
+ setlocale(LC_ALL, _M_name_messages);
+ const char* __msg = gettext(__dfault.c_str());
+ return string(__msg);
+#endif
+ }
+}
diff --git a/libstdc++-v3/config/locale/messages_members_gnu.h b/libstdc++-v3/config/locale/messages_members_gnu.h
new file mode 100644
index 00000000000..2afc5589b12
--- /dev/null
+++ b/libstdc++-v3/config/locale/messages_members_gnu.h
@@ -0,0 +1,93 @@
+// std::messages implementation details, GNU version -*- C++ -*-
+
+// Copyright (C) 2001 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.
+
+//
+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+ // Non-virtual member functions.
+ template<typename _CharT>
+ messages<_CharT>::catalog
+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
+ const char* __dir) const
+ {
+ bindtextdomain(__s.c_str(), __dir);
+ return this->do_open(__s, __loc);
+ }
+
+ // Virtual member functions.
+ template<typename _CharT>
+ messages<_CharT>::~messages()
+ {
+ if (_M_c_locale_messages)
+ _S_destroy_c_locale(_M_c_locale_messages);
+ }
+
+ template<typename _CharT>
+ messages<_CharT>::catalog
+ messages<_CharT>::do_open(const basic_string<char>& __s,
+ const locale&) const
+ {
+ // No error checking is done, assume the catalog exists and can
+ // be used.
+ textdomain(__s.c_str());
+ return 0;
+ }
+
+ template<typename _CharT>
+ messages<_CharT>::string_type
+ 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
+ setlocale(LC_ALL, _M_name_messages);
+ char* __msg = gettext(_M_convert_to_char(__dfault));
+ return _M_convert_from_char(__msg);
+#endif
+ }
+
+ template<typename _CharT>
+ void
+ messages<_CharT>::do_close(catalog) const
+ { }
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/config/locale/messages_members_ieee_1003.1-200x.cc b/libstdc++-v3/config/locale/messages_members_ieee_1003.1-200x.cc
new file mode 100644
index 00000000000..0f667d6a4d0
--- /dev/null
+++ b/libstdc++-v3/config/locale/messages_members_ieee_1003.1-200x.cc
@@ -0,0 +1,49 @@
+// std::messages implementation details, IEEE 1003.1-200x version -*- C++ -*-
+
+// Copyright (C) 2001 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.
+
+//
+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <locale>
+
+namespace std
+{
+ // Specializations
+ template<>
+ string
+ messages<char>::do_get(catalog __c, int __setid, int __msgid,
+ const string& __dfault) const
+ {
+ nl_catd __nlc = reinterpret_cast<nl_catd>(__c);
+ return string(catgets(__nlc, __setid, __msgid, __dfault.c_str()));
+ }
+}
diff --git a/libstdc++-v3/config/locale/messages_members_ieee_1003.1-200x.h b/libstdc++-v3/config/locale/messages_members_ieee_1003.1-200x.h
new file mode 100644
index 00000000000..c4901352796
--- /dev/null
+++ b/libstdc++-v3/config/locale/messages_members_ieee_1003.1-200x.h
@@ -0,0 +1,70 @@
+// std::messages implementation details, IEEE 1003.1-200x version -*- C++ -*-
+
+// Copyright (C) 2001 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.
+
+//
+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+ // Non-virtual member functions.
+ template<typename _CharT>
+ messages<_CharT>::catalog
+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
+ const char*) const
+ { return this->do_open(__s, __loc); }
+
+ // Virtual member functions.
+ template<typename _CharT>
+ messages<_CharT>::~messages()
+ { }
+
+ template<typename _CharT>
+ messages<_CharT>::catalog
+ messages<_CharT>::do_open(const basic_string<char>& __s,
+ const locale&) const
+ { return reinterpret_cast<catalog>(catopen(__s.c_str(), NL_CAT_LOCALE)); }
+
+ template<typename _CharT>
+ messages<_CharT>::string_type
+ messages<_CharT>::do_get(catalog __c, int __setid, int __msgid,
+ const string_type& __dfault) const
+ {
+ nl_catd __nlc = reinterpret_cast<nl_catd>(__c);
+ char* __msg = catgets(__nlc, __setid, __msgid,
+ _M_convert_to_char(__dfault));
+ return _M_convert_from_char(__msg);
+ }
+
+ template<typename _CharT>
+ void
+ messages<_CharT>::do_close(catalog __c) const
+ { catclose(reinterpret_cast<nl_catd>(__c)); }
+
+