-- ComString.Mesa Curry - September 26, 1980 DIRECTORY StreamDefs; ComString: DEFINITIONS = BEGIN OPEN StreamDefs; Found:TYPE = {Yes, No, Multiple}; StrArrayDesc:TYPE =DESCRIPTOR FOR ARRAY OF STRING; OpenCommandLine:PROCEDURE RETURNS [ in:StreamDefs.DiskHandle ]; CloseCommandLine:PROCEDURE[in:StreamHandle]; StrToIndex : PROCEDURE [ str:STRING, sad:StrArrayDesc ] RETURNS [ index:CARDINAL ]; -- index = 0 => NOT found StrFill: PROCEDURE[ unkstr:STRING, sad:StrArrayDesc, addstr:STRING _ NIL ] RETURNS [ found:Found ]; -- Tries to find str using sad:StrArrayDesc -- If not found then found _ No -- If str is part of or equal to only one string then -- found _ Yes -- unkstr is filled out -- if addstr present -- then addstr gets remainder of string -- else the remainder is output using IODefs.WriteStr -- If str is part of more than one string then -- found _ Multiple -- unkstr is filled out to point of disaggreement -- if addstr # NILL -- then addstr gets additions to string -- else the additions are output using WriteStr GetKeyboardCommand:PROCEDURE[ queststr:STRING, sad:StrArrayDesc] RETURNS[index:CARDINAL]; -- User interaction to get a legal command -- Only descriminating characters are required -- ESC or TAB show current legal commands -- CR, ?, or an illegal char show all legal commands (635)\71b9B40b5B29b12B40b15B11b1B39b16B30b10B103b7B635b18B GetStreamCommand:PROCEDURE[ stream:StreamHandle, sad:StrArrayDesc, substr:STRING] RETURNS[index:CARDINAL]; -- 0 if command not found -- Strings rep: SingArgStr/SubStr or SingArgStr[SubStr] GetStreamArg:PUBLIC PROCEDURE[ stream:StreamHandle, argstr:STRING, substr:STRING ] RETURNS[argfound:BOOLEAN]; -- Strings rep: SingArgStr/SubStr or SingArgStr[SubStr] GetStringArg:PROCEDURE[ sourcestr:STRING, index:CARDINAL, argstr:STRING, substr:STRING] RETURNS[CARDINAL]; -- = 0 if nothing found END. \b16B123b1B56b12B103b1B56b12B