* NEWS: Corrected remarks about SCM_API.
* configure.in: Defining USE_DLL_IMPORT definition to indicate
usage of DLL import macros in `libguile/__scm.h'.
(LIBOBJS): Removed `fileblocks.o' from the list of object files.
Somehow Jim Blandy's patch from 1997 did not survive.
2001-11-04 Stefan Jahn <stefan@lkcc.org>
* configure.in (EXTRA_DEFS): Follow-up patch. Using SCM_IMPORT
instead of __SCM_IMPORT__.
* readline.c (scm_readline_init_ports): Disable input/output
stream redirection for Win32. The readline package for Win32
does not support this. The guile-readline library works fine
for command line editing.
* readline.h (SCM_RL_API): Renamed __FOO__ macros into FOO.
2001-11-04 Stefan Jahn <stefan@lkcc.org>
* Makefile.am (libguile_la_LIBADD): Added $(THREAD_LIBS_LOCAL)
here (was at guile_LDADD) which describes the dependency
correctly and allows a clean build on Win32.
* __scm.h (SCM_API): Follow-up patch. Renamed __FOO__ macros
into FOO.
* __scm.h: USE_DLL_IMPORT indicates the usage of the DLL
import macros for external libraries (libcrypt, libqthreads,
libreadline and libregex).
* coop-defs.h: Include <winsock2.h> for `struct timeval'.
* posix.c (flock): Added support for flock() in M$-Windows.
* guile.c (SCM_IMPORT): Follow-up patch. Use SCM_IMPORT instead
of __SCM_IMPORT__.
* fports.c (getflags): Differentiate reading and writing pipes
descriptors.
* filesys.c (S_IS*): Redefine all of the S_IS*() macros for
M$-Windows.
* coop.c (coop_condition_variable_timed_wait_mutex): Use
conditionalized error code if `ETIMEDOUT' is not available.
(scm_thread_usleep): Remove bogus declaration of `struct timeval
timeout'.
* numbers.c (PTRDIFF_MIN): Moved this definition where it actually
belongs. That is because NO_PREPRO_MAGIC gets undefined after
each inclusion of `num2integral.i.c'.
(SIZE_MAX): Define NO_PREPRO_MAGIC if SIZE_MAX is undefined.
2001-11-04 Stefan Jahn <stefan@lkcc.org>
* md/Makefile.am (EXTRA_DIST): Added `i386.asm'.
* md/i386.asm: New file. Contains the Intel syntax version for
nasm/tasm/masm of the file `i386.s'.
* qt.h.in: Definition of QT_API, QT_IMPORT and QT_EXPORT.
Prefixed each symbols which is meant to go into a DLL.
* Makefile.am (libqthreads_la_LDFLAGS): Put `-no-undefined'
into LDFLAGS to support linkers which do not allow unresolved
symbols inside shared libraries.
(EXTRA_DIST): Add `libqthreads.def', which is an export file
definition for M$-Windows. It defines exported symbols. This is
necessary because the M$VC linker does not know how to export
assembler symbols into a DLL.
2001-11-04 Stefan Jahn <stefan@lkcc.org>
* srfi-13.h, srfi-14.h, srfi-4.h: Follow-up patch. Renamed
__FOO__ macros into FOO.
2001-11-04 Stefan Jahn <stefan@lkcc.org>
* tests/ports.test: Run (close-port) before (delete-file) if
necessary/advisory.
+2001-11-04 Stefan Jahn <stefan@lkcc.org>
+
+ * NEWS: Corrected remarks about SCM_API.
+
+ * configure.in: Defining USE_DLL_IMPORT definition to indicate
+ usage of DLL import macros in `libguile/__scm.h'.
+ (LIBOBJS): Removed `fileblocks.o' from the list of object files.
+ Somehow Jim Blandy's patch from 1997 did not survive.
+
2001-11-02 Marius Vollmer <mvo@zagadka.ping.de>
Support for native Win32. Thanks to Stefan Jahn!
build systems which do not have symbolic links.
* configure.in: Define AC_LIBTOOL_WIN32_DLL to build clean dlls
on Win32 platforms.
- Checking for `ws2_32.dll', `winsock2.h', add `uname.o' and
- `dirent.o' and define extra compiler flags necessary to build
- clean dlls.
+ Checking for `ws2_32.dll', `winsock2.h', add `win32-uname.o'
+ and `win32-dirent.o' and define extra compiler flags necessary
+ to build clean dlls.
Check for `regcomp()' inside `-lregex'.
2001-10-26 Thien-Thi Nguyen <ttn@glug.org>
common of which is just "extern" for Unix platforms. On Win32, it can
be used to control which symbols are exported from a DLL.
-If you `#define __SCM_IMPORT__' before including <libguile.h>, SCM_API
+If you `#define SCM_IMPORT' before including <libguile.h>, SCM_API
will expand into "__declspec (dllimport) extern", which is needed for
linking to the Guile DLL in Windows.
-There are also __SCM_RL_IMPORT__, __SCM_SRFI1314_IMPORT__, and
-__SCM_SRFI4_IMPORT__, for the corresponding libraries.
+There are also SCM_RL_IMPORT, QT_IMPORT, SCM_SRFI1314_IMPORT, and
+SCM_SRFI4_IMPORT, for the corresponding libraries.
Changes since Guile 1.4:
dnl Check for Winsock and other functionality on Win32 (*not* CygWin)
dnl
EXTRA_DEFS=""
-EXTRA_LIB_DEFS=""
if test "$MINGW32" = "yes" ; then
AC_CHECK_HEADER(winsock2.h, [AC_DEFINE([HAVE_WINSOCK2_H], 1,
[Define if you have the <winsock2.h> header file.])])
AC_CHECK_LIB(ws2_32, main)
- LIBOBJS="$LIBOBJS uname.o dirent.o"
+ LIBOBJS="$LIBOBJS win32-uname.o win32-dirent.o"
if test $enable_shared = yes ; then
- EXTRA_DEFS="-D__SCM_IMPORT__ -D__REGEX_IMPORT__ -D__CRYPT_IMPORT__"
- EXTRA_LIB_DEFS="-D__REGEX_IMPORT__ -D__CRYPT_IMPORT__"
+ EXTRA_DEFS="-DSCM_IMPORT"
+ AC_DEFINE(USE_DLL_IMPORT, 1,
+ [Define if you need additional CPP macros on Win32 platforms.])
fi
fi
AC_SUBST(EXTRA_DEFS)
-AC_SUBST(EXTRA_LIB_DEFS)
dnl Check for dynamic linking
AC_PROG_AWK
+## Remove fileblocks.o from the object list. This file gets added by
+## the Autoconf macro AC_STRUCT_ST_BLOCKS. But there is no need.
+LIBOBJS="`echo ${LIBOBJS} | sed 's/fileblocks\.o//g'`"
+
## If we're creating a shared library (using libtool!), then we'll
## need to generate a list of .lo files corresponding to the .o files
## given in LIBOBJS. We'll call it LIBLOBJS.
+2001-11-04 Stefan Jahn <stefan@lkcc.org>
+
+ * configure.in (EXTRA_DEFS): Follow-up patch. Using SCM_IMPORT
+ instead of __SCM_IMPORT__.
+
+ * readline.c (scm_readline_init_ports): Disable input/output
+ stream redirection for Win32. The readline package for Win32
+ does not support this. The guile-readline library works fine
+ for command line editing.
+
+ * readline.h (SCM_RL_API): Renamed __FOO__ macros into FOO.
+
2001-11-02 Marius Vollmer <mvo@zagadka.ping.de>
Support for native Win32. Thanks to Stefan Jahn!
EXTRA_DEFS=""
if test "$MINGW32" = "yes" ; then
if test $enable_shared = yes ; then
- EXTRA_DEFS="-D__SCM_IMPORT__ -D__READLINE_IMPORT__"
+ EXTRA_DEFS="-DSCM_IMPORT"
fi
fi
AC_SUBST(EXTRA_DEFS)
(void *) SCM_UNPACK (text),
handle_error, 0);
+#ifndef __MINGW32__
fclose (rl_instream);
fclose (rl_outstream);
+#endif
--in_readline;
return ans;
rl_free_line_state ();
rl_cleanup_after_signal ();
fputc ('\n', rl_outstream); /* We don't want next output on this line */
+#ifndef __MINGW32__
fclose (rl_instream);
fclose (rl_outstream);
+#endif
--in_readline;
scm_handle_by_throw (data, tag, args);
return SCM_UNSPECIFIED; /* never reached */
}
input_port = inp;
+#ifndef __MINGW32__
rl_instream = stream_from_fport (inp, "r", s_scm_readline);
rl_outstream = stream_from_fport (outp, "w", s_scm_readline);
+#endif
}
static int
match_paren (int x, int k)
{
- int tmp, fno;
+ int tmp;
+#ifndef __MINGW32__
+ int fno;
SELECT_TYPE readset;
struct timeval timeout;
-
+#endif
+
rl_insert (x, k);
if (!SCM_READLINE_BOUNCE_PARENS)
return 0;
&& rl_line_buffer[rl_point - 2] == '\\')
return 0;
+#ifndef __MINGW32__
tmp = 1000 * SCM_READLINE_BOUNCE_PARENS;
timeout.tv_sec = tmp / 1000000;
timeout.tv_usec = tmp % 1000000;
FD_ZERO (&readset);
fno = fileno (rl_instream);
FD_SET (fno, &readset);
-
+#endif
+
if (rl_point > 1)
{
tmp = rl_point;
if (rl_point > -1)
{
rl_redisplay ();
+#ifndef __MINGW32__
scm_internal_select (fno + 1, &readset, NULL, NULL, &timeout);
+#else
+ WaitForSingleObject (GetStdHandle(STD_INPUT_HANDLE),
+ SCM_READLINE_BOUNCE_PARENS);
+#endif
}
rl_point = tmp;
}
#include "guile-readline/readline.x"
scm_readline_completion_function_var
= scm_c_define ("*readline-completion-function*", SCM_BOOL_F);
+#ifndef __MINGW32__
rl_getc_function = current_input_getc;
+#endif
rl_redisplay_function = redisplay;
#if defined (_RL_FUNCTION_TYPEDEF)
rl_completion_entry_function = (rl_compentry_func_t*) completion_function;
which should be exported or imported in the resulting dynamic link
library in the Win32 port. */
-#if defined (__SCM_RL_IMPORT__)
-# define SCM_RL_API __declspec (dllimport)
-#elif defined (__SCM_RL_EXPORT__) || defined (DLL_EXPORT)
-# define SCM_RL_API __declspec (dllexport)
+#if defined (SCM_RL_IMPORT)
+# define SCM_RL_API __declspec (dllimport) extern
+#elif defined (SCM_RL_EXPORT) || defined (DLL_EXPORT)
+# define SCM_RL_API __declspec (dllexport) extern
#else
# define SCM_RL_API extern
#endif
+2001-11-04 Stefan Jahn <stefan@lkcc.org>
+
+ * Makefile.am (libguile_la_LIBADD): Added $(THREAD_LIBS_LOCAL)
+ here (was at guile_LDADD) which describes the dependency
+ correctly and allows a clean build on Win32.
+
+ * __scm.h (SCM_API): Follow-up patch. Renamed __FOO__ macros
+ into FOO.
+
+ * __scm.h: USE_DLL_IMPORT indicates the usage of the DLL
+ import macros for external libraries (libcrypt, libqthreads,
+ libreadline and libregex).
+
+ * coop-defs.h: Include <winsock2.h> for `struct timeval'.
+
+ * posix.c (flock): Added support for flock() in M$-Windows.
+
+ * guile.c (SCM_IMPORT): Follow-up patch. Use SCM_IMPORT instead
+ of __SCM_IMPORT__.
+
+ * fports.c (getflags): Differentiate reading and writing pipes
+ descriptors.
+
+ * filesys.c (S_IS*): Redefine all of the S_IS*() macros for
+ M$-Windows.
+
+ * coop.c (coop_condition_variable_timed_wait_mutex): Use
+ conditionalized error code if `ETIMEDOUT' is not available.
+ (scm_thread_usleep): Remove bogus declaration of `struct timeval
+ timeout'.
+
+ * numbers.c (PTRDIFF_MIN): Moved this definition where it actually
+ belongs. That is because NO_PREPRO_MAGIC gets undefined after
+ each inclusion of `num2integral.i.c'.
+ (SIZE_MAX): Define NO_PREPRO_MAGIC if SIZE_MAX is undefined.
+
2001-11-03 Marius Vollmer <mvo@zagadka.ping.de>
* eval.c (scm_m_begin): Allow `(begin)`, with no subforms.
AUTOMAKE_OPTIONS = gnu
## Prevent automake from adding extra -I options
-DEFS = @DEFS@ @EXTRA_LIB_DEFS@
+DEFS = @DEFS@
## Check for headers in $(srcdir)/.., so that #include
## <libguile/MUMBLE.h> will find MUMBLE.h in this dir when we're
## building.
bin_PROGRAMS = guile guile_filter_doc_snarfage
guile_SOURCES = guile.c
-guile_LDADD = libguile.la ${THREAD_LIBS_LOCAL}
+guile_LDADD = libguile.la
guile_LDFLAGS = @DLPREOPEN@
guile_filter_doc_snarfage_SOURCES = c-tokenize.c
num2integral.i.c num2float.i.c win32-uname.h win32-dirent.h
libguile_la_DEPENDENCIES = @LIBLOBJS@
-libguile_la_LIBADD = @LIBLOBJS@ $(LIBLTDL)
+libguile_la_LIBADD = @LIBLOBJS@ $(LIBLTDL) $(THREAD_LIBS_LOCAL)
libguile_la_LDFLAGS = -version-info @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@ -export-dynamic -no-undefined
# These are headers visible as <guile/mumble.h>
/* SCM_API is a macro prepended to all function and data definitions
which should be exported or imported in the resulting dynamic link
- library in the Win32 port. */
+ library (DLL) in the Win32 port. */
-#if defined (__SCM_IMPORT__)
+#if defined (SCM_IMPORT)
# define SCM_API __declspec (dllimport) extern
-#elif defined (__SCM_EXPORT__) || defined (DLL_EXPORT)
+#elif defined (SCM_EXPORT) || defined (DLL_EXPORT)
# define SCM_API __declspec (dllexport) extern
#else
# define SCM_API extern
\f
+/* Define some additional CPP macros on Win32 platforms. */
+#if USE_DLL_IMPORT
+# define __REGEX_IMPORT__ 1
+# define __CRYPT_IMPORT__ 1
+# define __READLINE_IMPORT__ 1
+# define QT_IMPORT 1
+#endif
+
+\f
+
#include "libguile/tags.h"
\f
#include "libguile/iselect.h"
#endif
+#if HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+
#ifdef GUILE_PTHREAD_COMPAT
#include <pthread.h>
#endif
* If you do not wish that, delete this exception notice. */
\f
-/* $Id: coop.c,v 1.28 2001-10-06 16:30:20 mdj Exp $ */
+/* $Id: coop.c,v 1.29 2001-11-04 15:52:29 ela Exp $ */
/* Cooperative thread library, based on QuickThreads */
const struct timespec *abstime)
{
coop_t *old, *t;
+#ifdef ETIMEDOUT
int res = ETIMEDOUT;
+#elif defined (WSAETIMEDOUT)
+ int res = WSAETIMEDOUT;
+#else
+ int res = 0;
+#endif
/* coop_mutex_unlock (m); */
t = coop_qget (&(m->waiting));
{
/* We're so cheap. */
scm_thread_sleep (usec / 1000000);
- struct timeval timeout;
return 0; /* Maybe we should calculate actual time slept,
but this is faster... :) */
}
/* The MinGW gcc does not define the S_ISSOCK macro. Any other native Windows
compiler like BorlandC or MSVC has none of these macros defined. */
#ifdef __MINGW32__
-# define _S_IFSOCK 0xC000
-# define S_ISSOCK(mode) (((mode) & _S_IFMT) == _S_IFSOCK)
-#endif
-#if defined (__BORLANDC__) || defined (_MSC_VER)
-# define _S_IFBLK 0x3000
-# define S_ISBLK(mode) (((mode) & _S_IFMT) == _S_IFBLK)
+
+# ifdef _S_IFIFO
+# undef _S_IFIFO
+# endif
+# ifdef _S_IFCHR
+# undef _S_IFCHR
+# endif
+# ifdef _S_IFBLK
+# undef _S_IFBLK
+# endif
+# ifdef _S_IFDIR
+# undef _S_IFDIR
+# endif
+# ifdef _S_IFREG
+# undef _S_IFREG
+# endif
+# ifdef _S_IFSOCK
+# undef _S_IFSOCK
+# endif
+
+# define _S_IFIFO 0x1000 /* FIFO */
+# define _S_IFCHR 0x2000 /* Character */
+# define _S_IFBLK 0x3000 /* Block */
+# define _S_IFDIR 0x4000 /* Directory */
+# define _S_IFREG 0x8000 /* Regular */
+# define _S_IFSOCK 0xC000 /* Socket */
+
+# ifdef S_ISBLK
+# undef S_ISBLK
+# endif
+# ifdef S_ISFIFO
+# undef S_ISFIFO
+# endif
+# ifdef S_ISCHR
+# undef S_ISCHR
+# endif
+# ifdef S_ISDIR
+# undef S_ISDIR
+# endif
+# ifdef S_ISREG
+# undef S_ISREG
+# endif
+# ifdef S_ISSOCK
+# undef S_ISSOCK
+# endif
+
+# define S_ISBLK(mode) (((mode) & _S_IFMT) == _S_IFBLK)
# define S_ISFIFO(mode) (((mode) & _S_IFMT) == _S_IFIFO)
-# define S_ISCHR(mode) (((mode) & _S_IFMT) == _S_IFCHR)
-# define S_ISDIR(mode) (((mode) & _S_IFMT) == _S_IFDIR)
-# define S_ISREG(mode) (((mode) & _S_IFMT) == _S_IFREG)
-#endif
+# define S_ISCHR(mode) (((mode) & _S_IFMT) == _S_IFCHR)
+# define S_ISDIR(mode) (((mode) & _S_IFMT) == _S_IFDIR)
+# define S_ISREG(mode) (((mode) & _S_IFMT) == _S_IFREG)
+# define S_ISSOCK(mode) (((mode) & _S_IFMT) == _S_IFSOCK)
+
+#endif /* __MINGW32__ */
/* Some more definitions for the native Windows port. */
#ifdef __MINGW32__
{
/* Or an anonymous pipe handle ? */
if (buf.st_mode & _S_IFIFO)
- flags = O_RDWR;
+ flags = PeekNamedPipe ((HANDLE) _get_osfhandle (fdes), NULL, 0,
+ NULL, NULL, NULL) ? O_RDONLY : O_WRONLY;
/* stdin ? */
else if (fdes == fileno (stdin) && isatty (fdes))
flags = O_RDONLY;
system. For now, please don't put interesting code in here. */
#ifdef __MINGW32__
-# define __SCM_IMPORT__ 1
+# define SCM_IMPORT 1
#endif
#include <libguile.h>
#define NEED_CHECK
#else
#ifdef UNSIGNED
- /*#if MAX_VALUE > SCM_MOST_POSITIVE_FIXNUM*/
+#if MAX_VALUE>SCM_MOST_POSITIVE_FIXNUM
#define NEED_CHECK
- /*#endif*/
+#endif
#else
- /*#if MIN_VALUE<SCM_MOST_NEGATIVE_FIXNUM || MAX_VALUE>SCM_MOST_POSITIVE_FIXNUM*/
+#if MIN_VALUE<SCM_MOST_NEGATIVE_FIXNUM || MAX_VALUE>SCM_MOST_POSITIVE_FIXNUM
#define NEED_CHECK
- /*#endif*/
+#endif
#endif
#endif
# endif
#endif
-#ifndef SIZE_MAX
-#define SIZE_MAX ((size_t) (-1))
-#endif
-
-#ifndef PTRDIFF_MIN
-/* the below is not really guaranteed to work (I think), but probably does: */
-#define PTRDIFF_MIN ((ptrdiff_t) ((ptrdiff_t)1 << (sizeof (ptrdiff_t)*8 - 1)))
-/* this prevents num2integral.c.i from using PTRDIFF_MIN in
- preprocessor expressions. */
-#define NO_PREPRO_MAGIC
-#endif
-
-#ifndef PTRDIFF_MAX
-#define PTRDIFF_MAX (~ PTRDIFF_MIN)
-#endif
-
#define NUM2INTEGRAL scm_num2short
#define INTEGRAL2NUM scm_short2num
#define INTEGRAL2BIG scm_i_short2big
#define MAX_VALUE ULONG_MAX
#include "libguile/num2integral.i.c"
+#ifndef PTRDIFF_MIN
+/* the below is not really guaranteed to work (I think), but probably does: */
+#define PTRDIFF_MIN ((ptrdiff_t) ((ptrdiff_t)1 << (sizeof (ptrdiff_t)*8 - 1)))
+/* this prevents num2integral.c.i from using PTRDIFF_MIN in
+ preprocessor expressions. */
+#define NO_PREPRO_MAGIC
+#endif
+
+#ifndef PTRDIFF_MAX
+#define PTRDIFF_MAX (~ PTRDIFF_MIN)
+#endif
+
#define NUM2INTEGRAL scm_num2ptrdiff
#define INTEGRAL2NUM scm_ptrdiff2num
#define INTEGRAL2BIG scm_i_ptrdiff2big
#define MAX_VALUE PTRDIFF_MAX
#include "libguile/num2integral.i.c"
+#ifndef SIZE_MAX
+#define SIZE_MAX ((size_t) (-1))
+#define NO_PREPRO_MAGIC
+#endif
+
#define NUM2INTEGRAL scm_num2size
#define INTEGRAL2NUM scm_size2num
#define INTEGRAL2BIG scm_i_size2big
#undef FUNC_NAME
#endif /* HAVE_GETPASS */
-#if HAVE_FLOCK
+/* Wrapper function for flock() support under M$-Windows. */
+#ifdef __MINGW32__
+# include <io.h>
+# include <sys/locking.h>
+# include <errno.h>
+# ifndef _LK_UNLCK
+ /* Current MinGW package fails to define this. *sigh* */
+# define _LK_UNLCK 0
+# endif
+# define LOCK_EX 1
+# define LOCK_UN 2
+# define LOCK_SH 4
+# define LOCK_NB 8
+
+static int flock (int fd, int operation)
+{
+ long pos, len;
+ int ret, err;
+
+ /* Disable invalid arguments. */
+ if (((operation & (LOCK_EX | LOCK_SH)) == (LOCK_EX | LOCK_SH)) ||
+ ((operation & (LOCK_EX | LOCK_UN)) == (LOCK_EX | LOCK_UN)) ||
+ ((operation & (LOCK_SH | LOCK_UN)) == (LOCK_SH | LOCK_UN)))
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* Determine mode of operation and discard unsupported ones. */
+ if (operation == (LOCK_NB | LOCK_EX))
+ operation = _LK_NBLCK;
+ else if (operation & LOCK_UN)
+ operation = _LK_UNLCK;
+ else if (operation == LOCK_EX)
+ operation = _LK_LOCK;
+ else
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* Save current file pointer and seek to beginning. */
+ if ((pos = lseek (fd, 0, SEEK_CUR)) == -1 || (len = filelength (fd)) == -1)
+ return -1;
+ lseek (fd, 0L, SEEK_SET);
+
+ /* Deadlock if necessary. */
+ do
+ {
+ ret = _locking (fd, operation, len);
+ }
+ while (ret == -1 && errno == EDEADLOCK);
+
+ /* Produce meaningful error message. */
+ if (errno == EACCES && operation == _LK_NBLCK)
+ err = EDEADLOCK;
+ else
+ err = errno;
+
+ /* Return to saved file position pointer. */
+ lseek (fd, pos, SEEK_SET);
+ errno = err;
+ return ret;
+}
+#endif /* __MINGW32__ */
+
+#if HAVE_FLOCK || defined (__MINGW32__)
SCM_DEFINE (scm_flock, "flock", 2, 0, 0,
(SCM file, SCM operation),
"Apply or remove an advisory lock on an open file.\n"
+2001-11-04 Stefan Jahn <stefan@lkcc.org>
+
+ * md/Makefile.am (EXTRA_DIST): Added `i386.asm'.
+
+ * md/i386.asm: New file. Contains the Intel syntax version for
+ nasm/tasm/masm of the file `i386.s'.
+
+ * qt.h.in: Definition of QT_API, QT_IMPORT and QT_EXPORT.
+ Prefixed each symbols which is meant to go into a DLL.
+
+ * Makefile.am (libqthreads_la_LDFLAGS): Put `-no-undefined'
+ into LDFLAGS to support linkers which do not allow unresolved
+ symbols inside shared libraries.
+ (EXTRA_DIST): Add `libqthreads.def', which is an export file
+ definition for M$-Windows. It defines exported symbols. This is
+ necessary because the M$VC linker does not know how to export
+ assembler symbols into a DLL.
+
2001-08-25 Marius Vollmer <mvo@zagadka.ping.de>
* Makefile.am, md/Makefile.am, time/Makefile.am:
libqthreads_la_SOURCES = qt.c copyright.h
libqthreads_la_LIBADD = qtmds.lo qtmdc.lo
libqthreads_la_DEPENDENCIES = qtmds.lo qtmdc.lo
-libqthreads_la_LDFLAGS = -rpath $(libdir) -version-info @LIBGUILEQTHREADS_INTERFACE_CURRENT@:@LIBGUILEQTHREADS_INTERFACE_REVISION@:@LIBGUILEQTHREADS_INTERFACE_AGE@ -export-dynamic
+libqthreads_la_LDFLAGS = -rpath $(libdir) -version-info @LIBGUILEQTHREADS_INTERFACE_CURRENT@:@LIBGUILEQTHREADS_INTERFACE_REVISION@:@LIBGUILEQTHREADS_INTERFACE_AGE@ -export-dynamic -no-undefined
OMIT_DEPENDENCIES = axp.h hppa.h i386.h ksr.h m88k.h mips.h sparc.h vax.h
${LN_S} ${srcdir}/${qtdmdb_s} qtdmdb.s
EXTRA_DIST = CHANGES README.MISC README.PORT b.h meas.c stp.c stp.h \
- Makefile.base config
+ Makefile.base config libqthreads.def
--- /dev/null
+LIBRARY libqthreads
+DESCRIPTION "libqthreads: QuickThreads Library"
+EXPORTS
+ qt_abort
+ qt_block
+ qt_blocki
+ qt_error
+ qt_null
+ qt_vargs
+ qt_vstart
i386.h i386.s i386_b.s ksr1.Makefile ksr1.h ksr1.s ksr1_b.s \
m88k.Makefile m88k.c m88k.h m88k.s m88k_b.s mips-irix5.s mips.h mips.s \
mips_b.s null.README null.c solaris.README sparc.h sparc.s sparc_b.s \
-vax.h vax.s vax_b.s
+vax.h vax.s vax_b.s i386.asm
--- /dev/null
+;; i386.asm -- assembly support.
+
+;;
+;; QuickThreads -- Threads-building toolkit.
+;; Copyright (c) 2001 Free Software Foundation, Inc.
+;;
+;; Permission to use, copy, modify and distribute this software and
+;; its documentation for any purpose and without fee is hereby
+;; granted, provided that the above copyright notice and this notice
+;; appear in all copies. This software is provided as a
+;; proof-of-concept and for demonstration purposes; there is no
+;; representation about the suitability of this software for any
+;; purpose.
+
+;; NOTE: double-labeled `_name' and `name' for System V compatability.
+;; NOTE: Comment lines start like this one, or with '//' ONLY. Sorry!
+
+;; Callee-save: %esi, %edi, %ebx, %ebp
+;; Caller-save: %eax, %ecx
+;; Can't tell: %edx (seems to work w/o saving it.)
+;;
+;; Assignment:
+;;
+;; See ``i386.h'' for the somewhat unconventional stack layout.
+
+
+ .386p
+ .model flat
+ .code
+
+ public _qt_abort
+ public qt_abort
+ public _qt_block
+ public qt_block
+ public _qt_blocki
+ public qt_blocki
+
+;; These all have the type signature
+;;
+;; void *blocking (helper, arg0, arg1, new)
+;;
+;; On procedure entry, the helper is at 4(sp), args at 8(sp) and
+;; 12(sp) and the new thread's sp at 16(sp). It *appears* that the
+;; calling convention for the 8X86 requires the caller to save all
+;; floating-point registers, this makes our life easy.
+
+;; Halt the currently-running thread. Save it's callee-save regs on
+;; to the stack, 32 bytes. Switch to the new stack (next == 16+32(sp))
+;; and call the user function (f == 4+32(sp) with arguments: old sp
+;; arg1 (8+32(sp)) and arg2 (12+32(sp)). When the user function is
+;; done, restore the new thread's state and return.
+;;
+;; `qt_abort' is (currently) an alias for `qt_block' because most of
+;; the work is shared. We could save the insns up to `qt_common' by
+;; replicating, but w/o replicating we need an inital subtract (to
+;; offset the stack as if it had been a qt_block) and then a jump
+;; to qt_common. For the cost of a jump, we might as well just do
+;; all the work.
+;;
+;; The helper function (4(sp)) can return a void* that is returned
+;; by the call to `qt_blockk{,i}'. Since we don't touch %eax in
+;; between, we get that ``for free''.
+
+_qt_abort:
+qt_abort:
+_qt_block:
+qt_block:
+_qt_blocki:
+qt_blocki:
+ push ebp ; Save callee-save, sp-=4.
+ push esi ; Save callee-save, sp-=4.
+ push edi ; Save callee-save, sp-=4.
+ push ebx ; Save callee-save, sp-=4.
+ mov eax, esp ; Remember old stack pointer.
+
+qt_common:
+ mov esp, [esp+32] ; Move to new thread.
+ push [eax+28] ; Push arg 2.
+ push [eax+24] ; Push arg 1.
+ push eax ; Push arg 0.
+ mov ebx, [eax+20] ; Get function to call.
+ call ebx ; Call f.
+ add esp, 12 ; Pop args.
+
+ pop ebx ; Restore callee-save, sp+=4.
+ pop edi ; Restore callee-save, sp+=4.
+ pop esi ; Restore callee-save, sp+=4.
+ pop ebp ; Restore callee-save, sp+=4.
+ ret ; Resume the stopped function.
+ hlt
+
+
+;; Start a varargs thread.
+
+ public _qt_vstart
+ public qt_vstart
+
+_qt_vstart:
+qt_vstart:
+ push edi ; Push `pt' arg to `startup'.
+ call ebp ; Call `startup'.
+ pop eax ; Clean up the stack.
+
+ call ebx ; Call the user's function.
+
+ push eax ; Push return from user's.
+ push edi ; Push `pt' arg to `cleanup'.
+ call esi ; Call `cleanup'.
+
+ hlt ; `cleanup' never returns.
+
+ end
/* What to do to start a varargs thread running. */
-extern void qt_vstart (void);
+QT_API void qt_vstart (void);
/* Hold 4 saved regs plus two return pcs (qt_error, qt_start) plus
pop off (preincrement, postdecrement). */
#define QT_GROW_DOWN
-extern void qt_error (void);
+QT_API void qt_error (void);
/* Push on the error return address. */
#define QT_ARGS_MD(sto) \
#ifndef QT_H
#define QT_H
+#if defined (QT_IMPORT)
+# define QT_API __declspec (dllimport) extern
+#elif defined (QT_EXPORT) || defined (DLL_EXPORT)
+# define QT_API __declspec (dllexport) extern
+#else
+# define QT_API extern
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
#define QT_VADJ(sp) (((char *)sp) + QT_VSTKBASE)
#endif
-extern qt_t *qt_vargs (qt_t *sp, int nbytes, void *vargs,
+QT_API qt_t *qt_vargs (qt_t *sp, int nbytes, void *vargs,
void *pt, qt_startup_t *startup,
qt_vuserf_t *vuserf, qt_cleanup_t *cleanup);
#endif
-extern void qt_null (void);
-extern void qt_error (void);
+QT_API void qt_null (void);
+QT_API void qt_error (void);
/* Save the state of the thread and call the helper function
using the stack of the new thread. */
/* Rearrange the parameters so that things passed to the helper
function are already in the right argument registers. */
#ifndef QT_ABORT
-extern void qt_abort (qt_helper_t *h, void *a0, void *a1, qt_t *newthread);
+QT_API void qt_abort (qt_helper_t *h, void *a0, void *a1, qt_t *newthread);
/* The following does, technically, `return' a value, but the
user had better not rely on it, since the function never
returns. */
#endif
#ifndef QT_BLOCK
-extern void *qt_block (qt_helper_t *h, void *a0, void *a1,
+QT_API void *qt_block (qt_helper_t *h, void *a0, void *a1,
qt_t *newthread);
#define QT_BLOCK(h, a0, a1, newthread) \
(qt_block (h, a0, a1, newthread))
#endif
#ifndef QT_BLOCKI
-extern void *qt_blocki (qt_helper_t *h, void *a0, void *a1,
+QT_API void *qt_blocki (qt_helper_t *h, void *a0, void *a1,
qt_t *newthread);
#define QT_BLOCKI(h, a0, a1, newthread) \
(qt_blocki (h, a0, a1, newthread))
+2001-11-04 Stefan Jahn <stefan@lkcc.org>
+
+ * srfi-13.h, srfi-14.h, srfi-4.h: Follow-up patch. Renamed
+ __FOO__ macros into FOO.
+
2001-11-03 Marius Vollmer <mvo@zagadka.ping.de>
* Makefile.am (libguile_srfi_srfi_4_la_LIBADD,
which should be exported or imported in the resulting dynamic link
library in the Win32 port. */
-#if defined (__SCM_SRFI1314_IMPORT__)
+#if defined (SCM_SRFI1314_IMPORT)
# define SCM_SRFI1314_API __declspec (dllimport) extern
-#elif defined (__SCM_SRFI1314_EXPORT__) || defined (DLL_EXPORT)
+#elif defined (SCM_SRFI1314_EXPORT) || defined (DLL_EXPORT)
# define SCM_SRFI1314_API __declspec (dllexport) extern
#else
# define SCM_SRFI1314_API extern
SCM_SRFI1314_API SCM scm_string_filter (SCM s, SCM char_pred, SCM start, SCM end);
SCM_SRFI1314_API SCM scm_string_delete (SCM s, SCM char_pred, SCM start, SCM end);
-
-
-
-
#endif /* SCM_SRFI_13_H */
which should be exported or imported in the resulting dynamic link
library in the Win32 port. */
-#if defined (__SCM_SRFI1314_IMPORT__)
+#if defined (SCM_SRFI1314_IMPORT)
# define SCM_SRFI1314_API __declspec (dllimport) extern
-#elif defined (__SCM_SRFI1314_EXPORT__) || defined (DLL_EXPORT)
+#elif defined (SCM_SRFI1314_EXPORT) || defined (DLL_EXPORT)
# define SCM_SRFI1314_API __declspec (dllexport) extern
#else
# define SCM_SRFI1314_API extern
which should be exported or imported in the resulting dynamic link
library in the Win32 port. */
-#if defined (__SCM_SRFI4_IMPORT__)
+#if defined (SCM_SRFI4_IMPORT)
# define SCM_SRFI4_API __declspec (dllimport) extern
-#elif defined (__SCM_SRFI4_EXPORT__) || defined (DLL_EXPORT)
+#elif defined (SCM_SRFI4_EXPORT) || defined (DLL_EXPORT)
# define SCM_SRFI4_API __declspec (dllexport) extern
#else
# define SCM_SRFI4_API extern
+2001-11-04 Stefan Jahn <stefan@lkcc.org>
+
+ * tests/ports.test: Run (close-port) before (delete-file) if
+ necessary/advisory.
+
2001-10-26 Dirk Herrmann <D.Herrmann@tu-bs.de>
* tests/eval.test: Added tests for promises.
(seek port -2 SEEK_END)
(pass-if "file: r/w 4"
(char=? (read-char port) #\s))
+ (close-port port)
(delete-file filename))
;;; Unbuffered input/output port with seeking.
(seek port -2 SEEK_END)
(pass-if "file: ub r/w 4"
(char=? (read-char port) #\s))
+ (close-port port)
(delete-file filename))
;;; Buffered output-only and input-only ports with seeking.
(pass-if "file: read back NUL 2"
(char=? (string-ref line 3) #\nul))
(pass-if "file: EOF"
- (eof-object? (read-char port))))
+ (eof-object? (read-char port)))
+ (close-port port))
(delete-file filename))
;;; line buffering mode.