DIRECTORY CD USING [ApplicationPtr, Design, ObPtr], CDPinObjects USING [AppEnumerator], Rope USING [ROPE]; PWPins: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; Side: TYPE = [0 .. 3]; -- INT interval is better than enumerated type, for we can save this property value on file bottom: Side = 0; right: Side = 1; top: Side = 2; left: Side = 3; -- must be a rotation on the edges. Some programs may depend on the representation of the Side. GetSide: PROC [ob: CD.ObPtr, pin: CD.ApplicationPtr] RETURNS [isOnBorder: BOOL, side: Side]; EnumerateDeepPins: PROC [ob: CD.ObPtr, eachPin: AppEnumerator, stopEnumerateDeepPins: BOOL _ TRUE] RETURNS [quit: BOOL]; AppEnumerator: TYPE = CDPinObjects.AppEnumerator; -- [app: CD.ApplicationPtr] RETURNS [quit: BOOL _ FALSE] EnumerateEdgePins: PROC [ob: CD.ObPtr, eachPin: AppEnumerator, stopEnumerateDeepPins: BOOL _ TRUE] RETURNS [quit: BOOL]; RenamePins: PUBLIC PROC [design: CD.Design, ob: CD.ObPtr, renameProc: RenameProc _ DefaultRenameProc, stopEnumerateDeepPins: BOOL _ TRUE] RETURNS [cell: CD.ObPtr]; RenameProc: TYPE = PROC [oldRope: ROPE] RETURNS [newRope: ROPE]; DefaultRenameProc: RenameProc; -- {newRope _ oldRope}; Identity renaming Index: PROC [rope: ROPE, index: INT] RETURNS [indexedRope: ROPE]; END. žPWPins.mesa Copyright c 1985 by Xerox Corporation. All rights reversed. Created by Bertrand Serlet and Louis Monier, June 4, 1985 11:27:01 am PDT Last Edited by: Serlet, June 27, 1985 3:51:34 pm PDT The convention for getting the side of a pin is to see if the pin is located on the border of the InterestRect of the ob. For pins at a corner, the biggest direction is the relevant one. This is not a Hack, because in fact only the dimension parallel to the side of the pin is meaningful. This proc enumerates in random order all pins, even the ones found in the deepest levels of the hierarchy of ob. The applications passed to eachPin are new applications, with all properties (e.g. the name) copied, so that the coordinate system refers to the one of ob. EnumerateDeepPins uses the expand proc for objects of unknown class. Changes on pins while the enumeration may or may not be seen. If the flag stopEnumerateDeepPins is TRUE, the recursion stops on instances of cells which have a non-nil $StopEnumerateDeepPins property, i.e. those instances will not be enumerated. The following function is a speed up of EnumerateDeepPins when the only pins wanted are the ones which intersect the boarder of the InterestRect, i.e. pins such as GetSide.isOnBorder is TRUE. Parses an object, extract all pins along the edges, and creates a new cell having an instance of the object, and renamed pins. Pins renamed to NIL are not copied. If the flag stopEnumerateDeepPins is TRUE, the property $StopEnumerateDeepPins is added on the instance, so that EnumerateDeepPins will only enumerate the copied pins next call. Useful in many RenameProcs for indexing names. e.g. Index["foo", 4]="foo[4]" Κn˜– "Cedar" stylešœ ™ Jšœ Οmœ1™