indenting

This commit is contained in:
Vítor Santos Costa 2015-10-20 08:13:09 +01:00
parent c26e5afaf0
commit cc6949681b
5 changed files with 1667 additions and 1854 deletions

File diff suppressed because it is too large Load Diff

View File

@ -15,26 +15,26 @@
* *
*************************************************************************/
#ifdef SCCS
static char SccsId[] = "%W% %G%";
static char SccsId[] = "%W% %G%";
#endif
a
/*
* This file is an entry for user defined C-predicates.
* This file is an entry for user defined C-predicates.
*
* There are two sorts of C-Predicates: deterministic - which should be defined
* in the function InitUserCPreds().
* in the function InitUserCPreds().
*
* backtrackable - they include a start and a continuation function, the first
* one called by the first invocation, the last one called after a fail. This
* can be seen as: pred :- init ; repeat, cont. These predicates should be
* defined in the function InitUserBacks()
* defined in the function InitUserBacks()
*
* These two functions are called after any "restore" operation.
* These two functions are called after any "restore" operation.
*
* The function InitUserExtensions() is called once, when starting the execution
* of the program, and should be used to initialize any user-defined
* extensions (like the execution environment or interfaces to other
* programs).
* programs).
*
*/
@ -51,7 +51,8 @@ static char SccsId[] = "%W% %G%";
/* You should include here the prototypes for all static functions */
#ifdef EUROTRA
static int p_clean(void);
static int
p_clean(void);
static int p_namelength(void);
static int p_getpid(void);
static int p_exit(void);
@ -63,48 +64,43 @@ static int p_subsumes(void);
static int p_grab_tokens(void);
#endif
#ifdef MACYAP
static typedef int(*SignalProc) ();
static typedef int (*SignalProc)();
static SignalProc skel_signal(int, SignalProc);
static int chdir(char *);
#endif
#ifdef SFUNC
static int p_softfunctor(void);
#endif /* SFUNC */
#endif /* SFUNC */
#ifdef USERPREDS
/* These are some examples of user-defined functions */
/*
* unify(A,B) --> unification with occurs-check it uses the functions
* full_unification and occurs_in
* full_unification and occurs_in
*
* occurs_check(V,S) :- var(S), !, S \== V. occurs_check(V,S) :- primitive(S),
* !. occurs_check(V,[H|T]) :- !, occurs_check(V,H), occurs_check(V,T).
* occurs_check(V,St) :- functor(T,_,N), occurs_check_struct(N,V,St).
* occurs_check(V,St) :- functor(T,_,N), occurs_check_struct(N,V,St).
*
* occurs_check_struct(1,V,T) :- !, arg(1,T,A), occurs_check(V,A).
* occurs_check_struct(N,V,T) :- N1 is N-1, occurs_check_structure(N1,V,T),
* arg(N,T,A), occurs_check(V,A).
* arg(N,T,A), occurs_check(V,A).
*
* unify(X,Y) :- var(X), var(Y), !, X = Y. unify(X,Y) :- var(X), !,
* occurs_check(X,Y), X = Y. unify(X,Y) :- var(Y), !, occurs_check(Y,X), X =
* Y. unify([H0|T0],[H1|T1]) :- !, unify(H0,H1), unify(T0,T1). unify(X,Y) :-
* functor(X,A,N), functor(Y,A,N), unify_structs(N,X,Y).
* functor(X,A,N), functor(Y,A,N), unify_structs(N,X,Y).
*
* unify_structs(1,X,Y) :- !, arg(1,X,A), arg(1,Y,B), unify(A,B).
* unify_structs(N,Y,Z) :- N1 is N-1, unify_structs(N1,X,Y), arg(N,X,A),
* arg(N,Y,B), unify(A,B).
* arg(N,Y,B), unify(A,B).
*/
/* occurs-in --> checks if the variable V occurs in term S */
static int
occurs_check(V, T)
Term V, T;
static int occurs_check(V, T) Term V, T;
{
/* V and S are always derefed */
if (IsVarTerm(T)) {
@ -112,15 +108,14 @@ occurs_check(V, T)
} else if (IsPrimitiveTerm(T)) {
return (TRUE);
} else if (IsPairTerm(T)) {
return (occurs_check(V, HeadOfTerm(T))
&& occurs_check(V, TailOfTerm(T)));
return (occurs_check(V, HeadOfTerm(T)) && occurs_check(V, TailOfTerm(T)));
} else if (IsApplTerm(T)) {
unsigned int i;
unsigned int i;
unsigned int arity = ArityOfFunctor(FunctorOfTerm(T));
for (i = 1; i <= arity; ++i)
if (!occurs_check(V, ArgOfTerm(i, T)))
return (FALSE);
return (FALSE);
return (TRUE);
}
return (FALSE);
@ -131,13 +126,11 @@ occurs_check(V, T)
arguments before dereferencing, otherwise unify() won't be
to wake possible bound variables
*/
static int
full_unification(T1, T2)
Term T1, T2;
static int full_unification(T1, T2) Term T1, T2;
{
Term t1 = Deref(T1);
Term t2 = Deref(T2);
if (IsVarTerm(t1)) { /* Testing for variables should be done first */
if (IsVarTerm(t1)) {/* Testing for variables should be done first */
if (IsVarTerm(t2) || IsPrimitiveTerm(t2))
return (Yap_unify(T1, t2));
if (occurs_check(t1, t2))
@ -151,11 +144,11 @@ Term T1, T2;
}
if (IsPrimitiveTerm(t1)) {
if (IsFloatTerm(t1))
return(IsFloatTerm(t2) && FloatOfTerm(t1) == FloatOfTerm(t2));
return (IsFloatTerm(t2) && FloatOfTerm(t1) == FloatOfTerm(t2));
else if (IsRefTerm(t1))
return(IsRefTerm(t2) && RefOfTerm(t1) == RefOfTerm(t2));
return (IsRefTerm(t2) && RefOfTerm(t1) == RefOfTerm(t2));
if (IsLongIntTerm(t1))
return(IsLongIntTerm(t2) && LongIntOfTerm(t1) == LongIntOfTerm(t2));
return (IsLongIntTerm(t2) && LongIntOfTerm(t1) == LongIntOfTerm(t2));
else
return (t1 == t2);
}
@ -163,10 +156,10 @@ Term T1, T2;
if (!IsPairTerm(t2))
return (FALSE);
return (full_unification(HeadOfTermCell(t1), HeadOfTermCell(t2)) &&
full_unification(TailOfTermCell(t1), TailOfTermCell(t2)));
full_unification(TailOfTermCell(t1), TailOfTermCell(t2)));
}
if (IsApplTerm(t1)) {
unsigned int i, arity;
unsigned int i, arity;
if (!IsApplTerm(t2))
return (FALSE);
if (FunctorOfTerm(t1) != FunctorOfTerm(t2))
@ -174,7 +167,7 @@ Term T1, T2;
arity = ArityOfFunctor(FunctorOfTerm(t1));
for (i = 1; i <= arity; ++i)
if (!full_unification(ArgOfTermCell(i, t1), ArgOfTerm(i, t2)))
return (FALSE);
return (FALSE);
return (TRUE);
}
#ifdef lint
@ -182,36 +175,29 @@ Term T1, T2;
#endif
}
static int
p_occurs_check()
{ /* occurs_check(?,?) */
static int p_occurs_check() { /* occurs_check(?,?) */
return (occurs_check(Deref(ARG1), Deref(DARG2)));
}
/* Out of date, use unify_with_occurs_check instead*/
static int
p_unify()
{ /* unify(?,?) */
static int p_unify() { /* unify(?,?) */
/* routines that perform unification must receive the original arguments */
return (full_unification(ARG1, ARG2));
}
/*
* One example of a counter using the atom value functions counter(Atom,M,N)
* One example of a counter using the atom value functions counter(Atom,M,N)
*
* If the second argument is uninstantiated, then it will be unified with the
* current value of the counter, otherwyse the counter will be set to its
* value. The third argument then be unified with the next integer, which
* will become the current counter value.
* will become the current counter value.
*/
static int
p_counter()
{ /* counter(+Atom,?Number,?Next) */
Term TCount, TNext, T1, T2;
Atom a;
static int p_counter() { /* counter(+Atom,?Number,?Next) */
Term TCount, TNext, T1, T2;
Atom a;
/* Int -> an YAP integer */
Int val;
Int val;
T1 = Deref(ARG1);
ARG2 = Deref(ARG2);
@ -223,7 +209,7 @@ p_counter()
TCount = Yap_GetValue(a);
if (!IsIntTerm(TCount))
return (FALSE);
Yap_unify_constant(ARG2, TCount); /* always succeeds */
Yap_unify_constant(ARG2, TCount); /* always succeeds */
val = IntOfTerm(TCount);
} else {
if (!IsIntTerm(T2))
@ -238,24 +224,22 @@ p_counter()
/*
* Concatenate an instantiated list to another list, and unify with third
* argument
* argument
*/
/*
* In order to be more efficient, iconcat instead of unifying the terms in
* the old structure with the ones in the new one just copies them. This is a
* dangerous behaviour, though acceptable in this case, and you should try to
* avoid it whenever possible
* avoid it whenever possible
*/
#ifdef COMMENT
static int
p_iconcat()
{ /* iconcat(+L1,+L2,-L) */
Term Tkeep[1025]; /* Will do it just for lists less
* than 1024 elements long */
register Term *Tkp = Tkeep;
register Term L0, L1;
Term T2;
static int p_iconcat() { /* iconcat(+L1,+L2,-L) */
Term Tkeep[1025]; /* Will do it just for lists less
* than 1024 elements long */
register Term *Tkp = Tkeep;
register Term L0, L1;
Term T2;
L0 = Deref(ARG1);
*Tkp++ = Unsigned(0);
@ -263,7 +247,7 @@ p_iconcat()
while (L0 != L1) {
/*
* Usually you should test if L1 a var, if (!IsPairTerm(L0))
* return(FALSE);
* return(FALSE);
*/
*Tkp++ = HeadOfTerm(L0);
L0 = TailOfTerm(L0);
@ -274,14 +258,12 @@ p_iconcat()
T2 = L1;
return (Yap_unify(T2, ARG3));
}
#endif /* COMMENT */
#endif /* COMMENT */
static int
p_iconcat()
{ /* iconcat(+L1,+L2,-L) */
register Term *Tkp = H, *tp;
register Term L0, L1;
Term T2;
static int p_iconcat() { /* iconcat(+L1,+L2,-L) */
register Term *Tkp = H, *tp;
register Term L0, L1;
Term T2;
L0 = Deref(ARG1);
L1 = TermNil;
@ -302,36 +284,34 @@ p_iconcat()
#ifdef EUROTRA
static int
p_clean() /* predicate clean for ets */
/*
* clean(FB,CFB) :- FB =.. [fb|L],!, clean1(L,CL), CFB =.. [fb|CL].
* clean(FB,CFB) :- var(FB).
*
* clean1([],[]) :- !. clean1([H|T],[CH|CT]) :- H==$u,!, clean1(T,CT).
* clean1([H|T],[H|CT]) :- clean1(T,CT).
*/
static int p_clean() /* predicate clean for ets */
/*
* clean(FB,CFB) :- FB =.. [fb|L],!, clean1(L,CL), CFB =.. [fb|CL].
* clean(FB,CFB) :- var(FB).
*
* clean1([],[]) :- !. clean1([H|T],[CH|CT]) :- H==$u,!, clean1(T,CT).
* clean1([H|T],[H|CT]) :- clean1(T,CT).
*/
{
unsigned int arity, i;
Term t, Args[255];
unsigned int arity, i;
Term t, Args[255];
Term t1 = Deref(ARG1);
if (IsVarTerm(t1))
return (TRUE);
if (!(IsApplTerm(t1)
&& NameOfFunctor(FunctorOfTerm(t1)) == AtomFB))
if (!(IsApplTerm(t1) && NameOfFunctor(FunctorOfTerm(t1)) == AtomFB))
return (FALSE);
arity = ArityOfFunctor(FunctorOfTerm(t1));
#ifdef SFUNC
if (arity == SFArity) {
CELL *pt = H, *ntp = ArgsOfSFTerm(t1);
Term tn = AbsAppl(H);
CELL *pt = H, *ntp = ArgsOfSFTerm(t1);
Term tn = AbsAppl(H);
*pt++ = FunctorOfTerm(t1);
RESET_VARIABLE(pt);
pt++;
while (*pt++ = *ntp++)
if ((*pt++ = *ntp++) == MkAtomTerm(AtomDollarUndef))
pt -= 2;
pt -= 2;
H = pt;
return (Yap_unify(tn, ARG2));
}
@ -345,16 +325,14 @@ p_clean() /* predicate clean for ets */
return (Yap_unify(ARG2, t));
}
static Term *subs_table;
static int subs_entries;
#define SUBS_TABLE_SIZE 500
static Term *subs_table;
static int subs_entries;
#define SUBS_TABLE_SIZE 500
static int
subsumes(T1, T2)
Term T1, T2;
static int subsumes(T1, T2) Term T1, T2;
{
int i;
int i;
if (IsVarTerm(T1)) {
if (!IsVarTerm(T2))
return (FALSE);
@ -362,14 +340,14 @@ Term T1, T2;
return (TRUE);
for (i = 0; i < subs_entries; ++i)
if (subs_table[i] == T2)
return (FALSE);
if (T2 < T1) { /* T1 gets instantiated with T2 */
return (FALSE);
if (T2 < T1) {/* T1 gets instantiated with T2 */
Yap_unify(T1, T2);
for (i = 0; i < subs_entries; ++i)
if (subs_table[i] == T1) {
subs_table[i] = T2;
return (TRUE);
}
if (subs_table[i] == T1) {
subs_table[i] = T2;
return (TRUE);
}
subs_table[subs_entries++] = T2;
return (TRUE);
}
@ -377,23 +355,23 @@ Term T1, T2;
Yap_unify(T1, T2);
for (i = 0; i < subs_entries; ++i)
if (subs_table[i] == T1)
return (TRUE);
return (TRUE);
subs_table[subs_entries++] = T1;
return (TRUE);
}
if (IsVarTerm(T2)) {
for (i = 0; i < subs_entries; ++i)
if (subs_table[i] == T2)
return (FALSE);
return (FALSE);
return (Yap_unify(T1, T2));
}
if (IsPrimitiveTerm(T1)) {
if (IsFloatTerm(T1))
return(IsFloatTerm(T2) && FloatOfTerm(T1) == FloatOfTerm(T2));
return (IsFloatTerm(T2) && FloatOfTerm(T1) == FloatOfTerm(T2));
else if (IsRefTerm(T1))
return(IsRefTerm(T2) && RefOfTerm(T1) == RefOfTerm(T2));
return (IsRefTerm(T2) && RefOfTerm(T1) == RefOfTerm(T2));
else if (IsLongIntTerm(T1))
return(IsLongIntTerm(T2) && LongIntOfTerm(T1) == LongIntOfTerm(T2));
return (IsLongIntTerm(T2) && LongIntOfTerm(T1) == LongIntOfTerm(T2));
else
return (T1 == T2);
}
@ -401,10 +379,10 @@ Term T1, T2;
if (!IsPairTerm(T2))
return (FALSE);
return (subsumes(HeadOfTerm(T1), HeadOfTerm(T2)) &&
subsumes(TailOfTerm(T1), TailOfTerm(T2)));
subsumes(TailOfTerm(T1), TailOfTerm(T2)));
}
if (IsApplTerm(T1)) {
int arity;
int arity;
if (!IsApplTerm(T2))
return (FALSE);
if (FunctorOfTerm(T1) != FunctorOfTerm(T2))
@ -412,103 +390,100 @@ Term T1, T2;
arity = ArityOfFunctor(FunctorOfTerm(T1));
#ifdef SFUNC
if (arity == SFArity) {
CELL *a1a = ArgsOfSFTerm(T1), *a2a = ArgsOfSFTerm(T2);
CELL *a1p = a1a - 1, *a2p = a2a - 1;
CELL *pt = H;
int flags = 0;
Term t1, t2;
CELL *a1a = ArgsOfSFTerm(T1), *a2a = ArgsOfSFTerm(T2);
CELL *a1p = a1a - 1, *a2p = a2a - 1;
CELL *pt = H;
int flags = 0;
Term t1, t2;
*pt++ = FunctorOfTerm(T1);
RESET_VARIABLE(pt);
pt++;
while (1) {
if (*a2a < *a1a || *a1a == 0) {
if (*a2a) {
*pt++ = *a2a++;
t2 = Derefa(a2a);
++a2a;
if (!IsVarTerm(t2))
return (FALSE);
for (i = 0; i < subs_entries; ++i)
if (subs_table[i] == t2)
return (FALSE);
subs_table[subs_entries++] = t2;
*pt++ = t2;
flags |= 1;
} else { /* T2 is finished */
if ((flags & 1) == 0) { /* containned in first */
*a2p = Unsigned(a1p - 1);
if (a2p < HB)
*TR++ = Unsigned(a2p);
return (TRUE);
}
while ((*pt++ = *a1a++));
*a1p = Unsigned(H);
if (a1p < HB)
*TR++ = Unsigned(a1p);
*a2p = Unsigned(H);
if (a2p < HB)
*TR++ = Unsigned(a2p);
H = pt;
return (TRUE);
}
} else if (*a2a > *a1a || *a2a == 0) {
*pt++ = *a1a++;
t1 = Derefa(a1a);
++a1a;
if (IsVarTerm(t1)) {
for (i = 0; i < subs_entries; ++i)
if (subs_table[i] == t1)
break;
if (i >= subs_entries)
subs_table[subs_entries++] = t1;
}
*pt++ = t1;
flags |= 2;
} else if (*a1a == *a2a) {
*pt++ = *a1a++;
++a2a;
t1 = Derefa(a1a);
++a1a;
t2 = Derefa(a2a);
++a2a;
*pt++ = t1;
if (!subsumes(t1, t2))
return (FALSE);
}
if (*a2a < *a1a || *a1a == 0) {
if (*a2a) {
*pt++ = *a2a++;
t2 = Derefa(a2a);
++a2a;
if (!IsVarTerm(t2))
return (FALSE);
for (i = 0; i < subs_entries; ++i)
if (subs_table[i] == t2)
return (FALSE);
subs_table[subs_entries++] = t2;
*pt++ = t2;
flags |= 1;
} else { /* T2 is finished */
if ((flags & 1) == 0) {/* containned in first */
*a2p = Unsigned(a1p - 1);
if (a2p < HB)
*TR++ = Unsigned(a2p);
return (TRUE);
}
while ((*pt++ = *a1a++))
;
*a1p = Unsigned(H);
if (a1p < HB)
*TR++ = Unsigned(a1p);
*a2p = Unsigned(H);
if (a2p < HB)
*TR++ = Unsigned(a2p);
H = pt;
return (TRUE);
}
} else if (*a2a > *a1a || *a2a == 0) {
*pt++ = *a1a++;
t1 = Derefa(a1a);
++a1a;
if (IsVarTerm(t1)) {
for (i = 0; i < subs_entries; ++i)
if (subs_table[i] == t1)
break;
if (i >= subs_entries)
subs_table[subs_entries++] = t1;
}
*pt++ = t1;
flags |= 2;
} else if (*a1a == *a2a) {
*pt++ = *a1a++;
++a2a;
t1 = Derefa(a1a);
++a1a;
t2 = Derefa(a2a);
++a2a;
*pt++ = t1;
if (!subsumes(t1, t2))
return (FALSE);
}
}
}
#endif
for (i = 1; i <= arity; ++i)
if (!subsumes(ArgOfTerm(i, T1), ArgOfTerm(i, T2)))
return (FALSE);
return (FALSE);
return (TRUE);
}
return (FALSE);
}
static int
p_subsumes()
{
Term work_space[SUBS_TABLE_SIZE];
static int p_subsumes() {
Term work_space[SUBS_TABLE_SIZE];
subs_table = work_space;
subs_entries = 0;
return (subsumes(Deref(ARG1), Deref(ARG2)));
}
static int
p_namelength()
{
register Term t = Deref(ARG1);
Term tf;
static int p_namelength() {
register Term t = Deref(ARG1);
Term tf;
if (IsVarTerm(t)) {
return (FALSE);
}
if (IsAtomTerm(t)) {
Term tf = MkIntTerm(strlen(RepAtom(AtomOfTerm(t))->StrOfAE));
Term tf = MkIntTerm(strlen(RepAtom(AtomOfTerm(t))->StrOfAE));
return (Yap_unify_constant(ARG2, tf));
} else if (IsIntTerm(t)) {
register int i = 1, k = IntOfTerm(t);
register int i = 1, k = IntOfTerm(t);
if (k < 0)
++i, k = -k;
while (k > 10)
@ -519,43 +494,35 @@ p_namelength()
return (FALSE);
}
static int
p_getpid()
{
static int p_getpid() {
#ifndef MPW
Term t = MkIntTerm(getpid());
Term t = MkIntTerm(getpid());
#else
Term t = MkIntTerm(1);
Term t = MkIntTerm(1);
#endif
return (Yap_unify_constant(ARG1, t));
}
static int
p_exit()
{
register Term t = Deref(ARG1);
static int p_exit() {
register Term t = Deref(ARG1);
if (IsVarTerm(t) || !IsIntTerm(t))
return (FALSE);
Yap_exit((int) IntOfTerm(t));
return(FALSE);
Yap_exit((int)IntOfTerm(t));
return (FALSE);
}
static int current_pos;
static int current_pos;
static int
p_incrcounter()
{
register Term t = Deref(ARG1);
static int p_incrcounter() {
register Term t = Deref(ARG1);
if (IsVarTerm(t) || !IsIntTerm(t))
return (FALSE);
current_pos += IntOfTerm(t);
return (TRUE);
}
static int
p_setcounter()
{
register Term t = Deref(ARG1);
static int p_setcounter() {
register Term t = Deref(ARG1);
if (IsVarTerm(t) || !IsIntTerm(t)) {
return (Yap_unify_constant(ARG1, MkIntTerm(current_pos)));
} else {
@ -566,34 +533,30 @@ p_setcounter()
#include <signal.h>
#ifdef MACYAP
#define signal(A,B) skel_signal(A,B)
#define signal(A, B) skel_signal(A, B)
#endif
#ifndef EOF
#define EOF -1
#define EOF -1
#endif
static int
p_trapsignal(void)
{
static int p_trapsignal(void) {
#ifndef MPW
signal(SIGINT, SIG_IGN);
#endif
return (TRUE);
}
#define varstarter(ch) ((ch >= 'A' && ch <= 'Z') || ch == '_')
#define idstarter(ch) (ch >= 'a' && ch <= 'z')
#define idchar(ch) \
((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || \
(ch >= 'a' && ch <= 'z') || ch == '_')
#define varstarter(ch) ((ch>='A' && ch<='Z') || ch=='_')
#define idstarter(ch) (ch>='a' && ch<='z')
#define idchar(ch) ((ch>='0' && ch<='9') || (ch>='A' && ch<='Z') || \
(ch>='a' && ch<='z') || ch=='_')
static int
p_grab_tokens()
{
Term *p = ASP - 20, *p0, t;
Functor IdFunctor, VarFunctor;
char ch, IdChars[256], *chp;
static int p_grab_tokens() {
Term *p = ASP - 20, *p0, t;
Functor IdFunctor, VarFunctor;
char ch, IdChars[256], *chp;
IdFunctor = FunctorId;
VarFunctor = FunctorVar;
@ -605,33 +568,33 @@ p_grab_tokens()
if (ch == '.' || ch == EOF)
break;
if (ch == '%') {
while ((ch = Yap_PlGetchar()) != 10);
while ((ch = Yap_PlGetchar()) != 10)
;
ch = Yap_PlGetchar();
continue;
}
if (ch == '\'') {
chp = IdChars;
while (1) {
ch = Yap_PlGetchar();
if (ch == '\'')
break;
*chp++ = ch;
ch = Yap_PlGetchar();
if (ch == '\'')
break;
*chp++ = ch;
}
*chp = 0;
t = MkAtomTerm(Yap_LookupAtom(IdChars));
*p-- = Yap_MkApplTerm(IdFunctor, 1, &t);
ch = Yap_PlGetchar();
continue;
}
if (varstarter(ch)) {
chp = IdChars;
*chp++ = ch;
while (1) {
ch = Yap_PlGetchar();
if (!idchar(ch))
break;
*chp++ = ch;
ch = Yap_PlGetchar();
if (!idchar(ch))
break;
*chp++ = ch;
}
*chp = 0;
t = MkAtomTerm(Yap_LookupAtom(IdChars));
@ -642,10 +605,10 @@ p_grab_tokens()
chp = IdChars;
*chp++ = ch;
while (1) {
ch = Yap_PlGetchar();
if (!idchar(ch))
break;
*chp++ = ch;
ch = Yap_PlGetchar();
if (!idchar(ch))
break;
*chp++ = ch;
}
*chp = 0;
t = MkAtomTerm(Yap_LookupAtom(IdChars));
@ -664,17 +627,15 @@ p_grab_tokens()
return (Yap_unify(ARG1, t));
}
#endif /* EUROTRA */
#endif /* EUROTRA */
#ifdef SFUNC
static
p_softfunctor()
{
Term nilvalue = 0;
SFEntry *pe;
Prop p0;
Atom a;
static p_softfunctor() {
Term nilvalue = 0;
SFEntry *pe;
Prop p0;
Atom a;
Term t1 = Deref(ARG1);
Term t2 = Deref(ARG2);
@ -685,7 +646,7 @@ p_softfunctor()
a = AtomOfTerm(t1);
WRITE_LOCK(RepAtom(a)->ARWLock);
if ((p0 = Yap_GetAProp(a, SFProperty)) == NIL) {
pe = (SFEntry *) Yap_AllocAtomSpace(sizeof(*pe));
pe = (SFEntry *)Yap_AllocAtomSpace(sizeof(*pe));
pe->KindOfPE = SFProperty;
AddPropToAtom(RepAtom(a), (PropEntry *)pe);
} else
@ -695,7 +656,7 @@ p_softfunctor()
return (TRUE);
}
#endif /* SFUNC */
#endif /* SFUNC */
#include <math.h>
@ -703,39 +664,36 @@ p_softfunctor()
static Int
p_matching_distances(void)
{
return(fabs(FloatOfTerm(Deref(ARG1))-FloatOfTerm(Deref(ARG2))) <= FloatOfTerm(Deref(ARG3)));
return(fabs(FloatOfTerm(Deref(ARG1))-FloatOfTerm(Deref(ARG2))) <=
FloatOfTerm(Deref(ARG3)));
}
*/
void
Yap_InitUserCPreds(void)
{
void Yap_InitUserCPreds(void) {
#ifdef XINTERFACE
Yap_InitXPreds();
#endif
#ifdef EUROTRA
Yap_InitCPred("clean", 2, p_clean, SafePredFlag|SyncPredFlag);
Yap_InitCPred("name_length", 2, p_namelength, SafePredFlag|SyncPredFlag);
Yap_InitCPred("clean", 2, p_clean, SafePredFlag | SyncPredFlag);
Yap_InitCPred("name_length", 2, p_namelength, SafePredFlag | SyncPredFlag);
Yap_InitCPred("get_pid", 1, p_getpid, SafePredFlag);
Yap_InitCPred("exit", 1, p_exit, SafePredFlag|SyncPredFlag);
Yap_InitCPred("incr_counter", 1, p_incrcounter, SafePredFlag|SyncPredFlag);
Yap_InitCPred("set_counter", 1, p_setcounter, SafePredFlag|SyncPredFlag);
Yap_InitCPred("trap_signal", 0, p_trapsignal, SafePredFlag|SyncPredFlag);
Yap_InitCPred("mark2_grab_tokens", 1, p_grab_tokens, SafePredFlag|SyncPredFlag);
Yap_InitCPred("exit", 1, p_exit, SafePredFlag | SyncPredFlag);
Yap_InitCPred("incr_counter", 1, p_incrcounter, SafePredFlag | SyncPredFlag);
Yap_InitCPred("set_counter", 1, p_setcounter, SafePredFlag | SyncPredFlag);
Yap_InitCPred("trap_signal", 0, p_trapsignal, SafePredFlag | SyncPredFlag);
Yap_InitCPred("mark2_grab_tokens", 1, p_grab_tokens,
SafePredFlag | SyncPredFlag);
Yap_InitCPred("subsumes", 2, p_subsumes, SafePredFlag);
#endif
#ifdef SFUNC
Yap_InitCPred("sparse_functor", 2, p_softfunctor, SafePredFlag);
#endif /* SFUNC */
/* Yap_InitCPred("match_distances", 3, p_matching_distances, SafePredFlag); */
#endif /* SFUNC */
/* Yap_InitCPred("match_distances", 3, p_matching_distances, SafePredFlag);
*/
/* Yap_InitCPred("unify",2,p_unify,SafePredFlag); */
/* Yap_InitCPred("occurs_check",2,p_occurs_check,SafePredFlag); */
/* Yap_InitCPred("counter",3,p_counter,SafePredFlag); */
/* Yap_InitCPred("iconcat",3,p_iconcat,SafePredFlag); */
}
void
Yap_InitUserBacks(void)
{
}
void Yap_InitUserBacks(void) {}

View File

@ -13,18 +13,18 @@ typedef enum TokenKinds {
eot_tok
} tkinds;
typedef struct TOKEN {
typedef struct TOKEN {
enum TokenKinds Tok;
Term TokInfo;
int TokPos;
int TokPos;
struct TOKEN *TokNext;
} TokEntry;
#define Ord(X) ((enum TokenKinds) (X))
#define Ord(X) ((enum TokenKinds)(X))
#define NextToken GNextToken( PASS_REGS1 )
#define NextToken GNextToken(PASS_REGS1)
typedef struct VARSTRUCT {
typedef struct VARSTRUCT {
Term VarAdr;
CELL hv;
UInt refs;

View File

@ -30,269 +30,334 @@ Set or read system properties for _Param_:
/// `address_bits`
///
/// Number of address bits in the machine, either 64 or 32 bits.
YAP_FLAG( ADDRESS_BITS_FLAG, "address_bits", false, nat, BITNESS , NULL ), /** `address_bits`
Number of address bits in the machine, either 64 or 32 bits */
YAP_FLAG( AGC_MARGIN_FLAG, "agc_margin", true, nat, "10000" , agc_threshold ), /**`agc_margin `
YAP_FLAG(ADDRESS_BITS_FLAG, "address_bits", false, nat, BITNESS,
NULL), /** `address_bits`
Number of address bits in the machine, either 64 or 32 bits */
YAP_FLAG(AGC_MARGIN_FLAG, "agc_margin", true, nat, "10000",
agc_threshold), /**`agc_margin `
An integer: if this amount of atoms has been created since the last
An integer: if this amount of atoms has been created since the last
atom-garbage collection, perform atom garbage collection at the first
opportunity. Initial value is 10,000. May be changed. A value of 0
(zero) disables atom garbage collection.
*/
YAP_FLAG( ALLOW_ASSERT_FOR_STATIC_PREDICATES, "allow_assert_for_static_predicates", true, boolean, "true" , NULL ), /**< `allow asserting and retracting clauses of static predicates. */
*/
YAP_FLAG(ALLOW_ASSERT_FOR_STATIC_PREDICATES,
"allow_assert_for_static_predicates", true, boolean, "true",
NULL), /**< `allow asserting and retracting clauses of static
predicates. */
/* YAP_FLAG( ALLOW_VARIABLE_NAME_AS_FUNCTOR_FLAG, "allow_variable_name_as_functor", true, boolean, "false" , NULL ), /\**< `allow_variable_name_as_functor` */
/* YAP_FLAG( ALLOW_VARIABLE_NAME_AS_FUNCTOR_FLAG,
"allow_variable_name_as_functor", true, boolean, "false" , NULL ), /\**<
`allow_variable_name_as_functor` */
/* allow A(X) *\/ */
YAP_FLAG( ANSWER_FORMAT_FLAG, "answer_format", true, isatom, "~p" , Yap_set_fpu_exceptions ), /** `arithmetic_exceptions `
/* allow
* A(X)
* *\/
*/
YAP_FLAG(ANSWER_FORMAT_FLAG, "answer_format", true, isatom, "~p",
NULL), /** `arithmetic_exceptions `
Read-write flag telling whether arithmetic exceptions generate
Prolog exceptions. If enabled:
Read-write flag telling whether arithmetic exceptions generate
Prolog exceptions. If enabled:
~~~~
?- X is 2/0.
ERROR!!
ZERO DIVISOR ERROR- X is Exp
?- X is 2/0.
ERROR!!
ZERO DIVISOR ERROR- X is Exp
~~~~
If disabled:
If disabled:
~~~~
?- X is 2/0.
?- X is 2/0.
X = (+inf).
~~~~
It is `true` by default, but it is disabled by packages like CLP(BN) and ProbLog.
*/
It is `true` by default, but it is disabled by packages like CLP(BN) and
ProbLog.
*/
#if __APPLE__
YAP_FLAG( APPLE_FLAG, "apple", false, boolean, "true" , NULL ), /**< `apple`
YAP_FLAG(APPLE_FLAG, "apple", false, boolean, "true", NULL), /**< `apple`
Read-only boolean flag that unifies with `true` if YAP is
running on an Apple machine.
*/
#endif
YAP_FLAG( ARCH_FLAG, "arch", false, isatom, YAP_ARCH , NULL ),
YAP_FLAG( ARGV_FLAG, "argv", false, argv, "?-" , NULL ),
YAP_FLAG( ARITHMETIC_EXCEPTIONS_FLAG, "arithmetic_exceptions", true, boolean, "true" , NULL ),
YAP_FLAG( BACKQUOTED_STRING_FLAG, "backquoted_string", true, isatom, "string" , ), /**>
YAP_FLAG(ARCH_FLAG, "arch", false, isatom, YAP_ARCH, NULL),
YAP_FLAG(ARGV_FLAG, "argv", false, argv, "?-", NULL),
YAP_FLAG(ARITHMETIC_EXCEPTIONS_FLAG, "arithmetic_exceptions", true, boolean,
"true", NULL),
YAP_FLAG(BACKQUOTED_STRING_FLAG, "backquoted_string", true, isatom,
"string", ), /**>
If _Value_ is unbound, tell whether a double quoted list of characters
token is converted to a list of atoms, `chars`, to a list of integers,
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
the corresponding behavior. The default value is `string`
*/
YAP_FLAG( BOUNDED_FLAG, "bounded", false, boolean, "false" , NULL ), /**< `bounded` is iso
Read-only flag telling whether integers are bounded. The value depends
YAP_FLAG(BOUNDED_FLAG, "bounded", false, boolean, "false",
NULL), /**< `bounded` is iso
Read-only flag telling whether integers are bounded. The value depends
on whether YAP uses the GMP library or not.
*/
YAP_FLAG( C_CC_FLAG, "c_cc", false, isatom, C_CC , NULL ),
YAP_FLAG( C_CFLAGS_FLAG, "c_cflags", false, isatom, C_CFLAGS , NULL ),
YAP_FLAG( C_LDFLAGS_FLAG, "c_ldflags", false, isatom, C_LDFLAGS , NULL ),
YAP_FLAG( C_LIBPLSO_FLAG, "c_libplso", false, isatom, C_LIBPLSO , NULL ),
YAP_FLAG( C_LIBS_FLAG, "c_libs", false, isatom, C_LIBS , NULL ),
YAP_FLAG( CHAR_CONVERSION_FLAG, "char_conversion", true, boolean, "false" , NULL ), /**< `char_conversion is iso`
*/
YAP_FLAG(C_CC_FLAG, "c_cc", false, isatom, C_CC, NULL),
YAP_FLAG(C_CFLAGS_FLAG, "c_cflags", false, isatom, C_CFLAGS, NULL),
YAP_FLAG(C_LDFLAGS_FLAG, "c_ldflags", false, isatom, C_LDFLAGS, NULL),
YAP_FLAG(C_LIBPLSO_FLAG, "c_libplso", false, isatom, C_LIBPLSO, NULL),
YAP_FLAG(C_LIBS_FLAG, "c_libs", false, isatom, C_LIBS, NULL),
YAP_FLAG(CHAR_CONVERSION_FLAG, "char_conversion", true, boolean, "false",
NULL), /**< `char_conversion is iso`
Writable flag telling whether a character conversion table is used when
Writable flag telling whether a character conversion table is used when
reading terms. The default value for this flag is `off` except in
`sicstus` and `iso` language modes, where it is `on`.
*/
YAP_FLAG( CHARACTER_ESCAPES_FLAG, "character_escapes", true, boolean, "true" , NULL ), /**< `character_escapes is iso `
*/
YAP_FLAG(CHARACTER_ESCAPES_FLAG, "character_escapes", true, boolean, "true",
NULL), /**< `character_escapes is iso `
Writable flag telling whether a character escapes are enables,
Writable flag telling whether a character escapes are enables,
`true`, or disabled, `false`. The default value for this flag is
`true`. */
YAP_FLAG( COLON_SETS_CALLING_CONTEXT_FLAG, "colon_sets_calling_context", true, boolean, "true" , NULL ),
YAP_FLAG( COMPILED_AT_FLAG, "compiled_at", false, isatom, YAP_COMPILED_AT , NULL ), /**< `compiled_at `
YAP_FLAG(COLON_SETS_CALLING_CONTEXT_FLAG, "colon_sets_calling_context",
true, boolean, "true", NULL),
YAP_FLAG(COMPILED_AT_FLAG, "compiled_at", false, isatom, YAP_COMPILED_AT,
NULL), /**< `compiled_at `
Read-only flag that gives the time when the main YAP binary was compiled. It is obtained staight from the __TIME__ macro, as defined in the C99.
*/
YAP_FLAG( DEBUG_FLAG, "debug", true, boolean, "false" , NULL ), /**< `debug is iso `
Read-only flag that gives the time when the main YAP binary was compiled. It is
obtained staight from the __TIME__ macro, as defined in the C99.
*/
YAP_FLAG(DEBUG_FLAG, "debug", true, boolean, "false",
NULL), /**< `debug is iso `
If _Value_ is unbound, tell whether debugging is `true` or
If _Value_ is unbound, tell whether debugging is `true` or
`false`. If _Value_ is bound to `true` enable debugging, and if
it is bound to `false` disable debugging.
*/
YAP_FLAG( DEBUG_INFO_FLAG, "debug_info", true, boolean, "true" , NULL ),
YAP_FLAG( DEBUG_ON_ERROR_FLAG, "debug_on_error", true, boolean, "true" , NULL ),
YAP_FLAG( DEBUGGER_PRINT_OPTIONS_FLAG, "debugger_print_options", true, list_option, "[quoted(true),numbervars(true),portrayed(true),max_depth(10)]" , NULL ), /**< `debugger_print_options `
*/
YAP_FLAG(DEBUG_INFO_FLAG, "debug_info", true, boolean, "true", NULL),
YAP_FLAG(DEBUG_ON_ERROR_FLAG, "debug_on_error", true, boolean, "true",
NULL),
YAP_FLAG(DEBUGGER_PRINT_OPTIONS_FLAG, "debugger_print_options", true,
list_option,
"[quoted(true),numbervars(true),portrayed(true),max_depth(10)]",
NULL), /**< `debugger_print_options `
If bound, set the argument to the `write_term/3` options the
If bound, set the argument to the `write_term/3` options the
debugger uses to write terms. If unbound, show the current options.
*/
YAP_FLAG( DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true, boolean, "false" , NULL ),
YAP_FLAG( DIALECT_FLAG, "dialect", false, ro, "yap" , NULL ), /**< `dialect `
Read-only flag that always returns `yap`.
*/
YAP_FLAG( DISCONTIGUOUS_WARNINGS_FLAG, "discontiguous_warnings", true, boolean, "true" , NULL ), /**< `discontiguous_warnings `
If `true` (default `true`) YAP checks for definitions of the same predicate that are separated by clauses for other predicates. This may indicate that different procedures have the sam*e name.
*/
YAP_FLAG( DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true, boolean, "false" , NULL ), /**< `dollar_as_lower_case `
*/
YAP_FLAG(DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true, boolean,
"false", NULL),
YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap",
NULL), /**< `dialect `
If `off` (default) consider the character `$` a control character, if
Read-only flag that always returns `yap`.
*/
YAP_FLAG(DISCONTIGUOUS_WARNINGS_FLAG, "discontiguous_warnings", true,
boolean, "true", NULL), /**< `discontiguous_warnings `
If `true` (default `true`) YAP checks for definitions of the same predicate that
are separated by clauses for other predicates. This may indicate that different
procedures have the sam*e name.
*/
YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true, boolean,
"false", NULL), /**< `dollar_as_lower_case `
If `off` (default) consider the character `$` a control character, if
`on` consider `$` a lower case character.
*/
YAP_FLAG( DOUBLE_QUOTES_FLAG, "double_quotes", true, isatom, "codes" , dqf ), /**< `double_quotes is iso `
*/
YAP_FLAG(DOUBLE_QUOTES_FLAG, "double_quotes", true, isatom, "codes",
dqf), /**< `double_quotes is iso `
If _Value_ is unbound, tell whether a double quoted list of characters
If _Value_ is unbound, tell whether a double quoted list of characters
token is converted to a list of atoms, `chars`, to a list of integers,
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
the corresponding behavior. The default value is `codes`. */
YAP_FLAG( EDITOR_FLAG, "editor", true, isatom, "$EDITOR" , NULL ),
YAP_FLAG( EXECUTABLE_FLAG, "executable", false, isatom, "yap" , executable ), /**< `executable `
YAP_FLAG(EDITOR_FLAG, "editor", true, isatom, "$EDITOR", NULL),
YAP_FLAG(EXECUTABLE_FLAG, "executable", false, isatom, "yap",
executable), /**< `executable `
Read-only flag. It unifies with an atom that gives the
Read-only flag. It unifies with an atom that gives the
original program path.
*/
YAP_FLAG( FAST_FLAG, "fast", true, boolean, "false" , NULL ), /**< `fast `
*/
YAP_FLAG(FAST_FLAG, "fast", true, boolean, "false", NULL), /**< `fast `
If `on` allow fast machine code, if `off` (default) disable it. Only
available in experimental implemexbntations.
*/
YAP_FLAG( FILE_NAME_VARIABLES_FLAG, "file_name_variables", true, boolean, "true" , NULL ),
YAP_FLAG( FLOAT_FORMAT_FLAG, "float_format", true, isatom, "%15e" , NULL ), /**< + `float_format `
YAP_FLAG(FILE_NAME_VARIABLES_FLAG, "file_name_variables", true, boolean,
"true", NULL),
YAP_FLAG(FLOAT_FORMAT_FLAG, "float_format", true, isatom, "%15e",
NULL), /**< + `float_format `
C-library `printf()` format specification used by write/1 and
friends to determine how floating point numbers are printed. The
default is `%.15g`. The specified value is passed to `printf()`
without further checking. For example, if you want less digits
printed, `%g` will print all floats using 6 digits instead of the
default 15.
*/
YAP_FLAG( GC_FLAG, "gc", true, boolean, "on" , NULL ), /**< `gc`
C-library `printf()` format specification used by write/1 and
friends to determine how floating point numbers are printed. The
default is `%.15g`. The specified value is passed to `printf()`
without further checking. For example, if you want less digits
printed, `%g` will print all floats using 6 digits instead of the
default 15.
*/
YAP_FLAG(GC_FLAG, "gc", true, boolean, "on", NULL), /**< `gc`
If `on` allow garbage collection (default), if `off` disable it.
*/
YAP_FLAG( GC_MARGIN_FLAG, "gc_margin", true, nat, "0" , gc_margin ), /**< `gc_margin `
If `on` allow garbage collection (default), if `off` disable it.
*/
YAP_FLAG(GC_MARGIN_FLAG, "gc_margin", true, nat, "0",
gc_margin), /**< `gc_margin `
Set or show the minimum free stack before starting garbage
Set or show the minimum free stack before starting garbage
collection. The default depends on total stack size.
*/
YAP_FLAG( GC_TRACE_FLAG, "gc_trace", true, isatom, "off" , NULL ), /**< `gc_trace `
*/
YAP_FLAG(GC_TRACE_FLAG, "gc_trace", true, isatom, "off",
NULL), /**< `gc_trace `
If `off` (default) do not show information on garbage collection
If `off` (default) do not show information on garbage collection
and stack shifts, if `on` inform when a garbage collection or stack
shift happened, if verbose give detailed information on garbage
collection and stack shifts. Last, if `very_verbose` give detailed
information on data-structures found during the garbage collection
process, namely, on choice-points.
*/
YAP_FLAG( GENERATE_DEBUGGING_INFO_FLAG, "generate_debug_info", true, boolean, "true" , NULL ), /**< `generate_debug_info `
*/
YAP_FLAG(GENERATE_DEBUGGING_INFO_FLAG, "generate_debug_info", true, boolean,
"true", NULL), /**< `generate_debug_info `
If `true` (default) generate debugging information for
If `true` (default) generate debugging information for
procedures, including source mode. If `false` predicates no
information is generated, although debugging is still possible, and
source mode is disabled.
*/
YAP_FLAG( GMP_VERSION_FLAG, "gmp_version", false, isatom, "4.8.12" , NULL ),
YAP_FLAG( HALT_AFTER_CONSULT_FLAG, "halt_after_consult", false, boolean, "false" , NULL ),
YAP_FLAG( HOME_FLAG, "home", false, isatom, YAP_ROOTDIR , NULL ), /**< home `
*/
YAP_FLAG(GMP_VERSION_FLAG, "gmp_version", false, isatom, "4.8.12", NULL),
YAP_FLAG(HALT_AFTER_CONSULT_FLAG, "halt_after_consult", false, boolean,
"false", NULL),
YAP_FLAG(HOME_FLAG, "home", false, isatom, YAP_ROOTDIR, NULL), /**< home `
the root of the YAP installation, by default `/usr/local` in Unix or
`c:\Yap` in Windows system. Can only be set at configure tien
*/
YAP_FLAG( HOST_TYPE_FLAG, "host_type", false, isatom, HOST_ALIAS , NULL ), /**< host_type `
YAP_FLAG(HOST_TYPE_FLAG, "host_type", false, isatom, HOST_ALIAS,
NULL), /**< host_type `
Return `configure` system information, including the machine-id
Return `configure` system information, including the machine-id
for which YAP was compiled and Operating System information.
*/
YAP_FLAG( INDEX_FLAG, "index", true, isatom, "multi" , indexer ), /**< `index `
*/
YAP_FLAG(INDEX_FLAG, "index", true, isatom, "multi", indexer), /**< `index `
If `on` allow indexing (default), if `off` disable it, if
`single` allow on first argument only.
*/
YAP_FLAG( INDEX_SUB_TERM_SEARCH_DEPTH_FLAG, "index_sub_term_search_depth", true, nat, "0" , NULL ), /**< `Index_sub_term_search_depth `
YAP_FLAG(INDEX_SUB_TERM_SEARCH_DEPTH_FLAG, "index_sub_term_search_depth",
true, nat, "0", NULL), /**< `Index_sub_term_search_depth `
Maximum bound on searching sub-terms for indexing, if `0` (default) no bound.
*/
YAP_FLAG( INFORMATIONAL_MESSAGES_FLAG, "informational_messages", true, isatom, "normal" , NULL ), /**< `informational_messages `
Maximum bound on searching sub-terms for indexing, if `0` (default) no bound.
*/
YAP_FLAG(INFORMATIONAL_MESSAGES_FLAG, "informational_messages", true,
isatom, "normal", NULL), /**< `informational_messages `
If `on` allow printing of informational messages, such as the ones
If `on` allow printing of informational messages, such as the ones
that are printed when consulting. If `off` disable printing
these messages. It is `on` by default except if YAP is booted with
the `-L` flag.
*/
YAP_FLAG( INTEGER_ROUNDING_FUNCTION_FLAG, "integer_rounding_function", true, isatom, "toward_zero" , NULL ), /**< `integer_rounding_function is iso `
*/
YAP_FLAG(INTEGER_ROUNDING_FUNCTION_FLAG, "integer_rounding_function", true,
isatom, "toward_zero",
NULL), /**< `integer_rounding_function is iso `
Read-only flag telling the rounding function used for integers. Takes the value
Read-only flag telling the rounding function used for integers. Takes the value
`toward_zero` for the current version of YAP.
*/
YAP_FLAG( ISO_FLAG, "iso", true, boolean, "false" , NULL ),
YAP_FLAG( LANGUAGE_FLAG, "language", true, isatom, "yap" , NULL ), /**< `language `
*/
YAP_FLAG(ISO_FLAG, "iso", true, boolean, "false", NULL),
YAP_FLAG(LANGUAGE_FLAG, "language", true, isatom, "yap",
NULL), /**< `language `
Choose whether YAP follows native, closer to C-Prolog, `yap`, iso-prolog,
Choose whether YAP follows native, closer to C-Prolog, `yap`, iso-prolog,
`iso` or SICStus Prolog, `sicstus`. The current default is
`cprolog`. This flag affects update semantics, leashing mode,
style checking, handling calls to undefined procedures, how directives
are interpreted, when to use dynamic, character escapes, and how files
are consulted. Also check the `dialect` option.
*/
YAP_FLAG( MAX_ARITY_FLAG, "max_arity", false, isatom, "unbounded" , NULL ), /**< `max_arity is iso `
*/
YAP_FLAG(MAX_ARITY_FLAG, "max_arity", false, isatom, "unbounded",
NULL), /**< `max_arity is iso `
Read-only flag telling the maximum arity of a functor. Takes the value
Read-only flag telling the maximum arity of a functor. Takes the value
`unbounded` for the current version of YAP.
*/
YAP_FLAG( MAX_TAGGED_INTEGER_FLAG, "max_tagged_integer", false, at2n, "INT_MAX" , NULL ),
YAP_FLAG( MAX_THREADS_FLAG, "max_threads", false, at2n, "MAX_THREADS" , NULL ),
YAP_FLAG( MAX_WORKERS_FLAG, "max_workers", false, at2n, "MAX_WORKERS" , NULL ),
YAP_FLAG( MIN_TAGGED_INTEGER_FLAG, "min_tagged_integer", false, at2n, "INT_MIN" , NULL ),
YAP_FLAG( N_OF_INTEGER_KEYS_IN_DB_FLAG, "n_of_integer_keys_in_db", false, ro, "256" , NULL ),
YAP_FLAG( OCCURS_CHECK_FLAG, "occurs_check", true, boolean, "false" , NULL ),
YAP_FLAG( OPEN_EXPANDS_FILENAME_FLAG, "open_expands_filename", true, boolean, "true" , NULL ), /**< `open_expands_filename `
*/
YAP_FLAG(MAX_TAGGED_INTEGER_FLAG, "max_tagged_integer", false, at2n,
"INT_MAX", NULL),
YAP_FLAG(MAX_THREADS_FLAG, "max_threads", false, at2n, "MAX_THREADS", NULL),
YAP_FLAG(MAX_WORKERS_FLAG, "max_workers", false, at2n, "MAX_WORKERS", NULL),
YAP_FLAG(MIN_TAGGED_INTEGER_FLAG, "min_tagged_integer", false, at2n,
"INT_MIN", NULL),
YAP_FLAG(N_OF_INTEGER_KEYS_IN_DB_FLAG, "n_of_integer_keys_in_db", false, ro,
"256", NULL),
YAP_FLAG(OCCURS_CHECK_FLAG, "occurs_check", true, boolean, "false", NULL),
YAP_FLAG(OPEN_EXPANDS_FILENAME_FLAG, "open_expands_filename", true, boolean,
"true", NULL), /**< `open_expands_filename `
If `true` the open/3 builtin performs filename-expansion
If `true` the open/3 builtin performs filename-expansion
before opening a file (SICStus Prolog like). If `false` it does not
(SWI-Prolog like).
*/
YAP_FLAG( OPEN_SHARED_OBJECT_FLAG, "open_shared_object", true, boolean, "true" , NULL ), /**< `open_shared_object `
*/
YAP_FLAG(OPEN_SHARED_OBJECT_FLAG, "open_shared_object", true, boolean,
"true", NULL), /**< `open_shared_object `
If true, `open_shared_object/2` and friends are implemented,
If true, `open_shared_object/2` and friends are implemented,
providing access to shared libraries (`.so` files) or to dynamic link
libraries (`.DLL` files).
*/
YAP_FLAG( OPTIMISE_FLAG, "optimise", true, boolean, "false" , NULL ),
YAP_FLAG( OS_ARGV_FLAG, "os_argv", false, os_argv, "?-" , NULL ),
YAP_FLAG( PID_FLAG, "pid", false, ro, "0" , NULL ),
YAP_FLAG( PIPE_FLAG, "pipe", true, boolean, "true" , NULL ),
YAP_FLAG( PROFILING_FLAG, "profiling", true, boolean, "false" , NULL ), /**< `profiling `
*/
YAP_FLAG(OPTIMISE_FLAG, "optimise", true, boolean, "false", NULL),
YAP_FLAG(OS_ARGV_FLAG, "os_argv", false, os_argv, "?-", NULL),
YAP_FLAG(PID_FLAG, "pid", false, ro, "0", NULL),
YAP_FLAG(PIPE_FLAG, "pipe", true, boolean, "true", NULL),
YAP_FLAG(PROFILING_FLAG, "profiling", true, boolean, "false",
NULL), /**< `profiling `
If `off` (default) do not compile call counting information for
If `off` (default) do not compile call counting information for
procedures. If `on` compile predicates so that they calls and
retries to the predicate may be counted. Profiling data can be read through the
call_count_data/3 built-in.
*/
YAP_FLAG( PROMPT_ALTERNATIVES_ON_FLAG, "prompt_alternatives_on", true, isatom, "determinism" , NULL ), /**< `prompt_alternatives_on(atom, changeable) `
*/
YAP_FLAG(PROMPT_ALTERNATIVES_ON_FLAG, "prompt_alternatives_on", true,
isatom, "determinism", NULL), /**< `prompt_alternatives_on(atom,
changeable) `
SWI-Compatible option, determines prompting for alternatives in the Prolog toplevel. Default is <tt>groundness</tt>, YAP prompts for alternatives if and only if the query contains variables. The alternative, default in SWI-Prolog is <tt>determinism</tt> which implies the system prompts for alternatives if the goal succeeded while leaving choicepoints. */
YAP_FLAG( QUASI_QUOTATIONS_FLAG, "quasi_quotations", true, boolean, "true" , NULL ),
YAP_FLAG( READLINE_FLAG, "readline", true, boolean, "true" , NULL ),
YAP_FLAG( REPORT_ERROR_FLAG, "report_error", true, boolean, "true" , NULL ),
YAP_FLAG( SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false, isatom, SO_EXT ,NULL ), /**< `shared_object_extension `
SWI-Compatible option, determines prompting for alternatives in the Prolog
toplevel. Default is <tt>groundness</tt>, YAP prompts for alternatives if and
only if the query contains variables. The alternative, default in SWI-Prolog is
<tt>determinism</tt> which implies the system prompts for alternatives if the
goal succeeded while leaving choicepoints. */
YAP_FLAG(QUASI_QUOTATIONS_FLAG, "quasi_quotations", true, boolean, "true",
NULL),
YAP_FLAG(READLINE_FLAG, "readline", true, boolean, "true", NULL),
YAP_FLAG(REPORT_ERROR_FLAG, "report_error", true, boolean, "true", NULL),
YAP_FLAG(SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false,
isatom, SO_EXT, NULL), /**< `shared_object_extension `
Suffix associated with loadable code.
*/
YAP_FLAG( SHARED_OBJECT_SEARCH_PATH_FLAG, "shared_object_search_path", true, isatom, SO_PATH , NULL ), /**< `shared_object_search_path `
Suffix associated with loadable code.
*/
YAP_FLAG(SHARED_OBJECT_SEARCH_PATH_FLAG, "shared_object_search_path", true,
isatom, SO_PATH, NULL), /**< `shared_object_search_path `
Name of the environment variable used by the system to search for shared
Name of the environment variable used by the system to search for shared
objects.
*/
YAP_FLAG( SIGNALS_FLAG, "signals", true, boolean, "true" , NULL ), /**< `signals`
If `true` (default) YAP handles Signals such as `^C` (`SIGINT`).
*/
YAP_FLAG( SOURCE_FLAG, "source", true, boolean, "true" , NULL ), /**< `source`
*/
YAP_FLAG(SIGNALS_FLAG, "signals", true, boolean, "true",
NULL), /**< `signals`
If `true` maintain the source for all clauses. Notice that this is trivially supported for facts, and always supported for dynamic code.
If `true` (default) YAP handles Signals such as `^C`
(`SIGINT`).
*/
YAP_FLAG(SOURCE_FLAG, "source", true, boolean, "true", NULL), /**< `source`
If `true` maintain the source for all clauses. Notice that this is trivially
supported for facts, and always supported for dynamic code.
*/
YAP_FLAG( STRICT_ISO_FLAG, "strict_iso", true, boolean, "false" , NULL ), /**< `strict_iso `
YAP_FLAG(STRICT_ISO_FLAG, "strict_iso", true, boolean, "false",
NULL), /**< `strict_iso `
If _Value_ is unbound, tell whether strict ISO compatibility mode
If _Value_ is unbound, tell whether strict ISO compatibility mode
is `on` or `off`. If _Value_ is bound to `on` set
language mode to `iso` and enable strict mode. If _Value_ is
bound to `off` disable strict mode, and keep the current language
@ -311,112 +376,144 @@ will work the same way in every Prolog and in every platform. We thus
believe this mode is mostly useful when investigating how a program
depends on a Prolog's platform specific features.
*/
YAP_FLAG( SYSTEM_OPTIONS_FLAG, "system_options", false, ro, "[big_numbers,coroutining,depth_limit,low_level_tracer,rational_trees,threads,tabling]" , NULL ), /**< `system_options `
*/
YAP_FLAG(SYSTEM_OPTIONS_FLAG, "system_options", false, ro,
"[big_numbers,coroutining,depth_limit,low_level_tracer,rational_"
"trees,threads,tabling]",
NULL), /**< `system_options `
This read only flag tells which options were used to compile
This read only flag tells which options were used to compile
YAP. Currently it informs whether the system supports `big_numbers`,
`coroutining`, `depth_limit`, `low_level_tracer`,
`or-parallelism`, `rational_trees`, `readline`, `tabling`,
`threads`, or the `wam_profiler`.
*/
YAP_FLAG( SYSTEM_THREAD_ID_FLAG, "system_thread_id", false, ro, "0", sys_thread_id ),
YAP_FLAG( TABLING_MODE_FLAG, "tabling_mode", true, isatom, "[]" , NULL ), /**< `tabling_mode`
*/
YAP_FLAG(SYSTEM_THREAD_ID_FLAG, "system_thread_id", false, ro, "0",
sys_thread_id),
YAP_FLAG(TABLING_MODE_FLAG, "tabling_mode", true, isatom, "[]",
NULL), /**< `tabling_mode`
Sets or reads the tabling mode for all tabled predicates. Please
(see Tabling) for the list of options.
Sets or reads the tabling mode for all tabled predicates. Please
(see Tabling) for the list of options.
*/
YAP_FLAG( THREADS_FLAG, "threads", false, ro, "MAX_THREADS" , NULL ),
YAP_FLAG( TIMEZONE_FLAG, "timezone", false, ro, "18000" , NULL ),
YAP_FLAG( TOPLEVEL_PRINT_ANON_FLAG, "toplevel_print_anon", true, boolean, "true" , NULL ),
YAP_FLAG( TOPLEVEL_PRINT_OPTIONS_FLAG, "toplevel_print_options", true, list_option, "[quoted(true),numbervars(true),portrayed(true)]" , NULL ), /**< `toplevel_hook `
*/
YAP_FLAG(THREADS_FLAG, "threads", false, ro, "MAX_THREADS", NULL),
YAP_FLAG(TIMEZONE_FLAG, "timezone", false, ro, "18000", NULL),
YAP_FLAG(TOPLEVEL_PRINT_ANON_FLAG, "toplevel_print_anon", true, boolean,
"true", NULL),
YAP_FLAG(TOPLEVEL_PRINT_OPTIONS_FLAG, "toplevel_print_options", true,
list_option, "[quoted(true),numbervars(true),portrayed(true)]",
NULL), /**< `toplevel_hook `
If bound, set the argument to a goal to be executed before entering the
If bound, set the argument to a goal to be executed before entering the
top-level. If unbound show the current goal or `true` if none is
presented. Only the first solution is considered and the goal is not
backtracked into.
*/
YAP_FLAG( TOPLEVEL_PROMPT_FLAG, "toplevel_prompt", true, isatom, "~m~d~l~! ?- " , mkprompt ),
YAP_FLAG( TTY_CONTROL_FLAG, "tty_control", true, boolean, "true" , NULL ),
YAP_FLAG( UNIX_FLAG, "unix", false, ro, "true" , NULL ), /**< `unix`
*/
YAP_FLAG(TOPLEVEL_PROMPT_FLAG, "toplevel_prompt", true, isatom,
"~m~d~l~! ?- ", mkprompt),
YAP_FLAG(TTY_CONTROL_FLAG, "tty_control", true, boolean, "true", NULL),
YAP_FLAG(UNIX_FLAG, "unix", false, ro, "true", NULL), /**< `unix`
Read-only Boolean flag that unifies with `true` if YAP is
running on an Unix system. Defined if the C-compiler used to compile
this version of YAP either defines `__unix__` or `unix`.
*/
YAP_FLAG( UPDATE_SEMANTICS_FLAG, "update_semantics", true, isatom, "logical" , NULL ), /**< `update_semantics `
YAP_FLAG(UPDATE_SEMANTICS_FLAG, "update_semantics", true, isatom, "logical",
NULL), /**< `update_semantics `
Define whether YAP should follow `immediate` update
Define whether YAP should follow `immediate` update
semantics, as in C-Prolog (default), `logical` update semantics,
as in Quintus Prolog, SICStus Prolog, or in the ISO standard. There is
also an intermediate mode, `logical_assert`, where dynamic
procedures follow logical semantics but the internal data base still
follows immediate semantics.
*/
YAP_FLAG( USER_FLAGS_FLAG, "user_flags", true, isatom, "error" , NULL ), /**< `user_flags `
*/
YAP_FLAG(USER_FLAGS_FLAG, "user_flags", true, isatom, "error", NULL), /**<
`user_flags `
Define the behaviour of set_prolog_flag/2 if the flag is not known. Values are `silent`, `warning` and `error`. The first two create the flag on-the-fly, with `warning` printing a message. The value `error` is consistent with ISO: it raises an existence error and does not create the flag. See also `create_prolog_flag/3`. The default is`error`, and developers are encouraged to use `create_prolog_flag/3` to create flags for their library.
Define the behaviour of set_prolog_flag/2 if the flag is not known. Values
are `silent`, `warning` and `error`. The first two create the flag
on-the-fly, with `warning` printing a message. The value `error` is
consistent with ISO: it raises an existence error and does not create the
flag. See also `create_prolog_flag/3`. The default is`error`, and developers
are encouraged to use `create_prolog_flag/3` to create flags for their
library.
*/
YAP_FLAG( UNKNOWN_FLAG, "unknown", true, isatom, "error" , NULL ), /**< `unknown is iso`
YAP_FLAG(UNKNOWN_FLAG, "unknown", true, isatom, "error",
NULL), /**< `unknown is iso`
Corresponds to calling the unknown/2 built-in. Possible values
Corresponds to calling the unknown/2 built-in. Possible values
are `error`, `fail`, and `warning`.
*/
YAP_FLAG( VARIABLE_NAMES_MAY_END_WITH_QUOTES_FLAG, "variable_names_may_end_with_quotes", true, boolean, "false" , NULL ),
YAP_FLAG( VERBOSE_FLAG, "verbose", true, isatom, "normal" , NULL ), /**< `verbose `
*/
YAP_FLAG(VARIABLE_NAMES_MAY_END_WITH_QUOTES_FLAG,
"variable_names_may_end_with_quotes", true, boolean, "false",
NULL),
YAP_FLAG(VERBOSE_FLAG, "verbose", true, isatom, "normal",
NULL), /**< `verbose `
If `normal` allow printing of informational and banner messages,
If `normal` allow printing of informational and banner messages,
such as the ones that are printed when consulting. If `silent`
disable printing these messages. It is `normal` by default except if
YAP is booted with the `-q` or `-L` flag.
*/
YAP_FLAG( VERBOSE_AUTOLOAD_FLAG, "verbose_autoload", true, boolean, "false" , NULL ),
YAP_FLAG( VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, boolean, "false" , NULL ), /**< `verbose_file_search `
*/
YAP_FLAG(VERBOSE_AUTOLOAD_FLAG, "verbose_autoload", true, boolean, "false",
NULL),
YAP_FLAG(VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, boolean,
"false", NULL), /**< `verbose_file_search `
If `true` allow printing of informational messages when
If `true` allow printing of informational messages when
searching for file names. If `false` disable printing these messages. It
is `false` by default except if YAP is booted with the `-L`
flag.
*/
YAP_FLAG( VERBOSE_LOAD_FLAG, "verbose_load", true, isatom, "normal" , NULL ), /**< `verbose_load `
*/
YAP_FLAG(VERBOSE_LOAD_FLAG, "verbose_load", true, isatom, "normal",
NULL), /**< `verbose_load `
If `true` allow printing of informational messages when
If `true` allow printing of informational messages when
consulting files. If `false` disable printing these messages. It
is `normal` by default except if YAP is booted with the `-L`
flag.
*/
YAP_FLAG( VERSION_FLAG, "version", false, nat, YAP_NUMERIC_VERSION , NULL ), /**< `version_data `
*/
YAP_FLAG(VERSION_FLAG, "version", false, nat, YAP_NUMERIC_VERSION,
NULL), /**< `version_data `
Read-only flag that unifies with a number of the form
`_Major_ * 100000 + _Minor_ *100 + _Patch_`, where
_Major_ is the major version, _Minor_ is the minor version,
Read-only flag that unifies with a number of the form
`_Major_ * 100000 + _Minor_ *100 + _Patch_`, where
_Major_ is the major version, _Minor_ is the minor version,
and _Patch_ is the patch number.
*/
YAP_FLAG( VERSION_DATA_FLAG, "version_data", false, ro, YAP_TVERSION , NULL ), /**<
*/
YAP_FLAG(VERSION_DATA_FLAG, "version_data", false, ro, YAP_TVERSION,
NULL), /**<
`version ` Read-only flag that returns an a compound term with the
current version of YAP. The term will have the name `yap` and arity 4, the first argument will be the
major version, the second the minor version, the third the patch number, and the last one is reserved.
current version of YAP. The term will have the name `yap` and arity 4, the first
argument will be the
major version, the second the minor version, the third the patch number, and the
last one is reserved.
*/
YAP_FLAG( VERSION_GIT_FLAG, "version_git", false, isatom, YAP_GIT_HEAD , NULL ), /**< `version_git `
`
this is the unique identifier for the last commit of the current GIT HEAD, it xan be used to identify versions that differ on small (or large) updates.
*/
YAP_FLAG( WRITE_ATTRIBUTES_FLAG, "write_attributes", true, isatom, "ignore" , NULL ),
*/
YAP_FLAG(VERSION_GIT_FLAG, "version_git", false, isatom, YAP_GIT_HEAD,
NULL), /**< `version_git `
`
this is the unique identifier for the last commit of the current GIT HEAD, it
xan be used to identify versions that differ on small (or large) updates.
*/
YAP_FLAG(WRITE_ATTRIBUTES_FLAG, "write_attributes", true, isatom, "ignore",
NULL),
#if __WINDOWS__
YAP_FLAG( WINDOWS_FLAG, "windows", false, ro, "true" , NULL ), /**< `windows `
YAP_FLAG(WINDOWS_FLAG, "windows", false, ro, "true", NULL), /**< `windows `
Read-only boolean flag that unifies with `true` if YAP is
running on an Windows machine.
*/
#endif
YAP_FLAG( WRITE_STRINGS_FLAG, "write_strings", true, boolean, "false" , NULL ), /**< `write_strings `
YAP_FLAG(WRITE_STRINGS_FLAG, "write_strings", true, boolean, "false",
NULL), /**< `write_strings `
Writable flag telling whether the system should write lists of
Writable flag telling whether the system should write lists of
integers that are writable character codes using the list notation. It
is `on` if enables or `off` if disabled. The default value for
this flag is `off`.
*/
*/

View File

@ -1,303 +1,197 @@

/* This file, rhstruct.h, was generated automatically by "yap -L misc/buildheap"
please do not update, update misc/HEAPFIELDS instead */
/* This file, rhstruct.h, was generated automatically by "yap -L misc/buildheap"
please do not update, update misc/HEAPFIELDS instead */
#if USE_DL_MALLOC
#if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(DLMallocLock);
REINIT_LOCK(DLMallocLock);
#endif
#endif
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
#ifndef HeapUsed
#define HeapUsed Yap_givemallinfo()
#ifndef HeapUsed
#define HeapUsed Yap_givemallinfo()
#endif
#else
#endif
#if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(FreeBlocksLock);
REINIT_LOCK(HeapUsedLock);
REINIT_LOCK(HeapTopLock);
REINIT_LOCK(FreeBlocksLock);
REINIT_LOCK(HeapUsedLock);
REINIT_LOCK(HeapTopLock);
#endif
#if USE_THREADED_CODE
OP_RTABLE = OpRTableAdjust(OP_RTABLE);
OP_RTABLE = OpRTableAdjust(OP_RTABLE);
#endif
EXECUTE_CPRED_OP_CODE = Yap_opcode(_execute_cpred);
EXPAND_OP_CODE = Yap_opcode(_expand_index);
FAIL_OPCODE = Yap_opcode(_op_fail);
INDEX_OPCODE = Yap_opcode(_index_pred);
LOCKPRED_OPCODE = Yap_opcode(_lock_pred);
ORLAST_OPCODE = Yap_opcode(_or_last);
UNDEF_OPCODE = Yap_opcode(_undef_p);
RETRY_USERC_OPCODE = Yap_opcode(_retry_userc);
EXECUTE_CPRED_OPCODE = Yap_opcode(_execute_cpred);
EXECUTE_CPRED_OP_CODE = Yap_opcode(_execute_cpred);
EXPAND_OP_CODE = Yap_opcode(_expand_index);
FAIL_OPCODE = Yap_opcode(_op_fail);
INDEX_OPCODE = Yap_opcode(_index_pred);
LOCKPRED_OPCODE = Yap_opcode(_lock_pred);
ORLAST_OPCODE = Yap_opcode(_or_last);
UNDEF_OPCODE = Yap_opcode(_undef_p);
RETRY_USERC_OPCODE = Yap_opcode(_retry_userc);
EXECUTE_CPRED_OPCODE = Yap_opcode(_execute_cpred);
RestoreInvisibleAtoms();
RestoreWideAtoms();
RestoreAtoms();
RestoreInvisibleAtoms();
RestoreWideAtoms();
RestoreAtoms();
#include "ratoms.h"
#ifdef EUROTRA
TermDollarU = AtomTermAdjust(TermDollarU);
TermDollarU = AtomTermAdjust(TermDollarU);
#endif
USER_MODULE = AtomTermAdjust(USER_MODULE);
IDB_MODULE = AtomTermAdjust(IDB_MODULE);
ATTRIBUTES_MODULE = AtomTermAdjust(ATTRIBUTES_MODULE);
CHARSIO_MODULE = AtomTermAdjust(CHARSIO_MODULE);
TERMS_MODULE = AtomTermAdjust(TERMS_MODULE);
SYSTEM_MODULE = AtomTermAdjust(SYSTEM_MODULE);
OPERATING_SYSTEM_MODULE = AtomTermAdjust(OPERATING_SYSTEM_MODULE);
READUTIL_MODULE = AtomTermAdjust(READUTIL_MODULE);
HACKS_MODULE = AtomTermAdjust(HACKS_MODULE);
ARG_MODULE = AtomTermAdjust(ARG_MODULE);
GLOBALS_MODULE = AtomTermAdjust(GLOBALS_MODULE);
SWI_MODULE = AtomTermAdjust(SWI_MODULE);
DBLOAD_MODULE = AtomTermAdjust(DBLOAD_MODULE);
RANGE_MODULE = AtomTermAdjust(RANGE_MODULE);
USER_MODULE = AtomTermAdjust(USER_MODULE);
IDB_MODULE = AtomTermAdjust(IDB_MODULE);
ATTRIBUTES_MODULE = AtomTermAdjust(ATTRIBUTES_MODULE);
CHARSIO_MODULE = AtomTermAdjust(CHARSIO_MODULE);
TERMS_MODULE = AtomTermAdjust(TERMS_MODULE);
SYSTEM_MODULE = AtomTermAdjust(SYSTEM_MODULE);
OPERATING_SYSTEM_MODULE = AtomTermAdjust(OPERATING_SYSTEM_MODULE);
READUTIL_MODULE = AtomTermAdjust(READUTIL_MODULE);
HACKS_MODULE = AtomTermAdjust(HACKS_MODULE);
ARG_MODULE = AtomTermAdjust(ARG_MODULE);
GLOBALS_MODULE = AtomTermAdjust(GLOBALS_MODULE);
SWI_MODULE = AtomTermAdjust(SWI_MODULE);
DBLOAD_MODULE = AtomTermAdjust(DBLOAD_MODULE);
RANGE_MODULE = AtomTermAdjust(RANGE_MODULE);
CurrentModules = ModEntryPtrAdjust(CurrentModules);
RestoreHiddenPredicates();
CurrentModules = ModEntryPtrAdjust(CurrentModules);
RestoreFlags(GLOBAL_flagCount);
RestoreHiddenPredicates();
RestoreFlags(GLOBAL_flagCount);
RestorePredHash();
RestorePredHash();
#if defined(YAPOR) || defined(THREADS)
#endif
CreepCode = PtoPredAdjust(CreepCode);
UndefCode = PtoPredAdjust(UndefCode);
SpyCode = PtoPredAdjust(SpyCode);
PredFail = PtoPredAdjust(PredFail);
PredTrue = PtoPredAdjust(PredTrue);
CreepCode = PtoPredAdjust(CreepCode);
UndefCode = PtoPredAdjust(UndefCode);
SpyCode = PtoPredAdjust(SpyCode);
PredFail = PtoPredAdjust(PredFail);
PredTrue = PtoPredAdjust(PredTrue);
#ifdef COROUTINING
WakeUpCode = PtoPredAdjust(WakeUpCode);
WakeUpCode = PtoPredAdjust(WakeUpCode);
#endif
PredGoalExpansion = PtoPredAdjust(PredGoalExpansion);
PredMetaCall = PtoPredAdjust(PredMetaCall);
PredTraceMetaCall = PtoPredAdjust(PredTraceMetaCall);
PredDollarCatch = PtoPredAdjust(PredDollarCatch);
PredRecordedWithKey = PtoPredAdjust(PredRecordedWithKey);
PredLogUpdClause = PtoPredAdjust(PredLogUpdClause);
PredLogUpdClauseErase = PtoPredAdjust(PredLogUpdClauseErase);
PredLogUpdClause0 = PtoPredAdjust(PredLogUpdClause0);
PredStaticClause = PtoPredAdjust(PredStaticClause);
PredThrow = PtoPredAdjust(PredThrow);
PredHandleThrow = PtoPredAdjust(PredHandleThrow);
PredIs = PtoPredAdjust(PredIs);
PredSafeCallCleanup = PtoPredAdjust(PredSafeCallCleanup);
PredRestoreRegs = PtoPredAdjust(PredRestoreRegs);
PredCommentHook = PtoPredAdjust(PredCommentHook);
PredGoalExpansion = PtoPredAdjust(PredGoalExpansion);
PredMetaCall = PtoPredAdjust(PredMetaCall);
PredTraceMetaCall = PtoPredAdjust(PredTraceMetaCall);
PredDollarCatch = PtoPredAdjust(PredDollarCatch);
PredRecordedWithKey = PtoPredAdjust(PredRecordedWithKey);
PredLogUpdClause = PtoPredAdjust(PredLogUpdClause);
PredLogUpdClauseErase = PtoPredAdjust(PredLogUpdClauseErase);
PredLogUpdClause0 = PtoPredAdjust(PredLogUpdClause0);
PredStaticClause = PtoPredAdjust(PredStaticClause);
PredThrow = PtoPredAdjust(PredThrow);
PredHandleThrow = PtoPredAdjust(PredHandleThrow);
PredIs = PtoPredAdjust(PredIs);
PredSafeCallCleanup = PtoPredAdjust(PredSafeCallCleanup);
PredRestoreRegs = PtoPredAdjust(PredRestoreRegs);
PredCommentHook = PtoPredAdjust(PredCommentHook);
#ifdef YAPOR
PredGetwork = PtoPredAdjust(PredGetwork);
PredGetworkSeq = PtoPredAdjust(PredGetworkSeq);
PredGetwork = PtoPredAdjust(PredGetwork);
PredGetworkSeq = PtoPredAdjust(PredGetworkSeq);
#endif /* YAPOR */
#ifdef LOW_LEVEL_TRACER
#if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(Yap_low_level_trace_lock);
REINIT_LOCK(Yap_low_level_trace_lock);
#endif
#endif
DUMMYCODE->opc = Yap_opcode(_op_fail);
FAILCODE->opc = Yap_opcode(_op_fail);
NOCODE->opc = Yap_opcode(_Nstop);
RestoreEnvInst(ENV_FOR_TRUSTFAIL, &TRUSTFAILCODE, _trust_fail, PredFail);
RestoreEnvInst(ENV_FOR_YESCODE, &YESCODE, _Ystop, PredFail);
DUMMYCODE->opc = Yap_opcode(_op_fail);
FAILCODE->opc = Yap_opcode(_op_fail);
NOCODE->opc = Yap_opcode(_Nstop);
RestoreEnvInst(ENV_FOR_TRUSTFAIL,&TRUSTFAILCODE,_trust_fail,PredFail);
RestoreEnvInst(ENV_FOR_YESCODE,&YESCODE,_Ystop,PredFail);
RestoreOtaplInst(RTRYCODE,_retry_and_mark,PredFail);
RestoreOtaplInst(RTRYCODE, _retry_and_mark, PredFail);
#ifdef BEAM
BEAM_RETRY_CODE->opc = Yap_opcode(_beam_retry_code);
BEAM_RETRY_CODE->opc = Yap_opcode(_beam_retry_code);
#endif /* BEAM */
#ifdef YAPOR
RestoreOtaplInst(GETWORK,_getwork,PredGetwork);
RestoreOtaplInst(GETWORK_SEQ,_getwork_seq,PredGetworkSeq);
GETWORK_FIRST_TIME->opc = Yap_opcode(_getwork_first_time);
RestoreOtaplInst(GETWORK, _getwork, PredGetwork);
RestoreOtaplInst(GETWORK_SEQ, _getwork_seq, PredGetworkSeq);
GETWORK_FIRST_TIME->opc = Yap_opcode(_getwork_first_time);
#endif /* YAPOR */
#ifdef TABLING
RestoreOtaplInst(LOAD_ANSWER,_table_load_answer,PredFail);
RestoreOtaplInst(TRY_ANSWER,_table_try_answer,PredFail);
RestoreOtaplInst(ANSWER_RESOLUTION,_table_answer_resolution,PredFail);
RestoreOtaplInst(COMPLETION,_table_completion,PredFail);
RestoreOtaplInst(LOAD_ANSWER, _table_load_answer, PredFail);
RestoreOtaplInst(TRY_ANSWER, _table_try_answer, PredFail);
RestoreOtaplInst(ANSWER_RESOLUTION, _table_answer_resolution, PredFail);
RestoreOtaplInst(COMPLETION, _table_completion, PredFail);
#ifdef THREADS_CONSUMER_SHARING
RestoreOtaplInst(ANSWER_RESOLUTION_COMPLETION,_table_answer_resolution_completion,PredFail);
RestoreOtaplInst(ANSWER_RESOLUTION_COMPLETION,
_table_answer_resolution_completion, PredFail);
#endif /* THREADS_CONSUMER_SHARING */
#endif /* TABLING */
P_before_spy = PtoOpAdjust(P_before_spy);
P_before_spy = PtoOpAdjust(P_before_spy);
RETRY_C_RECORDEDP_CODE = PtoOpAdjust(RETRY_C_RECORDEDP_CODE);
RETRY_C_RECORDED_K_CODE = PtoOpAdjust(RETRY_C_RECORDED_K_CODE);
RETRY_C_RECORDEDP_CODE = PtoOpAdjust(RETRY_C_RECORDEDP_CODE);
RETRY_C_RECORDED_K_CODE = PtoOpAdjust(RETRY_C_RECORDED_K_CODE);
#if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(DBTermsListLock);
REINIT_LOCK(DBTermsListLock);
#endif
RestoreDBTermsList();
RestoreDBTermsList();
RestoreExpandList();
RestoreExpandList();
#if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(ExpandClausesListLock);
REINIT_LOCK(OpListLock);
REINIT_LOCK(ExpandClausesListLock);
REINIT_LOCK(OpListLock);
#endif
#ifdef DEBUG
#endif
RestoreUdiControlBlocks();
RestoreUdiControlBlocks();
RestoreIntKeys();
RestoreIntLUKeys();
RestoreIntBBKeys();
RestoreDBErasedMarker();
RestoreLogDBErasedMarker();
RestoreIntKeys();
RestoreIntLUKeys();
RestoreIntBBKeys();
RestoreDBErasedMarker();
RestoreLogDBErasedMarker();
RestoreDeadStaticClauses();
RestoreDeadMegaClauses();
RestoreDeadStaticIndices();
RestoreDBErasedList();
RestoreDBErasedIList();
RestoreDeadStaticClauses();
RestoreDeadMegaClauses();
RestoreDeadStaticIndices();
RestoreDBErasedList();
RestoreDBErasedIList();
#if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(DeadStaticClausesLock);
REINIT_LOCK(DeadMegaClausesLock);
REINIT_LOCK(DeadStaticIndicesLock);
REINIT_LOCK(DeadStaticClausesLock);
REINIT_LOCK(DeadMegaClausesLock);
REINIT_LOCK(DeadStaticIndicesLock);
#endif
#ifdef COROUTINING
#endif
OpList = OpListAdjust(OpList);
OpList = OpListAdjust(OpList);
RestoreForeignCode();
RestoreForeignCode();
RestoreYapRecords();
RestoreSWIAtoms();
RestoreEmptyWakeups();
RestoreYapRecords();
RestoreSWIAtoms();
RestoreEmptyWakeups();
RestoreBlobTypes();
RestoreBlobs();
RestoreBlobTypes();
RestoreBlobs();
#if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(Blobs_Lock);
REINIT_LOCK(Blobs_Lock);
#endif