support message_string/2 for SWI emulation.

This commit is contained in:
Vitor Santos Costa 2009-11-23 10:09:32 +00:00
parent e4c9d69044
commit 31e5c54125
2 changed files with 8 additions and 0 deletions

View File

@ -3083,6 +3083,11 @@ format statements as described with @code{print_message_lines/3}.
This predicate should be defined dynamic and multifile to allow other
modules defining clauses for it too.
@item message_to_string(+@var{Term}, -@var{String})
@findex message_to_string/2
@snindex message_to_string/2
@cnindex message_to_string/2
Translates a message-term into a string object. Primarily intended for SWI-Prolog emulation.
@end table
@node Testing Terms, Predicates on Atoms, Messages, Top

View File

@ -229,6 +229,9 @@
'$process_error'(Throw, _) :-
print_message(error,error(unhandled_exception,Throw)).
message_to_string(Event, Message) :-
'$messages':generate_message(Event, Message, []).
print_message(force(_Severity), Msg) :- !,
print(user_error,Msg).
print_message(error, error(Msg,Info)) :- var(Info), !,