home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 February / macformat-047.iso / Shareware Plus / Developers / DLOGManager 1.02 / Source Code / assert_v451.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-14  |  1.2 KB  |  36 lines  |  [TEXT/KAHL]

  1. /*** File: ASSERT - V4.51
  2.  *
  3.  *    Define the new Assert library functions.
  4.  *
  5.  *    21/08/1996        minutes canges. (v451)
  6.  *                    Makes the assert file once incluseable.
  7.  *                    Now assert_warning, _assert_error, checkCondition
  8.  *                    use only two parameter (assert_warning .eq. assure)
  9.  *                        messageError = "%s%s%s%s" or "%s%s%s<message string>".
  10.  *    24/02/1996        1st version (v45)
  11.  *                    Now _error display the error with a dialog if
  12.  *                        _error("%p%p%p%p", "\p", "\p", "\p", "\p");
  13.  *                    New _checkCondition function.
  14.  ***/
  15. #ifndef __ASSERT__
  16. #define __ASSERT__
  17. #include <assert.h>                                                //    Include the standard assert
  18. #include <Types.h>
  19. extern void _error(Boolean forceQuit, char * message, ... );    //    Print a message and abort
  20.                                                                 //    if abort is true
  21.  
  22. #define assure(expr,message)             \
  23.     if    (expr) ;                        \
  24.     else _error(true, message)
  25.  
  26. #define assert_error(expr, message, err0, err1, err2, err3)     \
  27.     if    (expr) ;                        \
  28.         else _error(true, message, err0, err1, err2, err3)
  29.  
  30. #define assert_warning(expr, message, err0, err1, err2, err3)     \
  31.     if    (expr) ;                        \
  32.         else _error(false, message, err0, err1, err2, err3)    
  33.  
  34. #define checkCondition(expr, message, err0, err1, err2, err3)    \
  35.         assert_error(expr, message, err0, err1, err2, err3)
  36. #endif