DIRECTORY CD, CDExtras, CDIO, CDIOExtras, CDOps USING [AddAnObject], CDSequencer, CDViewer USING [CreateViewer], Commander USING [CommandProc, Register], CommandTool, FileNames, Rope USING [ROPE], TerminalIO; CDIOCommands: CEDAR PROGRAM IMPORTS CDExtras, CDIO, CDIOExtras, CDOps, CDSequencer, CDViewer, Commander, CommandTool, FileNames, TerminalIO = BEGIN SetDesignsWorkingDirectoryFromCurrent: PROC [design: CD.Design] = BEGIN CDIOExtras.SetDesignsWorkingDirectory[design, FileNames.CurrentWorkingDirectory[]]; END; IncludeCommand: PROC [comm: CDSequencer.Command] = BEGIN Forward: PROC [a: ATOM] = INLINE { CDSequencer.ExecuteCommand[comm: comm, as: a, queue: dontQueue]; }; yes: BOOL; TerminalIO.WriteRope["include the directory of an input design\n"]; TerminalIO.WriteRope[" (but usually people want to import other designs)\n"]; yes _ TerminalIO.UserSaysYes[ label: "you really want to include?", text: "you really want to include? " ]; TerminalIO.WriteRope[IF yes THEN " yes\n" ELSE " no, import\n"]; Forward[IF yes THEN $ReallyIncludeADesign ELSE $Import] END; ReallyIncludeCommand: PROC [comm: CDSequencer.Command] = BEGIN Check: PROC [design: CD.Design] RETURNS [ok: BOOL] = BEGIN ok _ design.technology=comm.design.technology; IF NOT ok THEN { TerminalIO.WriteRope["Technology missmatch: includee is "]; TerminalIO.WriteRope[design.technology.name]; TerminalIO.WriteRope["\n"]; } END; done: BOOL _ FALSE; design: CD.Design; ob: CD.ObPtr; pos: CD.DesignPosition; TerminalIO.WriteRope["really include the directory of an input design\n"]; design _ CDIO.ReadDesign[NIL, Check]; IF design#NIL THEN { [ob, pos] _ CDExtras.MergeIn[design: comm.design, from: design]; IF ob#NIL THEN { CDOps.AddAnObject[comm.design, ob, pos]; done _ TRUE; }; }; IF done THEN TerminalIO.WriteRope["include done\n"] ELSE TerminalIO.WriteRope["include not done\n"]; END; ReadCommand: Commander.CommandProc = BEGIN ENABLE { TerminalIO.UserAbort => GOTO UserAbrt; }; design: CD.Design; list: LIST OF Rope.ROPE; length: NAT; name: Rope.ROPE; [list, length] _ CommandTool.ParseToList[cmd]; IF length=0 THEN name_NIL ELSE IF length=1 THEN name_list.first ELSE { result_$Failure; msg_"unknown arguments"; TerminalIO.WriteRope["read command failed\n"]; RETURN }; design _ CDIO.ReadDesign[name]; IF design#NIL THEN { [] _ CDViewer.CreateViewer[design]; SetDesignsWorkingDirectoryFromCurrent[design]; TerminalIO.WriteRope["read done\n"]; } ELSE TerminalIO.WriteRope["read not done\n"]; EXITS UserAbrt => {TerminalIO.WriteRope["read aborted\n"]}; END; WriteCommand: PROC [comm: CDSequencer.Command] = BEGIN done: BOOL; TerminalIO.WriteRope["output file\n"]; done _ CDIO.WriteDesign[design: comm.design, to: NIL]; TerminalIO.WriteRope[IF done THEN "write done\n" ELSE "write not done\n"]; END; Commander.Register[ key: "CDRead", proc: ReadCommand, doc: "Read a Chipndale file" ]; CDSequencer.ImplementCommand[$ReallyIncludeADesign, ReallyIncludeCommand,, doQueue]; CDSequencer.ImplementCommand[$IncludeADesign, IncludeCommand,, doQueue]; CDSequencer.ImplementCommand[$OutputDesign, WriteCommand,, doQueue]; END. ΊCDIOCommands.mesa Last Edited by: Jacobi, February 8, 1984 9:41 am --sets the working directory of the design using the working directory of the process -- Module Initialization ΚV– "cedar" style˜J™J™0J˜šΟk ˜ Jšœ˜J˜ Jšœ˜Jšœ ˜ Jšœœ˜Jšœ ˜ Jšœ œ˜Jšœ œ˜(J˜ Jšœ ˜ Jšœœœ˜Jšœ ˜ J˜—šΟb œœ˜Jšœ œ[˜q—Jš˜J˜šΟn%œœ œ ˜AJšœU™UJš˜JšœS˜SJšœ˜—J˜šŸœœ˜3Jš˜šŸœœœœ˜"Jšœ@˜@J˜—Jšœœ˜ JšœC˜CJšœN˜Nšœ˜J˜%J˜$J˜—Jšœœœ œ˜@Jšœœœœ ˜8Jšœ˜—J˜šŸœœ˜9Jš˜J˜š Ÿœœ œ œœ˜4Jš˜Jšœ.˜.šœœœ˜Jšœ;˜;Jšœ-˜-Jšœ˜J˜—Jšœ˜—J˜Jšœœœ˜Jšœœ˜Jšœ ˜ Jšœ˜JšœJ˜JJšœ œ œ ˜%šœœœ˜Jšœ@˜@šœœœ˜Jšœ(˜(Jšœœ˜ J˜—J˜—Jšœœ'˜4Jšœ,˜0Jšœ˜—J˜šž œ˜%Jš˜codešœ˜ Kšœœ ˜&K˜—Jšœœ˜Jšœœœœ˜Kšœœ˜ Kšœ œ˜Kšœ.˜.Kšœ œ˜Kšœœ œ˜%šœ˜Kšœ˜Kšœ˜Jšœ.˜.Kš˜Kšœ˜—Jšœ œ˜šœœœ˜Jšœ#˜#Jšœ.˜.Jšœ$˜$J˜—Jšœ)˜-š˜Kšœ5˜5—Jšœ˜—J™šŸ œœ˜0Kš˜Kšœœ˜ Jšœ&˜&Kšœœ&œ˜6Kšœœœœ˜JJšœ˜—J™JšΟc™šœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜—JšœT˜TJšœH˜HJšœD˜DJšœ˜—…— "2