debug exc
This commit is contained in:
parent
7ce963b63c
commit
2d19db5fce
@ -916,7 +916,6 @@ static int interrupt_dexecute(USES_REGS1) {
|
||||
|
||||
static void undef_goal(USES_REGS1) {
|
||||
PredEntry *pe = PredFromDefCode(P);
|
||||
|
||||
BEGD(d0);
|
||||
/* avoid trouble with undefined dynamic procedures */
|
||||
/* I assume they were not locked beforehand */
|
||||
|
@ -1699,6 +1699,9 @@ bool Yap_addclause(Term t, yamop *cp, Term tmode, Term mod, Term *t4ref)
|
||||
Term tf;
|
||||
int mode;
|
||||
|
||||
if (tmode == 0) {
|
||||
tmode = TermConsult;
|
||||
}
|
||||
if (tmode == TermConsult) {
|
||||
mode = consult;
|
||||
} else if (tmode == TermReconsult) {
|
||||
|
477
C/errors.c
477
C/errors.c
@ -32,113 +32,114 @@
|
||||
#endif
|
||||
#include "Foreign.h"
|
||||
|
||||
|
||||
#define set_key_b(k, ks, q, i, t) \
|
||||
if (strcmp(ks,q) == 0) \
|
||||
{ i->k = t == TermTrue ? true : \
|
||||
false; \
|
||||
return i->k || t == TermFalse; } \
|
||||
if (strcmp(ks, q) == 0) { \
|
||||
i->k = t == TermTrue ? true : false; \
|
||||
return i->k || t == TermFalse; \
|
||||
}
|
||||
|
||||
#define set_key_i(k, ks, q, i, t) \
|
||||
if (strcmp(ks,q) == 0) \
|
||||
{ i->k = IsIntegerTerm(t) ? IntegerOfTerm(t) : \
|
||||
0; \
|
||||
return IsIntegerTerm(t); }
|
||||
if (strcmp(ks, q) == 0) { \
|
||||
i->k = IsIntegerTerm(t) ? IntegerOfTerm(t) : 0; \
|
||||
return IsIntegerTerm(t); \
|
||||
}
|
||||
|
||||
#define set_key_s(k, ks, q, i, t) \
|
||||
if (strcmp(ks,q) == 0) \
|
||||
{ const char *s = IsAtomTerm(t) ? RepAtom(AtomOfTerm(t))->StrOfAE : \
|
||||
IsStringTerm(t) ? StringOfTerm(t) : \
|
||||
NULL; \
|
||||
if (s) { char *tmp = malloc(strlen(s)+1); strcpy(tmp,s); i->k = tmp; } \
|
||||
return i->k != NULL; } \
|
||||
if (strcmp(ks, q) == 0) { \
|
||||
const char *s = IsAtomTerm(t) ? RepAtom(AtomOfTerm(t))->StrOfAE \
|
||||
: IsStringTerm(t) ? StringOfTerm(t) : NULL; \
|
||||
if (s) { \
|
||||
char *tmp = malloc(strlen(s) + 1); \
|
||||
strcpy(tmp, s); \
|
||||
i->k = tmp; \
|
||||
} \
|
||||
return i->k != NULL; \
|
||||
}
|
||||
|
||||
static bool setErr(const char *q, yap_error_descriptor_t *i, Term t) {
|
||||
set_key_i( errorNo, "errorNo", q, i , t);
|
||||
set_key_i(errorNo, "errorNo", q, i, t);
|
||||
set_key_i(errorClass, "errorClass", q, i, t);
|
||||
set_key_s(errorAsText, "errorAsText", q, i, t);
|
||||
set_key_s( errorGoal, "errorGoal", q, i, t);
|
||||
set_key_s( classAsText, "classAsText", q, i, t);
|
||||
set_key_i( errorLine, "errorLine", q, i , t);
|
||||
set_key_s( errorFunction, "errorFunction", q, i, t);
|
||||
set_key_s( errorFile, "errorFile", q, i, t);
|
||||
set_key_i( prologPredLine, "prologPredLine", q, i, t);
|
||||
set_key_i( prologPredFirstLine, "prologPredFirstLine", q, i, t);
|
||||
set_key_i( prologPredLastLine, "prologPredLastLine", q, i, t);
|
||||
set_key_s( prologPredName, "prologPredName", q, i, t);
|
||||
set_key_i( prologPredArity, "prologPredArity", q, i, t);
|
||||
set_key_s( prologPredModule, "prologPredModule", q, i, t);
|
||||
set_key_s( prologPredFile, "prologPredFile", q, i, t);
|
||||
set_key_i( prologParserPos, "prologParserPos", q, i, t);
|
||||
set_key_i( prologParserLine, "prologParserLine", q, i, t);
|
||||
set_key_i( prologParserFirstLine, "prologParserFirstLine", q, i, t);
|
||||
set_key_i( prologParserLastLine, "prologParserLastLine", q, i, t);
|
||||
set_key_s( prologParserText, "prologParserText", q, i, t);
|
||||
set_key_s( prologParserFile, "prologParserFile", q, i, t);
|
||||
set_key_b( prologConsulting, "prologConsulting", q, i, t);
|
||||
set_key_s( culprit, "culprit", q, i, t);
|
||||
set_key_s( errorMsg, "errorMsg", q, i, t);
|
||||
set_key_i( errorMsgLen, "errorMsgLen", q, i, t);
|
||||
set_key_s(errorGoal, "errorGoal", q, i, t);
|
||||
set_key_s(classAsText, "classAsText", q, i, t);
|
||||
set_key_i(errorLine, "errorLine", q, i, t);
|
||||
set_key_s(errorFunction, "errorFunction", q, i, t);
|
||||
set_key_s(errorFile, "errorFile", q, i, t);
|
||||
set_key_i(prologPredLine, "prologPredLine", q, i, t);
|
||||
set_key_i(prologPredFirstLine, "prologPredFirstLine", q, i, t);
|
||||
set_key_i(prologPredLastLine, "prologPredLastLine", q, i, t);
|
||||
set_key_s(prologPredName, "prologPredName", q, i, t);
|
||||
set_key_i(prologPredArity, "prologPredArity", q, i, t);
|
||||
set_key_s(prologPredModule, "prologPredModule", q, i, t);
|
||||
set_key_s(prologPredFile, "prologPredFile", q, i, t);
|
||||
set_key_i(prologParserPos, "prologParserPos", q, i, t);
|
||||
set_key_i(prologParserLine, "prologParserLine", q, i, t);
|
||||
set_key_i(prologParserFirstLine, "prologParserFirstLine", q, i, t);
|
||||
set_key_i(prologParserLastLine, "prologParserLastLine", q, i, t);
|
||||
set_key_s(prologParserText, "prologParserText", q, i, t);
|
||||
set_key_s(prologParserFile, "prologParserFile", q, i, t);
|
||||
set_key_b(prologConsulting, "prologConsulting", q, i, t);
|
||||
set_key_s(culprit, "culprit", q, i, t);
|
||||
set_key_s(errorMsg, "errorMsg", q, i, t);
|
||||
set_key_i(errorMsgLen, "errorMsgLen", q, i, t);
|
||||
return false;
|
||||
}
|
||||
|
||||
#define query_key_b(k, ks, q, i) \
|
||||
if (strcmp(ks,q) == 0) \
|
||||
{ return i->k ? TermTrue : TermFalse; } \
|
||||
if (strcmp(ks, q) == 0) { \
|
||||
return i->k ? TermTrue : TermFalse; \
|
||||
}
|
||||
|
||||
#define query_key_i(k, ks, q, i) \
|
||||
if (strcmp(ks,q) == 0) \
|
||||
{ return MkIntegerTerm(i->k); }
|
||||
if (strcmp(ks, q) == 0) { \
|
||||
return MkIntegerTerm(i->k); \
|
||||
}
|
||||
|
||||
#define query_key_s(k, ks, q, i) \
|
||||
if (strcmp(ks,q) == 0) \
|
||||
{ return ( i->k && i->k[0] ? MkStringTerm(i->k) : TermEmptyAtom ); }
|
||||
if (strcmp(ks, q) == 0) { \
|
||||
return (i->k && i->k[0] ? MkStringTerm(i->k) : TermNil); \
|
||||
}
|
||||
|
||||
static Term queryErr(const char *q, yap_error_descriptor_t *i) {
|
||||
query_key_i( errorNo, "errorNo", q, i );
|
||||
query_key_i(errorNo, "errorNo", q, i);
|
||||
query_key_i(errorClass, "errorClass", q, i);
|
||||
query_key_s(errorAsText, "errorAsText", q, i);
|
||||
query_key_s( errorGoal, "errorGoal", q, i);
|
||||
query_key_s( classAsText, "classAsText", q, i);
|
||||
query_key_i( errorLine, "errorLine", q, i );
|
||||
query_key_s( errorFunction, "errorFunction", q, i);
|
||||
query_key_s( errorFile, "errorFile", q, i);
|
||||
query_key_i( prologPredLine, "prologPredLine", q, i);
|
||||
query_key_i( prologPredFirstLine, "prologPredFirstLine", q, i);
|
||||
query_key_i( prologPredLastLine, "prologPredLastLine", q, i);
|
||||
query_key_s( prologPredName, "prologPredName", q, i);
|
||||
query_key_i( prologPredArity, "prologPredArity", q, i);
|
||||
query_key_s( prologPredModule, "prologPredModule", q, i);
|
||||
query_key_s( prologPredFile, "prologPredFile", q, i);
|
||||
query_key_i( prologParserPos, "prologParserPos", q, i);
|
||||
query_key_i( prologParserLine, "prologParserLine", q, i);
|
||||
query_key_i( prologParserFirstLine, "prologParserFirstLine", q, i);
|
||||
query_key_i( prologParserLastLine, "prologParserLastLine", q, i);
|
||||
query_key_s( prologParserText, "prologParserText", q, i);
|
||||
query_key_s( prologParserFile, "prologParserFile", q, i);
|
||||
query_key_b( prologConsulting, "prologConsulting", q, i);
|
||||
query_key_s( culprit, "culprit", q, i);
|
||||
query_key_s( errorMsg, "errorMsg", q, i);
|
||||
query_key_i( errorMsgLen, "errorMsgLen", q, i);
|
||||
query_key_s(errorGoal, "errorGoal", q, i);
|
||||
query_key_s(classAsText, "classAsText", q, i);
|
||||
query_key_i(errorLine, "errorLine", q, i);
|
||||
query_key_s(errorFunction, "errorFunction", q, i);
|
||||
query_key_s(errorFile, "errorFile", q, i);
|
||||
query_key_i(prologPredLine, "prologPredLine", q, i);
|
||||
query_key_i(prologPredFirstLine, "prologPredFirstLine", q, i);
|
||||
query_key_i(prologPredLastLine, "prologPredLastLine", q, i);
|
||||
query_key_s(prologPredName, "prologPredName", q, i);
|
||||
query_key_i(prologPredArity, "prologPredArity", q, i);
|
||||
query_key_s(prologPredModule, "prologPredModule", q, i);
|
||||
query_key_s(prologPredFile, "prologPredFile", q, i);
|
||||
query_key_i(prologParserPos, "prologParserPos", q, i);
|
||||
query_key_i(prologParserLine, "prologParserLine", q, i);
|
||||
query_key_i(prologParserFirstLine, "prologParserFirstLine", q, i);
|
||||
query_key_i(prologParserLastLine, "prologParserLastLine", q, i);
|
||||
query_key_s(prologParserText, "prologParserText", q, i);
|
||||
query_key_s(prologParserFile, "prologParserFile", q, i);
|
||||
query_key_b(prologConsulting, "prologConsulting", q, i);
|
||||
query_key_s(culprit, "culprit", q, i);
|
||||
query_key_s(errorMsg, "errorMsg", q, i);
|
||||
query_key_i(errorMsgLen, "errorMsgLen", q, i);
|
||||
return TermNil;
|
||||
}
|
||||
|
||||
static void print_key_b(const char *key, bool v)
|
||||
{
|
||||
static void print_key_b(const char *key, bool v) {
|
||||
const char *b = v ? "true" : "false";
|
||||
fprintf(stderr,"%s: %s\n", key, b);
|
||||
fprintf(stderr, "%s: %s\n", key, b);
|
||||
}
|
||||
|
||||
static void print_key_i(const char *key, YAP_Int v)
|
||||
{
|
||||
fprintf(stderr,"%s: " Int_FORMAT "\n", key, v);
|
||||
static void print_key_i(const char *key, YAP_Int v) {
|
||||
fprintf(stderr, "%s: " Int_FORMAT "\n", key, v);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void print_key_s(const char *key, const char *v)
|
||||
{
|
||||
fprintf(stderr,"%s: %s\n", key, v);
|
||||
static void print_key_s(const char *key, const char *v) {
|
||||
fprintf(stderr, "%s: %s\n", key, v);
|
||||
}
|
||||
|
||||
static void printErr(yap_error_descriptor_t *i) {
|
||||
@ -146,62 +147,56 @@ static void printErr(yap_error_descriptor_t *i) {
|
||||
if (i->errorNo == YAP_NO_ERROR) {
|
||||
return;
|
||||
}
|
||||
print_key_i( "errorNo", i->errorNo );
|
||||
print_key_i("errorNo", i->errorNo);
|
||||
print_key_i("errorClass", i->errorClass);
|
||||
print_key_s("errorAsText", i->errorAsText);
|
||||
print_key_s( "errorGoal", i->errorGoal);
|
||||
print_key_s( "classAsText", i->classAsText);
|
||||
print_key_i( "errorLineq", i->errorLine );
|
||||
print_key_s( "errorFunction", i->errorFunction);
|
||||
print_key_s( "errorFile", i->errorFile);
|
||||
print_key_i( "prologPredLine", i->prologPredLine);
|
||||
print_key_i( "prologPredFirstLine", i->prologPredFirstLine);
|
||||
print_key_i( "prologPredLastLine", i->prologPredLastLine);
|
||||
print_key_s( "prologPredName", i->prologPredName);
|
||||
print_key_i( "prologPredArity", i->prologPredArity);
|
||||
print_key_s( "prologPredModule", i->prologPredModule);
|
||||
print_key_s( "prologPredFile", i->prologPredFile);
|
||||
print_key_i( "prologParserPos", i->prologParserPos);
|
||||
print_key_i( "prologParserLine", i->prologParserLine);
|
||||
print_key_i( "prologParserFirstLine", i->prologParserFirstLine);
|
||||
print_key_i( "prologParserLastLine", i->prologParserLastLine);
|
||||
print_key_s( "prologParserText", i->prologParserText);
|
||||
print_key_s( "prologParserFile", i->prologParserFile);
|
||||
print_key_b( "prologConsulting", i->prologConsulting);
|
||||
print_key_s( "culprit", i->culprit);
|
||||
print_key_s("errorGoal", i->errorGoal);
|
||||
print_key_s("classAsText", i->classAsText);
|
||||
print_key_i("errorLineq", i->errorLine);
|
||||
print_key_s("errorFunction", i->errorFunction);
|
||||
print_key_s("errorFile", i->errorFile);
|
||||
print_key_i("prologPredLine", i->prologPredLine);
|
||||
print_key_i("prologPredFirstLine", i->prologPredFirstLine);
|
||||
print_key_i("prologPredLastLine", i->prologPredLastLine);
|
||||
print_key_s("prologPredName", i->prologPredName);
|
||||
print_key_i("prologPredArity", i->prologPredArity);
|
||||
print_key_s("prologPredModule", i->prologPredModule);
|
||||
print_key_s("prologPredFile", i->prologPredFile);
|
||||
print_key_i("prologParserPos", i->prologParserPos);
|
||||
print_key_i("prologParserLine", i->prologParserLine);
|
||||
print_key_i("prologParserFirstLine", i->prologParserFirstLine);
|
||||
print_key_i("prologParserLastLine", i->prologParserLastLine);
|
||||
print_key_s("prologParserText", i->prologParserText);
|
||||
print_key_s("prologParserFile", i->prologParserFile);
|
||||
print_key_b("prologConsulting", i->prologConsulting);
|
||||
print_key_s("culprit", i->culprit);
|
||||
if (i->errorMsgLen) {
|
||||
print_key_s( "errorMsg", i->errorMsg);
|
||||
print_key_i( "errorMsgLen", i->errorMsgLen);
|
||||
print_key_s("errorMsg", i->errorMsg);
|
||||
print_key_i("errorMsgLen", i->errorMsgLen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static YAP_Term add_key_b(const char *key, bool v, YAP_Term o0)
|
||||
{
|
||||
static YAP_Term add_key_b(const char *key, bool v, YAP_Term o0) {
|
||||
YAP_Term tkv[2];
|
||||
tkv[1] = v ? TermTrue : TermFalse;
|
||||
tkv[0] = MkStringTerm(key);
|
||||
Term node = Yap_MkApplTerm( FunctorEq, 2, tkv);
|
||||
Term node = Yap_MkApplTerm(FunctorEq, 2, tkv);
|
||||
return MkPairTerm(node, o0);
|
||||
}
|
||||
|
||||
static YAP_Term add_key_i(const char *key, YAP_Int v, YAP_Term o0)
|
||||
{
|
||||
static YAP_Term add_key_i(const char *key, YAP_Int v, YAP_Term o0) {
|
||||
YAP_Term tkv[2];
|
||||
tkv[1] = MkIntegerTerm(v), tkv[0] = MkStringTerm(key);
|
||||
Term node = Yap_MkApplTerm( FunctorEq, 2, tkv);
|
||||
Term node = Yap_MkApplTerm(FunctorEq, 2, tkv);
|
||||
return MkPairTerm(node, o0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static YAP_Term add_key_s(const char *key, const char *v, YAP_Term o0)
|
||||
{
|
||||
static YAP_Term add_key_s(const char *key, const char *v, YAP_Term o0) {
|
||||
Term tkv[2];
|
||||
if (!v || v[0] == '\0')
|
||||
return o0;
|
||||
tkv[1] = MkStringTerm(v), tkv[0] = MkStringTerm(key);
|
||||
Term node = Yap_MkApplTerm( FunctorEq, 2, tkv);
|
||||
Term node = Yap_MkApplTerm(FunctorEq, 2, tkv);
|
||||
return MkPairTerm(node, o0);
|
||||
}
|
||||
|
||||
@ -210,38 +205,36 @@ static Term err2list(yap_error_descriptor_t *i) {
|
||||
if (i->errorNo == YAP_NO_ERROR) {
|
||||
return o;
|
||||
}
|
||||
o = add_key_i( "errorNo", i->errorNo, o );
|
||||
o = add_key_i("errorNo", i->errorNo, o);
|
||||
o = add_key_i("errorClass", i->errorClass, o);
|
||||
o = add_key_s("errorAsText", i->errorAsText, o);
|
||||
o = add_key_s( "errorGoal", i->errorGoal, o);
|
||||
o = add_key_s( "classAsText", i->classAsText, o);
|
||||
o = add_key_i( "errorLineq", i->errorLine, o );
|
||||
o = add_key_s( "errorFunction", i->errorFunction, o);
|
||||
o = add_key_s( "errorFile", i->errorFile, o);
|
||||
o = add_key_i( "prologPredLine", i->prologPredLine, o);
|
||||
o = add_key_i( "prologPredFirstLine", i->prologPredFirstLine, o);
|
||||
o = add_key_i( "prologPredLastLine", i->prologPredLastLine, o);
|
||||
o = add_key_s( "prologPredName", i->prologPredName, o);
|
||||
o = add_key_i( "prologPredArity", i->prologPredArity, o);
|
||||
o = add_key_s( "prologPredModule", i->prologPredModule, o);
|
||||
o = add_key_s( "prologPredFile", i->prologPredFile, o);
|
||||
o = add_key_i( "prologParserPos", i->prologParserPos, o);
|
||||
o = add_key_i( "prologParserLine", i->prologParserLine, o);
|
||||
o = add_key_i( "prologParserFirstLine", i->prologParserFirstLine, o);
|
||||
o = add_key_i( "prologParserLastLine", i->prologParserLastLine, o);
|
||||
o = add_key_s( "prologParserText", i->prologParserText, o);
|
||||
o = add_key_s( "prologParserFile", i->prologParserFile, o);
|
||||
o = add_key_b( "prologConsulting", i->prologConsulting, o);
|
||||
o = add_key_s( "culprit", i->culprit, o);
|
||||
o = add_key_s("errorGoal", i->errorGoal, o);
|
||||
o = add_key_s("classAsText", i->classAsText, o);
|
||||
o = add_key_i("errorLineq", i->errorLine, o);
|
||||
o = add_key_s("errorFunction", i->errorFunction, o);
|
||||
o = add_key_s("errorFile", i->errorFile, o);
|
||||
o = add_key_i("prologPredLine", i->prologPredLine, o);
|
||||
o = add_key_i("prologPredFirstLine", i->prologPredFirstLine, o);
|
||||
o = add_key_i("prologPredLastLine", i->prologPredLastLine, o);
|
||||
o = add_key_s("prologPredName", i->prologPredName, o);
|
||||
o = add_key_i("prologPredArity", i->prologPredArity, o);
|
||||
o = add_key_s("prologPredModule", i->prologPredModule, o);
|
||||
o = add_key_s("prologPredFile", i->prologPredFile, o);
|
||||
o = add_key_i("prologParserPos", i->prologParserPos, o);
|
||||
o = add_key_i("prologParserLine", i->prologParserLine, o);
|
||||
o = add_key_i("prologParserFirstLine", i->prologParserFirstLine, o);
|
||||
o = add_key_i("prologParserLastLine", i->prologParserLastLine, o);
|
||||
o = add_key_s("prologParserText", i->prologParserText, o);
|
||||
o = add_key_s("prologParserFile", i->prologParserFile, o);
|
||||
o = add_key_b("prologConsulting", i->prologConsulting, o);
|
||||
o = add_key_s("culprit", i->culprit, o);
|
||||
if (i->errorMsgLen) {
|
||||
o = add_key_s( "errorMsg", i->errorMsg, o);
|
||||
o = add_key_i( "errorMsgLen", i->errorMsgLen, o);
|
||||
o = add_key_s("errorMsg", i->errorMsg, o);
|
||||
o = add_key_i("errorMsgLen", i->errorMsgLen, o);
|
||||
}
|
||||
return o;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool Yap_Warning(const char *s, ...) {
|
||||
CACHE_REGS
|
||||
va_list ap;
|
||||
@ -254,7 +247,8 @@ bool Yap_Warning(const char *s, ...) {
|
||||
|
||||
LOCAL_DoingUndefp = true;
|
||||
if (LOCAL_PrologMode & InErrorMode && (err = LOCAL_ActiveError->errorNo)) {
|
||||
fprintf(stderr, "%% Warning %s WITHIN ERROR %s %s\n", s, Yap_errorClassName( Yap_errorClass(err)), Yap_errorName(err));
|
||||
fprintf(stderr, "%% Warning %s WITHIN ERROR %s %s\n", s,
|
||||
Yap_errorClassName(Yap_errorClass(err)), Yap_errorName(err));
|
||||
Yap_RestartYap(1);
|
||||
}
|
||||
LOCAL_PrologMode |= InErrorMode;
|
||||
@ -289,7 +283,8 @@ bool Yap_Warning(const char *s, ...) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
void Yap_InitError__(const char *file, const char *function, int lineno, yap_error_number e, Term t, ...) {
|
||||
void Yap_InitError__(const char *file, const char *function, int lineno,
|
||||
yap_error_number e, Term t, ...) {
|
||||
CACHE_REGS
|
||||
va_list ap;
|
||||
va_start(ap, t);
|
||||
@ -331,7 +326,8 @@ bool Yap_PrintWarning(Term twarning) {
|
||||
Term ts[2];
|
||||
|
||||
if (LOCAL_PrologMode & InErrorMode) {
|
||||
fprintf(stderr, "%% ERROR WITHIN ERROR while processing warning: %s\n", Yap_TermToBuffer(twarning, LOCAL_encoding, 0));
|
||||
fprintf(stderr, "%% ERROR WITHIN ERROR while processing warning: %s\n",
|
||||
Yap_TermToBuffer(twarning, ENC_ISO_UTF8,Quote_illegal_f | Ignore_ops_f | Unfold_cyclics_f));
|
||||
Yap_RestartYap(1);
|
||||
}
|
||||
LOCAL_PrologMode |= InErrorMode;
|
||||
@ -379,7 +375,8 @@ bool Yap_HandleError__(const char *file, const char *function, int lineno,
|
||||
switch (err) {
|
||||
case RESOURCE_ERROR_STACK:
|
||||
if (!Yap_gc(arity, ENV, gc_P(P, CP))) {
|
||||
Yap_Error__(false, file, function, lineno, RESOURCE_ERROR_STACK, ARG1, serr);
|
||||
Yap_Error__(false, file, function, lineno, RESOURCE_ERROR_STACK, ARG1,
|
||||
serr);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -389,14 +386,15 @@ bool Yap_HandleError__(const char *file, const char *function, int lineno,
|
||||
}
|
||||
if (!Yap_ExpandPreAllocCodeSpace(0, NULL, TRUE)) {
|
||||
/* crash in flames */
|
||||
Yap_Error__(false, file, function, lineno, RESOURCE_ERROR_AUXILIARY_STACK, ARG1,
|
||||
serr);
|
||||
Yap_Error__(false, file, function, lineno, RESOURCE_ERROR_AUXILIARY_STACK,
|
||||
ARG1, serr);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case RESOURCE_ERROR_HEAP:
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error__(false, file, function, lineno, RESOURCE_ERROR_HEAP, ARG2, serr);
|
||||
Yap_Error__(false, file, function, lineno, RESOURCE_ERROR_HEAP, ARG2,
|
||||
serr);
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
@ -501,7 +499,7 @@ static char tmpbuf[YAP_BUF_SIZE];
|
||||
|
||||
#define ECLASS(CL, A, B) \
|
||||
case CL: \
|
||||
return Yap_LookupAtom(A); \
|
||||
return Yap_LookupAtom(A);
|
||||
|
||||
#define END_ERROR_CLASSES() \
|
||||
} \
|
||||
@ -517,29 +515,30 @@ static char tmpbuf[YAP_BUF_SIZE];
|
||||
Term ft[2]; \
|
||||
ft[0] = MkAtomTerm(mkerrorct(B)); \
|
||||
ft[1] = info; \
|
||||
return Yap_MkApplTerm(FunctorError,2,ft); }
|
||||
return Yap_MkApplTerm(FunctorError, 2, ft); \
|
||||
}
|
||||
|
||||
#define E(A, B, C) \
|
||||
case A: \
|
||||
{ Term ft[2], nt[2]; \
|
||||
case A: { \
|
||||
Term ft[2], nt[2]; \
|
||||
nt[0] = MkAtomTerm(Yap_LookupAtom(C)); \
|
||||
nt[1] = MkVarTerm(); \
|
||||
Yap_unify(nt[1], culprit); \
|
||||
ft[0] = Yap_MkApplTerm(Yap_MkFunctor(mkerrorct(B),2), 2, nt); \
|
||||
ft[0] = Yap_MkApplTerm(Yap_MkFunctor(mkerrorct(B), 2), 2, nt); \
|
||||
ft[1] = info; \
|
||||
return Yap_MkApplTerm(FunctorError,2,ft); }
|
||||
return Yap_MkApplTerm(FunctorError, 2, ft); \
|
||||
}
|
||||
|
||||
#define E2(A, B, C, D) \
|
||||
case A: \
|
||||
{ \
|
||||
case A: { \
|
||||
Term ft[2], nt[3]; \
|
||||
nt[0] = MkAtomTerm(Yap_LookupAtom(C)); \
|
||||
nt[1] = MkAtomTerm(Yap_LookupAtom(D)); \
|
||||
nt[2] = MkVarTerm(); \
|
||||
Yap_unify(nt[2], culprit); \
|
||||
ft[0] = Yap_MkApplTerm(Yap_MkFunctor(mkerrorct(B),3), 3, nt); \
|
||||
ft[0] = Yap_MkApplTerm(Yap_MkFunctor(mkerrorct(B), 3), 3, nt); \
|
||||
ft[1] = info; \
|
||||
return Yap_MkApplTerm(FunctorError,2,ft); \
|
||||
return Yap_MkApplTerm(FunctorError, 2, ft); \
|
||||
}
|
||||
|
||||
#define END_ERRORS() \
|
||||
@ -565,8 +564,6 @@ void Yap_pushErrorContext(yap_error_descriptor_t *new_error) {
|
||||
|
||||
/* } */
|
||||
|
||||
|
||||
|
||||
yap_error_descriptor_t *Yap_popErrorContext(bool pass) {
|
||||
if (pass && LOCAL_ActiveError->top_error->errorNo == YAP_NO_ERROR &&
|
||||
LOCAL_ActiveError->errorNo != YAP_NO_ERROR)
|
||||
@ -638,8 +635,8 @@ void Yap_ThrowError__(const char *file, const char *function, int lineno,
|
||||
*
|
||||
* + i=i(Comment): an user-written comment on this bug.
|
||||
*/
|
||||
yamop *Yap_Error__(bool throw, const char *file, const char *function, int lineno,
|
||||
yap_error_number type, Term where, ...) {
|
||||
yamop *Yap_Error__(bool throw, const char *file, const char *function,
|
||||
int lineno, yap_error_number type, Term where, ...) {
|
||||
CACHE_REGS
|
||||
va_list ap;
|
||||
char *fmt;
|
||||
@ -648,13 +645,21 @@ yamop *Yap_Error__(bool throw, const char *file, const char *function, int linen
|
||||
|
||||
/* disallow recursive error handling */
|
||||
if (LOCAL_PrologMode & InErrorMode && (err = LOCAL_ActiveError->errorNo)) {
|
||||
fprintf(stderr, "%% ERROR %s %s WITHIN ERROR %s %s\n", Yap_errorClassName( Yap_errorClass(type)), Yap_errorName(type), Yap_errorClassName( Yap_errorClass(err)), Yap_errorName(err));
|
||||
fprintf(stderr, "%% ERROR %s %s WITHIN ERROR %s %s\n",
|
||||
Yap_errorClassName(Yap_errorClass(type)), Yap_errorName(type),
|
||||
Yap_errorClassName(Yap_errorClass(err)), Yap_errorName(err));
|
||||
Yap_RestartYap(1);
|
||||
}
|
||||
if (LOCAL_DoingUndefp && type == EVALUATION_ERROR_UNDEFINED) {
|
||||
P = FAILCODE;
|
||||
CalculateStackGap(PASS_REGS1);
|
||||
return P;
|
||||
}
|
||||
if (where == 0L || where == TermNil) {
|
||||
LOCAL_ActiveError->culprit = NULL;
|
||||
} else {
|
||||
LOCAL_ActiveError->culprit = Yap_TermToBuffer(
|
||||
where, ENC_ISO_UTF8, Quote_illegal_f | Ignore_ops_f | Unfold_cyclics_f);
|
||||
}
|
||||
LOCAL_ActiveError->errorNo = type;
|
||||
LOCAL_ActiveError->errorAsText = Yap_errorName(type);
|
||||
@ -681,21 +686,14 @@ yamop *Yap_Error__(bool throw, const char *file, const char *function, int linen
|
||||
#endif
|
||||
if (type == INTERRUPT_EVENT) {
|
||||
fprintf(stderr, "%% YAP exiting: cannot handle signal %d\n",
|
||||
(int) IntOfTerm(where));
|
||||
LOCAL_PrologMode &= ~InErrorMode;
|
||||
(int)IntOfTerm(where));
|
||||
Yap_exit(1);
|
||||
}
|
||||
if (where == 0L || where == TermNil) {
|
||||
LOCAL_ActiveError->culprit = NULL;
|
||||
} else {
|
||||
LOCAL_ActiveError->culprit = Yap_TermToBuffer(where, LOCAL_encoding, Quote_illegal_f | Handle_vars_f);
|
||||
|
||||
}
|
||||
va_start(ap, where);
|
||||
fmt = va_arg(ap, char *);
|
||||
if (fmt != NULL) {
|
||||
#if HAVE_VSNPRINTF
|
||||
(void) vsnprintf(s, MAXPATHLEN - 1, fmt, ap);
|
||||
(void)vsnprintf(s, MAXPATHLEN - 1, fmt, ap);
|
||||
#else
|
||||
(void)vsprintf(s, fmt, ap);
|
||||
#endif
|
||||
@ -717,7 +715,7 @@ yamop *Yap_Error__(bool throw, const char *file, const char *function, int linen
|
||||
if (where == 0 || where == TermNil) {
|
||||
LOCAL_ActiveError->culprit = 0;
|
||||
}
|
||||
if (P == (yamop *) (FAILCODE)) {
|
||||
if (P == (yamop *)(FAILCODE)) {
|
||||
LOCAL_PrologMode &= ~InErrorMode;
|
||||
return P;
|
||||
}
|
||||
@ -837,7 +835,7 @@ yamop *Yap_Error__(bool throw, const char *file, const char *function, int linen
|
||||
return P;
|
||||
}
|
||||
LOCAL_CommittedError = Yap_GetException();
|
||||
//reset_error_description();
|
||||
// reset_error_description();
|
||||
if (!throw) {
|
||||
Yap_JumpToEnv();
|
||||
}
|
||||
@ -918,19 +916,18 @@ const char *Yap_errorClassName(yap_error_class_number e) {
|
||||
return c_error_class_name[e];
|
||||
}
|
||||
|
||||
yap_error_descriptor_t * Yap_GetException(void) {
|
||||
yap_error_descriptor_t *Yap_GetException(void) {
|
||||
CACHE_REGS
|
||||
if (LOCAL_ActiveError->errorNo != YAP_NO_ERROR) {
|
||||
yap_error_descriptor_t *t = LOCAL_ActiveError, *nt = malloc(sizeof(yap_error_descriptor_t));
|
||||
memcpy(nt,t,sizeof(yap_error_descriptor_t));
|
||||
return t;
|
||||
yap_error_descriptor_t *t = LOCAL_ActiveError,
|
||||
*nt = malloc(sizeof(yap_error_descriptor_t));
|
||||
memcpy(nt, t, sizeof(yap_error_descriptor_t));
|
||||
return nt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Yap_PrintException(void) {
|
||||
printErr(LOCAL_ActiveError);
|
||||
}
|
||||
void Yap_PrintException(void) { printErr(LOCAL_ActiveError); }
|
||||
|
||||
bool Yap_RaiseException(void) {
|
||||
if (LOCAL_ActiveError->errorNo == YAP_NO_ERROR)
|
||||
@ -940,7 +937,7 @@ bool Yap_RaiseException(void) {
|
||||
|
||||
bool Yap_ResetException(yap_error_descriptor_t *i) {
|
||||
// reset error descriptor
|
||||
if(!i)
|
||||
if (!i)
|
||||
return true;
|
||||
yap_error_descriptor_t *bf = i->top_error;
|
||||
memset(i, 0, sizeof(*i));
|
||||
@ -950,11 +947,12 @@ bool Yap_ResetException(yap_error_descriptor_t *i) {
|
||||
|
||||
static Int reset_exception(USES_REGS1) { return Yap_ResetException(worker_id); }
|
||||
|
||||
Term MkErrorTerm(yap_error_descriptor_t *t)
|
||||
{
|
||||
Term MkErrorTerm(yap_error_descriptor_t *t) {
|
||||
if (t->errorNo == THROW_EVENT)
|
||||
return t->errorRawTerm;
|
||||
return mkerrort(t->errorNo, Yap_BufferToTerm(t->culprit, TermNil), err2list(t));
|
||||
return mkerrort(t->errorNo,
|
||||
Yap_BufferToTerm(t->culprit, TermNil),
|
||||
err2list(t));
|
||||
}
|
||||
|
||||
static Int read_exception(USES_REGS1) {
|
||||
@ -972,7 +970,7 @@ static Int query_exception(USES_REGS1) {
|
||||
query = RepAtom(AtomOfTerm(t))->StrOfAE;
|
||||
if (IsStringTerm(t))
|
||||
query = StringOfTerm(t);
|
||||
if (!IsAddressTerm(Deref(ARG1)))
|
||||
if (!IsAddressTerm(Deref(ARG2)))
|
||||
return false;
|
||||
yap_error_descriptor_t *y = AddressOfTerm(Deref(ARG2));
|
||||
Term t3 = Deref(ARG3);
|
||||
@ -985,20 +983,17 @@ static Int query_exception(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static Int drop_exception(USES_REGS1) {
|
||||
yap_error_descriptor_t *t = AddressOfTerm(Deref(ARG1));
|
||||
free(t);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static Int new_exception(USES_REGS1) {
|
||||
Term t = MkSysError(malloc(sizeof(yap_error_descriptor_t)));
|
||||
return Yap_unify(ARG1,t);
|
||||
return Yap_unify(ARG1, t);
|
||||
}
|
||||
|
||||
|
||||
static Int get_exception(USES_REGS1) {
|
||||
yap_error_descriptor_t *i;
|
||||
Term t;
|
||||
@ -1007,50 +1002,104 @@ static Int get_exception(USES_REGS1) {
|
||||
if (i && i->errorNo != YAP_NO_ERROR) {
|
||||
if (i->errorNo == THROW_EVENT)
|
||||
t = i->errorRawTerm;
|
||||
else
|
||||
t = mkerrort(i->errorNo, Yap_BufferToTerm(i->culprit, TermNil), MkSysError(i));
|
||||
Yap_ResetException(i);
|
||||
else if (i->culprit != NULL) {
|
||||
t = mkerrort(i->errorNo, Yap_BufferToTerm(i->culprit,TermNil),
|
||||
MkSysError(i));
|
||||
} else {
|
||||
t = mkerrort(i->errorNo, TermNil, MkSysError(i));
|
||||
}
|
||||
Yap_ResetException(LOCAL_ActiveError);
|
||||
LOCAL_CommittedError = NULL;
|
||||
Int rc= Yap_unify(t, ARG1);
|
||||
Int rc = Yap_unify(t, ARG1);
|
||||
return rc;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
yap_error_descriptor_t *Yap_UserError(Term t, yap_error_descriptor_t *i) {
|
||||
Term t1, t2;
|
||||
t1 = ArgOfTerm(1, t);
|
||||
t2 = ArgOfTerm(2, t);
|
||||
char ename[65];
|
||||
|
||||
yap_error_descriptor_t *Yap_UserError( Term t, Term t1, yap_error_descriptor_t *i) {
|
||||
Term t2;
|
||||
Functor f = FunctorOfTerm(t);
|
||||
LOCAL_ActiveError->culprit = Yap_TermToBuffer(ArgOfTerm(1, t), LOCAL_encoding, 0);
|
||||
if (ArityOfFunctor(f) == 2) {
|
||||
LOCAL_ActiveError->errorGoal = Yap_TermToBuffer(ArgOfTerm(2, t), LOCAL_encoding, 0);
|
||||
}
|
||||
Yap_prolog_add_culprit(LOCAL_ActiveError PASS_REGS);
|
||||
// LOCAL_Error_TYPE = ERROR_EVENT;
|
||||
if (IsApplTerm(t1) && IsAtomTerm((t2 = ArgOfTerm(1, t1)))) {
|
||||
LOCAL_ActiveError->errorAsText = RepAtom(AtomOfTerm(t2))->StrOfAE;
|
||||
LOCAL_ActiveError->classAsText = RepAtom(NameOfFunctor(FunctorOfTerm(t1)))->StrOfAE;
|
||||
} else if (IsAtomTerm(t1)) {
|
||||
LOCAL_ActiveError->errorAsText = RepAtom(AtomOfTerm(t1))->StrOfAE;
|
||||
LOCAL_ActiveError->classAsText = NULL;
|
||||
}
|
||||
LOCAL_ActiveError->errorNo = USER_EVENT;
|
||||
LOCAL_ActiveError->errorClass = EVENT;
|
||||
if (IsApplTerm(t1)) {
|
||||
Functor f1 = FunctorOfTerm(t1);
|
||||
arity_t a1 = ArityOfFunctor(f1);
|
||||
LOCAL_ActiveError->culprit =
|
||||
Yap_TermToBuffer(ArgOfTerm(a1, t1), ENC_ISO_UTF8, Quote_illegal_f | Ignore_ops_f | Unfold_cyclics_f);
|
||||
if (a1 == 1) {
|
||||
return NULL;
|
||||
} else {
|
||||
Term ti;
|
||||
if (!IsAtomTerm((ti = ArgOfTerm(1, t1))))
|
||||
return NULL;
|
||||
strncpy(ename, RepAtom(AtomOfTerm(ti))->StrOfAE, 64);
|
||||
}
|
||||
if (a1 == 3) {
|
||||
Term ti;
|
||||
if (!IsAtomTerm((ti = ArgOfTerm(2, t1))))
|
||||
return NULL;
|
||||
strncat(ename, " ", 64);
|
||||
strncat(ename, RepAtom(AtomOfTerm(ti))->StrOfAE, 64);
|
||||
} else if (a1 > 3) {
|
||||
return NULL;
|
||||
}
|
||||
LOCAL_ActiveError->errorAsText = ename;
|
||||
LOCAL_ActiveError->classAsText = RepAtom(NameOfFunctor(f1))->StrOfAE;
|
||||
int j;
|
||||
for (j=0; j < sizeof(c_error_list)/sizeof(struct c_error_info); j++) {
|
||||
if (!strcmp(c_error_list[j].name,LOCAL_ActiveError->errorAsText) &&
|
||||
for (j = 0; j < sizeof(c_error_list) / sizeof(struct c_error_info); j++) {
|
||||
if (!strcmp(c_error_list[j].name, LOCAL_ActiveError->errorAsText) &&
|
||||
(c_error_list[j].class == 0 ||
|
||||
!strcmp(LOCAL_ActiveError->classAsText,c_error_class_name[c_error_list[j].class])))
|
||||
{
|
||||
!strcmp(LOCAL_ActiveError->classAsText,
|
||||
c_error_class_name[c_error_list[j].class]))) {
|
||||
if (c_error_list[j].class != PERMISSION_ERROR ||
|
||||
(t1 = ArgOfTerm(2, t1) && IsAtomTerm(t1) &&
|
||||
!strcmp(c_error_list[j].name,
|
||||
RepAtom(AtomOfTerm(t1))->StrOfAE))) {
|
||||
LOCAL_ActiveError->errorNo = j;
|
||||
LOCAL_ActiveError->errorClass = c_error_list[j].class;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
Yap_prolog_add_culprit(LOCAL_ActiveError PASS_REGS1);
|
||||
return
|
||||
LOCAL_ActiveError;
|
||||
}
|
||||
} else if (IsAtomTerm(t1)) {
|
||||
const char *err = RepAtom(AtomOfTerm(t1))->StrOfAE;
|
||||
if (!strcmp(err, "instantiation_error")) {
|
||||
LOCAL_ActiveError->errorClass = INSTANTIATION_ERROR_CLASS;
|
||||
LOCAL_ActiveError->classAsText = "instantiation_error";
|
||||
LOCAL_ActiveError->errorAsText = "instantiation_error";
|
||||
LOCAL_ActiveError->errorNo = INSTANTIATION_ERROR;
|
||||
} else if (!strcmp(err, "uninstantiation_error")) {
|
||||
LOCAL_ActiveError->errorClass = UNINSTANTIATION_ERROR_CLASS;
|
||||
LOCAL_ActiveError->classAsText = "uninstantiation_error";
|
||||
LOCAL_ActiveError->errorAsText = "uninstantiation_error";
|
||||
LOCAL_ActiveError->errorNo = UNINSTANTIATION_ERROR;
|
||||
}
|
||||
}
|
||||
while (IsPairTerm(t2)) {
|
||||
Term hd = HeadOfTerm(t2);
|
||||
if (IsPairTerm(hd)) {
|
||||
Term hdhd = HeadOfTerm(hd);
|
||||
Term hdtl = TailOfTerm(hd);
|
||||
if (hdhd == Termg) {
|
||||
Term n = ArgOfTerm(1,hdtl);
|
||||
|
||||
LOCAL_ActiveError->errorGoal = Yap_TermToBuffer(n, ENC_ISO_UTF8, Quote_illegal_f | Ignore_ops_f | Unfold_cyclics_f);
|
||||
}
|
||||
|
||||
}
|
||||
t2 = TailOfTerm(t2);
|
||||
}
|
||||
Yap_prolog_add_culprit(LOCAL_ActiveError PASS_REGS);
|
||||
{
|
||||
char *errs = malloc(strlen(LOCAL_ActiveError->errorAsText)+1);
|
||||
strcpy(errs, LOCAL_ActiveError->errorAsText);
|
||||
LOCAL_ActiveError->errorAsText = errs;
|
||||
}
|
||||
return LOCAL_ActiveError;
|
||||
}
|
||||
|
||||
static Int is_boolean(USES_REGS1) {
|
||||
|
9
C/exec.c
9
C/exec.c
@ -2055,15 +2055,12 @@ bool Yap_JumpToEnv(void) {
|
||||
|
||||
/* This does very nasty stuff!!!!! */
|
||||
static Int jump_env(USES_REGS1) {
|
||||
Term t = Deref(ARG1), t0 = t, t1;
|
||||
Term t = Deref(ARG1), t0 = t;
|
||||
if (IsVarTerm(t)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, t, "throw ball must be bound");
|
||||
return false;
|
||||
} else if (IsApplTerm(t) && FunctorOfTerm(t) == FunctorError
|
||||
&& (t1 = ArgOfTerm(1, t))
|
||||
&& IsPairTerm((t = ArgOfTerm(2, t)))
|
||||
&& IsApplTerm((t = HeadOfTerm(t)))) {
|
||||
LOCAL_ActiveError = Yap_UserError(t, t1, LOCAL_ActiveError);
|
||||
} else if (IsApplTerm(t) && FunctorOfTerm(t) == FunctorError) {
|
||||
LOCAL_ActiveError = Yap_UserError(t0, LOCAL_ActiveError);
|
||||
} else {
|
||||
LOCAL_Error_TYPE = THROW_EVENT;
|
||||
LOCAL_ActiveError->errorAsText = NULL;
|
||||
|
6
C/init.c
6
C/init.c
@ -165,8 +165,10 @@ The following is the list of the declarations of the predefined operators:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
:-op(1200,fx,['?-', ':-']).
|
||||
:-op(1200,xfx,[':-','-->']).
|
||||
:-op(1150,fx,[block,dynamic,mode,public,multifile,meta_predicate,
|
||||
sequential,table,initialization]).
|
||||
:-op(1150,fx,[block,
|
||||
discontiguous,dynamic,
|
||||
initialization,mode,multifile,meta_predicate,
|
||||
public,sequential,table]).
|
||||
:-op(1100,xfy,[';','|']).
|
||||
:-op(1050,xfy,->).
|
||||
:-op(1000,xfy,',').
|
||||
|
40
C/stack.c
40
C/stack.c
@ -73,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;
|
||||
@ -209,7 +209,7 @@ static PredEntry *PredForChoicePt(yamop *p_code, op_numbers *opn) {
|
||||
*
|
||||
* usually pretty straightforward, it can fall in trouble with
|
||||
8 OR-P or tabling.
|
||||
*/
|
||||
*/
|
||||
PredEntry *Yap_PredForChoicePt(choiceptr cp, op_numbers *op) {
|
||||
if (cp == NULL)
|
||||
return NULL;
|
||||
@ -538,7 +538,7 @@ static Int find_code_in_clause(PredEntry *pp, yamop *codeptr, void **startp,
|
||||
}
|
||||
|
||||
/*
|
||||
static bool put_clause_loc(yap_error_descriptor_t *t, void *clcode, PredEntry *pp) {
|
||||
static bool put_clause_loc(yap_error_descriptor_t *t, void *clcode, PredEntry *pp) {
|
||||
|
||||
CACHE_REGS
|
||||
if (pp->PredFlags & LogUpdatePredFlag) {
|
||||
@ -568,7 +568,7 @@ static bool put_clause_loc(yap_error_descriptor_t *t, void *clcode, PredEntry *p
|
||||
return MkIntTerm(0);
|
||||
}
|
||||
return MkIntTerm(0);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
static Term clause_loc(void *clcode, PredEntry *pp) {
|
||||
@ -1165,7 +1165,11 @@ yap_error_descriptor_t * set_clause_info(yap_error_descriptor_t *t, yamop *cod
|
||||
}
|
||||
return t;
|
||||
} else {
|
||||
return NULL;
|
||||
t->prologPredFirstLine = 0;
|
||||
t->prologPredLine = t->errorLine;
|
||||
t->prologPredLastLine = 0;
|
||||
t->prologPredFile = t->errorFile;
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1203,23 +1207,33 @@ yap_error_descriptor_t * Yap_prolog_add_culprit(yap_error_descriptor_t *t PASS_R
|
||||
} else {
|
||||
CELL *curENV = ENV;
|
||||
yamop *curCP = CP;
|
||||
choiceptr curB;
|
||||
PredEntry *pe = EnvPreg(curCP);
|
||||
|
||||
while (curCP != YESCODE) {
|
||||
while (curCP != YESCODE && curB) {
|
||||
if (curENV < (CELL *)curB) {
|
||||
pe = EnvPreg(curCP);
|
||||
curENV = (CELL *)(curENV[E_E]);
|
||||
if (curENV < ASP || curENV >= LCL0) {
|
||||
break;
|
||||
}
|
||||
pe = EnvPreg(curCP);
|
||||
curCP = (yamop *)curENV[E_CP];
|
||||
if (pe == NULL) {
|
||||
pe = PredMetaCall;
|
||||
}
|
||||
if (pe->ModuleOfPred)
|
||||
if (pe->ModuleOfPred || !(pe->PredFlags & HiddenPredFlag))
|
||||
return set_clause_info(t, curCP, pe);
|
||||
} else {
|
||||
pe = curB->cp_ap->y_u.Otapl.p;
|
||||
if (pe && (pe->ModuleOfPred || !(pe->PredFlags & HiddenPredFlag)))
|
||||
return set_clause_info(t, curB->cp_ap, pe);
|
||||
curB = curB->cp_b;
|
||||
}
|
||||
}
|
||||
curCP = (yamop *)(curENV[E_CP]);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Term all_calls(bool internal USES_REGS) {
|
||||
@ -2135,7 +2149,7 @@ yap_error_descriptor_t *Yap_env_add_location(yap_error_descriptor_t *t,void *cp0
|
||||
ignore_first--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Term Yap_env_location(yamop *cp, choiceptr b_ptr, CELL *env, Int ignore_first) {
|
||||
@ -2180,8 +2194,8 @@ static Int clause_location(USES_REGS1) {
|
||||
static Int ancestor_location(USES_REGS1) {
|
||||
yap_error_descriptor_t t;
|
||||
memset( &t, 0, sizeof(yap_error_descriptor_t));
|
||||
return
|
||||
Yap_unify(mkloc(Yap_env_add_location(&t,CP, B, ENV, 2)), ARG2) &&
|
||||
return
|
||||
Yap_unify(mkloc(Yap_env_add_location(&t,CP, B, ENV, 2)), ARG2) &&
|
||||
Yap_unify(mkloc(Yap_env_add_location(&t,CP, B, ENV, 3)), ARG2);
|
||||
|
||||
}
|
||||
|
@ -1756,7 +1756,7 @@ p_new_mutex(void)
|
||||
p_with_mutex( USES_REGS1 )
|
||||
{
|
||||
Int mut;
|
||||
Term t1 = Deref(ARG1), excep;
|
||||
Term t1 = Deref(ARG1);
|
||||
Int rc = FALSE;
|
||||
Int creeping = Yap_get_signal(YAP_CREEP_SIGNAL);
|
||||
PredEntry *pe;
|
||||
@ -1813,11 +1813,11 @@ p_new_mutex(void)
|
||||
}
|
||||
end:
|
||||
ARG1 = MkIntegerTerm(mut);
|
||||
excep = Yap_GetException();
|
||||
yap_error_descriptor_t *err = Yap_GetException();
|
||||
if (creeping) {
|
||||
Yap_signal( YAP_CREEP_SIGNAL );
|
||||
} else if ( excep != 0) {
|
||||
LOCAL_ActiveError->errorNo = IntegerOfTerm(excep);
|
||||
} else if ( err ) {
|
||||
LOCAL_ActiveError->errorNo = err->errorNo;
|
||||
return Yap_JumpToEnv();
|
||||
}
|
||||
return rc;
|
||||
|
@ -1258,6 +1258,8 @@ char *Yap_TermToBuffer(Term t, encoding_t enc, int flags) {
|
||||
|
||||
if (sno < 0)
|
||||
return NULL;
|
||||
if (t == 0)
|
||||
return NULL;
|
||||
if (enc)
|
||||
GLOBAL_Stream[sno].encoding = enc;
|
||||
else
|
||||
|
@ -203,10 +203,11 @@ static void consult(const char *b_file USES_REGS) {
|
||||
} else {
|
||||
YAP_CompileClause(t);
|
||||
}
|
||||
Term terr;
|
||||
Yap_PrintException();
|
||||
if ((terr = Yap_GetException()))
|
||||
fprintf(stderr,"Exception Found\n");
|
||||
yap_error_descriptor_t *errd;
|
||||
if ((errd = Yap_GetException())) {
|
||||
fprintf(stderr, "%s:%ld:0: Error %s %s Found\n", errd->errorFile, (long int) errd->errorLine, errd->classAsText,
|
||||
errd->errorAsText);
|
||||
}
|
||||
} while (t != TermEof);
|
||||
BACKUP_MACHINE_REGS();
|
||||
YAP_EndConsult(c_stream, &osno, full);
|
||||
|
@ -646,7 +646,6 @@ bool YAPQuery::next() {
|
||||
CACHE_REGS
|
||||
bool result = false;
|
||||
sigjmp_buf buf, *oldp = LOCAL_RestartEnv;
|
||||
Term terr;
|
||||
e = nullptr;
|
||||
BACKUP_MACHINE_REGS();
|
||||
if (!q_open)
|
||||
|
3
H/ATOMS
3
H/ATOMS
@ -171,6 +171,7 @@ A Full N "full"
|
||||
A Functor N "functor"
|
||||
A GT N ">"
|
||||
A GVar N "var"
|
||||
A g N "g"
|
||||
A Gc F "$gc"
|
||||
A GcMargin F "$gc_margin"
|
||||
A GcTrace F "$gc_trace"
|
||||
@ -429,6 +430,7 @@ A User N "user"
|
||||
A UserErr N "user_error"
|
||||
A UserIn N "user_input"
|
||||
A UserOut N "user_output"
|
||||
A UTF8 N "utf8"
|
||||
A DollarVar N "$VAR"
|
||||
A VBar N "|"
|
||||
A VarBranches N "var_branches"
|
||||
@ -504,6 +506,7 @@ F Dot9 Dot 9
|
||||
F DoubleArrow DoubleArrow 2
|
||||
F DoubleSlash DoubleSlash 2
|
||||
F EmptySquareBrackets EmptySquareBrackets 2
|
||||
F Encoding Encoding 1
|
||||
F Eq Eq 2
|
||||
F Error Error 2
|
||||
F EvaluationError EvaluationError 1
|
||||
|
@ -1615,7 +1615,7 @@ INLINE_ONLY inline EXTERN Term MkSysError(yap_error_descriptor_t *i) {
|
||||
Term et = MkAddressTerm(i);
|
||||
return Yap_MkApplTerm( FunctorException, 1, &et);
|
||||
}
|
||||
yap_error_descriptor_t *Yap_UserError( Term t, Term t1, yap_error_descriptor_t *i);
|
||||
yap_error_descriptor_t *Yap_UserError( Term t, yap_error_descriptor_t *i);
|
||||
|
||||
extern bool Yap_RaiseException(void);
|
||||
|
||||
|
@ -166,6 +166,7 @@
|
||||
AtomFunctor = Yap_LookupAtom("functor"); TermFunctor = MkAtomTerm(AtomFunctor);
|
||||
AtomGT = Yap_LookupAtom(">"); TermGT = MkAtomTerm(AtomGT);
|
||||
AtomGVar = Yap_LookupAtom("var"); TermGVar = MkAtomTerm(AtomGVar);
|
||||
Atomg = Yap_LookupAtom("g"); Termg = MkAtomTerm(Atomg);
|
||||
AtomGc = Yap_FullLookupAtom("$gc"); TermGc = MkAtomTerm(AtomGc);
|
||||
AtomGcMargin = Yap_FullLookupAtom("$gc_margin"); TermGcMargin = MkAtomTerm(AtomGcMargin);
|
||||
AtomGcTrace = Yap_FullLookupAtom("$gc_trace"); TermGcTrace = MkAtomTerm(AtomGcTrace);
|
||||
@ -424,6 +425,7 @@
|
||||
AtomUserErr = Yap_LookupAtom("user_error"); TermUserErr = MkAtomTerm(AtomUserErr);
|
||||
AtomUserIn = Yap_LookupAtom("user_input"); TermUserIn = MkAtomTerm(AtomUserIn);
|
||||
AtomUserOut = Yap_LookupAtom("user_output"); TermUserOut = MkAtomTerm(AtomUserOut);
|
||||
AtomUTF8 = Yap_LookupAtom("utf8"); TermUTF8 = MkAtomTerm(AtomUTF8);
|
||||
AtomDollarVar = Yap_LookupAtom("$VAR"); TermDollarVar = MkAtomTerm(AtomDollarVar);
|
||||
AtomVBar = Yap_LookupAtom("|"); TermVBar = MkAtomTerm(AtomVBar);
|
||||
AtomVarBranches = Yap_LookupAtom("var_branches"); TermVarBranches = MkAtomTerm(AtomVarBranches);
|
||||
@ -499,6 +501,7 @@
|
||||
FunctorDoubleArrow = Yap_MkFunctor(AtomDoubleArrow,2);
|
||||
FunctorDoubleSlash = Yap_MkFunctor(AtomDoubleSlash,2);
|
||||
FunctorEmptySquareBrackets = Yap_MkFunctor(AtomEmptySquareBrackets,2);
|
||||
FunctorEncoding = Yap_MkFunctor(AtomEncoding,1);
|
||||
FunctorEq = Yap_MkFunctor(AtomEq,2);
|
||||
FunctorError = Yap_MkFunctor(AtomError,2);
|
||||
FunctorEvaluationError = Yap_MkFunctor(AtomEvaluationError,1);
|
||||
|
@ -166,6 +166,7 @@
|
||||
AtomFunctor = AtomAdjust(AtomFunctor); TermFunctor = MkAtomTerm(AtomFunctor);
|
||||
AtomGT = AtomAdjust(AtomGT); TermGT = MkAtomTerm(AtomGT);
|
||||
AtomGVar = AtomAdjust(AtomGVar); TermGVar = MkAtomTerm(AtomGVar);
|
||||
Atomg = AtomAdjust(Atomg); Termg = MkAtomTerm(Atomg);
|
||||
AtomGc = AtomAdjust(AtomGc); TermGc = MkAtomTerm(AtomGc);
|
||||
AtomGcMargin = AtomAdjust(AtomGcMargin); TermGcMargin = MkAtomTerm(AtomGcMargin);
|
||||
AtomGcTrace = AtomAdjust(AtomGcTrace); TermGcTrace = MkAtomTerm(AtomGcTrace);
|
||||
@ -424,6 +425,7 @@
|
||||
AtomUserErr = AtomAdjust(AtomUserErr); TermUserErr = MkAtomTerm(AtomUserErr);
|
||||
AtomUserIn = AtomAdjust(AtomUserIn); TermUserIn = MkAtomTerm(AtomUserIn);
|
||||
AtomUserOut = AtomAdjust(AtomUserOut); TermUserOut = MkAtomTerm(AtomUserOut);
|
||||
AtomUTF8 = AtomAdjust(AtomUTF8); TermUTF8 = MkAtomTerm(AtomUTF8);
|
||||
AtomDollarVar = AtomAdjust(AtomDollarVar); TermDollarVar = MkAtomTerm(AtomDollarVar);
|
||||
AtomVBar = AtomAdjust(AtomVBar); TermVBar = MkAtomTerm(AtomVBar);
|
||||
AtomVarBranches = AtomAdjust(AtomVarBranches); TermVarBranches = MkAtomTerm(AtomVarBranches);
|
||||
@ -499,6 +501,7 @@
|
||||
FunctorDoubleArrow = FuncAdjust(FunctorDoubleArrow);
|
||||
FunctorDoubleSlash = FuncAdjust(FunctorDoubleSlash);
|
||||
FunctorEmptySquareBrackets = FuncAdjust(FunctorEmptySquareBrackets);
|
||||
FunctorEncoding = FuncAdjust(FunctorEncoding);
|
||||
FunctorEq = FuncAdjust(FunctorEq);
|
||||
FunctorError = FuncAdjust(FunctorError);
|
||||
FunctorEvaluationError = FuncAdjust(FunctorEvaluationError);
|
||||
|
@ -166,6 +166,7 @@ X_API EXTERNAL Atom AtomFull; X_API EXTERNAL Term TermFull;
|
||||
X_API EXTERNAL Atom AtomFunctor; X_API EXTERNAL Term TermFunctor;
|
||||
X_API EXTERNAL Atom AtomGT; X_API EXTERNAL Term TermGT;
|
||||
X_API EXTERNAL Atom AtomGVar; X_API EXTERNAL Term TermGVar;
|
||||
X_API EXTERNAL Atom Atomg; X_API EXTERNAL Term Termg;
|
||||
X_API EXTERNAL Atom AtomGc; X_API EXTERNAL Term TermGc;
|
||||
X_API EXTERNAL Atom AtomGcMargin; X_API EXTERNAL Term TermGcMargin;
|
||||
X_API EXTERNAL Atom AtomGcTrace; X_API EXTERNAL Term TermGcTrace;
|
||||
@ -424,6 +425,7 @@ X_API EXTERNAL Atom AtomUser; X_API EXTERNAL Term TermUser;
|
||||
X_API EXTERNAL Atom AtomUserErr; X_API EXTERNAL Term TermUserErr;
|
||||
X_API EXTERNAL Atom AtomUserIn; X_API EXTERNAL Term TermUserIn;
|
||||
X_API EXTERNAL Atom AtomUserOut; X_API EXTERNAL Term TermUserOut;
|
||||
X_API EXTERNAL Atom AtomUTF8; X_API EXTERNAL Term TermUTF8;
|
||||
X_API EXTERNAL Atom AtomDollarVar; X_API EXTERNAL Term TermDollarVar;
|
||||
X_API EXTERNAL Atom AtomVBar; X_API EXTERNAL Term TermVBar;
|
||||
X_API EXTERNAL Atom AtomVarBranches; X_API EXTERNAL Term TermVarBranches;
|
||||
@ -556,6 +558,8 @@ X_API EXTERNAL Functor FunctorDoubleSlash;
|
||||
|
||||
X_API EXTERNAL Functor FunctorEmptySquareBrackets;
|
||||
|
||||
X_API EXTERNAL Functor FunctorEncoding;
|
||||
|
||||
X_API EXTERNAL Functor FunctorEq;
|
||||
|
||||
X_API EXTERNAL Functor FunctorError;
|
||||
|
@ -415,6 +415,7 @@ A User N "user"
|
||||
A UserErr N "user_error"
|
||||
A UserIn N "user_input"
|
||||
A UserOut N "user_output"
|
||||
A UTF8 N "utf8"
|
||||
A DollarVar N "$VAR"
|
||||
A VBar N "|"
|
||||
A VarBranches N "var_branches"
|
||||
@ -490,6 +491,7 @@ F Dot9 Dot 9
|
||||
F DoubleSlash DoubleSlash 2
|
||||
F EmptySquareBrackets EmptySquareBrackets 2
|
||||
F EmptyCurlyBrackets EmptyCurlyBrackets 2
|
||||
F Encoding Encoding 1
|
||||
F Eq Eq 2
|
||||
F Error Error 2
|
||||
F EvaluationError EvaluationError 1
|
||||
|
@ -63,12 +63,12 @@ system_error(Type,Goal) :-
|
||||
|
||||
|
||||
'$do_error'(Type,Goal) :-
|
||||
throw(error(Type, [error(Goal)])).
|
||||
throw(error(Type, [[g|g(Goal)]])).
|
||||
|
||||
/**
|
||||
* @pred system_error( +Error, +Cause, +Culprit)
|
||||
*
|
||||
* Generate a system error _Error_, informing the source goal _Cause_ and a possible _Culprit_.
|
||||
* Generate a system error _Error_, informing the source goal _Cause_
|
||||
*
|
||||
*
|
||||
* ~~~~~~~~~~
|
||||
@ -76,9 +76,8 @@ system_error(Type,Goal) :-
|
||||
*
|
||||
*
|
||||
*/
|
||||
system_error(Type,Goal,Culprit) :-
|
||||
ancestor_location(Goal, Culprit),
|
||||
throw(error(Type, [error(Goal, Culprit)])).
|
||||
system_error(Type,Goal) :-
|
||||
hrow(error(Type, [[g|g(Goal)]])).
|
||||
|
||||
'$do_pi_error'(type_error(callable,Name/0),Message) :- !,
|
||||
'$do_error'(type_error(callable,Name),Message).
|
||||
@ -132,7 +131,7 @@ system_error(Type,Goal,Culprit) :-
|
||||
functor(Error, Severity, _),
|
||||
print_message(Severity, Error), !.
|
||||
%'$process_error'(error(Msg, Where), _) :-
|
||||
% Print_message(error,error(Msg, [g|Where])), !.
|
||||
% Print_message(error,error(Msg, [g|fWhere])), !.
|
||||
'$process_error'(Throw, _) :-
|
||||
print_message(error,error(unhandled_exception,Throw)).
|
||||
|
||||
|
@ -213,7 +213,7 @@ compose_message( loaded(included,AbsFileName,Mod,Time,Space), _Level) --> !,
|
||||
compose_message( loaded(What,AbsoluteFileName,Mod,Time,Space), _Level) --> !,
|
||||
[ '~a ~a in module ~a, ~d msec ~d bytes' -
|
||||
[What, AbsoluteFileName,Mod,Time,Space] ].
|
||||
compose_message(error(signal(SIG,_), _), _) -->
|
||||
compose_message(signal(SIG,_), _) -->
|
||||
!,
|
||||
[ 'UNEXPECTED SIGNAL: ~a' - [SIG] ].
|
||||
compose_message(trace_command(C), _Leve) -->
|
||||
@ -232,21 +232,18 @@ compose_message(yes, _Level) --> !,
|
||||
[ 'yes'- [] ].
|
||||
compose_message(error(E, exception(Exc)), Level) -->
|
||||
{ '$show_consult_level'(LC) },
|
||||
location( Exc, Level, LC),
|
||||
main_message( Exc, Level, LC ),
|
||||
location(error(E, exception(Exc)), Level, LC),
|
||||
main_message(error(E, exception(Exc)) , Level, LC ),
|
||||
c_goal( Exc, Level ),
|
||||
caller( Exc, Level ),
|
||||
extra_info( Exc, Level ),
|
||||
!,
|
||||
[nl,nl].
|
||||
compose_message(error(E,[I|Is]), Level) -->
|
||||
{ Level == error -> true ; Level == warning },
|
||||
{ '$show_consult_level'(LC),
|
||||
translate_info([I|Is], In))
|
||||
},
|
||||
compose_message( e(Err, In), Level),
|
||||
compose_message(error(E,[I|Is]), Level) -->
|
||||
{ translate_info([I|Is], In) },
|
||||
compose_message( e(E, In), Level),
|
||||
[nl,nl].
|
||||
compose_message(Throw), _Leve) -->
|
||||
compose_message(Throw, _Leve) -->
|
||||
!,
|
||||
[ 'UNHANDLED EXCEPTION - message ~w unknown' - [Throw] ].
|
||||
|
||||
@ -254,7 +251,7 @@ translate_info([I1|I2],exception(R) ) :-
|
||||
!,
|
||||
'$new_exception'(R),
|
||||
tinfo(R, [I1|I2], []).
|
||||
translate_info(E, none ).
|
||||
translate_info(_E, none ).
|
||||
|
||||
tinfo(_Reg) -->
|
||||
!.
|
||||
@ -263,7 +260,12 @@ tinfo(Reg) -->
|
||||
tinfo(Reg).
|
||||
|
||||
addinfo( Desc) -->
|
||||
( [[p|p(M,Na,Ar,File,FilePos)]]
|
||||
( ;
|
||||
[[p]]
|
||||
->
|
||||
[]
|
||||
;
|
||||
[[p|p(M,Na,Ar,File,FilePos)]]
|
||||
->
|
||||
{
|
||||
'$query_exception'(prologPredFile, Desc, File),
|
||||
@ -273,7 +275,11 @@ addinfo( Desc) -->
|
||||
'$query_exception'(prologPredArity, Desc, Ar)
|
||||
}
|
||||
;
|
||||
[e|p(M,Na,Ar,File,FilePos)], Desc)
|
||||
[[e]]
|
||||
->
|
||||
[]
|
||||
;
|
||||
[[e|p(M,Na,Ar,File,FilePos)]]
|
||||
->
|
||||
{
|
||||
'$query_exception'(prologPredFile, Desc, File),
|
||||
@ -291,11 +297,15 @@ addinfo( Desc) -->
|
||||
'$query_exception'(errorLine, Desc, Line)
|
||||
}
|
||||
;
|
||||
[[g|g(Call)]
|
||||
[[g|g(Call)]]
|
||||
->
|
||||
{
|
||||
'$query_exception'(errorGoal, Desc, Call)
|
||||
}
|
||||
;
|
||||
[[h|p(M,Na,Ar,File,FilePos)g)](_)]]
|
||||
->
|
||||
[]
|
||||
).
|
||||
|
||||
|
||||
@ -306,16 +316,6 @@ location(error(syntax_error(_),info(between(_,LN,_), FileName, _ChrPos, _Err)),
|
||||
location(error(style_check(style_check(_,LN,FileName,_ ) ),_), _ , _) -->
|
||||
!,
|
||||
[ '~a:~d:0 ' - [FileName,LN] ] .
|
||||
location( error(_,exception(Desc)), Level, LC ) -->
|
||||
{ source_location(F0, L),
|
||||
stream_property(_Stream, alias(loop_stream)),
|
||||
!,
|
||||
'$query_exception'(prologPredModule, Desc, M),
|
||||
'$query_exception'(prologPredName, Desc, Na),
|
||||
'$query_exception'(prologPredArity, Desc, Ar)
|
||||
},
|
||||
display_consulting( F0, Level, LC ),
|
||||
[ '~a:~d:0 ~a in ~a:~q/~d:'-[F0, L,Level,M,Na,Ar] ].
|
||||
location( error(_,exception(Desc)), Level, LC ) -->
|
||||
{ '$query_exception'(prologPredFile, Desc, File),
|
||||
'$query_exception'(prologPredLine, Desc, FilePos),
|
||||
@ -324,7 +324,7 @@ location( error(_,exception(Desc)), Level, LC ) -->
|
||||
'$query_exception'(prologPredArity, Desc, Ar)
|
||||
},
|
||||
display_consulting( File, Level, LC ),
|
||||
[ '~a:~d:0 ~a in ~a:~q/~d:'-[File, FilePos,Level,M,Na,Ar] ].
|
||||
[ '~s:~d:0 ~a in ~s:~s/~d:'-[File, FilePos,Level,M,Na,Ar] ].
|
||||
|
||||
%message(loaded(Past,AbsoluteFileName,user,Msec,Bytes), Prefix, Suffix) :- !,
|
||||
main_message(error(Msg,In), _, _) --> {var(In)}, !,
|
||||
@ -806,8 +806,8 @@ print_lines( S, Prefixes, Key) -->
|
||||
!,
|
||||
{ nl(S),
|
||||
Prefixes = [PrefixS - Cmds|More],
|
||||
format(S, PrefixS, Cmds)
|
||||
},
|
||||
format(S, PrefixS, []Cmds)
|
||||
}
|
||||
{
|
||||
More == []
|
||||
->
|
||||
|
@ -32,8 +32,6 @@
|
||||
]
|
||||
).
|
||||
|
||||
:- op(1150, fx, [multifile,discontiguous]).
|
||||
|
||||
'$log_upd'(1).
|
||||
|
||||
/**
|
||||
|
@ -212,10 +212,10 @@
|
||||
( exists('~/.prologrc') -> [-'~/.prologrc'] ; true ),
|
||||
( exists('~/prolog.ini') -> [-'~/prolog.ini'] ; true ))).
|
||||
% die on signal default. %
|
||||
'$signal_def'(sig_usr1, throw(error(signal(usr1,[]),true))).
|
||||
'$signal_def'(sig_usr2, throw(error(signal(usr2,[]),true))).
|
||||
'$signal_def'(sig_pipe, throw(error(signal(pipe,[]),true))).
|
||||
'$signal_def'(sig_fpe, throw(error(signal(fpe,[]),true))).
|
||||
'$signal_def'(sig_usr1, throw(signal(usr1,[]))).
|
||||
'$signal_def'(sig_usr2, throw(signal(usr2,[]))).
|
||||
'$signal_def'(sig_pipe, throw(signal(pipe,[]))).
|
||||
'$signal_def'(sig_fpe, throw(signal(fpe,[]))).
|
||||
% ignore sig_alarm by default %
|
||||
'$signal_def'(sig_alarm, true).
|
||||
|
||||
|
Reference in New Issue
Block a user