home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 427_01 / software / multierr.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-03-23  |  2.3 KB  |  67 lines

  1. unit multierr; (* error messages for use by MULTIJOY and MINIJOY *)
  2.  
  3.  
  4. interface
  5.  
  6.  
  7. procedure error_msg (msg_nr, code : integer;
  8.                      multipath, multicfg, multiport : string);
  9. (* displays error message and halts the program *)
  10.  
  11.  
  12. implementation
  13.  
  14.  
  15. function dos_error (code : integer) : string;
  16. (* returns dos error message to specified error code *)
  17. var error : string;
  18. begin
  19.   case code of
  20.      2 : error := ('File not found');
  21.      3 : error := ('Path not found');
  22.      5 : error := ('Access denied');
  23.      6 : error := ('Invalid Handle');
  24.      8 : error := ('Not enough memory');
  25.     10 : error := ('Invalid environment');
  26.     11 : error := ('Invalid format');
  27.     18 : error := ('No more files');
  28.     else begin
  29.       str (code, error);
  30.       dos_error := 'error #' + error;
  31.     end;
  32.   end;
  33.   dos_error := error;
  34. end;
  35.  
  36.  
  37. procedure error_msg (msg_nr, code : integer;
  38.                      multipath, multicfg, multiport : string);
  39. (* displays error message and halts the program *)
  40. begin
  41.   writeln ('MULTIJOY.TPU error message: ');
  42.   case msg_nr of
  43.      1 : writeln ('Config file read error: ', dos_error (code));
  44.      2 : writeln ('Config file syntax error: undefined action code (''', chr (code), ''')');
  45.      3 : writeln ('Config file read error: unexpected end of file');
  46.      4 : writeln ('Config file found but not able to read it (', dos_error (code), ')');
  47.     12 : writeln ('Config file error: illegal joystick number (', code, ')!');
  48.      5 : writeln ('DOS environment does not contain MULTIPATH (path of config file)');
  49.      6 : writeln ('DOS environment does not contain MULTICFG  (name of config file)');
  50.      7 : writeln ('DOS environment variable MULTICFG must have no extension!');
  51.     13 : writeln ('DOS environment variable MULTIDELAY is not a number');
  52.      8 : writeln ('Invalid DOS environment variable MULTIPORT (''', chr (code), ''')');
  53.      9 : writeln ('MINIJOY does not support keyboard emulation mode!');
  54.     10 : writeln ('Config file read error: address out of range (''', code, ''')');
  55.     11 : writeln ('Printer port ',code,' not found!')
  56.     else writeln ('critical error - no appropriate error message found (error #', code, ')');
  57.   end;
  58.   writeln;
  59.   writeln ('MULTIPATH = ', multipath);
  60.   writeln ('MULTICFG  = ', multicfg );
  61.   writeln ('MULTIPORT = ', multiport);
  62.   halt;
  63. end;
  64.  
  65.  
  66. begin
  67. end.