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.

92 lines
2.6 KiB

  1. /*** debug.h - debug related definitions
  2. *
  3. * Copyright (c) 1996,1997 Microsoft Corporation
  4. * Author: Michael Tsang (MikeTs)
  5. * Created 09/05/96
  6. *
  7. * MODIFICATION HISTORY
  8. */
  9. #ifndef _DEBUG_H
  10. #define _DEBUG_H
  11. /*** Macros
  12. */
  13. /*XLATOFF*/
  14. #pragma warning (disable: 4704) //don't complain about in-line assembly
  15. #define MSG(x) { \
  16. ErrPrintf("%s: ", MODNAME); \
  17. ErrPrintf x; \
  18. ErrPrintf("\n"); \
  19. }
  20. #define WARN(x) { \
  21. ErrPrintf("%s_WARN: ", MODNAME); \
  22. ErrPrintf x; \
  23. ErrPrintf("\n"); \
  24. }
  25. #define ERROR(x) { \
  26. ErrPrintf("%s_ERR: ", MODNAME); \
  27. ErrPrintf x; \
  28. ErrPrintf("\n"); \
  29. }
  30. #ifndef DEBUG
  31. #define WARN1(x) {}
  32. #define WARN2(x) {}
  33. #define ASSERT(x) {}
  34. #else
  35. #define ASSERT(x) if (!(x)) \
  36. { \
  37. ErrPrintf("%s_ASSERT: (" #x \
  38. ") in line %d of file %s\n", \
  39. MODNAME, __LINE__, __FILE__); \
  40. }
  41. #ifndef MAXDEBUG
  42. #define WARN1 WARN
  43. #define WARN2(x) {}
  44. #else
  45. #define WARN1 WARN
  46. #define WARN2 WARN
  47. #endif
  48. #endif
  49. #ifdef TRACING
  50. #define OPENTRACE OpenTrace
  51. #define CLOSETRACE CloseTrace
  52. #define ENTER(p) EnterProc p
  53. #define EXIT(p) ExitProc p
  54. #else
  55. #define OPENTRACE(x)
  56. #define CLOSETRACE()
  57. #define ENTER(p)
  58. #define EXIT(p)
  59. #endif
  60. /*XLATON*/
  61. //
  62. // Exported data definitions
  63. //
  64. #ifdef TRACING
  65. extern FILE *gpfileTrace;
  66. extern PSZ gpszTraceFile;
  67. extern int giTraceLevel;
  68. extern int giIndent;
  69. #endif
  70. //
  71. // Exported function prototypes
  72. //
  73. VOID CDECL ErrPrintf(char *pszFormat, ...);
  74. #ifdef TRACING
  75. VOID LOCAL OpenTrace(char *pszTraceOut);
  76. VOID LOCAL CloseTrace(VOID);
  77. VOID CDECL EnterProc(int n, char *pszFormat, ...);
  78. VOID CDECL ExitProc(int n, char *pszFormat, ...);
  79. #endif
  80. #endif //ifndef _DEBUG_H