<> <> <> DIRECTORY Commander, CommandTool, IO, List, Rope; CmdTest: CEDAR PROGRAM IMPORTS Commander, CommandTool, IO, List ={ ROPE: TYPE = Rope.ROPE; regDir: ROPE _ CommandTool.CurrentWorkingDirectory[]; Answerback: PROC [cmd: Commander.Handle] RETURNS [result: REF ANY _ NIL, msg: ROPE _ NIL] --Commander.CommandProc-- = { s: IO.STREAM _ IO.RIS[cmd.commandLine]; result _ s.GetRefAny[]; msg _ s.GetLineRope[]; s.Close[]; }; ShowResult: PROC [cmd: Commander.Handle] RETURNS [result: REF ANY _ NIL, msg: ROPE _ NIL] --Commander.CommandProc-- = { result _ List.Assoc[$Result, cmd.propertyList]; msg _ IO.PutFR["previous Result = %g", IO.refAny[result]]; }; ResultOf: PROC [cmd: Commander.Handle] RETURNS [result: REF ANY _ NIL, msg: ROPE _ NIL] --Commander.CommandProc-- = { result _ CommandTool.DoCommand[cmd.commandLine, cmd]; msg _ IO.PutFR["Result = %g", IO.refAny[result]]; }; Start: PROC = { Commander.Register[key: "Answerback", proc: Answerback, doc: "reads result and msg from command line (uninterpreted)", interpreted: FALSE]; Commander.Register[key: "ShowResult", proc: ShowResult, doc: "tells Result of previous command"]; Commander.Register[key: "ResultOf", proc: ResultOf, doc: "executes command and tells Result", interpreted: FALSE]; }; Start[]; }.