NodeProps.mesa
Copyright Ó 1985, 1986 by Xerox Corporation. All rights reserved.
written by Paxton. January 1981
last written by Paxton. December 28, 1982 11:11 am
Rick Beach, March 27, 1985 10:45:41 am PST
Michael Plass, May 9, 1986 10:29:27 am PDT
Doug Wyatt, September 3, 1986 10:29:54 am PDT
Put, Get, Map properties on a node
RefBool:
PROC [
BOOL]
RETURNS [
REF
BOOL];
Returns a shared REF to the given BOOL; convenient for boolean property values.
PutProp:
PROC [n: Node, 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:
PROC [n: Node, name:
ATOM]
RETURNS [
REF];
RemProp:
PROC [n: Node, name:
ATOM];
MapPropsAction:
TYPE =
PROC [name:
ATOM, value:
REF]
RETURNS [quit:
BOOL ←
FALSE];
MapProps:
PROC [n: Node, action: MapPropsAction,
formatFlag, commentFlag:
BOOL ←
TRUE]
RETURNS [quit:
BOOL];
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
Read, Write, Copy Props
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];
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
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
Property Attributes
This section deals with attributes of property names. Attributes are just tags associated with the property names that modify the way the properties are treated by Tioga. The most important attribute is $Visible, which says whether or not the value of the property can affect the appearance of the formatted document; if such a property's value is changed (at the TextEdit level or above), the node and all of its children will be repainted. The attributes are associated with the code that is currently loaded and registered, not with documents. Refer to NodePropsImpl for a list of meaningful attributes.
DeclarePropertyAttribute:
PROC [name:
ATOM, attribute:
ATOM];
Associates an attribute with a property name.
Is:
PROC [name:
ATOM, attribute:
ATOM]
RETURNS [
BOOL];
Tests whether the named property and a given attribute.
GetPropertyAttributes:
PROC [name:
ATOM]
RETURNS [
LIST
OF
ATOM];
For completeness only; list is read-only.
SetPropertyAttributes:
PROC [name:
ATOM, attributes:
LIST
OF
ATOM];
For completeness only; list is read-only.