re PR libstdc++/7230 (<strstream> header file is missing (trunk))

2002-07-24  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/7230
	* config/linker-map.gnu: Revert strstream patch from 2002-07-01.
	* include/Makefile.am (backward_headers): Use strstream, not
	strstream.h.
	* include/Makefile.in: Regenerate.
	* include/backward/strstream: Revert.
	* include/backward/strstream.h: Remove.
	* src/strstream.cc: Revert.
	* testsuite/backward/strstream_members.cc: Change include.

From-SVN: r55730
This commit is contained in:
Benjamin Kosnik 2002-07-25 00:04:37 +00:00 committed by Benjamin Kosnik
parent 8d1b7ba13b
commit 9a56333e55
10 changed files with 2039 additions and 1731 deletions

View File

@ -1,10 +1,22 @@
2002-07-24 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/7230
* config/linker-map.gnu: Revert strstream patch from 2002-07-01.
* include/Makefile.am (backward_headers): Use strstream, not
strstream.h.
* include/Makefile.in: Regenerate.
* include/backward/strstream: Revert.
* include/backward/strstream.h: Remove.
* src/strstream.cc: Revert.
* testsuite/backward/strstream_members.cc: Change include.
2002-07-24 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/7219
* testsuite/27_io/ios_base_type.cc: New.
* include/bits/ios_base.h (ios_base::streampos): Add.
(ios_base::streamoff): Add.
* testsuite/27_io/ios_base_type.cc: New.
2002-07-24 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/7286

View File

@ -1,6 +1,6 @@
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@ -2201,12 +2201,37 @@ AC_MSG_RESULT($enable_symvers)
])
# isc-posix.m4 serial 1 (gettext-0.10.40)
dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
# This test replaces the one in autoconf.
# Currently this macro should have the same name as the autoconf macro
# because gettext's gettext.m4 (distributed in the automake package)
# still uses it. Otherwise, the use in gettext.m4 makes autoheader
# give these diagnostics:
# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
undefine([AC_ISC_POSIX])
AC_DEFUN([AC_ISC_POSIX],
[
dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
]
)
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
# serial 1
AC_DEFUN(AM_MAINTAINER_MODE,
AC_DEFUN([AM_MAINTAINER_MODE],
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
@ -2223,7 +2248,7 @@ AC_DEFUN(AM_MAINTAINER_MODE,
# Define a conditional.
AC_DEFUN(AM_CONDITIONAL,
AC_DEFUN([AM_CONDITIONAL],
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
@ -2243,7 +2268,7 @@ fi])
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN(AM_INIT_AUTOMAKE,
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
@ -2271,7 +2296,7 @@ AC_REQUIRE([AC_PROG_MAKE_SET])])
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
@ -2312,7 +2337,7 @@ AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG,
AC_DEFUN([AM_MISSING_PROG],
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
@ -2328,7 +2353,7 @@ AC_SUBST($1)])
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN(AM_CONFIG_HEADER,
AC_DEFUN([AM_CONFIG_HEADER],
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.

View File

@ -38,11 +38,7 @@ GLIBCPP_3.1 {
std::_S_bit_count;
std::_S_first_one;
std::__default_alloc_template*;
std::__malloc_alloc_template*;
strstreambuf::*;
istrstream::*;
ostrstream::*;
strstream::*
std::__malloc_alloc_template*
};
# Names not in an 'extern' block are mangled names.

2464
libstdc++-v3/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -137,7 +137,7 @@ backward_headers = \
${backward_srcdir}/tree.h \
${backward_srcdir}/vector.h \
${backward_srcdir}/fstream.h \
${backward_srcdir}/strstream.h \
${backward_srcdir}/strstream \
${backward_srcdir}/backward_warning.h
ext_srcdir = ${glibcpp_srcdir}/include/ext

View File

@ -139,59 +139,307 @@ glibcpp_builddir = @glibcpp_builddir@
bits_srcdir = ${glibcpp_srcdir}/include/bits
bits_builddir = ./bits
bits_headers = ${bits_srcdir}/basic_ios.h ${bits_srcdir}/basic_ios.tcc ${bits_srcdir}/basic_string.h ${bits_srcdir}/basic_string.tcc ${bits_srcdir}/boost_concept_check.h ${bits_srcdir}/char_traits.h ${bits_srcdir}/codecvt.h ${bits_srcdir}/concept_check.h ${bits_srcdir}/cpp_type_traits.h ${bits_srcdir}/deque.tcc ${bits_srcdir}/fpos.h ${bits_srcdir}/fstream.tcc ${bits_srcdir}/functexcept.h ${bits_srcdir}/generic_shadow.h ${bits_srcdir}/gslice.h ${bits_srcdir}/gslice_array.h ${bits_srcdir}/indirect_array.h ${bits_srcdir}/ios_base.h ${bits_srcdir}/istream.tcc ${bits_srcdir}/list.tcc ${bits_srcdir}/locale_facets.h ${bits_srcdir}/locale_facets.tcc ${bits_srcdir}/localefwd.h ${bits_srcdir}/mask_array.h ${bits_srcdir}/ostream.tcc ${bits_srcdir}/pthread_allocimpl.h ${bits_srcdir}/stream_iterator.h ${bits_srcdir}/streambuf_iterator.h ${bits_srcdir}/slice_array.h ${bits_srcdir}/sstream.tcc ${bits_srcdir}/stl_algo.h ${bits_srcdir}/stl_algobase.h ${bits_srcdir}/stl_alloc.h ${bits_srcdir}/stl_bvector.h ${bits_srcdir}/stl_construct.h ${bits_srcdir}/stl_deque.h ${bits_srcdir}/stl_function.h ${bits_srcdir}/stl_heap.h ${bits_srcdir}/stl_iterator.h ${bits_srcdir}/stl_iterator_base_funcs.h ${bits_srcdir}/stl_iterator_base_types.h ${bits_srcdir}/stl_list.h ${bits_srcdir}/stl_map.h ${bits_srcdir}/stl_multimap.h ${bits_srcdir}/stl_multiset.h ${bits_srcdir}/stl_numeric.h ${bits_srcdir}/stl_pair.h ${bits_srcdir}/stl_pthread_alloc.h ${bits_srcdir}/stl_queue.h ${bits_srcdir}/stl_raw_storage_iter.h ${bits_srcdir}/stl_relops.h ${bits_srcdir}/stl_set.h ${bits_srcdir}/stl_stack.h ${bits_srcdir}/stl_tempbuf.h ${bits_srcdir}/stl_threads.h ${bits_srcdir}/stl_tree.h ${bits_srcdir}/stl_uninitialized.h ${bits_srcdir}/stl_vector.h ${bits_srcdir}/streambuf.tcc ${bits_srcdir}/stringfwd.h ${bits_srcdir}/type_traits.h ${bits_srcdir}/valarray_array.h ${bits_srcdir}/valarray_array.tcc ${bits_srcdir}/valarray_meta.h ${bits_srcdir}/vector.tcc
bits_headers = \
${bits_srcdir}/basic_ios.h \
${bits_srcdir}/basic_ios.tcc \
${bits_srcdir}/basic_string.h \
${bits_srcdir}/basic_string.tcc \
${bits_srcdir}/boost_concept_check.h \
${bits_srcdir}/char_traits.h \
${bits_srcdir}/codecvt.h \
${bits_srcdir}/concept_check.h \
${bits_srcdir}/cpp_type_traits.h \
${bits_srcdir}/deque.tcc \
${bits_srcdir}/fpos.h \
${bits_srcdir}/fstream.tcc \
${bits_srcdir}/functexcept.h \
${bits_srcdir}/generic_shadow.h \
${bits_srcdir}/gslice.h \
${bits_srcdir}/gslice_array.h \
${bits_srcdir}/indirect_array.h \
${bits_srcdir}/ios_base.h \
${bits_srcdir}/istream.tcc \
${bits_srcdir}/list.tcc \
${bits_srcdir}/locale_facets.h \
${bits_srcdir}/locale_facets.tcc \
${bits_srcdir}/localefwd.h \
${bits_srcdir}/mask_array.h \
${bits_srcdir}/ostream.tcc \
${bits_srcdir}/pthread_allocimpl.h \
${bits_srcdir}/stream_iterator.h \
${bits_srcdir}/streambuf_iterator.h \
${bits_srcdir}/slice_array.h \
${bits_srcdir}/sstream.tcc \
${bits_srcdir}/stl_algo.h \
${bits_srcdir}/stl_algobase.h \
${bits_srcdir}/stl_alloc.h \
${bits_srcdir}/stl_bvector.h \
${bits_srcdir}/stl_construct.h \
${bits_srcdir}/stl_deque.h \
${bits_srcdir}/stl_function.h \
${bits_srcdir}/stl_heap.h \
${bits_srcdir}/stl_iterator.h \
${bits_srcdir}/stl_iterator_base_funcs.h \
${bits_srcdir}/stl_iterator_base_types.h \
${bits_srcdir}/stl_list.h \
${bits_srcdir}/stl_map.h \
${bits_srcdir}/stl_multimap.h \
${bits_srcdir}/stl_multiset.h \
${bits_srcdir}/stl_numeric.h \
${bits_srcdir}/stl_pair.h \
${bits_srcdir}/stl_pthread_alloc.h \
${bits_srcdir}/stl_queue.h \
${bits_srcdir}/stl_raw_storage_iter.h \
${bits_srcdir}/stl_relops.h \
${bits_srcdir}/stl_set.h \
${bits_srcdir}/stl_stack.h \
${bits_srcdir}/stl_tempbuf.h \
${bits_srcdir}/stl_threads.h \
${bits_srcdir}/stl_tree.h \
${bits_srcdir}/stl_uninitialized.h \
${bits_srcdir}/stl_vector.h \
${bits_srcdir}/streambuf.tcc \
${bits_srcdir}/stringfwd.h \
${bits_srcdir}/type_traits.h \
${bits_srcdir}/valarray_array.h \
${bits_srcdir}/valarray_array.tcc \
${bits_srcdir}/valarray_meta.h \
${bits_srcdir}/vector.tcc
backward_srcdir = ${glibcpp_srcdir}/include/backward
backward_builddir = ./backward
backward_headers = ${backward_srcdir}/complex.h ${backward_srcdir}/iomanip.h ${backward_srcdir}/istream.h ${backward_srcdir}/ostream.h ${backward_srcdir}/stream.h ${backward_srcdir}/streambuf.h ${backward_srcdir}/algo.h ${backward_srcdir}/algobase.h ${backward_srcdir}/alloc.h ${backward_srcdir}/bvector.h ${backward_srcdir}/defalloc.h ${backward_srcdir}/deque.h ${backward_srcdir}/function.h ${backward_srcdir}/hash_map.h ${backward_srcdir}/hash_set.h ${backward_srcdir}/hashtable.h ${backward_srcdir}/heap.h ${backward_srcdir}/iostream.h ${backward_srcdir}/iterator.h ${backward_srcdir}/list.h ${backward_srcdir}/map.h ${backward_srcdir}/multimap.h ${backward_srcdir}/new.h ${backward_srcdir}/multiset.h ${backward_srcdir}/pair.h ${backward_srcdir}/queue.h ${backward_srcdir}/rope.h ${backward_srcdir}/set.h ${backward_srcdir}/slist.h ${backward_srcdir}/stack.h ${backward_srcdir}/tempbuf.h ${backward_srcdir}/tree.h ${backward_srcdir}/vector.h ${backward_srcdir}/fstream.h ${backward_srcdir}/strstream.h ${backward_srcdir}/backward_warning.h
backward_headers = \
${backward_srcdir}/complex.h \
${backward_srcdir}/iomanip.h \
${backward_srcdir}/istream.h \
${backward_srcdir}/ostream.h \
${backward_srcdir}/stream.h \
${backward_srcdir}/streambuf.h \
${backward_srcdir}/algo.h \
${backward_srcdir}/algobase.h \
${backward_srcdir}/alloc.h \
${backward_srcdir}/bvector.h \
${backward_srcdir}/defalloc.h \
${backward_srcdir}/deque.h \
${backward_srcdir}/function.h \
${backward_srcdir}/hash_map.h \
${backward_srcdir}/hash_set.h \
${backward_srcdir}/hashtable.h \
${backward_srcdir}/heap.h \
${backward_srcdir}/iostream.h \
${backward_srcdir}/iterator.h \
${backward_srcdir}/list.h \
${backward_srcdir}/map.h \
${backward_srcdir}/multimap.h \
${backward_srcdir}/new.h \
${backward_srcdir}/multiset.h \
${backward_srcdir}/pair.h \
${backward_srcdir}/queue.h \
${backward_srcdir}/rope.h \
${backward_srcdir}/set.h \
${backward_srcdir}/slist.h \
${backward_srcdir}/stack.h \
${backward_srcdir}/tempbuf.h \
${backward_srcdir}/tree.h \
${backward_srcdir}/vector.h \
${backward_srcdir}/fstream.h \
${backward_srcdir}/strstream \
${backward_srcdir}/backward_warning.h
ext_srcdir = ${glibcpp_srcdir}/include/ext
ext_builddir = ./ext
ext_headers = ${ext_srcdir}/algorithm ${ext_srcdir}/enc_filebuf.h ${ext_srcdir}/stdio_filebuf.h ${ext_srcdir}/functional ${ext_srcdir}/hash_map ${ext_srcdir}/hash_set ${ext_srcdir}/iterator ${ext_srcdir}/memory ${ext_srcdir}/numeric ${ext_srcdir}/rb_tree ${ext_srcdir}/rope ${ext_srcdir}/ropeimpl.h ${ext_srcdir}/slist ${ext_srcdir}/stl_hash_fun.h ${ext_srcdir}/stl_hashtable.h ${ext_srcdir}/stl_rope.h
ext_headers = \
${ext_srcdir}/algorithm \
${ext_srcdir}/enc_filebuf.h \
${ext_srcdir}/stdio_filebuf.h \
${ext_srcdir}/functional \
${ext_srcdir}/hash_map \
${ext_srcdir}/hash_set \
${ext_srcdir}/iterator \
${ext_srcdir}/memory \
${ext_srcdir}/numeric \
${ext_srcdir}/rb_tree \
${ext_srcdir}/rope \
${ext_srcdir}/ropeimpl.h \
${ext_srcdir}/slist \
${ext_srcdir}/stl_hash_fun.h \
${ext_srcdir}/stl_hashtable.h \
${ext_srcdir}/stl_rope.h
# This is the common subset of files that all three "C" header models use.
c_base_srcdir = @C_INCLUDE_DIR@
c_base_builddir = .
c_base_headers = ${c_base_srcdir}/std_cassert.h ${c_base_srcdir}/std_cctype.h ${c_base_srcdir}/std_cerrno.h ${c_base_srcdir}/std_cfloat.h ${c_base_srcdir}/std_ciso646.h ${c_base_srcdir}/std_climits.h ${c_base_srcdir}/std_clocale.h ${c_base_srcdir}/std_cmath.h ${c_base_srcdir}/std_csetjmp.h ${c_base_srcdir}/std_csignal.h ${c_base_srcdir}/std_cstdarg.h ${c_base_srcdir}/std_cstddef.h ${c_base_srcdir}/std_cstdio.h ${c_base_srcdir}/std_cstdlib.h ${c_base_srcdir}/std_cstring.h ${c_base_srcdir}/std_ctime.h ${c_base_srcdir}/std_cwchar.h ${c_base_srcdir}/std_cwctype.h
c_base_headers = \
${c_base_srcdir}/std_cassert.h \
${c_base_srcdir}/std_cctype.h \
${c_base_srcdir}/std_cerrno.h \
${c_base_srcdir}/std_cfloat.h \
${c_base_srcdir}/std_ciso646.h \
${c_base_srcdir}/std_climits.h \
${c_base_srcdir}/std_clocale.h \
${c_base_srcdir}/std_cmath.h \
${c_base_srcdir}/std_csetjmp.h \
${c_base_srcdir}/std_csignal.h \
${c_base_srcdir}/std_cstdarg.h \
${c_base_srcdir}/std_cstddef.h \
${c_base_srcdir}/std_cstdio.h \
${c_base_srcdir}/std_cstdlib.h \
${c_base_srcdir}/std_cstring.h \
${c_base_srcdir}/std_ctime.h \
${c_base_srcdir}/std_cwchar.h \
${c_base_srcdir}/std_cwctype.h
c_base_headers_rename = cassert cctype cerrno cfloat ciso646 climits clocale cmath csetjmp csignal cstdarg cstddef cstdio cstdlib cstring ctime cwchar cwctype
c_base_headers_rename = \
cassert \
cctype \
cerrno \
cfloat \
ciso646 \
climits \
clocale \
cmath \
csetjmp \
csignal \
cstdarg \
cstddef \
cstdio \
cstdlib \
cstring \
ctime \
cwchar \
cwctype
# "C" compatibility headers.
c_compatibility_srcdir = ${glibcpp_srcdir}/include/c_compatibility
c_compatibility_builddir = .
c_compatibility_headers = ${c_compatibility_srcdir}/assert.h ${c_compatibility_srcdir}/ctype.h ${c_compatibility_srcdir}/errno.h ${c_compatibility_srcdir}/float.h ${c_compatibility_srcdir}/iso646.h ${c_compatibility_srcdir}/limits.h ${c_compatibility_srcdir}/locale.h ${c_compatibility_srcdir}/math.h ${c_compatibility_srcdir}/setjmp.h ${c_compatibility_srcdir}/signal.h ${c_compatibility_srcdir}/stdarg.h ${c_compatibility_srcdir}/stddef.h ${c_compatibility_srcdir}/stdio.h ${c_compatibility_srcdir}/stdlib.h ${c_compatibility_srcdir}/string.h ${c_compatibility_srcdir}/time.h ${c_compatibility_srcdir}/wchar.h ${c_compatibility_srcdir}/wctype.h
c_compatibility_headers = \
${c_compatibility_srcdir}/assert.h \
${c_compatibility_srcdir}/ctype.h \
${c_compatibility_srcdir}/errno.h \
${c_compatibility_srcdir}/float.h \
${c_compatibility_srcdir}/iso646.h \
${c_compatibility_srcdir}/limits.h \
${c_compatibility_srcdir}/locale.h \
${c_compatibility_srcdir}/math.h \
${c_compatibility_srcdir}/setjmp.h \
${c_compatibility_srcdir}/signal.h \
${c_compatibility_srcdir}/stdarg.h \
${c_compatibility_srcdir}/stddef.h \
${c_compatibility_srcdir}/stdio.h \
${c_compatibility_srcdir}/stdlib.h \
${c_compatibility_srcdir}/string.h \
${c_compatibility_srcdir}/time.h \
${c_compatibility_srcdir}/wchar.h \
${c_compatibility_srcdir}/wctype.h
@GLIBCPP_C_HEADERS_C_STD_TRUE@c_base_headers_extra = ${c_base_srcdir}/cmath.tcc
@GLIBCPP_C_HEADERS_C_STD_TRUE@c_base_headers_extra = @GLIBCPP_C_HEADERS_C_STD_TRUE@${c_base_srcdir}/cmath.tcc
@GLIBCPP_C_HEADERS_C_STD_FALSE@c_base_headers_extra =
@GLIBCPP_C_HEADERS_COMPATIBILITY_TRUE@c_compatibility_headers_extra = ${c_compatibility_headers}
@GLIBCPP_C_HEADERS_COMPATIBILITY_TRUE@c_compatibility_headers_extra = @GLIBCPP_C_HEADERS_COMPATIBILITY_TRUE@${c_compatibility_headers}
@GLIBCPP_C_HEADERS_COMPATIBILITY_FALSE@c_compatibility_headers_extra =
std_srcdir = ${glibcpp_srcdir}/include/std
std_builddir = .
std_headers = ${std_srcdir}/std_algorithm.h ${std_srcdir}/std_bitset.h ${std_srcdir}/std_complex.h ${std_srcdir}/std_deque.h ${std_srcdir}/std_fstream.h ${std_srcdir}/std_functional.h ${std_srcdir}/std_iomanip.h ${std_srcdir}/std_ios.h ${std_srcdir}/std_iosfwd.h ${std_srcdir}/std_iostream.h ${std_srcdir}/std_istream.h ${std_srcdir}/std_iterator.h ${std_srcdir}/std_limits.h ${std_srcdir}/std_list.h ${std_srcdir}/std_locale.h ${std_srcdir}/std_map.h ${std_srcdir}/std_memory.h ${std_srcdir}/std_numeric.h ${std_srcdir}/std_ostream.h ${std_srcdir}/std_queue.h ${std_srcdir}/std_set.h ${std_srcdir}/std_sstream.h ${std_srcdir}/std_stack.h ${std_srcdir}/std_stdexcept.h ${std_srcdir}/std_streambuf.h ${std_srcdir}/std_string.h ${std_srcdir}/std_utility.h ${std_srcdir}/std_valarray.h ${std_srcdir}/std_vector.h
std_headers = \
${std_srcdir}/std_algorithm.h \
${std_srcdir}/std_bitset.h \
${std_srcdir}/std_complex.h \
${std_srcdir}/std_deque.h \
${std_srcdir}/std_fstream.h \
${std_srcdir}/std_functional.h \
${std_srcdir}/std_iomanip.h \
${std_srcdir}/std_ios.h \
${std_srcdir}/std_iosfwd.h \
${std_srcdir}/std_iostream.h \
${std_srcdir}/std_istream.h \
${std_srcdir}/std_iterator.h \
${std_srcdir}/std_limits.h \
${std_srcdir}/std_list.h \
${std_srcdir}/std_locale.h \
${std_srcdir}/std_map.h \
${std_srcdir}/std_memory.h \
${std_srcdir}/std_numeric.h \
${std_srcdir}/std_ostream.h \
${std_srcdir}/std_queue.h \
${std_srcdir}/std_set.h \
${std_srcdir}/std_sstream.h \
${std_srcdir}/std_stack.h \
${std_srcdir}/std_stdexcept.h \
${std_srcdir}/std_streambuf.h \
${std_srcdir}/std_string.h \
${std_srcdir}/std_utility.h \
${std_srcdir}/std_valarray.h \
${std_srcdir}/std_vector.h
# Renamed at build time.
std_headers_rename = algorithm bitset complex deque fstream functional iomanip ios iosfwd iostream istream iterator limits list locale map memory numeric ostream queue set sstream stack stdexcept streambuf string utility valarray vector
std_headers_rename = \
algorithm \
bitset \
complex \
deque \
fstream \
functional \
iomanip \
ios \
iosfwd \
iostream \
istream \
iterator \
limits \
list \
locale \
map \
memory \
numeric \
ostream \
queue \
set \
sstream \
stack \
stdexcept \
streambuf \
string \
utility \
valarray \
vector
target_srcdir = ${glibcpp_srcdir}/@OS_INC_SRCDIR@
target_builddir = ./${target_alias}/bits
target_headers = ${target_srcdir}/ctype_base.h ${target_srcdir}/ctype_inline.h ${target_srcdir}/ctype_noninline.h ${target_srcdir}/os_defines.h ${glibcpp_srcdir}/@ATOMICITY_INC_SRCDIR@/atomicity.h ${glibcpp_srcdir}/@CPU_LIMITS_INC_SRCDIR@/cpu_limits.h
target_headers = \
${target_srcdir}/ctype_base.h \
${target_srcdir}/ctype_inline.h \
${target_srcdir}/ctype_noninline.h \
${target_srcdir}/os_defines.h \
${glibcpp_srcdir}/@ATOMICITY_INC_SRCDIR@/atomicity.h \
${glibcpp_srcdir}/@CPU_LIMITS_INC_SRCDIR@/cpu_limits.h
# These target_headers_extra files are all built with ad hoc naming rules.
target_headers_extra = ${target_builddir}/basic_file.h ${target_builddir}/c++config.h ${target_builddir}/c++io.h ${target_builddir}/c++locale.h ${target_builddir}/messages_members.h ${target_builddir}/codecvt_specializations.h
target_headers_extra = \
${target_builddir}/basic_file.h \
${target_builddir}/c++config.h \
${target_builddir}/c++io.h \
${target_builddir}/c++locale.h \
${target_builddir}/messages_members.h \
${target_builddir}/codecvt_specializations.h
thread_target_headers = ${target_builddir}/gthr.h ${target_builddir}/gthr-single.h ${target_builddir}/gthr-posix.h ${target_builddir}/gthr-default.h
thread_target_headers = \
${target_builddir}/gthr.h \
${target_builddir}/gthr-single.h \
${target_builddir}/gthr-posix.h \
${target_builddir}/gthr-default.h
# List of all timestamp files. By keeping only one copy of this list, both
# CLEANFILES and all-local are kept up-to-date.
allstamps = stamp-std stamp-bits stamp-c_base stamp-c_compatibility stamp-backward stamp-ext ${target_builddir}/stamp-target
allstamps = \
stamp-std stamp-bits stamp-c_base stamp-c_compatibility \
stamp-backward stamp-ext \
${target_builddir}/stamp-target
# Target includes for threads
@ -214,7 +462,7 @@ DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
TAR = gtar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:

View File

@ -0,0 +1,174 @@
// Backward-compat support -*- C++ -*-
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// 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.
/*
* Copyright (c) 1998
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
// WARNING: The classes defined in this header are DEPRECATED. This
// header is defined in section D.7.1 of the C++ standard, and it
// MAY BE REMOVED in a future standard revision. You should use the
// header <sstream> instead.
#ifndef __SGI_STL_STRSTREAM
#define __SGI_STL_STRSTREAM
#include "backward_warning.h"
#include <iosfwd>
#include <ios>
#include <istream>
#include <ostream>
#include <string>
namespace std
{
// Class strstreambuf, a streambuf class that manages an array of char.
// Note that this class is not a template.
class strstreambuf : public basic_streambuf<char, char_traits<char> >
{
public:
// Types.
typedef char_traits<char> _Traits;
typedef basic_streambuf<char, _Traits> _Base;
public:
// Constructor, destructor
explicit strstreambuf(streamsize __initial_capacity = 0);
strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));
strstreambuf(char* __get, streamsize __n, char* __put = 0);
strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0);
strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0);
strstreambuf(const char* __get, streamsize __n);
strstreambuf(const signed char* __get, streamsize __n);
strstreambuf(const unsigned char* __get, streamsize __n);
virtual ~strstreambuf();
public:
void freeze(bool = true);
char* str();
int pcount() const;
protected:
virtual int_type overflow(int_type __c = _Traits::eof());
virtual int_type pbackfail(int_type __c = _Traits::eof());
virtual int_type underflow();
virtual _Base* setbuf(char* __buf, streamsize __n);
virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
ios_base::openmode __mode
= ios_base::in | ios_base::out);
virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
= ios_base::in | ios_base::out);
private:
// Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
char* _M_alloc(size_t);
void _M_free(char*);
// Helper function used in constructors.
void _M_setup(char* __get, char* __put, streamsize __n);
private:
// Data members.
void* (*_M_alloc_fun)(size_t);
void (*_M_free_fun)(void*);
bool _M_dynamic : 1;
bool _M_frozen : 1;
bool _M_constant : 1;
};
// Class istrstream, an istream that manages a strstreambuf.
class istrstream : public basic_istream<char>
{
public:
explicit istrstream(char*);
explicit istrstream(const char*);
istrstream(char* , streamsize);
istrstream(const char*, streamsize);
virtual ~istrstream();
strstreambuf* rdbuf() const;
char* str();
private:
strstreambuf _M_buf;
};
// Class ostrstream
class ostrstream : public basic_ostream<char>
{
public:
ostrstream();
ostrstream(char*, int, ios_base::openmode = ios_base::out);
virtual ~ostrstream();
strstreambuf* rdbuf() const;
void freeze(bool = true);
char* str();
int pcount() const;
private:
strstreambuf _M_buf;
};
// Class strstream
class strstream : public basic_iostream<char>
{
public:
typedef char char_type;
typedef char_traits<char>::int_type int_type;
typedef char_traits<char>::pos_type pos_type;
typedef char_traits<char>::off_type off_type;
strstream();
strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
virtual ~strstream();
strstreambuf* rdbuf() const;
void freeze(bool = true);
int pcount() const;
char* str();
private:
strstreambuf _M_buf;
};
} // namespace std
#endif

View File

@ -1,174 +0,0 @@
// Backward-compat support -*- C++ -*-
// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// 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.
/*
* Copyright (c) 1998
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
// WARNING: The classes defined in this header are DEPRECATED. This
// header is defined in section D.7.1 of the C++ standard, and it
// MAY BE REMOVED in a future standard revision. You should use the
// header <sstream> instead.
#ifndef _CPP_BACKWARD_STRSTREAM_H
#define _CPP_BACKWARD_STRSTREAM_H 1
#include "backward_warning.h"
#include <iosfwd>
#include <ios>
#include <istream>
#include <ostream>
#include <string>
// Class strstreambuf, a streambuf class that manages an array of char.
// Note that this class is not a template.
class strstreambuf : public std::basic_streambuf<char>
{
public:
// Types.
typedef std::char_traits<char> _Traits;
typedef std::basic_streambuf<char, _Traits> _Base;
public:
// Constructor, destructor
explicit strstreambuf(std::streamsize __initial_capacity = 0);
strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));
strstreambuf(char* __get, std::streamsize __n, char* __put = 0);
strstreambuf(signed char* __get, std::streamsize __n,
signed char* __put = 0);
strstreambuf(unsigned char* __get, std::streamsize __n,
unsigned char* __put=0);
strstreambuf(const char* __get, std::streamsize __n);
strstreambuf(const signed char* __get, std::streamsize __n);
strstreambuf(const unsigned char* __get, std::streamsize __n);
virtual ~strstreambuf();
public:
void freeze(bool = true);
char* str();
int pcount() const;
protected:
virtual int_type overflow(int_type __c = _Traits::eof());
virtual int_type pbackfail(int_type __c = _Traits::eof());
virtual int_type underflow();
virtual _Base* setbuf(char* __buf, std::streamsize __n);
virtual pos_type seekoff(off_type __off, std::ios_base::seekdir __dir,
std::ios_base::openmode __mode
= std::ios_base::in | std::ios_base::out);
virtual pos_type seekpos(pos_type __pos, std::ios_base::openmode __mode
= std::ios_base::in | std::ios_base::out);
private:
// Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
char* _M_alloc(size_t);
void _M_free(char*);
// Helper function used in constructors.
void _M_setup(char* __get, char* __put, std::streamsize __n);
private:
// Data members.
void* (*_M_alloc_fun)(size_t);
void (*_M_free_fun)(void*);
bool _M_dynamic : 1;
bool _M_frozen : 1;
bool _M_constant : 1;
};
// Class istrstream, an istream that manages a strstreambuf.
class istrstream : public std::basic_istream<char>
{
public:
explicit istrstream(char*);
explicit istrstream(const char*);
istrstream(char* , std::streamsize);
istrstream(const char*, std::streamsize);
virtual ~istrstream();
strstreambuf* rdbuf() const;
char* str();
private:
strstreambuf _M_buf;
};
// Class ostrstream
class ostrstream : public std::basic_ostream<char>
{
public:
ostrstream();
ostrstream(char*, int, std::ios_base::openmode = std::ios_base::out);
virtual ~ostrstream();
strstreambuf* rdbuf() const;
void freeze(bool = true);
char* str();
int pcount() const;
private:
strstreambuf _M_buf;
};
// Class strstream
class strstream : public std::basic_iostream<char>
{
public:
typedef char char_type;
typedef std::char_traits<char>::int_type int_type;
typedef std::char_traits<char>::pos_type pos_type;
typedef std::char_traits<char>::off_type off_type;
strstream();
strstream(char*, int,
std::ios_base::openmode = std::ios_base::in | std::ios_base::out);
virtual ~strstream();
strstreambuf* rdbuf() const;
void freeze(bool = true);
int pcount() const;
char* str();
private:
strstreambuf _M_buf;
};
#endif

View File

@ -47,156 +47,156 @@
// MAY BE REMOVED in a future standard revision. You should use the
// header <sstream> instead.
#include <strstream.h>
#include <strstream>
#include <algorithm>
#include <new>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
using namespace std;
namespace std
{
strstreambuf::strstreambuf(streamsize initial_capacity)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(true),
_M_frozen(false), _M_constant(false)
{
_M_buf_size = _M_buf_size_opt = max(initial_capacity, streamsize(16));
_M_buf = _M_alloc(_M_buf_size);
if (_M_buf)
{
setp(_M_buf, _M_buf + _M_buf_size);
setg(_M_buf, _M_buf, _M_buf);
}
}
strstreambuf::strstreambuf(streamsize initial_capacity)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(true),
strstreambuf::strstreambuf(void* (*alloc_f)(size_t), void (*free_f)(void*))
: _Base(), _M_alloc_fun(alloc_f), _M_free_fun(free_f), _M_dynamic(true),
_M_frozen(false), _M_constant(false)
{
_M_buf_size = _M_buf_size_opt = 16;
_M_buf = _M_alloc(_M_buf_size);
if (_M_buf)
{
setp(_M_buf, _M_buf + _M_buf_size);
setg(_M_buf, _M_buf, _M_buf);
}
}
strstreambuf::strstreambuf(char* get, streamsize n, char* put)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(false)
{ _M_setup(get, put, n); }
strstreambuf::strstreambuf(signed char* get, streamsize n, signed char* put)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(false)
{
_M_buf_size = _M_buf_size_opt = max(initial_capacity, streamsize(16));
_M_buf = _M_alloc(_M_buf_size);
if (_M_buf)
{
setp(_M_buf, _M_buf + _M_buf_size);
setg(_M_buf, _M_buf, _M_buf);
}
}
{ _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n); }
strstreambuf::strstreambuf(void* (*alloc_f)(size_t), void (*free_f)(void*))
: _Base(), _M_alloc_fun(alloc_f), _M_free_fun(free_f), _M_dynamic(true),
_M_frozen(false), _M_constant(false)
{
_M_buf_size = _M_buf_size_opt = 16;
_M_buf = _M_alloc(_M_buf_size);
if (_M_buf)
{
setp(_M_buf, _M_buf + _M_buf_size);
setg(_M_buf, _M_buf, _M_buf);
}
}
strstreambuf::strstreambuf(unsigned char* get, streamsize n,
unsigned char* put)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(false)
{ _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n); }
strstreambuf::strstreambuf(char* get, streamsize n, char* put)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(false)
{ _M_setup(get, put, n); }
strstreambuf::strstreambuf(const char* get, streamsize n)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(true)
{ _M_setup(const_cast<char*>(get), 0, n); }
strstreambuf::strstreambuf(signed char* get, streamsize n, signed char* put)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(false)
{ _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n); }
strstreambuf::strstreambuf(const signed char* get, streamsize n)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(true)
{ _M_setup(reinterpret_cast<char*>(const_cast<signed char*>(get)), 0, n); }
strstreambuf::strstreambuf(unsigned char* get, streamsize n,
unsigned char* put)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(false)
{ _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n); }
strstreambuf::strstreambuf(const unsigned char* get, streamsize n)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(true)
{ _M_setup(reinterpret_cast<char*>(const_cast<unsigned char*>(get)), 0, n); }
strstreambuf::strstreambuf(const char* get, streamsize n)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(true)
{ _M_setup(const_cast<char*>(get), 0, n); }
strstreambuf::~strstreambuf()
{
if (_M_dynamic && !_M_frozen)
{
char* p = this->eback();
_M_free(p);
if (p == _M_buf)
_M_buf = 0;
}
if (_M_buf)
_M_free(_M_buf);
}
strstreambuf::strstreambuf(const signed char* get, streamsize n)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(true)
{ _M_setup(reinterpret_cast<char*>(const_cast<signed char*>(get)), 0, n); }
void
strstreambuf::freeze(bool frozenflag)
{
if (_M_dynamic)
_M_frozen = frozenflag;
}
strstreambuf::strstreambuf(const unsigned char* get, streamsize n)
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(true)
{ _M_setup(reinterpret_cast<char*>(const_cast<unsigned char*>(get)), 0, n); }
char*
strstreambuf::str()
{
freeze(true);
return eback();
}
strstreambuf::~strstreambuf()
{
if (_M_dynamic && !_M_frozen)
{
char* p = this->eback();
_M_free(p);
if (p == _M_buf)
_M_buf = 0;
}
if (_M_buf)
_M_free(_M_buf);
}
int
strstreambuf::pcount() const
{ return pptr() ? pptr() - pbase() : 0; }
void
strstreambuf::freeze(bool frozenflag)
{
if (_M_dynamic)
_M_frozen = frozenflag;
}
char*
strstreambuf::str()
{
freeze(true);
return eback();
}
int
strstreambuf::pcount() const
{ return pptr() ? pptr() - pbase() : 0; }
strstreambuf::int_type
strstreambuf::overflow(int_type c)
{
if (c == traits_type::eof())
return traits_type::not_eof(c);
strstreambuf::int_type
strstreambuf::overflow(int_type c)
{
if (c == traits_type::eof())
return traits_type::not_eof(c);
// Try to expand the buffer.
if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant)
{
ptrdiff_t old_size = epptr() - pbase();
ptrdiff_t new_size = max(2 * old_size, ptrdiff_t(1));
// Try to expand the buffer.
if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant)
{
ptrdiff_t old_size = epptr() - pbase();
ptrdiff_t new_size = max(2 * old_size, ptrdiff_t(1));
char* buf = _M_alloc(new_size);
if (buf)
{
memcpy(buf, pbase(), old_size);
char* old_buffer = pbase();
bool reposition_get = false;
ptrdiff_t old_get_offset;
if (gptr() != 0)
{
reposition_get = true;
old_get_offset = gptr() - eback();
}
char* buf = _M_alloc(new_size);
if (buf)
{
memcpy(buf, pbase(), old_size);
char* old_buffer = pbase();
bool reposition_get = false;
ptrdiff_t old_get_offset;
if (gptr() != 0)
{
reposition_get = true;
old_get_offset = gptr() - eback();
}
_M_buf = buf;
_M_buf_size = _M_buf_size_opt = new_size;
setp(buf, buf + new_size);
pbump(old_size);
_M_buf = buf;
_M_buf_size = _M_buf_size_opt = new_size;
setp(buf, buf + new_size);
pbump(old_size);
if (reposition_get)
setg(buf, buf + old_get_offset, buf +
max(old_get_offset, old_size));
if (reposition_get)
setg(buf, buf + old_get_offset, buf +
max(old_get_offset, old_size));
_M_free(old_buffer);
}
}
_M_free(old_buffer);
}
}
if (pptr() != epptr())
{
*pptr() = c;
pbump(1);
return c;
}
else
return traits_type::eof();
}
if (pptr() != epptr())
{
*pptr() = c;
pbump(1);
return c;
}
else
return traits_type::eof();
}
strstreambuf::int_type
strstreambuf::pbackfail(int_type c)
{
if (gptr() != eback())
{
strstreambuf::int_type
strstreambuf::pbackfail(int_type c)
{
if (gptr() != eback())
{
if (c == _Traits::eof())
{
gbump(-1);
@ -214,208 +214,211 @@ strstreambuf::pbackfail(int_type c)
return c;
}
}
return _Traits::eof();
}
strstreambuf::int_type
strstreambuf::underflow()
{
if (gptr() == egptr() && pptr() && pptr() > egptr())
setg(eback(), gptr(), pptr());
if (gptr() != egptr())
return (unsigned char) *gptr();
else
return _Traits::eof();
}
}
basic_streambuf<char, char_traits<char> >*
strstreambuf::setbuf(char*, streamsize)
{ return this; }
strstreambuf::pos_type
strstreambuf::seekoff(off_type off, ios_base::seekdir dir,
ios_base::openmode mode)
{
bool do_get = false;
bool do_put = false;
if ((mode & (ios_base::in | ios_base::out))
== (ios_base::in | ios_base::out) &&
(dir == ios_base::beg || dir == ios_base::end))
do_get = do_put = true;
else if (mode & ios_base::in)
do_get = true;
else if (mode & ios_base::out)
do_put = true;
// !gptr() is here because, according to D.7.1 paragraph 4, the seekable
// area is undefined if there is no get area.
if ((!do_get && !do_put) || (do_put && !pptr()) || !gptr())
return pos_type(off_type(-1));
char* seeklow = eback();
char* seekhigh = epptr() ? epptr() : egptr();
off_type newoff;
switch (dir)
{
case ios_base::beg:
newoff = 0;
break;
case ios_base::end:
newoff = seekhigh - seeklow;
break;
case ios_base::cur:
newoff = do_put ? pptr() - seeklow : gptr() - seeklow;
break;
default:
return pos_type(off_type(-1));
}
strstreambuf::int_type
strstreambuf::underflow()
{
if (gptr() == egptr() && pptr() && pptr() > egptr())
setg(eback(), gptr(), pptr());
off += newoff;
if (off < 0 || off > seekhigh - seeklow)
return pos_type(off_type(-1));
if (do_put)
{
if (seeklow + off < pbase())
{
setp(seeklow, epptr());
pbump(off);
}
else
{
setp(pbase(), epptr());
pbump(off - (pbase() - seeklow));
}
}
if (do_get)
{
if (off <= egptr() - seeklow)
setg(seeklow, seeklow + off, egptr());
else if (off <= pptr() - seeklow)
setg(seeklow, seeklow + off, pptr());
else
setg(seeklow, seeklow + off, epptr());
}
return pos_type(newoff);
}
strstreambuf::pos_type
strstreambuf::seekpos(pos_type pos, ios_base::openmode mode)
{ return seekoff(pos - pos_type(off_type(0)), ios_base::beg, mode); }
char*
strstreambuf::_M_alloc(size_t n)
{
if (_M_alloc_fun)
return static_cast<char*>(_M_alloc_fun(n));
else
return new char[n];
}
void
strstreambuf::_M_free(char* p)
{
if (p)
if (_M_free_fun)
_M_free_fun(p);
if (gptr() != egptr())
return (unsigned char) *gptr();
else
delete[] p;
}
return _Traits::eof();
}
void
strstreambuf::_M_setup(char* get, char* put, streamsize n)
{
if (get)
{
size_t N = n > 0 ? size_t(n) : n == 0 ? strlen(get) : size_t(INT_MAX);
basic_streambuf<char, char_traits<char> >*
strstreambuf::setbuf(char*, streamsize)
{ return this; }
strstreambuf::pos_type
strstreambuf::seekoff(off_type off, ios_base::seekdir dir,
ios_base::openmode mode)
{
bool do_get = false;
bool do_put = false;
if ((mode & (ios_base::in | ios_base::out))
== (ios_base::in | ios_base::out) &&
(dir == ios_base::beg || dir == ios_base::end))
do_get = do_put = true;
else if (mode & ios_base::in)
do_get = true;
else if (mode & ios_base::out)
do_put = true;
// !gptr() is here because, according to D.7.1 paragraph 4, the seekable
// area is undefined if there is no get area.
if ((!do_get && !do_put) || (do_put && !pptr()) || !gptr())
return pos_type(off_type(-1));
char* seeklow = eback();
char* seekhigh = epptr() ? epptr() : egptr();
off_type newoff;
switch (dir)
{
case ios_base::beg:
newoff = 0;
break;
case ios_base::end:
newoff = seekhigh - seeklow;
break;
case ios_base::cur:
newoff = do_put ? pptr() - seeklow : gptr() - seeklow;
break;
default:
return pos_type(off_type(-1));
}
off += newoff;
if (off < 0 || off > seekhigh - seeklow)
return pos_type(off_type(-1));
if (do_put)
{
if (seeklow + off < pbase())
{
setp(seeklow, epptr());
pbump(off);
}
else
{
setp(pbase(), epptr());
pbump(off - (pbase() - seeklow));
}
}
if (do_get)
{
if (off <= egptr() - seeklow)
setg(seeklow, seeklow + off, egptr());
else if (off <= pptr() - seeklow)
setg(seeklow, seeklow + off, pptr());
else
setg(seeklow, seeklow + off, epptr());
}
return pos_type(newoff);
}
strstreambuf::pos_type
strstreambuf::seekpos(pos_type pos, ios_base::openmode mode)
{ return seekoff(pos - pos_type(off_type(0)), ios_base::beg, mode); }
char*
strstreambuf::_M_alloc(size_t n)
{
if (_M_alloc_fun)
return static_cast<char*>(_M_alloc_fun(n));
else
return new char[n];
}
void
strstreambuf::_M_free(char* p)
{
if (p)
if (_M_free_fun)
_M_free_fun(p);
else
delete[] p;
}
void
strstreambuf::_M_setup(char* get, char* put, streamsize n)
{
if (get)
{
size_t N = n > 0 ? size_t(n) : n == 0 ? strlen(get) : size_t(INT_MAX);
if (put)
{
setg(get, get, put);
setp(put, put + N);
}
else
setg(get, get, get + N);
}
}
if (put)
{
setg(get, get, put);
setp(put, put + N);
}
else
setg(get, get, get + N);
}
}
istrstream::istrstream(char* s)
: basic_ios<char>(), basic_istream<char>(0), _M_buf(s, 0)
{ basic_ios<char>::init(&_M_buf); }
istrstream::istrstream(char* s)
: basic_ios<char>(), basic_istream<char>(0), _M_buf(s, 0)
{ basic_ios<char>::init(&_M_buf); }
istrstream::istrstream(const char* s)
: basic_ios<char>(), basic_istream<char>(0), _M_buf(s, 0)
{ basic_ios<char>::init(&_M_buf); }
istrstream::istrstream(const char* s)
: basic_ios<char>(), basic_istream<char>(0), _M_buf(s, 0)
{ basic_ios<char>::init(&_M_buf); }
istrstream::istrstream(char* s, streamsize n)
: basic_ios<char>(), basic_istream<char>(0), _M_buf(s, n)
{ basic_ios<char>::init(&_M_buf); }
istrstream::istrstream(char* s, streamsize n)
: basic_ios<char>(), basic_istream<char>(0), _M_buf(s, n)
{ basic_ios<char>::init(&_M_buf); }
istrstream::istrstream(const char* s, streamsize n)
: basic_ios<char>(), basic_istream<char>(0), _M_buf(s, n)
{ basic_ios<char>::init(&_M_buf); }
istrstream::istrstream(const char* s, streamsize n)
: basic_ios<char>(), basic_istream<char>(0), _M_buf(s, n)
{ basic_ios<char>::init(&_M_buf); }
istrstream::~istrstream() { }
istrstream::~istrstream() { }
strstreambuf*
istrstream::rdbuf() const
{ return const_cast<strstreambuf*>(&_M_buf); }
strstreambuf*
istrstream::rdbuf() const
{ return const_cast<strstreambuf*>(&_M_buf); }
char*
istrstream::str()
{ return _M_buf.str(); }
char*
istrstream::str()
{ return _M_buf.str(); }
ostrstream::ostrstream() : basic_ios<char>(), basic_ostream<char>(0), _M_buf()
{ basic_ios<char>::init(&_M_buf); }
ostrstream::ostrstream()
: basic_ios<char>(), basic_ostream<char>(0), _M_buf()
{ basic_ios<char>::init(&_M_buf); }
ostrstream::ostrstream(char* s, int n, ios_base::openmode mode)
: basic_ios<char>(), basic_ostream<char>(0),
_M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s)
{ basic_ios<char>::init(&_M_buf); }
ostrstream::ostrstream(char* s, int n, ios_base::openmode mode)
: basic_ios<char>(), basic_ostream<char>(0),
_M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s)
{ basic_ios<char>::init(&_M_buf); }
ostrstream::~ostrstream() {}
ostrstream::~ostrstream() {}
strstreambuf*
ostrstream::rdbuf() const
{ return const_cast<strstreambuf*>(&_M_buf); }
strstreambuf*
ostrstream::rdbuf() const
{ return const_cast<strstreambuf*>(&_M_buf); }
void
ostrstream::freeze(bool freezeflag)
{ _M_buf.freeze(freezeflag); }
void
ostrstream::freeze(bool freezeflag)
{ _M_buf.freeze(freezeflag); }
char*
ostrstream::str()
{ return _M_buf.str(); }
char*
ostrstream::str()
{ return _M_buf.str(); }
int
ostrstream::pcount() const
{ return _M_buf.pcount(); }
int
ostrstream::pcount() const
{ return _M_buf.pcount(); }
strstream::strstream() : basic_ios<char>(), basic_iostream<char>(0), _M_buf()
{ basic_ios<char>::init(&_M_buf); }
strstream::strstream()
: basic_ios<char>(), basic_iostream<char>(0), _M_buf()
{ basic_ios<char>::init(&_M_buf); }
strstream::strstream(char* s, int n, ios_base::openmode mode)
: basic_ios<char>(), basic_iostream<char>(0),
_M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s)
{ basic_ios<char>::init(&_M_buf); }
strstream::strstream(char* s, int n, ios_base::openmode mode)
: basic_ios<char>(), basic_iostream<char>(0),
_M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s)
{ basic_ios<char>::init(&_M_buf); }
strstream::~strstream() { }
strstream::~strstream() { }
strstreambuf*
strstream::rdbuf() const
{ return const_cast<strstreambuf*>(&_M_buf); }
strstreambuf*
strstream::rdbuf() const
{ return const_cast<strstreambuf*>(&_M_buf); }
void
strstream::freeze(bool freezeflag)
{ _M_buf.freeze(freezeflag); }
void
strstream::freeze(bool freezeflag)
{ _M_buf.freeze(freezeflag); }
int
strstream::pcount() const
{ return _M_buf.pcount(); }
int
strstream::pcount() const
{ return _M_buf.pcount(); }
char*
strstream::str()
{ return _M_buf.str(); }
char*
strstream::str()
{ return _M_buf.str(); }
} // namespace std

View File

@ -18,14 +18,14 @@
// backward strstream members
#include <strstream.h>
#include <strstream>
#include <testsuite_hooks.h>
// { dg-options "-Wno-deprecated" }
int test01()
{
strstream s;
std::strstream s;
for (unsigned i=0 ; i!= 1000 ; ++i)
s << i << std::endl;
s << std::ends;