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

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