EX changes

This commit is contained in:
Vitor Santos Costa 2010-07-27 23:29:55 +01:00
parent 07907f1839
commit 5cd55b0e0e
3 changed files with 16 additions and 13 deletions

View File

@ -2839,7 +2839,7 @@ YAP_ThreadSelf(void)
#if THREADS #if THREADS
return Yap_thread_self(); return Yap_thread_self();
#else #else
return NULL; return -2;
#endif #endif
} }

View File

@ -110,6 +110,7 @@ STATIC_PROTO(int get_coded, (int, OPCODE []));
STATIC_PROTO(void restore_codes, (void)); STATIC_PROTO(void restore_codes, (void));
STATIC_PROTO(Term AdjustDBTerm, (Term, Term *)); STATIC_PROTO(Term AdjustDBTerm, (Term, Term *));
STATIC_PROTO(void RestoreDB, (DBEntry *)); STATIC_PROTO(void RestoreDB, (DBEntry *));
STATIC_PROTO(void RestoreDBTerm, (DBTerm *, int));
STATIC_PROTO(void CleanClauses, (yamop *, yamop *,PredEntry *)); STATIC_PROTO(void CleanClauses, (yamop *, yamop *,PredEntry *));
STATIC_PROTO(void rehash, (CELL *, int, int)); STATIC_PROTO(void rehash, (CELL *, int, int));
STATIC_PROTO(void CleanCode, (PredEntry *)); STATIC_PROTO(void CleanCode, (PredEntry *));
@ -404,7 +405,7 @@ save_regs(int mode)
return -1; return -1;
if (putout(CreepFlag) < 0) if (putout(CreepFlag) < 0)
return -1; return -1;
if (putout(EX) < 0) if (putcellptr((CELL *)EX) < 0)
return -1; return -1;
#if defined(SBA) || defined(TABLING) #if defined(SBA) || defined(TABLING)
if (putcellptr(H_FZ) < 0) if (putcellptr(H_FZ) < 0)
@ -841,7 +842,7 @@ get_regs(int flag)
CreepFlag = get_cell(); CreepFlag = get_cell();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
EX = get_cell(); EX = (struct DB_TERM *)get_cellptr();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
#if defined(SBA) || defined(TABLING) #if defined(SBA) || defined(TABLING)
@ -1046,8 +1047,10 @@ restore_regs(int flag)
HB = PtoLocAdjust(HB); HB = PtoLocAdjust(HB);
YENV = PtoLocAdjust(YENV); YENV = PtoLocAdjust(YENV);
S = PtoGloAdjust(S); S = PtoGloAdjust(S);
if (EX) if (EX) {
EX = AbsAppl(PtoGloAdjust(RepAppl(EX))); EX = DBTermAdjust(EX);
RestoreDBTerm(EX, TRUE);
}
WokenGoals = AbsAppl(PtoGloAdjust(RepAppl(WokenGoals))); WokenGoals = AbsAppl(PtoGloAdjust(RepAppl(WokenGoals)));
} }
} }

View File

@ -656,7 +656,7 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
putAtom(Atom3Dots, wglb->Quote_illegal, wglb->writewch); putAtom(Atom3Dots, wglb->Quote_illegal, wglb->writewch);
return; return;
} }
if (EX != 0) if (EX)
return; return;
t = Deref(t); t = Deref(t);
if (IsVarTerm(t)) { if (IsVarTerm(t)) {
@ -668,17 +668,17 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
} else if (IsPairTerm(t)) { } else if (IsPairTerm(t)) {
if (wglb->Use_portray) { if (wglb->Use_portray) {
Term targs[1]; Term targs[1];
Term old_EX = 0L; struct DB_TERM *old_EX = NULL;
Int sl = 0; Int sl = 0;
targs[0] = t; targs[0] = t;
Yap_PutValue(AtomPortray, MkAtomTerm(AtomNil)); Yap_PutValue(AtomPortray, MkAtomTerm(AtomNil));
if (EX != 0L) old_EX = EX; if (EX) old_EX = EX;
sl = Yap_InitSlot(t); sl = Yap_InitSlot(t);
Yap_execute_goal(Yap_MkApplTerm(FunctorPortray, 1, targs), 0, 1); Yap_execute_goal(Yap_MkApplTerm(FunctorPortray, 1, targs), 0, 1);
t = Yap_GetFromSlot(sl); t = Yap_GetFromSlot(sl);
Yap_RecoverSlots(1); Yap_RecoverSlots(1);
if (old_EX != 0L) EX = old_EX; if (old_EX != NULL) EX = old_EX;
if (Yap_GetValue(AtomPortray) == MkAtomTerm(AtomTrue)) if (Yap_GetValue(AtomPortray) == MkAtomTerm(AtomTrue))
return; return;
} }
@ -760,18 +760,18 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
#endif #endif
if (wglb->Use_portray) { if (wglb->Use_portray) {
Term targs[1]; Term targs[1];
Term old_EX = 0L; struct DB_TERM *old_EX = NULL;
Int sl = 0; Int sl = 0;
targs[0] = t; targs[0] = t;
Yap_PutValue(AtomPortray, MkAtomTerm(AtomNil)); Yap_PutValue(AtomPortray, MkAtomTerm(AtomNil));
if (EX != 0L) old_EX = EX; if (EX) old_EX = EX;
sl = Yap_InitSlot(t); sl = Yap_InitSlot(t);
Yap_execute_goal(Yap_MkApplTerm(FunctorPortray, 1, targs),0, 1); Yap_execute_goal(Yap_MkApplTerm(FunctorPortray, 1, targs),0, 1);
t = Yap_GetFromSlot(sl); t = Yap_GetFromSlot(sl);
Yap_RecoverSlots(1); Yap_RecoverSlots(1);
if (old_EX != 0L) EX = old_EX; if (old_EX) EX = old_EX;
if (Yap_GetValue(AtomPortray) == MkAtomTerm(AtomTrue) || EX != 0L) if (Yap_GetValue(AtomPortray) == MkAtomTerm(AtomTrue) || EX)
return; return;
} }
if (!wglb->Ignore_ops && if (!wglb->Ignore_ops &&