home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / g / gs252src.zip / GS252 / GDEBUG.H < prev    next >
C/C++ Source or Header  |  1992-08-03  |  3KB  |  77 lines

  1. /* Copyright (C) 1989, 1992 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* gdebug.h */
  21. /* Debugging machinery for Ghostscript */
  22.  
  23. /* Debugging options array */
  24. extern char gs_debug[128];
  25. /* If debugging, direct all error output to gs_debug_out. */
  26. #ifdef DEBUG
  27. extern FILE *gs_debug_out;
  28. #undef dstderr
  29. #define dstderr gs_debug_out
  30. #undef estderr
  31. #define estderr gs_debug_out
  32. #endif
  33.  
  34. /* Insert code conditionally if debugging. */
  35. #ifdef DEBUG
  36. #  define do_debug(x) x
  37. #else
  38. #  define do_debug(x)
  39. #endif
  40.  
  41. /* Debugging printout macros. */
  42. #ifdef DEBUG
  43. #  define debug_c(c)\
  44.     (c>='a' && c<='z' ? gs_debug[c] | gs_debug[c^32] : gs_debug[c])
  45. #  define if_debug0(c,s)\
  46.     if (debug_c(c)) dprintf(s)
  47. #  define if_debug1(c,s,a1)\
  48.     if (debug_c(c)) dprintf1(s,a1)
  49. #  define if_debug2(c,s,a1,a2)\
  50.     if (debug_c(c)) dprintf2(s,a1,a2)
  51. #  define if_debug3(c,s,a1,a2,a3)\
  52.     if (debug_c(c)) dprintf3(s,a1,a2,a3)
  53. #  define if_debug4(c,s,a1,a2,a3,a4)\
  54.     if (debug_c(c)) dprintf4(s,a1,a2,a3,a4)
  55. #  define if_debug5(c,s,a1,a2,a3,a4,a5)\
  56.     if (debug_c(c)) dprintf5(s,a1,a2,a3,a4,a5)
  57. #  define if_debug6(c,s,a1,a2,a3,a4,a5,a6)\
  58.     if (debug_c(c)) dprintf6(s,a1,a2,a3,a4,a5,a6)
  59. #  define if_debug7(c,s,a1,a2,a3,a4,a5,a6,a7)\
  60.     if (debug_c(c)) dprintf7(s,a1,a2,a3,a4,a5,a6,a7)
  61. #  define if_debug8(c,s,a1,a2,a3,a4,a5,a6,a7,a8)\
  62.     if (debug_c(c)) dprintf8(s,a1,a2,a3,a4,a5,a6,a7,a8)
  63. #  define if_debug9(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9)\
  64.     if (debug_c(c)) dprintf9(s,a1,a2,a3,a4,a5,a6,a7,a8,a9)
  65. #else
  66. #  define if_debug0(c,s) 0
  67. #  define if_debug1(c,s,a1) 0
  68. #  define if_debug2(c,s,a1,a2) 0
  69. #  define if_debug3(c,s,a1,a2,a3) 0
  70. #  define if_debug4(c,s,a1,a2,a3,a4) 0
  71. #  define if_debug5(c,s,a1,a2,a3,a4,a5) 0
  72. #  define if_debug6(c,s,a1,a2,a3,a4,a5,a6) 0
  73. #  define if_debug7(c,s,a1,a2,a3,a4,a5,a6,a7) 0
  74. #  define if_debug8(c,s,a1,a2,a3,a4,a5,a6,a7,a8) 0
  75. #  define if_debug9(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9) 0
  76. #endif
  77.