error handling
This commit is contained in:
parent
53de04c38f
commit
71aed8b870
34
C/errors.c
34
C/errors.c
@ -90,21 +90,23 @@ static bool setErr(const char *q, yap_error_descriptor_t *i, Term t) {
|
||||
return i->k ? TermTrue : TermFalse; \
|
||||
}
|
||||
|
||||
#define query_key_i(k, ks, q, i) \
|
||||
if (strcmp(ks, q) == 0) { \
|
||||
#define query_key_i(k, ks, q, i) 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) : TermNil); \
|
||||
}
|
||||
return MkAtomTerm(Yap_LookupAtom(i->k)); }
|
||||
|
||||
#define query_key_t(k, ks, q, i) \
|
||||
if (strcmp(ks, q) == 0) { \
|
||||
Term t; if((t = Yap_BufferToTerm(i->k, TermNil) ) == 0 ) return TermNil; return t; }
|
||||
|
||||
static Term queryErr(const char *q, yap_error_descriptor_t *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_t(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);
|
||||
@ -123,7 +125,7 @@ static Term queryErr(const char *q, yap_error_descriptor_t *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_t(culprit, "culprit", q, i);
|
||||
query_key_s(errorMsg, "errorMsg", q, i);
|
||||
query_key_i(errorMsgLen, "errorMsgLen", q, i);
|
||||
return TermNil;
|
||||
@ -581,23 +583,17 @@ bool Yap_pushErrorContext(bool pass, yap_error_descriptor_t *new_error) {
|
||||
/* if (Yap_HasException()) */
|
||||
/* memset(LOCAL_ActiveError, 0, sizeof(*LOCAL_ActiveError)); */
|
||||
/* LOCAL_ActiveError->top_error = bf; */
|
||||
|
||||
/* } */
|
||||
yap_error_descriptor_t *Yap_popErrorContext(bool mdnew, bool pass) {
|
||||
yap_error_descriptor_t *e = LOCAL_ActiveError;
|
||||
yap_error_descriptor_t *e = LOCAL_ActiveError, *ep = LOCAL_ActiveError->top_error;
|
||||
// last block
|
||||
LOCAL_ActiveError = e->top_error;
|
||||
if (e->errorNo) {
|
||||
if (!LOCAL_ActiveError->errorNo && pass) {
|
||||
memmove(LOCAL_ActiveError, e, sizeof(*LOCAL_ActiveError));
|
||||
} else {
|
||||
return e;
|
||||
LOCAL_ActiveError = ep;
|
||||
if (e->errorNo && !ep->errorNo && pass) {
|
||||
yap_error_descriptor_t *epp = ep->top_error;
|
||||
memmove(ep, e, sizeof(*e));
|
||||
ep->top_error = epp;
|
||||
}
|
||||
} else {
|
||||
if (e->errorNo)
|
||||
return e;
|
||||
}
|
||||
return NULL;
|
||||
return LOCAL_ActiveError;
|
||||
}
|
||||
/**
|
||||
* Throw an error directly to the error handler
|
||||
|
140
os/readterm.c
140
os/readterm.c
@ -110,11 +110,11 @@ static void clean_vars(VarEntry *p) {
|
||||
#ifdef O_QUASIQUOTATIONS
|
||||
/** '$qq_open'(+QQRange, -Stream) is det.
|
||||
|
||||
Opens a quasi-quoted memory range.
|
||||
Opens a quasi-quoted memory range.
|
||||
|
||||
@arg QQRange is a term '$quasi_quotation'(ReadData, Start, Length)
|
||||
@arg Stream is a UTF-8 encoded string, whose position indication
|
||||
reflects the location in the real file.
|
||||
@arg QQRange is a term '$quasi_quotation'(ReadData, Start, Length)
|
||||
@arg Stream is a UTF-8 encoded string, whose position indication
|
||||
reflects the location in the real file.
|
||||
*/
|
||||
|
||||
static Int qq_open(USES_REGS1) {
|
||||
@ -284,17 +284,17 @@ static Term scanToList(TokEntry *tok, TokEntry *errtok) {
|
||||
}
|
||||
|
||||
/**
|
||||
@pred scan_to_list( +Stream, -Tokens )
|
||||
Generate a list of tokens from a scan of the (input) stream, Tokens are of the
|
||||
form:
|
||||
@pred scan_to_list( +Stream, -Tokens )
|
||||
Generate a list of tokens from a scan of the (input) stream, Tokens are of the
|
||||
form:
|
||||
|
||||
+ `atom`(Atom)
|
||||
+ `<QQ>`(Text)
|
||||
+ `number`(Number)
|
||||
+ `var`(VarName)
|
||||
+ `string`(String)
|
||||
+ 'EOF''
|
||||
+ symbols, including `(`, `)`, `,`, `;`
|
||||
+ `atom`(Atom)
|
||||
+ `<QQ>`(Text)
|
||||
+ `number`(Number)
|
||||
+ `var`(VarName)
|
||||
+ `string`(String)
|
||||
+ 'EOF''
|
||||
+ symbols, including `(`, `)`, `,`, `;`
|
||||
|
||||
*/
|
||||
static Int scan_to_list(USES_REGS1) {
|
||||
@ -1008,7 +1008,6 @@ Term Yap_read_term(int sno, Term opts, bool clause) {
|
||||
#endif
|
||||
|
||||
yap_error_descriptor_t *new = malloc(sizeof *new);
|
||||
|
||||
bool err = Yap_pushErrorContext(true, new);
|
||||
int lvl = push_text_stack();
|
||||
parser_state_t state = YAP_START_PARSING;
|
||||
@ -1051,9 +1050,6 @@ Term Yap_read_term(int sno, Term opts, bool clause) {
|
||||
#endif /* EMACS */
|
||||
pop_text_stack(lvl);
|
||||
Yap_popErrorContext(err, true);
|
||||
if (LOCAL_Error_TYPE != YAP_NO_ERROR) {
|
||||
Yap_Error(LOCAL_Error_TYPE, Yap_MkStream(sno), LOCAL_ErrorMessage);
|
||||
}
|
||||
return fe.t;
|
||||
}
|
||||
}
|
||||
@ -1064,7 +1060,7 @@ Term Yap_read_term(int sno, Term opts, bool clause) {
|
||||
}
|
||||
|
||||
static Int
|
||||
read_term2(USES_REGS1) { /* '$read'(+Flag,?Term,?Module,?Vars,-Pos,-Err) */
|
||||
read_term2(USES_REGS1) { /* '$read'(+Flag,?Term,?Module,?Vars,-Pos,-Err) */
|
||||
return Yap_read_term(LOCAL_c_input_stream, add_output(ARG1, ARG2), false) !=
|
||||
0;
|
||||
}
|
||||
@ -1261,9 +1257,9 @@ static Int start_mega(USES_REGS1) {
|
||||
} else if (IsAtomOrIntTerm(t=*tp)) {
|
||||
(IsAtom(tok->Tokt)||IsIntTerm(XREGS+(i+1)))extra[arity]
|
||||
]
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
/**
|
||||
* @pred source_location( - _File_ , _Line_ )
|
||||
*
|
||||
* unify _File_ and _Line_ wuth the position of the last term read, if the
|
||||
@ -1280,12 +1276,12 @@ static Int start_mega(USES_REGS1) {
|
||||
*
|
||||
* @note SWI-Prolog built-in.
|
||||
*/
|
||||
static Int source_location(USES_REGS1) {
|
||||
static Int source_location(USES_REGS1) {
|
||||
return Yap_unify(ARG1, MkAtomTerm(LOCAL_SourceFileName)) &&
|
||||
Yap_unify(ARG2, MkIntegerTerm(LOCAL_SourceFileLineno));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @pred read(+ Stream, -Term ) is iso
|
||||
*
|
||||
* Reads term _T_ from the stream _S_ instead of from the current input
|
||||
@ -1295,7 +1291,7 @@ static Int source_location(USES_REGS1) {
|
||||
* @param - _Term_
|
||||
*
|
||||
*/
|
||||
static Int read2(
|
||||
static Int read2(
|
||||
USES_REGS1) { /* '$read2'(+Flag,?Term,?Module,?Vars,-Pos,-Err,+Stream) */
|
||||
int sno;
|
||||
Int out;
|
||||
@ -1308,35 +1304,35 @@ static Int read2(
|
||||
out = Yap_read_term(sno, add_output(ARG2, TermNil), false);
|
||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
/** @pred read(- T) is iso
|
||||
/** @pred read(- T) is iso
|
||||
|
||||
Reads the next term from the current input stream, and unifies it with
|
||||
_T_. The term must be followed by a dot (`.`) and any blank-character
|
||||
as previously defined. The syntax of the term must match the current
|
||||
declarations for operators (see op). If the end-of-stream is reached,
|
||||
_T_ is unified with the atom `end_of_file`. Further reads from of
|
||||
the same stream may cause an error failure (see open/3).
|
||||
Reads the next term from the current input stream, and unifies it with
|
||||
_T_. The term must be followed by a dot (`.`) and any blank-character
|
||||
as previously defined. The syntax of the term must match the current
|
||||
declarations for operators (see op). If the end-of-stream is reached,
|
||||
_T_ is unified with the atom `end_of_file`. Further reads from of
|
||||
the same stream may cause an error failure (see open/3).
|
||||
|
||||
*/
|
||||
static Int read1(
|
||||
*/
|
||||
static Int read1(
|
||||
USES_REGS1) { /* '$read2'(+Flag,?Term,?Module,?Vars,-Pos,-Err,+Stream) */
|
||||
Term out = Yap_read_term(LOCAL_c_input_stream, add_output(ARG1, TermNil), 1);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
/** @pred fileerrors
|
||||
/** @pred fileerrors
|
||||
|
||||
Switches on the file_errors flag so that in certain error conditions
|
||||
Input/Output predicates will produce an appropriated message and abort.
|
||||
Switches on the file_errors flag so that in certain error conditions
|
||||
Input/Output predicates will produce an appropriated message and abort.
|
||||
|
||||
*/
|
||||
static Int fileerrors(USES_REGS1) {
|
||||
*/
|
||||
static Int fileerrors(USES_REGS1) {
|
||||
return setYapFlag(TermFileErrors, TermTrue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
@pred nofileerrors
|
||||
|
||||
Switches off the `file_errors` flag, so that the predicates see/1,
|
||||
@ -1344,13 +1340,13 @@ static Int fileerrors(USES_REGS1) {
|
||||
an error message and aborting whenever the specified file cannot be
|
||||
opened or closed.
|
||||
|
||||
*/
|
||||
static Int nofileerrors(
|
||||
*/
|
||||
static Int nofileerrors(
|
||||
USES_REGS1) { /* '$read2'(+Flag,?Term,?Module,?Vars,-Pos,-Err,+Stream) */
|
||||
return setYapFlag(TermFileerrors, TermFalse);
|
||||
}
|
||||
}
|
||||
|
||||
static Int style_checker(USES_REGS1) {
|
||||
static Int style_checker(USES_REGS1) {
|
||||
Term t = Deref(ARG1);
|
||||
|
||||
if (IsVarTerm(t)) {
|
||||
@ -1392,9 +1388,9 @@ static Int style_checker(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
Term Yap_BufferToTerm(const char *s, Term opts) {
|
||||
Term Yap_BufferToTerm(const char *s, Term opts) {
|
||||
Term rval;
|
||||
int sno;
|
||||
encoding_t l = ENC_ISO_UTF8;
|
||||
@ -1405,9 +1401,9 @@ Term Yap_BufferToTerm(const char *s, Term opts) {
|
||||
rval = Yap_read_term(sno, opts, false);
|
||||
Yap_CloseStream(sno);
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
|
||||
Term Yap_UBufferToTerm(const unsigned char *s, Term opts) {
|
||||
Term Yap_UBufferToTerm(const unsigned char *s, Term opts) {
|
||||
Term rval;
|
||||
int sno;
|
||||
encoding_t l = ENC_ISO_UTF8;
|
||||
@ -1417,9 +1413,9 @@ Term Yap_UBufferToTerm(const unsigned char *s, Term opts) {
|
||||
rval = Yap_read_term(sno, opts, false);
|
||||
Yap_CloseStream(sno);
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
|
||||
X_API Term Yap_BufferToTermWithPrioBindings(const char *s, Term opts,
|
||||
X_API Term Yap_BufferToTermWithPrioBindings(const char *s, Term opts,
|
||||
Term bindings, size_t len,
|
||||
int prio) {
|
||||
CACHE_REGS
|
||||
@ -1433,9 +1429,9 @@ X_API Term Yap_BufferToTermWithPrioBindings(const char *s, Term opts,
|
||||
ctl = add_priority(bindings, ctl);
|
||||
}
|
||||
return Yap_BufferToTerm(s, ctl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @pred read_term_from_atom( +Atom , -T , +Options )
|
||||
*
|
||||
* read a term _T_ stored in constant _Atom_ according to _Options_
|
||||
@ -1451,7 +1447,7 @@ X_API Term Yap_BufferToTermWithPrioBindings(const char *s, Term opts,
|
||||
*supposed to
|
||||
* use YAP's internal encoding, so please avoid the encoding/1 option.
|
||||
*/
|
||||
static Int read_term_from_atom(USES_REGS1) {
|
||||
static Int read_term_from_atom(USES_REGS1) {
|
||||
Term t1 = Deref(ARG1);
|
||||
Atom at;
|
||||
const unsigned char *s;
|
||||
@ -1469,9 +1465,9 @@ static Int read_term_from_atom(USES_REGS1) {
|
||||
Term ctl = add_output(ARG2, ARG3);
|
||||
|
||||
return Yap_UBufferToTerm(s, ctl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @pred read_term_from_atomic( +Atomic , - T , +Options )
|
||||
*
|
||||
* read a term _T_ stored in text _Atomic_ according to _Options_
|
||||
@ -1486,7 +1482,7 @@ static Int read_term_from_atom(USES_REGS1) {
|
||||
*atom.
|
||||
* Encoding is fixed in atoms and strings.
|
||||
*/
|
||||
static Int read_term_from_atomic(USES_REGS1) {
|
||||
static Int read_term_from_atomic(USES_REGS1) {
|
||||
Term t1 = Deref(ARG1);
|
||||
const unsigned char *s;
|
||||
|
||||
@ -1503,9 +1499,9 @@ static Int read_term_from_atomic(USES_REGS1) {
|
||||
Term ctl = add_output(ARG2, ARG3);
|
||||
|
||||
return Yap_UBufferToTerm(s, ctl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @pred read_term_from_string( +String , - T , + Options )
|
||||
*
|
||||
* read a term _T_ stored in constant _String_ according to _Options_
|
||||
@ -1517,10 +1513,11 @@ static Int read_term_from_atomic(USES_REGS1) {
|
||||
* Idea from SWI-Prolog, in YAP only works with strings
|
||||
* Check read_term_from_atomic/3 for the general version.
|
||||
*/
|
||||
static Int read_term_from_string(USES_REGS1) {
|
||||
static Int read_term_from_string(USES_REGS1) {
|
||||
Term t1 = Deref(ARG1), rc;
|
||||
const unsigned char *s;
|
||||
size_t len;
|
||||
BACKUP_H()
|
||||
if (IsVarTerm(t1)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, t1, "read_term_from_string/3");
|
||||
return (FALSE);
|
||||
@ -1537,21 +1534,22 @@ static Int read_term_from_string(USES_REGS1) {
|
||||
GLOBAL_Stream[sno].status |= CloseOnException_Stream_f;
|
||||
rc = Yap_read_term(sno, Deref(ARG3), 3);
|
||||
Yap_CloseStream(sno);
|
||||
RECOVER_H();
|
||||
if (!rc)
|
||||
return false;
|
||||
return Yap_unify(rc, ARG2);
|
||||
}
|
||||
}
|
||||
|
||||
static Int atomic_to_term(USES_REGS1) {
|
||||
static Int atomic_to_term(USES_REGS1) {
|
||||
Term t1 = Deref(ARG1);
|
||||
int l = push_text_stack();
|
||||
const unsigned char *s = Yap_TextToUTF8Buffer(t1 PASS_REGS);
|
||||
Int rc = Yap_UBufferToTerm(s, add_output(ARG2, add_names(ARG3, TermNil)));
|
||||
pop_text_stack(l);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
static Int atom_to_term(USES_REGS1) {
|
||||
static Int atom_to_term(USES_REGS1) {
|
||||
Term t1 = Deref(ARG1);
|
||||
if (IsVarTerm(t1)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, t1, "read_term_from_string/3");
|
||||
@ -1564,9 +1562,9 @@ static Int atom_to_term(USES_REGS1) {
|
||||
const unsigned char *us = UStringOfTerm(t);
|
||||
return Yap_UBufferToTerm(us, add_output(ARG2, add_names(ARG3, TermNil)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Int string_to_term(USES_REGS1) {
|
||||
static Int string_to_term(USES_REGS1) {
|
||||
Term t1 = Deref(ARG1);
|
||||
|
||||
if (IsVarTerm(t1)) {
|
||||
@ -1579,9 +1577,9 @@ static Int string_to_term(USES_REGS1) {
|
||||
const unsigned char *us = UStringOfTerm(t1);
|
||||
return Yap_UBufferToTerm(us, add_output(ARG2, add_names(ARG3, TermNil)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Yap_InitReadTPreds(void) {
|
||||
void Yap_InitReadTPreds(void) {
|
||||
Yap_InitCPred("read_term", 2, read_term2, SyncPredFlag);
|
||||
Yap_InitCPred("read_term", 3, read_term, SyncPredFlag);
|
||||
|
||||
@ -1602,4 +1600,4 @@ void Yap_InitReadTPreds(void) {
|
||||
Yap_InitCPred("source_location", 2, source_location, SyncPredFlag);
|
||||
Yap_InitCPred("$style_checker", 1, style_checker,
|
||||
SyncPredFlag | HiddenPredFlag);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ add_definitions(-DSQLITE_ENABLE_JSON1=1 )
|
||||
add_definitions(-DSQLITE_ENABLE_RBU=1 )
|
||||
|
||||
add_definitions(-DSQLITE_ENABLE_RTREE=1 )
|
||||
|
||||
add_definitions(-DSQLITE_ENABLE_FTS5=1 )
|
||||
|
||||
SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS YAP_KERNEL=1 )
|
||||
@ -47,6 +46,8 @@ else()
|
||||
add_library( YAPsqlite3 SHARED
|
||||
${YAPSQLITE3_SOURCES})
|
||||
|
||||
target_link_libraries(YAPsqlite3 libYap )
|
||||
|
||||
set_target_properties(YAPsqlite3
|
||||
PROPERTIES
|
||||
# RPATH ${libdir} VERSION ${LIBYAPTAI_FULL_VERSION}
|
||||
|
@ -198,8 +198,7 @@ compose_message( halt, _Level) --> !,
|
||||
|
||||
% syntax error.
|
||||
compose_message(error(E, Exc), Level) -->
|
||||
{ '$show_consult_level'(LC), '$print_exception'(Exc)
|
||||
},
|
||||
{ '$show_consult_level'(LC) },
|
||||
location(error(E, Exc), Level, LC),
|
||||
main_message(error(E,Exc) , Level, LC ),
|
||||
c_goal( error(E, Exc), Level ),
|
||||
@ -257,6 +256,7 @@ location(style_check(A,LN,FileName,B ), Level , LC) -->
|
||||
display_consulting( FileName, Level,style_check(A,LN,FileName,B ), LC ),
|
||||
[ '~a:~d:0 ~a ' - [FileName,LN,Level] ] .
|
||||
location( error(_,Info), Level, LC ) -->
|
||||
|
||||
{ '$error_descriptor'(Info, Desc) },
|
||||
{
|
||||
'$query_exception'(prologPredFile, Desc, File),
|
||||
@ -267,19 +267,7 @@ location( error(_,Info), Level, LC ) -->
|
||||
},
|
||||
!,
|
||||
display_consulting( File, Level, Info, LC ),
|
||||
[ '~s:~d:0 ~a in ~s:~s/~d:'-[File, FilePos,Level,M,Na,Ar] ].
|
||||
location( error(_,Info), Level, LC ) -->
|
||||
{ '$error_descriptor'(Info, Desc) },
|
||||
{
|
||||
'$query_exception'(prologPredFile, Desc, File),
|
||||
'$query_exception'(prologPredLine, Desc, FilePos),
|
||||
'$query_exception'(prologPredModule, Desc, M),
|
||||
'$query_exception'(prologPredName, Desc, Na),
|
||||
'$query_exception'(prologPredArity, Desc, Ar)
|
||||
},
|
||||
!,
|
||||
display_consulting( File, Level, Info, LC ),
|
||||
[ '~s:~d:0 ~a in ~s:~s/~d:'-[File, FilePos,Level,M,Na,Ar] ].
|
||||
[ '~a:~d:0 ~a in ~a:~a/~d:'-[File, FilePos,Level,M,Na,Ar] ].
|
||||
location( error(_,Info), Level, LC ) -->
|
||||
{ '$error_descriptor'(Info, Desc) },
|
||||
{
|
||||
@ -289,7 +277,7 @@ location( error(_,Info), Level, LC ) -->
|
||||
},
|
||||
!,
|
||||
display_consulting( File, Level, Info, LC ),
|
||||
[ '~s:~d:0 ~a in ~s():'-[File, FilePos,Level,F] ].
|
||||
[ '~a:~d:0 ~a in ~a():'-[File, FilePos,Level,F] ].
|
||||
location( _Ball, _Level, _LC ) --> [].
|
||||
|
||||
|
||||
@ -393,7 +381,7 @@ caller( Info, _) -->
|
||||
},
|
||||
!,
|
||||
[nl],
|
||||
['~*| raised from ~a:~q:~d, ~a:~d:0: '-[10,M,Na,Ar,File, FilePos]],
|
||||
['~*| ~q:~d:0 ~a:~q'-[10,File, FilePos,M,Na,Ar]],
|
||||
[nl].
|
||||
caller( _, _) -->
|
||||
[].
|
||||
@ -982,8 +970,9 @@ confusing to YAP (who will process the error?). So we write this small
|
||||
stub to ensure everything os ok
|
||||
|
||||
*/
|
||||
|
||||
:- dynamic in/0.
|
||||
/*
|
||||
/*:- dynamic in/0.
|
||||
prolog:print_message(Severity, Msg) :-
|
||||
\+ in,
|
||||
assert(in),
|
||||
@ -991,7 +980,7 @@ prolog:print_message(Severity, Msg) :-
|
||||
( prolog:print_message(Severity, Msg), fail;
|
||||
stop_low_level_trace,
|
||||
retract(in)
|
||||
).*/
|
||||
).
|
||||
*/
|
||||
prolog:print_message(Severity, Msg) :-
|
||||
(
|
||||
@ -1044,6 +1033,7 @@ prolog:print_message(Severity, Term) :-
|
||||
!.
|
||||
prolog:print_message(Severity, Term) :-
|
||||
translate_message( Term, Severity, Lines0, [ end(Id)]),
|
||||
writeln(Lines0),
|
||||
Lines = [begin(Severity, Id)| Lines0],
|
||||
(
|
||||
user:message_hook(Term, Severity, Lines)
|
||||
@ -1057,7 +1047,7 @@ prolog:print_message(Severity, Term) :-
|
||||
prolog:print_message(_Severity, _Term) :-
|
||||
format(user_error,'failed to print ~w: ~w~n' ,[ _Severity, _Term]).
|
||||
|
||||
'$error_descriptor'( error(_,Info), Info ).
|
||||
'$error_descriptor'( exception(Info), Info ).
|
||||
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user