make operators defined within a module local to the module, operators in header are still global to every module, though (UN #131).

This commit is contained in:
Vitor Santos Costa 2009-11-17 00:59:06 +00:00
parent ce5ae8b972
commit f7214090cb
2 changed files with 5 additions and 1 deletions

View File

@ -94,7 +94,7 @@ module(N) :-
Arity2 is Arity+2, Arity2 is Arity+2,
'$process_exports'(Exports,Mod,ExportedPreds). '$process_exports'(Exports,Mod,ExportedPreds).
'$process_exports'([op(Prio,Assoc,Name)|Exports],Mod,ExportedPreds) :- !, '$process_exports'([op(Prio,Assoc,Name)|Exports],Mod,ExportedPreds) :- !,
op(Prio,Assoc,Name), op(Prio,Assoc,prolog:Name),
'$process_exports'(Exports,Mod,ExportedPreds). '$process_exports'(Exports,Mod,ExportedPreds).
'$process_exports'([Trash|_],Mod,_) :- '$process_exports'([Trash|_],Mod,_) :-
'$do_error'(type_error(predicate_indicator,Trash),module(Mod,[Trash])). '$do_error'(type_error(predicate_indicator,Trash),module(Mod,[Trash])).

View File

@ -95,6 +95,10 @@ op(P,T,V) :-
'$op2'(P, T, A), '$op2'(P, T, A),
'$opl'(P, T, As). '$opl'(P, T, As).
'$op2'(P,T,A) :-
atom(A),
prolog_load_context(module, Mod), Mod \= user, !,
'$opdec'(P,T,A,Mod).
'$op2'(P,T,A) :- '$op2'(P,T,A) :-
atom(A), !, atom(A), !,
'$opdec'(P,T,A,prolog). '$opdec'(P,T,A,prolog).