CCG: CEDAR DEFINITIONS = BEGIN Ref: TYPE = REF Rep; Rep: TYPE; NodeIndex: TYPE = [1..MaxGraphSize]; MaxGraphSize: NAT = 200; --%Restriction on the maximum number of nodes in the graph %-- MaxEdges: NAT = 20; --%Restriction on the maximum number of edges between nodes%-- GraphDirection: TYPE = {pos, neg}; InvalidNode: ERROR; FindRootError: ERROR[reason: Reasons1]; AssignNodeError: ERROR[reason: Reasons2]; Reasons1: TYPE ={NoRoot, MulitpleRoots}; Reasons2: TYPE ={NotARoot, CyclicGraph}; CleanUpChsProc: TYPE = PROC[chToDestroy, chToMove: REF]; EachChAction: TYPE = PROC[ch: REF] RETURNS [quit: BOOL _ FALSE]; Create: PROC[] RETURNS[Ref]; CreateNode: PROC[grph: Ref, ch: REF _ NIL] RETURNS[NodeIndex]; DestroyNode: PROC[grph: Ref, node: NodeIndex, p: CleanUpChsProc]; Size: PROC [grph: Ref] RETURNS [NAT]; ConstrainNodes: PROC[grph: Ref, negNd, posNd: NodeIndex, wt: INT]; CyclicConstrainp: PROC [grph: Ref, negNd, posNd: NodeIndex] RETURNS [cyclic: BOOL]; ResetNode: PROC[grph: Ref, nd: NodeIndex]; -- Clears the nodes so that it can be reused for the next position assignment-- ResetAllNodes: PROC[grph: Ref]; PosAssignNodePosition: PROC[grph: Ref, root: NodeIndex]; NegAssignNodePosition:PROC[grph: Ref, root: NodeIndex]; NodePosition: PROC[grph: Ref, nd: NodeIndex, which: GraphDirection] RETURNS[INT]; SetNodePosition: PROC[grph: Ref, nd: NodeIndex, which: GraphDirection, position: INT]; FindRoot: PROC[grph: Ref, which: GraphDirection] RETURNS[nd: NodeIndex]; GetCh: PROC[grph: Ref, nd: NodeIndex] RETURNS [REF]; Chs: PROC[grph: Ref, p: EachChAction] RETURNS [BOOL]; --Apply p to ch in all nodes of grph or until p returns True. -- Chs returns true <=> p returns true on none of the ch. END. -- File: CCG.mesa -- Last Edited by: CSChow, February 1, 1985 8:07:16 am PST --Note: CCG = ChannelConstraintGraph -- This is a bidirectional directed graph. Each node in the graph correspond to one channels. -- There are two sets of graphs for a layout, viz, a horizontal graph and a vertical graph. -- Each of which consist of two directed graphs (ie. bottomToTop & topToBottom, -- and leftToRight & rightToLeft.) These graphs are used to compute the -- geometrical information of ChannelTopologyGraph.-- --ch is associated with the node -- ch is a ref any to make it more general --if there is no edge between negNd and posNd create one with weight wt -- else set weight of existing edge to max. of wt and previous weight -- NB: This implies there is at most one edge between any pair of nodes --TRUE iff add constrain between negNd and posNd will result in a cycle in grph -- = {FOR nd: NodeIndex IN [1..grph.size] DO ResetNode[grph, nd] ENDLOOP}; -- Do position assignment in positive direction (left-to-right or bottom-to-top) --Do position assignment in negative direction --Get position of node (after assignment.) -- Used to set the starting position on root node --! ERROR FindRootError -- Get the ch created associated with the node JJ::JJ$J^J\JOJHJ5JJk JJJ J $Jc>WJ >RJIcode "Cedar" style"K "Cedar" styleK "Cedar" style K "Cedar" styleK "Cedar" style'K "Cedar" styleK "Cedar" style)K "Cedar" styleK "Cedar" style (K "Cedar" styleK "Cedar" style (K "Cedar" styleK "Cedar" stylen8K "Cedar" styleK "Cedar" style @K "Cedar" styleK "Cedar" styleK "Cedar" style "Cedar" style  >K "Cedar" style K "Cedar" style*K "Cedar" styleK "Cedar" style 0AK "Cedar" styleK "Cedar" style %K "Cedar" style "Cedar" style)BK "Cedar" styleGGK "Cedar" styleFK "Cedar" styleGK "Cedar" style "Cedar" style& SK "Cedar" styleOK "Cedar" style "Cedar" style +K "Cedar" styleOOK "Cedar" style "Cedar" style  K "Cedar" style JK "Cedar" style "Cedar" style8K "Cedar" stylePK "Cedar" style "Cedar" style7K "Cedar" style.K "Cedar" style "Cedar" style 2QK "Cedar" style*K "Cedar" style "Cedar" style<VK "Cedar" style1K "Cedar" style "Cedar" style#HK "Cedar" styleK "Cedar" style "Cedar" style4K "Cedar" style.K "Cedar" style "Cedar" style6K "Cedar" style>>K "Cedar" style69K "Cedar" styleK "Cedar" styler