-- File: IPCoTab.mesa
-- Last Edited by: CSChow, February 2, 1985 2:09:15 am PST
Preas, August 1, 1986 10:41:57 pm PDT
--Note: IPCoTab = ComponentTable
-- This a collection of all the components. Component has shape of a retangle with 0-4 of
-- its corners removed. Some of these corners may have corner channels, this
-- indicates that the corner spaces are being utilized
DIRECTORY
IPOrient USING [Orientation],
Misc USING [Rect],
IO USING [STREAM],
Imager USING [Context],
IPNetTab,
IPTypeTab,
IPChipRose,
IPConstants,
IPParams,
IPCTG USING [Ref, Channel],
IP,
Rope USING [ROPE],
SymTab USING [Ref],
RTStructure;
IPCoTab: CEDAR DEFINITIONS
IMPORTS IPParams = BEGIN
Channel: TYPE = IPCTG.Channel;
Ref: TYPE = REF Rep;
Rep: TYPE = RECORD[comps: SymTab.Ref];
Component: TYPE = REF ComponentRep;
ComponentRep: TYPE = IP.ComponentRep;
CornerChannels:TYPE = REF CornerChannelsRep;
CornerChannelsRep: TYPE = IP.CornerChannelsRep;
CornerSpace: TYPE = REF NatVector;
CornerTypes: TYPE = IP.CornerTypes;
EdgeTypes: TYPE = IP.EdgeTypes;
IntVector: TYPE = IP.IntVector;
NatVector: TYPE = IP.NatVector;
EachComponentAction: TYPE = PROC[co: Component] RETURNS[quit: BOOLFALSE];
--These are the top level global operations on IPCTG--
Create: PROC[chipRose: IPChipRose.Ref, typeTab: IPTypeTab.Ref, netTab: IPNetTab.Ref] RETURNS[Ref];
--Create an instance of component table by reading in all instances in chipRose
CreateFromStructure: PROC[structure: RTStructure.Structure, typeTab: IPTypeTab.Ref, netTab: IPNetTab.Ref] RETURNS[Ref];
--Create an instance of component table by evaluating a structure
DestroySelf: PROC[coTab: Ref];
DescribeSelf: PROC[coTab: Ref, stream: IO.STREAM];
--Create a recoverable textual description of self. Used for creating checkpoint--
ReconstructSelf: PROC[stream: IO.STREAM, typeTab: IPTypeTab.Ref, netTab: IPNetTab.Ref, ctg: IPCTG.Ref ← NIL] RETURNS [coTab: Ref];
--Create the ctg based on the textual description in s. The reconstruction is perfect
-- except the ref's are different.
CheckSelf: PROC[coTab: Ref];
--Used in debugging, no longer supported
PaintSelf: PROC [coTab: Ref, context: Imager.Context, xOffset, yOffset: REAL ← 0.0, scaleFactor: REAL ← 1.0, coStipple: CARDINAL ← IPConstants.White, showCoNames, showPhyPinNames: BOOLTRUE];
CreateComponent: PROC[coTab: Ref, name: Rope.ROPE, type: IPTypeTab.CoType, orient: IPOrient.Orientation, pinNets: IPNetTab.PinNets, origin: IntVector ← [IPParams.CoDefaultPosition, IPParams.CoDefaultPosition], active: BOOLTRUE] RETURNS[Component];
--create a component of given shape and size at specified positions in the table
CreateComponent2: PROC[coTab: Ref, name: Rope.ROPE, shape: IP.ShapeRep, active: BOOLTRUE, orient: IPOrient.Orientation, origin: IntVector, from: Component ← NIL] RETURNS[Component];
-- If from # NIL THEN name:, shape:, active:, orient:, origin:, are IGNORED
--Used in IPTopEditOpsExtraImpl.SpawnComps
DestroyComponent2: PROC[coTab: Ref, co: Component];
--Used in IPTopEditOpsExtraImpl.SpawnComps
Size: PROC[coTab: Ref] RETURNS[NAT];
--return the number of components (active and non-active) in coTab
CountComponents: PROC[coTab: Ref] RETURNS [active, nonActive: INT];
GetComponent: PROC[coTab: Ref, name: Rope.ROPE, raiseError: BOOLTRUE] RETURNS[component: Component];
--Get the component (active or not) with that name. If raiseError and no component has that
-- name will raise UnknownName[name]--
Components: PROC[coTab: Ref, p: EachComponentAction]; --enumerate all active components or until p returns true--
AllComponents: PROC[coTab: Ref, p: EachComponentAction]; --enumerate all (active and non-active) components or until p returns true--
SetName: PROC[coTab: Ref, co: Component, name: Rope.ROPE]; --Change the name of co to name. --
SetOrigin: PROC[co: Component, origin: IntVector] = INLINE{co.origin ← origin};--SetOrigin
--These are operations on individual component --
GetName: PROC[co: Component] RETURNS[Rope.ROPE] = INLINE {RETURN[co.name]};
GetDim: PROC[co: Component] RETURNS[x, y: NAT];
GetOrigin: PROC[co: Component] RETURNS[IntVector] = INLINE {RETURN[co.origin]};
CoActive: PROC[co: Component] RETURNS [BOOL] = INLINE {RETURN [co.active]};
DeActivateComponent: PROC[co: Component];
ReActivateComponent: PROC[co: Component];
PaintComponent: PROC [co: Component, context: Imager.Context, xOffset, yOffset: REAL ← 0.0, scaleFactor: REAL ← 1.0, stipple: CARDINAL ← IPConstants.Black, showName: BOOLTRUE]; --If showName then the name of the component will be visible--
--For Implementor --
PositionComponent: PROC[co: Component, southCoeff, eastCoeff, northCoeff, westCoeff: NAT ← 0]; --southCoeff, eastCoeff, northCoeff, and westCoeff are to position the component with respect to its surrounding channels--
GetCornerRects: PROC[co: Component, crop: INT ← 1] RETURNS[sw, se, ne, nw: Misc.Rect];
GetBRect: PROC[co: Component] RETURNS[Misc.Rect];
FindEdgeType: PROC[co: Component, ch: IPCTG.Channel] RETURNS [EdgeTypes];
GetPrinCh: PROC[co: Component, et: EdgeTypes] RETURNS [Channel];
SetPrinCh: PROC[co: Component, et: EdgeTypes, ch: Channel];
FindCornerType: PROC[co: Component, ch: IPCTG.Channel] RETURNS [CornerTypes];
GetCornerChs: PROC[co: Component, ct: CornerTypes] RETURNS [CornerChannels];
SetCornerChs: PROC[co: Component, ct: CornerTypes, cc: CornerChannels];
GetCornerChFor: PROC[co: Component, ct: CornerTypes, ot: IP.OrientationTypes] RETURNS [IPCTG.Channel];
SetCornerChs2: PROC[co: Component, ct: CornerTypes, horCh, verCh: IPCTG.Channel];
GetCornerSp: PROC[co: Component, ct: CornerTypes] RETURNS [CornerSpace];
GetCornerSps: PROC[co: Component] RETURNS [sw, se, ne, nw: CornerSpace];
GetChOnSide: PROC[co: Component, side: IP.PinSideType, useParrallel: BOOL] RETURNS [IPCTG.Channel];
--returns NIL if side = interior or side = unknown
--useParrallel: eg. if side = swVer and co.cornerChannels.sw = NIL then
-- if useParrallel then return [west] else return [south]
InsertComponent: PROC [co: Component, south, east, north, west: Channel, sw, se, ne,nw: CornerChannels ← NIL];
ConstrainChannels: PROC[co: Component, chs: IPCTG.Ref]; --Impose the constraints between thee surrounding channels resulting from the dimension of the component--
FromEdge: PROC[co: Component, edge: EdgeTypes, edgeAt: INT] RETURNS [coord: INT];
FromCorner: PROC[co: Component, corner: CornerTypes, CornerAtX, CornerAtY: INT] RETURNS [xCoord, yCoord: INT];
CCGetCh: PROC[cc: CornerChannels, ot: IP.OrientationTypes] RETURNS [IPCTG.Channel]; --CCGetCh--
--Operation to manipulate component shape
OrientCoShape: PROC[co: Component, operation: IP.Orientation];
OrientCoShapeChk: PROC[co: Component, operation: IP.Orientation] RETURNS [BOOL];
END.