<> <> <> <> <> <> <> <> <<>> DIRECTORY Rope USING [ROPE], ViewerClasses USING [Viewer]; TiogaOps: CEDAR DEFINITIONS = BEGIN ROPE: TYPE ~ Rope.ROPE; Viewer: TYPE ~ ViewerClasses.Viewer; Ref: TYPE = REF NodeBody; -- points to a Tioga node NodeBody: TYPE; Location: TYPE = RECORD [node: Ref, where: INT]; Order: TYPE = { before, same, after, disjoint }; WhichNodes: TYPE = { root, selection }; SelectionGrain: TYPE = { point, char, word, node, branch }; WhichSelection: TYPE = { primary, secondary, feedback }; <> <> <> GetCaret: PROC RETURNS [loc: Location]; CaretBefore: PROC; CaretAfter: PROC; CaretOnly: PROC; GoToNextCharacter: PROC [n: INT _ 1]; GoToNextWord: PROC [n: INT _ 1]; GoToNextNode: PROC [n: INT _ 1]; GoToPreviousCharacter: PROC [n: INT _ 1]; GoToPreviousWord: PROC [n: INT _ 1]; GoToPreviousNode: PROC [n: INT _ 1]; <> ToPrimary: PROC; ToSecondary: PROC; Transpose: PROC; <> InsertLineBreak: PROC; <> BackSpace: PROC [n: INT _ 1]; BackWord: PROC [n: INT _ 1]; DeleteNextCharacter: PROC [n: INT _ 1]; DeleteNextWord: PROC [n: INT _ 1]; InsertTime: PROC; InsertBrackets: PROC [left, right: CHAR]; MakeControlCharacter: PROC; UnMakeControlCharacter: PROC; MakeOctalCharacter: PROC; UnMakeOctalCharacter: PROC; ExpandAbbreviation: PROC; MesaFormatting: PROC; Repeat: PROC; Undo: PROC; <> WhichLooks: TYPE = { caret, selection }; SetSelectionLooks: PROC [which: WhichSelection _ primary]; <> SetLooks: PROC [looks: ROPE, which: WhichLooks _ selection]; AddLooks: PROC [looks: ROPE, which: WhichLooks _ selection]; SubtractLooks: PROC [looks: ROPE, which: WhichLooks _ selection]; ClearLooks: PROC [which: WhichLooks _ selection]; CopyLooks: PROC; <> <<>> <> <<>> <> CaretNodeFormat: PROC; <> InsertFormat: PROC; <> CopyFormat: PROC; <> <<>> <> <> SelectMatchingBrackets: PROC [before, after: CHAR] RETURNS [found: BOOL]; NextPlaceholder: PROC [dir: Dir _ forward, gotoend: BOOL, startBoundaryNode, endBoundaryNode: Ref _ NIL, startBoundaryOffset: INT _ 0, endBoundaryOffset: INT _ LAST[INT]] RETURNS [found, wenttoend: BOOL]; <> <> NextViewer: PROC [dir: Dir _ forward] RETURNS [found: BOOL]; Dir: TYPE = { forward, backwards }; <<>> <> <<>> FindText: PROC [viewer: Viewer, rope: ROPE _ NIL, whichDir: SearchDir _ forwards, which: WhichSelection _ primary, case: BOOL _ TRUE -- case => case of characters is significant -- ] RETURNS [found: BOOL]; <> <> <> FindWord: PROC [viewer: Viewer, rope: ROPE _ NIL, whichDir: SearchDir _ forwards, which: WhichSelection _ primary, case: BOOL _ TRUE -- case => case of characters is significant -- ] RETURNS [found: BOOL]; FindDef: PROC [viewer: Viewer, rope: ROPE _ NIL, whichDir: SearchDir _ forwards, which: WhichSelection _ primary, case: BOOL _ TRUE -- case => case of characters is significant -- ] RETURNS [found: BOOL]; <> GetSelection: PROC [which: WhichSelection _ primary] RETURNS [viewer: Viewer, start, end: Location, level: SelectionGrain, caretBefore: BOOL, pendingDelete: BOOL]; SelectionRoot: PROC [which: WhichSelection _ primary] RETURNS [root: Ref]; <> SetSelection: PROC [viewer: Viewer, start, end: Location, level: SelectionGrain _ char, caretBefore: BOOL _ TRUE, pendingDelete: BOOL _ FALSE, which: WhichSelection _ primary]; SelectPoint: PROC [viewer: Viewer, caret: Location, which: WhichSelection _ primary]; SelectNodes: PROC [viewer: Viewer, start, end: Ref, level: SelectionGrain _ node, caretBefore: BOOL _ TRUE, pendingDelete: BOOL _ FALSE, which: WhichSelection _ primary]; SelectBranches: PROC [viewer: Viewer, start, end: Ref, level: SelectionGrain _ node, caretBefore: BOOL _ TRUE, pendingDelete: BOOL _ FALSE, which: WhichSelection _ primary]; SelectDocument: PROC [viewer: Viewer, level: SelectionGrain _ node, caretBefore: BOOL _ TRUE, pendingDelete: BOOL _ FALSE, which: WhichSelection _ primary]; SelectionError: ERROR [ec: SelectionErrorCode]; -- can be raised by the above procedures SelectionErrorCode: TYPE = { IllegalViewer, -- either NIL or destroyed or no document data IllegalNode, -- either start or end node is NIL WrongDoc, -- start node not part of the viewer document WrongOrder, -- start location doesn't come before end location BadStartOffset, -- not within size of start node BadEndOffset }; -- not within size of end node CancelSelection: PROC [which: WhichSelection _ primary]; SaveSelA: PROC; RestoreSelA: PROC; SaveSelB: PROC; RestoreSelB: PROC; GrowSelection: PROC; GrowSelectionToBlanks: PROC; GrowSelectionToSomething: PROC [left, right: PROC [CHAR] RETURNS [BOOL]]; <> <<>> <> <> LockSel: PROC [which: WhichSelection _ primary]; <> UnlockSel: PROC [which: WhichSelection _ primary]; <> <<>> <> <> ViewerDoc: PROC [viewer: Viewer] RETURNS [Ref]; <> <<>> Jump: PROC [viewer: Viewer, loc: Location]; <> <<>> <> PutTextKey: PROC [node: Ref, where: INT, key: REF]; <> GetTextKey: PROC [node: Ref, key: REF] RETURNS [loc: Location]; <> <> TextKeyNotFound: ERROR; -- raised by GetTextKey RemoveTextKey: PROC [node: Ref, key: REF]; MapTextKeys: PROC [node: Ref, proc: PROC [key: REF, where: INT] RETURNS [BOOL] ] RETURNS [BOOL]; <> <> <> GetStyle: PROC [node: Ref] RETURNS [ROPE]; -- NIL for default <> IsDirty: PROC [node: Node] RETURNS [BOOL]; IsNew: PROC [node: Node] RETURNS [BOOL]; ClearDirty: PROC [n: Ref]; <> ClearNew: PROC [n: Ref]; <> <<>> <> CallWithLocks: PROC [proc: PROC [root: Ref], root: Ref _ NIL]; <> <<>> NoSelection: ERROR; <> <<>> <> <<>> Lock: PROC [root: Ref]; <> Unlock: PROC [root: Ref]; <> <<>> <> <> SelectionSearch: PROC [pattern: Pattern, whichDir: SearchDir _ forwards, interrupt: REF BOOL _ NIL, startBoundaryNode, endBoundaryNode: Ref _ NIL, startBoundaryOffset: INT _ 0, endBoundaryOffset: INT _ LAST[INT]] RETURNS [found: BOOL]; <> <> <<>> NodeSearch: PROC [pattern: Pattern, whichDir: SearchDir _ forwards, startLoc, endLoc: Location, interrupt: REF BOOL _ NIL, startBoundaryNode, endBoundaryNode: Ref _ NIL, startBoundaryOffset: INT _ 0, endBoundaryOffset: INT _ LAST[INT]] RETURNS [found: BOOL, start, end: Location]; <> <> SearchDir: TYPE = { forwards, backwards, anywhere }; CreateSimplePattern: PROC [ target: ROPE, -- node from which to get the pattern case: BOOL _ TRUE, -- if true, match case literal: BOOL _ FALSE, -- if true, treat target literally rather than as a pattern word: BOOL _ FALSE, -- if true, match words only addBounds: BOOL _ FALSE] -- if true, add |'s to both ends of pattern RETURNS [pattern: Pattern]; CreateGeneralPattern: PROC [ target: Ref, -- node from which to get the pattern text: BOOL _ TRUE, -- if true, match target text looks: BOOL _ FALSE, -- if true, match target looks format: BOOL _ FALSE, -- if true, match target format style: BOOL _ FALSE, -- if true, match target style comment: BOOL _ FALSE, -- if true, match target comment property case: BOOL _ TRUE, -- if true, match case literal: BOOL _ FALSE, -- if true, treat target literally rather than as a pattern word: BOOL _ FALSE, -- if true, match words only subset: BOOL _ TRUE, -- if true, use subset for looks test, else use equality addBounds: BOOL _ FALSE] -- if true, add |'s to both ends of pattern RETURNS [pattern: Pattern]; <> <<>> MalformedPattern: ERROR [ec: PatternErrorCode]; PatternErrorCode: TYPE = { toobig, -- pattern too long endquote, -- pattern ends with ' endtilda, -- pattern ends with ~ boundary, -- pattern has | inside rather than at beginning or end missingNameEnd, -- pattern has < without matching > unmatchedNameEnd, -- pattern has > without previous < other -- other unspecified error in pattern }; Pattern: TYPE = REF PatternRec; PatternRec: TYPE = RECORD [ finder: Finder, text: BOOL, looks: BOOL, looksExact: BOOL, word: BOOL, commentControl: CommentControl, checkFormat: BOOL, format: ROPE, checkStyle: BOOL, style: ROPE, searchLooks: ROPE ]; Finder: TYPE = REF FinderRec; FinderRec: TYPE; CommentControl: TYPE = { includeComments, excludeComments, commentsOnly }; <> <> <<>> CommandProc: TYPE = PROC [viewer: Viewer _ NIL] RETURNS [recordAtom: BOOL _ TRUE, quit: BOOL _ FALSE]; <> RegisterCommand: PROC [name: ATOM, proc: CommandProc, before: BOOL _ TRUE]; <> UnRegisterCommand: PROC [name: ATOM, proc: CommandProc]; <> Interpret: PROC [viewer: Viewer, params: LIST OF REF ANY]; <> <> <> <<>> <> RegisterAbbrevFailedProc: PROC [proc: PROC RETURNS [BOOL]]; <> <<>> RegisterFileNameProc: PROC [ proc: PROC [ROPE, Viewer] RETURNS [fileName: ROPE, search: ROPE] ]; <> <> GetFile: PROC [name: ROPE] RETURNS [root: Ref]; PutFile: PROC [name: ROPE, root: Ref]; FreeTree: PROC [root: Ref]; <> END.