This commit is contained in:
Vitor Santos Costa 2010-09-27 22:31:06 +01:00
parent c50ed643f9
commit bf40154ff1
2 changed files with 75 additions and 60 deletions

View File

@ -222,8 +222,8 @@ system_message(error(permission_error(modify,dynamic_procedure,_), Where)) -->
[ 'PERMISSION ERROR- ~w: modifying a dynamic procedure' - [Where] ]. [ 'PERMISSION ERROR- ~w: modifying a dynamic procedure' - [Where] ].
system_message(error(permission_error(modify,flag,W), _)) --> system_message(error(permission_error(modify,flag,W), _)) -->
[ 'PERMISSION ERROR- cannot modify flag ~w' - [W] ]. [ 'PERMISSION ERROR- cannot modify flag ~w' - [W] ].
system_message(error(permission_error(modify,operator,W), _)) --> system_message(error(permission_error(modify,operator,W), Q)) -->
[ 'PERMISSION ERROR- T cannot declare ~w an operator' - [W] ]. [ 'PERMISSION ERROR- ~w: cannot modify operator ~q' - [Q,W] ].
system_message(error(permission_error(modify,dynamic_procedure,F), Where)) --> system_message(error(permission_error(modify,dynamic_procedure,F), Where)) -->
[ 'PERMISSION ERROR- ~w: modifying dynamic procedure ~w' - [Where,F] ]. [ 'PERMISSION ERROR- ~w: modifying dynamic procedure ~w' - [Where,F] ].
system_message(error(permission_error(modify,static_procedure,F), Where)) --> system_message(error(permission_error(modify,static_procedure,F), Where)) -->

View File

@ -1,25 +1,25 @@
/************************************************************************* /*************************************************************************
* * * *
* YAP Prolog * * YAP Prolog *
* * * *
* Yap Prolog was developed at NCCUP - Universidade do Porto * * Yap Prolog was developed at NCCUP - Universidade do Porto *
* * * *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
* * * *
************************************************************************** **************************************************************************
* * * *
* File: utils.yap * * File: utils.yap *
* Last rev: 8/2/88 * * Last rev: 8/2/88 *
* mods: * * mods: *
* comments: Some utility predicates available in yap * * comments: Some utility predicates available in yap *
* * * *
*************************************************************************/ *************************************************************************/
op(P,T,V) :- op(P,T,V) :-
'$check_op'(P,T,V,op(P,T,V)), '$check_op'(P,T,V,op(P,T,V)),
'$op'(P, T, V). '$op'(P, T, V).
'$check_op'(P,T,V,G) :- '$check_op'(P,T,V,G) :-
( (
var(P) -> var(P) ->
'$do_error'(instantiation_error,G) '$do_error'(instantiation_error,G)
@ -48,18 +48,33 @@ op(P,T,V) :-
'$check_op_name'(V,G) '$check_op_name'(V,G)
). ).
'$associativity'(xfx). '$associativity'(xfx).
'$associativity'(xfy). '$associativity'(xfy).
'$associativity'(yfx). '$associativity'(yfx).
'$associativity'(yfy). '$associativity'(yfy).
'$associativity'(xf). '$associativity'(xf).
'$associativity'(yf). '$associativity'(yf).
'$associativity'(fx). '$associativity'(fx).
'$associativity'(fy). '$associativity'(fy).
'$check_op_name'(V,G) :- '$check_op_name'(V,G) :-
var(V), !, var(V), !,
'$do_error'(instantiation_error,G). '$do_error'(instantiation_error,G).
'$check_op_name'(',',G) :- !,
'$do_error'(permission_error(modify,operator,','),G).
'$check_op_name'('[]',G) :- !,
'$do_error'(permission_error(create,operator,'[]'),G).
'$check_op_name'('{}',G) :- !,
'$do_error'(permission_error(create,operator,'{}'),G).
'$check_op_name'('|',G) :- !,
G = op(P, T, _),
(
integer(P),
P < 1001
;
Fix \== xfx, Fix \== xfy, Fix \== yfx, Fix \== yfy
),
'$do_error'(permission_error(create,operator,'|'),G).
'$check_op_name'(V,_) :- '$check_op_name'(V,_) :-
atom(V), !. atom(V), !.
'$check_op_name'(M:A, G) :- '$check_op_name'(M:A, G) :-