Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/height_map/src/defs/debug.h @ 6265

Last change on this file since 6265 was 5996, checked in by patrick, 19 years ago

orxonox/trunk: merged network branche into trunk with command svn merge -r 5824:HEAD

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