5#include "inline-only.h"
6#define _EXPORT_KERNEL 1
18#include "android/log.h"
31X_API
extern char *Yap_TermToBuffer(Term t,
int flags);
33X_API
extern void YAP_UserCPredicate(
const char *, YAP_UserCPred, arity_t arity);
34X_API
extern void YAP_UserCPredicateWithArgs(
const char *, YAP_UserCPred, arity_t,
36X_API
extern void YAP_UserBackCPredicate(
const char *, YAP_UserCPred, YAP_UserCPred,
37 YAP_Arity, YAP_Arity);
40X_API
bool do_init_python(
void);
44static void YAPCatchError() {
45 if (LOCAL_CommittedError !=
nullptr &&
46 LOCAL_CommittedError->errorNo != YAP_NO_ERROR) {
51 es[1] = MkErrorTerm(LOCAL_CommittedError);
52 Functor f = Yap_MkFunctor(Yap_LookupAtom(
"print_message"), 2);
53 YAP_RunGoalOnce(Yap_MkApplTerm(f, 2, es));
56 }
else if (LOCAL_ActiveError !=
nullptr &&
57 LOCAL_ActiveError->errorNo != YAP_NO_ERROR) {
62 es[1] = MkErrorTerm(LOCAL_ActiveError);
63 Functor f = Yap_MkFunctor(Yap_LookupAtom(
"print_message"), 2);
64 YAP_RunGoalOnce(Yap_MkApplTerm(f, 2, es));
76 }
else if (IsAtomTerm(t)) {
77 ap = RepPredProp(Yap_GetPredPropByAtom(AtomOfTerm(t), tmod));
79 }
else if (IsIntegerTerm(t) && tmod == IDB_MODULE) {
81 ap = Yap_FindLUIntKey(IntegerOfTerm(t));
82 }
else if (IsPairTerm(t)) {
83 t = Yap_MkApplTerm(FunctorCsult, 1, &t);
85 }
else if (IsApplTerm(t)) {
87 if (IsExtensionFunctor(fun)) {
89 Yap_TermToIndicator(t, tmod), pname);
91 if (fun == FunctorModule) {
92 tmod = ArgOfTerm(1, t);
93 if (IsVarTerm(tmod)) {
96 if (!IsAtomTerm(tmod)) {
102 ap = RepPredProp(Yap_GetPredPropByFunc(fun, tmod));
110 BACKUP_MACHINE_REGS();
114 if (IsApplTerm(t0)) {
115 if (i > ArityOfFunctor(FunctorOfTerm(t0)))
116 throw YAPError(
SOURCE(), DOMAIN_ERROR_OUT_OF_RANGE, t0,
"t0.getArg()");
117 tf = (ArgOfTerm(i, t0));
118 }
else if (IsPairTerm(t0)) {
120 tf = (HeadOfTerm(t0));
122 tf = (TailOfTerm(t0));
124 throw YAPError(
SOURCE(), DOMAIN_ERROR_OUT_OF_RANGE, t0,
"t0.getArg()");
128 RECOVER_MACHINE_REGS();
132YAPAtomTerm::YAPAtomTerm(
char s[]) {
137 inp.enc = LOCAL_encoding;
139 inp.type = YAP_STRING_CHARS;
140 out.type = YAP_STRING_ATOM;
141 if (Yap_CVT_Text(&inp, &out PASS_REGS))
142 mk(MkAtomTerm(out.val.a));
148YAPAtomTerm::YAPAtomTerm(
char *s,
size_t len) {
154 inp.type = YAP_STRING_CHARS;
155 inp.enc = LOCAL_encoding;
156 out.type = YAP_STRING_ATOM | YAP_STRING_NCHARS | YAP_STRING_TRUNC;
158 if (Yap_CVT_Text(&inp, &out PASS_REGS))
159 mk(MkAtomTerm(out.val.a));
165YAPAtomTerm::YAPAtomTerm(
wchar_t *s) :
YAPTerm() {
171 inp.type = YAP_STRING_WCHARS;
172 out.type = YAP_STRING_ATOM;
173 if (Yap_CVT_Text(&inp, &out PASS_REGS))
174 mk(MkAtomTerm(out.val.a));
180YAPAtomTerm::YAPAtomTerm(
wchar_t *s,
size_t len) :
YAPTerm() {
186 inp.type = YAP_STRING_WCHARS;
187 out.type = YAP_STRING_ATOM | YAP_STRING_NCHARS | YAP_STRING_TRUNC;
189 if (Yap_CVT_Text(&inp, &out PASS_REGS))
190 mk(MkAtomTerm(out.val.a));
200 Term ts = MkStringTerm(s);
212 inp.type = YAP_STRING_CHARS;
213 out.type = YAP_STRING_STRING | YAP_STRING_NCHARS | YAP_STRING_TRUNC;
215 if (Yap_CVT_Text(&inp, &out PASS_REGS))
229 inp.type = YAP_STRING_WCHARS;
230 out.type = YAP_STRING_STRING;
231 if (Yap_CVT_Text(&inp, &out PASS_REGS))
246 inp.type = YAP_STRING_WCHARS;
247 out.type = YAP_STRING_STRING | YAP_STRING_NCHARS | YAP_STRING_TRUNC;
249 if (Yap_CVT_Text(&inp, &out PASS_REGS))
258 arity_t
arity = ArityOfFunctor(f.f);
259 Term o = Yap_MkNewApplTerm(f.f,
arity);
260 Term *tt = RepAppl(o) + 1;
261 for (arity_t i = 0; i <
arity; i++)
262 tt[i] = ts[i].term();
269 arity_t
arity = ts.size();
270 Functor ff = Yap_MkFunctor(Yap_LookupAtom(f.c_str()),
arity);
271 Term o = AbsAppl(HR);
275 for (arity_t i = 0; i <
arity; i++)
284YAPApplTerm::YAPApplTerm(
const std::string f, std::vector<YAPTerm> ts) {
286 arity_t
arity = ts.size();
287 Functor ff = Yap_MkFunctor(Yap_LookupAtom(f.c_str()),
arity);
288 Term o = AbsAppl(HR);
292 for (arity_t i = 0; i <
arity; i++)
293 tt[i] = ts[i].term();
302 arity_t
arity = ArityOfFunctor(f.f);
303 mk(Yap_MkNewApplTerm(f.f,
arity));
308 BACKUP_MACHINE_REGS();
311 if (IsApplTerm(t0)) {
315 tf = RepAppl(t0) + (i + 1);
316 }
else if (IsPairTerm(t0)) {
320 tf = RepPair(t0) + 1;
321 RECOVER_MACHINE_REGS();
325 RECOVER_MACHINE_REGS();
330 BACKUP_MACHINE_REGS();
332 while (IsPairTerm(t0)) {
345 mk(MkPairTerm(th.term(), tl.term()));
349YAPPairTerm::YAPPairTerm() {
355std::vector<Term> YAPPairTerm::listToArray() {
358 Int l = Yap_SkipList(&t1, &tailp);
362 std::vector<Term> o = *
new std::vector<Term>(l);
365 while (t != TermNil) {
366 o[i++] = HeadOfTerm(t);
372std::vector<YAPTerm> YAPPairTerm::listToVector() {
375 Int len = Yap_SkipList(&t1, &tailp);
379 std::vector<YAPTerm> o = *
new std::vector<YAPTerm>(len);
382 while (l != TermNil) {
383 o[i++] =
YAPTerm(HeadOfTerm(l));
392 CELL *pt = VarOfTerm(tt);
393 if (IsUnboundVar(pt)) {
397 return YAP_TAG_UNBOUND;
403 if (IsAtomOrIntTerm(tt)) {
410 if (IsExtensionFunctor(f)) {
411 if (f == FunctorDBRef) {
412 return YAP_TAG_DBREF;
414 if (f == FunctorLongInt) {
415 return YAP_TAG_LONG_INT;
417 if (f == FunctorBigInt) {
418 big_blob_type bt = (big_blob_type)RepAppl(tt)[1];
421 return YAP_TAG_BIG_INT;
423 return YAP_TAG_RATIONAL;
425 return YAP_TAG_OPAQUE;
435 BACKUP_MACHINE_REGS();
437 tn = Yap_CopyTerm(
gt());
439 RECOVER_MACHINE_REGS();
446 return (TailOfTerm(to));
447 else if (to == TermNil)
454 BACKUP_MACHINE_REGS();
457 while (IsApplTerm(t0) && FunctorOfTerm(t0) == FunctorComma) {
459 return *(RepAppl(t0)+1);
461 t0 = ArgOfTerm(2,t0);
465 RECOVER_MACHINE_REGS();
466 return RepPair(tf)[i];
471 BACKUP_MACHINE_REGS();
473 tn = Yap_CopyTerm(
gt());
475 RECOVER_MACHINE_REGS();
481YAPIntegerTerm::YAPIntegerTerm(intptr_t i) {
482 CACHE_REGS Term tn = MkIntegerTerm(i);
499 mk(MkIntegerTerm((Int)ptr));
505 return (HeadOfTerm(to));
514 while (HR + n * 3 > ASP-1024) {
516 if (!Yap_dogc( PASS_REGS1 )) {
521 Term rc = AbsAppl(HR);
524 for (
size_t i=0; i< n; i++) {
525 ptr[0] = MkGlobal(ts[i]);
526 ptr[1] = AbsPair(ptr+2);
539 while (HR + n * 2 > ASP - 1024) {
541 if (!Yap_dogc( PASS_REGS1 )) {
546 Term a = AbsPair(HR);
549 for (arity_t i = 0; i < n; i++) {
550 ptr[0] = MkGlobal(ts[i]);
551 ptr[1] = AbsPair(ptr + 2);
562 if (IsApplTerm(to)&& FunctorOfTerm(to)==FunctorComma)
563 return (ArgOfTerm(1,to));
572 if (IsApplTerm(to)&& FunctorOfTerm(to)==FunctorComma)
573 return (ArgOfTerm(2,to));
592 while (HR + n * 3 > ASP - 1024) {
594 if (!Yap_dogc( PASS_REGS1 )) {
599 Term a = AbsAppl(HR);
602 for (arity_t i = 0; i < n-1; i++) {
603 ptr[0] = (CELL)FunctorComma;
604 ptr[1] = MkGlobal(ts[i]);
605 ptr[2] = AbsAppl(ptr + 3);
625 while (HR + n * 3 > ASP - 1024) {
627 if (!Yap_dogc( PASS_REGS1 )) {
632 Term a = AbsAppl(HR);
635 for (arity_t i = 0; i < n-1; i++) {
636 ptr[0] = (CELL)FunctorComma;
637 ptr[1] = MkGlobal(ts[i]);
638 ptr[2] = AbsAppl(ptr + 3);
649void YAPQuery::openQuery() {
651 if (ap == NULL || ap->OpcodeOfPred == UNDEF_OPCODE) {
652 ap = rewriteUndefQuery();
662 BACKUP_MACHINE_REGS();
663 arity_t arity = ap.getArity();
667 q.CurSlot = Yap_StartSlots();
671 q.b0 = LCL0-CellPtr(B);
673 for (arity_t i = 0; i < arity; i++)
674 XREGS[i + 1] = ts[i].term();
678 result = YAP_EnterGoal(ap.ap,
nullptr, &q);
679 YAP_LeaveGoal(result, &q);
683 RECOVER_MACHINE_REGS();
697 BACKUP_MACHINE_REGS();
700 q.CurSlot = Yap_StartSlots();
704 Int oB = LCL0-CellPtr(B);
706 if (IsStringTerm(tmod))
707 tmod = MkAtomTerm(Yap_LookupAtom(StringOfTerm(tmod)));
708 ap = Yap_get_pred(t, tmod,
"C++");
710 ap->OpcodeOfPred == UNDEF_OPCODE) {
711 ap = rewriteUndefEngineQuery(ap, t, tmod);
713 if (
false && ap->PredFlags & MetaPredFlag) {
716 ARG1 = Yap_MkApplTerm(FunctorModule,2,ts);
721 else if (IsPairTerm(t))
725 arity_t arity = ap->ArityOfPE;
727 for (arity_t i = 0; i < arity; i++) {
728 XREGS[i + 1] = ts[i];
736 Term ocmod = CurrentModule;
737 Term osmod = LOCAL_SourceModule;
738 CurrentModule = LOCAL_SourceModule = tmod;
739 result = (bool)YAP_EnterGoal(ap,
nullptr, &q);
740 LOCAL_SourceModule = osmod;
741 CurrentModule = ocmod;
743 YAP_LeaveGoal(result, &q);
749 RECOVER_MACHINE_REGS();
757 BACKUP_MACHINE_REGS();
760 RECOVER_MACHINE_REGS();
763Term YAPEngine::fun(Term t) {
765 BACKUP_MACHINE_REGS();
772 q.CurSlot = Yap_StartSlots();
777 Int oB = LCL0-CellPtr(B);
782 name = NameOfFunctor(f);
783 arity = ArityOfFunctor(f);
784 for (arity_t i = 0; i < arity; i++)
787 }
else if (IsAtomTerm(t)) {
788 name = AtomOfTerm(t);
791 }
else if (IsPairTerm(t)) {
798 Yap_CloseSlots(q.CurSlot);
802 Term ot = XREGS[arity + 1] = MkVarTerm();
803 yhandle_t h = Yap_InitHandle(ot);
806 f = Yap_MkFunctor(name, arity);
807 ap = (
PredEntry *)(PredPropByFunc(f, tmod));
808 if (ap ==
nullptr || ap->OpcodeOfPred == UNDEF_OPCODE) {
809 Term g = (Yap_MkApplTerm(f, arity, ts));
810 ap = rewriteUndefEngineQuery(ap, g, (ap->ModuleOfPred));
816 bool result = (bool)YAP_EnterGoal(ap,
nullptr, &q);
818 ot = Yap_GetFromHandle(h);
824 YAP_LeaveGoal(result, &q);
829 RECOVER_MACHINE_REGS();
830 Yap_CloseSlots(q.CurSlot);
839 BACKUP_MACHINE_REGS();
845 nts = RepAppl(goal) + 1;
846 size_t arity = f.arity();
847 for (arity_t i = 0; i < arity; i++)
848 XREGS[i + 1] = nts[i];
854 RECOVER_MACHINE_REGS();
861 BACKUP_MACHINE_REGS();
865 size_t arity = f.arity();
866 goal = Yap_MkApplTerm(Yap_MkFunctor(f.name().asAtom(),arity), arity, ts);
867 nts = RepAppl(goal) + 1;
868 for (arity_t i = 0; i < arity; i++)
869 XREGS[i + 1] = ts[i];
875 RECOVER_MACHINE_REGS();
881 BACKUP_MACHINE_REGS();
889 openQuery(term(), nts);
890 RECOVER_MACHINE_REGS();
895 BACKUP_MACHINE_REGS();
897 arity_t arity = p.ap->ArityOfPE;
900 for (arity_t i = 0; i < arity; i++)
901 XREGS[i + 1] = ts[i].term();
904 goal = MkAtomTerm((
Atom)(p.ap->FunctorOfPred));
910 RECOVER_MACHINE_REGS();
917 q_h.CurSlot = Yap_StartSlots();
921 sigjmp_buf buf, *oldp = (sigjmp_buf *)LOCAL_RestartEnv;
923 BACKUP_MACHINE_REGS();
926 LOCAL_RestartEnv = &buf;
928 __android_log_print(ANDROID_LOG_INFO,
"YAPDroid",
"exec ");
932 result = (bool)YAP_EnterGoal(ap,
nullptr, &q_h);
934 LOCAL_AllowRestart = q_open;
935 result = (bool)YAP_RetryGoal(&q_h);
938 __android_log_print(ANDROID_LOG_INFO,
"YAPDroid",
"out %d", result);
940 YAP_LeaveGoal(result, &q_h);
941 Yap_CloseHandles(q_h.CurSlot);
944 YAP_LeaveGoal(result, &q_h);
949 RECOVER_MACHINE_REGS();
950 LOCAL_RestartEnv = oldp;
954PredEntry *YAPQuery::rewriteUndefQuery() {
956 ts[0] = CurrentModule;
958 goal = Yap_MkApplTerm(FunctorModule, 2, ts);
959 ARG1 = goal = Yap_SaveTerm(goal);
960 return ap = PredCall;
968 tgoal = Yap_MkApplTerm(FunctorModule, 2, ts);
969 tgoal = Yap_SaveTerm(Yap_MkApplTerm(FunctorCall, 1, &tgoal));
970 LOCAL_ActiveError->errorNo = YAP_NO_ERROR;
979 BACKUP_MACHINE_REGS();
980 if (!q_open || q_state == 0)
982 YAP_LeaveGoal(
true, &q_h);
985 RECOVER_MACHINE_REGS();
991 BACKUP_MACHINE_REGS();
992 if (!q_open || q_state == 0)
996 RECOVER_MACHINE_REGS();
1004 RECOVER_MACHINE_REGS();
1007 if (q_open !=
true || q_state == 0) {
1008 RECOVER_MACHINE_REGS();
1011 YAP_LeaveGoal(
false, &q_h);
1013 Yap_CloseHandles(q_h.CurSlot);
1015 RECOVER_MACHINE_REGS();
1025extern JNIEXPORT jint JNICALL JNI_MySQLOnLoad(JavaVM *vm,
void *reserved);
1027JNIEXPORT jint JNICALL JNI_MySQLOnLoad(JavaVM *vm,
void *reserved) {
1029 if (vm->GetEnv(
reinterpret_cast<void **
>(&env), JNI_VERSION_1_6) != JNI_OK) {
1034 return JNI_VERSION_1_6;
1037char *Yap_AndroidBufp;
1039static size_t Yap_AndroidMax, Yap_AndroidSz;
1041extern void (*Yap_DisplayWithJava)(
int c);
1045void Yap_displayWithJava(
int c) {
1046 char *ptr = Yap_AndroidBufp;
1048 ptr = Yap_AndroidBufp = (
char *)malloc(Yap_AndroidSz);
1049 ptr[Yap_AndroidSz++] = c;
1050 if (Yap_AndroidMax - 1 == Yap_AndroidSz) {
1051 if (Yap_AndroidMax < 32 * 1024) {
1052 Yap_AndroidMax *= 2;
1054 Yap_AndroidMax += 32 * 1024;
1056 Yap_AndroidBufp = (
char *)realloc(ptr, Yap_AndroidMax);
1058 Yap_AndroidBufp[Yap_AndroidSz] =
'\0';
1060 Yap_AndroidBufp[Yap_AndroidSz] =
'\0';
1061 cb->run(Yap_AndroidBufp);
1068void YAPEngine::doInit(YAP_file_type_t BootMode,
YAPEngineArgs *engineArgs) {
1069 if (GLOBAL_Initialised)
1071 GLOBAL_Initialised =
true;
1072 YAP_Init(engineArgs);
1074CurrentModule = LOCAL_SourceModule = TermUser;
1084 CurrentModule = TermUser;
1085 LOCAL_SourceModule = TermUser;
1092 YAP_file_type_t BootMode;
1099 doInit(BootMode, engine_args);
1100 CurrentModule = LOCAL_SourceModule = TermUser;
1105 ap = RepPredProp(PredPropByAtom(at.a, Yap_CurrentModule()));
1111 Functor f = Yap_MkFunctor(at.a, arity);
1112 ap = RepPredProp(PredPropByFunc(f, Yap_CurrentModule()));
1114 ap = RepPredProp(PredPropByAtom(at.a, Yap_CurrentModule()));
1121 t = Yap_StripModule(t, &
m);
1123 if (IsVarTerm(t) || IsNumTerm(t)) {
1126 else if (IsNumTerm(t))
1129 if (IsAtomTerm(t)) {
1130 ap = RepPredProp(PredPropByAtom(AtomOfTerm(t),
m));
1132 }
else if (IsPairTerm(t)) {
1133 Term ts[2], *s = (out ? out : ts);
1134 Functor FunctorConsult = Yap_MkFunctor(Yap_LookupAtom(
"consult"), 1);
1137 t = Yap_MkApplTerm(FunctorModule, 2, s);
1138 t = Yap_MkApplTerm(FunctorConsult, 1, &t);
1140 out = RepAppl(t) + 1;
1143 if (IsExtensionFunctor(f)) {
1146 ap = RepPredProp(PredPropByFunc(f,
m));
1148 memmove(out, (
const CELL *)RepAppl(t) + 1, ap->ArityOfPE *
sizeof(CELL));
1150 out = RepAppl(t) + 1;
1158 RECOVER_MACHINE_REGS();
1162 Yap_cclause(tt, ap->ArityOfPE, (last ? TermAssertz : TermAsserta), Yap_CurrentModule());
1164 if (LOCAL_ErrorMessage) {
1165 RECOVER_MACHINE_REGS();
1169 if (Yap_addclause(ntt, codeaddr, (last ? TermAssertz : TermAsserta),
1170 Yap_CurrentModule(), tref)) {
1171 RECOVER_MACHINE_REGS();
1179 RECOVER_MACHINE_REGS();
1180 Term tt = AbsAppl(HR);
1181 *HR++ = (CELL)(ap->FunctorOfPred);
1182 for (i = 0; i < ap->ArityOfPE; i++, cl++)
1184 yamop *codeaddr = Yap_cclause(tt, ap->ArityOfPE, (last ? TermAssertz : TermAsserta), Yap_CurrentModule());
1186 if (LOCAL_ErrorMessage) {
1187 RECOVER_MACHINE_REGS();
1191 if (Yap_addclause(tt, codeaddr, (last ? TermAssertz : TermAsserta),
1192 Yap_CurrentModule(), tref)) {
1193 RECOVER_MACHINE_REGS();
1208 if (info->
errorNo == YAP_NO_ERROR)
1213 sprintf(buf,
"%ld", (
long int)info->
errorLine);
1215 s +=
":0 in C-code";
1249 if (B && B->cp_b && B->cp_ap != NOCODE)
1251 LOCAL_ActiveError->errorNo = YAP_NO_ERROR;
1252 if (LOCAL_CommittedError) {
1253 LOCAL_CommittedError->errorNo = YAP_NO_ERROR;
1254 free(LOCAL_CommittedError);
1255 LOCAL_CommittedError = NULL;
1265 ARG1 = YAP_ReadBuffer(s.data(), &tp);
1273 ts[0] = MkAddressTerm(Q);
1279 return YAP_MkApplTerm(YAP_MkFunctor(YAP_LookupAtom(
"t"), 2), 2, ts);
1287 ts[0] = MkAddressTerm(Q);
1293 return YAP_MkApplTerm(YAP_MkFunctor(YAP_LookupAtom(
"t"), 2), 2, ts);
X_API YAP_file_type_t YAP_parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
Parse command line.
bool Yap_ResetException(yap_error_descriptor_t *i)
clean up (notice that the code ensures ActiveError exists on exit
@ argv
read-only atom, it describes the list with all arguments received by YAP at boot
@ source
If true maintain the source for all clauses.
PredEntry * getPred(Term &t, Term &tm, CELL *&outp)
auxiliary routine to find a predicate in the current module
YAPPredicate()
Empty constructor for predicates.
bool assertFact(YAPTerm *tuple, bool last=true)
add a new tuple
bool assertClause(YAPTerm clause, bool last=true, YAPTerm source=YAPTerm())
add a new clause
void * retractClause(YAPTerm skeleton, bool all=false)
retract at least the first clause matching the predicate
std::string text()
the term that caused the bug
take information on a Prolog error:
const char * getName(void)
get name of atom
Atom A YAP data-base is a collection of atoms, where each atom has a name and a set of Properties.
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)
void reSet()
reset Prolog state
Term Yap_CurrentModule()
current module for the engine
void release()
assune that there are no stack pointers, just release memory
const char * text()
represent the top-goal
Term next_answer(YAPQuery *&Q)
void close()
remove alternatives in the current search space, and finish the current query finish the current quer...
bool deterministic()
does this query have open choice-points? or is it deterministic?
bool next()
ask for the next solution of the current query same call for every solution
bool call(YAPPredicate ap, YAPTerm ts[])
current directory for the engine
YAPTerm getTerm(yhandle_t t)
convert a ref to a binding
bool mgoal(Term t, Term tmod, bool release=false)
ru1n a goal in a module
void cut()
query variables
This class implements a callback Prolog-side.
Setup all arguments to a new engine.
Term deepCopy()
copy the term ( term copy )
void mk(Term t0)
create a new YAPTerm from a term
Term car()
Extract the first element of a list.
YAP_tag_t tag()
construct a term out of an integer (if you know object type use YAPIntegerTerm) YAPTerm(long int num)...
Term gt()
handle to term, equivalent to term_t
YAPTerm()
private method to convert from Term (internal YAP representation) to YAPTerm
Term & operator[](size_t n)
Extract the nth element.
virtual Term getArg(arity_t i)
term is a list
YAPStringTerm(char *s)
your standard constructor
virtual arity_t arity()
extract the arity of the term variables have arity 0
virtual const char * text()
return a string with a textual representation of the term
Term cdr()
Extract the tail elements of a list.
YAPApplTerm(Term t0)
There are very many ways to build one of these terms:
Term & operator[](arity_t n)
from YAPTerm to Term (internal YAP representation) fetch a sub-term
uintptr_t prologPredLine
line where error clause defined
const char * errorFunction
C-function.
const char * errorFile
C-file.
yap_error_number errorNo
error identifier
yap_error_class_number errorClass
kind of error: derived from errorNo;
const char * prologPredName
Prolog predicate that caused the error: name.
char * classAsText
errorClass as text
char * errorAsText
errorNo as text
const char * prologPredFile
Prolog predicate that caused the error:line
intptr_t errorLine
c-code that generated the error C-line
const char * prologPredModule
Prolog predicate that caused the error:module
uintptr_t prologPredArity
Prolog predicate that caused the error:arity.
entry file for the YAP C++ interface
#define SOURCE()
short version