DIRECTORY Commander USING [CommandProc, Register], Express USING [ClientProcList, Fcn, FreeFcn, ParseError, RopeToFcn], IO USING [Put, real, rope], Real USING [Fix], Rope USING [Length, ROPE, Substr]; ExpressExampleClient: CEDAR MONITOR IMPORTS C: Commander, EX: Express, IO, Real, Rope ~ { DoStuff: C.CommandProc ~ { fcn: EX.Fcn _ EX.RopeToFcn[expression: cmd.commandLine, symbols: LIST["i", "j"], cProcs: clientProcList ! --NOTE: We don't use oldFcn here, 'cause we'd have to make fcn global EX.ParseError => { IO.Put [cmd.out, IO.rope[error.reason], IO.rope[": "]]; IO.Put [cmd.out, IO.rope[Rope.Substr[base: cmd.commandLine, len: error.position]], IO.rope["\000"], IO.rope[IF Rope.Length[cmd.commandLine]<=error.position THEN NIL ELSE Rope.Substr[base: cmd.commandLine, start: error.position] ] ]; GOTO DidntParse; }; ]; FOR i: REAL _ 1, i+1.0 WHILE i<=5.0 DO IO.Put[cmd.out, IO.rope["\t"]]; FOR j: REAL _ 1, j+1.0 WHILE j<=5.0 DO value: REAL _ lastValue _ fcn[i, j]; IO.Put[cmd.out, IO.real[value], IO.rope["\t"]]; ENDLOOP; IO.Put[cmd.out, IO.rope["\n"]]; ENDLOOP; TRUSTED {EX.FreeFcn[fcn]}; EXITS DidntParse => RETURN }; lastValue: REAL _ 0; Last: PROC RETURNS [REAL] ~ {RETURN[lastValue]}; At: PROC [addr: REAL] RETURNS [REAL] ~ TRUSTED { address: LONG POINTER TO LONG CARDINAL _ LOOPHOLE[Real.Fix[addr]]; RETURN[address^]; }; clientProcList: Express.ClientProcList ~ LIST [ [Last, "last"], [At, "at"], [At, "@"] ]; C.Register[key: "Evaluate", doc: "Evaluate f[i,j] for 5 x 5", proc: DoStuff]; }. äExpressExampleClient.mesa Created Thursday, June 28, 1984 10:55 am PDT Last edited by Eric Nickell, July 13, 1984 7:45:51 pm PDT This shows the use of the Express interface This module, for the purpose of demonstrating Express, implements the evaluate command, which evaluates a function of i and j, both in the interval [1..5]. Also, two additional functions are implemented to show how to do this. Some procedures to show the callback facility of Express START UP procedure ʆ˜šœ™Jšœ,™,J™9J™+J™—šÏk ˜ Jšœ œ˜(Jšœœ7˜DJšœœ˜Jšœœ˜Jšœœ œ ˜"J˜—šœœ˜#Jšœœ œ œ ˜1J˜J˜—J™ãšÏnœœ˜šœœœ1œ&ÏcE˜°šœ˜Jšœœœ˜8šœ˜Jšœ?˜AJšœ˜šœœ-˜7Jšœ˜Jšœ:˜>J˜—J˜—Jšœ ˜J˜—Jšœ˜—šœœ œ˜&Jšœœ ˜šœœ œ˜&Jšœœ˜$Jšœœœ ˜/Jšœ˜—Jšœœ ˜Jšœ˜—Jšœœ˜š˜Jšœ˜—J˜J˜—™8Jšœ œ˜š žœœœœœ ˜0J˜—š žœœœœœœ˜0Jš œ œœœœœœ˜BJšœ ˜J˜J˜—šœ)œ˜/J˜J˜ J˜ J˜J˜——Jšœœ ™JšœL˜MJ˜J˜J˜—…—ì V