CinderSysOps.mesa
Copyright Ó 1987, 1989, 1991 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) November 19, 1987 7:42:44 pm PST
Andy Litman February 16, 1988 11:35:31 pm PST
JKF July 22, 1989 3:49:53 pm PDT
DIRECTORY
BasicTime USING [GMT],
IO USING [STREAM],
Rope USING [ROPE];
CinderSysOps: CEDAR DEFINITIONS = BEGIN
Interceptor: TYPE = REF InterceptorRecord;
InterceptorRecord: TYPE = RECORD [
open: OpenProc,
close: CloseProc,
delete: DeleteProc,
data: REF ¬ NIL
];
OpenProc: TYPE = PROC
[interceptor: Interceptor, name: Rope.ROPE, kind: OpenKind]
RETURNS [stream: IO.STREAM, err: Rope.ROPE, time: BasicTime.GMT];
OpenKind: TYPE = {read, write, writeLog};
Opens the named file and returns a stream to it. If the stream cannot be opened then an error message is returned.
CloseProc: TYPE = PROC
[interceptor: Interceptor, stream: IO.STREAM, abortAndDelete: BOOL]
RETURNS [err: Rope.ROPE];
Closes the given stream. If abortAndDelete, then abort all output operations and delete the associated file (if any). Otherwise, normal close is performed.
DeleteProc: TYPE = PROC
[interceptor: Interceptor, name: Rope.ROPE]
RETURNS [err: Rope.ROPE];
Deletes the named file (returning a messge if not possible).
Intercept: PROC [interceptor: Interceptor] RETURNS [old: Interceptor];
Intercepts the system operations, returning the previous interceptor (if any).
Open: PROC [name: Rope.ROPE, kind: OpenKind]
RETURNS [stream: IO.STREAM, err: Rope.ROPE, time: BasicTime.GMT];
Opens the file via the current interceptor proc.
Close: PROC [stream: IO.STREAM, abortAndDelete: BOOL ¬ FALSE] RETURNS [err: Rope.ROPE];
Closes the stream via the current interceptor proc. If abortAndDelete, then all I/O operations on files opened with kind in {read, write} will be aborted, and all files opened with kind = write will be deleted.
Delete: PROC [name: Rope.ROPE] RETURNS [err: Rope.ROPE];
Deletes the named file (returning a messge if not possible).
Cleanup: PROC [abortAndDelete: BOOL];
Closes all open streams managed by MimSysOps.
END.