fix complaints about mixing term, term_t and yapterm.
This commit is contained in:
parent
db029a478d
commit
9684352f1d
@ -377,7 +377,7 @@ char *YAPAtom::getName(void) {
|
|||||||
YAPPredicate::YAPPredicate(const char *s, Term **outp, YAPTerm &vnames) throw (int) {
|
YAPPredicate::YAPPredicate(const char *s, Term **outp, YAPTerm &vnames) throw (int) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
vnames = Yap_NewSlots(1 PASS_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)
|
if (t == 0L)
|
||||||
throw YAPError::YAP_SYNTAX_ERROR;
|
throw YAPError::YAP_SYNTAX_ERROR;
|
||||||
ap = getPred( t, outp );
|
ap = getPred( t, outp );
|
||||||
@ -478,7 +478,7 @@ YAPQuery::YAPQuery(YAPPredicate p, YAPTerm t[]): YAPPredicate(p.ap)
|
|||||||
|
|
||||||
YAPListTerm YAPQuery::namedVars() {
|
YAPListTerm YAPQuery::namedVars() {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Term o = Yap_GetFromSlot( vnames PASS_REGS );
|
Term o = Yap_GetFromSlot( this->vnames.t PASS_REGS );
|
||||||
return YAPListTerm( o );
|
return YAPListTerm( o );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,3 +625,5 @@ YAPQuery *YAPEngine::query( char *s ) {
|
|||||||
YAPQuery *n = new YAPQuery( s );
|
YAPQuery *n = new YAPQuery( s );
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
18
CXX/yapi.hh
18
CXX/yapi.hh
@ -484,7 +484,7 @@ class YAPQuery: public YAPPredicate {
|
|||||||
int q_flags;
|
int q_flags;
|
||||||
YAP_dogoalinfo q_h;
|
YAP_dogoalinfo q_h;
|
||||||
YAPQuery *oq;
|
YAPQuery *oq;
|
||||||
yhandle_t vnames;
|
YAPTerm vnames;
|
||||||
void initQuery( Term ts[] );
|
void initQuery( Term ts[] );
|
||||||
void initQuery( YAPTerm t[], arity_t arity );
|
void initQuery( YAPTerm t[], arity_t arity );
|
||||||
public:
|
public:
|
||||||
@ -503,12 +503,24 @@ public:
|
|||||||
/// It is given a functor, and an array of terms that must have at least
|
/// 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.
|
/// the same arity as the functor. Works within the current module.
|
||||||
YAPQuery(YAPFunctor f, YAPTerm t[]);
|
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
|
/// string constructor with varnames
|
||||||
///
|
///
|
||||||
/// It is given a string, calls the parser and obtains a Prolog term that should be a callable
|
/// 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.
|
/// 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;
|
Term *ts = this->q_g;
|
||||||
|
|
||||||
initQuery( ts );
|
initQuery( ts );
|
||||||
@ -583,7 +595,7 @@ public:
|
|||||||
YAPQuery *query( char *s );
|
YAPQuery *query( char *s );
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* @}
|
* @}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -1,12 +1,4 @@
|
|||||||
|
|
||||||
class YAPEngine;
|
|
||||||
class YAPAtom;
|
|
||||||
class YAPFunctor;
|
|
||||||
class YAPApplTerm;
|
|
||||||
class YAPPairTerm;
|
|
||||||
class YAPQuery;
|
|
||||||
class YAPPredicate;
|
|
||||||
|
|
||||||
|
|
||||||
class YAPError {
|
class YAPError {
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user