make full init even before entering Prolog top-level
This commit is contained in:
parent
ceb5785120
commit
d5bf100b71
@ -3186,7 +3186,7 @@ YAP_Init(YAP_init_args *yap_init)
|
||||
Yap_AttsSize = 2048*sizeof(CELL);
|
||||
if (restore_result == DO_ONLY_CODE) {
|
||||
/* first, initialise the saved state */
|
||||
Term t_goal = MkAtomTerm(AtomStartupSavedState);
|
||||
Term t_goal = MkAtomTerm(AtomInitProlog);
|
||||
YAP_RunGoalOnce(t_goal);
|
||||
Yap_InitYaamRegs();
|
||||
/* reset stacks */
|
||||
|
11
C/qlyr.c
11
C/qlyr.c
@ -999,9 +999,13 @@ p_read_module_preds( USES_REGS1 )
|
||||
}
|
||||
|
||||
static void
|
||||
ReInitCatch(void)
|
||||
ReInitProlog(void)
|
||||
{
|
||||
Term t = Yap_MkNewApplTerm(PredHandleThrow->FunctorOfPred, PredHandleThrow->ArityOfPE);
|
||||
Term t = MkAtomTerm(AtomInitProlog);
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
Yap_init_root_frames();
|
||||
#endif /* YAPOR || TABLING */
|
||||
Yap_InitYaamRegs();
|
||||
YAP_RunGoalOnce(t);
|
||||
}
|
||||
|
||||
@ -1030,7 +1034,7 @@ p_read_program( USES_REGS1 )
|
||||
Sclose( stream );
|
||||
/* back to the top level we go */
|
||||
Yap_CloseSlots(PASS_REGS1);
|
||||
ReInitCatch();
|
||||
ReInitProlog();
|
||||
Yap_RestartYap( 3 );
|
||||
return TRUE;
|
||||
}
|
||||
@ -1044,7 +1048,6 @@ Yap_Restore(char *s, char *lib_dir)
|
||||
return -1;
|
||||
read_module(stream);
|
||||
Sclose( stream );
|
||||
ReInitCatch();
|
||||
return DO_ONLY_CODE;
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,7 @@
|
||||
AtomId = Yap_LookupAtom("id");
|
||||
AtomInf = Yap_LookupAtom("inf");
|
||||
AtomInitGoal = Yap_FullLookupAtom("$init_goal");
|
||||
AtomInitProlog = Yap_FullLookupAtom("$init_prolog");
|
||||
AtomInStackExpansion = Yap_LookupAtom("in stack expansion");
|
||||
AtomInput = Yap_LookupAtom("input");
|
||||
AtomInstantiationError = Yap_LookupAtom("instantiation_error");
|
||||
|
@ -135,6 +135,7 @@
|
||||
AtomId = AtomAdjust(AtomId);
|
||||
AtomInf = AtomAdjust(AtomInf);
|
||||
AtomInitGoal = AtomAdjust(AtomInitGoal);
|
||||
AtomInitProlog = AtomAdjust(AtomInitProlog);
|
||||
AtomInStackExpansion = AtomAdjust(AtomInStackExpansion);
|
||||
AtomInput = AtomAdjust(AtomInput);
|
||||
AtomInstantiationError = AtomAdjust(AtomInstantiationError);
|
||||
|
@ -268,6 +268,8 @@
|
||||
#define AtomInf Yap_heap_regs->AtomInf_
|
||||
Atom AtomInitGoal_;
|
||||
#define AtomInitGoal Yap_heap_regs->AtomInitGoal_
|
||||
Atom AtomInitProlog_;
|
||||
#define AtomInitProlog Yap_heap_regs->AtomInitProlog_
|
||||
Atom AtomInStackExpansion_;
|
||||
#define AtomInStackExpansion Yap_heap_regs->AtomInStackExpansion_
|
||||
Atom AtomInput_;
|
||||
|
@ -140,6 +140,7 @@ A IOMode N "io_mode"
|
||||
A Id N "id"
|
||||
A Inf N "inf"
|
||||
A InitGoal F "$init_goal"
|
||||
A InitProlog F "$init_prolog"
|
||||
A InStackExpansion N "in stack expansion"
|
||||
A Input N "input"
|
||||
A InstantiationError N "instantiation_error"
|
||||
|
22
pl/boot.yap
22
pl/boot.yap
@ -25,6 +25,9 @@ true :- true.
|
||||
'$init_system',
|
||||
'$do_live'.
|
||||
|
||||
'$init_prolog' :-
|
||||
'$init_system'.
|
||||
|
||||
'$do_live' :-
|
||||
repeat,
|
||||
'$current_module'(Module),
|
||||
@ -35,7 +38,11 @@ true :- true.
|
||||
),
|
||||
'$system_catch'('$enter_top_level',Module,Error,user:'$Error'(Error)).
|
||||
|
||||
|
||||
'$init_system' :-
|
||||
'$nb_getval'('$yap_inited', on, fail), !.
|
||||
'$init_system' :-
|
||||
nb_setval('$yap_inited', on),
|
||||
% do catch as early as possible
|
||||
(
|
||||
'$access_yap_flags'(15, 0),
|
||||
@ -165,18 +172,23 @@ true :- true.
|
||||
-> fail
|
||||
; throw(E)
|
||||
))),
|
||||
( current_predicate(_, user:rl_add_history(_))
|
||||
-> format(atom(CompleteLine), '~W~W',
|
||||
(
|
||||
current_predicate(_, user:rl_add_history(_))
|
||||
->
|
||||
format(atom(CompleteLine), '~W~W',
|
||||
[ Line, [partial(true)],
|
||||
'.', [partial(true)]
|
||||
]),
|
||||
call(user:rl_add_history(CompleteLine))
|
||||
; true
|
||||
;
|
||||
true
|
||||
),
|
||||
'$system_catch'(atom_to_term(Line, Goal, Bindings), prolog, E,
|
||||
'$system_catch'(
|
||||
atom_to_term(Line, Goal, Bindings), prolog, E,
|
||||
( print_message(error, E),
|
||||
fail
|
||||
)), !.
|
||||
)
|
||||
), !.
|
||||
|
||||
|
||||
% reset alarms when entering top-level.
|
||||
|
Reference in New Issue
Block a user