PipalConnect.mesa
Copyright Ó 1988 by Xerox Corporation. All rights reversed.
Created by Bertrand Serlet March 18, 1988 5:38:22 pm PST
Bertrand Serlet April 12, 1988 3:17:46 pm PDT
Connector Type
Each Object can connectize into a null connector (e.g. text in layout), a leaf connector (e.g a contact or a transistor, in which only the interface is known) or a composite connector (e.g. an overlay). In the leaf and composite cases, it is possible to enumerate the ports, stars or names of the object. When the object is a composite connector, it is also possible to reach inside it.
Type:
TYPE = {null, leaf, composite};
GetTypeProc:
TYPE =
PROC [object: Pipal.Object, mode: Mode]
RETURNS [type: Type];
GetType: GetTypeProc;
Applies the getType method, EnumerationType by default.
EnumerationType: GetTypeProc;
Applies PipalInt.Enumerate and returns null if there was no child, null or leaf if there was a single null or leaf child, composite otherwise.
NullType: GetTypeProc;
Always returns null.
LeafType: GetTypeProc;
Always returns leaf.
CompositeType: GetTypeProc;
Always returns composite.
Ports Enumeration
EachPortProc:
TYPE =
PROC [transformation: PipalInt.Transformation, portIndex:
NAT, port: Pipal.Object]
RETURNS [quit:
BOOL ←
FALSE];
First portIndex is 0
EnumeratePortsProc:
TYPE =
PROC [object: Pipal.Object, mode: Mode, privateArea: PipalInt.Rectangle, eachPort: EachPortProc, transformation: PipalInt.Transformation ← []]
RETURNS [quit:
BOOL ←
FALSE];
Can only be called if GetType[object, mode] is leaf or composite.
privateArea is the area in which nodes are not promoted. It is used only for composite connectors.
EnumeratePorts: EnumeratePortsProc;
Applies the enumeratePortsMethod method, EnumerationEnumeratePorts by default.
Two invocations with same object, mode and privateArea applies eachPort with the same arguments, in the same order.
CountPorts:
PROC [object: Pipal.Object, mode: Mode, privateArea: PipalInt.Rectangle]
RETURNS [count:
NAT ← 0];
Returns the number of ports.
EnumerationEnumeratePorts: EnumeratePortsProc;
Applies PipalInt.ObjectEnumerate, assuming there is a single child, and applies children enumeration.
ComposerEnumeratePorts: EnumeratePortsProc;
Enumerate the ports of a the composite connector obtained by GetComposer (see below).
AtomicEnumeratePorts: EnumeratePortsProc;
Used for primitive objects which extract as one electric component.
WellAtomicEnumeratePorts: EnumeratePortsProc;
Used for primitive objects which extract as one or two electric components.
Stars Enumeration
EachSatellitesProc: TYPE = PROC [satellites: LIST OF Pipal.ROPE] RETURNS [quit: BOOL ← FALSE];
EnumerateSatellitesProc:
TYPE =
PROC [object: Pipal.Object, mode: Mode, eachSatellites: EachSatellitesProc]
RETURNS [quit:
BOOL ←
FALSE];
Can only be called if GetType[object, mode] is leaf or composite.
EnumerateSatellites: EnumerateSatellitesProc;
Applies the enumerateSatellitesMethod method.
Only non italic texts are enumerated.
If none then applies PipalInt.ObjectEnumerate and applies children enumeration.
Two invocations with same object and mode applies eachSatellites with the same argument, in the same order.
Recurses on masters, iff its type is leaf or composite.
StarEnumerateSatellites: EnumerateSatellitesProc;
The obvious one.
NullEnumerateSatellites: EnumerateSatellitesProc;
No star!
Annotation Enumeration
EachAnnotationProc: TYPE = PROC [value: REF] RETURNS [quit: BOOL ← FALSE];
EnumerateAnnotationsProc:
TYPE =
PROC [object: Pipal.Object, mode: Mode, key:
ATOM, eachAnnotation: EachAnnotationProc]
RETURNS [quit:
BOOL ←
FALSE];
Can only be called if GetType[object, mode] is leaf or composite.
EnumerateAnnotations: EnumerateAnnotationsProc;
Applies the enumerateAnnotationsMethod method.
If none then applies PipalInt.ObjectEnumerate and applies children enumeration.
Two invocations with same object and mode applies eachAnnotation with the same argument, in the same order.
AnnotationEnumerateAnnotations: EnumerateAnnotationsProc;
The obvious one, followed by recursing on child.
NullEnumerateAnnotations: EnumerateAnnotationsProc;
No name!
Composite Connector
Composer: TYPE = REF ComposerRec;
ComposerRec:
TYPE =
RECORD [
object: Pipal.Object, -- enumerated object provides correct childIndex for bindings
ports: REF PortsSequence,
nodes:
SEQUENCE size:
NAT
OF Node
size>=ports.size.
first nodes corresponds to ports, in the same order.
];
PortsSequence: TYPE = RECORD [ports: SEQUENCE size: NAT OF Pipal.Object];
Node: TYPE = REF NodeRec;
NodeRec:
TYPE =
RECORD [
bindings: SEQUENCE size: NAT OF Binding
Bindings are guaranteed to be sorted in lexicographic order (lowest childIndex first)
];
Binding:
TYPE =
RECORD [childIndex, nodeIndex:
NAT];
childIndex refers to the index obtained when enumerating the composite connector.
children[childIndex] must be composite.
GetComposerProc:
TYPE =
PROC [object: Pipal.Object, mode: Mode, privateArea: PipalInt.Rectangle]
RETURNS [cc: Composer];
Can only be called if GetType[object, mode] is composite.
privateArea is the area in which nodes are not promoted.
eachInstance is called first on all sub-composite connectors, then eachNode is called on each node.
GetComposer: GetComposerProc;
Applies the enumerateNodes method.
If none then applies GetEnumerationComposer.
Two invocations of that function with same object, mode and privateArea returns the same Composer.
EnumerationComposer: GetComposerProc;
Enumerate the object, and creates a Composer. Typically used for overlay.
AbutComposer: GetComposerProc;
Faster than GetEnumerationComposer for abuts.
RoutingComposer: GetComposerProc;
Faster than GetEnumerationComposer for routing objects.
TilingComposer: GetComposerProc;
Faster than GetEnumerationComposer for tilings.
Mode
Connectizing requires a few parameters, summarized in Mode.
Mode: TYPE = REF ModeRec;
ModeRec:
TYPE =
RECORD [
getTypeMethod, enumeratePortsMethod, enumerateSatellitesMethod, enumerateAnnotationsMethod, getComposerMethod: Pipal.Method,
methods for recursion.
name: Pipal.
ROPE,
identifies the mode
touch: PipalMos.TouchProc,
Specifies if two decorations touch and provoke a geometric fusion.
nbOfLayers:
NAT ← 1,
determines the number of interesting layers corresponding to subinstances of obj. Efficiency hack: should be defaulted for clients unaware of implementation details. Also note layer means in this context "virtual layers", not PipalMos.Layer.
objectLayer:
PROC [Pipal.Object]
RETURNS [LayerRange] ←
NIL
determines the [min .. max] layers corresponding to a subinstance of obj. Efficiency hack: should be set to DefaultObjectLayer for clients unaware of implementation details.
];
LayerRange:
TYPE =
RECORD [min, max:
NAT];
min and max are included