Merge branch 'master' of https://github.com/vscosta/yap-6.3
This commit is contained in:
commit
af38d14ba7
67
CXX/yapa.hh
67
CXX/yapa.hh
@ -1,41 +1,56 @@
|
|||||||
|
/// @{
|
||||||
|
|
||||||
#ifndef YAPA_HH
|
#ifndef YAPA_HH
|
||||||
#define YAPA_HH 1
|
#define YAPA_HH 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Prolog operates over constants, called atoms
|
*
|
||||||
YAP, like lisp, associates properties with atoms.
|
* @defgroup yap-cplus-interface An object oriented interface for YAP.
|
||||||
|
*
|
||||||
|
* @ingroup ChYInterface
|
||||||
|
* @tableofcontents
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Prolog operates over constants, called atoms. YAP's stores most data as a list
|
||||||
|
* of properties for atoms. Properties include functors, data-base tecords, predicates. operators,
|
||||||
|
* and more.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
Tne different tgaas area represented through PropTag.
|
||||||
*/
|
*/
|
||||||
enum PropTag {
|
enum PropTag {
|
||||||
/// predicate
|
/// predicate
|
||||||
PRED_TAG = PEProp, // 0x0000,
|
PRED_TAG = PEProp, // 0x0000,
|
||||||
/// db key, may be associated with a functor
|
/// db key, may be associated with a functor
|
||||||
DB_TAG = DBProperty, // 0x8000,
|
DB_TAG = DBProperty, // 0x8000,
|
||||||
/// generic functor, may include sub-properties
|
/// generic functor, may include sub-properties
|
||||||
FUNCTOR_TAG = FunctorProperty, // 0xBB00,
|
FUNCTOR_TAG = FunctorProperty, // 0xBB00,
|
||||||
// SPARSE_FUNCTOR_TAG = 0xFFDF,
|
// SPARSE_FUNCTOR_TAG = 0xFFDF,
|
||||||
/// arithmetic function
|
/// arithmetic function
|
||||||
ARITHMETIC_PROPERTY_TAG = ExpProperty, // 0xFFE0,
|
ARITHMETIC_PROPERTY_TAG = ExpProperty, // 0xFFE0,
|
||||||
/// map the atom to an integer
|
/// map the atom to an integer
|
||||||
TRANSLATION_TAG = TranslationProperty, // 0xFFF4,
|
TRANSLATION_TAG = TranslationProperty, // 0xFFF4,
|
||||||
/// ensure the atom may not be garbafe colected
|
/// ensure the atom may not be garbafe colected
|
||||||
HOLD_TAG = HoldProperty, // 0xFFF6
|
HOLD_TAG = HoldProperty, // 0xFFF6
|
||||||
/// named mutEX
|
/// named mutEX
|
||||||
MUTEX_TAG = MutexProperty, // 0xFFF6,
|
MUTEX_TAG = MutexProperty, // 0xFFF6,
|
||||||
/// A typed array, may be in-db or in-stack deped
|
/// A typed array, may be in-db or in-stack deped
|
||||||
ARRAY_TAG = ArrayProperty, // 0xFFF7,
|
ARRAY_TAG = ArrayProperty, // 0xFFF7,
|
||||||
/// module
|
/// module
|
||||||
MODULE_TAG = ModProperty, // 0xFFFA,
|
MODULE_TAG = ModProperty, // 0xFFFA,
|
||||||
/// the original SICStus blackboard
|
/// the original SICStus blackboard
|
||||||
BLACKBOARD_TAG = BBProperty, // 0xFFFB,
|
BLACKBOARD_TAG = BBProperty, // 0xFFFB,
|
||||||
/// associate an atomic value with the atom
|
/// associate an atomic value with the atom
|
||||||
VALUE_TAG = ValProperty, // 0xFFFC,
|
VALUE_TAG = ValProperty, // 0xFFFC,
|
||||||
/// Demoen's proposal for gkobal variables
|
/// Demoen's proposal for gkobal variables
|
||||||
GLOBAL_VAR_TAG = GlobalProperty, // 0xFFFD
|
GLOBAL_VAR_TAG = GlobalProperty, // 0xFFFD
|
||||||
/// SWI-STYLE ATOM Extension
|
/// SWI-STYLE ATOM Extension
|
||||||
BLOB_TAG = BlobProperty, // 0xFFFE,
|
BLOB_TAG = BlobProperty, // 0xFFFE,
|
||||||
/// Prolog operator,
|
/// Prolog operator,
|
||||||
OPERATOR_TAG = OpProperty, // 0xFFFF,
|
OPERATOR_TAG = OpProperty, // 0xFFFF,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Atom
|
* @brief Atom
|
||||||
@ -57,19 +72,19 @@ class YAPAtom {
|
|||||||
/// construct new YAPAtom from Atom
|
/// construct new YAPAtom from Atom
|
||||||
YAPAtom( Atom at ) { a = at; }
|
YAPAtom( Atom at ) { a = at; }
|
||||||
public:
|
public:
|
||||||
/// construct new YAPAtom from UTF-8 string
|
/// construct new YAPAtom from UTF-8 string
|
||||||
YAPAtom( const char * s) { a = Yap_LookupAtom( s ); }
|
YAPAtom( const char * s) { a = Yap_LookupAtom( s ); }
|
||||||
/// construct new YAPAtom from UTF-8 string
|
/// construct new YAPAtom from UTF-8 string
|
||||||
YAPAtom( const wchar_t * s) { CACHE_REGS a = UTF32ToAtom( s PASS_REGS ); }
|
YAPAtom( const wchar_t * s) { CACHE_REGS a = UTF32ToAtom( s PASS_REGS ); }
|
||||||
/// construct new YAPAtom from wide string
|
/// construct new YAPAtom from wide string
|
||||||
//YAPAtom( const wchar_t * s) { a = Yap_LookupMaybeWideAtom( s ); }
|
//YAPAtom( const wchar_t * s) { a = Yap_LookupMaybeWideAtom( s ); }
|
||||||
/// construct new YAPAtom from max-length string
|
/// construct new YAPAtom from max-length string
|
||||||
YAPAtom( const char * s, size_t len) { a = Yap_LookupAtomWithLength( s, len ); }
|
YAPAtom( const char * s, size_t len) { a = Yap_LookupAtomWithLength( s, len ); }
|
||||||
/// get name of atom
|
/// get name of atom
|
||||||
const char *getName(void);
|
const char *getName(void);
|
||||||
/// get name of (other way)
|
/// get name of (other way)
|
||||||
inline const char *text(void) { return getName(); } ;
|
inline const char *text(void) { return getName(); } ;
|
||||||
/// get prop of type
|
/// get prop of type
|
||||||
Prop getProp( PropTag tag ) { return Yap_GetAProp( a , (PropFlags)tag ); }
|
Prop getProp( PropTag tag ) { return Yap_GetAProp( a , (PropFlags)tag ); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -90,10 +105,12 @@ class YAPProp {
|
|||||||
public:
|
public:
|
||||||
/// get name of property
|
/// get name of property
|
||||||
// virtual YAPAtom name();
|
// virtual YAPAtom name();
|
||||||
virtual ~YAPProp() {};
|
virtual ~YAPProp() {};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* YAPA_HH */
|
#endif /* YAPA_HH */
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
84
CXX/yapdb.hh
84
CXX/yapdb.hh
@ -14,8 +14,8 @@
|
|||||||
* @tableofcontents
|
* @tableofcontents
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Data-base component of C++ interface to YAP. It manipulates sets of
|
* These classes define the main data-structures stored in the Data-base component: atoms, functors
|
||||||
* atoms, each one containing a number of props.
|
* and predicates.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class YAPTerm;
|
class YAPTerm;
|
||||||
@ -40,8 +40,8 @@ class YAPModule : protected YAPAtomTerm {
|
|||||||
Term curModule() { CACHE_REGS return Yap_CurrentModule(); }
|
Term curModule() { CACHE_REGS return Yap_CurrentModule(); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
YAPModule() : YAPAtomTerm(curModule()){};
|
YAPModule() : YAPAtomTerm(curModule()){};
|
||||||
YAPModule(YAPAtom t) : YAPAtomTerm(t){};
|
YAPModule(YAPAtom t) : YAPAtomTerm(t){};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,12 +54,12 @@ class YAPModuleProp : public YAPProp {
|
|||||||
ModEntry *m;
|
ModEntry *m;
|
||||||
|
|
||||||
YAPModuleProp(ModEntry *mod) { m = mod; };
|
YAPModuleProp(ModEntry *mod) { m = mod; };
|
||||||
YAPModuleProp(Term tmod) { m = Yap_GetModuleEntry(tmod); };
|
YAPModuleProp(Term tmod) { m = Yap_GetModuleEntry(tmod); };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
YAPModuleProp(YAPModule tmod) { m = Yap_GetModuleEntry(tmod.gt()); };
|
YAPModuleProp(YAPModule tmod) { m = Yap_GetModuleEntry(tmod.gt()); };
|
||||||
YAPModuleProp() { CACHE_REGS m = Yap_GetModuleEntry(Yap_CurrentModule()); };
|
YAPModuleProp() { CACHE_REGS m = Yap_GetModuleEntry(Yap_CurrentModule()); };
|
||||||
virtual YAPModule module() { return YAPModule(m->AtomOfME); };
|
virtual YAPModule module() { return YAPModule(m->AtomOfME); };
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,14 +80,14 @@ public:
|
|||||||
/// Constructor: receives name as an atom, plus arity
|
/// Constructor: receives name as an atom, plus arity
|
||||||
///
|
///
|
||||||
/// This is the default method, and the most popular
|
/// This is the default method, and the most popular
|
||||||
YAPFunctor(YAPAtom at, uintptr_t arity) { f = Yap_MkFunctor(at.a, arity); }
|
YAPFunctor(YAPAtom at, uintptr_t arity) { f = Yap_MkFunctor(at.a, arity); }
|
||||||
|
|
||||||
/// Constructor: receives name as a string plus arity
|
/// Constructor: receives name as a string plus arity
|
||||||
///
|
///
|
||||||
/// Notice that this is designed for ISO-LATIN-1 right now
|
/// Notice that this is designed for ISO-LATIN-1 right now
|
||||||
/// Note: Python confuses the 3 constructors,
|
/// Note: Python confuses the 3 constructors,
|
||||||
/// use YAPFunctorFromString
|
/// use YAPFunctorFromString
|
||||||
inline YAPFunctor(const char *s, uintptr_t arity, bool isutf8 = true) {
|
inline YAPFunctor(const char *s, uintptr_t arity, bool isutf8 = true) {
|
||||||
f = Yap_MkFunctor(Yap_LookupAtom(s), arity);
|
f = Yap_MkFunctor(Yap_LookupAtom(s), arity);
|
||||||
}
|
}
|
||||||
/// Constructor: receives name as a wide string plus arity
|
/// Constructor: receives name as a wide string plus arity
|
||||||
@ -96,18 +96,18 @@ public:
|
|||||||
///
|
///
|
||||||
/// Note: Python confuses the 3 constructors,
|
/// Note: Python confuses the 3 constructors,
|
||||||
/// use YAPFunctorFromWideString
|
/// use YAPFunctorFromWideString
|
||||||
inline YAPFunctor(const wchar_t *s, uintptr_t arity) {
|
inline YAPFunctor(const wchar_t *s, uintptr_t arity) {
|
||||||
CACHE_REGS f = Yap_MkFunctor(UTF32ToAtom(s PASS_REGS), arity);
|
CACHE_REGS f = Yap_MkFunctor(UTF32ToAtom(s PASS_REGS), arity);
|
||||||
}
|
}
|
||||||
/// Getter: extract name of functor as an atom
|
/// Getter: extract name of functor as an atom
|
||||||
///
|
///
|
||||||
/// this is for external usage.
|
/// this is for external usage.
|
||||||
YAPAtom name(void) { return YAPAtom(NameOfFunctor(f)); }
|
YAPAtom name(void) { return YAPAtom(NameOfFunctor(f)); }
|
||||||
|
|
||||||
/// Getter: extract arity of functor as an unsigned integer
|
/// Getter: extract arity of functor as an unsigned integer
|
||||||
///
|
///
|
||||||
/// this is for external usage.
|
/// this is for external usage.
|
||||||
uintptr_t arity(void) { return ArityOfFunctor(f); }
|
uintptr_t arity(void) { return ArityOfFunctor(f); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,14 +132,14 @@ protected:
|
|||||||
/// It also communicates the array of arguments t[]
|
/// It also communicates the array of arguments t[]
|
||||||
/// and the array of variables
|
/// and the array of variables
|
||||||
/// back to yapquery
|
/// back to yapquery
|
||||||
YAPPredicate(const char *s0, Term &out, Term &names) {
|
YAPPredicate(const char *s0, Term &out, Term &names) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
Term *modp = NULL;
|
Term *modp = NULL;
|
||||||
names = MkVarTerm ();
|
names = MkVarTerm ();
|
||||||
const unsigned char *us = (const unsigned char *)s0;
|
const unsigned char *us = (const unsigned char *)s0;
|
||||||
out =
|
out =
|
||||||
Yap_BufferToTermWithPrioBindings(us, strlen(s0), TermNil, 1200, names);
|
Yap_BufferToTermWithPrioBindings(us, strlen(s0), TermNil, 1200, names);
|
||||||
// extern char *s0;
|
// extern char *s0;
|
||||||
// fprintf(stderr,"ap=%p arity=%d text=%s", ap, ap->ArityOfPE, s);
|
// fprintf(stderr,"ap=%p arity=%d text=%s", ap, ap->ArityOfPE, s);
|
||||||
// Yap_DebugPlWrite(out);
|
// Yap_DebugPlWrite(out);
|
||||||
@ -154,7 +154,7 @@ names = MkVarTerm ();
|
|||||||
/// Term constructor for predicates
|
/// Term constructor for predicates
|
||||||
///
|
///
|
||||||
/// It is just a call to getPred
|
/// It is just a call to getPred
|
||||||
inline YAPPredicate(Term t) {
|
inline YAPPredicate(Term t) {
|
||||||
CELL *v = NULL;
|
CELL *v = NULL;
|
||||||
ap = getPred(t, v);
|
ap = getPred(t, v);
|
||||||
}
|
}
|
||||||
@ -178,30 +178,30 @@ public:
|
|||||||
/// Functor constructor for predicates
|
/// Functor constructor for predicates
|
||||||
///
|
///
|
||||||
/// Asssumes that we use the current module.
|
/// Asssumes that we use the current module.
|
||||||
YAPPredicate(YAPFunctor f) {
|
YAPPredicate(YAPFunctor f) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
ap = RepPredProp(PredPropByFunc(f.f, Yap_CurrentModule()));
|
ap = RepPredProp(PredPropByFunc(f.f, Yap_CurrentModule()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Functor constructor for predicates, is given a specific module.
|
/// Functor constructor for predicates, is given a specific module.
|
||||||
///
|
///
|
||||||
inline YAPPredicate(YAPFunctor f, YAPTerm mod) {
|
inline YAPPredicate(YAPFunctor f, YAPTerm mod) {
|
||||||
ap = RepPredProp(PredPropByFunc(f.f, mod.t));
|
ap = RepPredProp(PredPropByFunc(f.f, mod.t));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Name/arity constructor for predicates.
|
/// Name/arity constructor for predicates.
|
||||||
///
|
///
|
||||||
inline YAPPredicate(YAPAtom at, YAPTerm mod) {
|
inline YAPPredicate(YAPAtom at, YAPTerm mod) {
|
||||||
ap = RepPredProp(PredPropByAtom(at.a, mod.t));
|
ap = RepPredProp(PredPropByAtom(at.a, mod.t));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Name/0 constructor for predicates.
|
/// Name/0 constructor for predicates.
|
||||||
///
|
///
|
||||||
YAPPredicate(YAPAtom at);
|
YAPPredicate(YAPAtom at);
|
||||||
|
|
||||||
/// Mod:Name/Arity constructor for predicates.
|
/// Mod:Name/Arity constructor for predicates.
|
||||||
///
|
///
|
||||||
inline YAPPredicate(YAPAtom at, uintptr_t arity, YAPModule mod) {
|
inline YAPPredicate(YAPAtom at, uintptr_t arity, YAPModule mod) {
|
||||||
if (arity) {
|
if (arity) {
|
||||||
Functor f = Yap_MkFunctor(at.a, arity);
|
Functor f = Yap_MkFunctor(at.a, arity);
|
||||||
ap = RepPredProp(PredPropByFunc(f, mod.t()));
|
ap = RepPredProp(PredPropByFunc(f, mod.t()));
|
||||||
@ -212,32 +212,32 @@ public:
|
|||||||
|
|
||||||
/// Atom/Arity constructor for predicates.
|
/// Atom/Arity constructor for predicates.
|
||||||
///
|
///
|
||||||
YAPPredicate(YAPAtom at, uintptr_t arity);
|
YAPPredicate(YAPAtom at, uintptr_t arity);
|
||||||
|
|
||||||
/// char */module constructor for predicates.
|
/// char */module constructor for predicates.
|
||||||
///
|
///
|
||||||
inline YAPPredicate(const char *at, uintptr_t arity) {
|
inline YAPPredicate(const char *at, uintptr_t arity) {
|
||||||
ap = RepPredProp(PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom(at), arity),
|
ap = RepPredProp(PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom(at), arity),
|
||||||
CurrentModule));
|
CurrentModule));
|
||||||
};
|
};
|
||||||
|
|
||||||
/// char */module constructor for predicates.
|
/// char */module constructor for predicates.
|
||||||
///
|
///
|
||||||
inline YAPPredicate(const char *at, uintptr_t arity, YAPTerm mod) {
|
inline YAPPredicate(const char *at, uintptr_t arity, YAPTerm mod) {
|
||||||
ap = RepPredProp(
|
ap = RepPredProp(
|
||||||
PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom(at), arity), mod.t));
|
PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom(at), arity), mod.t));
|
||||||
};
|
};
|
||||||
|
|
||||||
/// char */module constructor for predicates.
|
/// char */module constructor for predicates.
|
||||||
///
|
///
|
||||||
inline YAPPredicate(const char *at, YAPTerm mod) {
|
inline YAPPredicate(const char *at, YAPTerm mod) {
|
||||||
ap = RepPredProp(PredPropByAtom(Yap_LookupAtom(at), mod.t));
|
ap = RepPredProp(PredPropByAtom(Yap_LookupAtom(at), mod.t));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// module of a predicate
|
/// module of a predicate
|
||||||
///
|
///
|
||||||
/// notice that modules are currently treated as atoms, this should change.
|
/// notice that modules are currently treated as atoms, this should change.
|
||||||
YAPModule module() {
|
YAPModule module() {
|
||||||
if (ap->ModuleOfPred == PROLOG_MODULE)
|
if (ap->ModuleOfPred == PROLOG_MODULE)
|
||||||
return YAPModule(AtomProlog);
|
return YAPModule(AtomProlog);
|
||||||
else
|
else
|
||||||
@ -259,7 +259,7 @@ public:
|
|||||||
/// onlu defined if arity >= 1
|
/// onlu defined if arity >= 1
|
||||||
YAPFunctor functor() {
|
YAPFunctor functor() {
|
||||||
if (ap->ArityOfPE)
|
if (ap->ArityOfPE)
|
||||||
return YAPFunctor(ap->FunctorOfPred);
|
return YAPFunctor(ap->FunctorOfPred);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,15 +277,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
class YAPPrologPredicate : public YAPPredicate {
|
class YAPPrologPredicate : public YAPPredicate {
|
||||||
public:
|
public:
|
||||||
YAPPrologPredicate(YAPTerm t) : YAPPredicate(t){};
|
YAPPrologPredicate(YAPTerm t) : YAPPredicate(t){};
|
||||||
YAPPrologPredicate(const char *s, arity_t arity) : YAPPredicate(s, arity){};
|
YAPPrologPredicate(const char *s, arity_t arity) : YAPPredicate(s, arity){};
|
||||||
/// add a new clause
|
/// add a new clause
|
||||||
bool assertClause(YAPTerm clause, bool last = true,
|
bool assertClause(YAPTerm clause, bool last = true,
|
||||||
YAPTerm source = YAPTerm());
|
YAPTerm source = YAPTerm());
|
||||||
/// add a new tuple
|
/// add a new tuple
|
||||||
bool assertFact(YAPTerm *tuple, bool last = true);
|
bool assertFact(YAPTerm *tuple, bool last = true);
|
||||||
/// retract at least the first clause matching the predicate.
|
/// retract at least the first clause matching the predicate.
|
||||||
void *retractClause(YAPTerm skeleton, bool all = false);
|
void *retractClause(YAPTerm skeleton, bool all = false);
|
||||||
/// return the Nth clause (if source is available)
|
/// return the Nth clause (if source is available)
|
||||||
// YAPTerm clause(size_t index, YAPPredicate p) { return YAPTerm(); };
|
// YAPTerm clause(size_t index, YAPPredicate p) { return YAPTerm(); };
|
||||||
/// return the Nth clause (if source is available)
|
/// return the Nth clause (if source is available)
|
||||||
@ -302,7 +302,7 @@ public:
|
|||||||
YAPFLIP(CPredicate call, YAPAtom name, uintptr_t arity,
|
YAPFLIP(CPredicate call, YAPAtom name, uintptr_t arity,
|
||||||
YAPModule module = YAPModule(), CPredicate retry = 0,
|
YAPModule module = YAPModule(), CPredicate retry = 0,
|
||||||
CPredicate cut = 0, size_t extra = 0, bool test = false)
|
CPredicate cut = 0, size_t extra = 0, bool test = false)
|
||||||
: YAPPredicate(name, arity, module) {
|
: YAPPredicate(name, arity, module) {
|
||||||
if (retry) {
|
if (retry) {
|
||||||
Yap_InitCPredBackCut(name.getName(), arity, extra, call, retry, cut,
|
Yap_InitCPredBackCut(name.getName(), arity, extra, call, retry, cut,
|
||||||
UserCPredFlag);
|
UserCPredFlag);
|
||||||
@ -314,18 +314,20 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
YAPFLIP(const char *name, uintptr_t arity, YAPModule module = YAPModule(),
|
YAPFLIP(const char *name, uintptr_t arity, YAPModule module = YAPModule(),
|
||||||
bool backtrackable = false)
|
bool backtrackable = false)
|
||||||
: YAPPredicate(YAPAtom(name), arity, module) {
|
: YAPPredicate(YAPAtom(name), arity, module) {
|
||||||
if (backtrackable) {
|
if (backtrackable) {
|
||||||
Yap_InitCPredBackCut(name, arity, 0, 0, 0, 0, UserCPredFlag);
|
Yap_InitCPredBackCut(name, arity, 0, 0, 0, 0, UserCPredFlag);
|
||||||
} else {
|
} else {
|
||||||
YAP_UserCPredicate(name, 0, arity);
|
YAP_UserCPredicate(name, 0, arity);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
bool addCall(CPredicate call) { return Yap_AddCallToFli(ap, call); }
|
bool addCall(CPredicate call) { return Yap_AddCallToFli(ap, call); }
|
||||||
bool addRetry(CPredicate call) { return Yap_AddRetryToFli(ap, call); }
|
bool addRetry(CPredicate call) { return Yap_AddRetryToFli(ap, call); }
|
||||||
bool addCut(CPredicate call) { return Yap_AddCutToFli(ap, call); }
|
bool addCut(CPredicate call) { return Yap_AddCutToFli(ap, call); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @defgroup yap-cplus-interface An object oriented interface for YAP.
|
* @defgroup yap-cplus-interface An object oriented interface for YAP.
|
||||||
*
|
*
|
||||||
* @ingroup ChYInterface
|
* @ingroup yap-cplus-interface
|
||||||
* @tableofcontents
|
* @tableofcontents
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
16
CXX/yapie.hh
16
CXX/yapie.hh
@ -1,3 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @defgroup yap-cplus-error-hanadlinge Errir Handling in the YAP interface.
|
||||||
|
*
|
||||||
|
* @ingroup yap-cplus-interface
|
||||||
|
* @tableofcontents
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* These classes define an object that we can then throw when an error
|
||||||
|
* or unexoected event interrupts YAP. Often, the object is built by
|
||||||
|
* YAP itself, but we may generate our own errors.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef YAPIE_HH
|
#ifndef YAPIE_HH
|
||||||
#define YAPIE_HH
|
#define YAPIE_HH
|
||||||
@ -36,3 +50,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
17
CXX/yapq.hh
17
CXX/yapq.hh
@ -1,3 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* @{
|
||||||
|
^
|
||||||
|
* @defgroup yap-cplus-query-hanadlinge Query Handling in the YAP interface.
|
||||||
|
*
|
||||||
|
* @ingroup yap-cplus-interface
|
||||||
|
* @tableofcontents
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* These classes define the concepts of engine ana of query.Ann engine is an environment where we can rum
|
||||||
|
* Prolog, that is, where we can run queries.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef YAPQ_HH
|
#ifndef YAPQ_HH
|
||||||
#define YAPQ_HH 1
|
#define YAPQ_HH 1
|
||||||
|
|
||||||
@ -217,3 +230,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif /* YAPQ_HH */
|
#endif /* YAPQ_HH */
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
|
||||||
|
16
CXX/yapt.hh
16
CXX/yapt.hh
@ -1,3 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* @{
|
||||||
|
* @defgroup yap-cplus-term-handling Term Handling in the YAP interface.
|
||||||
|
*
|
||||||
|
* @ingroup yap-cplus-interface
|
||||||
|
* @tableofcontents
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* These classes define a term objectthat can be refined, Currently, all exported terms have an
|
||||||
|
* handle, in the SWI-Prolog style.
|
||||||
|
*
|
||||||
|
* Nottce that terms are forcefully destroyed during backtracking.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef YAPT_HH
|
#ifndef YAPT_HH
|
||||||
#define YAPT_HH 1
|
#define YAPT_HH 1
|
||||||
@ -445,3 +459,5 @@ public:
|
|||||||
const char *text() { return (const char *)AtomOfTerm(gt())->StrOfAE; }
|
const char *text() { return (const char *)AtomOfTerm(gt())->StrOfAE; }
|
||||||
};
|
};
|
||||||
#endif /* YAPT_HH */
|
#endif /* YAPT_HH */
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
#
|
#
|
||||||
macro_optional_find_package (LibR ON)
|
macro_optional_find_package (LibR ON)
|
||||||
|
|
||||||
macro_log_feature (R_FOUND "R"
|
macro_log_feature (LIBR_FOUND "R"
|
||||||
"Use R Environment"
|
"Use R Environment"
|
||||||
"http://www.r.org" FALSE)
|
"http://www.r.org" FALSE)
|
||||||
|
|
||||||
if (LIBR_FOUND)
|
if (LIBR_FOUND)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user