(************************************************************************
*                                                                       *
*                  D E F I N I T I O N   M O D U L                      *
*                                                                       *
*    Projekt     :   Modula Einpass Compiler (m1pc)                     *
*    Hauptmodul  :                                                      *
*    Modul       :   FileSystem                                         *
*    Beginn      :   15.02.87                                           *
*                                                                       *
*    Bearbeitung                                                        *
*    Freigegeben     <----                                              *
*                                                                       *
************************************************************************)



DEFINITION MODULE FileSystem;  (* W. Heiz, 19-Dec-85 / 4-Feb-86 *)

  FROM SYSTEM   IMPORT  WORD;
 
  TYPE
   
    Response = (done, notdone);

    File     = RECORD
                 refNum,
                 volRef:     INTEGER;
                 firstPos,
                 lastPos,
                 curPos:     LONGINT;
                 res:        Response;
                 eof:        BOOLEAN;
                 dirty:      BOOLEAN;
                 nameString: ARRAY [0..31] OF CHAR;
                 buffer:     ARRAY [0..1024-1] OF CHAR;
                 fdesc:      INTEGER;
                 blocknr:    LONGINT;
                 lim:        INTEGER;
                 index:      INTEGER;
                 length:     LONGINT;
                 errorno:    INTEGER;
               END;

  PROCEDURE Lookup    (VAR f: File; VAR filename: ARRAY OF CHAR; new: BOOLEAN); 
  (*  Lookup loescht ein bereits vorhandenes file, wenn new = TRUE ist  *)

  PROCEDURE Close     (VAR f: File);
  PROCEDURE Delete    (VAR f: File);
  PROCEDURE Rename    (VAR f: File; VAR filename: ARRAY OF CHAR);
  PROCEDURE SetPos    (VAR f: File; pos: LONGINT);
  PROCEDURE GetPos    (VAR f: File; VAR pos: LONGINT);    (* 0..x-1 *)
  PROCEDURE Length    (VAR f: File; VAR pos: LONGINT);    (* 1..x   *)
  PROCEDURE ReadWord  (VAR f: File; VAR w: WORD);
  PROCEDURE WriteWord (VAR f: File; w: WORD);
  PROCEDURE ReadChar  (VAR f: File; VAR ch: CHAR);
  PROCEDURE WriteChar (VAR f: File; ch: CHAR);

END FileSystem.
