update dev300-m58
[ooovba.git] / dmake / dbug / malloc / debug.h
blob0cc1c5ca4b3f3eed50439da9060d074aab7fb0d7
1 /*
2 * (c) Copyright 1990 Conor P. Cahill (uunet!virtech!cpcahil).
3 * You may copy, distribute, and use this software as long as this
4 * copyright statement is not removed.
5 */
6 /************************************************************************/
7 /* */
8 /* this include sets up some macro functions which can be used while */
9 /* debugging the program, and then left in the code, but turned of by */
10 /* just not defining "DEBUG". This way your production version of */
11 /* the program will not be filled with bunches of debugging junk */
12 /* */
13 /************************************************************************/
15 * $Id: debug.h,v 1.2 2006-07-25 10:07:24 rt Exp $
18 #ifdef DEBUG
20 #if DEBUG == 1 /* if default level */
21 #undef DEBUG
22 #define DEBUG 100 /* use level 100 */
23 #endif
25 #include <stdio.h>
27 #define DEBUG0(val,str)\
29 if( DEBUG > val ) \
30 fprintf(stderr,"%s(%d): %s\n",\
31 __FILE__,__LINE__,str);\
33 #define DEBUG1(val,str,a1)\
35 char _debugbuf[100];\
36 if( DEBUG > val )\
38 sprintf(_debugbuf,str,a1);\
39 fprintf(stderr,"%s(%d): %s\n",\
40 __FILE__,__LINE__,_debugbuf);\
44 #define DEBUG2(val,str,a1,a2)\
46 char _debugbuf[100];\
47 if( DEBUG > val )\
49 sprintf(_debugbuf,str,a1,a2);\
50 fprintf(stderr,"%s(%d): %s\n",\
51 __FILE__,__LINE__,_debugbuf);\
55 #define DEBUG3(val,str,a1,a2,a3)\
57 char _debugbuf[100];\
58 if( DEBUG > val )\
60 sprintf(_debugbuf,str,a1,a2,a3);\
61 fprintf(stderr,"%s(%d): %s\n",\
62 __FILE__,__LINE__,_debugbuf);\
66 #define DEBUG4(val,str,a1,a2,a3,a4)\
68 char _debugbuf[100];\
69 if( DEBUG > val )\
71 sprintf(_debugbuf,str,a1,a2,a3,a4);\
72 fprintf(stderr,"%s(%d): %s\n",\
73 __FILE__,__LINE__,_debugbuf);\
77 #define DEBUG5(val,str,a1,a2,a3,a4,a5)\
79 char _debugbuf[100];\
80 if( DEBUG > val )\
82 sprintf(_debugbuf,str,a1,a2,a3,a4,a5);\
83 fprintf(stderr,"%s(%d): %s\n",\
84 __FILE__,__LINE__,_debugbuf);\
88 #else
90 #define DEBUG0(val,s)
91 #define DEBUG1(val,s,a1)
92 #define DEBUG2(val,s,a1,a2)
93 #define DEBUG3(val,s,a1,a2,a3)
94 #define DEBUG4(val,s,a1,a2,a3,a4)
95 #define DEBUG5(val,s,a1,a2,a3,a4,a5)
97 #endif /* DEBUG */