home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / winui / shell / fileview / dbgout.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-12  |  2.8 KB  |  90 lines

  1. //THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 
  2. //ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
  3. //THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 
  4. // PARTICULAR PURPOSE.
  5. //
  6. // Copyright  1994-1996  Microsoft Corporation.  All Rights Reserved.
  7. //
  8. //    PROGRAM:DBGOUT.H    
  9. //
  10. //    PURPOSE:  Useful debugging output macros that compile to nothing and
  11. //   eliminate ugly #ifdef DEBUGs from source code. 
  12. //
  13. //    PLATFORMS:    Windows 95
  14. //
  15. //    SPECIAL INSTRUCTIONS: N/A
  16. //
  17. #ifndef _DBGOUT_H
  18. #define _DBGOUT_H
  19.  
  20. #ifdef DEBUG
  21.  
  22. //Basic debug macros
  23. #define D(x)        {x;}
  24.  
  25. #define ODS(x)      {\
  26.                     char        szDebug[128];\
  27.                     OutputDebugString(x);\
  28.                     wsprintf(szDebug, " %s, %u\r\n", (LPSTR)__FILE__, __LINE__);\
  29.                     OutputDebugString(szDebug);\
  30.                     }
  31.  
  32. #define ODSsz(f, s)  {\
  33.                      char        szDebug[128];\
  34.                      wsprintf(szDebug, f, (LPSTR)s);\
  35.                      OutputDebugString(szDebug);\
  36.                      wsprintf(szDebug, " %s, %u\r\n", (LPSTR)__FILE__, __LINE__);\
  37.                      OutputDebugString(szDebug);\
  38.                      }
  39.  
  40.  
  41. #define ODSu(f, u)  {\
  42.                     char        szDebug[128];\
  43.                     wsprintf(szDebug, f, (UINT)u);\
  44.                     OutputDebugString(szDebug);\
  45.                     wsprintf(szDebug, " %s, %u\r\n", (LPSTR)__FILE__, __LINE__);\
  46.                     OutputDebugString(szDebug);\
  47.                     }
  48.  
  49.  
  50. #define ODSlu(f, lu) {\
  51.                      char        szDebug[128];\
  52.                      wsprintf(szDebug, f, (DWORD)lu);\
  53.                      OutputDebugString(szDebug);\
  54.                      wsprintf(szDebug, " %s, %u\r\n", (LPSTR)__FILE__, __LINE__);\
  55.                      OutputDebugString(szDebug);\
  56.                      }
  57.  
  58. #define ODSszu(f, s, u) {\
  59.                         char        szDebug[128];\
  60.                         wsprintf(szDebug, f, (LPSTR)s, (UINT)u);\
  61.                         OutputDebugString(szDebug);\
  62.                         wsprintf(szDebug, " %s, %u\r\n", (LPSTR)__FILE__, __LINE__);\
  63.                         OutputDebugString(szDebug);\
  64.                         }
  65.  
  66.  
  67. #define ODSszlu(f, s, lu) {\
  68.                           char        szDebug[128];\
  69.                           wsprintf(szDebug, f, (LPSTR)s, (DWORD)lu);\
  70.                           OutputDebugString(szDebug);\
  71.                           wsprintf(szDebug, " %s, %u\r\n", (LPSTR)__FILE__, __LINE__);\
  72.                           OutputDebugString(szDebug);\
  73.                           }
  74.  
  75. #else   //NO DEBUG
  76.  
  77. #define D(x)
  78. #define ODS(x)
  79.  
  80. #define ODSsz(f, s)
  81. #define ODSu(f, u)
  82. #define ODSlu(f, lu)
  83. #define ODSszu(f, s, u)
  84. #define ODSszlu(f, s, lu)
  85.  
  86.  
  87. #endif //DEBUG
  88.  
  89. #endif //_DBGOUT_H
  90.