home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 038 / pmd110.zip / ASSERTIO.PAS next >
Pascal/Delphi Source File  |  1994-11-14  |  1KB  |  38 lines

  1. (* This file was mangled by Mangler 1.35 (c) Copyright 1993-1994 by Berend de Boer *)
  2. { Created : 1994-02-26  (c) Copyright 1994 by Berend de Boer
  3.  
  4. Assertions for Pascal. Use a compiler directive like DEBUG to enable or
  5. disable portions of your code.
  6.  
  7.  
  8. Install the Post Mortem Debugger to be able to fully use it.
  9.  
  10. Last changes :
  11. 94-09-21  Changed Assert so that it does not call PrintError anymore, but
  12.           only writes a message and stacktrace to the log file and terminates
  13.           the program.
  14. }
  15.  
  16.  
  17.  
  18. {$IFDEF MsDos}
  19. {$F+,O+}
  20. {$ENDIF}
  21.  
  22. {$S-,R-,Q-}
  23. unit Assertions;
  24.  
  25. interface
  26.  
  27.  
  28.  
  29. procedure Assert(Success : Boolean; const Msg : string);
  30. procedure Warning(Success : Boolean; const Msg : string);
  31.  
  32.  
  33.  
  34.  IMPLEMENTATION USES BBERROR , BBGUI ;PROCEDURE ASSERT (SUCCESS:BOOLEAN;CONST MSG:STRING );VAR O100llIl00IOl:WORD;
  35. BEGIN ASM {} MOV O100llIl00IOl, BP {} END;IF NOT SUCCESS THEN BEGIN LOGERROR ('Assertion failed: '#39+ MSG + #39'.');
  36. DUMPSTACK (NIL , O100llIl00IOl );HALT (1 );END ;END ;PROCEDURE WARNING (SUCCESS:BOOLEAN;CONST MSG:STRING );BEGIN IF NOT
  37. SUCCESS THEN PRINTERROR ('Warning failed: '#39+ MSG + #39'.', 0 );END ;END .
  38.