home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / DesktopDoubler / Common / Headers / DCon.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-06-25  |  1.7 KB  |  64 lines  |  [TEXT/CWIE]

  1. #ifndef _DCON_
  2. #define _DCON_
  3.  
  4. #include <MacTypes.h>
  5. #include <stdarg.h>
  6. #include <stdlib.h>
  7.  
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11.  
  12.  
  13. void dopen(const char *log);
  14. void dprintf(const char *format,...);
  15. void vdprintf(const char *format,va_list arg);
  16. void dprintmem(const void *data,size_t len);
  17.  
  18. void dfprintf(const char *log,const char *format,...);
  19. void vdfprintf(const char *log,const char *format,va_list arg);
  20. void dfprintmem(const char *log,const void *data,size_t len);
  21.  
  22.  
  23. // Default: DCon off
  24. #ifndef DCON
  25.     #define DCON        0
  26. #endif
  27.  
  28.  
  29. #if DCON
  30.     #include "MacPrint.h"
  31.     #if MACPRINTENABLED
  32.         #define dopen                            while(0)
  33.         #define dprintf                            MacPrint_printf
  34.         #define vdprintf                        MacPrint_vprintf
  35.         #define dprintmem                        MacPrint_printmem
  36.         #define dfprintf                        MacPrint_fprintf
  37.         #define vfdprintf                        MacPrint_vfprintf
  38.         #define dfprintmem                        MacPrint_fprintmem
  39.     #endif
  40.     #define dAssertPrint(condition)                dprintf("Assert failed: " condition "  %s:%d\n",__FILE__,__LINE__)
  41.     #define dAssertIfTrue(condition)            ((condition) ? dAssertPrint(#condition) : ((void)0))
  42.     #define dAssertIfFalse(condition)            ((condition) ? ((void)0) : dAssertPrint(#condition))
  43.     #define dAssert(condition)                    dAssertIfFalse(condition)
  44. #else
  45.     #define dAssertPrint(condition)                ((void)0)
  46.     #define dAssertIfTrue(condition)            ((condition) ? ((void)0) : ((void)0))
  47.     #define dAssertIfFalse(condition)            ((condition) ? ((void)0) : ((void)0))
  48.     #define dAssert(condition)                    dAssertIfFalse(condition)
  49.     #define dopen                                while(0)
  50.     #define dprintf                                while(0)
  51.     #define vdprintf                            while(0)
  52.     #define dprintmem                            while(0)
  53.     #define dfprintf                            while(0)
  54.     #define vfdprintf                            while(0)
  55.     #define dfprintmem                            while(0)
  56. #endif
  57.  
  58.  
  59. #ifdef __cplusplus
  60. }
  61. #endif
  62.  
  63. #endif /* _DCON_ */
  64.