50 inline void setNext() {
59 q_h.CurSlot = LOCAL_CurSlot;
100 __android_log_print(ANDROID_LOG_INFO,
"YAPDroid",
"got game %ld",
121 BACKUP_MACHINE_REGS();
124 RECOVER_MACHINE_REGS();
133 inline bool first() {
return next(); }
139 bool deterministic();
148 Term namedVars() {
return names->term(); };
173 virtual void run() { LOG(
"callback"); }
174 virtual void run(
char *s) {}
186 Yap_InitDefaults(&this->start,
nullptr, 0,
nullptr);
189 python_in_python = Py_IsInitialized();
195 inline void setEmbedded(
bool fl) { Embedded = fl; };
197 inline bool getEmbedded() {
return Embedded; };
199 inline void setStackSize(
bool fl) { StackSize = fl; };
201 inline bool getStackSize() {
return StackSize; };
203 inline void setTrailSize(
bool fl) { TrailSize = fl; };
205 inline bool getTrailSize() {
return TrailSize; };
207 inline bool getMStackSize() {
return StackSize; };
209 inline void setMaxTrailSize(
bool fl) { MaxTrailSize = fl; };
211 inline bool getMaxTrailSize() {
return MaxTrailSize; };
213 inline void createSavedState(
bool fl) { install = fl; };
215 inline bool creatingSavedState() {
return install; };
217 inline void setPLDIR(
const char *fl) {
218 std::string *s =
new std::string(fl);
222 inline const char *getPLDIR() {
return PLDIR; };
224 inline void setINPUT_STARTUP(
const char *fl) {
225 std::string *s =
new std::string(fl);
226 INPUT_STARTUP = s->c_str();
229 inline const char *getINPUT_STARTUP() {
return INPUT_STARTUP; };
231 inline void setOUTPUT_STARTUP(
const char *fl) {
232 std::string *s =
new std::string(fl);
233 OUTPUT_STARTUP = s->c_str();
236 inline void setOUTPUT_RESTORE(
const char *fl) {
237 std::string *s =
new std::string(fl);
238 OUTPUT_STARTUP = s->c_str();
241 inline const char *getOUTPUT_STARTUP() {
return OUTPUT_STARTUP; };
243 inline void setSOURCEBOOT(
const char *fl) {
244 std::string *s =
new std::string(fl);
245 SOURCEBOOT = s->c_str();
248 inline const char *getSOURCEBOOT() {
return SOURCEBOOT; };
250 inline void setPrologBOOTSTRAP(
const char *fl) {
251 std::string *s =
new std::string(fl);
252 BOOTSTRAP = s->c_str();
255 inline const char *getBOOTSTRAP() {
return BOOTSTRAP; };
257 inline void setPrologGoal(
const char *fl) {
258 std::string *s =
new std::string(fl);
259 PrologGoal = s->c_str();
263 inline const char *getPrologGoal() {
return PrologGoal; };
265 inline void setPrologTopLevelGoal(
const char *fl) {
266 std::string *s =
new std::string(fl);
267 PrologTopLevelGoal = s->c_str() ;
270 inline const char *getPrologTopLevelGoal() {
return PrologTopLevelGoal; };
272 inline void setHaltAfterBoot(
bool fl) { HaltAfterBoot = fl; };
274 inline bool getHaltAfterBoot() {
return HaltAfterBoot; };
276 inline void setFastBoot(
bool fl) { FastBoot = fl; };
278 inline bool getFastBoot() {
return FastBoot; };
280 inline void setArgc(
int fl) { Argc = fl; };
282 inline int getArgc() {
return Argc; };
284 inline void setArgv(
char **fl) { Argv = fl; };
286 inline char **getArgv() {
return Argv; };
288 inline void setBOOTDIR(
const char *fl) {
289 std::string *s =
new std::string(fl);
290 BOOTDIR = s->c_str() ;
293 inline const char *getBOOTDIR() {
return BOOTDIR; };
295 inline const char *getBOOTFILE() {
return BOOTSTRAP; };
297 inline void setBOOTFILE(
const char *fl) {
298 std::string *s =
new std::string(fl);
299 BOOTSTRAP = s->c_str() ;
303 inline void setROOTDIR(
const char *fl) {
304 std::string *s =
new std::string(fl);
305 ROOTDIR = s->c_str() ;
332 ANDROID_LOG_INFO,
"YAPDroid",
"start engine ");
334 doInit(YAP_PL, cargs);
337 doInit(YAP_QLY, cargs);
363 bool hasError() {
return LOCAL_Error_TYPE != YAP_NO_ERROR; }
398 const char *currentDir() {
400 std::string *s =
new std::string(Yap_getcwd(dir, 1024 - 1));
405 std::string *s =
new std::string(Yap_version());
416 bool setStringFlag(std::string arg, std::string path) {
417 return Yap_set_flag(MkAtomTerm(Yap_LookupAtom(arg.data())),
418 MkAtomTerm(Yap_LookupAtom(path.data())));
@ argv
read-only atom, it describes the list with all arguments received by YAP at boot
YAPModule A YAPModule describes a bare module, which in YAP is just a name.
take information on a Prolog error:
YAPFunctor represents Prolog functors Name/Arity.
YAPEngine(YAPEngineArgs *cargs)
construct a new engine; may use a variable number of arguments
Term top_level(std::string s)
const char * version()
report YAP version as a string
bool command()
simple YAP Query; just calls YAP and reports success or failure, Useful when we just want things done...
void reSet()
reset Prolog state
std::vector< Term > namedVarsVector()
query variables, but copied out
Term Yap_CurrentModule()
current module for the engine
void setFlag(int flag)
set flags for query execution, currently only for exception handling
void release()
assune that there are no stack pointers, just release memory
bool goal(YAPTerm Yt, YAPModule module, bool release=false)
current directory for the engine
YAPQuery * query(const char *s)
build a query on the engine
Term next_answer(YAPQuery *&Q)
void setYAPCallback(YAPCallback *cb)
set a new callback
YAPQuery * query(YAPTerm t)
build a query from a term
void delYAPCallback()
remove current callback
YAPTerm getTerm(yhandle_t h)
given a handle, fetch a term from the engine
bool call(YAPPredicate ap, YAPTerm ts[])
current directory for the engine
YAPQuery(YAPTerm t)
string constructor with just an atom
bool goal(YAPTerm t, bool release=false)
current directory for the engine
void resetFlag(int flag)
reset flags for query execution, currently only for exception handling
YAPQuery(const char *s)
functor/term constructor,
YAPQuery * qt(Term t)
build a query from a Prolog term (internal)
bool mgoal(Term t, Term tmod, bool release=false)
ru1n a goal in a module
void run(char *s)
execute the callback
bool hasError()
execute the callback with a text argument
This class implements a callback Prolog-side.
YAP Engine: takes care of the execution environment where we can go executing goals.
Setup all arguments to a new engine.