ComparePrivate.Mesa
Last Edited by: Spreitzer, July 10, 1984 3:20:48 pm PDT
DIRECTORY IO, OrderedSymbolTableRef, Rope;
ComparePrivate: CEDAR DEFINITIONS =
BEGIN
ROPE: TYPE = Rope.ROPE;
SymbolTable: TYPE = OrderedSymbolTableRef.Table;
Color: TYPE = HashTableIndex;
noColor: Color = LAST[Color];
HashTableIndex: TYPE = CARDINAL;
NullIndex: HashTableIndex = LAST[HashTableIndex];
VertexClass: TYPE = {net, component};
NetVertex: TYPE = REF VertexRep[net];
ComponentVertex: TYPE = REF VertexRep[component];
Vertex: TYPE = REF VertexRep;
VertexRep:
TYPE =
RECORD [
name: ROPE,
QNext: Vertex ← notInQ,
colorNext, equiv: Vertex ← NIL,
oldColor, curColor: Color ← noColor,
graph: GraphID,
unique, suspect: BOOL ← FALSE,
variant:
SELECT class: VertexClass
FROM
net => [used:
CARDINAL,
neighbors: SEQUENCE length: CARDINAL OF NetNeighbor],
component => [
ports: PortS,
neighbors: SEQUENCE length: CARDINAL OF NetVertex],
ENDCASE
];
notInQ: Vertex = NIL--but you're not supposed to know that--;
endOfQ: Vertex;
NetNeighbor: TYPE = RECORD [v: ComponentVertex, color: Color--of edge--];
ComponentType: TYPE = REF ComponentTypeRep;
ComponentTypeRep:
TYPE =
RECORD [
name, file: ROPE,
ports: PortS ← NIL];
PortS: TYPE = REF PortSeq;
PortSeq: TYPE = RECORD [ports: SEQUENCE length: CARDINAL OF Port];
Port: TYPE = RECORD [name: ROPE, color: Color];
HashTable: TYPE = REF HashTableRep;
HashTableRep:
TYPE =
RECORD [
firstNonEmpty: HashTableIndex ← NullIndex,
entries: SEQUENCE length: HashTableIndex OF HashTableEntry];
GraphID: TYPE = {A, B};
HashTableEntry:
TYPE =
RECORD [
v: Vertex ← NIL,
nextNonEmpty: HashTableIndex ← NullIndex,
count: ARRAY GraphID OF CARDINAL ← [0, 0],
newColor: Color ← noColor,
suspect, multicolored: BOOL ← FALSE
];
newColor and multicolored are indexed by oldColor; the rest by curColor.
MinHashSize: CARDINAL = 511;
graphIDToRope: ARRAY GraphID OF ROPE;
HashRope: PROC [r: ROPE, hashTableSize: CARDINAL] RETURNS [Color];
CompareCDs:
PROC [vertices: SymbolTablePair];
SymbolTablePair: TYPE = ARRAY GraphID OF SymbolTable;
Log: PROC [format: ROPE, v1, v2, v3, v4, v5: IO.Value ← [null[]]];
WriteAll: PROC [when: ROPE, vertices: SymbolTablePair, hashTable: HashTable];
END.