<> <> <> <> DIRECTORY CD USING [Technology], CDSequencer USING [Command, CommandProc, QueueMethod], Rope USING [ROPE]; CDMenus: CEDAR DEFINITIONS = BEGIN <<>> <> CreateMenu: PROC [label: Rope.ROPE_NIL, globalKey: ATOM _ NIL] RETURNS [menu: REF]; <<--Creates a new menu>> <<--label: its header line>> <<--globalKey: If not NIL, the menu may be fetched (GetMenu) using this atom>> GetMenu: PROC [globalKey: ATOM] RETURNS [menu: REF]; <<--Fetches a menu which had been created with a globalKey>> <<--NIL if not found>> CreateEntry: PROC [menu: REF, entry: Rope.ROPE _ NIL, key: REF]; <<--Makes an entry line in a menu (overwrite if ropes are equal, remove if NIL)>> <<--menu: a menu => use this menu >> <<-- an ATOM => fetch for menu with globalKey>> <<--key: a menu => use the key menu recursively>> <<-- an ATOM => return this as result (does NOT search for a menu) / >> <<-- use CDSequencer>> <<-- others => return as result / error message>> CallMenu: PROC [menu: REF] RETURNS [key: REF]; <<--Calls a menu and return the selected key>> <<--(recursively, until returned key is not of type menu)>> CallCommand: PROC [menu: REF, comm: CDSequencer.Command]; <<--Calls a menu and replace the "comm" key with the selected key>> <<--then "comm" is executed >> ImplementMenuCommand: PROC[a: ATOM, menu: REF, technology: CD.Technology _ NIL]; <<--Implements a CDSequencer command "a" which shows the "menu" and after >> <<--selection executes the selected entry >> ImplementEntryCommand: PROC [menu: REF, entry: Rope.ROPE _ NIL, p: CDSequencer.CommandProc, key: ATOM _ NIL, queue: CDSequencer.QueueMethod _ doQueue]; <<--For conveniance only; in all technologies.>> <<--Creates an entry line into the menu and sets it up to call the command p.>> <<--key: key of the command; is made up if NIL.>> END.