DIRECTORY Commander USING [CommandProc, Handle, Register], CommanderOps USING [ArgN, NumArgs], IO USING [PutF, rope], 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.PutF[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.PutF[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."]; }. ¨ CirioEval.mesa Copyright Σ 1991 by Xerox Corporation. All rights reserved. Philip James, July 2, 1991 3:58 pm PDT Laurie Horton, February 8, 1993 12:02 pm PST Κ‘•NewlineDelimiter ™™J™