Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: even less debug-info

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