2008-02-22 15:08:37 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* *
|
|
|
|
* YAP Prolog *
|
|
|
|
* *
|
2016-05-15 08:12:49 +01:00
|
|
|
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
2008-02-22 15:08:37 +00:00
|
|
|
* *
|
|
|
|
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
|
|
|
* *
|
|
|
|
**************************************************************************
|
|
|
|
* *
|
|
|
|
* File: utilities for displaying messages in YAP. *
|
|
|
|
* comments: error messages for YAP *
|
|
|
|
* *
|
2008-07-16 11:58:59 +01:00
|
|
|
* Last rev: $Date: 2008-07-16 10:58:59 $,$Author: vsc $ *
|
2008-02-22 15:08:37 +00:00
|
|
|
* *
|
|
|
|
* *
|
|
|
|
*************************************************************************/
|
|
|
|
|
2015-01-04 23:58:23 +00:00
|
|
|
/**
|
2015-12-15 09:28:43 +00:00
|
|
|
* @file messages.yap
|
|
|
|
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP.lan>
|
|
|
|
* @date Thu Nov 19 10:22:26 2015
|
2016-03-03 23:23:32 +00:00
|
|
|
*
|
2015-12-15 09:28:43 +00:00
|
|
|
* @brief The YAP Message Handler
|
2016-03-03 23:23:32 +00:00
|
|
|
*
|
|
|
|
*
|
2015-12-15 09:28:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
2015-01-04 23:58:23 +00:00
|
|
|
@defgroup Messages Message Handling
|
|
|
|
@ingroup YAPControl
|
2014-09-11 20:06:57 +01:00
|
|
|
|
|
|
|
The interaction between YAP and the user relies on YAP's ability to
|
|
|
|
portray messages. These messages range from prompts to error
|
|
|
|
information. All message processing is performed through the builtin
|
|
|
|
print_message/2, in two steps:
|
|
|
|
|
2014-12-24 15:32:29 +00:00
|
|
|
+ The message is processed into a list of commands
|
2014-09-11 20:06:57 +01:00
|
|
|
+ The commands in the list are sent to the `format/3` builtin
|
|
|
|
in sequence.
|
|
|
|
|
|
|
|
|
|
|
|
The first argument to print_message/2 specifies the importance of
|
|
|
|
the message. The options are:
|
|
|
|
|
|
|
|
+ `error`
|
|
|
|
error handling
|
|
|
|
+ `warning`
|
|
|
|
compilation and run-time warnings,
|
|
|
|
+ `informational`
|
|
|
|
generic informational messages
|
|
|
|
+ `help`
|
|
|
|
help messages (not currently implemented in YAP)
|
|
|
|
+ `query`
|
|
|
|
query used in query processing (not currently implemented in YAP)
|
2015-09-29 23:09:12 +01:00
|
|
|
+ `silent`,M,Na,Ar,File, FilePos]],
|
|
|
|
[nl, nl].
|
|
|
|
caller( error(_,Term), _) -->
|
|
|
|
{ lists:memberchk([g|g(Call)], Term) },
|
|
|
|
['~*|called from
|
2014-09-11 20:06:57 +01:00
|
|
|
messages that do not produce output but that can be intercepted by hooks.
|
|
|
|
|
|
|
|
|
|
|
|
The next table shows the main predicates and hooks associated to message
|
|
|
|
handling in YAP:
|
|
|
|
|
2016-11-08 07:37:36 +00:00
|
|
|
|
|
|
|
An error record comsists of An ISO compatible descriptor of the format
|
|
|
|
|
|
|
|
error(errror_kind(Culprit,..), Info)
|
|
|
|
|
|
|
|
In YAP, the infoo field describes:
|
|
|
|
|
|
|
|
- what() more detauls on the event
|
|
|
|
|
|
|
|
- input_stream, may be ine of;
|
|
|
|
|
|
|
|
- loop_sream
|
|
|
|
- file()
|
|
|
|
- none
|
2016-12-06 07:50:11 +00:00
|
|
|
|
2016-11-08 07:37:36 +00:00
|
|
|
- prolog_source(_) a record containing file, line, predicate, and clause
|
|
|
|
that activated the goal, or a list therof. YAP tries to search for the user
|
|
|
|
code generatinng the error.
|
|
|
|
|
|
|
|
- c_source(0), a record containing the line of C-code thhat caused the event. This
|
|
|
|
is reported under systm debugging mode, or if this is user code.
|
|
|
|
|
|
|
|
- stream_source() - a record containg data on the the I/O stream datum causisng the evwnt.
|
|
|
|
|
|
|
|
- user_message () - ttext on the event.
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-20 22:36:16 +00:00
|
|
|
@{
|
2014-09-11 20:06:57 +01:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-04-18 13:25:23 +01:00
|
|
|
|
|
|
|
|
2016-03-05 12:41:47 +00:00
|
|
|
:- module(system('$messages'),
|
2008-02-22 15:08:37 +00:00
|
|
|
[system_message/4,
|
|
|
|
prefix/6,
|
|
|
|
prefix/5,
|
2014-04-21 11:29:05 +01:00
|
|
|
file_location/3]).
|
2008-02-22 15:08:37 +00:00
|
|
|
|
2014-09-11 20:06:57 +01:00
|
|
|
|
2015-08-18 20:53:05 +01:00
|
|
|
:- use_system_module( user, [message_hook/3]).
|
2014-04-09 12:39:29 +01:00
|
|
|
|
2014-04-21 11:29:05 +01:00
|
|
|
:- multifile prolog:message/3.
|
2013-11-22 00:44:28 +00:00
|
|
|
|
2015-08-18 20:53:05 +01:00
|
|
|
:- multifile user:message_hook/3.
|
2014-01-07 01:10:48 +00:00
|
|
|
|
2008-02-22 15:08:37 +00:00
|
|
|
|
2015-08-18 20:53:05 +01:00
|
|
|
/** @pred message_to_string(+ _Term_, - _String_)
|
2008-02-22 15:08:37 +00:00
|
|
|
|
|
|
|
|
2015-08-18 20:53:05 +01:00
|
|
|
Translates a message-term into a string object. Primarily intended for SWI-Prolog emulation.
|
2009-03-10 18:07:50 +00:00
|
|
|
|
2015-08-18 20:53:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
prolog:message_to_string(Event, Message) :-
|
2016-07-31 16:35:18 +01:00
|
|
|
translate_message(Event, warning, Message, []).
|
2015-08-18 20:53:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
%% @pred compose_message(+Term, +Level, +Lines, -Lines0) is det
|
|
|
|
%
|
|
|
|
% Print the message if the user did not intercept the message.
|
|
|
|
% The first is used for errors and warnings that can be related
|
|
|
|
% to source-location. Note that syntax errors have their own
|
|
|
|
% source-location and should therefore not be handled this way.
|
2016-07-31 16:35:18 +01:00
|
|
|
compose_message( Term, Level ) -->
|
|
|
|
[' ~w:'- [Level]
|
|
|
|
],
|
2015-08-18 20:53:05 +01:00
|
|
|
prolog:message(Term), !.
|
|
|
|
compose_message( query(_QueryResult,_), _Level) -->
|
|
|
|
[].
|
2016-02-11 14:17:30 +00:00
|
|
|
compose_message( absolute_file_path(File), _Level) -->
|
2016-03-03 23:23:32 +00:00
|
|
|
[ '~N~n absolute_file of ~w' - [File] ].
|
2015-09-21 23:05:36 +01:00
|
|
|
compose_message( absolute_file_path(Msg, Args), _Level) -->
|
2016-02-11 14:17:30 +00:00
|
|
|
[ ' : ' - [],
|
2015-09-21 23:05:36 +01:00
|
|
|
Msg - Args,
|
|
|
|
nl ].
|
2016-02-11 14:17:30 +00:00
|
|
|
compose_message( arguments([]), _Level) -->
|
|
|
|
[].
|
|
|
|
compose_message( arguments([A|As]), Level) -->
|
|
|
|
[ ' ~w' - [A],
|
|
|
|
nl ],
|
|
|
|
compose_message( arguments(As), Level).
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( ancestors([]), _Level) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'There are no ancestors.' ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( breakp(bp(debugger,_,_,M:F/N,_),add,already), _Level) -->
|
|
|
|
[ 'There is already a spy point on ~w:~w/~w.' - [M,F,N] ].
|
|
|
|
compose_message( breakp(bp(debugger,_,_,M:F/N,_),add,ok), _Level) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'Spy point set on ~w:~w/~w.' - [M,F,N] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( breakp(bp(debugger,_,_,M:F/N,_),remove,last), _Level) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'Spy point on ~w:~w/~w removed.' - [M,F,N] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( breakp(no,breakpoint_for,M:F/N), _Level) -->
|
|
|
|
[ 'There is no spy point on ~w:~w/~w.' - [M,F,N] ].
|
|
|
|
compose_message( breakpoints([]), _Level) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'There are no spy-points set.' ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( breakpoints(L), _Level) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'Spy-points set on:' ],
|
|
|
|
list_of_preds(L).
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( clauses_not_together(P), _Level) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'Discontiguous definition of ~q.' - [P] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( debug(debug), _Level) -->
|
2015-09-21 23:05:36 +01:00
|
|
|
[ 'Debug mode on.' - [] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( debug(off), _Level) -->
|
2015-09-21 23:05:36 +01:00
|
|
|
[ 'Debug mode off.'- [] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( debug(trace), _Level) -->
|
2015-09-21 23:05:36 +01:00
|
|
|
[ 'Trace mode on.'- [] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( declaration(Args,Action), _Level) -->
|
2008-07-11 18:02:10 +01:00
|
|
|
[ 'declaration ~w ~w.' - [Args,Action] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( defined_elsewhere(P,F), _Level) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'predicate ~q previously defined in file ~w' - [P,F] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( functionality(Library), _Level) -->
|
2012-03-22 21:42:41 +00:00
|
|
|
[ '~q not available' - [Library] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( import(Pred,To,From,private), _Level) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'Importing private predicate ~w:~w to ~w.' - [From,Pred,To] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( redefine_imported(M,M0,PI), _Level) -->
|
2015-09-21 23:05:36 +01:00
|
|
|
{ source_location(ParentF, Line) },
|
|
|
|
[ '~w:~w: Module ~w redefines imported predicate ~w:~w.' - [ParentF, Line, M,M0,PI] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( leash([]), _Level) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'No leashing.' ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( leash([A|B]), _Level) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'Leashing set to ~w.' - [[A|B]] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( no, _Level) -->
|
|
|
|
[ 'no' - [] ].
|
|
|
|
compose_message( no_match(P), _Level) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'No matching predicate for ~w.' - [P] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message( leash([A|B]), _Level) -->
|
|
|
|
[ 'Leashing set to ~w.' - [[A|B]] ].
|
|
|
|
compose_message( halt, _Level) --> !,
|
|
|
|
[ 'YAP execution halted.'-[] ].
|
|
|
|
compose_message( false, _Level) --> !,
|
|
|
|
[ 'false.'-[] ].
|
|
|
|
compose_message( '$abort', _Level) --> !,
|
|
|
|
[ 'YAP execution aborted'-[] ].
|
|
|
|
compose_message( abort(user), _Level) --> !,
|
|
|
|
[ 'YAP execution aborted' - [] ].
|
|
|
|
compose_message( loading(_,F), _Level) --> { F == user }, !.
|
|
|
|
compose_message( loading(What,FileName), _Level) --> !,
|
|
|
|
[ '~a ~w...' - [What, FileName] ].
|
|
|
|
compose_message( loaded(_,user,_,_,_), _Level) --> !.
|
|
|
|
compose_message( loaded(included,AbsFileName,Mod,Time,Space), _Level) --> !,
|
|
|
|
[ '~a included in module ~a, ~d msec ~d bytes' -
|
|
|
|
[AbsFileName,Mod,Time,Space] ].
|
|
|
|
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(trace_command(-1), _Leve) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'EOF is not a valid debugger command.' ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message(trace_command(C), _Leve) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ '~c is not a valid debugger command.' - [C] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message(trace_help, _Leve) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ ' Please enter a valid debugger command (h for help).' ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message(version(Version), _Leve) -->
|
2010-04-06 00:57:40 +01:00
|
|
|
[ '~a' - [Version] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message(myddas_version(Version), _Leve) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'MYDDAS version ~a' - [Version] ].
|
2015-09-29 23:09:12 +01:00
|
|
|
compose_message(yes, _Level) --> !,
|
2015-09-21 23:05:36 +01:00
|
|
|
[ 'yes'- [] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
compose_message(Term, Level) -->
|
2016-03-03 23:23:32 +00:00
|
|
|
{ '$show_consult_level'(LC) },
|
|
|
|
location(Term, Level, LC),
|
2016-02-20 21:50:06 +00:00
|
|
|
main_message( Term, Level, LC ),
|
2015-09-29 23:09:12 +01:00
|
|
|
c_goal( Term, Level ),
|
|
|
|
caller( Term, Level ),
|
2016-03-03 23:23:32 +00:00
|
|
|
extra_info( Term, Level ),
|
2015-09-29 23:09:12 +01:00
|
|
|
!,
|
2015-10-05 10:38:54 +01:00
|
|
|
[nl,nl].
|
|
|
|
compose_message(Term, Level) -->
|
|
|
|
{ Level == error -> true ; Level == warning },
|
2016-02-11 14:17:30 +00:00
|
|
|
{ '$show_consult_level'(LC) },
|
2016-03-03 23:23:32 +00:00
|
|
|
main_message( Term, Level, LC),
|
2015-10-05 10:38:54 +01:00
|
|
|
[nl,nl].
|
2015-08-18 20:53:05 +01:00
|
|
|
|
2016-11-08 07:37:36 +00:00
|
|
|
location(error(syntax_error(_),info(between(_,LN,_), FileName, _)), _ , _) -->
|
|
|
|
!,
|
|
|
|
[ '~a:~d:~d ' - [FileName,LN,0] ] .
|
|
|
|
|
2016-03-03 23:23:32 +00:00
|
|
|
location(error(style_check(style_check(_,LN,FileName,_ ) ),_), _ , _) -->
|
2015-11-05 17:23:26 +00:00
|
|
|
!,
|
2016-03-29 02:02:43 +01:00
|
|
|
[ '~a:~d:0 ' - [FileName,LN] ] .
|
2016-03-03 23:23:32 +00:00
|
|
|
location( error(_,Term), Level, LC ) -->
|
2015-10-05 10:38:54 +01:00
|
|
|
{ source_location(F0, L),
|
|
|
|
stream_property(_Stream, alias(loop_stream)) }, !,
|
2016-05-19 13:38:54 +01:00
|
|
|
display_consulting( F0, Level, LC ),
|
2015-10-05 10:38:54 +01:00
|
|
|
{ lists:memberchk([p|p(M,Na,Ar,_File,_FilePos)], Term ) },
|
2016-03-29 02:02:43 +01:00
|
|
|
[ '~a:~d:0 ~a in ~a:~q/~d:'-[F0, L,Level,M,Na,Ar] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
location( error(_,Term), Level, LC ) -->
|
2015-10-05 10:38:54 +01:00
|
|
|
{ lists:memberchk([p|p(M,Na,Ar,File,FilePos)], Term ) }, !,
|
2016-03-03 23:23:32 +00:00
|
|
|
display_consulting( File, Level, LC ),
|
2016-03-29 02:02:43 +01:00
|
|
|
[ '~a:~d:0 ~a in ~a:~q/~d:'-[File, FilePos,Level,M,Na,Ar] ].
|
2015-08-18 20:53:05 +01:00
|
|
|
|
|
|
|
%message(loaded(Past,AbsoluteFileName,user,Msec,Bytes), Prefix, Suffix) :- !,
|
2016-03-03 23:23:32 +00:00
|
|
|
main_message(error(Msg,Info), _, _) --> {var(Info)}, !,
|
|
|
|
[ ' error: uninstantiated message ~w~n.' - [Msg], nl ].
|
2016-11-08 07:37:36 +00:00
|
|
|
main_message( error(syntax_error(Msg),info(between(L0,LM,LF),_Stream,Term)), Level, LC ) -->
|
2015-08-18 20:53:05 +01:00
|
|
|
!,
|
2016-03-03 23:23:32 +00:00
|
|
|
[' ~a: syntax error ~s' - [Level,Msg]],
|
2015-07-28 04:22:44 +01:00
|
|
|
[nl],
|
2016-03-03 23:23:32 +00:00
|
|
|
( syntax_error_term( between(L0,LM,LF), Term, LC )
|
2015-09-29 23:09:12 +01:00
|
|
|
->
|
|
|
|
[]
|
2015-08-18 20:53:05 +01:00
|
|
|
;
|
2016-03-03 23:23:32 +00:00
|
|
|
[' ~a: failed_processing syntax error term ~q' - [Level,Term]],
|
2015-09-29 23:09:12 +01:00
|
|
|
[nl]
|
2015-08-18 20:53:05 +01:00
|
|
|
).
|
2016-03-03 23:23:32 +00:00
|
|
|
main_message(error(style_check(style_check(singleton(SVs),_Pos,_File,P)),_), Level, _LC) -->
|
2015-12-15 09:28:43 +00:00
|
|
|
!,
|
2016-02-20 21:50:06 +00:00
|
|
|
% {writeln(ci)},
|
2015-09-21 23:05:36 +01:00
|
|
|
{ clause_to_indicator(P, I) },
|
2016-03-03 23:23:32 +00:00
|
|
|
[ ' ~a: singleton variable~*c ~s in ~q.' - [ Level, NVs, 0's, SVsL, I] ],
|
2015-11-05 17:23:26 +00:00
|
|
|
{ svs(SVs,SVs,SVsL),
|
2015-09-21 23:05:36 +01:00
|
|
|
( SVs = [_] -> NVs = 0 ; NVs = 1 )
|
|
|
|
}.
|
2016-03-03 23:23:32 +00:00
|
|
|
main_message(error(style_check(style_check(multiple(N,A,Mod,I0),_Pos,File,_P)),_), Level, _LC) -->
|
2015-12-15 09:28:43 +00:00
|
|
|
!,
|
2016-03-03 23:23:32 +00:00
|
|
|
[ ' ~a: ~a redefines ~q from ~a.' - [Level,File, Mod:N/A, I0] ].
|
|
|
|
main_message(error(style_check(style_check(discontiguous(N,A,Mod),_S,_W,_P)),_) , Level, _LC)-->
|
2015-12-15 09:28:43 +00:00
|
|
|
!,
|
2016-03-03 23:23:32 +00:00
|
|
|
[ ' ~a: discontiguous definition for ~p.' - [Level,Mod:N/A] ].
|
|
|
|
main_message(error(consistency_error(Who)), Level, _LC) -->
|
2015-12-15 09:28:43 +00:00
|
|
|
!,
|
2016-03-03 23:23:32 +00:00
|
|
|
[ ' ~a: has argument ~a not consistent with type.'-[Level,Who] ].
|
|
|
|
main_message(error(domain_error(Who , Type), _Where), Level, _LC) -->
|
2015-12-15 09:28:43 +00:00
|
|
|
!,
|
2016-03-03 23:23:32 +00:00
|
|
|
[ ' ~a: ~q does not belong to domain ~a,' - [Level,Type,Who], nl ].
|
2016-12-06 07:50:11 +00:00
|
|
|
main_message(error(evaluation_error(What), _Where), Level, _LC) -->
|
|
|
|
!,
|
|
|
|
[ ' ~a: ~w during evaluation of arithmetic expressions,' - [Level,What], nl ].
|
|
|
|
main_message(error(evaluation_error(What, Who), _Where), Level, _LC) -->
|
|
|
|
!,
|
|
|
|
[ ' ~a: ~w caused ~a during evaluation of arithmetic expressions,' - [Level,Who,What], nl ].
|
2016-03-03 23:23:32 +00:00
|
|
|
main_message(error(existence_error(Type , Who), _Where), Level, _LC) -->
|
2015-12-15 09:28:43 +00:00
|
|
|
!,
|
2016-03-03 23:23:32 +00:00
|
|
|
[ ' ~a: ~q ~q could not be found,' - [Level,Type, Who], nl ].
|
|
|
|
main_message(error(permission_error(Op, Type, Id), _Where), Level, _LC) -->
|
|
|
|
[ ' ~a: ~q is not allowed in ~a ~q,' - [Level, Op, Type,Id], nl ].
|
|
|
|
main_message(error(instantiation_error, _Where), Level, _LC) -->
|
|
|
|
[ ' ~a: unbound variable' - [Level], nl ].
|
|
|
|
main_message(error(representation_error(Type)), Level, _LC) -->
|
|
|
|
[ ' ~a: ~a representation error ~a' - [Level, Type], nl ].
|
|
|
|
main_message(error(type_error(Type,Who), _What), Level, _LC) -->
|
|
|
|
[ ' ~a: ~q should be of type ~a' - [Level,Who,Type]],
|
2015-10-05 10:38:54 +01:00
|
|
|
[ nl ].
|
2016-03-03 23:23:32 +00:00
|
|
|
main_message(error(system_error(Who), _What), Level, _LC) -->
|
|
|
|
[ ' ~a: ~q error' - [Level,Who]],
|
2016-01-20 22:36:16 +00:00
|
|
|
[ nl ].
|
2016-03-03 23:23:32 +00:00
|
|
|
main_message(error(uninstantiation_error(T),_), Level, _LC) -->
|
|
|
|
[ ' ~a: found ~q, expected unbound variable ' - [Level,T], nl ].
|
|
|
|
|
|
|
|
display_consulting( F, Level, LC) -->
|
|
|
|
{ LC > 0,
|
|
|
|
source_location(F0, L),
|
|
|
|
F \= F0
|
|
|
|
}, !,
|
|
|
|
[ '~a:~d:0: ~a while compiling.'-[F0,L,Level], nl ].
|
|
|
|
display_consulting(_F, _, _LC) -->
|
|
|
|
[].
|
2015-10-05 10:38:54 +01:00
|
|
|
|
2015-09-29 23:09:12 +01:00
|
|
|
caller( error(_,Term), _) -->
|
|
|
|
{ lists:memberchk([p|p(M,Na,Ar,File,FilePos)], Term ) },
|
|
|
|
{ lists:memberchk([g|g(Call)], Term) },
|
|
|
|
!,
|
|
|
|
['~*|goal was ~q' - [10,Call]],
|
|
|
|
[nl],
|
2016-02-11 14:17:30 +00:00
|
|
|
['~*|exception raised from ~a:~q:~d, ~a:~d:0: '-[10,M,Na,Ar,File, FilePos]],
|
2015-09-29 23:09:12 +01:00
|
|
|
[nl].
|
|
|
|
caller( error(_,Term), _) -->
|
|
|
|
{ lists:memberchk([e|p(M,Na,Ar,File,FilePos)], Term ) },
|
|
|
|
!,
|
2016-02-11 14:17:30 +00:00
|
|
|
['~*|exception raised from ~a:~q/~d, ~a:~d:0: '-[10,M,Na,Ar,File, FilePos]],
|
2015-09-29 23:09:12 +01:00
|
|
|
[nl].
|
|
|
|
caller( error(_,Term), _) -->
|
|
|
|
{ lists:memberchk([g|g(Call)], Term) },
|
|
|
|
!,
|
|
|
|
['~*|goal ~q '-[10,Call]],
|
|
|
|
[nl].
|
|
|
|
caller( _, _) -->
|
|
|
|
[].
|
|
|
|
|
|
|
|
c_goal( error(_,Term), Level ) -->
|
|
|
|
{ lists:memberchk([c|c(File, Line, Func)], Term ) },
|
|
|
|
!,
|
2016-02-11 14:17:30 +00:00
|
|
|
['~*|~a raised at C-function ~a() in ~a:~d:0: '-[10, Level, Func, File, Line]],
|
2015-09-29 23:09:12 +01:00
|
|
|
[nl].
|
|
|
|
c_goal( _, _Level ) --> [].
|
2015-09-21 23:05:36 +01:00
|
|
|
|
2015-08-18 20:53:05 +01:00
|
|
|
|
|
|
|
prolog_message(X) -->
|
|
|
|
system_message(X).
|
|
|
|
|
2014-10-07 01:35:41 +01:00
|
|
|
system_message(error(Msg,Info)) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
( { var(Msg) } ; { var(Info)} ), !,
|
|
|
|
['bad error ~w' - [error(Msg,Info)]].
|
|
|
|
system_message(error(consistency_error(Who),Where)) -->
|
2008-07-16 11:58:59 +01:00
|
|
|
[ 'CONSISTENCY ERROR (arguments not compatible with format)- ~w ~w' - [Who,Where] ].
|
2008-02-22 15:08:37 +00:00
|
|
|
system_message(error(context_error(Goal,Who),Where)) -->
|
|
|
|
[ 'CONTEXT ERROR- ~w: ~w appeared in ~w' - [Goal,Who,Where] ].
|
|
|
|
system_message(error(domain_error(DomainType,Opt), Where)) -->
|
|
|
|
[ 'DOMAIN ERROR- ~w: ' - Where],
|
|
|
|
domain_error(DomainType, Opt).
|
2013-03-20 02:23:55 +00:00
|
|
|
system_message(error(format_argument_type(Type,Arg), Where)) -->
|
2014-10-07 01:35:41 +01:00
|
|
|
[ 'FORMAT ARGUMENT ERROR- ~~~a called with ~w in ~w: ' - [Type,Arg,Where]].
|
2011-07-22 23:38:19 +01:00
|
|
|
system_message(error(existence_error(directory,Key), Where)) -->
|
|
|
|
[ 'EXISTENCE ERROR- ~w: ~w not an existing directory' - [Where,Key] ].
|
|
|
|
system_message(error(existence_error(key,Key), Where)) -->
|
|
|
|
[ 'EXISTENCE ERROR- ~w: ~w not an existing key' - [Where,Key] ].
|
2014-11-27 10:02:04 +00:00
|
|
|
system_message(error(existence_error(mutex,Key), Where)) -->
|
2015-12-15 09:28:43 +00:00
|
|
|
[ 'EXISTENCE ERROR- ~w: ~w is an erased mutex' - [Where,Key] ].
|
2011-07-22 23:38:19 +01:00
|
|
|
system_message(existence_error(prolog_flag,F)) -->
|
|
|
|
[ 'Prolog Flag ~w: new Prolog flags must be created using create_prolog_flag/3.' - [F] ].
|
2010-02-28 00:42:47 +00:00
|
|
|
system_message(error(existence_error(prolog_flag,P), Where)) --> !,
|
|
|
|
[ 'EXISTENCE ERROR- ~w: prolog flag ~w is undefined' - [Where,P] ].
|
2008-02-22 15:08:37 +00:00
|
|
|
system_message(error(existence_error(procedure,P), context(Call,Parent))) --> !,
|
|
|
|
[ 'EXISTENCE ERROR- procedure ~w is undefined, called from context ~w~n Goal was ~w' - [P,Parent,Call] ].
|
|
|
|
system_message(error(existence_error(stream,Stream), Where)) -->
|
|
|
|
[ 'EXISTENCE ERROR- ~w: ~w not an open stream' - [Where,Stream] ].
|
|
|
|
system_message(error(existence_error(thread,Thread), Where)) -->
|
|
|
|
[ 'EXISTENCE ERROR- ~w: ~w not a running thread' - [Where,Thread] ].
|
2010-02-28 00:57:29 +00:00
|
|
|
system_message(error(existence_error(variable,Var), Where)) -->
|
|
|
|
[ 'EXISTENCE ERROR- ~w: variable ~w does not exist' - [Where,Var] ].
|
2008-02-22 15:08:37 +00:00
|
|
|
system_message(error(existence_error(Name,F), W)) -->
|
|
|
|
{ object_name(Name, ObjName) },
|
|
|
|
[ 'EXISTENCE ERROR- ~w could not open ~a ~w' - [W,ObjName,F] ].
|
|
|
|
system_message(error(evaluation_error(int_overflow), Where)) -->
|
|
|
|
[ 'INTEGER OVERFLOW ERROR- ~w' - [Where] ].
|
|
|
|
system_message(error(evaluation_error(float_overflow), Where)) -->
|
|
|
|
[ 'FLOATING POINT OVERFLOW ERROR- ~w' - [Where] ].
|
|
|
|
system_message(error(evaluation_error(undefined), Where)) -->
|
|
|
|
[ 'UNDEFINED ARITHMETIC RESULT ERROR- ~w' - [Where] ].
|
|
|
|
system_message(error(evaluation_error(underflow), Where)) -->
|
|
|
|
[ 'UNDERFLOW ERROR- ~w' - [Where] ].
|
|
|
|
system_message(error(evaluation_error(float_underflow), Where)) -->
|
|
|
|
[ 'FLOATING POINT UNDERFLOW ERROR- ~w' - [Where] ].
|
|
|
|
system_message(error(evaluation_error(zero_divisor), Where)) -->
|
|
|
|
[ 'ZERO DIVISOR ERROR- ~w' - [Where] ].
|
2009-05-30 18:52:23 +01:00
|
|
|
system_message(error(not_implemented(Type, What), Where)) -->
|
2014-10-07 01:35:41 +01:00
|
|
|
[ '~w: ~w not implemented- ~w' - [Where, Type, What] ].
|
2015-09-25 10:57:26 +01:00
|
|
|
system_message(error(operating_SYSTEM_ERROR_INTERNAL, Where)) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'OPERATING SYSTEM ERROR- ~w' - [Where] ].
|
|
|
|
system_message(error(out_of_heap_error, Where)) -->
|
|
|
|
[ 'OUT OF DATABASE SPACE ERROR- ~w' - [Where] ].
|
|
|
|
system_message(error(out_of_stack_error, Where)) -->
|
|
|
|
[ 'OUT OF STACK SPACE ERROR- ~w' - [Where] ].
|
2014-10-07 01:35:41 +01:00
|
|
|
system_message(error(out_of_trail_error, Where)) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'OUT OF TRAIL SPACE ERROR- ~w' - [Where] ].
|
|
|
|
system_message(error(out_of_attvars_error, Where)) -->
|
|
|
|
[ 'OUT OF STACK SPACE ERROR- ~w' - [Where] ].
|
|
|
|
system_message(error(out_of_auxspace_error, Where)) -->
|
|
|
|
[ 'OUT OF AUXILIARY STACK SPACE ERROR- ~w' - [Where] ].
|
|
|
|
system_message(error(permission_error(access,private_procedure,P), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: cannot see clauses for ~w' - [Where,P] ].
|
|
|
|
system_message(error(permission_error(access,static_procedure,P), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: cannot access static procedure ~w' - [Where,P] ].
|
|
|
|
system_message(error(permission_error(alias,new,P), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: cannot create alias ~w' - [Where,P] ].
|
2008-03-24 23:48:47 +00:00
|
|
|
system_message(error(permission_error(create,Name,P), Where)) -->
|
2015-09-29 23:09:12 +01:00
|
|
|
[ 'PERMISSION ERROR- ~w: cannot create ~a ~w' - [Where,Name,P] ].
|
2014-07-17 18:19:38 +01:00
|
|
|
system_message(error(permission_error(import,M1:I,redefined,SecondMod), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- loading ~w: modules ~w and ~w both define ~w' - [Where,M1,SecondMod,I] ].
|
2008-02-22 15:08:37 +00:00
|
|
|
system_message(error(permission_error(input,binary_stream,Stream), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: cannot read from binary stream ~w' - [Where,Stream] ].
|
|
|
|
system_message(error(permission_error(input,closed_stream,Stream), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: trying to read from closed stream ~w' - [Where,Stream] ].
|
|
|
|
system_message(error(permission_error(input,past_end_of_stream,Stream), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: past end of stream ~w' - [Where,Stream] ].
|
|
|
|
system_message(error(permission_error(input,stream,Stream), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: cannot read from ~w' - [Where,Stream] ].
|
|
|
|
system_message(error(permission_error(input,text_stream,Stream), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: cannot read from text stream ~w' - [Where,Stream] ].
|
|
|
|
system_message(error(permission_error(modify,dynamic_procedure,_), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: modifying a dynamic procedure' - [Where] ].
|
|
|
|
system_message(error(permission_error(modify,flag,W), _)) -->
|
|
|
|
[ 'PERMISSION ERROR- cannot modify flag ~w' - [W] ].
|
2010-09-27 22:31:06 +01:00
|
|
|
system_message(error(permission_error(modify,operator,W), Q)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: cannot modify operator ~q' - [Q,W] ].
|
2008-05-15 14:41:48 +01:00
|
|
|
system_message(error(permission_error(modify,dynamic_procedure,F), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: modifying dynamic procedure ~w' - [Where,F] ].
|
|
|
|
system_message(error(permission_error(modify,static_procedure,F), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: modifying static procedure ~w' - [Where,F] ].
|
2008-02-22 15:08:37 +00:00
|
|
|
system_message(error(permission_error(modify,static_procedure_in_use,_), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: modifying a static procedure in use' - [Where] ].
|
|
|
|
system_message(error(permission_error(modify,table,P), _)) -->
|
|
|
|
[ 'PERMISSION ERROR- cannot table procedure ~w' - [P] ].
|
|
|
|
system_message(error(permission_error(module,redefined,Mod), Who)) -->
|
|
|
|
[ 'PERMISSION ERROR ~w- redefining module ~a in a different file' - [Who,Mod] ].
|
|
|
|
system_message(error(permission_error(open,source_sink,Stream), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: cannot open file ~w' - [Where,Stream] ].
|
|
|
|
system_message(error(permission_error(output,binary_stream,Stream), Where)) -->
|
2015-11-05 17:23:26 +00:00
|
|
|
[ 'PERMISSION ERROR- ~w: cannot
|
|
|
|
write to binary stream ~w' - [Where,Stream] ].
|
2008-02-22 15:08:37 +00:00
|
|
|
system_message(error(permission_error(output,stream,Stream), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: cannot write to ~w' - [Where,Stream] ].
|
|
|
|
system_message(error(permission_error(output,text_stream,Stream), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: cannot write to text stream ~w' - [Where,Stream] ].
|
|
|
|
system_message(error(permission_error(resize,array,P), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: cannot resize array ~w' - [Where,P] ].
|
|
|
|
system_message(error(permission_error(unlock,mutex,P), Where)) -->
|
|
|
|
[ 'PERMISSION ERROR- ~w: cannot unlock mutex ~w' - [Where,P] ].
|
|
|
|
system_message(error(representation_error(character), Where)) -->
|
|
|
|
[ 'REPRESENTATION ERROR- ~w: expected character' - [Where] ].
|
|
|
|
system_message(error(representation_error(character_code), Where)) -->
|
|
|
|
[ 'REPRESENTATION ERROR- ~w: expected character code' - [Where] ].
|
|
|
|
system_message(error(representation_error(max_arity), Where)) -->
|
|
|
|
[ 'REPRESENTATION ERROR- ~w: number too big' - [Where] ].
|
2009-05-23 03:51:48 +01:00
|
|
|
system_message(error(representation_error(variable), Where)) -->
|
|
|
|
[ 'REPRESENTATION ERROR- ~w: should be a variable' - [Where] ].
|
2009-05-23 01:55:18 +01:00
|
|
|
system_message(error(resource_error(code_space), Where)) -->
|
|
|
|
[ 'RESOURCE ERROR- not enough code space' - [Where] ].
|
2009-04-25 01:03:00 +01:00
|
|
|
system_message(error(resource_error(huge_int), Where)) -->
|
|
|
|
[ 'RESOURCE ERROR- too large an integer in absolute value' - [Where] ].
|
2009-05-17 18:40:14 +01:00
|
|
|
system_message(error(resource_error(memory), Where)) -->
|
|
|
|
[ 'RESOURCE ERROR- not enough virtual memory' - [Where] ].
|
2009-04-25 17:01:33 +01:00
|
|
|
system_message(error(resource_error(stack), Where)) -->
|
|
|
|
[ 'RESOURCE ERROR- not enough stack' - [Where] ].
|
2009-05-23 01:55:18 +01:00
|
|
|
system_message(error(resource_error(streams), Where)) -->
|
|
|
|
[ 'RESOURCE ERROR- could not find a free stream' - [Where] ].
|
2008-03-25 01:04:27 +00:00
|
|
|
system_message(error(resource_error(threads), Where)) -->
|
2008-03-24 23:48:47 +00:00
|
|
|
[ 'RESOURCE ERROR- too many open threads' - [Where] ].
|
2009-05-17 18:40:14 +01:00
|
|
|
system_message(error(resource_error(trail), Where)) -->
|
|
|
|
[ 'RESOURCE ERROR- not enough trail space' - [Where] ].
|
2008-05-23 11:02:13 +01:00
|
|
|
system_message(error(signal(SIG,_), _)) -->
|
2008-05-23 23:29:52 +01:00
|
|
|
[ 'UNEXPECTED SIGNAL: ~a' - [SIG] ].
|
2011-11-08 15:48:55 +00:00
|
|
|
% SWI like I/O error message.
|
2009-03-26 08:54:49 +00:00
|
|
|
system_message(error(unhandled_exception,Throw)) -->
|
|
|
|
[ 'UNHANDLED EXCEPTION - message ~w unknown' - [Throw] ].
|
2014-10-07 01:35:41 +01:00
|
|
|
system_message(error(uninstantiation_error(TE), _Where)) -->
|
2010-10-12 22:02:24 +01:00
|
|
|
[ 'UNINSTANTIATION ERROR - expected unbound term, got ~q' - [TE] ].
|
2008-02-22 15:08:37 +00:00
|
|
|
system_message(Messg) -->
|
|
|
|
[ '~q' - Messg ].
|
|
|
|
|
|
|
|
|
|
|
|
domain_error(array_overflow, Opt) --> !,
|
|
|
|
[ 'invalid static index ~w for array' - Opt ].
|
|
|
|
domain_error(array_type, Opt) --> !,
|
|
|
|
[ 'invalid static array type ~w' - Opt ].
|
|
|
|
domain_error(builtin_procedure, _) --> !,
|
|
|
|
[ 'non-iso built-in procedure' ].
|
|
|
|
domain_error(character_code_list, Opt) --> !,
|
|
|
|
[ 'invalid list of codes ~w' - [Opt] ].
|
|
|
|
domain_error(close_option, Opt) --> !,
|
|
|
|
[ 'invalid close option ~w' - [Opt] ].
|
|
|
|
domain_error(delete_file_option, Opt) --> !,
|
|
|
|
[ 'invalid list of options ~w' - [Opt] ].
|
|
|
|
domain_error(encoding, Opt) --> !,
|
|
|
|
[ 'invalid encoding ~w' - [Opt] ].
|
2014-11-13 18:13:49 +00:00
|
|
|
domain_error(flag_value, [Opt,Flag]) --> !,
|
|
|
|
[ 'invalid value ~w for flag ~w' - [Opt,Flag] ].
|
2008-02-22 15:08:37 +00:00
|
|
|
domain_error(flag_value, Opt) --> !,
|
2014-11-13 18:13:49 +00:00
|
|
|
[ 'invalid value ~w for flag' - [Opt] ].
|
2008-02-22 15:08:37 +00:00
|
|
|
domain_error(io_mode, Opt) --> !,
|
|
|
|
[ 'invalid io mode ~w' - [Opt] ].
|
|
|
|
domain_error(mutable, Opt) --> !,
|
|
|
|
[ 'invalid id mutable ~w' - [Opt] ].
|
|
|
|
domain_error(module_decl_options, Opt) --> !,
|
|
|
|
[ 'expect module declaration options, found ~w' - [Opt] ].
|
2009-06-03 16:43:40 +01:00
|
|
|
domain_error(non_empty_list, Opt) --> !,
|
2008-02-22 15:08:37 +00:00
|
|
|
[ 'found empty list' - [Opt] ].
|
|
|
|
domain_error(not_less_than_zero, Opt) --> !,
|
|
|
|
[ 'number ~w less than zero' - [Opt] ].
|
|
|
|
domain_error(not_newline, Opt) --> !,
|
|
|
|
[ 'number ~w not newline' - [Opt] ].
|
|
|
|
domain_error(not_zero, Opt) --> !,
|
|
|
|
[ '~w is not allowed in the domain' - [Opt] ].
|
|
|
|
domain_error(operator_priority, Opt) --> !,
|
|
|
|
[ '~w invalid operator priority' - [Opt] ].
|
|
|
|
domain_error(operator_specifier, Opt) --> !,
|
|
|
|
[ 'invalid operator specifier ~w' - [Opt] ].
|
|
|
|
domain_error(out_of_range, Opt) --> !,
|
|
|
|
[ 'expression ~w is out of range' - [Opt] ].
|
|
|
|
domain_error(predicate_spec, Opt) --> !,
|
|
|
|
[ '~w invalid predicate specifier' - [Opt] ].
|
|
|
|
domain_error(radix, Opt) --> !,
|
|
|
|
[ 'invalid radix ~w' - [Opt] ].
|
2014-10-07 01:35:41 +01:00
|
|
|
domain_error(read_option, Opt) --> !,
|
2008-02-22 15:08:37 +00:00
|
|
|
[ '~w invalid option to read_term' - [Opt] ].
|
2014-10-07 01:35:41 +01:00
|
|
|
domain_error(semantics_indicator, Opt) --> !,
|
|
|
|
[ 'predicate indicator, got ~w' - [Opt] ].
|
2008-02-22 15:08:37 +00:00
|
|
|
domain_error(shift_count_overflow, Opt) --> !,
|
|
|
|
[ 'shift count overflow in ~w' - [Opt] ].
|
|
|
|
domain_error(source_sink, Opt) --> !,
|
|
|
|
[ '~w is not a source sink term' - [Opt] ].
|
|
|
|
domain_error(stream, Opt) --> !,
|
|
|
|
[ '~w is not a stream' - [Opt] ].
|
|
|
|
domain_error(stream_or_alias, Opt) --> !,
|
|
|
|
[ '~w is not a stream (or alias)' - [Opt] ].
|
2010-10-27 14:49:27 +01:00
|
|
|
domain_error(stream_encoding, Opt) --> !,
|
|
|
|
[ '~w is not a supported stream encoding' - [Opt] ].
|
2008-02-22 15:08:37 +00:00
|
|
|
domain_error(stream_position, Opt) --> !,
|
|
|
|
[ '~w is not a stream position' - [Opt] ].
|
|
|
|
domain_error(stream_property, Opt) --> !,
|
|
|
|
[ '~w is not a stream property' - [Opt] ].
|
|
|
|
domain_error(syntax_error_handler, Opt) --> !,
|
|
|
|
[ '~w is not a syntax error handler' - [Opt] ].
|
|
|
|
domain_error(table, Opt) --> !,
|
|
|
|
[ 'non-tabled procedure ~w' - [Opt] ].
|
|
|
|
domain_error(thread_create_option, Opt) --> !,
|
|
|
|
[ '~w is not a thread_create option' - [Opt] ].
|
|
|
|
domain_error(time_out_spec, Opt) --> !,
|
|
|
|
[ '~w is not valid specificatin for time_out' - [Opt] ].
|
|
|
|
domain_error(unimplemented_option, Opt) --> !,
|
|
|
|
[ '~w is not yet implemented' - [Opt] ].
|
|
|
|
domain_error(write_option, Opt) --> !,
|
|
|
|
[ '~w invalid write option' - [Opt] ].
|
|
|
|
domain_error(Domain, Opt) -->
|
|
|
|
[ '~w not a valid element for ~w' - [Opt,Domain] ].
|
|
|
|
|
2015-09-29 23:09:12 +01:00
|
|
|
extra_info( error(_,Extra), _ ) -->
|
|
|
|
{lists:memberchk([i|Msg], Extra)}, !,
|
2016-01-20 22:36:16 +00:00
|
|
|
['~*|user provided data is: ~q' - [10,Msg]],
|
|
|
|
[nl].
|
2015-09-29 23:09:12 +01:00
|
|
|
extra_info( _, _ ) -->
|
|
|
|
[].
|
2008-02-22 15:08:37 +00:00
|
|
|
|
|
|
|
object_name(array, array).
|
|
|
|
object_name(atom, atom).
|
|
|
|
object_name(atomic, atomic).
|
|
|
|
object_name(byte, byte).
|
|
|
|
object_name(callable, 'callable goal').
|
|
|
|
object_name(char, char).
|
|
|
|
object_name(character_code, 'character code').
|
|
|
|
object_name(compound, 'compound term').
|
|
|
|
object_name(db_reference, 'data base reference').
|
|
|
|
object_name(evaluable, 'evaluable term').
|
|
|
|
object_name(file, file).
|
|
|
|
object_name(float, float).
|
|
|
|
object_name(in_byte, byte).
|
|
|
|
object_name(in_character, character).
|
|
|
|
object_name(integer, integer).
|
2015-09-29 23:09:12 +01:00
|
|
|
|
2008-02-22 15:08:37 +00:00
|
|
|
object_name(key, 'database key').
|
|
|
|
object_name(leash_mode, 'leash mode').
|
|
|
|
object_name(library, library).
|
|
|
|
object_name(list, list).
|
|
|
|
object_name(message_queue, 'message queue').
|
|
|
|
object_name(mutex, mutex).
|
|
|
|
object_name(number, number).
|
|
|
|
object_name(operator, operator).
|
|
|
|
object_name(pointer, pointer).
|
|
|
|
object_name(predicate_indicator, 'predicate indicator').
|
|
|
|
object_name(source_sink, file).
|
|
|
|
object_name(unsigned_byte, 'unsigned byte').
|
|
|
|
object_name(unsigned_char, 'unsigned char').
|
|
|
|
object_name(variable, 'unbound variable').
|
|
|
|
|
2015-11-05 17:23:26 +00:00
|
|
|
svs([A=VA], [A=VA], S) :- !,
|
|
|
|
atom_string(A, S).
|
|
|
|
svs([A=VA,B=VB], [A=VA,B=VB], SN) :- !,
|
|
|
|
atom_string(A, S),
|
|
|
|
atom_string(B, S1),
|
|
|
|
string_concat([S,` and `,S1], SN).
|
|
|
|
svs([A=_], _, SN) :- !,
|
|
|
|
atom_string(A, S),
|
|
|
|
string_concat(`, and `,S, SN).
|
|
|
|
svs([A=V|L], [A=V|L], SN) :- !,
|
|
|
|
atom_string(A, S),
|
|
|
|
svs(L, [A=V|L], S1 ),
|
|
|
|
string_concat([ S, S1], SN).
|
|
|
|
svs([A=_V|L], All, SN) :- !,
|
|
|
|
atom_string(A, S),
|
|
|
|
svs(L, All, S1 ),
|
|
|
|
string_concat([`, `, S, S1], SN).
|
2008-02-22 15:08:37 +00:00
|
|
|
|
|
|
|
list_of_preds([]) --> [].
|
|
|
|
list_of_preds([P|L]) -->
|
|
|
|
['~q' - [P]],
|
|
|
|
list_of_preds(L).
|
|
|
|
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_term(between(_I,_J,_L),LTaL,LC) -->
|
2016-11-08 07:37:36 +00:00
|
|
|
['term between lines ~d and ~d' - [_I,_L], nl ],
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_tokens(LTaL, LC).
|
2008-02-22 15:08:37 +00:00
|
|
|
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_tokens([], _LC) --> [].
|
|
|
|
syntax_error_tokens([T|L], LC) -->
|
|
|
|
syntax_error_token(T, LC),
|
|
|
|
syntax_error_tokens(L, LC).
|
2008-02-22 15:08:37 +00:00
|
|
|
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token(atom(A), _LC) --> !,
|
2015-09-21 23:05:36 +01:00
|
|
|
[ '~q' - [A] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token(number(N), _LC) --> !,
|
2015-07-28 04:22:44 +01:00
|
|
|
[ '~w' - [N] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token(var(_,S), _LC) --> !,
|
2016-11-08 07:37:36 +00:00
|
|
|
[ '~a' - [S] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token(string(S), _LC) --> !,
|
2015-09-21 23:05:36 +01:00
|
|
|
[ '`~s`' - [S] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token(error, _LC) --> !,
|
2015-11-05 17:23:26 +00:00
|
|
|
[ ' <== HERE ==> ' ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token('EOT', _LC) --> !,
|
2015-08-18 20:53:05 +01:00
|
|
|
[ '.' - [], nl ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token('(', _LC) --> !,
|
2015-08-18 20:53:05 +01:00
|
|
|
[ '( '- [] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token('{', _LC) --> !,
|
2015-08-18 20:53:05 +01:00
|
|
|
[ '{ '- [] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token('[', _LC) --> !,
|
2015-08-18 20:53:05 +01:00
|
|
|
[ '[' - [] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token(')', _LC) --> !,
|
2015-08-18 20:53:05 +01:00
|
|
|
[ ' )'- [] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token(']', _LC) --> !,
|
2015-08-18 20:53:05 +01:00
|
|
|
[ ']'- [] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token('}', _LC) --> !,
|
2015-08-18 20:53:05 +01:00
|
|
|
[ ' }' - [] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token(',', _LC) --> !,
|
2015-08-18 20:53:05 +01:00
|
|
|
[ ', ' - [] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token('.', _LC) --> !,
|
2015-09-21 23:05:36 +01:00
|
|
|
[ '.' - [] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token(';', _LC) --> !,
|
2015-09-21 23:05:36 +01:00
|
|
|
[ '; ' - [] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token(':', _LC) --> !,
|
2015-09-21 23:05:36 +01:00
|
|
|
[ ':' - [] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token('|', _LC) --> !,
|
2015-09-21 23:05:36 +01:00
|
|
|
[ '|' - [] ].
|
2016-12-16 09:54:16 +00:00
|
|
|
syntax_error_token('l', _LC) --> !,
|
|
|
|
[ '|' - [] ].
|
2016-03-03 23:23:32 +00:00
|
|
|
syntax_error_token(nl, LC) --> !,
|
|
|
|
[ '~*| ' -[LC], nl ].
|
|
|
|
syntax_error_token(B, _LC) --> !,
|
2015-09-21 23:05:36 +01:00
|
|
|
[ nl, 'bad_token: ~q' - [B], nl ].
|
2008-02-22 15:08:37 +00:00
|
|
|
|
|
|
|
|
2015-11-05 17:23:26 +00:00
|
|
|
print_lines( S, _, Key) -->
|
|
|
|
[nl, end(Key0)],
|
|
|
|
{ Key == Key0 },
|
|
|
|
!,
|
|
|
|
{ nl(S),
|
|
|
|
flush_output(S) }.
|
|
|
|
print_lines( S, _, Key) -->
|
|
|
|
[flush, end(Key0)],
|
|
|
|
{ Key == Key0 },
|
|
|
|
!,
|
|
|
|
{ flush_output(S) }.
|
|
|
|
print_lines(S, _, Key) -->
|
|
|
|
[ end(Key0) ],
|
|
|
|
{ Key0 == Key }, !,
|
|
|
|
{ nl(S) }.
|
|
|
|
print_lines( S, Prefix, Key) -->
|
|
|
|
[at_same_line],
|
|
|
|
!,
|
|
|
|
print_lines( S, Prefix, Key).
|
|
|
|
print_lines( S, Prefixes, Key) -->
|
|
|
|
[nl],
|
|
|
|
!,
|
|
|
|
{ nl(S),
|
|
|
|
Prefixes = [PrefixS - Cmds|More],
|
|
|
|
format(S, PrefixS, Cmds)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
More == []
|
|
|
|
->
|
|
|
|
NPrefixes = Prefixes
|
|
|
|
;
|
|
|
|
NPrefixes = More
|
|
|
|
},
|
|
|
|
print_lines( S, NPrefixes, Key).
|
|
|
|
print_lines( S, Prefixes, Key) -->
|
|
|
|
[flush],
|
|
|
|
!,
|
|
|
|
{ flush_output(S) },
|
|
|
|
print_lines( S, Prefixes, Key ).
|
|
|
|
print_lines(S, Prefixes, Key) -->
|
|
|
|
[end(_OtherKey)],
|
|
|
|
!,
|
|
|
|
print_lines( S, Prefixes, Key ).
|
2016-03-03 23:23:32 +00:00
|
|
|
% consider this a message within the message
|
2015-11-05 17:23:26 +00:00
|
|
|
print_lines(S, Prefixes, Key) -->
|
|
|
|
[begin(Severity, OtherKey)],
|
|
|
|
!,
|
|
|
|
{ prefix( Severity, P ) },
|
|
|
|
print_message_lines(S, [P], OtherKey),
|
|
|
|
print_lines( S, Prefixes, Key ).
|
|
|
|
print_lines(S, Prefixes, Key) -->
|
|
|
|
[prefix(Fmt-Args)],
|
|
|
|
!,
|
|
|
|
print_lines( S, [Fmt-Args|Prefixes], Key ).
|
|
|
|
print_lines(S, Prefixes, Key) -->
|
|
|
|
[prefix(Fmt)],
|
|
|
|
{ atom( Fmt ) ; string( Fmt ) },
|
|
|
|
!,
|
|
|
|
print_lines( S, [Fmt-[]|Prefixes], Key ).
|
|
|
|
print_lines(S, Prefixes, Key) -->
|
|
|
|
[Fmt-Args],
|
|
|
|
!,
|
|
|
|
{ format(S, Fmt, Args) },
|
|
|
|
print_lines( S, Prefixes, Key ).
|
|
|
|
print_lines(S, Prefixes, Key) -->
|
|
|
|
[format(Fmt,Args)],
|
|
|
|
!,
|
|
|
|
{ format(S, Fmt, Args) },
|
|
|
|
print_lines( S, Prefixes, Key ).
|
2015-08-18 20:53:05 +01:00
|
|
|
% deprecated....
|
2015-11-05 17:23:26 +00:00
|
|
|
print_lines(S, Prefixes, Key) -->
|
|
|
|
[ Fmt ],
|
|
|
|
{ atom(Fmt) ; string( Fmt ) },
|
|
|
|
!,
|
|
|
|
{ format(S, Fmt, []) },
|
|
|
|
print_lines(S, Prefixes, Key).
|
2015-12-15 09:28:43 +00:00
|
|
|
print_lines(S, _Prefixes, _Key) -->
|
2015-11-05 17:23:26 +00:00
|
|
|
[ Msg ],
|
|
|
|
{ format(S, 'Illegal message Component: ~q !!!.~n', [Msg]) }.
|
|
|
|
|
|
|
|
prefix(help, '~N'-[]).
|
|
|
|
prefix(query, '~N'-[]).
|
|
|
|
prefix(debug, '~N'-[]).
|
|
|
|
prefix(warning, '~N'-[]).
|
2015-08-18 20:53:05 +01:00
|
|
|
/* { thread_self(Id) },
|
2008-02-22 15:08:37 +00:00
|
|
|
( { Id == main }
|
2015-08-18 20:53:05 +01:00
|
|
|
-> [ 'warning, ' - [] ]
|
2013-11-04 22:32:03 +00:00
|
|
|
; { atom(Id) }
|
2015-08-18 20:53:05 +01:00
|
|
|
-> ['warning [Thread ~a ], ' - [Id] ]
|
|
|
|
; ['warning [Thread ~d ], ' - [Id] ]
|
2008-02-22 15:08:37 +00:00
|
|
|
).
|
2015-08-18 20:53:05 +01:00
|
|
|
*/
|
2015-11-05 17:23:26 +00:00
|
|
|
prefix(error, '~N'-[]).
|
2015-08-18 20:53:05 +01:00
|
|
|
/*
|
2008-02-22 15:08:37 +00:00
|
|
|
{ thread_self(Id) },
|
|
|
|
( { Id == main }
|
2015-08-18 20:53:05 +01:00
|
|
|
-> [ 'error ' ]
|
2015-11-05 17:23:26 +00:00
|
|
|
; { thread_main_name(Id) }
|
2015-08-18 20:53:05 +01:00
|
|
|
-> [ 'error [ Thread ~w ] ' - [Id] ]
|
2008-02-22 15:08:37 +00:00
|
|
|
),
|
2015-08-18 20:53:05 +01:00
|
|
|
!.
|
2014-11-27 10:02:04 +00:00
|
|
|
prefix(error, '', user_error) -->
|
2008-02-22 15:08:37 +00:00
|
|
|
{ thread_self(Id) },
|
|
|
|
( { Id == main }
|
2015-08-18 20:53:05 +01:00
|
|
|
-> [ 'error ' - [], nl ]
|
2013-11-04 22:32:03 +00:00
|
|
|
; { atom(Id) }
|
2015-08-18 20:53:05 +01:00
|
|
|
-> [ 'error [ Thread ~a ] ' - [Id], nl ]
|
|
|
|
; [ 'error [ Thread ~d ] ' - [Id], nl ]
|
2008-02-22 15:08:37 +00:00
|
|
|
).
|
2015-08-18 20:53:05 +01:00
|
|
|
*/
|
2015-11-05 17:23:26 +00:00
|
|
|
prefix(banner, '~N'-[]).
|
|
|
|
prefix(informational, '~N~*|% '-[LC]) :-
|
|
|
|
'$show_consult_level'(LC).
|
|
|
|
prefix(debug(_), '~N% '-[]).
|
|
|
|
prefix(information, '~N% '-[]).
|
2008-02-22 15:08:37 +00:00
|
|
|
|
2009-03-10 18:07:50 +00:00
|
|
|
|
2015-11-05 17:23:26 +00:00
|
|
|
clause_to_indicator(T, MNameArity) :-
|
|
|
|
strip_module(T, M0, T1),
|
|
|
|
pred_arity( T1, M0, MNameArity ).
|
2014-04-23 21:39:32 +01:00
|
|
|
|
2015-11-05 17:23:26 +00:00
|
|
|
pred_arity(V, M, M:call/1) :- var(V), !.
|
|
|
|
pred_arity((:- _Path), _M, prolog:(:-)/1 ) :- !.
|
|
|
|
pred_arity((?- _Path), _M, prolog:(?)/1 ) :- !.
|
|
|
|
pred_arity((H:-_),M, MNameArity) :-
|
2014-09-10 05:53:41 +01:00
|
|
|
nonvar(H),
|
|
|
|
!,
|
2015-11-05 17:23:26 +00:00
|
|
|
strip_module(M:H, M1, H1),
|
|
|
|
pred_arity( H1, M1, MNameArity).
|
|
|
|
pred_arity((H-->_), M, M2:Name//Arity) :-
|
2015-09-21 23:05:36 +01:00
|
|
|
nonvar(H),
|
|
|
|
!,
|
2015-11-05 17:23:26 +00:00
|
|
|
strip_module(M:H, M1, H1),
|
|
|
|
pred_arity( H1, M1, M2:Name/Arity).
|
|
|
|
% special for a, [x] --> b, [y].
|
|
|
|
pred_arity((H,_), M, MNameArity) :-
|
2014-09-10 05:53:41 +01:00
|
|
|
nonvar(H),
|
|
|
|
!,
|
2015-11-05 17:23:26 +00:00
|
|
|
strip_module(M:H, M1, H1),
|
|
|
|
pred_arity( H1, M1, MNameArity).
|
|
|
|
pred_arity(Name/Arity, M, M:Name/Arity) :-
|
|
|
|
!.
|
|
|
|
pred_arity(Name//Arity, M, M:Name//Arity) :-
|
|
|
|
!.
|
|
|
|
pred_arity(H,M, M:Name/Arity) :-
|
2014-09-10 05:53:41 +01:00
|
|
|
functor(H,Name,Arity).
|
2014-04-23 21:39:32 +01:00
|
|
|
|
2014-09-11 20:06:57 +01:00
|
|
|
|
2015-11-05 17:23:26 +00:00
|
|
|
translate_message(Term, Level) -->
|
|
|
|
compose_message(Term, Level), !.
|
|
|
|
translate_message(Term, _) -->
|
2015-07-23 01:31:03 +01:00
|
|
|
{ Term = error(_, _) },
|
|
|
|
[ 'Unknown exception: ~p'-[Term] ].
|
2015-11-05 17:23:26 +00:00
|
|
|
translate_message(Term, _) -->
|
2015-07-23 01:31:03 +01:00
|
|
|
[ 'Unknown message: ~p'-[Term] ].
|
2015-07-06 12:04:42 +01:00
|
|
|
|
2015-11-05 17:23:26 +00:00
|
|
|
% print_message_lines(+Stream, +Prefix, +Lines)
|
|
|
|
%
|
|
|
|
% Quintus/SICStus/SWI compatibility predicate to print message lines
|
|
|
|
% using a prefix.
|
2015-08-18 20:53:05 +01:00
|
|
|
|
2015-11-05 17:23:26 +00:00
|
|
|
/** @pred print_message_lines(+ _Stream_, + _Prefix_, + _Lines_)
|
2015-08-18 20:53:05 +01:00
|
|
|
|
2015-11-05 17:23:26 +00:00
|
|
|
Print a message (see print_message/2) that has been translated to
|
|
|
|
a list of message elements. The elements of this list are:
|
2015-08-18 20:53:05 +01:00
|
|
|
|
2015-11-05 17:23:26 +00:00
|
|
|
+ _Format_-_Args_
|
|
|
|
Where _Format_ is an atom and _Args_ is a list
|
|
|
|
of format argument. Handed to `format/3`.
|
|
|
|
+ `flush`
|
|
|
|
If this appears as the last element, _Stream_ is flushed
|
|
|
|
(see `flush_output/1`) and no final newline is generated.
|
|
|
|
+ `at_same_line`
|
|
|
|
If this appears as first element, no prefix is printed for
|
|
|
|
the line and the line-position is not forced to 0
|
|
|
|
(see `format/1`, `~N`).
|
|
|
|
+ `prefix`(Prefix)
|
|
|
|
define a prefix for the next line, say `''` will be seen as an
|
|
|
|
empty prefix.
|
|
|
|
(see `format/1`, `~N`).
|
|
|
|
+ `<Format>`
|
|
|
|
Handed to `format/3` as `format(Stream, Format, [])`, may get confused
|
|
|
|
with other commands.
|
|
|
|
+ nl
|
|
|
|
A new line is started and if the message is not complete
|
|
|
|
the _Prefix_ is printed too.
|
2015-08-18 20:53:05 +01:00
|
|
|
*/
|
2015-11-05 17:23:26 +00:00
|
|
|
prolog:print_message_lines(S, Prefix0, Lines) :-
|
|
|
|
Lines = [begin(_, Key)|Msg],
|
|
|
|
(
|
|
|
|
atom(Prefix0)
|
|
|
|
->
|
|
|
|
Prefix = Prefix0-[]
|
|
|
|
;
|
|
|
|
string(Prefix0)
|
|
|
|
->
|
|
|
|
Prefix = Prefix0-[]
|
|
|
|
;
|
|
|
|
Prefix = Prefix0
|
2016-03-03 23:23:32 +00:00
|
|
|
),
|
2015-11-05 17:23:26 +00:00
|
|
|
(Msg = [at_same_line|Msg1]
|
|
|
|
->
|
2015-12-15 09:28:43 +00:00
|
|
|
print_lines(S, [Prefix], Key, Msg1, [])
|
2015-11-05 17:23:26 +00:00
|
|
|
;
|
|
|
|
print_lines(S, [Prefix], Key, [Prefix|Msg], [])
|
|
|
|
).
|
|
|
|
|
2016-02-21 19:09:10 +00:00
|
|
|
/** @pred prolog:print_message(+ Severity, +Term)
|
|
|
|
|
|
|
|
The predicate print_message/2 is used to print messages, notably from
|
|
|
|
exceptions, in a human-readable format. _Kind_ is one of
|
|
|
|
`informational`, `banner`, `warning`, `error`, `help` or `silent`. In YAP, the message is always outut to the stream user_error.
|
|
|
|
|
|
|
|
If the Prolog flag verbose is `silent`, messages with
|
|
|
|
_Kind_ `informational`, or `banner` are treated as
|
|
|
|
silent. See `-q` in [Running_YAP_Interactively].
|
|
|
|
|
|
|
|
This predicate first translates the _Term_ into a list of `message
|
|
|
|
lines` (see print_message_lines/3 for details). Next it will
|
|
|
|
call the hook message_hook/3 to allow the user intercepting the
|
|
|
|
message. If message_hook/3 fails it will print the message unless
|
|
|
|
_Kind_ is silent.
|
|
|
|
|
|
|
|
If you need to report errors from your own predicates, we advise you to
|
|
|
|
stick to the existing error terms if you can; but should you need to
|
|
|
|
invent new ones, you can define corresponding error messages by
|
|
|
|
asserting clauses for `prolog:message/2`. You will need to declare
|
|
|
|
the predicate as multifile.
|
|
|
|
|
|
|
|
Note: errors in the implementation of print_message/2 are very
|
|
|
|
confusing to YAP (who will process the error?). So we write this small
|
|
|
|
stub to ensure everything os ok
|
|
|
|
|
|
|
|
*/
|
|
|
|
prolog:print_message(Severity, Msg) :-
|
2015-08-18 20:53:05 +01:00
|
|
|
(
|
|
|
|
var(Severity)
|
|
|
|
->
|
|
|
|
!,
|
|
|
|
format(user_error, 'malformed message ~q: message level is unbound~n', [Msg])
|
|
|
|
;
|
|
|
|
var(Msg)
|
|
|
|
->
|
|
|
|
!,
|
|
|
|
format(user_error, 'uninstantiated message~n', [])
|
2016-07-31 16:35:18 +01:00
|
|
|
;
|
|
|
|
Severity == silent
|
|
|
|
->
|
|
|
|
true
|
2015-08-18 20:53:05 +01:00
|
|
|
;
|
2016-05-19 13:38:54 +01:00
|
|
|
'$pred_exists'(portray_message(_,_),user),
|
2015-08-18 20:53:05 +01:00
|
|
|
user:portray_message(Severity, Msg)
|
|
|
|
),
|
|
|
|
!.
|
2016-06-03 16:53:43 +01:00
|
|
|
prolog:print_message(Level, _Msg) :-
|
|
|
|
current_prolog_flag(verbose_load, silent),
|
|
|
|
stream_property(_Stream, alias(loop_stream) ),
|
|
|
|
Level = informational,
|
|
|
|
!.
|
|
|
|
prolog:print_message(Level, _Msg) :-
|
|
|
|
current_prolog_flag(verbose, silent),
|
|
|
|
Level \= error,
|
|
|
|
Level \= warning,
|
|
|
|
!.
|
|
|
|
prolog:print_message(_, _Msg) :-
|
2016-07-31 16:35:18 +01:00
|
|
|
% first step at hook processing
|
2016-06-03 16:53:43 +01:00
|
|
|
'$nb_getval'('$if_skip_mode',skip,fail),
|
|
|
|
!.
|
2016-02-21 19:09:10 +00:00
|
|
|
prolog:print_message(force(_Severity), Msg) :- !,
|
2015-08-18 20:53:05 +01:00
|
|
|
print(user_error,Msg).
|
|
|
|
% This predicate has more hooks than a pirate ship!
|
2016-07-31 16:35:18 +01:00
|
|
|
prolog:print_message(Severity, Term) :-
|
|
|
|
prolog:message( Term,Lines0, [ end(Id)]),
|
|
|
|
Lines = [begin(Severity, Id)| Lines0],
|
|
|
|
(
|
|
|
|
user:message_hook(Term, Severity, Lines)
|
|
|
|
->
|
|
|
|
true
|
|
|
|
;
|
|
|
|
prefix( Severity, Prefix ),
|
|
|
|
prolog:print_message_lines(user_error, Prefix, Lines)
|
|
|
|
),
|
|
|
|
!.
|
2016-02-21 19:09:10 +00:00
|
|
|
prolog:print_message(Severity, Term) :-
|
2015-11-05 17:23:26 +00:00
|
|
|
translate_message( Term, Severity, Lines0, [ end(Id)]),
|
|
|
|
Lines = [begin(Severity, Id)| Lines0],
|
2015-08-18 20:53:05 +01:00
|
|
|
(
|
2015-11-05 17:23:26 +00:00
|
|
|
user:message_hook(Term, Severity, Lines)
|
2015-08-18 20:53:05 +01:00
|
|
|
->
|
2015-11-05 17:23:26 +00:00
|
|
|
true
|
2015-08-18 20:53:05 +01:00
|
|
|
;
|
2015-11-05 17:23:26 +00:00
|
|
|
prefix( Severity, Prefix ),
|
|
|
|
prolog:print_message_lines(user_error, Prefix, Lines)
|
2015-08-18 20:53:05 +01:00
|
|
|
),
|
2015-11-05 17:23:26 +00:00
|
|
|
!.
|
2016-02-21 19:09:10 +00:00
|
|
|
prolog:print_message(Severity, _Term) :-
|
2015-11-05 17:23:26 +00:00
|
|
|
format('No handler for ~a message ~q,~n',[Severity, _Term]).
|
|
|
|
|
|
|
|
|
2014-09-11 20:06:57 +01:00
|
|
|
/**
|
2015-01-04 23:58:23 +00:00
|
|
|
@}
|
2014-09-11 20:06:57 +01:00
|
|
|
*/
|