DIRECTORY Rope USING [ROPE], RefTab USING [Ref], IO USING[STREAM], Imager USING [Context], CCG USING[Ref], IPCB, IP USING [ChannelRep, IntersectionRep, IntersectionType, ComponentRep, ChType], IPParams USING[ChDefaultWidth]; IPCTG: CEDAR DEFINITIONS IMPORTS IPCB, IPParams = BEGIN Ref: TYPE = REF Rep; Rep: TYPE = RECORD[horCCG, verCCG: CCG.Ref, extConstraintsTable: RefTab.Ref, horChNameCounter, verChNameCounter: NAT _ 0]; Channel: TYPE = REF ChannelRep; ChannelRep: TYPE = IP.ChannelRep; Component: TYPE = REF IP.ComponentRep; ChType: TYPE = IP.ChType; Intersection: TYPE = REF IntersectionRep; IntersectionRep: TYPE = IP.IntersectionRep; IntersectionType: TYPE = IP.IntersectionType; Side: TYPE = IPCB.Side; Cross, TEnd: IntersectionType = 0; TNeg, LNeg: IntersectionType = -1; TPos, LPos: IntersectionType = 1; EachComponentAction: TYPE = IPCB.EachComponentAction; EachChannelAction: TYPE = PROC[ch: Channel] RETURNS[quit: BOOL _ FALSE]; EachIntersectionAction: TYPE = IPCB.EachIntersectionAction; ChannelTypeMismatch: ERROR; CyclicConstraints: ERROR [negCh, posCh: Channel]; Create: PROC[] RETURNS[Ref]; --Create an instance of Channel Topology Graph-- DescribeSelf: PROC[ctg: Ref, stream: IO.STREAM]; --Create a recoverable textual description of self. Used for creating checkpoint-- ReconstructSelf: PROC[stream: IO.STREAM] RETURNS [ctg: Ref]; -- Create the ctg based on the textual description in s. The reconstruction is perfect except the ref's are different. CheckSelf: PROC[ctg: Ref]; -- Check to see if everything is all right. Useful for debugging-- DestroySelf: PROC[ctg: Ref]; -- Use to clean up cyclic garabage-- PaintSelf: PROC[ctg: Ref, context: Imager.Context, xOffset, yOffset: REAL _ 0.0, scaleFactor: REAL _ 1.0, showChName: BOOL _ TRUE]; CreateChannel: PROC[ctg: Ref, type: ChType, width: INT _ IPParams.ChDefaultWidth, coord: INT _ 0, name: Rope.ROPE _ NIL] RETURNS[ch: Channel]; --Create a channel in ctg-- DeActivateChannel: PROC[ctg: Ref, ch: Channel]; ReActivateChannel: PROC[ctg: Ref, ch: Channel]; --put the channel back-- Size: PROC[ctg: Ref, type: ChType] RETURNS[INT]; --Return the number of channels of the given type GetChannel: PROC[ctg: Ref, name: Rope.ROPE, raiseError: BOOL _ TRUE] RETURNS[channel: Channel]; --Given the name get the channel. If no channel AND raiseError = TRUE then error UnknownName[name] else returns NIL DirectedChannels: PROC[ctg: Ref, p: EachChannelAction, chType: ChType] RETURNS[BOOL]; -- Enumerate all channels of chType (hor or ver) or until p returns true. Returns TRUE <=> p returns FALSE ON ALL Channels. Channels: PROC[ctg: Ref, p: EachChannelAction, horChsFirst: BOOL _ TRUE] RETURNS[BOOL]; -- Enumerate all channels or until p returns true. Returns TRUE <=> p returns FALSE ON ALL Channels. IF horChsFirst is true then all horizontal channels will be enumerated before the vertical channels else vice versa; this is an implementation dependent feature may disappear in future GetType: PROC[ch: Channel] RETURNS[ChType] = INLINE{RETURN[ch.type]}; GetCoord: PROC[ch: Channel] RETURNS[INT] = INLINE {RETURN[ch.coord]}; GetSlack: PROC[ch: Channel] RETURNS[neg, pos: INT ] = INLINE {[neg, pos] _ ch.slack}; GetWidth: PROC[ch: Channel] RETURNS[INT]= INLINE {RETURN[ch.width]}; GetName: PROC[ch: Channel] RETURNS[Rope.ROPE] = INLINE {RETURN[ch.name]}; SetWidth: PROC[ch: Channel, width: INT] = INLINE {ch.width _ width}; SetCoord: PROC[ch: Channel, coord: INT] = INLINE {ch.coord _ coord}; PaintChannel: PROC[ch: Channel, context: Imager.Context, xOffset, yOffset: REAL _ 0.0, scaleFactor: REAL _ 1.0, showName: BOOL _ TRUE]; NewIn: PROC[ch: Channel, type:IntersectionType] RETURNS [Intersection] = INLINE {RETURN [NEW[IntersectionRep _[ch: ch, type: type]]]};--NewIn-- ComputeGeometry: PROC[ctg: Ref, xPosition, yPosition: INT, horPosSense, verPosSense: BOOL _ TRUE]; -- This computes the positions and the slacks of all the channels -- GetBoundingChannels: PROC[ctg: Ref] RETURNS [southMost, eastMost, northMost, westMost: Channel]; --This find the bounding channels of the assembly-- IsBoundingChannel: PROC[ctg: Ref, ch: Channel] RETURNS [BOOL]; -- TRUE iff ch is a bounding channel of the assembly RefreshAllConstraints: PROC [ctg: Ref]; AddExternalConstraints: PROC[ctg: Ref]; --This actually add the external constraints set to the channels. The lifetime of constraints is also until the next invocation of Compute Geometry-- SetExternalConstraint: PROC[ctg: Ref, negCh, posCh: Channel, wt: INT]; --This is the same as the above except that all external constraints will be remembered until explicitly cleared-- ClearExternalConstraints: PROC[ctg: Ref, negCh, posCh: Channel]; ClearAllExternalConstraints: PROC[ctg: Ref]; AddTopologicalConstraints: PROC[ctg: Ref]; --This add the topological constraints to the model. Topological constraints are like imposed to preserved the topology of the channel intersection. The lifetime of the constraints is until the next invocation of Compute Geometry-- ConstrainChannels0: PROC[ctg: Ref, negCh, posCh: Channel, wt: INT]; --This set a constraint between channels. It will be used in the next computation of geometrical information but will be forgotten afterwards. It is meant to be called by a program-- ConstrainChannels: PROC[ctg: Ref, negCh, posCh: Channel, wt: INT]; --This is the same as ConstrainChannels0[ctg, negCh, posCh, wt + negChWidth/2 + posChWidth/2]-- InsertCoAt: PROC[ch: Channel, co: Component, whichSide, whichEnd: Side] = INLINE {IPCB.InsertCoAt[ch.boundary, co, whichSide, whichEnd]}; InsertCoBetween: PROC[ch: Channel, co: Component, negBnd, posBnd: Channel, which: Side]= INLINE{IPCB.InsertCoBetween[ch.boundary, co, negBnd, posBnd, which]}; SetBoundary: PROC[ch: Channel, negEnd, posEnd: Intersection, negSide, posSide: LIST OF Intersection _ NIL] = INLINE {IPCB.SetBoundary[ch.boundary, negEnd, posEnd, negSide, posSide]}; -- SetBoundary-- ComponentOn: PROC[ch: Channel, co: Component, which: Side] RETURNS[BOOL] = INLINE {RETURN[IPCB.ComponentOn[ch.boundary, co, which]]}; --ComponentOn-- EndCh: PROC[refCh, ch: Channel] RETURNS [BOOL] = INLINE { RETURN [IPCB.EndCh[refCh.boundary, ch]]}; --EndCh-- GetChNbr: PROC[refCh, ch: Channel, whichNbr, hint: Side] RETURNS [Channel] = INLINE { RETURN [IPCB.GetChNbr[refCh.boundary, ch, whichNbr, hint]]}; End: PROC[ch: Channel, which: Side] RETURNS[Intersection]; NthComponent: PROC [ch: Channel, which: Side, n: INT] RETURNS[Component]; NthIntersection: PROC[ch: Channel, which: Side, n: INT] RETURNS[Intersection]; IntersectsCh: PROC[refCh, ch: Channel] RETURNS [BOOL]= INLINE{RETURN [IPCB.IntersectsCh[refCh.boundary, ch]]}; Components: PROC[ch: Channel, which: Side, p: EachComponentAction] RETURNS[BOOL]; Intersections: PROC[ch: Channel, which: Side, p: EachIntersectionAction] RETURNS[BOOL]; NoIntersection: PROC[ch: Channel, which: Side] RETURNS[BOOL]; NoComponent: PROC[ch: Channel, which: Side] RETURNS[BOOL]; ArmOn: PROC[refCh: Channel, ch: Channel, which: Side] RETURNS [BOOL] = INLINE { RETURN [IPCB.ArmOn[refCh.boundary, ch, which]]}; --ArmOn-- InCount: PROC[refCh, ch: IPCTG.Channel, which: IPCB.Side] RETURNS [INT] = INLINE{ RETURN [IPCB.InCount[refCh.boundary, ch, which]]}; --InCount-- Length: PROC[ch: Channel] RETURNS [INT] = INLINE{ RETURN [End[ch, pos].ch.coord - End[ch, neg].ch.coord]};--Length Bounds: PROC[ch: Channel] RETURNS [neg, pos: INT] = INLINE { RETURN [End[ch, neg].ch.coord, End[ch, pos].ch.coord]}; --Bounds END. r-- File: IPCTG.mesa -- Last Edited by: CSChow, February 2, 1985 2:53:20 am PST Preas, August 1, 1986 4:33:38 pm PDT changed definition of CreateChannel, Size November 30, 1987 2:42:26 pm PST --Note: IPCTG = ChannelTopologyGraph --Intro: This is a collection of all the channels and information on their intersection topology. -- At this point the only interesting top level thing this interface do are --These are the top level global operations on IPCTG-- --remove the channel, inverse of ReActivateChannel-- --These are operations on individual channel -- --Operations on intersection-- --##################-- Κ‘˜Jšœ™šœ:™:Icode™$KšœΟnœ!™J—J˜J™$J™J™bJ™KšΟk ˜ K– "Cedar" stylešœžœžœ˜K– "Cedar" stylešœžœ˜K– "Cedar" stylešžœžœžœ˜K– "Cedar" stylešœžœ ˜K– "Cedar" stylešžœžœ˜K– "Cedar" stylešžœ˜K– "Cedar" stylešžœžœG˜OK– "Cedar" stylešœ žœ˜—J˜šžœžœž œ˜Jšžœžœ˜Jšœž˜J˜Jšœžœžœ˜J™Jš œžœžœžœKžœ˜zJšœ žœžœ ˜Jšœ žœžœ ˜!Jšœ žœžœžœ˜&J˜Jšœžœžœ˜Jšœžœžœ˜)Jšœžœžœ˜+Jšœžœžœ˜-Jšœžœžœ˜Jšœ"˜"Jšœ"˜"Jšœ!˜!Jšœžœžœ˜5Jš œžœžœžœžœžœ˜HJšœžœžœ˜;J˜Jšœžœ˜Jšœžœ˜1J˜K– "Cedar" style˜K– "Cedar" style™K– "Cedar" style™6– "Cedar" stylešœžœžœ˜K– "Cedar" stylešΟc0˜0—K– "Cedar" style˜– "Cedar" styleš œžœžœžœ˜1K– "Cedar" stylešŸR˜R—K– "Cedar" style˜– "Cedar" styleš œžœ žœžœžœ ˜=K– "Cedar" stylešŸv˜v—K– "Cedar" style˜– "Cedar" styleš œžœ ˜K– "Cedar" stylešŸB˜B—K– "Cedar" style˜– "Cedar" styleš œžœ ˜K– "Cedar" stylešŸ$˜$—K– "Cedar" style˜K– "Cedar" styleš  œžœ6žœžœžœžœ˜ƒK– "Cedar" style˜– "Cedar" styleš œžœ žœ#žœžœžœžœ˜K– "Cedar" stylešŸ˜—K– "Cedar" style˜– "Cedar" stylešœžœ˜0K– "Cedar" stylešœ4™4—K– "Cedar" style˜– "Cedar" stylešœžœ˜0K– "Cedar" stylešŸ˜—K– "Cedar" style˜– "Cedar" stylešœžœžœžœ˜1K– "Cedar" stylešŸ1˜1—K– "Cedar" style˜– "Cedar" styleš  œžœžœžœžœžœ˜`K– "Cedar" stylešŸt˜t—K– "Cedar" style˜– "Cedar" stylešœžœ1žœžœ˜UK– "Cedar" stylešŸ{˜{—K– "Cedar" style˜– "Cedar" styleš œžœ.žœžœžœžœ˜WK– "Cedar" stylešŸhœ Ÿͺ˜—K– "Cedar" style˜K– "Cedar" stylešœ/™/K– "Cedar" styleš œžœžœ žœžœ ˜EK– "Cedar" style˜K– "Cedar" styleš œžœžœžœžœžœ ˜FK– "Cedar" style˜K– "Cedar" stylešœžœžœžœ˜UK– "Cedar" style˜K– "Cedar" styleš œžœžœžœžœžœ ˜DK– "Cedar" style˜K– "Cedar" styleš œžœžœžœžœžœ ˜JK– "Cedar" style˜K– "Cedar" stylešœžœžœžœ˜DK– "Cedar" style˜K– "Cedar" stylešœžœžœžœ˜DK– "Cedar" style˜K– "Cedar" style˜K– "Cedar" styleš  œžœ9žœžœžœžœ˜‡K– "Cedar" style˜K– "Cedar" stylešœ™K– "Cedar" style™K– "Cedar" styleš œžœ%žœžœžœžœ*Ÿ ˜K– "Cedar" style˜K– "Cedar" styleš œžœ!žœžœžœŸDœ˜©K– "Cedar" stylešœžœ žœ6Ÿ3˜”K– "Cedar" styleš œžœžœžœŸ4˜sK– "Cedar" stylešœžœ ˜'K– "Cedar" stylešœžœ Ÿ•˜½K– "Cedar" stylešœžœ&žœŸr˜ΉK– "Cedar" stylešœžœ"˜@K– "Cedar" stylešœžœ ˜,K– "Cedar" stylešœžœ Ÿη˜’K– "Cedar" stylešœžœ&žœŸΆ˜ϊK– "Cedar" stylešœžœ&žœŸ_œ˜£K– "Cedar" style™K– "Cedar" stylešœ™K– "Cedar" styleš œžœ:žœžœ3˜‰K– "Cedar" stylešœžœDžœžœ:˜žK– "Cedar" style˜K– "Cedar" styleš œžœ?žœžœžœžœžœ>Ÿ˜ΙK– "Cedar" styleš œžœ*žœžœžœžœžœ(Ÿ œ˜•K– "Cedar" style˜– "Cedar" styleš œžœžœžœžœ˜9K– "Cedar" stylešžœžœŸœ˜3—K– "Cedar" style˜– "Cedar" stylešœžœ+žœ žœ˜UK– "Cedar" stylešžœžœ0˜<—K– "Cedar" stylešœžœžœ˜;K– "Cedar" style˜K– "Cedar" styleš œžœžœžœ ˜IK– "Cedar" style˜K– "Cedar" stylešœžœžœžœ˜OK– "Cedar" style˜K– "Cedar" styleš œžœžœžœžœžœžœ$˜nK– "Cedar" style˜K– "Cedar" styleš œžœ4žœžœ˜RK– "Cedar" style˜K– "Cedar" styleš œžœ6žœžœ˜WK– "Cedar" style˜K– "Cedar" stylešœžœžœžœ˜>K– "Cedar" style˜K– "Cedar" styleš œžœžœžœ˜;K– "Cedar" style˜– "Cedar" styleš œžœ+žœžœžœ˜OK– "Cedar" stylešžœžœ%Ÿž˜:—šœžœ žœžœžœžœžœ˜QKšžœžœ'Ÿ œ˜>—K– "Cedar" style˜– "Cedar" styleš œžœžœžœžœ˜1K– "Cedar" stylešžœ2Ÿ˜@—K– "Cedar" style˜– "Cedar" styleš œžœžœ žœžœ˜