home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / ek / eksw / src / debug.h < prev    next >
C/C++ Source or Header  |  2020-01-01  |  2KB  |  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. #define DB_OPNT 7               /* Open log with time stamps */
  20. #define DB_HEX 8                /* Record a buffer in hex */
  21.  
  22. int dodebug (int, UCHAR *, UCHAR *, long);      /* Prototype */
  23. /*
  24.   dodebug() is accessed throug a macro that:
  25.    . Coerces its args to the required types.
  26.    . Accesses dodebug() directly or thru a pointer according to context.
  27.    . Makes it disappear entirely if DEBUG not defined.
  28. */
  29. #ifdef KERMIT_C
  30. /* In kermit.c we debug only through a function pointer */
  31. #define debug(a,b,c,d) if(k->dbf) k->dbf(a,(UCHAR *)b,(UCHAR *)c,(long)(d))
  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.