home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / graphics / audio / acmapp / debug.h < prev    next >
C/C++ Source or Header  |  1997-10-05  |  2KB  |  95 lines

  1. //==========================================================================;
  2. //
  3. //  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. //  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. //  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. //  PURPOSE.
  7. //
  8. //  Copyright (C) 1992 - 1997 Microsoft Corporation.  All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. //
  12. //  debug.h
  13. //
  14. //  Description:
  15. //
  16. //
  17. //
  18. //==========================================================================;
  19.  
  20. #ifndef _INC_DEBUG
  21. #define _INC_DEBUG
  22. #ifdef __cplusplus
  23. extern "C"
  24. {
  25. #endif
  26.  
  27. //
  28. //
  29. //
  30. //
  31. #ifdef DEBUG
  32.     #define DEBUG_SECTION       "Debug"     // section name for 
  33.     #define DEBUG_MODULE_NAME   "ACMAPP"    // key name and prefix for output
  34.     #define DEBUG_MAX_LINE_LEN  255         // max line length (bytes!)
  35. #endif
  36.  
  37.  
  38. //
  39. //  based code makes since only in win 16 (to try and keep stuff out of
  40. //  [fixed] data segments, etc)...
  41. //
  42. #ifndef BCODE
  43. #ifdef WIN32
  44.     #define BCODE
  45. #else
  46.     #define BCODE           _based(_segname("_CODE"))
  47. #endif
  48. #endif
  49.  
  50.  
  51.  
  52.  
  53. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  54. //
  55. //
  56. //
  57. //  #pragma message(REMIND("this is a reminder"))
  58. //
  59. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  60.  
  61. #define DEBUG_QUOTE(x)      #x
  62. #define DEBUG_QQUOTE(y)     DEBUG_QUOTE(y)
  63. #define REMIND(sz)          __FILE__ "(" DEBUG_QQUOTE(__LINE__) ") : " sz
  64.  
  65. #ifdef DEBUG
  66.     BOOL WINAPI DbgEnable(BOOL fEnable);
  67.     UINT WINAPI DbgGetLevel(void);
  68.     UINT WINAPI DbgSetLevel(UINT uLevel);
  69.     UINT WINAPI DbgInitialize(BOOL fEnable);
  70.  
  71.     void FAR CDECL dprintf(UINT uDbgLevel, LPSTR szFmt, ...);
  72.  
  73.     #define D(x)        {x;}
  74.     #define DPF         dprintf
  75.     #define DPI(sz)     {static char BCODE ach[] = sz; OutputDebugStr(ach);}
  76. #else
  77.     #define DbgEnable(x)        FALSE
  78.     #define DbgGetLevel()       0
  79.     #define DbgSetLevel(x)      0
  80.     #define DbgInitialize(x)    0
  81.  
  82.     #ifdef _MSC_VER
  83.     #pragma warning(disable:4002)
  84.     #endif
  85.  
  86.     #define D(x)
  87.     #define DPF()
  88.     #define DPI(sz)
  89. #endif
  90.  
  91. #ifdef __cplusplus
  92. }
  93. #endif
  94. #endif  // _INC_DEBUG
  95.