home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / dbmsg / mapi / common / traces.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-11  |  3.5 KB  |  130 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  File Name 
  4. //      TRACES.H
  5. //
  6. //  Description
  7. //      Function declaration for the API's in TRACES.CPP
  8. //
  9. //  Author
  10. //      Irving De la Cruz
  11. //
  12. //  Revision: 1.3
  13. //
  14. // Written for Microsoft Windows Developer Support
  15. // Copyright (c) 1994-1996 Microsoft Corporation. All rights reserved.
  16. //
  17.  
  18. #ifndef _TRACES_H
  19. #define _TRACES_H
  20.  
  21. ///////////////////////////////////////////////////////////////////////////////
  22. //  Function prototype for the debug functions used to trace and log output 
  23. //  messages
  24. //
  25. #include <OBJBASE.H>
  26.  
  27. #define TRACES_CONSOLE              0x00000001
  28. #define TRACES_LOG_FILE             0x00000002
  29. #define TRACES_NO_COM_OUTPUT        0x00000004
  30. #define TRACES_NO_ASSERTS           0x00000008
  31. #define TRACES_NO_ASSERT_DIALOG     0x00000010
  32.  
  33. #ifdef __cplusplus
  34. extern "C"
  35. {
  36. #endif // __cplusplus
  37.  
  38. #ifdef ENABLE_DEBUG_OUTPUT
  39.  
  40. void WINAPI InitTraces (DWORD dwFlags);
  41. void WINAPI UnInitTraces ();
  42.  
  43. void WINAPI  TraceFn1 (LPSTR);
  44. void WINAPI  TraceFn2 (LPSTR, ULONG);
  45. void WINAPI  TraceFn3 (LPSTR);
  46. void __cdecl TraceFn4 (BOOL, LPSTR, ...);
  47. void WINAPI  TraceIO  (ULONG);
  48. void WINAPI  TraceIO2 (LPSTR, ULONG);
  49.  
  50. #ifndef TRACES_NO_MAPI
  51. void WINAPI TraceProp (ULONG);
  52. #else
  53. #define TraceProp(a)
  54. #endif // TRACES_NO_MAPI
  55.  
  56. #define TraceString1(a,b)           TraceFn4 (FALSE, a, b)
  57. #define TraceString2(a,b,c)         TraceFn4 (FALSE, a, b, c)
  58. #define TraceString3(a,b,c,d)       TraceFn4 (FALSE, a, b, c, d)
  59. #define TraceString4(a,b,c,d,e)     TraceFn4 (FALSE, a, b, c, d, e)
  60.  
  61. #define TraceMessage(a)             TraceFn1 (a)
  62. #define TraceMessageIf(a, b)        {if (b) TraceFn1 (a); }
  63. #define TraceRaw(a)                 TraceFn3 (a)
  64.  
  65. // These functions will trace only if the error is non-zero
  66. #define TraceRPCError(a,b)          {if (b) TraceFn4 (FALSE, "%s, RPC error: %d",a, b);}
  67. #define TraceSysError(a,b)          {if (b) TraceFn4 (FALSE, "%s, Systen Error: %d",a, b);}
  68. #define TraceResult(a, b)           {if (b) TraceFn2 (a, b);}
  69. #define TraceDebugger(a,b)          TraceFn4 (TRUE, a, b)
  70.  
  71. void WINAPI AssertStatement (LPSTR, ULONG);
  72. void WINAPI AssertStatementWithMsg (LPSTR, LPSTR, ULONG);
  73.  
  74. #ifndef ASSERT
  75. #define ASSERT(a)           {if (!(a)) AssertStatement (__FILE__, __LINE__);}
  76. #endif // ASSERT
  77. #define ASSERTMSG(a, b)     {if (!(a)) AssertStatementWithMsg (b, __FILE__, __LINE__);}
  78.  
  79. #ifndef VERIFY
  80. #define VERIFY(a)       ASSERT(a)
  81. #endif // VERIFY
  82.  
  83. #ifdef  DISABLE_INFO_TRACES
  84. #define TraceInfoMessage(a)
  85. #else  // DISABLE_INFO_TRACES
  86. #define TraceInfoMessage(a)     TraceFn1 (a)
  87. #endif // DISABLE_INFO_TRACES
  88.  
  89. #else // ENABLE_DEBUG_OUTPUT
  90.  
  91. #define TraceMessage(a)
  92. #define TraceMessageIf(a, b)
  93. #define TraceInfoMessage(a)
  94. #define TraceResult(a, b)
  95. #define TraceIO(a)              a
  96. #define TraceIO2(a, b)
  97. #define TraceProp(a)
  98. #define TraceRPCError(a,b)
  99. #define TraceSysError(a,b)
  100. #define TraceString1(a,b)
  101. #define TraceString2(a,b,c)
  102. #define TraceString3(a,b,c,d)
  103. #define TraceString4(a,b,c,d,e)
  104. #define TraceRaw(a)
  105. #define TraceDebugger(a,b)
  106.  
  107. #ifndef ASSERT
  108. #define ASSERT(a)
  109. #endif // ASSERT
  110. #define ASSERTMSG(a, b)
  111.  
  112. #ifndef VERIFY
  113. #define VERIFY(a)               a
  114. #endif // VERIFY
  115.  
  116. #define InitTraces(a)
  117. #define UnInitTraces()
  118.  
  119. #endif // ENABLE_DEBUG_OUTPUT
  120.  
  121. #define AssertSz(a, b)      ASSERTMSG(a, b)
  122.  
  123. #ifdef __cplusplus
  124. }
  125. #endif // __cplusplus
  126.  
  127. #endif // _TRACES_H
  128.  
  129. // End of file for TRACES.H
  130.