fix complaints about mixing term, term_t and yapterm.

This commit is contained in:
Vitor Santos Costa 2014-07-27 22:39:33 -05:00
parent db029a478d
commit 9684352f1d
3 changed files with 19 additions and 13 deletions

View File

@ -377,7 +377,7 @@ char *YAPAtom::getName(void) {
YAPPredicate::YAPPredicate(const char *s, Term **outp, YAPTerm &vnames) throw (int) {
CACHE_REGS
vnames = Yap_NewSlots(1 PASS_REGS);
Term t = Yap_StringToTerm(s, strlen(s)+1, vnames);
Term t = Yap_StringToTerm(s, strlen(s)+1, Yap_GetFromSlot( vnames.t PASS_REGS));
if (t == 0L)
throw YAPError::YAP_SYNTAX_ERROR;
ap = getPred( t, outp );
@ -478,7 +478,7 @@ YAPQuery::YAPQuery(YAPPredicate p, YAPTerm t[]): YAPPredicate(p.ap)
YAPListTerm YAPQuery::namedVars() {
CACHE_REGS
Term o = Yap_GetFromSlot( vnames PASS_REGS );
Term o = Yap_GetFromSlot( this->vnames.t PASS_REGS );
return YAPListTerm( o );
}
@ -625,3 +625,5 @@ YAPQuery *YAPEngine::query( char *s ) {
YAPQuery *n = new YAPQuery( s );
return n;
}

View File

@ -484,7 +484,7 @@ class YAPQuery: public YAPPredicate {
int q_flags;
YAP_dogoalinfo q_h;
YAPQuery *oq;
yhandle_t vnames;
YAPTerm vnames;
void initQuery( Term ts[] );
void initQuery( YAPTerm t[], arity_t arity );
public:
@ -503,12 +503,24 @@ public:
/// It is given a functor, and an array of terms that must have at least
/// the same arity as the functor. Works within the current module.
YAPQuery(YAPFunctor f, YAPTerm t[]);
/// string constructor without varnames
///
/// It is given a string, calls the parser and obtains a Prolog term that should be a callable
/// goal. It does not ask for a list of variables.
inline YAPQuery(char *s): YAPPredicate(s, &this->q_g)
{
this->vnames = vnames;
Term *ts = this->q_g;
initQuery( ts );
}
/// string constructor with varnames
///
/// It is given a string, calls the parser and obtains a Prolog term that should be a callable
/// goal and a list of variables. Useful for top-level simulation. Works within the current module.
inline YAPQuery(char *s): YAPPredicate(s, &this->q_g, vnames)
inline YAPQuery(char *s, YAPTerm &vnames): YAPPredicate(s, &this->q_g, vnames)
{
this->vnames = vnames;
Term *ts = this->q_g;
initQuery( ts );
@ -583,7 +595,7 @@ public:
YAPQuery *query( char *s );
};
/*
/**
* @}
*
*/

View File

@ -1,12 +1,4 @@
class YAPEngine;
class YAPAtom;
class YAPFunctor;
class YAPApplTerm;
class YAPPairTerm;
class YAPQuery;
class YAPPredicate;
class YAPError {
public: