mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-14 23:50:19 +02:00
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* strports.c (scm_strprint_obj): bug fix: get pt from the port, not from the parameter obj. (Thanks to Eric Moore.) * ports.h: SCM_CRDY, SCM_CUC, SCM_CRDYP, SCM_SETRDY, SCM_CUNGET, SCM_CGETUN, SCM_CLRDY, SCM_TRY_CLRDY, SCM_N_READY_CHARS: deleted. * strings.c (scm_make_string): throw error if 2nd arg isn't a char. * unif.c (scm_uniform_array_read_x): fix reading from a port. allow non-fports. (scm_uniform_array_write): likewise. 1999-06-29 Gary Houston <ghouston@easynet.co.uk> * ports.c (scm_drain_input): rewritten. * fports.c (local_fclose): check putback_buf. (local_read_flush): likewise. * ports.c (scm_remove_from_port_table): maybe free putback_buf. * ports.h (scm_port): replace cbuf/cbufend/cp with putback_buf/ putback_buf_size. (SCM_INITIAL_PUTBACK_BUF_SIZE): renamed from SCM_INITIAL_CBUF_SIZE. * ports.c (scm_grow_port_cbuf): deleted. (scm_add_to_port_table): initialise putback_buf to 0. remove cbuf stuff. (scm_char_ready_p): check putback_buf (scm_fill_buffer): likewise. (scm_ungetc): rewritten. 1999-06-27 Gary Houston <ghouston@easynet.co.uk> * fports.c (local_fclose): account for push-back buffer. * ports.c (scm_char_ready_p): check the push-back buffer in a new way. * ioext.c (scm_do_read_line): remove the extra code to handle the push-back buffer. * ports.c (scm_getc): don't use SCM_CRDYP etc. * ioext.c (scm_do_read_line): call scm_fill_buffer. * ports.c (scm_ungetc): don't call SCM_CUNGET. reset the read buffer pointers. scm_fill_buffer: new procedure. (scm_getc): call scm_fill_buffer. * ports.h (struct scm_port): saved_read_buf, saved_read_pos, saved_read_end: new fields. 1999-07-04 Gary Houston <ghouston@easynet.co.uk> * configure.in: don't check for ways to violate stdio abstraction.
This commit is contained in:
parent
ab41a129a8
commit
6c9514275b
23 changed files with 631 additions and 1655 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
|
||||||
|
|
||||||
|
* configure.in: don't check for ways to violate stdio abstraction.
|
||||||
|
|
||||||
1999-05-02 Jim Blandy <jimb@savonarola.red-bean.com>
|
1999-05-02 Jim Blandy <jimb@savonarola.red-bean.com>
|
||||||
|
|
||||||
* configure.in (AC_CHECK_FUNCS): Fill in list of functions that
|
* configure.in (AC_CHECK_FUNCS): Fill in list of functions that
|
||||||
|
|
|
@ -59,11 +59,9 @@ PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
host_alias = @host_alias@
|
host_alias = @host_alias@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
AS = @AS@
|
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
DLLTOOL = @DLLTOOL@
|
|
||||||
GUILE_LIBS = @GUILE_LIBS@
|
GUILE_LIBS = @GUILE_LIBS@
|
||||||
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
||||||
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
||||||
|
@ -76,7 +74,6 @@ LN_S = @LN_S@
|
||||||
MAINT = @MAINT@
|
MAINT = @MAINT@
|
||||||
MAKEINFO = @MAKEINFO@
|
MAKEINFO = @MAKEINFO@
|
||||||
NM = @NM@
|
NM = @NM@
|
||||||
OBJDUMP = @OBJDUMP@
|
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
|
|
480
aclocal.m4
vendored
480
aclocal.m4
vendored
|
@ -303,58 +303,25 @@ done<<>>dnl>>)
|
||||||
changequote([,]))])
|
changequote([,]))])
|
||||||
|
|
||||||
|
|
||||||
# serial 35 AC_PROG_LIBTOOL
|
# serial 25 AM_PROG_LIBTOOL
|
||||||
AC_DEFUN(AC_PROG_LIBTOOL,
|
AC_DEFUN(AM_PROG_LIBTOOL,
|
||||||
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
|
[AC_REQUIRE([AM_ENABLE_SHARED])dnl
|
||||||
|
AC_REQUIRE([AM_ENABLE_STATIC])dnl
|
||||||
# Save cache, so that ltconfig can load it
|
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||||
AC_CACHE_SAVE
|
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||||
|
AC_REQUIRE([AC_PROG_CC])dnl
|
||||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
AC_REQUIRE([AM_PROG_LD])dnl
|
||||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
AC_REQUIRE([AM_PROG_NM])dnl
|
||||||
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
|
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||||
DLLTOOL="$DLLTOOL" AS="$AS" \
|
dnl
|
||||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
|
||||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|
|
||||||
|| AC_MSG_ERROR([libtool configure failed])
|
|
||||||
|
|
||||||
# Reload cache, that may have been modified by ltconfig
|
|
||||||
AC_CACHE_LOAD
|
|
||||||
|
|
||||||
# This can be used to rebuild libtool when needed
|
|
||||||
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
|
|
||||||
|
|
||||||
# Always use our own libtool.
|
# Always use our own libtool.
|
||||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||||
AC_SUBST(LIBTOOL)dnl
|
AC_SUBST(LIBTOOL)dnl
|
||||||
|
|
||||||
# Redirect the config.log output again, so that the ltconfig log is not
|
|
||||||
# clobbered by the next message.
|
|
||||||
exec 5>>./config.log
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN(AC_LIBTOOL_SETUP,
|
|
||||||
[AC_PREREQ(2.13)dnl
|
|
||||||
AC_REQUIRE([AC_ENABLE_SHARED])dnl
|
|
||||||
AC_REQUIRE([AC_ENABLE_STATIC])dnl
|
|
||||||
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
|
|
||||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
|
||||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
|
||||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
|
||||||
AC_REQUIRE([AC_PROG_CC])dnl
|
|
||||||
AC_REQUIRE([AC_PROG_LD])dnl
|
|
||||||
AC_REQUIRE([AC_PROG_NM])dnl
|
|
||||||
AC_REQUIRE([AC_SYS_NM_PARSE])dnl
|
|
||||||
AC_REQUIRE([AC_SYS_SYMBOL_UNDERSCORE])dnl
|
|
||||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
|
||||||
dnl
|
|
||||||
|
|
||||||
# Check for any special flags to pass to ltconfig.
|
# Check for any special flags to pass to ltconfig.
|
||||||
libtool_flags="--cache-file=$cache_file"
|
libtool_flags=
|
||||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||||
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
|
|
||||||
test "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen"
|
|
||||||
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
|
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
|
||||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||||
|
@ -383,46 +350,31 @@ case "$host" in
|
||||||
|
|
||||||
*-*-sco3.2v5*)
|
*-*-sco3.2v5*)
|
||||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||||
SAVE_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CFLAGS -belf"
|
CFLAGS="$CFLAGS -belf"
|
||||||
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
|
|
||||||
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
|
|
||||||
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
|
|
||||||
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
|
|
||||||
CFLAGS="$SAVE_CFLAGS"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*-*-cygwin*)
|
|
||||||
AC_SYS_LIBTOOL_CYGWIN
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# enable the --disable-libtool-lock switch
|
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||||
|
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||||
|
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
|
||||||
|
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||||
|
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|
||||||
|
|| AC_MSG_ERROR([libtool configure failed])
|
||||||
|
|
||||||
AC_ARG_ENABLE(libtool-lock,
|
# Redirect the config.log output again, so that the ltconfig log is not
|
||||||
[ --disable-libtool-lock force libtool not to do file locking],
|
# clobbered by the next message.
|
||||||
need_locks=$enableval,
|
exec 5>>./config.log
|
||||||
need_locks=yes)
|
|
||||||
|
|
||||||
if test x"$need_locks" = xno; then
|
|
||||||
libtool_flags="$libtool_flags --disable-lock"
|
|
||||||
fi
|
|
||||||
])
|
])
|
||||||
|
|
||||||
# AC_LIBTOOL_DLOPEN - check for dlopen support
|
# AM_ENABLE_SHARED - implement the --enable-shared flag
|
||||||
AC_DEFUN(AC_LIBTOOL_DLOPEN, [lt_dlopen=yes])
|
# Usage: AM_ENABLE_SHARED[(DEFAULT)]
|
||||||
|
|
||||||
# AC_ENABLE_SHARED - implement the --enable-shared flag
|
|
||||||
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
|
|
||||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||||
# `yes'.
|
# `yes'.
|
||||||
AC_DEFUN(AC_ENABLE_SHARED,
|
AC_DEFUN(AM_ENABLE_SHARED,
|
||||||
[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||||
AC_ARG_ENABLE(shared,
|
AC_ARG_ENABLE(shared,
|
||||||
changequote(<<, >>)dnl
|
changequote(<<, >>)dnl
|
||||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
<< --enable-shared[=PKGS] build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT],
|
||||||
changequote([, ])dnl
|
changequote([, ])dnl
|
||||||
[p=${PACKAGE-default}
|
[p=${PACKAGE-default}
|
||||||
case "$enableval" in
|
case "$enableval" in
|
||||||
|
@ -440,22 +392,26 @@ no) enable_shared=no ;;
|
||||||
IFS="$ac_save_ifs"
|
IFS="$ac_save_ifs"
|
||||||
;;
|
;;
|
||||||
esac],
|
esac],
|
||||||
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
|
# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||||
AC_DEFUN(AC_DISABLE_SHARED,
|
AC_DEFUN(AM_DISABLE_SHARED,
|
||||||
[AC_ENABLE_SHARED(no)])
|
[AM_ENABLE_SHARED(no)])
|
||||||
|
|
||||||
# AC_ENABLE_STATIC - implement the --enable-static flag
|
# AM_DISABLE_STATIC - set the default static flag to --disable-static
|
||||||
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
|
AC_DEFUN(AM_DISABLE_STATIC,
|
||||||
|
[AM_ENABLE_STATIC(no)])
|
||||||
|
|
||||||
|
# AM_ENABLE_STATIC - implement the --enable-static flag
|
||||||
|
# Usage: AM_ENABLE_STATIC[(DEFAULT)]
|
||||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||||
# `yes'.
|
# `yes'.
|
||||||
AC_DEFUN(AC_ENABLE_STATIC,
|
AC_DEFUN(AM_ENABLE_STATIC,
|
||||||
[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||||
AC_ARG_ENABLE(static,
|
AC_ARG_ENABLE(static,
|
||||||
changequote(<<, >>)dnl
|
changequote(<<, >>)dnl
|
||||||
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
<< --enable-static[=PKGS] build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT],
|
||||||
changequote([, ])dnl
|
changequote([, ])dnl
|
||||||
[p=${PACKAGE-default}
|
[p=${PACKAGE-default}
|
||||||
case "$enableval" in
|
case "$enableval" in
|
||||||
|
@ -473,74 +429,28 @@ no) enable_static=no ;;
|
||||||
IFS="$ac_save_ifs"
|
IFS="$ac_save_ifs"
|
||||||
;;
|
;;
|
||||||
esac],
|
esac],
|
||||||
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
|
enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
# AC_DISABLE_STATIC - set the default static flag to --disable-static
|
|
||||||
AC_DEFUN(AC_DISABLE_STATIC,
|
|
||||||
[AC_ENABLE_STATIC(no)])
|
|
||||||
|
|
||||||
|
# AM_PROG_LD - find the path to the GNU or non-GNU linker
|
||||||
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
|
AC_DEFUN(AM_PROG_LD,
|
||||||
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
|
|
||||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
|
||||||
# `yes'.
|
|
||||||
AC_DEFUN(AC_ENABLE_FAST_INSTALL,
|
|
||||||
[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
|
|
||||||
AC_ARG_ENABLE(fast-install,
|
|
||||||
changequote(<<, >>)dnl
|
|
||||||
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
|
|
||||||
changequote([, ])dnl
|
|
||||||
[p=${PACKAGE-default}
|
|
||||||
case "$enableval" in
|
|
||||||
yes) enable_fast_install=yes ;;
|
|
||||||
no) enable_fast_install=no ;;
|
|
||||||
*)
|
|
||||||
enable_fast_install=no
|
|
||||||
# Look at the argument we got. We use all the common list separators.
|
|
||||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
|
||||||
for pkg in $enableval; do
|
|
||||||
if test "X$pkg" = "X$p"; then
|
|
||||||
enable_fast_install=yes
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS="$ac_save_ifs"
|
|
||||||
;;
|
|
||||||
esac],
|
|
||||||
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
|
|
||||||
AC_DEFUN(AC_DISABLE_FAST_INSTALL,
|
|
||||||
[AC_ENABLE_FAST_INSTALL(no)])
|
|
||||||
|
|
||||||
|
|
||||||
# AC_PROG_LD - find the path to the GNU or non-GNU linker
|
|
||||||
AC_DEFUN(AC_PROG_LD,
|
|
||||||
[AC_ARG_WITH(gnu-ld,
|
[AC_ARG_WITH(gnu-ld,
|
||||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||||
AC_REQUIRE([AC_PROG_CC])dnl
|
AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
|
||||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
|
||||||
ac_prog=ld
|
ac_prog=ld
|
||||||
if test "$ac_cv_prog_gcc" = yes; then
|
if test "$ac_cv_prog_gcc" = yes; then
|
||||||
# Check if gcc -print-prog-name=ld gives a path.
|
# Check if gcc -print-prog-name=ld gives a path.
|
||||||
AC_MSG_CHECKING([for ld used by GCC])
|
AC_MSG_CHECKING([for ld used by GCC])
|
||||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||||
case "$ac_prog" in
|
case "$ac_prog" in
|
||||||
# Accept absolute paths.
|
# Accept absolute paths.
|
||||||
changequote(,)dnl
|
changequote(,)dnl
|
||||||
/* | [A-Za-z]:[\\/]*)
|
/* | [A-Za-z]:\\*)
|
||||||
re_direlt='/[^/][^/]*/\.\./'
|
|
||||||
changequote([,])dnl
|
changequote([,])dnl
|
||||||
# Canonicalize the path of ld
|
test -z "$LD" && LD="$ac_prog"
|
||||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
;;
|
||||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
|
||||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
|
||||||
done
|
|
||||||
test -z "$LD" && LD="$ac_prog"
|
|
||||||
;;
|
|
||||||
"")
|
"")
|
||||||
# If it fails, then pretend we aren't using GCC.
|
# If it fails, then pretend we aren't using GCC.
|
||||||
ac_prog=ld
|
ac_prog=ld
|
||||||
|
@ -568,7 +478,7 @@ AC_CACHE_VAL(ac_cv_path_LD,
|
||||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||||
test "$with_gnu_ld" != no && break
|
test "$with_gnu_ld" != no && break
|
||||||
else
|
else
|
||||||
test "$with_gnu_ld" != yes && break
|
test "$with_gnu_ld" != yes && break
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -584,10 +494,10 @@ else
|
||||||
fi
|
fi
|
||||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||||
AC_SUBST(LD)
|
AC_SUBST(LD)
|
||||||
AC_PROG_LD_GNU
|
AM_PROG_LD_GNU
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN(AC_PROG_LD_GNU,
|
AC_DEFUN(AM_PROG_LD_GNU,
|
||||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||||
|
@ -597,8 +507,8 @@ else
|
||||||
fi])
|
fi])
|
||||||
])
|
])
|
||||||
|
|
||||||
# AC_PROG_NM - find the path to a BSD-compatible name lister
|
# AM_PROG_NM - find the path to a BSD-compatible name lister
|
||||||
AC_DEFUN(AC_PROG_NM,
|
AC_DEFUN(AM_PROG_NM,
|
||||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||||
AC_CACHE_VAL(ac_cv_path_NM,
|
AC_CACHE_VAL(ac_cv_path_NM,
|
||||||
[if test -n "$NM"; then
|
[if test -n "$NM"; then
|
||||||
|
@ -606,22 +516,20 @@ AC_CACHE_VAL(ac_cv_path_NM,
|
||||||
ac_cv_path_NM="$NM"
|
ac_cv_path_NM="$NM"
|
||||||
else
|
else
|
||||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||||
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
|
for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
|
||||||
test -z "$ac_dir" && ac_dir=.
|
test -z "$ac_dir" && ac_dir=.
|
||||||
if test -f $ac_dir/nm; then
|
if test -f $ac_dir/nm; then
|
||||||
# Check to see if the nm accepts a BSD-compat flag.
|
# Check to see if the nm accepts a BSD-compat flag.
|
||||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||||
# nm: unknown option "B" ignored
|
# nm: unknown option "B" ignored
|
||||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||||
ac_cv_path_NM="$ac_dir/nm -B"
|
ac_cv_path_NM="$ac_dir/nm -B"
|
||||||
break
|
|
||||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||||
ac_cv_path_NM="$ac_dir/nm -p"
|
ac_cv_path_NM="$ac_dir/nm -p"
|
||||||
break
|
|
||||||
else
|
else
|
||||||
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
|
ac_cv_path_NM="$ac_dir/nm"
|
||||||
continue # so that we can try to find one that supports BSD flags
|
|
||||||
fi
|
fi
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
IFS="$ac_save_ifs"
|
IFS="$ac_save_ifs"
|
||||||
|
@ -632,280 +540,6 @@ AC_MSG_RESULT([$NM])
|
||||||
AC_SUBST(NM)
|
AC_SUBST(NM)
|
||||||
])
|
])
|
||||||
|
|
||||||
# AC_SYS_NM_PARSE - Check for command to grab the raw symbol name followed
|
|
||||||
# by C symbol name from nm.
|
|
||||||
AC_DEFUN(AC_SYS_NM_PARSE,
|
|
||||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
|
||||||
AC_REQUIRE([AC_PROG_NM])dnl
|
|
||||||
# Check for command to grab the raw symbol name followed by C symbol from nm.
|
|
||||||
AC_MSG_CHECKING([command to parse $NM output])
|
|
||||||
AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
|
|
||||||
[# These are sane defaults that work on at least a few old systems.
|
|
||||||
# {They come from Ultrix. What could be older than Ultrix?!! ;)}
|
|
||||||
|
|
||||||
changequote(,)dnl
|
|
||||||
# Character class describing NM global symbol codes.
|
|
||||||
ac_symcode='[BCDEGRST]'
|
|
||||||
|
|
||||||
# Regexp to match symbols that can be accessed directly from C.
|
|
||||||
ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
|
|
||||||
|
|
||||||
# Transform the above into a raw symbol and a C symbol.
|
|
||||||
ac_symxfrm='\1 \2\3 \3'
|
|
||||||
|
|
||||||
# Transform an extracted symbol line into a proper C declaration
|
|
||||||
ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
|
|
||||||
|
|
||||||
# Define system-specific variables.
|
|
||||||
case "$host_os" in
|
|
||||||
aix*)
|
|
||||||
ac_symcode='[BCDT]'
|
|
||||||
;;
|
|
||||||
cygwin* | mingw*)
|
|
||||||
ac_symcode='[ABCDGISTW]'
|
|
||||||
;;
|
|
||||||
hpux*)
|
|
||||||
ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
|
|
||||||
;;
|
|
||||||
irix*)
|
|
||||||
ac_symcode='[BCDEGRST]'
|
|
||||||
;;
|
|
||||||
solaris*)
|
|
||||||
ac_symcode='[BDT]'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# If we're using GNU nm, then use its standard symbol codes.
|
|
||||||
if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
|
|
||||||
ac_symcode='[ABCDGISTW]'
|
|
||||||
fi
|
|
||||||
changequote([,])dnl
|
|
||||||
|
|
||||||
# Try without a prefix undercore, then with it.
|
|
||||||
for ac_symprfx in "" "_"; do
|
|
||||||
|
|
||||||
ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($ac_symcode\)[ ][ ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
|
|
||||||
|
|
||||||
# Check to see that the pipe works correctly.
|
|
||||||
ac_pipe_works=no
|
|
||||||
rm -f conftest.$ac_ext
|
|
||||||
cat > conftest.$ac_ext <<EOF
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
char nm_test_var;
|
|
||||||
void nm_test_func(){}
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
int main(){nm_test_var='a';nm_test_func;return 0;}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if AC_TRY_EVAL(ac_compile); then
|
|
||||||
# Now try to grab the symbols.
|
|
||||||
ac_nlist=conftest.nm
|
|
||||||
|
|
||||||
if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
|
|
||||||
|
|
||||||
# Try sorting and uniquifying the output.
|
|
||||||
if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
|
|
||||||
mv -f "$ac_nlist"T "$ac_nlist"
|
|
||||||
else
|
|
||||||
rm -f "$ac_nlist"T
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make sure that we snagged all the symbols we need.
|
|
||||||
if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
|
|
||||||
if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
|
|
||||||
cat <<EOF > conftest.c
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
EOF
|
|
||||||
# Now generate the symbol file.
|
|
||||||
eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c'
|
|
||||||
|
|
||||||
cat <<EOF >> conftest.c
|
|
||||||
#if defined (__STDC__) && __STDC__
|
|
||||||
# define lt_ptr_t void *
|
|
||||||
#else
|
|
||||||
# define lt_ptr_t char *
|
|
||||||
# define const
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The mapping between symbol names and symbols. */
|
|
||||||
const struct {
|
|
||||||
const char *name;
|
|
||||||
lt_ptr_t address;
|
|
||||||
}
|
|
||||||
changequote(,)dnl
|
|
||||||
lt_preloaded_symbols[] =
|
|
||||||
changequote([,])dnl
|
|
||||||
{
|
|
||||||
EOF
|
|
||||||
sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
|
|
||||||
cat <<\EOF >> conftest.c
|
|
||||||
{0, (lt_ptr_t) 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
EOF
|
|
||||||
# Now try linking the two files.
|
|
||||||
mv conftest.$ac_objext conftestm.$ac_objext
|
|
||||||
ac_save_LIBS="$LIBS"
|
|
||||||
ac_save_CFLAGS="$CFLAGS"
|
|
||||||
LIBS="conftestm.$ac_objext"
|
|
||||||
CFLAGS="$CFLAGS$no_builtin_flag"
|
|
||||||
if AC_TRY_EVAL(ac_link) && test -s conftest; then
|
|
||||||
ac_pipe_works=yes
|
|
||||||
else
|
|
||||||
echo "configure: failed program was:" >&AC_FD_CC
|
|
||||||
cat conftest.c >&AC_FD_CC
|
|
||||||
fi
|
|
||||||
LIBS="$ac_save_LIBS"
|
|
||||||
CFLAGS="$ac_save_CFLAGS"
|
|
||||||
else
|
|
||||||
echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "$progname: failed program was:" >&AC_FD_CC
|
|
||||||
cat conftest.c >&AC_FD_CC
|
|
||||||
fi
|
|
||||||
rm -rf conftest*
|
|
||||||
|
|
||||||
# Do not use the global_symbol_pipe unless it works.
|
|
||||||
if test "$ac_pipe_works" = yes; then
|
|
||||||
if test x"$ac_symprfx" = x"_"; then
|
|
||||||
ac_cv_sys_symbol_underscore=yes
|
|
||||||
else
|
|
||||||
ac_cv_sys_symbol_underscore=no
|
|
||||||
fi
|
|
||||||
break
|
|
||||||
else
|
|
||||||
ac_cv_sys_global_symbol_pipe=
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
])
|
|
||||||
|
|
||||||
ac_result=yes
|
|
||||||
if test -z "$ac_cv_sys_global_symbol_pipe"; then
|
|
||||||
ac_result=no
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT($ac_result)
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
|
|
||||||
AC_DEFUN(AC_SYS_LIBTOOL_CYGWIN,
|
|
||||||
[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
|
||||||
AC_CHECK_TOOL(AS, as, false)
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
|
|
||||||
# with an underscore?
|
|
||||||
AC_DEFUN(AC_SYS_SYMBOL_UNDERSCORE,
|
|
||||||
[AC_REQUIRE([AC_PROG_NM])dnl
|
|
||||||
AC_REQUIRE([AC_SYS_NM_PARSE])dnl
|
|
||||||
AC_MSG_CHECKING([for _ prefix in compiled symbols])
|
|
||||||
AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
|
|
||||||
[ac_cv_sys_symbol_underscore=no
|
|
||||||
cat > conftest.$ac_ext <<EOF
|
|
||||||
void nm_test_func(){}
|
|
||||||
int main(){nm_test_func;return 0;}
|
|
||||||
EOF
|
|
||||||
if AC_TRY_EVAL(ac_compile); then
|
|
||||||
# Now try to grab the symbols.
|
|
||||||
ac_nlist=conftest.nm
|
|
||||||
if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
|
|
||||||
# See whether the symbols have a leading underscore.
|
|
||||||
if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
|
|
||||||
ac_cv_sys_symbol_underscore=yes
|
|
||||||
else
|
|
||||||
if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "configure: failed program was:" >&AC_FD_CC
|
|
||||||
cat conftest.c >&AC_FD_CC
|
|
||||||
fi
|
|
||||||
rm -rf conftest*
|
|
||||||
])
|
|
||||||
AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
|
|
||||||
USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
|
|
||||||
AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_CHECK_LIBM - check for math library
|
|
||||||
AC_DEFUN(AC_CHECK_LIBM, [
|
|
||||||
AC_CHECK_LIB(mw, _mwvalidcheckl)
|
|
||||||
AC_CHECK_LIB(m, cos)
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
|
|
||||||
# the libltdl convenience library, adds --enable-ltdl-convenience to
|
|
||||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
|
||||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
|
||||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
|
||||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
|
||||||
# flat, and, if you're not using automake, define top_builddir as
|
|
||||||
# appropriate in the Makefiles.
|
|
||||||
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [
|
|
||||||
case "$enable_ltdl_convenience" in
|
|
||||||
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
|
|
||||||
"") enable_ltdl_convenience=yes
|
|
||||||
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
|
|
||||||
esac
|
|
||||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
|
|
||||||
# the libltdl installable library, and adds --enable-ltdl-install to
|
|
||||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
|
||||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
|
||||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
|
||||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
|
||||||
# flat, and, if you're not using automake, define top_builddir as
|
|
||||||
# appropriate in the Makefiles.
|
|
||||||
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
|
|
||||||
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [
|
|
||||||
AC_CHECK_LIB(ltdl, main, LIBLTDL="-lltdl", [
|
|
||||||
case "$enable_ltdl_install" in
|
|
||||||
no) AC_MSG_WARN([libltdl not installed, but installation disabled]) ;;
|
|
||||||
"") enable_ltdl_install=yes
|
|
||||||
ac_configure_args="$ac_configure_args --enable-ltdl-install" ;;
|
|
||||||
esac
|
|
||||||
])
|
|
||||||
if test x"$enable_ltdl_install" != x"no"; then
|
|
||||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl old names
|
|
||||||
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
|
|
||||||
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
|
|
||||||
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
|
|
||||||
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
|
|
||||||
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
|
|
||||||
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
|
|
||||||
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
|
|
||||||
AC_DEFUN(AM_SYS_NM_PARSE, [indir([AC_SYS_NM_PARSE])])dnl
|
|
||||||
AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, [indir([AC_SYS_SYMBOL_UNDERSCORE])])dnl
|
|
||||||
AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN, [indir([AC_SYS_LIBTOOL_CYGWIN])])dnl
|
|
||||||
|
|
||||||
|
|
||||||
# serial 1
|
# serial 1
|
||||||
|
|
||||||
|
|
116
configure.in
116
configure.in
|
@ -299,25 +299,25 @@ fi
|
||||||
#
|
#
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
AC_MSG_CHECKING(how to set a stream file descriptor)
|
dnl AC_MSG_CHECKING(how to set a stream file descriptor)
|
||||||
AC_CACHE_VAL(scm_cv_fd_setter,
|
dnl AC_CACHE_VAL(scm_cv_fd_setter,
|
||||||
AC_TRY_COMPILE([#include <stdio.h>],
|
dnl AC_TRY_COMPILE([#include <stdio.h>],
|
||||||
[stdout->_file = 1],
|
dnl [stdout->_file = 1],
|
||||||
scm_cv_fd_setter="_file",
|
dnl scm_cv_fd_setter="_file",
|
||||||
AC_TRY_COMPILE([#include <stdio.h>],
|
dnl AC_TRY_COMPILE([#include <stdio.h>],
|
||||||
[stdout->__file = 1],
|
dnl [stdout->__file = 1],
|
||||||
scm_cv_fd_setter="__file",
|
dnl scm_cv_fd_setter="__file",
|
||||||
AC_TRY_COMPILE([#include <stdio.h>],
|
dnl AC_TRY_COMPILE([#include <stdio.h>],
|
||||||
[stdout->_fileno = 1],
|
dnl [stdout->_fileno = 1],
|
||||||
scm_cv_fd_setter="_fileno",
|
dnl scm_cv_fd_setter="_fileno",
|
||||||
scm_cv_fd_setter=""))))
|
dnl scm_cv_fd_setter=""))))
|
||||||
|
|
||||||
if test "$scm_cv_fd_setter"; then
|
dnl if test "$scm_cv_fd_setter"; then
|
||||||
AC_MSG_RESULT($scm_cv_fd_setter)
|
dnl AC_MSG_RESULT($scm_cv_fd_setter)
|
||||||
AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
|
dnl AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
|
||||||
else
|
dnl else
|
||||||
AC_MSG_RESULT(we couldn't do it!)
|
dnl AC_MSG_RESULT(we couldn't do it!)
|
||||||
fi
|
dnl fi
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# How to find out whether a FILE structure contains buffered data.
|
# How to find out whether a FILE structure contains buffered data.
|
||||||
|
@ -331,46 +331,46 @@ fi
|
||||||
# These can also be known as _IO_read_ptr and _IO_read_end.
|
# These can also be known as _IO_read_ptr and _IO_read_end.
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
AC_MSG_CHECKING(how to get buffer char count from FILE structure)
|
dnl AC_MSG_CHECKING(how to get buffer char count from FILE structure)
|
||||||
AC_CACHE_VAL(scm_cv_struct_file_count,
|
dnl AC_CACHE_VAL(scm_cv_struct_file_count,
|
||||||
AC_TRY_COMPILE([#include <stdio.h>],
|
dnl AC_TRY_COMPILE([#include <stdio.h>],
|
||||||
[FILE *f = stdin; f->_cnt = 0],
|
dnl [FILE *f = stdin; f->_cnt = 0],
|
||||||
scm_cv_struct_file_count="_cnt",
|
dnl scm_cv_struct_file_count="_cnt",
|
||||||
AC_TRY_COMPILE([#include <stdio.h>],
|
dnl AC_TRY_COMPILE([#include <stdio.h>],
|
||||||
[FILE *f = stdin; f->__cnt = 0],
|
dnl [FILE *f = stdin; f->__cnt = 0],
|
||||||
scm_cv_struct_file_count="__cnt",
|
dnl scm_cv_struct_file_count="__cnt",
|
||||||
AC_TRY_COMPILE([#include <stdio.h>],
|
dnl AC_TRY_COMPILE([#include <stdio.h>],
|
||||||
[FILE *f = stdin; f->_r = 0],
|
dnl [FILE *f = stdin; f->_r = 0],
|
||||||
scm_cv_struct_file_count="_r",
|
dnl scm_cv_struct_file_count="_r",
|
||||||
AC_TRY_COMPILE([#include <stdio.h>],
|
dnl AC_TRY_COMPILE([#include <stdio.h>],
|
||||||
[FILE *f = stdin; f->readCount = 0],
|
dnl [FILE *f = stdin; f->readCount = 0],
|
||||||
scm_cv_struct_file_count="readCount",
|
dnl scm_cv_struct_file_count="readCount",
|
||||||
scm_cv_struct_file_count="")))))
|
dnl scm_cv_struct_file_count="")))))
|
||||||
if test "$scm_cv_struct_file_count"; then
|
dnl if test "$scm_cv_struct_file_count"; then
|
||||||
AC_MSG_RESULT($scm_cv_struct_file_count)
|
dnl AC_MSG_RESULT($scm_cv_struct_file_count)
|
||||||
AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
|
dnl AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
|
||||||
else
|
dnl else
|
||||||
AC_CACHE_VAL(scm_cv_struct_file_gptr,
|
dnl AC_CACHE_VAL(scm_cv_struct_file_gptr,
|
||||||
AC_TRY_COMPILE([#include <stdio.h>],
|
dnl AC_TRY_COMPILE([#include <stdio.h>],
|
||||||
[FILE *f = stdin; f->_gptr = f->egptr;],
|
dnl [FILE *f = stdin; f->_gptr = f->egptr;],
|
||||||
scm_cv_struct_file_gptr=1,
|
dnl scm_cv_struct_file_gptr=1,
|
||||||
scm_cv_struct_file_gptr=""))
|
dnl scm_cv_struct_file_gptr=""))
|
||||||
if test "$scm_cv_struct_gptr"; then
|
dnl if test "$scm_cv_struct_gptr"; then
|
||||||
AC_MSG_RESULT(gptr)
|
dnl AC_MSG_RESULT(gptr)
|
||||||
AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
|
dnl AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
|
||||||
else
|
dnl else
|
||||||
AC_CACHE_VAL(scm_cv_struct_file_readptr,
|
dnl AC_CACHE_VAL(scm_cv_struct_file_readptr,
|
||||||
AC_TRY_COMPILE([#include <stdio.h>],
|
dnl AC_TRY_COMPILE([#include <stdio.h>],
|
||||||
[FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
|
dnl [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
|
||||||
scm_cv_struct_file_readptr=1))
|
dnl scm_cv_struct_file_readptr=1))
|
||||||
if test "$scm_cv_struct_file_readptr"; then
|
dnl if test "$scm_cv_struct_file_readptr"; then
|
||||||
AC_MSG_RESULT(read_ptr)
|
dnl AC_MSG_RESULT(read_ptr)
|
||||||
AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
|
dnl AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
|
||||||
else
|
dnl else
|
||||||
AC_MSG_RESULT(we couldn't do it!)
|
dnl AC_MSG_RESULT(we couldn't do it!)
|
||||||
fi
|
dnl fi
|
||||||
fi
|
dnl fi
|
||||||
fi
|
dnl fi
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|
|
@ -59,11 +59,9 @@ PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
host_alias = @host_alias@
|
host_alias = @host_alias@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
AS = @AS@
|
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
DLLTOOL = @DLLTOOL@
|
|
||||||
GUILE_LIBS = @GUILE_LIBS@
|
GUILE_LIBS = @GUILE_LIBS@
|
||||||
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
||||||
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
||||||
|
@ -76,7 +74,6 @@ LN_S = @LN_S@
|
||||||
MAINT = @MAINT@
|
MAINT = @MAINT@
|
||||||
MAKEINFO = @MAKEINFO@
|
MAKEINFO = @MAKEINFO@
|
||||||
NM = @NM@
|
NM = @NM@
|
||||||
OBJDUMP = @OBJDUMP@
|
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
@set UPDATED 19 October 1998
|
@set UPDATED 27 June 1999
|
||||||
@set EDITION 1.3.1
|
@set EDITION 1.3.1
|
||||||
@set VERSION 1.3.1
|
@set VERSION 1.3.1
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
@set UPDATED 19 October 1998
|
@set UPDATED 27 June 1999
|
||||||
@set EDITION 1.3.1
|
@set EDITION 1.3.1
|
||||||
@set VERSION 1.3.1
|
@set VERSION 1.3.1
|
||||||
|
|
|
@ -59,11 +59,9 @@ PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
host_alias = @host_alias@
|
host_alias = @host_alias@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
AS = @AS@
|
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
DLLTOOL = @DLLTOOL@
|
|
||||||
GUILE_LIBS = @GUILE_LIBS@
|
GUILE_LIBS = @GUILE_LIBS@
|
||||||
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
||||||
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
||||||
|
@ -76,7 +74,6 @@ LN_S = @LN_S@
|
||||||
MAINT = @MAINT@
|
MAINT = @MAINT@
|
||||||
MAKEINFO = @MAKEINFO@
|
MAKEINFO = @MAKEINFO@
|
||||||
NM = @NM@
|
NM = @NM@
|
||||||
OBJDUMP = @OBJDUMP@
|
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
|
|
|
@ -59,11 +59,9 @@ PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
host_alias = @host_alias@
|
host_alias = @host_alias@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
AS = @AS@
|
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
DLLTOOL = @DLLTOOL@
|
|
||||||
GUILE_LIBS = @GUILE_LIBS@
|
GUILE_LIBS = @GUILE_LIBS@
|
||||||
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
||||||
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
||||||
|
@ -83,7 +81,6 @@ THREAD_CPPFLAGS = @THREAD_CPPFLAGS@
|
||||||
THREAD_LIBS_INSTALLED = @THREAD_LIBS_INSTALLED@
|
THREAD_LIBS_INSTALLED = @THREAD_LIBS_INSTALLED@
|
||||||
THREAD_LIBS_LOCAL = @THREAD_LIBS_LOCAL@
|
THREAD_LIBS_LOCAL = @THREAD_LIBS_LOCAL@
|
||||||
THREAD_PACKAGE = @THREAD_PACKAGE@
|
THREAD_PACKAGE = @THREAD_PACKAGE@
|
||||||
USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@
|
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
qtdmdb_s = @qtdmdb_s@
|
qtdmdb_s = @qtdmdb_s@
|
||||||
qthread_asflags = @qthread_asflags@
|
qthread_asflags = @qthread_asflags@
|
||||||
|
|
|
@ -1,3 +1,60 @@
|
||||||
|
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
|
||||||
|
|
||||||
|
* strports.c (scm_strprint_obj): bug fix: get pt from the port,
|
||||||
|
not from the parameter obj. (Thanks to Eric Moore.)
|
||||||
|
|
||||||
|
* ports.h: SCM_CRDY, SCM_CUC, SCM_CRDYP, SCM_SETRDY, SCM_CUNGET,
|
||||||
|
SCM_CGETUN, SCM_CLRDY, SCM_TRY_CLRDY, SCM_N_READY_CHARS: deleted.
|
||||||
|
|
||||||
|
* strings.c (scm_make_string): throw error if 2nd arg isn't
|
||||||
|
a char.
|
||||||
|
|
||||||
|
* unif.c (scm_uniform_array_read_x): fix reading from a port.
|
||||||
|
allow non-fports.
|
||||||
|
(scm_uniform_array_write): likewise.
|
||||||
|
|
||||||
|
1999-06-29 Gary Houston <ghouston@easynet.co.uk>
|
||||||
|
|
||||||
|
* ports.c (scm_drain_input): rewritten.
|
||||||
|
|
||||||
|
* fports.c (local_fclose): check putback_buf.
|
||||||
|
(local_read_flush): likewise.
|
||||||
|
|
||||||
|
* ports.c (scm_remove_from_port_table): maybe free putback_buf.
|
||||||
|
|
||||||
|
* ports.h (scm_port): replace cbuf/cbufend/cp with putback_buf/
|
||||||
|
putback_buf_size.
|
||||||
|
(SCM_INITIAL_PUTBACK_BUF_SIZE): renamed from SCM_INITIAL_CBUF_SIZE.
|
||||||
|
|
||||||
|
* ports.c (scm_grow_port_cbuf): deleted.
|
||||||
|
(scm_add_to_port_table): initialise putback_buf to 0. remove cbuf
|
||||||
|
stuff.
|
||||||
|
(scm_char_ready_p): check putback_buf
|
||||||
|
(scm_fill_buffer): likewise.
|
||||||
|
(scm_ungetc): rewritten.
|
||||||
|
|
||||||
|
1999-06-27 Gary Houston <ghouston@easynet.co.uk>
|
||||||
|
|
||||||
|
* fports.c (local_fclose): account for push-back buffer.
|
||||||
|
|
||||||
|
* ports.c (scm_char_ready_p): check the push-back buffer in
|
||||||
|
a new way.
|
||||||
|
|
||||||
|
* ioext.c (scm_do_read_line): remove the extra code to handle
|
||||||
|
the push-back buffer.
|
||||||
|
|
||||||
|
* ports.c (scm_getc): don't use SCM_CRDYP etc.
|
||||||
|
|
||||||
|
* ioext.c (scm_do_read_line): call scm_fill_buffer.
|
||||||
|
|
||||||
|
* ports.c (scm_ungetc): don't call SCM_CUNGET. reset the
|
||||||
|
read buffer pointers.
|
||||||
|
scm_fill_buffer: new procedure.
|
||||||
|
(scm_getc): call scm_fill_buffer.
|
||||||
|
|
||||||
|
* ports.h (struct scm_port): saved_read_buf, saved_read_pos,
|
||||||
|
saved_read_end: new fields.
|
||||||
|
|
||||||
1999-06-24 Mikael Djurfeldt <mdj@orjan.nada.kth.se>
|
1999-06-24 Mikael Djurfeldt <mdj@orjan.nada.kth.se>
|
||||||
|
|
||||||
* dynl-dl.c (sysdep_dynl_link): Added parenthesis around the
|
* dynl-dl.c (sysdep_dynl_link): Added parenthesis around the
|
||||||
|
|
|
@ -59,11 +59,9 @@ PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
host_alias = @host_alias@
|
host_alias = @host_alias@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
AS = @AS@
|
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
DLLTOOL = @DLLTOOL@
|
|
||||||
GUILE_LIBS = @GUILE_LIBS@
|
GUILE_LIBS = @GUILE_LIBS@
|
||||||
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
||||||
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
||||||
|
@ -76,7 +74,6 @@ LN_S = @LN_S@
|
||||||
MAINT = @MAINT@
|
MAINT = @MAINT@
|
||||||
MAKEINFO = @MAKEINFO@
|
MAKEINFO = @MAKEINFO@
|
||||||
NM = @NM@
|
NM = @NM@
|
||||||
OBJDUMP = @OBJDUMP@
|
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
|
|
|
@ -514,10 +514,13 @@ local_read_flush (SCM port)
|
||||||
scm_port *pt = SCM_PTAB_ENTRY (port);
|
scm_port *pt = SCM_PTAB_ENTRY (port);
|
||||||
int offset = pt->read_end - pt->read_pos;
|
int offset = pt->read_end - pt->read_pos;
|
||||||
|
|
||||||
if (SCM_CRDYP (port))
|
if (pt->read_buf == pt->putback_buf)
|
||||||
{
|
{
|
||||||
offset += SCM_N_READY_CHARS (port);
|
pt->read_buf = pt->saved_read_buf;
|
||||||
SCM_CLRDY (port);
|
pt->read_pos = pt->saved_read_pos;
|
||||||
|
pt->read_end = pt->saved_read_end;
|
||||||
|
pt->read_buf_size = pt->saved_read_buf_size;
|
||||||
|
offset += pt->read_end - pt->read_pos;
|
||||||
}
|
}
|
||||||
if (offset > 0)
|
if (offset > 0)
|
||||||
{
|
{
|
||||||
|
@ -541,6 +544,8 @@ local_fclose (SCM port)
|
||||||
SCM_SYSCALL (rv = close (fp->fdes));
|
SCM_SYSCALL (rv = close (fp->fdes));
|
||||||
if (rv == -1 && errno != EBADF)
|
if (rv == -1 && errno != EBADF)
|
||||||
scm_syserror ("local_fclose");
|
scm_syserror ("local_fclose");
|
||||||
|
if (pt->read_buf == pt->putback_buf)
|
||||||
|
pt->read_buf = pt->saved_read_buf;
|
||||||
if (pt->read_buf != &pt->shortbuf)
|
if (pt->read_buf != &pt->shortbuf)
|
||||||
free (pt->read_buf);
|
free (pt->read_buf);
|
||||||
if (pt->write_buf != &pt->shortbuf)
|
if (pt->write_buf != &pt->shortbuf)
|
||||||
|
|
|
@ -148,44 +148,8 @@ scm_do_read_line (SCM port, int *len_p)
|
||||||
|
|
||||||
/* I thought reading lines was simple. Mercy me. */
|
/* I thought reading lines was simple. Mercy me. */
|
||||||
|
|
||||||
/* If there are any pushed-back characters, read the line character
|
/* The common case: the buffer contains a complete line.
|
||||||
by character. */
|
This needs to be fast. */
|
||||||
if (SCM_CRDYP (port))
|
|
||||||
{
|
|
||||||
int buf_size = 60;
|
|
||||||
/* Invariant: buf always has buf_size + 1 characters allocated;
|
|
||||||
the `+ 1' is for the final '\0'. */
|
|
||||||
unsigned char *buf = malloc (buf_size + 1);
|
|
||||||
int buf_len = 0;
|
|
||||||
int c;
|
|
||||||
|
|
||||||
while ((c = scm_getc (port)) != EOF)
|
|
||||||
{
|
|
||||||
if (buf_len >= buf_size)
|
|
||||||
{
|
|
||||||
buf = realloc (buf, buf_size * 2 + 1);
|
|
||||||
buf_size *= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf[buf_len++] = c;
|
|
||||||
|
|
||||||
if (c == '\n')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Since SCM_CRDYP returned true, we ought to have gotten at
|
|
||||||
least one character. */
|
|
||||||
if (buf_len == 0)
|
|
||||||
abort ();
|
|
||||||
|
|
||||||
buf[buf_len] = '\0';
|
|
||||||
|
|
||||||
*len_p = buf_len;
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The common case: no unread characters, and the buffer contains
|
|
||||||
a complete line. This needs to be fast. */
|
|
||||||
if ((end = memchr (pt->read_pos, '\n', (pt->read_end - pt->read_pos)))
|
if ((end = memchr (pt->read_pos, '\n', (pt->read_end - pt->read_pos)))
|
||||||
!= 0)
|
!= 0)
|
||||||
{
|
{
|
||||||
|
@ -202,7 +166,7 @@ scm_do_read_line (SCM port, int *len_p)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There are no unread characters, and the buffer contains no newlines. */
|
/* The buffer contains no newlines. */
|
||||||
{
|
{
|
||||||
/* When live, len is always the number of characters in the
|
/* When live, len is always the number of characters in the
|
||||||
current buffer that are part of the current line. */
|
current buffer that are part of the current line. */
|
||||||
|
@ -234,7 +198,7 @@ scm_do_read_line (SCM port, int *len_p)
|
||||||
|
|
||||||
/* Get more characters. I think having fill_buffer return a
|
/* Get more characters. I think having fill_buffer return a
|
||||||
character is not terribly graceful... */
|
character is not terribly graceful... */
|
||||||
c = (scm_ptobs[SCM_PTOBNUM (port)].fill_buffer) (port);
|
c = scm_fill_buffer (port, pt);
|
||||||
if (c == EOF)
|
if (c == EOF)
|
||||||
{
|
{
|
||||||
/* If we're missing a final newline in the file, return
|
/* If we're missing a final newline in the file, return
|
||||||
|
|
161
libguile/ports.c
161
libguile/ports.c
|
@ -128,62 +128,61 @@ SCM
|
||||||
scm_char_ready_p (port)
|
scm_char_ready_p (port)
|
||||||
SCM port;
|
SCM port;
|
||||||
{
|
{
|
||||||
|
scm_port *pt = SCM_PTAB_ENTRY (port);
|
||||||
|
|
||||||
if (SCM_UNBNDP (port))
|
if (SCM_UNBNDP (port))
|
||||||
port = scm_cur_inp;
|
port = scm_cur_inp;
|
||||||
else
|
else
|
||||||
SCM_ASSERT (SCM_NIMP (port) && SCM_OPINPORTP (port), port, SCM_ARG1,
|
SCM_ASSERT (SCM_NIMP (port) && SCM_OPINPORTP (port), port, SCM_ARG1,
|
||||||
s_char_ready_p);
|
s_char_ready_p);
|
||||||
|
|
||||||
if (SCM_CRDYP (port))
|
/* if the current read buffer is filled, or the
|
||||||
|
last pushed-back char has been read and the saved buffer is
|
||||||
|
filled, result is true. */
|
||||||
|
if (pt->read_pos < pt->read_end
|
||||||
|
|| (pt->read_buf == pt->putback_buf
|
||||||
|
&& pt->saved_read_pos < pt->saved_read_end))
|
||||||
return SCM_BOOL_T;
|
return SCM_BOOL_T;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scm_port *pt = SCM_PTAB_ENTRY (port);
|
scm_ptobfuns *ptob = &scm_ptobs[SCM_PTOBNUM (port)];
|
||||||
|
|
||||||
if (pt->read_pos < pt->read_end)
|
if (ptob->input_waiting_p)
|
||||||
return SCM_BOOL_T;
|
return (ptob->input_waiting_p (port)) ? SCM_BOOL_T : SCM_BOOL_F;
|
||||||
else
|
else
|
||||||
{
|
return SCM_BOOL_T;
|
||||||
scm_ptobfuns *ptob = &scm_ptobs[SCM_PTOBNUM (port)];
|
|
||||||
|
|
||||||
if (ptob->input_waiting_p)
|
|
||||||
return (ptob->input_waiting_p (port)) ? SCM_BOOL_T : SCM_BOOL_F;
|
|
||||||
else
|
|
||||||
return SCM_BOOL_T;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear a port's read buffer, returning the contents. */
|
/* Clear a port's read buffers, returning the contents. */
|
||||||
SCM_PROC (s_drain_input, "drain-input", 1, 0, 0, scm_drain_input);
|
SCM_PROC (s_drain_input, "drain-input", 1, 0, 0, scm_drain_input);
|
||||||
SCM
|
SCM
|
||||||
scm_drain_input (SCM port)
|
scm_drain_input (SCM port)
|
||||||
{
|
{
|
||||||
SCM result;
|
SCM result;
|
||||||
scm_port *pt = SCM_PTAB_ENTRY (port);
|
scm_port *pt = SCM_PTAB_ENTRY (port);
|
||||||
int p_count;
|
int count;
|
||||||
char *dst;
|
char *dst;
|
||||||
char *p_buf;
|
|
||||||
|
|
||||||
SCM_ASSERT (SCM_NIMP (port) && SCM_OPINPORTP (port), port, SCM_ARG1,
|
SCM_ASSERT (SCM_NIMP (port) && SCM_OPINPORTP (port), port, SCM_ARG1,
|
||||||
s_drain_input);
|
s_drain_input);
|
||||||
|
|
||||||
p_count = (SCM_CRDYP (port)) ? SCM_N_READY_CHARS (port) : 0;
|
count = pt->read_end - pt->read_pos;
|
||||||
result = scm_makstr (p_count + pt->read_end - pt->read_pos, 0);
|
if (pt->read_buf == pt->putback_buf)
|
||||||
dst = SCM_CHARS (result);
|
count += pt->saved_read_end - pt->saved_read_pos;
|
||||||
p_buf = SCM_PTAB_ENTRY (port)->cp;
|
|
||||||
|
|
||||||
while (p_count > 0)
|
result = scm_makstr (count, 0);
|
||||||
{
|
dst = SCM_CHARS (result);
|
||||||
*dst++ = *p_buf--;
|
|
||||||
p_count--;
|
|
||||||
}
|
|
||||||
SCM_CLRDY (port);
|
|
||||||
|
|
||||||
while (pt->read_pos < pt->read_end)
|
while (pt->read_pos < pt->read_end)
|
||||||
|
*dst++ = *(pt->read_pos++);
|
||||||
|
|
||||||
|
if (pt->read_buf == pt->putback_buf)
|
||||||
{
|
{
|
||||||
*dst++ = *(pt->read_pos++);
|
while (pt->saved_read_pos < pt->saved_read_end)
|
||||||
|
*dst++ = *(pt->saved_read_pos++);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,10 +298,8 @@ scm_add_to_port_table (port)
|
||||||
entry->file_name = SCM_BOOL_F;
|
entry->file_name = SCM_BOOL_F;
|
||||||
entry->line_number = 0;
|
entry->line_number = 0;
|
||||||
entry->column_number = 0;
|
entry->column_number = 0;
|
||||||
entry->cp
|
entry->putback_buf = 0;
|
||||||
= entry->cbuf;
|
entry->putback_buf_size = 0;
|
||||||
entry->cbufend
|
|
||||||
= &entry->cbuf[SCM_INITIAL_CBUF_SIZE];
|
|
||||||
entry->rw_active = 0;
|
entry->rw_active = 0;
|
||||||
|
|
||||||
scm_port_table[scm_port_table_size] = entry;
|
scm_port_table[scm_port_table_size] = entry;
|
||||||
|
@ -311,7 +308,7 @@ scm_add_to_port_table (port)
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove a port from the table. */
|
/* Remove a port from the table and destroy it. */
|
||||||
|
|
||||||
void
|
void
|
||||||
scm_remove_from_port_table (port)
|
scm_remove_from_port_table (port)
|
||||||
|
@ -319,9 +316,11 @@ scm_remove_from_port_table (port)
|
||||||
{
|
{
|
||||||
scm_port *p = SCM_PTAB_ENTRY (port);
|
scm_port *p = SCM_PTAB_ENTRY (port);
|
||||||
int i = p->entry;
|
int i = p->entry;
|
||||||
/* Error if not found: too violent? May occur in GC. */
|
|
||||||
if (i >= scm_port_table_size)
|
if (i >= scm_port_table_size)
|
||||||
scm_wta (port, "Port not in table", "scm_remove_from_port_table");
|
scm_wta (port, "Port not in table", "scm_remove_from_port_table");
|
||||||
|
if (p->putback_buf)
|
||||||
|
free (p->putback_buf);
|
||||||
free (p);
|
free (p);
|
||||||
/* Since we have just freed slot i we can shrink the table by moving
|
/* Since we have just freed slot i we can shrink the table by moving
|
||||||
the last entry to that slot... */
|
the last entry to that slot... */
|
||||||
|
@ -334,6 +333,7 @@ scm_remove_from_port_table (port)
|
||||||
scm_port_table_size--;
|
scm_port_table_size--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
void
|
void
|
||||||
scm_grow_port_cbuf (port, requested)
|
scm_grow_port_cbuf (port, requested)
|
||||||
SCM port;
|
SCM port;
|
||||||
|
@ -342,12 +342,17 @@ scm_grow_port_cbuf (port, requested)
|
||||||
scm_port *p = SCM_PTAB_ENTRY (port);
|
scm_port *p = SCM_PTAB_ENTRY (port);
|
||||||
int size = p->cbufend - p->cbuf;
|
int size = p->cbufend - p->cbuf;
|
||||||
int new_size = size * 3 / 2;
|
int new_size = size * 3 / 2;
|
||||||
|
int count = p->cp - p->cbuf;
|
||||||
|
|
||||||
if (new_size < requested)
|
if (new_size < requested)
|
||||||
new_size = requested;
|
new_size = requested;
|
||||||
p = realloc (p, sizeof (*p) - SCM_INITIAL_CBUF_SIZE + new_size);
|
p = realloc (p, sizeof (*p) - SCM_INITIAL_CBUF_SIZE + new_size);
|
||||||
|
p->cp = p->cbuf + count;
|
||||||
|
p->bufend = p->cbuf + new_size;
|
||||||
scm_port_table[p->entry] = p;
|
scm_port_table[p->entry] = p;
|
||||||
SCM_SETPTAB_ENTRY (port, p);
|
SCM_SETPTAB_ENTRY (port, p);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef GUILE_DEBUG
|
#ifdef GUILE_DEBUG
|
||||||
/* Undocumented functions for debugging. */
|
/* Undocumented functions for debugging. */
|
||||||
|
@ -623,33 +628,43 @@ scm_read_char (port)
|
||||||
return SCM_MAKICHR (c);
|
return SCM_MAKICHR (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
scm_fill_buffer (SCM port, scm_port *pt)
|
||||||
|
/* port and pt refer to the same port. */
|
||||||
|
{
|
||||||
|
if (pt->read_buf == pt->putback_buf)
|
||||||
|
{
|
||||||
|
/* finished reading put-back chars. */
|
||||||
|
pt->read_buf = pt->saved_read_buf;
|
||||||
|
pt->read_pos = pt->saved_read_pos;
|
||||||
|
pt->read_end = pt->saved_read_end;
|
||||||
|
pt->read_buf_size = pt->saved_read_buf_size;
|
||||||
|
if (pt->read_pos < pt->read_end)
|
||||||
|
return *(pt->read_pos++);
|
||||||
|
}
|
||||||
|
return scm_ptobs[SCM_PTOBNUM (port)].fill_buffer (port);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
scm_getc (port)
|
scm_getc (port)
|
||||||
SCM port;
|
SCM port;
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
scm_port *pt = SCM_PTAB_ENTRY (port);
|
scm_port *pt = SCM_PTAB_ENTRY (port);
|
||||||
scm_ptobfuns *ptob = &scm_ptobs[SCM_PTOBNUM (port)];
|
|
||||||
|
|
||||||
if (pt->rw_active == SCM_PORT_WRITE)
|
if (pt->rw_active == SCM_PORT_WRITE)
|
||||||
{
|
{
|
||||||
ptob->fflush (port);
|
/* may be marginally faster than calling scm_fflush. */
|
||||||
|
scm_ptobs[SCM_PTOBNUM (port)].fflush (port);
|
||||||
}
|
}
|
||||||
if (SCM_CRDYP (port))
|
|
||||||
|
if (pt->read_pos < pt->read_end)
|
||||||
{
|
{
|
||||||
c = SCM_CGETUN (port);
|
c = *(pt->read_pos++);
|
||||||
SCM_TRY_CLRDY (port); /* Clear ungetted char */
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pt->read_pos < pt->read_end)
|
c = scm_fill_buffer (port, pt);
|
||||||
{
|
|
||||||
c = *(pt->read_pos++);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
c = ptob->fill_buffer (port);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pt->rw_random)
|
if (pt->rw_random)
|
||||||
|
@ -681,7 +696,9 @@ scm_putc (c, port)
|
||||||
|
|
||||||
if (pt->rw_active == SCM_PORT_READ)
|
if (pt->rw_active == SCM_PORT_READ)
|
||||||
ptob->read_flush (port);
|
ptob->read_flush (port);
|
||||||
|
|
||||||
*(pt->write_pos++) = (char) c;
|
*(pt->write_pos++) = (char) c;
|
||||||
|
|
||||||
if (pt->write_pos == pt->write_end)
|
if (pt->write_pos == pt->write_end)
|
||||||
ptob->fflush (port);
|
ptob->fflush (port);
|
||||||
|
|
||||||
|
@ -765,7 +782,59 @@ scm_ungetc (c, port)
|
||||||
{
|
{
|
||||||
scm_port *pt = SCM_PTAB_ENTRY (port);
|
scm_port *pt = SCM_PTAB_ENTRY (port);
|
||||||
|
|
||||||
SCM_CUNGET (c, port);
|
if (pt->read_buf == pt->putback_buf)
|
||||||
|
/* already using the put-back buffer. */
|
||||||
|
{
|
||||||
|
/* enlarge putback_buf if necessary. */
|
||||||
|
if (pt->read_end == pt->read_buf + pt->read_buf_size
|
||||||
|
&& pt->read_buf == pt->read_pos)
|
||||||
|
{
|
||||||
|
int new_size = pt->read_buf_size * 2;
|
||||||
|
unsigned char *tmp =
|
||||||
|
(unsigned char *) realloc (pt->putback_buf, new_size);
|
||||||
|
|
||||||
|
if (tmp == NULL)
|
||||||
|
scm_memory_error ("scm_ungetc");
|
||||||
|
pt->read_pos = pt->read_buf = pt->putback_buf = tmp;
|
||||||
|
pt->read_end = pt->read_buf + pt->read_buf_size;
|
||||||
|
pt->read_buf_size = pt->putback_buf_size = new_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* shift any existing bytes to buffer + 1. */
|
||||||
|
if (pt->read_pos == pt->read_end)
|
||||||
|
pt->read_end = pt->read_buf + 1;
|
||||||
|
else if (pt->read_pos != pt->read_buf + 1)
|
||||||
|
{
|
||||||
|
int count = pt->read_end - pt->read_pos;
|
||||||
|
|
||||||
|
memmove (pt->read_buf + 1, pt->read_pos, count);
|
||||||
|
pt->read_end = pt->read_buf + 1 + count;
|
||||||
|
}
|
||||||
|
|
||||||
|
pt->read_pos = pt->read_buf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* switch to the put-back buffer. */
|
||||||
|
{
|
||||||
|
if (pt->putback_buf == NULL)
|
||||||
|
{
|
||||||
|
pt->putback_buf = (char *) malloc (pt->putback_buf_size);
|
||||||
|
if (pt->putback_buf == NULL)
|
||||||
|
scm_memory_error ("scm_ungetc");
|
||||||
|
pt->putback_buf_size = SCM_INITIAL_PUTBACK_BUF_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pt->saved_read_buf = pt->read_buf;
|
||||||
|
pt->saved_read_pos = pt->read_pos;
|
||||||
|
pt->saved_read_end = pt->read_end;
|
||||||
|
pt->saved_read_buf_size = pt->read_buf_size;
|
||||||
|
|
||||||
|
pt->read_pos = pt->read_buf = pt->putback_buf;
|
||||||
|
pt->read_end = pt->read_buf + 1;
|
||||||
|
pt->read_buf_size = pt->putback_buf_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pt->read_buf = c;
|
||||||
|
|
||||||
if (pt->rw_random)
|
if (pt->rw_random)
|
||||||
pt->rw_active = SCM_PORT_READ;
|
pt->rw_active = SCM_PORT_READ;
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SCM_INITIAL_CBUF_SIZE 4
|
#define SCM_INITIAL_PUTBACK_BUF_SIZE 4
|
||||||
|
|
||||||
/* C representation of a Scheme port. */
|
/* C representation of a Scheme port. */
|
||||||
|
|
||||||
|
@ -86,11 +86,20 @@ typedef struct
|
||||||
unsigned char *read_end; /* pointer to last buffered char + 1. */
|
unsigned char *read_end; /* pointer to last buffered char + 1. */
|
||||||
off_t read_buf_size; /* size of the buffer. */
|
off_t read_buf_size; /* size of the buffer. */
|
||||||
|
|
||||||
|
/* when chars are put back into the buffer, e.g., using peek-char or
|
||||||
|
unread-string, the read-buffer pointers are switched to cbuf.
|
||||||
|
the original pointers are saved here and restored when the put-back
|
||||||
|
chars have been consumed. */
|
||||||
|
unsigned char *saved_read_buf;
|
||||||
|
const unsigned char *saved_read_pos;
|
||||||
|
unsigned char *saved_read_end;
|
||||||
|
off_t saved_read_buf_size;
|
||||||
|
|
||||||
/* write requests are saved into this buffer at write_pos until it
|
/* write requests are saved into this buffer at write_pos until it
|
||||||
reaches write_buf + write_buf_size, then the ptob flush is
|
reaches write_buf + write_buf_size, then the ptob flush is
|
||||||
called. */
|
called. */
|
||||||
|
|
||||||
unsigned char *write_buf; /* buffer start. */
|
unsigned char *write_buf; /* buffer start. */
|
||||||
unsigned char *write_pos; /* pointer to last buffered char + 1. */
|
unsigned char *write_pos; /* pointer to last buffered char + 1. */
|
||||||
unsigned char *write_end; /* pointer to end of buffer + 1. */
|
unsigned char *write_end; /* pointer to end of buffer + 1. */
|
||||||
off_t write_buf_size; /* size of the buffer. */
|
off_t write_buf_size; /* size of the buffer. */
|
||||||
|
@ -107,11 +116,9 @@ typedef struct
|
||||||
can be SCM_PORT_WRITE, SCM_PORT_READ,
|
can be SCM_PORT_WRITE, SCM_PORT_READ,
|
||||||
or 0. */
|
or 0. */
|
||||||
|
|
||||||
/* a completely separate buffer which is only used for un-read chars
|
/* a buffer for un-read chars and strings. */
|
||||||
and strings. */
|
unsigned char *putback_buf;
|
||||||
unsigned char *cp; /* where to put and get unget chars */
|
int putback_buf_size; /* allocated size of putback_buf. */
|
||||||
unsigned char *cbufend; /* points after this struct */
|
|
||||||
unsigned char cbuf[SCM_INITIAL_CBUF_SIZE]; /* must be last: may grow */
|
|
||||||
} scm_port;
|
} scm_port;
|
||||||
|
|
||||||
/* values for the rw_active flag. */
|
/* values for the rw_active flag. */
|
||||||
|
@ -135,12 +142,9 @@ extern int scm_port_table_size; /* Number of ports in scm_port_table. */
|
||||||
#define SCM_RDNG (2L<<16) /* Is it a readable port? */
|
#define SCM_RDNG (2L<<16) /* Is it a readable port? */
|
||||||
#define SCM_WRTNG (4L<<16) /* Is it writable? */
|
#define SCM_WRTNG (4L<<16) /* Is it writable? */
|
||||||
#define SCM_BUF0 (8L<<16) /* Is it unbuffered? */
|
#define SCM_BUF0 (8L<<16) /* Is it unbuffered? */
|
||||||
#define SCM_CRDY (32L<<16) /* Are there pushed back characters? */
|
/* #define SCM_CRDY (32L<<16) obsolete, for pushed back characters */
|
||||||
#define SCM_BUFLINE (64L<<16) /* Is it line-buffered? */
|
#define SCM_BUFLINE (64L<<16) /* Is it line-buffered? */
|
||||||
|
|
||||||
/* A mask used to clear the char-ready port flag. */
|
|
||||||
#define SCM_CUC (~SCM_CRDY)
|
|
||||||
|
|
||||||
#define SCM_PORTP(x) (SCM_TYP7(x)==scm_tc7_port)
|
#define SCM_PORTP(x) (SCM_TYP7(x)==scm_tc7_port)
|
||||||
#define SCM_OPPORTP(x) (((0x7f | SCM_OPN) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN))
|
#define SCM_OPPORTP(x) (((0x7f | SCM_OPN) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN))
|
||||||
#define SCM_OPINPORTP(x) (((0x7f | SCM_OPN | SCM_RDNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_RDNG))
|
#define SCM_OPINPORTP(x) (((0x7f | SCM_OPN | SCM_RDNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_RDNG))
|
||||||
|
@ -158,49 +162,11 @@ extern int scm_port_table_size; /* Number of ports in scm_port_table. */
|
||||||
#define SCM_COL(x) SCM_PTAB_ENTRY(x)->column_number
|
#define SCM_COL(x) SCM_PTAB_ENTRY(x)->column_number
|
||||||
#define SCM_REVEALED(x) SCM_PTAB_ENTRY(x)->revealed
|
#define SCM_REVEALED(x) SCM_PTAB_ENTRY(x)->revealed
|
||||||
#define SCM_SETREVEALED(x,s) (SCM_PTAB_ENTRY(x)->revealed = s)
|
#define SCM_SETREVEALED(x,s) (SCM_PTAB_ENTRY(x)->revealed = s)
|
||||||
#define SCM_CRDYP(port) (SCM_CAR (port) & SCM_CRDY)
|
|
||||||
#define SCM_SETRDY(port) {SCM_SETOR_CAR (port, SCM_CRDY);}
|
|
||||||
#define SCM_CUNGET(c, port) \
|
|
||||||
{ \
|
|
||||||
if (SCM_CRDYP (port)) \
|
|
||||||
{ \
|
|
||||||
if (++SCM_PTAB_ENTRY (port)->cp == SCM_PTAB_ENTRY (port)->cbufend) \
|
|
||||||
scm_grow_port_cbuf (port, 1); \
|
|
||||||
*SCM_PTAB_ENTRY (port)->cp = c; \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
SCM_PTAB_ENTRY (port)->cbuf[0] = c; \
|
|
||||||
SCM_SETRDY (port); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
|
|
||||||
#define SCM_CGETUN(port) (*SCM_PTAB_ENTRY (port)->cp)
|
|
||||||
#define SCM_CLRDY(port) \
|
|
||||||
{ \
|
|
||||||
SCM_PTAB_ENTRY (port)->cp = SCM_PTAB_ENTRY (port)->cbuf; \
|
|
||||||
SCM_SETAND_CAR (port, SCM_CUC); \
|
|
||||||
} \
|
|
||||||
|
|
||||||
#define SCM_TRY_CLRDY(port) \
|
|
||||||
{ \
|
|
||||||
if (SCM_PTAB_ENTRY (port)->cp == SCM_PTAB_ENTRY (port)->cbuf) \
|
|
||||||
SCM_SETAND_CAR (port, SCM_CUC); \
|
|
||||||
else \
|
|
||||||
--SCM_PTAB_ENTRY (port)->cp; \
|
|
||||||
} \
|
|
||||||
|
|
||||||
/* Returns number of unread characters in a port.
|
|
||||||
Returns wrong answer if SCM_CRDYP is false. */
|
|
||||||
#define SCM_N_READY_CHARS(port) \
|
|
||||||
(SCM_PTAB_ENTRY (port)->cp - SCM_PTAB_ENTRY (port)->cbuf + 1)
|
|
||||||
|
|
||||||
#define SCM_INCLINE(port) {SCM_LINUM (port) += 1; SCM_COL (port) = 0;}
|
#define SCM_INCLINE(port) {SCM_LINUM (port) += 1; SCM_COL (port) = 0;}
|
||||||
#define SCM_INCCOL(port) {SCM_COL (port) += 1;}
|
#define SCM_INCCOL(port) {SCM_COL (port) += 1;}
|
||||||
#define SCM_TABCOL(port) {SCM_COL (port) += 8 - SCM_COL (port) % 8;}
|
#define SCM_TABCOL(port) {SCM_COL (port) += 8 - SCM_COL (port) % 8;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct scm_ptobfuns
|
typedef struct scm_ptobfuns
|
||||||
|
@ -261,6 +227,7 @@ extern void scm_putc SCM_P ((int c, SCM port));
|
||||||
extern void scm_puts SCM_P ((char *str_data, SCM port));
|
extern void scm_puts SCM_P ((char *str_data, SCM port));
|
||||||
extern void scm_lfwrite SCM_P ((char *ptr, scm_sizet size, SCM port));
|
extern void scm_lfwrite SCM_P ((char *ptr, scm_sizet size, SCM port));
|
||||||
extern void scm_fflush SCM_P ((SCM port));
|
extern void scm_fflush SCM_P ((SCM port));
|
||||||
|
extern int scm_fill_buffer (SCM port, scm_port *pt);
|
||||||
extern int scm_getc SCM_P ((SCM port));
|
extern int scm_getc SCM_P ((SCM port));
|
||||||
extern void scm_ungetc SCM_P ((int c, SCM port));
|
extern void scm_ungetc SCM_P ((int c, SCM port));
|
||||||
extern void scm_ungets SCM_P ((char *s, int n, SCM port));
|
extern void scm_ungets SCM_P ((char *s, int n, SCM port));
|
||||||
|
|
|
@ -94,24 +94,6 @@
|
||||||
#undef DEBUG_EXTENSIONS
|
#undef DEBUG_EXTENSIONS
|
||||||
#undef READER_EXTENSIONS
|
#undef READER_EXTENSIONS
|
||||||
|
|
||||||
/* Define this if your system has a way to set a stdio stream's file
|
|
||||||
descriptor. */
|
|
||||||
#undef FD_SETTER
|
|
||||||
|
|
||||||
/* Set this to the name of a field in FILE which contains the number
|
|
||||||
of buffered characters waiting to be read. */
|
|
||||||
#undef FILE_CNT_FIELD
|
|
||||||
|
|
||||||
/* Define this if your stdio has _gptr and _egptr fields which can
|
|
||||||
be compared to give the number of buffered characters waiting to
|
|
||||||
be read. */
|
|
||||||
#undef FILE_CNT_GPTR
|
|
||||||
|
|
||||||
/* Define this if your stdio has _IO_read_ptr and _IO_read_end fields
|
|
||||||
which can be compared to give the number of buffered characters
|
|
||||||
waiting to be read. */
|
|
||||||
#undef FILE_CNT_READPTR
|
|
||||||
|
|
||||||
/* Define this if your system defines struct linger, for use with the
|
/* Define this if your system defines struct linger, for use with the
|
||||||
getsockopt and setsockopt system calls. */
|
getsockopt and setsockopt system calls. */
|
||||||
#undef HAVE_STRUCT_LINGER
|
#undef HAVE_STRUCT_LINGER
|
||||||
|
|
|
@ -246,19 +246,19 @@ scm_make_string (k, chr)
|
||||||
SCM chr;
|
SCM chr;
|
||||||
{
|
{
|
||||||
SCM res;
|
SCM res;
|
||||||
register unsigned char *dst;
|
|
||||||
register long i;
|
register long i;
|
||||||
SCM_ASSERT (SCM_INUMP (k) && (k >= 0), k, SCM_ARG1, s_make_string);
|
SCM_ASSERT (SCM_INUMP (k) && (k >= 0), k, SCM_ARG1, s_make_string);
|
||||||
i = SCM_INUM (k);
|
i = SCM_INUM (k);
|
||||||
res = scm_makstr (i, 0);
|
res = scm_makstr (i, 0);
|
||||||
dst = SCM_UCHARS (res);
|
if (!SCM_UNBNDP (chr))
|
||||||
if SCM_ICHRP (chr)
|
|
||||||
{
|
{
|
||||||
char c = SCM_ICHR (chr);
|
SCM_ASSERT (SCM_ICHRP (chr), chr, SCM_ARG2, s_make_string);
|
||||||
for (i--;i >= 0;i--)
|
{
|
||||||
{
|
unsigned char *dst = SCM_UCHARS (res);
|
||||||
dst[i] = c;
|
char c = SCM_ICHR (chr);
|
||||||
}
|
|
||||||
|
memset (dst, c, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,7 +247,7 @@ scm_strprint_obj (obj)
|
||||||
port = scm_mkstrport (SCM_MAKINUM (0), str, SCM_OPN | SCM_WRTNG, "scm_strprint_obj");
|
port = scm_mkstrport (SCM_MAKINUM (0), str, SCM_OPN | SCM_WRTNG, "scm_strprint_obj");
|
||||||
scm_prin1 (obj, port, 1);
|
scm_prin1 (obj, port, 1);
|
||||||
{
|
{
|
||||||
scm_port *pt = SCM_PTAB_ENTRY (obj);
|
scm_port *pt = SCM_PTAB_ENTRY (port);
|
||||||
SCM answer;
|
SCM answer;
|
||||||
|
|
||||||
answer = scm_makfromstr (SCM_CHARS (SCM_STREAM (port)),
|
answer = scm_makfromstr (SCM_CHARS (SCM_STREAM (port)),
|
||||||
|
|
|
@ -1469,7 +1469,7 @@ scm_uniform_array_read_x (ra, port_or_fd, start, end)
|
||||||
port_or_fd = scm_cur_inp;
|
port_or_fd = scm_cur_inp;
|
||||||
else
|
else
|
||||||
SCM_ASSERT (SCM_INUMP (port_or_fd)
|
SCM_ASSERT (SCM_INUMP (port_or_fd)
|
||||||
|| (SCM_NIMP (port_or_fd) && SCM_OPINFPORTP (port_or_fd)),
|
|| (SCM_NIMP (port_or_fd) && SCM_OPINPORTP (port_or_fd)),
|
||||||
port_or_fd, SCM_ARG2, s_uniform_array_read_x);
|
port_or_fd, SCM_ARG2, s_uniform_array_read_x);
|
||||||
vlen = SCM_LENGTH (v);
|
vlen = SCM_LENGTH (v);
|
||||||
|
|
||||||
|
@ -1542,18 +1542,49 @@ loop:
|
||||||
|
|
||||||
if (SCM_NIMP (port_or_fd))
|
if (SCM_NIMP (port_or_fd))
|
||||||
{
|
{
|
||||||
/* if we have stored a character from the port in our own buffer,
|
scm_port *pt = SCM_PTAB_ENTRY (port_or_fd);
|
||||||
push it back onto the stream. */
|
int remaining = (cend - offset) * sz;
|
||||||
/* An ungetc before an fread will not work on some systems if
|
char *dest = SCM_CHARS (v) + (cstart + offset) * sz;
|
||||||
setbuf(0). do #define NOSETBUF in scmfig.h to fix this. */
|
|
||||||
if (SCM_CRDYP (port_or_fd))
|
if (pt->rw_active == SCM_PORT_WRITE)
|
||||||
|
scm_fflush (port_or_fd);
|
||||||
|
|
||||||
|
ans = cend - offset;
|
||||||
|
while (remaining > 0)
|
||||||
{
|
{
|
||||||
ungetc (SCM_CGETUN (port_or_fd), (FILE *)SCM_STREAM (port_or_fd));
|
if (pt->read_pos < pt->read_end)
|
||||||
SCM_CLRDY (port_or_fd); /* Clear ungetted char */
|
{
|
||||||
|
int to_copy = min (pt->read_end - pt->read_pos,
|
||||||
|
remaining);
|
||||||
|
|
||||||
|
memcpy (dest, pt->read_pos, to_copy);
|
||||||
|
pt->read_pos += to_copy;
|
||||||
|
remaining -= to_copy;
|
||||||
|
dest += to_copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int ch = scm_fill_buffer (port_or_fd, pt);
|
||||||
|
|
||||||
|
if (ch == EOF)
|
||||||
|
{
|
||||||
|
if (remaining % sz != 0)
|
||||||
|
{
|
||||||
|
scm_misc_error (s_uniform_array_read_x,
|
||||||
|
"unexpected EOF",
|
||||||
|
SCM_EOL);
|
||||||
|
}
|
||||||
|
ans -= remaining / sz;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
*dest++ = ch;
|
||||||
|
remaining--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SCM_SYSCALL (ans = fread (SCM_CHARS (v) + (cstart + offset) * sz,
|
|
||||||
(scm_sizet) sz, (scm_sizet) (cend - offset),
|
if (pt->rw_random)
|
||||||
(FILE *)SCM_STREAM (port_or_fd)));
|
pt->rw_active = SCM_PORT_READ;
|
||||||
}
|
}
|
||||||
else /* file descriptor. */
|
else /* file descriptor. */
|
||||||
{
|
{
|
||||||
|
@ -1593,7 +1624,7 @@ scm_uniform_array_write (v, port_or_fd, start, end)
|
||||||
port_or_fd = scm_cur_outp;
|
port_or_fd = scm_cur_outp;
|
||||||
else
|
else
|
||||||
SCM_ASSERT (SCM_INUMP (port_or_fd)
|
SCM_ASSERT (SCM_INUMP (port_or_fd)
|
||||||
|| (SCM_NIMP (port_or_fd) && SCM_OPOUTFPORTP (port_or_fd)),
|
|| (SCM_NIMP (port_or_fd) && SCM_OPOUTPORTP (port_or_fd)),
|
||||||
port_or_fd, SCM_ARG2, s_uniform_array_write);
|
port_or_fd, SCM_ARG2, s_uniform_array_write);
|
||||||
vlen = SCM_LENGTH (v);
|
vlen = SCM_LENGTH (v);
|
||||||
|
|
||||||
|
@ -1666,9 +1697,31 @@ loop:
|
||||||
|
|
||||||
if (SCM_NIMP (port_or_fd))
|
if (SCM_NIMP (port_or_fd))
|
||||||
{
|
{
|
||||||
SCM_SYSCALL (ans = fwrite (SCM_CHARS (v) + (cstart + offset) * sz,
|
scm_port *pt = SCM_PTAB_ENTRY (port_or_fd);
|
||||||
(scm_sizet) sz, (scm_sizet) (cend - offset),
|
int remaining = (cend - offset) * sz;
|
||||||
(FILE *)SCM_STREAM (port_or_fd)));
|
char *source = SCM_CHARS (v) + (cstart + offset) * sz;
|
||||||
|
scm_ptobfuns *ptob = &scm_ptobs[SCM_PTOBNUM (port_or_fd)];
|
||||||
|
|
||||||
|
ans = cend - offset;
|
||||||
|
if (pt->rw_active == SCM_PORT_READ)
|
||||||
|
ptob->read_flush (port_or_fd);
|
||||||
|
|
||||||
|
while (remaining > 0)
|
||||||
|
{
|
||||||
|
int to_copy = min (pt->write_end - pt->write_pos, remaining);
|
||||||
|
|
||||||
|
memcpy (pt->write_pos, source, to_copy);
|
||||||
|
pt->write_pos += to_copy;
|
||||||
|
source += to_copy;
|
||||||
|
remaining -= to_copy;
|
||||||
|
if (pt->write_pos == pt->write_end)
|
||||||
|
ptob->fflush (port_or_fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pt->rw_random)
|
||||||
|
{
|
||||||
|
pt->rw_active = SCM_PORT_WRITE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else /* file descriptor. */
|
else /* file descriptor. */
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,11 +59,9 @@ PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
host_alias = @host_alias@
|
host_alias = @host_alias@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
AS = @AS@
|
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
DLLTOOL = @DLLTOOL@
|
|
||||||
GUILE_LIBS = @GUILE_LIBS@
|
GUILE_LIBS = @GUILE_LIBS@
|
||||||
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
||||||
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
||||||
|
@ -76,7 +74,6 @@ LN_S = @LN_S@
|
||||||
MAINT = @MAINT@
|
MAINT = @MAINT@
|
||||||
MAKEINFO = @MAKEINFO@
|
MAKEINFO = @MAKEINFO@
|
||||||
NM = @NM@
|
NM = @NM@
|
||||||
OBJDUMP = @OBJDUMP@
|
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
|
|
|
@ -59,11 +59,9 @@ PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
host_alias = @host_alias@
|
host_alias = @host_alias@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
AS = @AS@
|
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
DLLTOOL = @DLLTOOL@
|
|
||||||
GUILE_LIBS = @GUILE_LIBS@
|
GUILE_LIBS = @GUILE_LIBS@
|
||||||
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
||||||
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
||||||
|
@ -76,7 +74,6 @@ LN_S = @LN_S@
|
||||||
MAINT = @MAINT@
|
MAINT = @MAINT@
|
||||||
MAKEINFO = @MAKEINFO@
|
MAKEINFO = @MAKEINFO@
|
||||||
NM = @NM@
|
NM = @NM@
|
||||||
OBJDUMP = @OBJDUMP@
|
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
|
|
|
@ -59,11 +59,9 @@ PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
host_alias = @host_alias@
|
host_alias = @host_alias@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
AS = @AS@
|
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
DLLTOOL = @DLLTOOL@
|
|
||||||
GUILE_LIBS = @GUILE_LIBS@
|
GUILE_LIBS = @GUILE_LIBS@
|
||||||
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
GUILE_MAJOR_VERSION = @GUILE_MAJOR_VERSION@
|
||||||
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
GUILE_MINOR_VERSION = @GUILE_MINOR_VERSION@
|
||||||
|
@ -76,7 +74,6 @@ LN_S = @LN_S@
|
||||||
MAINT = @MAINT@
|
MAINT = @MAINT@
|
||||||
MAKEINFO = @MAKEINFO@
|
MAKEINFO = @MAKEINFO@
|
||||||
NM = @NM@
|
NM = @NM@
|
||||||
OBJDUMP = @OBJDUMP@
|
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
QTHREAD_LTLIBS = @QTHREAD_LTLIBS@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue