;Merge ../../yap-6.3

This commit is contained in:
Vitor Santos Costa
2018-06-15 13:50:55 +01:00
3178 changed files with 59028 additions and 67702 deletions

View File

@@ -90,7 +90,7 @@ protected:
/// auxiliary routine to find a predicate in the current module.
/// auxiliary routine to find a predicate in the current module.
PredEntry *getPred(YAPTerm &t, CELL *& outp);
PredEntry *getPred(Term &t, CELL *& outp);
PredEntry *asPred() { return ap; };
@@ -99,43 +99,36 @@ protected:
/// Just do nothing.
inline YAPPredicate() {
}
/// String constructor for predicates
///
/// It also communicates the array of arguments t[]
/// and the array of variables
/// back to yapquery
YAPPredicate(const char *s0, Term &tout, Term &tnames) {
CACHE_REGS
Term *modp = NULL;
const unsigned char *us = (const unsigned char *)s0;
tnames = MkVarTerm();
tout =
Yap_BufferToTermWithPrioBindings(us, TermNil, tnames, strlen(s0), 1200);
// fprintf(stderr,"ap=%p arity=%d text=%s", ap, ap->ArityOfPE, s);
// Yap_DebugPlWrite(out);
if (tout == 0L) {
Yap_ThrowError(TYPE_ERROR_PREDICATE_INDICATOR, MkStringTerm(s0), "YAPPredicate");
}
YAPTerm tt = YAPTerm(tout);
ap = getPred(tt, modp);
}
YAPPredicate(Term &t, Term &tmod, CELL * &ts, const char *pname);
YAPPredicate(Term &to, Term &tmod, CELL * &ts, const char *pname);
/// Term constructor for predicates
///
/// It is just a call to getPred
inline YAPPredicate(Term t) {
CELL *v = nullptr;
YAPTerm tt = YAPTerm(t);
ap = getPred(tt, v);
inline YAPPredicate(Term t, CELL *&v) {
if (t) {
ap = getPred(t, v);
}
}
inline YAPPredicate(Term t) {
if (t) {
CELL *v = nullptr;
ap = getPred(t, v);
}
}
/// Term constructor for predicates
///
/// It is just a call to getPred
inline YAPPredicate(YAPTerm t) {
CELL *v = nullptr;
ap = getPred(t, v);
inline YAPPredicate(YAPTerm t, CELL *&v) {
Term tp = t.term();
ap = getPred(tp, v);
}
inline YAPPredicate(YAPTerm t) {
CELL *v = nullptr;
Term tp = t.term();
ap = getPred(tp, v);
}
/// Cast constructor for predicates,
@@ -152,6 +145,28 @@ protected:
public:
/// String constructor for predicates
///
/// It also communicates the array of arguments t[]
/// and the array of variables
/// back to yapquery
YAPPredicate(const char *s0, Term &tout, Term &tnames, CELL *&nts) {
CACHE_REGS
const char *s = (const char *)s0;
tnames = MkVarTerm();
tout =
Yap_BufferToTermWithPrioBindings(s, TermNil, tnames, strlen(s0), 1200);
// fprintf(stderr,"ap=%p arity=%d text=%s", ap, ap->ArityOfPE, s);
// Yap_DebugPlWrite(out);
if (tout == 0L) {
throw YAPError();
}
ap = getPred(tout, nts);
tout = Yap_SaveTerm(tout);
tnames = Yap_SaveTerm(tnames);
}
/// Functor constructor for predicates
///
/// Asssumes that we use the current module.
@@ -176,6 +191,7 @@ public:
///
YAPPredicate(YAPAtom at);
/// Mod:Name/Arity constructor for predicates.
///
inline YAPPredicate(YAPAtom at, uintptr_t arity, YAPModule mod) {