isupport for improved SWI emulation.

This commit is contained in:
Vítor Santos Costa 2010-06-23 11:47:14 +01:00
parent 3e13be32a0
commit de2d6867ad
6 changed files with 24 additions and 0 deletions

View File

@ -22,6 +22,10 @@
#include <stdio.h>
#endif
typedef int (*SWI_PutFunction)(int, void *);
typedef int (*SWI_GetFunction)(void *);
typedef int (*SWI_CloseFunction)(void *);
#include "../include/dswiatoms.h"
#ifndef INT_KEYS_DEFAULT_SIZE

View File

@ -91,6 +91,10 @@
#define TotGcRecovered WL->tot_gc_recovered
#define LastGcTime WL->last_gc_time
#define LastSSTime WL->last_ss_time
#define FSWIStream WL->f_swi_stream
#define SWIGetc WL->swi_getc
#define SWIPutc WL->swi_putc
#define SWIClose WL->swi_close
#if defined(YAPOR) || defined(THREADS)
#define SignalLock WL->signal_lock

View File

@ -93,6 +93,10 @@ typedef struct worker_local {
YAP_ULONG_LONG tot_gc_recovered;
Int last_gc_time;
Int last_ss_time;
Functor f_swi_stream;
SWI_GetFunction swi_getc;
SWI_PutFunction swi_putc;
SWI_CloseFunction swi_close;
#if defined(YAPOR) || defined(THREADS)
lockvar signal_lock;

View File

@ -91,6 +91,10 @@ static void InitWorker(int wid) {
FOREIGN_WL(wid)->tot_gc_recovered = 0L;
FOREIGN_WL(wid)->last_gc_time = 0L;
FOREIGN_WL(wid)->last_ss_time = 0L;
FOREIGN_WL(wid)->f_swi_stream = NULL;
FOREIGN_WL(wid)->swi_getc = NULL;
FOREIGN_WL(wid)->swi_putc = NULL;
FOREIGN_WL(wid)->swi_close = NULL;
#if defined(YAPOR) || defined(THREADS)
INIT_LOCK(FOREIGN_WL(wid)->signal_lock);

View File

@ -48,6 +48,9 @@ typedef int (*GetsFunc)(int, UInt, char *);
typedef struct stream_desc
{
union {
struct {
struct io_stream *swi_ptr;
} swi_stream;
struct {
Atom name;
Term user_name;
@ -129,6 +132,7 @@ StreamDesc;
#define HAS_BOM_f 0x200000
#define RepError_Prolog_f 0x400000
#define RepError_Xml_f 0x800000
#define SWI_Stream_f 0x1000000
#define EXPAND_FILENAME 0x000080

View File

@ -92,6 +92,10 @@ static void RestoreWorker(int wid) {
#if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(FOREIGN_WL(wid)->signal_lock);