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.

47 lines
1.2 KiB

  1. /*
  2. * Some simple debugging macros that look and behave a lot like their
  3. * namesakes in MFC. These macros should work in both C and C++ and
  4. * do something useful with almost any Win32 compiler.
  5. *
  6. * George V. Reilly <georger@microcrafts.com> <a-georgr@microsoft.com>
  7. */
  8. #ifndef __DEBUG_H__
  9. #define __DEBUG_H__
  10. #if DBG
  11. #include <crtdbg.h>
  12. #include <windows.h>
  13. # define SC_TRACE Trace
  14. # define SC_TRACE0(psz) Trace(L"%s", psz)
  15. # define SC_TRACE1(psz, p1) Trace(psz, p1)
  16. # define SC_TRACE2(psz, p1, p2) Trace(psz, p1, p2)
  17. # define SC_TRACE3(psz, p1, p2, p3) Trace(psz, p1, p2, p3)
  18. # define SC_ASSERT(bCond) if(bCond == false) Assert(__FILE__, __LINE__, #bCond)
  19. #else /* !DBG */
  20. /* These macros should all compile away to nothing */
  21. # define SC_TRACE
  22. # define SC_TRACE0(psz)
  23. # define SC_TRACE1(psz, p1)
  24. # define SC_TRACE2(psz, p1, p2)
  25. # define SC_TRACE3(psz, p1, p2, p3)
  26. # define SC_ASSERT(bCond)
  27. #endif /* !DBG*/
  28. #if DBG
  29. /* in debug version, writes trace messages to debug stream */
  30. void __cdecl
  31. Trace(
  32. LPCWSTR pszFormat,
  33. ...);
  34. void __cdecl
  35. Assert(
  36. LPCSTR pszFile,
  37. DWORD dwLine,
  38. LPCSTR pszCond);
  39. #endif /* DBG */
  40. #endif /* __DEBUG_H__ */