Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4855 was 4852, checked in by patrick, 19 years ago

split the constructor into init and both constr. some debug output

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