DIRECTORY LichenDataStructure, LichenSetTheory, IO; LichenTransforms: CEDAR DEFINITIONS = BEGIN OPEN LichenDataStructure, LichenSetTheory; IntroCellType: PROC [design: Design] RETURNS [newCT: CellType]; ExtroCellType: PROC [design: Design, oldCT: CellType]; Differentiate: PROC [design: Design, instances: Set--of Vertex--] RETURNS [newCT: CellType]; Undifferentiate: PROC [design: Design, toType, fromType: CellType] RETURNS [changed: Set--of Vertex--]; LowerChildren: PROC [design: Design, childType: CellType, sibber: Mapper--child _ RefSeq (role _ sibling: Vertex)--] RETURNS [gcs: RefSeq--role _ grandchild--, children: Set--of Vertex--]; RaiseGrandchildren: PROC [design: Design, gcs: Set--of Vertex--] RETURNS [childType: CellType, sibber: Mapper--child _ RefSeq (role _ sibling: Vertex)--]; MergeTypes: PROC [design: Design, pairs: OneToOne--instances of from f instances of into--]; SplitType: PROC [design: Design, fizz: Set--of CellInstance--] RETURNS [from, to: CellType, pairs: OneToOne--instances of from f instances of to--]; ExpandType: PROC [design: Design, cellType: CellType] RETURNS [mapper: Mapper--Vertex _ RefSeq (role _ sibling: Vertex)--]; ExpandVertex: PROC [child: CellInstance] RETURNS [roleToSib: RefSeq--role _ sibling: CellInstance--]; ExpandChildren: PROC [design: Design, parent: CellType, flatten: BOOL _ FALSE]; Flatten: PROC [root: CellType, expand: Filter--of CellInstance--]; GroupType: PROC [design: Design, mapper: Mapper--any _ RefSeq (role _ sibling: CellInstance)--] RETURNS [newType: CellType, pairs: OneToOne--domain of mapper f instances of newType--]; END. ΠLichenTransforms.Mesa Last tweaked by Mike Spreitzer on May 5, 1987 10:50:30 am PDT Pre: newCT N design Post: newCT B design & empty newCT & |instances of newCT|=0 Pre: newCT B design & (empty newCT V |instances of newCT|=0) Post: newCT N design Pre: E oldCT A i B instances: i of oldCT Post: (instances of newCT) = instances & equiv(newCT, oldCT) Pre: A i B changed: i of fromType & equiv(fromType, toType) Post: A i B changed: i of toType Pre: (dom sibber)=(instances of childType). A c of childType: (dom range sibber(c)) = [0 .. |gcs|). A c of childType, n B dom sibber(c): parent(c)=parent(sibber(c)[n]). Post: A c of childType, n B dom sibber(c): type of sibber(c)[n] = type of gcs[n]. children = instances of childType. A n: parent of gcs[n] = childType. A c of childType, n B dom sibber(c): sibber(c)[n] ~~ gcs[n]. Inverse of RaiseGrandchildren. Equivalent to [temp, pairs] _ GroupType[sibber]; MergeTypes[reverse pairs]. Pre: A gc B gcs: parent(gc) = childType. Post: (dom sibber) = (instances of childType). A c of childType: (dom range sibber(c)) = [0 .. |gcs|). A c of childType, n B dom sibber(c): parent(c)=parent(sibber(c)[n]). A c of childType, n B dom sibber(c): type of sibber(c)[n] = type of gcs[n]. A c of childType, n B dom sibber(c): sibber(c)[n] ~~ gcs[n]. Inverse of LowerChildren. Equivalent to [childType, temp, pairs] _ SplitType[gcs]; ss _ ExpandType[temp]; sibber _ (l_r pairs)gss. Each pair is replaced by an instance of the new version of into, which got the contents of from merged into it. Cell type from is then deleted. Inverse of SplitType. Equivalent to [from, sibber]_RaiseGrandchildren[(children of from)]; LowerChildren[into, (r_l pairs)gsibber]; DeleteCellTypeAndInstances[from]. The fizz must all be components of from; they are moved into the new cell type to. At each instance of from, an instance of to is created. Inverse of MergeTypes. Equivalent to to_CreateCellType[]; at each instance of from instantiate to; [from, sibber]_RaiseGrandchildren[fizz]; LowerChildren[to, (r_l pairs)gsibber]. Replaces each instance of cellType with the contents of cellType. Inverse of GroupType. Equivalent to [cellType, sibber] _ RaiseGrandchildren[(contents of cellType)]; delete new version of cellType and all its instances. replaces child with its contents. Equivalent to Differentiate[{child}] then ExpandType[(new type of child)]. If flatten then ExpandVertex[each composite descendant] else ExpandVertex[each composite child]. For each pair in the mapping, replace the range of the range with an instance of the new cell type. Inverse of ExpandType. Equivalent to: introduce newType; instantiate it in the parent of each set of instances; LowerChildren[newType, an instance of newType _ the set of instances it is for]. Κ―– "cedar" style˜code™K™=—K˜KšΟk œ'œ˜3K˜šΠbxœœ œ˜%K˜Kšœœ&˜0K˜šΟn œœœ˜?Kšœ Οmœ™Kšœ  œ œ  œ™;—K˜šŸ œœ#˜6Kšœ  œ œ œ™