more fixes to recursive call execution and backtracking from within C-mode.
semweb java example now working.
This commit is contained in:
parent
666ef1877d
commit
eb82f5fa2a
@ -2054,7 +2054,6 @@ YAP_RestartGoal(void)
|
|||||||
{
|
{
|
||||||
int out;
|
int out;
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
|
|
||||||
if (Yap_AllowRestart) {
|
if (Yap_AllowRestart) {
|
||||||
P = (yamop *)FAILCODE;
|
P = (yamop *)FAILCODE;
|
||||||
do_putcf = myputc;
|
do_putcf = myputc;
|
||||||
@ -2650,6 +2649,8 @@ YAP_Init(YAP_init_args *yap_init)
|
|||||||
/* first, initialise the saved state */
|
/* first, initialise the saved state */
|
||||||
Term t_goal = MkAtomTerm(AtomStartupSavedState);
|
Term t_goal = MkAtomTerm(AtomStartupSavedState);
|
||||||
YAP_RunGoalOnce(t_goal);
|
YAP_RunGoalOnce(t_goal);
|
||||||
|
Yap_InitYaamRegs();
|
||||||
|
/* reset stacks */
|
||||||
return YAP_BOOT_FROM_SAVED_CODE;
|
return YAP_BOOT_FROM_SAVED_CODE;
|
||||||
} else {
|
} else {
|
||||||
return YAP_BOOT_FROM_SAVED_STACKS;
|
return YAP_BOOT_FROM_SAVED_STACKS;
|
||||||
@ -2681,6 +2682,8 @@ YAP_Init(YAP_init_args *yap_init)
|
|||||||
fgoal = Yap_MkFunctor(Yap_LookupAtom("module"), 1);
|
fgoal = Yap_MkFunctor(Yap_LookupAtom("module"), 1);
|
||||||
goal = Yap_MkApplTerm(fgoal, 1, as);
|
goal = Yap_MkApplTerm(fgoal, 1, as);
|
||||||
YAP_RunGoalOnce(goal);
|
YAP_RunGoalOnce(goal);
|
||||||
|
/* reset stacks */
|
||||||
|
Yap_InitYaamRegs();
|
||||||
}
|
}
|
||||||
Yap_PutValue(Yap_FullLookupAtom("$live"), MkAtomTerm (Yap_FullLookupAtom("$true")));
|
Yap_PutValue(Yap_FullLookupAtom("$live"), MkAtomTerm (Yap_FullLookupAtom("$true")));
|
||||||
}
|
}
|
||||||
|
4
C/exec.c
4
C/exec.c
@ -1021,9 +1021,6 @@ init_stack(int arity, CELL *pt, int top, choiceptr saved_b)
|
|||||||
collection is going up in the environment chain it doesn't get
|
collection is going up in the environment chain it doesn't get
|
||||||
confused */
|
confused */
|
||||||
EX = NULL;
|
EX = NULL;
|
||||||
/* always have an empty slots for people to use */
|
|
||||||
CurSlot = 0;
|
|
||||||
Yap_StartSlots();
|
|
||||||
// sl = Yap_InitSlot(t);
|
// sl = Yap_InitSlot(t);
|
||||||
YENV = ASP;
|
YENV = ASP;
|
||||||
YENV[E_CP] = (CELL)P;
|
YENV[E_CP] = (CELL)P;
|
||||||
@ -1644,6 +1641,7 @@ Yap_InitYaamRegs(void)
|
|||||||
EX = NULL;
|
EX = NULL;
|
||||||
init_stack(0, NULL, TRUE, NULL);
|
init_stack(0, NULL, TRUE, NULL);
|
||||||
/* the first real choice-point will also have AP=FAIL */
|
/* the first real choice-point will also have AP=FAIL */
|
||||||
|
/* always have an empty slots for people to use */
|
||||||
CurSlot = 0;
|
CurSlot = 0;
|
||||||
GlobalArena = TermNil;
|
GlobalArena = TermNil;
|
||||||
h0var = MkVarTerm();
|
h0var = MkVarTerm();
|
||||||
|
@ -2578,12 +2578,7 @@ X_API qid_t PL_open_query(module_t ctx, int flags, predicate_t p, term_t t0)
|
|||||||
Term t[2], m;
|
Term t[2], m;
|
||||||
|
|
||||||
/* ignore flags and module for now */
|
/* ignore flags and module for now */
|
||||||
if (execution == NULL)
|
|
||||||
PL_open_foreign_frame();
|
PL_open_foreign_frame();
|
||||||
if (execution->open != 0) {
|
|
||||||
YAP_Error(0, 0L, "only one query at a time allowed\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
execution->open=1;
|
execution->open=1;
|
||||||
execution->state=0;
|
execution->state=0;
|
||||||
PredicateInfo((PredEntry *)p, &yname, &arity, &m);
|
PredicateInfo((PredEntry *)p, &yname, &arity, &m);
|
||||||
@ -2617,13 +2612,13 @@ X_API qid_t PL_open_query(module_t ctx, int flags, predicate_t p, term_t t0)
|
|||||||
X_API int PL_next_solution(qid_t qi)
|
X_API int PL_next_solution(qid_t qi)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (qi->open != 1) return 0;
|
if (qi->open != 1) return 0;
|
||||||
if (setjmp(execution->env))
|
if (setjmp(execution->env))
|
||||||
return 0;
|
return 0;
|
||||||
if (qi->state == 0) {
|
if (qi->state == 0) {
|
||||||
result = YAP_RunGoal(qi->g);
|
result = YAP_RunGoal(qi->g);
|
||||||
} else {
|
} else {
|
||||||
|
Yap_AllowRestart = qi->open;
|
||||||
result = YAP_RestartGoal();
|
result = YAP_RestartGoal();
|
||||||
}
|
}
|
||||||
qi->state = 1;
|
qi->state = 1;
|
||||||
|
Reference in New Issue
Block a user