CDPropertyTools.mesa a ChipNDale module
Copyright © 1986 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, January 13, 1986 2:06:18 pm PST
Last edited by: Christian Jacobi, December 30, 1986 12:47:41 pm PST
DIRECTORY
CD;
CDPropertyTools: CEDAR DEFINITIONS =
BEGIN
This package implements a method for separate ChipNDale applications to set up parameters. It solves the following problem:
The problem
Application x is set up from a command file. A first command file sets up certain properties, but then the user executes a second command file for different properties. How can the second command file undo all the registrations made by the first command file without any knowledge of the first command file?
The solution
The application package designates a root property key. All the parameters which can be set up from command files are associated to the root key. By calling RemoveProperties, all those associated parameters are removed. RemoveProperties can also be called directly from a command file, by issuing a command "///ChipNDale/CDRemoveRegistrations root".
What properties are removed with this mechanism
1) any associated property from the root atom
2) the root property from all layers
3) a root property from itself
Less important
4) layerkeys from root
5) a root property from any associated property key
Exclusive properties are protected for use by programs and can not be removed with this mechanism.
Concern
In general it is better to pass parameters with a single property list or ref, instead of building up a large state with properies on layers and atoms.
RemoveProperties: PROC [root: ATOM];
--Removes
-- root from layers
-- root from itself
-- layerkeys from root
-- further properties as associated
--Exclusive properties are not removed
Associate: PROC [root, key: ATOM];
--Associates "key" to "root":
-- whenever RemoveProperties[root] is called, the "key" property on "root"
-- and the "root" property on "key" will both be removed.
--Exclusive properties are not removed.
IsExclusive: PROC [key: REF] RETURNS [BOOL];
--Returns whether the "key" property is exclusive.
-- An exclusive property must not be used interactively
-- [but also properties with non Atom keys shouldn't]
END.