Separate callable errors that refer to the predicate indicator.

This commit is contained in:
Vitor Santos Costa 2014-10-20 15:40:19 +01:00
parent 7f4b478572
commit 67de7e422d
3 changed files with 14 additions and 9 deletions

View File

@ -202,7 +202,7 @@ The error handler is called when there is an execution error or a
warning needs to be displayed. The handlers include a number of hooks
to allow user-control.
*/
*/
:- system_module( '$_errors', [message_to_string/2,
print_message/2], ['$Error'/1,
@ -219,6 +219,11 @@ to allow user-control.
% '$stack_dump',
throw(error(Type,[Message|local_sp(Message,CP,Envs,CPs)])).
'$do_pi_error'(type_error(callable,Name/0),Message) :- !,
'$do_error'(type_error(callable,Name),Message).
'$do_pi_error'(Error,Message) :- !,
'$do_error'(Error,Message).
'$Error'(E) :-
'$LoopError'(E,top).

View File

@ -103,7 +103,7 @@ dynamic(X) :-
'$do_error'(permission_error(modify,static_procedure,A/N),dynamic(Mod:A/N))
).
'$dynamic2'(X,Mod) :-
'$do_error'(type_error(callable,X),dynamic(Mod:X)).
'$do_pi_error'(type_error(callable,X),dynamic(Mod:X)).
'$logical_updatable'(A//N,Mod) :- integer(N), !,
N1 is N+2,
@ -145,7 +145,7 @@ defines all new or redefined predicates to be public.
functor(T,A,N),
'$do_make_public'(T, Mod).
'$public'(X, Mod) :-
'$do_error'(type_error(callable,X),dynamic(Mod:X)).
'$do_pi_error'(type_error(callable,X),dynamic(Mod:X)).
'$do_make_public'(T, Mod) :-
'$is_dynamic'(T, Mod), !. % all dynamic predicates are public.

View File

@ -281,7 +281,7 @@ table(Pred) :-
functor(PredFunctor,PredName,PredArity), !,
'$set_table'(Mod,PredFunctor,PredModeList).
'$do_table'(Mod,Pred) :-
'$do_error'(type_error(callable,Pred),table(Mod:Pred)).
'$do_pi_error'(type_error(callable,Pred),table(Mod:Pred)).
'$set_table'(Mod,PredFunctor,_PredModeList) :-
'$undefined'('$c_table'(_,_,_),prolog), !,
@ -349,7 +349,7 @@ is_tabled(Pred) :-
'$flags'(PredFunctor,Mod,Flags,Flags), !,
Flags /\ 0x000040 =\= 0.
'$do_is_tabled'(Mod,Pred) :-
'$do_error'(type_error(callable,Pred),is_tabled(Mod:Pred)).
'$do_pi_error'(type_error(callable,Pred),is_tabled(Mod:Pred)).
@ -384,7 +384,7 @@ tabling_mode(Pred,Options) :-
'$do_error'(domain_error(table,Mod:PredName/PredArity),tabling_mode(Mod:PredName/PredArity,Options))
).
'$do_tabling_mode'(Mod,Pred,Options) :-
'$do_error'(type_error(callable,Pred),tabling_mode(Mod:Pred,Options)).
'$do_pi_error'(type_error(callable,Pred),tabling_mode(Mod:Pred,Options)).
'$set_tabling_mode'(Mod,PredFunctor,Options) :-
var(Options), !,
@ -445,7 +445,7 @@ abolish_table(Pred) :-
'$do_error'(domain_error(table,Mod:PredName/PredArity),abolish_table(Mod:PredName/PredArity))
).
'$do_abolish_table'(Mod,Pred) :-
'$do_error'(type_error(callable,Pred),abolish_table(Mod:Pred)).
'$do_pi_error'(type_error(callable,Pred),abolish_table(Mod:Pred)).
@ -485,7 +485,7 @@ show_table(Stream,Pred) :-
'$do_error'(domain_error(table,Mod:PredName/PredArity),show_table(Mod:PredName/PredArity))
).
'$do_show_table'(_,Mod,Pred) :-
'$do_error'(type_error(callable,Pred),show_table(Mod:Pred)).
'$do_pi_error'(type_error(callable,Pred),show_table(Mod:Pred)).
@ -525,7 +525,7 @@ table_statistics(Stream,Pred) :-
'$do_error'(domain_error(table,Mod:PredName/PredArity),table_statistics(Mod:PredName/PredArity))
).
'$do_table_statistics'(_,Mod,Pred) :-
'$do_error'(type_error(callable,Pred),table_statistics(Mod:Pred)).
'$do_pi_error'(type_error(callable,Pred),table_statistics(Mod:Pred)).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%