DIRECTORY CD, CDRepetitions, TerminalIO, CDSequencer, CDApplications, CDCells, CDCallSpecific, CDOps, CDOrient; RepetitionCommands: CEDAR PROGRAM IMPORTS CDCallSpecific, CDRepetitions, TerminalIO, CDSequencer, CDApplications, CDCells, CDOps = BEGIN HasSingleSelected: PROC [list: CD.ApplicationList] RETURNS [BOOLEAN] = BEGIN firstFound: BOOLEAN _ FALSE; FOR w: CD.ApplicationList _ list, w.rest WHILE w#NIL DO IF w.first.selected THEN IF firstFound THEN RETURN [FALSE] ELSE firstFound _ TRUE; ENDLOOP; RETURN [firstFound] END; 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; 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; CDSequencer.ImplementCommand[$DrawRepetition, MakeRepetition]; CDSequencer.ImplementCommand[$TransformToCellS, TransformToCellS]; END. šRepetitionCommands.mesa (part of Chipndale) by Christian Jacobi July 11, 1983 3:42 pm last edited Christian Jacobi November 2, 1983 4:06 pm ʦ˜Jšœ-™-Jšœ,™,Jšœ7™7J˜šÏk ˜ Jšœ˜J˜J˜ J˜ J˜J˜J˜J˜J˜ J˜—šÏnœœ˜!JšœZ˜a—Jš˜J˜š žœœœœœ˜FJš˜Jšœ œœ˜š œœ œœ˜7šœ˜Jšœ œœœ˜!Jšœœ˜—Jšœ˜—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šœœ˜J˜,J˜BJ˜GJšœ˜J˜—˜J˜—J˜>JšœB˜BJšœ˜J˜J˜J˜J˜—…—æ &