fix skip/1 and debugging stuff
formatting
This commit is contained in:
parent
746a4b4ef8
commit
bf78d70d66
@ -138,7 +138,7 @@ static inline Atom SearchAtom(const unsigned char *p, Atom a) {
|
|||||||
/* search atom in chain */
|
/* search atom in chain */
|
||||||
while (a != NIL) {
|
while (a != NIL) {
|
||||||
ae = RepAtom(a);
|
ae = RepAtom(a);
|
||||||
if (strcmp((char *)ae->StrOfAE, (const char *)p) == 0) {
|
if (strcmp(ae->UStrOfAE, p) == 0) {
|
||||||
return (a);
|
return (a);
|
||||||
}
|
}
|
||||||
a = ae->NextOfAE;
|
a = ae->NextOfAE;
|
||||||
|
@ -201,7 +201,7 @@ static Int LoadForeign(StringList ofiles, StringList libs, char *proc_name,
|
|||||||
if (LOCAL_ErrorMessage == NULL) {
|
if (LOCAL_ErrorMessage == NULL) {
|
||||||
LOCAL_ErrorMessage = malloc(MAX_ERROR_MSG_SIZE);
|
LOCAL_ErrorMessage = malloc(MAX_ERROR_MSG_SIZE);
|
||||||
strcpy(LOCAL_ErrorMessage,
|
strcpy(LOCAL_ErrorMessage,
|
||||||
"%% Trying to open unexisting file in LoadForeign");
|
"%% Trying to open non-existing file in LoadForeign");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef __osf__
|
#ifdef __osf__
|
||||||
|
278
C/stack.c
278
C/stack.c
@ -34,24 +34,37 @@
|
|||||||
#include "iopreds.h"
|
#include "iopreds.h"
|
||||||
#include "tracer.h"
|
#include "tracer.h"
|
||||||
#include "yapio.h"
|
#include "yapio.h"
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
#include "or.macros.h"
|
#include "or.macros.h"
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
|
|
||||||
#include "tab.macros.h"
|
#include "tab.macros.h"
|
||||||
|
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
#if HAVE_STRING_H
|
#if HAVE_STRING_H
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <heapgc.h>
|
#include <heapgc.h>
|
||||||
|
|
||||||
#if !defined(YAPOR) && !defined(THREADS)
|
#if !defined(YAPOR) && !defined(THREADS)
|
||||||
|
|
||||||
static void mark_pred(int, PredEntry *);
|
static void mark_pred(int, PredEntry *);
|
||||||
|
|
||||||
static void do_toggle_static_predicates_in_use(int);
|
static void do_toggle_static_predicates_in_use(int);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static Int in_use(USES_REGS1);
|
static Int in_use(USES_REGS1);
|
||||||
|
|
||||||
static Int PredForCode(yamop *, Atom *, arity_t *, Term *, PredEntry **);
|
static Int PredForCode(yamop *, Atom *, arity_t *, Term *, PredEntry **);
|
||||||
|
|
||||||
static LogUpdIndex *find_owner_log_index(LogUpdIndex *, yamop *);
|
static LogUpdIndex *find_owner_log_index(LogUpdIndex *, yamop *);
|
||||||
|
|
||||||
static StaticIndex *find_owner_static_index(StaticIndex *, yamop *);
|
static StaticIndex *find_owner_static_index(StaticIndex *, yamop *);
|
||||||
|
|
||||||
#define IN_BLOCK(P, B, SZ) \
|
#define IN_BLOCK(P, B, SZ) \
|
||||||
@ -60,7 +73,7 @@ static StaticIndex *find_owner_static_index(StaticIndex *, yamop *);
|
|||||||
static PredEntry *get_pred(Term t, Term tmod, char *pname) {
|
static PredEntry *get_pred(Term t, Term tmod, char *pname) {
|
||||||
Term t0 = t;
|
Term t0 = t;
|
||||||
|
|
||||||
restart:
|
restart:
|
||||||
if (IsVarTerm(t)) {
|
if (IsVarTerm(t)) {
|
||||||
Yap_Error(INSTANTIATION_ERROR, t0, pname);
|
Yap_Error(INSTANTIATION_ERROR, t0, pname);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -204,6 +217,7 @@ PredEntry *Yap_PredForChoicePt(choiceptr cp, op_numbers *op) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(YAPOR) && !defined(THREADS)
|
#if !defined(YAPOR) && !defined(THREADS)
|
||||||
|
|
||||||
static yamop *cur_clause(PredEntry *pe, yamop *codeptr) {
|
static yamop *cur_clause(PredEntry *pe, yamop *codeptr) {
|
||||||
StaticClause *cl;
|
StaticClause *cl;
|
||||||
|
|
||||||
@ -226,7 +240,7 @@ static yamop *cur_log_upd_clause(PredEntry *pe, yamop *codeptr) {
|
|||||||
cl = ClauseCodeToLogUpdClause(pe->cs.p_code.FirstClause);
|
cl = ClauseCodeToLogUpdClause(pe->cs.p_code.FirstClause);
|
||||||
do {
|
do {
|
||||||
if (IN_BLOCK(codeptr, cl->ClCode, cl->ClSize)) {
|
if (IN_BLOCK(codeptr, cl->ClCode, cl->ClSize)) {
|
||||||
return ((yamop *)cl->ClCode);
|
return ((yamop *) cl->ClCode);
|
||||||
}
|
}
|
||||||
cl = cl->ClNext;
|
cl = cl->ClNext;
|
||||||
} while (cl != NULL);
|
} while (cl != NULL);
|
||||||
@ -257,15 +271,15 @@ bool Yap_search_for_static_predicate_in_use(PredEntry *p,
|
|||||||
I do not need to check environments for asserts,
|
I do not need to check environments for asserts,
|
||||||
only for retracts
|
only for retracts
|
||||||
*/
|
*/
|
||||||
while (env_ptr && b_ptr > (choiceptr)env_ptr) {
|
while (env_ptr && b_ptr > (choiceptr) env_ptr) {
|
||||||
yamop *cp = (yamop *)env_ptr[E_CP];
|
yamop *cp = (yamop *) env_ptr[E_CP];
|
||||||
PredEntry *pe;
|
PredEntry *pe;
|
||||||
|
|
||||||
pe = EnvPreg(cp);
|
pe = EnvPreg(cp);
|
||||||
if (p == pe)
|
if (p == pe)
|
||||||
return true;
|
return true;
|
||||||
if (env_ptr != NULL)
|
if (env_ptr != NULL)
|
||||||
env_ptr = (CELL *)(env_ptr[E_E]);
|
env_ptr = (CELL *) (env_ptr[E_E]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* now mark the choicepoint */
|
/* now mark the choicepoint */
|
||||||
@ -335,11 +349,11 @@ static void do_toggle_static_predicates_in_use(int mask) {
|
|||||||
PredEntry *pe;
|
PredEntry *pe;
|
||||||
|
|
||||||
/* check first environments that are younger than our latest choicepoint */
|
/* check first environments that are younger than our latest choicepoint */
|
||||||
while (b_ptr > (choiceptr)env_ptr) {
|
while (b_ptr > (choiceptr) env_ptr) {
|
||||||
PredEntry *pe = EnvPreg((yamop *)env_ptr[E_CP]);
|
PredEntry *pe = EnvPreg((yamop *) env_ptr[E_CP]);
|
||||||
|
|
||||||
mark_pred(mask, pe);
|
mark_pred(mask, pe);
|
||||||
env_ptr = (CELL *)(env_ptr[E_E]);
|
env_ptr = (CELL *) (env_ptr[E_E]);
|
||||||
}
|
}
|
||||||
/* now mark the choicepoint */
|
/* now mark the choicepoint */
|
||||||
if ((b_ptr)) {
|
if ((b_ptr)) {
|
||||||
@ -380,13 +394,19 @@ static Int toggle_static_predicates_in_use(USES_REGS1) {
|
|||||||
static void clause_was_found(PredEntry *pp, Atom *pat, UInt *parity) {
|
static void clause_was_found(PredEntry *pp, Atom *pat, UInt *parity) {
|
||||||
if (pp->ModuleOfPred == IDB_MODULE) {
|
if (pp->ModuleOfPred == IDB_MODULE) {
|
||||||
if (pp->PredFlags & NumberDBPredFlag) {
|
if (pp->PredFlags & NumberDBPredFlag) {
|
||||||
|
if (parity)
|
||||||
*parity = 0;
|
*parity = 0;
|
||||||
|
if (pat)
|
||||||
*pat = AtomInteger;
|
*pat = AtomInteger;
|
||||||
} else if (pp->PredFlags & AtomDBPredFlag) {
|
} else if (pp->PredFlags & AtomDBPredFlag) {
|
||||||
|
if (parity)
|
||||||
*parity = 0;
|
*parity = 0;
|
||||||
*pat = (Atom)pp->FunctorOfPred;
|
if (pat)
|
||||||
|
*pat = (Atom) pp->FunctorOfPred;
|
||||||
} else {
|
} else {
|
||||||
|
if (pat)
|
||||||
*pat = NameOfFunctor(pp->FunctorOfPred);
|
*pat = NameOfFunctor(pp->FunctorOfPred);
|
||||||
|
if (parity)
|
||||||
*parity = ArityOfFunctor(pp->FunctorOfPred);
|
*parity = ArityOfFunctor(pp->FunctorOfPred);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -397,7 +417,7 @@ static void clause_was_found(PredEntry *pp, Atom *pat, UInt *parity) {
|
|||||||
if (pp->ArityOfPE) {
|
if (pp->ArityOfPE) {
|
||||||
*pat = NameOfFunctor(pp->FunctorOfPred);
|
*pat = NameOfFunctor(pp->FunctorOfPred);
|
||||||
} else {
|
} else {
|
||||||
*pat = (Atom)(pp->FunctorOfPred);
|
*pat = (Atom) (pp->FunctorOfPred);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -412,9 +432,9 @@ static int code_in_pred_lu_index(LogUpdIndex *icl, yamop *codeptr,
|
|||||||
LogUpdIndex *cicl;
|
LogUpdIndex *cicl;
|
||||||
if (IN_BLOCK(codeptr, icl, icl->ClSize)) {
|
if (IN_BLOCK(codeptr, icl, icl->ClSize)) {
|
||||||
if (startp)
|
if (startp)
|
||||||
*startp = (CODEADDR)icl;
|
*startp = (CODEADDR) icl;
|
||||||
if (endp)
|
if (endp)
|
||||||
*endp = (CODEADDR)icl + icl->ClSize;
|
*endp = (CODEADDR) icl + icl->ClSize;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
cicl = icl->ChildIndex;
|
cicl = icl->ChildIndex;
|
||||||
@ -431,9 +451,9 @@ static int code_in_pred_s_index(StaticIndex *icl, yamop *codeptr, void **startp,
|
|||||||
StaticIndex *cicl;
|
StaticIndex *cicl;
|
||||||
if (IN_BLOCK(codeptr, icl, icl->ClSize)) {
|
if (IN_BLOCK(codeptr, icl, icl->ClSize)) {
|
||||||
if (startp)
|
if (startp)
|
||||||
*startp = (CODEADDR)icl;
|
*startp = (CODEADDR) icl;
|
||||||
if (endp)
|
if (endp)
|
||||||
*endp = (CODEADDR)icl + icl->ClSize;
|
*endp = (CODEADDR) icl + icl->ClSize;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
cicl = icl->ChildIndex;
|
cicl = icl->ChildIndex;
|
||||||
@ -455,11 +475,11 @@ static Int find_code_in_clause(PredEntry *pp, yamop *codeptr, void **startp,
|
|||||||
if (pp->PredFlags & LogUpdatePredFlag) {
|
if (pp->PredFlags & LogUpdatePredFlag) {
|
||||||
LogUpdClause *cl = ClauseCodeToLogUpdClause(clcode);
|
LogUpdClause *cl = ClauseCodeToLogUpdClause(clcode);
|
||||||
do {
|
do {
|
||||||
if (IN_BLOCK(codeptr, (CODEADDR)cl, cl->ClSize)) {
|
if (IN_BLOCK(codeptr, (CODEADDR) cl, cl->ClSize)) {
|
||||||
if (startp)
|
if (startp)
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR) cl;
|
||||||
if (endp)
|
if (endp)
|
||||||
*endp = (CODEADDR)cl + cl->ClSize;
|
*endp = (CODEADDR) cl + cl->ClSize;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
@ -472,9 +492,9 @@ static Int find_code_in_clause(PredEntry *pp, yamop *codeptr, void **startp,
|
|||||||
cl = ClauseCodeToDynamicClause(clcode);
|
cl = ClauseCodeToDynamicClause(clcode);
|
||||||
if (IN_BLOCK(codeptr, cl, cl->ClSize)) {
|
if (IN_BLOCK(codeptr, cl, cl->ClSize)) {
|
||||||
if (startp)
|
if (startp)
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR) cl;
|
||||||
if (endp)
|
if (endp)
|
||||||
*endp = (CODEADDR)cl + cl->ClSize;
|
*endp = (CODEADDR) cl + cl->ClSize;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
if (clcode == pp->cs.p_code.LastClause)
|
if (clcode == pp->cs.p_code.LastClause)
|
||||||
@ -488,10 +508,10 @@ static Int find_code_in_clause(PredEntry *pp, yamop *codeptr, void **startp,
|
|||||||
cl = ClauseCodeToMegaClause(clcode);
|
cl = ClauseCodeToMegaClause(clcode);
|
||||||
if (IN_BLOCK(codeptr, cl, cl->ClSize)) {
|
if (IN_BLOCK(codeptr, cl, cl->ClSize)) {
|
||||||
if (startp)
|
if (startp)
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR) cl;
|
||||||
if (endp)
|
if (endp)
|
||||||
*endp = (CODEADDR)cl + cl->ClSize;
|
*endp = (CODEADDR) cl + cl->ClSize;
|
||||||
return 1 + ((char *)codeptr - (char *)cl->ClCode) / cl->ClItemSize;
|
return 1 + ((char *) codeptr - (char *) cl->ClCode) / cl->ClItemSize;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
StaticClause *cl;
|
StaticClause *cl;
|
||||||
@ -502,9 +522,9 @@ static Int find_code_in_clause(PredEntry *pp, yamop *codeptr, void **startp,
|
|||||||
return 0;
|
return 0;
|
||||||
if (IN_BLOCK(codeptr, cl, cl->ClSize)) {
|
if (IN_BLOCK(codeptr, cl, cl->ClSize)) {
|
||||||
if (startp)
|
if (startp)
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR) cl;
|
||||||
if (endp)
|
if (endp)
|
||||||
*endp = (CODEADDR)cl + cl->ClSize;
|
*endp = (CODEADDR) cl + cl->ClSize;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
if (cl->ClCode == pp->cs.p_code.LastClause)
|
if (cl->ClCode == pp->cs.p_code.LastClause)
|
||||||
@ -575,11 +595,11 @@ static int cl_code_in_pred(PredEntry *pp, yamop *codeptr, void **startp,
|
|||||||
}
|
}
|
||||||
if (pp->PredFlags & (CPredFlag | AsmPredFlag | UserCPredFlag)) {
|
if (pp->PredFlags & (CPredFlag | AsmPredFlag | UserCPredFlag)) {
|
||||||
StaticClause *cl = ClauseCodeToStaticClause(pp->CodeOfPred);
|
StaticClause *cl = ClauseCodeToStaticClause(pp->CodeOfPred);
|
||||||
if (IN_BLOCK(codeptr, (CODEADDR)cl, cl->ClSize)) {
|
if (IN_BLOCK(codeptr, (CODEADDR) cl, cl->ClSize)) {
|
||||||
if (startp)
|
if (startp)
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR) cl;
|
||||||
if (endp)
|
if (endp)
|
||||||
*endp = (CODEADDR)cl + cl->ClSize;
|
*endp = (CODEADDR) cl + cl->ClSize;
|
||||||
UNLOCK(pp->PELock);
|
UNLOCK(pp->PELock);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
@ -688,40 +708,40 @@ Int Yap_PredForCode(yamop *codeptr, find_pred_type where_from, Atom *pat,
|
|||||||
static PredEntry *walk_got_lu_block(LogUpdIndex *cl, void **startp,
|
static PredEntry *walk_got_lu_block(LogUpdIndex *cl, void **startp,
|
||||||
void **endp) {
|
void **endp) {
|
||||||
PredEntry *pp = cl->ClPred;
|
PredEntry *pp = cl->ClPred;
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR) cl;
|
||||||
*endp = (CODEADDR)cl + cl->ClSize;
|
*endp = (CODEADDR) cl + cl->ClSize;
|
||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* intruction blocks we found ourselves at */
|
/* intruction blocks we found ourselves at */
|
||||||
static PredEntry *walk_got_lu_clause(LogUpdClause *cl, void **startp,
|
static PredEntry *walk_got_lu_clause(LogUpdClause *cl, void **startp,
|
||||||
void **endp) {
|
void **endp) {
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR) cl;
|
||||||
*endp = (CODEADDR)cl + cl->ClSize;
|
*endp = (CODEADDR) cl + cl->ClSize;
|
||||||
return cl->ClPred;
|
return cl->ClPred;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we hit a meta-call, so we don't know what is happening */
|
/* we hit a meta-call, so we don't know what is happening */
|
||||||
static PredEntry *found_meta_call(void **startp, void **endp) {
|
static PredEntry *found_meta_call(void **startp, void **endp) {
|
||||||
PredEntry *pp = PredMetaCall;
|
PredEntry *pp = PredMetaCall;
|
||||||
*startp = (CODEADDR) & (pp->OpcodeOfPred);
|
*startp = (CODEADDR) &(pp->OpcodeOfPred);
|
||||||
*endp = (CODEADDR)NEXTOP((yamop *)&(pp->OpcodeOfPred), e);
|
*endp = (CODEADDR) NEXTOP((yamop *) &(pp->OpcodeOfPred), e);
|
||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* intruction blocks we found ourselves at */
|
/* intruction blocks we found ourselves at */
|
||||||
static PredEntry *walk_found_c_pred(PredEntry *pp, void **startp, void **endp) {
|
static PredEntry *walk_found_c_pred(PredEntry *pp, void **startp, void **endp) {
|
||||||
StaticClause *cl = ClauseCodeToStaticClause(pp->CodeOfPred);
|
StaticClause *cl = ClauseCodeToStaticClause(pp->CodeOfPred);
|
||||||
*startp = (CODEADDR) & (cl->ClCode);
|
*startp = (CODEADDR) &(cl->ClCode);
|
||||||
*endp = (CODEADDR) & (cl->ClCode) + cl->ClSize;
|
*endp = (CODEADDR) &(cl->ClCode) + cl->ClSize;
|
||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we hit a mega-clause, no point in going on */
|
/* we hit a mega-clause, no point in going on */
|
||||||
static PredEntry *found_mega_clause(PredEntry *pp, void **startp, void **endp) {
|
static PredEntry *found_mega_clause(PredEntry *pp, void **startp, void **endp) {
|
||||||
MegaClause *mcl = ClauseCodeToMegaClause(pp->cs.p_code.FirstClause);
|
MegaClause *mcl = ClauseCodeToMegaClause(pp->cs.p_code.FirstClause);
|
||||||
*startp = (CODEADDR)mcl;
|
*startp = (CODEADDR) mcl;
|
||||||
*endp = (CODEADDR)mcl + mcl->ClSize;
|
*endp = (CODEADDR) mcl + mcl->ClSize;
|
||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -729,8 +749,8 @@ static PredEntry *found_mega_clause(PredEntry *pp, void **startp, void **endp) {
|
|||||||
static PredEntry *found_idb_clause(yamop *pc, void **startp, void **endp) {
|
static PredEntry *found_idb_clause(yamop *pc, void **startp, void **endp) {
|
||||||
LogUpdClause *cl = ClauseCodeToLogUpdClause(pc);
|
LogUpdClause *cl = ClauseCodeToLogUpdClause(pc);
|
||||||
|
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR) cl;
|
||||||
*endp = (CODEADDR)cl + cl->ClSize;
|
*endp = (CODEADDR) cl + cl->ClSize;
|
||||||
return cl->ClPred;
|
return cl->ClPred;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -739,8 +759,8 @@ static PredEntry *found_expand_index(yamop *pc, void **startp, void **endp,
|
|||||||
yamop *codeptr USES_REGS) {
|
yamop *codeptr USES_REGS) {
|
||||||
PredEntry *pp = codeptr->y_u.sssllp.p;
|
PredEntry *pp = codeptr->y_u.sssllp.p;
|
||||||
if (pc == codeptr) {
|
if (pc == codeptr) {
|
||||||
*startp = (CODEADDR)codeptr;
|
*startp = (CODEADDR) codeptr;
|
||||||
*endp = (CODEADDR)NEXTOP(codeptr, sssllp);
|
*endp = (CODEADDR) NEXTOP(codeptr, sssllp);
|
||||||
}
|
}
|
||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
@ -748,17 +768,17 @@ static PredEntry *found_expand_index(yamop *pc, void **startp, void **endp,
|
|||||||
/* we hit a expand_index, no point in going on */
|
/* we hit a expand_index, no point in going on */
|
||||||
static PredEntry *found_fail(yamop *pc, void **startp, void **endp USES_REGS) {
|
static PredEntry *found_fail(yamop *pc, void **startp, void **endp USES_REGS) {
|
||||||
PredEntry *pp = RepPredProp(Yap_GetPredPropByAtom(AtomFail, CurrentModule));
|
PredEntry *pp = RepPredProp(Yap_GetPredPropByAtom(AtomFail, CurrentModule));
|
||||||
*startp = *endp = (CODEADDR)FAILCODE;
|
*startp = *endp = (CODEADDR) FAILCODE;
|
||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we hit a expand_index, no point in going on */
|
/* we hit a expand_index, no point in going on */
|
||||||
static PredEntry *found_owner_op(yamop *pc, void **startp,
|
static PredEntry *found_owner_op(yamop *pc, void **startp,
|
||||||
void **endp USES_REGS) {
|
void **endp USES_REGS) {
|
||||||
PredEntry *pp = ((PredEntry *)(Unsigned(pc) -
|
PredEntry *pp = ((PredEntry *) (Unsigned(pc) -
|
||||||
(CELL)(&(((PredEntry *)NULL)->OpcodeOfPred))));
|
(CELL) (&(((PredEntry *) NULL)->OpcodeOfPred))));
|
||||||
*startp = (CODEADDR) & (pp->OpcodeOfPred);
|
*startp = (CODEADDR) &(pp->OpcodeOfPred);
|
||||||
*endp = (CODEADDR)NEXTOP((yamop *)&(pp->OpcodeOfPred), e);
|
*endp = (CODEADDR) NEXTOP((yamop *) &(pp->OpcodeOfPred), e);
|
||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -766,10 +786,10 @@ static PredEntry *found_owner_op(yamop *pc, void **startp,
|
|||||||
static PredEntry *found_expand(yamop *pc, void **startp,
|
static PredEntry *found_expand(yamop *pc, void **startp,
|
||||||
void **endp USES_REGS) {
|
void **endp USES_REGS) {
|
||||||
PredEntry *pp =
|
PredEntry *pp =
|
||||||
((PredEntry *)(Unsigned(pc) -
|
((PredEntry *) (Unsigned(pc) -
|
||||||
(CELL)(&(((PredEntry *)NULL)->cs.p_code.ExpandCode))));
|
(CELL) (&(((PredEntry *) NULL)->cs.p_code.ExpandCode))));
|
||||||
*startp = (CODEADDR) & (pp->cs.p_code.ExpandCode);
|
*startp = (CODEADDR) &(pp->cs.p_code.ExpandCode);
|
||||||
*endp = (CODEADDR)NEXTOP((yamop *)&(pp->cs.p_code.ExpandCode), e);
|
*endp = (CODEADDR) NEXTOP((yamop *) &(pp->cs.p_code.ExpandCode), e);
|
||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -778,9 +798,9 @@ static PredEntry *found_ystop(yamop *pc, int clause_code, void **startp,
|
|||||||
if (pc == YESCODE) {
|
if (pc == YESCODE) {
|
||||||
pp = RepPredProp(Yap_GetPredPropByAtom(AtomTrue, CurrentModule));
|
pp = RepPredProp(Yap_GetPredPropByAtom(AtomTrue, CurrentModule));
|
||||||
if (startp)
|
if (startp)
|
||||||
*startp = (CODEADDR)YESCODE;
|
*startp = (CODEADDR) YESCODE;
|
||||||
if (endp)
|
if (endp)
|
||||||
*endp = (CODEADDR)YESCODE + (CELL)(NEXTOP((yamop *)NULL, e));
|
*endp = (CODEADDR) YESCODE + (CELL) (NEXTOP((yamop *) NULL, e));
|
||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
if (!pp) {
|
if (!pp) {
|
||||||
@ -789,33 +809,33 @@ static PredEntry *found_ystop(yamop *pc, int clause_code, void **startp,
|
|||||||
pp = o->y_u.Osbpp.p0;
|
pp = o->y_u.Osbpp.p0;
|
||||||
} else {
|
} else {
|
||||||
/* must be an index */
|
/* must be an index */
|
||||||
PredEntry **pep = (PredEntry **)pc->y_u.l.l;
|
PredEntry **pep = (PredEntry **) pc->y_u.l.l;
|
||||||
pp = pep[-1];
|
pp = pep[-1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pp->PredFlags & LogUpdatePredFlag) {
|
if (pp->PredFlags & LogUpdatePredFlag) {
|
||||||
if (clause_code) {
|
if (clause_code) {
|
||||||
LogUpdClause *cl = ClauseCodeToLogUpdClause(pc->y_u.l.l);
|
LogUpdClause *cl = ClauseCodeToLogUpdClause(pc->y_u.l.l);
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR) cl;
|
||||||
*endp = (CODEADDR)cl + cl->ClSize;
|
*endp = (CODEADDR) cl + cl->ClSize;
|
||||||
} else {
|
} else {
|
||||||
LogUpdIndex *cl = ClauseCodeToLogUpdIndex(pc->y_u.l.l);
|
LogUpdIndex *cl = ClauseCodeToLogUpdIndex(pc->y_u.l.l);
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR) cl;
|
||||||
*endp = (CODEADDR)cl + cl->ClSize;
|
*endp = (CODEADDR) cl + cl->ClSize;
|
||||||
}
|
}
|
||||||
} else if (pp->PredFlags & DynamicPredFlag) {
|
} else if (pp->PredFlags & DynamicPredFlag) {
|
||||||
DynamicClause *cl = ClauseCodeToDynamicClause(pc->y_u.l.l);
|
DynamicClause *cl = ClauseCodeToDynamicClause(pc->y_u.l.l);
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR) cl;
|
||||||
*endp = (CODEADDR)cl + cl->ClSize;
|
*endp = (CODEADDR) cl + cl->ClSize;
|
||||||
} else {
|
} else {
|
||||||
if (clause_code) {
|
if (clause_code) {
|
||||||
StaticClause *cl = ClauseCodeToStaticClause(pc->y_u.l.l);
|
StaticClause *cl = ClauseCodeToStaticClause(pc->y_u.l.l);
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR) cl;
|
||||||
*endp = (CODEADDR)cl + cl->ClSize;
|
*endp = (CODEADDR) cl + cl->ClSize;
|
||||||
} else {
|
} else {
|
||||||
StaticIndex *cl = ClauseCodeToStaticIndex(pc->y_u.l.l);
|
StaticIndex *cl = ClauseCodeToStaticIndex(pc->y_u.l.l);
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR) cl;
|
||||||
*endp = (CODEADDR)cl + cl->ClSize;
|
*endp = (CODEADDR) cl + cl->ClSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pp;
|
return pp;
|
||||||
@ -829,12 +849,14 @@ static PredEntry *ClauseInfoForCode(yamop *codeptr, void **startp,
|
|||||||
|
|
||||||
if (codeptr >= COMMA_CODE && codeptr < FAILCODE) {
|
if (codeptr >= COMMA_CODE && codeptr < FAILCODE) {
|
||||||
pp = RepPredProp(Yap_GetPredPropByFunc(FunctorComma, CurrentModule));
|
pp = RepPredProp(Yap_GetPredPropByFunc(FunctorComma, CurrentModule));
|
||||||
*startp = (CODEADDR)COMMA_CODE;
|
*startp = (CODEADDR) COMMA_CODE;
|
||||||
*endp = (CODEADDR)(FAILCODE - 1);
|
*endp = (CODEADDR) (FAILCODE - 1);
|
||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
pc = codeptr;
|
pc = codeptr;
|
||||||
|
|
||||||
#include "walkclause.h"
|
#include "walkclause.h"
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -891,9 +913,9 @@ static Int pred_for_code(USES_REGS1) {
|
|||||||
} else if (IsApplTerm(t) && FunctorOfTerm(t) == FunctorStaticClause) {
|
} else if (IsApplTerm(t) && FunctorOfTerm(t) == FunctorStaticClause) {
|
||||||
codeptr = Yap_ClauseFromTerm(t)->ClCode;
|
codeptr = Yap_ClauseFromTerm(t)->ClCode;
|
||||||
} else if (IsIntegerTerm(t)) {
|
} else if (IsIntegerTerm(t)) {
|
||||||
codeptr = (yamop *)IntegerOfTerm(t);
|
codeptr = (yamop *) IntegerOfTerm(t);
|
||||||
} else if (IsDBRefTerm(t)) {
|
} else if (IsDBRefTerm(t)) {
|
||||||
codeptr = (yamop *)DBRefOfTerm(t);
|
codeptr = (yamop *) DBRefOfTerm(t);
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -911,7 +933,7 @@ static Int pred_for_code(USES_REGS1) {
|
|||||||
|
|
||||||
static LogUpdIndex *find_owner_log_index(LogUpdIndex *cl, yamop *code_p) {
|
static LogUpdIndex *find_owner_log_index(LogUpdIndex *cl, yamop *code_p) {
|
||||||
yamop *code_beg = cl->ClCode;
|
yamop *code_beg = cl->ClCode;
|
||||||
yamop *code_end = (yamop *)((char *)cl + cl->ClSize);
|
yamop *code_end = (yamop *) ((char *) cl + cl->ClSize);
|
||||||
|
|
||||||
if (code_p >= code_beg && code_p <= code_end) {
|
if (code_p >= code_beg && code_p <= code_end) {
|
||||||
return cl;
|
return cl;
|
||||||
@ -929,7 +951,7 @@ static LogUpdIndex *find_owner_log_index(LogUpdIndex *cl, yamop *code_p) {
|
|||||||
|
|
||||||
static StaticIndex *find_owner_static_index(StaticIndex *cl, yamop *code_p) {
|
static StaticIndex *find_owner_static_index(StaticIndex *cl, yamop *code_p) {
|
||||||
yamop *code_beg = cl->ClCode;
|
yamop *code_beg = cl->ClCode;
|
||||||
yamop *code_end = (yamop *)((char *)cl + cl->ClSize);
|
yamop *code_end = (yamop *) ((char *) cl + cl->ClSize);
|
||||||
|
|
||||||
if (code_p >= code_beg && code_p <= code_end) {
|
if (code_p >= code_beg && code_p <= code_end) {
|
||||||
return cl;
|
return cl;
|
||||||
@ -949,10 +971,10 @@ ClauseUnion *Yap_find_owner_index(yamop *ipc, PredEntry *ap) {
|
|||||||
/* we assume we have an owner index */
|
/* we assume we have an owner index */
|
||||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||||
LogUpdIndex *cl = ClauseCodeToLogUpdIndex(ap->cs.p_code.TrueCodeOfPred);
|
LogUpdIndex *cl = ClauseCodeToLogUpdIndex(ap->cs.p_code.TrueCodeOfPred);
|
||||||
return (ClauseUnion *)find_owner_log_index(cl, ipc);
|
return (ClauseUnion *) find_owner_log_index(cl, ipc);
|
||||||
} else {
|
} else {
|
||||||
StaticIndex *cl = ClauseCodeToStaticIndex(ap->cs.p_code.TrueCodeOfPred);
|
StaticIndex *cl = ClauseCodeToStaticIndex(ap->cs.p_code.TrueCodeOfPred);
|
||||||
return (ClauseUnion *)find_owner_static_index(cl, ipc);
|
return (ClauseUnion *) find_owner_static_index(cl, ipc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -972,13 +994,13 @@ static Term all_envs(CELL *env_ptr USES_REGS) {
|
|||||||
LOCAL_Error_Size = (ASP - 1024) - HR;
|
LOCAL_Error_Size = (ASP - 1024) - HR;
|
||||||
while (env_ptr) {
|
while (env_ptr) {
|
||||||
LOCAL_Error_Size += 2;
|
LOCAL_Error_Size += 2;
|
||||||
env_ptr = (CELL *)(env_ptr[E_E]);
|
env_ptr = (CELL *) (env_ptr[E_E]);
|
||||||
}
|
}
|
||||||
return 0L;
|
return 0L;
|
||||||
} else {
|
} else {
|
||||||
bp[1] = AbsPair(HR);
|
bp[1] = AbsPair(HR);
|
||||||
}
|
}
|
||||||
env_ptr = (CELL *)(env_ptr[E_E]);
|
env_ptr = (CELL *) (env_ptr[E_E]);
|
||||||
}
|
}
|
||||||
bp[1] = TermNil;
|
bp[1] = TermNil;
|
||||||
return tf;
|
return tf;
|
||||||
@ -993,7 +1015,7 @@ static Term all_cps(choiceptr b_ptr USES_REGS) {
|
|||||||
bp = HR;
|
bp = HR;
|
||||||
HR += 2;
|
HR += 2;
|
||||||
/* notice that MkIntegerTerm may increase the HReap */
|
/* notice that MkIntegerTerm may increase the HReap */
|
||||||
bp[0] = MkIntegerTerm((Int)(LCL0 - (CELL *)b_ptr));
|
bp[0] = MkIntegerTerm((Int) (LCL0 - (CELL *) b_ptr));
|
||||||
if (HR >= ASP - 1024) {
|
if (HR >= ASP - 1024) {
|
||||||
HR = start;
|
HR = start;
|
||||||
LOCAL_Error_Size = (ASP - 1024) - HR;
|
LOCAL_Error_Size = (ASP - 1024) - HR;
|
||||||
@ -1006,7 +1028,7 @@ static Term all_cps(choiceptr b_ptr USES_REGS) {
|
|||||||
bp[1] = AbsPair(HR);
|
bp[1] = AbsPair(HR);
|
||||||
}
|
}
|
||||||
b_ptr = b_ptr->cp_b;
|
b_ptr = b_ptr->cp_b;
|
||||||
if (!IsVarTerm((CELL)b_ptr) || (CELL *)b_ptr < HR || (CELL *)b_ptr > LCL0) {
|
if (!IsVarTerm((CELL) b_ptr) || (CELL *) b_ptr < HR || (CELL *) b_ptr > LCL0) {
|
||||||
// Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "choice-point chain
|
// Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "choice-point chain
|
||||||
// corrupted at %p!!!\n", b_ptr);
|
// corrupted at %p!!!\n", b_ptr);
|
||||||
break;
|
break;
|
||||||
@ -1044,7 +1066,7 @@ static Term clause_info(yamop *codeptr, PredEntry *pp) {
|
|||||||
void *begin;
|
void *begin;
|
||||||
|
|
||||||
if (pp->ArityOfPE == 0) {
|
if (pp->ArityOfPE == 0) {
|
||||||
ts[0] = MkAtomTerm((Atom)pp->FunctorOfPred);
|
ts[0] = MkAtomTerm((Atom) pp->FunctorOfPred);
|
||||||
ts[1] = MkIntTerm(0);
|
ts[1] = MkIntTerm(0);
|
||||||
} else {
|
} else {
|
||||||
ts[0] = MkAtomTerm(NameOfFunctor(pp->FunctorOfPred));
|
ts[0] = MkAtomTerm(NameOfFunctor(pp->FunctorOfPred));
|
||||||
@ -1069,7 +1091,7 @@ bool set_clause_info(yamop *codeptr, PredEntry *pp) {
|
|||||||
Term ts[2];
|
Term ts[2];
|
||||||
void *begin;
|
void *begin;
|
||||||
if (pp->ArityOfPE == 0) {
|
if (pp->ArityOfPE == 0) {
|
||||||
LOCAL_ActiveError->prologPredName = (Atom)pp->FunctorOfPred;
|
LOCAL_ActiveError->prologPredName = (Atom) pp->FunctorOfPred;
|
||||||
LOCAL_ActiveError->prologPredArity = 0;
|
LOCAL_ActiveError->prologPredArity = 0;
|
||||||
} else {
|
} else {
|
||||||
LOCAL_ActiveError->prologPredName = NameOfFunctor(pp->FunctorOfPred);
|
LOCAL_ActiveError->prologPredName = NameOfFunctor(pp->FunctorOfPred);
|
||||||
@ -1128,8 +1150,8 @@ static Term error_culprit(bool internal USES_REGS) {
|
|||||||
while (curCP != YESCODE) {
|
while (curCP != YESCODE) {
|
||||||
if (pe->ModuleOfPred)
|
if (pe->ModuleOfPred)
|
||||||
return clause_info(curCP, pe);
|
return clause_info(curCP, pe);
|
||||||
curENV = (CELL *)(curENV[E_E]);
|
curENV = (CELL *) (curENV[E_E]);
|
||||||
curCP = (yamop *)(curENV[E_CP]);
|
curCP = (yamop *) (curENV[E_CP]);
|
||||||
pe = EnvPreg(curCP);
|
pe = EnvPreg(curCP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1149,7 +1171,7 @@ bool Yap_find_prolog_culprit(USES_REGS1) {
|
|||||||
PredEntry *pe = EnvPreg(curCP);
|
PredEntry *pe = EnvPreg(curCP);
|
||||||
|
|
||||||
while (curCP != YESCODE) {
|
while (curCP != YESCODE) {
|
||||||
curENV = (CELL *)(curENV[E_E]);
|
curENV = (CELL *) (curENV[E_E]);
|
||||||
if (curENV < ASP || curENV >= LCL0) {
|
if (curENV < ASP || curENV >= LCL0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1159,7 +1181,7 @@ bool Yap_find_prolog_culprit(USES_REGS1) {
|
|||||||
}
|
}
|
||||||
if (pe->ModuleOfPred)
|
if (pe->ModuleOfPred)
|
||||||
return set_clause_info(curCP, pe);
|
return set_clause_info(curCP, pe);
|
||||||
curCP = (yamop *)(curENV[E_CP]);
|
curCP = (yamop *) (curENV[E_CP]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TermNil;
|
return TermNil;
|
||||||
@ -1213,7 +1235,7 @@ static Int current_stack(USES_REGS1) {
|
|||||||
#if LOW_PROF
|
#if LOW_PROF
|
||||||
|
|
||||||
static void add_code_in_lu_index(LogUpdIndex *cl, PredEntry *pp) {
|
static void add_code_in_lu_index(LogUpdIndex *cl, PredEntry *pp) {
|
||||||
char *code_end = (char *)cl + cl->ClSize;
|
char *code_end = (char *) cl + cl->ClSize;
|
||||||
Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_LU_INDEX);
|
Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_LU_INDEX);
|
||||||
cl = cl->ChildIndex;
|
cl = cl->ChildIndex;
|
||||||
while (cl != NULL) {
|
while (cl != NULL) {
|
||||||
@ -1223,7 +1245,7 @@ static void add_code_in_lu_index(LogUpdIndex *cl, PredEntry *pp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void add_code_in_static_index(StaticIndex *cl, PredEntry *pp) {
|
static void add_code_in_static_index(StaticIndex *cl, PredEntry *pp) {
|
||||||
char *code_end = (char *)cl + cl->ClSize;
|
char *code_end = (char *) cl + cl->ClSize;
|
||||||
Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_STATIC_INDEX);
|
Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_STATIC_INDEX);
|
||||||
cl = cl->ChildIndex;
|
cl = cl->ChildIndex;
|
||||||
while (cl != NULL) {
|
while (cl != NULL) {
|
||||||
@ -1247,7 +1269,7 @@ static void add_code_in_pred(PredEntry *pp) {
|
|||||||
|
|
||||||
clcode = pp->CodeOfPred;
|
clcode = pp->CodeOfPred;
|
||||||
cl = ClauseCodeToStaticClause(clcode);
|
cl = ClauseCodeToStaticClause(clcode);
|
||||||
code_end = (char *)cl + cl->ClSize;
|
code_end = (char *) cl + cl->ClSize;
|
||||||
Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_INIT_SYSTEM_CODE);
|
Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_INIT_SYSTEM_CODE);
|
||||||
UNLOCK(pp->PELock);
|
UNLOCK(pp->PELock);
|
||||||
return;
|
return;
|
||||||
@ -1272,7 +1294,7 @@ static void add_code_in_pred(PredEntry *pp) {
|
|||||||
do {
|
do {
|
||||||
char *code_end;
|
char *code_end;
|
||||||
|
|
||||||
code_end = (char *)cl + cl->ClSize;
|
code_end = (char *) cl + cl->ClSize;
|
||||||
Yap_inform_profiler_of_clause(cl, code_end, pp,
|
Yap_inform_profiler_of_clause(cl, code_end, pp,
|
||||||
GPROF_INIT_LOG_UPD_CLAUSE);
|
GPROF_INIT_LOG_UPD_CLAUSE);
|
||||||
cl = cl->ClNext;
|
cl = cl->ClNext;
|
||||||
@ -1283,7 +1305,7 @@ static void add_code_in_pred(PredEntry *pp) {
|
|||||||
CODEADDR code_end;
|
CODEADDR code_end;
|
||||||
|
|
||||||
cl = ClauseCodeToDynamicClause(clcode);
|
cl = ClauseCodeToDynamicClause(clcode);
|
||||||
code_end = (CODEADDR)cl + cl->ClSize;
|
code_end = (CODEADDR) cl + cl->ClSize;
|
||||||
Yap_inform_profiler_of_clause(cl, code_end, pp,
|
Yap_inform_profiler_of_clause(cl, code_end, pp,
|
||||||
GPROF_INIT_DYNAMIC_CLAUSE);
|
GPROF_INIT_DYNAMIC_CLAUSE);
|
||||||
if (clcode == pp->cs.p_code.LastClause)
|
if (clcode == pp->cs.p_code.LastClause)
|
||||||
@ -1295,7 +1317,7 @@ static void add_code_in_pred(PredEntry *pp) {
|
|||||||
do {
|
do {
|
||||||
char *code_end;
|
char *code_end;
|
||||||
|
|
||||||
code_end = (char *)cl + cl->ClSize;
|
code_end = (char *) cl + cl->ClSize;
|
||||||
Yap_inform_profiler_of_clause(cl, code_end, pp,
|
Yap_inform_profiler_of_clause(cl, code_end, pp,
|
||||||
GPROF_INIT_STATIC_CLAUSE);
|
GPROF_INIT_STATIC_CLAUSE);
|
||||||
if (cl->ClCode == pp->cs.p_code.LastClause)
|
if (cl->ClCode == pp->cs.p_code.LastClause)
|
||||||
@ -1340,7 +1362,7 @@ void Yap_dump_code_area_for_profiler(void) {
|
|||||||
#endif /* LOW_PROF */
|
#endif /* LOW_PROF */
|
||||||
|
|
||||||
static Int program_continuation(USES_REGS1) {
|
static Int program_continuation(USES_REGS1) {
|
||||||
PredEntry *pe = EnvPreg((yamop *)((ENV_Parent(ENV))[E_CP]));
|
PredEntry *pe = EnvPreg((yamop *) ((ENV_Parent(ENV))[E_CP]));
|
||||||
if (pe->ModuleOfPred) {
|
if (pe->ModuleOfPred) {
|
||||||
if (!Yap_unify(ARG1, pe->ModuleOfPred))
|
if (!Yap_unify(ARG1, pe->ModuleOfPred))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1354,7 +1376,7 @@ static Int program_continuation(USES_REGS1) {
|
|||||||
if (!Yap_unify(ARG3, MkIntegerTerm(ArityOfFunctor(pe->FunctorOfPred))))
|
if (!Yap_unify(ARG3, MkIntegerTerm(ArityOfFunctor(pe->FunctorOfPred))))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
if (!Yap_unify(ARG2, MkAtomTerm((Atom)pe->FunctorOfPred)))
|
if (!Yap_unify(ARG2, MkAtomTerm((Atom) pe->FunctorOfPred)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!Yap_unify(ARG3, MkIntTerm(0)))
|
if (!Yap_unify(ARG3, MkIntTerm(0)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1394,7 +1416,7 @@ static int UnifyPredInfo(PredEntry *pe, int start_arg USES_REGS) {
|
|||||||
tmod = pe->ModuleOfPred;
|
tmod = pe->ModuleOfPred;
|
||||||
}
|
}
|
||||||
if (pe->ArityOfPE == 0) {
|
if (pe->ArityOfPE == 0) {
|
||||||
tname = MkAtomTerm((Atom)pe->FunctorOfPred);
|
tname = MkAtomTerm((Atom) pe->FunctorOfPred);
|
||||||
} else {
|
} else {
|
||||||
Functor f = pe->FunctorOfPred;
|
Functor f = pe->FunctorOfPred;
|
||||||
tname = MkAtomTerm(NameOfFunctor(f));
|
tname = MkAtomTerm(NameOfFunctor(f));
|
||||||
@ -1404,7 +1426,7 @@ static int UnifyPredInfo(PredEntry *pe, int start_arg USES_REGS) {
|
|||||||
if (pe->PredFlags & NumberDBPredFlag) {
|
if (pe->PredFlags & NumberDBPredFlag) {
|
||||||
tname = MkIntegerTerm(pe->src.IndxId);
|
tname = MkIntegerTerm(pe->src.IndxId);
|
||||||
} else if (pe->PredFlags & AtomDBPredFlag) {
|
} else if (pe->PredFlags & AtomDBPredFlag) {
|
||||||
tname = MkAtomTerm((Atom)pe->FunctorOfPred);
|
tname = MkAtomTerm((Atom) pe->FunctorOfPred);
|
||||||
} else {
|
} else {
|
||||||
Functor f = pe->FunctorOfPred;
|
Functor f = pe->FunctorOfPred;
|
||||||
tname = MkAtomTerm(NameOfFunctor(f));
|
tname = MkAtomTerm(NameOfFunctor(f));
|
||||||
@ -1429,18 +1451,18 @@ static Int env_info(USES_REGS1) {
|
|||||||
|
|
||||||
if (!env)
|
if (!env)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
env_b = MkIntegerTerm((Int)(LCL0 - (CELL *)env[E_CB]));
|
env_b = MkIntegerTerm((Int) (LCL0 - (CELL *) env[E_CB]));
|
||||||
env_cp = (yamop *)env[E_CP];
|
env_cp = (yamop *) env[E_CP];
|
||||||
|
|
||||||
/* pe = PREVOP(env_cp,Osbpp)->y_u.Osbpp.p0; */
|
/* pe = PREVOP(env_cp,Osbpp)->y_u.Osbpp.p0; */
|
||||||
taddr = MkIntegerTerm((Int)env);
|
taddr = MkIntegerTerm((Int) env);
|
||||||
return Yap_unify(ARG3, MkIntegerTerm((Int)env_cp)) &&
|
return Yap_unify(ARG3, MkIntegerTerm((Int) env_cp)) &&
|
||||||
Yap_unify(ARG2, taddr) && Yap_unify(ARG4, env_b);
|
Yap_unify(ARG2, taddr) && Yap_unify(ARG4, env_b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int p_cpc_info(USES_REGS1) {
|
static Int p_cpc_info(USES_REGS1) {
|
||||||
PredEntry *pe;
|
PredEntry *pe;
|
||||||
yamop *ipc = (yamop *)IntegerOfTerm(Deref(ARG1));
|
yamop *ipc = (yamop *) IntegerOfTerm(Deref(ARG1));
|
||||||
|
|
||||||
pe = PREVOP(ipc, Osbpp)->y_u.Osbpp.p0;
|
pe = PREVOP(ipc, Osbpp)->y_u.Osbpp.p0;
|
||||||
return UnifyPredInfo(pe, 2 PASS_REGS) &&
|
return UnifyPredInfo(pe, 2 PASS_REGS) &&
|
||||||
@ -1448,14 +1470,14 @@ static Int p_cpc_info(USES_REGS1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Int p_choicepoint_info(USES_REGS1) {
|
static Int p_choicepoint_info(USES_REGS1) {
|
||||||
choiceptr cptr = (choiceptr)(LCL0 - IntegerOfTerm(Deref(ARG1)));
|
choiceptr cptr = (choiceptr) (LCL0 - IntegerOfTerm(Deref(ARG1)));
|
||||||
PredEntry *pe = NULL;
|
PredEntry *pe = NULL;
|
||||||
int go_on = TRUE;
|
int go_on = TRUE;
|
||||||
yamop *ipc = cptr->cp_ap;
|
yamop *ipc = cptr->cp_ap;
|
||||||
yamop *ncl = NULL;
|
yamop *ncl = NULL;
|
||||||
Term t = TermNil, taddr;
|
Term t = TermNil, taddr;
|
||||||
|
|
||||||
taddr = MkIntegerTerm((Int)cptr);
|
taddr = MkIntegerTerm((Int) cptr);
|
||||||
while (go_on) {
|
while (go_on) {
|
||||||
op_numbers opnum = Yap_op_from_opcode(ipc->opc);
|
op_numbers opnum = Yap_op_from_opcode(ipc->opc);
|
||||||
go_on = FALSE;
|
go_on = FALSE;
|
||||||
@ -1487,7 +1509,7 @@ static Int p_choicepoint_info(USES_REGS1) {
|
|||||||
#endif /* DETERMINISTIC_TABLING */
|
#endif /* DETERMINISTIC_TABLING */
|
||||||
{
|
{
|
||||||
pe = GEN_CP(cptr)->cp_pred_entry;
|
pe = GEN_CP(cptr)->cp_pred_entry;
|
||||||
t = BuildActivePred(pe, (CELL *)(GEN_CP(B) + 1));
|
t = BuildActivePred(pe, (CELL *) (GEN_CP(B) + 1));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
pe = UndefCode;
|
pe = UndefCode;
|
||||||
@ -1617,7 +1639,8 @@ static Int p_choicepoint_info(USES_REGS1) {
|
|||||||
Atom at = AtomLive;
|
Atom at = AtomLive;
|
||||||
t = MkAtomTerm(at);
|
t = MkAtomTerm(at);
|
||||||
pe = RepPredProp(PredPropByAtom(at, CurrentModule));
|
pe = RepPredProp(PredPropByAtom(at, CurrentModule));
|
||||||
} break;
|
}
|
||||||
|
break;
|
||||||
case _Ystop:
|
case _Ystop:
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1645,8 +1668,11 @@ parent_pred(USES_REGS1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Yap_dump_stack(void);
|
void Yap_dump_stack(void);
|
||||||
|
|
||||||
void DumpActiveGoals(CACHE_TYPE1);
|
void DumpActiveGoals(CACHE_TYPE1);
|
||||||
|
|
||||||
static int hidden(Atom);
|
static int hidden(Atom);
|
||||||
|
|
||||||
static int legal_env(CELL *CACHE_TYPE);
|
static int legal_env(CELL *CACHE_TYPE);
|
||||||
|
|
||||||
#define ONLOCAL(ptr) \
|
#define ONLOCAL(ptr) \
|
||||||
@ -1673,8 +1699,8 @@ static int legal_env(CELL *ep USES_REGS) {
|
|||||||
cp = ep[E_CP];
|
cp = ep[E_CP];
|
||||||
if (!ONHEAP(cp))
|
if (!ONHEAP(cp))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
ps = *((CELL *)(Addr(cp) - CellSize));
|
ps = *((CELL *) (Addr(cp) - CellSize));
|
||||||
pe = (PredEntry *)(ps - sizeof(OPREG) - sizeof(Prop));
|
pe = (PredEntry *) (ps - sizeof(OPREG) - sizeof(Prop));
|
||||||
PELOCK(70, pe);
|
PELOCK(70, pe);
|
||||||
if (!ONHEAP(pe) || Unsigned(pe) & 3 || pe->KindOfPE & 0xff00) {
|
if (!ONHEAP(pe) || Unsigned(pe) & 3 || pe->KindOfPE & 0xff00) {
|
||||||
UNLOCK(pe->PELock);
|
UNLOCK(pe->PELock);
|
||||||
@ -1720,14 +1746,14 @@ void Yap_dump_stack(void) {
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
fprintf(stderr, "%% YAP regs: P=%p, CP=%p, ASP=%p, H=%p, TR=%p, HeapTop=%p\n",
|
fprintf(stderr, "%% YAP regs: P=%p, CP=%p, ASP=%p, H=%p, TR=%p, HeapTop=%p\n",
|
||||||
P, CP, ASP, HR, TR, HeapTop);
|
P, CP, ASP, HR, TR, HeapTop);
|
||||||
fprintf(stderr, "%% YAP mode: %ux\n", (unsigned int)LOCAL_PrologMode);
|
fprintf(stderr, "%% YAP mode: %ux\n", (unsigned int) LOCAL_PrologMode);
|
||||||
if (LOCAL_ErrorMessage)
|
if (LOCAL_ErrorMessage)
|
||||||
fprintf(stderr, "%% LOCAL_ErrorMessage: %s\n", LOCAL_ErrorMessage);
|
fprintf(stderr, "%% LOCAL_ErrorMessage: %s\n", LOCAL_ErrorMessage);
|
||||||
#endif
|
#endif
|
||||||
if (HR > ASP || HR > LCL0) {
|
if (HR > ASP || HR > LCL0) {
|
||||||
fprintf(stderr, "%% YAP ERROR: Global Collided against Local (%p--%p)\n",
|
fprintf(stderr, "%% YAP ERROR: Global Collided against Local (%p--%p)\n",
|
||||||
HR, ASP);
|
HR, ASP);
|
||||||
} else if (HeapTop > (ADDR)LOCAL_GlobalBase) {
|
} else if (HeapTop > (ADDR) LOCAL_GlobalBase) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%% YAP ERROR: Code Space Collided against Global (%p--%p)\n",
|
"%% YAP ERROR: Code Space Collided against Global (%p--%p)\n",
|
||||||
HeapTop, LOCAL_GlobalBase);
|
HeapTop, LOCAL_GlobalBase);
|
||||||
@ -1747,18 +1773,18 @@ void Yap_dump_stack(void) {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
Yap_detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, 256);
|
Yap_detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, 256);
|
||||||
fprintf(stderr, "%%\n%% PC: %s\n", (char *)HR);
|
fprintf(stderr, "%%\n%% PC: %s\n", (char *) HR);
|
||||||
Yap_detect_bug_location(CP, FIND_PRED_FROM_ANYWHERE, 256);
|
Yap_detect_bug_location(CP, FIND_PRED_FROM_ANYWHERE, 256);
|
||||||
fprintf(stderr, "%% Continuation: %s\n", (char *)HR);
|
fprintf(stderr, "%% Continuation: %s\n", (char *) HR);
|
||||||
fprintf(stderr, "%% %luKB of Global Stack (%p--%p)\n",
|
fprintf(stderr, "%% %luKB of Global Stack (%p--%p)\n",
|
||||||
(unsigned long int)(sizeof(CELL) * (HR - H0)) / 1024, H0, HR);
|
(unsigned long int) (sizeof(CELL) * (HR - H0)) / 1024, H0, HR);
|
||||||
fprintf(stderr, "%% %luKB of Local Stack (%p--%p)\n",
|
fprintf(stderr, "%% %luKB of Local Stack (%p--%p)\n",
|
||||||
(unsigned long int)(sizeof(CELL) * (LCL0 - ASP)) / 1024, ASP, LCL0);
|
(unsigned long int) (sizeof(CELL) * (LCL0 - ASP)) / 1024, ASP, LCL0);
|
||||||
fprintf(stderr, "%% %luKB of Trail (%p--%p)\n",
|
fprintf(stderr, "%% %luKB of Trail (%p--%p)\n",
|
||||||
(unsigned long int)((ADDR)TR - LOCAL_TrailBase) / 1024,
|
(unsigned long int) ((ADDR) TR - LOCAL_TrailBase) / 1024,
|
||||||
LOCAL_TrailBase, TR);
|
LOCAL_TrailBase, TR);
|
||||||
fprintf(stderr, "%% Performed %ld garbage collections\n",
|
fprintf(stderr, "%% Performed %ld garbage collections\n",
|
||||||
(unsigned long int)LOCAL_GcCalls);
|
(unsigned long int) LOCAL_GcCalls);
|
||||||
#if LOW_LEVEL_TRACER
|
#if LOW_LEVEL_TRACER
|
||||||
{
|
{
|
||||||
extern long long vsc_count;
|
extern long long vsc_count;
|
||||||
@ -1776,9 +1802,9 @@ void Yap_dump_stack(void) {
|
|||||||
fprintf(stderr, "%% Goals With Alternatives Open (Global In "
|
fprintf(stderr, "%% Goals With Alternatives Open (Global In "
|
||||||
"Use--Local In Use)\n%%\n");
|
"Use--Local In Use)\n%%\n");
|
||||||
while (b_ptr != NULL) {
|
while (b_ptr != NULL) {
|
||||||
while (env_ptr && env_ptr <= (CELL *)b_ptr) {
|
while (env_ptr && env_ptr <= (CELL *) b_ptr) {
|
||||||
Yap_detect_bug_location(ipc, FIND_PRED_FROM_ENV, 256);
|
Yap_detect_bug_location(ipc, FIND_PRED_FROM_ENV, 256);
|
||||||
if (env_ptr == (CELL *)b_ptr && (choiceptr)env_ptr[E_CB] > b_ptr) {
|
if (env_ptr == (CELL *) b_ptr && (choiceptr) env_ptr[E_CB] > b_ptr) {
|
||||||
b_ptr = b_ptr->cp_b;
|
b_ptr = b_ptr->cp_b;
|
||||||
fprintf(stderr, "%% %s\n", tp);
|
fprintf(stderr, "%% %s\n", tp);
|
||||||
} else {
|
} else {
|
||||||
@ -1788,8 +1814,8 @@ void Yap_dump_stack(void) {
|
|||||||
fprintf(stderr, "%% .....\n");
|
fprintf(stderr, "%% .....\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ipc = (yamop *)(env_ptr[E_CP]);
|
ipc = (yamop *) (env_ptr[E_CP]);
|
||||||
env_ptr = (CELL *)(env_ptr[E_E]);
|
env_ptr = (CELL *) (env_ptr[E_E]);
|
||||||
}
|
}
|
||||||
if (b_ptr) {
|
if (b_ptr) {
|
||||||
if (!max_count--) {
|
if (!max_count--) {
|
||||||
@ -1803,8 +1829,8 @@ void Yap_dump_stack(void) {
|
|||||||
/* we can safely ignore ; because there is always an upper env */
|
/* we can safely ignore ; because there is always an upper env */
|
||||||
Yap_detect_bug_location(b_ptr->cp_ap, FIND_PRED_FROM_CP, 256);
|
Yap_detect_bug_location(b_ptr->cp_ap, FIND_PRED_FROM_CP, 256);
|
||||||
fprintf(stderr, "%% %s (%luKB--%luKB)\n", tp,
|
fprintf(stderr, "%% %s (%luKB--%luKB)\n", tp,
|
||||||
(unsigned long int)((b_ptr->cp_h - H0) * sizeof(CELL) / 1024),
|
(unsigned long int) ((b_ptr->cp_h - H0) * sizeof(CELL) / 1024),
|
||||||
(unsigned long int)((ADDR)LCL0 - (ADDR)b_ptr) / 1024);
|
(unsigned long int) ((ADDR) LCL0 - (ADDR) b_ptr) / 1024);
|
||||||
}
|
}
|
||||||
b_ptr = b_ptr->cp_b;
|
b_ptr = b_ptr->cp_b;
|
||||||
}
|
}
|
||||||
@ -1830,7 +1856,7 @@ void DumpActiveGoals(USES_REGS1) {
|
|||||||
cp = ep[E_CP];
|
cp = ep[E_CP];
|
||||||
if (!ONHEAP(cp) || (Unsigned(cp) & (sizeof(CELL) - 1)))
|
if (!ONHEAP(cp) || (Unsigned(cp) & (sizeof(CELL) - 1)))
|
||||||
break;
|
break;
|
||||||
pe = EnvPreg((yamop *)cp);
|
pe = EnvPreg((yamop *) cp);
|
||||||
if (!ONHEAP(pe) || Unsigned(pe) & (sizeof(CELL) - 1))
|
if (!ONHEAP(pe) || Unsigned(pe) & (sizeof(CELL) - 1))
|
||||||
break;
|
break;
|
||||||
PELOCK(71, pe);
|
PELOCK(71, pe);
|
||||||
@ -1858,7 +1884,7 @@ void DumpActiveGoals(USES_REGS1) {
|
|||||||
UNLOCK(pe->PELock);
|
UNLOCK(pe->PELock);
|
||||||
}
|
}
|
||||||
next:
|
next:
|
||||||
ep = (CELL *)ep[E_E];
|
ep = (CELL *) ep[E_E];
|
||||||
}
|
}
|
||||||
first = 1;
|
first = 1;
|
||||||
fprintf(stderr, "Active Choice-Points:\n");
|
fprintf(stderr, "Active Choice-Points:\n");
|
||||||
@ -1890,7 +1916,7 @@ void DumpActiveGoals(USES_REGS1) {
|
|||||||
Yap_plwrite(MkIntegerTerm(id), GLOBAL_Stream + 2, 0, 0,
|
Yap_plwrite(MkIntegerTerm(id), GLOBAL_Stream + 2, 0, 0,
|
||||||
GLOBAL_MaxPriority);
|
GLOBAL_MaxPriority);
|
||||||
} else if (pe->PredFlags & AtomDBPredFlag) {
|
} else if (pe->PredFlags & AtomDBPredFlag) {
|
||||||
Atom At = (Atom)pe->FunctorOfPred;
|
Atom At = (Atom) pe->FunctorOfPred;
|
||||||
Yap_plwrite(MkAtomTerm(At), GLOBAL_Stream + 2, 0, 0,
|
Yap_plwrite(MkAtomTerm(At), GLOBAL_Stream + 2, 0, 0,
|
||||||
GLOBAL_MaxPriority);
|
GLOBAL_MaxPriority);
|
||||||
} else {
|
} else {
|
||||||
@ -1913,7 +1939,7 @@ void DumpActiveGoals(USES_REGS1) {
|
|||||||
Yap_plwrite(b_ptr->cp_a2, GLOBAL_Stream + 2, 0, 0, GLOBAL_MaxPriority);
|
Yap_plwrite(b_ptr->cp_a2, GLOBAL_Stream + 2, 0, 0, GLOBAL_MaxPriority);
|
||||||
fputc(')', stderr);
|
fputc(')', stderr);
|
||||||
} else if (pe->ArityOfPE == 0) {
|
} else if (pe->ArityOfPE == 0) {
|
||||||
Yap_plwrite(MkAtomTerm((Atom)f), GLOBAL_Stream + 2, 0, 0,
|
Yap_plwrite(MkAtomTerm((Atom) f), GLOBAL_Stream + 2, 0, 0,
|
||||||
GLOBAL_MaxPriority);
|
GLOBAL_MaxPriority);
|
||||||
} else {
|
} else {
|
||||||
Int i = 0, arity = pe->ArityOfPE;
|
Int i = 0, arity = pe->ArityOfPE;
|
||||||
@ -1958,15 +1984,15 @@ void Yap_detect_bug_location(yamop *yap_pc, int where_from, int psize) {
|
|||||||
fprintf(stderr, "%s", "meta-call");
|
fprintf(stderr, "%s", "meta-call");
|
||||||
} else if (pred_module == 0) {
|
} else if (pred_module == 0) {
|
||||||
fprintf(stderr, "in prolog:%s/%lu", RepAtom(pred_name)->StrOfAE,
|
fprintf(stderr, "in prolog:%s/%lu", RepAtom(pred_name)->StrOfAE,
|
||||||
(unsigned long int)pred_arity);
|
(unsigned long int) pred_arity);
|
||||||
} else if (cl < 0) {
|
} else if (cl < 0) {
|
||||||
fprintf(stderr, "%s:%s/%lu", RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
fprintf(stderr, "%s:%s/%lu", RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
||||||
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity);
|
RepAtom(pred_name)->StrOfAE, (unsigned long int) pred_arity);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "%s:%s/%lu at clause %lu",
|
fprintf(stderr, "%s:%s/%lu at clause %lu",
|
||||||
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
||||||
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity,
|
RepAtom(pred_name)->StrOfAE, (unsigned long int) pred_arity,
|
||||||
(unsigned long int)cl);
|
(unsigned long int) cl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1980,7 +2006,7 @@ static Term build_bug_location(yamop *codeptr, PredEntry *pe) {
|
|||||||
if (pe->ArityOfPE)
|
if (pe->ArityOfPE)
|
||||||
p[1] = MkAtomTerm(NameOfFunctor(pe->FunctorOfPred));
|
p[1] = MkAtomTerm(NameOfFunctor(pe->FunctorOfPred));
|
||||||
else
|
else
|
||||||
p[1] = MkAtomTerm((Atom)pe->FunctorOfPred);
|
p[1] = MkAtomTerm((Atom) pe->FunctorOfPred);
|
||||||
p[2] = MkIntegerTerm(pe->ArityOfPE);
|
p[2] = MkIntegerTerm(pe->ArityOfPE);
|
||||||
if (pe->src.OwnerFile) {
|
if (pe->src.OwnerFile) {
|
||||||
p[3] = MkAtomTerm(pe->src.OwnerFile);
|
p[3] = MkAtomTerm(pe->src.OwnerFile);
|
||||||
@ -2064,7 +2090,7 @@ Term Yap_env_location(yamop *cp, choiceptr b_ptr, CELL *env, Int ignore_first) {
|
|||||||
env = b_ptr->cp_env;
|
env = b_ptr->cp_env;
|
||||||
b_ptr = b_ptr->cp_b;
|
b_ptr = b_ptr->cp_b;
|
||||||
} else {
|
} else {
|
||||||
cp = (yamop *)env[E_CP];
|
cp = (yamop *) env[E_CP];
|
||||||
env = ENV_Parent(env);
|
env = ENV_Parent(env);
|
||||||
}
|
}
|
||||||
ignore_first--;
|
ignore_first--;
|
||||||
|
@ -224,6 +224,10 @@ if (ANACONDA)
|
|||||||
set( PYTHON_INCLUDE_DIR $ENV{PREFIX}/include/python$ENV{PY_VER}m)
|
set( PYTHON_INCLUDE_DIR $ENV{PREFIX}/include/python$ENV{PY_VER}m)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
ADD_CUSTOM_TARGET(run_install COMMAND ${CMAKE_MAKE_PROGRAM} install)
|
||||||
|
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(MACOSX_RPATH ON)
|
set(MACOSX_RPATH ON)
|
||||||
if (NOT ANACONDA)
|
if (NOT ANACONDA)
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include "YapErrors.h"
|
#include "YapErrors.h"
|
||||||
|
|
||||||
#define MAX_ERROR_MSG_SIZE 10
|
#define MAX_ERROR_MSG_SIZE 1024
|
||||||
|
|
||||||
struct yami *Yap_Error__(const char *file, const char *function, int lineno,
|
struct yami *Yap_Error__(const char *file, const char *function, int lineno,
|
||||||
yap_error_number err, YAP_Term wheret, ...);
|
yap_error_number err, YAP_Term wheret, ...);
|
||||||
|
@ -81,12 +81,13 @@ E(DOMAIN_ERROR_TIMEOUT_SPEC, DOMAIN_ERROR, "timeout_spec")
|
|||||||
E(DOMAIN_ERROR_SYNTAX_ERROR_HANDLER, DOMAIN_ERROR, "syntax_error_handler")
|
E(DOMAIN_ERROR_SYNTAX_ERROR_HANDLER, DOMAIN_ERROR, "syntax_error_handler")
|
||||||
E(DOMAIN_ERROR_WRITE_OPTION, DOMAIN_ERROR, "write_option")
|
E(DOMAIN_ERROR_WRITE_OPTION, DOMAIN_ERROR, "write_option")
|
||||||
|
|
||||||
E(EVALUATION_ERROR_FLOAT_OVERFLOW, EVALUATION_ERROR, "float_overflow")
|
E(EVALUATION_ERROR_DBMS, EVALUATION_ERROR, "DBMS_error")
|
||||||
|
E(EVALUATION_ERROR_FLOAT_OVERFLOW, EVALUATION_ERROR, "float_overflow")
|
||||||
E(EVALUATION_ERROR_FLOAT_UNDERFLOW, EVALUATION_ERROR, "float_underflow")
|
E(EVALUATION_ERROR_FLOAT_UNDERFLOW, EVALUATION_ERROR, "float_underflow")
|
||||||
E(EVALUATION_ERROR_INT_OVERFLOW, EVALUATION_ERROR, "int_overflow")
|
E(EVALUATION_ERROR_INT_OVERFLOW, EVALUATION_ERROR, "int_overflow")
|
||||||
E(EVALUATION_ERROR_UNDEFINED, EVALUATION_ERROR, "undefined")
|
E(EVALUATION_ERROR_UNDEFINED, EVALUATION_ERROR, "undefined")
|
||||||
E(EVALUATION_ERROR_UNDERFLOW, EVALUATION_ERROR, "underflow")
|
E(EVALUATION_ERROR_UNDERFLOW, EVALUATION_ERROR, "underflow")
|
||||||
E(EVALUATION_ERROR_ZERO_DIVISOR, EVALUATION_ERROR, "zero_divisor")
|
E(EVALUATION_ERROR_ZERO_DIVISOR, EVALUATION_ERROR, "zero_divisor")
|
||||||
|
|
||||||
E(EXISTENCE_ERROR_ARRAY, EXISTENCE_ERROR, "array")
|
E(EXISTENCE_ERROR_ARRAY, EXISTENCE_ERROR, "array")
|
||||||
E(EXISTENCE_ERROR_KEY, EXISTENCE_ERROR, "key, ")
|
E(EXISTENCE_ERROR_KEY, EXISTENCE_ERROR, "key, ")
|
||||||
|
21
os/charsio.c
21
os/charsio.c
@ -864,27 +864,24 @@ as those for `put` (see 6.11).
|
|||||||
*/
|
*/
|
||||||
static Int skip_1(USES_REGS1) { /* 'skip'(N) */
|
static Int skip_1(USES_REGS1) { /* 'skip'(N) */
|
||||||
Int n;
|
Int n;
|
||||||
Term t2;
|
Term t1;
|
||||||
int sno;
|
int sno;
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
if (IsVarTerm(t2 = Deref(ARG2))) {
|
if (IsVarTerm(t1 = Deref(ARG1))) {
|
||||||
Yap_Error(INSTANTIATION_ERROR, t2, "skip/2");
|
Yap_Error(INSTANTIATION_ERROR, t1, "skip/1");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (!IsIntegerTerm(t2)) {
|
} else if (!IsIntegerTerm(t1)) {
|
||||||
Yap_Error(TYPE_ERROR_INTEGER, t2, "skip/2");
|
Yap_Error(TYPE_ERROR_INTEGER, t1, "skip/1");
|
||||||
return FALSE;
|
|
||||||
} else if ((n = IntegerOfTerm(t2)) < 0) {
|
|
||||||
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, t2, "skip/2");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
} else if ((n = IntegerOfTerm(t1)) < 0) {
|
||||||
|
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, t1, "skip/1");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "skip/2");
|
|
||||||
if (sno < 0)
|
|
||||||
return (FALSE);
|
|
||||||
while ((ch = GLOBAL_Stream[sno].stream_wgetc(sno)) != n && ch != -1)
|
while ((ch = GLOBAL_Stream[sno].stream_wgetc(sno)) != n && ch != -1)
|
||||||
;
|
;
|
||||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
return (TRUE);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @pred skip(+ _S_,- _C_)
|
/** @pred skip(+ _S_,- _C_)
|
||||||
|
@ -5,7 +5,7 @@ INCLUDE(UseSWIG)
|
|||||||
|
|
||||||
include(FindPythonModule)
|
include(FindPythonModule)
|
||||||
|
|
||||||
list (APPEND pl_library ${CMAKE_CURRENT_SOURCE_DIR}/prolog/jupyter.yap ${CMAKE_CURRENT_SOURCE_DIR}/prolog/yapi.yap )
|
list (APPEND pl_library ${CMAKE_CURRENT_SOURCE_DIR}/prolog/yapi.yap )
|
||||||
set (PYTHON_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/yap4py/yapi.py ${CMAKE_CURRENT_SOURCE_DIR}/yap4py/__init__.py ${CMAKE_CURRENT_SOURCE_DIR}/yap4py/__main__.py)
|
set (PYTHON_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/yap4py/yapi.py ${CMAKE_CURRENT_SOURCE_DIR}/yap4py/__init__.py ${CMAKE_CURRENT_SOURCE_DIR}/yap4py/__main__.py)
|
||||||
|
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ SET_SOURCE_FILES_PROPERTIES(../../swiyap.i PROPERTIES SWIG_MODULE_NAME yap4py.ya
|
|||||||
|
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/yap4py)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/yap4py)
|
||||||
|
|
||||||
set(YAP4PY_PL prolog/jupyter.yap prolog/yapi.yap)
|
set(YAP4PY_PL prolog/yapi.yap)
|
||||||
set(YAP4PY_PY yap4py/__init__.py yap4py/__main__.py yap4py/yapi.py)
|
set(YAP4PY_PY yap4py/__init__.py yap4py/__main__.py yap4py/yapi.py)
|
||||||
|
|
||||||
configure_file("setup.py.in" setup.py)
|
configure_file("setup.py.in" setup.py)
|
||||||
|
@ -1383,7 +1383,6 @@ Command = (H --> B) ->
|
|||||||
;
|
;
|
||||||
'$system_catch'('$boot_clause'( Command, Where ), prolog, Error,
|
'$system_catch'('$boot_clause'( Command, Where ), prolog, Error,
|
||||||
user:'$LoopError'(Error, consult) ),
|
user:'$LoopError'(Error, consult) ),
|
||||||
|
|
||||||
fail
|
fail
|
||||||
).
|
).
|
||||||
|
|
||||||
|
59
pl/debug.yap
59
pl/debug.yap
@ -465,12 +465,10 @@ be lost.
|
|||||||
current_prolog_flag(debug, false)
|
current_prolog_flag(debug, false)
|
||||||
;
|
;
|
||||||
'__NB_getval__'('$debug_status',state(zip,Border,Spy), fail),
|
'__NB_getval__'('$debug_status',state(zip,Border,Spy), fail),
|
||||||
( Border >= GoalNumber -> fail;
|
Border < GoalNumber,
|
||||||
Spy == ignore -> true ;
|
( Spy == ignore ; '$pred_being_spied'(G, M) )
|
||||||
'$pred_being_spied'(G, M) -> Border == GoalNumber ;
|
|
||||||
true
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|
writeln(go:G:M),
|
||||||
!,
|
!,
|
||||||
'$execute_nonstop'(G,M).
|
'$execute_nonstop'(G,M).
|
||||||
'$trace_goal'(G, M, GoalNumber, H) :-
|
'$trace_goal'(G, M, GoalNumber, H) :-
|
||||||
@ -611,7 +609,8 @@ be lost.
|
|||||||
( Skip == creep -> true; '$id_goal'(GoalNumber) ; GoalNumber =< Border),
|
( Skip == creep -> true; '$id_goal'(GoalNumber) ; GoalNumber =< Border),
|
||||||
!,
|
!,
|
||||||
'__NB_setval__'('$debug_status', state(creep, 0, stop)),
|
'__NB_setval__'('$debug_status', state(creep, 0, stop)),
|
||||||
'$trace_port_'(Port, GoalNumber, G, Module, Info).
|
'$trace_port_'(Port, GoalNumber, G, Module, Info),
|
||||||
|
writeln(Port:G).
|
||||||
'$trace_port'(_Port, _GoalNumber, _G, _Module, _CalledFromDebugger, _Info).
|
'$trace_port'(_Port, _GoalNumber, _G, _Module, _CalledFromDebugger, _Info).
|
||||||
|
|
||||||
'$trace_port_'(call, GoalNumber, G, Module, Info) :-
|
'$trace_port_'(call, GoalNumber, G, Module, Info) :-
|
||||||
@ -744,38 +743,38 @@ be lost.
|
|||||||
ignore( G ),
|
ignore( G ),
|
||||||
% at this point we are done with leap or skip
|
% at this point we are done with leap or skip
|
||||||
set_prolog_flag(debug, OldDeb),
|
set_prolog_flag(debug, OldDeb),
|
||||||
% skip(10), % '
|
% skip( debugger_input, 10), % '
|
||||||
fail.
|
fail.
|
||||||
'$action'(<,_,_,_,_,_) :- !, % <'Depth
|
'$action'(<,_,_,_,_,_) :- !, % <'Depth
|
||||||
'$new_deb_depth',
|
'$new_deb_depth',
|
||||||
skip(10),
|
skip( debugger_input, 10),
|
||||||
fail.
|
fail.
|
||||||
'$action'('C',_,_,_,_,_) :-
|
'$action'('C',_,_,_,_,_) :-
|
||||||
yap_flag(system_options, Opts),
|
yap_flag(system_options, Opts),
|
||||||
lists:memberchk( call_tracer, Opts),
|
lists:memberchk( call_tracer, Opts),
|
||||||
!, % <'Depth
|
!, % <'Depth
|
||||||
skip(10),
|
skip( debugger_input, 10),
|
||||||
'__NB_setval__'('$debug_status', state(creep, 0, stop)).
|
'__NB_setval__'('$debug_status', state(creep, 0, stop)).
|
||||||
'$action'(^,_,_,G,_,_) :- !, % '
|
'$action'(^,_,_,G,_,_) :- !, % '
|
||||||
'$print_deb_sterm'(G),
|
'$print_deb_sterm'(G),
|
||||||
skip(10),
|
skip( debugger_input, 10),
|
||||||
fail.
|
fail.
|
||||||
'$action'(a,_,_,_,_,_) :- !, % 'a abort
|
'$action'(a,_,_,_,_,_) :- !, % 'a abort
|
||||||
skip(10),
|
skip( debugger_input, 10),
|
||||||
'$stop_creeping'(_),
|
'$stop_creeping'(_),
|
||||||
nodebug,
|
nodebug,
|
||||||
abort.
|
abort.
|
||||||
'$action'(b,_,_,_,_,_) :- !, % 'b break
|
'$action'(b,_,_,_,_,_) :- !, % 'b break
|
||||||
'$stop_creeping'(_),
|
'$stop_creeping'(_),
|
||||||
skip(10),
|
skip( debugger_input, 10),
|
||||||
break,
|
break,
|
||||||
fail.
|
fail.
|
||||||
'$action'('A',_,_,_,_,_) :- !, % 'b break
|
'$action'('A',_,_,_,_,_) :- !, % 'b break
|
||||||
skip(10),
|
skip( debugger_input, 10),
|
||||||
'$stack_dump',
|
'$stack_dump',
|
||||||
fail.
|
fail.
|
||||||
'$action'(c,_,_,_,_,_) :- !, % 'c creep
|
'$action'(c,_,_,_,_,_) :- !, % 'c creep
|
||||||
skip(10),
|
skip( debugger_input, 10),
|
||||||
'__NB_setval__'('$debug_status',status(creep,0,stop)).
|
'__NB_setval__'('$debug_status',status(creep,0,stop)).
|
||||||
'$action'(e,_,_,_,_,_) :- !, % 'e exit
|
'$action'(e,_,_,_,_,_) :- !, % 'e exit
|
||||||
halt.
|
halt.
|
||||||
@ -784,11 +783,11 @@ be lost.
|
|||||||
throw(forward(fail,GoalId)).
|
throw(forward(fail,GoalId)).
|
||||||
'$action'(h,_,_,_,_,_) :- !, % 'h help
|
'$action'(h,_,_,_,_,_) :- !, % 'h help
|
||||||
'$action_help',
|
'$action_help',
|
||||||
skip(10),
|
skip( debugger_input, 10),
|
||||||
fail.
|
fail.
|
||||||
'$action'(?,_,_,_,_,_) :- !, % '? help
|
'$action'(?,_,_,_,_,_) :- !, % '? help
|
||||||
'$action_help',
|
'$action_help',
|
||||||
skip(10),
|
skip( debugger_input, 10),
|
||||||
fail.
|
fail.
|
||||||
'$action'(p,_,_,G,Module,_) :- !, % 'p print
|
'$action'(p,_,_,G,Module,_) :- !, % 'p print
|
||||||
((Module = prolog ; Module = user) ->
|
((Module = prolog ; Module = user) ->
|
||||||
@ -796,7 +795,7 @@ be lost.
|
|||||||
;
|
;
|
||||||
print(user_error,Module:G), nl(user_error)
|
print(user_error,Module:G), nl(user_error)
|
||||||
),
|
),
|
||||||
skip(10),
|
skip( debugger_input, 10),
|
||||||
fail.
|
fail.
|
||||||
'$action'(d,_,_,G,Module,_) :- !, % 'd display
|
'$action'(d,_,_,G,Module,_) :- !, % 'd display
|
||||||
((Module = prolog ; Module = user) ->
|
((Module = prolog ; Module = user) ->
|
||||||
@ -804,23 +803,23 @@ be lost.
|
|||||||
;
|
;
|
||||||
display(user_error,Module:G), nl(user_error)
|
display(user_error,Module:G), nl(user_error)
|
||||||
),
|
),
|
||||||
skip(10),
|
skip( debugger_input, 10),
|
||||||
fail.
|
fail.
|
||||||
'$action'(l,_,_CallNumber,_,_,_) :- !, % 'l leap
|
'$action'(l,_,_CallNumber,_,_,_) :- !, % 'l leap
|
||||||
skip(10),
|
skip( debugger_input, 10),
|
||||||
'__NB_setval__'('$debug_status', state(leap, 0, stop)).
|
'__NB_setval__'('$debug_status', state(leap, 0, stop)).
|
||||||
'$action'(z,_,_CallNumber,_,_,_H) :- !, % 'z zip, fast leap
|
'$action'(z,_,_CallNumber,_,_,_H) :- !, % 'z zip, fast leap
|
||||||
skip(10), % 'z
|
skip( debugger_input, 10), % 'z
|
||||||
'__NB_setval__'('$debug_status', state(zip, 0, stop)).
|
'__NB_setval__'('$debug_status', state(zip, 0, stop)).
|
||||||
% skip first call (for current goal),
|
% skip first call (for current goal),
|
||||||
% stop next time.
|
% stop next time.
|
||||||
'$action'(k,_,CallNumber,_,_,_) :- !, % 'k zip, fast leap
|
'$action'(k,_,CallNumber,_,_,_) :- !, % 'k zip, fast leap
|
||||||
skip(10), % '
|
skip( debugger_input, 10), % '
|
||||||
'__NB_setval__'('$debug_status', state(zip, CallNumber, ignore)).
|
'__NB_setval__'('$debug_status', state(zip, CallNumber, ignore)).
|
||||||
% skip first call (for current goal),
|
% skip first call (for current goal),
|
||||||
% stop next time.
|
% stop next time.
|
||||||
'$action'(n,_,_,_,_,_) :- !, % 'n nodebug
|
'$action'(n,_,_,_,_,_) :- !, % 'n nodebug
|
||||||
skip(10), % '
|
skip( debugger_input, 10), % '
|
||||||
% tell debugger never to stop.
|
% tell debugger never to stop.
|
||||||
'__NB_setval__'('$debug_status', state(zip, 0, ignore)),
|
'__NB_setval__'('$debug_status', state(zip, 0, ignore)),
|
||||||
nodebug.
|
nodebug.
|
||||||
@ -829,30 +828,30 @@ be lost.
|
|||||||
% set_prolog_flag(debug, true),
|
% set_prolog_flag(debug, true),
|
||||||
throw(forward(redo,ScanNumber)).
|
throw(forward(redo,ScanNumber)).
|
||||||
'$action'(s,P,CallNumber,_,_,_) :- !, % 's skip
|
'$action'(s,P,CallNumber,_,_,_) :- !, % 's skip
|
||||||
skip(10), % '
|
skip( debugger_input, 10), % '
|
||||||
( (P=call; P=redo) ->
|
( (P=call; P=redo) ->
|
||||||
'__NB_setval__'('$debug_status', state(leap, CallNumber, ignore) ) ;
|
'__NB_setval__'('$debug_status', state(leap, CallNumber, ignore) ) ;
|
||||||
'$ilgl'(s) % '
|
'$ilgl'(s) % '
|
||||||
).
|
).
|
||||||
'$action'(t,P,CallNumber,_,_,_) :- !, % 't fast skip
|
'$action'(t,P,CallNumber,_,_,_) :- !, % 't fast skip
|
||||||
skip(10), % '
|
skip( debugger_input, 10), % '
|
||||||
( (P=call; P=redo) ->
|
( (P=call; P=redo) ->
|
||||||
'__NB_setval__'('$debug_status', state(zip, CallNumber, ignore)) ;
|
'__NB_setval__'('$debug_status', state(zip, CallNumber, ignore)) ;
|
||||||
'$ilgl'(t) % '
|
'$ilgl'(t) % '
|
||||||
).
|
).
|
||||||
'$action'(q,P,CallNumber,_,_,_) :- !, % 'qst skip
|
'$action'(q,P,CallNumber,_,_,_) :- !, % 'qst skip
|
||||||
skip(10), % '
|
skip( debugger_input, 10), % '
|
||||||
( (P=call; P=redo) ->
|
( (P=call; P=redo) ->
|
||||||
'__NB_setval__'('$debug_status', state(leap, CallNumber, stop)) ;
|
'__NB_setval__'('$debug_status', state(leap, CallNumber, stop)) ;
|
||||||
'$ilgl'(t) % '
|
'$ilgl'(t) % '
|
||||||
).
|
).
|
||||||
'$action'(+,_,_,G,M,_) :- !, % '+ spy this
|
'$action'(+,_,_,G,M,_) :- !, % '+ spy this
|
||||||
functor(G,F,N), spy(M:(F/N)),
|
functor(G,F,N), spy(M:(F/N)),
|
||||||
skip(10), % '
|
skip( debugger_input, 10), % '
|
||||||
fail.
|
fail.
|
||||||
'$action'(-,_,_,G,M,_) :- !, % '- nospy this
|
'$action'(-,_,_,G,M,_) :- !, % '- nospy this
|
||||||
functor(G,F,N), nospy(M:(F/N)),
|
functor(G,F,N), nospy(M:(F/N)),
|
||||||
skip(10), % '
|
skip( debugger_input, 10), % '
|
||||||
fail.
|
fail.
|
||||||
'$action'(g,_,_,_,_,_) :- !, % 'g ancestors
|
'$action'(g,_,_,_,_,_) :- !, % 'g ancestors
|
||||||
'$scan_number'(HowMany), % '
|
'$scan_number'(HowMany), % '
|
||||||
@ -861,7 +860,7 @@ be lost.
|
|||||||
'$action'('T',exception(G),_,_,_,_) :- !, % 'T throw
|
'$action'('T',exception(G),_,_,_,_) :- !, % 'T throw
|
||||||
throw( forward('$wrapper',G)).
|
throw( forward('$wrapper',G)).
|
||||||
'$action'(C,_,_,_,_,_) :-
|
'$action'(C,_,_,_,_,_) :-
|
||||||
skip(10),
|
skip( debugger_input, 10),
|
||||||
'$ilgl'(C),
|
'$ilgl'(C),
|
||||||
fail.
|
fail.
|
||||||
|
|
||||||
@ -931,7 +930,7 @@ be lost.
|
|||||||
'$deb_get_sterm_in_g'(L,G,A),
|
'$deb_get_sterm_in_g'(L,G,A),
|
||||||
recorda('$debug_sub_skel',L,_),
|
recorda('$debug_sub_skel',L,_),
|
||||||
format(user_error,'~n~w~n~n',[A]).
|
format(user_error,'~n~w~n~n',[A]).
|
||||||
'$print_deb_sterm'(_) :- skip(10).
|
'$print_deb_sterm'(_) :- skip( debugger_input, 10).
|
||||||
|
|
||||||
'$get_sterm_list'(L) :-
|
'$get_sterm_list'(L) :-
|
||||||
get_code( debugger_input_input,C),
|
get_code( debugger_input_input,C),
|
||||||
@ -972,7 +971,7 @@ be lost.
|
|||||||
get_code( debugger_input,NC),
|
get_code( debugger_input,NC),
|
||||||
'$get_deb_depth_char_by_char'(NC,XI,XF).
|
'$get_deb_depth_char_by_char'(NC,XI,XF).
|
||||||
% reset when given garbage.
|
% reset when given garbage.
|
||||||
'$get_deb_depth_char_by_char'(_C,_,10) :- skip(10).
|
'$get_deb_depth_char_by_char'(_C,_,10) :- skip( debugger_input, 10).
|
||||||
|
|
||||||
'$set_deb_depth'(D) :-
|
'$set_deb_depth'(D) :-
|
||||||
yap_flag(debugger_print_options,L),
|
yap_flag(debugger_print_options,L),
|
||||||
|
Reference in New Issue
Block a user