home *** CD-ROM | disk | FTP | other *** search
/ Phoenix CD 2.0 / Phoenix_CD.cdr / 02a / pull55.zip / GOOF.PAS next >
Pascal/Delphi Source File  |  1989-08-24  |  2KB  |  68 lines

  1. { =========================================================================== }
  2. { Goof.pas - Displays fatal programming errors              ver 5.5, 08-24-89 }
  3. {                                                                             }
  4. { This file contains a convenient way to alert you of programming errors      }
  5. { since it is possible to create unseen errors with virtual and hidden        }
  6. { windows.  You can edit and recompile this unit at any time since it is      }
  7. { indirectly called.  But you MUST use it, else when CallGoof is              }
  8. { called or your machine will lock up.  So be sure to place this Unit as      }
  9. { the last unit in the MAIN program (see demos).                              }
  10. {   Copyright (C) 1987-1989 by James H. LeMay,  All rights reserved.          }
  11. { =========================================================================== }
  12.  
  13. { R-,S-,I-,D-,T-,F-,V-,B-,N-,L+ }       { TP4 directives }
  14. {$A-,B-,D-,E-,F-,I-,L-,N-,O-,R-,S-,V-}  { TP5 directives }
  15.  
  16. UNIT Goof;
  17.  
  18. INTERFACE
  19.  
  20. uses
  21.   Qwik, Wndw;
  22.  
  23. procedure ShowGoof (ErrorNum: byte);
  24.  
  25.  
  26. IMPLEMENTATION
  27.  
  28. procedure ShowGoof; { (ErrorNum: byte); }
  29. type  Str40 = string[40];
  30. var
  31.   Msg1,Msg2,MemS,MaxS: Str40;
  32. begin
  33.   Msg2 := '';
  34.   case ErrorNum of
  35.     1: begin
  36.          Msg1 := 'Not enough Heap space!';
  37.          Str (memavail,MemS);
  38.          Str (maxavail,MaxS);
  39.          Msg2 := 'Mem='+MemS+'/'+'Max='+MaxS;
  40.        end;
  41.     2: Msg1 := 'Too many Windows!';
  42.     3: Msg1 := 'Too many Virtual Windows!';
  43.     4: Msg1 := 'Perm window out of order!';
  44.     5: Msg1 := 'No window to remove!';
  45.     6: Msg1 := 'Hidden window not found!';
  46.     7: Msg1 := 'Virtual screen not found!';
  47.     8: Msg1 := 'Video page not available!';
  48.    10: Msg1 := 'A Submenu could not fit!';
  49.   end;
  50.   LI := 0;                      { Set top window level }
  51.   TopWndwStat := WndwStat[0];   { Get original CRT stat }
  52.   QScrRec := TWS.VScrRec;       { Set Qwik stats }
  53.   QwritePage (0);               { Ensure we are writing to page 0 }
  54.   QviewPage (0);                { Ensure we are viewing page 0 }
  55.   WindowModes := RelMode;
  56.   MakeWindow (0,0,5,42,LightGrayBG,LightGrayBG+Blink,
  57.               DoubleBrdr,aWindow);
  58.   WWriteC (1,Msg1);
  59.   WWriteC (2,Msg2);
  60.   WWriteC (3,'Program halted.');
  61.   SetCursor (CursorInitial);
  62.   Halt;
  63. end;
  64.  
  65. BEGIN
  66.   AddrGoof := @ShowGoof;
  67. END.
  68.