<> <> <> <<>> <> <<1) a file whose server name contains ".alpine" is presumed to be an Alpine file.>> <<2) the special server name "StableStorage" identifies a file residing in stable storage; the file name syntax is [StableStorage]copy.broadside where bank in [0..15], copy in [0..3], and broadside in [0..1].>> <<3) any other file is presumed to be an ordinary FS file.>> <> DIRECTORY BasicTime USING [GMT, nullGMT], FS USING [AccessOptions, ByteCount, defaultStreamBufferParms, defaultStreamOptions, ExtendFileProc, Lock, OpenFile, StreamBufferParms, StreamOptions], IO USING [STREAM], Rope USING [ROPE]; GeneralFS: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; STREAM: TYPE = IO.STREAM; <> <> <> OpenFile: TYPE = FS.OpenFile; Open: PROC [name: ROPE, lock: FS.Lock _ $read, wantedCreatedTime: BasicTime.GMT _ BasicTime.nullGMT, remoteCheck: BOOL _ TRUE, wDir: ROPE _ NIL ] RETURNS [OpenFile]; <> <<>> <> <> Create: PROC [name: ROPE, setPages: BOOL _ TRUE, pages: INT _ 0, setKeep: BOOL _ FALSE, keep: CARDINAL _ 1, wDir: ROPE _ NIL ] RETURNS [OpenFile]; <> <<>> <> <> OpenOrCreate: PROC [name: ROPE, keep: CARDINAL _ 1, pages: INT _ 5, wDir: ROPE _ NIL ] RETURNS [OpenFile]; <> <<>> <> <> <> StreamOpen: PROC [fileName: ROPE, accessOptions: FS.AccessOptions _ $read, streamOptions: FS.StreamOptions _ FS.defaultStreamOptions, keep: CARDINAL _ 1, createByteCount: FS.ByteCount _ 2560, streamBufferParms: FS.StreamBufferParms _ FS.defaultStreamBufferParms, extendFileProc: FS.ExtendFileProc _ NIL, wantedCreatedTime: BasicTime.GMT _ BasicTime.nullGMT, remoteCheck: BOOL _ TRUE, wDir: ROPE _ NIL ] RETURNS [STREAM]; <<>> <> <<>> <<(1) If accessOptions = $read, perform GeneralFS.Open[name: fileName, wantedCreatedTime: wantedCreatedTime, remoteCheck: remoteCheck, wDir: wDir]. If accessOptions = $create, perform GeneralFS.Create[name: fileName, keep: keep, pages: FS.PagesForBytes[createByteCount], wDir: wDir]. If accessOptions = $append, perform GeneralFS.OpenOrCreate[name: fileName, keep: keep, pages: FS.PagesForBytes[createByteCount], wDir: wDir]. If accessOptions = $write, perform GeneralFS.Open[name: fileName, lock: $write, wantedCreatedTime: wantedCreatedTime, remoteCheck: remoteCheck, wDir: wDir]. Any FS.Error raised by a call to GeneralFS.Open, GeneralFS.Create, or GeneralFS.OpenOrCreate will propogate through GeneralFS.StreamOpen.>> <<>> <<(2) Perform FS.StreamFromOpenFile[ ... , streamOptions, streamBufferParms, extendFileProc] on the resulting FS.OpenFile. The value of accessOptions determines the set of operations allowed on the stream (disallowed operations raise IO.Error[$NotImplementedForThisStream, stream] when called), and the initial streamIndex, as follows:>> <> <> <> <> <<>> <> <> END.