Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3621 was 3617, checked in by bensch, 20 years ago

orxonox/trunk: little fix to graphicsEngine, now the different resolution-types are outputted. also there is a fix from debug.h all warnings are shown now

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