improve SWI call interface code.
This commit is contained in:
parent
839d612367
commit
30d9257fe0
@ -1538,12 +1538,12 @@ Int
|
|||||||
YAP_Execute(PredEntry *pe, CPredicate exec_code)
|
YAP_Execute(PredEntry *pe, CPredicate exec_code)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
|
Int ret;
|
||||||
if (pe->PredFlags & SWIEnvPredFlag) {
|
if (pe->PredFlags & SWIEnvPredFlag) {
|
||||||
CPredicateV codev = (CPredicateV)exec_code;
|
CPredicateV codev = (CPredicateV)exec_code;
|
||||||
struct foreign_context ctx;
|
struct foreign_context ctx;
|
||||||
UInt i;
|
UInt i;
|
||||||
Int sl = 0;
|
Int sl = 0;
|
||||||
Int ret;
|
|
||||||
|
|
||||||
ctx.engine = NULL;
|
ctx.engine = NULL;
|
||||||
for (i=pe->ArityOfPE; i > 0; i--) {
|
for (i=pe->ArityOfPE; i > 0; i--) {
|
||||||
@ -1551,48 +1551,25 @@ YAP_Execute(PredEntry *pe, CPredicate exec_code)
|
|||||||
}
|
}
|
||||||
PP = pe;
|
PP = pe;
|
||||||
ret = ((codev)(sl,0,&ctx));
|
ret = ((codev)(sl,0,&ctx));
|
||||||
PP = NULL;
|
} else if (pe->PredFlags & CArgsPredFlag) {
|
||||||
if (!ret) {
|
|
||||||
Term t;
|
|
||||||
|
|
||||||
BallTerm = EX;
|
|
||||||
EX = NULL;
|
|
||||||
if ((t = Yap_GetException())) {
|
|
||||||
Yap_JumpToEnv(t);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
if (pe->PredFlags & CArgsPredFlag) {
|
|
||||||
PP = pe;
|
PP = pe;
|
||||||
Int out = execute_cargs(pe, exec_code PASS_REGS);
|
ret = execute_cargs(pe, exec_code PASS_REGS);
|
||||||
PP = NULL;
|
|
||||||
if (!out) {
|
|
||||||
Term t;
|
|
||||||
|
|
||||||
BallTerm = EX;
|
|
||||||
EX = NULL;
|
|
||||||
if ((t = Yap_GetException())) {
|
|
||||||
Yap_JumpToEnv(t);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
} else {
|
} else {
|
||||||
Int ret = (exec_code)( PASS_REGS1 );
|
PP = pe;
|
||||||
if (!ret) {
|
ret = (exec_code)( PASS_REGS1 );
|
||||||
Term t;
|
|
||||||
|
|
||||||
BallTerm = EX;
|
|
||||||
EX = NULL;
|
|
||||||
if ((t = Yap_GetException())) {
|
|
||||||
Yap_JumpToEnv(t);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
PP = NULL;
|
||||||
|
if (!ret) {
|
||||||
|
Term t;
|
||||||
|
|
||||||
|
BallTerm = EX;
|
||||||
|
EX = NULL;
|
||||||
|
if ((t = Yap_GetException())) {
|
||||||
|
Yap_JumpToEnv(t);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FRG_REDO_MASK 0x00000003L
|
#define FRG_REDO_MASK 0x00000003L
|
||||||
|
Reference in New Issue
Block a user