CDStretchyBackdoorImpl.mesa (part of ChipNDale)
Copyright © 1984, 1986 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, October 22, 1984 10:04:35 am PDT
Last edited by: Christian Jacobi, October 31, 1986 10:20:20 am PST
DIRECTORY
CD,
CDAtomicObjects,
CDBasics,
CDProperties,
CDRects,
CDStretchyBackdoor;
CDStretchyBackdoorImpl: CEDAR PROGRAM
IMPORTS CDAtomicObjects, CDBasics, CDProperties, CDRects
EXPORTS CDStretchyBackdoor =
BEGIN
MatchProc: TYPE = CDStretchyBackdoor.MatchProc;
MakeSimilarProc: TYPE = CDStretchyBackdoor.MakeSimilarProc;
matchKey: ATOM = $CDxMatchProc;
similarKey: ATOM = $CDxMakeSimilarProc;
Match: PUBLIC PROC[me: CD.Object, r: CD.Rect, layer: CD.Layer, prim: BOOL, horz: BOOL] RETURNS [BOOLFALSE] = {
WITH CDProperties.GetProp[me.class.properties, matchKey] SELECT FROM
mp: REF MatchProc => RETURN [ mp^[me, r, layer, prim, horz] ];
ENDCASE => NULL;
};
MakeSimilar: PUBLIC PROC [me: CD.Object, ir: CD.Rect] RETURNS [CD.Object←NIL] = {
SELECT TRUE FROM
me.class.wireTyped => RETURN [ CDRects.CreateRect[, me.layer] ];
CDAtomicObjects.IsAtomicOb[me] => RETURN [ CDAtomicObjects.CreateAtomicOb[me.class.objectType, CDBasics.SizeOfRect[ir], me.class.technology, me.layer] ];
ENDCASE =>
WITH CDProperties.GetProp[me.class.properties, similarKey] SELECT FROM
p: REF MakeSimilarProc => RETURN [ p^[me, ir] ];
ENDCASE => NULL;
};
HasMatchProc: PUBLIC PROC [me: CD.Object] RETURNS [BOOL] = {
RETURN [CDProperties.GetProp[me.class.properties, matchKey]#NIL];
};
InstallMatchProc: PUBLIC PROC [type: CD.ObjectClass, match: MatchProc] = {
CDProperties.PutProp[type, matchKey, NEW[MatchProc←match]];
};
InstallMakeSimilarProc: PUBLIC PROC [type: CD.ObjectClass, makeSimilar: MakeSimilarProc] = {
CDProperties.PutProp[type, similarKey, NEW[MakeSimilarProc←makeSimilar]];
};
[] ← CDProperties.RegisterProperty[matchKey, $chj];
[] ← CDProperties.RegisterProperty[similarKey, $chj];
END.