home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ek17.zip / debug.h < prev    next >
C/C++ Source or Header  |  2004-04-10  |  1KB  |  41 lines

  1. #ifndef NODEBUG                /* NODEBUG inhibits debugging */
  2. #ifndef DEBUG                /* and if DEBUG not already defined */
  3. #ifndef MINSIZE                /* MINSIZE inhibits debugging */
  4. #ifndef DEBUG
  5. #define DEBUG
  6. #endif /* DEBUG */
  7. #endif /* MINSIZE */
  8. #endif /* DEBUG */
  9. #endif /* NODEBUG */
  10.  
  11. #ifdef DEBUG                /* Debugging included... */
  12. /* dodebug() function codes... */
  13. #define DB_OPN 1            /* Open log */
  14. #define DB_LOG 2            /* Write label+string or int to log */
  15. #define DB_MSG 3            /* Write message to log */
  16. #define DB_CHR 4            /* Write label + char to log */
  17. #define DB_PKT 5            /* Record a Kermit packet in log */
  18. #define DB_CLS 6            /* Close log */
  19.  
  20. void dodebug(int, UCHAR *, UCHAR *, long); /* Prototype */
  21. /*
  22.   dodebug() is accessed throug a macro that:
  23.    . Coerces its args to the required types.
  24.    . Accesses dodebug() directly or thru a pointer according to context.
  25.    . Makes it disappear entirely if DEBUG not defined.
  26. */
  27. #ifdef KERMIT_C
  28. /* In kermit.c we debug only through a function pointer */
  29. #define debug(a,b,c,d) \
  30. if(*(k->dbf))(*(k->dbf))(a,(UCHAR *)b,(UCHAR *)c,(long)(d))
  31.  
  32. #else  /* KERMIT_C */
  33. /* Elsewhere we can call the debug function directly */
  34. #define debug(a,b,c,d) dodebug(a,(UCHAR *)b,(UCHAR *)c,(long)(d))
  35. #endif /* KERMIT_C */
  36.  
  37. #else  /* Debugging not included... */
  38.  
  39. #define debug(a,b,c,d)
  40. #endif /* DEBUG */
  41.