home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Vertigo / Common / Headers / DebugUtils.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  1.2 KB  |  82 lines

  1. #ifndef _DEBUGUTILS_
  2. #define _DEBUGUTILS_
  3.  
  4. #include <ConditionalMacros.h>
  5. #include <MacTypes.h>
  6.  
  7.  
  8. // Default: Call Traces off
  9. #ifndef CALLTRACE
  10.     #define CALLTRACE        0
  11. #endif
  12.  
  13. // Default: Debugging off
  14. #ifndef DEBUG
  15.     #define DEBUG            0
  16. #endif
  17.  
  18. // Local Call Traces override?
  19. #if DISABLE_LOCAL_CALLTRACE
  20.     #undef CALLTRACE
  21.     #define CALLTRACE        0
  22. #endif
  23.  
  24. // Local Debugging override?
  25. #if DISABLE_LOCAL_DEBUG
  26.     #undef DEBUG
  27.     #define DEBUG            0
  28. #endif
  29.  
  30. // !DEBUG --> !DCON
  31. #if !DEBUG
  32.     #ifdef DCON
  33.         #undef DCON
  34.     #endif
  35.     #define DCON            0
  36. #endif
  37.  
  38. #include "DCon.h"
  39.  
  40.  
  41. #if DEBUG && CALLTRACE
  42.     typedef class CallTrace
  43.     {
  44.         public:
  45.             #if TARGET_RT_MAC_CFM
  46.                 static UInt32    fLevel;
  47.             #endif
  48.             char            *fName;
  49.             #if CALLTRACE_TIMER
  50.                 UInt64            fTime;
  51.             #endif
  52.             
  53.             CallTrace(char *func);
  54.             ~CallTrace(void);
  55.         
  56.         private:
  57.             void *operator new(unsigned long) { return NULL; }
  58.             void operator delete(void *) { }
  59.     } CallTrace;
  60. #else
  61.     #define CallTrace        typedef int
  62.     #define trace(x)        __ignore_me__
  63. #endif
  64.  
  65.  
  66. #if DEBUG
  67.     #ifdef __cplusplus
  68.     extern "C" {
  69.     #endif
  70.     
  71.     void DebugStrf(char *format,...);
  72.     
  73.     #ifdef __cplusplus
  74.     }
  75.     #endif
  76. #else
  77.     #define DebugStrf        while(0)
  78. #endif
  79.  
  80.  
  81. #endif /* _DEBUGUTILS_ */
  82.