/* FLAGRO : Flag handling UTILITY Lawrence Updated: 11 September 81 */ %%% FLAGRO requires no other modules % Flags are stored in the database keyed under the Flag itself with % the information packaged into a functor as follows: % % Flag --> '$flag'(Flag,Value) % % This routine maintains these flags returning previous values as Old and % updating the flag to New each time. The code actually checks to see if % this updating really requires changing the database. % flag(X,Old,New) :- nonvar(X), ( recorded(X,'$flag'(X,O),ID) ; O = 0 ), ( Old == New, !, Old = O ; !, Old = O, ( nonvar(ID), erase(ID) ; true ), recorda(X,'$flag'(X,New),_) ), !.