<> <> <> DIRECTORY Commander USING [CommandProcHandle, Handle], IO USING [STREAM], Rope USING [ROPE]; CommandToolLookup: CEDAR DEFINITIONS = BEGIN LOR: TYPE = LIST OF ROPE; LORA: TYPE = LIST OF REF ANY; ROPE: TYPE = Rope.ROPE; STREAM: TYPE = IO.STREAM; DoLookup: PROC [cmd: Commander.Handle, arg: ROPE] RETURNS [paths: LOR _ NIL, procData: Commander.CommandProcHandle _ NIL]; <> <<1. Search for an exact match (if one is found, return it immediately)>> <<1.1. Search for the registered command arg in search rule order>> <<1.2. Search for the file arg.load in search rule order>> <<1.3. Search for the file arg.cm in search rule order>> <<2. Search for an unambiguous match (don't return early)>> <<2.1. Accumulate matches for the registered command arg* in search rule order>> <<(if more than one match, return early to avoid costly file searches)>> <<2.2. Accumulate matches for the file arg*.load in search rule order>> <<2.3. Accumulate matches for the file arg*.cm in search rule order>> <> <> <> <> <> <> FindMatchingFiles: PROC [root: ROPE, defaultExtension: ROPE, requireExact: BOOL _ TRUE, searchRules: REF ANY] RETURNS [paths: LOR _ NIL]; <> <> <> <> <> <<>> FindMatchingCommands: PROC [root: ROPE, requireExact: BOOL, searchRules: REF] RETURNS [paths: LOR _ NIL, data: Commander.CommandProcHandle _ NIL]; <> <> <> <> <> <> <> <> DoWithRules: PROC [rules: REF, inner: WithRulesProc] RETURNS [stop: BOOL _ FALSE]; <> WithRulesProc: TYPE = PROC [rule: ROPE] RETURNS [stop: BOOL _ FALSE]; ShowAmbiguous: PROC [out: STREAM, list: LOR]; <> <<{Ambiguous:>> <> <<...>> <<}>> END.