DIRECTORY CD, CDBasics, CDCells, CDDirectory, CDInstances, CDOrient, CDProperties, Rope, CDSimpleCells; CDSimpleCellsImpl: CEDAR PROGRAM IMPORTS CD, CDBasics, CDCells, CDDirectory, CDInstances, CDOrient, CDProperties, Rope EXPORTS CDSimpleCells = BEGIN InstRec: TYPE = CDSimpleCells.InstRec; Direction: TYPE = CDSimpleCells.Direction; CreateSimpleCell: PUBLIC PROC [design: CD.Design, contents: LIST OF InstRec, cellName: Rope.ROPE _ NIL, direction: Direction _ right, alignHigh: BOOL _ FALSE] RETURNS [CD.Object] = BEGIN r: CD.Rect _ [0, 0, 0, 0]; c: CD.Object = CDCells.CreateEmptyCell[]; inst: CD.Instance; pos: CD.Position _ [0, 0]; IF Rope.IsEmpty[cellName] THEN cellName _ "-SimpleCell"; NARROW[c.specificRef, CD.CellPtr].name _ cellName; FOR list: LIST OF InstRec _ contents, list.rest WHILE list#NIL DO sz: CD.Position; IF list.first.ob=NIL THEN LOOP; sz _ CDOrient.OrientedSize[CDBasics.SizeOfRect[CD.InterestRect[list.first.ob]], list.first.orient]; SELECT direction FROM right => {pos.x _ r.x2}; left => {pos.x _ r.x1-sz.x}; up => {pos.y _ r.y2}; down => {pos.y _ r.y1-sz.y}; none => {pos _ [0, 0]}; ENDCASE => ERROR; IF alignHigh THEN SELECT direction FROM right, left => {pos.y _ -sz.y}; up, down => {pos.x _ -sz.x}; none => {pos _ [-sz.x, -sz.y]}; ENDCASE => ERROR; inst _ CDCells.IncludeOb[cell: c, ob: list.first.ob, position: [pos.x+list.first.dX, pos.y+list.first.dY], orientation: list.first.orient, cellCSystem: cdCoords, obCSystem: interrestCoords, mode: dontPropagate ].newInst; r _ CDInstances.InstRectI[inst]; IF list.first.properties#NIL THEN inst.properties _ CDProperties.AppendProps[inst.properties, list.first.properties]; IF ~Rope.IsEmpty[list.first.name] THEN CDProperties.PutPropOnInstance[inst, $InstanceName, list.first.name]; ENDLOOP; [] _ CDCells.RepositionCell[c, NIL]; IF design#NIL THEN [] _ CDDirectory.Include[design, c]; RETURN[c] END; END. €CDSimpleCellsImpl.mesa by Ch. Jacobi, June 10, 1985 12:06:12 pm PDT last edited Ch. Jacobi, July 10, 1985 9:50:09 am PDT ʶ˜šœ™Jšœ,™,Jšœ4™4—J˜šÏk ˜ Jšœ˜Jšœ ˜ Jšœ˜Jšœ ˜ Jšœ ˜ Jšœ ˜ Jšœ ˜ Jšœ˜Jšœ˜—J˜šÏbœœ˜ JšœœL˜VJšœ˜—Jšœ˜J˜Jšœ œ˜&Jšœ œ˜*J˜šÏnœœœ œœœœœ+œœœœ ˜´Jš˜Jšœœ˜Jšœœ$˜)Jšœœ ˜Jšœœ˜Jšœœ˜8Jšœœ˜2š œœœœœ˜AJšœœ ˜Jšœœœœ˜Jšœ/œ2˜cšœ ˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœœ˜—šœ ˜šœ ˜Jšœ˜Jšœ˜Jšœ!˜!Jšœœ˜——šœ5˜5Jšœ5˜5Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ ˜ —Jšœ ˜ šœœ˜!JšœS˜S—šœ ˜&JšœE˜E—Jšœ˜—Jšœœ˜$Jšœœœ%˜7Jšœ˜ Jšœ˜—J˜Jšœ˜J˜—…—n ¤