CDPrivate.mesa (part of ChipNDale)
Copyright © 1983, 1985, 1986 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, November 21, 1983 4:02 pm
Last Edited by: Christian Jacobi, December 15, 1986 11:23:06 am PST
DIRECTORY
CD;
CDPrivate: CEDAR DEFINITIONS =
BEGIN
-- Layers and technologies
LayerRef: TYPE = REF LayerRec;
LayerRec: TYPE = RECORD [
technology: CD.Technology ← NIL,
uniqueKey: ATOM NIL, -- unique per technology
properties: CD.PropRef,
globalUniqueKey: REF NIL, --use as CDValue key reserved by CDDefaults
number: CD.Layer
];
layers: READONLY REF ARRAY CD.Layer OF LayerRef;
ConvertLayer: PROC [technology: CD.Technology, uniqueKey: ATOM, into: CD.Layer];
--To enable input of no more supported layers
--To be used by technology implementors only
ConvertTechnologyKey: PROC [technology: CD.Technology, oldKey: ATOM];
--To register an alternative key for a technology
--To be used by technology implementors only
-- Designs
DesignEnumerator: TYPE = PROC [design: CD.Design] RETURNS [quit: BOOLFALSE];
EnumDesigns: PROC [p: DesignEnumerator] RETURNS [BOOL];
--only (modifyable) subset of designs will be enumerated
--Enumerator does NOT have a lock on design: design is readonly unless locked explicitely
InstallDesignEnumerator: PRIVATE PROC [PROC [p: DesignEnumerator] RETURNS [BOOL]];
--Designs are also used for private purposes, therefore, enumeration must only return those
--designs where public access is intended, e.g. designs with viewers or control panels
-- Grid
GetGrid: PROC [design: CD.Design, hint: REFNIL] RETURNS [CD.Number];
--Returns a grid number
--Interesting, because it returns a grid without explicitely importing viewer modules
InstallGetGrid: PRIVATE PROC [PROC [design: CD.Design, hint: REFNIL] RETURNS [CD.Number]];
--Used by viewer modules to set up GetGrid
-- Handy procedures for object generators...
Hash: PROC [x: REF] RETURNS [h: CARDINAL];
--assumes x of type CD.Object
--generates hash code using size, layer and class
Equal: PROC [x, y: REF] RETURNS [BOOL];
--assumes x, y of type CD.Object
--checks class, layer, bbox and ir
MinBBox: PROC [s: CD.Position] RETURNS [CD.Rect] = INLINE {
RETURN [[x1: 0, y1: 0, x2: MAX[s.x, 1], y2: MAX[s.y, 1]]]
};
END.