File: debug.h

package info (click to toggle)
xblast-tnt 2.10.4-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,448 kB
  • sloc: ansic: 54,105; sh: 4,014; makefile: 129; sed: 16
file content (262 lines) | stat: -rw-r--r-- 6,763 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/*
 * file debug.h - memory debugging
 *
 * $Id: debug.h,v 1.32 2006/02/09 21:21:23 fzago Exp $
 *
 * Program XBLAST
 * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 2; or (at your option)
 * any later version
 *
 * This program is distributed in the hope that it will be entertaining,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 * Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.
 * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#ifndef XBLAST_DEBUG_H
#define XBLAST_DEBUG_H

//#define DEBUG
//#define DEBUG_FILE
//#define DEBUG_CONFIG
//#define DEBUG_LEVEL
//#define DEBUG_GAME
//#define DEBUG_ACTION
//#define DEBUG_NETWORK
//#define DEBUG_SERVER
//#define DEBUG_CLIENT
//#define DEBUG_USER
//#define DEBUG_LISTEN
//#define DEBUG_STREAM
//#define DEBUG_S2C
//#define DEBUG_C2S
//#define DEBUG_X2C
//#define DEBUG_C2X
//#define DEBUG_C2B
//#define DEBUG_DGRAM
//#define DEBUG_D2C
//#define DEBUG_D2S
//#define DEBUG_BROWSE
//#define DEBUG_NEWGAME
//#define DEBUG_REPLY
//#define DEBUG_QUERY
//#define DEBUG_CENTRAL
//#define DEBUG_COMM
//#define DEBUG_SOCKET
//#define DEBUG_VERSION
//#define DEBUG_CHAT

/*
 * global macros
 */
#if defined(__GNUC__) && !defined(DEBUG)
#define Dbg_Out(fmt, ...) (void)0
#define DBGATTR
#else
#ifdef __GNUC__
#define DBGATTR __attribute__ ((format (printf, 1, 2)));
#endif
extern void Dbg_StartClock (void);
extern time_t Dbg_FinishClock (void);
extern void
Dbg_Out (const char *fmt, ...)
	DBGATTR;
#endif

#ifdef DEBUG_ALLOC
#define malloc(a)   Dbg_Malloc (__FILE__,__LINE__,a)
#define calloc(a,b) Dbg_Calloc (__FILE__,__LINE__,a,b)
#define free(a)     Dbg_Free   (__FILE__,__LINE__,a)
#endif

/*
 * global prototypes
 */

#if defined(__GNUC__) && !defined(DEBUG_FILE)
#define Dbg_File(fmt,...)  (void)0
#else
	 extern void Dbg_File (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_CONFIG)
#define Dbg_Config(fmt,...)  (void)0
#else
	 extern void Dbg_Config (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_LEVEL)
#define Dbg_Level(fmt,...)  (void)0
#else
	 extern void Dbg_Level (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_GAME)
#define Dbg_Game(fmt,...)  (void)0
#else
	 extern void Dbg_Game (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_ACTION)
#define Dbg_Action(fmt,...)  (void)0
#else
	 extern void Dbg_Action (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_NETWORK)
#define Dbg_Network(fmt,...)  (void)0
#else
	 extern void Dbg_Network (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_SERVER)
#define Dbg_Server(fmt,...)  (void)0
#else
	 extern void Dbg_Server (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_CLIENT)
#define Dbg_Client(fmt,...)  (void)0
#else
	 extern void Dbg_Client (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_USER)
#define Dbg_User(fmt,...)  (void)0
#else
	 extern void Dbg_User (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_LISTEN)
#define Dbg_Listen(fmt,...)  (void)0
#else
	 extern void Dbg_Listen (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_STREAM)
#define Dbg_Stream(fmt,...)  (void)0
#else
	 extern void Dbg_Stream (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_S2C)
#define Dbg_S2C(fmt,...)  (void)0
#else
	 extern void Dbg_S2C (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_C2S)
#define Dbg_C2S(fmt,...)  (void)0
#else
	 extern void Dbg_C2S (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_X2C)
#define Dbg_X2C(fmt,...)  (void)0
#else
	 extern void Dbg_X2C (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_C2X)
#define Dbg_C2X(fmt,...)  (void)0
#else
	 extern void Dbg_C2X (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_C2B)
#define Dbg_C2B(fmt,...)  (void)0
#else
	 extern void Dbg_C2B (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_DGRAM)
#define Dbg_Dgram(fmt,...)  (void)0
#else
	 extern void Dbg_Dgram (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_D2C)
#define Dbg_D2C(fmt,...)  (void)0
#else
	 extern void Dbg_D2C (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_D2S)
#define Dbg_D2S(fmt,...)  (void)0
#else
	 extern void Dbg_D2S (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_BROWSE)
#define Dbg_Browse(fmt,...)  (void)0
#else
	 extern void Dbg_Browse (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_NEWGAME)
#define Dbg_Newgame(fmt,...)  (void)0
#else
	 extern void Dbg_Newgame (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_REPLY)
#define Dbg_Reply(fmt,...)  (void)0
#else
	 extern void Dbg_Reply (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_QUERY)
#define Dbg_Query(fmt,...)  (void)0
#else
	 extern void Dbg_Query (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_CENTRAL)
#define Dbg_Central(fmt,...)  (void)0
#else
	 extern void Dbg_Central (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_COMM)
#define Dbg_Comm(fmt,...)  (void)0
#else
	 extern void Dbg_Comm (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_SOCKET)
#define Dbg_Socket(fmt,...)  (void)0
#else
	 extern void Dbg_Socket (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_VERSION)
#define Dbg_Version(fmt,...)  (void)0
#else
	 extern void Dbg_Version (const char *fmt, ...) DBGATTR;
#endif

#if defined(__GNUC__) && !defined(DEBUG_CHAT)
#define Dbg_Chat(fmt,...)  (void)0
#else
	 extern void Dbg_Chat (const char *fmt, ...) DBGATTR;
#endif

#ifdef DEBUG_ALLOC
	 extern void *Dbg_Malloc (const char *file, int line, size_t nBytes);
	 extern void *Dbg_Calloc (const char *file, int line, size_t nElem, size_t sElem);
	 extern void Dbg_Free (const char *file, int line, void *ptr);
	 extern void Dbg_Vfree (const char *file, int line, void *ptr);
	 extern void Dbg_FinishAlloc (void);
#endif

#endif
/*
 * end of file alloc.h
 */