home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1992-06-22 | 3.2 KB | 76 lines |
- (* DOSdisk DOS interupt procedures 1992 Chris Harshman
- This module provides DOS disk handling procedures not provided in
- FileSystem, such as setting or getting the current drive or directory. *)
-
- DEFINITION MODULE DOSdisk;
-
- PROCEDURE SetDrive(drive:CHAR);
- (* Given the letter of the drive, will set that drive to be the current
- disk drive for file handling. Can use upper or lowwer case letter. *)
-
- PROCEDURE GetDrive(VAR drive:CHAR);
- (* Will return the letter of the current disk drive, in upper case. *)
-
- (* Even though in the following procedures, directory is not defined as a
- VAR parameter, I recomend using an array of size one more than the name
- you will be passing. For example, if you wanted to specify '/DOS'
- use a variable defined as ARRAY [0..4] OF CHAR at least. This will
- automatically handle DOS's expectation of the name ending in a CHR(0). *)
-
- PROCEDURE Mkdir(directory:ARRAY OF CHAR; VAR error:CARDINAL);
- (* Will create the specified directory, and return the errorcode, if any.
- Errorcodes are standard DOS interupt errorcodes and are listed later. *)
-
- PROCEDURE Chdir(directory:ARRAY OF CHAR; VAR error:CARDINAL);
- (* Will set the specified directory to become the current directory.
- Returns the errorcode of any. *)
-
- PROCEDURE Rmdir(directory:ARRAY OF CHAR; VAR error:CARDINAL);
- (* Will remove the specified directory from disk, as long as it is not the
- current directory and it contains no files or subdirectories. *)
-
- PROCEDURE GetDir(VAR directory:ARRAY OF CHAR);
- (* Will return the current directory path. *)
-
- PROCEDURE Delete(file:ARRAY OF CHAR; VAR error:CARDINAL);
- (* Will delete the file specified. The file name must have no wildcards.
- Error will return the DOS errorcode, or 0 if no error. *)
-
- PROCEDURE FindFirst(name:ARRAY OF CHAR; attr:CARDINAL; VAR error:CARDINAL);
- (* Will search for the first file found as specified by the name, if any
- are found error will hold 0. Else, error will hold the DOS errorcode. *)
-
- PROCEDURE FindNext(VAR error:CARDINAL);
- (* Will search for the next file, if any left error will hold 0. Else,
- error holds the DOS errorcode. *)
-
- PROCEDURE FindAttr(VAR attr:CARDINAL);
- (* Will return the attribute of the currently found file. *)
-
- PROCEDURE FindTime(VAR hour,min,sec:CARDINAL);
- (* Will return the time of the currently found file. *)
-
- PROCEDURE FindDate(VAR month,day,year:CARDINAL);
- (* Will return the date of the currently found file. *)
-
- PROCEDURE FindLength(VAR len:LONGCARD);
- (* Will return the length of the currently found file. *)
-
- PROCEDURE FindName(VAR name:ARRAY OF CHAR);
- (* Will return the name of the currently found file. *)
-
- END DOSdisk.
- (* this is a list of DOS errorcodes
- 0 no error
- 1 invalid function
- 2 file not found
- 3 path not found
- 4 too many open files
- 5 access denied (general error)
- 6 invalid handle
- 15 invalid drive
- 16 can't remove current directory
- 18 no more files
- other codes 7 to 13 and 17 do exist but are not relevant for these
- procedures. *)