DIRECTORY Xl USING [Window, nullWindow]; XlAssoc: CEDAR DEFINITIONS ~ BEGIN OPEN Xl; Table: TYPE = REF AssocTabRep; AssocTabRep: TYPE = MONITORED RECORD [impl: REF AssocTabImplRep]; AssocTabImplRep: TYPE; ParentUnknown: ERROR; NullWindowUsed: ERROR; Create: PROC [mod: NAT ¬ 17] RETURNS [Table]; GetSize: PROC [x: Table] RETURNS [INT]; InsertWindow: PROC [x: Table, window: Window, parent: Window ¬ nullWindow, val: REF ¬ NIL] RETURNS [done: BOOL]; StoreWindow: PROC [x: Table, window: Window, parent: Window ¬ nullWindow] RETURNS [new: BOOL]; RemoveWindow: PROC [x: Table, window: Window] RETURNS [found: BOOL]; FetchValue: PROC [x: Table, window: Window] RETURNS [found: BOOL, parent: Window, val: REF]; StoreValue: PROC [x: Table, window: Window, val: REF ¬ NIL] RETURNS [found: BOOL]; EachChildAction: TYPE = PROC [window: Window, val: REF, parent: Window, data: REF] RETURNS [quit: BOOL ¬ FALSE]; Recurse: TYPE = {oneLevelOnly, topDown, bottomUp}; EnumerateChildren: PROC [x: Table, window: Window, action: EachChildAction, recurse: Recurse ¬ oneLevelOnly, data: REF ¬ NIL] RETURNS [found: BOOL, quit: BOOL]; Erase: PROC [x: Table]; END. π XlAssoc.mesa Copyright Σ 1988, 1991 by Xerox Corporation. All rights reserved. Christian Jacobi, April 29, 1988 0:30:03 am PDT Christian Jacobi, March 7, 1991 4:57 pm PST Package implements hash tables for association of windows with REF values. All windows must belong to the same server [name space]. This packages does not generate requests to the X server, nor does it get events in case windows are destroyed. The nullWindow acts as universal root; it can not be included or removed, but its children can be enumerated and it can hold data. creates new table with suggested number of windows. returns number of windows in table [the nullWindow is not counted] introduces new window and stores value, if window is not already known parent must be already inserted or nullWindow. window will be removed whenever parent is removed returns TRUE if inserted, FALSE if previously known may raise ParentUnknown or NullWindowUsed introduces window or change parent parent must be already inserted or nullWindow. window will be removed whenever parent is removed leaves associated value as it was, or, NIL if not previously known returns TRUE if newly inserted, FALSE if previously known may raise ParentUnknown or NullWindowUsed removes window and all its descendants from table may raise NullWindowUsed looks up window in table, returns associated value and parent (if window in table) if window found: found = TRUE, val = associated value, parent = parent of window if window not found: found = FALSE, val = NIL, parent = nullWindow parent as introduced with window; not checked with X server stores new value for window; returns TRUE if window known (=in table), FALSE otherwise enumerates children, each level in unspecified order children inserted/deleted during enumeration may or may not be seen applies action to each child until action returns TRUE or no more children returns found: window is found in table; quit: some action returned TRUE removes all windows and data from table [and breaks circularities] Κ+–(cedarcode) style•NewlineDelimiter ™codešœ ™ Kšœ Οeœ7™BKšœ/™/Kšœ+™+K™—šΟk œžœ˜(K˜—KšΟnœžœž ˜Kšœžœžœ˜K™šœ?žœ ™LK™8K™oKšœ‚™‚—K˜Kšœžœžœ ˜Kš œ žœž œžœžœ˜AKšœžœ˜K˜KšŸ œžœ˜KšŸœžœ˜K˜šŸœžœžœžœ ˜-Kšœ3™3K˜—šŸœžœ žœžœ˜'KšœB™BK˜—š Ÿ œžœ>žœžœžœžœ˜pJšœG™GJšœ.™.Jšœ1™1Jšœžœžœ™3Jšœ)™)—K˜šŸ œžœ9žœžœ˜^Jšœ"™"Jšœ.™.Jšœ1™1Jšœ'žœ™BJšœžœžœ™9Jšœ)™)J™—šŸ œžœžœ žœ˜DKšœ1™1Jšœ™K˜—š Ÿ œžœžœ žœžœ˜\KšœS™SKšœžœ3™PKšœžœžœ™BKšœ;™;—K˜š Ÿ œžœ!žœžœžœ žœ˜RKšœ™Kšœžœžœ ™9—K˜Kšœžœžœžœžœžœžœžœ˜pK˜Kšœ žœ%˜2K˜šŸœžœ\žœžœžœ žœžœ˜ Kšœ4™4KšœC™CKšœ2žœ™JKšœDž™H—K˜šŸœžœ ˜K™'K™—K˜Kšžœ˜K˜—…—†‘