YggOpenDoc.mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Last edited by
Bob Hagmann April 28, 1988 9:31:03 am PDT
DIRECTORY
YggDID USING[DID],
YggEnvironment USING[DID, LockMode, PageCount],
YggInternal
USING[Document, OpenDoc, TransHandle];
YggOpenDoc: CEDAR DEFINITIONS =
BEGIN
OpenDoc: TYPE = YggInternal.OpenDoc;
Register: PROCEDURE [trans: YggInternal.TransHandle, did: YggDID.DID] RETURNS [openDoc: OpenDoc];
errors defined in this interface: none.
Finds or creates a openDoc handle for the supplied trans and DID, and increments use count on the returned handle. If the handle is created, it is also entered in the document list for its transaction and DIDMap.Register is called.
Unregister: PROCEDURE [openDoc: OpenDoc];
errors defined in this interface: none.
Decrements use count on handle. If the use count becomes zero and delta version is 0 (i.e., if the file has not been updated), deletes it from the document list for its transaction and calls DIDMap.Unregister. (Updated documents are taken care of by FlushTransState.)
FlushTransState: PROCEDURE [trans: YggInternal.TransHandle];
errors defined in this interface: none.
When this is called, it is a fatal error if any handle in this transaction's document list has useCount # 0 or delta version = 0. Otherwise, DIDMap.Unregister is called for each handle.
Access to immutable attributes.
GetDocHandle: PROCEDURE [openDoc: OpenDoc] RETURNS [doc: YggInternal.Document];
errors defined in this interface: none.
GetTransHandle: PROCEDURE [openDoc: OpenDoc] RETURNS [trans: YggInternal.TransHandle];
errors defined in this interface: none.
GetDID: PROCEDURE [openDoc: OpenDoc] RETURNS [did: YggEnvironment.DID];
errors defined in this interface: none.
Access to read/write attributes.
GetDeltaVersion: PROCEDURE [openDoc: OpenDoc] RETURNS [delta: INT];
errors defined in this interface: none.
Returns the most recent value set by SetMaxDeltaVersion, or zero if SetMaxDeltaVersion
hasn't been called. A nonzero value means that the file has been updated by this transaction.
SetMaxDeltaVersion: PROCEDURE [openDoc: OpenDoc, increment: INT ← 1];
errors defined in this interface: none.
Sets the delta version to the MAX of increment and its existing value.
GetHighWaterMark:
PROCEDURE [openDoc: OpenDoc]
RETURNS [highWaterMark:
YggEnvironment.PageCount];
errors defined in this interface: none.
returns the uncommitted highWaterMark, for this transaction. Initialize value is
LAST[PageCount].
GetLockMode: PROCEDURE [openDoc: OpenDoc] RETURNS [lock: YggEnvironment.LockMode];
errors defined in this interface: none.
SetLockMode: PROCEDURE [openDoc: OpenDoc, lock: YggEnvironment.LockMode];
errors defined in this interface: none.
Enumeration.
GetNextHandleForTrans:
PROCEDURE [trans: YggInternal.TransHandle, lastOpenDoc: OpenDoc ←
NIL] RETURNS [nextOpenDoc: OpenDoc];
errors defined in this interface: none.
handle = NIL starts a new enumeration, and nextHandle = NIL is returned when the
enumeration is exhausted. The FileInstance list is assumed to not be being
modified during this enumeration. When handle is non-NIL, not finding it is a fatal error.
END.