Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.5 KiB

  1. #ifndef DEBUG_H
  2. #define DEBUG_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <windows.h>
  7. //
  8. // Macros for debugging support.
  9. //
  10. // ASSERT(exp) Popup a dialogbox, if exp is FALSE
  11. // ASSERTMSG(exp, msg) Similar to ASSERT. Except the msg is displayed instead of the expression
  12. //
  13. // Use TRACE(x) for output, where x is a list of printf()-style parameters.
  14. // TRACEn() is TRACE with n printf arguments
  15. // For example, TRACE2("This shows how to print stuff, like a string %s, and a number %u.","string",5);
  16. //
  17. // USE VERIFY for expressions executed for both debug and release version
  18. //
  19. #undef ASSERT
  20. #undef ASSERTMSG
  21. /*
  22. //
  23. // Used by atl
  24. //
  25. #ifdef _ATL_NO_DEBUG_CRT
  26. #define _ASSERTE ASSERT
  27. #define _ASSERT ASSERT
  28. #endif
  29. */
  30. #ifdef DBG
  31. #define DEBUG
  32. #endif
  33. #if ( defined(DEBUG) || defined(_DEBUG))
  34. #ifdef UNICODE
  35. #define AssertMessage AssertMessageW
  36. #else
  37. #define AssertMessage AssertMessageA
  38. #endif
  39. void AssertMessage(const TCHAR *pszFile, unsigned nLine, const TCHAR *pszMsg);
  40. #define ASSERT(x) (void)((x) || (AssertMessage(TEXT(__FILE__),__LINE__,TEXT(#x)),0))
  41. #define ASSERTMSG(exp, msg) (void)((exp) || (AssertMessage(TEXT(__FILE__),__LINE__,msg),0))
  42. #define VERIFY(x) ASSERT(x)
  43. // {ASSERT(pObj);pObj->AssertValid();}
  44. #define ASSERT_VALID(pObj) ((ASSERT(pObj),1) && ((pObj)->AssertValid(),1))
  45. #else // DEBUG
  46. #define ASSERT_VALID(pObj)
  47. #define ASSERT(x) ((void)0)
  48. #define ASSERTMSG(exp, msg) ((void)0)
  49. #define VERIFY(x) (x)
  50. #endif
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif