NodeProps.Mesa; written by Paxton. January 1981
edited by McGregor. February 24, 1983 3:21 pm
edited by Paxton. August 26, 1983 9:28 am
DIRECTORY
TiogaNode,
NameSymbolTable,
Rope;
NodeProps: CEDAR DEFINITIONS =
BEGIN
***** general access routines
ROPE: TYPE = Rope.ROPE;
true, false: REF BOOL;
PutProp: PROCEDURE [n: TiogaNode.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: TiogaNode.Ref, name: ATOM] RETURNS [REF];
RemProps: PROCEDURE [n: TiogaNode.Ref]; -- remove all properties
RemProp: PROCEDURE [n: TiogaNode.Ref, name: ATOM];
MapProps: PROC [
n: TiogaNode.Ref, action: MapPropsAction, formatFlag, 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 formatFlag
hack to accelerate Inherit and PutFile operations
MapPropsAction: TYPE = PROC [name: ATOM, value: REF] RETURNS [BOOLEAN];
***** read, write, copy props
Register: 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, specsRope: ROPE, start, len: INT, n: TiogaNode.Ref] RETURNS [value: REF];
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 get proc.
WriteSpecsProc: TYPE = PROC [
name: ATOM, value: REF, n: TiogaNode.Ref] RETURNS [specs: ROPE];
CopyInfoProc: TYPE = PROC [
name: ATOM, value: REF, from, to: TiogaNode.Ref] RETURNS [new: REF];
NullRead: ReadSpecsProc; -- returns NIL always
NullWrite: WriteSpecsProc; -- returns NIL always
NullCopy: CopyInfoProc; -- returns NIL always
DoSpecs: ReadSpecsProc;
used when reading files
calls the registered reader for this property name
returns specs if no reader is registered
HasWriter: PROC [name: ATOM] RETURNS [BOOL]; --returns true if there is a non-null writer
GetSpecs: WriteSpecsProc;
used when writing files
calls the registered writer for this property name
if no writer is registered, returns value if it is a rope, NIL otherwise
CopyInfo: CopyInfoProc;
used when copying nodes
calls the registered copier for this property name
if no copier is registered, returns old value
***** special procs for internal use by Tioga
Object: TYPE = NameSymbolTable.Object;
GetPrefixObject: PROC
[n: TiogaNode.Ref] RETURNS [ob: Object];
PrefixName: PROC RETURNS [ROPE];
the name of the prefix property
PrefixAtom: PROC RETURNS [ATOM];
the atom used as name for prefix property
GetPostfixObject: PROCEDURE
[n: TiogaNode.Ref] RETURNS [ob: Object];
PostfixName: PROC RETURNS [ROPE];
the name of the postfix property
PostfixAtom: PROC RETURNS [ATOM];
the atom used as name for postfix prop 
END.