YggFile.mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Last Edited by:
Bob Hagmann May 26, 1988 3:24:50 pm PDT
DIRECTORY
IO USING [STREAM],
YggDID USING[DID],
YggInternal USING[FileHandle, FPMFileHandle, LogMap],
Rope USING[ROPE];
YggFile: CEDAR DEFINITIONS =
BEGIN
PageNumber: TYPE = RECORD[INT];
PageCount: TYPE = INT;
FileHandle: TYPE = PUBLIC YggInternal.FileHandle;
FileHandleRep: TYPE = RECORD [
did: YggDID.DID,
component: ATOM, -- which part of the document (contents, links, attributes)
fpmFileHandle: YggInternal.FPMFileHandle,
logMapHandle: YggInternal.LogMap,
locked: BOOLFALSE,
users: INT ← 0,
name: Rope.ROPE ← NIL,
fd: INT ← 0,
fdLockCount: INT ← 0
];
Open: PROC [name: Rope.ROPE] RETURNS [FileHandle];
Create: PROC [name: Rope.ROPE, size: PageCount ] RETURNS [FileHandle];
Delete: PROC [file: FileHandle];
Info: PROC [file: FileHandle] RETURNS [size: PageCount, name: Rope.ROPE];
SetSize: PROC [file: FileHandle, size: PageCount];
Read: UNSAFE PROC [file: FileHandle, from: PageNumber, nPages: PageCount, to: LONG POINTER];
Write: PROC [file: FileHandle, to: PageNumber, nPages: PageCount, from: LONG POINTER];
FilesForDID: PROC [did: YggDID.DID] RETURNS [contents, attributes, links: YggFile.FileHandle];
Get the file objects for the DID. Any or all of these objects may be NIL. For objects with few links, the links are stored in the attributes. For objects with small contents, the contents are stored in the attributes. If there are no attributes, there is no file for them.
Creating a file stream
StreamFromOpenFile: PROC [file: YggFile.FileHandle] RETURNS [IO.STREAM];
END.