home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / pascal / shdk_1.zip / TESTERR.PAS < prev    next >
Pascal/Delphi Source File  |  1992-03-23  |  2KB  |  87 lines

  1. program TestErr;
  2. {
  3.                        To test the ShErrMsg unit
  4.  
  5.                   Copyright 1991 Madison & Associates
  6.                           All Rights Reserved
  7.  
  8.          This program source file and the associated executable
  9.          file may be  used and distributed  only in  accordance
  10.          with the  provisions  described  on  the title page of
  11.                   the accompanying documentation file
  12.                               SKYHAWK.DOC
  13. }
  14.  
  15. uses 
  16.   ShErrMsg;
  17.  
  18. const
  19.   T2  : byte = 0;
  20.  
  21. var
  22.   T1  : integer;
  23.   R1  : real;
  24.   C1  : char;
  25.   S1  : string;
  26.   F   : text;
  27.  
  28. begin
  29.   FillChar(F, SizeOf(F), 0);
  30.   Write('Checking on? [Y/N] » '); ReadLn(C1);
  31.   if UpCase(C1) = 'Y' then CheckOn else CheckOff;
  32.   WriteLn;
  33.   WriteLn('Error options:');
  34.   WriteLn('1.   File not found');
  35.   WriteLn('2.   File not assigned');
  36.   WriteLn('3.   Drive not ready');
  37.   WriteLn('4.   Division by zero');
  38.   WriteLn('5.   Invalid floating point operation');
  39.   WriteLn('6.   User defined runtime error');
  40.   WriteLn('7.   Halt');
  41.   WriteLn('8.   User defined runtime error, no message');
  42.   WriteLn('9.   Halt, no message');
  43.   WriteLn;
  44.   Write('Option number: » '); ReadLn(T2);
  45.   case T2 of
  46.     1 : begin
  47.           Assign(F, 'FOO.BAZ');
  48.           Reset(F);
  49.           end;
  50.     2 : begin
  51.           Reset(F);
  52.           end;
  53.     3 : begin
  54.           WriteLn('Check that the A drive is empty and the latch open.');
  55.           Write('<CR> when ready.. '); ReadLn;
  56.           Assign(F, 'A:\FOO.BAZ');
  57.           Reset(F);
  58.           end;
  59.     4 : begin
  60.           R1 := 0.0;
  61.           R1 := 1.0 / R1;
  62.           end;
  63.     5 : begin
  64.           R1 := 1234567.89E27;
  65.           T1 := trunc(R1);
  66.           end;
  67.     6 : begin
  68.           Write('Error code » '); ReadLn(T1);
  69.           Write('Message » '); ReadLn(S1);
  70.           RunErrorMsg(T1, S1);
  71.           end;
  72.     7 : begin
  73.           Write('Error code » '); ReadLn(T1);
  74.           Write('Message » '); ReadLn(S1);
  75.           HaltMsg(T1, S1);
  76.           end;
  77.     8 : begin
  78.           Write('Error code » '); ReadLn(T1);
  79.           RunError(T1);
  80.           end;
  81.     9 : begin
  82.           Write('Error code » '); ReadLn(T1);
  83.           Halt(T1);
  84.           end;
  85.     end; {case}
  86.   end.
  87.