mirror of git://gcc.gnu.org/git/gcc.git
stl_algo (__stl_threshold): Declare external.
2002-02-11 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/stl_algo (__stl_threshold): Declare external.
(__stl_chunk_size): Same.
* include/bits/stl_bvector.h (__WORD_BIT): Same.
* include/bits/stl_tree.h (_S_rb_tree_red): Same.
(_S_rb_tree_black): Same.
* src/stl-inst.cc (__stl_threshold): Define.
(__stl_chunk_size): Same.
(__WORD_BIT): Same.
(_S_rb_tree_red): Same.
(_S_rb_tree_black): Same.
* config/io/basic_file_libio.h (__basic_file): Add declarations.
* include/bits/basic_file.h: Remove.
* config/io/c_io_stdio.h: Remove _GLIBCPP_BASIC_FILE_ENCAPSULATION
Declare generic types, specialization.
* config/io/basic_file_stdio.cc: Definitions.
* config/io/c_io_libio.h: Remove _GLIBCPP_BASIC_FILE_INHERITANCE.
Declare generic types.
* include/Makefile.am (bits_headers): Remove basic_file.h.
(extra_target_headers): Change basic_file_model.h to basic_file.h.
(stamp-target): Same.
* include/bits/stl_alloc.h: Tweaks.
* include/bits/localefwd.h: Same.
From-SVN: r49697
This commit is contained in:
parent
1febeb40bf
commit
005326029f
|
|
@ -1,3 +1,30 @@
|
|||
2002-02-11 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* include/bits/stl_algo (__stl_threshold): Declare external.
|
||||
(__stl_chunk_size): Same.
|
||||
* include/bits/stl_bvector.h (__WORD_BIT): Same.
|
||||
* include/bits/stl_tree.h (_S_rb_tree_red): Same.
|
||||
(_S_rb_tree_black): Same.
|
||||
* src/stl-inst.cc (__stl_threshold): Define.
|
||||
(__stl_chunk_size): Same.
|
||||
(__WORD_BIT): Same.
|
||||
(_S_rb_tree_red): Same.
|
||||
(_S_rb_tree_black): Same.
|
||||
|
||||
* config/io/basic_file_libio.h (__basic_file): Add declarations.
|
||||
* include/bits/basic_file.h: Remove.
|
||||
* config/io/c_io_stdio.h: Remove _GLIBCPP_BASIC_FILE_ENCAPSULATION
|
||||
Declare generic types, specialization.
|
||||
* config/io/basic_file_stdio.cc: Definitions.
|
||||
* config/io/c_io_libio.h: Remove _GLIBCPP_BASIC_FILE_INHERITANCE.
|
||||
Declare generic types.
|
||||
* include/Makefile.am (bits_headers): Remove basic_file.h.
|
||||
(extra_target_headers): Change basic_file_model.h to basic_file.h.
|
||||
(stamp-target): Same.
|
||||
|
||||
* include/bits/stl_alloc.h: Tweaks.
|
||||
* include/bits/localefwd.h: Same.
|
||||
|
||||
2002-02-11 Aaron W LaFramboise <AWLaFramboise@aol.com>
|
||||
|
||||
* include/bits/locale_facets.tcc (collate::do_hash): Fix.
|
||||
|
|
@ -17,7 +44,7 @@
|
|||
generate, generate_n, remove_copy, remove_copy_if, remove, remove_if,
|
||||
unique, unique_copy, reverse, reverse_copy): Doxygenate.
|
||||
|
||||
2002-02-08 Benjamin Kosnik <bkoz@redhat.com>
|
||||
2002-02-08 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* include/bits/locale_facets.h
|
||||
(numpunct<_CharT>::_M_initialize_numpunct): Remove definition.
|
||||
|
|
|
|||
|
|
@ -2017,6 +2017,24 @@ fi
|
|||
|
||||
|
||||
|
||||
#serial 1
|
||||
# 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
|
||||
|
||||
|
|
@ -2058,9 +2076,37 @@ fi])
|
|||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 5
|
||||
# serial 9
|
||||
|
||||
AC_DEFUN(AM_WITH_NLS,
|
||||
dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
|
||||
dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
|
||||
dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
|
||||
dnl depending on --{enable,disable}-{shared,static} and on the presence of
|
||||
dnl AM-DISABLE-SHARED). Otherwise, a static library
|
||||
dnl $(top_builddir)/intl/libintl.a will be created.
|
||||
dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
|
||||
dnl implementations (in libc or libintl) without the ngettext() function
|
||||
dnl will be ignored.
|
||||
dnl LIBDIR is used to find the intl libraries. If empty,
|
||||
dnl the value `$(top_builddir)/intl/' is used.
|
||||
dnl
|
||||
dnl The result of the configuration is one of three cases:
|
||||
dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
|
||||
dnl and used.
|
||||
dnl Catalog format: GNU --> install in $(datadir)
|
||||
dnl Catalog extension: .mo after installation, .gmo in source tree
|
||||
dnl 2) GNU gettext has been found in the system's C library.
|
||||
dnl Catalog format: GNU --> install in $(datadir)
|
||||
dnl Catalog extension: .mo after installation, .gmo in source tree
|
||||
dnl 3) No internationalization, always use English msgid.
|
||||
dnl Catalog format: none
|
||||
dnl Catalog extension: none
|
||||
dnl The use of .gmo is historical (it was needed to avoid overwriting the
|
||||
dnl GNU format catalogs when building on a platform with an X/Open gettext),
|
||||
dnl but we keep it in order not to force irrelevant filename changes on the
|
||||
dnl maintainers.
|
||||
dnl
|
||||
AC_DEFUN([AM_WITH_NLS],
|
||||
[AC_MSG_CHECKING([whether NLS is requested])
|
||||
dnl Default is enabled NLS
|
||||
AC_ARG_ENABLE(nls,
|
||||
|
|
@ -2069,11 +2115,15 @@ AC_DEFUN(AM_WITH_NLS,
|
|||
AC_MSG_RESULT($USE_NLS)
|
||||
AC_SUBST(USE_NLS)
|
||||
|
||||
BUILD_INCLUDED_LIBINTL=no
|
||||
USE_INCLUDED_LIBINTL=no
|
||||
INTLLIBS=
|
||||
|
||||
dnl If we use NLS figure out what method
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
AC_DEFINE(ENABLE_NLS)
|
||||
AC_DEFINE(ENABLE_NLS, 1,
|
||||
[Define to 1 if translation of program messages to the user's native language
|
||||
is requested.])
|
||||
AC_MSG_CHECKING([whether included gettext is requested])
|
||||
AC_ARG_WITH(included-gettext,
|
||||
[ --with-included-gettext use the GNU gettext library included here],
|
||||
|
|
@ -2084,89 +2134,74 @@ AC_DEFUN(AM_WITH_NLS,
|
|||
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
||||
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
||||
dnl User does not insist on using GNU NLS library. Figure out what
|
||||
dnl to use. If gettext or catgets are available (in this order) we
|
||||
dnl use this. Else we have to fall back to GNU NLS library.
|
||||
dnl catgets is only used if permitted by option --with-catgets.
|
||||
nls_cv_header_intl=
|
||||
nls_cv_header_libgt=
|
||||
dnl to use. If GNU gettext is available we use this. Else we have
|
||||
dnl to fall back to GNU NLS library.
|
||||
CATOBJEXT=NONE
|
||||
|
||||
AC_CHECK_HEADER(libintl.h,
|
||||
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
|
||||
dnl Add a version number to the cache macros.
|
||||
define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
|
||||
define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||
AC_CHECK_LIB(intl, bindtextdomain,
|
||||
[AC_CACHE_CHECK([for gettext in libintl],
|
||||
gt_cv_func_gettext_libintl,
|
||||
[AC_CHECK_LIB(intl, gettext,
|
||||
gt_cv_func_gettext_libintl=yes,
|
||||
gt_cv_func_gettext_libintl=no)],
|
||||
gt_cv_func_gettext_libintl=no)])
|
||||
AC_CHECK_HEADER(libintl.h,
|
||||
[AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>
|
||||
extern int _nl_msg_cat_cntr;],
|
||||
[bindtextdomain ("", "");
|
||||
return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
|
||||
gt_cv_func_gnugettext_libc=yes,
|
||||
gt_cv_func_gnugettext_libc=no)])
|
||||
|
||||
if test "$gt_cv_func_gnugettext_libc" != "yes"; then
|
||||
AC_CACHE_CHECK([for GNU gettext in libintl],
|
||||
gt_cv_func_gnugettext_libintl,
|
||||
[gt_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lintl $LIBICONV"
|
||||
AC_TRY_LINK([#include <libintl.h>
|
||||
extern int _nl_msg_cat_cntr;],
|
||||
[bindtextdomain ("", "");
|
||||
return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
|
||||
gt_cv_func_gnugettext_libintl=yes,
|
||||
gt_cv_func_gnugettext_libintl=no)
|
||||
LIBS="$gt_save_LIBS"])
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" = "yes" \
|
||||
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT)
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
||||
if test "$MSGFMT" != "no"; then
|
||||
AC_CHECK_FUNCS(dcgettext)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
|
||||
return _nl_msg_cat_cntr],
|
||||
[CATOBJEXT=.gmo
|
||||
DATADIRNAME=share],
|
||||
[CATOBJEXT=.mo
|
||||
DATADIRNAME=lib])
|
||||
INSTOBJEXT=.mo
|
||||
fi
|
||||
fi
|
||||
if test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||
INTLLIBS='-lintl'
|
||||
fi
|
||||
dnl If an already present or preinstalled GNU gettext() is found,
|
||||
dnl use it. But if this macro is used in GNU gettext, and GNU
|
||||
dnl gettext is already preinstalled in libintl, we update this
|
||||
dnl libintl. (Cf. the install rule in intl/Makefile.in.)
|
||||
if test "$gt_cv_func_gnugettext_libc" = "yes" \
|
||||
|| { test "$gt_cv_func_gnugettext_libintl" = "yes" \
|
||||
&& test "$PACKAGE" != gettext; }; then
|
||||
AC_DEFINE(HAVE_GETTEXT, 1,
|
||||
[Define if the GNU gettext() function is already present or preinstalled.])
|
||||
|
||||
if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
|
||||
dnl If iconv() is in a separate libiconv library, then anyone
|
||||
dnl linking with libintl{.a,.so} also needs to link with
|
||||
dnl libiconv.
|
||||
INTLLIBS="-lintl $LIBICONV"
|
||||
fi
|
||||
|
||||
gt_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $INTLLIBS"
|
||||
AC_CHECK_FUNCS(dcgettext)
|
||||
LIBS="$gt_save_LIBS"
|
||||
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
||||
if test "$MSGFMT" != "no"; then
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
fi
|
||||
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
|
||||
CATOBJEXT=.gmo
|
||||
fi
|
||||
])
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
AC_MSG_CHECKING([whether catgets can be used])
|
||||
AC_ARG_WITH(catgets,
|
||||
[ --with-catgets use catgets functions if available],
|
||||
nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
|
||||
AC_MSG_RESULT($nls_cv_use_catgets)
|
||||
|
||||
if test "$nls_cv_use_catgets" = "yes"; then
|
||||
dnl No gettext in C library. Try catgets next.
|
||||
AC_CHECK_LIB(i, main)
|
||||
AC_CHECK_FUNC(catgets,
|
||||
[AC_DEFINE(HAVE_CATGETS)
|
||||
INTLOBJS="\$(CATOBJS)"
|
||||
AC_PATH_PROG(GENCAT, gencat, no)dnl
|
||||
if test "$GENCAT" != "no"; then
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
|
||||
if test "$GMSGFMT" = "no"; then
|
||||
AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
|
||||
fi
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.cat
|
||||
INSTOBJEXT=.cat
|
||||
DATADIRNAME=lib
|
||||
INTLDEPS='$(top_builddir)/intl/libintl.a'
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
dnl Neither gettext nor catgets in included in the C library.
|
||||
dnl GNU gettext is not found in the C library.
|
||||
dnl Fall back on GNU gettext library.
|
||||
nls_cv_use_gnu_gettext=yes
|
||||
fi
|
||||
|
|
@ -2181,15 +2216,11 @@ AC_DEFUN(AM_WITH_NLS,
|
|||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_SUBST(MSGFMT)
|
||||
BUILD_INCLUDED_LIBINTL=yes
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.gmo
|
||||
INSTOBJEXT=.mo
|
||||
DATADIRNAME=share
|
||||
INTLDEPS='$(top_builddir)/intl/libintl.a'
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
|
||||
LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
|
||||
fi
|
||||
|
||||
dnl Test whether we really found GNU xgettext.
|
||||
|
|
@ -2205,25 +2236,73 @@ AC_DEFUN(AM_WITH_NLS,
|
|||
fi
|
||||
fi
|
||||
|
||||
# We need to process the po/ directory.
|
||||
dnl We need to process the po/ directory.
|
||||
POSUB=po
|
||||
else
|
||||
DATADIRNAME=share
|
||||
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])
|
||||
[for ac_file in $CONFIG_FILES; do
|
||||
# Support "outfile[:infile[:infile...]]"
|
||||
case "$ac_file" in
|
||||
*:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
|
||||
esac
|
||||
# PO directories have a Makefile.in generated from Makefile.in.in.
|
||||
case "$ac_file" in */Makefile.in)
|
||||
# Adjust a relative srcdir.
|
||||
ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
|
||||
ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
|
||||
ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
|
||||
case "$ac_given_srcdir" in
|
||||
.) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
|
||||
/*) top_srcdir="$ac_given_srcdir" ;;
|
||||
*) top_srcdir="$ac_dots$ac_given_srcdir" ;;
|
||||
esac
|
||||
if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
|
||||
rm -f "$ac_dir/POTFILES"
|
||||
echo creating "$ac_dir/POTFILES"
|
||||
sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
|
||||
echo creating "$ac_dir/Makefile"
|
||||
sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done])
|
||||
|
||||
|
||||
# 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.
|
||||
dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
|
||||
dnl to 'yes' because some of the testsuite requires it.
|
||||
if test "$PACKAGE" = gettext; then
|
||||
USE_NLS=yes
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
BUILD_INCLUDED_LIBINTL=yes
|
||||
fi
|
||||
|
||||
dnl intl/plural.c is generated from intl/plural.y. It requires bison,
|
||||
dnl because plural.y uses bison specific features. It requires at least
|
||||
dnl bison-1.26 because earlier versions generate a plural.c that doesn't
|
||||
dnl compile.
|
||||
dnl bison is only needed for the maintainer (who touches plural.y). But in
|
||||
dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
|
||||
dnl the rule in general Makefile. Now, some people carelessly touch the
|
||||
dnl files or have a broken "make" program, hence the plural.c rule will
|
||||
dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
|
||||
dnl present or too old.
|
||||
AC_CHECK_PROGS([INTLBISON], [bison])
|
||||
if test -z "$INTLBISON"; then
|
||||
ac_verc_fail=yes
|
||||
else
|
||||
dnl Found it, now check the version.
|
||||
AC_MSG_CHECKING([version of bison])
|
||||
changequote(<<,>>)dnl
|
||||
ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'`
|
||||
case $ac_prog_version in
|
||||
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
|
||||
1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
|
||||
changequote([,])dnl
|
||||
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
|
||||
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
|
||||
esac
|
||||
AC_MSG_RESULT([$ac_prog_version])
|
||||
fi
|
||||
if test $ac_verc_fail = yes; then
|
||||
INTLBISON=:
|
||||
fi
|
||||
|
||||
dnl These rules are solely for the distribution goal. While doing this
|
||||
|
|
@ -2235,22 +2314,38 @@ AC_DEFUN(AM_WITH_NLS,
|
|||
done
|
||||
|
||||
dnl Make all variables we use known to autoconf.
|
||||
AC_SUBST(BUILD_INCLUDED_LIBINTL)
|
||||
AC_SUBST(USE_INCLUDED_LIBINTL)
|
||||
AC_SUBST(CATALOGS)
|
||||
AC_SUBST(CATOBJEXT)
|
||||
AC_SUBST(DATADIRNAME)
|
||||
AC_SUBST(GMOFILES)
|
||||
AC_SUBST(INSTOBJEXT)
|
||||
AC_SUBST(INTLDEPS)
|
||||
AC_SUBST(INTLLIBS)
|
||||
AC_SUBST(INTLOBJS)
|
||||
AC_SUBST(POFILES)
|
||||
AC_SUBST(POSUB)
|
||||
|
||||
dnl For backward compatibility. Some configure.ins may be using this.
|
||||
nls_cv_header_intl=
|
||||
nls_cv_header_libgt=
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
DATADIRNAME=share
|
||||
AC_SUBST(DATADIRNAME)
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
INSTOBJEXT=.mo
|
||||
AC_SUBST(INSTOBJEXT)
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
GENCAT=gencat
|
||||
AC_SUBST(GENCAT)
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_GNU_GETTEXT,
|
||||
dnl Usage: Just like AM_WITH_NLS, which see.
|
||||
AC_DEFUN([AM_GNU_GETTEXT],
|
||||
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
|
|
@ -2260,21 +2355,18 @@ AC_DEFUN(AM_GNU_GETTEXT,
|
|||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
||||
AC_REQUIRE([jm_GLIBC21])dnl
|
||||
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
|
||||
unistd.h sys/param.h])
|
||||
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
|
||||
strdup __argz_count __argz_stringify __argz_next])
|
||||
|
||||
if test "${ac_cv_func_stpcpy+set}" != "set"; then
|
||||
AC_CHECK_FUNCS(stpcpy)
|
||||
fi
|
||||
if test "${ac_cv_func_stpcpy}" = "yes"; then
|
||||
AC_DEFINE(HAVE_STPCPY)
|
||||
fi
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
|
||||
stdlib.h string.h unistd.h sys/param.h])
|
||||
AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
|
||||
getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
|
||||
strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
|
||||
|
||||
AM_ICONV
|
||||
AM_LANGINFO_CODESET
|
||||
AM_LC_MESSAGES
|
||||
AM_WITH_NLS
|
||||
AM_WITH_NLS([$1],[$2],[$3])
|
||||
|
||||
if test "x$CATOBJEXT" != "x"; then
|
||||
if test "x$ALL_LINGUAS" = "x"; then
|
||||
|
|
@ -2282,10 +2374,21 @@ strdup __argz_count __argz_stringify __argz_next])
|
|||
else
|
||||
AC_MSG_CHECKING(for catalogs to be installed)
|
||||
NEW_LINGUAS=
|
||||
for lang in ${LINGUAS=$ALL_LINGUAS}; do
|
||||
case "$ALL_LINGUAS" in
|
||||
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
|
||||
esac
|
||||
for presentlang in $ALL_LINGUAS; do
|
||||
useit=no
|
||||
for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
|
||||
# Use the presentlang catalog if desiredlang is
|
||||
# a. equal to presentlang, or
|
||||
# b. a variant of presentlang (because in this case,
|
||||
# presentlang can be used as a fallback for messages
|
||||
# which are not translated in the desiredlang catalog).
|
||||
case "$desiredlang" in
|
||||
"$presentlang"*) useit=yes;;
|
||||
esac
|
||||
done
|
||||
if test $useit = yes; then
|
||||
NEW_LINGUAS="$NEW_LINGUAS $presentlang"
|
||||
fi
|
||||
done
|
||||
LINGUAS=$NEW_LINGUAS
|
||||
AC_MSG_RESULT($LINGUAS)
|
||||
|
|
@ -2297,47 +2400,8 @@ strdup __argz_count __argz_stringify __argz_next])
|
|||
fi
|
||||
fi
|
||||
|
||||
dnl The reference to <locale.h> in the installed <libintl.h> file
|
||||
dnl must be resolved because we cannot expect the users of this
|
||||
dnl to define HAVE_LOCALE_H.
|
||||
if test $ac_cv_header_locale_h = yes; then
|
||||
INCLUDE_LOCALE_H="#include <locale.h>"
|
||||
else
|
||||
INCLUDE_LOCALE_H="\
|
||||
/* The system does not provide the header <locale.h>. Take care yourself. */"
|
||||
fi
|
||||
AC_SUBST(INCLUDE_LOCALE_H)
|
||||
|
||||
dnl Determine which catalog format we have (if any is needed)
|
||||
dnl For now we know about two different formats:
|
||||
dnl Linux libc-5 and the normal X/Open format
|
||||
test -d intl || mkdir intl
|
||||
if test "$CATOBJEXT" = ".cat"; then
|
||||
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
|
||||
|
||||
dnl Transform the SED scripts while copying because some dumb SEDs
|
||||
dnl cannot handle comments.
|
||||
sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
|
||||
fi
|
||||
dnl po2tbl.sed is always needed.
|
||||
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
|
||||
$srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
|
||||
|
||||
dnl In the intl/Makefile.in we have a special dependency which makes
|
||||
dnl only sense for gettext. We comment this out for non-gettext
|
||||
dnl packages.
|
||||
if test "$PACKAGE" = "gettext"; then
|
||||
GT_NO="#NO#"
|
||||
GT_YES=
|
||||
else
|
||||
GT_NO=
|
||||
GT_YES="#YES#"
|
||||
fi
|
||||
AC_SUBST(GT_NO)
|
||||
AC_SUBST(GT_YES)
|
||||
|
||||
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
|
||||
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
|
||||
dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
|
||||
dnl Try to locate is.
|
||||
MKINSTALLDIRS=
|
||||
if test -n "$ac_aux_dir"; then
|
||||
|
|
@ -2348,25 +2412,9 @@ strdup __argz_count __argz_stringify __argz_next])
|
|||
fi
|
||||
AC_SUBST(MKINSTALLDIRS)
|
||||
|
||||
dnl *** For now the libtool support in intl/Makefile is not for real.
|
||||
l=
|
||||
AC_SUBST(l)
|
||||
|
||||
dnl Generate list of files to be processed by xgettext which will
|
||||
dnl be included in po/Makefile.
|
||||
test -d po || mkdir po
|
||||
if test "x$srcdir" != "x."; then
|
||||
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
|
||||
posrcprefix="$srcdir/"
|
||||
else
|
||||
posrcprefix="../$srcdir/"
|
||||
fi
|
||||
else
|
||||
posrcprefix="../"
|
||||
fi
|
||||
rm -f po/POTFILES
|
||||
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
|
||||
< $srcdir/po/POTFILES.in > po/POTFILES
|
||||
dnl Enable libtool support if the surrounding package wishes it.
|
||||
INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
|
||||
AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
|
||||
])
|
||||
|
||||
# Search path for a program which passes the given test.
|
||||
|
|
@ -2381,7 +2429,7 @@ strdup __argz_count __argz_stringify __argz_next])
|
|||
|
||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
|
||||
AC_DEFUN([AM_PATH_PROG_WITH_TEST],
|
||||
[# Extract the first word of "$2", so it can be a program name with args.
|
||||
set dummy $2; ac_word=[$]2
|
||||
AC_MSG_CHECKING([for $ac_word])
|
||||
|
|
@ -2417,6 +2465,121 @@ fi
|
|||
AC_SUBST($1)dnl
|
||||
])
|
||||
|
||||
#serial 2
|
||||
|
||||
# Test for the GNU C Library, version 2.1 or newer.
|
||||
# From Bruno Haible.
|
||||
|
||||
AC_DEFUN([jm_GLIBC21],
|
||||
[
|
||||
AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
|
||||
ac_cv_gnu_library_2_1,
|
||||
[AC_EGREP_CPP([Lucky GNU user],
|
||||
[
|
||||
#include <features.h>
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
|
||||
Lucky GNU user
|
||||
#endif
|
||||
#endif
|
||||
],
|
||||
ac_cv_gnu_library_2_1=yes,
|
||||
ac_cv_gnu_library_2_1=no)
|
||||
]
|
||||
)
|
||||
AC_SUBST(GLIBC21)
|
||||
GLIBC21="$ac_cv_gnu_library_2_1"
|
||||
]
|
||||
)
|
||||
|
||||
#serial AM2
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([AM_ICONV],
|
||||
[
|
||||
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
|
||||
dnl those with the standalone portable GNU libiconv installed).
|
||||
|
||||
AC_ARG_WITH([libiconv-prefix],
|
||||
[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
|
||||
for dir in `echo "$withval" | tr : ' '`; do
|
||||
if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
|
||||
if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
|
||||
done
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
|
||||
am_cv_func_iconv="no, consider installing GNU libiconv"
|
||||
am_cv_lib_iconv=no
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <iconv.h>],
|
||||
[iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);],
|
||||
am_cv_func_iconv=yes)
|
||||
if test "$am_cv_func_iconv" != yes; then
|
||||
am_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -liconv"
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <iconv.h>],
|
||||
[iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);],
|
||||
am_cv_lib_iconv=yes
|
||||
am_cv_func_iconv=yes)
|
||||
LIBS="$am_save_LIBS"
|
||||
fi
|
||||
])
|
||||
if test "$am_cv_func_iconv" = yes; then
|
||||
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
|
||||
AC_MSG_CHECKING([for iconv declaration])
|
||||
AC_CACHE_VAL(am_cv_proto_iconv, [
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
|
||||
#else
|
||||
size_t iconv();
|
||||
#endif
|
||||
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
|
||||
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
|
||||
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
|
||||
AC_MSG_RESULT([$]{ac_t:-
|
||||
}[$]am_cv_proto_iconv)
|
||||
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
|
||||
[Define as const if the declaration of iconv() needs const.])
|
||||
fi
|
||||
LIBICONV=
|
||||
if test "$am_cv_lib_iconv" = yes; then
|
||||
LIBICONV="-liconv"
|
||||
fi
|
||||
AC_SUBST(LIBICONV)
|
||||
])
|
||||
|
||||
#serial AM1
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([AM_LANGINFO_CODESET],
|
||||
[
|
||||
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
|
||||
[AC_TRY_LINK([#include <langinfo.h>],
|
||||
[char* cs = nl_langinfo(CODESET);],
|
||||
am_cv_langinfo_codeset=yes,
|
||||
am_cv_langinfo_codeset=no)
|
||||
])
|
||||
if test $am_cv_langinfo_codeset = yes; then
|
||||
AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
|
||||
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
|
||||
fi
|
||||
])
|
||||
|
||||
# Check whether LC_MESSAGES is available in <locale.h>.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
|
|
@ -2425,15 +2588,16 @@ AC_SUBST($1)dnl
|
|||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 1
|
||||
# serial 2
|
||||
|
||||
AC_DEFUN(AM_LC_MESSAGES,
|
||||
AC_DEFUN([AM_LC_MESSAGES],
|
||||
[if test $ac_cv_header_locale_h = yes; then
|
||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_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)
|
||||
AC_DEFINE(HAVE_LC_MESSAGES, 1,
|
||||
[Define if your <locale.h> file defines LC_MESSAGES.])
|
||||
fi
|
||||
fi])
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
// Define if GCC supports weak symbols.
|
||||
#undef _GLIBCPP_SUPPORTS_WEAK
|
||||
|
||||
|
|
@ -702,6 +699,9 @@
|
|||
/* Define if you have the <nan.h> header file. */
|
||||
#undef HAVE_NAN_H
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define if you have the <sys/isa_defs.h> header file. */
|
||||
#undef HAVE_SYS_ISA_DEFS_H
|
||||
|
||||
|
|
@ -711,6 +711,9 @@
|
|||
/* Define if you have the <sys/resource.h> header file. */
|
||||
#undef HAVE_SYS_RESOURCE_H
|
||||
|
||||
/* Define if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Wrapper of C-language FILE struct -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
// 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
|
||||
|
|
@ -31,10 +31,221 @@
|
|||
// ISO C++ 14882: 27.8 File-based streams
|
||||
//
|
||||
|
||||
/** @file basic_file.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
#ifndef _CPP_BASIC_FILE
|
||||
#define _CPP_BASIC_FILE 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <bits/c++config.h>
|
||||
#include <ios>
|
||||
#include <libioP.h>
|
||||
|
||||
namespace std
|
||||
{
|
||||
// Ulrich is going to make some detailed comment here, explaining
|
||||
// all this unpleasantness, providing detailed performance analysis
|
||||
// as to why we have to do all this lame vtable hacking instead of a
|
||||
// sane, function-based approach. This verbiage will provide a clear
|
||||
// and detailed description of the whole object-layout,
|
||||
// vtable-swapping, sordid history of this hack.
|
||||
template<typename _CharT>
|
||||
struct __basic_file_base: public __c_file_type
|
||||
{
|
||||
virtual
|
||||
~__basic_file_base() { };
|
||||
|
||||
virtual int
|
||||
overflow(int __c = EOF) = 0;
|
||||
|
||||
virtual int
|
||||
underflow() = 0;
|
||||
|
||||
virtual int
|
||||
uflow() = 0;
|
||||
|
||||
virtual int
|
||||
pbackfail(int __c) = 0;
|
||||
|
||||
virtual streamsize
|
||||
xsputn(const _CharT* __s, streamsize __n) = 0;
|
||||
|
||||
virtual streamsize
|
||||
xsgetn(_CharT* __s, streamsize __n) = 0;
|
||||
|
||||
virtual streamoff
|
||||
seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out) = 0;
|
||||
|
||||
virtual streamoff
|
||||
seekpos(streamoff __pos,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out) = 0;
|
||||
|
||||
virtual streambuf*
|
||||
setbuf(_CharT* __b, int __len) = 0;
|
||||
|
||||
virtual int
|
||||
sync() = 0;
|
||||
|
||||
virtual int
|
||||
doallocate() = 0;
|
||||
|
||||
virtual streamsize
|
||||
sys_read(_CharT* __s, streamsize __n) = 0;
|
||||
|
||||
virtual streamsize
|
||||
sys_write(const _CharT* __s, streamsize __n) = 0;
|
||||
|
||||
virtual streamoff
|
||||
sys_seek(streamoff __off, ios_base::seekdir __way) = 0;
|
||||
|
||||
virtual int
|
||||
sys_close() = 0;
|
||||
|
||||
virtual int
|
||||
sys_stat(void* __v) = 0;
|
||||
|
||||
virtual int
|
||||
showmanyc() = 0;
|
||||
|
||||
virtual void
|
||||
imbue(void* __v) = 0;
|
||||
};
|
||||
|
||||
// Some of these member functions are based on libio/filebuf.cc.
|
||||
// Also note that the order and number of virtual functions has to precisely
|
||||
// match the order and number in the _IO_jump_t struct defined in libioP.h.
|
||||
template<typename _CharT>
|
||||
class __basic_file: public __basic_file_base<_CharT>
|
||||
{
|
||||
# ifdef _GLIBCPP_USE_WCHAR_T
|
||||
__c_wfile_type _M_wfile;
|
||||
# endif
|
||||
|
||||
public:
|
||||
__basic_file(__c_lock* __lock = 0);
|
||||
|
||||
void
|
||||
_M_open_mode(ios_base::openmode __mode, int& __p_mode, int& __rw_mode,
|
||||
char* __c_mode);
|
||||
|
||||
// Equivalent to the normal fopen function.
|
||||
__basic_file*
|
||||
open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
|
||||
|
||||
// Used for opening the standard streams, cin, cout, cerr, clog,
|
||||
// and their wide-stream equivalents. Instead of calling open, it
|
||||
// just sets
|
||||
// - for libio: __c_file_type->_fileno and the respective _flags bits
|
||||
// - for stdio: _M_cfile = __file and some internal flags
|
||||
// and returns.
|
||||
__basic_file*
|
||||
sys_open(__c_file_type* __file, ios_base::openmode __mode);
|
||||
|
||||
_CharT
|
||||
sys_getc();
|
||||
|
||||
_CharT
|
||||
sys_ungetc(_CharT);
|
||||
|
||||
__basic_file*
|
||||
close();
|
||||
|
||||
bool
|
||||
is_open();
|
||||
|
||||
int
|
||||
fd();
|
||||
|
||||
// NB: Must match FILE specific jump table starting here--this
|
||||
// means all virtual functions starting with the dtor must match,
|
||||
// slot by slot. For glibc-based dystems, this means the _IO_FILE
|
||||
// as the FILE struct and _IO_jump_t as the jump table.
|
||||
virtual
|
||||
~__basic_file(); // Takes the place of __finish.
|
||||
|
||||
virtual int
|
||||
overflow(int __c = EOF);
|
||||
|
||||
virtual int
|
||||
underflow();
|
||||
|
||||
virtual int
|
||||
uflow();
|
||||
|
||||
virtual int
|
||||
pbackfail(int __c);
|
||||
|
||||
// A complex "write" function that sets all of __c_file_type's
|
||||
// pointers and associated data members correctly and manages its
|
||||
// relation to the external byte sequence.
|
||||
virtual streamsize
|
||||
xsputn(const _CharT* __s, streamsize __n);
|
||||
|
||||
// A complex "read" function that sets all of __c_file_type's
|
||||
// pointers and associated data members correctly and manages its
|
||||
// relation to the external byte sequence.
|
||||
virtual streamsize
|
||||
xsgetn(_CharT* __s, streamsize __n);
|
||||
|
||||
// A complex "seekoff" function that sets all of __c_file_type's
|
||||
// pointers and associated data members correctly and manages its
|
||||
// relation to the external byte sequence.
|
||||
virtual streamoff
|
||||
seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
|
||||
// A complex "seekpos" function that sets all of __c_file_type's
|
||||
// pointers and associated data members correctly and manages its
|
||||
// relation to the external byte sequence.
|
||||
virtual streamoff
|
||||
seekpos(streamoff __pos,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
|
||||
virtual streambuf*
|
||||
setbuf(_CharT* __b, int __len);
|
||||
|
||||
virtual int
|
||||
sync();
|
||||
|
||||
virtual int
|
||||
doallocate();
|
||||
|
||||
// A simple read function for the external byte sequence, that
|
||||
// does no mucking around with or setting of the pointers or flags
|
||||
// in __c_file_type.
|
||||
virtual streamsize
|
||||
sys_read(_CharT* __s, streamsize __n);
|
||||
|
||||
// A simple write function for the external byte sequence, that
|
||||
// does no mucking around with or setting of the pointers or flags
|
||||
// in __c_file_type.
|
||||
virtual streamsize
|
||||
sys_write(const _CharT* __s, streamsize __n);
|
||||
|
||||
// A simple seek function for the external byte sequence, that
|
||||
// does no mucking around with or setting of the pointers or flags
|
||||
// in __c_file_type.
|
||||
virtual streamoff
|
||||
sys_seek(streamoff __off, ios_base::seekdir __way);
|
||||
|
||||
virtual int
|
||||
sys_close();
|
||||
|
||||
virtual int
|
||||
sys_stat(void* __v);
|
||||
|
||||
virtual int
|
||||
showmanyc();
|
||||
|
||||
virtual void
|
||||
imbue(void* __v);
|
||||
};
|
||||
|
||||
// __basic_file<char> specializations
|
||||
template<>
|
||||
__basic_file<char>::__basic_file(__c_lock* __lock);
|
||||
|
|
@ -283,3 +494,5 @@ namespace std
|
|||
void
|
||||
__basic_file<_CharT>::imbue(void* /*__v*/) { }
|
||||
} // namespace std
|
||||
|
||||
#endif // _CPP_BASIC_FILE
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Wrapper of C-language FILE struct -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
// 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
|
||||
|
|
@ -35,8 +35,124 @@
|
|||
|
||||
namespace std
|
||||
{
|
||||
template class __basic_file<char>;
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template class __basic_file<wchar_t>;
|
||||
#endif
|
||||
// Definitions for __basic_file<char>.
|
||||
__basic_file<char>::__basic_file(__c_lock* /*__lock*/)
|
||||
: _M_cfile(NULL), _M_cfile_created(false) { }
|
||||
|
||||
__basic_file<char>::~__basic_file()
|
||||
{
|
||||
if (this->is_open())
|
||||
{
|
||||
fflush(_M_cfile);
|
||||
this->close();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__basic_file<char>::_M_open_mode(ios_base::openmode __mode, int&, int&,
|
||||
char* __c_mode)
|
||||
{
|
||||
bool __testb = __mode & ios_base::binary;
|
||||
bool __testi = __mode & ios_base::in;
|
||||
bool __testo = __mode & ios_base::out;
|
||||
bool __testt = __mode & ios_base::trunc;
|
||||
bool __testa = __mode & ios_base::app;
|
||||
|
||||
if (!__testi && __testo && !__testt && !__testa)
|
||||
strcpy(__c_mode, "w");
|
||||
if (!__testi && __testo && !__testt && __testa)
|
||||
strcpy(__c_mode, "a");
|
||||
if (!__testi && __testo && __testt && !__testa)
|
||||
strcpy(__c_mode, "w");
|
||||
if (__testi && !__testo && !__testt && !__testa)
|
||||
strcpy(__c_mode, "r");
|
||||
if (__testi && __testo && !__testt && !__testa)
|
||||
strcpy(__c_mode, "r+");
|
||||
if (__testi && __testo && __testt && !__testa)
|
||||
strcpy(__c_mode, "w+");
|
||||
if (__testb)
|
||||
strcat(__c_mode, "b");
|
||||
}
|
||||
|
||||
__basic_file<char>*
|
||||
__basic_file<char>::sys_open(__c_file_type* __file, ios_base::openmode)
|
||||
{
|
||||
__basic_file* __ret = NULL;
|
||||
if (!this->is_open() && __file)
|
||||
{
|
||||
_M_cfile = __file;
|
||||
_M_cfile_created = false;
|
||||
__ret = this;
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
char
|
||||
__basic_file<char>::sys_getc() { return getc (_M_cfile); }
|
||||
|
||||
char
|
||||
__basic_file<char>::sys_ungetc(char __s) { return ungetc (__s, _M_cfile); }
|
||||
|
||||
__basic_file<char>*
|
||||
__basic_file<char>::open(const char* __name, ios_base::openmode __mode,
|
||||
int /*__prot*/)
|
||||
{
|
||||
__basic_file* __ret = NULL;
|
||||
int __p_mode = 0;
|
||||
int __rw_mode = 0;
|
||||
char __c_mode[4];
|
||||
|
||||
_M_open_mode(__mode, __p_mode, __rw_mode, __c_mode);
|
||||
|
||||
if (!this->is_open())
|
||||
{
|
||||
if ((_M_cfile = fopen(__name, __c_mode)))
|
||||
{
|
||||
_M_cfile_created = true;
|
||||
__ret = this;
|
||||
}
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
bool
|
||||
__basic_file<char>::is_open() { return _M_cfile != 0; }
|
||||
|
||||
int
|
||||
__basic_file<char>::fd() { return fileno(_M_cfile) ; }
|
||||
|
||||
__basic_file<char>*
|
||||
__basic_file<char>::close()
|
||||
{
|
||||
__basic_file* __retval = static_cast<__basic_file*>(NULL);
|
||||
if (_M_cfile_created && fclose(_M_cfile))
|
||||
__retval = this;
|
||||
return __retval;
|
||||
}
|
||||
|
||||
streamsize
|
||||
__basic_file<char>::xsgetn(char* __s, streamsize __n)
|
||||
{ return fread(__s, 1, __n, _M_cfile); }
|
||||
|
||||
streamsize
|
||||
__basic_file<char>::xsputn(const char* __s, streamsize __n)
|
||||
{ return fwrite(__s, 1, __n, _M_cfile); }
|
||||
|
||||
streamoff
|
||||
__basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode /*__mode*/)
|
||||
{
|
||||
fseek(_M_cfile, __off, __way);
|
||||
return ftell(_M_cfile);
|
||||
}
|
||||
|
||||
streamoff
|
||||
__basic_file<char>::seekpos(streamoff __pos, ios_base::openmode /*__mode*/)
|
||||
{
|
||||
fseek(_M_cfile, __pos, ios_base::beg);
|
||||
return ftell(_M_cfile);
|
||||
}
|
||||
|
||||
int
|
||||
__basic_file<char>::sync() { return fflush(_M_cfile); }
|
||||
} // namespace std
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Wrapper of C-language FILE struct -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
// 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
|
||||
|
|
@ -31,226 +31,81 @@
|
|||
// ISO C++ 14882: 27.8 File-based streams
|
||||
//
|
||||
|
||||
/** @file basic_file.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
#ifndef _CPP_BASIC_FILE
|
||||
#define _CPP_BASIC_FILE 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <bits/c++config.h>
|
||||
#include <ios>
|
||||
|
||||
namespace std
|
||||
{
|
||||
// Generic definitions for __basic_file
|
||||
// Generic declaration.
|
||||
template<typename _CharT>
|
||||
__basic_file<_CharT>::__basic_file(__c_lock* /*__lock*/)
|
||||
: _M_cfile(NULL), _M_cfile_created(false) { }
|
||||
class __basic_file;
|
||||
|
||||
template<typename _CharT>
|
||||
__basic_file<_CharT>::~__basic_file()
|
||||
// Specialization.
|
||||
template<>
|
||||
class __basic_file<char>
|
||||
{
|
||||
if (this->is_open())
|
||||
{
|
||||
fflush(_M_cfile);
|
||||
this->close();
|
||||
}
|
||||
}
|
||||
// Underlying data source/sink.
|
||||
__c_file_type* _M_cfile;
|
||||
// True iff we opened _M_cfile, and thus must close it ourselves.
|
||||
bool _M_cfile_created;
|
||||
|
||||
public:
|
||||
__basic_file(__c_lock* __lock = 0);
|
||||
|
||||
template<typename _CharT>
|
||||
void
|
||||
__basic_file<_CharT>::_M_open_mode(ios_base::openmode __mode,
|
||||
int& /*__p_mode*/, int& /*__rw_mode*/,
|
||||
char* __c_mode)
|
||||
{
|
||||
bool __testb = __mode & ios_base::binary;
|
||||
bool __testi = __mode & ios_base::in;
|
||||
bool __testo = __mode & ios_base::out;
|
||||
bool __testt = __mode & ios_base::trunc;
|
||||
bool __testa = __mode & ios_base::app;
|
||||
void
|
||||
_M_open_mode(ios_base::openmode __mode, int& __p_mode, int& __rw_mode,
|
||||
char* __c_mode);
|
||||
|
||||
if (!__testi && __testo && !__testt && !__testa)
|
||||
strcpy(__c_mode, "w");
|
||||
if (!__testi && __testo && !__testt && __testa)
|
||||
strcpy(__c_mode, "a");
|
||||
if (!__testi && __testo && __testt && !__testa)
|
||||
strcpy(__c_mode, "w");
|
||||
if (__testi && !__testo && !__testt && !__testa)
|
||||
strcpy(__c_mode, "r");
|
||||
if (__testi && __testo && !__testt && !__testa)
|
||||
strcpy(__c_mode, "r+");
|
||||
if (__testi && __testo && __testt && !__testa)
|
||||
strcpy(__c_mode, "w+");
|
||||
if (__testb)
|
||||
strcat(__c_mode, "b");
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
__basic_file<_CharT>*
|
||||
__basic_file<_CharT>::sys_open(__c_file_type* __file, ios_base::openmode)
|
||||
{
|
||||
__basic_file* __ret = NULL;
|
||||
__basic_file*
|
||||
open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
|
||||
|
||||
if (!this->is_open() && __file)
|
||||
{
|
||||
_M_cfile = __file;
|
||||
_M_cfile_created = false;
|
||||
__ret = this;
|
||||
}
|
||||
__basic_file*
|
||||
sys_open(__c_file_type* __file, ios_base::openmode __mode);
|
||||
|
||||
return __ret;
|
||||
}
|
||||
char
|
||||
sys_getc();
|
||||
|
||||
template<typename _CharT>
|
||||
_CharT
|
||||
__basic_file<_CharT>::sys_getc()
|
||||
{
|
||||
return getc (_M_cfile);
|
||||
}
|
||||
char
|
||||
sys_ungetc(char);
|
||||
|
||||
template<typename _CharT>
|
||||
_CharT
|
||||
__basic_file<_CharT>::sys_ungetc(_CharT __s)
|
||||
{
|
||||
return ungetc (__s, _M_cfile);
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
__basic_file<_CharT>*
|
||||
__basic_file<_CharT>::open(const char* __name, ios_base::openmode __mode,
|
||||
int /*__prot*/)
|
||||
{
|
||||
__basic_file* __ret = NULL;
|
||||
int __p_mode = 0;
|
||||
int __rw_mode = 0;
|
||||
char __c_mode[4];
|
||||
|
||||
_M_open_mode(__mode, __p_mode, __rw_mode, __c_mode);
|
||||
__basic_file*
|
||||
close();
|
||||
|
||||
if (!this->is_open())
|
||||
{
|
||||
if ((_M_cfile = fopen(__name, __c_mode)))
|
||||
{
|
||||
_M_cfile_created = true;
|
||||
__ret = this;
|
||||
}
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
bool
|
||||
__basic_file<_CharT>::is_open() { return _M_cfile != 0; }
|
||||
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::fd() { return fileno(_M_cfile) ; }
|
||||
|
||||
template<typename _CharT>
|
||||
__basic_file<_CharT>*
|
||||
__basic_file<_CharT>::close()
|
||||
{
|
||||
__basic_file* __retval = static_cast<__basic_file*>(NULL);
|
||||
if (_M_cfile_created && fclose(_M_cfile))
|
||||
__retval = this;
|
||||
return __retval;
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
streamsize
|
||||
__basic_file<_CharT>::xsgetn(_CharT* __s, streamsize __n)
|
||||
{ return fread(__s, 1, __n, _M_cfile); }
|
||||
bool
|
||||
is_open();
|
||||
|
||||
template<typename _CharT>
|
||||
streamsize
|
||||
__basic_file<_CharT>::xsputn(const _CharT* __s, streamsize __n)
|
||||
{ return fwrite(__s, 1, __n, _M_cfile); }
|
||||
|
||||
template<typename _CharT>
|
||||
streamoff
|
||||
__basic_file<_CharT>::seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode /*__mode*/)
|
||||
{ fseek(_M_cfile, __off, __way); return ftell(_M_cfile); }
|
||||
int
|
||||
fd();
|
||||
|
||||
template<typename _CharT>
|
||||
streamoff
|
||||
__basic_file<_CharT>::seekpos(streamoff __pos,
|
||||
ios_base::openmode /*__mode*/)
|
||||
{ fseek(_M_cfile, __pos, ios_base::beg); return ftell(_M_cfile); }
|
||||
~__basic_file();
|
||||
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::sync()
|
||||
{ return fflush(_M_cfile); }
|
||||
streamsize
|
||||
xsputn(const char* __s, streamsize __n);
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::overflow(int /*__c*/)
|
||||
{ return EOF; }
|
||||
streamsize
|
||||
xsgetn(char* __s, streamsize __n);
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::underflow()
|
||||
{ return EOF; }
|
||||
streamoff
|
||||
seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::uflow()
|
||||
{ return EOF; }
|
||||
streamoff
|
||||
seekpos(streamoff __pos,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::pbackfail(int /*__c*/)
|
||||
{ return EOF; }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
streambuf*
|
||||
__basic_file<_CharT>::setbuf(_CharT* /*__b*/, int /*__len*/)
|
||||
{ return reinterpret_cast<streambuf*>(this); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::doallocate()
|
||||
{ return EOF; }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
streamsize
|
||||
__basic_file<_CharT>::sys_read(_CharT* __s, streamsize __n)
|
||||
{ return fread(__s, 1, __n, _M_cfile); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
streamsize
|
||||
__basic_file<_CharT>::sys_write(const _CharT* __s, streamsize __n)
|
||||
{ return fwrite(__s, 1, __n, _M_cfile); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
streamoff
|
||||
__basic_file<_CharT>::sys_seek(streamoff __pos, ios_base::seekdir __way)
|
||||
{
|
||||
fseek(_M_cfile, __pos, __way);
|
||||
return ftell(_M_cfile);
|
||||
}
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::sys_close()
|
||||
{ return fclose(_M_cfile); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::sys_stat(void* /*__v*/)
|
||||
{ return EOF; }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::showmanyc()
|
||||
{ return EOF; }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
void
|
||||
__basic_file<_CharT>::imbue(void* /*__v*/) { }
|
||||
int
|
||||
sync();
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
#endif // _CPP_BASIC_FILE
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// underlying io library -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
// 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
|
||||
|
|
@ -55,7 +55,6 @@ namespace std
|
|||
#endif
|
||||
|
||||
// from basic_file.h
|
||||
#define _GLIBCPP_BASIC_FILE_INHERITANCE 1
|
||||
typedef _IO_FILE __c_file_type;
|
||||
typedef _IO_wide_data __c_wfile_type;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// underlying io library -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
// 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
|
||||
|
|
@ -49,7 +49,6 @@ namespace std
|
|||
typedef __gthread_mutex_t __c_lock;
|
||||
|
||||
// for basic_file.h
|
||||
#define _GLIBCPP_BASIC_FILE_ENCAPSULATION 1
|
||||
typedef FILE __c_file_type;
|
||||
|
||||
// for ios_base.h
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -34,7 +34,6 @@ glibcpp_builddir=@glibcpp_builddir@
|
|||
bits_srcdir = ${glibcpp_srcdir}/include/bits
|
||||
bits_builddir = ./bits
|
||||
bits_headers = \
|
||||
${bits_srcdir}/basic_file.h \
|
||||
${bits_srcdir}/basic_ios.h \
|
||||
${bits_srcdir}/basic_ios.tcc \
|
||||
${bits_srcdir}/basic_string.h \
|
||||
|
|
@ -278,7 +277,7 @@ target_headers = \
|
|||
${glibcpp_srcdir}/@CPU_LIMITS_INC_SRCDIR@/cpu_limits.h
|
||||
# These extra_target_headers files are all built with ad hoc naming rules.
|
||||
extra_target_headers = \
|
||||
${target_builddir}/basic_file_model.h \
|
||||
${target_builddir}/basic_file.h \
|
||||
${target_builddir}/c++config.h \
|
||||
${target_builddir}/c++io.h \
|
||||
${target_builddir}/c++locale.h \
|
||||
|
|
@ -360,7 +359,7 @@ stamp-target: ${target_headers} ${target_builddir}
|
|||
@cd ${target_builddir} ;\
|
||||
if [ ! -f stamp-target ]; then \
|
||||
@LN_S@ ${target_headers} . || true ;\
|
||||
@LN_S@ ${glibcpp_srcdir}/@BASIC_FILE_H@ basic_file_model.h || true ;\
|
||||
@LN_S@ ${glibcpp_srcdir}/@BASIC_FILE_H@ basic_file.h || true ;\
|
||||
@LN_S@ ${glibcpp_srcdir}/@CSTDIO_H@ c++io.h || true ;\
|
||||
@LN_S@ ${glibcpp_srcdir}/@CLOCALE_H@ c++locale.h || true ;\
|
||||
@LN_S@ ${glibcpp_srcdir}/@CMESSAGES_H@ messages_members.h || true ;\
|
||||
|
|
|
|||
|
|
@ -159,7 +159,6 @@ glibcpp_builddir = @glibcpp_builddir@
|
|||
bits_srcdir = ${glibcpp_srcdir}/include/bits
|
||||
bits_builddir = ./bits
|
||||
bits_headers = \
|
||||
${bits_srcdir}/basic_file.h \
|
||||
${bits_srcdir}/basic_ios.h \
|
||||
${bits_srcdir}/basic_ios.tcc \
|
||||
${bits_srcdir}/basic_string.h \
|
||||
|
|
@ -412,7 +411,7 @@ target_headers = \
|
|||
|
||||
# These extra_target_headers files are all built with ad hoc naming rules.
|
||||
extra_target_headers = \
|
||||
${target_builddir}/basic_file_model.h \
|
||||
${target_builddir}/basic_file.h \
|
||||
${target_builddir}/c++config.h \
|
||||
${target_builddir}/c++io.h \
|
||||
${target_builddir}/c++locale.h \
|
||||
|
|
@ -611,7 +610,7 @@ stamp-target: ${target_headers} ${target_builddir}
|
|||
@cd ${target_builddir} ;\
|
||||
if [ ! -f stamp-target ]; then \
|
||||
@LN_S@ ${target_headers} . || true ;\
|
||||
@LN_S@ ${glibcpp_srcdir}/@BASIC_FILE_H@ basic_file_model.h || true ;\
|
||||
@LN_S@ ${glibcpp_srcdir}/@BASIC_FILE_H@ basic_file.h || true ;\
|
||||
@LN_S@ ${glibcpp_srcdir}/@CSTDIO_H@ c++io.h || true ;\
|
||||
@LN_S@ ${glibcpp_srcdir}/@CLOCALE_H@ c++locale.h || true ;\
|
||||
@LN_S@ ${glibcpp_srcdir}/@CMESSAGES_H@ messages_members.h || true ;\
|
||||
|
|
|
|||
|
|
@ -1,264 +0,0 @@
|
|||
// Wrapper of C-language FILE struct -*- C++ -*-
|
||||
|
||||
// Copyright (C) 1999, 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: 27.8 File-based streams
|
||||
//
|
||||
|
||||
/** @file basic_file.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
#ifndef _CPP_BASIC_FILE
|
||||
#define _CPP_BASIC_FILE 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <bits/c++config.h>
|
||||
#include <ios>
|
||||
|
||||
namespace std
|
||||
{
|
||||
// Ulrich is going to make some detailed comment here, explaining
|
||||
// all this unpleasantness, providing detailed performance analysis
|
||||
// as to why we have to do all this lame vtable hacking instead of a
|
||||
// sane, function-based approach. This verbiage will provide a clear
|
||||
// and detailed description of the whole object-layout,
|
||||
// vtable-swapping, sordid history of this hack.
|
||||
template<typename _CharT>
|
||||
struct __basic_file_base: public __c_file_type
|
||||
{
|
||||
virtual
|
||||
~__basic_file_base() { };
|
||||
|
||||
virtual int
|
||||
overflow(int __c = EOF) = 0;
|
||||
|
||||
virtual int
|
||||
underflow() = 0;
|
||||
|
||||
virtual int
|
||||
uflow() = 0;
|
||||
|
||||
virtual int
|
||||
pbackfail(int __c) = 0;
|
||||
|
||||
virtual streamsize
|
||||
xsputn(const _CharT* __s, streamsize __n) = 0;
|
||||
|
||||
virtual streamsize
|
||||
xsgetn(_CharT* __s, streamsize __n) = 0;
|
||||
|
||||
virtual streamoff
|
||||
seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out) = 0;
|
||||
|
||||
virtual streamoff
|
||||
seekpos(streamoff __pos,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out) = 0;
|
||||
|
||||
virtual streambuf*
|
||||
setbuf(_CharT* __b, int __len) = 0;
|
||||
|
||||
virtual int
|
||||
sync() = 0;
|
||||
|
||||
virtual int
|
||||
doallocate() = 0;
|
||||
|
||||
virtual streamsize
|
||||
sys_read(_CharT* __s, streamsize __n) = 0;
|
||||
|
||||
virtual streamsize
|
||||
sys_write(const _CharT* __s, streamsize __n) = 0;
|
||||
|
||||
virtual streamoff
|
||||
sys_seek(streamoff __off, ios_base::seekdir __way) = 0;
|
||||
|
||||
virtual int
|
||||
sys_close() = 0;
|
||||
|
||||
virtual int
|
||||
sys_stat(void* __v) = 0;
|
||||
|
||||
virtual int
|
||||
showmanyc() = 0;
|
||||
|
||||
virtual void
|
||||
imbue(void* __v) = 0;
|
||||
};
|
||||
|
||||
// Some of these member functions are based on libio/filebuf.cc.
|
||||
// Also note that the order and number of virtual functions has to precisely
|
||||
// match the order and number in the _IO_jump_t struct defined in libioP.h.
|
||||
template<typename _CharT>
|
||||
#ifdef _GLIBCPP_BASIC_FILE_INHERITANCE
|
||||
class __basic_file: public __basic_file_base<_CharT>
|
||||
#else
|
||||
class __basic_file
|
||||
#endif
|
||||
{
|
||||
#if _GLIBCPP_BASIC_FILE_ENCAPSULATION
|
||||
// underlying data source/sink
|
||||
__c_file_type* _M_cfile;
|
||||
// true iff we opened _M_cfile, and thus must close it ourselves
|
||||
bool _M_cfile_created;
|
||||
#else
|
||||
# ifdef _GLIBCPP_USE_WCHAR_T
|
||||
__c_wfile_type _M_wfile;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
public:
|
||||
__basic_file(__c_lock* __lock = 0);
|
||||
|
||||
void
|
||||
_M_open_mode(ios_base::openmode __mode, int& __p_mode, int& __rw_mode,
|
||||
char* __c_mode);
|
||||
|
||||
// Equivalent to the normal fopen function.
|
||||
__basic_file*
|
||||
open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
|
||||
|
||||
// Used for opening the standard streams, cin, cout, cerr, clog,
|
||||
// and their wide-stream equivalents. Instead of calling open, it
|
||||
// just sets
|
||||
// - for libio: __c_file_type->_fileno and the respective _flags bits
|
||||
// - for stdio: _M_cfile = __file and some internal flags
|
||||
// and returns.
|
||||
__basic_file*
|
||||
sys_open(__c_file_type* __file, ios_base::openmode __mode);
|
||||
|
||||
_CharT
|
||||
sys_getc();
|
||||
|
||||
_CharT
|
||||
sys_ungetc(_CharT);
|
||||
|
||||
__basic_file*
|
||||
close();
|
||||
|
||||
bool
|
||||
is_open();
|
||||
|
||||
int
|
||||
fd();
|
||||
|
||||
// NB: Must match FILE specific jump table starting here--this
|
||||
// means all virtual functions starting with the dtor must match,
|
||||
// slot by slot. For glibc-based dystems, this means the _IO_FILE
|
||||
// as the FILE struct and _IO_jump_t as the jump table.
|
||||
virtual
|
||||
~__basic_file(); // Takes the place of __finish.
|
||||
|
||||
virtual int
|
||||
overflow(int __c = EOF);
|
||||
|
||||
virtual int
|
||||
underflow();
|
||||
|
||||
virtual int
|
||||
uflow();
|
||||
|
||||
virtual int
|
||||
pbackfail(int __c);
|
||||
|
||||
// A complex "write" function that sets all of __c_file_type's
|
||||
// pointers and associated data members correctly and manages its
|
||||
// relation to the external byte sequence.
|
||||
virtual streamsize
|
||||
xsputn(const _CharT* __s, streamsize __n);
|
||||
|
||||
// A complex "read" function that sets all of __c_file_type's
|
||||
// pointers and associated data members correctly and manages its
|
||||
// relation to the external byte sequence.
|
||||
virtual streamsize
|
||||
xsgetn(_CharT* __s, streamsize __n);
|
||||
|
||||
// A complex "seekoff" function that sets all of __c_file_type's
|
||||
// pointers and associated data members correctly and manages its
|
||||
// relation to the external byte sequence.
|
||||
virtual streamoff
|
||||
seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
|
||||
// A complex "seekpos" function that sets all of __c_file_type's
|
||||
// pointers and associated data members correctly and manages its
|
||||
// relation to the external byte sequence.
|
||||
virtual streamoff
|
||||
seekpos(streamoff __pos,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
|
||||
virtual streambuf*
|
||||
setbuf(_CharT* __b, int __len);
|
||||
|
||||
virtual int
|
||||
sync();
|
||||
|
||||
virtual int
|
||||
doallocate();
|
||||
|
||||
// A simple read function for the external byte sequence, that
|
||||
// does no mucking around with or setting of the pointers or flags
|
||||
// in __c_file_type.
|
||||
virtual streamsize
|
||||
sys_read(_CharT* __s, streamsize __n);
|
||||
|
||||
// A simple write function for the external byte sequence, that
|
||||
// does no mucking around with or setting of the pointers or flags
|
||||
// in __c_file_type.
|
||||
virtual streamsize
|
||||
sys_write(const _CharT* __s, streamsize __n);
|
||||
|
||||
// A simple seek function for the external byte sequence, that
|
||||
// does no mucking around with or setting of the pointers or flags
|
||||
// in __c_file_type.
|
||||
virtual streamoff
|
||||
sys_seek(streamoff __off, ios_base::seekdir __way);
|
||||
|
||||
virtual int
|
||||
sys_close();
|
||||
|
||||
virtual int
|
||||
sys_stat(void* __v);
|
||||
|
||||
virtual int
|
||||
showmanyc();
|
||||
|
||||
virtual void
|
||||
imbue(void* __v);
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
// Now include the bits that are dependent on the underlying I/O
|
||||
// model chosen at configure time.
|
||||
#include <bits/basic_file_model.h>
|
||||
|
||||
#endif // _CPP_BASIC_FILE
|
||||
|
|
@ -119,7 +119,6 @@ namespace std
|
|||
// 4. All fields==0 is an empty string, given the extra storage
|
||||
// beyond-the-end for a null terminator; thus, the shared
|
||||
// empty string representation needs no constructor.
|
||||
|
||||
struct _Rep
|
||||
{
|
||||
// Types:
|
||||
|
|
|
|||
|
|
@ -43,16 +43,16 @@
|
|||
|
||||
namespace std
|
||||
{
|
||||
template<typename _CharT, typename _Traits, typename _Alloc>
|
||||
const _CharT
|
||||
basic_string<_CharT, _Traits, _Alloc>::
|
||||
_Rep::_S_terminal = _CharT();
|
||||
|
||||
template<typename _CharT, typename _Traits, typename _Alloc>
|
||||
const typename basic_string<_CharT, _Traits, _Alloc>::size_type
|
||||
basic_string<_CharT, _Traits, _Alloc>::
|
||||
_Rep::_S_max_size = (((npos - sizeof(_Rep))/sizeof(_CharT)) - 1) / 4;
|
||||
|
||||
template<typename _CharT, typename _Traits, typename _Alloc>
|
||||
const _CharT
|
||||
basic_string<_CharT, _Traits, _Alloc>::
|
||||
_Rep::_S_terminal = _CharT();
|
||||
|
||||
template<typename _CharT, typename _Traits, typename _Alloc>
|
||||
const typename basic_string<_CharT, _Traits, _Alloc>::size_type
|
||||
basic_string<_CharT, _Traits, _Alloc>::npos;
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ namespace std
|
|||
// NB: There is no accessor for _M_index because it may be used
|
||||
// before the constructor is run; the effect of calling a member
|
||||
// function (even an inline) would be undefined.
|
||||
mutable size_t _M_index;
|
||||
mutable size_t _M_index;
|
||||
|
||||
// Last id number assigned
|
||||
static _Atomic_word _S_highwater;
|
||||
|
|
|
|||
|
|
@ -1775,7 +1775,7 @@ __result, __binary_pred, _IterType());
|
|||
}
|
||||
}
|
||||
|
||||
const int __stl_threshold = 16;
|
||||
extern const int __stl_threshold;
|
||||
|
||||
// sort() and its auxiliary functions.
|
||||
|
||||
|
|
@ -2060,7 +2060,7 @@ __result, __binary_pred, _IterType());
|
|||
__comp);
|
||||
}
|
||||
|
||||
const int __stl_chunk_size = 7;
|
||||
extern const int __stl_chunk_size;
|
||||
|
||||
template<typename _RandomAccessIter, typename _Distance>
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Allocators -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
|
|
@ -321,267 +321,274 @@ typedef __mem_interface __single_client_alloc;
|
|||
* @endmaint
|
||||
* (See @link Allocators allocators info @endlink for more.)
|
||||
*/
|
||||
template <bool __threads, int __inst>
|
||||
class __default_alloc_template
|
||||
{
|
||||
template<bool __threads, int __inst>
|
||||
class __default_alloc_template
|
||||
{
|
||||
private:
|
||||
enum {_ALIGN = 8};
|
||||
enum {_MAX_BYTES = 128};
|
||||
enum {_NFREELISTS = _MAX_BYTES / _ALIGN};
|
||||
|
||||
union _Obj
|
||||
{
|
||||
union _Obj* _M_free_list_link;
|
||||
char _M_client_data[1]; // The client sees this.
|
||||
};
|
||||
|
||||
private:
|
||||
enum {_ALIGN = 8};
|
||||
enum {_MAX_BYTES = 128};
|
||||
enum {_NFREELISTS = _MAX_BYTES / _ALIGN};
|
||||
static _Obj* volatile _S_free_list[_NFREELISTS];
|
||||
|
||||
static size_t
|
||||
_S_round_up(size_t __bytes)
|
||||
// Chunk allocation state.
|
||||
static char* _S_start_free;
|
||||
static char* _S_end_free;
|
||||
static size_t _S_heap_size;
|
||||
|
||||
static _STL_mutex_lock _S_node_allocator_lock;
|
||||
|
||||
static size_t
|
||||
_S_round_up(size_t __bytes)
|
||||
{ return (((__bytes) + (size_t) _ALIGN-1) & ~((size_t) _ALIGN - 1)); }
|
||||
|
||||
union _Obj {
|
||||
union _Obj* _M_free_list_link;
|
||||
char _M_client_data[1]; // The client sees this.
|
||||
};
|
||||
|
||||
static _Obj* volatile _S_free_list[];
|
||||
static size_t _S_freelist_index(size_t __bytes)
|
||||
static size_t
|
||||
_S_freelist_index(size_t __bytes)
|
||||
{ return (((__bytes) + (size_t)_ALIGN-1)/(size_t)_ALIGN - 1); }
|
||||
|
||||
// Returns an object of size __n, and optionally adds to size __n free list.
|
||||
static void* _S_refill(size_t __n);
|
||||
// Allocates a chunk for nobjs of size size. nobjs may be reduced
|
||||
// if it is inconvenient to allocate the requested number.
|
||||
static char* _S_chunk_alloc(size_t __size, int& __nobjs);
|
||||
// Returns an object of size __n, and optionally adds to size __n
|
||||
// free list.
|
||||
static void*
|
||||
_S_refill(size_t __n);
|
||||
|
||||
// Chunk allocation state.
|
||||
static char* _S_start_free;
|
||||
static char* _S_end_free;
|
||||
static size_t _S_heap_size;
|
||||
|
||||
static _STL_mutex_lock _S_node_allocator_lock;
|
||||
|
||||
// It would be nice to use _STL_auto_lock here. But we need a test whether
|
||||
// threads are in use.
|
||||
class _Lock {
|
||||
// Allocates a chunk for nobjs of size size. nobjs may be reduced
|
||||
// if it is inconvenient to allocate the requested number.
|
||||
static char*
|
||||
_S_chunk_alloc(size_t __size, int& __nobjs);
|
||||
|
||||
// It would be nice to use _STL_auto_lock here. But we need a
|
||||
// test whether threads are in use.
|
||||
class _Lock
|
||||
{
|
||||
public:
|
||||
_Lock() { if (__threads) _S_node_allocator_lock._M_acquire_lock(); }
|
||||
~_Lock() { if (__threads) _S_node_allocator_lock._M_release_lock(); }
|
||||
} __attribute__ ((__unused__));
|
||||
friend class _Lock;
|
||||
|
||||
public:
|
||||
|
||||
// __n must be > 0
|
||||
static void* allocate(size_t __n)
|
||||
{
|
||||
void* __ret = 0;
|
||||
|
||||
if (__n > (size_t) _MAX_BYTES)
|
||||
__ret = __mem_interface::allocate(__n);
|
||||
else
|
||||
{
|
||||
_Obj* volatile* __my_free_list = _S_free_list + _S_freelist_index(__n);
|
||||
// Acquire the lock here with a constructor call. This ensures that
|
||||
// it is released in exit or during stack unwinding.
|
||||
_Lock __lock_instance;
|
||||
_Obj* __restrict__ __result = *__my_free_list;
|
||||
if (__result == 0)
|
||||
__ret = _S_refill(_S_round_up(__n));
|
||||
else
|
||||
{
|
||||
*__my_free_list = __result -> _M_free_list_link;
|
||||
__ret = __result;
|
||||
}
|
||||
}
|
||||
} __attribute__ ((__unused__));
|
||||
friend class _Lock;
|
||||
|
||||
return __ret;
|
||||
public:
|
||||
// __n must be > 0
|
||||
static void*
|
||||
allocate(size_t __n)
|
||||
{
|
||||
void* __ret = 0;
|
||||
|
||||
if (__n > (size_t) _MAX_BYTES)
|
||||
__ret = __mem_interface::allocate(__n);
|
||||
else
|
||||
{
|
||||
_Obj* volatile* __my_free_list = _S_free_list
|
||||
+ _S_freelist_index(__n);
|
||||
// Acquire the lock here with a constructor call. This
|
||||
// ensures that it is released in exit or during stack
|
||||
// unwinding.
|
||||
_Lock __lock_instance;
|
||||
_Obj* __restrict__ __result = *__my_free_list;
|
||||
if (__result == 0)
|
||||
__ret = _S_refill(_S_round_up(__n));
|
||||
else
|
||||
{
|
||||
*__my_free_list = __result -> _M_free_list_link;
|
||||
__ret = __result;
|
||||
}
|
||||
}
|
||||
return __ret;
|
||||
};
|
||||
|
||||
// __p may not be 0
|
||||
static void
|
||||
deallocate(void* __p, size_t __n)
|
||||
{
|
||||
if (__n > (size_t) _MAX_BYTES)
|
||||
__mem_interface::deallocate(__p, __n);
|
||||
else
|
||||
{
|
||||
_Obj* volatile* __my_free_list
|
||||
= _S_free_list + _S_freelist_index(__n);
|
||||
_Obj* __q = (_Obj*)__p;
|
||||
|
||||
// Acquire the lock here with a constructor call. This ensures that
|
||||
// it is released in exit or during stack unwinding.
|
||||
_Lock __lock_instance;
|
||||
__q -> _M_free_list_link = *__my_free_list;
|
||||
*__my_free_list = __q;
|
||||
}
|
||||
}
|
||||
|
||||
static void*
|
||||
reallocate(void* __p, size_t __old_sz, size_t __new_sz);
|
||||
};
|
||||
|
||||
// __p may not be 0
|
||||
static void deallocate(void* __p, size_t __n)
|
||||
{
|
||||
if (__n > (size_t) _MAX_BYTES)
|
||||
__mem_interface::deallocate(__p, __n);
|
||||
else
|
||||
{
|
||||
_Obj* volatile* __my_free_list
|
||||
= _S_free_list + _S_freelist_index(__n);
|
||||
_Obj* __q = (_Obj*)__p;
|
||||
|
||||
// Acquire the lock here with a constructor call. This ensures that
|
||||
// it is released in exit or during stack unwinding.
|
||||
_Lock __lock_instance;
|
||||
__q -> _M_free_list_link = *__my_free_list;
|
||||
*__my_free_list = __q;
|
||||
}
|
||||
}
|
||||
|
||||
static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz);
|
||||
};
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
inline bool
|
||||
operator==(const __default_alloc_template<__threads, __inst>&,
|
||||
const __default_alloc_template<__threads, __inst>&)
|
||||
{ return true; }
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
inline bool
|
||||
operator!=(const __default_alloc_template<__threads, __inst>&,
|
||||
const __default_alloc_template<__threads, __inst>&)
|
||||
{ return false; }
|
||||
|
||||
|
||||
template <bool __threads, int __inst>
|
||||
inline bool operator==(const __default_alloc_template<__threads, __inst>&,
|
||||
const __default_alloc_template<__threads, __inst>&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <bool __threads, int __inst>
|
||||
inline bool operator!=(const __default_alloc_template<__threads, __inst>&,
|
||||
const __default_alloc_template<__threads, __inst>&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// We allocate memory in large chunks in order to avoid fragmenting the
|
||||
// malloc heap (or whatever __mem_interface is using) too much. We assume
|
||||
// that __size is properly aligned. We hold the allocation lock.
|
||||
template <bool __threads, int __inst>
|
||||
char*
|
||||
__default_alloc_template<__threads, __inst>::_S_chunk_alloc(size_t __size,
|
||||
int& __nobjs)
|
||||
{
|
||||
char* __result;
|
||||
size_t __total_bytes = __size * __nobjs;
|
||||
size_t __bytes_left = _S_end_free - _S_start_free;
|
||||
|
||||
if (__bytes_left >= __total_bytes)
|
||||
// We allocate memory in large chunks in order to avoid fragmenting the
|
||||
// malloc heap (or whatever __mem_interface is using) too much. We assume
|
||||
// that __size is properly aligned. We hold the allocation lock.
|
||||
template<bool __threads, int __inst>
|
||||
char*
|
||||
__default_alloc_template<__threads, __inst>::_S_chunk_alloc(size_t __size,
|
||||
int& __nobjs)
|
||||
{
|
||||
char* __result;
|
||||
size_t __total_bytes = __size * __nobjs;
|
||||
size_t __bytes_left = _S_end_free - _S_start_free;
|
||||
|
||||
if (__bytes_left >= __total_bytes)
|
||||
{
|
||||
__result = _S_start_free;
|
||||
_S_start_free += __total_bytes;
|
||||
return(__result);
|
||||
}
|
||||
else if (__bytes_left >= __size)
|
||||
{
|
||||
__nobjs = (int)(__bytes_left/__size);
|
||||
__total_bytes = __size * __nobjs;
|
||||
__result = _S_start_free;
|
||||
_S_start_free += __total_bytes;
|
||||
return(__result);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t __bytes_to_get =
|
||||
2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
|
||||
// Try to make use of the left-over piece.
|
||||
if (__bytes_left > 0)
|
||||
{
|
||||
_Obj* volatile* __my_free_list =
|
||||
_S_free_list + _S_freelist_index(__bytes_left);
|
||||
|
||||
((_Obj*)_S_start_free) -> _M_free_list_link = *__my_free_list;
|
||||
*__my_free_list = (_Obj*)_S_start_free;
|
||||
}
|
||||
_S_start_free = (char*) __mem_interface::allocate(__bytes_to_get);
|
||||
if (0 == _S_start_free)
|
||||
{
|
||||
size_t __i;
|
||||
_Obj* volatile* __my_free_list;
|
||||
_Obj* __p;
|
||||
// Try to make do with what we have. That can't hurt. We
|
||||
// do not try smaller requests, since that tends to result
|
||||
// in disaster on multi-process machines.
|
||||
__i = __size;
|
||||
for (; __i <= (size_t) _MAX_BYTES; __i += (size_t) _ALIGN)
|
||||
{
|
||||
__my_free_list = _S_free_list + _S_freelist_index(__i);
|
||||
__p = *__my_free_list;
|
||||
if (0 != __p)
|
||||
{
|
||||
*__my_free_list = __p -> _M_free_list_link;
|
||||
_S_start_free = (char*)__p;
|
||||
_S_end_free = _S_start_free + __i;
|
||||
return(_S_chunk_alloc(__size, __nobjs));
|
||||
// Any leftover piece will eventually make it to the
|
||||
// right free list.
|
||||
}
|
||||
}
|
||||
_S_end_free = 0; // In case of exception.
|
||||
_S_start_free = (char*)__mem_interface::allocate(__bytes_to_get);
|
||||
// This should either throw an exception or remedy the situation.
|
||||
// Thus we assume it succeeded.
|
||||
}
|
||||
_S_heap_size += __bytes_to_get;
|
||||
_S_end_free = _S_start_free + __bytes_to_get;
|
||||
return(_S_chunk_alloc(__size, __nobjs));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Returns an object of size __n, and optionally adds to "size __n"'s free list.
|
||||
// We assume that __n is properly aligned. We hold the allocation lock.
|
||||
template <bool __threads, int __inst>
|
||||
void*
|
||||
__default_alloc_template<__threads, __inst>::_S_refill(size_t __n)
|
||||
{
|
||||
int __nobjs = 20;
|
||||
char* __chunk = _S_chunk_alloc(__n, __nobjs);
|
||||
_Obj* volatile* __my_free_list;
|
||||
_Obj* __result;
|
||||
_Obj* __current_obj;
|
||||
_Obj* __next_obj;
|
||||
int __i;
|
||||
|
||||
if (1 == __nobjs) return(__chunk);
|
||||
__my_free_list = _S_free_list + _S_freelist_index(__n);
|
||||
|
||||
/* Build free list in chunk */
|
||||
else if (__bytes_left >= __size)
|
||||
{
|
||||
__nobjs = (int)(__bytes_left/__size);
|
||||
__total_bytes = __size * __nobjs;
|
||||
__result = _S_start_free;
|
||||
_S_start_free += __total_bytes;
|
||||
return(__result);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t __bytes_to_get =
|
||||
2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
|
||||
// Try to make use of the left-over piece.
|
||||
if (__bytes_left > 0)
|
||||
{
|
||||
_Obj* volatile* __my_free_list =
|
||||
_S_free_list + _S_freelist_index(__bytes_left);
|
||||
|
||||
((_Obj*)_S_start_free) -> _M_free_list_link = *__my_free_list;
|
||||
*__my_free_list = (_Obj*)_S_start_free;
|
||||
}
|
||||
_S_start_free = (char*) __mem_interface::allocate(__bytes_to_get);
|
||||
if (0 == _S_start_free)
|
||||
{
|
||||
size_t __i;
|
||||
_Obj* volatile* __my_free_list;
|
||||
_Obj* __p;
|
||||
// Try to make do with what we have. That can't hurt. We
|
||||
// do not try smaller requests, since that tends to result
|
||||
// in disaster on multi-process machines.
|
||||
__i = __size;
|
||||
for (; __i <= (size_t) _MAX_BYTES; __i += (size_t) _ALIGN)
|
||||
{
|
||||
__my_free_list = _S_free_list + _S_freelist_index(__i);
|
||||
__p = *__my_free_list;
|
||||
if (0 != __p)
|
||||
{
|
||||
*__my_free_list = __p -> _M_free_list_link;
|
||||
_S_start_free = (char*)__p;
|
||||
_S_end_free = _S_start_free + __i;
|
||||
return(_S_chunk_alloc(__size, __nobjs));
|
||||
// Any leftover piece will eventually make it to the
|
||||
// right free list.
|
||||
}
|
||||
}
|
||||
_S_end_free = 0; // In case of exception.
|
||||
_S_start_free = (char*)__mem_interface::allocate(__bytes_to_get);
|
||||
// This should either throw an exception or remedy the situation.
|
||||
// Thus we assume it succeeded.
|
||||
}
|
||||
_S_heap_size += __bytes_to_get;
|
||||
_S_end_free = _S_start_free + __bytes_to_get;
|
||||
return(_S_chunk_alloc(__size, __nobjs));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Returns an object of size __n, and optionally adds to "size
|
||||
// __n"'s free list. We assume that __n is properly aligned. We
|
||||
// hold the allocation lock.
|
||||
template<bool __threads, int __inst>
|
||||
void*
|
||||
__default_alloc_template<__threads, __inst>::_S_refill(size_t __n)
|
||||
{
|
||||
int __nobjs = 20;
|
||||
char* __chunk = _S_chunk_alloc(__n, __nobjs);
|
||||
_Obj* volatile* __my_free_list;
|
||||
_Obj* __result;
|
||||
_Obj* __current_obj;
|
||||
_Obj* __next_obj;
|
||||
int __i;
|
||||
|
||||
if (1 == __nobjs) return(__chunk);
|
||||
__my_free_list = _S_free_list + _S_freelist_index(__n);
|
||||
|
||||
/* Build free list in chunk */
|
||||
__result = (_Obj*)__chunk;
|
||||
*__my_free_list = __next_obj = (_Obj*)(__chunk + __n);
|
||||
for (__i = 1; ; __i++) {
|
||||
__current_obj = __next_obj;
|
||||
__next_obj = (_Obj*)((char*)__next_obj + __n);
|
||||
if (__nobjs - 1 == __i) {
|
||||
__current_obj -> _M_free_list_link = 0;
|
||||
break;
|
||||
__current_obj -> _M_free_list_link = 0;
|
||||
break;
|
||||
} else {
|
||||
__current_obj -> _M_free_list_link = __next_obj;
|
||||
__current_obj -> _M_free_list_link = __next_obj;
|
||||
}
|
||||
}
|
||||
return(__result);
|
||||
}
|
||||
|
||||
|
||||
template <bool threads, int inst>
|
||||
void*
|
||||
__default_alloc_template<threads, inst>::reallocate(void* __p,
|
||||
size_t __old_sz,
|
||||
size_t __new_sz)
|
||||
{
|
||||
void* __result;
|
||||
size_t __copy_sz;
|
||||
|
||||
if (__old_sz > (size_t) _MAX_BYTES && __new_sz > (size_t) _MAX_BYTES) {
|
||||
return(realloc(__p, __new_sz));
|
||||
return(__result);
|
||||
}
|
||||
if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p);
|
||||
__result = allocate(__new_sz);
|
||||
__copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
|
||||
memcpy(__result, __p, __copy_sz);
|
||||
deallocate(__p, __old_sz);
|
||||
return(__result);
|
||||
}
|
||||
|
||||
template <bool __threads, int __inst>
|
||||
|
||||
template<bool threads, int inst>
|
||||
void*
|
||||
__default_alloc_template<threads, inst>::reallocate(void* __p,
|
||||
size_t __old_sz,
|
||||
size_t __new_sz)
|
||||
{
|
||||
void* __result;
|
||||
size_t __copy_sz;
|
||||
|
||||
if (__old_sz > (size_t) _MAX_BYTES && __new_sz > (size_t) _MAX_BYTES) {
|
||||
return(realloc(__p, __new_sz));
|
||||
}
|
||||
if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p);
|
||||
__result = allocate(__new_sz);
|
||||
__copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
|
||||
memcpy(__result, __p, __copy_sz);
|
||||
deallocate(__p, __old_sz);
|
||||
return(__result);
|
||||
}
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
_STL_mutex_lock
|
||||
__default_alloc_template<__threads, __inst>::_S_node_allocator_lock
|
||||
__STL_MUTEX_INITIALIZER;
|
||||
|
||||
template <bool __threads, int __inst>
|
||||
char* __default_alloc_template<__threads, __inst>::_S_start_free = 0;
|
||||
|
||||
template <bool __threads, int __inst>
|
||||
char* __default_alloc_template<__threads, __inst>::_S_end_free = 0;
|
||||
|
||||
template <bool __threads, int __inst>
|
||||
size_t __default_alloc_template<__threads, __inst>::_S_heap_size = 0;
|
||||
|
||||
template <bool __threads, int __inst>
|
||||
typename __default_alloc_template<__threads, __inst>::_Obj* volatile
|
||||
__default_alloc_template<__threads, __inst> ::_S_free_list[
|
||||
__default_alloc_template<__threads, __inst>::_NFREELISTS ];
|
||||
|
||||
|
||||
typedef __default_alloc_template<true, 0> __alloc;
|
||||
typedef __default_alloc_template<false, 0> __single_client_alloc;
|
||||
__STL_MUTEX_INITIALIZER;
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
char* __default_alloc_template<__threads, __inst>::_S_start_free = 0;
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
char* __default_alloc_template<__threads, __inst>::_S_end_free = 0;
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
size_t __default_alloc_template<__threads, __inst>::_S_heap_size = 0;
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
typename __default_alloc_template<__threads, __inst>::_Obj* volatile
|
||||
__default_alloc_template<__threads, __inst>::_S_free_list[_NFREELISTS];
|
||||
|
||||
typedef __default_alloc_template<true, 0> __alloc;
|
||||
typedef __default_alloc_template<false, 0> __single_client_alloc;
|
||||
|
||||
|
||||
#endif /* ! __USE_MALLOC */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// bit_vector and vector<bool> specialization -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
|
|
@ -63,8 +63,7 @@
|
|||
|
||||
namespace std
|
||||
{
|
||||
|
||||
static const int __WORD_BIT = int(CHAR_BIT*sizeof(unsigned int));
|
||||
extern const int __WORD_BIT;
|
||||
|
||||
struct _Bit_reference {
|
||||
unsigned int* _M_p;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// RB tree implementation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
|
|
@ -90,10 +90,9 @@ iterators invalidated are those referring to the deleted node.
|
|||
|
||||
namespace std
|
||||
{
|
||||
|
||||
typedef bool _Rb_tree_Color_type;
|
||||
const _Rb_tree_Color_type _S_rb_tree_red = false;
|
||||
const _Rb_tree_Color_type _S_rb_tree_black = true;
|
||||
typedef bool _Rb_tree_Color_type;
|
||||
extern const _Rb_tree_Color_type _S_rb_tree_red; // false
|
||||
extern const _Rb_tree_Color_type _S_rb_tree_black; // true
|
||||
|
||||
struct _Rb_tree_node_base
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Explicit instantiation file.
|
||||
|
||||
// Copyright (C) 1999, 2001 Free Software Foundation, Inc.
|
||||
// Copyright (C) 1999, 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
|
||||
|
|
@ -35,9 +35,16 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
#include <map>
|
||||
|
||||
namespace std
|
||||
{
|
||||
const int __stl_threshold = 16;
|
||||
const int __stl_chunk_size = 7;
|
||||
const int __WORD_BIT = int(CHAR_BIT*sizeof(unsigned int));
|
||||
const _Rb_tree_Color_type _S_rb_tree_red = false;
|
||||
const _Rb_tree_Color_type _S_rb_tree_black = true;
|
||||
|
||||
template class __malloc_alloc_template<0>;
|
||||
|
||||
#ifndef __USE_MALLOC
|
||||
|
|
|
|||
Loading…
Reference in New Issue