ExtractOps.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Barth, October 14, 1987 3:21:10 pm PDT
Jean-Marc Frailong December 6, 1987 3:18:30 pm PST
DIRECTORY CD, Core, CoreGeometry, Rope, Sinix, ViewerClasses;
ExtractOps: CEDAR DEFINITIONS = BEGIN
HighlightInstance: PROC [instance: CoreGeometry.Instance] RETURNS [hinstance: CD.Instance];
Converts instance to highlighted instance.
HighlightInstanceList: PROC [instances: CoreGeometry.Instances] RETURNS [hinstances: CD.InstanceList];
Converts instance list to highlighted instance list.
HighlightDesign: PROC [design: CD.Design, highlight: CD.Instance ← NIL, viewer: ViewerClasses.Viewer ← NIL, label: Rope.ROPENIL];
If viewer is NIL then applies to all viewers of design. NIL removes all previous highlight. Viewers scale to the best zoom on the highlighted area.
HighlightDesignList: PROC [design: CD.Design, highlight: CD.InstanceList ← NIL, viewer: ViewerClasses.Viewer ← NIL, label: Rope.ROPENIL];
If viewer is NIL then applies to all viewers of design. NIL removes all previous highlight. Viewers scale to the best zoom on the highlighted area.
FindViewer: PROC [design: CD.Design, label: Rope.ROPENIL] RETURNS [viewer: ViewerClasses.Viewer];
Finds a single viewer for the design. Picks the last viewer if it belongs to the design, otherwise picks a random viewer belonging to the design if any exist, otherwise creates a viewer for the design. If a viewer is created and the label is not NIL then ViewerOps.SetViewer[viewer: viewer, data: label, op: $Label].
ExtractCDInstance: PROC [instance: CD.Instance, design: CD.Design, mode: Sinix.Mode] RETURNS [result: REF, props: Core.Properties];
This version of Sinix.Extract starts from a top-level CD Instance and computes the context if necessary (currently because of satellites). 
Returned arguments have same meaning as in Sinix.Extract.
ExtractCDInstanceAndReport: PROC [instance: CD.Instance, design: CD.Design, mode: Sinix.Mode] RETURNS [result: REFNIL, props: Core.Properties ← NIL];
Same as ExtractCDInstance but prints errors on terminal.
ExtractCDInstanceCellTypeAndReport: PROC [instance: CD.Instance, design: CD.Design, mode: Sinix.Mode] RETURNS [root: Core.CellType ← NIL];
Same as ExtractCDInstanceAndReport but also checks that the result is a cell type.
EachSelectedInstanceProc: TYPE = PROC [selectedInstance: CoreGeometry.Instance] RETURNS [quit: BOOLFALSE];
EnumerateSelectedInstances: PROC [design: CD.Design, eachInstance: EachSelectedInstanceProc] RETURNS [quit: BOOLFALSE];
Enumerate selected instances in the coordinate system of the containing cell.
SameCDInstance: PROC [cdInstance: CD.Instance, cdInstanceTrans: CD.Transformation, coreInstance: CoreGeometry.Instance] RETURNS [BOOL];
Given a cd instance in world coordinates and the transformation to cell coordiantes decide if it is the same as the given core instance.
SameCDObject: PROC [cdObject, coreObject: CD.Object] RETURNS [BOOL];
Expands the cdObject until it is ref equal to the coreObject or it cannot be expanded any further.
IsSchematic: PROC [design: CD.Design, object: CD.Object] RETURNS [BOOL];
Uses a heuristic to decide if this object is a schematic. This is obviously a crock but better than requiring the user to specify the mode in each command.
GetExtractMode: PROC [design: CD.Design, object: CD.Object] RETURNS [mode: Sinix.Mode];
Uses IsSchematic to choose between Sisyph.mode and SinixCMosB.mode.
PopTop: PROC [design: CD.Design];
Pop design to top level.
TopInstanceLists: TYPE = LIST OF RECORD [
design: CD.Design ← NIL,
instances: CD.InstanceList ← NIL];
GetTopInstances: PROC [design: CD.Design] RETURNS [topInstances: TopInstanceLists ← NIL];
FindSameInstance: PROC [design: CD.Design, cellInstance: CD.Instance, cellTransform: CD.Transformation] RETURNS [worldInstance: CD.Instance];
END.