DIRECTORY Xl; XlPrivateResources: CEDAR DEFINITIONS SHARES Xl ~ BEGIN OPEN Xl; InitPrivateResources: PRIVATE PROC [c: Connection, resourceIdBase, resourceIdMask: CARD32]; MarkDead: PRIVATE PROC [c: Connection]; NewResourceID: --INTERNAL-- PROC [c: Connection] RETURNS [ID]; InternalFreeResourceID: PRIVATE --INTERNAL-- PROC [c: Connection, id: ID]; EntryFreeResourceID: PRIVATE --ENTRY-- PROC [c: Connection, id: ID]; ValidID: PROC [c: Connection, id: ID] RETURNS [BOOL]; Attach: PROC [c: Connection, id: ID, ref: REF]; Detach: PROC [c: Connection, id: ID]; Fetch: PROC [c: Connection, id: ID] RETURNS [ref: REF]; END. , XlPrivateResources.mesa Copyright Σ 1989, 1990, 1991 by Xerox Corporation. All rights reserved. Christian Jacobi, August 15, 1989 10:19:14 am PDT Christian Jacobi, August 19, 1992 3:15 pm PDT Private interface for the implementation of Xl dealing with resource allocations Initializes the data structures dealing with resources Call once per connection resourceIdBase and resourceIdMask as from connection set up Frees up memory; call when connection dies Resource creation, free and reuse Freeing and re-use is necessary as the X window spec does not really guarantee enough resource id's for long lived, shared connections. Returns a new or recycled ID Call from inside c's monitor lock only Recycle this ID Call from inside c's monitor lock only Recycle this ID Call from outside c's monitor lock only Returns whether id looks like an id which could be owned by c Resource reservation convention This Convention is frequently used to declare cached and shared id's immutable. Convention: Use of attached ref restricted to caller of NewResourceID. Restrict attachment to applications which will give a guarantee for detach on free, as there is no automatic built in detach. Attaches a ref to an id. Note: Do not forget to call Detach before freeing resource. Undo of Attach. Fetches attached ref Κ.•NewlineDelimiter –(cedarcode) style™codešœ™Kšœ Οeœ=™HKšœ1™1K™-K™—šΟk œ˜ K˜—šΟnœžœž ˜%Kšžœ˜ —Kšœžœžœ˜K™šœP™PK™—šŸœžœžœ1žœ˜[Kšœ7™7Kšœ™Kšœ;™;K™—šŸœžœžœ˜'K™+K™—šœ!™!K™‡K˜š Ÿ œΟc œžœžœžœ˜>Kšœž™K™&K™—š Ÿœžœ  œžœžœ˜JKšœ ž™K™&K˜—š Ÿœžœ  œžœžœ˜DKšœ ž™K™'K˜—š Ÿœžœžœžœžœ˜5Kšœ=™=—K™—šœ™KšœP™PKšœΕ™ΕK™šŸœžœžœžœ˜/Kšœ™Kšœ;™;K™—šŸœžœžœ˜%Jšœ™K™—š Ÿœžœžœžœžœ˜7K™——K˜Kšžœ˜K˜K˜—…—r Μ