ClientStateInfo.mesa
Last Edited by: Arnon, January 25, 1985 12:27:34 pm PST
DIRECTORY
Rope USING [ROPE];
ClientStateInfo: CEDAR DEFINITIONS = BEGIN
State: TYPE = REF; -- State = NIL => "no state"; our convention is that brush interiors have (non-NIL) state, and their exteriors do not have state.
StateCombiner: TYPE = PROC[currentregionstate, inputregionstate: State] RETURNS [combinedregionstate: State]; -- note well the order of arguments.
IF currentregionstate=NIL THEN RETURN[ inputregionstate ];
IF inputregionstate=NIL THEN RETURN[ currentregionstate ]; -- all StateCombiner's should contain these lines: our convention is that NIL state combined with any state returns that state.
defaultState: State; -- client is to provide a default (brush interior) state
stateCombiner: StateCombiner; -- client is to provide a default StateCombiner.
StateEqual: PROC [state1, state2: State] RETURNS [BOOL]; -- test for equality of states.
IF state1=NIL OR state2=NIL THEN RETURN[state1=NIL AND state2 = NIL]; -- all StateEqual's should contain this test
RopeFromState: PROC [state: State] RETURNS [Rope.ROPE];
State-encoding Ropes should not contain blanks, commas, colons, or semicolons, since the IDProc breakProc which procedures to read stateRopes will probably use considers them separators.
IF state=NIL THEN RETURN["NIL"] ELSE RETURN[ ... -- all RopeFromState's should do this
StateFromRope: PROC [in: Rope.ROPE] RETURNS [State];
Remember to catch "NIL"
END.