make PL_is_initialised honest :)
This commit is contained in:
parent
661b9c3b7d
commit
719089b96b
@ -182,3 +182,8 @@
|
||||
#define REMOTE Yap_global->remote
|
||||
#endif
|
||||
|
||||
#define Yap_Initialised Yap_global->initialised
|
||||
#define Yap_InitialisedFromPL Yap_global->initialised_from_pl
|
||||
#define Yap_PL_Argc Yap_global->pl_argc
|
||||
#define Yap_PL_Argv Yap_global->pl_argv
|
||||
|
||||
|
@ -183,4 +183,9 @@ typedef struct worker_shared {
|
||||
struct global_data global;
|
||||
struct local_data remote[MAX_WORKERS];
|
||||
#endif
|
||||
|
||||
int initialised;
|
||||
int initialised_from_pl;
|
||||
int pl_argc;
|
||||
char **pl_argv;
|
||||
} w_shared;
|
||||
|
@ -181,4 +181,9 @@ static void InitGlobal(void) {
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Yap_global->initialised = FALSE;
|
||||
Yap_global->initialised_from_pl = FALSE;
|
||||
Yap_global->pl_argc = 0;
|
||||
Yap_global->pl_argv = NULL;
|
||||
}
|
||||
|
@ -181,4 +181,9 @@ static void RestoreGlobal(void) {
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1984,13 +1984,24 @@ PL_initialise(int myargc, char **myargv)
|
||||
init_args.NumberWorkers = 1;
|
||||
init_args.SchedulerLoop = 10;
|
||||
init_args.DelayedReleaseLoad = 3;
|
||||
|
||||
Yap_PL_Argc = myargc;
|
||||
Yap_PL_Argv = myargv;
|
||||
Yap_InitialisedFromPL = TRUE;
|
||||
|
||||
return YAP_Init(&init_args);
|
||||
}
|
||||
|
||||
X_API int
|
||||
PL_is_initialised(int *argc, char ***argv)
|
||||
PL_is_initialised(int *argcp, char ***argvp)
|
||||
{
|
||||
return TRUE;
|
||||
if (Yap_InitialisedFromPL) {
|
||||
if (argcp)
|
||||
*argcp = Yap_PL_Argc;
|
||||
if (argvp)
|
||||
*argvp = Yap_PL_Argv;
|
||||
}
|
||||
return Yap_InitialisedFromPL;
|
||||
}
|
||||
|
||||
X_API module_t
|
||||
|
@ -205,5 +205,11 @@ struct global_data global GLOBAL void
|
||||
struct local_data remote[MAX_WORKERS] REMOTE void
|
||||
#endif
|
||||
|
||||
// initialization: tell whether the system has been initialised and by whom.
|
||||
int initialised Yap_Initialised =FALSE
|
||||
int initialised_from_pl Yap_InitialisedFromPL =FALSE
|
||||
int pl_argc Yap_PL_Argc =0
|
||||
char **pl_argv Yap_PL_Argv =NULL
|
||||
|
||||
END_WORKER_SHARED
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit cb4b299493f80d424dcd19f1928ebb2e0203bdb2
|
||||
Subproject commit fde4e853dc29532a0360cc7ac7200dff28ad606e
|
@ -1107,6 +1107,13 @@ current_stream(File, Opts, Stream) :-
|
||||
close(Stream),
|
||||
fail.
|
||||
|
||||
sformat(String, Form, Args) :-
|
||||
charsio:open_mem_write_stream(Stream),
|
||||
format(Stream, Form, Args),
|
||||
charsio:peek_mem_write_stream(Stream, [], String),
|
||||
close(Stream).
|
||||
|
||||
|
||||
'$handle_exception'(Exception, Stream, SO) :-
|
||||
set_output(SO),
|
||||
close(Stream),
|
||||
@ -1144,3 +1151,5 @@ prolog_file_name(File, PrologFileName) :-
|
||||
system:true_file_name(File, PrologFileName).
|
||||
prolog_file_name(File, PrologFileName) :-
|
||||
'$do_error'(type_error(atom,T), prolog_file_name(File, PrologFileName)).
|
||||
|
||||
s
|
Reference in New Issue
Block a user