more jupytr fixes

This commit is contained in:
Vitor Santos Costa
2018-06-02 10:36:04 +01:00
parent 94a826efcc
commit 08ece03f4a
6 changed files with 2399 additions and 2296 deletions

View File

@@ -525,11 +525,10 @@ bool YAPEngine::mgoal(Term t, Term tmod, bool release) {
q.CurSlot = Yap_StartSlots();
q.p = P;
q.cp = CP;
try {
PredEntry *ap;
if (IsStringTerm(tmod))
tmod = MkAtomTerm(Yap_LookupAtom(StringOfTerm(tmod)));
YAPPredicate *p = new YAPPredicate(t, tmod, ts, "C++");
PredEntry *ap = nullptr;
if (p == nullptr || (ap = p->ap) == nullptr ||
ap->OpcodeOfPred == UNDEF_OPCODE) {
ap = rewriteUndefEngineQuery(ap, t, tmod);
@@ -555,11 +554,6 @@ bool YAPEngine::mgoal(Term t, Term tmod, bool release) {
// PyEval_RestoreThread(_save);
RECOVER_MACHINE_REGS();
return result;
} catch (...) {
YAPCatchError();
return false;
}
}
/**
* called when a query must be terminated and its state fully recovered,
@@ -722,17 +716,14 @@ PredEntry *YAPQuery::rewriteUndefQuery() {
Term ts[2];
ts[0] = CurrentModule;
ts[1] = goal;
ARG1 = goal = Yap_SaveTerm(Yap_MkApplTerm(FunctorModule, 2, ts));
ARG1 = goal = Yap_SaveTerm(Yap_MkApplTerm(FunctorCall
, 1, &goal));
return ap = PredCall;
}
PredEntry *YAPEngine::rewriteUndefEngineQuery(PredEntry *a, Term &tgoal,
Term mod) {
Term ts[2];
ts[0] = mod;
ts[1] = tgoal;
ARG1 = tgoal = Yap_SaveTerm(Yap_MkApplTerm(FunctorModule, 2, ts));
// goal = YAPTerm(Yap_MkApplTerm(FunctorMetaCall, 1, &ARG1));
tgoal = Yap_MkApplTerm(FunctorCall, 1, &tgoal);
return PredCall;
// return YAPApplTerm(FunctorUndefinedQuery, ts);