DIRECTORY CD, CDCore, CDOrient, CDUtil, Core, CoreClasses, CoreProperties, Rope; CDMoreCoreGeneratorsImpl: CEDAR MONITOR IMPORTS CDCore, CDUtil, CoreClasses, CoreProperties = BEGIN ToOrient: PROC [x: REF] RETURNS [o: CD.Orientation _ CD.original] = BEGIN WITH x SELECT FROM p: REF CD.Orientation => o _ p^; a: ATOM => SELECT a FROM $original => o _ CDOrient.original; $mirrorX => o _ CDOrient.mirrorX; $rotate90 => o _ CDOrient.rotate90; $rotate90X => o _ CDOrient.rotate90X; $rotate180 => o _ CDOrient.rotate180; $rotate180X => o _ CDOrient.rotate180X; $mirrorY => o _ CDOrient.mirrorY; $rotate270 => o _ CDOrient.rotate270; $rotate270X => o _ CDOrient.rotate270X; ENDCASE => ERROR; ENDCASE => IF x#NIL THEN ERROR; END; ToDir: PROC [x: REF] RETURNS [dir: CDUtil.Direction _ right] = BEGIN WITH x SELECT FROM p: REF CDUtil.Direction => dir _ p^; a: ATOM => SELECT a FROM $right => dir _ right; $up => dir _ up; $left => dir _ left; $down => dir _ down; $none => dir _ none; ENDCASE => ERROR; ENDCASE => IF x#NIL THEN ERROR; END; RecastToRecord: PROC [c: Core.CellType] RETURNS [cell: Core.CellType] = BEGIN cell _ c; WHILE cell.class#CoreClasses.recordCellClass DO cell _ cell.class.recast[cell]; ENDLOOP; END; CDAbutGenerator: CDCore.CreateProc = BEGIN dir: CDUtil.Direction; instL: LIST OF CDUtil.InstRec _ NIL; reOrdered: CoreClasses.CellInstanceList; name: Rope.ROPE _ coreCellType.name; coreCellType _ RecastToRecord[coreCellType]; IF param=NIL THEN dir _ right ELSE dir _ ToDir[param.first]; FOR l: CoreClasses.CellInstanceList _ NARROW[coreCellType.data, CoreClasses.RecordCellType].instances, l.rest WHILE l#NIL DO reOrdered _ CONS[l.first, reOrdered]; ENDLOOP; FOR list: CoreClasses.CellInstanceList _ reOrdered, list.rest WHILE list#NIL DO inst: CDUtil.InstRec = [ ob: CDCore.CreateCDFromCore[coreDesign: coreDesign, coreCellType: list.first.type, cdDesign: cdDesign], name: list.first.name, orient: ToOrient[CoreProperties.GetProp[list.first.properties, $CDOrient]] ]; instL _ CONS[inst, instL]; ENDLOOP; ob _ CDUtil.CreateSimpleCell[design: cdDesign, contents: instL, direction: dir, cellName: name] END; CDCore.RegisterGenerator[CDAbutGenerator, $Abut]; END. DCDMoreCoreGeneratorsImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. by Christian Jacobi, August 14, 1985 2:35:33 pm PDT Last Edited by Christian Jacobi, October 4, 1985 4:44:52 pm PDT --make a reordered copy of the Core instance list --build a CDUtil instance list --build the resulting object Ęg˜šœ™Jšœ Ďmœ1™Jšž˜šžœžœž˜Jšœžœ˜%šœžœžœž˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšžœžœ˜—Jš žœžœžœžœžœ˜—Jšžœ˜J˜—š œžœžœ˜GJšž˜Jšœ ˜ šžœ(ž˜/Jšœ˜Jšžœ˜—Jšžœ˜—J˜šŸœ˜$Jšž˜Jšœ˜Jšœžœžœžœ˜$Jšœ(˜(Jšœ$˜$Jšœ,˜,Jšžœžœžœ žœ˜