DIRECTORY CD USING [Design, Object], RefTab USING [Ref], Rope USING [ROPE]; CDDirectoryOps: CEDAR DEFINITIONS = BEGIN RemoveIfUnused: PROC [design: CD.Design, ob: CD.Object] RETURNS [done: BOOL, msg: Rope.ROPE]; PruneDirectory: PROC [design: CD.Design, askFirst: BOOL _ FALSE, pattern: Rope.ROPE _ NIL]; ReplaceTagged: PROC [design: CD.Design, replaceBy: REF, rename: BOOL_TRUE, key: REF_NIL]; RemoveProperties: PROC [design: CD.Design, key: REF]; CleanUp: PROC [design: CD.Design, rootOb: CD.Object_NIL]; IncludeDescribedObjects: PROC [design: CD.Design, ob: CD.Object, visited: RefTab.Ref_NIL]; END. ΪCDDirectoryOps.mesa (a ChipNDale module) Copyright c 1985, 1987 by Xerox Corporation. All rights reserved. Created by Christian Jacobi, June 3, 1985 7:04:20 pm PDT Last edited by: Christian Jacobi, April 3, 1987 2:05:09 pm PST Higher level directory functions. --Removes ob from the directory, --but succeeds only if the object is not used anywhere else in the design. --msg_NIL if succeded without problem. --Removes objects which are not used in the design from the directory. --pattern: If ~NIL, only objects which match pattern are considered. --askFirst makes it interactive --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 --Tries to remove the propertiy "key" from all objects of "design"; --May be delayed or incomplete --General clean up of designs created using lazy programs. --Not all invariants are checked, but some; clean up is not an excuse for --incorrect object creation, but a means for ChipNDale to survive such. --IF rootOb#NIL only rootOb and its descendants are cleaned up -- (but the replace step might check the whole design anyway) --Objects of funny classes might be replaced in place --Objects which are not included in a directory but could might be included or copied. -- Those objects must therefore not be used by other processes [callers responsibility]. --Objects which are in the directory of some other design might be replaced with a copy -- or might cause a crash. --This procedure might do excessive copying, it is only a survival hack for ChipnDale -- around bad clients. -- Composed objects or subobjects which have a $Describe property are -- included in the directory. Objects already in directory will not be renamed. -- On name conflict, fiddles name. -- visited: read-write cache of already visited object. Normally use NIL! Κ&˜codešœ*™*Kšœ Οmœ7™BKšœ8™8K™>K˜—šΟk ˜ Kšžœžœ˜Kšœžœ˜Kšœžœžœ˜—K˜KšΟnœžœž œ˜$Kšž˜K˜šœ!™!K™—K˜šŸœžœ žœ žœ žœžœ žœ˜]Kšœ ™ KšœJ™JKšœ'™'K˜—šŸœžœ žœžœžœžœžœ˜[KšΟcF™FKš D™DKš ™K™—šŸ œžœ žœžœ žœžœžœžœ˜YKšœW™WKšœV™VKšœM™MKšœP™PKšœ™JšœF™FJšœ<™<—K˜šŸœžœ žœžœ˜5KšœC™CKšœ™K˜—š Ÿœžœ žœžœžœ˜9K™:K™JK™GKšœ?™?KšœA™AK™5K™VK™]K™WK™K™UK™—K˜š Ÿœžœ žœ žœžœ˜ZJš F™FJšœ M™UJšœ ™'Jšœ  =™I—K˜Kšžœ˜K˜—…—h h