(* $N- *)
DEFINITION MODULE FileSystem;
(* 2.0 / 29.5.87 / ms *)

FROM SYSTEM IMPORT
 ADDRESS,BYTE;
FROM Dos IMPORT
 FileHandlePtr;

TYPE
 CHARPtr=POINTER TO CHAR;
 Response=(done,notdone,lockErr,openErr,readErr,writeErr,seekErr,
  memErr,inUse,notFound,diskWriteProtected,deviceNotMounted,diskFull,
  deleteProtected,writeProtected,notDosDisk,noDisk);
 FileMode=(read,write,noBuffer);
 FileModeSet=SET OF FileMode;
 File=RECORD
  bufa,ela,ina,topa: CHARPtr;
  bufPos,filePos: LONGINT;
  file: FileHandlePtr;
  mode: FileModeSet;
  eof: BOOLEAN;
  res: Response;
 END;

PROCEDURE Lookup(VAR f: File; name: ARRAY OF CHAR;
                 bufferSize: CARDINAL; new: BOOLEAN);
PROCEDURE Close(VAR f: File);
PROCEDURE Delete(VAR f: File);
PROCEDURE SetPos(VAR f: File; pos: LONGINT);
PROCEDURE GetPos(VAR f: File; VAR pos: LONGINT);
PROCEDURE Length(VAR f: File; VAR pos: LONGINT);
PROCEDURE ReadChar(VAR f: File; VAR ch: CHAR);
PROCEDURE WriteChar(VAR f: File; ch: CHAR);
PROCEDURE ReadByteBlock(VAR f: File; VAR block: ARRAY OF BYTE);
PROCEDURE WriteByteBlock(VAR f: File; VAR block: ARRAY OF BYTE);
PROCEDURE ReadBytes(VAR f: File; adr: ADDRESS;
                    len: LONGINT; VAR actual: LONGINT);
PROCEDURE WriteBytes(VAR f: File; adr: ADDRESS;
                     len: LONGINT; VAR actual: LONGINT);

END FileSystem.
