DIRECTORY CD, CDOps, CDPanelFonts, CDSatellites, CDSequencer, CDTexts, IO, Rope, TerminalIO; CDSatellitesCommands: CEDAR PROGRAM IMPORTS CD, CDOps, CDPanelFonts, CDSatellites, CDSequencer, CDTexts, IO, TerminalIO = BEGIN CountAssociated: PROC [design: CD.Design, master: REF] RETURNS [n: INT_0] = { FOR w: CD.InstanceList _ CDOps.InstList[design], w.rest WHILE w#NIL DO IF CDTexts.IsText[w.first.ob] AND CDSatellites.IsAssociated[master, w.first] THEN n _ n+1; ENDLOOP; }; SelectWithMaster: PROC [design: CD.Design, master: REF, deselectOthers: BOOL_TRUE] RETURNS [n: INT_0] = { FOR w: CD.InstanceList _ CDOps.InstList[design], w.rest WHILE w#NIL DO IF CDTexts.IsText[w.first.ob] AND CDSatellites.IsAssociated[master, w.first] THEN { n _ n+1; SelectInst[design, w.first] } ELSE IF master=w.first THEN SelectInst[design, w.first] ELSE IF deselectOthers THEN DeSelectInst[design, w.first] ENDLOOP; }; SelectObjectSatellites: PROC [design: CD.Design, exclusive: BOOL_TRUE] = { n, m: INT; ob: CD.Object _ CDOps.PushedTopCell[design]; [] _ CDSatellites.GetSatellites[ob]; --reinstalls invariants n _ SelectWithMaster[design, ob, exclusive]; m _ CountAssociated[design, NIL]; IF m>0 THEN TerminalIO.PutF["select object satellites of pushed in cell: %g satellite(s) selected; %g non-associated texts found\n", [integer[n]], [integer[m]]] ELSE TerminalIO.PutF["select object satellites of pushed in cell: %g satellite(s) selected; (all texts are satellites)\n", [integer[n]]] }; SelectNonSatellites: PROC [design: CD.Design, exclusive: BOOL_TRUE] = { n, m: INT; ob: CD.Object _ CDOps.PushedTopCell[design]; [] _ CDSatellites.GetSatellites[ob]; --reinstalls invariants n _ SelectWithMaster[design, NIL, exclusive]; m _ CountAssociated[design, ob]; TerminalIO.PutF["select non-associated texts: %g text(s) selected; (%g text(s) are object satellites)\n", [integer[n]], [integer[m]]]; }; SelectInstanceSatellites: PROC [design: CD.Design, inst: CD.Instance, exclusive: BOOL_TRUE] = { n: INT; ob: CD.Object _ CDOps.PushedTopCell[design]; IF inst=NIL OR CDTexts.IsText[inst.ob] THEN ERROR; [] _ CDSatellites.GetSatellites[ob]; --reinstalls invariants n _ SelectWithMaster[design, inst, exclusive]; TerminalIO.PutF["select instance satellites of %g; %g satellite(s)\n", [rope[CD.Describe[inst.ob, inst.properties, design]]], [integer[n]] ] }; SelectSatellitesComm: PROC [comm: CDSequencer.Command] = { inst: CD.Instance; multiple: BOOL; exclusive: BOOL = TRUE; [inst, multiple] _ CDOps.SelectedInstance[comm.design]; SELECT TRUE FROM multiple => TerminalIO.PutRope["multiple selection; cant do select satellites\n"]; inst=NIL => SelectObjectSatellites[comm.design, exclusive]; CDTexts.IsText[inst.ob] => WITH CDSatellites.GetMaster[CDOps.PushedTopCell[comm.design], inst] SELECT FROM i: CD.Instance => SelectInstanceSatellites[comm.design, i, exclusive]; o: CD.Object => SelectObjectSatellites[comm.design, exclusive]; ENDCASE => SelectNonSatellites[comm.design, exclusive]; ~CDTexts.IsText[inst.ob] => SelectInstanceSatellites[comm.design, inst, exclusive]; ENDCASE => NULL; }; SelectUnAssociatedTextsComm: PROC [comm: CDSequencer.Command] = { SelectNonSatellites[comm.design, TRUE]; }; SelectObjectSatellitesComm: PROC [comm: CDSequencer.Command] = { SelectObjectSatellites[comm.design, TRUE]; }; SetInstanceSatellites: PROC [design: CD.Design, exclusive: BOOL] RETURNS [n: INT_0] = { satellites: CD.InstanceList _ NIL; master: CD.Instance _ NIL; ob: CD.Object _ CDOps.PushedTopCell[design]; [] _ CDSatellites.GetSatellites[ob]; --reinstalls invariants FOR w: CD.InstanceList _ CDOps.InstList[design], w.rest WHILE w#NIL DO IF w.first.selected THEN { IF CDTexts.IsText[w.first.ob] THEN satellites _ CONS[w.first, satellites] ELSE { IF master#NIL THEN CDSequencer.Quit["failed: more than one master selected"]; master _ w.first } } ENDLOOP; IF master=NIL THEN CDSequencer.Quit["failed: no master selected"]; IF exclusive THEN CDSatellites.Associate[master, NIL]; FOR w: CD.InstanceList _ satellites, w.rest WHILE w#NIL DO n _ n+1; CDSatellites.Associate[master, w.first]; ENDLOOP; }; SetObjectSatellites: PROC [design: CD.Design, exclusive: BOOL] RETURNS [n: INT_0] = { ob: CD.Object _ CDOps.PushedTopCell[design]; [] _ CDSatellites.GetSatellites[ob]; --reinstalls invariants IF exclusive THEN CDSatellites.Associate[ob, NIL]; FOR w: CD.InstanceList _ CDOps.InstList[design], w.rest WHILE w#NIL DO IF w.first.selected AND CDTexts.IsText[w.first.ob] THEN { CDSatellites.Associate[ob, w.first]; n _ n+1; }; ENDLOOP; }; AddInstSatComm: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["add instance satellites\n"]; [] _ SetInstanceSatellites[comm.design, FALSE]; }; AddObSatellitesComm: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["add object satellites for pushed in cell\n"]; [] _ SetObjectSatellites[comm.design, FALSE]; }; ReSetInstSatComm: PROC [comm: CDSequencer.Command] = { n: INT; TerminalIO.PutRope["reset instance satellites\n"]; n _ SetInstanceSatellites[comm.design, TRUE]; TerminalIO.PutF[" %g satellite(s) in instance group\n", IO.int[n]]; }; ReSetObSatellitesComm: PROC [comm: CDSequencer.Command] = { n, m: INT; TerminalIO.PutRope["reset object satellites for pushed in cell\n"]; n _ SetObjectSatellites[comm.design, TRUE]; m _ CountAssociated[comm.design, NIL]; TerminalIO.PutF1[" %g object satellite(s) of pushed in cell\n", IO.int[n]]; IF m>0 THEN TerminalIO.PutF1[" (there are %g un-associated texts)\n", IO.int[m]]; }; GetTextPart: PROC [comm: CDSequencer.Command, r: Rope.ROPE] RETURNS [i: CD.Instance] = { ob: CD.Object; f: CDTexts.CDFont; name: Rope.ROPE _ TerminalIO.RequestRope[r]; f _ CDPanelFonts.CurrentFont[comm.design]; IF f=NIL THEN CDSequencer.Quit["failed: no current font"]; IF name=NIL THEN CDSequencer.Quit["failed: empty text"]; ob _ CDTexts.Create[name, f, CD.commentLayer, TRUE]; IF ob=NIL THEN CDSequencer.Quit["failed: text not created"]; i _ CDOps.IncludeObjectI[comm.design, ob, comm.pos]; }; DrawInstanceSatelliteComm: PROC [comm: CDSequencer.Command] = { selected: CD.Instance _ CDOps.TheInstance[comm.design, "draw satellite to master\n"]; IF selected#NIL THEN { inst: CD.Instance; ob: CD.Object _ CDOps.PushedTopCell[comm.design]; [] _ CDSatellites.GetSatellites[ob]; --reinstalls invariants IF CDTexts.IsText[selected.ob] THEN CDSequencer.Quit["failed: selected instance is text, can't put a satellite on texts\n"]; inst _ GetTextPart[comm, "type instance satellite: "]; CDSatellites.Associate[selected, inst]; }; }; DrawObjectSatelliteComm: PROC [comm: CDSequencer.Command] = { ob: CD.Object _ CDOps.PushedTopCell[comm.design]; text: CD.Instance _ GetTextPart[comm, "type object satellite for pushed in cell: "]; [] _ CDSatellites.GetSatellites[ob]; --reinstalls invariants CDSatellites.Associate[ob, text]; }; UnSatelliteComm: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["remove satellite association for selection\n"]; FOR w: CD.InstanceList _ CDOps.InstList[comm.design], w.rest WHILE w#NIL DO IF w.first.selected THEN CDSatellites.Associate[w.first, NIL]; ENDLOOP; }; SelectInst: PROC [design: CD.Design, inst: CD.Instance] = { IF ~inst.selected THEN { inst.selected_TRUE; CDOps.RedrawInstance[design, inst]; } }; DeSelectInst: PROC [design: CD.Design, inst: CD.Instance] = { IF inst.selected THEN { inst.selected_FALSE; CDOps.RedrawInstance[design, inst, TRUE]; } }; CDSequencer.ImplementCommand[$SatellitesSelectSat, SelectSatellitesComm,, doQueue]; CDSequencer.ImplementCommand[$SatellitesSelObGroup, SelectObjectSatellitesComm,, doQueue]; CDSequencer.ImplementCommand[$SatellitesSelNotGroup, SelectUnAssociatedTextsComm,, doQueue]; CDSequencer.ImplementCommand[$SatellitesDrawInstSat, DrawInstanceSatelliteComm,, doQueueAndMark]; CDSequencer.ImplementCommand[$SatellitesDrawObSat, DrawObjectSatelliteComm,, doQueueAndMark]; CDSequencer.ImplementCommand[$SatellitesAddInstSat, AddInstSatComm,, doQueueAndMark]; CDSequencer.ImplementCommand[$SatellitesAddObSat, AddObSatellitesComm,, doQueueAndMark]; CDSequencer.ImplementCommand[$SatellitesReSetInstSat, ReSetInstSatComm,, doQueueAndMark]; CDSequencer.ImplementCommand[$SatellitesReSetObSat, ReSetObSatellitesComm,, doQueueAndMark]; CDSequencer.ImplementCommand[$SatellitesUndoSat, UnSatelliteComm,, doQueueAndMark]; END. ΆCDSatellitesCommands.mesa Copyright c 1985, 1987 by Xerox Corporation. All rights reserved. Written by: Christian Jacobi, August 29, 1986 9:55:02 pm PDT This module is descended from the early implementation of satellites by Monier. It has been rewritten a number of times since then by Sindhu and Serlet to find an implementation that is comfortable to use both from programs and interactively. This last version is a complete rewrite by Jacobi, one hopes for the last time! Old version by: Pradeep Sindhu December 20, 1985 1:25:44 pm PST Old version by: Pradeep Sindhu March 26, 1986 3:21:40 pm PST Old version by: Bertrand Serlet August 17, 1986 0:49:00 am PDT Old version by: Christian Jacobi, July 15, 1986 1:59:30 pm PDT Old version by: Jean-Marc Frailong July 28, 1986 6:45:49 pm PDT Last edited by: Christian Jacobi, March 23, 1987 6:26:35 pm PST --inst: a non text instance --quits command if no success --general utilities ΚΪ– "cedar" style˜codešœ™Kšœ Οmœ7™B™K™>K™?K™?Ibody™—šΟk œ˜ Kšžœ;žœ˜R—K˜•StartOfExpansion[]šΟnœžœž˜#Kšžœ>žœ˜U—Kšžœ˜K˜š Ÿœžœ žœžœžœžœ˜Mš žœžœ/žœžœž˜FKšžœžœ,žœ ˜[Kšžœ˜—K˜—K˜šŸœžœ žœžœžœžœžœžœ˜iš žœžœ/žœžœž˜Fšžœžœ,žœ˜SKšœ$˜$Kšœ˜—Kšžœžœžœ˜8Kšžœžœžœ˜9Kšžœ˜—K˜—K˜š Ÿœžœ žœžœžœ˜JKšœžœžœ&˜7Kšœ%Οc˜