fix skip/1 and debugging stuff

formatting
This commit is contained in:
Vitor Santos Costa 2017-11-18 00:18:42 +00:00
parent 746a4b4ef8
commit bf78d70d66
10 changed files with 1694 additions and 1668 deletions

View File

@ -138,7 +138,7 @@ static inline Atom SearchAtom(const unsigned char *p, Atom a) {
/* search atom in chain */
while (a != NIL) {
ae = RepAtom(a);
if (strcmp((char *)ae->StrOfAE, (const char *)p) == 0) {
if (strcmp(ae->UStrOfAE, p) == 0) {
return (a);
}
a = ae->NextOfAE;

View File

@ -201,7 +201,7 @@ static Int LoadForeign(StringList ofiles, StringList libs, char *proc_name,
if (LOCAL_ErrorMessage == NULL) {
LOCAL_ErrorMessage = malloc(MAX_ERROR_MSG_SIZE);
strcpy(LOCAL_ErrorMessage,
"%% Trying to open unexisting file in LoadForeign");
"%% Trying to open non-existing file in LoadForeign");
}
}
#ifdef __osf__

278
C/stack.c
View File

@ -34,24 +34,37 @@
#include "iopreds.h"
#include "tracer.h"
#include "yapio.h"
#ifdef YAPOR
#include "or.macros.h"
#endif /* YAPOR */
#ifdef TABLING
#include "tab.macros.h"
#endif /* TABLING */
#if HAVE_STRING_H
#include <string.h>
#endif
#include <heapgc.h>
#if !defined(YAPOR) && !defined(THREADS)
static void mark_pred(int, PredEntry *);
static void do_toggle_static_predicates_in_use(int);
#endif
static Int in_use(USES_REGS1);
static Int PredForCode(yamop *, Atom *, arity_t *, Term *, PredEntry **);
static LogUpdIndex *find_owner_log_index(LogUpdIndex *, yamop *);
static StaticIndex *find_owner_static_index(StaticIndex *, yamop *);
#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) {
Term t0 = t;
restart:
restart:
if (IsVarTerm(t)) {
Yap_Error(INSTANTIATION_ERROR, t0, pname);
return NULL;
@ -204,6 +217,7 @@ PredEntry *Yap_PredForChoicePt(choiceptr cp, op_numbers *op) {
}
#if !defined(YAPOR) && !defined(THREADS)
static yamop *cur_clause(PredEntry *pe, yamop *codeptr) {
StaticClause *cl;
@ -226,7 +240,7 @@ static yamop *cur_log_upd_clause(PredEntry *pe, yamop *codeptr) {
cl = ClauseCodeToLogUpdClause(pe->cs.p_code.FirstClause);
do {
if (IN_BLOCK(codeptr, cl->ClCode, cl->ClSize)) {
return ((yamop *)cl->ClCode);
return ((yamop *) cl->ClCode);
}
cl = cl->ClNext;
} 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,
only for retracts
*/
while (env_ptr && b_ptr > (choiceptr)env_ptr) {
yamop *cp = (yamop *)env_ptr[E_CP];
while (env_ptr && b_ptr > (choiceptr) env_ptr) {
yamop *cp = (yamop *) env_ptr[E_CP];
PredEntry *pe;
pe = EnvPreg(cp);
if (p == pe)
return true;
if (env_ptr != NULL)
env_ptr = (CELL *)(env_ptr[E_E]);
env_ptr = (CELL *) (env_ptr[E_E]);
}
}
/* now mark the choicepoint */
@ -335,11 +349,11 @@ static void do_toggle_static_predicates_in_use(int mask) {
PredEntry *pe;
/* check first environments that are younger than our latest choicepoint */
while (b_ptr > (choiceptr)env_ptr) {
PredEntry *pe = EnvPreg((yamop *)env_ptr[E_CP]);
while (b_ptr > (choiceptr) env_ptr) {
PredEntry *pe = EnvPreg((yamop *) env_ptr[E_CP]);
mark_pred(mask, pe);
env_ptr = (CELL *)(env_ptr[E_E]);
env_ptr = (CELL *) (env_ptr[E_E]);
}
/* now mark the choicepoint */
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) {
if (pp->ModuleOfPred == IDB_MODULE) {
if (pp->PredFlags & NumberDBPredFlag) {
if (parity)
*parity = 0;
if (pat)
*pat = AtomInteger;
} else if (pp->PredFlags & AtomDBPredFlag) {
if (parity)
*parity = 0;
*pat = (Atom)pp->FunctorOfPred;
if (pat)
*pat = (Atom) pp->FunctorOfPred;
} else {
if (pat)
*pat = NameOfFunctor(pp->FunctorOfPred);
if (parity)
*parity = ArityOfFunctor(pp->FunctorOfPred);
}
} else {
@ -397,7 +417,7 @@ static void clause_was_found(PredEntry *pp, Atom *pat, UInt *parity) {
if (pp->ArityOfPE) {
*pat = NameOfFunctor(pp->FunctorOfPred);
} 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;
if (IN_BLOCK(codeptr, icl, icl->ClSize)) {
if (startp)
*startp = (CODEADDR)icl;
*startp = (CODEADDR) icl;
if (endp)
*endp = (CODEADDR)icl + icl->ClSize;
*endp = (CODEADDR) icl + icl->ClSize;
return TRUE;
}
cicl = icl->ChildIndex;
@ -431,9 +451,9 @@ static int code_in_pred_s_index(StaticIndex *icl, yamop *codeptr, void **startp,
StaticIndex *cicl;
if (IN_BLOCK(codeptr, icl, icl->ClSize)) {
if (startp)
*startp = (CODEADDR)icl;
*startp = (CODEADDR) icl;
if (endp)
*endp = (CODEADDR)icl + icl->ClSize;
*endp = (CODEADDR) icl + icl->ClSize;
return TRUE;
}
cicl = icl->ChildIndex;
@ -455,11 +475,11 @@ static Int find_code_in_clause(PredEntry *pp, yamop *codeptr, void **startp,
if (pp->PredFlags & LogUpdatePredFlag) {
LogUpdClause *cl = ClauseCodeToLogUpdClause(clcode);
do {
if (IN_BLOCK(codeptr, (CODEADDR)cl, cl->ClSize)) {
if (IN_BLOCK(codeptr, (CODEADDR) cl, cl->ClSize)) {
if (startp)
*startp = (CODEADDR)cl;
*startp = (CODEADDR) cl;
if (endp)
*endp = (CODEADDR)cl + cl->ClSize;
*endp = (CODEADDR) cl + cl->ClSize;
return i;
}
i++;
@ -472,9 +492,9 @@ static Int find_code_in_clause(PredEntry *pp, yamop *codeptr, void **startp,
cl = ClauseCodeToDynamicClause(clcode);
if (IN_BLOCK(codeptr, cl, cl->ClSize)) {
if (startp)
*startp = (CODEADDR)cl;
*startp = (CODEADDR) cl;
if (endp)
*endp = (CODEADDR)cl + cl->ClSize;
*endp = (CODEADDR) cl + cl->ClSize;
return i;
}
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);
if (IN_BLOCK(codeptr, cl, cl->ClSize)) {
if (startp)
*startp = (CODEADDR)cl;
*startp = (CODEADDR) cl;
if (endp)
*endp = (CODEADDR)cl + cl->ClSize;
return 1 + ((char *)codeptr - (char *)cl->ClCode) / cl->ClItemSize;
*endp = (CODEADDR) cl + cl->ClSize;
return 1 + ((char *) codeptr - (char *) cl->ClCode) / cl->ClItemSize;
}
} else {
StaticClause *cl;
@ -502,9 +522,9 @@ static Int find_code_in_clause(PredEntry *pp, yamop *codeptr, void **startp,
return 0;
if (IN_BLOCK(codeptr, cl, cl->ClSize)) {
if (startp)
*startp = (CODEADDR)cl;
*startp = (CODEADDR) cl;
if (endp)
*endp = (CODEADDR)cl + cl->ClSize;
*endp = (CODEADDR) cl + cl->ClSize;
return i;
}
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)) {
StaticClause *cl = ClauseCodeToStaticClause(pp->CodeOfPred);
if (IN_BLOCK(codeptr, (CODEADDR)cl, cl->ClSize)) {
if (IN_BLOCK(codeptr, (CODEADDR) cl, cl->ClSize)) {
if (startp)
*startp = (CODEADDR)cl;
*startp = (CODEADDR) cl;
if (endp)
*endp = (CODEADDR)cl + cl->ClSize;
*endp = (CODEADDR) cl + cl->ClSize;
UNLOCK(pp->PELock);
return TRUE;
} 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,
void **endp) {
PredEntry *pp = cl->ClPred;
*startp = (CODEADDR)cl;
*endp = (CODEADDR)cl + cl->ClSize;
*startp = (CODEADDR) cl;
*endp = (CODEADDR) cl + cl->ClSize;
return pp;
}
/* intruction blocks we found ourselves at */
static PredEntry *walk_got_lu_clause(LogUpdClause *cl, void **startp,
void **endp) {
*startp = (CODEADDR)cl;
*endp = (CODEADDR)cl + cl->ClSize;
*startp = (CODEADDR) cl;
*endp = (CODEADDR) cl + cl->ClSize;
return cl->ClPred;
}
/* we hit a meta-call, so we don't know what is happening */
static PredEntry *found_meta_call(void **startp, void **endp) {
PredEntry *pp = PredMetaCall;
*startp = (CODEADDR) & (pp->OpcodeOfPred);
*endp = (CODEADDR)NEXTOP((yamop *)&(pp->OpcodeOfPred), e);
*startp = (CODEADDR) &(pp->OpcodeOfPred);
*endp = (CODEADDR) NEXTOP((yamop *) &(pp->OpcodeOfPred), e);
return pp;
}
/* intruction blocks we found ourselves at */
static PredEntry *walk_found_c_pred(PredEntry *pp, void **startp, void **endp) {
StaticClause *cl = ClauseCodeToStaticClause(pp->CodeOfPred);
*startp = (CODEADDR) & (cl->ClCode);
*endp = (CODEADDR) & (cl->ClCode) + cl->ClSize;
*startp = (CODEADDR) &(cl->ClCode);
*endp = (CODEADDR) &(cl->ClCode) + cl->ClSize;
return pp;
}
/* we hit a mega-clause, no point in going on */
static PredEntry *found_mega_clause(PredEntry *pp, void **startp, void **endp) {
MegaClause *mcl = ClauseCodeToMegaClause(pp->cs.p_code.FirstClause);
*startp = (CODEADDR)mcl;
*endp = (CODEADDR)mcl + mcl->ClSize;
*startp = (CODEADDR) mcl;
*endp = (CODEADDR) mcl + mcl->ClSize;
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) {
LogUpdClause *cl = ClauseCodeToLogUpdClause(pc);
*startp = (CODEADDR)cl;
*endp = (CODEADDR)cl + cl->ClSize;
*startp = (CODEADDR) cl;
*endp = (CODEADDR) cl + cl->ClSize;
return cl->ClPred;
}
@ -739,8 +759,8 @@ static PredEntry *found_expand_index(yamop *pc, void **startp, void **endp,
yamop *codeptr USES_REGS) {
PredEntry *pp = codeptr->y_u.sssllp.p;
if (pc == codeptr) {
*startp = (CODEADDR)codeptr;
*endp = (CODEADDR)NEXTOP(codeptr, sssllp);
*startp = (CODEADDR) codeptr;
*endp = (CODEADDR) NEXTOP(codeptr, sssllp);
}
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 */
static PredEntry *found_fail(yamop *pc, void **startp, void **endp USES_REGS) {
PredEntry *pp = RepPredProp(Yap_GetPredPropByAtom(AtomFail, CurrentModule));
*startp = *endp = (CODEADDR)FAILCODE;
*startp = *endp = (CODEADDR) FAILCODE;
return pp;
}
/* we hit a expand_index, no point in going on */
static PredEntry *found_owner_op(yamop *pc, void **startp,
void **endp USES_REGS) {
PredEntry *pp = ((PredEntry *)(Unsigned(pc) -
(CELL)(&(((PredEntry *)NULL)->OpcodeOfPred))));
*startp = (CODEADDR) & (pp->OpcodeOfPred);
*endp = (CODEADDR)NEXTOP((yamop *)&(pp->OpcodeOfPred), e);
PredEntry *pp = ((PredEntry *) (Unsigned(pc) -
(CELL) (&(((PredEntry *) NULL)->OpcodeOfPred))));
*startp = (CODEADDR) &(pp->OpcodeOfPred);
*endp = (CODEADDR) NEXTOP((yamop *) &(pp->OpcodeOfPred), e);
return pp;
}
@ -766,10 +786,10 @@ static PredEntry *found_owner_op(yamop *pc, void **startp,
static PredEntry *found_expand(yamop *pc, void **startp,
void **endp USES_REGS) {
PredEntry *pp =
((PredEntry *)(Unsigned(pc) -
(CELL)(&(((PredEntry *)NULL)->cs.p_code.ExpandCode))));
*startp = (CODEADDR) & (pp->cs.p_code.ExpandCode);
*endp = (CODEADDR)NEXTOP((yamop *)&(pp->cs.p_code.ExpandCode), e);
((PredEntry *) (Unsigned(pc) -
(CELL) (&(((PredEntry *) NULL)->cs.p_code.ExpandCode))));
*startp = (CODEADDR) &(pp->cs.p_code.ExpandCode);
*endp = (CODEADDR) NEXTOP((yamop *) &(pp->cs.p_code.ExpandCode), e);
return pp;
}
@ -778,9 +798,9 @@ static PredEntry *found_ystop(yamop *pc, int clause_code, void **startp,
if (pc == YESCODE) {
pp = RepPredProp(Yap_GetPredPropByAtom(AtomTrue, CurrentModule));
if (startp)
*startp = (CODEADDR)YESCODE;
*startp = (CODEADDR) YESCODE;
if (endp)
*endp = (CODEADDR)YESCODE + (CELL)(NEXTOP((yamop *)NULL, e));
*endp = (CODEADDR) YESCODE + (CELL) (NEXTOP((yamop *) NULL, e));
return pp;
}
if (!pp) {
@ -789,33 +809,33 @@ static PredEntry *found_ystop(yamop *pc, int clause_code, void **startp,
pp = o->y_u.Osbpp.p0;
} else {
/* must be an index */
PredEntry **pep = (PredEntry **)pc->y_u.l.l;
PredEntry **pep = (PredEntry **) pc->y_u.l.l;
pp = pep[-1];
}
}
if (pp->PredFlags & LogUpdatePredFlag) {
if (clause_code) {
LogUpdClause *cl = ClauseCodeToLogUpdClause(pc->y_u.l.l);
*startp = (CODEADDR)cl;
*endp = (CODEADDR)cl + cl->ClSize;
*startp = (CODEADDR) cl;
*endp = (CODEADDR) cl + cl->ClSize;
} else {
LogUpdIndex *cl = ClauseCodeToLogUpdIndex(pc->y_u.l.l);
*startp = (CODEADDR)cl;
*endp = (CODEADDR)cl + cl->ClSize;
*startp = (CODEADDR) cl;
*endp = (CODEADDR) cl + cl->ClSize;
}
} else if (pp->PredFlags & DynamicPredFlag) {
DynamicClause *cl = ClauseCodeToDynamicClause(pc->y_u.l.l);
*startp = (CODEADDR)cl;
*endp = (CODEADDR)cl + cl->ClSize;
*startp = (CODEADDR) cl;
*endp = (CODEADDR) cl + cl->ClSize;
} else {
if (clause_code) {
StaticClause *cl = ClauseCodeToStaticClause(pc->y_u.l.l);
*startp = (CODEADDR)cl;
*endp = (CODEADDR)cl + cl->ClSize;
*startp = (CODEADDR) cl;
*endp = (CODEADDR) cl + cl->ClSize;
} else {
StaticIndex *cl = ClauseCodeToStaticIndex(pc->y_u.l.l);
*startp = (CODEADDR)cl;
*endp = (CODEADDR)cl + cl->ClSize;
*startp = (CODEADDR) cl;
*endp = (CODEADDR) cl + cl->ClSize;
}
}
return pp;
@ -829,12 +849,14 @@ static PredEntry *ClauseInfoForCode(yamop *codeptr, void **startp,
if (codeptr >= COMMA_CODE && codeptr < FAILCODE) {
pp = RepPredProp(Yap_GetPredPropByFunc(FunctorComma, CurrentModule));
*startp = (CODEADDR)COMMA_CODE;
*endp = (CODEADDR)(FAILCODE - 1);
*startp = (CODEADDR) COMMA_CODE;
*endp = (CODEADDR) (FAILCODE - 1);
return pp;
}
pc = codeptr;
#include "walkclause.h"
return NULL;
}
@ -891,9 +913,9 @@ static Int pred_for_code(USES_REGS1) {
} else if (IsApplTerm(t) && FunctorOfTerm(t) == FunctorStaticClause) {
codeptr = Yap_ClauseFromTerm(t)->ClCode;
} else if (IsIntegerTerm(t)) {
codeptr = (yamop *)IntegerOfTerm(t);
codeptr = (yamop *) IntegerOfTerm(t);
} else if (IsDBRefTerm(t)) {
codeptr = (yamop *)DBRefOfTerm(t);
codeptr = (yamop *) DBRefOfTerm(t);
} else {
return FALSE;
}
@ -911,7 +933,7 @@ static Int pred_for_code(USES_REGS1) {
static LogUpdIndex *find_owner_log_index(LogUpdIndex *cl, yamop *code_p) {
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) {
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) {
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) {
return cl;
@ -949,10 +971,10 @@ ClauseUnion *Yap_find_owner_index(yamop *ipc, PredEntry *ap) {
/* we assume we have an owner index */
if (ap->PredFlags & LogUpdatePredFlag) {
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 {
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;
while (env_ptr) {
LOCAL_Error_Size += 2;
env_ptr = (CELL *)(env_ptr[E_E]);
env_ptr = (CELL *) (env_ptr[E_E]);
}
return 0L;
} else {
bp[1] = AbsPair(HR);
}
env_ptr = (CELL *)(env_ptr[E_E]);
env_ptr = (CELL *) (env_ptr[E_E]);
}
bp[1] = TermNil;
return tf;
@ -993,7 +1015,7 @@ static Term all_cps(choiceptr b_ptr USES_REGS) {
bp = HR;
HR += 2;
/* 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) {
HR = start;
LOCAL_Error_Size = (ASP - 1024) - HR;
@ -1006,7 +1028,7 @@ static Term all_cps(choiceptr b_ptr USES_REGS) {
bp[1] = AbsPair(HR);
}
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
// corrupted at %p!!!\n", b_ptr);
break;
@ -1044,7 +1066,7 @@ static Term clause_info(yamop *codeptr, PredEntry *pp) {
void *begin;
if (pp->ArityOfPE == 0) {
ts[0] = MkAtomTerm((Atom)pp->FunctorOfPred);
ts[0] = MkAtomTerm((Atom) pp->FunctorOfPred);
ts[1] = MkIntTerm(0);
} else {
ts[0] = MkAtomTerm(NameOfFunctor(pp->FunctorOfPred));
@ -1069,7 +1091,7 @@ bool set_clause_info(yamop *codeptr, PredEntry *pp) {
Term ts[2];
void *begin;
if (pp->ArityOfPE == 0) {
LOCAL_ActiveError->prologPredName = (Atom)pp->FunctorOfPred;
LOCAL_ActiveError->prologPredName = (Atom) pp->FunctorOfPred;
LOCAL_ActiveError->prologPredArity = 0;
} else {
LOCAL_ActiveError->prologPredName = NameOfFunctor(pp->FunctorOfPred);
@ -1128,8 +1150,8 @@ static Term error_culprit(bool internal USES_REGS) {
while (curCP != YESCODE) {
if (pe->ModuleOfPred)
return clause_info(curCP, pe);
curENV = (CELL *)(curENV[E_E]);
curCP = (yamop *)(curENV[E_CP]);
curENV = (CELL *) (curENV[E_E]);
curCP = (yamop *) (curENV[E_CP]);
pe = EnvPreg(curCP);
}
}
@ -1149,7 +1171,7 @@ bool Yap_find_prolog_culprit(USES_REGS1) {
PredEntry *pe = EnvPreg(curCP);
while (curCP != YESCODE) {
curENV = (CELL *)(curENV[E_E]);
curENV = (CELL *) (curENV[E_E]);
if (curENV < ASP || curENV >= LCL0) {
break;
}
@ -1159,7 +1181,7 @@ bool Yap_find_prolog_culprit(USES_REGS1) {
}
if (pe->ModuleOfPred)
return set_clause_info(curCP, pe);
curCP = (yamop *)(curENV[E_CP]);
curCP = (yamop *) (curENV[E_CP]);
}
}
return TermNil;
@ -1213,7 +1235,7 @@ static Int current_stack(USES_REGS1) {
#if LOW_PROF
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);
cl = cl->ChildIndex;
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) {
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);
cl = cl->ChildIndex;
while (cl != NULL) {
@ -1247,7 +1269,7 @@ static void add_code_in_pred(PredEntry *pp) {
clcode = pp->CodeOfPred;
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);
UNLOCK(pp->PELock);
return;
@ -1272,7 +1294,7 @@ static void add_code_in_pred(PredEntry *pp) {
do {
char *code_end;
code_end = (char *)cl + cl->ClSize;
code_end = (char *) cl + cl->ClSize;
Yap_inform_profiler_of_clause(cl, code_end, pp,
GPROF_INIT_LOG_UPD_CLAUSE);
cl = cl->ClNext;
@ -1283,7 +1305,7 @@ static void add_code_in_pred(PredEntry *pp) {
CODEADDR code_end;
cl = ClauseCodeToDynamicClause(clcode);
code_end = (CODEADDR)cl + cl->ClSize;
code_end = (CODEADDR) cl + cl->ClSize;
Yap_inform_profiler_of_clause(cl, code_end, pp,
GPROF_INIT_DYNAMIC_CLAUSE);
if (clcode == pp->cs.p_code.LastClause)
@ -1295,7 +1317,7 @@ static void add_code_in_pred(PredEntry *pp) {
do {
char *code_end;
code_end = (char *)cl + cl->ClSize;
code_end = (char *) cl + cl->ClSize;
Yap_inform_profiler_of_clause(cl, code_end, pp,
GPROF_INIT_STATIC_CLAUSE);
if (cl->ClCode == pp->cs.p_code.LastClause)
@ -1340,7 +1362,7 @@ void Yap_dump_code_area_for_profiler(void) {
#endif /* LOW_PROF */
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 (!Yap_unify(ARG1, pe->ModuleOfPred))
return FALSE;
@ -1354,7 +1376,7 @@ static Int program_continuation(USES_REGS1) {
if (!Yap_unify(ARG3, MkIntegerTerm(ArityOfFunctor(pe->FunctorOfPred))))
return FALSE;
} else {
if (!Yap_unify(ARG2, MkAtomTerm((Atom)pe->FunctorOfPred)))
if (!Yap_unify(ARG2, MkAtomTerm((Atom) pe->FunctorOfPred)))
return FALSE;
if (!Yap_unify(ARG3, MkIntTerm(0)))
return FALSE;
@ -1394,7 +1416,7 @@ static int UnifyPredInfo(PredEntry *pe, int start_arg USES_REGS) {
tmod = pe->ModuleOfPred;
}
if (pe->ArityOfPE == 0) {
tname = MkAtomTerm((Atom)pe->FunctorOfPred);
tname = MkAtomTerm((Atom) pe->FunctorOfPred);
} else {
Functor f = pe->FunctorOfPred;
tname = MkAtomTerm(NameOfFunctor(f));
@ -1404,7 +1426,7 @@ static int UnifyPredInfo(PredEntry *pe, int start_arg USES_REGS) {
if (pe->PredFlags & NumberDBPredFlag) {
tname = MkIntegerTerm(pe->src.IndxId);
} else if (pe->PredFlags & AtomDBPredFlag) {
tname = MkAtomTerm((Atom)pe->FunctorOfPred);
tname = MkAtomTerm((Atom) pe->FunctorOfPred);
} else {
Functor f = pe->FunctorOfPred;
tname = MkAtomTerm(NameOfFunctor(f));
@ -1429,18 +1451,18 @@ static Int env_info(USES_REGS1) {
if (!env)
return FALSE;
env_b = MkIntegerTerm((Int)(LCL0 - (CELL *)env[E_CB]));
env_cp = (yamop *)env[E_CP];
env_b = MkIntegerTerm((Int) (LCL0 - (CELL *) env[E_CB]));
env_cp = (yamop *) env[E_CP];
/* pe = PREVOP(env_cp,Osbpp)->y_u.Osbpp.p0; */
taddr = MkIntegerTerm((Int)env);
return Yap_unify(ARG3, MkIntegerTerm((Int)env_cp)) &&
taddr = MkIntegerTerm((Int) env);
return Yap_unify(ARG3, MkIntegerTerm((Int) env_cp)) &&
Yap_unify(ARG2, taddr) && Yap_unify(ARG4, env_b);
}
static Int p_cpc_info(USES_REGS1) {
PredEntry *pe;
yamop *ipc = (yamop *)IntegerOfTerm(Deref(ARG1));
yamop *ipc = (yamop *) IntegerOfTerm(Deref(ARG1));
pe = PREVOP(ipc, Osbpp)->y_u.Osbpp.p0;
return UnifyPredInfo(pe, 2 PASS_REGS) &&
@ -1448,14 +1470,14 @@ static Int p_cpc_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;
int go_on = TRUE;
yamop *ipc = cptr->cp_ap;
yamop *ncl = NULL;
Term t = TermNil, taddr;
taddr = MkIntegerTerm((Int)cptr);
taddr = MkIntegerTerm((Int) cptr);
while (go_on) {
op_numbers opnum = Yap_op_from_opcode(ipc->opc);
go_on = FALSE;
@ -1487,7 +1509,7 @@ static Int p_choicepoint_info(USES_REGS1) {
#endif /* DETERMINISTIC_TABLING */
{
pe = GEN_CP(cptr)->cp_pred_entry;
t = BuildActivePred(pe, (CELL *)(GEN_CP(B) + 1));
t = BuildActivePred(pe, (CELL *) (GEN_CP(B) + 1));
}
#else
pe = UndefCode;
@ -1617,7 +1639,8 @@ static Int p_choicepoint_info(USES_REGS1) {
Atom at = AtomLive;
t = MkAtomTerm(at);
pe = RepPredProp(PredPropByAtom(at, CurrentModule));
} break;
}
break;
case _Ystop:
default:
return FALSE;
@ -1645,8 +1668,11 @@ parent_pred(USES_REGS1) {
}
void Yap_dump_stack(void);
void DumpActiveGoals(CACHE_TYPE1);
static int hidden(Atom);
static int legal_env(CELL *CACHE_TYPE);
#define ONLOCAL(ptr) \
@ -1673,8 +1699,8 @@ static int legal_env(CELL *ep USES_REGS) {
cp = ep[E_CP];
if (!ONHEAP(cp))
return (FALSE);
ps = *((CELL *)(Addr(cp) - CellSize));
pe = (PredEntry *)(ps - sizeof(OPREG) - sizeof(Prop));
ps = *((CELL *) (Addr(cp) - CellSize));
pe = (PredEntry *) (ps - sizeof(OPREG) - sizeof(Prop));
PELOCK(70, pe);
if (!ONHEAP(pe) || Unsigned(pe) & 3 || pe->KindOfPE & 0xff00) {
UNLOCK(pe->PELock);
@ -1720,14 +1746,14 @@ void Yap_dump_stack(void) {
#if DEBUG
fprintf(stderr, "%% YAP regs: P=%p, CP=%p, ASP=%p, H=%p, TR=%p, HeapTop=%p\n",
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)
fprintf(stderr, "%% LOCAL_ErrorMessage: %s\n", LOCAL_ErrorMessage);
#endif
if (HR > ASP || HR > LCL0) {
fprintf(stderr, "%% YAP ERROR: Global Collided against Local (%p--%p)\n",
HR, ASP);
} else if (HeapTop > (ADDR)LOCAL_GlobalBase) {
} else if (HeapTop > (ADDR) LOCAL_GlobalBase) {
fprintf(stderr,
"%% YAP ERROR: Code Space Collided against Global (%p--%p)\n",
HeapTop, LOCAL_GlobalBase);
@ -1747,18 +1773,18 @@ void Yap_dump_stack(void) {
#endif
#endif
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);
fprintf(stderr, "%% Continuation: %s\n", (char *)HR);
fprintf(stderr, "%% Continuation: %s\n", (char *) HR);
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",
(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",
(unsigned long int)((ADDR)TR - LOCAL_TrailBase) / 1024,
(unsigned long int) ((ADDR) TR - LOCAL_TrailBase) / 1024,
LOCAL_TrailBase, TR);
fprintf(stderr, "%% Performed %ld garbage collections\n",
(unsigned long int)LOCAL_GcCalls);
(unsigned long int) LOCAL_GcCalls);
#if LOW_LEVEL_TRACER
{
extern long long vsc_count;
@ -1776,9 +1802,9 @@ void Yap_dump_stack(void) {
fprintf(stderr, "%% Goals With Alternatives Open (Global In "
"Use--Local In Use)\n%%\n");
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);
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;
fprintf(stderr, "%% %s\n", tp);
} else {
@ -1788,8 +1814,8 @@ void Yap_dump_stack(void) {
fprintf(stderr, "%% .....\n");
return;
}
ipc = (yamop *)(env_ptr[E_CP]);
env_ptr = (CELL *)(env_ptr[E_E]);
ipc = (yamop *) (env_ptr[E_CP]);
env_ptr = (CELL *) (env_ptr[E_E]);
}
if (b_ptr) {
if (!max_count--) {
@ -1803,8 +1829,8 @@ void Yap_dump_stack(void) {
/* we can safely ignore ; because there is always an upper env */
Yap_detect_bug_location(b_ptr->cp_ap, FIND_PRED_FROM_CP, 256);
fprintf(stderr, "%% %s (%luKB--%luKB)\n", tp,
(unsigned long int)((b_ptr->cp_h - H0) * sizeof(CELL) / 1024),
(unsigned long int)((ADDR)LCL0 - (ADDR)b_ptr) / 1024);
(unsigned long int) ((b_ptr->cp_h - H0) * sizeof(CELL) / 1024),
(unsigned long int) ((ADDR) LCL0 - (ADDR) b_ptr) / 1024);
}
b_ptr = b_ptr->cp_b;
}
@ -1830,7 +1856,7 @@ void DumpActiveGoals(USES_REGS1) {
cp = ep[E_CP];
if (!ONHEAP(cp) || (Unsigned(cp) & (sizeof(CELL) - 1)))
break;
pe = EnvPreg((yamop *)cp);
pe = EnvPreg((yamop *) cp);
if (!ONHEAP(pe) || Unsigned(pe) & (sizeof(CELL) - 1))
break;
PELOCK(71, pe);
@ -1858,7 +1884,7 @@ void DumpActiveGoals(USES_REGS1) {
UNLOCK(pe->PELock);
}
next:
ep = (CELL *)ep[E_E];
ep = (CELL *) ep[E_E];
}
first = 1;
fprintf(stderr, "Active Choice-Points:\n");
@ -1890,7 +1916,7 @@ void DumpActiveGoals(USES_REGS1) {
Yap_plwrite(MkIntegerTerm(id), GLOBAL_Stream + 2, 0, 0,
GLOBAL_MaxPriority);
} else if (pe->PredFlags & AtomDBPredFlag) {
Atom At = (Atom)pe->FunctorOfPred;
Atom At = (Atom) pe->FunctorOfPred;
Yap_plwrite(MkAtomTerm(At), GLOBAL_Stream + 2, 0, 0,
GLOBAL_MaxPriority);
} else {
@ -1913,7 +1939,7 @@ void DumpActiveGoals(USES_REGS1) {
Yap_plwrite(b_ptr->cp_a2, GLOBAL_Stream + 2, 0, 0, GLOBAL_MaxPriority);
fputc(')', stderr);
} 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);
} else {
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");
} else if (pred_module == 0) {
fprintf(stderr, "in prolog:%s/%lu", RepAtom(pred_name)->StrOfAE,
(unsigned long int)pred_arity);
(unsigned long int) pred_arity);
} else if (cl < 0) {
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 {
fprintf(stderr, "%s:%s/%lu at clause %lu",
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity,
(unsigned long int)cl);
RepAtom(pred_name)->StrOfAE, (unsigned long int) pred_arity,
(unsigned long int) cl);
}
}
@ -1980,7 +2006,7 @@ static Term build_bug_location(yamop *codeptr, PredEntry *pe) {
if (pe->ArityOfPE)
p[1] = MkAtomTerm(NameOfFunctor(pe->FunctorOfPred));
else
p[1] = MkAtomTerm((Atom)pe->FunctorOfPred);
p[1] = MkAtomTerm((Atom) pe->FunctorOfPred);
p[2] = MkIntegerTerm(pe->ArityOfPE);
if (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;
b_ptr = b_ptr->cp_b;
} else {
cp = (yamop *)env[E_CP];
cp = (yamop *) env[E_CP];
env = ENV_Parent(env);
}
ignore_first--;

View File

@ -224,6 +224,10 @@ if (ANACONDA)
set( PYTHON_INCLUDE_DIR $ENV{PREFIX}/include/python$ENV{PY_VER}m)
endif()
ADD_CUSTOM_TARGET(run_install COMMAND ${CMAKE_MAKE_PROGRAM} install)
if (APPLE)
set(MACOSX_RPATH ON)
if (NOT ANACONDA)

View File

@ -36,7 +36,7 @@
#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,
yap_error_number err, YAP_Term wheret, ...);

View File

@ -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_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_INT_OVERFLOW, EVALUATION_ERROR, "int_overflow")
E(EVALUATION_ERROR_UNDEFINED, EVALUATION_ERROR, "undefined")
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_KEY, EXISTENCE_ERROR, "key, ")

View File

@ -864,27 +864,24 @@ as those for `put` (see 6.11).
*/
static Int skip_1(USES_REGS1) { /* 'skip'(N) */
Int n;
Term t2;
Term t1;
int sno;
int ch;
if (IsVarTerm(t2 = Deref(ARG2))) {
Yap_Error(INSTANTIATION_ERROR, t2, "skip/2");
if (IsVarTerm(t1 = Deref(ARG1))) {
Yap_Error(INSTANTIATION_ERROR, t1, "skip/1");
return FALSE;
} else if (!IsIntegerTerm(t2)) {
Yap_Error(TYPE_ERROR_INTEGER, t2, "skip/2");
return FALSE;
} else if ((n = IntegerOfTerm(t2)) < 0) {
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, t2, "skip/2");
} else if (!IsIntegerTerm(t1)) {
Yap_Error(TYPE_ERROR_INTEGER, t1, "skip/1");
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)
;
UNLOCK(GLOBAL_Stream[sno].streamlock);
return (TRUE);
return true;
}
/** @pred skip(+ _S_,- _C_)

View File

@ -5,7 +5,7 @@ INCLUDE(UseSWIG)
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)
@ -16,7 +16,7 @@ SET_SOURCE_FILES_PROPERTIES(../../swiyap.i PROPERTIES SWIG_MODULE_NAME yap4py.ya
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)
configure_file("setup.py.in" setup.py)

View File

@ -1383,7 +1383,6 @@ Command = (H --> B) ->
;
'$system_catch'('$boot_clause'( Command, Where ), prolog, Error,
user:'$LoopError'(Error, consult) ),
fail
).

View File

@ -465,12 +465,10 @@ be lost.
current_prolog_flag(debug, false)
;
'__NB_getval__'('$debug_status',state(zip,Border,Spy), fail),
( Border >= GoalNumber -> fail;
Spy == ignore -> true ;
'$pred_being_spied'(G, M) -> Border == GoalNumber ;
true
)
Border < GoalNumber,
( Spy == ignore ; '$pred_being_spied'(G, M) )
),
writeln(go:G:M),
!,
'$execute_nonstop'(G,M).
'$trace_goal'(G, M, GoalNumber, H) :-
@ -611,7 +609,8 @@ be lost.
( Skip == creep -> true; '$id_goal'(GoalNumber) ; GoalNumber =< Border),
!,
'__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_'(call, GoalNumber, G, Module, Info) :-
@ -744,38 +743,38 @@ be lost.
ignore( G ),
% at this point we are done with leap or skip
set_prolog_flag(debug, OldDeb),
% skip(10), % '
% skip( debugger_input, 10), % '
fail.
'$action'(<,_,_,_,_,_) :- !, % <'Depth
'$new_deb_depth',
skip(10),
skip( debugger_input, 10),
fail.
'$action'('C',_,_,_,_,_) :-
yap_flag(system_options, Opts),
lists:memberchk( call_tracer, Opts),
!, % <'Depth
skip(10),
skip( debugger_input, 10),
'__NB_setval__'('$debug_status', state(creep, 0, stop)).
'$action'(^,_,_,G,_,_) :- !, % '
'$print_deb_sterm'(G),
skip(10),
skip( debugger_input, 10),
fail.
'$action'(a,_,_,_,_,_) :- !, % 'a abort
skip(10),
skip( debugger_input, 10),
'$stop_creeping'(_),
nodebug,
abort.
'$action'(b,_,_,_,_,_) :- !, % 'b break
'$stop_creeping'(_),
skip(10),
skip( debugger_input, 10),
break,
fail.
'$action'('A',_,_,_,_,_) :- !, % 'b break
skip(10),
skip( debugger_input, 10),
'$stack_dump',
fail.
'$action'(c,_,_,_,_,_) :- !, % 'c creep
skip(10),
skip( debugger_input, 10),
'__NB_setval__'('$debug_status',status(creep,0,stop)).
'$action'(e,_,_,_,_,_) :- !, % 'e exit
halt.
@ -784,11 +783,11 @@ be lost.
throw(forward(fail,GoalId)).
'$action'(h,_,_,_,_,_) :- !, % 'h help
'$action_help',
skip(10),
skip( debugger_input, 10),
fail.
'$action'(?,_,_,_,_,_) :- !, % '? help
'$action_help',
skip(10),
skip( debugger_input, 10),
fail.
'$action'(p,_,_,G,Module,_) :- !, % 'p print
((Module = prolog ; Module = user) ->
@ -796,7 +795,7 @@ be lost.
;
print(user_error,Module:G), nl(user_error)
),
skip(10),
skip( debugger_input, 10),
fail.
'$action'(d,_,_,G,Module,_) :- !, % 'd display
((Module = prolog ; Module = user) ->
@ -804,23 +803,23 @@ be lost.
;
display(user_error,Module:G), nl(user_error)
),
skip(10),
skip( debugger_input, 10),
fail.
'$action'(l,_,_CallNumber,_,_,_) :- !, % 'l leap
skip(10),
skip( debugger_input, 10),
'__NB_setval__'('$debug_status', state(leap, 0, stop)).
'$action'(z,_,_CallNumber,_,_,_H) :- !, % 'z zip, fast leap
skip(10), % 'z
skip( debugger_input, 10), % 'z
'__NB_setval__'('$debug_status', state(zip, 0, stop)).
% skip first call (for current goal),
% stop next time.
'$action'(k,_,CallNumber,_,_,_) :- !, % 'k zip, fast leap
skip(10), % '
skip( debugger_input, 10), % '
'__NB_setval__'('$debug_status', state(zip, CallNumber, ignore)).
% skip first call (for current goal),
% stop next time.
'$action'(n,_,_,_,_,_) :- !, % 'n nodebug
skip(10), % '
skip( debugger_input, 10), % '
% tell debugger never to stop.
'__NB_setval__'('$debug_status', state(zip, 0, ignore)),
nodebug.
@ -829,30 +828,30 @@ be lost.
% set_prolog_flag(debug, true),
throw(forward(redo,ScanNumber)).
'$action'(s,P,CallNumber,_,_,_) :- !, % 's skip
skip(10), % '
skip( debugger_input, 10), % '
( (P=call; P=redo) ->
'__NB_setval__'('$debug_status', state(leap, CallNumber, ignore) ) ;
'$ilgl'(s) % '
).
'$action'(t,P,CallNumber,_,_,_) :- !, % 't fast skip
skip(10), % '
skip( debugger_input, 10), % '
( (P=call; P=redo) ->
'__NB_setval__'('$debug_status', state(zip, CallNumber, ignore)) ;
'$ilgl'(t) % '
).
'$action'(q,P,CallNumber,_,_,_) :- !, % 'qst skip
skip(10), % '
skip( debugger_input, 10), % '
( (P=call; P=redo) ->
'__NB_setval__'('$debug_status', state(leap, CallNumber, stop)) ;
'$ilgl'(t) % '
).
'$action'(+,_,_,G,M,_) :- !, % '+ spy this
functor(G,F,N), spy(M:(F/N)),
skip(10), % '
skip( debugger_input, 10), % '
fail.
'$action'(-,_,_,G,M,_) :- !, % '- nospy this
functor(G,F,N), nospy(M:(F/N)),
skip(10), % '
skip( debugger_input, 10), % '
fail.
'$action'(g,_,_,_,_,_) :- !, % 'g ancestors
'$scan_number'(HowMany), % '
@ -861,7 +860,7 @@ be lost.
'$action'('T',exception(G),_,_,_,_) :- !, % 'T throw
throw( forward('$wrapper',G)).
'$action'(C,_,_,_,_,_) :-
skip(10),
skip( debugger_input, 10),
'$ilgl'(C),
fail.
@ -931,7 +930,7 @@ be lost.
'$deb_get_sterm_in_g'(L,G,A),
recorda('$debug_sub_skel',L,_),
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_code( debugger_input_input,C),
@ -972,7 +971,7 @@ be lost.
get_code( debugger_input,NC),
'$get_deb_depth_char_by_char'(NC,XI,XF).
% 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) :-
yap_flag(debugger_print_options,L),