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.

76 lines
3.9 KiB

  1. //*******************************************************************************************
  2. //
  3. // Filename : Debug.h
  4. //
  5. // Definitions of Debug routines
  6. //
  7. // Copyright (c) 1994 - 1996 Microsoft Corporation. All rights reserved
  8. //
  9. //*******************************************************************************************
  10. #define NOSHELLDEBUG // don't take shell versions of this
  11. // NOTE: You can #define your own DM_* values using bits in the HI BYTE
  12. #define DM_TRACE 0x0001 // Trace messages
  13. #define DM_WARNING 0x0002 // Warning
  14. #define DM_ERROR 0x0004 // Error
  15. #define DM_ASSERT 0x0008 // Assertions
  16. // NOTE: Default debug mask is 0x00ff (show everything)
  17. //
  18. // Inside debugger, you can modify wDebugMask variable.
  19. //
  20. // Set debug mask; returning previous.
  21. //
  22. UINT WINAPI SetDebugMask(UINT mask);
  23. // Get debug mask.
  24. //
  25. UINT WINAPI GetDebugMask();
  26. // Use this macro to declare message text that will be placed
  27. // in the CODE segment (useful if DS is getting full)
  28. //
  29. // Ex: DBGTEXT(szMsg, "Invalid whatever: %d");
  30. //
  31. #define DBGTEXT(sz, msg) static const CHAR sz[] = msg;
  32. #ifdef DEBUG
  33. // Assert(f) -- Generate "assertion failed in line x of file.c"
  34. // message if f is NOT true.
  35. //
  36. // AssertMsg(f, msg, args...) -- Generate wsprintf-formatted msg w/params
  37. // if f is NOT true.
  38. //
  39. // DebugMsg(mask, msg, args...) -
  40. // Generate wsprintf-formatted msg using
  41. // specified debug mask. System debug mask
  42. // governs whether message is output.
  43. //
  44. void WINAPI AssertFailed(LPCSTR szFile, int line);
  45. #define Assert(f) \
  46. { \
  47. DBGTEXT(szFile, __FILE__); \
  48. if (!(f)) \
  49. AssertFailed(szFile, __LINE__); \
  50. }
  51. #define AssertE(f) Assert(f)
  52. void __cdecl _AssertMsg(BOOL f, LPCSTR pszMsg, ...);
  53. #define AssertMsg _AssertMsg
  54. void __cdecl _DebugMsg(UINT mask, LPCSTR psz, ...);
  55. #define DebugMsg _DebugMsg
  56. #else
  57. // retail versions to produce no code, no data
  58. #define Assert(f)
  59. #define AssertE(f) (f)
  60. #define AssertMsg 1 ? (void)0 : (void)
  61. #define DebugMsg 1 ? (void)0 : (void)
  62. #endif