Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3597 was 3597, checked in by bensch, 19 years ago

orxonox/trunk: Light is now a World-entity.

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