<> <> <> <> <<>> <<>> <> DIRECTORY TiogaOpsDefs USING [Ref, Offset, Location, Order, WhichNodes, SelectionGrain, WhichSelection, ROPE, Viewer] ; TiogaOps: CEDAR DEFINITIONS = BEGIN OPEN TiogaOpsDefs; <> Ref: TYPE = TiogaOpsDefs.Ref; Offset: TYPE = TiogaOpsDefs.Offset; Location: TYPE = TiogaOpsDefs.Location; Order: TYPE = TiogaOpsDefs.Order; WhichNodes: TYPE = TiogaOpsDefs.WhichNodes; SelectionGrain: TYPE = TiogaOpsDefs.SelectionGrain; WhichSelection: TYPE = TiogaOpsDefs.WhichSelection; <> <> <> <> <> <> <> <> <> <> <> 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; -- inserts a CR and then copies blanks from front of previous line 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]; <<-- like SaveForPaste, but saves the given span rather than the selection>> <<-- use grain = node or branch to simulate node or branch selections>> <<-- span need not come from document currently in a viewer>> 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; -- copies looks from secondary selection to primary selection <<>> <<--see LooksRead.Mesa if you need to read a lot of looks>> <> SetFormat: PROC [format: ROPE, which: WhichNodes _ selection]; CaretNodeFormat: PROC; <> InsertFormat: PROC; -- inserts the format name CopyFormat: PROC; -- copies format from secondary selection to primary selection <> 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: Offset _ 0, endBoundaryOffset: Offset _ LAST[Offset]] 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 [BOOLEAN]]; <> <> <> LockSel: PROC [which: WhichSelection _ primary]; <> UnlockSel: PROC [which: WhichSelection _ primary]; <> <> GetRope: PROC [node: Ref] RETURNS [ROPE]; -- the contents of the node 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: Offset, 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: Offset]; <> <> <> <> BadArgs: ERROR; LastLocWithin: PROC [node: Ref] RETURNS [Location]; <> Jump: PROC [viewer: Viewer, loc: Location]; <> <> PutProp: PROCEDURE [n: Ref, name: ATOM, value: REF]; <> <<>> GetProp: PROCEDURE [n: Ref, name: ATOM] RETURNS [REF]; <> <> PutTextKey: PROC [node: Ref, where: Offset, key: REF]; <> GetTextKey: PROC [node: Ref, key: REF] RETURNS [loc: Location]; <> <> TextKeyNotFound: ERROR; -- raised by GetTextKey <> <> FetchLooks: PROC [node: Ref, index: Offset] 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; -- applies to all selected nodes SetNotComment: PROC; -- applies to all selected nodes <> IsDirty: PROCEDURE [n: Ref] RETURNS [BOOL]; IsNew: PROCEDURE [n: Ref] RETURNS [BOOL]; ClearDirty: PROC [n: Ref]; -- turns off the dirty bit on the node ClearNew: PROC [n: Ref]; -- turns off the new bit on the node <> CompareLocOrder: PROCEDURE [loc1, loc2: Location] RETURNS [order: Order]; CompareNodeOrder: PROCEDURE [node1, node2: Ref] RETURNS [order: Order]; <> CallWithLocks: PROC [proc: PROC [root: Ref], root: Ref _ NIL]; <> NoSelection: ERROR; -- raised by CallWithLocks <<>> <> <<>> Lock: PROC [root: Ref]; <> Unlock: PROC [root: Ref]; <> <> <> SelectionSearch: PROC [ pattern: Pattern, whichDir: SearchDir _ forwards, interrupt: REF BOOL _ NIL, startBoundaryNode, endBoundaryNode: Ref _ NIL, startBoundaryOffset: Offset _ 0, endBoundaryOffset: Offset _ LAST[Offset]] RETURNS [found: BOOL]; <> <> <<>> NodeSearch: PROC [ pattern: Pattern, whichDir: SearchDir _ forwards, startLoc, endLoc: Location, interrupt: REF BOOL _ NIL, startBoundaryNode, endBoundaryNode: Ref _ NIL, startBoundaryOffset: Offset _ 0, endBoundaryOffset: Offset _ LAST[Offset]] 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 < }; Pattern: TYPE = REF PatternRec; PatternRec: TYPE = RECORD [ finder: Finder, text: BOOLEAN, looks: BOOLEAN, looksExact: BOOLEAN, word: BOOLEAN, commentControl: CommentControl, checkType: BOOLEAN, type: ROPE, checkStyle: BOOLEAN, 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.