DIRECTORY IO USING [STREAM], PFS USING [nullUniqueID, UniqueID], PFSNames USING [PATH], Rope USING [ROPE]; SourceFileOps: CEDAR DEFINITIONS ~ BEGIN ROPE: TYPE ~ Rope.ROPE; Position: TYPE ~ RECORD [ fileName: FileName, uniqueID: UniqueID, index: ARRAY PosKind OF Range]; FileName: TYPE ~ PFSNames.PATH; UniqueID: TYPE ~ PFS.UniqueID; PosKind: TYPE ~ {char, line}; Index: TYPE ~ INT; Range: TYPE ~ RECORD [first, last: Index ¬ noIndex] ¬ noRange; noRange: Range ~ []; noPosition: Position ~ [noName, nullUniqueID, ALL[noRange]]; noName: PFSNames.PATH ~ NIL; noIndex: Index ~ INT.FIRST; nullUniqueID: UniqueID ~ PFS.nullUniqueID; WhichSelection: TYPE ~ { primary, secondary, feedback }; GetSelection: PROC [selection: WhichSelection ¬ primary] RETURNS [pos: Position, contents: ROPE]; FormatPosition: PROC [Position] RETURNS [ROPE]; FmtIdxs: PROC [pos: Position] RETURNS [ROPE]; FmtRange: PROC [r: Range, introSingular, introPlural: ROPE ¬ NIL] RETURNS [ROPE]; OpenSource: ShowProc; ShowProc: TYPE ~ PROC [desc: ROPE, pos: Position, feedBack: IO.STREAM, selection: WhichSelection ¬ feedback]; END. ’ SourceFileOps.mesa Copyright Σ 1989, 1991 by Xerox Corporation. All rights reserved. Linda Howe October 13, 1989 5:03:21 pm PDT Coolidge, July 17, 1990 5:17 pm PDT Christian Jacobi, August 24, 1990 12:35 pm PDT Last tweaked by Mike Spreitzer on October 3, 1990 8:54 am PDT Willie-s, October 7, 1991 6:46 pm PDT Some basic feedback operations on source files. Implemented in the most reasonable way for each world. A position in a file may be identified by either or both of a line number range and a character index range. Sloppy people (and programs) can make Positions with uniqueID=nullUniqueID; when interpreting such a position, any file with the given name will do. [n] is how to talk about a position, rather than a range. [] is the unspecified range/position. Denotes choice of what selection to use. Returns the file name and position within the file for the selected text viewer. Returns noPosition if no valid editor viewer is selected. Also returns selection contents (as ROPE). Gives answers like introSingular.Cat["5"] and introPlural.Cat["5..6"]. Directs the user's attention to the given position, describing it as desc when text is used. Κ|•NewlineDelimiter –(cedarcode) style™codešœ™Kšœ Οeœ7™BK™*K™#K™.K™=K™%—K˜K™gK™K™šΟk ˜ Kšžœžœžœ˜Kšžœžœ˜#Kšœ žœžœ˜Kšœžœžœ˜K˜—šΟn œžœž œžœ˜*K˜Kšžœžœžœ˜K˜šœ žœžœ˜Kšœ˜Kšœ˜Kšœžœ žœ˜Kšœ‚™‚—K˜Kšœ žœ žœ˜Kšœ žœžœ ˜Kšœ žœ˜Kšœžœžœ˜Kšœžœžœ*˜>˜K™9K™%—K˜Kšœ.žœ ˜