DIRECTORY Rope USING [ROPE], CD USING [Design, ObPtr, DesignPosition, DesignRect, ObjectProcs]; CDDirectory: CEDAR DEFINITIONS = BEGIN Fetch: PROC [design: CD.Design, name: Rope.ROPE] RETURNS [found: BOOL, object: CD.ObPtr]; Remove: PROC [design: CD.Design, name: Rope.ROPE, expectObject: CD.ObPtr_NIL] RETURNS [done: BOOL]; Include: PROC [design: CD.Design, object: CD.ObPtr, alternateName: Rope.ROPE_NIL, fiddleName: BOOL_TRUE] RETURNS [done: BOOL]; Rename: PROC [design: CD.Design, object: CD.ObPtr, newName: Rope.ROPE _ NIL] RETURNS [done: BOOL]; Enumerate: PROC [design: CD.Design, action: EachEntryAction] RETURNS [quit: BOOL]; EachEntryAction: TYPE = PROC [name: Rope.ROPE, ob: CD.ObPtr] RETURNS [quit: BOOL_FALSE]; EnumerateChildObjects: PROC[me: CD.ObPtr, p: EnumerateObjectsProc, x: REF] ~ INLINE { IF me.p.hasChildren THEN ObToDirectoryProcs[me].enumerateChildObjects[me, p, x] }; Key: PROC[me: CD.ObPtr] RETURNS [Rope.ROPE] ~ INLINE { RETURN [IF me.p.hasChildren THEN ObToDirectoryProcs[me].key[me] ELSE NIL] }; Name: PROC[me: CD.ObPtr] RETURNS [Rope.ROPE] ~ INLINE { RETURN [IF me.p.hasChildren THEN ObToDirectoryProcs[me].name[me] ELSE NIL] }; DirectoryProcs: TYPE = PRIVATE RECORD [ enumerateChildObjects: EnumerateChildObjectsProc, adjustItself: AdjustItselfProc, repositionElements: RepositionElementsProc, computeBounds: ComputeBoundsProc, key: RopeProc, name: RopeProc, setName: SetRopeProc, -- but name must be same as Include used setKey: SetRopeProc -- but name must be same as Include used ]; ObToDirectoryProcs: PRIVATE PROC [ob: CD.ObPtr] RETURNS [REF DirectoryProcs] ~ INLINE { RETURN [NARROW[ob.p.directoryProcs, REF DirectoryProcs]] }; InstallDirectoryProcs: PRIVATE PROC [type: REF CD.ObjectProcs] RETURNS [REF DirectoryProcs]; AdjustItselfProc: TYPE = PROC [objToReposition: CD.ObPtr, newBound: CD.DesignRect]; RepositionElementsProc: TYPE = PROC [me: CD.ObPtr, objToReposition: CD.ObPtr, oldSize: CD.DesignPosition, -- of objToReposition newBound: CD.DesignRect, -- of objToReposition design: CD.Design]; ComputeBoundsProc: TYPE = PROC [ob: CD.ObPtr] RETURNS [CD.DesignRect]; EnumerateChildObjectsProc: TYPE = PROC [me: CD.ObPtr, p: EnumerateObjectsProc, x: REF]; EnumerateObjectsProc: TYPE = PROC [me: CD.ObPtr, x: REF]; RopeProc: TYPE = PROC [me: CD.ObPtr] RETURNS [Rope.ROPE]; SetRopeProc: TYPE = PROC [me: CD.ObPtr, r: Rope.ROPE]; RepositionAnObject: PROC [design: CD.Design, objToReposition: CD.ObPtr]; END. ¦CDDirectory.mesa (a Chipndale module) by Christian Jacobi 23-Aug-83 last edited Christian Jacobi April 2, 1984 4:59:04 pm PST -- directory level -- all object which contain other objects are supposed to be in the directory; -- which is necessary for enumeration and for repositioning -- calls handling the same design must be sequential, otherwise the design can be clobbered -- search for object in directory -- if expectObject#NIL removes name only, iff named object=expectObject -- if removed objects are still used, they are neither enumerated correctly anymore, -- nor repositioned if internal objects change -- it is an ERROR to include an object into several design's -- even if it fiddles the name, it does not change the first character -- enumerates objects currently in directory in unspecified order -- objects inserted/deleted during enumeration may or may not be seen -- applies action to each object until action returns TRUE or no more objects -- returns quit: TRUE if some action returns TRUE -- implementation of other compound objects --at least once, but eventualy duplications; only its immediate childs -- objToReposition.size must be old, not yet adjusted size; -- (the actual reposition process may be postboned until an started -- reposition is finished; the started reposition should not be interferred -- with objToReposition changing size.) -- the size will be recomputed and corrected before return ÊM˜Jšœ'™'J˜Jšœ™Jšœ;™;J˜šÏk ˜ Jšœœœ˜Jšœœ:˜BJ˜—JšÐbnÏb œœ œ˜!Jš˜J˜Jšœ™J™NJ™;J™J™\J˜J˜šÏnœœ œœœ œ œ˜YJšœ!™!—J™š œœ œœœœœœ˜cJšœG™GJ™TJ™.—J˜š œœ œœ˜4Jš œœœœœœœ˜JJšœ<™Jšœ¡(˜