home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / BuildingBlocks / DebugAssert.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  1.2 KB  |  55 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        DebugAssert.h
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef    __DEBUGASSERT__
  15. #define    __DEBUGASSERT__
  16.  
  17. #ifndef    __TYPES__
  18. #include "Types.h"
  19. #endif
  20.  
  21. /***********************************|****************************************/
  22.  
  23. #define    NOT_IMPLEMENTED() AssertDebug(0,"NOT IMPLEMENTED",__FILE__,__LINE__)
  24.  
  25.  
  26. #if defined ( DEBUG ) || defined ( debug )
  27.     
  28.     extern Boolean AssertDebug ( Boolean expr, const char* exprString, const char* file, unsigned long line );
  29.     
  30.     #define    ASSERT(EXPR) AssertDebug(EXPR,#EXPR,__FILE__,__LINE__)
  31.     
  32.     #define    ASSERT_RETURN(EXPR) \
  33.         if (!AssertDebug (EXPR,#EXPR,__FILE__,__LINE__)) return
  34.  
  35.     #define    ASSERT_RETURN_ZERO(EXPR) \
  36.         if (!AssertDebug (EXPR,#EXPR,__FILE__,__LINE__)) return 0
  37.         
  38.     #define    MARK(S) S << "\n\nFILE " << __FILE__ << "; LINE " << dec << __LINE__ << '\n'
  39.  
  40. #else
  41.     
  42.     #define    ASSERT(EXPR) (EXPR)                
  43.  
  44.     #define    ASSERT_RETURN(EXPR) if (!(EXPR)) return
  45.  
  46.     #define    ASSERT_RETURN_ZERO(EXPR) if (!(EXPR)) return 0
  47.  
  48.     #define    MARK(S)
  49.  
  50. #endif
  51.  
  52. /***********************************|****************************************/
  53.  
  54. #endif    // __DEBUGASSERT__
  55.