DEFINITION GEMDOS; (* SJ *)

(* All parameters have the opposite order than the c bindings. This is
   necessary becauses the compiler pushes the first parameter first onto
   the stack whereas a c compiler pushes the last parameter first.
   Using a procedure defined here will not produce a subroutine call but
   a trap call.
*)

IMPORT SYSTEM;

CONST (* modi for Fopen *)
   read* = 0; write* = 1; readwrite* = 2;

   (* file attributes *)
   readonly* = 0; hidden* = 1; system* = 2; label* = 3; subdir* = 4; archiv* = 5;

   (* modi for Fseek *)
   absbeg* = 0; rel* = 1; absend* = 2;

   (* modi for Fattrib and Fdatime *)
   get* = 0; set* = 1;

TYPE
   dtarec*    = RECORD
                  SearchStr*   : ARRAY 12 OF CHAR;
                  Reserved     : ARRAY 8 OF CHAR;
                  Attribut*    : INTEGER;
                  Time*,Date*  : INTEGER;
                  Length*      : LONGINT;
                  Name*        : ARRAY 14 OF CHAR;
                END(*RECORD*);
   dta*       = POINTER TO dtarec;
   dfreedesc* = RECORD
                  FreeClus*    : INTEGER;
                  NumClus*     : INTEGER;
                  BytesPClus*  : INTEGER;
                  SecPClus*    : INTEGER;
                END(*RECORD*);
   dfree*     = POINTER TO dfreedesc;


PROCEDURE Pterm0*();

PROCEDURE Cconin*() : LONGINT;

PROCEDURE Cconout*(c : INTEGER);

PROCEDURE Cauxin*() : LONGINT;

PROCEDURE Cauxout*(c : INTEGER);

PROCEDURE Cprnout*(c : INTEGER);

PROCEDURE Crawio*(c : INTEGER) : LONGINT;

PROCEDURE Crawcin*() : LONGINT;

PROCEDURE Cconws*(StrPtr : SYSTEM.PTR);

PROCEDURE Cconrs*(StrPtr : SYSTEM.PTR);

PROCEDURE Cconis*() : INTEGER;

PROCEDURE Dsetdrv*(Drive : INTEGER) : SET;

PROCEDURE Cconos*() : INTEGER;

PROCEDURE Cprnos*() : INTEGER;

PROCEDURE Cauxis*() : INTEGER;

PROCEDURE Cauxos*() : INTEGER;

PROCEDURE Dgetdrv*() : INTEGER;

PROCEDURE Fsetdta*(Dta : dta);

PROCEDURE Super*(Stack : LONGINT) : LONGINT;

PROCEDURE Tgetdate*() : INTEGER;

PROCEDURE Tsetdate*(Date : INTEGER);

PROCEDURE Tgettime*() : INTEGER;

PROCEDURE Tsettime*(Time : INTEGER);

PROCEDURE Fgetdta*() : dta;

PROCEDURE Sversion*() : INTEGER;

PROCEDURE Ptermres*(Return : INTEGER; NumBytes : LONGINT);

PROCEDURE Dfree*(Drive : INTEGER; Dfree : dfree) : INTEGER;

PROCEDURE Dcreate*(Path : SYSTEM.PTR) : INTEGER;

PROCEDURE Ddelete*(Path : SYSTEM.PTR) : INTEGER;

PROCEDURE Dsetpath*(Path : SYSTEM.PTR) : INTEGER;

PROCEDURE Fcreate*(Attribs : INTEGER; Name : SYSTEM.PTR) : INTEGER;

PROCEDURE Fopen*(Mode : INTEGER; Name : SYSTEM.PTR) : INTEGER;

PROCEDURE Fclose*(Handle : INTEGER);

PROCEDURE Fread*(Buffer : SYSTEM.PTR; Count : LONGINT; Handle : INTEGER) : LONGINT;

PROCEDURE Fwrite*(Buffer : SYSTEM.PTR; Count : LONGINT; Handle : INTEGER) : LONGINT;

PROCEDURE Fdelete*(Name : SYSTEM.PTR) : INTEGER;

PROCEDURE Fseek*(Mode,Handle : INTEGER; NumBytes : LONGINT) : LONGINT;

PROCEDURE Fattrib*(Attribs,Mode : INTEGER; Name : SYSTEM.PTR) : INTEGER;

PROCEDURE Fdup*(StdHandle : INTEGER) : INTEGER;

PROCEDURE Fforce*(NStdHandle,StdHandle : INTEGER) : INTEGER;

PROCEDURE Dgetpath*(Drive : INTEGER; Path : SYSTEM.PTR) : INTEGER;

PROCEDURE Malloc*(Bytes : LONGINT) : SYSTEM.PTR;

PROCEDURE Mfree*(Adr : SYSTEM.PTR) : INTEGER;

PROCEDURE Mshrink*(Size : LONGINT; Adr : SYSTEM.PTR; Rsv : INTEGER) : INTEGER;

PROCEDURE Pexec*(Env,Command,Name : SYSTEM.PTR; Mode : INTEGER) : LONGINT;

PROCEDURE Pterm*(Return : INTEGER);

PROCEDURE Fsfirst*(Attribs : INTEGER; Name : SYSTEM.PTR) : INTEGER;

PROCEDURE Fsnext*() : INTEGER;

PROCEDURE Frename*(New,Old : SYSTEM.PTR; Rsv : INTEGER) : INTEGER;

PROCEDURE Fdatime*(Mode,Handle : INTEGER; Buffer : SYSTEM.PTR);

END GEMDOS.
