This commit is contained in:
Vitor Santos Costa
2017-06-22 10:41:41 +01:00
parent d7e21c80df
commit 9272a1c7d5
6 changed files with 109 additions and 62 deletions

View File

@@ -603,14 +603,19 @@ Term YAPEngine::fun(Term t)
// don't forget, on success these guys may create slots
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
if (YAP_EnterGoal(ap, nullptr, &q) == 0)
if (YAP_EnterGoal(ap, nullptr, &q) == 0) {
#if DEBUG
fprintf(stderr,"function call failed:\n");
#endif
return 0;
XREGS[arity] = Yap_GetFromSlot(o);
}
DBTerm *pt = Yap_StoreTermInDB(Yap_GetFromSlot(o), arity);
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "out %ld", o);
YAP_LeaveGoal(false, &q);
Yap_CloseHandles(q.CurSlot);
Term rc = Yap_PopTermFromDB(pt);
RECOVER_MACHINE_REGS();
return XREGS[arity];
return rc;
}
catch (YAPError e)
{