Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: no more movement at the end of the Track

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