Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: implemented event subscribe function

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