XlPerDepth.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, October 7, 1992 8:39:37 pm PDT
Christian Jacobi, October 7, 1992 10:11 pm PDT
A little X window utility to manage per screen depth data efficiently.
This is useful for widgets which want to share certain information to reduce resource allocations, as well as for cases where real per screen depth data is needed.
DIRECTORY Xl;
XlPerDepth: CEDAR DEFINITIONS ~ BEGIN
Handle: TYPE = REF HandleRep;
A handle represents the application or package.
HandleRep: PRIVATE TYPE = RECORD [
last: REF READONLY PrivateRec ¬ NIL,
initData: REF,
init: InitProc,
implData: REF
];
PrivateRec: PRIVATE TYPE = RECORD [
sd: Xl.ScreenDepth,
sdData: REF
];
InlineGetData: PROC [h: Handle, sd: Xl.ScreenDepth] RETURNS [<<sdData:>> REF] = INLINE {
Returns (and creates if necessary) the per depth data of an application.
Raises all errors raised by InitProc.
pr: REF READONLY PrivateRec ¬ h.last;
IF pr.sd=sd THEN RETURN [pr.sdData];
RETURN [GetData[h, sd]]
};
GetData: PROC [h: Handle, sd: Xl.ScreenDepth] RETURNS [<<sdData:>> REF];
Returns (and creates if necessary) the per depth data of an application
Raises all errors raised by InitProc.
InitProc: TYPE = PROC [sd: Xl.ScreenDepth, initData: REF] RETURNS [<<sdData:>> REF];
Called once per ScreenDepth to create data.
All errors are propagated to caller of GetData.
InstallHandle: PROC [init: InitProc, initData: REF ¬ NIL] RETURNS [Handle];
Use this to set-up usage.
Data is lost when connection dies (For garbage collection reasons). Implementation may then return data for NIL ScreenDepth.
Restriction: handle is used as property key on ScreenDepth; clients should not interfere.
END.