indenting, fix syntax erors
This commit is contained in:
parent
8f7c43997e
commit
5762aa846c
42
C/errors.c
42
C/errors.c
@ -29,7 +29,6 @@
|
||||
#endif
|
||||
#include "Foreign.h"
|
||||
|
||||
|
||||
#if DEBUG
|
||||
void Yap_PrintPredName(PredEntry *ap) {
|
||||
CACHE_REGS
|
||||
@ -103,7 +102,8 @@ bool Yap_Warning(const char *s, ...) {
|
||||
}
|
||||
LOCAL_DoingUndefp = true;
|
||||
LOCAL_within_print_message = true;
|
||||
pred = RepPredProp(PredPropByFunc(FunctorPrintMessage, PROLOG_MODULE)); // PROCEDURE_print_message2
|
||||
pred = RepPredProp(PredPropByFunc(FunctorPrintMessage,
|
||||
PROLOG_MODULE)); // PROCEDURE_print_message2
|
||||
if (pred->OpcodeOfPred == UNDEF_OPCODE) {
|
||||
// fprintf(stderr, "warning message:\n");
|
||||
// Yap_DebugPlWrite(twarning);
|
||||
@ -348,7 +348,8 @@ return mkerrorct(B, ts);
|
||||
*
|
||||
* + e=p(mod, name, arity, cl, file, lin): where the code was entered;
|
||||
*
|
||||
* + p=p(mod, name, arity, cl, file, line): the prolog procedure that caused the bug,
|
||||
* + p=p(mod, name, arity, cl, file, line): the prolog procedure that caused
|
||||
*the bug,
|
||||
*and optionally,
|
||||
*
|
||||
* + g=g(Goal): the goal that created this mess
|
||||
@ -417,10 +418,11 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
#endif
|
||||
// fprintf(stderr, "warning: ");
|
||||
comment = MkAtomTerm(Yap_LookupAtom(s));
|
||||
} else if (LOCAL_ErrorSay && LOCAL_ErrorSay[0])
|
||||
} else if (LOCAL_ErrorSay && LOCAL_ErrorSay[0]) {
|
||||
comment = MkAtomTerm(Yap_LookupAtom(LOCAL_ErrorSay));
|
||||
else
|
||||
} else {
|
||||
comment = TermNil;
|
||||
}
|
||||
va_end(ap);
|
||||
if (P == (yamop *)(FAILCODE)) {
|
||||
LOCAL_PrologMode &= ~InErrorMode;
|
||||
@ -462,6 +464,15 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
#ifdef DEBUG
|
||||
// DumpActiveGoals( USES_REGS1 );
|
||||
#endif /* DEBUG */
|
||||
if (!IsVarTerm(where) &&
|
||||
IsApplTerm(where) &&
|
||||
FunctorOfTerm(where) == FunctorError) {
|
||||
error_t = where;
|
||||
Yap_JumpToEnv(error_t);
|
||||
P = (yamop *)FAILCODE;
|
||||
LOCAL_PrologMode &= ~InErrorMode;
|
||||
return P;
|
||||
}
|
||||
switch (type) {
|
||||
case SYSTEM_ERROR_INTERNAL: {
|
||||
fprintf(stderr, "%% Internal YAP Error: %s exiting....\n", tmpbuf);
|
||||
@ -518,6 +529,9 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
ts[2] = where;
|
||||
nt[0] = mkerrort(type, ts + 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
if (type != ABORT_EVENT) {
|
||||
/* This is used by some complex procedures to detect there was an error */
|
||||
@ -531,7 +545,6 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
MAX_ERROR_MSG_SIZE);
|
||||
LOCAL_ErrorMessage = LOCAL_ErrorSay;
|
||||
}
|
||||
}
|
||||
switch (type) {
|
||||
case RESOURCE_ERROR_HEAP:
|
||||
case RESOURCE_ERROR_STACK:
|
||||
@ -540,20 +553,25 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
default:
|
||||
nt[1] = TermNil;
|
||||
if (comment != TermNil)
|
||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("i")),comment), nt[1]);
|
||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("i")), comment),
|
||||
nt[1]);
|
||||
if (file && function) {
|
||||
Term ts[3], t3;
|
||||
ts[0] = MkAtomTerm(Yap_LookupAtom(file));
|
||||
ts[1] = MkIntegerTerm(lineno);
|
||||
ts[2] = MkAtomTerm(Yap_LookupAtom(function));
|
||||
t3 = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("c"), 3), 3, ts);
|
||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("c")),t3), nt[1]);
|
||||
nt[1] =
|
||||
MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("c")), t3), nt[1]);
|
||||
}
|
||||
if ((culprit = Yap_pc_location(P, B, ENV)) != TermNil) {
|
||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("p")),culprit), nt[1]);
|
||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("p")), culprit),
|
||||
nt[1]);
|
||||
}
|
||||
if ((culprit = Yap_env_location(CP, B, ENV, 0)) != TermNil) {
|
||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("e")),culprit), nt[1]);
|
||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("e")), culprit),
|
||||
nt[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* disable active signals at this point */
|
||||
@ -583,7 +601,6 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
error_t = MkAtomTerm(AtomDAbort);
|
||||
} else {
|
||||
error_t = Yap_MkApplTerm(fun, 2, nt);
|
||||
|
||||
}
|
||||
Yap_JumpToEnv(error_t);
|
||||
P = (yamop *)FAILCODE;
|
||||
@ -591,7 +608,4 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
|
||||
LOCAL_PrologMode &= ~InErrorMode;
|
||||
return P;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user