home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / sharewar / dos / program / gs300sr1 / gs300sr1.exe / GDEBUG.H < prev    next >
C/C++ Source or Header  |  1994-07-27  |  4KB  |  94 lines

  1. /* Copyright (C) 1989, 1992, 1993, 1994 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* gdebug.h */
  20. /* Debugging machinery definitions */
  21.  
  22. /* Define the array of debugging flags, indexed by character code. */
  23. extern char gs_debug[128];
  24. #define gs_debug_c(c)\
  25.   ((c)>='a' && (c)<='z' ? gs_debug[c] | gs_debug[(c)^32] : gs_debug[c])
  26. /* Define aliases for two specialized debugging flags */
  27. /* that used to be separate variables. */
  28. #define gs_alloc_debug gs_debug['@']
  29. #define gs_log_errors gs_debug['#']
  30.  
  31. /* If debugging, direct all error output to gs_debug_out. */
  32. #ifdef DEBUG
  33. extern FILE *gs_debug_out;
  34. #undef dstderr
  35. #define dstderr gs_debug_out
  36. #undef estderr
  37. #define estderr gs_debug_out
  38. #endif
  39.  
  40. /* Insert code conditionally if debugging. */
  41. #ifdef DEBUG
  42. #  define do_debug(x) x
  43. #else
  44. #  define do_debug(x)
  45. #endif
  46.  
  47. /* Debugging printout macros. */
  48. #ifdef DEBUG
  49. #  define if_debug0(c,s)\
  50.     if (gs_debug_c(c)) dprintf(s)
  51. #  define if_debug1(c,s,a1)\
  52.     if (gs_debug_c(c)) dprintf1(s,a1)
  53. #  define if_debug2(c,s,a1,a2)\
  54.     if (gs_debug_c(c)) dprintf2(s,a1,a2)
  55. #  define if_debug3(c,s,a1,a2,a3)\
  56.     if (gs_debug_c(c)) dprintf3(s,a1,a2,a3)
  57. #  define if_debug4(c,s,a1,a2,a3,a4)\
  58.     if (gs_debug_c(c)) dprintf4(s,a1,a2,a3,a4)
  59. #  define if_debug5(c,s,a1,a2,a3,a4,a5)\
  60.     if (gs_debug_c(c)) dprintf5(s,a1,a2,a3,a4,a5)
  61. #  define if_debug6(c,s,a1,a2,a3,a4,a5,a6)\
  62.     if (gs_debug_c(c)) dprintf6(s,a1,a2,a3,a4,a5,a6)
  63. #  define if_debug7(c,s,a1,a2,a3,a4,a5,a6,a7)\
  64.     if (gs_debug_c(c)) dprintf7(s,a1,a2,a3,a4,a5,a6,a7)
  65. #  define if_debug8(c,s,a1,a2,a3,a4,a5,a6,a7,a8)\
  66.     if (gs_debug_c(c)) dprintf8(s,a1,a2,a3,a4,a5,a6,a7,a8)
  67. #  define if_debug9(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9)\
  68.     if (gs_debug_c(c)) dprintf9(s,a1,a2,a3,a4,a5,a6,a7,a8,a9)
  69. #  define if_debug10(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)\
  70.     if (gs_debug_c(c)) dprintf10(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
  71. #  define if_debug11(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)\
  72.     if (gs_debug_c(c)) dprintf11(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
  73. #  define if_debug12(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)\
  74.     if (gs_debug_c(c)) dprintf12(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
  75. #else
  76. #  define if_debug0(c,s) DO_NOTHING
  77. #  define if_debug1(c,s,a1) DO_NOTHING
  78. #  define if_debug2(c,s,a1,a2) DO_NOTHING
  79. #  define if_debug3(c,s,a1,a2,a3) DO_NOTHING
  80. #  define if_debug4(c,s,a1,a2,a3,a4) DO_NOTHING
  81. #  define if_debug5(c,s,a1,a2,a3,a4,a5) DO_NOTHING
  82. #  define if_debug6(c,s,a1,a2,a3,a4,a5,a6) DO_NOTHING
  83. #  define if_debug7(c,s,a1,a2,a3,a4,a5,a6,a7) DO_NOTHING
  84. #  define if_debug8(c,s,a1,a2,a3,a4,a5,a6,a7,a8) DO_NOTHING
  85. #  define if_debug9(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9) DO_NOTHING
  86. #  define if_debug10(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) DO_NOTHING
  87. #  define if_debug11(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) DO_NOTHING
  88. #  define if_debug12(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) DO_NOTHING
  89. #endif
  90.  
  91. /* Debugging support procedures in gsmisc.c */
  92. extern void debug_dump_bytes(P3(const byte *from, const byte *to, 
  93.                 const char *msg));
  94.