Grep.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Jim Donahue July 16, 1985 8:20:20 am PDT
DIRECTORY
IO USING [STREAM],
RegularExpression USING [Finder],
Rope USING [ROPE];
Grep: CEDAR DEFINITIONS = {
Switches: TYPE = {oncePerLine, textOnly, positionsOnly, verbose, fileNamesOnly};
SwitchSettings: TYPE = ARRAY Switches OF BOOLEAN;
GetSwitches: PROC[cmdLine: LIST OF Rope.ROPE, prefixLen: INT ← 2] RETURNS[ switches: SwitchSettings, remainder: LIST OF Rope.ROPE ];
RegularOutput: PROC[switches: SwitchSettings] RETURNS[ yes: BOOL ];
TRUE for the default settings of all of the switches
GrepStream: PROC[ pattern: RegularExpression.Finder, inStream, outStream: IO.STREAM, switches: SwitchSettings, fileName: Rope.ROPE, interrupt: REF BOOL ] RETURNS [numberOfHits: INT];
}.