acinclude.m4 (GLIBCPP_ENABLE_CSTDIO): Simplify.
2003-06-11 Benjamin Kosnik <bkoz@redhat.com> * acinclude.m4 (GLIBCPP_ENABLE_CSTDIO): Simplify. * aclocal.m4: Regenerate. * Makefile.am (SUBDIRS): Remove libio. * Makefile.in: Regenerate. * configure.in: Same. * configure: Regenerate. * config/io/basic_file_libio.cc: Remove. * config/io/basic_file_libio.h: Remove. * config/io/c_io_libio_codecvt.c: Remove. * config/io/c_io_libio.h: Remove. * libio/*: Remove. * src/Makefile.am: Same. * src/Makefile.in: Regenerate. * docs/html/configopts.html: Edits. * docs/html/explanations.html: Edits. From-SVN: r67813
This commit is contained in:
parent
3ad93a3475
commit
58ac1d7f0e
|
@ -1,3 +1,21 @@
|
|||
2003-06-11 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* acinclude.m4 (GLIBCPP_ENABLE_CSTDIO): Simplify.
|
||||
* aclocal.m4: Regenerate.
|
||||
* Makefile.am (SUBDIRS): Remove libio.
|
||||
* Makefile.in: Regenerate.
|
||||
* configure.in: Same.
|
||||
* configure: Regenerate.
|
||||
* config/io/basic_file_libio.cc: Remove.
|
||||
* config/io/basic_file_libio.h: Remove.
|
||||
* config/io/c_io_libio_codecvt.c: Remove.
|
||||
* config/io/c_io_libio.h: Remove.
|
||||
* libio/*: Remove.
|
||||
* src/Makefile.am: Same.
|
||||
* src/Makefile.in: Regenerate.
|
||||
* docs/html/configopts.html: Edits.
|
||||
* docs/html/explanations.html: Edits.
|
||||
|
||||
2003-06-11 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* include/bits/stl_alloc.h (__debug_alloc): Move out.
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
AUTOMAKE_OPTIONS = 1.3 cygnus
|
||||
MAINT_CHARSET = latin1
|
||||
|
||||
SUBDIRS = include libio libmath libsupc++ src po testsuite
|
||||
SUBDIRS = include libmath libsupc++ src po testsuite
|
||||
|
||||
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
@ -70,7 +70,6 @@ AWK = @AWK@
|
|||
BASIC_FILE_CC = @BASIC_FILE_CC@
|
||||
BASIC_FILE_H = @BASIC_FILE_H@
|
||||
CC = @CC@
|
||||
CCODECVT_C = @CCODECVT_C@
|
||||
CCODECVT_CC = @CCODECVT_CC@
|
||||
CCODECVT_H = @CCODECVT_H@
|
||||
CCOLLATE_CC = @CCOLLATE_CC@
|
||||
|
@ -97,7 +96,6 @@ GCJ = @GCJ@
|
|||
GCJFLAGS = @GCJFLAGS@
|
||||
GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
|
||||
GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
|
||||
LIBIO_INCLUDES = @LIBIO_INCLUDES@
|
||||
LIBMATHOBJS = @LIBMATHOBJS@
|
||||
LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
|
||||
LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
|
||||
|
@ -128,6 +126,7 @@ enable_shared = @enable_shared@
|
|||
enable_static = @enable_static@
|
||||
glibcpp_CXX = @glibcpp_CXX@
|
||||
glibcpp_MOFILES = @glibcpp_MOFILES@
|
||||
glibcpp_PCHFLAGS = @glibcpp_PCHFLAGS@
|
||||
glibcpp_POFILES = @glibcpp_POFILES@
|
||||
glibcpp_basedir = @glibcpp_basedir@
|
||||
glibcpp_builddir = @glibcpp_builddir@
|
||||
|
@ -139,14 +138,13 @@ glibcpp_toolexecdir = @glibcpp_toolexecdir@
|
|||
glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
|
||||
gxx_include_dir = @gxx_include_dir@
|
||||
ifGNUmake = @ifGNUmake@
|
||||
libio_la = @libio_la@
|
||||
libtool_VERSION = @libtool_VERSION@
|
||||
toplevel_srcdir = @toplevel_srcdir@
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.3 cygnus
|
||||
MAINT_CHARSET = latin1
|
||||
|
||||
SUBDIRS = include libio libmath libsupc++ src po testsuite
|
||||
SUBDIRS = include libmath libsupc++ src po testsuite
|
||||
|
||||
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
|
||||
|
||||
|
@ -170,7 +168,45 @@ MULTICLEAN = true
|
|||
# Work around what appears to be a GNU make bug handling MAKEFLAGS
|
||||
# values defined in terms of make variables, as is the case for CC and
|
||||
# friends when we are called from the top level Makefile.
|
||||
AM_MAKEFLAGS = "AR_FLAGS=$(AR_FLAGS)" "CC_FOR_BUILD=$(CC_FOR_BUILD)" "CC_FOR_TARGET=$(CC_FOR_TARGET)" "CFLAGS=$(CFLAGS)" "CXXFLAGS=$(CXXFLAGS)" "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" "INSTALL=$(INSTALL)" "INSTALL_DATA=$(INSTALL_DATA)" "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" "LDFLAGS=$(LDFLAGS)" "LIBCFLAGS=$(LIBCFLAGS)" "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" "MAKE=$(MAKE)" "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" "PICFLAG=$(PICFLAG)" "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" "SHELL=$(SHELL)" "RUNTESTFLAGS=$(RUNTESTFLAGS)" "exec_prefix=$(exec_prefix)" "infodir=$(infodir)" "libdir=$(libdir)" "includedir=$(includedir)" "prefix=$(prefix)" "tooldir=$(tooldir)" "gxx_include_dir=$(gxx_include_dir)" "AR=$(AR)" "AS=$(AS)" "LD=$(LD)" "LIBCFLAGS=$(LIBCFLAGS)" "PICFLAG=$(PICFLAG)" "RANLIB=$(RANLIB)" "NM=$(NM)" "NM_FOR_BUILD=$(NM_FOR_BUILD)" "NM_FOR_TARGET=$(NM_FOR_TARGET)" "DESTDIR=$(DESTDIR)" "WERROR=$(WERROR)"
|
||||
AM_MAKEFLAGS = \
|
||||
"AR_FLAGS=$(AR_FLAGS)" \
|
||||
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
|
||||
"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
|
||||
"CFLAGS=$(CFLAGS)" \
|
||||
"CXXFLAGS=$(CXXFLAGS)" \
|
||||
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
|
||||
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
|
||||
"INSTALL=$(INSTALL)" \
|
||||
"INSTALL_DATA=$(INSTALL_DATA)" \
|
||||
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
|
||||
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
|
||||
"LDFLAGS=$(LDFLAGS)" \
|
||||
"LIBCFLAGS=$(LIBCFLAGS)" \
|
||||
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
|
||||
"MAKE=$(MAKE)" \
|
||||
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
|
||||
"PICFLAG=$(PICFLAG)" \
|
||||
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
|
||||
"SHELL=$(SHELL)" \
|
||||
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
|
||||
"exec_prefix=$(exec_prefix)" \
|
||||
"infodir=$(infodir)" \
|
||||
"libdir=$(libdir)" \
|
||||
"includedir=$(includedir)" \
|
||||
"prefix=$(prefix)" \
|
||||
"tooldir=$(tooldir)" \
|
||||
"gxx_include_dir=$(gxx_include_dir)" \
|
||||
"AR=$(AR)" \
|
||||
"AS=$(AS)" \
|
||||
"LD=$(LD)" \
|
||||
"LIBCFLAGS=$(LIBCFLAGS)" \
|
||||
"PICFLAG=$(PICFLAG)" \
|
||||
"RANLIB=$(RANLIB)" \
|
||||
"NM=$(NM)" \
|
||||
"NM_FOR_BUILD=$(NM_FOR_BUILD)" \
|
||||
"NM_FOR_TARGET=$(NM_FOR_TARGET)" \
|
||||
"DESTDIR=$(DESTDIR)" \
|
||||
"WERROR=$(WERROR)"
|
||||
|
||||
|
||||
# Subdir rules rely on $(FLAGS_TO_PASS)
|
||||
|
@ -185,7 +221,7 @@ mkcheck.in testsuite_flags.in
|
|||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
|
@ -199,7 +235,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
|||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
|
||||
cd $(srcdir) && $(ACLOCAL)
|
||||
|
||||
config.status: $(srcdir)/configure.in $(CONFIG_STATUS_DEPENDENCIES)
|
||||
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
@ -272,7 +308,7 @@ maintainer-clean-recursive:
|
|||
dot_seen=no; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
test "$$subdir" = "." && dot_seen=yes; \
|
||||
test "$$subdir" != "." || dot_seen=yes; \
|
||||
done; \
|
||||
test "$$dot_seen" = "no" && rev=". $$rev"; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
|
|
|
@ -206,8 +206,6 @@ AC_DEFUN(GLIBCPP_CONFIGURE, [
|
|||
need_libmath=no
|
||||
enable_wchar_t=no
|
||||
#enable_debug=no
|
||||
#need_libio=no
|
||||
#need_wlibio=no
|
||||
#glibcpp_pch_comp=no
|
||||
#enable_cheaders=c
|
||||
#c_compatibility=no
|
||||
|
@ -1331,10 +1329,9 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
|||
|
||||
|
||||
dnl
|
||||
dnl Check for which I/O library to use: libio, or something specific.
|
||||
dnl Check for which I/O library to use: stdio, or something specific.
|
||||
dnl
|
||||
dnl GLIBCPP_ENABLE_CSTDIO
|
||||
dnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends
|
||||
dnl
|
||||
dnl default is stdio
|
||||
dnl
|
||||
|
@ -1353,72 +1350,12 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
|
|||
|
||||
dnl Check if a valid I/O package
|
||||
case x${enable_cstdio_flag} in
|
||||
xlibio)
|
||||
CSTDIO_H=config/io/c_io_libio.h
|
||||
BASIC_FILE_H=config/io/basic_file_libio.h
|
||||
BASIC_FILE_CC=config/io/basic_file_libio.cc
|
||||
AC_MSG_RESULT(libio)
|
||||
|
||||
# see if we are on a system with libio native (ie, linux)
|
||||
AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
|
||||
|
||||
# Need to check and see what version of glibc is being used. If
|
||||
# it's not glibc-2.2 or higher, then we'll need to go ahead and
|
||||
# compile most of libio for linux systems.
|
||||
if test x$has_libio = x"yes"; then
|
||||
case "$target" in
|
||||
*-*-linux*)
|
||||
AC_MSG_CHECKING([for glibc version >= 2.2])
|
||||
AC_EGREP_CPP([ok], [
|
||||
#include <features.h>
|
||||
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
|
||||
ok
|
||||
#endif
|
||||
], glibc_satisfactory=yes, glibc_satisfactory=no)
|
||||
AC_MSG_RESULT($glibc_satisfactory)
|
||||
;;
|
||||
esac
|
||||
|
||||
# XXX at the moment, admit defeat and force the recompilation
|
||||
# XXX of glibc even on glibc-2.2 systems, because libio is not synched.
|
||||
glibc_satisfactory=no
|
||||
|
||||
if test x$glibc_satisfactory = x"yes"; then
|
||||
need_libio=no
|
||||
need_wlibio=no
|
||||
else
|
||||
need_libio=yes
|
||||
# bkoz XXX need to add checks to enable this
|
||||
# pme XXX here's a first pass at such a check
|
||||
if test x$enable_c_mbchar != xno; then
|
||||
need_wlibio=yes
|
||||
else
|
||||
need_wlibio=no
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
# Using libio, but <libio.h> doesn't exist on the target system. . .
|
||||
need_libio=yes
|
||||
# bkoz XXX need to add checks to enable this
|
||||
# pme XXX here's a first pass at such a check
|
||||
if test x$enable_c_mbchar != xno; then
|
||||
need_wlibio=yes
|
||||
else
|
||||
need_wlibio=no
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
xstdio | x | xno | xnone | xyes)
|
||||
# default
|
||||
CSTDIO_H=config/io/c_io_stdio.h
|
||||
BASIC_FILE_H=config/io/basic_file_stdio.h
|
||||
BASIC_FILE_CC=config/io/basic_file_stdio.cc
|
||||
AC_MSG_RESULT(stdio)
|
||||
|
||||
# We're not using stdio.
|
||||
need_libio=no
|
||||
need_wlibio=no
|
||||
;;
|
||||
*)
|
||||
echo "$enable_cstdio is an unknown io package" 1>&2
|
||||
|
@ -1428,22 +1365,6 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
|
|||
AC_SUBST(CSTDIO_H)
|
||||
AC_SUBST(BASIC_FILE_H)
|
||||
AC_SUBST(BASIC_FILE_CC)
|
||||
|
||||
# 2000-08-04 bkoz hack
|
||||
CCODECVT_C=config/io/c_io_libio_codecvt.c
|
||||
AC_SUBST(CCODECVT_C)
|
||||
# 2000-08-04 bkoz hack
|
||||
|
||||
AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
|
||||
test "$need_libio" = yes || test "$need_wlibio" = yes)
|
||||
AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
|
||||
AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
|
||||
if test "$need_libio" = yes || test "$need_wlibio" = yes; then
|
||||
libio_la=../libio/libio.la
|
||||
else
|
||||
libio_la=
|
||||
fi
|
||||
AC_SUBST(libio_la)
|
||||
])
|
||||
|
||||
|
||||
|
@ -1859,7 +1780,6 @@ dnl
|
|||
dnl TOPLEVEL_INCLUDES
|
||||
dnl LIBMATH_INCLUDES
|
||||
dnl LIBSUPCXX_INCLUDES
|
||||
dnl LIBIO_INCLUDES
|
||||
dnl
|
||||
dnl GLIBCPP_EXPORT_INCLUDES
|
||||
AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
|
||||
|
@ -1875,11 +1795,6 @@ AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
|
|||
|
||||
LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
|
||||
|
||||
if test x"$need_libio" = xyes; then
|
||||
LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
|
||||
AC_SUBST(LIBIO_INCLUDES)
|
||||
fi
|
||||
|
||||
# Now, export this to all the little Makefiles....
|
||||
AC_SUBST(GLIBCPP_INCLUDES)
|
||||
AC_SUBST(TOPLEVEL_INCLUDES)
|
||||
|
|
|
@ -218,8 +218,6 @@ AC_DEFUN(GLIBCPP_CONFIGURE, [
|
|||
need_libmath=no
|
||||
enable_wchar_t=no
|
||||
#enable_debug=no
|
||||
#need_libio=no
|
||||
#need_wlibio=no
|
||||
#glibcpp_pch_comp=no
|
||||
#enable_cheaders=c
|
||||
#c_compatibility=no
|
||||
|
@ -1343,10 +1341,9 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
|||
|
||||
|
||||
dnl
|
||||
dnl Check for which I/O library to use: libio, or something specific.
|
||||
dnl Check for which I/O library to use: stdio, or something specific.
|
||||
dnl
|
||||
dnl GLIBCPP_ENABLE_CSTDIO
|
||||
dnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends
|
||||
dnl
|
||||
dnl default is stdio
|
||||
dnl
|
||||
|
@ -1365,72 +1362,12 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
|
|||
|
||||
dnl Check if a valid I/O package
|
||||
case x${enable_cstdio_flag} in
|
||||
xlibio)
|
||||
CSTDIO_H=config/io/c_io_libio.h
|
||||
BASIC_FILE_H=config/io/basic_file_libio.h
|
||||
BASIC_FILE_CC=config/io/basic_file_libio.cc
|
||||
AC_MSG_RESULT(libio)
|
||||
|
||||
# see if we are on a system with libio native (ie, linux)
|
||||
AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
|
||||
|
||||
# Need to check and see what version of glibc is being used. If
|
||||
# it's not glibc-2.2 or higher, then we'll need to go ahead and
|
||||
# compile most of libio for linux systems.
|
||||
if test x$has_libio = x"yes"; then
|
||||
case "$target" in
|
||||
*-*-linux*)
|
||||
AC_MSG_CHECKING([for glibc version >= 2.2])
|
||||
AC_EGREP_CPP([ok], [
|
||||
#include <features.h>
|
||||
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
|
||||
ok
|
||||
#endif
|
||||
], glibc_satisfactory=yes, glibc_satisfactory=no)
|
||||
AC_MSG_RESULT($glibc_satisfactory)
|
||||
;;
|
||||
esac
|
||||
|
||||
# XXX at the moment, admit defeat and force the recompilation
|
||||
# XXX of glibc even on glibc-2.2 systems, because libio is not synched.
|
||||
glibc_satisfactory=no
|
||||
|
||||
if test x$glibc_satisfactory = x"yes"; then
|
||||
need_libio=no
|
||||
need_wlibio=no
|
||||
else
|
||||
need_libio=yes
|
||||
# bkoz XXX need to add checks to enable this
|
||||
# pme XXX here's a first pass at such a check
|
||||
if test x$enable_c_mbchar != xno; then
|
||||
need_wlibio=yes
|
||||
else
|
||||
need_wlibio=no
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
# Using libio, but <libio.h> doesn't exist on the target system. . .
|
||||
need_libio=yes
|
||||
# bkoz XXX need to add checks to enable this
|
||||
# pme XXX here's a first pass at such a check
|
||||
if test x$enable_c_mbchar != xno; then
|
||||
need_wlibio=yes
|
||||
else
|
||||
need_wlibio=no
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
xstdio | x | xno | xnone | xyes)
|
||||
# default
|
||||
CSTDIO_H=config/io/c_io_stdio.h
|
||||
BASIC_FILE_H=config/io/basic_file_stdio.h
|
||||
BASIC_FILE_CC=config/io/basic_file_stdio.cc
|
||||
AC_MSG_RESULT(stdio)
|
||||
|
||||
# We're not using stdio.
|
||||
need_libio=no
|
||||
need_wlibio=no
|
||||
;;
|
||||
*)
|
||||
echo "$enable_cstdio is an unknown io package" 1>&2
|
||||
|
@ -1440,22 +1377,6 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
|
|||
AC_SUBST(CSTDIO_H)
|
||||
AC_SUBST(BASIC_FILE_H)
|
||||
AC_SUBST(BASIC_FILE_CC)
|
||||
|
||||
# 2000-08-04 bkoz hack
|
||||
CCODECVT_C=config/io/c_io_libio_codecvt.c
|
||||
AC_SUBST(CCODECVT_C)
|
||||
# 2000-08-04 bkoz hack
|
||||
|
||||
AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
|
||||
test "$need_libio" = yes || test "$need_wlibio" = yes)
|
||||
AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
|
||||
AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
|
||||
if test "$need_libio" = yes || test "$need_wlibio" = yes; then
|
||||
libio_la=../libio/libio.la
|
||||
else
|
||||
libio_la=
|
||||
fi
|
||||
AC_SUBST(libio_la)
|
||||
])
|
||||
|
||||
|
||||
|
@ -1871,7 +1792,6 @@ dnl
|
|||
dnl TOPLEVEL_INCLUDES
|
||||
dnl LIBMATH_INCLUDES
|
||||
dnl LIBSUPCXX_INCLUDES
|
||||
dnl LIBIO_INCLUDES
|
||||
dnl
|
||||
dnl GLIBCPP_EXPORT_INCLUDES
|
||||
AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
|
||||
|
@ -1887,11 +1807,6 @@ AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
|
|||
|
||||
LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
|
||||
|
||||
if test x"$need_libio" = xyes; then
|
||||
LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
|
||||
AC_SUBST(LIBIO_INCLUDES)
|
||||
fi
|
||||
|
||||
# Now, export this to all the little Makefiles....
|
||||
AC_SUBST(GLIBCPP_INCLUDES)
|
||||
AC_SUBST(TOPLEVEL_INCLUDES)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
@ -749,6 +749,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/filio.h> header file. */
|
||||
#undef HAVE_SYS_FILIO_H
|
||||
|
||||
|
|
|
@ -1,194 +0,0 @@
|
|||
// Wrapper of C-language FILE struct -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
//
|
||||
// ISO C++ 14882: 27.8 File-based streams
|
||||
//
|
||||
|
||||
#include <bits/basic_file.h>
|
||||
|
||||
namespace std
|
||||
{
|
||||
// __basic_file<char> definitions
|
||||
__basic_file<char>::__basic_file(__c_lock* __lock)
|
||||
{
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_lock = __lock;
|
||||
#endif
|
||||
// Don't set the orientation of the stream when initializing.
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
_IO_no_init(this, 0, 0, &_M_wfile, 0);
|
||||
#else /* !defined(_GLIBCPP_USE_WCHAR_T) */
|
||||
_IO_no_init(this, 0, 0, NULL, 0);
|
||||
#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */
|
||||
_IO_JUMPS((_IO_FILE_plus *) this) = &_IO_file_jumps;
|
||||
_IO_file_init((_IO_FILE_plus*)this);
|
||||
}
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<char>::overflow(int __c)
|
||||
{ return _IO_file_overflow(this, __c); }
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<char>::underflow()
|
||||
{ return _IO_file_underflow(this); }
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<char>::uflow()
|
||||
{ return _IO_default_uflow(this); }
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<char>::pbackfail(int __c)
|
||||
{ return _IO_default_pbackfail(this, __c); }
|
||||
|
||||
streamsize
|
||||
__basic_file<char>::xsputn(const char* __s, streamsize __n)
|
||||
{ return _IO_file_xsputn(this, __s, __n); }
|
||||
|
||||
streamoff
|
||||
__basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode)
|
||||
{ return _IO_file_seekoff(this, __off, __way, __mode); }
|
||||
|
||||
streamoff
|
||||
__basic_file<char>::seekpos(streamoff __pos, ios_base::openmode __mode)
|
||||
{ return _IO_file_seekoff(this, __pos, ios_base::beg, __mode); }
|
||||
|
||||
// NB: Unused.
|
||||
streambuf*
|
||||
__basic_file<char>::setbuf(char* __b, int __len)
|
||||
{ return (streambuf*) _IO_file_setbuf(this,__b, __len); }
|
||||
|
||||
int
|
||||
__basic_file<char>::sync()
|
||||
{ return _IO_file_sync(this); }
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<char>::doallocate()
|
||||
{ return _IO_file_doallocate(this); }
|
||||
|
||||
// __basic_file<wchar_t> definitions
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
__basic_file<wchar_t>::__basic_file(__c_lock* __lock)
|
||||
{
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_lock = __lock;
|
||||
#endif
|
||||
// Don't set the orientation of the stream when initializing.
|
||||
_IO_no_init(this, 0, 0, &_M_wfile, &_IO_wfile_jumps);
|
||||
_IO_JUMPS((_IO_FILE_plus *) this) = &_IO_wfile_jumps;
|
||||
_IO_file_init((_IO_FILE_plus*)this);
|
||||
|
||||
// In addition, need to allocate the buffer...
|
||||
_IO_wdoallocbuf(this);
|
||||
// Setup initial positions for this buffer...
|
||||
// if (!(_flags & _IO_NO_READS))
|
||||
_IO_wsetg(this, _wide_data->_IO_buf_base, _wide_data->_IO_buf_base,
|
||||
_wide_data->_IO_buf_base);
|
||||
// if (!(_flags & _IO_NO_WRITES))
|
||||
_IO_wsetp(this, _wide_data->_IO_buf_base, _wide_data->_IO_buf_base);
|
||||
|
||||
// Setup codecvt bits...
|
||||
_codecvt = &__c_libio_codecvt;
|
||||
|
||||
// Do the same for narrow bits...
|
||||
if (_IO_write_base == NULL)
|
||||
{
|
||||
_IO_doallocbuf(this);
|
||||
// if (!(_flags & _IO_NO_READS))
|
||||
_IO_setg(this, _IO_buf_base, _IO_buf_base, _IO_buf_base);
|
||||
// if (!(_flags & _IO_NO_WRITES))
|
||||
_IO_setp(this, _IO_buf_base, _IO_buf_base);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
__basic_file<wchar_t>::overflow(int __c)
|
||||
{ return _IO_wfile_overflow(this, __c); }
|
||||
|
||||
int
|
||||
__basic_file<wchar_t>::underflow()
|
||||
{ return _IO_wfile_underflow(this); }
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<wchar_t>::uflow()
|
||||
{ return _IO_wdefault_uflow(this); }
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<wchar_t>::pbackfail(int __c)
|
||||
{ return _IO_wdefault_pbackfail(this, __c); }
|
||||
|
||||
streamsize
|
||||
__basic_file<wchar_t>::xsputn(const wchar_t* __s, streamsize __n)
|
||||
{ return _IO_wfile_xsputn(this, __s, __n); }
|
||||
|
||||
streamoff
|
||||
__basic_file<wchar_t>::seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode)
|
||||
{ return _IO_wfile_seekoff(this, __off, __way, __mode); }
|
||||
|
||||
streamoff
|
||||
__basic_file<wchar_t>::seekpos(streamoff __pos, ios_base::openmode __mode)
|
||||
{ return _IO_wfile_seekoff(this, __pos, ios_base::beg, __mode); }
|
||||
|
||||
streambuf*
|
||||
__basic_file<wchar_t>::setbuf(wchar_t* __b, int __len)
|
||||
{ return (streambuf*) _IO_wfile_setbuf(this,__b, __len); }
|
||||
|
||||
int
|
||||
__basic_file<wchar_t>::sync()
|
||||
{ return _IO_wfile_sync(this); }
|
||||
|
||||
int
|
||||
__basic_file<wchar_t>::doallocate()
|
||||
{ return _IO_wfile_doallocate(this); }
|
||||
#endif
|
||||
|
||||
// Need to instantiate base class here for type-info bits, etc
|
||||
template struct __basic_file_base<char>;
|
||||
template class __basic_file<char>;
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template struct __basic_file_base<wchar_t>;
|
||||
template class __basic_file<wchar_t>;
|
||||
#endif
|
||||
} // namespace std
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,528 +0,0 @@
|
|||
// Wrapper of C-language FILE struct -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001, 2002, 2003 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>
|
||||
#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
|
||||
{
|
||||
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 _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->_fileno and the respective _flags bits
|
||||
// - for stdio: _M_cfile = __file and some internal flags
|
||||
// and returns.
|
||||
__basic_file*
|
||||
sys_open(__c_file* __file, ios_base::openmode __mode);
|
||||
|
||||
__basic_file*
|
||||
sys_open(int __fd, ios_base::openmode __mode, bool __del);
|
||||
|
||||
_CharT
|
||||
sys_getc();
|
||||
|
||||
_CharT
|
||||
sys_ungetc(_CharT);
|
||||
|
||||
__basic_file*
|
||||
close();
|
||||
|
||||
bool
|
||||
is_open() const;
|
||||
|
||||
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'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'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'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'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.
|
||||
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.
|
||||
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.
|
||||
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);
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<char>::overflow(int __c);
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<char>::underflow();
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<char>::uflow();
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<char>::pbackfail(int __c);
|
||||
|
||||
template<>
|
||||
streamsize
|
||||
__basic_file<char>::xsputn(const char* __s, streamsize __n);
|
||||
|
||||
template<>
|
||||
streamoff
|
||||
__basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode);
|
||||
|
||||
template<>
|
||||
streamoff
|
||||
__basic_file<char>::seekpos(streamoff __pos, ios_base::openmode __mode);
|
||||
|
||||
template<>
|
||||
streambuf*
|
||||
__basic_file<char>::setbuf(char* __b, int __len);
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<char>::sync();
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<char>::doallocate();
|
||||
|
||||
// __basic_file<wchar_t> specializations
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template<>
|
||||
__basic_file<wchar_t>::__basic_file(__c_lock* __lock);
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<wchar_t>::overflow(int __c);
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<wchar_t>::underflow();
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<wchar_t>::uflow();
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<wchar_t>::pbackfail(int __c);
|
||||
|
||||
template<>
|
||||
streamsize
|
||||
__basic_file<wchar_t>::xsputn(const wchar_t* __s, streamsize __n);
|
||||
|
||||
template<>
|
||||
streamoff
|
||||
__basic_file<wchar_t>::seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode);
|
||||
|
||||
template<>
|
||||
streamoff
|
||||
__basic_file<wchar_t>::seekpos(streamoff __pos, ios_base::openmode __mode);
|
||||
|
||||
template<>
|
||||
streambuf*
|
||||
__basic_file<wchar_t>::setbuf(wchar_t* __b, int __len);
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<wchar_t>::sync();
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<wchar_t>::doallocate();
|
||||
#endif
|
||||
|
||||
template<typename _CharT>
|
||||
__basic_file<_CharT>::~__basic_file()
|
||||
{ _IO_file_finish(this, 0); }
|
||||
|
||||
template<typename _CharT>
|
||||
void
|
||||
__basic_file<_CharT>::_M_open_mode(ios_base::openmode __mode,
|
||||
int& __p_mode, int& __rw_mode,
|
||||
char* /*__c_mode*/)
|
||||
{
|
||||
#ifdef O_BINARY
|
||||
bool __testb = __mode & ios_base::binary;
|
||||
#endif
|
||||
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)
|
||||
{
|
||||
__p_mode = O_WRONLY | O_TRUNC | O_CREAT;
|
||||
__rw_mode = _IO_NO_READS;
|
||||
}
|
||||
if (!__testi && __testo && !__testt && __testa)
|
||||
{
|
||||
__p_mode = O_WRONLY | O_APPEND | O_CREAT;
|
||||
__rw_mode = _IO_NO_READS | _IO_IS_APPENDING;
|
||||
}
|
||||
if (!__testi && __testo && __testt && !__testa)
|
||||
{
|
||||
__p_mode = O_WRONLY | O_TRUNC | O_CREAT;
|
||||
__rw_mode = _IO_NO_READS;
|
||||
}
|
||||
if (__testi && !__testo && !__testt && !__testa)
|
||||
{
|
||||
__p_mode = O_RDONLY;
|
||||
__rw_mode = _IO_NO_WRITES;
|
||||
}
|
||||
if (__testi && __testo && !__testt && !__testa)
|
||||
{
|
||||
__p_mode = O_RDWR;
|
||||
__rw_mode = 0;
|
||||
}
|
||||
if (__testi && __testo && __testt && !__testa)
|
||||
{
|
||||
__p_mode = O_RDWR | O_TRUNC | O_CREAT;
|
||||
__rw_mode = 0;
|
||||
}
|
||||
#ifdef O_BINARY
|
||||
if (__testb)
|
||||
__p_mode |= O_BINARY;
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
__basic_file<_CharT>*
|
||||
__basic_file<_CharT>::sys_open(__c_file* __f,
|
||||
ios_base::openmode __mode)
|
||||
{
|
||||
__basic_file* __ret = NULL;
|
||||
int __fd = fileno(__f);
|
||||
int __p_mode = 0;
|
||||
int __rw_mode = _IO_NO_READS + _IO_NO_WRITES;
|
||||
char __c_mode[4];
|
||||
|
||||
_M_open_mode(__mode, __p_mode, __rw_mode, __c_mode);
|
||||
|
||||
if (!_IO_file_is_open(this))
|
||||
{
|
||||
_fileno = __fd;
|
||||
_flags &= ~(_IO_NO_READS + _IO_NO_WRITES);
|
||||
_flags |= _IO_DELETE_DONT_CLOSE;
|
||||
_offset = _IO_pos_BAD;
|
||||
int __mask = _IO_NO_READS + _IO_NO_WRITES + _IO_IS_APPENDING;
|
||||
_IO_mask_flags(this, __rw_mode, __mask);
|
||||
}
|
||||
|
||||
return __ret;
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
__basic_file<_CharT>*
|
||||
__basic_file<_CharT>::sys_open(int __fd, ios_base::openmode __mode,
|
||||
bool __del)
|
||||
{
|
||||
__basic_file* __ret = NULL;
|
||||
int __p_mode = 0;
|
||||
int __rw_mode = 0;
|
||||
char __c_mode[4];
|
||||
|
||||
#if 0
|
||||
#error copy from basic_file_stdio.h will make no sense
|
||||
_M_open_mode(__mode, __p_mode, __rw_mode, __c_mode);
|
||||
if (!this->is_open() && (_M_cfile = fdopen(__fd, __c_mode)))
|
||||
{
|
||||
// Iff __del is true, then close will fclose the fd.
|
||||
_M_cfile_created = __del;
|
||||
|
||||
if (__fd == 0)
|
||||
setvbuf(_M_cfile, reinterpret_cast<char*>(NULL), _IONBF, 0);
|
||||
|
||||
__ret = this;
|
||||
}
|
||||
#endif
|
||||
return __ret;
|
||||
}
|
||||
|
||||
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 = _IO_NO_READS + _IO_NO_WRITES;
|
||||
char __c_mode[4];
|
||||
|
||||
_M_open_mode(__mode, __p_mode, __rw_mode, __c_mode);
|
||||
if (!_IO_file_is_open(this))
|
||||
{
|
||||
__c_file* __f;
|
||||
__f = _IO_file_open(this, __name, __p_mode, __prot, __rw_mode, 0);
|
||||
__ret = __f ? this: NULL;
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
bool
|
||||
__basic_file<_CharT>::is_open() const { return _fileno >= 0; }
|
||||
|
||||
template<typename _CharT>
|
||||
__basic_file<_CharT>*
|
||||
__basic_file<_CharT>::close()
|
||||
{
|
||||
return _IO_file_close_it(this) ? static_cast<__basic_file*>(NULL) : this;
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
streamsize
|
||||
__basic_file<_CharT>::xsgetn(_CharT* __s, streamsize __n)
|
||||
{ return _IO_file_xsgetn(this, __s, __n); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
streamsize
|
||||
__basic_file<_CharT>::sys_read(_CharT* __s, streamsize __n)
|
||||
{ return _IO_file_read(this, __s, __n); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
streamsize
|
||||
__basic_file<_CharT>::sys_write(const _CharT* __s, streamsize __n)
|
||||
{ return _IO_file_write(this, __s, __n); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
streamoff
|
||||
__basic_file<_CharT>::sys_seek(streamoff __pos, ios_base::seekdir __way)
|
||||
{ return _IO_file_seek(this, __pos, __way); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::sys_close()
|
||||
{ return _IO_file_close(this); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::sys_stat(void* __v)
|
||||
{ return _IO_file_stat(this, __v); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::showmanyc() { return EOF; }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
void
|
||||
__basic_file<_CharT>::imbue(void* /*__v*/) { }
|
||||
} // namespace std
|
||||
|
||||
#endif // _CPP_BASIC_FILE
|
|
@ -1,113 +0,0 @@
|
|||
// underlying io library -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001, 2002, 2003 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.
|
||||
|
||||
// c_io_libio.h - Defines for using the GNU libio
|
||||
|
||||
#ifndef _CPP_IO_LIBIO_H
|
||||
#define _CPP_IO_LIBIO_H 1
|
||||
|
||||
#include <libio.h>
|
||||
|
||||
namespace std
|
||||
{
|
||||
// from fpos.h
|
||||
typedef _IO_ssize_t streamsize; // Signed integral type
|
||||
typedef _IO_ssize_t wstreamsize;
|
||||
|
||||
#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
|
||||
typedef _IO_off64_t streamoff;
|
||||
typedef _IO_fpos64_t __c_streampos;
|
||||
#else
|
||||
typedef _IO_off_t streamoff;
|
||||
typedef _IO_fpos_t __c_streampos;
|
||||
#endif
|
||||
|
||||
#ifdef _GLIBCPP_USE_THREADS
|
||||
typedef _IO_lock_t __c_lock;
|
||||
#else
|
||||
typedef int __c_lock;
|
||||
#endif
|
||||
|
||||
// from basic_file.h
|
||||
typedef _IO_FILE __c_file;
|
||||
typedef _IO_wide_data __c_wfile;
|
||||
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
extern "C" _IO_codecvt __c_libio_codecvt;
|
||||
#endif
|
||||
|
||||
// from ios_base.h
|
||||
struct __ios_flags
|
||||
{
|
||||
typedef short __int_type;
|
||||
|
||||
static const __int_type _S_boolalpha = _IO_BAD_SEEN;
|
||||
static const __int_type _S_dec = _IO_DEC;
|
||||
static const __int_type _S_fixed = _IO_FIXED;
|
||||
static const __int_type _S_hex = _IO_HEX;
|
||||
static const __int_type _S_internal = _IO_INTERNAL;
|
||||
static const __int_type _S_left = _IO_LEFT;
|
||||
static const __int_type _S_oct = _IO_OCT;
|
||||
static const __int_type _S_right = _IO_RIGHT;
|
||||
static const __int_type _S_scientific = _IO_SCIENTIFIC;
|
||||
static const __int_type _S_showbase = _IO_SHOWBASE;
|
||||
static const __int_type _S_showpoint = _IO_SHOWPOINT;
|
||||
static const __int_type _S_showpos = _IO_SHOWPOS;
|
||||
static const __int_type _S_skipws = _IO_SKIPWS;
|
||||
static const __int_type _S_unitbuf = _IO_UNITBUF;
|
||||
static const __int_type _S_uppercase = _IO_UPPERCASE;
|
||||
static const __int_type _S_adjustfield = _IO_LEFT | _IO_RIGHT
|
||||
| _IO_INTERNAL;
|
||||
static const __int_type _S_basefield = _IO_DEC | _IO_OCT | _IO_HEX;
|
||||
static const __int_type _S_floatfield = _IO_SCIENTIFIC | _IO_FIXED;
|
||||
|
||||
// 27.4.2.1.3 Type ios_base::iostate
|
||||
static const __int_type _S_badbit = _IO_BAD_SEEN;
|
||||
static const __int_type _S_eofbit = _IO_EOF_SEEN;
|
||||
static const __int_type _S_failbit = _IO_ERR_SEEN;
|
||||
|
||||
// 27.4.2.1.4 Type openmode
|
||||
static const __int_type _S_app = _IOS_APPEND;
|
||||
static const __int_type _S_ate = _IOS_ATEND;
|
||||
static const __int_type _S_bin = _IOS_BIN;
|
||||
static const __int_type _S_in = _IOS_INPUT;
|
||||
static const __int_type _S_out = _IOS_OUTPUT;
|
||||
static const __int_type _S_trunc = _IOS_TRUNC;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // _CPP_IO_LIBIO_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,153 +0,0 @@
|
|||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO 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, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not 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. */
|
||||
|
||||
/* Slightly modified from glibc/libio/iofwide.c */
|
||||
|
||||
#include <libio.h>
|
||||
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
|
||||
/* Prototypes of libio's codecvt functions. */
|
||||
static enum __codecvt_result
|
||||
do_out(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const wchar_t *from_start, const wchar_t *from_end,
|
||||
const wchar_t **from_stop, char *to_start, char *to_end,
|
||||
char **to_stop);
|
||||
|
||||
static enum __codecvt_result
|
||||
do_unshift(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, char *to_start,
|
||||
char *to_end, char **to_stop);
|
||||
|
||||
static enum __codecvt_result
|
||||
do_in(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const char *from_start, const char *from_end, const char **from_stop,
|
||||
wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop);
|
||||
|
||||
static int
|
||||
do_encoding(struct _IO_codecvt *codecvt);
|
||||
|
||||
static int
|
||||
do_length(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const char *from_start, const char *from_end, _IO_size_t max);
|
||||
|
||||
static int
|
||||
do_max_length(struct _IO_codecvt *codecvt);
|
||||
|
||||
static int
|
||||
do_always_noconv(struct _IO_codecvt *codecvt);
|
||||
|
||||
|
||||
/* The functions used in `codecvt' for libio are always the same. */
|
||||
struct _IO_codecvt __c_libio_codecvt =
|
||||
{
|
||||
.__codecvt_destr = NULL, /* Destructor, never used. */
|
||||
.__codecvt_do_out = do_out,
|
||||
.__codecvt_do_unshift = do_unshift,
|
||||
.__codecvt_do_in = do_in,
|
||||
.__codecvt_do_encoding = do_encoding,
|
||||
.__codecvt_do_always_noconv = do_always_noconv,
|
||||
.__codecvt_do_length = do_length,
|
||||
.__codecvt_do_max_length = do_max_length
|
||||
};
|
||||
|
||||
static enum __codecvt_result
|
||||
do_out(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const wchar_t *from_start, const wchar_t *from_end,
|
||||
const wchar_t **from_stop, char *to_start, char *to_end,
|
||||
char **to_stop)
|
||||
{
|
||||
enum __codecvt_result res = __codecvt_ok;
|
||||
|
||||
while (from_start < from_end)
|
||||
{
|
||||
if (to_start >= to_end)
|
||||
{
|
||||
res = __codecvt_partial;
|
||||
break;
|
||||
}
|
||||
*to_start++ = (char) *from_start++;
|
||||
}
|
||||
|
||||
*from_stop = from_start;
|
||||
*to_stop = to_start;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static enum __codecvt_result
|
||||
do_unshift(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
char *to_start, char *to_end, char **to_stop)
|
||||
{
|
||||
*to_stop = to_start;
|
||||
return __codecvt_ok;
|
||||
}
|
||||
|
||||
|
||||
static enum __codecvt_result
|
||||
do_in(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const char *from_start, const char *from_end, const char **from_stop,
|
||||
wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop)
|
||||
{
|
||||
enum __codecvt_result res = __codecvt_ok;
|
||||
|
||||
while (from_start < from_end)
|
||||
{
|
||||
if (to_start >= to_end)
|
||||
{
|
||||
res = __codecvt_partial;
|
||||
break;
|
||||
}
|
||||
*to_start++ = (wchar_t) *from_start++;
|
||||
}
|
||||
|
||||
*from_stop = from_start;
|
||||
*to_stop = to_start;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
do_encoding(struct _IO_codecvt *codecvt)
|
||||
{ return 1; }
|
||||
|
||||
|
||||
static int
|
||||
do_always_noconv(struct _IO_codecvt *codecvt)
|
||||
{ return 0; }
|
||||
|
||||
|
||||
static int
|
||||
do_length(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const char *from_start, const char *from_end, _IO_size_t max)
|
||||
{ return from_end - from_start; }
|
||||
|
||||
|
||||
static int
|
||||
do_max_length(struct _IO_codecvt *codecvt)
|
||||
{ return 1; }
|
||||
|
||||
#endif /* _GLIBCPP_USE_WCHAR_T */
|
File diff suppressed because it is too large
Load Diff
|
@ -490,7 +490,7 @@ AC_SUBST(LIBSUPCXX_PICFLAGS)
|
|||
# top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
|
||||
AC_OUTPUT(Makefile \
|
||||
include/Makefile src/Makefile \
|
||||
libmath/Makefile libio/Makefile libsupc++/Makefile \
|
||||
libmath/Makefile libsupc++/Makefile \
|
||||
po/Makefile testsuite/Makefile mkcheck testsuite_flags,
|
||||
[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
|
||||
if test -n "$CONFIG_FILES"; then
|
||||
|
@ -532,7 +532,7 @@ ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
|
|||
dnl In autoconf 2.5x, AC_OUTPUT is replaced by three AC_ macros:
|
||||
dnl AC_CONFIG_FILES(Makefile \
|
||||
dnl include/Makefile src/Makefile \
|
||||
dnl libmath/Makefile libio/Makefile libsupc++/Makefile \
|
||||
dnl libmath/Makefile libsupc++/Makefile \
|
||||
dnl po/Makefile testsuite/Makefile mkcheck testsuite_flags)
|
||||
dnl AC_CONFIG_COMMANDS([default],
|
||||
dnl [if test -n "$CONFIG_FILES"; then
|
||||
|
|
|
@ -90,13 +90,10 @@ options</a></h1>
|
|||
</dd>
|
||||
|
||||
<dt><code>--enable-cstdio=OPTION </code></dt>
|
||||
<dd><p>Select a target-specific I/O package. As of libstdc++-v3
|
||||
snapshot 3.0.96, the choices are 'libio' to specify the GNU
|
||||
I/O package (from
|
||||
<a href="http://sources.redhat.com/glibc/">glibc</a>, the
|
||||
GNU C library), or 'stdio' to use a generic "C"
|
||||
abstraction. The default is 'stdio'. A longer explanation
|
||||
is <a href="explanations.html#cstdio">here</a>.
|
||||
<dd><p>Select a target-specific I/O package. At the moment, the only
|
||||
choice is to use 'stdio', a generic "C" abstraction.
|
||||
The default is 'stdio'. A longer explanation is <a
|
||||
href="explanations.html#cstdio">here</a>.
|
||||
</p>
|
||||
</dd>
|
||||
|
||||
|
|
|
@ -48,12 +48,6 @@ design</a></h1>
|
|||
disadvantage is that the C++ code will run slower (fortunately, the layer
|
||||
is thin).
|
||||
</p>
|
||||
<p>Choosing 'libio' is the cool way; it allows C++ and C to share some
|
||||
buffers. It's disabled because of tricky synchronization issues. Other
|
||||
cool ways (various methods of sharing resources between C and C++
|
||||
facilities, instead of layering) are possible. This approach can speed
|
||||
up I/O significantly.
|
||||
</p>
|
||||
<p>Other packages are possible. For a new package, a header must be
|
||||
written to provide types like streamsize (usually just a typedef), as
|
||||
well as some internal types like<code> __c_file_type </code> and
|
||||
|
|
|
@ -70,7 +70,6 @@ AWK = @AWK@
|
|||
BASIC_FILE_CC = @BASIC_FILE_CC@
|
||||
BASIC_FILE_H = @BASIC_FILE_H@
|
||||
CC = @CC@
|
||||
CCODECVT_C = @CCODECVT_C@
|
||||
CCODECVT_CC = @CCODECVT_CC@
|
||||
CCODECVT_H = @CCODECVT_H@
|
||||
CCOLLATE_CC = @CCOLLATE_CC@
|
||||
|
@ -95,7 +94,6 @@ EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
|
|||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
|
||||
LIBIO_INCLUDES = @LIBIO_INCLUDES@
|
||||
LIBMATHOBJS = @LIBMATHOBJS@
|
||||
LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
|
||||
LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@
|
||||
|
@ -134,7 +132,6 @@ glibcpp_prefixdir = @glibcpp_prefixdir@
|
|||
glibcpp_toolexecdir = @glibcpp_toolexecdir@
|
||||
glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
|
||||
ifGNUmake = @ifGNUmake@
|
||||
libio_la = @libio_la@
|
||||
libtool_VERSION = @libtool_VERSION@
|
||||
toplevel_srcdir = @toplevel_srcdir@
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Threading support -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
// Copyright (C) 2001, 2002, 2003 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
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,67 +0,0 @@
|
|||
## Makefile for the libio subdirectory of the GNU C++ Standard library.
|
||||
##
|
||||
## Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
##
|
||||
## This file is part of the libstdc++ version 3 distribution.
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
## 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.
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.3 cygnus
|
||||
|
||||
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
|
||||
|
||||
if GLIBCPP_BUILD_LIBIO
|
||||
noinst_LTLIBRARIES = libio.la
|
||||
else
|
||||
noinst_LTLIBRARIES =
|
||||
endif
|
||||
|
||||
# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
|
||||
GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
|
||||
TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
|
||||
LIBIO_INCLUDES = @LIBIO_INCLUDES@
|
||||
|
||||
INCLUDES = \
|
||||
-nostdinc++ \
|
||||
$(GLIBCPP_INCLUDES) $(LIBIO_INCLUDES) $(TOPLEVEL_INCLUDES)
|
||||
|
||||
libio_headers = \
|
||||
libio.h libioP.h iolibio.h
|
||||
|
||||
if GLIBCPP_NEED_LIBIO
|
||||
LIBIO_SRCS = \
|
||||
filedoalloc.c genops.c fileops.c stdfiles.c \
|
||||
iofclose.c iofopen.c
|
||||
else
|
||||
LIBIO_SRCS =
|
||||
endif
|
||||
|
||||
if GLIBCPP_NEED_WLIBIO
|
||||
LIBIO_WSRCS = \
|
||||
wfiledoalloc.c wfileops.c wgenops.c iofwide.c
|
||||
else
|
||||
LIBIO_WSRCS =
|
||||
endif
|
||||
|
||||
|
||||
EXTRA_DIST = iostreamP.h
|
||||
|
||||
libio_la_SOURCES = $(LIBIO_SRCS) $(LIBIO_WSRCS)
|
||||
|
||||
|
||||
AM_CFLAGS = -D_GNU_SOURCE
|
|
@ -1,415 +0,0 @@
|
|||
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_alias = @build_alias@
|
||||
build_triplet = @build@
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
target_alias = @target_alias@
|
||||
target_triplet = @target@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@
|
||||
AWK = @AWK@
|
||||
BASIC_FILE_CC = @BASIC_FILE_CC@
|
||||
BASIC_FILE_H = @BASIC_FILE_H@
|
||||
CC = @CC@
|
||||
CCODECVT_C = @CCODECVT_C@
|
||||
CCODECVT_CC = @CCODECVT_CC@
|
||||
CCODECVT_H = @CCODECVT_H@
|
||||
CCOLLATE_CC = @CCOLLATE_CC@
|
||||
CCTYPE_CC = @CCTYPE_CC@
|
||||
CLOCALE_CC = @CLOCALE_CC@
|
||||
CLOCALE_H = @CLOCALE_H@
|
||||
CLOCALE_INTERNAL_H = @CLOCALE_INTERNAL_H@
|
||||
CMESSAGES_CC = @CMESSAGES_CC@
|
||||
CMESSAGES_H = @CMESSAGES_H@
|
||||
CMONEY_CC = @CMONEY_CC@
|
||||
CNUMERIC_CC = @CNUMERIC_CC@
|
||||
CPP = @CPP@
|
||||
CSTDIO_H = @CSTDIO_H@
|
||||
CTIME_CC = @CTIME_CC@
|
||||
CTIME_H = @CTIME_H@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
C_INCLUDE_DIR = @C_INCLUDE_DIR@
|
||||
DEBUG_FLAGS = @DEBUG_FLAGS@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
|
||||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
|
||||
LIBMATHOBJS = @LIBMATHOBJS@
|
||||
LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
|
||||
LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
|
||||
LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBUNWIND_FLAG = @LIBUNWIND_FLAG@
|
||||
LN_S = @LN_S@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
|
||||
OPT_LDFLAGS = @OPT_LDFLAGS@
|
||||
OS_INC_SRCDIR = @OS_INC_SRCDIR@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
SECTION_FLAGS = @SECTION_FLAGS@
|
||||
SECTION_LDFLAGS = @SECTION_LDFLAGS@
|
||||
STRIP = @STRIP@
|
||||
SYMVER_MAP = @SYMVER_MAP@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WARN_FLAGS = @WARN_FLAGS@
|
||||
WERROR = @WERROR@
|
||||
baseline_file = @baseline_file@
|
||||
check_msgfmt = @check_msgfmt@
|
||||
enable_shared = @enable_shared@
|
||||
enable_static = @enable_static@
|
||||
glibcpp_CXX = @glibcpp_CXX@
|
||||
glibcpp_MOFILES = @glibcpp_MOFILES@
|
||||
glibcpp_POFILES = @glibcpp_POFILES@
|
||||
glibcpp_basedir = @glibcpp_basedir@
|
||||
glibcpp_builddir = @glibcpp_builddir@
|
||||
glibcpp_localedir = @glibcpp_localedir@
|
||||
glibcpp_prefixdir = @glibcpp_prefixdir@
|
||||
glibcpp_srcdir = @glibcpp_srcdir@
|
||||
glibcpp_thread_h = @glibcpp_thread_h@
|
||||
glibcpp_toolexecdir = @glibcpp_toolexecdir@
|
||||
glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
|
||||
gxx_include_dir = @gxx_include_dir@
|
||||
ifGNUmake = @ifGNUmake@
|
||||
libio_la = @libio_la@
|
||||
libtool_VERSION = @libtool_VERSION@
|
||||
toplevel_srcdir = @toplevel_srcdir@
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.3 cygnus
|
||||
|
||||
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
|
||||
@GLIBCPP_BUILD_LIBIO_TRUE@noinst_LTLIBRARIES = @GLIBCPP_BUILD_LIBIO_TRUE@libio.la
|
||||
@GLIBCPP_BUILD_LIBIO_FALSE@noinst_LTLIBRARIES =
|
||||
|
||||
# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
|
||||
GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
|
||||
TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
|
||||
LIBIO_INCLUDES = @LIBIO_INCLUDES@
|
||||
|
||||
INCLUDES = \
|
||||
-nostdinc++ \
|
||||
$(GLIBCPP_INCLUDES) $(LIBIO_INCLUDES) $(TOPLEVEL_INCLUDES)
|
||||
|
||||
|
||||
libio_headers = \
|
||||
libio.h libioP.h iolibio.h
|
||||
|
||||
@GLIBCPP_NEED_LIBIO_TRUE@LIBIO_SRCS = @GLIBCPP_NEED_LIBIO_TRUE@\
|
||||
@GLIBCPP_NEED_LIBIO_TRUE@ filedoalloc.c genops.c fileops.c stdfiles.c \
|
||||
@GLIBCPP_NEED_LIBIO_TRUE@ iofclose.c iofopen.c
|
||||
@GLIBCPP_NEED_LIBIO_FALSE@LIBIO_SRCS =
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@LIBIO_WSRCS = @GLIBCPP_NEED_WLIBIO_TRUE@\
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@ wfiledoalloc.c wfileops.c wgenops.c iofwide.c
|
||||
@GLIBCPP_NEED_WLIBIO_FALSE@LIBIO_WSRCS =
|
||||
|
||||
EXTRA_DIST = iostreamP.h
|
||||
|
||||
libio_la_SOURCES = $(LIBIO_SRCS) $(LIBIO_WSRCS)
|
||||
|
||||
AM_CFLAGS = -D_GNU_SOURCE
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
libio_la_LDFLAGS =
|
||||
libio_la_LIBADD =
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@libio_la_OBJECTS = \
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@filedoalloc.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@genops.lo fileops.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@stdfiles.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@iofclose.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@iofopen.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wfiledoalloc.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wfileops.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wgenops.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@iofwide.lo
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@libio_la_OBJECTS = \
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wfiledoalloc.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wfileops.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wgenops.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@iofwide.lo
|
||||
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@libio_la_OBJECTS = \
|
||||
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@filedoalloc.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@genops.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@fileops.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@stdfiles.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@iofclose.lo \
|
||||
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@iofopen.lo
|
||||
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_FALSE@libio_la_OBJECTS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = ChangeLog Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
SOURCES = $(libio_la_SOURCES)
|
||||
OBJECTS = $(libio_la_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .lo .o .obj .s
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --cygnus libio/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-noinstLTLIBRARIES:
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
|
||||
distclean-noinstLTLIBRARIES:
|
||||
|
||||
maintainer-clean-noinstLTLIBRARIES:
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
# FIXME: We should only use cygpath when building on Windows,
|
||||
# and only if it is available.
|
||||
.c.obj:
|
||||
$(COMPILE) -c `cygpath -w $<`
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.c.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
libio.la: $(libio_la_OBJECTS) $(libio_la_DEPENDENCIES)
|
||||
$(LINK) $(libio_la_LDFLAGS) $(libio_la_OBJECTS) $(libio_la_LIBADD) $(LIBS)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = libio
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am:
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-info-am:
|
||||
install-info: install-info-am
|
||||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am:
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-noinstLTLIBRARIES mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-tags \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-noinstLTLIBRARIES clean-compile clean-libtool \
|
||||
clean-tags clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-noinstLTLIBRARIES distclean-compile \
|
||||
distclean-libtool distclean-tags distclean-generic \
|
||||
clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-noinstLTLIBRARIES \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-tags maintainer-clean-generic \
|
||||
distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-noinstLTLIBRARIES distclean-noinstLTLIBRARIES \
|
||||
clean-noinstLTLIBRARIES maintainer-clean-noinstLTLIBRARIES \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
|
||||
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-info-am \
|
||||
install-info install-exec-am install-exec install-data-am install-data \
|
||||
install-am install uninstall-am uninstall all-redirect all-am all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -1,136 +0,0 @@
|
|||
/* This file is needed by libio to define various configuration parameters.
|
||||
These are always the same in the GNU C library. */
|
||||
|
||||
#ifndef _G_config_h
|
||||
#define _G_config_h 1
|
||||
|
||||
#ifndef _LIBC
|
||||
# include <bits/c++config.h>
|
||||
# ifdef _GLIBCPP_USE_THREADS
|
||||
# define _IO_MTSAFE_IO
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define types for libio in terms of the standard internal type names. */
|
||||
|
||||
#include <sys/types.h>
|
||||
#define __need_size_t
|
||||
#define __need_wchar_t
|
||||
#define __need_wint_t
|
||||
#define __need_NULL
|
||||
#define __need_ptrdiff_t
|
||||
#ifdef __cplusplus
|
||||
# include <cstddef>
|
||||
#else
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _WINT_T
|
||||
/* Integral type unchanged by default argument promotions that can
|
||||
hold any value corresponding to members of the extended character
|
||||
set, as well as at least one value that does not correspond to any
|
||||
member of the extended character set. */
|
||||
# define _WINT_T
|
||||
typedef unsigned int wint_t;
|
||||
#endif
|
||||
|
||||
/* For use as part of glibc (native) or as part of libstdc++ (maybe
|
||||
not glibc) */
|
||||
#ifndef __c_mbstate_t_defined
|
||||
# define __c_mbstate_t_defined 1
|
||||
/*# ifdef _GLIBCPP_USE_WCHAR_T*/
|
||||
typedef struct
|
||||
{
|
||||
int count;
|
||||
wint_t value;
|
||||
}__c_mbstate_t;
|
||||
/*# endif*/
|
||||
#endif
|
||||
#undef __need_mbstate_t
|
||||
|
||||
typedef size_t _G_size_t;
|
||||
|
||||
|
||||
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
typedef struct
|
||||
{
|
||||
__off_t __pos;
|
||||
__c_mbstate_t __state;
|
||||
} _G_fpos_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
__off64_t __pos;
|
||||
__c_mbstate_t __state;
|
||||
} _G_fpos64_t;
|
||||
#else
|
||||
typedef __off_t _G_fpos_t;
|
||||
typedef __off64_t _G_fpos64_t;
|
||||
#endif
|
||||
#define _G_ssize_t __ssize_t
|
||||
#define _G_off_t __off_t
|
||||
#define _G_off64_t __off64_t
|
||||
#define _G_pid_t __pid_t
|
||||
#define _G_uid_t __uid_t
|
||||
#define _G_wchar_t wchar_t
|
||||
#define _G_wint_t wint_t
|
||||
#define _G_stat64 stat64
|
||||
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
# include <iconv.h>
|
||||
typedef iconv_t _G_iconv_t;
|
||||
#endif
|
||||
|
||||
typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
|
||||
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
|
||||
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
|
||||
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
|
||||
|
||||
#define _G_HAVE_BOOL 1
|
||||
|
||||
|
||||
/* These library features are always available in the GNU C library. */
|
||||
#define _G_HAVE_ATEXIT 1
|
||||
#define _G_HAVE_SYS_CDEFS 1
|
||||
#define _G_HAVE_SYS_WAIT 1
|
||||
#define _G_NEED_STDARG_H 1
|
||||
#define _G_va_list __gnuc_va_list
|
||||
|
||||
#define _G_HAVE_PRINTF_FP 1
|
||||
#define _G_HAVE_MMAP 1
|
||||
#define _G_HAVE_LONG_DOUBLE_IO 1
|
||||
#define _G_HAVE_IO_FILE_OPEN 1
|
||||
#define _G_HAVE_IO_GETLINE_INFO 1
|
||||
|
||||
#define _G_IO_IO_FILE_VERSION 0x20001
|
||||
|
||||
//#define _G_OPEN64 __open64
|
||||
//#define _G_LSEEK64 __lseek64
|
||||
//#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
|
||||
|
||||
/* This is defined by <bits/stat.h> if `st_blksize' exists. */
|
||||
/*#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)*/
|
||||
|
||||
#define _G_BUFSIZ 8192
|
||||
|
||||
/* These are the vtbl details for ELF. */
|
||||
#define _G_NAMES_HAVE_UNDERSCORE 0
|
||||
#define _G_VTABLE_LABEL_HAS_LENGTH 1
|
||||
#ifndef _G_USING_THUNKS
|
||||
# define _G_USING_THUNKS 1
|
||||
#endif /* _G_USING_THUNKS */
|
||||
#define _G_VTABLE_LABEL_PREFIX "__vt_"
|
||||
#define _G_VTABLE_LABEL_PREFIX_ID __vt_
|
||||
|
||||
#define _G_INTERNAL_CCS "UCS4"
|
||||
#define _G_HAVE_WEAK_SYMBOL 1
|
||||
#define _G_STDIO_USES_LIBIO 1
|
||||
|
||||
#if defined __cplusplus || defined __STDC__
|
||||
# define _G_ARGS(ARGLIST) ARGLIST
|
||||
#else
|
||||
# define _G_ARGS(ARGLIST) ()
|
||||
#endif
|
||||
|
||||
#endif /* _G_config.h */
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO 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, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not 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) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* Modified for GNU iostream by Per Bothner 1991, 1992. */
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
# define _POSIX_SOURCE
|
||||
#endif
|
||||
#include "libioP.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef __STDC__
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# undef isatty
|
||||
# define isatty(Fd) __isatty (Fd)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allocate a file buffer, or switch to unbuffered I/O.
|
||||
* Per the ANSI C standard, ALL tty devices default to line buffered.
|
||||
*
|
||||
* As a side effect, we set __SOPT or __SNPT (en/dis-able fseek
|
||||
* optimisation) right after the _fstat() that finds the buffer size.
|
||||
*/
|
||||
|
||||
int
|
||||
_IO_file_doallocate (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
_IO_size_t size;
|
||||
int couldbetty;
|
||||
char *p;
|
||||
struct _G_stat64 st;
|
||||
|
||||
if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
|
||||
{
|
||||
couldbetty = 0;
|
||||
size = _IO_BUFSIZ;
|
||||
#if 0
|
||||
/* do not try to optimise fseek() */
|
||||
fp->_flags |= __SNPT;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
couldbetty = S_ISCHR (st.st_mode);
|
||||
#if _IO_HAVE_ST_BLKSIZE
|
||||
size = st.st_blksize <= 0 ? _IO_BUFSIZ : st.st_blksize;
|
||||
#else
|
||||
size = _IO_BUFSIZ;
|
||||
#endif
|
||||
}
|
||||
ALLOC_BUF (p, size, EOF);
|
||||
_IO_setb (fp, p, p + size, 1);
|
||||
if (couldbetty && isatty (fp->_fileno))
|
||||
fp->_flags |= _IO_LINE_BUF;
|
||||
return 1;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,97 +0,0 @@
|
|||
/* Copyright (C) 1993, 1995, 1997-1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO 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, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not 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. */
|
||||
|
||||
#include "libioP.h"
|
||||
#ifdef __STDC__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#if _LIBC
|
||||
# include "../iconv/gconv_int.h"
|
||||
# include <shlib-compat.h>
|
||||
#else
|
||||
# define SHLIB_COMPAT(a, b, c) 0
|
||||
# define _IO_new_fclose fclose
|
||||
#endif
|
||||
|
||||
int
|
||||
_IO_new_fclose (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
int status;
|
||||
|
||||
CHECK_FILE(fp, EOF);
|
||||
|
||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
|
||||
/* We desperately try to help programs which are using streams in a
|
||||
strange way and mix old and new functions. Detect old streams
|
||||
here. */
|
||||
if (fp->_vtable_offset != 0)
|
||||
return _IO_old_fclose (fp);
|
||||
#endif
|
||||
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
if (fp->_IO_file_flags & _IO_IS_FILEBUF)
|
||||
status = _IO_file_close_it (fp);
|
||||
else
|
||||
status = fp->_flags & _IO_ERR_SEEN ? -1 : 0;
|
||||
_IO_FINISH (fp);
|
||||
_IO_funlockfile (fp);
|
||||
if (fp->_mode > 0)
|
||||
{
|
||||
#if _LIBC
|
||||
/* This stream has a wide orientation. This means we have to free
|
||||
the conversion functions. */
|
||||
struct _IO_codecvt *cc = fp->_codecvt;
|
||||
|
||||
if (cc->__cd_in.__cd.__steps->__shlib_handle != NULL)
|
||||
{
|
||||
--cc->__cd_in.__cd.__steps->__counter;
|
||||
__gconv_close_transform (cc->__cd_in.__cd.__steps, 1);
|
||||
}
|
||||
if (cc->__cd_out.__cd.__steps->__shlib_handle != NULL)
|
||||
{
|
||||
--cc->__cd_out.__cd.__steps->__counter;
|
||||
__gconv_close_transform (cc->__cd_out.__cd.__steps, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
_IO_cleanup_region_end (0);
|
||||
if (_IO_have_backup (fp))
|
||||
_IO_free_backup_area (fp);
|
||||
if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr)
|
||||
{
|
||||
fp->_IO_file_flags = 0;
|
||||
free(fp);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
versioned_symbol (libc, _IO_new_fclose, _IO_fclose, GLIBC_2_1);
|
||||
strong_alias (_IO_new_fclose, __new_fclose)
|
||||
versioned_symbol (libc, __new_fclose, fclose, GLIBC_2_1);
|
||||
#endif
|
|
@ -1,78 +0,0 @@
|
|||
/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO 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, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not 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. */
|
||||
|
||||
#include "libioP.h"
|
||||
#ifdef __STDC__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef _LIBC
|
||||
# include <shlib-compat.h>
|
||||
#else
|
||||
# define _IO_new_fopen fopen
|
||||
#endif
|
||||
|
||||
_IO_FILE *
|
||||
_IO_new_fopen (filename, mode)
|
||||
const char *filename;
|
||||
const char *mode;
|
||||
{
|
||||
struct locked_FILE
|
||||
{
|
||||
struct _IO_FILE_plus fp;
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_IO_lock_t lock;
|
||||
#endif
|
||||
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
struct _IO_wide_data wd;
|
||||
#endif /* !(defined _LIBC || defined _GLIBCPP_USE_WCHAR_T) */
|
||||
} *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
|
||||
|
||||
if (new_f == NULL)
|
||||
return NULL;
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
new_f->fp.file._lock = &new_f->lock;
|
||||
#endif
|
||||
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
_IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
|
||||
#else
|
||||
_IO_no_init (&new_f->fp.file, 1, 0, NULL, NULL);
|
||||
#endif
|
||||
_IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
|
||||
_IO_file_init (&new_f->fp);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
new_f->fp.vtable = NULL;
|
||||
#endif
|
||||
if (_IO_file_fopen ((_IO_FILE *) new_f, filename, mode, 1) != NULL)
|
||||
return (_IO_FILE *) &new_f->fp;
|
||||
_IO_un_link (&new_f->fp);
|
||||
free (new_f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
strong_alias (_IO_new_fopen, __new_fopen)
|
||||
versioned_symbol (libc, _IO_new_fopen, _IO_fopen, GLIBC_2_1);
|
||||
versioned_symbol (libc, __new_fopen, fopen, GLIBC_2_1);
|
||||
#endif
|
|
@ -1,476 +0,0 @@
|
|||
/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO 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, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not 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. */
|
||||
|
||||
#include <libioP.h>
|
||||
#ifdef _LIBC
|
||||
# include <dlfcn.h>
|
||||
# include <wchar.h>
|
||||
# include <locale/localeinfo.h>
|
||||
# include <wcsmbs/wcsmbsload.h>
|
||||
# include <iconv/gconv_int.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_LIBC) || defined(_GLIBCPP_USE_WCHAR_T)
|
||||
# include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
/* Prototypes of libio's codecvt functions. */
|
||||
static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
|
||||
__c_mbstate_t *statep,
|
||||
const wchar_t *from_start,
|
||||
const wchar_t *from_end,
|
||||
const wchar_t **from_stop, char *to_start,
|
||||
char *to_end, char **to_stop);
|
||||
static enum __codecvt_result do_unshift (struct _IO_codecvt *codecvt,
|
||||
__c_mbstate_t *statep, char *to_start,
|
||||
char *to_end, char **to_stop);
|
||||
static enum __codecvt_result do_in (struct _IO_codecvt *codecvt,
|
||||
__c_mbstate_t *statep,
|
||||
const char *from_start,
|
||||
const char *from_end,
|
||||
const char **from_stop, wchar_t *to_start,
|
||||
wchar_t *to_end, wchar_t **to_stop);
|
||||
static int do_encoding (struct _IO_codecvt *codecvt);
|
||||
static int do_length (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const char *from_start,
|
||||
const char *from_end, _IO_size_t max);
|
||||
static int do_max_length (struct _IO_codecvt *codecvt);
|
||||
static int do_always_noconv (struct _IO_codecvt *codecvt);
|
||||
|
||||
|
||||
/* The functions used in `codecvt' for libio are always the same. */
|
||||
struct _IO_codecvt __libio_codecvt =
|
||||
{
|
||||
.__codecvt_destr = NULL, /* Destructor, never used. */
|
||||
.__codecvt_do_out = do_out,
|
||||
.__codecvt_do_unshift = do_unshift,
|
||||
.__codecvt_do_in = do_in,
|
||||
.__codecvt_do_encoding = do_encoding,
|
||||
.__codecvt_do_always_noconv = do_always_noconv,
|
||||
.__codecvt_do_length = do_length,
|
||||
.__codecvt_do_max_length = do_max_length
|
||||
};
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
static struct __gconv_trans_data libio_translit =
|
||||
{
|
||||
.__trans_fct = __gconv_transliterate
|
||||
};
|
||||
#endif
|
||||
#endif /* defined(GLIBCPP_USE_WCHAR_T) */
|
||||
|
||||
/* Return orientation of stream. If mode is nonzero try to change
|
||||
the orientation first. */
|
||||
#undef _IO_fwide
|
||||
int
|
||||
_IO_fwide (fp, mode)
|
||||
_IO_FILE *fp;
|
||||
int mode;
|
||||
{
|
||||
/* Normalize the value. */
|
||||
mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
|
||||
|
||||
if (mode == 0 || fp->_mode != 0)
|
||||
/* The caller simply wants to know about the current orientation
|
||||
or the orientation already has been determined. */
|
||||
return fp->_mode;
|
||||
|
||||
/* Set the orientation appropriately. */
|
||||
if (mode > 0)
|
||||
{
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
struct _IO_codecvt *cc = fp->_codecvt;
|
||||
|
||||
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
|
||||
fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_write_base;
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Get the character conversion functions based on the currently
|
||||
selected locale for LC_CTYPE. */
|
||||
{
|
||||
struct gconv_fcts fcts;
|
||||
|
||||
/* Clear the state. We start all over again. */
|
||||
memset (&fp->_wide_data->_IO_state, '\0', sizeof (__c_mbstate_t));
|
||||
memset (&fp->_wide_data->_IO_last_state, '\0', sizeof (__c_mbstate_t));
|
||||
|
||||
__wcsmbs_clone_conv (&fcts);
|
||||
|
||||
/* The functions are always the same. */
|
||||
*cc = __libio_codecvt;
|
||||
|
||||
cc->__cd_in.__cd.__nsteps = 1; /* Only one step allowed. */
|
||||
cc->__cd_in.__cd.__steps = fcts.towc;
|
||||
|
||||
cc->__cd_in.__cd.__data[0].__invocation_counter = 0;
|
||||
cc->__cd_in.__cd.__data[0].__internal_use = 1;
|
||||
cc->__cd_in.__cd.__data[0].__flags = __GCONV_IS_LAST;
|
||||
cc->__cd_in.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;
|
||||
|
||||
/* XXX For now no transliteration. */
|
||||
cc->__cd_in.__cd.__data[0].__trans = NULL;
|
||||
|
||||
cc->__cd_out.__cd.__nsteps = 1; /* Only one step allowed. */
|
||||
cc->__cd_out.__cd.__steps = fcts.tomb;
|
||||
|
||||
cc->__cd_out.__cd.__data[0].__invocation_counter = 0;
|
||||
cc->__cd_out.__cd.__data[0].__internal_use = 1;
|
||||
cc->__cd_out.__cd.__data[0].__flags = __GCONV_IS_LAST;
|
||||
cc->__cd_out.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;
|
||||
|
||||
/* And now the transliteration. */
|
||||
cc->__cd_out.__cd.__data[0].__trans = &libio_translit;
|
||||
}
|
||||
#else
|
||||
# ifdef _GLIBCPP_USE_WCHAR_T
|
||||
{
|
||||
/* Determine internal and external character sets.
|
||||
XXX For now we make our life easy: we assume a fixed internal
|
||||
encoding (as most sane systems have; hi HP/UX!). If somebody
|
||||
cares about systems which changing internal charsets they
|
||||
should come up with a solution for the determination of the
|
||||
currently used internal character set. */
|
||||
#if 0
|
||||
const char *internal_ccs = _G_INTERNAL_CCS;
|
||||
const char *external_ccs = nl_langinfo(CODESET);
|
||||
|
||||
if (external_ccs == NULL)
|
||||
external_ccs = "ISO-8859-1";
|
||||
|
||||
cc->__cd_in = iconv_open (internal_ccs, external_ccs);
|
||||
if (cc->__cd_in != (iconv_t) -1)
|
||||
cc->__cd_out = iconv_open (external_ccs, internal_ccs);
|
||||
#endif
|
||||
}
|
||||
# else
|
||||
# error "somehow determine this from LC_CTYPE"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* From now on use the wide character callback functions. */
|
||||
((struct _IO_FILE_plus *) fp)->vtable = fp->_wide_data->_wide_vtable;
|
||||
#else /* !defined(_GLIBCPP_USE_WCHAR_T) */
|
||||
mode = fp->_mode;
|
||||
#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */
|
||||
}
|
||||
|
||||
/* Set the mode now. */
|
||||
fp->_mode = mode;
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
#ifdef weak_alias
|
||||
weak_alias (_IO_fwide, fwide)
|
||||
#endif
|
||||
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
|
||||
static enum __codecvt_result
|
||||
do_out (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const wchar_t *from_start, const wchar_t *from_end,
|
||||
const wchar_t **from_stop, char *to_start, char *to_end,
|
||||
char **to_stop)
|
||||
{
|
||||
enum __codecvt_result result;
|
||||
|
||||
#ifdef _LIBC
|
||||
struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
|
||||
int status;
|
||||
size_t dummy;
|
||||
const unsigned char *from_start_copy = (unsigned char *) from_start;
|
||||
|
||||
codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
|
||||
codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
|
||||
codecvt->__cd_out.__cd.__data[0].__statep = statep;
|
||||
|
||||
status = DL_CALL_FCT (gs->__fct,
|
||||
(gs, codecvt->__cd_out.__cd.__data, &from_start_copy,
|
||||
(const unsigned char *) from_end, NULL,
|
||||
&dummy, 0, 0));
|
||||
|
||||
*from_stop = (wchar_t *) from_start_copy;
|
||||
*to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case __GCONV_OK:
|
||||
case __GCONV_EMPTY_INPUT:
|
||||
result = __codecvt_ok;
|
||||
break;
|
||||
|
||||
case __GCONV_FULL_OUTPUT:
|
||||
case __GCONV_INCOMPLETE_INPUT:
|
||||
result = __codecvt_partial;
|
||||
break;
|
||||
|
||||
default:
|
||||
result = __codecvt_error;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
# ifdef _GLIBCPP_USE_WCHAR_T
|
||||
size_t res;
|
||||
const char *from_start_copy = (const char *) from_start;
|
||||
size_t from_len = from_end - from_start;
|
||||
char *to_start_copy = to_start;
|
||||
size_t to_len = to_end - to_start;
|
||||
res = iconv (codecvt->__cd_out, &from_start_copy, &from_len,
|
||||
&to_start_copy, &to_len);
|
||||
|
||||
if (res == 0 || from_len == 0)
|
||||
result = __codecvt_ok;
|
||||
else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
|
||||
result = __codecvt_partial;
|
||||
else
|
||||
result = __codecvt_error;
|
||||
|
||||
# else
|
||||
/* Decide what to do. */
|
||||
result = __codecvt_error;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static enum __codecvt_result
|
||||
do_unshift (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
char *to_start, char *to_end, char **to_stop)
|
||||
{
|
||||
enum __codecvt_result result;
|
||||
|
||||
#ifdef _LIBC
|
||||
struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
|
||||
int status;
|
||||
size_t dummy;
|
||||
|
||||
codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
|
||||
codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
|
||||
codecvt->__cd_out.__cd.__data[0].__statep = statep;
|
||||
|
||||
status = DL_CALL_FCT (gs->__fct,
|
||||
(gs, codecvt->__cd_out.__cd.__data, NULL, NULL,
|
||||
NULL, &dummy, 1, 0));
|
||||
|
||||
*to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case __GCONV_OK:
|
||||
case __GCONV_EMPTY_INPUT:
|
||||
result = __codecvt_ok;
|
||||
break;
|
||||
|
||||
case __GCONV_FULL_OUTPUT:
|
||||
case __GCONV_INCOMPLETE_INPUT:
|
||||
result = __codecvt_partial;
|
||||
break;
|
||||
|
||||
default:
|
||||
result = __codecvt_error;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
# ifdef _GLIBCPP_USE_WCHAR_T
|
||||
size_t res;
|
||||
char *to_start_copy = (char *) to_start;
|
||||
size_t to_len = to_end - to_start;
|
||||
|
||||
res = iconv (codecvt->__cd_out, NULL, NULL, &to_start_copy, &to_len);
|
||||
|
||||
if (res == 0)
|
||||
result = __codecvt_ok;
|
||||
else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
|
||||
result = __codecvt_partial;
|
||||
else
|
||||
result = __codecvt_error;
|
||||
# else
|
||||
/* Decide what to do. */
|
||||
result = __codecvt_error;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static enum __codecvt_result
|
||||
do_in (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const char *from_start, const char *from_end, const char **from_stop,
|
||||
wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop)
|
||||
{
|
||||
enum __codecvt_result result;
|
||||
|
||||
#ifdef _LIBC
|
||||
struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
|
||||
int status;
|
||||
size_t dummy;
|
||||
const unsigned char *from_start_copy = (unsigned char *) from_start;
|
||||
|
||||
codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_start;
|
||||
codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) to_end;
|
||||
codecvt->__cd_in.__cd.__data[0].__statep = statep;
|
||||
|
||||
status = DL_CALL_FCT (gs->__fct,
|
||||
(gs, codecvt->__cd_in.__cd.__data, &from_start_copy,
|
||||
from_end, NULL, &dummy, 0, 0));
|
||||
|
||||
*from_stop = from_start_copy;
|
||||
*to_stop = (wchar_t *) codecvt->__cd_in.__cd.__data[0].__outbuf;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case __GCONV_OK:
|
||||
case __GCONV_EMPTY_INPUT:
|
||||
result = __codecvt_ok;
|
||||
break;
|
||||
|
||||
case __GCONV_FULL_OUTPUT:
|
||||
case __GCONV_INCOMPLETE_INPUT:
|
||||
result = __codecvt_partial;
|
||||
break;
|
||||
|
||||
default:
|
||||
result = __codecvt_error;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
# ifdef _GLIBCPP_USE_WCHAR_T
|
||||
size_t res;
|
||||
const char *from_start_copy = (const char *) from_start;
|
||||
size_t from_len = from_end - from_start;
|
||||
char *to_start_copy = (char *) from_start;
|
||||
size_t to_len = to_end - to_start;
|
||||
|
||||
res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
|
||||
&to_start_copy, &to_len);
|
||||
|
||||
if (res == 0)
|
||||
result = __codecvt_ok;
|
||||
else if (to_len == 0)
|
||||
result = __codecvt_partial;
|
||||
else if (from_len < codecvt->__codecvt_do_max_length (codecvt))
|
||||
result = __codecvt_partial;
|
||||
else
|
||||
result = __codecvt_error;
|
||||
# else
|
||||
/* Decide what to do. */
|
||||
result = __codecvt_error;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
do_encoding (struct _IO_codecvt *codecvt)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
/* See whether the encoding is stateful. */
|
||||
if (codecvt->__cd_in.__cd.__steps[0].__stateful)
|
||||
return -1;
|
||||
/* Fortunately not. Now determine the input bytes for the conversion
|
||||
necessary for each wide character. */
|
||||
if (codecvt->__cd_in.__cd.__steps[0].__min_needed_from
|
||||
!= codecvt->__cd_in.__cd.__steps[0].__max_needed_from)
|
||||
/* Not a constant value. */
|
||||
return 0;
|
||||
|
||||
return codecvt->__cd_in.__cd.__steps[0].__min_needed_from;
|
||||
#else
|
||||
/* Worst case scenario. */
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
do_always_noconv (struct _IO_codecvt *codecvt)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
do_length (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const char *from_start, const char *from_end, _IO_size_t max)
|
||||
{
|
||||
int result;
|
||||
#ifdef _LIBC
|
||||
const unsigned char *cp = (const unsigned char *) from_start;
|
||||
wchar_t to_buf[max];
|
||||
struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
|
||||
int status;
|
||||
size_t dummy;
|
||||
|
||||
codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_buf;
|
||||
codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) &to_buf[max];
|
||||
codecvt->__cd_in.__cd.__data[0].__statep = statep;
|
||||
|
||||
status = DL_CALL_FCT (gs->__fct,
|
||||
(gs, codecvt->__cd_in.__cd.__data, &cp, from_end,
|
||||
NULL, &dummy, 0, 0));
|
||||
|
||||
result = cp - (const unsigned char *) from_start;
|
||||
#else
|
||||
# ifdef _GLIBCPP_USE_WCHAR_T
|
||||
const char *from_start_copy = (const char *) from_start;
|
||||
size_t from_len = from_end - from_start;
|
||||
wchar_t to_buf[max];
|
||||
size_t res;
|
||||
char *to_start = (char *) to_buf;
|
||||
|
||||
res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
|
||||
&to_start, &max);
|
||||
|
||||
result = from_start_copy - (char *) from_start;
|
||||
# else
|
||||
/* Decide what to do. */
|
||||
result = 0;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
do_max_length (struct _IO_codecvt *codecvt)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
return codecvt->__cd_in.__cd.__steps[0].__max_needed_from;
|
||||
#else
|
||||
return MB_CUR_MAX;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* defined(_GLIBCPP_USE_WCHAR_T) */
|
|
@ -1,82 +0,0 @@
|
|||
#include "libio.h"
|
||||
|
||||
/* These emulate stdio functionality, but with a different name
|
||||
(_IO_ungetc instead of ungetc), and using _IO_FILE instead of FILE. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int _IO_fclose __P((_IO_FILE*));
|
||||
extern int _IO_new_fclose __P((_IO_FILE*));
|
||||
extern int _IO_old_fclose __P((_IO_FILE*));
|
||||
extern _IO_FILE *_IO_fdopen __P((int, const char*));
|
||||
extern _IO_FILE *_IO_old_fdopen __P((int, const char*));
|
||||
extern _IO_FILE *_IO_new_fdopen __P((int, const char*));
|
||||
extern int _IO_fflush __P((_IO_FILE*));
|
||||
extern int _IO_fgetpos __P((_IO_FILE*, _IO_fpos_t*));
|
||||
extern int _IO_fgetpos64 __P((_IO_FILE*, _IO_fpos64_t*));
|
||||
extern char* _IO_fgets __P((char*, int, _IO_FILE*));
|
||||
extern _IO_FILE *_IO_fopen __P((const char*, const char*));
|
||||
extern _IO_FILE *_IO_old_fopen __P((const char*, const char*));
|
||||
extern _IO_FILE *_IO_new_fopen __P((const char*, const char*));
|
||||
extern _IO_FILE *_IO_fopen64 __P((const char*, const char*));
|
||||
extern int _IO_fprintf __P((_IO_FILE*, const char*, ...));
|
||||
extern int _IO_fputs __P((const char*, _IO_FILE*));
|
||||
extern int _IO_fsetpos __P((_IO_FILE*, const _IO_fpos_t *));
|
||||
extern int _IO_fsetpos64 __P((_IO_FILE*, const _IO_fpos64_t *));
|
||||
extern long int _IO_ftell __P((_IO_FILE*));
|
||||
extern _IO_size_t _IO_fread __P((void*, _IO_size_t, _IO_size_t, _IO_FILE*));
|
||||
extern _IO_size_t _IO_fwrite __P((const void*,
|
||||
_IO_size_t, _IO_size_t, _IO_FILE*));
|
||||
extern char* _IO_gets __P((char*));
|
||||
extern void _IO_perror __P((const char*));
|
||||
extern int _IO_printf __P((const char*, ...));
|
||||
extern int _IO_puts __P((const char*));
|
||||
extern int _IO_scanf __P((const char*, ...));
|
||||
extern void _IO_setbuffer __P((_IO_FILE *, char*, _IO_size_t));
|
||||
extern int _IO_setvbuf __P((_IO_FILE*, char*, int, _IO_size_t));
|
||||
extern int _IO_sscanf __P((const char*, const char*, ...));
|
||||
extern int _IO_sprintf __P((char *, const char*, ...));
|
||||
extern int _IO_ungetc __P((int, _IO_FILE*));
|
||||
extern int _IO_vsscanf __P((const char *, const char *, _IO_va_list));
|
||||
extern int _IO_vsprintf __P((char*, const char*, _IO_va_list));
|
||||
extern int _IO_vswprintf __P((wchar_t*, _IO_size_t, const wchar_t*,
|
||||
_IO_va_list));
|
||||
|
||||
struct obstack;
|
||||
extern int _IO_obstack_vprintf __P ((struct obstack *, const char *,
|
||||
_IO_va_list));
|
||||
extern int _IO_obstack_printf __P ((struct obstack *, const char *, ...));
|
||||
#ifndef _IO_pos_BAD
|
||||
#define _IO_pos_BAD ((_IO_off64_t)(-1))
|
||||
#endif
|
||||
#define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN))
|
||||
#define _IO_fseek(__fp, __offset, __whence) \
|
||||
(_IO_seekoff(__fp, __offset, __whence, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD ? EOF : 0)
|
||||
#define _IO_rewind(FILE) (void)_IO_seekoff(FILE, 0, 0, _IOS_INPUT|_IOS_OUTPUT)
|
||||
#define _IO_vprintf(FORMAT, ARGS) _IO_vfprintf(_IO_stdout, FORMAT, ARGS)
|
||||
#define _IO_freopen(FILENAME, MODE, FP) \
|
||||
(_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 0))
|
||||
#define _IO_old_freopen(FILENAME, MODE, FP) \
|
||||
(_IO_old_file_close_it (FP), _IO_old_file_fopen(FP, FILENAME, MODE))
|
||||
#define _IO_freopen64(FILENAME, MODE, FP) \
|
||||
(_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 1))
|
||||
#define _IO_fileno(FP) ((FP)->_fileno)
|
||||
extern _IO_FILE* _IO_popen __P((const char*, const char*));
|
||||
extern _IO_FILE* _IO_new_popen __P((const char*, const char*));
|
||||
extern _IO_FILE* _IO_old_popen __P((const char*, const char*));
|
||||
extern int __new_pclose __P((_IO_FILE *));
|
||||
extern int __old_pclose __P((_IO_FILE *));
|
||||
#define _IO_pclose _IO_fclose
|
||||
#define _IO_setbuf(_FP, _BUF) _IO_setbuffer(_FP, _BUF, _IO_BUFSIZ)
|
||||
#define _IO_setlinebuf(_FP) _IO_setvbuf(_FP, NULL, 1, 0)
|
||||
|
||||
_IO_FILE *__new_freopen __P ((const char *, const char *, _IO_FILE *));
|
||||
_IO_FILE *__old_freopen __P ((const char *, const char *, _IO_FILE *));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1,511 +0,0 @@
|
|||
/* Copyright (C) 1991,92,93,94,95,97,98,99,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
Written by Per Bothner <bothner@cygnus.com>.
|
||||
|
||||
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, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not 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. */
|
||||
|
||||
#ifndef _IO_STDIO_H
|
||||
#define _IO_STDIO_H
|
||||
|
||||
#include <_G_config.h>
|
||||
/* ALL of these should be defined in _G_config.h */
|
||||
#define _IO_pos_t _G_fpos_t /* obsolete */
|
||||
#define _IO_fpos_t _G_fpos_t
|
||||
#define _IO_fpos64_t _G_fpos64_t
|
||||
#define _IO_size_t _G_size_t
|
||||
#define _IO_ssize_t _G_ssize_t
|
||||
#define _IO_off_t _G_off_t
|
||||
#define _IO_off64_t _G_off64_t
|
||||
#define _IO_pid_t _G_pid_t
|
||||
#define _IO_uid_t _G_uid_t
|
||||
#define _IO_iconv_t _G_iconv_t
|
||||
#define _IO_HAVE_SYS_WAIT _G_HAVE_SYS_WAIT
|
||||
#define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE
|
||||
#define _IO_BUFSIZ _G_BUFSIZ
|
||||
#define _IO_va_list _G_va_list
|
||||
#define _IO_wint_t _G_wint_t
|
||||
|
||||
#ifdef _G_NEED_STDARG_H
|
||||
/* This define avoids name pollution if we're using GNU stdarg.h */
|
||||
# define __need___va_list
|
||||
# include <stdarg.h>
|
||||
# ifdef __GNUC_VA_LIST
|
||||
# undef _IO_va_list
|
||||
# define _IO_va_list __gnuc_va_list
|
||||
# endif /* __GNUC_VA_LIST */
|
||||
#endif
|
||||
|
||||
#ifndef __THROW
|
||||
# ifdef __cplusplus
|
||||
# define __THROW throw ()
|
||||
# else
|
||||
# define __THROW
|
||||
# endif
|
||||
#endif /* not __THROW */
|
||||
|
||||
#ifndef __P
|
||||
# define __P(p) p __THROW
|
||||
#endif /* not __P */
|
||||
|
||||
#ifndef __PMT
|
||||
# define __PMT(p) p
|
||||
#endif /* not __PMT */
|
||||
|
||||
/* For backward compatibility */
|
||||
#ifndef _PARAMS
|
||||
# define _PARAMS(protos) __P(protos)
|
||||
#endif /*!_PARAMS*/
|
||||
|
||||
#ifndef __STDC__
|
||||
# ifndef const
|
||||
# define const
|
||||
# endif
|
||||
#endif
|
||||
#define _IO_UNIFIED_JUMPTABLES 1
|
||||
#ifndef _G_HAVE_PRINTF_FP
|
||||
# define _IO_USE_DTOA 1
|
||||
#endif
|
||||
|
||||
#ifndef EOF
|
||||
# define EOF (-1)
|
||||
#endif
|
||||
#ifndef NULL
|
||||
# if defined __GNUG__ && \
|
||||
(__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
|
||||
# define NULL (__null)
|
||||
# else
|
||||
# if !defined(__cplusplus)
|
||||
# define NULL ((void*)0)
|
||||
# else
|
||||
# define NULL (0)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define _IOS_INPUT 1
|
||||
#define _IOS_OUTPUT 2
|
||||
#define _IOS_ATEND 4
|
||||
#define _IOS_APPEND 8
|
||||
#define _IOS_TRUNC 16
|
||||
#define _IOS_NOCREATE 32
|
||||
#define _IOS_NOREPLACE 64
|
||||
#define _IOS_BIN 128
|
||||
|
||||
/* Magic numbers and bits for the _flags field.
|
||||
The magic numbers use the high-order bits of _flags;
|
||||
the remaining bits are available for variable flags.
|
||||
Note: The magic numbers must all be negative if stdio
|
||||
emulation is desired. */
|
||||
|
||||
#define _IO_MAGIC 0xFBAD0000 /* Magic number */
|
||||
#define _OLD_STDIO_MAGIC 0xFABC0000 /* Emulate old stdio. */
|
||||
#define _IO_MAGIC_MASK 0xFFFF0000
|
||||
#define _IO_USER_BUF 1 /* User owns buffer; don't delete it on close. */
|
||||
#define _IO_UNBUFFERED 2
|
||||
#define _IO_NO_READS 4 /* Reading not allowed */
|
||||
#define _IO_NO_WRITES 8 /* Writing not allowd */
|
||||
#define _IO_EOF_SEEN 0x10
|
||||
#define _IO_ERR_SEEN 0x20
|
||||
#define _IO_DELETE_DONT_CLOSE 0x40 /* Don't call close(_fileno) on cleanup. */
|
||||
#define _IO_LINKED 0x80 /* Set if linked (using _chain) to streambuf::_list_all.*/
|
||||
#define _IO_IN_BACKUP 0x100
|
||||
#define _IO_LINE_BUF 0x200
|
||||
#define _IO_TIED_PUT_GET 0x400 /* Set if put and get pointer logicly tied. */
|
||||
#define _IO_CURRENTLY_PUTTING 0x800
|
||||
#define _IO_IS_APPENDING 0x1000
|
||||
#define _IO_IS_FILEBUF 0x2000
|
||||
#define _IO_BAD_SEEN 0x4000
|
||||
#define _IO_USER_LOCK 0x8000
|
||||
|
||||
/* These are "formatting flags" matching the iostream fmtflags enum values. */
|
||||
#define _IO_SKIPWS 01
|
||||
#define _IO_LEFT 02
|
||||
#define _IO_RIGHT 04
|
||||
#define _IO_INTERNAL 010
|
||||
#define _IO_DEC 020
|
||||
#define _IO_OCT 040
|
||||
#define _IO_HEX 0100
|
||||
#define _IO_SHOWBASE 0200
|
||||
#define _IO_SHOWPOINT 0400
|
||||
#define _IO_UPPERCASE 01000
|
||||
#define _IO_SHOWPOS 02000
|
||||
#define _IO_SCIENTIFIC 04000
|
||||
#define _IO_FIXED 010000
|
||||
#define _IO_UNITBUF 020000
|
||||
#define _IO_STDIO 040000
|
||||
#define _IO_DONT_CLOSE 0100000
|
||||
#define _IO_BOOLALPHA 0200000
|
||||
|
||||
|
||||
struct _IO_jump_t; struct _IO_FILE;
|
||||
|
||||
/* Handle lock. */
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
# if defined __GLIBC__ && __GLIBC__ >= 2
|
||||
# if __GLIBC_MINOR__ == 0
|
||||
# include <stdio-lock.h>
|
||||
# else
|
||||
# include <bits/stdio-lock.h>
|
||||
# endif
|
||||
# else
|
||||
/*# include <comthread.h>*/
|
||||
# endif
|
||||
#else
|
||||
typedef void _IO_lock_t;
|
||||
#endif
|
||||
|
||||
|
||||
/* A streammarker remembers a position in a buffer. */
|
||||
|
||||
struct _IO_marker {
|
||||
struct _IO_marker *_next;
|
||||
struct _IO_FILE *_sbuf;
|
||||
/* If _pos >= 0
|
||||
it points to _buf->Gbase()+_pos. FIXME comment */
|
||||
/* if _pos < 0, it points to _buf->eBptr()+_pos. FIXME comment */
|
||||
int _pos;
|
||||
#if 0
|
||||
void set_streampos(streampos sp) { _spos = sp; }
|
||||
void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); }
|
||||
public:
|
||||
streammarker(streambuf *sb);
|
||||
~streammarker();
|
||||
int saving() { return _spos == -2; }
|
||||
int delta(streammarker&);
|
||||
int delta();
|
||||
#endif
|
||||
};
|
||||
|
||||
/* This is the structure from the libstdc++ codecvt class. */
|
||||
enum __codecvt_result
|
||||
{
|
||||
__codecvt_ok,
|
||||
__codecvt_partial,
|
||||
__codecvt_error,
|
||||
__codecvt_noconv
|
||||
};
|
||||
|
||||
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
/* The order of the elements in the following struct must match the order
|
||||
of the virtual functions in the libstdc++ codecvt class. */
|
||||
struct _IO_codecvt
|
||||
{
|
||||
void (*__codecvt_destr) (struct _IO_codecvt *);
|
||||
enum __codecvt_result (*__codecvt_do_out) (struct _IO_codecvt *,
|
||||
__c_mbstate_t *,
|
||||
const wchar_t *,
|
||||
const wchar_t *,
|
||||
const wchar_t **, char *,
|
||||
char *, char **);
|
||||
enum __codecvt_result (*__codecvt_do_unshift) (struct _IO_codecvt *,
|
||||
__c_mbstate_t *, char *,
|
||||
char *, char **);
|
||||
enum __codecvt_result (*__codecvt_do_in) (struct _IO_codecvt *,
|
||||
__c_mbstate_t *,
|
||||
const char *, const char *,
|
||||
const char **, wchar_t *,
|
||||
wchar_t *, wchar_t **);
|
||||
int (*__codecvt_do_encoding) (struct _IO_codecvt *);
|
||||
int (*__codecvt_do_always_noconv) (struct _IO_codecvt *);
|
||||
int (*__codecvt_do_length) (struct _IO_codecvt *, __c_mbstate_t *,
|
||||
const char *, const char *, _IO_size_t);
|
||||
int (*__codecvt_do_max_length) (struct _IO_codecvt *);
|
||||
|
||||
_IO_iconv_t __cd_in;
|
||||
_IO_iconv_t __cd_out;
|
||||
};
|
||||
|
||||
/* Extra data for wide character streams. */
|
||||
struct _IO_wide_data
|
||||
{
|
||||
wchar_t *_IO_read_ptr; /* Current read pointer */
|
||||
wchar_t *_IO_read_end; /* End of get area. */
|
||||
wchar_t *_IO_read_base; /* Start of putback+get area. */
|
||||
wchar_t *_IO_write_base; /* Start of put area. */
|
||||
wchar_t *_IO_write_ptr; /* Current put pointer. */
|
||||
wchar_t *_IO_write_end; /* End of put area. */
|
||||
wchar_t *_IO_buf_base; /* Start of reserve area. */
|
||||
wchar_t *_IO_buf_end; /* End of reserve area. */
|
||||
/* The following fields are used to support backing up and undo. */
|
||||
wchar_t *_IO_save_base; /* Pointer to start of non-current get area. */
|
||||
wchar_t *_IO_backup_base; /* Pointer to first valid character of
|
||||
backup area */
|
||||
wchar_t *_IO_save_end; /* Pointer to end of non-current get area. */
|
||||
|
||||
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
__c_mbstate_t _IO_state;
|
||||
__c_mbstate_t _IO_last_state;
|
||||
#endif
|
||||
struct _IO_codecvt _codecvt;
|
||||
|
||||
wchar_t _shortbuf[1];
|
||||
|
||||
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
struct _IO_jump_t *_wide_vtable;
|
||||
#endif
|
||||
};
|
||||
#else /* !(defined _LIBC || defined _GLIBCPP_USE_WCHAR_T) */
|
||||
/* Because _IO_no_init unconditionally takes a `_IO_wide_data*' as its
|
||||
last parameter we must still define this type. We intentionally
|
||||
leave it incomplete to prevent any use of this type when we are not
|
||||
supporting wide characters. */
|
||||
struct _IO_wide_data;
|
||||
#endif /* !(defined _LIBC || defined _GLIBCPP_USE_WCHAR_T) */
|
||||
|
||||
struct _IO_FILE {
|
||||
int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
|
||||
#define _IO_file_flags _flags
|
||||
|
||||
/* The following pointers correspond to the C++ streambuf protocol. */
|
||||
/* Note: Tk uses the _IO_read_ptr and _IO_read_end fields directly. */
|
||||
char* _IO_read_ptr; /* Current read pointer */
|
||||
char* _IO_read_end; /* End of get area. */
|
||||
char* _IO_read_base; /* Start of putback+get area. */
|
||||
char* _IO_write_base; /* Start of put area. */
|
||||
char* _IO_write_ptr; /* Current put pointer. */
|
||||
char* _IO_write_end; /* End of put area. */
|
||||
char* _IO_buf_base; /* Start of reserve area. */
|
||||
char* _IO_buf_end; /* End of reserve area. */
|
||||
/* The following fields are used to support backing up and undo. */
|
||||
char *_IO_save_base; /* Pointer to start of non-current get area. */
|
||||
char *_IO_backup_base; /* Pointer to first valid character of backup area */
|
||||
char *_IO_save_end; /* Pointer to end of non-current get area. */
|
||||
|
||||
struct _IO_marker *_markers;
|
||||
|
||||
struct _IO_FILE *_chain;
|
||||
|
||||
int _fileno;
|
||||
int _blksize;
|
||||
_IO_off_t _old_offset; /* This used to be _offset but it's too small. */
|
||||
|
||||
#define __HAVE_COLUMN /* temporary */
|
||||
/* 1+column number of pbase(); 0 is unknown. */
|
||||
unsigned short _cur_column;
|
||||
signed char _vtable_offset;
|
||||
char _shortbuf[1];
|
||||
|
||||
/* char* _save_gptr; char* _save_egptr; */
|
||||
|
||||
_IO_lock_t *_lock;
|
||||
#ifdef _IO_USE_OLD_IO_FILE
|
||||
};
|
||||
|
||||
struct _IO_FILE_complete
|
||||
{
|
||||
struct _IO_FILE _file;
|
||||
#endif
|
||||
#if defined _G_IO_IO_FILE_VERSION && _G_IO_IO_FILE_VERSION == 0x20001
|
||||
_IO_off64_t _offset;
|
||||
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
/* Wide character stream stuff. */
|
||||
struct _IO_codecvt *_codecvt;
|
||||
struct _IO_wide_data *_wide_data;
|
||||
# else
|
||||
void *__pad1;
|
||||
void *__pad2;
|
||||
# endif
|
||||
int _mode;
|
||||
/* Make sure we don't get into trouble again. */
|
||||
char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef struct _IO_FILE _IO_FILE;
|
||||
#endif
|
||||
|
||||
struct _IO_FILE_plus;
|
||||
|
||||
extern struct _IO_FILE_plus _IO_2_1_stdin_;
|
||||
extern struct _IO_FILE_plus _IO_2_1_stdout_;
|
||||
extern struct _IO_FILE_plus _IO_2_1_stderr_;
|
||||
#ifndef _LIBC
|
||||
#define _IO_stdin ((_IO_FILE*)(&_IO_2_1_stdin_))
|
||||
#define _IO_stdout ((_IO_FILE*)(&_IO_2_1_stdout_))
|
||||
#define _IO_stderr ((_IO_FILE*)(&_IO_2_1_stderr_))
|
||||
#else
|
||||
extern _IO_FILE *_IO_stdin;
|
||||
extern _IO_FILE *_IO_stdout;
|
||||
extern _IO_FILE *_IO_stderr;
|
||||
#endif
|
||||
|
||||
|
||||
/* Functions to do I/O and file management for a stream. */
|
||||
|
||||
/* Read NBYTES bytes from COOKIE into a buffer pointed to by BUF.
|
||||
Return number of bytes read. */
|
||||
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
|
||||
|
||||
/* Write N bytes pointed to by BUF to COOKIE. Write all N bytes
|
||||
unless there is an error. Return number of bytes written, or -1 if
|
||||
there is an error without writing anything. If the file has been
|
||||
opened for append (__mode.__append set), then set the file pointer
|
||||
to the end of the file and then do the write; if not, just write at
|
||||
the current file pointer. */
|
||||
typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
|
||||
size_t __n);
|
||||
|
||||
/* Move COOKIE's file position to *POS bytes from the
|
||||
beginning of the file (if W is SEEK_SET),
|
||||
the current position (if W is SEEK_CUR),
|
||||
or the end of the file (if W is SEEK_END).
|
||||
Set *POS to the new file position.
|
||||
Returns zero if successful, nonzero if not. */
|
||||
typedef int __io_seek_fn (void *__cookie, _IO_off64_t *__pos, int __w);
|
||||
|
||||
/* Close COOKIE. */
|
||||
typedef int __io_close_fn (void *__cookie);
|
||||
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
/* User-visible names for the above. */
|
||||
typedef __io_read_fn cookie_read_function_t;
|
||||
typedef __io_write_fn cookie_write_function_t;
|
||||
typedef __io_seek_fn cookie_seek_function_t;
|
||||
typedef __io_close_fn cookie_close_function_t;
|
||||
|
||||
/* The structure with the cookie function pointers. */
|
||||
typedef struct
|
||||
{
|
||||
__io_read_fn *read; /* Read bytes. */
|
||||
__io_write_fn *write; /* Write bytes. */
|
||||
__io_seek_fn *seek; /* Seek/tell file position. */
|
||||
__io_close_fn *close; /* Close file. */
|
||||
} _IO_cookie_io_functions_t;
|
||||
typedef _IO_cookie_io_functions_t cookie_io_functions_t;
|
||||
|
||||
struct _IO_cookie_file;
|
||||
|
||||
/* Initialize one of those. */
|
||||
extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
|
||||
void *__cookie, _IO_cookie_io_functions_t __fns);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int __underflow (_IO_FILE *) __THROW;
|
||||
extern int __uflow (_IO_FILE *) __THROW;
|
||||
extern int __overflow (_IO_FILE *, int) __THROW;
|
||||
extern _IO_wint_t __wunderflow (_IO_FILE *) __THROW;
|
||||
extern _IO_wint_t __wuflow (_IO_FILE *) __THROW;
|
||||
extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t) __THROW;
|
||||
|
||||
#define _IO_getc_unlocked(_fp) \
|
||||
((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end ? __uflow (_fp) \
|
||||
: *(unsigned char *) (_fp)->_IO_read_ptr++)
|
||||
#define _IO_peekc_unlocked(_fp) \
|
||||
((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end \
|
||||
&& __underflow (_fp) == EOF ? EOF \
|
||||
: *(unsigned char *) (_fp)->_IO_read_ptr)
|
||||
#define _IO_putc_unlocked(_ch, _fp) \
|
||||
(((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end) \
|
||||
? __overflow (_fp, (unsigned char) (_ch)) \
|
||||
: (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch)))
|
||||
|
||||
#define _IO_getwc_unlocked(_fp) \
|
||||
((_fp)->_wide_data->_IO_read_ptr >= (_fp)->_wide_data->_IO_read_end \
|
||||
? __wuflow (_fp) : (_IO_wint_t) *(_fp)->_wide_data->_IO_read_ptr++)
|
||||
#define _IO_putwc_unlocked(_wch, _fp) \
|
||||
((_fp)->_wide_data->_IO_write_ptr >= (_fp)->_wide_data->_IO_write_end \
|
||||
? __woverflow (_fp, _wch) \
|
||||
: (_IO_wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch)))
|
||||
|
||||
#define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0)
|
||||
#define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0)
|
||||
|
||||
extern int _IO_getc (_IO_FILE *__fp) __THROW;
|
||||
extern int _IO_putc (int __c, _IO_FILE *__fp) __THROW;
|
||||
extern int _IO_feof (_IO_FILE *__fp) __THROW;
|
||||
extern int _IO_ferror (_IO_FILE *__fp) __THROW;
|
||||
|
||||
extern int _IO_peekc_locked (_IO_FILE *__fp) __THROW;
|
||||
|
||||
/* This one is for Emacs. */
|
||||
#define _IO_PENDING_OUTPUT_COUNT(_fp) \
|
||||
((_fp)->_IO_write_ptr - (_fp)->_IO_write_base)
|
||||
|
||||
extern void _IO_flockfile (_IO_FILE *) __THROW;
|
||||
extern void _IO_funlockfile (_IO_FILE *) __THROW;
|
||||
extern int _IO_ftrylockfile (_IO_FILE *) __THROW;
|
||||
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
# define _IO_peekc(_fp) _IO_peekc_locked (_fp)
|
||||
#else
|
||||
# define _IO_peekc(_fp) _IO_peekc_unlocked (_fp)
|
||||
# define _IO_flockfile(_fp) /**/
|
||||
# define _IO_funlockfile(_fp) /**/
|
||||
# define _IO_ftrylockfile(_fp) /**/
|
||||
# define _IO_cleanup_region_start(_fct, _fp) /**/
|
||||
# define _IO_cleanup_region_end(_Doit) /**/
|
||||
#endif /* !_IO_MTSAFE_IO */
|
||||
|
||||
extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
|
||||
_IO_va_list, int *__restrict) __THROW;
|
||||
extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
|
||||
_IO_va_list) __THROW;
|
||||
extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t) __THROW;
|
||||
extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t) __THROW;
|
||||
|
||||
extern _IO_off64_t _IO_seekoff (_IO_FILE *, _IO_off64_t, int, int) __THROW;
|
||||
extern _IO_off64_t _IO_seekpos (_IO_FILE *, _IO_off64_t, int) __THROW;
|
||||
|
||||
extern void _IO_free_backup_area (_IO_FILE *) __THROW;
|
||||
|
||||
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
extern _IO_wint_t _IO_getwc (_IO_FILE *__fp) __THROW;
|
||||
extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp) __THROW;
|
||||
extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW;
|
||||
# if __GNUC__ >= 2
|
||||
/* A special optimized version of the function above. It optimizes the
|
||||
case of initializing an unoriented byte stream. */
|
||||
# define _IO_fwide(__fp, __mode) \
|
||||
({ int __result = (__mode); \
|
||||
if (__result < 0) \
|
||||
{ \
|
||||
if ((__fp)->_mode == 0) \
|
||||
/* We know that all we have to do is to set the flag. */ \
|
||||
(__fp)->_mode = -1; \
|
||||
__result = (__fp)->_mode; \
|
||||
} \
|
||||
else \
|
||||
__result = _IO_fwide (__fp, __result); \
|
||||
__result; })
|
||||
# endif
|
||||
|
||||
extern int _IO_vfwscanf (_IO_FILE * __restrict, const wchar_t * __restrict,
|
||||
_IO_va_list, int *__restrict) __THROW;
|
||||
extern int _IO_vfwprintf (_IO_FILE *__restrict, const wchar_t *__restrict,
|
||||
_IO_va_list) __THROW;
|
||||
extern _IO_ssize_t _IO_wpadn (_IO_FILE *, wint_t, _IO_ssize_t) __THROW;
|
||||
extern void _IO_free_wbackup_area (_IO_FILE *) __THROW;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _IO_STDIO_H */
|
|
@ -1,821 +0,0 @@
|
|||
/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO 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, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not 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. */
|
||||
|
||||
# include <errno.h>
|
||||
|
||||
#ifndef __set_errno
|
||||
# define __set_errno(Val) errno = (Val)
|
||||
#endif
|
||||
#if defined __GLIBC__ && __GLIBC__ >= 2
|
||||
# include <bits/libc-lock.h>
|
||||
#else
|
||||
/*# include <comthread.h>*/
|
||||
#endif
|
||||
|
||||
#include "iolibio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define _IO_seek_set 0
|
||||
#define _IO_seek_cur 1
|
||||
#define _IO_seek_end 2
|
||||
|
||||
/* THE JUMPTABLE FUNCTIONS.
|
||||
|
||||
* The _IO_FILE type is used to implement the FILE type in GNU libc,
|
||||
* as well as the streambuf class in GNU iostreams for C++.
|
||||
* These are all the same, just used differently.
|
||||
* An _IO_FILE (or FILE) object is allows followed by a pointer to
|
||||
* a jump table (of pointers to functions). The pointer is accessed
|
||||
* with the _IO_JUMPS macro. The jump table has a eccentric format,
|
||||
* so as to be compatible with the layout of a C++ virtual function table.
|
||||
* (as implemented by g++). When a pointer to a streambuf object is
|
||||
* coerced to an (_IO_FILE*), then _IO_JUMPS on the result just
|
||||
* happens to point to the virtual function table of the streambuf.
|
||||
* Thus the _IO_JUMPS function table used for C stdio/libio does
|
||||
* double duty as the virtual function table for C++ streambuf.
|
||||
*
|
||||
* The entries in the _IO_JUMPS function table (and hence also the
|
||||
* virtual functions of a streambuf) are described below.
|
||||
* The first parameter of each function entry is the _IO_FILE/streambuf
|
||||
* object being acted on (i.e. the 'this' parameter).
|
||||
*/
|
||||
|
||||
#if (!defined _IO_USE_OLD_IO_FILE \
|
||||
&& (!defined _G_IO_NO_BACKWARD_COMPAT || _G_IO_NO_BACKWARD_COMPAT == 0))
|
||||
# define _IO_JUMPS_OFFSET 1
|
||||
#endif
|
||||
|
||||
#define _IO_JUMPS(THIS) (THIS)->vtable
|
||||
#define _IO_WIDE_JUMPS(THIS) ((struct _IO_FILE *) (THIS))->_wide_data->_wide_vtable
|
||||
#define _IO_CHECK_WIDE(THIS) (((struct _IO_FILE *) (THIS))->_wide_data != NULL)
|
||||
|
||||
#if _IO_JUMPS_OFFSET
|
||||
# define _IO_JUMPS_FUNC(THIS) \
|
||||
(*(struct _IO_jump_t **) ((void *) &_IO_JUMPS ((struct _IO_FILE_plus *) (THIS)) \
|
||||
+ (THIS)->_vtable_offset))
|
||||
#else
|
||||
# define _IO_JUMPS_FUNC(THIS) _IO_JUMPS ((struct _IO_FILE_plus *) (THIS))
|
||||
#endif
|
||||
#define _IO_WIDE_JUMPS_FUNC(THIS) _IO_WIDE_JUMPS(THIS)
|
||||
#if _G_USING_THUNKS
|
||||
# define JUMP_FIELD(TYPE, NAME) TYPE NAME
|
||||
# define JUMP0(FUNC, THIS) _IO_JUMPS_FUNC(THIS)->FUNC (THIS)
|
||||
# define JUMP1(FUNC, THIS, X1) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1)
|
||||
# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1, X2)
|
||||
# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1,X2, X3)
|
||||
# define JUMP_INIT(NAME, VALUE) VALUE
|
||||
# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0), JUMP_INIT (dummy2, 0)
|
||||
|
||||
# define WJUMP0(FUNC, THIS) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS)
|
||||
# define WJUMP1(FUNC, THIS, X1) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS, X1)
|
||||
# define WJUMP2(FUNC, THIS, X1, X2) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS, X1, X2)
|
||||
# define WJUMP3(FUNC, THIS, X1,X2,X3) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS, X1,X2, X3)
|
||||
#else
|
||||
/* These macros will change when we re-implement vtables to use "thunks"! */
|
||||
# define JUMP_FIELD(TYPE, NAME) struct { short delta1, delta2; TYPE pfn; } NAME
|
||||
# define JUMP0(FUNC, THIS) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS)
|
||||
# define JUMP1(FUNC, THIS, X1) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1)
|
||||
# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1, X2)
|
||||
# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1,X2,X3)
|
||||
# define JUMP_INIT(NAME, VALUE) {0, 0, VALUE}
|
||||
# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0)
|
||||
|
||||
# define WJUMP0(FUNC, THIS) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS)
|
||||
# define WJUMP1(FUNC, THIS, X1) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1)
|
||||
# define WJUMP2(FUNC, THIS, X1, X2) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1, X2)
|
||||
# define WJUMP3(FUNC, THIS, X1,X2,X3) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1,X2,X3)
|
||||
#endif
|
||||
|
||||
/* The 'finish' function does any final cleaning up of an _IO_FILE object.
|
||||
It does not delete (free) it, but does everything else to finalize it.
|
||||
It matches the streambuf::~streambuf virtual destructor. */
|
||||
typedef void (*_IO_finish_t) __PMT ((_IO_FILE *, int)); /* finalize */
|
||||
#define _IO_FINISH(FP) JUMP1 (__finish, FP, 0)
|
||||
#define _IO_WFINISH(FP) WJUMP1 (__finish, FP, 0)
|
||||
|
||||
/* The 'overflow' hook flushes the buffer.
|
||||
The second argument is a character, or EOF.
|
||||
It matches the streambuf::overflow virtual function. */
|
||||
typedef int (*_IO_overflow_t) __PMT ((_IO_FILE *, int));
|
||||
#define _IO_OVERFLOW(FP, CH) JUMP1 (__overflow, FP, CH)
|
||||
#define _IO_WOVERFLOW(FP, CH) WJUMP1 (__overflow, FP, CH)
|
||||
|
||||
/* The 'underflow' hook tries to fills the get buffer.
|
||||
It returns the next character (as an unsigned char) or EOF. The next
|
||||
character remains in the get buffer, and the get position is not changed.
|
||||
It matches the streambuf::underflow virtual function. */
|
||||
typedef int (*_IO_underflow_t) __PMT ((_IO_FILE *));
|
||||
#define _IO_UNDERFLOW(FP) JUMP0 (__underflow, FP)
|
||||
#define _IO_WUNDERFLOW(FP) WJUMP0 (__underflow, FP)
|
||||
|
||||
/* The 'uflow' hook returns the next character in the input stream
|
||||
(cast to unsigned char), and increments the read position;
|
||||
EOF is returned on failure.
|
||||
It matches the streambuf::uflow virtual function, which is not in the
|
||||
cfront implementation, but was added to C++ by the ANSI/ISO committee. */
|
||||
#define _IO_UFLOW(FP) JUMP0 (__uflow, FP)
|
||||
#define _IO_WUFLOW(FP) WJUMP0 (__uflow, FP)
|
||||
|
||||
/* The 'pbackfail' hook handles backing up.
|
||||
It matches the streambuf::pbackfail virtual function. */
|
||||
typedef int (*_IO_pbackfail_t) __PMT ((_IO_FILE *, int));
|
||||
#define _IO_PBACKFAIL(FP, CH) JUMP1 (__pbackfail, FP, CH)
|
||||
#define _IO_WPBACKFAIL(FP, CH) WJUMP1 (__pbackfail, FP, CH)
|
||||
|
||||
/* The 'xsputn' hook writes upto N characters from buffer DATA.
|
||||
Returns the number of character actually written.
|
||||
It matches the streambuf::xsputn virtual function. */
|
||||
typedef _IO_size_t (*_IO_xsputn_t) __PMT ((_IO_FILE *FP, const void *DATA,
|
||||
_IO_size_t N));
|
||||
#define _IO_XSPUTN(FP, DATA, N) JUMP2 (__xsputn, FP, DATA, N)
|
||||
#define _IO_WXSPUTN(FP, DATA, N) WJUMP2 (__xsputn, FP, DATA, N)
|
||||
|
||||
/* The 'xsgetn' hook reads upto N characters into buffer DATA.
|
||||
Returns the number of character actually read.
|
||||
It matches the streambuf::xsgetn virtual function. */
|
||||
typedef _IO_size_t (*_IO_xsgetn_t) __PMT ((_IO_FILE *FP, void *DATA,
|
||||
_IO_size_t N));
|
||||
#define _IO_XSGETN(FP, DATA, N) JUMP2 (__xsgetn, FP, DATA, N)
|
||||
#define _IO_WXSGETN(FP, DATA, N) WJUMP2 (__xsgetn, FP, DATA, N)
|
||||
|
||||
/* The 'seekoff' hook moves the stream position to a new position
|
||||
relative to the start of the file (if DIR==0), the current position
|
||||
(MODE==1), or the end of the file (MODE==2).
|
||||
It matches the streambuf::seekoff virtual function.
|
||||
It is also used for the ANSI fseek function. */
|
||||
typedef _IO_off64_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off64_t OFF,
|
||||
int DIR, int MODE));
|
||||
#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3 (__seekoff, FP, OFF, DIR, MODE)
|
||||
#define _IO_WSEEKOFF(FP, OFF, DIR, MODE) WJUMP3 (__seekoff, FP, OFF, DIR, MODE)
|
||||
|
||||
/* The 'seekpos' hook also moves the stream position,
|
||||
but to an absolute position given by a fpos64_t (seekpos).
|
||||
It matches the streambuf::seekpos virtual function.
|
||||
It is also used for the ANSI fgetpos and fsetpos functions. */
|
||||
/* The _IO_seek_cur and _IO_seek_end options are not allowed. */
|
||||
typedef _IO_off64_t (*_IO_seekpos_t) __PMT ((_IO_FILE *, _IO_off64_t, int));
|
||||
#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2 (__seekpos, FP, POS, FLAGS)
|
||||
#define _IO_WSEEKPOS(FP, POS, FLAGS) WJUMP2 (__seekpos, FP, POS, FLAGS)
|
||||
|
||||
/* The 'setbuf' hook gives a buffer to the file.
|
||||
It matches the streambuf::setbuf virtual function. */
|
||||
typedef _IO_FILE* (*_IO_setbuf_t) __PMT ((_IO_FILE *, char *, _IO_ssize_t));
|
||||
#define _IO_SETBUF(FP, BUFFER, LENGTH) JUMP2 (__setbuf, FP, BUFFER, LENGTH)
|
||||
#define _IO_WSETBUF(FP, BUFFER, LENGTH) WJUMP2 (__setbuf, FP, BUFFER, LENGTH)
|
||||
|
||||
/* The 'sync' hook attempts to synchronize the internal data structures
|
||||
of the file with the external state.
|
||||
It matches the streambuf::sync virtual function. */
|
||||
typedef int (*_IO_sync_t) __PMT ((_IO_FILE *));
|
||||
#define _IO_SYNC(FP) JUMP0 (__sync, FP)
|
||||
#define _IO_WSYNC(FP) WJUMP0 (__sync, FP)
|
||||
|
||||
/* The 'doallocate' hook is used to tell the file to allocate a buffer.
|
||||
It matches the streambuf::doallocate virtual function, which is not
|
||||
in the ANSI/ISO C++ standard, but is part traditional implementations. */
|
||||
typedef int (*_IO_doallocate_t) __PMT ((_IO_FILE *));
|
||||
#define _IO_DOALLOCATE(FP) JUMP0 (__doallocate, FP)
|
||||
#define _IO_WDOALLOCATE(FP) WJUMP0 (__doallocate, FP)
|
||||
|
||||
/* The following four hooks (sysread, syswrite, sysclose, sysseek, and
|
||||
sysstat) are low-level hooks specific to this implementation.
|
||||
There is no correspondence in the ANSI/ISO C++ standard library.
|
||||
The hooks basically correspond to the Unix system functions
|
||||
(read, write, close, lseek, and stat) except that a _IO_FILE*
|
||||
parameter is used instead of a integer file descriptor; the default
|
||||
implementation used for normal files just calls those functions.
|
||||
The advantage of overriding these functions instead of the higher-level
|
||||
ones (underflow, overflow etc) is that you can leave all the buffering
|
||||
higher-level functions. */
|
||||
|
||||
/* The 'sysread' hook is used to read data from the external file into
|
||||
an existing buffer. It generalizes the Unix read(2) function.
|
||||
It matches the streambuf::sys_read virtual function, which is
|
||||
specific to this implementation. */
|
||||
typedef _IO_ssize_t (*_IO_read_t) __PMT ((_IO_FILE *, void *, _IO_ssize_t));
|
||||
#define _IO_SYSREAD(FP, DATA, LEN) JUMP2 (__read, FP, DATA, LEN)
|
||||
#define _IO_WSYSREAD(FP, DATA, LEN) WJUMP2 (__read, FP, DATA, LEN)
|
||||
|
||||
/* The 'syswrite' hook is used to write data from an existing buffer
|
||||
to an external file. It generalizes the Unix write(2) function.
|
||||
It matches the streambuf::sys_write virtual function, which is
|
||||
specific to this implementation. */
|
||||
typedef _IO_ssize_t (*_IO_write_t) __PMT ((_IO_FILE *, const void *,
|
||||
_IO_ssize_t));
|
||||
#define _IO_SYSWRITE(FP, DATA, LEN) JUMP2 (__write, FP, DATA, LEN)
|
||||
#define _IO_WSYSWRITE(FP, DATA, LEN) WJUMP2 (__write, FP, DATA, LEN)
|
||||
|
||||
/* The 'sysseek' hook is used to re-position an external file.
|
||||
It generalizes the Unix lseek(2) function.
|
||||
It matches the streambuf::sys_seek virtual function, which is
|
||||
specific to this implementation. */
|
||||
typedef _IO_off64_t (*_IO_seek_t) __PMT ((_IO_FILE *, _IO_off64_t, int));
|
||||
#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2 (__seek, FP, OFFSET, MODE)
|
||||
#define _IO_WSYSSEEK(FP, OFFSET, MODE) WJUMP2 (__seek, FP, OFFSET, MODE)
|
||||
|
||||
/* The 'sysclose' hook is used to finalize (close, finish up) an
|
||||
external file. It generalizes the Unix close(2) function.
|
||||
It matches the streambuf::sys_close virtual function, which is
|
||||
specific to this implementation. */
|
||||
typedef int (*_IO_close_t) __PMT ((_IO_FILE *)); /* finalize */
|
||||
#define _IO_SYSCLOSE(FP) JUMP0 (__close, FP)
|
||||
#define _IO_WSYSCLOSE(FP) WJUMP0 (__close, FP)
|
||||
|
||||
/* The 'sysstat' hook is used to get information about an external file
|
||||
into a struct stat buffer. It generalizes the Unix fstat(2) call.
|
||||
It matches the streambuf::sys_stat virtual function, which is
|
||||
specific to this implementation. */
|
||||
typedef int (*_IO_stat_t) __PMT ((_IO_FILE *, void *));
|
||||
#define _IO_SYSSTAT(FP, BUF) JUMP1 (__stat, FP, BUF)
|
||||
#define _IO_WSYSSTAT(FP, BUF) WJUMP1 (__stat, FP, BUF)
|
||||
|
||||
/* The 'showmany' hook can be used to get an image how much input is
|
||||
available. In many cases the answer will be 0 which means unknown
|
||||
but some cases one can provide real information. */
|
||||
typedef int (*_IO_showmanyc_t) __PMT ((_IO_FILE *));
|
||||
#define _IO_SHOWMANYC(FP) JUMP0 (__showmanyc, FP)
|
||||
#define _IO_WSHOWMANYC(FP) WJUMP0 (__showmanyc, FP)
|
||||
|
||||
/* The 'imbue' hook is used to get information about the currently
|
||||
installed locales. */
|
||||
typedef void (*_IO_imbue_t) __PMT ((_IO_FILE *, void *));
|
||||
#define _IO_IMBUE(FP, LOCALE) JUMP1 (__imbue, FP, LOCALE)
|
||||
#define _IO_WIMBUE(FP, LOCALE) WJUMP1 (__imbue, FP, LOCALE)
|
||||
|
||||
|
||||
#define _IO_CHAR_TYPE char /* unsigned char ? */
|
||||
#define _IO_INT_TYPE int
|
||||
|
||||
struct _IO_jump_t
|
||||
{
|
||||
JUMP_FIELD(_G_size_t, __dummy);
|
||||
#if _G_USING_THUNKS
|
||||
JUMP_FIELD(_G_size_t, __dummy2);
|
||||
#endif
|
||||
JUMP_FIELD(_IO_finish_t, __finish);
|
||||
JUMP_FIELD(_IO_overflow_t, __overflow);
|
||||
JUMP_FIELD(_IO_underflow_t, __underflow);
|
||||
JUMP_FIELD(_IO_underflow_t, __uflow);
|
||||
JUMP_FIELD(_IO_pbackfail_t, __pbackfail);
|
||||
/* showmany */
|
||||
JUMP_FIELD(_IO_xsputn_t, __xsputn);
|
||||
JUMP_FIELD(_IO_xsgetn_t, __xsgetn);
|
||||
JUMP_FIELD(_IO_seekoff_t, __seekoff);
|
||||
JUMP_FIELD(_IO_seekpos_t, __seekpos);
|
||||
JUMP_FIELD(_IO_setbuf_t, __setbuf);
|
||||
JUMP_FIELD(_IO_sync_t, __sync);
|
||||
JUMP_FIELD(_IO_doallocate_t, __doallocate);
|
||||
JUMP_FIELD(_IO_read_t, __read);
|
||||
JUMP_FIELD(_IO_write_t, __write);
|
||||
JUMP_FIELD(_IO_seek_t, __seek);
|
||||
JUMP_FIELD(_IO_close_t, __close);
|
||||
JUMP_FIELD(_IO_stat_t, __stat);
|
||||
JUMP_FIELD(_IO_showmanyc_t, __showmanyc);
|
||||
JUMP_FIELD(_IO_imbue_t, __imbue);
|
||||
#if 0
|
||||
get_column;
|
||||
set_column;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* We always allocate an extra word following an _IO_FILE.
|
||||
This contains a pointer to the function jump table used.
|
||||
This is for compatibility with C++ streambuf; the word can
|
||||
be used to smash to a pointer to a virtual function table. */
|
||||
|
||||
struct _IO_FILE_plus
|
||||
{
|
||||
_IO_FILE file;
|
||||
const struct _IO_jump_t *vtable;
|
||||
};
|
||||
|
||||
/* Special file type for fopencookie function. */
|
||||
struct _IO_cookie_file
|
||||
{
|
||||
struct _IO_FILE_plus __fp;
|
||||
void *__cookie;
|
||||
_IO_cookie_io_functions_t __io_functions;
|
||||
};
|
||||
|
||||
/* Iterator type for walking global linked list of _IO_FILE objects. */
|
||||
|
||||
typedef struct _IO_FILE *_IO_ITER;
|
||||
|
||||
/* Generic functions */
|
||||
|
||||
extern void _IO_switch_to_main_get_area __P ((_IO_FILE *));
|
||||
extern void _IO_switch_to_backup_area __P ((_IO_FILE *));
|
||||
extern int _IO_switch_to_get_mode __P ((_IO_FILE *));
|
||||
extern void _IO_init __P ((_IO_FILE *, int));
|
||||
extern int _IO_sputbackc __P ((_IO_FILE *, int));
|
||||
extern int _IO_sungetc __P ((_IO_FILE *));
|
||||
extern void _IO_un_link __P ((struct _IO_FILE_plus *));
|
||||
extern void _IO_link_in __P ((struct _IO_FILE_plus *));
|
||||
extern void _IO_doallocbuf __P ((_IO_FILE *));
|
||||
extern void _IO_unsave_markers __P ((_IO_FILE *));
|
||||
extern void _IO_setb __P ((_IO_FILE *, char *, char *, int));
|
||||
extern unsigned _IO_adjust_column __P ((unsigned, const char *, int));
|
||||
#define _IO_sputn(__fp, __s, __n) _IO_XSPUTN (__fp, __s, __n)
|
||||
|
||||
extern void _IO_switch_to_main_wget_area __P ((_IO_FILE *));
|
||||
extern void _IO_switch_to_wbackup_area __P ((_IO_FILE *));
|
||||
extern int _IO_switch_to_wget_mode __P ((_IO_FILE *));
|
||||
extern void _IO_wsetb __P ((_IO_FILE *, wchar_t *, wchar_t *, int));
|
||||
extern wint_t _IO_sputbackwc __P ((_IO_FILE *, wint_t));
|
||||
extern wint_t _IO_sungetwc __P ((_IO_FILE *));
|
||||
extern void _IO_wdoallocbuf __P ((_IO_FILE *));
|
||||
extern void _IO_unsave_wmarkers __P ((_IO_FILE *));
|
||||
extern unsigned _IO_adjust_wcolumn __P ((unsigned, const wchar_t *, int));
|
||||
|
||||
/* Marker-related function. */
|
||||
|
||||
extern void _IO_init_marker __P ((struct _IO_marker *, _IO_FILE *));
|
||||
extern void _IO_init_wmarker __P ((struct _IO_marker *, _IO_FILE *));
|
||||
extern void _IO_remove_marker __P ((struct _IO_marker *));
|
||||
extern int _IO_marker_difference __P ((struct _IO_marker *,
|
||||
struct _IO_marker *));
|
||||
extern int _IO_marker_delta __P ((struct _IO_marker *));
|
||||
extern int _IO_wmarker_delta __P ((struct _IO_marker *));
|
||||
extern int _IO_seekmark __P ((_IO_FILE *, struct _IO_marker *, int));
|
||||
extern int _IO_seekwmark __P ((_IO_FILE *, struct _IO_marker *, int));
|
||||
|
||||
/* Functions for iterating global list and dealing with
|
||||
its lock */
|
||||
|
||||
extern _IO_ITER _IO_iter_begin __P ((void));
|
||||
extern _IO_ITER _IO_iter_end __P ((void));
|
||||
extern _IO_ITER _IO_iter_next __P ((_IO_ITER));
|
||||
extern _IO_FILE *_IO_iter_file __P ((_IO_ITER));
|
||||
extern void _IO_list_lock __P ((void));
|
||||
extern void _IO_list_unlock __P ((void));
|
||||
extern void _IO_list_resetlock __P ((void));
|
||||
|
||||
/* Default jumptable functions. */
|
||||
|
||||
extern int _IO_default_underflow __P ((_IO_FILE *));
|
||||
extern int _IO_default_uflow __P ((_IO_FILE *));
|
||||
extern wint_t _IO_wdefault_uflow __P ((_IO_FILE *));
|
||||
extern int _IO_default_doallocate __P ((_IO_FILE *));
|
||||
extern int _IO_wdefault_doallocate __P ((_IO_FILE *));
|
||||
extern void _IO_default_finish __P ((_IO_FILE *, int));
|
||||
extern void _IO_wdefault_finish __P ((_IO_FILE *, int));
|
||||
extern int _IO_default_pbackfail __P ((_IO_FILE *, int));
|
||||
extern wint_t _IO_wdefault_pbackfail __P ((_IO_FILE *, wint_t));
|
||||
extern _IO_FILE* _IO_default_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
|
||||
extern _IO_FILE* _IO_wdefault_setbuf __P ((_IO_FILE *, wchar_t *,
|
||||
_IO_ssize_t));
|
||||
extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *,
|
||||
_IO_size_t));
|
||||
extern _IO_size_t _IO_wdefault_xsputn __P ((_IO_FILE *, const void *,
|
||||
_IO_size_t));
|
||||
extern _IO_size_t _IO_default_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
|
||||
extern _IO_size_t _IO_wdefault_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
|
||||
extern _IO_off64_t _IO_default_seekoff __P ((_IO_FILE *,
|
||||
_IO_off64_t, int, int));
|
||||
extern _IO_off64_t _IO_default_seekpos __P ((_IO_FILE *, _IO_off64_t, int));
|
||||
extern _IO_ssize_t _IO_default_write __P ((_IO_FILE *, const void *,
|
||||
_IO_ssize_t));
|
||||
extern _IO_ssize_t _IO_default_read __P ((_IO_FILE *, void *, _IO_ssize_t));
|
||||
extern int _IO_default_stat __P ((_IO_FILE *, void *));
|
||||
extern _IO_off64_t _IO_default_seek __P ((_IO_FILE *, _IO_off64_t, int));
|
||||
extern int _IO_default_sync __P ((_IO_FILE *));
|
||||
#define _IO_default_close ((_IO_close_t) _IO_default_sync)
|
||||
extern int _IO_default_showmanyc __P ((_IO_FILE *));
|
||||
extern void _IO_default_imbue __P ((_IO_FILE *, void *));
|
||||
|
||||
extern struct _IO_jump_t _IO_file_jumps;
|
||||
extern struct _IO_jump_t _IO_wfile_jumps;
|
||||
extern struct _IO_jump_t _IO_old_file_jumps;
|
||||
extern struct _IO_jump_t _IO_streambuf_jumps;
|
||||
extern struct _IO_jump_t _IO_proc_jumps;
|
||||
extern struct _IO_jump_t _IO_old_proc_jumps;
|
||||
extern struct _IO_jump_t _IO_str_jumps;
|
||||
extern struct _IO_jump_t _IO_wstr_jumps;
|
||||
extern struct _IO_codecvt __libio_codecvt;
|
||||
extern int _IO_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
|
||||
extern int _IO_new_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
|
||||
extern int _IO_old_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
|
||||
extern int _IO_wdo_write __P ((_IO_FILE *, const wchar_t *, _IO_size_t));
|
||||
extern int _IO_flush_all __P ((void));
|
||||
extern int _IO_cleanup __P ((void));
|
||||
extern void _IO_flush_all_linebuffered __P ((void));
|
||||
extern int _IO_new_fgetpos __P ((_IO_FILE *, _IO_fpos_t *));
|
||||
extern int _IO_old_fgetpos __P ((_IO_FILE *, _IO_fpos_t *));
|
||||
extern int _IO_new_fsetpos __P ((_IO_FILE *, const _IO_fpos_t *));
|
||||
extern int _IO_old_fsetpos __P ((_IO_FILE *, const _IO_fpos_t *));
|
||||
extern int _IO_new_fgetpos64 __P ((_IO_FILE *, _IO_fpos64_t *));
|
||||
extern int _IO_old_fgetpos64 __P ((_IO_FILE *, _IO_fpos64_t *));
|
||||
extern int _IO_new_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
|
||||
extern int _IO_old_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
|
||||
|
||||
|
||||
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
# define _IO_do_flush(_f) \
|
||||
((_f)->_mode <= 0 \
|
||||
? _IO_do_write(_f, (_f)->_IO_write_base, \
|
||||
(_f)->_IO_write_ptr-(_f)->_IO_write_base) \
|
||||
: _IO_wdo_write(_f, (_f)->_wide_data->_IO_write_base, \
|
||||
((_f)->_wide_data->_IO_write_ptr \
|
||||
- (_f)->_wide_data->_IO_write_base)))
|
||||
#else
|
||||
# define _IO_do_flush(_f) \
|
||||
_IO_do_write(_f, (_f)->_IO_write_base, \
|
||||
(_f)->_IO_write_ptr-(_f)->_IO_write_base)
|
||||
#endif
|
||||
#define _IO_old_do_flush(_f) \
|
||||
_IO_old_do_write(_f, (_f)->_IO_write_base, \
|
||||
(_f)->_IO_write_ptr-(_f)->_IO_write_base)
|
||||
#define _IO_in_put_mode(_fp) ((_fp)->_flags & _IO_CURRENTLY_PUTTING)
|
||||
#define _IO_mask_flags(fp, f, mask) \
|
||||
((fp)->_flags = ((fp)->_flags & ~(mask)) | ((f) & (mask)))
|
||||
#define _IO_setg(fp, eb, g, eg) ((fp)->_IO_read_base = (eb),\
|
||||
(fp)->_IO_read_ptr = (g), (fp)->_IO_read_end = (eg))
|
||||
#define _IO_wsetg(fp, eb, g, eg) ((fp)->_wide_data->_IO_read_base = (eb),\
|
||||
(fp)->_wide_data->_IO_read_ptr = (g), \
|
||||
(fp)->_wide_data->_IO_read_end = (eg))
|
||||
#define _IO_setp(__fp, __p, __ep) \
|
||||
((__fp)->_IO_write_base = (__fp)->_IO_write_ptr \
|
||||
= __p, (__fp)->_IO_write_end = (__ep))
|
||||
#define _IO_wsetp(__fp, __p, __ep) \
|
||||
((__fp)->_wide_data->_IO_write_base \
|
||||
= (__fp)->_wide_data->_IO_write_ptr = __p, \
|
||||
(__fp)->_wide_data->_IO_write_end = (__ep))
|
||||
#define _IO_have_backup(fp) ((fp)->_IO_save_base != NULL)
|
||||
#define _IO_have_wbackup(fp) ((fp)->_wide_data->_IO_save_base != NULL)
|
||||
#define _IO_in_backup(fp) ((fp)->_flags & _IO_IN_BACKUP)
|
||||
#define _IO_have_markers(fp) ((fp)->_markers != NULL)
|
||||
#define _IO_blen(fp) ((fp)->_IO_buf_end - (fp)->_IO_buf_base)
|
||||
#define _IO_wblen(fp) ((fp)->_wide_data->_IO_buf_end \
|
||||
- (fp)->_wide_data->_IO_buf_base)
|
||||
|
||||
/* Jumptable functions for files. */
|
||||
|
||||
extern int _IO_file_doallocate __P ((_IO_FILE *));
|
||||
extern _IO_FILE* _IO_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
|
||||
extern _IO_off64_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern _IO_size_t _IO_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
|
||||
extern _IO_size_t _IO_file_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
|
||||
extern int _IO_file_stat __P ((_IO_FILE *, void *));
|
||||
extern int _IO_file_close __P ((_IO_FILE *));
|
||||
extern int _IO_file_underflow __P ((_IO_FILE *));
|
||||
extern int _IO_file_overflow __P ((_IO_FILE *, int));
|
||||
#define _IO_file_is_open(__fp) ((__fp)->_fileno != -1)
|
||||
extern void _IO_file_init __P ((struct _IO_FILE_plus *));
|
||||
extern _IO_FILE* _IO_file_attach __P ((_IO_FILE *, int));
|
||||
extern _IO_FILE* _IO_file_open __P ((_IO_FILE *, const char *, int, int,
|
||||
int, int));
|
||||
extern _IO_FILE* _IO_file_fopen __P ((_IO_FILE *, const char *, const char *,
|
||||
int));
|
||||
extern _IO_ssize_t _IO_file_write __P ((_IO_FILE *, const void *,
|
||||
_IO_ssize_t));
|
||||
extern _IO_ssize_t _IO_file_read __P ((_IO_FILE *, void *, _IO_ssize_t));
|
||||
extern int _IO_file_sync __P ((_IO_FILE *));
|
||||
extern int _IO_file_close_it __P ((_IO_FILE *));
|
||||
extern _IO_off64_t _IO_file_seek __P ((_IO_FILE *, _IO_off64_t, int));
|
||||
extern void _IO_file_finish __P ((_IO_FILE *, int));
|
||||
|
||||
extern _IO_FILE* _IO_new_file_attach __P ((_IO_FILE *, int));
|
||||
extern int _IO_new_file_close_it __P ((_IO_FILE *));
|
||||
extern void _IO_new_file_finish __P ((_IO_FILE *, int));
|
||||
extern _IO_FILE* _IO_new_file_fopen __P ((_IO_FILE *, const char *, const char *,
|
||||
int));
|
||||
extern void _IO_no_init __P ((_IO_FILE *, int, int, struct _IO_wide_data *,
|
||||
struct _IO_jump_t *));
|
||||
extern void _IO_new_file_init __P ((struct _IO_FILE_plus *));
|
||||
extern _IO_FILE* _IO_new_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
|
||||
extern int _IO_new_file_sync __P ((_IO_FILE *));
|
||||
extern int _IO_new_file_underflow __P ((_IO_FILE *));
|
||||
extern int _IO_new_file_overflow __P ((_IO_FILE *, int));
|
||||
extern _IO_off64_t _IO_new_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern _IO_ssize_t _IO_new_file_write __P ((_IO_FILE *, const void *,
|
||||
_IO_ssize_t));
|
||||
extern _IO_size_t _IO_new_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
|
||||
|
||||
extern _IO_FILE* _IO_old_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
|
||||
extern _IO_off64_t _IO_old_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int,
|
||||
int));
|
||||
extern _IO_size_t _IO_old_file_xsputn __P ((_IO_FILE *, const void *,
|
||||
_IO_size_t));
|
||||
extern int _IO_old_file_underflow __P ((_IO_FILE *));
|
||||
extern int _IO_old_file_overflow __P ((_IO_FILE *, int));
|
||||
extern void _IO_old_file_init __P ((struct _IO_FILE_plus *));
|
||||
extern _IO_FILE* _IO_old_file_attach __P ((_IO_FILE *, int));
|
||||
extern _IO_FILE* _IO_old_file_fopen __P ((_IO_FILE *, const char *,
|
||||
const char *));
|
||||
extern _IO_ssize_t _IO_old_file_write __P ((_IO_FILE *, const void *,
|
||||
_IO_ssize_t));
|
||||
extern int _IO_old_file_sync __P ((_IO_FILE *));
|
||||
extern int _IO_old_file_close_it __P ((_IO_FILE *));
|
||||
extern void _IO_old_file_finish __P ((_IO_FILE *, int));
|
||||
|
||||
extern int _IO_wfile_doallocate __P ((_IO_FILE *));
|
||||
extern _IO_size_t _IO_wfile_xsputn __P ((_IO_FILE *, const void *,
|
||||
_IO_size_t));
|
||||
extern _IO_FILE* _IO_wfile_setbuf __P ((_IO_FILE *, wchar_t *, _IO_ssize_t));
|
||||
extern wint_t _IO_wfile_sync __P ((_IO_FILE *));
|
||||
extern wint_t _IO_wfile_underflow __P ((_IO_FILE *));
|
||||
extern wint_t _IO_wfile_overflow __P ((_IO_FILE *, wint_t));
|
||||
extern _IO_off64_t _IO_wfile_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
|
||||
/* Jumptable functions for proc_files. */
|
||||
extern _IO_FILE* _IO_proc_open __P ((_IO_FILE *, const char *, const char *));
|
||||
extern _IO_FILE* _IO_new_proc_open __P ((_IO_FILE *, const char *, const char *));
|
||||
extern _IO_FILE* _IO_old_proc_open __P ((_IO_FILE *, const char *, const char *));
|
||||
extern int _IO_proc_close __P ((_IO_FILE *));
|
||||
extern int _IO_new_proc_close __P ((_IO_FILE *));
|
||||
extern int _IO_old_proc_close __P ((_IO_FILE *));
|
||||
|
||||
/* Jumptable functions for strfiles. */
|
||||
extern int _IO_str_underflow __P ((_IO_FILE *));
|
||||
extern int _IO_str_overflow __P ((_IO_FILE *, int));
|
||||
extern int _IO_str_pbackfail __P ((_IO_FILE *, int));
|
||||
extern _IO_off64_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern void _IO_str_finish __P ((_IO_FILE *, int));
|
||||
|
||||
/* Other strfile functions */
|
||||
struct _IO_strfile_;
|
||||
extern void _IO_str_init_static __P ((struct _IO_strfile_ *, char *, int, char *));
|
||||
extern void _IO_str_init_readonly __P ((struct _IO_strfile_ *, const char *, int));
|
||||
extern _IO_ssize_t _IO_str_count __P ((_IO_FILE *));
|
||||
|
||||
/* And the wide character versions. */
|
||||
extern void _IO_wstr_init_static __P ((_IO_FILE *, wchar_t *, int, wchar_t *));
|
||||
extern void _IO_wstr_init_readonly __P ((_IO_FILE *, const char *, int));
|
||||
extern _IO_ssize_t _IO_wstr_count __P ((_IO_FILE *));
|
||||
extern _IO_wint_t _IO_wstr_overflow __P ((_IO_FILE *, _IO_wint_t));
|
||||
extern _IO_wint_t _IO_wstr_underflow __P ((_IO_FILE *));
|
||||
extern _IO_off64_t _IO_wstr_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern _IO_wint_t _IO_wstr_pbackfail __P ((_IO_FILE *, _IO_wint_t));
|
||||
extern void _IO_wstr_finish __P ((_IO_FILE *, int));
|
||||
|
||||
extern int _IO_vasprintf __P ((char **result_ptr, __const char *format,
|
||||
_IO_va_list args));
|
||||
extern int _IO_vdprintf __P ((int d, __const char *format, _IO_va_list arg));
|
||||
extern int _IO_vsnprintf __P ((char *string, _IO_size_t maxlen,
|
||||
__const char *format, _IO_va_list args));
|
||||
|
||||
|
||||
extern _IO_size_t _IO_getline __P ((_IO_FILE *,char *, _IO_size_t, int, int));
|
||||
extern _IO_size_t _IO_getline_info __P ((_IO_FILE *,char *, _IO_size_t,
|
||||
int, int, int *));
|
||||
extern _IO_ssize_t _IO_getdelim __P ((char **, _IO_size_t *, int, _IO_FILE *));
|
||||
extern _IO_size_t _IO_getwline __P ((_IO_FILE *,wchar_t *, _IO_size_t, wint_t,
|
||||
int));
|
||||
extern _IO_size_t _IO_getwline_info __P ((_IO_FILE *,wchar_t *, _IO_size_t,
|
||||
wint_t, int, wint_t *));
|
||||
extern double _IO_strtod __P ((const char *, char **));
|
||||
extern char *_IO_dtoa __P ((double __d, int __mode, int __ndigits,
|
||||
int *__decpt, int *__sign, char **__rve));
|
||||
extern int _IO_outfloat __P ((double __value, _IO_FILE *__sb, int __type,
|
||||
int __width, int __precision, int __flags,
|
||||
int __sign_mode, int __fill));
|
||||
|
||||
extern struct _IO_FILE_plus *_IO_list_all;
|
||||
extern void (*_IO_cleanup_registration_needed) __PMT ((void));
|
||||
|
||||
#ifndef EOF
|
||||
# define EOF (-1)
|
||||
#endif
|
||||
#ifndef NULL
|
||||
# if defined __GNUG__ && \
|
||||
(__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
|
||||
# define NULL (__null)
|
||||
# else
|
||||
# if !defined(__cplusplus)
|
||||
# define NULL ((void*)0)
|
||||
# else
|
||||
# define NULL (0)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if _G_HAVE_MMAP
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# include <sys/mman.h>
|
||||
# include <sys/param.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
|
||||
# define MAP_ANONYMOUS MAP_ANON
|
||||
# endif
|
||||
|
||||
# if !defined(MAP_ANONYMOUS) || !defined(EXEC_PAGESIZE)
|
||||
# undef _G_HAVE_MMAP
|
||||
# define _G_HAVE_MMAP 0
|
||||
# endif
|
||||
|
||||
#endif /* _G_HAVE_MMAP */
|
||||
|
||||
#if _G_HAVE_MMAP
|
||||
|
||||
# ifdef _LIBC
|
||||
/* When using this code in the GNU libc we must not pollute the name space. */
|
||||
# define mmap __mmap
|
||||
# define munmap __munmap
|
||||
# define ftruncate __ftruncate
|
||||
# endif
|
||||
|
||||
# define ROUND_TO_PAGE(_S) \
|
||||
(((_S) + EXEC_PAGESIZE - 1) & ~(EXEC_PAGESIZE - 1))
|
||||
|
||||
# define FREE_BUF(_B, _S) \
|
||||
munmap ((_B), ROUND_TO_PAGE (_S))
|
||||
# define ALLOC_BUF(_B, _S, _R) \
|
||||
do { \
|
||||
(_B) = (char *) mmap (0, ROUND_TO_PAGE (_S), \
|
||||
PROT_READ | PROT_WRITE, \
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
|
||||
if ((_B) == (char *) MAP_FAILED) \
|
||||
return (_R); \
|
||||
} while (0)
|
||||
# define ALLOC_WBUF(_B, _S, _R) \
|
||||
do { \
|
||||
(_B) = (wchar_t *) mmap (0, ROUND_TO_PAGE (_S), \
|
||||
PROT_READ | PROT_WRITE, \
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
|
||||
if ((_B) == (wchar_t *) MAP_FAILED) \
|
||||
return (_R); \
|
||||
} while (0)
|
||||
|
||||
#else /* _G_HAVE_MMAP */
|
||||
|
||||
# define FREE_BUF(_B, _S) \
|
||||
free(_B)
|
||||
# define ALLOC_BUF(_B, _S, _R) \
|
||||
do { \
|
||||
(_B) = (char*)malloc(_S); \
|
||||
if ((_B) == NULL) \
|
||||
return (_R); \
|
||||
} while (0)
|
||||
# define ALLOC_WBUF(_B, _S, _R) \
|
||||
do { \
|
||||
(_B) = (wchar_t *)malloc(_S); \
|
||||
if ((_B) == NULL) \
|
||||
return (_R); \
|
||||
} while (0)
|
||||
|
||||
#endif /* _G_HAVE_MMAP */
|
||||
|
||||
#ifndef OS_FSTAT
|
||||
# define OS_FSTAT fstat
|
||||
#endif
|
||||
struct stat;
|
||||
extern _IO_ssize_t _IO_read __P ((int, void *, _IO_size_t));
|
||||
extern _IO_ssize_t _IO_write __P ((int, const void *, _IO_size_t));
|
||||
extern _IO_off64_t _IO_lseek __P ((int, _IO_off64_t, int));
|
||||
extern int _IO_close __P ((int));
|
||||
extern int _IO_fstat __P ((int, struct stat *));
|
||||
extern int _IO_vscanf __P ((const char *, _IO_va_list));
|
||||
|
||||
/* _IO_pos_BAD is an _IO_off64_t value indicating error, unknown, or EOF. */
|
||||
#ifndef _IO_pos_BAD
|
||||
# define _IO_pos_BAD ((_IO_off64_t) -1)
|
||||
#endif
|
||||
/* _IO_pos_adjust adjust an _IO_off64_t by some number of bytes. */
|
||||
#ifndef _IO_pos_adjust
|
||||
# define _IO_pos_adjust(pos, delta) ((pos) += (delta))
|
||||
#endif
|
||||
/* _IO_pos_0 is an _IO_off64_t value indicating beginning of file. */
|
||||
#ifndef _IO_pos_0
|
||||
# define _IO_pos_0 ((_IO_off64_t) 0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
/* check following! */
|
||||
# ifdef _IO_USE_OLD_IO_FILE
|
||||
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
|
||||
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
|
||||
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
|
||||
# else
|
||||
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
|
||||
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
|
||||
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
|
||||
NULL, WDP, 0 }
|
||||
# else
|
||||
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
|
||||
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
|
||||
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
|
||||
0 }
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# ifdef _IO_USE_OLD_IO_FILE
|
||||
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
|
||||
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
|
||||
0, _IO_pos_BAD }
|
||||
# else
|
||||
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
|
||||
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
|
||||
0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
|
||||
NULL, WDP, 0 }
|
||||
# else
|
||||
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
|
||||
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
|
||||
0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
|
||||
0 }
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* VTABLE_LABEL defines NAME as of the CLASS class.
|
||||
CNLENGTH is strlen(#CLASS). */
|
||||
#ifdef __GNUC__
|
||||
# if _G_VTABLE_LABEL_HAS_LENGTH
|
||||
# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
|
||||
extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CNLENGTH #CLASS);
|
||||
# else
|
||||
# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
|
||||
extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CLASS);
|
||||
# endif
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#if !defined(builtinbuf_vtable) && defined(__cplusplus)
|
||||
# ifdef __GNUC__
|
||||
VTABLE_LABEL(builtinbuf_vtable, builtinbuf, 10)
|
||||
# else
|
||||
# if _G_VTABLE_LABEL_HAS_LENGTH
|
||||
# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##10builtinbuf
|
||||
# else
|
||||
# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##builtinbuf
|
||||
# endif
|
||||
# endif
|
||||
#endif /* !defined(builtinbuf_vtable) && defined(__cplusplus) */
|
||||
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
# define _IO_va_start(args, last) va_start(args, last)
|
||||
#else
|
||||
# define _IO_va_start(args, last) va_start(args)
|
||||
#endif
|
||||
|
||||
extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
|
||||
|
||||
#if 1
|
||||
# define COERCE_FILE(FILE) /* Nothing */
|
||||
#else
|
||||
/* This is part of the kludge for binary compatibility with old stdio. */
|
||||
# define COERCE_FILE(FILE) \
|
||||
(((FILE)->_IO_file_flags & _IO_MAGIC_MASK) == _OLD_MAGIC_MASK \
|
||||
&& (FILE) = *(FILE**)&((int*)fp)[1])
|
||||
#endif
|
||||
|
||||
#ifdef EINVAL
|
||||
# define MAYBE_SET_EINVAL __set_errno (EINVAL)
|
||||
#else
|
||||
# define MAYBE_SET_EINVAL /* nothing */
|
||||
#endif
|
||||
|
||||
#ifdef IO_DEBUG
|
||||
# define CHECK_FILE(FILE, RET) \
|
||||
if ((FILE) == NULL) { MAYBE_SET_EINVAL; return RET; } \
|
||||
else { COERCE_FILE(FILE); \
|
||||
if (((FILE)->_IO_file_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
|
||||
{ MAYBE_SET_EINVAL; return RET; }}
|
||||
#else
|
||||
# define CHECK_FILE(FILE, RET) COERCE_FILE (FILE)
|
||||
#endif
|
|
@ -1,71 +0,0 @@
|
|||
/* Copyright (C) 1993, 1994, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO 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, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not 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. */
|
||||
|
||||
|
||||
/* This file provides definitions of _IO_stdin, _IO_stdout, and _IO_stderr
|
||||
for C code. Compare stdstreams.cc.
|
||||
(The difference is that here the vtable field is set to 0,
|
||||
so the objects defined are not valid C++ objects. On the other
|
||||
hand, we don't need a C++ compiler to build this file.) */
|
||||
|
||||
#include "libioP.h"
|
||||
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
||||
static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
|
||||
static struct _IO_wide_data _IO_wide_data_##FD \
|
||||
= { ._wide_vtable = &_IO_wfile_jumps }; \
|
||||
struct _IO_FILE_plus NAME \
|
||||
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
|
||||
&_IO_file_jumps};
|
||||
# else
|
||||
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
||||
static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
|
||||
struct _IO_FILE_plus NAME \
|
||||
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
|
||||
&_IO_file_jumps};
|
||||
# endif
|
||||
#else
|
||||
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
||||
static struct _IO_wide_data _IO_wide_data_##FD \
|
||||
= { ._wide_vtable = &_IO_wfile_jumps }; \
|
||||
struct _IO_FILE_plus NAME \
|
||||
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
|
||||
&_IO_file_jumps};
|
||||
# else
|
||||
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
||||
struct _IO_FILE_plus NAME \
|
||||
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
|
||||
&_IO_file_jumps};
|
||||
# endif
|
||||
#endif
|
||||
|
||||
DEF_STDFILE(_IO_2_1_stdin_, 0, 0, _IO_NO_WRITES);
|
||||
DEF_STDFILE(_IO_2_1_stdout_, 1, &_IO_2_1_stdin_, _IO_NO_READS);
|
||||
DEF_STDFILE(_IO_2_1_stderr_, 2, &_IO_2_1_stdout_, _IO_NO_READS+_IO_UNBUFFERED);
|
||||
|
||||
struct _IO_FILE_plus *_IO_list_all = &_IO_2_1_stderr_;
|
|
@ -1,43 +0,0 @@
|
|||
/* Copyright (C) 1993, 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO 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, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not 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. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include "stdio.h"
|
||||
|
||||
#undef stdin
|
||||
#undef stdout
|
||||
#undef stderr
|
||||
_IO_FILE *stdin = (FILE *) &_IO_2_1_stdin_;
|
||||
_IO_FILE *stdout = (FILE *) &_IO_2_1_stdout_;
|
||||
_IO_FILE *stderr = (FILE *) &_IO_2_1_stderr_;
|
||||
|
||||
#undef _IO_stdin
|
||||
#undef _IO_stdout
|
||||
#undef _IO_stderr
|
||||
#ifdef _LIBC
|
||||
strong_alias (stdin, _IO_stdin);
|
||||
strong_alias (stdout, _IO_stdout);
|
||||
strong_alias (stderr, _IO_stderr);
|
||||
#endif
|
|
@ -1,108 +0,0 @@
|
|||
/* Copyright (C) 1993, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO 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, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not 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) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* Modified for GNU iostream by Per Bothner 1991, 1992. */
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
# define _POSIX_SOURCE
|
||||
#endif
|
||||
#include "libioP.h"
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef __STDC__
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# undef isatty
|
||||
# define isatty(Fd) __isatty (Fd)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allocate a file buffer, or switch to unbuffered I/O.
|
||||
* Per the ANSI C standard, ALL tty devices default to line buffered.
|
||||
*
|
||||
* As a side effect, we set __SOPT or __SNPT (en/dis-able fseek
|
||||
* optimisation) right after the _fstat() that finds the buffer size.
|
||||
*/
|
||||
|
||||
int
|
||||
_IO_wfile_doallocate (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
_IO_size_t size;
|
||||
int couldbetty;
|
||||
wchar_t *p;
|
||||
struct _G_stat64 st;
|
||||
|
||||
/* Allocate room for the external buffer. */
|
||||
if (fp->_IO_buf_base == NULL)
|
||||
_IO_file_doallocate (fp);
|
||||
|
||||
if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
|
||||
{
|
||||
couldbetty = 0;
|
||||
size = _IO_BUFSIZ;
|
||||
#if 0
|
||||
/* do not try to optimise fseek() */
|
||||
fp->_flags |= __SNPT;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
couldbetty = S_ISCHR (st.st_mode);
|
||||
#if _IO_HAVE_ST_BLKSIZE
|
||||
size = st.st_blksize <= 0 ? _IO_BUFSIZ : st.st_blksize;
|
||||
#else
|
||||
size = _IO_BUFSIZ;
|
||||
#endif
|
||||
}
|
||||
ALLOC_WBUF (p, size * sizeof (wchar_t), EOF);
|
||||
_IO_wsetb (fp, p, p + size, 1);
|
||||
if (couldbetty && isatty (fp->_fileno))
|
||||
fp->_flags |= _IO_LINE_BUF;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* _GLIBCPP_USE_WCHAR_T */
|
|
@ -1,754 +0,0 @@
|
|||
/* Copyright (C) 1993, 95, 97, 98, 99, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
Written by Ulrich Drepper <drepper@cygnus.com>.
|
||||
Based on the single byte version by Per Bothner <bothner@cygnus.com>.
|
||||
|
||||
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, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not 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. */
|
||||
|
||||
#include <assert.h>
|
||||
#include <libioP.h>
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
#include <wchar.h>
|
||||
#ifdef HAVE_GCONV_H
|
||||
# include <gconv.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifndef _LIBC
|
||||
# define _IO_new_do_write _IO_do_write
|
||||
# define _IO_new_file_attach _IO_file_attach
|
||||
# define _IO_new_file_close_it _IO_file_close_it
|
||||
# define _IO_new_file_finish _IO_file_finish
|
||||
# define _IO_new_file_fopen _IO_file_fopen
|
||||
# define _IO_new_file_init _IO_file_init
|
||||
# define _IO_new_file_setbuf _IO_file_setbuf
|
||||
# define _IO_new_file_sync _IO_file_sync
|
||||
# define _IO_new_file_overflow _IO_file_overflow
|
||||
# define _IO_new_file_seekoff _IO_file_seekoff
|
||||
# define _IO_new_file_underflow _IO_file_underflow
|
||||
# define _IO_new_file_write _IO_file_write
|
||||
# define _IO_new_file_xsputn _IO_file_xsputn
|
||||
#endif
|
||||
|
||||
|
||||
_IO_FILE *
|
||||
_IO_wfile_setbuf (fp, p, len)
|
||||
_IO_FILE *fp;
|
||||
wchar_t *p;
|
||||
_IO_ssize_t len;
|
||||
{
|
||||
if (_IO_wdefault_setbuf (fp, p, len) == NULL)
|
||||
return NULL;
|
||||
|
||||
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr =
|
||||
fp->_wide_data->_IO_write_end = fp->_wide_data->_IO_buf_base;
|
||||
_IO_wsetg (fp, fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base,
|
||||
fp->_wide_data->_IO_buf_base);
|
||||
|
||||
return fp;
|
||||
}
|
||||
|
||||
|
||||
/* Convert TO_DO wide character from DATA to FP.
|
||||
Then mark FP as having empty buffers. */
|
||||
int
|
||||
_IO_wdo_write (fp, data, to_do)
|
||||
_IO_FILE *fp;
|
||||
const wchar_t *data;
|
||||
_IO_size_t to_do;
|
||||
{
|
||||
struct _IO_codecvt *cc = fp->_codecvt;
|
||||
|
||||
if (to_do > 0)
|
||||
{
|
||||
if (fp->_IO_write_end == fp->_IO_write_ptr
|
||||
&& fp->_IO_write_end != fp->_IO_write_base)
|
||||
{
|
||||
if (_IO_new_do_write (fp, fp->_IO_write_base,
|
||||
fp->_IO_write_ptr - fp->_IO_write_base) == EOF)
|
||||
return EOF;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
enum __codecvt_result result;
|
||||
const wchar_t *new_data;
|
||||
|
||||
/* Now convert from the internal format into the external buffer. */
|
||||
result = (*cc->__codecvt_do_out) (cc, &fp->_wide_data->_IO_state,
|
||||
data, data + to_do, &new_data,
|
||||
fp->_IO_write_ptr,
|
||||
fp->_IO_buf_end,
|
||||
&fp->_IO_write_ptr);
|
||||
|
||||
/* Write out what we produced so far. */
|
||||
if (_IO_new_do_write (fp, fp->_IO_write_base,
|
||||
fp->_IO_write_ptr - fp->_IO_write_base) == EOF)
|
||||
/* Something went wrong. */
|
||||
return EOF;
|
||||
|
||||
to_do -= new_data - data;
|
||||
|
||||
/* Next see whether we had problems during the conversion. If yes,
|
||||
we cannot go on. */
|
||||
if (result != __codecvt_ok
|
||||
&& (result != __codecvt_partial || new_data - data == 0))
|
||||
break;
|
||||
|
||||
data = new_data;
|
||||
}
|
||||
while (to_do > 0);
|
||||
}
|
||||
|
||||
_IO_wsetg (fp, fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base,
|
||||
fp->_wide_data->_IO_buf_base);
|
||||
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr
|
||||
= fp->_wide_data->_IO_buf_base;
|
||||
fp->_wide_data->_IO_write_end = ((fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
|
||||
? fp->_wide_data->_IO_buf_base
|
||||
: fp->_wide_data->_IO_buf_end);
|
||||
|
||||
return to_do == 0 ? 0 : WEOF;
|
||||
}
|
||||
|
||||
|
||||
wint_t
|
||||
_IO_wfile_underflow (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
struct _IO_codecvt *cd;
|
||||
enum __codecvt_result status;
|
||||
_IO_ssize_t count;
|
||||
int tries;
|
||||
const char *read_ptr_copy;
|
||||
|
||||
if (fp->_flags & _IO_NO_READS)
|
||||
{
|
||||
fp->_flags |= _IO_ERR_SEEN;
|
||||
__set_errno (EBADF);
|
||||
return WEOF;
|
||||
}
|
||||
if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
|
||||
return *fp->_wide_data->_IO_read_ptr;
|
||||
|
||||
cd = fp->_codecvt;
|
||||
|
||||
/* Maybe there is something left in the external buffer. */
|
||||
if (fp->_IO_read_ptr < fp->_IO_read_end)
|
||||
{
|
||||
/* Convert it. */
|
||||
size_t avail_bytes = fp->_IO_read_end - fp->_IO_read_ptr;
|
||||
|
||||
if (avail_bytes >= (*cd->__codecvt_do_max_length) (cd))
|
||||
{
|
||||
/* There is more in the external. */
|
||||
const char *read_stop = (const char *) fp->_IO_read_ptr;
|
||||
|
||||
fp->_wide_data->_IO_last_state = fp->_wide_data->_IO_state;
|
||||
status = (*cd->__codecvt_do_in) (cd, &fp->_wide_data->_IO_state,
|
||||
fp->_IO_read_ptr, fp->_IO_read_end,
|
||||
&read_stop,
|
||||
fp->_wide_data->_IO_read_end,
|
||||
fp->_wide_data->_IO_buf_end,
|
||||
&fp->_wide_data->_IO_read_end);
|
||||
|
||||
fp->_IO_read_ptr = (char *) read_stop;
|
||||
|
||||
/* If we managed to generate some text return the next character. */
|
||||
if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
|
||||
return *fp->_wide_data->_IO_read_ptr;
|
||||
|
||||
if (status == __codecvt_error)
|
||||
{
|
||||
__set_errno (EILSEQ);
|
||||
fp->_flags |= _IO_ERR_SEEN;
|
||||
return WEOF;
|
||||
}
|
||||
}
|
||||
|
||||
/* Move the remaining content of the read buffer to the beginning. */
|
||||
memmove (fp->_IO_buf_base, fp->_IO_read_ptr,
|
||||
fp->_IO_read_end - fp->_IO_read_ptr);
|
||||
fp->_IO_read_end = (fp->_IO_buf_base
|
||||
+ (fp->_IO_read_end - fp->_IO_read_ptr));
|
||||
fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_buf_base;
|
||||
}
|
||||
else
|
||||
fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end =
|
||||
fp->_IO_buf_base;
|
||||
|
||||
if (fp->_IO_buf_base == NULL)
|
||||
{
|
||||
/* Maybe we already have a push back pointer. */
|
||||
if (fp->_IO_save_base != NULL)
|
||||
{
|
||||
free (fp->_IO_save_base);
|
||||
fp->_flags &= ~_IO_IN_BACKUP;
|
||||
}
|
||||
_IO_doallocbuf (fp);
|
||||
|
||||
fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end =
|
||||
fp->_IO_buf_base;
|
||||
}
|
||||
|
||||
fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end =
|
||||
fp->_IO_buf_base;
|
||||
|
||||
if (fp->_wide_data->_IO_buf_base == NULL)
|
||||
{
|
||||
/* Maybe we already have a push back pointer. */
|
||||
if (fp->_wide_data->_IO_save_base != NULL)
|
||||
{
|
||||
free (fp->_wide_data->_IO_save_base);
|
||||
fp->_flags &= ~_IO_IN_BACKUP;
|
||||
}
|
||||
_IO_wdoallocbuf (fp);
|
||||
}
|
||||
|
||||
/* Flush all line buffered files before reading. */
|
||||
/* FIXME This can/should be moved to genops ?? */
|
||||
if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
|
||||
_IO_flush_all_linebuffered ();
|
||||
|
||||
_IO_switch_to_get_mode (fp);
|
||||
|
||||
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr =
|
||||
fp->_wide_data->_IO_buf_base;
|
||||
fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_buf_base;
|
||||
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr =
|
||||
fp->_wide_data->_IO_write_end = fp->_wide_data->_IO_buf_base;
|
||||
|
||||
tries = 0;
|
||||
again:
|
||||
count = _IO_SYSREAD (fp, fp->_IO_read_end,
|
||||
fp->_IO_buf_end - fp->_IO_read_end);
|
||||
if (count <= 0)
|
||||
{
|
||||
if (count == 0 && tries == 0)
|
||||
fp->_flags |= _IO_EOF_SEEN;
|
||||
else
|
||||
fp->_flags |= _IO_ERR_SEEN, count = 0;
|
||||
}
|
||||
fp->_IO_read_end += count;
|
||||
if (count == 0)
|
||||
{
|
||||
if (tries != 0)
|
||||
/* There are some bytes in the external buffer but they don't
|
||||
convert to anything. */
|
||||
__set_errno (EILSEQ);
|
||||
return WEOF;
|
||||
}
|
||||
if (fp->_offset != _IO_pos_BAD)
|
||||
_IO_pos_adjust (fp->_offset, count);
|
||||
|
||||
/* Now convert the read input. */
|
||||
fp->_wide_data->_IO_last_state = fp->_wide_data->_IO_state;
|
||||
fp->_IO_read_base = fp->_IO_read_ptr;
|
||||
status = (*cd->__codecvt_do_in) (cd, &fp->_wide_data->_IO_state,
|
||||
fp->_IO_read_ptr, fp->_IO_read_end,
|
||||
&read_ptr_copy,
|
||||
fp->_wide_data->_IO_read_end,
|
||||
fp->_wide_data->_IO_buf_end,
|
||||
&fp->_wide_data->_IO_read_end);
|
||||
|
||||
fp->_IO_read_ptr = (char *) read_ptr_copy;
|
||||
if (fp->_wide_data->_IO_read_end == fp->_wide_data->_IO_buf_base)
|
||||
{
|
||||
if (status == __codecvt_error || fp->_IO_read_end == fp->_IO_buf_end)
|
||||
{
|
||||
__set_errno (EILSEQ);
|
||||
fp->_flags |= _IO_ERR_SEEN;
|
||||
return WEOF;
|
||||
}
|
||||
|
||||
/* The read bytes make no complete character. Try reading again. */
|
||||
assert (status == __codecvt_partial);
|
||||
++tries;
|
||||
goto again;
|
||||
}
|
||||
|
||||
return *fp->_wide_data->_IO_read_ptr;
|
||||
}
|
||||
|
||||
|
||||
wint_t
|
||||
_IO_wfile_overflow (f, wch)
|
||||
_IO_FILE *f;
|
||||
wint_t wch;
|
||||
{
|
||||
if (f->_flags & _IO_NO_WRITES) /* SET ERROR */
|
||||
{
|
||||
f->_flags |= _IO_ERR_SEEN;
|
||||
__set_errno (EBADF);
|
||||
return WEOF;
|
||||
}
|
||||
/* If currently reading or no buffer allocated. */
|
||||
if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0)
|
||||
{
|
||||
/* Allocate a buffer if needed. */
|
||||
if (f->_wide_data->_IO_write_base == 0)
|
||||
{
|
||||
_IO_wdoallocbuf (f);
|
||||
_IO_wsetg (f, f->_wide_data->_IO_buf_base,
|
||||
f->_wide_data->_IO_buf_base, f->_wide_data->_IO_buf_base);
|
||||
|
||||
if (f->_IO_write_base == NULL)
|
||||
{
|
||||
_IO_doallocbuf (f);
|
||||
_IO_setg (f, f->_IO_buf_base, f->_IO_buf_base, f->_IO_buf_base);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise must be currently reading. If _IO_read_ptr
|
||||
(and hence also _IO_read_end) is at the buffer end,
|
||||
logically slide the buffer forwards one block (by setting
|
||||
the read pointers to all point at the beginning of the
|
||||
block). This makes room for subsequent output.
|
||||
Otherwise, set the read pointers to _IO_read_end (leaving
|
||||
that alone, so it can continue to correspond to the
|
||||
external position). */
|
||||
if (f->_wide_data->_IO_read_ptr == f->_wide_data->_IO_buf_end)
|
||||
{
|
||||
f->_IO_read_end = f->_IO_read_ptr = f->_IO_buf_base;
|
||||
f->_wide_data->_IO_read_end = f->_wide_data->_IO_read_ptr =
|
||||
f->_wide_data->_IO_buf_base;
|
||||
}
|
||||
}
|
||||
f->_wide_data->_IO_write_ptr = f->_wide_data->_IO_read_ptr;
|
||||
f->_wide_data->_IO_write_base = f->_wide_data->_IO_write_ptr;
|
||||
f->_wide_data->_IO_write_end = f->_wide_data->_IO_buf_end;
|
||||
f->_wide_data->_IO_read_base = f->_wide_data->_IO_read_ptr =
|
||||
f->_wide_data->_IO_read_end;
|
||||
|
||||
f->_IO_write_ptr = f->_IO_read_ptr;
|
||||
f->_IO_write_base = f->_IO_write_ptr;
|
||||
f->_IO_write_end = f->_IO_buf_end;
|
||||
f->_IO_read_base = f->_IO_read_ptr = f->_IO_read_end;
|
||||
|
||||
f->_flags |= _IO_CURRENTLY_PUTTING;
|
||||
if (f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
|
||||
f->_wide_data->_IO_write_end = f->_wide_data->_IO_write_ptr;
|
||||
}
|
||||
if (wch == WEOF)
|
||||
return _IO_do_flush (f);
|
||||
if (f->_wide_data->_IO_write_ptr == f->_wide_data->_IO_buf_end)
|
||||
/* Buffer is really full */
|
||||
if (_IO_do_flush (f) == WEOF)
|
||||
return WEOF;
|
||||
*f->_wide_data->_IO_write_ptr++ = wch;
|
||||
if ((f->_flags & _IO_UNBUFFERED)
|
||||
|| ((f->_flags & _IO_LINE_BUF) && wch == L'\n'))
|
||||
if (_IO_do_flush (f) == WEOF)
|
||||
return WEOF;
|
||||
return wch;
|
||||
}
|
||||
|
||||
wint_t
|
||||
_IO_wfile_sync (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
_IO_ssize_t delta;
|
||||
wint_t retval = 0;
|
||||
|
||||
/* char* ptr = cur_ptr(); */
|
||||
if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base)
|
||||
if (_IO_do_flush (fp))
|
||||
return WEOF;
|
||||
delta = fp->_wide_data->_IO_read_ptr - fp->_wide_data->_IO_read_end;
|
||||
if (delta != 0)
|
||||
{
|
||||
/* We have to find out how many bytes we have to go back in the
|
||||
external buffer. */
|
||||
struct _IO_codecvt *cv = fp->_codecvt;
|
||||
_IO_off64_t new_pos;
|
||||
|
||||
int clen = (*cv->__codecvt_do_encoding) (cv);
|
||||
|
||||
if (clen > 0)
|
||||
/* It is easy, a fixed number of input bytes are used for each
|
||||
wide character. */
|
||||
delta *= clen;
|
||||
else
|
||||
{
|
||||
/* We have to find out the hard way how much to back off.
|
||||
To do this we determine how much input we needed to
|
||||
generate the wide characters up to the current reading
|
||||
position. */
|
||||
int nread;
|
||||
|
||||
fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
|
||||
nread = (*cv->__codecvt_do_length) (cv, &fp->_wide_data->_IO_state,
|
||||
fp->_IO_read_base,
|
||||
fp->_IO_read_end, delta);
|
||||
fp->_IO_read_ptr = fp->_IO_read_base + nread;
|
||||
delta = -(fp->_IO_read_end - fp->_IO_read_base - nread);
|
||||
}
|
||||
|
||||
new_pos = _IO_SYSSEEK (fp, delta, 1);
|
||||
if (new_pos != (_IO_off64_t) EOF)
|
||||
{
|
||||
fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_read_ptr;
|
||||
fp->_IO_read_end = fp->_IO_read_ptr;
|
||||
}
|
||||
#ifdef ESPIPE
|
||||
else if (errno == ESPIPE)
|
||||
; /* Ignore error from unseekable devices. */
|
||||
#endif
|
||||
else
|
||||
retval = WEOF;
|
||||
}
|
||||
if (retval != WEOF)
|
||||
fp->_offset = _IO_pos_BAD;
|
||||
/* FIXME: Cleanup - can this be shared? */
|
||||
/* setg(base(), ptr, ptr); */
|
||||
return retval;
|
||||
}
|
||||
|
||||
_IO_off64_t
|
||||
_IO_wfile_seekoff (fp, offset, dir, mode)
|
||||
_IO_FILE *fp;
|
||||
_IO_off64_t offset;
|
||||
int dir;
|
||||
int mode;
|
||||
{
|
||||
_IO_off64_t result;
|
||||
_IO_off64_t delta, new_offset;
|
||||
long int count;
|
||||
/* POSIX.1 8.2.3.7 says that after a call the fflush() the file
|
||||
offset of the underlying file must be exact. */
|
||||
int must_be_exact = ((fp->_wide_data->_IO_read_base
|
||||
== fp->_wide_data->_IO_read_end)
|
||||
&& (fp->_wide_data->_IO_write_base
|
||||
== fp->_wide_data->_IO_write_ptr));
|
||||
|
||||
if (mode == 0)
|
||||
dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */
|
||||
|
||||
/* Flush unwritten characters.
|
||||
(This may do an unneeded write if we seek within the buffer.
|
||||
But to be able to switch to reading, we would need to set
|
||||
egptr to ptr. That can't be done in the current design,
|
||||
which assumes file_ptr() is eGptr. Anyway, since we probably
|
||||
end up flushing when we close(), it doesn't make much difference.)
|
||||
FIXME: simulate mem-papped files. */
|
||||
|
||||
if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base
|
||||
|| _IO_in_put_mode (fp))
|
||||
if (_IO_switch_to_wget_mode (fp))
|
||||
return WEOF;
|
||||
|
||||
if (fp->_wide_data->_IO_buf_base == NULL)
|
||||
{
|
||||
/* It could be that we already have a pushback buffer. */
|
||||
if (fp->_wide_data->_IO_read_base != NULL)
|
||||
{
|
||||
free (fp->_wide_data->_IO_read_base);
|
||||
fp->_flags &= ~_IO_IN_BACKUP;
|
||||
}
|
||||
_IO_doallocbuf (fp);
|
||||
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
|
||||
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
|
||||
_IO_wsetp (fp, fp->_wide_data->_IO_buf_base,
|
||||
fp->_wide_data->_IO_buf_base);
|
||||
_IO_wsetg (fp, fp->_wide_data->_IO_buf_base,
|
||||
fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base);
|
||||
}
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
struct _IO_codecvt *cv;
|
||||
int clen;
|
||||
|
||||
case _IO_seek_cur:
|
||||
/* Adjust for read-ahead (bytes is buffer). To do this we must
|
||||
find out which position in the external buffer corresponds to
|
||||
the current position in the internal buffer. */
|
||||
cv = fp->_codecvt;
|
||||
clen = (*cv->__codecvt_do_encoding) (cv);
|
||||
|
||||
if (clen > 0)
|
||||
offset -= (fp->_wide_data->_IO_read_end
|
||||
- fp->_wide_data->_IO_read_ptr) * clen;
|
||||
else
|
||||
{
|
||||
int nread;
|
||||
|
||||
delta = fp->_wide_data->_IO_read_ptr - fp->_wide_data->_IO_read_end;
|
||||
fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
|
||||
nread = (*cv->__codecvt_do_length) (cv, &fp->_wide_data->_IO_state,
|
||||
fp->_IO_read_base,
|
||||
fp->_IO_read_end, delta);
|
||||
fp->_IO_read_ptr = fp->_IO_read_base + nread;
|
||||
offset -= fp->_IO_read_end - fp->_IO_read_base - nread;
|
||||
}
|
||||
|
||||
if (fp->_offset == _IO_pos_BAD)
|
||||
goto dumb;
|
||||
/* Make offset absolute, assuming current pointer is file_ptr(). */
|
||||
offset += fp->_offset;
|
||||
|
||||
dir = _IO_seek_set;
|
||||
break;
|
||||
case _IO_seek_set:
|
||||
break;
|
||||
case _IO_seek_end:
|
||||
{
|
||||
struct _G_stat64 st;
|
||||
if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
|
||||
{
|
||||
offset += st.st_size;
|
||||
dir = _IO_seek_set;
|
||||
}
|
||||
else
|
||||
goto dumb;
|
||||
}
|
||||
}
|
||||
/* At this point, dir==_IO_seek_set. */
|
||||
|
||||
/* If we are only interested in the current position we've found it now. */
|
||||
if (mode == 0)
|
||||
return offset;
|
||||
|
||||
/* If destination is within current buffer, optimize: */
|
||||
if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
|
||||
&& !_IO_in_backup (fp))
|
||||
{
|
||||
/* Offset relative to start of main get area. */
|
||||
_IO_off64_t rel_offset = (offset - fp->_offset
|
||||
+ (fp->_IO_read_end - fp->_IO_read_base));
|
||||
if (rel_offset >= 0)
|
||||
{
|
||||
#if 0
|
||||
if (_IO_in_backup (fp))
|
||||
_IO_switch_to_main_get_area (fp);
|
||||
#endif
|
||||
if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base)
|
||||
{
|
||||
fp->_IO_read_ptr = fp->_IO_read_base + rel_offset;
|
||||
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
|
||||
|
||||
/* Now set the pointer for the internal buffer. This
|
||||
might be an iterative process. Though the read
|
||||
pointer is somewhere in the current external buffer
|
||||
this does not mean we can convert this whole buffer
|
||||
at once fitting in the internal buffer. */
|
||||
do
|
||||
{
|
||||
|
||||
}
|
||||
while (0);
|
||||
|
||||
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
|
||||
goto resync;
|
||||
}
|
||||
#ifdef TODO
|
||||
/* If we have streammarkers, seek forward by reading ahead. */
|
||||
if (_IO_have_markers (fp))
|
||||
{
|
||||
int to_skip = rel_offset
|
||||
- (fp->_IO_read_ptr - fp->_IO_read_base);
|
||||
if (ignore (to_skip) != to_skip)
|
||||
goto dumb;
|
||||
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
|
||||
goto resync;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef TODO
|
||||
if (rel_offset < 0 && rel_offset >= Bbase () - Bptr ())
|
||||
{
|
||||
if (!_IO_in_backup (fp))
|
||||
_IO_switch_to_backup_area (fp);
|
||||
gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr);
|
||||
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
|
||||
goto resync;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef TODO
|
||||
_IO_unsave_markers (fp);
|
||||
#endif
|
||||
|
||||
if (fp->_flags & _IO_NO_READS)
|
||||
goto dumb;
|
||||
|
||||
/* Try to seek to a block boundary, to improve kernel page management. */
|
||||
new_offset = offset & ~(fp->_IO_buf_end - fp->_IO_buf_base - 1);
|
||||
delta = offset - new_offset;
|
||||
if (delta > fp->_IO_buf_end - fp->_IO_buf_base)
|
||||
{
|
||||
new_offset = offset;
|
||||
delta = 0;
|
||||
}
|
||||
result = _IO_SYSSEEK (fp, new_offset, 0);
|
||||
if (result < 0)
|
||||
return EOF;
|
||||
if (delta == 0)
|
||||
count = 0;
|
||||
else
|
||||
{
|
||||
count = _IO_SYSREAD (fp, fp->_IO_buf_base,
|
||||
(must_be_exact
|
||||
? delta : fp->_IO_buf_end - fp->_IO_buf_base));
|
||||
if (count < delta)
|
||||
{
|
||||
/* We weren't allowed to read, but try to seek the remainder. */
|
||||
offset = count == EOF ? delta : delta-count;
|
||||
dir = _IO_seek_cur;
|
||||
goto dumb;
|
||||
}
|
||||
}
|
||||
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta,
|
||||
fp->_IO_buf_base + count);
|
||||
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
|
||||
fp->_offset = result + count;
|
||||
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
|
||||
return offset;
|
||||
dumb:
|
||||
|
||||
_IO_unsave_markers (fp);
|
||||
result = _IO_SYSSEEK (fp, offset, dir);
|
||||
if (result != EOF)
|
||||
{
|
||||
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
|
||||
fp->_offset = result;
|
||||
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
|
||||
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
|
||||
}
|
||||
return result;
|
||||
|
||||
resync:
|
||||
/* We need to do it since it is possible that the file offset in
|
||||
the kernel may be changed behind our back. It may happen when
|
||||
we fopen a file and then do a fork. One process may access the
|
||||
the file and the kernel file offset will be changed. */
|
||||
if (fp->_offset >= 0)
|
||||
_IO_SYSSEEK (fp, fp->_offset, 0);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
_IO_size_t
|
||||
_IO_wfile_xsputn (f, data, n)
|
||||
_IO_FILE *f;
|
||||
const void *data;
|
||||
_IO_size_t n;
|
||||
{
|
||||
register const wchar_t *s = (const wchar_t *) data;
|
||||
_IO_size_t to_do = n;
|
||||
int must_flush = 0;
|
||||
_IO_size_t count;
|
||||
|
||||
if (n <= 0)
|
||||
return 0;
|
||||
/* This is an optimized implementation.
|
||||
If the amount to be written straddles a block boundary
|
||||
(or the filebuf is unbuffered), use sys_write directly. */
|
||||
|
||||
/* First figure out how much space is available in the buffer. */
|
||||
count = f->_wide_data->_IO_write_end - f->_wide_data->_IO_write_ptr;
|
||||
if ((f->_flags & _IO_LINE_BUF) && (f->_flags & _IO_CURRENTLY_PUTTING))
|
||||
{
|
||||
count = f->_wide_data->_IO_buf_end - f->_wide_data->_IO_write_ptr;
|
||||
if (count >= n)
|
||||
{
|
||||
register const wchar_t *p;
|
||||
for (p = s + n; p > s; )
|
||||
{
|
||||
if (*--p == L'\n')
|
||||
{
|
||||
count = p - s + 1;
|
||||
must_flush = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Then fill the buffer. */
|
||||
if (count > 0)
|
||||
{
|
||||
if (count > to_do)
|
||||
count = to_do;
|
||||
if (count > 20)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
f->_wide_data->_IO_write_ptr =
|
||||
__wmempcpy (f->_wide_data->_IO_write_ptr, s, count);
|
||||
#else
|
||||
wmemcpy (f->_wide_data->_IO_write_ptr, s, count);
|
||||
f->_wide_data->_IO_write_ptr += count;
|
||||
#endif
|
||||
s += count;
|
||||
}
|
||||
else
|
||||
{
|
||||
register wchar_t *p = f->_wide_data->_IO_write_ptr;
|
||||
register int i = (int) count;
|
||||
while (--i >= 0)
|
||||
*p++ = *s++;
|
||||
f->_wide_data->_IO_write_ptr = p;
|
||||
}
|
||||
to_do -= count;
|
||||
}
|
||||
if (to_do > 0)
|
||||
to_do -= _IO_wdefault_xsputn (f, s, to_do);
|
||||
if (must_flush
|
||||
&& f->_wide_data->_IO_write_ptr != f->_wide_data->_IO_write_base)
|
||||
_IO_wdo_write (f, f->_wide_data->_IO_write_base,
|
||||
f->_wide_data->_IO_write_ptr
|
||||
- f->_wide_data->_IO_write_base);
|
||||
|
||||
return n - to_do;
|
||||
}
|
||||
|
||||
|
||||
struct _IO_jump_t _IO_wfile_jumps =
|
||||
{
|
||||
JUMP_INIT_DUMMY,
|
||||
JUMP_INIT(finish, _IO_new_file_finish),
|
||||
JUMP_INIT(overflow, (_IO_overflow_t) _IO_wfile_overflow),
|
||||
JUMP_INIT(underflow, (_IO_underflow_t) _IO_wfile_underflow),
|
||||
JUMP_INIT(uflow, (_IO_underflow_t) _IO_wdefault_uflow),
|
||||
JUMP_INIT(pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
|
||||
JUMP_INIT(xsputn, _IO_wfile_xsputn),
|
||||
JUMP_INIT(xsgetn, _IO_file_xsgetn),
|
||||
JUMP_INIT(seekoff, _IO_wfile_seekoff),
|
||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
||||
JUMP_INIT(setbuf, _IO_new_file_setbuf),
|
||||
JUMP_INIT(sync, (_IO_sync_t) _IO_wfile_sync),
|
||||
JUMP_INIT(doallocate, _IO_wfile_doallocate),
|
||||
JUMP_INIT(read, _IO_file_read),
|
||||
JUMP_INIT(write, _IO_new_file_write),
|
||||
JUMP_INIT(seek, _IO_file_seek),
|
||||
JUMP_INIT(close, _IO_file_close),
|
||||
JUMP_INIT(stat, _IO_file_stat),
|
||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
||||
JUMP_INIT(imbue, _IO_default_imbue)
|
||||
};
|
||||
|
||||
#endif /* _GLIBCPP_USE_WCHAR_T */
|
|
@ -1,756 +0,0 @@
|
|||
/* Copyright (C) 1993, 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
Written by Ulrich Drepper <drepper@cygnus.com>.
|
||||
Based on the single byte version by Per Bothner <bothner@cygnus.com>.
|
||||
|
||||
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, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not 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. */
|
||||
|
||||
/* Generic or default I/O operations. */
|
||||
|
||||
#include "libioP.h"
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
#ifdef __STDC__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
||||
#ifndef _LIBC
|
||||
# define __wmemcpy(dst, src, n) wmemcpy (dst, src, n)
|
||||
#endif
|
||||
|
||||
|
||||
static int save_for_wbackup __P ((_IO_FILE *fp, wchar_t *end_p))
|
||||
#ifdef _LIBC
|
||||
internal_function
|
||||
#endif
|
||||
;
|
||||
|
||||
/* Return minimum _pos markers
|
||||
Assumes the current get area is the main get area. */
|
||||
_IO_ssize_t _IO_least_wmarker __P ((_IO_FILE *fp, wchar_t *end_p));
|
||||
|
||||
_IO_ssize_t
|
||||
_IO_least_wmarker (fp, end_p)
|
||||
_IO_FILE *fp;
|
||||
wchar_t *end_p;
|
||||
{
|
||||
_IO_ssize_t least_so_far = end_p - fp->_wide_data->_IO_read_base;
|
||||
struct _IO_marker *mark;
|
||||
for (mark = fp->_markers; mark != NULL; mark = mark->_next)
|
||||
if (mark->_pos < least_so_far)
|
||||
least_so_far = mark->_pos;
|
||||
return least_so_far;
|
||||
}
|
||||
|
||||
/* Switch current get area from backup buffer to (start of) main get area. */
|
||||
void
|
||||
_IO_switch_to_main_wget_area (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
wchar_t *tmp;
|
||||
fp->_flags &= ~_IO_IN_BACKUP;
|
||||
/* Swap _IO_read_end and _IO_save_end. */
|
||||
tmp = fp->_wide_data->_IO_read_end;
|
||||
fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_save_end;
|
||||
fp->_wide_data->_IO_save_end= tmp;
|
||||
/* Swap _IO_read_base and _IO_save_base. */
|
||||
tmp = fp->_wide_data->_IO_read_base;
|
||||
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_save_base;
|
||||
fp->_wide_data->_IO_save_base = tmp;
|
||||
/* Set _IO_read_ptr. */
|
||||
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_base;
|
||||
}
|
||||
|
||||
|
||||
/* Switch current get area from main get area to (end of) backup area. */
|
||||
void
|
||||
_IO_switch_to_wbackup_area (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
wchar_t *tmp;
|
||||
fp->_flags |= _IO_IN_BACKUP;
|
||||
/* Swap _IO_read_end and _IO_save_end. */
|
||||
tmp = fp->_wide_data->_IO_read_end;
|
||||
fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_save_end;
|
||||
fp->_wide_data->_IO_save_end = tmp;
|
||||
/* Swap _IO_read_base and _IO_save_base. */
|
||||
tmp = fp->_wide_data->_IO_read_base;
|
||||
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_save_base;
|
||||
fp->_wide_data->_IO_save_base = tmp;
|
||||
/* Set _IO_read_ptr. */
|
||||
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_IO_wsetb (f, b, eb, a)
|
||||
_IO_FILE *f;
|
||||
wchar_t *b;
|
||||
wchar_t *eb;
|
||||
int a;
|
||||
{
|
||||
if (f->_wide_data->_IO_buf_base && !(f->_flags & _IO_USER_BUF))
|
||||
FREE_BUF (f->_wide_data->_IO_buf_base, _IO_wblen (f));
|
||||
f->_wide_data->_IO_buf_base = b;
|
||||
f->_wide_data->_IO_buf_end = eb;
|
||||
if (a)
|
||||
f->_flags &= ~_IO_USER_BUF;
|
||||
else
|
||||
f->_flags |= _IO_USER_BUF;
|
||||
}
|
||||
|
||||
|
||||
wint_t
|
||||
_IO_wdefault_pbackfail (fp, c)
|
||||
_IO_FILE *fp;
|
||||
wint_t c;
|
||||
{
|
||||
if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
|
||||
&& !_IO_in_backup (fp)
|
||||
&& (wint_t) fp->_IO_read_ptr[-1] == c)
|
||||
--fp->_IO_read_ptr;
|
||||
else
|
||||
{
|
||||
/* Need to handle a filebuf in write mode (switch to read mode). FIXME!*/
|
||||
if (!_IO_in_backup (fp))
|
||||
{
|
||||
/* We need to keep the invariant that the main get area
|
||||
logically follows the backup area. */
|
||||
if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
|
||||
&& _IO_have_wbackup (fp))
|
||||
{
|
||||
if (save_for_wbackup (fp, fp->_wide_data->_IO_read_ptr))
|
||||
return WEOF;
|
||||
}
|
||||
else if (!_IO_have_wbackup (fp))
|
||||
{
|
||||
/* No backup buffer: allocate one. */
|
||||
/* Use nshort buffer, if unused? (probably not) FIXME */
|
||||
int backup_size = 128;
|
||||
wchar_t *bbuf = (wchar_t *) malloc (backup_size
|
||||
* sizeof (wchar_t));
|
||||
if (bbuf == NULL)
|
||||
return WEOF;
|
||||
fp->_wide_data->_IO_save_base = bbuf;
|
||||
fp->_wide_data->_IO_save_end = (fp->_wide_data->_IO_save_base
|
||||
+ backup_size);
|
||||
fp->_wide_data->_IO_backup_base = fp->_wide_data->_IO_save_end;
|
||||
}
|
||||
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr;
|
||||
_IO_switch_to_wbackup_area (fp);
|
||||
}
|
||||
else if (fp->_wide_data->_IO_read_ptr <= fp->_wide_data->_IO_read_base)
|
||||
{
|
||||
/* Increase size of existing backup buffer. */
|
||||
_IO_size_t new_size;
|
||||
_IO_size_t old_size = (fp->_wide_data->_IO_read_end
|
||||
- fp->_wide_data->_IO_read_base);
|
||||
wchar_t *new_buf;
|
||||
new_size = 2 * old_size;
|
||||
new_buf = (wchar_t *) malloc (new_size * sizeof (wchar_t));
|
||||
if (new_buf == NULL)
|
||||
return WEOF;
|
||||
__wmemcpy (new_buf + (new_size - old_size),
|
||||
fp->_wide_data->_IO_read_base, old_size);
|
||||
free (fp->_wide_data->_IO_read_base);
|
||||
_IO_wsetg (fp, new_buf, new_buf + (new_size - old_size),
|
||||
new_buf + new_size);
|
||||
fp->_wide_data->_IO_backup_base = fp->_wide_data->_IO_read_ptr;
|
||||
}
|
||||
|
||||
*--fp->_wide_data->_IO_read_ptr = c;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_IO_wdefault_finish (fp, dummy)
|
||||
_IO_FILE *fp;
|
||||
int dummy;
|
||||
{
|
||||
struct _IO_marker *mark;
|
||||
if (fp->_wide_data->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
|
||||
{
|
||||
FREE_BUF (fp->_wide_data->_IO_buf_base,
|
||||
_IO_wblen (fp) * sizeof (wchar_t));
|
||||
fp->_wide_data->_IO_buf_base = fp->_wide_data->_IO_buf_end = NULL;
|
||||
}
|
||||
|
||||
for (mark = fp->_markers; mark != NULL; mark = mark->_next)
|
||||
mark->_sbuf = NULL;
|
||||
|
||||
if (fp->_IO_save_base)
|
||||
{
|
||||
free (fp->_wide_data->_IO_save_base);
|
||||
fp->_IO_save_base = NULL;
|
||||
}
|
||||
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_IO_lock_fini (*fp->_lock);
|
||||
#endif
|
||||
|
||||
_IO_un_link ((struct _IO_FILE_plus *) fp);
|
||||
}
|
||||
|
||||
|
||||
wint_t
|
||||
_IO_wdefault_uflow (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
wint_t wch;
|
||||
wch = _IO_UNDERFLOW (fp);
|
||||
if (wch == WEOF)
|
||||
return WEOF;
|
||||
return *fp->_wide_data->_IO_read_ptr++;
|
||||
}
|
||||
|
||||
|
||||
wint_t
|
||||
__woverflow (f, wch)
|
||||
_IO_FILE *f;
|
||||
wint_t wch;
|
||||
{
|
||||
if (f->_mode == 0)
|
||||
_IO_fwide (f, 1);
|
||||
return _IO_OVERFLOW (f, wch);
|
||||
}
|
||||
|
||||
|
||||
wint_t
|
||||
__wuflow (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1))
|
||||
return WEOF;
|
||||
|
||||
if (fp->_mode == 0)
|
||||
_IO_fwide (fp, 1);
|
||||
if (_IO_in_put_mode (fp))
|
||||
if (_IO_switch_to_wget_mode (fp) == EOF)
|
||||
return WEOF;
|
||||
if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
|
||||
return *fp->_wide_data->_IO_read_ptr++;
|
||||
if (_IO_in_backup (fp))
|
||||
{
|
||||
_IO_switch_to_main_wget_area (fp);
|
||||
if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
|
||||
return *fp->_wide_data->_IO_read_ptr++;
|
||||
}
|
||||
if (_IO_have_markers (fp))
|
||||
{
|
||||
if (save_for_wbackup (fp, fp->_wide_data->_IO_read_end))
|
||||
return WEOF;
|
||||
}
|
||||
else if (_IO_have_wbackup (fp))
|
||||
_IO_free_wbackup_area (fp);
|
||||
return _IO_UFLOW (fp);
|
||||
}
|
||||
|
||||
|
||||
wint_t
|
||||
__wunderflow (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1))
|
||||
return WEOF;
|
||||
|
||||
if (fp->_mode == 0)
|
||||
_IO_fwide (fp, 1);
|
||||
if (_IO_in_put_mode (fp))
|
||||
if (_IO_switch_to_wget_mode (fp) == EOF)
|
||||
return WEOF;
|
||||
if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
|
||||
return *fp->_wide_data->_IO_read_ptr;
|
||||
if (_IO_in_backup (fp))
|
||||
{
|
||||
_IO_switch_to_main_wget_area (fp);
|
||||
if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
|
||||
return *fp->_wide_data->_IO_read_ptr;
|
||||
}
|
||||
if (_IO_have_markers (fp))
|
||||
{
|
||||
if (save_for_wbackup (fp, fp->_wide_data->_IO_read_end))
|
||||
return WEOF;
|
||||
}
|
||||
else if (_IO_have_backup (fp))
|
||||
_IO_free_wbackup_area (fp);
|
||||
return _IO_UNDERFLOW (fp);
|
||||
}
|
||||
|
||||
|
||||
_IO_size_t
|
||||
_IO_wdefault_xsputn (f, data, n)
|
||||
_IO_FILE *f;
|
||||
const void *data;
|
||||
_IO_size_t n;
|
||||
{
|
||||
const wchar_t *s = (const wchar_t *) data;
|
||||
_IO_size_t more = n;
|
||||
if (more <= 0)
|
||||
return 0;
|
||||
for (;;)
|
||||
{
|
||||
/* Space available. */
|
||||
_IO_ssize_t count = (f->_wide_data->_IO_write_end
|
||||
- f->_wide_data->_IO_write_ptr);
|
||||
if (count > 0)
|
||||
{
|
||||
if ((_IO_size_t) count > more)
|
||||
count = more;
|
||||
if (count > 20)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
f->_wide_data->_IO_write_ptr =
|
||||
__wmempcpy (f->_wide_data->_IO_write_ptr, s, count);
|
||||
#else
|
||||
memcpy (f->_wide_data->_IO_write_ptr, s, count);
|
||||
f->_wide_data->_IO_write_ptr += count;
|
||||
#endif
|
||||
s += count;
|
||||
}
|
||||
else if (count <= 0)
|
||||
count = 0;
|
||||
else
|
||||
{
|
||||
wchar_t *p = f->_wide_data->_IO_write_ptr;
|
||||
_IO_ssize_t i;
|
||||
for (i = count; --i >= 0; )
|
||||
*p++ = *s++;
|
||||
f->_wide_data->_IO_write_ptr = p;
|
||||
}
|
||||
more -= count;
|
||||
}
|
||||
if (more == 0 || __woverflow (f, *s++) == WEOF)
|
||||
break;
|
||||
more--;
|
||||
}
|
||||
return n - more;
|
||||
}
|
||||
|
||||
|
||||
_IO_size_t
|
||||
_IO_wdefault_xsgetn (fp, data, n)
|
||||
_IO_FILE *fp;
|
||||
void *data;
|
||||
_IO_size_t n;
|
||||
{
|
||||
_IO_size_t more = n;
|
||||
wchar_t *s = (wchar_t*) data;
|
||||
for (;;)
|
||||
{
|
||||
/* Data available. */
|
||||
_IO_ssize_t count = (fp->_wide_data->_IO_read_end
|
||||
- fp->_wide_data->_IO_read_ptr);
|
||||
if (count > 0)
|
||||
{
|
||||
if ((_IO_size_t) count > more)
|
||||
count = more;
|
||||
if (count > 20)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
s = __wmempcpy (s, fp->_wide_data->_IO_read_ptr, count);
|
||||
#else
|
||||
memcpy (s, fp->_wide_data->_IO_read_ptr, count);
|
||||
s += count;
|
||||
#endif
|
||||
fp->_wide_data->_IO_read_ptr += count;
|
||||
}
|
||||
else if (count <= 0)
|
||||
count = 0;
|
||||
else
|
||||
{
|
||||
wchar_t *p = fp->_wide_data->_IO_read_ptr;
|
||||
int i = (int) count;
|
||||
while (--i >= 0)
|
||||
*s++ = *p++;
|
||||
fp->_wide_data->_IO_read_ptr = p;
|
||||
}
|
||||
more -= count;
|
||||
}
|
||||
if (more == 0 || __wunderflow (fp) == WEOF)
|
||||
break;
|
||||
}
|
||||
return n - more;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_IO_wdoallocbuf (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
if (fp->_wide_data->_IO_buf_base)
|
||||
return;
|
||||
if (!(fp->_flags & _IO_UNBUFFERED))
|
||||
if (_IO_DOALLOCATE (fp) != WEOF)
|
||||
return;
|
||||
_IO_wsetb (fp, fp->_wide_data->_shortbuf, fp->_wide_data->_shortbuf + 1, 0);
|
||||
}
|
||||
|
||||
|
||||
_IO_FILE *
|
||||
_IO_wdefault_setbuf (fp, p, len)
|
||||
_IO_FILE *fp;
|
||||
wchar_t *p;
|
||||
_IO_ssize_t len;
|
||||
{
|
||||
if (_IO_SYNC (fp) == EOF)
|
||||
return NULL;
|
||||
if (p == NULL || len == 0)
|
||||
{
|
||||
fp->_flags |= _IO_UNBUFFERED;
|
||||
_IO_wsetb (fp, fp->_wide_data->_shortbuf, fp->_wide_data->_shortbuf + 1,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
fp->_flags &= ~_IO_UNBUFFERED;
|
||||
_IO_wsetb (fp, p, p + len, 0);
|
||||
}
|
||||
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr
|
||||
= fp->_wide_data->_IO_write_end = 0;
|
||||
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr
|
||||
= fp->_wide_data->_IO_read_end = 0;
|
||||
return fp;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_IO_wdefault_doallocate (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
wchar_t *buf;
|
||||
|
||||
ALLOC_WBUF (buf, _IO_BUFSIZ, EOF);
|
||||
_IO_wsetb (fp, buf, buf + _IO_BUFSIZ, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_IO_switch_to_wget_mode (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base)
|
||||
if (_IO_OVERFLOW (fp, WEOF) == WEOF)
|
||||
return EOF;
|
||||
if (_IO_in_backup (fp))
|
||||
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_backup_base;
|
||||
else
|
||||
{
|
||||
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_buf_base;
|
||||
if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_read_end)
|
||||
fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_write_ptr;
|
||||
}
|
||||
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_write_ptr;
|
||||
|
||||
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr
|
||||
= fp->_wide_data->_IO_write_end = fp->_wide_data->_IO_read_ptr;
|
||||
|
||||
fp->_flags &= ~_IO_CURRENTLY_PUTTING;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
_IO_free_wbackup_area (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
if (_IO_in_backup (fp))
|
||||
_IO_switch_to_main_wget_area (fp); /* Just in case. */
|
||||
free (fp->_wide_data->_IO_save_base);
|
||||
fp->_wide_data->_IO_save_base = NULL;
|
||||
fp->_wide_data->_IO_save_end = NULL;
|
||||
fp->_wide_data->_IO_backup_base = NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int
|
||||
_IO_switch_to_wput_mode (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_read_ptr;
|
||||
fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_read_ptr;
|
||||
/* Following is wrong if line- or un-buffered? */
|
||||
fp->_wide_data->_IO_write_end = (fp->_flags & _IO_IN_BACKUP
|
||||
? fp->_wide_data->_IO_read_end
|
||||
: fp->_wide_data->_IO_buf_end);
|
||||
|
||||
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
|
||||
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_end;
|
||||
|
||||
fp->_flags |= _IO_CURRENTLY_PUTTING;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int
|
||||
#ifdef _LIBC
|
||||
internal_function
|
||||
#endif
|
||||
save_for_wbackup (fp, end_p)
|
||||
_IO_FILE *fp;
|
||||
wchar_t *end_p;
|
||||
{
|
||||
/* Append [_IO_read_base..end_p] to backup area. */
|
||||
_IO_ssize_t least_mark = _IO_least_wmarker (fp, end_p);
|
||||
/* needed_size is how much space we need in the backup area. */
|
||||
_IO_size_t needed_size = ((end_p - fp->_wide_data->_IO_read_base)
|
||||
- least_mark);
|
||||
/* FIXME: Dubious arithmetic if pointers are NULL */
|
||||
_IO_size_t current_Bsize = (fp->_wide_data->_IO_save_end
|
||||
- fp->_wide_data->_IO_save_base);
|
||||
_IO_size_t avail; /* Extra space available for future expansion. */
|
||||
_IO_ssize_t delta;
|
||||
struct _IO_marker *mark;
|
||||
if (needed_size > current_Bsize)
|
||||
{
|
||||
wchar_t *new_buffer;
|
||||
avail = 100;
|
||||
new_buffer = (wchar_t *) malloc ((avail + needed_size)
|
||||
* sizeof (wchar_t));
|
||||
if (new_buffer == NULL)
|
||||
return EOF; /* FIXME */
|
||||
if (least_mark < 0)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
__wmempcpy (__wmempcpy (new_buffer + avail,
|
||||
fp->_wide_data->_IO_save_end + least_mark,
|
||||
-least_mark),
|
||||
fp->_wide_data->_IO_read_base,
|
||||
end_p - fp->_wide_data->_IO_read_base);
|
||||
#else
|
||||
memcpy (new_buffer + avail,
|
||||
fp->_wide_data->_IO_save_end + least_mark,
|
||||
-least_mark * sizeof (wchar_t));
|
||||
memcpy (new_buffer + avail - least_mark,
|
||||
fp->_wide_data->_IO_read_base,
|
||||
(end_p - fp->_wide_data->_IO_read_base) * sizeof (wchar_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _LIBC
|
||||
__wmemcpy (new_buffer + avail,
|
||||
fp->_wide_data->_IO_read_base + least_mark,
|
||||
needed_size);
|
||||
#else
|
||||
memcpy (new_buffer + avail,
|
||||
fp->_wide_data->_IO_read_base + least_mark,
|
||||
needed_size * sizeof (wchar_t));
|
||||
#endif
|
||||
}
|
||||
if (fp->_wide_data->_IO_save_base)
|
||||
free (fp->_wide_data->_IO_save_base);
|
||||
fp->_wide_data->_IO_save_base = new_buffer;
|
||||
fp->_wide_data->_IO_save_end = new_buffer + avail + needed_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
avail = current_Bsize - needed_size;
|
||||
if (least_mark < 0)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
__wmemmove (fp->_wide_data->_IO_save_base + avail,
|
||||
fp->_wide_data->_IO_save_end + least_mark,
|
||||
-least_mark);
|
||||
__wmemcpy (fp->_wide_data->_IO_save_base + avail - least_mark,
|
||||
fp->_wide_data->_IO_read_base,
|
||||
end_p - fp->_wide_data->_IO_read_base);
|
||||
#else
|
||||
memmove (fp->_wide_data->_IO_save_base + avail,
|
||||
fp->_wide_data->_IO_save_end + least_mark,
|
||||
-least_mark * sizeof (wchar_t));
|
||||
memcpy (fp->_wide_data->_IO_save_base + avail - least_mark,
|
||||
fp->_wide_data->_IO_read_base,
|
||||
(end_p - fp->_wide_data->_IO_read_base) * sizeof (wchar_t));
|
||||
#endif
|
||||
}
|
||||
else if (needed_size > 0)
|
||||
#ifdef _LIBC
|
||||
__wmemcpy (fp->_wide_data->_IO_save_base + avail,
|
||||
fp->_wide_data->_IO_read_base + least_mark,
|
||||
needed_size);
|
||||
#else
|
||||
memcpy (fp->_wide_data->_IO_save_base + avail,
|
||||
fp->_wide_data->_IO_read_base + least_mark,
|
||||
needed_size * sizeof (wchar_t));
|
||||
#endif
|
||||
}
|
||||
fp->_wide_data->_IO_backup_base = fp->_wide_data->_IO_save_base + avail;
|
||||
/* Adjust all the streammarkers. */
|
||||
delta = end_p - fp->_wide_data->_IO_read_base;
|
||||
for (mark = fp->_markers; mark != NULL; mark = mark->_next)
|
||||
mark->_pos -= delta;
|
||||
return 0;
|
||||
}
|
||||
|
||||
wint_t
|
||||
_IO_sputbackwc (fp, c)
|
||||
_IO_FILE *fp;
|
||||
wint_t c;
|
||||
{
|
||||
wint_t result;
|
||||
|
||||
if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
|
||||
&& (wchar_t)fp->_wide_data->_IO_read_ptr[-1] == (wchar_t) c)
|
||||
{
|
||||
fp->_wide_data->_IO_read_ptr--;
|
||||
result = c;
|
||||
}
|
||||
else
|
||||
result = _IO_PBACKFAIL (fp, c);
|
||||
|
||||
if (result != EOF)
|
||||
fp->_flags &= ~_IO_EOF_SEEN;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
wint_t
|
||||
_IO_sungetwc (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
int result;
|
||||
|
||||
if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base)
|
||||
{
|
||||
fp->_wide_data->_IO_read_ptr--;
|
||||
result = *fp->_wide_data->_IO_read_ptr;
|
||||
}
|
||||
else
|
||||
result = _IO_PBACKFAIL (fp, EOF);
|
||||
|
||||
if (result != WEOF)
|
||||
fp->_flags &= ~_IO_EOF_SEEN;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
_IO_adjust_wcolumn (start, line, count)
|
||||
unsigned start;
|
||||
const wchar_t *line;
|
||||
int count;
|
||||
{
|
||||
const wchar_t *ptr = line + count;
|
||||
while (ptr > line)
|
||||
if (*--ptr == L'\n')
|
||||
return line + count - ptr - 1;
|
||||
return start + count;
|
||||
}
|
||||
|
||||
void
|
||||
_IO_init_wmarker (marker, fp)
|
||||
struct _IO_marker *marker;
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
marker->_sbuf = fp;
|
||||
if (_IO_in_put_mode (fp))
|
||||
_IO_switch_to_wget_mode (fp);
|
||||
if (_IO_in_backup (fp))
|
||||
marker->_pos = fp->_wide_data->_IO_read_ptr - fp->_wide_data->_IO_read_end;
|
||||
else
|
||||
marker->_pos = (fp->_wide_data->_IO_read_ptr
|
||||
- fp->_wide_data->_IO_read_base);
|
||||
|
||||
/* Should perhaps sort the chain? */
|
||||
marker->_next = fp->_markers;
|
||||
fp->_markers = marker;
|
||||
}
|
||||
|
||||
#define BAD_DELTA EOF
|
||||
|
||||
/* Return difference between MARK and current position of MARK's stream. */
|
||||
int
|
||||
_IO_wmarker_delta (mark)
|
||||
struct _IO_marker *mark;
|
||||
{
|
||||
int cur_pos;
|
||||
if (mark->_sbuf == NULL)
|
||||
return BAD_DELTA;
|
||||
if (_IO_in_backup (mark->_sbuf))
|
||||
cur_pos = (mark->_sbuf->_wide_data->_IO_read_ptr
|
||||
- mark->_sbuf->_wide_data->_IO_read_end);
|
||||
else
|
||||
cur_pos = (mark->_sbuf->_wide_data->_IO_read_ptr
|
||||
- mark->_sbuf->_wide_data->_IO_read_base);
|
||||
return mark->_pos - cur_pos;
|
||||
}
|
||||
|
||||
int
|
||||
_IO_seekwmark (fp, mark, delta)
|
||||
_IO_FILE *fp;
|
||||
struct _IO_marker *mark;
|
||||
int delta;
|
||||
{
|
||||
if (mark->_sbuf != fp)
|
||||
return EOF;
|
||||
if (mark->_pos >= 0)
|
||||
{
|
||||
if (_IO_in_backup (fp))
|
||||
_IO_switch_to_main_wget_area (fp);
|
||||
fp->_wide_data->_IO_read_ptr = (fp->_wide_data->_IO_read_base
|
||||
+ mark->_pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_IO_in_backup (fp))
|
||||
_IO_switch_to_wbackup_area (fp);
|
||||
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end + mark->_pos;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
_IO_unsave_wmarkers (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
struct _IO_marker *mark = fp->_markers;
|
||||
if (mark)
|
||||
{
|
||||
#ifdef TODO
|
||||
streampos offset = seekoff (0, ios::cur, ios::in);
|
||||
if (offset != EOF)
|
||||
{
|
||||
offset += eGptr () - Gbase ();
|
||||
for ( ; mark != NULL; mark = mark->_next)
|
||||
mark->set_streampos (mark->_pos + offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( ; mark != NULL; mark = mark->_next)
|
||||
mark->set_streampos (EOF);
|
||||
}
|
||||
#endif
|
||||
fp->_markers = 0;
|
||||
}
|
||||
|
||||
if (_IO_have_backup (fp))
|
||||
_IO_free_wbackup_area (fp);
|
||||
}
|
||||
|
||||
#endif /* _GLIBCPP_USE_WCHAR_T */
|
|
@ -1,4 +1,4 @@
|
|||
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
|
@ -70,7 +70,6 @@ AWK = @AWK@
|
|||
BASIC_FILE_CC = @BASIC_FILE_CC@
|
||||
BASIC_FILE_H = @BASIC_FILE_H@
|
||||
CC = @CC@
|
||||
CCODECVT_C = @CCODECVT_C@
|
||||
CCODECVT_CC = @CCODECVT_CC@
|
||||
CCODECVT_H = @CCODECVT_H@
|
||||
CCOLLATE_CC = @CCOLLATE_CC@
|
||||
|
@ -97,7 +96,6 @@ GCJ = @GCJ@
|
|||
GCJFLAGS = @GCJFLAGS@
|
||||
GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
|
||||
GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
|
||||
LIBIO_INCLUDES = @LIBIO_INCLUDES@
|
||||
LIBMATHOBJS = @LIBMATHOBJS@
|
||||
LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
|
||||
LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
|
||||
|
@ -127,6 +125,7 @@ enable_shared = @enable_shared@
|
|||
enable_static = @enable_static@
|
||||
glibcpp_CXX = @glibcpp_CXX@
|
||||
glibcpp_MOFILES = @glibcpp_MOFILES@
|
||||
glibcpp_PCHFLAGS = @glibcpp_PCHFLAGS@
|
||||
glibcpp_POFILES = @glibcpp_POFILES@
|
||||
glibcpp_basedir = @glibcpp_basedir@
|
||||
glibcpp_builddir = @glibcpp_builddir@
|
||||
|
@ -138,7 +137,6 @@ glibcpp_toolexecdir = @glibcpp_toolexecdir@
|
|||
glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
|
||||
gxx_include_dir = @gxx_include_dir@
|
||||
ifGNUmake = @ifGNUmake@
|
||||
libio_la = @libio_la@
|
||||
libtool_VERSION = @libtool_VERSION@
|
||||
toplevel_srcdir = @toplevel_srcdir@
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
|
@ -69,7 +69,6 @@ ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@
|
|||
AWK = @AWK@
|
||||
BASIC_FILE_CC = @BASIC_FILE_CC@
|
||||
BASIC_FILE_H = @BASIC_FILE_H@
|
||||
CCODECVT_C = @CCODECVT_C@
|
||||
CCODECVT_CC = @CCODECVT_CC@
|
||||
CCODECVT_H = @CCODECVT_H@
|
||||
CCOLLATE_CC = @CCOLLATE_CC@
|
||||
|
@ -94,7 +93,6 @@ EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
|
|||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
|
||||
LIBIO_INCLUDES = @LIBIO_INCLUDES@
|
||||
LIBMATHOBJS = @LIBMATHOBJS@
|
||||
LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
|
||||
LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@
|
||||
|
@ -124,6 +122,7 @@ enable_shared = @enable_shared@
|
|||
enable_static = @enable_static@
|
||||
glibcpp_CXX = @glibcpp_CXX@
|
||||
glibcpp_MOFILES = @glibcpp_MOFILES@
|
||||
glibcpp_PCHFLAGS = @glibcpp_PCHFLAGS@
|
||||
glibcpp_POFILES = @glibcpp_POFILES@
|
||||
glibcpp_basedir = @glibcpp_basedir@
|
||||
glibcpp_builddir = @glibcpp_builddir@
|
||||
|
@ -135,7 +134,6 @@ glibcpp_toolexecdir = @glibcpp_toolexecdir@
|
|||
glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
|
||||
gxx_include_dir = @gxx_include_dir@
|
||||
ifGNUmake = @ifGNUmake@
|
||||
libio_la = @libio_la@
|
||||
libtool_VERSION = @libtool_VERSION@
|
||||
toplevel_srcdir = @toplevel_srcdir@
|
||||
|
||||
|
@ -164,11 +162,13 @@ OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
|
|||
# These bits are all figured out from configure. Look in acinclude.m4
|
||||
# or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS
|
||||
# NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden.
|
||||
CONFIG_CXXFLAGS = @SECTION_FLAGS@ @EXTRA_CXX_FLAGS@
|
||||
CONFIG_CXXFLAGS = \
|
||||
@SECTION_FLAGS@ @EXTRA_CXX_FLAGS@
|
||||
|
||||
|
||||
# Warning flags to use.
|
||||
WARN_CXXFLAGS = @WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once
|
||||
WARN_CXXFLAGS = \
|
||||
@WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once
|
||||
|
||||
|
||||
LIBSUPCXX_CXXFLAGS = @LIBSUPCXX_PICFLAGS@
|
||||
|
@ -178,13 +178,41 @@ GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
|
|||
LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
|
||||
GCC_INCLUDES = -I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include
|
||||
|
||||
INCLUDES = $(GCC_INCLUDES) $(GLIBCPP_INCLUDES) $(LIBSUPCXX_INCLUDES)
|
||||
INCLUDES = \
|
||||
$(GCC_INCLUDES) $(GLIBCPP_INCLUDES) $(LIBSUPCXX_INCLUDES)
|
||||
|
||||
|
||||
headers = exception new typeinfo cxxabi.h exception_defines.h
|
||||
headers = \
|
||||
exception new typeinfo cxxabi.h exception_defines.h
|
||||
|
||||
|
||||
sources = del_op.cc del_opnt.cc del_opv.cc del_opvnt.cc eh_alloc.cc eh_aux_runtime.cc eh_catch.cc eh_exception.cc eh_globals.cc eh_personality.cc eh_term_handler.cc eh_terminate.cc eh_throw.cc eh_type.cc eh_unex_handler.cc guard.cc new_handler.cc new_op.cc new_opnt.cc new_opv.cc new_opvnt.cc pure.cc tinfo.cc tinfo2.cc vec.cc vterminate.cc
|
||||
sources = \
|
||||
del_op.cc \
|
||||
del_opnt.cc \
|
||||
del_opv.cc \
|
||||
del_opvnt.cc \
|
||||
eh_alloc.cc \
|
||||
eh_aux_runtime.cc \
|
||||
eh_catch.cc \
|
||||
eh_exception.cc \
|
||||
eh_globals.cc \
|
||||
eh_personality.cc \
|
||||
eh_term_handler.cc \
|
||||
eh_terminate.cc \
|
||||
eh_throw.cc \
|
||||
eh_type.cc \
|
||||
eh_unex_handler.cc \
|
||||
guard.cc \
|
||||
new_handler.cc \
|
||||
new_op.cc \
|
||||
new_opnt.cc \
|
||||
new_opv.cc \
|
||||
new_opvnt.cc \
|
||||
pure.cc \
|
||||
tinfo.cc \
|
||||
tinfo2.cc \
|
||||
vec.cc \
|
||||
vterminate.cc
|
||||
|
||||
|
||||
libsupc___la_SOURCES = $(sources)
|
||||
|
@ -198,10 +226,16 @@ glibcppinstall_HEADERS = $(headers)
|
|||
# set this option because CONFIG_CXXFLAGS has to be after
|
||||
# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
|
||||
# as the occasion call for it.
|
||||
AM_CXXFLAGS = -fno-implicit-templates $(LIBSUPCXX_CXXFLAGS) $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
|
||||
AM_CXXFLAGS = \
|
||||
-fno-implicit-templates \
|
||||
$(LIBSUPCXX_CXXFLAGS) \
|
||||
$(WARN_CXXFLAGS) \
|
||||
$(OPTIMIZE_CXXFLAGS) \
|
||||
$(CONFIG_CXXFLAGS)
|
||||
|
||||
|
||||
AM_MAKEFLAGS = "gxx_include_dir=$(gxx_include_dir)"
|
||||
AM_MAKEFLAGS = \
|
||||
"gxx_include_dir=$(gxx_include_dir)"
|
||||
|
||||
|
||||
# libstdc++ libtool notes
|
||||
|
@ -225,7 +259,9 @@ AM_MAKEFLAGS = "gxx_include_dir=$(gxx_include_dir)"
|
|||
#
|
||||
# We have to put --tag disable-shared after --tag CXX lest things
|
||||
# CXX undo the affect of disable-shared.
|
||||
LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared --mode=compile $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
|
||||
LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared \
|
||||
--mode=compile $(CXX) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
|
||||
|
||||
|
||||
# 3) We'd have a problem when building the shared libstdc++ object if
|
||||
|
@ -234,7 +270,9 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared --mode=c
|
|||
# course is problematic at this point. So, we get the top-level
|
||||
# directory to configure libstdc++-v3 to use gcc as the C++
|
||||
# compilation driver.
|
||||
CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared --mode=link $(CXX) @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
|
||||
CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared \
|
||||
--mode=link $(CXX) \
|
||||
@OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
|
@ -271,7 +309,7 @@ DIST_COMMON = Makefile.am Makefile.in
|
|||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
SOURCES = $(libsupc__convenience_la_SOURCES) $(libsupc___la_SOURCES)
|
||||
OBJECTS = $(libsupc__convenience_la_OBJECTS) $(libsupc___la_OBJECTS)
|
||||
|
|
|
@ -70,7 +70,6 @@ AWK = @AWK@
|
|||
BASIC_FILE_CC = @BASIC_FILE_CC@
|
||||
BASIC_FILE_H = @BASIC_FILE_H@
|
||||
CC = @CC@
|
||||
CCODECVT_C = @CCODECVT_C@
|
||||
CCODECVT_CC = @CCODECVT_CC@
|
||||
CCODECVT_H = @CCODECVT_H@
|
||||
CCOLLATE_CC = @CCOLLATE_CC@
|
||||
|
@ -97,7 +96,6 @@ GCJ = @GCJ@
|
|||
GCJFLAGS = @GCJFLAGS@
|
||||
GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
|
||||
GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
|
||||
LIBIO_INCLUDES = @LIBIO_INCLUDES@
|
||||
LIBMATHOBJS = @LIBMATHOBJS@
|
||||
LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
|
||||
LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
|
||||
|
@ -128,6 +126,7 @@ enable_shared = @enable_shared@
|
|||
enable_static = @enable_static@
|
||||
glibcpp_CXX = @glibcpp_CXX@
|
||||
glibcpp_MOFILES = @glibcpp_MOFILES@
|
||||
glibcpp_PCHFLAGS = @glibcpp_PCHFLAGS@
|
||||
glibcpp_POFILES = @glibcpp_POFILES@
|
||||
glibcpp_basedir = @glibcpp_basedir@
|
||||
glibcpp_builddir = @glibcpp_builddir@
|
||||
|
@ -138,7 +137,6 @@ glibcpp_toolexecdir = @glibcpp_toolexecdir@
|
|||
glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
|
||||
gxx_include_dir = @gxx_include_dir@
|
||||
ifGNUmake = @ifGNUmake@
|
||||
libio_la = @libio_la@
|
||||
libtool_VERSION = @libtool_VERSION@
|
||||
toplevel_srcdir = @toplevel_srcdir@
|
||||
|
||||
|
@ -159,7 +157,9 @@ LOCALE_OUT = @glibcpp_MOFILES@
|
|||
MSGFMT = msgfmt
|
||||
|
||||
# Necessary files.
|
||||
DISTFILES = Makefile.am Makefile.in string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN)
|
||||
DISTFILES = \
|
||||
Makefile.am Makefile.in string_literals.cc POTFILES.in $(PACKAGE).pot \
|
||||
$(LOCALE_IN)
|
||||
|
||||
|
||||
# Specify what gets cleaned up on a 'make clean'
|
||||
|
@ -174,15 +174,15 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
|||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
TAR = tar
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .mo .po
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu po/Makefile
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --cygnus po/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
@ -195,13 +195,8 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
|||
subdir = po
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu po/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
|
@ -214,10 +209,12 @@ info-am:
|
|||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check-am:
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-info-am:
|
||||
install-info: install-info-am
|
||||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
|
@ -266,11 +263,12 @@ maintainer-clean-am: maintainer-clean-generic distclean-am
|
|||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: tags distdir info-am info dvi-am dvi check check-am \
|
||||
installcheck-am installcheck install-exec-am install-exec \
|
||||
install-data-local install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-local all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
installcheck-am installcheck install-info-am install-info \
|
||||
install-exec-am install-exec install-data-local install-data-am \
|
||||
install-data install-am install uninstall-am uninstall all-local \
|
||||
all-redirect all-am all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
.po.mo:
|
||||
|
|
|
@ -62,13 +62,12 @@ WARN_CXXFLAGS = \
|
|||
GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
|
||||
LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
|
||||
LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
|
||||
LIBIO_INCLUDES = @LIBIO_INCLUDES@
|
||||
TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
|
||||
|
||||
INCLUDES = \
|
||||
-nostdinc++ \
|
||||
$(GLIBCPP_INCLUDES) \
|
||||
$(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \
|
||||
$(LIBSUPCXX_INCLUDES) $(LIBMATH_INCLUDES) \
|
||||
$(TOPLEVEL_INCLUDES)
|
||||
|
||||
# Source files linked in via configuration/make substitution for a
|
||||
|
@ -151,7 +150,7 @@ VPATH = $(top_srcdir)/src:$(top_srcdir)
|
|||
libstdc___la_SOURCES = $(sources)
|
||||
|
||||
libstdc___la_LIBADD = \
|
||||
$(top_builddir)/libmath/libmath.la @libio_la@ \
|
||||
$(top_builddir)/libmath/libmath.la \
|
||||
$(top_builddir)/libsupc++/libsupc++convenience.la
|
||||
|
||||
libstdc___la_DEPENDENCIES = libstdc++-symbol.ver $(libstdc___la_LIBADD)
|
||||
|
|
|
@ -69,7 +69,6 @@ AWK = @AWK@
|
|||
BASIC_FILE_CC = @BASIC_FILE_CC@
|
||||
BASIC_FILE_H = @BASIC_FILE_H@
|
||||
CC = @CC@
|
||||
CCODECVT_C = @CCODECVT_C@
|
||||
CCODECVT_CC = @CCODECVT_CC@
|
||||
CCODECVT_H = @CCODECVT_H@
|
||||
CCOLLATE_CC = @CCOLLATE_CC@
|
||||
|
@ -131,7 +130,6 @@ glibcpp_toolexecdir = @glibcpp_toolexecdir@
|
|||
glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
|
||||
gxx_include_dir = @gxx_include_dir@
|
||||
ifGNUmake = @ifGNUmake@
|
||||
libio_la = @libio_la@
|
||||
libtool_VERSION = @libtool_VERSION@
|
||||
toplevel_srcdir = @toplevel_srcdir@
|
||||
|
||||
|
@ -169,13 +167,12 @@ WARN_CXXFLAGS = \
|
|||
GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
|
||||
LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
|
||||
LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
|
||||
LIBIO_INCLUDES = @LIBIO_INCLUDES@
|
||||
TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
|
||||
|
||||
INCLUDES = \
|
||||
-nostdinc++ \
|
||||
$(GLIBCPP_INCLUDES) \
|
||||
$(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \
|
||||
$(LIBSUPCXX_INCLUDES) $(LIBMATH_INCLUDES) \
|
||||
$(TOPLEVEL_INCLUDES)
|
||||
|
||||
|
||||
|
@ -235,7 +232,7 @@ VPATH = $(top_srcdir)/src:$(top_srcdir)
|
|||
libstdc___la_SOURCES = $(sources)
|
||||
|
||||
libstdc___la_LIBADD = \
|
||||
$(top_builddir)/libmath/libmath.la @libio_la@ \
|
||||
$(top_builddir)/libmath/libmath.la \
|
||||
$(top_builddir)/libsupc++/libsupc++convenience.la
|
||||
|
||||
|
||||
|
|
|
@ -70,7 +70,6 @@ AWK = @AWK@
|
|||
BASIC_FILE_CC = @BASIC_FILE_CC@
|
||||
BASIC_FILE_H = @BASIC_FILE_H@
|
||||
CC = @CC@
|
||||
CCODECVT_C = @CCODECVT_C@
|
||||
CCODECVT_CC = @CCODECVT_CC@
|
||||
CCODECVT_H = @CCODECVT_H@
|
||||
CCOLLATE_CC = @CCOLLATE_CC@
|
||||
|
@ -96,7 +95,6 @@ GCJ = @GCJ@
|
|||
GCJFLAGS = @GCJFLAGS@
|
||||
GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
|
||||
GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
|
||||
LIBIO_INCLUDES = @LIBIO_INCLUDES@
|
||||
LIBMATHOBJS = @LIBMATHOBJS@
|
||||
LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
|
||||
LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
|
||||
|
@ -128,6 +126,7 @@ enable_shared = @enable_shared@
|
|||
enable_static = @enable_static@
|
||||
glibcpp_CXX = @glibcpp_CXX@
|
||||
glibcpp_MOFILES = @glibcpp_MOFILES@
|
||||
glibcpp_PCHFLAGS = @glibcpp_PCHFLAGS@
|
||||
glibcpp_POFILES = @glibcpp_POFILES@
|
||||
glibcpp_basedir = @glibcpp_basedir@
|
||||
glibcpp_builddir = @glibcpp_builddir@
|
||||
|
@ -139,7 +138,6 @@ glibcpp_toolexecdir = @glibcpp_toolexecdir@
|
|||
glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
|
||||
gxx_include_dir = @gxx_include_dir@
|
||||
ifGNUmake = @ifGNUmake@
|
||||
libio_la = @libio_la@
|
||||
libtool_VERSION = @libtool_VERSION@
|
||||
toplevel_srcdir = @toplevel_srcdir@
|
||||
|
||||
|
@ -147,10 +145,14 @@ AUTOMAKE_OPTIONS = cygnus dejagnu
|
|||
|
||||
DEJATOOL = libstdc++-v3
|
||||
|
||||
EXPECT = `if [ -f @glibcpp_builddir@/../../expect/expect ] ; then echo @glibcpp_builddir@/../../expect/expect ; else echo expect ; fi`
|
||||
EXPECT = `if [ -f @glibcpp_builddir@/../../expect/expect ] ; then \
|
||||
echo @glibcpp_builddir@/../../expect/expect ; \
|
||||
else echo expect ; fi`
|
||||
|
||||
|
||||
RUNTEST = `if [ -f @glibcpp_srcdir@/../dejagnu/runtest ] ; then echo @glibcpp_srcdir@/../dejagnu/runtest ; else echo runtest; fi`
|
||||
RUNTEST = `if [ -f @glibcpp_srcdir@/../dejagnu/runtest ] ; then \
|
||||
echo @glibcpp_srcdir@/../dejagnu/runtest ; \
|
||||
else echo runtest; fi`
|
||||
|
||||
|
||||
AM_RUNTESTFLAGS =
|
||||
|
@ -158,20 +160,26 @@ RUNTESTFLAGS =
|
|||
|
||||
CXX_build = @glibcpp_CXX@
|
||||
CXX = `echo "$(CXX_build)" | sed 's,gcc/xgcc ,gcc/g++ ,'`
|
||||
CXXLINK = LD_RUN_PATH=$${LD_RUN_PATH:+$$LD_RUN_PATH:}${glibcpp_builddir}/src/.libs $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
|
||||
CXXLINK = \
|
||||
LD_RUN_PATH=$${LD_RUN_PATH:+$$LD_RUN_PATH:}${glibcpp_builddir}/src/.libs\
|
||||
$(LIBTOOL) --tag=CXX --mode=link $(CXX) \
|
||||
$(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
|
||||
INCLUDES = -nostdinc++ @GLIBCPP_INCLUDES@ @LIBSUPCXX_INCLUDES@ @TOPLEVEL_INCLUDES@
|
||||
INCLUDES = \
|
||||
-nostdinc++ \
|
||||
@GLIBCPP_INCLUDES@ @LIBSUPCXX_INCLUDES@ @TOPLEVEL_INCLUDES@
|
||||
|
||||
|
||||
noinst_LIBRARIES = libv3test.a
|
||||
libv3test_a_SOURCES = testsuite_hooks.cc testsuite_allocator.cc
|
||||
@GLIBCPP_BUILD_ABI_CHECK_TRUE@noinst_PROGRAMS = abi_check
|
||||
@GLIBCPP_BUILD_ABI_CHECK_TRUE@noinst_PROGRAMS = @GLIBCPP_BUILD_ABI_CHECK_TRUE@abi_check
|
||||
@GLIBCPP_BUILD_ABI_CHECK_FALSE@noinst_PROGRAMS =
|
||||
abi_check_SOURCES = abi_check.cc
|
||||
|
||||
# By adding these files here, automake will remove them for 'make clean'
|
||||
CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum testsuite_* site.exp abi_check
|
||||
CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
|
||||
testsuite_* site.exp abi_check
|
||||
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
|
@ -197,12 +205,12 @@ CXXFLAGS = @CXXFLAGS@
|
|||
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
CXXLD = $(CXX)
|
||||
DIST_COMMON = README Makefile.am Makefile.in
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
SOURCES = $(libv3test_a_SOURCES) $(abi_check_SOURCES)
|
||||
OBJECTS = $(libv3test_a_OBJECTS) $(abi_check_OBJECTS)
|
||||
|
@ -313,7 +321,7 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
|||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP))
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
|
@ -370,7 +378,7 @@ site.exp: Makefile
|
|||
@echo 'set build_alias $(build_alias)' >> $@-t
|
||||
@echo 'set build_triplet $(build_triplet)' >> $@-t
|
||||
@echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
|
||||
@test ! -f $(srcdir)/site.exp || sed '1,/^## All variables above are.*##/ d' $(srcdir)/site.exp >> $@-t
|
||||
@test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
|
||||
@test ! -f site.exp || mv site.exp site.bak
|
||||
@mv $@-t site.exp
|
||||
info-am:
|
||||
|
|
Loading…
Reference in New Issue