CDConditions.mesa (part of Chipndale)
by Christian Jacobi May 4, 1984
last edited by Christian Jacobi May 10, 1984 11:10:29 am PDT
DIRECTORY
CD USING [ObPtr, ApplicationPtr, Design, DrawRef],
Rope USING [ROPE];
CDConditions: CEDAR DEFINITIONS =
BEGIN
--vanilla stuff for designers and implementors of ConditionProc's
ConditionProc:
TYPE =
PROC [me:
CD.ApplicationPtr, environment:
CD.DrawRef]
RETURNS [drawMe:
BOOL←
TRUE];
-- condition procedures better have no arbitrary side effects; they are evaluated
-- in unspecified order, or sometimes not at all.
-- me.ob.specificRef is defined and of type CondPtr.
GetProp: PROC [environment: CD.DrawRef, prop: REF, skipInnerMost: NAT𡤀] RETURNS [REF];
GetIntProp: PROC[environment: CD.DrawRef, prop: REF, skipInnerMost: NAT𡤀, ifNotFound: INT𡤀] RETURNS [INT];
Index: PROC[environment: CD.DrawRef, skipInnerMost: NAT𡤀, ifNotFound: INT𡤀] RETURNS [INT];
--chipndale internal and client stuff
CondPtr: TYPE = REF CondRec;
CondRec:
TYPE =
RECORD [
app: CD.ApplicationPtr,
condition: ConditionProc←NIL,
data: REF←NIL,
cache:
REF←
NIL,
-- speed up for condition's internal usage;
--may be modified at runtime as controlled side effect
fileName: Rope.ROPE←NIL,
procName: Rope.ROPE←NIL, -- actually moduleName.procName
myData: PRIVATE REF←NIL
];
CreateCondition:
PROC [design:
CD.Design, ob:
CD.ObPtr, condition: ConditionProc←
NIL, data:
REF←
NIL]
RETURNS [
CD.ObPtr];
--there are restrictions on the type of data; (because of IO!)
ChangeCondition:
PROC [design:
CD.Design, ob:
CD.ObPtr, fileName, procName: Rope.
ROPE←
NIL, data:
REF←
NIL, condition: ConditionProc←
NIL]
RETURNS [done:
BOOL];
--ob must already be a conditional object.
--if condition is nil, tries to evaluate fileName, procName.
--procName can be prefixed by a modulename.
--redraws the complete design.
--there are restrictions on the type of data.
--done means condition evaluated according parameters.
--the fileName and procName fields are set independently of the "done" return.
UpdateConditions:
PROC [design:
CD.Design, doAll:
BOOL←
TRUE]
RETURNS [done:
BOOL];
--checks if any conditions have been recompiled and reloads them
--doAll TRUE: checks all, including already loded conditions
--doAll FALSE: checks the conditions which are not already loded
END.