--- a/FileSystem.def.m2cc
+++ b/FileSystem.def.m2cc
@@ -194,6 +194,10 @@
(* O_WRONLY, O_RDWR etc. verwandt werden, wenn vor dem Aufruf der *)
(* C-Routine open(...) OpenMode um 1 Bit nach rechts verschoben *)
(* wird. *)
+ (* In the form given above the SET OpenMode with it approprialy *)
+ (* set flags can be used like the "C" constans O_WRONLY, O_RDWR *)
+ (* for a call to "C"-touine open(...) if Openmode is shifted by *)
+ (* one byte to the right. *)
CONST OpenReadOnly = OpenMode{openRDONLY};
OpenWriteOnly = OpenMode{openWRONLY};
@@ -241,6 +245,11 @@
(* auf der Konsole protokoliert. Die Variable Fehler und *)
(* Fehlerflag werden aber in jedem Fall entsprechende gesetzt, *)
(* so da3 der Benutzer einen Fehler selbst abfangen kann. *)
+ (* *)
+ (* If CheckIO is set to false error messages are no more written *)
+ (* to the standard error channel. But in most cases the variables *)
+ (* Fehler and Fehlerflag (module Errors) are still set so that *)
+ (* a potential error can be captured. *)
(*----------------------------------------------------------------*)
PROCEDURE Lookup(VAR f : File;
@@ -292,6 +301,45 @@
(* den Support fuer Dateien groesser (2**31-1) zu *)
(* aktivieren, das funktioniert nur wenn dieser *)
(* vom Dateisystem unterstuetzt wird. *)
+ (* *)
+ (* Open or create a file *)
+ (* *)
+ (* Example of calls: *)
+ (* *)
+ (* Lookup(f,"dat",TRUE ,OpenMode{openWRONLY}); *)
+ (* Lookup(f,"dat",FALSE,OpenMode{openWRONLY,openAPPEND}); *)
+ (* Lookup(f,"dat",FALSE,OpenMode{openWRONLY,openTRUNC}); *)
+ (* *)
+ (* f : after the call the channel number of the opened *)
+ (* file, -1 in case of an error *)
+ (* DName : file name of the file to be opened *)
+ (* creat : *)
+ (* TRUE *)
+ (* File will be creat if not present. *)
+ (* In case the file is already presen it will be *)
+ (* erased and recreated with openCREAT and all *)
+ (* requested open directifes (take care) *)
+ (* If the actual access right of a file does not *)
+ (* permit the operation, f is set to -1 and *)
+ (* Errros.Fehlerflag will be set appropriate *)
+ (* The new file will be created with access riths *)
+ (* defaultAccess. If that is not wanted they have to *)
+ (* be changed immediately by a call to ChMod *)
+ (* FALSE *)
+ (* the file, if present, will be opende with the *)
+ (* options requested in OpenMask *)
+ (* Optionen ge"offnet, falls vorhanden. *)
+ (* If the file is not present or access rights do - *)
+ (* not permit an approprite open of the file f will *)
+ (* set to -1 and Errors.Fehlerflag will be set *)
+ (* accordingly *)
+ (* OpenMask : With parameter OpenMask the way the file is opened *)
+ (* is controlle. Potential flags for OpenMask can be *)
+ (* (openTRUNC,openAPPEND,openRDWR, etc.) *)
+ (* If openLARGEFILE in OpenMask the routine tries *)
+ (* to activate the support for filess greater then *)
+ (* (2**31-1). This will only work if it is supported *)
+ (* by the underlaying file system *)
(*----------------------------------------------------------------*)
PROCEDURE OpenLargeFile(VAR f : File;
@@ -310,6 +358,8 @@
(*----------------------------------------------------------------*)
(* Ermittelt ob zu Kanalnummer f eine Datei geoeffnet wurde. *)
+ (* *)
+ (* Checks if for channel number f a file had been opened *)
(*----------------------------------------------------------------*)
PROCEDURE GetFileName( f : File; (* Kanalnummer *)
@@ -320,6 +370,9 @@
(* Die Datei mu3 dabei mit FileSystem.Lookup ge"offnet *)
(* worden sein. L"a3t sich der Dateiname nicht ermitteln, *)
(* wird 0C in Name[0] zur"uckgegeben. *)
+ (* *)
+ (* Get the filename "Name" of the open file "f". If the routine *)
+ (* is unable to get the name 0C is returned. *)
(*----------------------------------------------------------------*)
PROCEDURE ReWrite(VAR f : File);
@@ -329,6 +382,11 @@
(* verloren geht. f mu3 einer ge"offneten Datei zugeordnet *)
(* sein. Im Fehlerfall wird f auf -1 gesetzt. *)
(* Die Datei wird mit der Option oRDWR neu ge"offnet. *)
+ (* *)
+ (* Reset the file f. The current content of f is lost. f must *)
+ (* be an opened file. In case of an erroe f is set to -1, *)
+ (* otherwise the file had been truncted and is now open with *)
+ (* mode oRDWR *)
(*----------------------------------------------------------------*)
PROCEDURE Exists(DName : ARRAY OF CHAR) : BOOLEAN;
@@ -336,6 +394,9 @@
(*----------------------------------------------------------------*)
(* Test, ob eine Datei mit Namen DName im aktuellen *)
(* Arbeitsverzeichniss vorhanden ist. *)
+ (* *)
+ (* Check if a file with name "DName" exits in the actual *)
+ (* directory *)
(*----------------------------------------------------------------*)
PROCEDURE Close(VAR f : File);
@@ -344,12 +405,17 @@
(* Schlie3t die Datei f. Dabei mu3 f einer ge"offnet Datei *)
(* zugeordnet sein. Im Fehlerfall wird f auf -1 gesetzt, *)
(* ansonsten ist f = 0. *)
+ (* *)
+ (* Close opened file f. In case of an error f is set to -1, *)
+ (* otherwise f is 0 after the call. *)
(*----------------------------------------------------------------*)
PROCEDURE CloseAll();
(*----------------------------------------------------------------*)
(* Schlie\3t alle offenen Dateien, privat f"ur das Projekt. *)
+ (* *)
+ (* Closes all open files, privat for the Projekt. *)
(*----------------------------------------------------------------*)
PROCEDURE Delete( Name : ARRAY OF CHAR;
@@ -359,6 +425,10 @@
(* L"oscht die Datei Name aus dem Dateiverzeichnis. *)
(* Die Datei f mu3 dabei geo2ffnet und auf Name verweisen. *)
(* Im Fehlerfalle wird f auf -1 gesetzt. *)
+ (* *)
+ (* Deletes the file with name "Name". The file f must be opened *)
+ (* and pointing to the file with name "Name". In case of an error *)
+ (* f is set to -1 *)
(*----------------------------------------------------------------*)
PROCEDURE Length( f : File;
@@ -368,6 +438,10 @@
(* Ermittelt die L"ange der mit f verbundenen, ge"offneten *)
(* Datei in Bytes. Im Fehlerfalle werden nur Fehler und *)
(* Fehlerflag gesetzt und Len auf MAX(LONGCARD). *)
+ (* *)
+ (* Get the length file f where f needs to be assigned to an open *)
+ (* file. In case of an error Fehler and Fehlerfalg (module *)
+ (* Errors) are set and Len is set to MAX(LONGCARD) *)
(*----------------------------------------------------------------*)
PROCEDURE GetPos( f : File;
@@ -376,6 +450,9 @@
(*----------------------------------------------------------------*)
(* Ermittelt die aktuelle Dateiposition in der ge"offneten *)
(* Datei f. Im Fehlerfall wird Pos auf MAX(LONGCARD) gesetzt. *)
+ (* *)
+ (* Get the current file position of file f and return the value *)
+ (* in "Pos". If case of an error Pos is set to MAX(LONGCARD). *)
(*----------------------------------------------------------------*)
PROCEDURE SetPos(VAR f : File;
@@ -384,14 +461,18 @@
(*----------------------------------------------------------------*)
(* Setzt die Dateiposition der ge"offneten Datei f. *)
(* Im Fehlerfall werden nur Fehler und Fehlerflag gesetzt. *)
+ (* *)
+ (* Sets the file position of file f to "Pos". If case of an error *)
+ (* Fehler and Fehlerfalg (module Errors) are set. *)
(*----------------------------------------------------------------*)
PROCEDURE Rewind(VAR f : File);
- (*---------------------------------------------------------------*)
- (* Zurueckstellen des Dateizeiger auf Position 0. *)
- (* Set the position of (large) file f to position zero. *)
- (*---------------------------------------------------------------*)
+ (*----------------------------------------------------------------*)
+ (* Zurueckstellen des Dateizeiger auf Position 0. *)
+ (* *)
+ (* Set the position of (large) file f to position zero. *)
+ (*----------------------------------------------------------------*)
PROCEDURE ReadNBytes( f : File;
VAR Ziel : ARRAY OF BYTE;
@@ -403,6 +484,12 @@
(* m"oglich, so wird m auf 0 gesetzt. Ist m # 0, m < n, so *)
(* ist das Dateiende erreicht. Ansonsten ist nach verlassen *)
(* der Routine m = n. *)
+ (* *)
+ (* Reads n bytes form file f into buffer "Ziel". If reading is *)
+ (* not possible m will be set to 0. m generally indicates the *)
+ (* amount of bytes read, if m # 0 and m < n after a call the end *)
+ (* of file f is most probably reached. In normal cases m = n *)
+ (* should hold after the call to this procedure *)
(*----------------------------------------------------------------*)
PROCEDURE WriteNBytes( f : File;
@@ -415,6 +502,12 @@
(* nicht m"oglich, so wird m auf 0 gesetzt. Ist m # 0, m < n, so *)
(* wahrscheinlich das Medium, auf das geschrieben werden soll, *)
(* voll. Ansonsten ist nach verlassen der Routine m = n. *)
+ (* *)
+ (* Write n bytes from "Quelle" out to file f. If writing is not *)
+ (* possible m will be set to 0. m generally indicates the amount *)
+ (* of bytes written, if m # 0 and m < n after a call the device *)
+ (* the file f is on is most probably full. In normal cases m = n *)
+ (* should hold after the call to this procedure *)
(*----------------------------------------------------------------*)
PROCEDURE RdBinObj( Ein : File;
@@ -429,6 +522,13 @@
(* ifehl = 0 : Alles in Ordnung *)
(* ifehl = 1 : Ein Lesefehler ist aufgetreten *)
(* ifehl = 2 : A ist zu klein um n Elemente aufnehemn zu k"onnen *)
+ (* *)
+ (* Binary read of object A with size N bytes frim file "Aus". *)
+ (* The routine is working block-oriented *)
+ (* *)
+ (* ifehl = 0 : all fine *)
+ (* ifehl = 1 : a read error occured *)
+ (* ifehl = 2 : A is smaller than N bytes *)
(*----------------------------------------------------------------*)
PROCEDURE WrBinObj( Aus : File;
@@ -441,8 +541,15 @@
(* Die Routine arbeitet blockorientiert. *)
(* *)
(* ifehl = 0 : Alles in Ordnung *)
- (* ifehl = 1 : Ein Lesefehler ist aufgetreten *)
+ (* ifehl = 1 : Ein Schreibfehler ist aufgetreten *)
(* ifehl = 2 : A ist zu klein um n Elemente aufnehemn zu k"onnen *)
+ (* *)
+ (* Binary write of object A with size N bytes to file "Aus". *)
+ (* The routine is working block-oriented *)
+ (* *)
+ (* ifehl = 0 : all fine *)
+ (* ifehl = 1 : a write error occured *)
+ (* ifehl = 2 : A is smaller than N bytes *)
(*----------------------------------------------------------------*)
(*============== Unix - spezifische Routinen. ==============*)
@@ -456,6 +563,11 @@
(* ge"offneten Datei zugeordnet sein. Ist dies nicht der Fall, *)
(* wird f auf -1 gesetzt. Bei sonstigen Fehlern wird nur Fehler *)
(* und Fehlerflag gesetzt. *)
+ (* *)
+ (* Sets the acces rights for file f. For that f must be assigend *)
+ (* to a open file. If that's not the case f is set to -1. If case *)
+ (* of other failures Fehler and Fehlerflag (module Errors) are *)
+ (* set. *)
(*----------------------------------------------------------------*)
PROCEDURE Lock(VAR f : File);
@@ -463,6 +575,8 @@
(*----------------------------------------------------------------*)
(* Verh"angt eine Schreibsperre f"ur den offenen *)
(* Ausgabekanal f gegen"uber anderen Prozessen. *)
+ (* *)
+ (* Locks the file f from access by other processes *)
(*----------------------------------------------------------------*)
PROCEDURE UnLock(VAR f : File);
@@ -470,12 +584,16 @@
(*----------------------------------------------------------------*)
(* Hebt die Schreibsperre des offenen Ausgabekanals f *)
(* gegen"uber anderen Prozessen auf. *)
+ (* *)
+ (* Removes a lock on file f *)
(*----------------------------------------------------------------*)
PROCEDURE Sync();
(*----------------------------------------------------------------*)
(* Syncronisation des Dateisystms. *)
+ (* *)
+ (* sync of the file system *)
(*----------------------------------------------------------------*)
END FileSystem.