Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: BaseObject with Debug-Level

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  *  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#include "shell_buffer.h"
30
31#include <stdio.h>
32
33// DEFINE ERROR MODES
34#define NO              0
35#define ERR             1
36#define WARN            2
37#define INFO            3
38//#define DEBUG           4
39#define vDEBUG          5
40
41extern int verbose;
42
43//definitions
44#ifndef MODULAR_DEBUG
45#define HARD_DEBUG_LEVEL DEBUG
46#define SOFT_DEBUG_LEVEL verbose
47#else /* MODULAR_DEBUG */
48#ifndef DEBUG_MODULE_SOFT
49#define SOFT_DEBUG_LEVEL verbose
50#else /* DEBUG_MODULE_SOFT */
51#define SOFT_DEBUG_LEVEL DEBUG_MODULE_SOFT
52#endif /* DEBUG_MODULE_SOFT */
53
54#ifndef DEBUG_SPECIAL_MODULE
55#define HARD_DEBUG_LEVEL DEBUG
56#else /* DEBUG_SPECIAL_MODULE */
57////////////////////
58// DEFINE MODULES //
59////////////////////
60// FRAMEWORK
61#define DEBUG_MODULE_BASE                  2
62#define DEBUG_MODULE_ORXONOX               2
63#define DEBUG_MODULE_WORLD                 2
64#define DEBUG_MODULE_NETWORK               2
65
66// LOADING
67#define DEBUG_MODULE_LOAD                  2
68#define DEBUG_MODULE_IMPORTER              2
69
70// ENGINES
71#define DEBUG_MODULE_GRAPHICS              2
72#define DEBUG_MODULE_EVENT                 2
73#define DEBUG_MODULE_PHYSICS               2
74#define DEBUG_MODULE_GARBAGE_COLLECTOR     2
75#define DEBUG_MODULE_OBJECT_MANAGER        2
76#define DEBUG_MODULE_ANIM                  2
77#define DEBUG_MODULE_COLLISON_DETECTION    2
78#define DEBUG_MODULE_SPATIAL_SEPARATION    2
79#define DEBUG_MODULE_GUI                   2
80
81// MISC
82#define DEBUG_MODULE_TRACK_MANAGER         2
83#define DEBUG_MODULE_MATH                  2
84
85#define DEBUG_MODULE_PNODE                 2
86#define DEBUG_MODULE_WORLD_ENTITY          2
87
88#define DEBUG_MODULE_WEAPON                2
89
90#define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE
91#endif /* DEBUG_SPECIAL_MODULE */
92#endif /* MODULAR_DEBUG */
93
94///////////////////////////////////////////////////
95/// PRINTF: prints with filename and linenumber ///
96///////////////////////////////////////////////////
97#define PRINTFNO      PRINTF0
98#define PRINTFERR     PRINTF1
99#define PRINTFWARN    PRINTF2
100#define PRINTFINFO    PRINTF3
101#define PRINTFDEBUG   PRINTF4
102#define PRINTFVDEBUG  PRINTF5
103
104#if DEBUG <= 3
105#define PRINTF(x)        PRINT(x)
106#endif
107#define PRINT_EXEC       ShellBuffer::addBufferLineStatic
108
109#ifndef PRINTF
110#ifdef DEBUG
111
112#define PRINTF(x) \
113           PRINTF ## x
114
115#if HARD_DEBUG_LEVEL >= ERR
116#define PRINTF1 \
117    if (SOFT_DEBUG_LEVEL >= ERR) \
118      printf("(EE)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
119#else
120#define PRINTF1 if (NO)
121#endif
122
123#if HARD_DEBUG_LEVEL >= WARN
124#define PRINTF2 \
125     if (SOFT_DEBUG_LEVEL >= WARN) \
126       printf("(WW)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
127
128#else
129#define PRINTF2 if (NO)
130#endif
131
132#if HARD_DEBUG_LEVEL >= INFO
133#define PRINTF3 \
134     if (SOFT_DEBUG_LEVEL >= INFO) \
135       printf("(II)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
136#else
137#define PRINTF3 if (NO)
138#endif
139
140#if HARD_DEBUG_LEVEL >= DEBUG
141#define PRINTF4 \
142     if (SOFT_DEBUG_LEVEL >= DEBUG) \
143       printf("(DD)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
144#else
145#define PRINTF4 if (NO)
146#endif
147
148#if HARD_DEBUG_LEVEL >= vDEBUG
149#define PRINTF5 \
150     if (SOFT_DEBUG_LEVEL >= vDEBUG) \
151       printf("(VD)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
152#else
153#define PRINTF5 if (NO)
154#endif
155
156#else
157#define PRINTF(x) if (NO)
158#endif
159
160#define PRINTF0 \
161    printf("%s:%d::", __FILE__, __LINE__) && PRINT_EXEC
162#endif
163
164///////////////////////////////////////////////////
165///  PRINT: just prints output as is            ///
166///////////////////////////////////////////////////
167#define PRINTNO      PRINT0
168#define PRINTERR     PRINT1
169#define PRINTWARN    PRINT2
170#define PRINTINFO    PRINT3
171#define PRINTDEBUG   PRINT4
172#define PRINTVDEBUG  PRINT5
173
174#ifdef  DEBUG
175#define PRINT(x) \
176  PRINT ## x
177
178#if HARD_DEBUG_LEVEL >= ERR
179#define PRINT1  \
180  if (SOFT_DEBUG_LEVEL >= ERR)  \
181    PRINT_EXEC
182#else
183#define PRINT1 if (NO)
184#endif
185
186#if HARD_DEBUG_LEVEL >= WARN
187#define PRINT2 \
188  if (SOFT_DEBUG_LEVEL >= WARN) \
189    PRINT_EXEC
190
191#else
192#define PRINT2 if (NO)
193#endif
194
195#if HARD_DEBUG_LEVEL >= INFO
196#define PRINT3 \
197  if (SOFT_DEBUG_LEVEL >= INFO) \
198    PRINT_EXEC
199#else
200#define PRINT3 if (NO)
201#endif
202
203#if HARD_DEBUG_LEVEL >= DEBUG
204#define PRINT4 \
205  if (SOFT_DEBUG_LEVEL >= DEBUG) \
206    PRINT_EXEC
207#else
208#define PRINT4 if (NO)
209#endif
210
211#if HARD_DEBUG_LEVEL >= vDEBUG
212#define PRINT5 \
213     if (SOFT_DEBUG_LEVEL >= vDEBUG) \
214       PRINT_EXEC
215#else
216#define PRINT5 if (NO)
217#endif
218
219
220#else
221#define PRINT(x) if (NO)
222#endif
223
224#define PRINT0 \
225  PRINT_EXEC
226
227#endif /* _DEBUG_H */
Note: See TracBrowser for help on using the repository browser.