home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / manage / condor / Condor_4.1.3b / src / h / ebug.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-05  |  1.8 KB  |  88 lines

  1. /*
  2.  *  Author   : Ronald Wong
  3.  *  Date     : Oct 1991 -- Oct 1991
  4.  *
  5.  *  Uses :
  6.  *    This small debug util helps user keep track of how the program executes
  7.  *    and where are YOU in the program.  This is very usefel for locating
  8.  *    bug or the place where core dump occurs.
  9.  *
  10.  *  Available flags:
  11.  *    EBUG < 0 : see `NOTE:'
  12.  *
  13.  *    EBUG = 1 :
  14.  *        No debug statements for macros `Enter/Exit' and `debug'.
  15.  *
  16.  *    EBUG = 2;
  17.  *        `Enter', `Exit' and `debug' will print debug mesg.
  18.  *
  19.  *    EBUG = 3;
  20.  *        Same as `1' PLUS `Enter/Exit' has indentation for defferent calling
  21.  *        sequence.
  22.  *
  23.  *  NOTE:
  24.  *    If you want the indentation, set `EBUG' to negative at the when you
  25.  *    include this debug header file.
  26.  *
  27.  *    On further including this file, set `EBUG' to the desired flag.
  28.  *
  29.  *  Indentifiers used :
  30.  *    _null_, Z_Z -- don't use these name in the file.
  31.  *    EBUG, __DEBUG__ define's are used.
  32.  */
  33.  
  34.  
  35. #ifndef    _EBUG_H_
  36. #define    _EBUG_H_
  37.  
  38.  
  39. #if    EBUG < 0
  40.     int  Z_Z;
  41.     char z_z[20][100];
  42. #endif
  43.  
  44. #define    deb0    _null_
  45. #define    Enter0    _null_
  46. #define    Exit0    _null_
  47.  
  48. #include <varargs.h>
  49. /*VARARGS*/
  50. static void _null_(va_alist) va_dcl {}
  51.  
  52. #if    EBUG == 1 || EBUG == -1
  53.  
  54. #define    debug    _null_
  55. #define    deb    _null_
  56. #define    Enter    _null_
  57. #define    Exit    _null_
  58.  
  59. #elif    EBUG == 2 || EBUG == -2
  60.  
  61. #define    Enter(A)    printf("    Enter %s()\n", A)
  62.  
  63. #define    Exit(A)        printf("    Exit %s()\n", A)
  64. #define    debug        printf
  65. #define    deb        printf
  66.  
  67. #elif    EBUG == 3 || EBUG == -3
  68.  
  69. #include <string.h>
  70.  
  71.  
  72. #define    Enter(A)    printf("%*sEnter %s()\n",Z_Z+=3,"",strcpy(z_z[Z_Z/3],A))
  73. #define    Exit()        printf("%*sExit %s()\n",(Z_Z-=3)+3,"",z_z[Z_Z/3+1])
  74. #define    Return()    printf("%*sReturn %s()\n",(Z_Z-=3)+3,"",z_z[Z_Z/3+1]), \
  75.             return(A)
  76. #define    debug        printf
  77. #define    deb        printf("%*s%s: ",Z_Z+3,"",z_z[Z_Z/3]),printf
  78.  
  79. #if    EBUG == 3
  80. extern int  Z_Z;
  81. extern char z_z[20][100];
  82. #endif
  83.  
  84. #endif
  85.  
  86. #endif
  87.  
  88.