IPCTGMaker:
CEDAR
DEFINITIONS
IMPORTS IPParams = BEGIN
-- Intro: The sole reasons for not making most of the fields below opaque is to
-- simply debugging.
Ref: TYPE = REF Rep;
Rep: TYPE = RECORD[comps: CompItems, horPreChs, verPreChs: OrderedSymbolTableRef.Table, xMin, yMin, xMax, yMax: INT];
CompItems: TYPE = REF CompItemsRep;
CompItemsRep: TYPE = RECORD[count: NAT ← 0, compItems: ARRAY CompItemIndices OF CompItem ← ALL [NIL]];
CompItemIndices: TYPE = [1..MaxCompItemCnt];
MaxCompItemCnt: NAT = 100; --%Restriction on maximum number of Components%--
MaxClusterCnt: NAT = 200; --%Restriction on maximum number of Channels%--
CompItem: TYPE = REF CompItemRep;
CompItemRep: TYPE = RECORD[co: IPCoTab.Component, prinPreChs: RECORD [south, east, north, west: PreCh ← NIL], cornerPreChs: RECORD[sw, se, ne, nw: CornerPreChs ← NIL]];
CornerPreChs:TYPE = REF CornerPreChsRep;
CornerPreChsRep: TYPE = RECORD[hor, ver: PreCh];
PreCh: TYPE = REF PreChRep;
PreChRep: TYPE = RECORD[type: IPCTG.ChType, posComp: BOOL, coord: INT, span, range: Misc.Interval, comp: IPCoTab.Component, negBnd, posBnd: PreCh, cluster: NAT ← 0];
Create: PROC[] RETURNS[Ref];
Destroy: PROC [r: Ref];
--This frees up any cyclic pointers and invalidates the instance.
-- Needed because an instance of IPCTGMaker can be reused as often as desired.
ConstructCTG: PROC[r: Ref, cV: IPCoVerifier.Ref, chWidth: INT ← IPParams.ChDefaultWidth, yPrimary, maxChWidth: BOOL ← TRUE] RETURNS[needGeom: BOOL ← FALSE, ctg: IPCTG.Ref]; --Assumed that the instance of IPCoVerifier has verified that there are no overlaps among
-- the components. If yPrimary is true then the output will tend to have more long vertical
-- running channels else it will give more long horizontal running channels. If maxChWidth
-- is true then the width of the each constructed channel will be set to the maximum possible
-- without moving the components else all channels will be set to chWidth (In any case all
-- channels will be at least chWidth wide.) The output is an instance of Channel Topology
-- Graph with the coordinates of all the channels assigned. If needGeom is true this
-- means that ctg has to be geometrized (ie. the channel position has to be reassigned)
-- otherwise some channels may intersect with the components. This arises mostly
-- because the input configuration of components does not permit the construction
-- of a valid channels structure without moving some components
END.