Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: the Sky is farther now

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