MakeMeddleViewer.mesa
Carl Waldspurger, August 29, 1986 4:16:28 pm PDT
MakeMeddleViewer.mesa
Carl Waldspurger, August 29, 1986 4:43:55 pm PDT
DIRECTORY
Commander USING [Register, CommandProc],
Rope USING [ROPE, Cat, FromChar, Length, Fetch],
ViewExpr USING [Create];
MakeMeddleViewer: CEDAR PROGRAM
IMPORTS ViewExpr, Commander, Rope ~
BEGIN
DoIt: Commander.CommandProc ~ {
effects: Creates a new MEDDLE expression viewer with label from command line.
local declarations
name: Rope.ROPE ← ""; -- label for viewer
filter all garbage characters out of command line for viewer name
FOR i:INT IN [0..cmd.commandLine.Length[] - 1] DO
c: CHAR ← cmd.commandLine.Fetch[i];
IF c IN ['\040..'\176] THEN name ← Rope.Cat[name, Rope.FromChar[c]];
ENDLOOP;
IF name.Length[] = 0 THEN name ← "MEDDLE Expr";
[] ← ViewExpr.Create[NIL, name];
};
Commander.Register[key: "MeddleOpen", proc: DoIt, doc: "Opens a new MEDDLE math expression editor viewer."];
END.