home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / appwiz / logowiz / debug.h < prev    next >
C/C++ Source or Header  |  1998-03-05  |  2KB  |  58 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Diagnostic support
  3. //
  4. // This is a part of the Microsoft Foundation Classes C++ library.
  5. // Copyright (C) 1995 Microsoft Corporation
  6. // All rights reserved.
  7. //
  8. // This source code is only intended as a supplement to the
  9. // Microsoft Foundation Classes Reference and related
  10. // electronic documentation provided with the library.
  11. // See these sources for detailed information regarding the
  12. // Microsoft Foundation Classes product.
  13.  
  14. #ifdef _PSEUDO_DEBUG
  15.  
  16. #undef TRACE
  17. #undef VERIFY
  18. #undef ASSERT
  19. #undef THIS_FILE
  20. #undef TRACE0
  21. #undef TRACE1
  22. #undef TRACE2
  23. #undef TRACE3
  24.  
  25.  
  26. // Note: file names are still ANSI strings (filenames rarely need UNICODE)
  27. BOOL AssertFailedLine(LPCSTR lpszFileName, int nLine);
  28.  
  29. void Trace(LPCTSTR lpszFormat, ...);
  30.  
  31. // by default, debug break is asm int 3, or a call to DebugBreak, or nothing
  32. #if defined(_M_IX86)
  33. #define CustomDebugBreak() _asm { int 3 }
  34. #else
  35. #define CustomDebugBreak() DebugBreak()
  36. #endif
  37.  
  38. #define TRACE              ::Trace
  39. #define THIS_FILE          __FILE__
  40. #define ASSERT(f) \
  41.     do \
  42.     { \
  43.     if (!(f) && AssertFailedLine(THIS_FILE, __LINE__)) \
  44.         CustomDebugBreak(); \
  45.     } while (0) \
  46.  
  47. #define VERIFY(f)          ASSERT(f)
  48.  
  49. // The following trace macros are provided for backward compatiblity
  50. //  (they also take a fixed number of parameters which provides
  51. //   some amount of extra error checking)
  52. #define TRACE0(sz)              ::Trace(_T(sz))
  53. #define TRACE1(sz, p1)          ::Trace(_T(sz), p1)
  54. #define TRACE2(sz, p1, p2)      ::Trace(_T(sz), p1, p2)
  55. #define TRACE3(sz, p1, p2, p3)  ::Trace(_T(sz), p1, p2, p3)
  56.  
  57. #endif // !_PSEUDO_DEBUG
  58.