TiogaExtraOps.Mesa
written by Bill Paxton. June 1982
last written by Paxton. December 30, 1982 11:19 am
last written by Teitelman. January 19, 1983 12:02 pm
Last Edited by: Maxwell, January 19, 1983 12:22 pm
This contains overflow from TiogaOps.Mesa
DIRECTORY
TiogaOps USING [CommandProc],
TiogaOpsDefs,
Rope USING [ROPE];
TiogaExtraOps: CEDAR DEFINITIONS =
BEGIN OPEN TiogaOpsDefs;
Node Property Lists
SetProp: PROC [name: ROPE, value: REF, which: WhichNodes ← selection];
PutProp: PROCEDURE [n: Ref, name: ATOM, value: REF];
NIL is a valid value. Use RemProp to remove property. (Although GetProp will not distinguish between property value NIL and no property present, it is useful to be able to have NIL values to avoid creating garbage. Setting to NIL doesn't release the property record, so don't need to reallocate when next set to a non-NIL value.
GetProp: PROCEDURE [n: Ref, name: ATOM] RETURNS [REF];
RemProp: PROCEDURE [n: Ref, name: ATOM];
MapProps: PROC [n: Ref, action: MapPropsAction, typeFlag, commentFlag: BOOLEANTRUE]
RETURNS [BOOLEAN];
-- apply the action to each name & value pair for the node
-- returns true if&when an action returns true
-- if commentFlag is false, skips Comment property; ditto for typeFlag
-- hack to accelerate Inherit and PutFile operations
MapPropsAction: TYPE = PROC [name: ATOM, value: REF] RETURNS [BOOLEAN];
read, write, copy props
RegisterPropProc: PROC [name: ATOM,
reader: ReadSpecsProc,
writer: WriteSpecsProc,
copier: CopyInfoProc];
-- registers these procs for this property name
-- they will be called by DoSpecs, GetSpecs, and CopyInfo
ReadSpecsProc: TYPE = PROC [name: ATOM, specs: ROPE] RETURNS [value: REF];
WriteSpecsProc: TYPE = PROC [name: ATOM, value: REF] RETURNS [specs: ROPE];
CopyInfoProc: TYPE = PROC [name: ATOM, value: REF] RETURNS [new: REF];
NullRead: ReadSpecsProc; -- returns NIL always
NullWrite: WriteSpecsProc; -- returns NIL always
NullCopy: CopyInfoProc; -- returns NIL always
Text keys: persistent "addresses" for characters in text nodes
PutTextKey: PROC [node: Ref, where: Offset, key: REF];
Associates the key with the given offset in the text node. Key moves with the text as edits take place in the node. Key can move to new node. (Also defined in TiogaOps)
GetTextKey: PROC [node: Ref, key: REF] RETURNS [loc: Location];
Tells you where the key is in the node at the current time.
loc node may be different if addr has been moved (Also defined in TiogaOps)
TextKeyNotFound: ERROR; -- raised by GetTextKey
RemoveTextKey: PROC [node: Ref, key: REF];
MapTextKeys: PROC [
node: Ref,
proc: PROC [key: REF, where: Offset] RETURNS [BOOLEAN]]
RETURNS [BOOLEAN];
Calls proc for all the keys for the given node.
Returns true if&when an action returns true
File I/O
GetFile: PROCEDURE [name: ROPE] RETURNS [root: Ref];
PutFile: PROCEDURE [name: ROPE, root: Ref];
FreeTree: PROCEDURE [root: Ref];
If you have gotten access to the root by GetFile and know that there are no remaining references to it, call FreeTree to have all of the intra-tree pointers set to NIL. This causes circular reference chains to be broken so that the garbage collector can reclaim the tree. If you are not sure, don't call this!
Registering Command procedures
UnRegisterCommand: PROC [name: ATOM, proc: TiogaOps.CommandProc];
Remove the proc from the list for the atom.
Miscellaneous
editTypeScripts: BOOL ; -- if true and selection not at end of ts, edit like normal Tioga doc.
sourceExtensions: LIST OF ROPE; -- the extensions all start with "."
END.