CDMenuSpecialsImpl.mesa (part of ChipNDale)
Copyright © 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, June 5, 1985 8:02:35 pm PDT
Last Edited by Christian Jacobi, September 19, 1985 8:55:22 pm PDT
DIRECTORY
CD,
CDMenuSpecials,
CDMenus,
Rope,
SymTab;
CDMenuSpecialsImpl: CEDAR MONITOR
IMPORTS CDMenus, SymTab
EXPORTS CDMenuSpecials =
BEGIN
SelectOneOf: PUBLIC PROC[ref: SymTab.Ref, label: Rope.ROPE] RETURNS [key: Rope.ROPENIL] =
--Interactive selection
--NIL if discarded
BEGIN
cnt: INT ← 0;
menu, firstMenu: REF;
EachEntry: SymTab.EachPairAction = { --key: Rope.ROPE
quit ← FALSE;
IF cnt>10 THEN {
newMenu: REF ← CDMenus.CreateMenu[label: label];
CDMenus.CreateEntry[menu: menu, entry: "more ?", key: newMenu];
menu ← newMenu;
cnt ← 0
};
cnt ← cnt+1;
CDMenus.CreateEntry[menu: menu, entry: key, key: key]
};
menu ← firstMenu ← CDMenus.CreateMenu[label: label];
[] ← ref.Pairs[EachEntry];
IF menu#firstMenu THEN
CDMenus.CreateEntry[menu: menu, entry: "again ?", key: firstMenu];
key ← NARROW[CDMenus.CallMenu[firstMenu]];
END;
END.