TreeSlice.mesa; written by Bill Paxton, June 1981
edited by McGregor, February 7, 1983 9:44 am
edited by Bill Paxton, July 11, 1983 1:31 pm
DIRECTORY
TiogaNode, TiogaNodeOps;
TreeSlice: CEDAR DEFINITIONS = BEGIN
Ref: TYPE = TiogaNode.Ref;
Span: TYPE = TiogaNode.Span;
***** Declarations
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 };
***** Operations
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]] };
CompareSliceOrder: PROC [s1, s2: Slice] RETURNS [order: TiogaNodeOps.NodeOrder];
SliceOrder:
PROC [alpha, beta: Span, aBefore, aBottom, bBefore, bBottom: Slice]
RETURNS [overlap: BOOLEAN, head, tail: Span, startOrder, endOrder: TiogaNodeOps.NodeOrder];
END.