<> <> <> <> <> <> <> <> <<>> <> DIRECTORY Rope USING [ROPE], TiogaOpsDefs USING [Location, Order, Ref, SelectionGrain, WhichNodes, WhichSelection], ViewerClasses USING [Viewer]; TiogaOps: CEDAR DEFINITIONS = BEGIN ROPE: TYPE ~ Rope.ROPE; Viewer: TYPE ~ ViewerClasses.Viewer; Ref: TYPE = TiogaOpsDefs.Ref; -- points to a Tioga node Location: TYPE = TiogaOpsDefs.Location; -- RECORD [node: Ref, where: INT]; Order: TYPE = TiogaOpsDefs.Order; -- { before, same, after, disjoint } WhichNodes: TYPE = TiogaOpsDefs.WhichNodes; -- { root, selection } SelectionGrain: TYPE = TiogaOpsDefs.SelectionGrain; -- { point, char, word, node, branch } WhichSelection: TYPE = TiogaOpsDefs.WhichSelection; -- { 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; <> InsertRope: PROC [ROPE]; InsertChar: PROC [CHAR]; 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; Delete: PROC; Paste: PROC; SaveForPaste: PROC; SaveSpanForPaste: PROC [startLoc, endLoc: Location, grain: SelectionGrain _ char]; <> <> <> AllLower: PROC; AllCaps: PROC; InitialCaps: PROC; FirstCap: PROC; MesaFormatting: PROC; Repeat: PROC; Undo: PROC; <> Break: PROC; Join: PROC; Nest: PROC; UnNest: PROC; <> SetSelectionLooks: PROC [which: WhichSelection _ primary]; <> WhichLooks: TYPE = { caret, selection }; 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; <> <<>> <> <<>> <> SetFormat: PROC [format: ROPE, which: WhichNodes _ selection]; CaretNodeFormat: PROC; <> InsertFormat: PROC; <> CopyFormat: PROC; <> <<>> <> SetStyle: PROC [style: ROPE, which: WhichNodes _ selection]; <> <> 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]; <> <<>> <> <> GetRope: PROC [node: Ref] RETURNS [ROPE]; <> Parent: PROC [node: Ref] RETURNS [Ref]; Root: PROC [node: Ref] RETURNS [Ref]; Next: PROC [node: Ref] RETURNS [Ref]; <> <> Previous: PROC [node: Ref, parent: Ref _ NIL] RETURNS [nx: Ref]; <> <> <> StepForward: PROC [node: Ref] RETURNS [nx: Ref]; <> StepBackward: PROC [node: Ref, parent: Ref _ NIL] RETURNS [back: Ref]; <> FirstSibling: PROC [node: Ref] RETURNS [Ref]; LastSibling: PROC [node: Ref] RETURNS [Ref]; LastWithin: PROC [node: Ref] RETURNS [Ref]; <> <> FirstChild: PROC [node: Ref] RETURNS [Ref]; LastChild: PROC [node: Ref] RETURNS [Ref]; ViewerDoc: PROC [viewer: Viewer] RETURNS [Ref]; <> <<>> <> <> <> LocRelative: PROC [location: Location, count: INT, break: NAT _ 1, skipCommentNodes: BOOL _ FALSE] RETURNS [Location]; <> < location corresponding to count>> <> <> LocOffset: PROC [loc1, loc2: Location, break: NAT _ 1, skipCommentNodes: BOOL _ FALSE] RETURNS [count: INT]; <> <> <> <> BadArgs: ERROR; LastLocWithin: PROC [node: Ref] RETURNS [Location]; <> Jump: PROC [viewer: Viewer, loc: Location]; <> <<>> <> PutProp: PROC [n: Ref, name: ATOM, value: REF]; <> <<>> GetProp: PROC [n: Ref, name: ATOM] RETURNS [REF]; <> <> PutTextKey: PROC [node: Ref, where: INT, key: REF]; <> GetTextKey: PROC [node: Ref, key: REF] RETURNS [loc: Location]; <> <> TextKeyNotFound: ERROR; -- raised by GetTextKey <> <> FetchLooks: PROC [node: Ref, index: INT] RETURNS [ROPE]; GetFormat: PROC [node: Ref] RETURNS [ROPE]; -- NIL for default SetNodeFormat: PROC [format: ROPE, node: Ref]; <> GetStyle: PROC [node: Ref] RETURNS [ROPE]; -- NIL for default SetNodeStyle: PROC [style: ROPE, node: Ref]; <> <> IsComment: PROC [node: Ref] RETURNS [BOOL]; SetComment: PROC; <> SetNotComment: PROC; <> <<>> <> IsDirty: PROC [n: Ref] RETURNS [BOOL]; IsNew: PROC [n: Ref] RETURNS [BOOL]; ClearDirty: PROC [n: Ref]; <> ClearNew: PROC [n: Ref]; <> <<>> <> CompareLocOrder: PROC [loc1, loc2: Location] RETURNS [order: Order]; CompareNodeOrder: PROC [node1, node2: Ref] RETURNS [order: Order]; <> 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]; <> <> <> <<>> 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] ]; <> END. January 9, 1983 5:16 pm moved SelectPoint, LastLocWithin here. Deleted Search, Find, LocWithin.