(* Version 1.10, Nov 1984 *)
DEFINITION MODULE DiskDirectory;
(*
   Interface to directory functions of the underlying OS

Derived from the Lilith Modula-2 system developed by the
group of Prof. N. Wirth at ETH Zurich, Switzerland.
*)


EXPORT QUALIFIED
    CurrentDrive, SelectDrive,
    CurrentDirectory, ChangeDirectory,
    MakeDir, RemoveDir,
    ResetDiskSys, ResetDrive;


PROCEDURE CurrentDrive (VAR drive: CHAR);
(*
- Returns the current default drive.

out:    drive   name of the default drive, given in
                character format (e.g. 'A').
*)


PROCEDURE SelectDrive (drive: CHAR; VAR done: BOOLEAN);
(*
- Set default drive.

in:     drive   name of drive to make default, specified
                in character format.

out:    done    TRUE if operation was successful.

The default drive will be used by all routines referring
to DK: .
*)


PROCEDURE CurrentDirectory (drive: CHAR;
                            VAR dir: ARRAY OF CHAR);
(*
- Gets the current directory for the specified drive. 

in:     drive   name of the drive, specified in
                character format (e.g. 'A'); blank or
                0C denotes the current drive.

out:    dir     current directory for that drive.

Under DOS 1.1, dir[0] will be set to nul (0C).
*)


PROCEDURE ChangeDirectory (dir: ARRAY OF CHAR;
                           VAR done: BOOLEAN);
(*
- Set the current directory 

in:     dir     drive and directory path name.

out:    done    TRUE if successful; FALSE if the
                directory does not exist.

Under DOS 1.1, this function has no effect and 'done'
is FALSE.
*)


PROCEDURE MakeDir (dir: ARRAY OF CHAR;
                   VAR done: BOOLEAN);
(*
- Create a sub-directory
 
in:     dir     drive, optional pathname and name of
                sub-directory to create.

out:    done    TRUE if successful; FALSE if path or
                drive does not exist.

Under DOS 1.1, this function has no effect and 'done'
is FALSE.
*)


PROCEDURE RemoveDir (dir: ARRAY OF CHAR;
                     VAR done: BOOLEAN);
(*
- Remove a directory

in:     dir     drive and name of the sub-directory
                to remove.

out:    done:   TRUE if successful; FALSE if directory
                does not exist.

The specified directory must be empty or the procedure
returns FALSE. Under DOS 1.1, this function has no effect
and 'done' is FALSE.
*)


PROCEDURE ResetDiskSys;
(*
- MS-DOS disk reset 
*)


PROCEDURE ResetDrive (d: CHAR): CARDINAL;
(*
- This function has no effect and always returns 255.
  It is part of this definition module for reasons of
  compatibility with other implementations.
*)


END DiskDirectory.

