Prolog library: flagro.pl
pereira at sri-unix.UUCP
pereira at sri-unix.UUCP
Mon Aug 15 15:52:16 AEST 1983
/* 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),_)
),
!.
More information about the Comp.sources.unix
mailing list