DEFINITION MODULE DirHelps;

(*            Copyright (c) 1987, 1989 - Coronado Enterprises    *)

EXPORT QUALIFIED ReadFileStats,
                 GetDiskStatistics,
                 ChangeToDirectory,
                 CopyFile,
                 FileDataPointer,
                 FileData;


TYPE FileDataPointer = POINTER TO FileData;
     FileData = RECORD
        Name  : ARRAY[0..13] OF CHAR;
        Attr  : CARDINAL;
        Time  : CARDINAL;
        Date  : CARDINAL;
        Size  : REAL;
        Left  : FileDataPointer;
        Right : FileDataPointer;
     END;



(*******************************************************************)
PROCEDURE ReadFileStats(FileName      : ARRAY OF CHAR;
                        FirstFile     : BOOLEAN;
                        VAR FilePt    : FileDataPointer;
                        VAR FileError : BOOLEAN);

(* This procedure is used to read the DOS data concerning a file.  *)
(* It returns a pointer to the FileData structure containing all   *)
(* of the file data.  FirstFile is set to TRUE for the first file  *)
(* and to FALSE for the remaining files in the list.  FileError    *)
(* returns TRUE if the read was successful and FALSE if it was not *)
(* with a FALSE also indicating the end of the files in this dir-  *)
(* ectory.                                                         *)



(*******************************************************************)
PROCEDURE GetDiskStatistics(Drive                 : CHAR;
                            VAR SectorsPerCluster : CARDINAL;
                            VAR FreeClusters      : CARDINAL;
                            VAR BytesPerSector    : CARDINAL;
                            VAR TotalClusters     : CARDINAL);

(* This procedure gets the disk statistics on the selected drive.  *)



(*******************************************************************)
PROCEDURE ChangeToDirectory(Directory : ARRAY OF CHAR;
                            CreateIt : BOOLEAN;
                            VAR ErrorReturn : BOOLEAN);

(* C:\DIR1\DIR2\DIR3\<000>   Example of usage                      *)
(* This procedure is used to change to a directory on the selected *)
(* drive included in the CHAR array. The directory is a complete   *)
(* path and if the CreatIt flag is TRUE, the directory will be     *)
(* created, otherwise an error return will be generated as follows.*)
(* ErrorReturn = 0  Directory created as desired.                  *)
(* ErrorReturn = 1  Directory doesn't exist and CreateIt = FALSE.  *)
(* ErrorReturn = 2  Not enough disk room to create Directory.      *)



(*******************************************************************)
PROCEDURE CopyFile(SourceFile       : ARRAY OF CHAR;
                   DestinationFile  : ARRAY OF CHAR;
                   FileSize         : REAL;
                   VAR ResultOfCopy : CARDINAL);

(* C:FILENAME.EXT<000>   Example of usage                          *)
(* This procedure copies a file from SourceDrive:SourceFile to     *)
(* DestinationDrive:DestinationFile and returns a ResultOfCopy     *)
(* indicator to signal the result of the copy.  It assumes that    *)
(* the proper subdirectory has been selected prior to a call to    *)
(* this routine.  If a file cannot be opened, it is not copied.    *)

(* ResultOfCopy = 0  Good copy made.                               *)
(* ResultOfCopy = 1  Cannot open source file.                      *)
(* ResultOfCopy = 2  Cannot open destination file.                 *)
(* ResultOfCopy = 3  Not enough room on the disk.                  *)


END DirHelps.
