TiogaFileOps.Mesa
written by Bill Paxton. June 1982
last written by Paxton. August 12, 1982 3:23 pm
This is for applications that are creating a Tioga file from some other source
The expected mode of operation is as follows:
create a root node using CreateRoot
set its style (if not default) using SetStyle
for each node in tree,
(1) create it using InsertNode or InsertAsLastChild
(2) set the text contents using SetContents
(3) add looks if any using AddLooks
(4) set the format (if not default) using SetFormat
write the new Tioga file using Store
DIRECTORY
Rope USING [ROPE];
TiogaFileOps: CEDAR DEFINITIONS = BEGIN
Ref: TYPE = REF NodeBody;
NodeBody: TYPE;
CreateRoot: PROC RETURNS [root: Ref];
InsertNode:
PROC [x: Ref, child:
BOOL ←
FALSE]
RETURNS [new: Ref];
if ~child then new is immediate next sibling of x
else new is first child of x
InsertAsLastChild:
PROC [x: Ref, prevLast: Ref ←
NIL]
RETURNS [new: Ref];
prevLast is optional accelerator
SetContents: PROC [x: Ref, txt: Rope.ROPE];
AddLooks:
PROC [x: Ref, start, len:
INT, look:
CHAR ['a..'z], root: Ref ←
NIL];
start is char index of first char to get looks added. count from 0
can omit root, but runs faster if you supply it
must set contents before add looks
can add several different looks for any given character
can add looks for overlapping spans of text
SetFormat:
PROC [x: Ref, format: Rope.
ROPE];
e.g., SetStyle[node, "Title"];
SetStyle:
PROC [x: Ref, style: Rope.
ROPE];
e.g., SetStyle[root, "Mesa"];
Store:
PROC [x: Ref, filename: Rope.
ROPE];
x should be from call on CreateRoot
e.g., Store[root, "Foo.Tioga"];
END...