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, January 29, 1986 6:57:46 pm PST
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];
--General clean up of designs created using lazy programs
--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, key:
REF←
NIL];
--Replaces all object with funny classes in place,
--hopes that this is allowed... but it does not know funny classes and their restrictions
--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, key:
REF←
NIL];
--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.
--Warning: might fail if there are object of funny classes.
--The object used for replacement must not be in other designs directory.
--key: a property key which will be used freely... NIL is ok
END.