EditSpanSupport.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
written by Bill Paxton, June 1981
last edit by Bill Paxton, 17-Feb-82 9:53:04
last edit by Russ Atkinson, July 22, 1983 9:53 am
Michael Plass, March 14, 1985 12:24:06 pm PST
Doug Wyatt, April 14, 1985 4:36:16 pm PST
DIRECTORY
EditSpan USING [NodeOrder, Place],
TextNode USING [Location, NodeItself, Ref, RefTextNode, Span],
UndoEvent USING [Ref];
EditSpanSupport: CEDAR DEFINITIONS
= BEGIN
Ref: TYPE = TextNode.Ref;
RefTextNode: TYPE = TextNode.RefTextNode;
Offset: TYPE = INT;
MaxLen: INT = LAST[INT];
Location: TYPE = TextNode.Location;
Span: TYPE = TextNode.Span;
NodeItself: INT = TextNode.NodeItself;
Event: TYPE = UndoEvent.Ref;
Place: TYPE ~ EditSpan.Place;
NodeOrder: TYPE ~ EditSpan.NodeOrder;
Slice: TYPE = REF SliceArray;
SliceArray:
TYPE =
RECORD [
next: Slice, -- for free list
kind: OfSlice, -- before/after
length: NAT ← 0,
nodes: SEQUENCE maxLength: NAT OF Ref
];
OfSlice:
TYPE = { before, after };
GetSlice:
PROC [len:
NAT]
RETURNS [slice: Slice];
FreeSlice:
PROC [slice: Slice];
SliceLength:
PROC [slice: Slice]
RETURNS [length:
NAT]
= INLINE { RETURN [slice.length] };
SliceNode:
PROC [slice: Slice, index:
NAT]
RETURNS [Ref]
= INLINE { RETURN [slice[index]] };
LastOfSlice:
PROC [slice: Slice]
RETURNS [Ref]
= INLINE { RETURN [slice[slice.length-1]] };
Splice:
PROC [before, after: Slice, beforeStart, afterStart:
NAT ← 0];
ReplaceBand:
PROC [before, after, top, bottom: Slice, nesting:
INTEGER, event: Event];
DescribeBand:
PROC [first, last: Ref]
RETURNS [before, after, top, bottom: Slice, nesting:
INTEGER, depth:
NAT];
DeletePrefix:
PROC [slice: Slice, depth:
NAT];
DestSlices:
PUBLIC
PROC [dest: Ref, 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: NodeOrder];
DoSplits:
PROC [alpha, beta: Span, event: Event]
RETURNS [Span, Span];
DoSplits2:
PROC [dest: Location, source: Span, where: Place, nesting:
INTEGER, event: Event]
RETURNS [Location, Span, Place,
INTEGER];
UndoSplits:
PROC [alpha, beta: Span, event: Event]
RETURNS [Span, Span];
UndoSplits2:
PROC [dest: Location, source: Span, event: Event]
RETURNS [Location, Span];
ReMerge:
PROC [alpha, beta: Span, merge: Ref, event: Event, tail:
BOOL ←
FALSE]
RETURNS [Span, Span];
SliceOrder:
PROC [alpha, beta: Span, aBefore, aBottom, bBefore, bBottom: Slice]
RETURNS [overlap:
BOOL, head, tail: Span, startOrder, endOrder: NodeOrder];
ApplyProc:
TYPE =
PROC [node: RefTextNode, start, len:
INT]
RETURNS [stop:
BOOL];
Apply:
PROC [span: Span, proc: ApplyProc];
NodeSpan:
PROC [span: Span]
RETURNS [Span]
= INLINE { RETURN[[[span.start.node,NodeItself],[span.end.node,NodeItself]]] };
NodeLoc:
PROC [loc: Location]
RETURNS [Location]
= INLINE { RETURN [[loc.node,NodeItself]] };
ForwardLoc:
PROC [loc: Location]
RETURNS [new: Location];
BackLoc:
PROC [loc: Location]
RETURNS [new: Location];
END.