Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

trunk: less debug

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