DIRECTORY Rosary USING [ROSARY], Tioga; TiogaPrivate: CEDAR DEFINITIONS ~ BEGIN OPEN Tioga; ROSARY: TYPE ~ Rosary.ROSARY; CheckFailed: ERROR; Check: PROC [node: Node]; CheckRope: PROC [rope: ROPE]; CheckRuns: PROC [runs: Runs]; Verify: PROC [node: Node]; RefBool: PROC [BOOL] RETURNS [REF BOOL]; PutProp: PROC [n: Node, name: ATOM, value: REF]; RemProp: PROC [n: Node, name: ATOM]; Inherit: PROC [n: Node, from: Node, allprops: BOOL]; DeclarePropertyAttribute: PROC [name: ATOM, attribute: ATOM]; Is: PROC [name: ATOM, attribute: ATOM] RETURNS [BOOL]; GetPropertyAttributes: PROC [name: ATOM] RETURNS [LIST OF ATOM]; SetPropertyAttributes: PROC [name: ATOM, attributes: LIST OF ATOM]; AddrsProp: PROC RETURNS [ATOM]; PutTextAddr: PROC [n: Node, addr: REF, location: INT, pin: BOOL _ FALSE]; RemTextAddr: PROC [n: Node, addr: REF]; PinTextAddr: PROC [n: Node, addr: REF]; UnpinTextAddr: PROC [n: Node, addr: REF]; UnpinAllAddrs: PROC [n: Node]; MoveTextAddr: PROC [from, to: Node, addr: REF, location: INT]; GetTextAddr: PROC [n: Node, addr: REF] RETURNS [node: Node, location: INT]; TryGetTextAddr: PROC [n: Node, addr: REF] RETURNS [found: BOOL, node: Node, location: INT]; TextAddrNotFound: ERROR; MapTextAddrs: PROC [n: Node, action: TextAddrsAction] RETURNS [BOOL]; TextAddrsAction: TYPE = PROC [addr: REF, location: INT] RETURNS [BOOL]; AddAddrNotifyProc: PROC [proc: AddrNotifyProc]; RemoveAddrNotifyProc: PROC [proc: AddrNotifyProc]; AddrNotifyProc: TYPE = PROC [node: Node, new: PROC [old: INT] RETURNS [INT]]; AddrReplace: PROC [node: Node, start, len, newlen: INT]; AfterReplace: PROC [initLoc, start, len, newlen: INT] RETURNS [newLoc: INT]; ChangeType: TYPE = { ChangingView, ChangingText, ChangingTextForPaste, ChangingSpanForPaste, ChangingFormat, ChangingProp, MovingNodes, NodeNesting, InsertingNode }; Change: TYPE = RECORD [SELECT kind: ChangeType FROM ChangingView => [ viewer: REF, old: Location ], ChangingText => [ root: Node, text: Node, start, newlen, oldlen: INT, oldRope: ROPE, oldRuns: Runs, oldCharSets: ROSARY, oldCharProps: ROSARY ], ChangingTextForPaste => [ rope: ROPE, runs: Runs, charSets: ROSARY, charProps: ROSARY, start, len: INT ], ChangingSpanForPaste => [ span: Span ], ChangingFormat => [ -- change format for node root: Node, node: Node, newFormatName, oldFormatName: ATOM ], ChangingProp => [ -- change property for node root, node: Node, propName: ROPE, propAtom: ATOM, newval, oldval: REF ], MovingNodes => [ destRoot, sourceRoot: Node, dest, first, last, pred: Node, nesting: INTEGER, afterDest: BOOL ], NodeNesting => [ -- change nesting of nodes [first..last] root, first, last: Node, change: INTEGER ], InsertingNode => [ -- insert new node after dest root, new, dest: Node ], ENDCASE ]; ChangeSet: TYPE = PACKED ARRAY ChangeType OF Flag; Flag: TYPE = BOOL _ FALSE; defaultChangeSet: ChangeSet = ALL[TRUE]; EditNotifyProc: TYPE = PROC [change: REF READONLY Change]; When: TYPE = { before, after }; Priority: TYPE = { high, normal, low }; AddEditNotifyProc: PROC [world: World, proc: EditNotifyProc, time: When _ after, priority: Priority _ normal, changeSet: ChangeSet _ defaultChangeSet]; RemoveEditNotifyProc: PROC [world: World, proc: EditNotifyProc, time: When _ after]; EditNotify: PROC [world: World, change: REF READONLY Change, time: When]; Event: TYPE = REF EventBody; EventBody: TYPE = RECORD [subevents: SubEvent]; SubEvent: TYPE = REF SubEventBody; SubEventBody: TYPE = RECORD [ next: SubEvent, undoProc: UndoProc, undoRef: REF Change ]; UndoProc: TYPE ~ PROC [world: World, undoRef: REF Change]; CreateEvent: PROC RETURNS [Event]; NoteEvent: PROC [world: World, undoProc: UndoProc, undoRef: REF Change]; UndoEvent: PROC [world: World, undoEvent: Event]; ResetEvent: PROC [event: Event]; EmptyEvent: PROC [event: Event] RETURNS [BOOL]; Slice: TYPE = REF SliceArray; SliceArray: TYPE = RECORD [ next: Slice, -- for free list length: NAT _ 0, nodes: SEQUENCE maxLength: NAT OF Node ]; SliceKind: TYPE = { before, after }; GetSlice: PROC [len: NAT] RETURNS [slice: Slice]; FreeSlice: PROC [slice: Slice]; SliceLength: PROC [slice: Slice] RETURNS [NAT] = INLINE { RETURN [slice.length] }; SliceNode: PROC [slice: Slice, index: NAT] RETURNS [Node] = INLINE { RETURN [slice[index]] }; LastOfSlice: PROC [slice: Slice] RETURNS [Node] = INLINE { RETURN [slice[slice.length-1]] }; KindOfSlice: PROC [slice: Slice] RETURNS [SliceKind] = INLINE { RETURN [IF slice[0]#NIL THEN before ELSE after] }; Splice: PROC [before, after: Slice, beforeStart, afterStart: NAT _ 0]; ReplaceBand: PROC [before, after, top, bottom: Slice, nesting: INTEGER]; BadBand: ERROR; DescribeBand: PROC [first, last: Node] RETURNS [before, after, top, bottom: Slice, nesting: INTEGER, depth: NAT]; DeletePrefix: PROC [slice: Slice, depth: NAT]; DestSlices: PROC [dest: Node, where: Place] RETURNS [before, after: Slice, nesting: INTEGER]; CreateDest: PROC [depth: NAT] RETURNS [dest: Location]; CopySpan: PROC [span: Span] RETURNS [result: Span]; NeededNestingChange: TYPE = { needNest, needUnNest, ok }; NeedNestingChange: PROC [before, after, top, bottom: Slice, nesting: INTEGER, depth: NAT] RETURNS [NeededNestingChange]; CompareSliceOrder: PROC [s1, s2: Slice] RETURNS [order: Order]; DoSplits: PROC [world: World, alpha, beta: Span] RETURNS [Span, Span]; DoSplits2: PROC [world: World, dest: Location, source: Span, where: Place, nesting: INTEGER] RETURNS [Location, Span, Place, INTEGER]; UndoSplits: PROC [world: World, alpha, beta: Span] RETURNS [Span, Span]; UndoSplits2: PROC [world: World, dest: Location, source: Span] RETURNS [Location, Span]; ReMerge: PROC [world: World, alpha, beta: Span, merge: Node, tail: BOOL _ FALSE] RETURNS [Span, Span]; SliceOrder: PROC [alpha, beta: Span, aBefore, aBottom, bBefore, bBottom: Slice] RETURNS [overlap: BOOL, head, tail: Span, startOrder, endOrder: Order]; ApplyToSpanProc: TYPE = PROC [node: Node, start, len: INT] RETURNS [stop: BOOL]; ApplyToSpan: PROC [span: Span, proc: ApplyToSpanProc]; ForwardLoc: PROC [loc: Location] RETURNS [new: Location]; BackLoc: PROC [loc: Location] RETURNS [new: Location]; Flatten: PROC [node: Node] RETURNS [BOOL]; EditNotifyData: TYPE ~ REF EditNotifyDataRep; EditNotifyDataRep: TYPE; -- see EditNotifyImpl World: TYPE ~ REF WorldRep; WorldRep: TYPE ~ RECORD [ editNotify: EditNotifyData, currentEvent: Event, paste: REF Change.ChangingSpanForPaste, afterMoved1, afterMoved2: Location ]; END. TiogaPrivate.mesa Copyright Σ 1986 by Xerox Corporation. All rights reserved. Doug Wyatt, September 18, 1986 11:24:10 am PDT CheckNode, TreeCheck does CheckRope & CheckRuns ... called to verify that a Tioga tree structure is valid. If a problem is discovered, an exit to the debugger with an error message and locale is taken. NodeProps Put, Remove, Inherit properties Returns a shared REF to the given BOOL; convenient for boolean property values. NIL is a valid value. Use RemProp to remove property. (Although GetProp will not distinguish between property value NIL and no property present, it is useful to be able to have NIL values to avoid creating garbage. Setting to NIL doesn't release the property record, so don't need to reallocate when next set to a non-NIL value. n inherits properties from another node Property Attributes This section deals with attributes of property names. Attributes are just tags associated with the property names that modify the way the properties are treated by Tioga. The most important attribute is $Visible, which says whether or not the value of the property can affect the appearance of the formatted document; if such a property's value is changed (at the TextEdit level or above), the node and all of its children will be repainted. The attributes are associated with the code that is currently loaded and registered, not with documents. Refer to NodePropsImpl for a list of meaningful attributes. Associates an attribute with a property name. Tests whether the named property and a given attribute. For completeness only; list is read-only. For completeness only; list is read-only. NodeAddrs assigns addr to location in text ok if addr was previously assigned elsewhere in the text location automatically updated when text is edited removes the given addr if addr has been moved, does RemTextAddr on new location also don't modify location when edits take place does RemTextAddr[from, addr]; PutTextAddr[to, addr, location]; add leaves forwarding address for use by GetTextAddr generates ERROR TextAddrNotFound if the addr is not in the mapping node may be different than n if addr has been moved apply the action to each addr&location pair for the text returns true if&when an action returns true skips pinned or moved addresses Notify proc registration Editing Operations for persistent addrs replace chars in [start..start+len) by newlen chars addrs that are in the replaced section move to start add (newlen-len) to addrs that are after the replaced section Update Functions for persistent addrs EditNotify Change Record dest cannot be within nodes [first..last] pred is the node before first. pred and nesting used for undo Notification Operations indicates whether notify before or after the change has taken place high priority procs called before normal, and normal called before low e.g., might use high priority for clearing style cache, normal for redisplay, and low for saving replay info add new proc to list of notification procedures call proc before/after any edit in its changeSet use time=before for applications such as saving text for undo use time=after for applications such as reformat & redisplay remove proc from list of notification procedures call the appropriate edit notify procs UndoEvent procedure supplied by client to undo the effects of a particular subevent adds to list of subevents calls undoProc[world, undoRef] for each subevent in reverse order that subevents originally happened world arg is to record the effects of Undo so it too will be undoable resets the list of subevents to NIL Undo automatically does a Reset when it is finished returns true if subevents list is empty EditSpanSupport Miscellaneous returns true if it decides to flatten rope & runs this is done automatically after a certain number of edits to the node World info Κ Ÿ˜codešœ™Kšœ<™Kšœ>™>Kšœ4™4K˜—K˜š Ÿ œœœœœ˜KKšœB™BK™3K˜—š Ÿœœœœ œœ˜\K˜—šœœ˜K˜—K˜šŸ œœ$œœ˜EKšœ8™8Kšœ+™+K™K˜—š œœœœ œœœ˜GK˜—K˜Kšœ™K˜KšŸœœ˜/šŸœœ˜2K˜—š œœœœœœœ˜MK˜—K˜Kšœ'™'K˜šŸ œœ"œ˜8Kšœ3™3Kšœ4™4Kšœ=™=K˜—K˜Kšœ%™%K˜Kš Ÿ œœœœ œ˜L—™ šœ ™ šœ œ˜K˜GKšœE˜EK˜K˜—šœœœœ˜3˜Kšœœ˜ K˜ K˜—˜K˜Kšœœ˜Kšœ œ˜K˜Kšœ œ˜Kšœ˜K˜—˜Kšœœ˜ K˜ Kšœ œ˜Kšœ œ˜Kšœ ˜Kšœ˜—˜K˜ K˜—šœΟc˜-K˜Kšœ˜"K˜—šœ ˜-Kšœœ œ˜EKšœ˜—˜K˜Kšœ(œ˜0Kšœ ˜Kšœ˜Kšœ)™)Kšœ=™=—šœ (˜9Kšœ!˜(Kšœ˜—šœ ˜0K˜K˜—Kš˜Kšœ˜K˜——šœ™Kš œ œœœ œ˜2Kšœœœœ˜šœœœ˜(K˜—š œœœ œœ ˜:K˜—šœœ˜KšœC™CK˜—šœ œ˜'KšœF™Fšœ7™7šœ™Kšœ™——K˜—K˜šŸœœ˜˜Kšœ/™/šœ0™0Kšœ=™=Kšœ<™