LichenTransforms.Mesa
Last tweaked by Mike Spreitzer on July 10, 1987 1:51:23 pm PDT
DIRECTORY LichenDataStructure, IO;
LichenTransforms: CEDAR DEFINITIONS =
BEGIN OPEN LichenDataStructure;
Use of CT = instance of CT or array of ct
IntroCellType: PROC [design: Design] RETURNS [newCT: CellType];
Pre: newCT design
Post: newCT  design ' empty newCT ' |uses of newCT|=0
ExtroCellType: PROC [design: Design, oldCT: CellType];
Pre: newCT  design ' (empty newCT ( |uses of newCT|=0)
Post: newCT design
Differentiate: PROC [design: Design, uses: ConstSet--of Use of oldCT--] RETURNS [newCT: CellType];
Pre:  oldCT i  uses: i of oldCT
Post: (uses of newCT) = uses ' equiv(newCT, oldCT)
Undifferentiate: PROC [design: Design, toType, fromType: CellType] RETURNS [changed: ConstSet--of Use of fromType--];
Pre: i  changed: i of fromType ' equiv(fromType, toType)
Post: i  changed: i of toType
LowerChildren: PROC [design: Design, childType: CellType, sibber: ConstFunction--instance of array*n of childType b Seq (role é sibling: instance of array*n of type of gcs[role])--] RETURNS [gcs: Seq--role é grandchild--];
Inverse of RaiseGrandchildren.
Equivalent to [, pairs, gcs] ← GroupUnorganized[sibber]; MergeTypes[pairs-1].
RaiseGrandchildren: PROC [design: Design, gcs: Seq--role é instance in childType--] RETURNS [childType: CellType, sibber: ConstFunction--instance of array*n of childType b Seq (role é sibling: instance of array*n of type of gcs[role])--, typer: ConstFunction--array*n of childType b Seq (role é array*n of type of gcs[role])--];
Inverse of LowerChildren.
Equivalent to [childType, temp, pairs] ← SplitType[gcs]; ss ← ExpandUnorganized[temp]; sibber ← pairsgss.
MergeTypes: PROC [design: Design, pairs: ConstOneToOne--instance of array* of from é instance of array* of into--];
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, pairs-1gsibber]; ExtroCellType[from].
SplitType: PROC [design: Design, fizz: ConstSet--of instance in from--] RETURNS [from, to: CellType, pairs: ConstOneToOne--instance of array* of from é instance of array* of to--];
The fizz must all be components of from; they are moved into the new cell type to. At each use of from, a corresponding use of to is created.
Inverse of MergeTypes.
Equivalent to (assuming no array+s of from) to𡤌reateCellType[]; ForEachInstance[from, l fi {ti ← Instantiate[type: to, in: fi.parent]; pairs ← pairs + <fi, ti>}]; [from, sibber]←RaiseGrandchildren[fizz]; LowerChildren[to, pairs-1gsibber].
GroupUnorganized: PROC [design: Design, mapper: ConstFunction--any b Seq (role é sibling: instance of array* of type of newType's roleth child)--] RETURNS [newType: CellType, pairs: ConstOneToOne--domain of mapper é instance of array* of newType--, gcs: Seq--role é instance in newType--];
For each pair in the mapping, replace the range of the range with an instance of the new cell type.
Inverse of ExpandUnorganized.
Equivalent to (assuming no sibling is array+ed) newType ← IntroCellType[]; mapper.Enum[l <dom, seq> {ti ← Instantiate[newType, seq[0].parent]; pairs ← pairs + <dom, ti>}]; gcs ← LowerChildren[newType, pairs-1gmapper].
ExpandUnorganized: PROC [design: Design, cellType: CellType] RETURNS [mapper: ConstFunction--instance of array*n of cellType b Seq (role é sibling: instance of array*n of type of cellType's roleth child)--];
Replaces each use of cellType with corresponding uses of the contents of cellType.
Inverse of GroupType.
Equivalent to [cellType, mapper] ← RaiseGrandchildren[<contents of cellType>]; ExtroCellType[cellType].
ExpandVertex: PROC [child: CellInstance] RETURNS [roleToSib: Seq--role é sibling: CellInstance--];
replaces child with its contents.
Equivalent to Differentiate[{child}] then ExpandUnorganized[(new type of child)].
ExpandChildren: PROC [design: Design, parent: CellType, flatten: BOOLFALSE];
If flatten then ExpandVertex[each composite descendant] else ExpandVertex[each composite child].
Flatten: PROC [root: CellType, expand: ConstFilter--of CellInstance--];
Expands the given vertices.
END.