EditSpanSupport.mesa
Copyright Ó 1985, 1986, 1991, 1992 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, February 27, 1992 2:49 pm PST
DIRECTORY
Tioga USING [Event, Location, Node, NodeItself, Order, Place, Span];
EditSpanSupport: CEDAR DEFINITIONS = BEGIN
Node: TYPE = Tioga.Node;
Location: TYPE = Tioga.Location;
Span: TYPE = Tioga.Span;
NodeItself: INT = Tioga.NodeItself;
Offset: TYPE = INT;
MaxLen: INT = LAST[INT];
Event: TYPE = Tioga.Event;
Place: TYPE ~ Tioga.Place;
NodeOrder: TYPE ~ Tioga.Order;
Slice: TYPE = REF SliceArray;
SliceArray:
TYPE =
RECORD [
next: Slice, -- for free list
kind: OfSlice, -- before/after
length: NAT ¬ 0,
nodes: SEQUENCE maxLength: NAT OF Node
];
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 [Node]
= INLINE { RETURN [slice[index]] };
LastOfSlice:
PROC [slice: Slice]
RETURNS [Node]
= INLINE { RETURN [slice[slice.length-1]] };
Splice:
PROC [before, after: Slice, beforeStart, afterStart:
NAT ¬ 0];
AdoptChildren:
PROC [node, child: Node];
ReplaceBand:
PROC [before, after, top, bottom: Slice, nesting:
INTEGER, event: Event];
DescribeBand:
PROC [first, last: Node]
RETURNS [before, after, top, bottom: Slice, nesting:
INTEGER, depth:
NAT];
DeletePrefix:
PROC [slice: Slice, depth:
NAT];
DestSlices:
PUBLIC
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: 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: Node, 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: Node, start, len:
INT]
RETURNS [stop:
BOOL];
Apply:
PROC [span: Span, proc: ApplyProc];
NodeLoc:
PROC [loc: Location]
RETURNS [Location]
= INLINE { RETURN [[loc.node,NodeItself]] };
NodeSpan:
PROC [span: Span]
RETURNS [Span]
= INLINE { RETURN[[NodeLoc[span.start],NodeLoc[span.end]]] };
ForwardLoc:
PROC [loc: Location]
RETURNS [new: Location];
BackLoc:
PROC [loc: Location]
RETURNS [new: Location];
END.