From 7f70a797f491b5eb9354c437d95de657e2b8372e Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 12 Oct 2010 22:02:24 +0100 Subject: [PATCH] fix error messages to obey standard. --- library/regexp.yap | 4 ++-- pl/corout.yap | 2 +- pl/messages.yap | 2 ++ pl/threads.yap | 16 ++++++++-------- pl/yio.yap | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/library/regexp.yap b/library/regexp.yap index 53cbe7e7b..b58baee39 100644 --- a/library/regexp.yap +++ b/library/regexp.yap @@ -42,11 +42,11 @@ regexp(RegExp, String, Opts, OUT) :- check_out(V,_,_,_) :- var(V), !. check_out([],I,I,_) :- !. check_out([V|L],I0,IF,G) :- !, - (nonvar(V) -> throw(error(type_error(variable,V),G)) ; true), + (nonvar(V) -> throw(error(uninstantiation_error(V),G)) ; true), I is I0+1, check_out(L,I,IF,G). check_out(OUT,_,_,G) :- - throw(error(type_error(variable,OUT),G)). + throw(error(uninstantiation_error(OUT),G)). % % Option processing diff --git a/pl/corout.yap b/pl/corout.yap index 589016cc8..82e401beb 100644 --- a/pl/corout.yap +++ b/pl/corout.yap @@ -443,7 +443,7 @@ prolog:'$wait'(Na/Ar) :- prolog:'$wait'(_). frozen(V, G) :- nonvar(V), !, - '$do_error'(type_error(variable,V),frozen(V,G)). + '$do_error'(uninstantiation_error(V),frozen(V,G)). frozen(V, LG) :- '$attributes':get_conj_from_attvars([V], LG). diff --git a/pl/messages.yap b/pl/messages.yap index 611206611..1cc62351d 100644 --- a/pl/messages.yap +++ b/pl/messages.yap @@ -296,6 +296,8 @@ system_message(error(unknown, Where)) --> [ 'EXISTENCE ERROR- procedure ~w undefined' - [Where] ]. system_message(error(unhandled_exception,Throw)) --> [ 'UNHANDLED EXCEPTION - message ~w unknown' - [Throw] ]. +system_message(error(uninstantiation_error(TE), Where)) --> + [ 'UNINSTANTIATION ERROR - expected unbound term, got ~q' - [TE] ]. system_message(Messg) --> [ '~q' - Messg ]. diff --git a/pl/threads.yap b/pl/threads.yap index b0f45a05e..79b194e04 100644 --- a/pl/threads.yap +++ b/pl/threads.yap @@ -99,7 +99,7 @@ thread_create(Goal) :- thread_create(Goal, Id) :- G0 = thread_create(Goal, Id), '$check_callable'(Goal, G0), - ( nonvar(Id) -> '$do_error'(type_error(variable,Id),G0) ; true ), + ( nonvar(Id) -> '$do_error'(uninstantiation_error(Id),G0) ; true ), '$thread_options'([], [], Stack, Trail, System, Detached, AtExit, G0), '$thread_new_tid'(Id), % '$erase_thread_info'(Id), % this should not be here @@ -116,7 +116,7 @@ thread_create(Goal, Id) :- thread_create(Goal, Id, Options) :- G0 = thread_create(Goal, Id, Options), '$check_callable'(Goal,G0), - ( nonvar(Id) -> '$do_error'(type_error(variable,Id),G0) ; true ), + ( nonvar(Id) -> '$do_error'(uninstantiation_error(Id),G0) ; true ), '$thread_options'(Options, Alias, Stack, Trail, System, Detached, AtExit, G0), '$thread_new_tid'(Id), % '$erase_thread_info'(Id), % this should not be here @@ -159,7 +159,7 @@ thread_create(Goal, Id, Options) :- ; \+ atom(Mod) -> - '$do_error'(type_error(atom,Mod),G) + '$do_error'(uninstantiation_error(Mod),G) ; var(LOpts) -> @@ -207,7 +207,7 @@ thread_create(Goal, Id, Options) :- % vsc: ????? thread_defaults(Defaults) :- nonvar(Defaults), !, - '$do_error'(type_error(variable, Defaults), thread_defaults(Defaults)). + '$do_error'(uninstantion_error(Defaults), thread_defaults(Defaults)). thread_defaults([stack(Stack), trail(Trail), system(System), detached(Detached), at_exit(AtExit)]) :- recorded('$thread_defaults',[Stack, Trail, System, Detached, AtExit], _). @@ -314,7 +314,7 @@ thread_self(Id) :- /* Exit status may be either true, false, exception(Term), or exited(Term) */ thread_join(Id, Status) :- nonvar(Status), !, - '$do_error'(type_error(variable,Status),thread_join(Id, Status)). + '$do_error'(uninstantiation_error(Status),thread_join(Id, Status)). thread_join(Id, Status) :- '$check_thread_or_alias'(Id, thread_join(Id, Status)), '$thread_id_alias'(Id0, Id), @@ -385,7 +385,7 @@ mutex_create(Mutex) :- mutex_create(Id, Options) :- nonvar(Id), !, - '$do_error'(type_error(variable, Id), mutex_create(Id, Options)). + '$do_error'(uninstantiation_error(Id), mutex_create(Id, Options)). mutex_create(Id, Options) :- Goal = mutex_create(Id, Options), '$mutex_options'(Options, Alias, Goal), @@ -562,7 +562,7 @@ mutex_property(Mutex, Prop) :- message_queue_create(Id, Options) :- nonvar(Id), !, - '$do_error'(type_error(variable, Id), message_queue_create(Id, Options)). + '$do_error'(uninstantiation_error(Id), message_queue_create(Id, Options)). message_queue_create(Id, Options) :- var(Options), !, '$do_error'(instantiation_error, message_queue_create(Id, Options)). @@ -594,7 +594,7 @@ message_queue_create(Id) :- message_queue_create(Id, []) ; atom(Id) -> % old behavior message_queue_create(_, [alias(Id)]) - ; '$do_error'(type_error(variable, Id), message_queue_create(Id)) + ; '$do_error'(uninstantiation_error(Id), message_queue_create(Id)) ). '$do_msg_queue_create'(Id) :- diff --git a/pl/yio.yap b/pl/yio.yap index 7cb4bb192..9a406d509 100644 --- a/pl/yio.yap +++ b/pl/yio.yap @@ -22,7 +22,7 @@ open(Source,M,T) :- var(Source), !, open(Source,M,T) :- var(M), !, '$do_error'(instantiation_error,open(Source,M,T)). open(Source,M,T) :- nonvar(T), !, - '$do_error'(type_error(variable,T),open(Source,M,T)). + '$do_error'(uninstantiation_error(T),open(Source,M,T)). open(File0,Mode,Stream) :- '$default_encoding'(Encoding), '$default_expand'(Expansion), @@ -76,7 +76,7 @@ open(F,T,S,Opts) :- '$open2'(Source,M,T,N,_,_) :- var(M), !, '$do_error'(instantiation_error,open(Source,M,T,N)). '$open2'(Source,M,T,N,_,_) :- nonvar(T), !, - '$do_error'(type_error(variable,T),open(Source,M,T,N)). + '$do_error'(uninstantiation_error(T),open(Source,M,T,N)). '$open2'(File, Mode, Stream, N, Encoding, F0) :- '$open'(File, Mode, Stream, N, Encoding, F0).