CDViewerBaseImpl.mesa
Copyright © 1983, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, October 13, 1983 2:51 pm
last edited by Christian Jacobi, November 13, 1985 11:15:38 am PST
DIRECTORY
CDProperties,
CDViewerBase,
ViewerClasses;
CDViewerBaseImpl: CEDAR PROGRAM
IMPORTS CDProperties
EXPORTS CDViewerBase =
BEGIN
getList: CDProperties.PropRef ← CDProperties.InitPropRef[];
setList: CDProperties.PropRef ← CDProperties.InitPropRef[];
ImplementGetProc: PUBLIC PROC [op: ATOM, proc: ViewerClasses.GetProc] = {
ENABLE UNWIND => NULL;
val: REF = IF proc=NIL THEN NIL ELSE NEW[ViewerClasses.GetProc←proc];
IF proc=GetProc THEN ERROR; --don't do that, it causes infinite recursion
CDProperties.PutProp[getList, op, val]
};
ImplementSetProc: PUBLIC PROC [op: ATOM, proc: ViewerClasses.SetProc] = {
ENABLE UNWIND => NULL;
val: REF = IF proc=NIL THEN NIL ELSE NEW[ViewerClasses.SetProc←proc];
IF proc=SetProc THEN ERROR; --don't do that, it causes infinite recursion
CDProperties.PutProp[setList, op, val]
};
GetProc: PUBLIC ViewerClasses.GetProc = {
WITH CDProperties.GetPropFromList[getList^, op] SELECT FROM
gp: REF ViewerClasses.GetProc => RETURN [gp[self, op]];
ENDCASE => RETURN [NIL];
};
SetProc: PUBLIC ViewerClasses.SetProc = {
WITH CDProperties.GetPropFromList[setList^, op] SELECT FROM
sp: REF ViewerClasses.SetProc => sp[self, data, finalise, op];
ENDCASE => NULL;
};
END.