export current predicate for SWI built-ins.

This commit is contained in:
Vítor Santos Costa
2011-02-11 19:01:18 +00:00
parent b041ae00c2
commit 45032cc61e
4 changed files with 38 additions and 1 deletions

View File

@@ -379,6 +379,10 @@ X_API int PL_error(const char *pred, int arity, const char *msg, int id, ...)
goto err_instantiation;
}
va_end(args);
if (!pred) {
pred = Yap_GetCurrentPredName();
arity = Yap_GetCurrentPredArity();
}
if ( pred )
{ PL_unify_term(predterm,
PL_FUNCTOR, FUNCTOR_divide2,

View File

@@ -29,6 +29,10 @@ typedef YAP_Term *Word; /* Anonymous 4 byte object */
typedef YAP_Atom Atom;
typedef YAP_Term (*Func)(); /* foreign functions */
const char *Yap_GetCurrentPredName(void);
YAP_Int Yap_GetCurrentPredArity(void);
extern atom_t codeToAtom(int chrcode);
#define valTermRef(t) ((Word)YAP_AddressFromSlot(t))