1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
guile/qt/qt.h.in
Stefan Jahn 8f99e3f38b 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-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 15:52:30 +00:00

186 lines
4.9 KiB
C

#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
#include <qt/@qtmd_h@>
/* A QuickThreads thread is represented by it's current stack pointer.
To restart a thread, you merely need pass the current sp (qt_t*) to
a QuickThreads primitive. `qt_t*' is a location on the stack. To
improve type checking, represent it by a particular struct. */
typedef struct qt_t {
char dummy;
} qt_t;
/* Alignment is guaranteed to be a power of two. */
#ifndef QT_STKALIGN
#error "Need to know the machine-dependent stack alignment."
#endif
#define QT_STKROUNDUP(bytes) \
(((bytes)+QT_STKALIGN) & ~(QT_STKALIGN-1))
/* Find ``top'' of the stack, space on the stack. */
#ifndef QT_SP
#ifdef QT_GROW_DOWN
#define QT_SP(sto, size) ((qt_t *)(&((char *)(sto))[(size)]))
#endif
#ifdef QT_GROW_UP
#define QT_SP(sto, size) ((void *)(sto))
#endif
#if !defined(QT_SP)
#error "QT_H: Stack must grow up or down!"
#endif
#endif
/* The type of the user function:
For non-varargs, takes one void* function.
For varargs, takes some number of arguments. */
typedef void *(qt_userf_t)(void *pu);
typedef void *(qt_vuserf_t)(int arg0, ...);
/* For non-varargs, just call a client-supplied function,
it does all startup and cleanup, and also calls the user's
function. */
typedef void (qt_only_t)(void *pu, void *pt, qt_userf_t *userf);
/* For varargs, call `startup', then call the user's function,
then call `cleanup'. */
typedef void (qt_startup_t)(void *pt);
typedef void (qt_cleanup_t)(void *pt, void *vuserf_return);
/* Internal helper for putting stuff on stack. */
#ifndef QT_SPUT
#define QT_SPUT(top, at, val) \
(((qt_word_t *)(top))[(at)] = (qt_word_t)(val))
#endif
/* Push arguments for the non-varargs case. */
#ifndef QT_ARGS
#ifndef QT_ARGS_MD
#define QT_ARGS_MD (0)
#endif
#ifndef QT_STKBASE
#error "Need to know the machine-dependent stack allocation."
#endif
/* All things are put on the stack relative to the final value of
the stack pointer. */
#ifdef QT_GROW_DOWN
#define QT_ADJ(sp) (((char *)sp) - QT_STKBASE)
#else
#define QT_ADJ(sp) (((char *)sp) + QT_STKBASE)
#endif
#define QT_ARGS(sp, pu, pt, userf, only) \
(QT_ARGS_MD (QT_ADJ(sp)), \
QT_SPUT (QT_ADJ(sp), QT_ONLY_INDEX, only), \
QT_SPUT (QT_ADJ(sp), QT_USER_INDEX, userf), \
QT_SPUT (QT_ADJ(sp), QT_ARGT_INDEX, pt), \
QT_SPUT (QT_ADJ(sp), QT_ARGU_INDEX, pu), \
((qt_t *)QT_ADJ(sp)))
#endif
/* Push arguments for the varargs case.
Has to be a function call because initialization is an expression
and we need to loop to copy nbytes of stuff on to the stack.
But that's probably OK, it's not terribly cheap, anyway. */
#ifdef QT_VARGS_DEFAULT
#ifndef QT_VARGS_MD0
#define QT_VARGS_MD0(sp, vasize) (sp)
#endif
#ifndef QT_VARGS_MD1
#define QT_VARGS_MD1(sp) do { ; } while (0)
#endif
#ifndef QT_VSTKBASE
#error "Need base stack size for varargs functions."
#endif
/* Sometimes the stack pointer needs to munged a bit when storing
the list of arguments. */
#ifndef QT_VARGS_ADJUST
#define QT_VARGS_ADJUST(sp) (sp)
#endif
/* All things are put on the stack relative to the final value of
the stack pointer. */
#ifdef QT_GROW_DOWN
#define QT_VADJ(sp) (((char *)sp) - QT_VSTKBASE)
#else
#define QT_VADJ(sp) (((char *)sp) + QT_VSTKBASE)
#endif
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);
#ifndef QT_VARGS
#define QT_VARGS(sp, nbytes, vargs, pt, startup, vuserf, cleanup) \
(qt_vargs (sp, nbytes, vargs, pt, startup, vuserf, cleanup))
#endif
#endif
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. */
typedef void *(qt_helper_t)(qt_t *old, void *a0, void *a1);
typedef void *(qt_block_t)(qt_helper_t *helper, void *a0, void *a1,
qt_t *newthread);
/* Rearrange the parameters so that things passed to the helper
function are already in the right argument registers. */
#ifndef QT_ABORT
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. */
#define QT_ABORT(h, a0, a1, newthread) \
do { qt_abort (h, a0, a1, newthread); } while (0)
#endif
#ifndef QT_BLOCK
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
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))
#endif
#ifdef __cplusplus
} /* Match `extern "C" {' at top. */
#endif
#endif /* ndef QT_H */