Branch Classes
BranchClass: TYPE = REF BranchClassRec;
defaultBranchClass: BranchClass; -- default flavor = $Branch
branchContentsAtom, branchChildrenAtom: ATOM;
BranchClassRec:
TYPE =
RECORD [
setContents: BranchSetContentsProc ←
NIL,
Called when creating internal representation for branch.
If leave this NIL, system will process the contents in the usual manner.
getContents: BranchGetContentsProc ←
NIL,
Called when creating external representation for branch.
If leave this NIL, system will save the contents in the usual manner.
setChildren: BranchSetChildrenProc ←
NIL,
Called when creating internal representation for branch.
If leave this NIL, system will process the children in the usual manner.
getChildren: BranchGetChildrenProc ←
NIL,
Called when creating external representation for branch.
If leave this NIL, system will save the children in the usual manner.
flavor: BranchFlavor ←
NIL,
Each branch class has a unique name to distinguish it from other implementations.
privateData: REF ANY ← NIL,
privateOps:
REF
ANY ←
NIL
Implementor private class operations and data
];
BranchFlavor: TYPE = ATOM;
RefBranchNode: TYPE = TiogaNode.RefBranchNode;
RefItemNode: TYPE = TiogaNode.RefItemNode;
ROPE: TYPE = Rope.ROPE;
BranchSetContentsProc:
TYPE =
PROC [
br: RefBranchNode, specsRope: ROPE, start, len: INT, insert: InsertContentsProc];
InsertContentsProc: TYPE = PROC [item: RefItemNode, previous: RefItemNode ← NIL];
start and len indicate where in the specsRope the information is actually stored. These parameters are included so that the file reader doesn't have to create a rope substring just to pass the specs to the set proc.
Implementor calls the insert proc for each of the contents item nodes. If you can pass the previous item, the insert will run faster. If previous is nil, the insert proc will simply set it to last contents of the branch.
Implementor typically will not use the branch arg to the set proc.
BranchSetChildrenProc:
TYPE =
PROC [
br: RefBranchNode, specsRope: ROPE, start, len: INT, insert: InsertChildrenProc];
InsertChildrenProc: TYPE = PROC [child: RefBranchNode, previous: RefBranchNode ← NIL];
start and len indicate where in the specsRope the information is actually stored. These parameters are included so that the file reader doesn't have to create a rope substring just to pass the specs to the set proc.
Implementor calls the insert proc for each of the children branch nodes. If you can pass the previous child, the insert will run faster. If previous is nil, the insert proc will simply set it to last child of the branch.
Implementor typically will not use the branch arg to the set proc.
BranchGetContentsProc:
TYPE =
PROC [br: RefBranchNode]
RETURNS [specs:
ROPE];
The specs will be written on the file instead of the usual representation for the contents.
If returns NIL specs, contents will be saved in standard manner.
BranchGetChildrenProc:
TYPE =
PROC [br: RefBranchNode]
RETURNS [specs:
ROPE];
The specs will be written on the file instead of the usual representation for the children.
If returns NIL specs, contents will be saved in standard manner.
AlreadyRegistered:
SIGNAL;
-- raised by Register if class with same name already exists.
if you continue, it will simply overwrite the old class definition.