Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4063 was 3966, checked in by bensch, 20 years ago

orxonox/trunk: merged branches/particleEngine into the trunk, because of the new vector class
merged with command:
svn merge -r 3922:HEAD particleEngine/ ../trunk/

not merged src/story_entities/world.cc. will do this at a later time (do not forget)

File size: 5.4 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#include "confincl.h"
29
30#include <stdio.h>
31
32// DEFINE ERROR MODES
33#define NO              0
34#define ERR             1
35#define WARN            2
36#define INFO            3
37#define DEBUGING        4
38#define vDEBUGING       5
39
40extern int verbose;
41
42//definitions
43#ifndef MODULAR_DEBUG
44#define HARD_DEBUG_LEVEL DEBUG
45#define SOFT_DEBUG_LEVEL verbose
46#else /* MODULAR_DEBUG */
47#ifndef DEBUG_MODULE_SOFT
48#define SOFT_DEBUG_LEVEL verbose
49#else /* DEBUG_MODULE_SOFT */
50#define SOFT_DEBUG_LEVEL DEBUG_MODULE_SOFT
51#endif /* DEBUG_MODULE_SOFT */
52
53#ifndef DEBUG_SPECIAL_MODULE
54#define HARD_DEBUG_LEVEL DEBUG
55#else /* DEBUG_SPECIAL_MODULE */
56// DEFINE MODULES
57#define DEBUG_MODULE_ORXONOX            0
58#define DEBUG_MODULE_WORLD              1
59#define DEBUG_MODULE_PNODE              1
60#define DEBUG_MODULE_WORLD_ENTITY       0
61#define DEBUG_MODULE_COMMAND_NODE       0
62#define DEBUG_MODULE_GRAPHICS           0
63#define DEBUG_MODULE_LOAD               0
64
65#define DEBUG_MODULE_IMPORTER           3
66#define DEBUG_MODULE_TRACK_MANAGER      0
67#define DEBUG_MODULE_GARBAGE_COLLECTOR  0
68#define DEBUG_MODULE_LIGHT              0
69#define DEBUG_MODULE_PLAYER             1
70#define DEBUG_MODULE_WEAPON             3
71#define DEBUG_MODULE_MATH               0
72#define DEBUG_MODULE_FONT               1
73#define DEBUG_MODULE_ANIM               1
74#define DEBUG_MODULE_PARTICLE           4
75
76#define DEBUG_MODULE_NULL_PARENT        0
77
78
79#define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE
80#endif /* DEBUG_SPECIAL_MODULE */
81#endif /* MODULAR_DEBUG */
82///////////////////////////////////////////////////
83/// PRINTF: prints with filename and linenumber ///
84///////////////////////////////////////////////////
85
86#ifdef DEBUG
87
88#define PRINTF(x) \
89           PRINTF ## x
90
91#if HARD_DEBUG_LEVEL >= ERR
92#define PRINTF1 \
93    if (SOFT_DEBUG_LEVEL >= ERR) \
94      printf("ERROR::%s:%d:", __FILE__, __LINE__) && printf
95#else
96#define PRINTF1 if (NO)
97#endif
98     
99#if HARD_DEBUG_LEVEL >= WARN
100#define PRINTF2 \
101     if (SOFT_DEBUG_LEVEL >= WARN) \
102       printf("WARNING::%s:%d:", __FILE__, __LINE__) && printf
103         
104#else
105#define PRINTF2 if (NO)
106#endif
107     
108#if HARD_DEBUG_LEVEL >= INFO
109#define PRINTF3 \
110     if (SOFT_DEBUG_LEVEL >= INFO) \
111       printf("INFO::%s:%d:", __FILE__, __LINE__) && printf
112#else
113#define PRINTF3 if (NO)
114#endif
115     
116#if HARD_DEBUG_LEVEL >= DEBUGING
117#define PRINTF4 \
118     if (SOFT_DEBUG_LEVEL >= DEBUGING) \
119       printf("DEBUG::%s:%d:", __FILE__, __LINE__) && printf
120#else
121#define PRINTF4 if (NO)
122#endif
123     
124#if HARD_DEBUG_LEVEL >= vDEBUGING
125#define PRINTF5 \
126     if (SOFT_DEBUG_LEVEL >= vDEBUGING) \
127       printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf
128#else
129#define PRINTF5 if (NO)
130#endif
131   
132#else 
133#define PRINTF(x) if (NO)
134#endif
135
136#define PRINTF0 \
137    printf("%s:%d::", __FILE__, __LINE__) && printf
138
139
140///////////////////////////////////////////////////
141///  PRINT: just prints output as is            ///
142///////////////////////////////////////////////////
143#ifdef  DEBUG
144#define PRINT(x) \
145  PRINT ## x
146
147#if HARD_DEBUG_LEVEL >= ERR
148#define PRINT1  \
149  if (SOFT_DEBUG_LEVEL >= ERR)  \
150    printf
151#else
152#define PRINT1 if (NO)
153#endif
154
155#if HARD_DEBUG_LEVEL >= WARN
156#define PRINT2 \
157  if (SOFT_DEBUG_LEVEL >= WARN) \
158    printf
159
160#else
161#define PRINT2 if (NO)
162#endif
163
164#if HARD_DEBUG_LEVEL >= INFO
165#define PRINT3 \
166  if (SOFT_DEBUG_LEVEL >= INFO) \
167    printf
168#else
169#define PRINT3 if (NO)
170#endif
171
172#if HARD_DEBUG_LEVEL >= DEBUGING
173#define PRINT4 \
174  if (SOFT_DEBUG_LEVEL >= DEBUGING) \
175    printf
176#else
177#define PRINT4 if (NO)
178#endif
179
180#if HARD_DEBUG_LEVEL >= vDEBUGING
181#define PRINT5 \
182     if (SOFT_DEBUG_LEVEL >= vDEBUGING) \
183       printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf
184#else
185#define PRINT5 if (NO)
186#endif
187
188
189#else 
190#define PRINT(x) if (NO)
191#endif
192
193#define PRINT0 \
194  printf
195
196///////////////////////////////////////////////////
197/// COUT: simple cout print with verbose-check  ///
198///////////////////////////////////////////////////
199#ifdef  DEBUG
200#define COUT(x) \
201           COUT ## x
202
203#if HARD_DEBUG_LEVEL >= 1
204#define COUT1 \
205    if (SOFT_DEBUG_LEVEL >= 1 ) \
206      cout
207#else
208#define COUT1 if (NO) cout
209#endif
210     
211#if HARD_DEBUG_LEVEL >= 2
212#define COUT2 \
213     if (SOFT_DEBUG_LEVEL >= 2 ) \
214       cout
215
216#else
217#define COUT2 if (NO) cout
218#endif
219     
220#if HARD_DEBUG_LEVEL >= 3
221#define COUT3 \
222     if (SOFT_DEBUG_LEVEL >= 3 ) \
223       cout
224#else
225#define COUT3 if (NO) cout
226#endif
227     
228#if HARD_DEBUG_LEVEL >= 4
229#define COUT4 \
230     if (SOFT_DEBUG_LEVEL >= 4 ) \
231       cout
232#else
233#define COUT4 if (NO) cout
234#endif
235     
236     
237#else 
238#define COUT(x) if (NO) cout
239#endif
240
241#define COUT0 \
242           cout
243
244#endif /* _DEBUG_H */
Note: See TracBrowser for help on using the repository browser.