Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: some minor cleanup, of the mess i made with AutoMake-sh

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