Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: merged the Network back to the trunk.
merged with command
svn merge https://svn.orxonox.net/orxonox/branches/network . -r6817:HEAD
no conflicts

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