home *** CD-ROM | disk | FTP | other *** search
- {
- *******************************************************
-
- Turbo Pascal Version 5.5
- IO Error Messages
-
- Copyright (c) 1993 Mark Baker
- *******************************************************
- }
-
- unit IOError;
-
- interface
-
- const
-
- Success = 0;
- DOS_Error = 1;
- IO_Error = 2;
- Critical_Error = 3;
- Unknown_Error = 255;
-
- File_not_found = 2;
- Path_not_found = 3;
- Too_many_open_files = 4;
- File_access_denied = 5;
- Invalid_file_handle = 6;
- Invalid_file_access_code = 12;
- Invalid_drive_number = 15;
- Cannot_remove_current_directory = 16;
- Cannot_rename_across_drives = 17;
- Disc_read_error = 100;
- Disc_write_error = 101;
- File_not_assigned = 102;
- File_not_open = 103;
- File_not_open_for_input = 104;
- File_not_open_for_output = 105;
- Invalid_numeric_format = 106;
- Disc_is_write_protected = 150;
- Unknown_unit = 151;
- Drive_not_ready = 152;
- Unknown_command = 153;
- CRC_error_in_data = 154;
- Bad_drive_request_structure_length = 155;
- Disc_seek_error = 156;
- Unknown_media_type = 157;
- Sector_not_found = 158;
- Printer_out_of_paper = 159;
- Device_write_fault = 160;
- Device_read_fault = 161;
- Hardware_failure = 162;
-
-
- procedure IOError_Message
- (Error_Code : byte; var Error_Message : string;
- var Error_Type : byte);
-
-
- implementation
-
- const
-
- DOS_Errors : array[2..17] of string[34] =
- ('File not found',
- 'Path not found',
- 'Too many open files',
- 'File access denied',
- 'Invalid file handle',
- '','','','','',
- 'Invalid file access code',
- '','',
- 'Invalid drive number',
- 'Cannot remove current directory',
- 'Cannot rename across drives');
- IO_Errors : array[100..106] of string[34] =
- ('Disc read error',
- 'Disc write error',
- 'File not assigned',
- 'File not open',
- 'File not open for input',
- 'File not open for output',
- 'Invalid numeric format');
- Critical_Errors : array[150..162] of string[34] =
- ('Disc is write-protected',
- 'Unknown unit',
- 'Drive not ready',
- 'Unknown command',
- 'CRC error in data',
- 'Bad drive request structure length',
- 'Disc seek error',
- 'Unknown media type',
- 'Sector not found',
- 'Printer out of paper',
- 'Device write fault',
- 'Device read fault',
- 'Hardware failure');
- Unknown_Error_Message = 'Unknown Error';
-
-
- procedure IOError_Message
- (Error_Code : byte; var Error_Message : string;
- var Error_Type : byte);
- begin
- case Error_Code of
- 0 : begin
- Error_Type:=Success;
- Error_Message:='';
- end;
- 2..6,
- 12,
- 15..17 : begin
- Error_Type:=DOS_Error;
- Error_Message:=DOS_Errors[Error_Code];
- end;
- 100..106 : begin
- Error_Type:=IO_Error;
- Error_Message:=IO_Errors[Error_Code];
- end;
- 150..162 : begin
- Error_Type:=Critical_Error;
- Error_Message:=Critical_Errors[Error_Code];
- end;
- else begin
- Error_Type:=Unknown_Error;
- Error_Message:=Unknown_Error_Message;
- end;
- end;
- end; { IOError_Message }
-
- end.