mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-13 22:35:06 +08:00
6aa43d99a3
2002-12-16 Benjamin Kosnik <bkoz@redhat.com> * configure.in (GLIBCPP_ENABLE_DEBUG): Default to none. Call GLIBCPP_ENABLE_DEBUG_FLAGS. * acinclude.m4 (GLIBCPP_ENABLE_DEBUG): GLIBCPP_BUILD_DEBUG, new conditional if --enable-debug is yes. Rework. (GLIBCPP_ENABLE_DEBUG_FLAGS): New. * aclocal.m4: Regenerate. * libio/Makefile.am: Remove DEBUG_FLAGS. * libio/Makefile.in: Regenerate. * libsupc++/Makefile.am: Remove DEBUG_FLAGS. * libsupc++/Makefile.in: Regenerate. * docs/html/configopts.html: Add docs for --enable-debug, --enable-debug-flags. 2002-12-16 Benjamin Kosnik <bkoz@redhat.com> Correct dependency tracking, build warts. * configure.in: Correct repeated AC_OUTPUT thrashing by config-ml.in * configure: Regenerate. * include/Makefile.am (stamp-target): Stamp in top_builddir. * include/Makefile.in: Regenerate. * src/Makefile.am (codecvt_members.cc): New rule. (collate_members.cc): Same. (ctype_members.cc): Same. (messages_members.cc): Same. (monetary_members.cc): Same. (numeric_members.cc): Same. (time_members.cc): Same. (c++locale.cc): Same. (basic_file.cc): Same. * src/Makefile.in: Regenerate. * acinclude.m4 (CCTYPE_CHAR_CC): Remove. (CCCODECVT_CC): Don't link, AC_SUBST. (CCOLLATE_CC): Same. (CCTYPE_CC): Same. (CMESSAGES_CC): Same. (CMONEY_CC): Same. (CNUMERIC_CC): Same. (CTIME_CC): Same. (CLOCALE_CC): Same. * aclocal.m4: Regenerate. * src/Makefile.am (libstdc___la_LIBADD): Use top_builddir for convenience libraries. (version_arg): Rename linker.map to libstdc++.ver. (libstdc___la_DEPENDENCIES): Remove linker.map, add libstdc++-symbol.ver as a dependency. (libstdc++-symbol.ver): Add rule. * acinclude.m4 (GLIBCPP_ENABLE_SYMVERS): Change LINKER_MAP to SYMVER_MAP. Don't link, AC_SUBST. * include/Makefile.am (target_headers_noinst): New. (stamp-target): Add CLOCALE_INTERNAL_H. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): Don't link CLOCALE_INTERNAL_H, AC_SUBST. * config/locale/gnu/c_locale.cc: Modify c++locale_internal.h include. * config/locale/gnu/time_members.cc: Same. * config/locale/gnu/numeric_members.cc: Same. * config/locale/gnu/monetary_members.cc: Same. * config/locale/gnu/messages_members.cc: Same. * config/locale/gnu/ctype_members.cc: Same. * config/locale/gnu/collate_members.cc: Same. * config/locale/gnu/codecvt_members.cc: Same. * config/locale/generic/codecvt_members.cc: Remove. From-SVN: r60177
114 lines
3.5 KiB
C++
114 lines
3.5 KiB
C++
// std::codecvt implementation details, GNU version -*- 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.
|
|
|
|
//
|
|
// ISO C++ 14882: 22.2.1.5 - Template class codecvt
|
|
//
|
|
|
|
// Written by Benjamin Kosnik <bkoz@redhat.com>
|
|
|
|
#include <locale>
|
|
#include <bits/c++locale_internal.h>
|
|
|
|
namespace std
|
|
{
|
|
// Specializations.
|
|
#ifdef _GLIBCPP_USE_WCHAR_T
|
|
codecvt_base::result
|
|
codecvt<wchar_t, char, mbstate_t>::
|
|
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;
|
|
size_t __len = std::min(__from_end - __from, __to_end - __to);
|
|
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
|
|
__c_locale __old = __uselocale(_M_c_locale_codecvt);
|
|
#endif
|
|
size_t __conv = wcsrtombs(__to, &__from, __len, &__state);
|
|
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
|
|
__uselocale(__old);
|
|
#endif
|
|
|
|
if (__conv == __len)
|
|
{
|
|
__from_next = __from;
|
|
__to_next = __to + __conv;
|
|
__ret = ok;
|
|
}
|
|
else if (__conv > 0 && __conv < __len)
|
|
{
|
|
__from_next = __from;
|
|
__to_next = __to + __conv;
|
|
__ret = partial;
|
|
}
|
|
else
|
|
__ret = error;
|
|
|
|
return __ret;
|
|
}
|
|
|
|
codecvt_base::result
|
|
codecvt<wchar_t, char, mbstate_t>::
|
|
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;
|
|
size_t __len = std::min(__from_end - __from, __to_end - __to);
|
|
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
|
|
__c_locale __old = __uselocale(_M_c_locale_codecvt);
|
|
#endif
|
|
size_t __conv = mbsrtowcs(__to, &__from, __len, &__state);
|
|
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
|
|
__uselocale(__old);
|
|
#endif
|
|
|
|
if (__conv == __len)
|
|
{
|
|
__from_next = __from;
|
|
__to_next = __to + __conv;
|
|
__ret = ok;
|
|
}
|
|
else if (__conv > 0 && __conv < __len)
|
|
{
|
|
__from_next = __from;
|
|
__to_next = __to + __conv;
|
|
__ret = partial;
|
|
}
|
|
else
|
|
__ret = error;
|
|
|
|
return __ret;
|
|
}
|
|
#endif
|
|
}
|