--PTest.mesa
--Ch. Jacobi December 27, 1983 12:51 pm
DIRECTORY
PopUpMenu USING [RequestSelection],
TerminalIO,
Commander,
Rope;
PTest: CEDAR PROGRAM
IMPORTS PopUpMenu, Commander, TerminalIO =
BEGIN
def: CARDINAL ← 0;
Start: Commander.CommandProc =
BEGIN
def ← PopUpMenu.RequestSelection[
choice: LIST["first", "second", "third", "fourth", "fifth", "sixth", "seventh"],
label: "Menu",
default: def
];
TerminalIO.WriteRope["PopUpMenu test : "];
TerminalIO.WriteInt[def];
TerminalIO.WriteLn[];
END;
TStart: Commander.CommandProc =
BEGIN
def ← PopUpMenu.RequestSelection[
choice: LIST["rope", "int", "char", "r", "i", "c"],
label: "Test out",
default: 0
];
SELECT def FROM
1 => {
r: Rope.ROPE ← TerminalIO.RequestRope["rope>"];
TerminalIO.WriteRope["["];
TerminalIO.WriteRope[r];
TerminalIO.WriteRope["]\n"];
};
2 => {
i: INT← TerminalIO.RequestInt["int>"];
TerminalIO.WriteRope["["];
TerminalIO.WriteInt[i];
TerminalIO.WriteRope["]\n"];
};
3 => {
c: CHAR ← TerminalIO.RequestChar["char>"];
TerminalIO.WriteRope["\n["];
TerminalIO.WriteChar[c];
TerminalIO.WriteRope["]\n"];
};
4 => {
r: Rope.ROPE ← TerminalIO.RequestRope[];
TerminalIO.WriteRope["["];
TerminalIO.WriteRope[r];
TerminalIO.WriteRope["]\n"];
};
5 => {
i: INT← TerminalIO.RequestInt[];
TerminalIO.WriteRope["["];
TerminalIO.WriteInt[i];
TerminalIO.WriteRope["]\n"];
};
6 => {
c: CHAR ← TerminalIO.RequestChar[];
i: INTLOOPHOLE[c, INTEGER];
TerminalIO.WriteRope["\n["];
TerminalIO.WriteChar[c];
TerminalIO.WriteInt[i];
TerminalIO.WriteRope["]\n"];
};
ENDCASE => TerminalIO.WriteRope["skipped\n"];
END;
Commander.Register[
key: "p",
proc: Start,
doc: "Test out Menu"
];
Commander.Register[
key: "t",
proc: TStart,
doc: "Test out Terminal"
];
END.