<> <> <> <> <> <<>> <> DIRECTORY BasicTime USING [GMT, nullGMT], IO USING [STREAM], PFSNames USING [PATH], Rope USING [ROPE]; PFS: CEDAR DEFINITIONS = BEGIN ROPE: TYPE ~ Rope.ROPE; STREAM: TYPE ~ IO.STREAM; PATH: TYPE ~ PFSNames.PATH; <> <> <> <> NameFormat: TYPE ~ {slashes, brackets}; RopeFromPath: PROC [path: PATH, format: NameFormat _ slashes] RETURNS [rope: ROPE]; <...".>> <<>> PathFromRope: PROC [rope: ROPE] RETURNS [path: PATH]; <> <> <> DoInWDir: PROC [ wDir: PATH, inner: PROC ]; <> GetWDir: PROC RETURNS [ wDir: PATH ]; AbsoluteName: PROC [short: PATH, wDir: PATH _ NIL] RETURNS [absolute: PATH]; <> <> <> <> <> <<>> ErrorGroup: TYPE = { ok, -- initial group for a new PFS.ErrorDesc bug, -- caused by an internal bug environment, -- something's wrong in the environment; human intervention required client, -- illegal operation, probably due to bug in client program user -- illegal operation, probably due to user action }; <<>> <> <<>> ErrorDesc: TYPE = RECORD [group: ErrorGroup, code: ATOM, explanation: ROPE, info: REF] _ [ok, NIL, NIL, NIL]; <<>> <> <<>> Error: ERROR [error: ErrorDesc]; <> <<>> <> <> <> <<>> UniqueID: TYPE = RECORD [ egmt: RECORD [time: BasicTime.GMT, usecs: CARD -- [0..1000000) -- _ 0 ], host: RECORD [a, b: CARD32] _ [0, 0] ]; nullUniqueID: UniqueID ~ [ [BasicTime.nullGMT, 0], [0, 0] ]; Mutability: TYPE = MACHINE DEPENDENT {immutable(0), mutable(1)}; FileType: TYPE = MACHINE DEPENDENT RECORD [CARD32]; tUnspecified: FileType = [0]; tDirectory: FileType = [1]; tText: FileType = [2]; <<>> <> <<>> <> <<>> <> <> <<>> <> <> <<>> <> <> <> <> <> <<>> <> <> <> <> <> FileInfo: PROC [ name: PATH, wantedUniqueID: UniqueID _ nullUniqueID ] RETURNS [ fullFName, attachedTo: PATH, uniqueID: UniqueID, bytes: INT, mutability: Mutability, fileType: FileType ]; <<>> <> <<>> <> <<>> <> <<>> <> <> <<>> <> <> <> <<>> InfoProc: TYPE = PROC [ fullFName, attachedTo: PATH, uniqueID: UniqueID, bytes: INT, mutability: Mutability, fileType: FileType ] RETURNS [continue: BOOL _ TRUE]; EnumerateForInfo: PROC [pattern: PATH, proc: InfoProc, lbound: PATH _ NIL, hbound: PATH _ NIL ]; <<"proc" is called for each FName selected by the pattern, lbound and hbound. Returning "continue" as FALSE stops the enumeration. The values passed to the InfoProc are the same as would be reported by a call to PFS.FileInfo for each of the file names encountered.>> <> <<>> <> <> NameProc: TYPE = PROC [name: PATH] RETURNS [continue: BOOL _ TRUE]; EnumerateForNames: PROC [pattern: PATH, proc: NameProc, lbound: PATH _ NIL, hbound: PATH _ NIL]; <> <<>> <> <> <<>> FileLookup: PROC [name: PATH, tryExtensions: LIST OF ROPE] RETURNS [fullPath: PATH]; <> <<>> <> <> <<>> FileSearch: PROC [name: PATH, searchRules: LIST OF -- directory -- PATH] RETURNS [fullPath: PATH]; <> <<>> <> <> <> <> <<>> <> OpenFile: TYPE = REF OpenFileObject; OpenFileObject: TYPE; nullOpenFile: OpenFile = NIL; AttributeSource: TYPE = {inherit, set}; CreateOptions: TYPE = RECORD [ keep: CARDINAL _ 0, -- no keep processing setMutability: AttributeSource _ inherit, mutability: Mutability _ immutable, setFileType: AttributeSource _ inherit, fileType: FileType _ tUnspecified ]; defaultCreateOptions: CreateOptions ~ []; AccessOptions: TYPE = {read, write, create, append}; Open: PROC [name: PATH, access: AccessOptions _ read, wantedUniqueID: UniqueID _ nullUniqueID, checkFileType: BOOL _ FALSE, fileType: FileType _ tUnspecified, createOptions: CreateOptions _ defaultCreateOptions ] RETURNS [OpenFile]; <> <<>> <> <> <> <> RetrieveConfirmProc: TYPE = PROC[fullFName: PATH, bytes: INT, uniqueID: UniqueID] RETURNS [IO.STREAM]; Retrieve: PROCEDURE [name: PATH, wantedUniqueID: UniqueID _ nullUniqueID, proc: RetrieveConfirmProc, checkFileType: BOOL _ FALSE, fileType: FileType _ tUnspecified ]; <> <<>> <> <> StoreConfirmProc: TYPE = PROC [fullName: PATH] RETURNS [continue: BOOLEAN _ TRUE]; <> Store: PROCEDURE [name: PATH, wantedUniqueID: UniqueID, str: IO.STREAM, proc: StoreConfirmProc _ NIL, createOptions: CreateOptions _ defaultCreateOptions ]; <> <<>> <> <> Attach: PROC [attachment, attachedFile: PATH, keep: CARDINAL _ 0, -- no keep processing wantedUniqueID: UniqueID _ nullUniqueID, remoteCheck: BOOL _ TRUE ] RETURNS [toFName: PATH]; <<>> <> <<>> <> <> <<>> NameConfirmProc: TYPE ~ PROC [fullName: PATH, uniqueID: UniqueID] RETURNS [continue: BOOL _ FALSE]; Delete: PROC [name: PATH, wantedUniqueID: UniqueID _ nullUniqueID, confirmProc: NameConfirmProc _ NIL ]; <> <> <<>> <> <> Rename: PROC [from, to: PATH, wantedUniqueID: UniqueID _ nullUniqueID, createOptions: CreateOptions _ defaultCreateOptions, confirmProc: NameConfirmProc _ NIL ]; <> <<>> <> <> <<>> Copy: PROC [from, to: PATH, wantedUniqueID: UniqueID _ nullUniqueID, createOptions: CreateOptions _ defaultCreateOptions, confirmProc: NameConfirmProc ]; <> <<>> <> <<>> <> <> GetClass: PROC [file: OpenFile] RETURNS [ATOM]; <> <<>> <> <> <<>> GetName: PROC [file: OpenFile] RETURNS [fullFName, attachedTo: PATH]; <> <<>> <> <> GetInfo: PROC [file: OpenFile] RETURNS [ fullFName, attachedTo: PATH, uniqueID: UniqueID, bytes: INT, mutability: Mutability, fileType: FileType ]; <> <<>> <> <> <<>> SetAttributes: PROC [file: OpenFile, attributes: CreateOptions]; <<Comment needed.>> <<>> <> <> <<>> SetByteCountAndUniqueID: PROC [ file: OpenFile, bytes: INT _ -1, uniqueID: UniqueID _ nullUniqueID ]; <> <<>> <> <> <<>> Read: UNSAFE PROC [file: OpenFile, filePosition, nBytes: CARD, to: LONG POINTER] RETURNS [bytesRead: INT]; <> <<>> <> <> Write: PROC [file: OpenFile, filePosition, nBytes: CARD, from: LONG POINTER] RETURNS [bytesWritten: INT]; <> <<>> <> <> Close: PROC [file: OpenFile]; <> <<>> <> <> <> <<>> SetClientProperty: PROC [file: OpenFile, propertyName: ROPE, propertyValue: ROPE]; <> <<>> <> <> <<>> GetClientProperty: PROC [file: OpenFile, propertyName: ROPE] RETURNS [propertyValue: ROPE]; <> <<>> <> <> <<>> PropProc: TYPE = PROC [ propertyName: ROPE, propertyValue: ROPE ] RETURNS [continue: BOOL _ TRUE]; EnumerateClientProperties: PROC [file: OpenFile, proc: PropProc]; <<"proc" is called for each client property that has a non-NIL value. The enumeration is done over the properties and their values that existed when the call is made to EnumerateClientProperties, so updates to the properties will not be seen by the enumerator during the enumeration.>> <<>> <> <> <<>> <> <> <<>> <> <> <> <> <<];>> <> <> <> <> <> <<... more stuff>> <<];>> <<>> <> <<>> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> < fileLen. Set streamIndex _ index.>> <> <> <> <> <<>> <> <<>> <> <<>> <> <> StreamOptions: TYPE = PACKED ARRAY StreamOption OF BOOL _ [includeFormatting: FALSE, closeFSOpenFileOnClose: TRUE]; StreamOption: TYPE = { includeFormatting, <> closeFSOpenFileOnClose <> }; defaultStreamOptions: StreamOptions = [includeFormatting: FALSE, closeFSOpenFileOnClose: TRUE]; <<>> StreamBufferParms: TYPE = RECORD [bytesPerBuffer: INT [0 .. 63*LONG[1024]] _ 4*1024, nBuffers: INT [0 .. 64] _ 2]; defaultStreamBufferParms: StreamBufferParms = []; minimumStreamBufferParms: StreamBufferParms = [bytesPerBuffer: 512, nBuffers: 1]; <> <<>> ByteCount: TYPE = INT; StreamOpen: PROC [fileName: PATH, accessOptions: AccessOptions _ read, wantedUniqueID: UniqueID _ nullUniqueID, checkFileType: BOOL _ FALSE, fileType: FileType _ tUnspecified, createOptions: CreateOptions _ defaultCreateOptions, streamOptions: StreamOptions _ defaultStreamOptions, streamBufferParms: StreamBufferParms _ defaultStreamBufferParms ] RETURNS [STREAM]; <<>> <> <<>> <> <> <> <> <> <<>> <> <> StreamFromOpenStream: PROC [self: STREAM] RETURNS [STREAM]; <> <> <> <<>> InitialPosition: TYPE = {start, end}; StreamFromOpenFile: PROC [openFile: OpenFile, accessOptions: AccessOptions _ read, streamOptions: StreamOptions _ defaultStreamOptions, streamBufferParms: StreamBufferParms _ defaultStreamBufferParms ] RETURNS [STREAM]; <> <<>> <> OpenFileFromStream: PROC [self: STREAM] RETURNS [OpenFile]; <> ErrorFromStream: PROC [self: STREAM] RETURNS [ErrorDesc]; <> <> <> <> <<>> <> <<$inconsistent -- an invariant of the file system code has been violated>> <<>> <> <<$volumeFull -- no more space on a file system>> <<$noMoreVersions -- next version number would be too big>> <<$accessDenied -- remote server access controls succeeded>> <<$quotaExceeded -- disk space quota on remote server exceeded>> <<$invalidPropertyStorage -- unrecognized property storage format for a file>> <<>> <> <<$badByteCount -- tried to set a byte count that is beyond end of file or negative>> <<$positionNotInFile -- tried to read or write beyond end of the file>> <<$invalidOpenFile -- PFS.OpenFile is closed, is PFS.nullOpenFile, or is an unrecognized TYPE>> <<$notImplemented -- called procedure not provided for this PFS.OpenFile>> <<$fileTypeMismatch -- the file type of the file did not match the type specified.>> <<$outOfPropertySpace -- property space for this file has been exhausted>> <<>> <> <<$unknownClass -- no implementation for the class has been registered.>> <<$unknownFile -- FName not in the implied directory>> <<$unknownUniqueID -- no version of the given FName had the specified uniqueID >> <<$patternNotAllowed -- name presented contained a "*" and procedure doesn't allow patterns>> <<$versionSpecified -- tried to create an FName with a specific version>> <<$cantUpdateTiogaFile -- tried open a file stream to write on a .tioga file>> <<$invalidNameSyntax -- for name parsers when they can't parse a ROPE into a PATH>> END. <<>>