-- NodeProps.Mesa
-- written by Paxton. January 1981
-- last written by Paxton. December 28, 1982 11:11 am
DIRECTORY
TextNode,
PGSupport,
NameSymbolTable,
Rope;
NodeProps: CEDAR DEFINITIONS =
BEGIN
ROPE: TYPE = Rope.ROPE;
true, false: REF BOOLEAN;
PutProp: PROCEDURE [n: TextNode.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: TextNode.Ref, name: ATOM] RETURNS [REF];
RemProp: PROCEDURE [n: TextNode.Ref, name: ATOM];
MapProps: PROC [n: TextNode.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
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, 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
DoSpecs: ReadSpecsProc;
-- used when reading files
-- calls the registered reader for this property name
-- returns specs if no reader is registered
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: TextNode.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: TextNode.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 
-- ***** Initialization
StartNodeProps: PROC; -- for initialization only
END.