CDCleanUp.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
by Ch. Jacobi, January 29, 1986 5:31:20 pm PST
last edited Ch. Jacobi, March 14, 1986 6:41:39 pm PST
DIRECTORY
CD, Rope;
CDCleanUp: CEDAR DEFINITIONS =
BEGIN
Handy procedures for creating designs with lazy programs.
Lazy programs might simply build objects without including them into the designs
directory but call CleanUp before the design is handed to any other usage.
CleanUp: PROC [design: CD.Design, rootOb: CD.Object←NIL];
--General clean up of designs created using lazy programs
--IF rootOb#NIL only rootOb and its descendants are cleaned up
-- (but the replace step checks the whole design anyway)
--All objects of funny classes are replaced
--All objects which are not included in a directory, but should, will be included
-- Those objects must therefore not be used by other processes; callers responsibility.
--All objects which are in the directory of some other design will be replaced with a copy.
ReplaceFunnys: PROC [design: CD.Design, rootOb: CD.Object←NIL, key: REFNIL];
--Replaces all object with funny classes in place,
--hopes that this is allowed... but it does not know funny classes and their restrictions
--IF rootOb#NIL only rootOb and its descendants are handled
--Of course, there shouldn't be any funny classes...
--key: a property key which will be used freely... NIL is ok
ReplaceTagged: PROC [design: CD.Design, replaceBy: REF, rename: BOOLTRUE, key: REFNIL];
--Every object in the design is checked whether it has a replaceBy property pointing to
--an other object. Every instance of the object is then replaced by the other object.
--Directory invariants must hold (except for objects which will be replaced).
-- The object used for replacement must already be in the designs directory.
-- No funny object classes.
--rename: tries to rename replacing objects by name of replaced object
--key: a property key which will be used freely... NIL is ok
RemoveProperties: PROC [design: CD.Design, key: REF];
--tries to remove the propertiy "key" from all objects of "design";
--may be delayed or incomplete
END.