CDCleanUp.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Created by Ch. Jacobi, January 29, 1986 5:31:20 pm PST
Last edited by: Christian Jacobi, September 22, 1986 4:22:40 pm PDT
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.
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.