Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4289 was 4287, checked in by patrick, 19 years ago

orxonox/trunk: implemented the objectmanager debug functon, some small fixed in the ol code

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