NodeProps.mesa
Copyright Ó 1985, 1986, 1991 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, October 16, 1991 10:53 am PDT
DIRECTORY
Rope USING [ROPE],
Tioga USING [Node];
NodeProps: CEDAR DEFINITIONS ~ BEGIN
ROPE: TYPE = Rope.ROPE;
Get, Put, Map properties on a node
PutProp: PROC [n: Tioga.Node, name: ATOM, value: REF];
GetProp: PROC [n: Tioga.Node, name: ATOM] RETURNS [REF];
RemProp: PROC [n: Tioga.Node, name: ATOM]
~ INLINE { PutProp[n, name, NIL] };
MapPropsAction: TYPE = PROC [name: ATOM, value: REF] RETURNS [quit: BOOL ¬ FALSE];
MapProps: PROC [n: Tioga.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
nameFormat: ATOM; -- $Format
nameComment: ATOM; -- $Comment
nameCharSets: ATOM; -- $CharSets
nameCharProps: ATOM; -- $CharProps
nameStyleDef: ATOM; -- $StyleDef
namePrefix: ATOM; -- $Prefix
namePostfix: ATOM; -- $Postfix
nameArtwork: ATOM; -- $Artwork
nameActive: ATOM; -- $Active
AtomFromValue: PROC [REF] RETURNS [ATOM];
ValueFromAtom: PROC [ATOM] RETURNS [REF];
BoolFromValue: PROC [REF] RETURNS [BOOL];
ValueFromBool: PROC [BOOL] RETURNS [REF];
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 associatiated 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.
END.