CDMarkObjectsImpl.mesa   
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Created by: Bob Mayo, June 8, 1984 12:28:34 pm PDT
Redesigned by: Jacobi, September 10, 1984 5:04:14 pm PDT
Last Edited: Jacobi, November 11, 1985 3:01:16 pm PST
DIRECTORY
CDMarkObjects,
CD,
CDOrient,
CDProperties,
Rope USING [ROPE, Equal],
CDSymbolicObjects;
CDMarkObjectsImpl: CEDAR PROGRAM    
IMPORTS CDProperties, Rope, CDOrient, CDSymbolicObjects
EXPORTS CDMarkObjects =
BEGIN
MarkEnumerator: TYPE = CDMarkObjects.MarkEnumerator;
--PROC [markInstance: CD.Instance] RETURNS [quit: BOOL�LSE]
markAtom: PUBLIC ATOM ← $AlignmentMarkOb;
markOb: PUBLIC CD.Object ← CDSymbolicObjects.CreateMark[10];
markNameProperty: PUBLIC ATOM ← $SignalName;
SetMarkName: PUBLIC PROC [markInstance: CD.Instance, name: Rope.ROPE] =
BEGIN
CDProperties.PutPropOnInstance[onto: markInstance, prop: markNameProperty, val: name]
END;
GetMarkName: PUBLIC PROC [markInstance: CD.Instance] RETURNS [name: Rope.ROPE] =
BEGIN
WITH CDProperties.GetPropFromInstance[from: markInstance, prop: markNameProperty] SELECT FROM
r: Rope.ROPE => name ← r;
ENDCASE => name ← NIL;
END;
FindMark: PUBLIC PROC [cellOb: CD.Object←NIL, design: CD.Design←NIL, name: Rope.ROPE] RETURNS [inst: CD.Instance←NIL] =
BEGIN
Enumerate: MarkEnumerator = {
IF Rope.Equal[GetMarkName[markInstance], name] THEN {inst ← markInstance; quit←TRUE}
};
[] ← EnumerateMarks[cellOb: cellOb, design: design, proc: Enumerate];
END;
GetMarkPosition: PUBLIC PROC [markInstance: CD.Instance] RETURNS [CD.Position] =
--actually finds any position of a real origin
BEGIN
RETURN [CDOrient.MapPoint[
pointInCell: [x: 0, y: 0],
cellInstPos: markInstance.location,
cellSize: markInstance.ob.size,
cellInstOrient: markInstance.orientation
]]
END;
EnumerateMarks: PUBLIC PROC [cellOb: CD.Object←NIL, design: CD.Design←NIL, proc: MarkEnumerator] RETURNS [quit: BOOLFALSE] =
BEGIN
cp: CD.CellPtr;
IF cellOb#NIL THEN cp ← NARROW[cellOb.specificRef]
ELSE IF design#NIL THEN cp ← design^.actual.first.specific
ELSE ERROR;
FOR list: CD.InstanceList ← cp.contents, list.rest WHILE (list#NIL AND ~quit) DO
IF list.first.ob=markOb THEN {
quit ← proc[list.first]; -- do NOT catch errors
};
ENDLOOP;
END;
END.