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.

127 lines
4.3 KiB

  1. //-----------------------------------------------------------------------------
  2. // File: cfguitrace.h
  3. //
  4. // Desc: Contains all trace functionalities used by the UI.
  5. // Define __CFGUI_TRACE__TO_FILE to have output written to a file.
  6. // Define __CFGUI_TRACE__TO_DEBUG_OUT to direct output to a debugger.
  7. // These two symbols can coexist, and are defined in defines.h.
  8. //
  9. // Copyright (C) 1999-2000 Microsoft Corporation. All Rights Reserved.
  10. //-----------------------------------------------------------------------------
  11. #ifndef __CFGUI_TRACE_H__
  12. #define __CFGUI_TRACE_H__
  13. #ifdef UNICODE
  14. #define _tfWSTR _T("%s")
  15. #define _tfSTR _T("%S")
  16. #else
  17. #define _tfWSTR _T("%S")
  18. #define _tfSTR _T("%s")
  19. #endif
  20. enum __cfgui_tracetype {
  21. __cfgui_tracetype_ERROR,
  22. __cfgui_tracetype_INFO,
  23. };
  24. #ifdef NTRACE
  25. #define tracescope(t,s) (void(0))
  26. #define etrace(a) (void(0))
  27. #define etrace1(a,b) (void(0))
  28. #define etrace2(a,b,c) (void(0))
  29. #define etrace3(a,b,c,d) (void(0))
  30. #define etrace4(a,b,c,d,e) (void(0))
  31. #define etrace5(a,b,c,d,e,f) (void(0))
  32. #define etrace6(a,b,c,d,e,f,g) (void(0))
  33. #define etrace7(a,b,c,d,e,f,g,h) (void(0))
  34. #define trace(a) (void(0))
  35. #define trace1(a,b) (void(0))
  36. #define trace2(a,b,c) (void(0))
  37. #define trace3(a,b,c,d) (void(0))
  38. #define trace4(a,b,c,d,e) (void(0))
  39. #define trace5(a,b,c,d,e,f) (void(0))
  40. #define trace6(a,b,c,d,e,f,g) (void(0))
  41. #define trace7(a,b,c,d,e,f,g,h) (void(0))
  42. #define traceDWORD(v) (void(0))
  43. #define traceUINT(v) (void(0))
  44. #define traceLONG(v) (void(0))
  45. #define traceHEX(v) (void(0))
  46. #define traceHEXPTR(v) (void(0))
  47. #define traceWSTR(v) (void(0))
  48. #define traceSTR(v) (void(0))
  49. #define traceTSTR(v) (void(0))
  50. #define traceGUID(v) (void(0))
  51. #define traceBOOL(v) (void(0))
  52. #define tracePOINT(v) (void(0))
  53. #define traceSIZE(v) (void(0))
  54. #define traceRECT(v) (void(0))
  55. #define traceRECTDIM(v) (void(0))
  56. #define traceSUPERSTR(v) (void(0))
  57. #else
  58. void __cfgui_trace(__cfgui_tracetype, LPCTSTR, ...);
  59. class __cfgui_out_filescope
  60. {
  61. friend class __cfgui_tracescope;
  62. __cfgui_out_filescope(bool bInternal = false);
  63. ~__cfgui_out_filescope();
  64. friend void __cfgui_trace(__cfgui_tracetype, LPCTSTR, ...);
  65. bool m_bInternal;
  66. };
  67. class __cfgui_tracescope
  68. {
  69. __cfgui_out_filescope fs;
  70. public:
  71. __cfgui_tracescope(LPCTSTR);
  72. ~__cfgui_tracescope();
  73. };
  74. #define tracescope(t,s) __cfgui_tracescope t(s)
  75. #define etrace(a) __cfgui_trace(__cfgui_tracetype_ERROR, a)
  76. #define etrace1(a,b) __cfgui_trace(__cfgui_tracetype_ERROR, a,b)
  77. #define etrace2(a,b,c) __cfgui_trace(__cfgui_tracetype_ERROR, a,b,c)
  78. #define etrace3(a,b,c,d) __cfgui_trace(__cfgui_tracetype_ERROR, a,b,c,d)
  79. #define etrace4(a,b,c,d,e) __cfgui_trace(__cfgui_tracetype_ERROR, a,b,c,d,e)
  80. #define etrace5(a,b,c,d,e,f) __cfgui_trace(__cfgui_tracetype_ERROR, a,b,c,d,e,f)
  81. #define etrace6(a,b,c,d,e,f,g) __cfgui_trace(__cfgui_tracetype_ERROR, a,b,c,d,e,f,g)
  82. #define etrace7(a,b,c,d,e,f,g,h) __cfgui_trace(__cfgui_tracetype_ERROR, a,b,c,d,e,f,g,h)
  83. #define trace(a) __cfgui_trace(__cfgui_tracetype_INFO, a)
  84. #define trace1(a,b) __cfgui_trace(__cfgui_tracetype_INFO, a,b)
  85. #define trace2(a,b,c) __cfgui_trace(__cfgui_tracetype_INFO, a,b,c)
  86. #define trace3(a,b,c,d) __cfgui_trace(__cfgui_tracetype_INFO, a,b,c,d)
  87. #define trace4(a,b,c,d,e) __cfgui_trace(__cfgui_tracetype_INFO, a,b,c,d,e)
  88. #define trace5(a,b,c,d,e,f) __cfgui_trace(__cfgui_tracetype_INFO, a,b,c,d,e,f)
  89. #define trace6(a,b,c,d,e,f,g) __cfgui_trace(__cfgui_tracetype_INFO, a,b,c,d,e,f,g)
  90. #define trace7(a,b,c,d,e,f,g,h) __cfgui_trace(__cfgui_tracetype_INFO, a,b,c,d,e,f,g,h)
  91. #define traceDWORD(v) trace1(_T(#v) _T(" = %u\n"), v)
  92. #define traceUINT(v) trace1(_T(#v) _T(" = %u\n"), v)
  93. #define traceLONG(v) trace1(_T(#v) _T(" = %d\n"), v)
  94. #define traceHEX(v) trace1(_T(#v) _T(" = 0x%08x\n"), v)
  95. #define traceHEXPTR(v) trace1(_T(#v) _T(" = 0x%p\n"), v)
  96. #define traceWSTR(v) traceTSTR(v)
  97. #define traceSTR(v) traceTSTR(v)
  98. #define traceTSTR(v) trace1(_T(#v) _T(" = %s\n"), QSAFESTR(v))
  99. #define traceGUID(v) trace1(_T(#v) _T(" = %s\n"), GUIDSTR(v))
  100. #define traceBOOL(v) trace1(_T(#v) _T(" = %s\n"), BOOLSTR(v))
  101. #define tracePOINT(v) trace1(_T(#v) _T(" = %s\n"), POINTSTR(v))
  102. #define traceSIZE(v) trace1(_T(#v) _T(" = %s\n"), SIZESTR(v))
  103. #define traceRECT(v) trace1(_T(#v) _T(" = %s\n"), RECTSTR(v))
  104. #define traceRECTDIM(v) trace1(_T(#v) _T(" = %s\n"), RECTDIMSTR(v))
  105. #define traceSUPERSTR(v) trace1(_T(#v) _T(" = %s\n"), SUPERSTR(v))
  106. #endif
  107. #endif //__CFGUI_TRACE_H__