Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: better definition of debug.h

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