Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/2d-recalc/src/defs/debug.h @ 5924

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

oroxnox/trunk: gui extends element2D

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