DIRECTORY CD, CDApplications, CDCallSpecific, CDCells, CDCommandOps, CDDirectory, CDMenus, CDOps, CDOrient, CDRepetitions, CDSequencer, Rope, TerminalIO; CDRepetitionCommands: CEDAR PROGRAM IMPORTS CDApplications, CDCallSpecific, CDCells, CDCommandOps, CDDirectory, CDMenus, CDOps, CDOrient, CDRepetitions, CDSequencer, Rope, TerminalIO = BEGIN MakeRepetition: PROC [comm: CDSequencer.Command] = BEGIN sel: CD.ApplicationList; ob: CD.ObPtr; offset, location: CD.DesignPosition; count: INT; first: CD.ApplicationPtr; multiple: BOOL; TerminalIO.WriteRope["make a repetition "]; [first, multiple] _ CDOps.SelectedApplication[comm.design]; IF first=NIL THEN {TerminalIO.WriteRope["no selected object\n"]; RETURN}; count _ TerminalIO.RequestInt["number: "]; IF count<1 OR count>=LAST[NAT] THEN {TerminalIO.WriteRope["bad number\n"]; RETURN}; IF count>=257 THEN {TerminalIO.WriteRope["don't exagerate\n"]; RETURN}; IF multiple THEN { [done: multiple, cellOb: ob] _ CDCells.CreateCellSelected[comm.design, "-dummy"]; IF NOT multiple THEN {TerminalIO.WriteRope["not done\n"]; RETURN}; }; [selected: sel, others: comm.design.actual.first.specific.contents] _ CDApplications.SplitSelected[comm.design.actual.first.specific.contents]; IF sel.first=NIL OR sel.rest#NIL THEN ERROR; -- therefore sel#NIL ! offset _ [comm.pos.x-comm.sPos.x, comm.pos.y-comm.sPos.y]; ob _ CDRepetitions.CreateRepetition[comm.design, sel.first.ob, count, offset, sel.first.orientation]; location _ sel.first.location; IF offset.x<0 THEN location.x _ location.x+(count-1)*offset.x; IF offset.y<0 THEN location.y _ location.y+(count-1)*offset.y; CDOps.AddAnObject[comm.design, ob, location, CDOrient.original]; END; ChangeRepetition: PROC [comm: CDSequencer.Command] = BEGIN app: CD.ApplicationPtr = CDCommandOps.TheApplication[comm, "change a repetition "]; IF app#NIL THEN IF ~ISTYPE[app.ob.specificRef, CDRepetitions.RepPtr] THEN TerminalIO.WriteRope["selected ob not a repetition"] ELSE { offset: CD.DesignPosition = [comm.pos.x-comm.sPos.x, comm.pos.y-comm.sPos.y]; rp: CDRepetitions.RepPtr = NARROW[app.ob.specificRef]; CDCommandOps.RedrawApplication[comm.design, app]; app.ob _ CDRepetitions.CreateRepetition[comm.design, rp.ob, rp.count, offset, CDOrient.ComposeOrient[rp.orientation, app.orientation]]; app.orientation _ CDOrient.original; CDCommandOps.RedrawApplication[comm.design, app, FALSE]; TerminalIO.WriteRope[" done\n"] }; END; TransformToCellS: PROC [comm: CDSequencer.Command] = BEGIN n: NAT; TerminalIO.WriteRope["transform to cell\n"]; n _ CDCallSpecific.CallForSelected[comm.design, $TransformToCell]; TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects transformed\n"]; END; AllRepetitionsToCells: PROC [comm: CDSequencer.Command] = BEGIN n: NAT _ 0; repList: LIST OF CD.ObPtr _ NIL; FindRepetitions: CDDirectory.EachEntryAction = BEGIN WITH ob.specificRef SELECT FROM rp: CDRepetitions.RepPtr => repList _ CONS[ob, repList]; ENDCASE => NULL END; TerminalIO.WriteRope["transform all repetitions to cells\n"]; [] _ CDDirectory.Enumerate[design: comm.design, action: FindRepetitions]; FOR list: LIST OF CD.ObPtr _ repList, list.rest WHILE list#NIL DO name: Rope.ROPE _ CDDirectory.Name[list.first]; rCell: CD.ObPtr _ CDDirectory.Expand[list.first, comm.design, comm.design]; IF rCell=NIL THEN TerminalIO.WriteRope[Rope.Cat["** ", name, " not transformed\n"]] ELSE { [] _ CDDirectory.Remove[design: comm.design, name: name, expectObject: list.first]; [] _ CDDirectory.Rename[design: comm.design, object: rCell, newName: name]; n _ n+1; CDDirectory.ReplaceObject[design: comm.design, old: list.first, new: rCell]; TerminalIO.WriteRope[Rope.Cat[" cell ", CDDirectory.Name[rCell], " generated\n"]] }; ENDLOOP; TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" repetitions transformed\n"]; END; CDSequencer.ImplementCommand[$DrawRepetition, MakeRepetition]; CDSequencer.ImplementCommand[$ChangeRepetition, ChangeRepetition]; CDSequencer.ImplementCommand[$TransformToCellS, TransformToCellS]; CDSequencer.ImplementCommand[$AllRepetitionsToCells, AllRepetitionsToCells,, dontQueue]; --XXXXX CDMenus.CreateEntry[$SpecialMenu, "ALL rep->cell", $AllRepetitionsToCells]; END. tCDRepetitionCommands.mesa (part of ChipNDale) Copyright c 1983, 1984 by Xerox Corporation. All rights reserved. by Christian Jacobi, July 11, 1983 3:42 pm last edited Christian Jacobi, December 4, 1984 2:39:18 pm PST --we make a list first, otherwise: directory changes while the enumeration -- PROC [name: Rope.ROPE, ob: CD.ObPtr] RETURNS [quit: BOOL_FALSE] Ê6˜šœ/™/Jšœ Ïmœ7™BJšœ,™,Jšœ>™>—J˜šÏk ˜ Jšžœ˜J˜J˜J˜Jšœ ˜ Jšœ ˜ Jšœ˜Jšœ˜J˜ J˜J˜ J˜J˜ J˜—šÏnœžœž˜#JšžœŽ˜•—Jšž˜J˜šŸœžœ˜2Jšž˜Jšœžœ˜Jšœžœ˜ Jšœžœ˜$Jšœžœ˜ Jšœžœ˜Jšœ žœ˜J˜-Jšœ;˜;Jšžœžœžœ0žœ˜IJ˜*š žœ žœžœžœžœ˜$Jšœ'žœ˜/šžœ žœ˜Jšœ,žœ˜4——šžœ žœ˜JšœQ˜QJšžœžœ žœ&žœ˜BJ˜—šœI˜IJ˜I—Jš žœ žœžœ žœžœžœÏc˜CJ˜:J˜eJ˜Jšžœ žœ,˜>Jšžœ žœ,˜>J˜@Jšžœ˜—J˜šŸœžœ˜4Jšž˜JšœžœM˜Tšžœžœžœ˜šžœžœ+žœ˜:Jšœ4˜4—šžœ˜JšœžœC˜MJšœžœ˜6Jšœ1˜1Jšœ‡˜‡Jšœ$˜$Jšœ1žœ˜8Jšœ˜Jšœ˜——Jšžœ˜—J˜šŸœžœ˜4Jšž˜Jšœžœ˜J˜,J˜BJ˜GJšžœ˜J˜J˜—šŸœžœ˜9Jšž˜Jšœžœ˜ š œ žœžœžœ žœ˜ JšœJ™J—J˜šÏbœ˜.JšœB™BJšž˜šžœžœž˜Jšœ&žœ˜8Jšžœž˜—Jšžœ˜—J˜Jšœ=˜=JšœI˜Iš žœžœžœžœžœžœž˜AJšœ žœ ˜/JšœžœB˜Kšžœžœžœ˜JšœA˜A—šžœ˜JšœS˜SJšœK˜KJšœ˜JšœL˜LJšœS˜SJšœ˜—Jšžœ˜—J˜KJšžœ˜J˜J˜—J˜>J˜BJšœB˜BJšœ`˜`JšœL˜LJšžœ˜J˜J˜J˜J˜—…—X