c_locale_gnu.cc: Move facet info to separate files...

2001-08-27  Benjamin Kosnik  <bkoz@redhat.com>

	* config/locale/c_locale_gnu.cc: Move facet info to separate files...
	* config/locale/c_locale_generic.cc: Same.
	* config/locale/moneypunct_members_gnu.cc: New file.
	* config/locale/moneypunct_members_generic.cc: New file.
	* config/locale/numpunct_members_gnu.cc: New file.
	* config/locale/numpunct_members_generic.cc: New file.
	* acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): Add moneypunct, numpunct
	options.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* src/Makefile.am (sources): And here.
	* src/Makefile.in: Regenerate.

	Rename for consistency with rest of testsuite.
	* testsuite/22_locale/codecvt.cc: New file.
	* testsuite/22_locale/money_put.cc: New file.
	* testsuite/22_locale/money_put_members_char.cc: New file.

From-SVN: r45224
This commit is contained in:
Benjamin Kosnik 2001-08-28 06:19:35 +00:00 committed by Benjamin Kosnik
parent 79e8ec0eb2
commit 72e2386f87
30 changed files with 1565 additions and 1206 deletions

View file

@ -1,3 +1,23 @@
2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
* config/locale/c_locale_gnu.cc: Move facet info to separate files...
* config/locale/c_locale_generic.cc: Same.
* config/locale/moneypunct_members_gnu.cc: New file.
* config/locale/moneypunct_members_generic.cc: New file.
* config/locale/numpunct_members_gnu.cc: New file.
* config/locale/numpunct_members_generic.cc: New file.
* acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): Add moneypunct, numpunct
options.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* src/Makefile.am (sources): And here.
* src/Makefile.in: Regenerate.
Rename for consistency with rest of testsuite.
* testsuite/22_locale/codecvt.cc: New file.
* testsuite/22_locale/money_put.cc: New file.
* testsuite/22_locale/money_put_members_char.cc: New file.
2001-08-27 Phil Edwards <pme@sources.redhat.com>
PR libstdc++/4143

View file

@ -1058,9 +1058,11 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
CLOCALE_H=config/locale/c_locale_generic.h
CLOCALE_CC=config/locale/c_locale_generic.cc
CCODECVT_H=config/locale/codecvt_specializations_generic.h
CCOLLATE_CC=config/locale/collate_members_generic.cc
CMESSAGES_H=config/locale/messages_members_generic.h
CMESSAGES_CC=config/locale/messages_members_generic.cc
CCOLLATE_CC=config/locale/collate_specializations_generic.cc
CMONEY_CC=config/locale/moneypunct_members_generic.cc
CNUMERIC_CC=config/locale/numpunct_members_generic.cc
;;
xgnu)
AC_MSG_RESULT(gnu)
@ -1084,9 +1086,11 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
CLOCALE_H=config/locale/c_locale_gnu.h
CLOCALE_CC=config/locale/c_locale_gnu.cc
CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
CCOLLATE_CC=config/locale/collate_members_gnu.cc
CMESSAGES_H=config/locale/messages_members_gnu.h
CMESSAGES_CC=config/locale/messages_members_gnu.cc
CCOLLATE_CC=config/locale/collate_specializations_gnu.cc
CMONEY_CC=config/locale/moneypunct_members_gnu.cc
CNUMERIC_CC=config/locale/numpunct_members_gnu.cc
;;
xieee_1003.1)
AC_MSG_RESULT(generic)
@ -1097,9 +1101,11 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
CLOCALE_H=config/locale/c_locale_ieee_1003.1-200x.h
CLOCALE_CC=config/locale/c_locale_ieee_1003.1-200x.cc
CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
CCOLLATE_CC=config/locale/collate_members_generic.cc
CMESSAGES_H=config/locale/messages_members_ieee_1003.1-200x.h
CMESSAGES_CC=config/locale/messages_members_ieee_1003.1-200x.cc
CCOLLATE_CC=config/locale/collate_specializations_generic.cc
CMONEY_CC=config/locale/moneypunct_members_generic.cc
CNUMERIC_CC=config/locale/numpunct_members_generic.cc
;;
*)
echo "$enable_clocale is an unknown locale package" 1>&2
@ -1117,8 +1123,10 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
AC_SUBST(CCODECVT_H)
AC_SUBST(CMESSAGES_H)
AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
AC_LINK_FILES($CMONEY_CC, src/moneypunct.cc)
AC_LINK_FILES($CNUMERIC_CC, src/numpunct.cc)
])

View file

@ -1070,9 +1070,11 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
CLOCALE_H=config/locale/c_locale_generic.h
CLOCALE_CC=config/locale/c_locale_generic.cc
CCODECVT_H=config/locale/codecvt_specializations_generic.h
CCOLLATE_CC=config/locale/collate_members_generic.cc
CMESSAGES_H=config/locale/messages_members_generic.h
CMESSAGES_CC=config/locale/messages_members_generic.cc
CCOLLATE_CC=config/locale/collate_specializations_generic.cc
CMONEY_CC=config/locale/moneypunct_members_generic.cc
CNUMERIC_CC=config/locale/numpunct_members_generic.cc
;;
xgnu)
AC_MSG_RESULT(gnu)
@ -1096,9 +1098,11 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
CLOCALE_H=config/locale/c_locale_gnu.h
CLOCALE_CC=config/locale/c_locale_gnu.cc
CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
CCOLLATE_CC=config/locale/collate_members_gnu.cc
CMESSAGES_H=config/locale/messages_members_gnu.h
CMESSAGES_CC=config/locale/messages_members_gnu.cc
CCOLLATE_CC=config/locale/collate_specializations_gnu.cc
CMONEY_CC=config/locale/moneypunct_members_gnu.cc
CNUMERIC_CC=config/locale/numpunct_members_gnu.cc
;;
xieee_1003.1)
AC_MSG_RESULT(generic)
@ -1109,9 +1113,11 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
CLOCALE_H=config/locale/c_locale_ieee_1003.1-200x.h
CLOCALE_CC=config/locale/c_locale_ieee_1003.1-200x.cc
CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
CCOLLATE_CC=config/locale/collate_members_generic.cc
CMESSAGES_H=config/locale/messages_members_ieee_1003.1-200x.h
CMESSAGES_CC=config/locale/messages_members_ieee_1003.1-200x.cc
CCOLLATE_CC=config/locale/collate_specializations_generic.cc
CMONEY_CC=config/locale/moneypunct_members_generic.cc
CNUMERIC_CC=config/locale/numpunct_members_generic.cc
;;
*)
echo "$enable_clocale is an unknown locale package" 1>&2
@ -1129,8 +1135,10 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
AC_SUBST(CCODECVT_H)
AC_SUBST(CMESSAGES_H)
AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
AC_LINK_FILES($CMONEY_CC, src/moneypunct.cc)
AC_LINK_FILES($CNUMERIC_CC, src/numpunct.cc)
])
@ -1959,12 +1967,12 @@ fi])
# Macro to add for using GNU gettext.
# Ulrich Drepper <drepper@cygnus.com>, 1995.
#
# This file file be copied and used freely without restrictions. It can
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
# serial 3
# serial 5
AC_DEFUN(AM_WITH_NLS,
[AC_MSG_CHECKING([whether NLS is requested])
@ -2006,9 +2014,10 @@ AC_DEFUN(AM_WITH_NLS,
AC_CHECK_LIB(intl, bindtextdomain,
[AC_CACHE_CHECK([for gettext in libintl],
gt_cv_func_gettext_libintl,
[AC_TRY_LINK([], [return (int) gettext ("")],
gt_cv_func_gettext_libintl=yes,
gt_cv_func_gettext_libintl=no)])])
[AC_CHECK_LIB(intl, gettext,
gt_cv_func_gettext_libintl=yes,
gt_cv_func_gettext_libintl=no)],
gt_cv_func_gettext_libintl=no)])
fi
if test "$gt_cv_func_gettext_libc" = "yes" \
@ -2102,7 +2111,7 @@ AC_DEFUN(AM_WITH_NLS,
: ;
else
AC_MSG_RESULT(
[found xgettext programs is not GNU xgettext; ignore it])
[found xgettext program is not GNU xgettext; ignore it])
XGETTEXT=":"
fi
fi
@ -2114,6 +2123,12 @@ AC_DEFUN(AM_WITH_NLS,
nls_cv_header_intl=intl/libintl.h
nls_cv_header_libgt=intl/libgettext.h
fi
AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
AC_OUTPUT_COMMANDS(
[case "$CONFIG_FILES" in *po/Makefile.in*)
sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
esac])
# If this is used in GNU gettext we have to set USE_NLS to `yes'
# because some of the sources are only built for this goal.
@ -2158,9 +2173,9 @@ AC_DEFUN(AM_GNU_GETTEXT,
AC_REQUIRE([AC_FUNC_MMAP])dnl
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
unistd.h values.h sys/param.h])
unistd.h sys/param.h])
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
__argz_count __argz_stringify __argz_next])
strdup __argz_count __argz_stringify __argz_next])
if test "${ac_cv_func_stpcpy+set}" != "set"; then
AC_CHECK_FUNCS(stpcpy)
@ -2268,7 +2283,7 @@ __argz_count __argz_stringify __argz_next])
# Search path for a program which passes the given test.
# Ulrich Drepper <drepper@cygnus.com>, 1996.
#
# This file file be copied and used freely without restrictions. It can
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
@ -2316,7 +2331,7 @@ AC_SUBST($1)dnl
# Check whether LC_MESSAGES is available in <locale.h>.
# Ulrich Drepper <drepper@cygnus.com>, 1995.
#
# This file file be copied and used freely without restrictions. It can
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
@ -2329,8 +2344,7 @@ AC_DEFUN(AM_LC_MESSAGES,
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
if test $am_cv_val_LC_MESSAGES = yes; then
AC_DEFINE(HAVE_LC_MESSAGES, 1,
[Define if your locale.h file contains LC_MESSAGES.])
AC_DEFINE(HAVE_LC_MESSAGES)
fi
fi])

View file

@ -48,65 +48,4 @@ namespace std
__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

View file

@ -64,188 +64,4 @@ namespace std
__c_locale
locale::facet::_S_clone_c_locale(__c_locale& __cloc)
{ return __duplocale(__cloc); }
template<>
void
numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
{
if (!__cloc)
{
// "C" locale
_M_decimal_point = '.';
_M_thousands_sep = ',';
_M_grouping = "";
}
else
{
// Named locale.
_M_decimal_point = *(__nl_langinfo_l(RADIXCHAR, __cloc));
_M_thousands_sep = *(__nl_langinfo_l(THOUSEP, __cloc));
_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
}
// NB: There is no way to extact this info from posix locales.
// _M_truename = __nl_langinfo_l(YESSTR, __cloc);
_M_truename = "true";
// _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
_M_falsename = "false";
}
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
void
numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
{
if (!__cloc)
{
// "C" locale
_M_decimal_point = L'.';
_M_thousands_sep = L',';
_M_grouping = "";
}
else
{
// Named locale.
_M_decimal_point = reinterpret_cast<wchar_t>(__nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc));
_M_thousands_sep = reinterpret_cast<wchar_t>(__nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC,__cloc));
_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
}
// NB: There is no way to extact this info from posix locales.
// _M_truename = __nl_langinfo_l(YESSTR, __cloc);
_M_truename = L"true";
// _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
_M_falsename = L"false";
}
#endif
template<>
void
moneypunct<char>::_M_initialize_moneypunct(__c_locale __cloc)
{
if (!__cloc)
{
// "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;
}
else
{
// Named locale.
_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, __cloc));
_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, __cloc));
_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
if (intl)
{
_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, __cloc));
char __ppreceeds = *(__nl_langinfo_l(__INT_P_CS_PRECEDES,
__cloc));
char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
_M_pos_format = _S_construct_pattern(__ppreceeds, __pspace,
__pposn);
char __npreceeds = *(__nl_langinfo_l(__INT_N_CS_PRECEDES,
__cloc));
char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
_M_neg_format = _S_construct_pattern(__npreceeds, __nspace,
__nposn);
}
else
{
_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
char __ppreceeds = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
_M_pos_format = _S_construct_pattern(__ppreceeds, __pspace,
__pposn);
char __npreceeds = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
_M_neg_format = _S_construct_pattern(__npreceeds, __nspace,
__nposn);
}
}
}
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
void
moneypunct<wchar_t>::_M_initialize_moneypunct(__c_locale __cloc)
{
if (!__cloc)
{
// "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;
}
else
{
// Named locale.
_M_decimal_point = reinterpret_cast<wchar_t>(__nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc));
_M_thousands_sep = reinterpret_cast<wchar_t>(__nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC,__cloc));
_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
_M_positive_sign = reinterpret_cast<wchar_t*>(__nl_langinfo_l(__POSITIVE_SIGN, __cloc));
_M_negative_sign = reinterpret_cast<wchar_t*>(__nl_langinfo_l(__NEGATIVE_SIGN, __cloc));
if (intl)
{
_M_curr_symbol = reinterpret_cast<wchar_t*>(__nl_langinfo_l(__INT_CURR_SYMBOL, __cloc));
_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, __cloc));
char __ppreceeds = *(__nl_langinfo_l(__INT_P_CS_PRECEDES,
__cloc));
char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
_M_pos_format = _S_construct_pattern(__ppreceeds, __pspace,
__pposn);
char __npreceeds = *(__nl_langinfo_l(__INT_N_CS_PRECEDES,
__cloc));
char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
_M_neg_format = _S_construct_pattern(__npreceeds, __nspace,
__nposn);
}
else
{
_M_curr_symbol = reinterpret_cast<wchar_t*>(__nl_langinfo_l(__CURRENCY_SYMBOL, __cloc));
_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
char __ppreceeds = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
_M_pos_format = _S_construct_pattern(__ppreceeds, __pspace,
__pposn);
char __npreceeds = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
_M_neg_format = _S_construct_pattern(__npreceeds, __nspace,
__nposn);
}
}
}
#endif
} // namespace std

View file

@ -0,0 +1,73 @@
// std::moneypunct 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.6.3.2 moneypunct virtual functions
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <locale>
namespace std
{
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
}

View file

@ -0,0 +1,161 @@
// std::moneypunct 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.6.3.2 moneypunct virtual functions
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <locale>
namespace std
{
template<>
void
moneypunct<char>::_M_initialize_moneypunct(__c_locale __cloc)
{
if (!__cloc)
{
// "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;
}
else
{
// Named locale.
_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, __cloc));
_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, __cloc));
_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
if (intl)
{
_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, __cloc));
char __ppreceeds = *(__nl_langinfo_l(__INT_P_CS_PRECEDES,
__cloc));
char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
_M_pos_format = _S_construct_pattern(__ppreceeds, __pspace,
__pposn);
char __npreceeds = *(__nl_langinfo_l(__INT_N_CS_PRECEDES,
__cloc));
char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
_M_neg_format = _S_construct_pattern(__npreceeds, __nspace,
__nposn);
}
else
{
_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
char __ppreceeds = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
_M_pos_format = _S_construct_pattern(__ppreceeds, __pspace,
__pposn);
char __npreceeds = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
_M_neg_format = _S_construct_pattern(__npreceeds, __nspace,
__nposn);
}
}
}
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
void
moneypunct<wchar_t>::_M_initialize_moneypunct(__c_locale __cloc)
{
if (!__cloc)
{
// "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;
}
else
{
// Named locale.
_M_decimal_point = reinterpret_cast<wchar_t>(__nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc));
_M_thousands_sep = reinterpret_cast<wchar_t>(__nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC,__cloc));
_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
_M_positive_sign = reinterpret_cast<wchar_t*>(__nl_langinfo_l(__POSITIVE_SIGN, __cloc));
_M_negative_sign = reinterpret_cast<wchar_t*>(__nl_langinfo_l(__NEGATIVE_SIGN, __cloc));
if (intl)
{
_M_curr_symbol = reinterpret_cast<wchar_t*>(__nl_langinfo_l(__INT_CURR_SYMBOL, __cloc));
_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, __cloc));
char __ppreceeds = *(__nl_langinfo_l(__INT_P_CS_PRECEDES,
__cloc));
char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
_M_pos_format = _S_construct_pattern(__ppreceeds, __pspace,
__pposn);
char __npreceeds = *(__nl_langinfo_l(__INT_N_CS_PRECEDES,
__cloc));
char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
_M_neg_format = _S_construct_pattern(__npreceeds, __nspace,
__nposn);
}
else
{
_M_curr_symbol = reinterpret_cast<wchar_t*>(__nl_langinfo_l(__CURRENCY_SYMBOL, __cloc));
_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
char __ppreceeds = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
_M_pos_format = _S_construct_pattern(__ppreceeds, __pspace,
__pposn);
char __npreceeds = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
_M_neg_format = _S_construct_pattern(__npreceeds, __nspace,
__nposn);
}
}
}
#endif
}

View file

@ -0,0 +1,65 @@
// std::numpunct 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.3.1.2 numpunct virtual functions
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <locale>
namespace std
{
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
}

View file

@ -0,0 +1,91 @@
// std::numpunct 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.3.1.2 numpunct virtual functions
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <locale>
namespace std
{
template<>
void
numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
{
if (!__cloc)
{
// "C" locale
_M_decimal_point = '.';
_M_thousands_sep = ',';
_M_grouping = "";
}
else
{
// Named locale.
_M_decimal_point = *(__nl_langinfo_l(RADIXCHAR, __cloc));
_M_thousands_sep = *(__nl_langinfo_l(THOUSEP, __cloc));
_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
}
// NB: There is no way to extact this info from posix locales.
// _M_truename = __nl_langinfo_l(YESSTR, __cloc);
_M_truename = "true";
// _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
_M_falsename = "false";
}
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
void
numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
{
if (!__cloc)
{
// "C" locale
_M_decimal_point = L'.';
_M_thousands_sep = L',';
_M_grouping = "";
}
else
{
// Named locale.
_M_decimal_point = reinterpret_cast<wchar_t>(__nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc));
_M_thousands_sep = reinterpret_cast<wchar_t>(__nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC,__cloc));
_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
}
// NB: There is no way to extact this info from posix locales.
// _M_truename = __nl_langinfo_l(YESSTR, __cloc);
_M_truename = L"true";
// _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
_M_falsename = L"false";
}
#endif
}

1857
libstdc++-v3/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -21,7 +21,7 @@
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA.
## $Id: Makefile.am,v 1.6 2001/08/14 01:24:28 bkoz Exp $
## $Id: Makefile.am,v 1.7 2001/08/14 08:42:19 bkoz Exp $
AUTOMAKE_OPTIONS = 1.3 gnits
MAINT_CHARSET = latin1
@ -392,5 +392,3 @@ install-data-local:
# By adding these files here, automake will remove them for 'make clean'
#CLEANFILES = ${allstamps}

View file

@ -58,5 +58,3 @@ namespace std
} // namespace std
#endif

View file

@ -21,7 +21,7 @@
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA.
## $Id: Makefile.am,v 1.94 2001/08/14 01:24:30 bkoz Exp $
## $Id: Makefile.am,v 1.95 2001/08/18 02:53:13 bkoz Exp $
AUTOMAKE_OPTIONS = 1.3 gnits
MAINT_CHARSET = latin1
@ -65,7 +65,7 @@ sources = \
basic_file.cc bitset.cc c++locale.cc cmath.cc codecvt.cc \
complex_io.cc functexcept.cc globals.cc ios.cc limits.cc \
locale.cc locale-inst.cc localename.cc \
messages.cc collate.cc \
collate.cc messages.cc moneypunct.cc numpunct.cc \
misc-inst.cc stdexcept.cc stl-inst.cc string-inst.cc strstream.cc \
valarray-inst.cc wstring-inst.cc

View file

@ -178,7 +178,7 @@ TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
INCLUDES = -nostdinc++ $(GLIBCPP_INCLUDES) $(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) $(TOPLEVEL_INCLUDES)
sources = basic_file.cc bitset.cc c++locale.cc cmath.cc codecvt.cc complex_io.cc functexcept.cc globals.cc ios.cc limits.cc locale.cc locale-inst.cc localename.cc messages.cc collate.cc misc-inst.cc stdexcept.cc stl-inst.cc string-inst.cc strstream.cc valarray-inst.cc wstring-inst.cc
sources = basic_file.cc bitset.cc c++locale.cc cmath.cc codecvt.cc complex_io.cc functexcept.cc globals.cc ios.cc limits.cc locale.cc locale-inst.cc localename.cc collate.cc messages.cc moneypunct.cc numpunct.cc misc-inst.cc stdexcept.cc stl-inst.cc string-inst.cc strstream.cc valarray-inst.cc wstring-inst.cc
VPATH = $(top_srcdir):$(top_srcdir)/src
@ -248,9 +248,9 @@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libstdc___la_OBJECTS = basic_file.lo bitset.lo c++locale.lo cmath.lo \
codecvt.lo complex_io.lo functexcept.lo globals.lo ios.lo limits.lo \
locale.lo locale-inst.lo localename.lo messages.lo collate.lo \
misc-inst.lo stdexcept.lo stl-inst.lo string-inst.lo strstream.lo \
valarray-inst.lo wstring-inst.lo
locale.lo locale-inst.lo localename.lo collate.lo messages.lo \
moneypunct.lo numpunct.lo misc-inst.lo stdexcept.lo stl-inst.lo \
string-inst.lo strstream.lo valarray-inst.lo wstring-inst.lo
CXXFLAGS = @CXXFLAGS@
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)

View file

@ -0,0 +1,53 @@
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001 Free Software Foundation
//
// 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.
// 22.2.1.5 Template class codecvt
#include <locale>
void test01()
{
// Check for required base class.
typedef std::codecvt<char, char, mbstate_t> test_type;
typedef std::locale::facet base_type;
const test_type& obj = std::use_facet<test_type>(std::locale());
const base_type* base = &obj;
// Check for required typedefs
typedef test_type::intern_type intern_type;
typedef test_type::extern_type extern_type;
typedef test_type::state_type state_type;
}
// Should be able to instantiate this for other types besides char, wchar_t
class gnu_codecvt: public std::codecvt<unsigned char, unsigned long, char>
{ };
void test02()
{
gnu_codecvt facet01;
}
int main()
{
test01();
test02();
return 0;
}

View file

@ -0,0 +1,53 @@
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001 Free Software Foundation
//
// 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.
// 22.2.6.2 Template class money_put
#include <locale>
void test01()
{
// Check for required base class.
typedef std::money_put<char> test_type;
typedef std::locale::facet base_type;
const test_type& obj = std::use_facet<test_type>(std::locale());
const base_type* base = &obj;
// Check for required typedefs
typedef test_type::char_type char_type;
typedef test_type::string_type string_type;
typedef test_type::iter_type iter_type;
}
// Should be able to instantiate this for other types besides char, wchar_t
class gnu_money_put: public std::money_put<unsigned char>
{ };
void test02()
{
gnu_money_put facet01;
}
int main()
{
test01();
test02();
return 0;
}

View file

@ -0,0 +1,73 @@
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001 Free Software Foundation
//
// 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.
// 22.2.6.2.1 money_put members
#include <locale>
#include <testsuite_hooks.h>
// XXX This test is not working for non-glibc locale models.
// { dg-do run { xfail *-*-* } }
void test01()
{
using namespace std;
typedef money_base::part part;
typedef money_base::pattern pattern;
bool test = true;
string str;
// basic construction
locale loc_c = locale::classic();
str = loc_c.name();
locale loc_us("en_US");
str = loc_us.name();
VERIFY( loc_c != loc_us );
locale loc_fr("fr_FR");
str = loc_fr.name();
VERIFY( loc_c != loc_fr );
locale loc_de("de_DE");
str = loc_de.name();
VERIFY( loc_c != loc_de );
VERIFY( loc_us != loc_fr );
VERIFY( loc_us != loc_de );
VERIFY( loc_de != loc_fr );
// cache the money_put facets
const money_put<char>& monp_c = use_facet<money_put<char> >(loc_c);
const money_put<char>& monp_us = use_facet<money_put<char> >(loc_us);
const money_put<char>& monp_fr = use_facet<money_put<char> >(loc_fr);
const money_put<char>& monp_de = use_facet<money_put<char> >(loc_de);
// sanity check the data is correct.
// VERIFY( dp1 != dp2 );
}
int main()
{
test01();
return 0;
}