Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/defs/debug.h @ 3715

Last change on this file since 3715 was 3688, checked in by patrick, 20 years ago

orxonox/trunk: added GARBAGECOLLECTOR to debug module and changed the way the speed is set.

File size: 5.2 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16/*!
17    \file debug.h
18    \brief Handles output to console for different Verbose-Modes.
19
20    There are two main modes HARD and SOFT. HARD is precessed during compileTime where SOFT is for runtime.
21    \li HARD: One can choose between different modes. see: // DEFINE_MODULES \\
22    \li SOFT: If you want each module can have its own variable for processing. just pass it to DEBUG_MODULE_SOFT
23*/ 
24
25#ifndef _DEBUG_H
26#define _DEBUG_H
27
28#if HAVE_CONFIG_H
29#include <config.h> 
30#endif
31
32#include <stdio.h>
33
34// DEFINE ERROR MODES
35#define NO              0
36#define ERR             1
37#define WARN            2
38#define INFO            3
39#define DEBUGING        4
40#define vDEBUGING       5
41
42extern int verbose;
43
44//definitions
45#ifndef MODULAR_DEBUG
46#define HARD_DEBUG_LEVEL DEBUG
47#define SOFT_DEBUG_LEVEL verbose
48#else /* MODULAR_DEBUG */
49#ifndef DEBUG_MODULE_SOFT
50#define SOFT_DEBUG_LEVEL verbose
51#else /* DEBUG_MODULE_SOFT */
52#define SOFT_DEBUG_LEVEL DEBUG_MODULE_SOFT
53#endif /* DEBUG_MODULE_SOFT */
54
55#ifndef DEBUG_SPECIAL_MODULE
56#define HARD_DEBUG_LEVEL DEBUG
57#else /* DEBUG_SPECIAL_MODULE */
58// DEFINE MODULES \\
59#define DEBUG_MODULE_ORXONOX            0
60#define DEBUG_MODULE_WORLD              0
61#define DEBUG_MODULE_PNODE              3
62#define DEBUG_MODULE_WORLD_ENTITY       0
63#define DEBUG_MODULE_COMMAND_NODE       0
64#define DEBUG_MODULE_GRAPHICS           0
65#define DEBUG_MODULE_LOAD               0
66
67#define DEBUG_MODULE_IMPORTER           0
68#define DEBUG_MODULE_TRACK_MANAGER      0
69#define DEBUG_MODULE_GARBAGE_COLLECTOR  0
70#define DEBUG_MODULE_LIGHT              0
71#define DEBUG_MODULE_PLAYER             3
72#define DEBUG_MODULE_MATH               0
73
74#define DEBUG_MODULE_NULL_PARENT        0
75
76
77#define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE
78#endif /* DEBUG_SPECIAL_MODULE */
79#endif /* MODULAR_DEBUG */
80///////////////////////////////////////////////////
81/// PRINTF: prints with filename and linenumber ///
82///////////////////////////////////////////////////
83
84#ifdef DEBUG
85
86#define PRINTF(x) \
87           PRINTF ## x
88
89#if HARD_DEBUG_LEVEL >= ERR
90#define PRINTF1 \
91    if (SOFT_DEBUG_LEVEL >= ERR) \
92      printf("ERROR::%s:%d:", __FILE__, __LINE__) && printf
93#else
94#define PRINTF1 if (NO)
95#endif
96     
97#if HARD_DEBUG_LEVEL >= WARN
98#define PRINTF2 \
99     if (SOFT_DEBUG_LEVEL >= WARN) \
100       printf("WARNING::%s:%d:", __FILE__, __LINE__) && printf
101         
102#else
103#define PRINTF2 if (NO)
104#endif
105     
106#if HARD_DEBUG_LEVEL >= INFO
107#define PRINTF3 \
108     if (SOFT_DEBUG_LEVEL >= INFO) \
109       printf("INFO::%s:%d:", __FILE__, __LINE__) && printf
110#else
111#define PRINTF3 if (NO)
112#endif
113     
114#if HARD_DEBUG_LEVEL >= DEBUGING
115#define PRINTF4 \
116     if (SOFT_DEBUG_LEVEL >= DEBUGING) \
117       printf("DEBUG::%s:%d:", __FILE__, __LINE__) && printf
118#else
119#define PRINTF4 if (NO)
120#endif
121     
122#if HARD_DEBUG_LEVEL >= vDEBUGING
123#define PRINTF5 \
124     if (SOFT_DEBUG_LEVEL >= vDEBUGING) \
125       printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf
126#else
127#define PRINTF5 if (NO)
128#endif
129   
130#else 
131#define PRINTF(x) if (NO)
132#endif
133
134#define PRINTF0 \
135    printf("%s:%d::", __FILE__, __LINE__) && printf
136
137
138///////////////////////////////////////////////////
139///  PRINT: just prints output as is            ///
140///////////////////////////////////////////////////
141#ifdef  DEBUG
142#define PRINT(x) \
143  PRINT ## x
144
145#if HARD_DEBUG_LEVEL >= ERR
146#define PRINT1  \
147  if (SOFT_DEBUG_LEVEL >= ERR)  \
148    printf
149#else
150#define PRINT1 if (NO)
151#endif
152
153#if HARD_DEBUG_LEVEL >= WARN
154#define PRINT2 \
155  if (SOFT_DEBUG_LEVEL >= WARN) \
156    printf
157
158#else
159#define PRINT2 if (NO)
160#endif
161
162#if HARD_DEBUG_LEVEL >= INFO
163#define PRINT3 \
164  if (SOFT_DEBUG_LEVEL >= INFO) \
165    printf
166#else
167#define PRINT3 if (NO)
168#endif
169
170#if HARD_DEBUG_LEVEL >= DEBUGING
171#define PRINT4 \
172  if (SOFT_DEBUG_LEVEL >= DEBUGING) \
173    printf
174#else
175#define PRINT4 if (NO)
176#endif
177
178#if HARD_DEBUG_LEVEL >= vDEBUGING
179#define PRINT5 \
180     if (SOFT_DEBUG_LEVEL >= vDEBUGING) \
181       printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf
182#else
183#define PRINT5 if (NO)
184#endif
185
186
187#else 
188#define PRINT(x) if (NO)
189#endif
190
191#define PRINT0 \
192  printf
193
194///////////////////////////////////////////////////
195/// COUT: simple cout print with verbose-check  ///
196///////////////////////////////////////////////////
197#ifdef  DEBUG
198#define COUT(x) \
199           COUT ## x
200
201#if HARD_DEBUG_LEVEL >= 1
202#define COUT1 \
203    if (SOFT_DEBUG_LEVEL >= 1 ) \
204      cout
205#else
206#define COUT1 if (NO) cout
207#endif
208     
209#if HARD_DEBUG_LEVEL >= 2
210#define COUT2 \
211     if (SOFT_DEBUG_LEVEL >= 2 ) \
212       cout
213
214#else
215#define COUT2 if (NO) cout
216#endif
217     
218#if HARD_DEBUG_LEVEL >= 3
219#define COUT3 \
220     if (SOFT_DEBUG_LEVEL >= 3 ) \
221       cout
222#else
223#define COUT3 if (NO) cout
224#endif
225     
226#if HARD_DEBUG_LEVEL >= 4
227#define COUT4 \
228     if (SOFT_DEBUG_LEVEL >= 4 ) \
229       cout
230#else
231#define COUT4 if (NO) cout
232#endif
233     
234     
235#else 
236#define COUT(x) if (NO) cout
237#endif
238
239#define COUT0 \
240           cout
241
242#endif /* _DEBUG_H */
Note: See TracBrowser for help on using the repository browser.