<<>> <> <> <> <> <> <<>> DIRECTORY Commander USING [CommandProc, Handle, Register], CommanderOps USING [ArgN, NumArgs], IO, LocalCirio USING [Connection, DoUnderMonitorLock, GetConnection, GetDummyStack, ReleaseConnection], Rope USING [Length, ROPE, Substr], StackCirio USING [InterpretTextLine, Stack]; CirioEval: CEDAR MONITOR IMPORTS Commander, CommanderOps, IO, LocalCirio, Rope, StackCirio ~ { ch: Commander.Handle ¬ NIL; DontCallMe: PUBLIC PROCEDURE [key: CARD32] = { IF ch # NIL THEN IO.PutRope[ch.out, "If you get this message, then scream and holler, because it should never appear.\n"]; }; CirioEvalCmd: Commander.CommandProc ~ { connection: LocalCirio.Connection; numArgs:CARD ¬ CommanderOps.NumArgs[cmd]; stack: StackCirio.Stack ¬ NIL; reslt, line: Rope.ROPE ¬ NIL; interpret: PROC = {reslt ¬ StackCirio.InterpretTextLine[stack, line, cmd.out]}; ch ¬ cmd; IF numArgs > 1 THEN { connection ¬ LocalCirio.GetConnection[["CirioEval", "DontCallMe"], cmd.out]; IF connection # NIL THEN { stack ¬ LocalCirio.GetDummyStack[connection, cmd.out]; line ¬ Rope.Substr[cmd.commandLine, CommanderOps.ArgN[cmd, 0].Length]; LocalCirio.DoUnderMonitorLock[connection, interpret]; IO.PutF1[cmd.out, "%g\n", IO.rope[reslt]]; LocalCirio.ReleaseConnection[connection, cmd.out]; } } }; Commander.Register["_", CirioEvalCmd, "Evaluate an expression in the local world."]; Commander.Register["¬", CirioEvalCmd, "Evaluate an expression in the local world."]; }.