Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3924 was 3875, checked in by patrick, 20 years ago

orxonox/trunk: weapon manager now works in player, cleaning up the rest

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