pereira@sri-unix.UUCP (08/15/83)
/* FLAGRO.PL : Flag handling UTILITY Lawrence Updated: 30 March 81 */ %%% Compile this module %%% FLAGRO requires no other modules /* EXPORT */ :- public flag/3. /* MODES */ :- mode flag(+,?,?). % 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 returing 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),_) ), !.