|
|
1.1 root 1: /* DEBUGOUT.H */
2:
3: /* $Id: debugout.h,v 1.1.1.1 2000/10/10 11:27:22 rswindell Exp $ */
4:
5: /****************************************************************************
6: * @format.tab-size 4 (Plain Text/Source Code File Header) *
7: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
8: * *
9: * Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html *
10: * *
11: * This program is free software; you can redistribute it and/or *
12: * modify it under the terms of the GNU General Public License *
13: * as published by the Free Software Foundation; either version 2 *
14: * of the License, or (at your option) any later version. *
15: * See the GNU General Public License for more details: gpl.txt or *
16: * http://www.fsf.org/copyleft/gpl.html *
17: * *
18: * Anonymous FTP access to the most recent released source is available at *
19: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
20: * *
21: * Anonymous CVS access to the development source and modification history *
22: * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
23: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login *
24: * (just hit return, no password is necessary) *
25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src *
26: * *
27: * For Synchronet coding style and modification guidelines, see *
28: * http://www.synchro.net/source.html *
29: * *
30: * You are encouraged to submit any modifications (preferably in Unix diff *
31: * format) via e-mail to [email protected] *
32: * *
33: * Note: If this box doesn't appear square, then you need to fix your tabs. *
34: ****************************************************************************/
35:
36: #ifndef _DEBUGOUT_H_
37: #define _DEBUGOUT_H_
38:
39: #ifndef DEBUG_VAR // Pre-define to use different/dynamic debug enable var
40: #define DEBUG_VAR 0x1
41: #endif
42:
43: #ifndef DEVICENAME // Pre-define to display devicename on output
44: #define DEVICENAME "DBTRACE"
45: #endif
46:
47: #ifndef DBTRACEDPF // Pre-define if using other printf type function
48: #define DBTRACEDPF dprintf
49: #endif
50:
51: #ifndef DBTFILEOFF // Pre-define if __FILE__ offset required != 2
52: #define DBTFILEOFF 2
53: #endif
54:
55: #ifndef TEXT // Windows Unicode support
56: #define TEXT(x) x
57: #endif
58:
59: #ifndef DBTRACENL // Pre-define if \n required
60: #define DBTRACENL TEXT("")
61: #endif
62:
63: #if !defined(DBG) && !defined(DEBUG)
64:
65: #define DBTRACE(b,s); { /* DBTRACE */ }
66: #define DBTRACEd(b,s,d); { /* DBTRACE */ }
67: #define DBTRACEs(b,s,t); { /* DBTRACE */ }
68: #define DBTRACEx(b,s,x); { /* DBTRACE */ }
69: #define DBTRACEdd(b,s,x,y); { /* DBTRACE */ }
70: #define DBTRACEds(b,s,x,y); { /* DBTRACE */ }
71: #define DBTRACEsd(b,s,x,y); { /* DBTRACE */ }
72: #define DBTRACEdx(b,s,x,y); { /* DBTRACE */ }
73: #define DBTRACExd(b,s,x,y); { /* DBTRACE */ }
74: #define DBTRACExx(b,s,x,y); { /* DBTRACE */ }
75: #define DBTRACEsx(b,s,x,y); { /* DBTRACE */ }
76: #define DBTRACExs(b,s,x,y); { /* DBTRACE */ }
77: #define DBTRACEss(b,s,x,y); { /* DBTRACE */ }
78: #define DBTRACExxd(b,s,x,y,z); { /* DBTRACE */ }
79: #define DBTRACEddx(b,s,x,y,z); { /* DBTRACE */ }
80: #define DBTRACEdds(b,s,x,y,z); { /* DBTRACE */ }
81: #define DBTRACExdd(b,s,x,y,z); { /* DBTRACE */ }
82: #define DBTRACExxx(b,s,x,y,z); { /* DBTRACE */ }
83: #define DBTRACExsx(b,s,x,y,z); { /* DBTRACE */ }
84:
85: #else /* DBG or DEBUG */
86:
87: #define DBTRACE(b,s); { if(DEBUG_VAR&(1<<b)) { \
88: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s%s") \
89: ,DEVICENAME,TEXT(__FILE__+DBTFILEOFF) \
90: ,__LINE__,TEXT(s) \
91: ,DBTRACENL); } }
92: #define DBTRACEd(b,s,d); { if(DEBUG_VAR&(1<<b)) { \
93: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ") \
94: TEXT("%d%s") \
95: ,DEVICENAME,TEXT(__FILE__+DBTFILEOFF) \
96: ,__LINE__,TEXT(s),d \
97: ,DBTRACENL); } }
98: #define DBTRACEs(b,s,t); { if(DEBUG_VAR&(1<<b)) { \
99: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
100: TEXT("%s%s") \
101: ,DEVICENAME,TEXT(__FILE__+DBTFILEOFF) \
102: ,__LINE__,TEXT(s),t \
103: ,DBTRACENL); } }
104: #define DBTRACEx(b,s,x); { if(DEBUG_VAR&(1<<b)) { \
105: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
106: TEXT("%02X%s") \
107: ,DEVICENAME,TEXT(__FILE__+DBTFILEOFF) \
108: ,__LINE__,TEXT(s),x \
109: ,DBTRACENL); } }
110: #define DBTRACEdd(b,s,x,y); { if(DEBUG_VAR&(1<<b)) { \
111: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
112: TEXT("%d %d%s") \
113: ,DEVICENAME,TEXT(__FILE__+DBTFILEOFF) \
114: ,__LINE__,TEXT(s),x,y \
115: ,DBTRACENL); } }
116: #define DBTRACEds(b,s,x,y); { if(DEBUG_VAR&(1<<b)) { \
117: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
118: TEXT("%d %s%s") \
119: ,DEVICENAME,TEXT(__FILE__+DBTFILEOFF) \
120: ,__LINE__,TEXT(s),x,y \
121: ,DBTRACENL); } }
122: #define DBTRACEsd(b,s,x,y); { if(DEBUG_VAR&(1<<b)) { \
123: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
124: TEXT("%s %d%s") \
125: ,DEVICENAME,TEXT(__FILE__+DBTFILEOFF) \
126: ,__LINE__,TEXT(s),x,y \
127: ,DBTRACENL); } }
128: #define DBTRACEdx(b,s,x,y); { if(DEBUG_VAR&(1<<b)) { \
129: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
130: TEXT("%d %X%s") \
131: ,DEVICENAME,TEXT(__FILE__+DBTFILEOFF) \
132: ,__LINE__,TEXT(s),x,y \
133: ,DBTRACENL); } }
134: #define DBTRACExd(b,s,x,y); { if(DEBUG_VAR&(1<<b)) { \
135: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
136: TEXT("%X %d%s") \
137: ,DEVICENAME,TEXT(__FILE__+DBTFILEOFF) \
138: ,__LINE__,TEXT(s),x,y \
139: ,DBTRACENL); } }
140: #define DBTRACExx(b,s,x,y); { if(DEBUG_VAR&(1<<b)) { \
141: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
142: TEXT("%X %X%s") \
143: ,DEVICENAME,TEXT(__FILE__+DBTFILEOFF) \
144: ,__LINE__,TEXT(s),x,y \
145: ,DBTRACENL); } }
146: #define DBTRACEsx(b,s,t,x); { if(DEBUG_VAR&(1<<b)) { \
147: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
148: TEXT("%s %X%s") \
149: ,DEVICENAME,TEXT(__FILE__+DBTFILEOFF) \
150: ,__LINE__,TEXT(s),t,x \
151: ,DBTRACENL); } }
152: #define DBTRACExs(b,s,x,t); { if(DEBUG_VAR&(1<<b)) { \
153: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
154: TEXT("%X %s%s") \
155: ,DEVICENAME,TEXT(__FILE__+DBTFILEOFF) \
156: ,__LINE__,TEXT(s),x,t \
157: ,DBTRACENL); } }
158: #define DBTRACEss(b,s,x,t); { if(DEBUG_VAR&(1<<b)) { \
159: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
160: TEXT("%s %s%s") \
161: ,DEVICENAME,TEXT(__FILE__+DBTFILEOFF) \
162: ,__LINE__,TEXT(s),x,t \
163: ,DBTRACENL); } }
164: #define DBTRACEddx(b,s,x,y,z); { if(DEBUG_VAR&(1<<b)) { \
165: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
166: TEXT("%d %d %X%s") \
167: ,DEVICENAME \
168: ,TEXT(__FILE__+DBTFILEOFF),__LINE__ \
169: ,TEXT(s),x,y,z \
170: ,DBTRACENL); } }
171: #define DBTRACEdds(b,s,x,y,z); { if(DEBUG_VAR&(1<<b)) { \
172: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
173: TEXT("%d %d %s%s") \
174: ,DEVICENAME \
175: ,TEXT(__FILE__+DBTFILEOFF),__LINE__ \
176: ,TEXT(s),x,y,z \
177: ,DBTRACENL); } }
178: #define DBTRACExdd(b,s,x,y,z); { if(DEBUG_VAR&(1<<b)) { \
179: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
180: TEXT("%X %d %d%s") \
181: ,DEVICENAME \
182: ,TEXT(__FILE__+DBTFILEOFF),__LINE__ \
183: ,TEXT(s),x,y,z \
184: ,DBTRACENL); } }
185: #define DBTRACExxd(b,s,x,y,z); { if(DEBUG_VAR&(1<<b)) { \
186: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
187: TEXT("%X %X %d%s") \
188: ,DEVICENAME \
189: ,TEXT(__FILE__+DBTFILEOFF),__LINE__ \
190: ,TEXT(s),x,y,z \
191: ,DBTRACENL); } }
192: #define DBTRACExxx(b,s,x,y,z); { if(DEBUG_VAR&(1<<b)) { \
193: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
194: TEXT("%X %X %X%s") \
195: ,DEVICENAME \
196: ,TEXT(__FILE__+DBTFILEOFF),__LINE__ \
197: ,TEXT(s),x,y,z \
198: ,DBTRACENL); } }
199: #define DBTRACExsx(b,s,x,t,z); { if(DEBUG_VAR&(1<<b)) { \
200: DBTRACEDPF(TEXT("%-8s (%-12.12s %4d): %s: ")\
201: TEXT("%X %s %X%s") \
202: ,DEVICENAME \
203: ,TEXT(__FILE__+DBTFILEOFF),__LINE__ \
204: ,TEXT(s),x,t,z \
205: ,DBTRACENL); } }
206:
207: #endif
208:
209: #endif // Don't add anything after this line
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.