DIRECTORY Ascii, BasicTime, BridgeDriver, CD, CDCells, CDCommandOps, CDIO, CDOps, CDSequencer, CedarProcess, Core, CoreOps, FSBackdoor, HashTable, IO, Rope, SinixOps, Sisyph, UserCredentials, TerminalIO, SpiceOps; SpiceCDCmds: CEDAR PROGRAM IMPORTS Ascii, BasicTime, BridgeDriver, CDCells, CDCommandOps, CDIO, CDOps, CedarProcess, CoreOps, HashTable, FSBackdoor, IO, Rope, SinixOps, Sisyph, UserCredentials, TerminalIO, SpiceOps EXPORTS SpiceOps ~ BEGIN ROPE: TYPE = Rope.ROPE; waitingProcess: CedarProcess.Process; pendingSimulations: PUBLIC HashTable.Table; stop: BOOL _ FALSE; magicString: ROPE _ "RBatch\ncd spice ;spice "; magicString2: ROPE _ " rw "; criterion: ROPE _ "*.spo!*"; simNumber: PUBLIC LONG CARDINAL; ExtractSelectedObjAndSpiceIt: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; wDir: ROPE _ CDIO.GetWorkingDirectory[comm.design]; shortFN, fileName, msg: ROPE; cellType: Core.CellType; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelectedAndCell[selected, multiple] THEN RETURN; cellType _ NARROW [SinixOps.ExtractCDInstance[selected, comm.design, Sisyph.mode].result]; WHILE SinixOps.IsIcon[Sisyph.mode.decoration, cellType] DO cellType _ CoreOps.Recast[cellType]; ENDLOOP; IF CoreOps.GetCellTypeName[cellType]=NIL THEN shortFN _ "SpiceInputDeck" ELSE shortFN _ CoreOps.GetCellTypeName[cellType]; fileName _ Rope.Cat[wDir, shortFN, ".spice"]; SpiceOps.WriteSpiceDeck[cellType, fileName]; msg _ ExecuteRemoteSpice[shortFN]; TerminalIO.PutRopes[fileName, ": ", IF msg#NIL THEN msg ELSE "sended to remote host"] }; ExecuteRemoteSpice: PUBLIC PROC [fileName: ROPE] RETURNS [errmsg: ROPE] ~ { name, password, spiceCmd: ROPE; [name, password] _ UserCredentials.Get[]; name _ Rope.Substr[name, 0, Rope.Index[name, 0, "."]]; -- get rid of the ".pa" name _ Rope.Translate[base: name, translator: MyLower]; spiceCmd _ Rope.Cat[magicString, fileName, magicString2]; errmsg _ BridgeDriver.StartSession["vaxc", name, password, spiceCmd]; }; MyLower: Rope.TranslatorType ~ {RETURN[Ascii.Lower[old]]}; StartWatching: PROC ~ { IF waitingProcess=NIL OR CedarProcess.GetStatus[waitingProcess]#busy THEN waitingProcess _ CedarProcess.Fork[WaitForListings, criterion]; }; IsSingleSelectedAndCell: PROC [selected: CD.Instance, multiple: BOOL] RETURNS [BOOL] = { IF ~IsSingleSelected[selected, multiple] THEN RETURN [FALSE]; IF ~CDCells.IsCell[selected.ob] THEN { TerminalIO.PutRope["\n** Selected instance is not a cellcan't do it.\n"]; RETURN[FALSE]; }; RETURN[TRUE]; }; IsSingleSelected: PROC [selected: CD.Instance, multiple: BOOL] RETURNS [BOOL] = { IF selected=NIL THEN { TerminalIO.PutRope["\n** No current selection--can't do it.\n"]; RETURN[FALSE]; }; IF multiple THEN { TerminalIO.PutRope["\n** Multiple instances selected--can't do it.\n"]; RETURN[FALSE]; }; RETURN[TRUE]; }; WaitForListings: CedarProcess.ForkableProc ~ { matchCriterion: ROPE _ NARROW[data]; event: REF READONLY FSBackdoor.CreateEvent _ NIL; UNTIL stop DO event _ FSBackdoor.NextCreateEvent[event]; IF Rope.Match[pattern: matchCriterion, object: event.fName, case: FALSE] THEN { SpiceOps.DisplaySpiceListing[event.fName ! IO.Error, IO.EndOfStream => {TerminalIO.PutRopes[event.fName, " is not coherent\n"]; CONTINUE;}]; }; ENDLOOP; }; pendingSimulations _ HashTable.Create[equal: HashTable.RopeEqual, hash: HashTable.HashRope]; simNumber _ LOOPHOLE[BasicTime.Now[], LONG CARDINAL]; CDCommandOps.RegisterWithMenu[menu: $OtherProgramMenu, entry: "Sisyph -> Spice", proc: ExtractSelectedObjAndSpiceIt, key: $ExtractToSpice]; StartWatching[]; END.  SpiceCDCmds.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Created by Pradeep Sindhu, March 31, 1986 6:25:43 pm PST Pradeep Sindhu, April 29, 1986 0:19:46 am PDT Bertrand Serlet October 17, 1986 10:46:42 pm PDT Christian Jacobi, January 7, 1987 2:58:17 pm PST Christian LeCocq March 5, 1987 5:34:09 pm PST Command Procs Internal Utilities PROC [data: REF] RETURNS [results: REF _ NIL] Wait until a file having a name matching the criterion is created, then call the call-back proc Initialization Κ˜šœ™Jšœ Οmœ1™