diff --git a/C/init.c b/C/init.c index e729322ed..4c32dac0d 100755 --- a/C/init.c +++ b/C/init.c @@ -165,8 +165,6 @@ int Yap_CritLocks = 0; /********* streams ********************************************/ -int Yap_c_input_stream, Yap_c_output_stream, Yap_c_error_stream; - YP_FILE *Yap_stdin; YP_FILE *Yap_stdout; YP_FILE *Yap_stderr; diff --git a/C/threads.c b/C/threads.c index 99c5d6770..b66710f0c 100755 --- a/C/threads.c +++ b/C/threads.c @@ -81,6 +81,9 @@ store_specs(int new_worker_id, UInt ssize, UInt tsize, UInt sysize, Term *tpgoal FOREIGN_ThreadHandle(new_worker_id).ssize = ssize; FOREIGN_ThreadHandle(new_worker_id).tsize = tsize; FOREIGN_ThreadHandle(new_worker_id).sysize = sysize; + FOREIGN_WL(new_worker_id)->c_input_stream = Yap_c_input_stream; + FOREIGN_WL(new_worker_id)->c_output_stream = Yap_c_output_stream; + FOREIGN_WL(new_worker_id)->c_error_stream = Yap_c_error_stream; pm = (ssize + tsize)*1024; if (!(FOREIGN_ThreadHandle(new_worker_id).stack_address = malloc(pm))) { return FALSE; diff --git a/H/dglobals.h b/H/dglobals.h index 2729af0e8..293e497b1 100644 --- a/H/dglobals.h +++ b/H/dglobals.h @@ -21,6 +21,10 @@ + +#define Yap_c_input_stream WL->c_input_stream +#define Yap_c_output_stream WL->c_output_stream +#define Yap_c_error_stream WL->c_error_stream #define OldASP WL->rinfo.old_ASP #define OldLCL0 WL->rinfo.old_LCL0 diff --git a/H/hglobals.h b/H/hglobals.h index 99843a85e..8c5a8624a 100644 --- a/H/hglobals.h +++ b/H/hglobals.h @@ -22,6 +22,10 @@ typedef struct worker_local { + int c_input_stream; + int c_output_stream; + int c_error_stream; + restoreinfo rinfo; diff --git a/H/iglobals.h b/H/iglobals.h index 622fdebeb..44c4b0e9a 100644 --- a/H/iglobals.h +++ b/H/iglobals.h @@ -22,6 +22,10 @@ static void InitWorker(int wid) { + FOREIGN_WL(wid)->c_input_stream = 0; + FOREIGN_WL(wid)->c_output_stream = 1; + FOREIGN_WL(wid)->c_error_stream = 2; + FOREIGN_WL(wid)->rinfo.old_ASP = NULL; FOREIGN_WL(wid)->rinfo.old_LCL0 = NULL; FOREIGN_WL(wid)->rinfo.old_TR = NULL; diff --git a/H/rglobals.h b/H/rglobals.h index e8681a7b5..be46ef1f7 100644 --- a/H/rglobals.h +++ b/H/rglobals.h @@ -54,6 +54,10 @@ static void RestoreWorker(int wid) { + + + + diff --git a/H/yapio.h b/H/yapio.h index c47094cf8..61dac11f4 100644 --- a/H/yapio.h +++ b/H/yapio.h @@ -322,11 +322,6 @@ Term STD_PROTO(Yap_WStringToList,(wchar_t *)); Term STD_PROTO(Yap_WStringToListOfAtoms,(wchar_t *)); Atom STD_PROTO(Yap_LookupWideAtom,(wchar_t *)); -extern int - Yap_c_input_stream, - Yap_c_output_stream, - Yap_c_error_stream; - #define YAP_INPUT_STREAM 0x01 #define YAP_OUTPUT_STREAM 0x02 #define YAP_APPEND_STREAM 0x04 diff --git a/misc/GLOBALS b/misc/GLOBALS index 8c1d74e45..3cc824da7 100644 --- a/misc/GLOBALS +++ b/misc/GLOBALS @@ -20,6 +20,11 @@ // Stuff that must be considered local to a thread or worker START_WORKER_LOCAL +// Streams +int c_input_stream Yap_c_input_stream =0 +int c_output_stream Yap_c_output_stream =1 +int c_error_stream Yap_c_error_stream =2 + /* shifts and restore: per local data-structure */ restoreinfo rinfo . rinfo.old_ASP OldASP =NULL diff --git a/packages/jpl b/packages/jpl index 7c9456b5c..6e7c68cdc 160000 --- a/packages/jpl +++ b/packages/jpl @@ -1 +1 @@ -Subproject commit 7c9456b5c9c60ab227674f7653dc226e13973484 +Subproject commit 6e7c68cdcc5d781d218b57d04f2a16b3e0bcbfca