Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/levelloader/src/defs/debug.h @ 4052

Last change on this file since 4052 was 3746, checked in by chris, 20 years ago

orxonox/branches/levelloader: Merged trunk into branch… still not working though…

File size: 5.2 KB
RevLine 
[3395]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.
[3605]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
[3395]23*/ 
24
[3204]25#ifndef _DEBUG_H
26#define _DEBUG_H
27
[3530]28#if HAVE_CONFIG_H
29#include <config.h> 
30#endif
31
32#include <stdio.h>
33
[3605]34// DEFINE ERROR MODES
[3395]35#define NO              0
[3480]36#define ERR             1
37#define WARN            2
38#define INFO            3
[3395]39#define DEBUGING        4
[3605]40#define vDEBUGING       5
[3293]41
[3605]42extern int verbose;
43
44//definitions
45#ifndef MODULAR_DEBUG
46#define HARD_DEBUG_LEVEL DEBUG
47#define SOFT_DEBUG_LEVEL verbose
48#else /* MODULAR_DEBUG */
49#ifndef DEBUG_MODULE_SOFT
50#define SOFT_DEBUG_LEVEL verbose
51#else /* DEBUG_MODULE_SOFT */
52#define SOFT_DEBUG_LEVEL DEBUG_MODULE_SOFT
53#endif /* DEBUG_MODULE_SOFT */
54
55#ifndef DEBUG_SPECIAL_MODULE
56#define HARD_DEBUG_LEVEL DEBUG
57#else /* DEBUG_SPECIAL_MODULE */
58// DEFINE MODULES \\
59#define DEBUG_MODULE_ORXONOX            0
60#define DEBUG_MODULE_WORLD              0
[3746]61#define DEBUG_MODULE_PNODE              3
[3605]62#define DEBUG_MODULE_WORLD_ENTITY       0
63#define DEBUG_MODULE_COMMAND_NODE       0
[3746]64#define DEBUG_MODULE_GRAPHICS           0
65#define DEBUG_MODULE_LOAD               0
[3605]66
67#define DEBUG_MODULE_IMPORTER           0
68#define DEBUG_MODULE_TRACK_MANAGER      0
[3746]69#define DEBUG_MODULE_GARBAGE_COLLECTOR  0
70#define DEBUG_MODULE_LIGHT              0
71#define DEBUG_MODULE_PLAYER             3
[3605]72#define DEBUG_MODULE_MATH               0
73
74#define DEBUG_MODULE_NULL_PARENT        0
75
76
77#define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE
78#endif /* DEBUG_SPECIAL_MODULE */
79#endif /* MODULAR_DEBUG */
[3293]80///////////////////////////////////////////////////
81/// PRINTF: prints with filename and linenumber ///
82///////////////////////////////////////////////////
[3605]83
[3433]84#ifdef DEBUG
[3605]85
[3205]86#define PRINTF(x) \
87           PRINTF ## x
[3605]88
89#if HARD_DEBUG_LEVEL >= ERR
[3205]90#define PRINTF1 \
[3605]91    if (SOFT_DEBUG_LEVEL >= ERR) \
92      printf("ERROR::%s:%d:", __FILE__, __LINE__) && printf
[3205]93#else
[3395]94#define PRINTF1 if (NO)
[3205]95#endif
96     
[3605]97#if HARD_DEBUG_LEVEL >= WARN
[3205]98#define PRINTF2 \
[3605]99     if (SOFT_DEBUG_LEVEL >= WARN) \
100       printf("WARNING::%s:%d:", __FILE__, __LINE__) && printf
[3206]101         
[3205]102#else
[3395]103#define PRINTF2 if (NO)
[3205]104#endif
105     
[3605]106#if HARD_DEBUG_LEVEL >= INFO
[3205]107#define PRINTF3 \
[3605]108     if (SOFT_DEBUG_LEVEL >= INFO) \
109       printf("INFO::%s:%d:", __FILE__, __LINE__) && printf
[3205]110#else
[3395]111#define PRINTF3 if (NO)
[3205]112#endif
113     
[3605]114#if HARD_DEBUG_LEVEL >= DEBUGING
[3205]115#define PRINTF4 \
[3605]116     if (SOFT_DEBUG_LEVEL >= DEBUGING) \
117       printf("DEBUG::%s:%d:", __FILE__, __LINE__) && printf
[3205]118#else
[3395]119#define PRINTF4 if (NO)
[3205]120#endif
121     
[3605]122#if HARD_DEBUG_LEVEL >= vDEBUGING
123#define PRINTF5 \
124     if (SOFT_DEBUG_LEVEL >= vDEBUGING) \
125       printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf
126#else
127#define PRINTF5 if (NO)
128#endif
129   
[3204]130#else 
[3395]131#define PRINTF(x) if (NO)
[3204]132#endif
133
[3206]134#define PRINTF0 \
[3212]135    printf("%s:%d::", __FILE__, __LINE__) && printf
[3204]136
[3293]137
138///////////////////////////////////////////////////
139///  PRINT: just prints output as is            ///
140///////////////////////////////////////////////////
141#ifdef  DEBUG
142#define PRINT(x) \
[3395]143  PRINT ## x
[3605]144
145#if HARD_DEBUG_LEVEL >= ERR
[3395]146#define PRINT1  \
[3605]147  if (SOFT_DEBUG_LEVEL >= ERR)  \
[3395]148    printf
[3293]149#else
[3395]150#define PRINT1 if (NO)
[3293]151#endif
[3395]152
[3605]153#if HARD_DEBUG_LEVEL >= WARN
[3293]154#define PRINT2 \
[3605]155  if (SOFT_DEBUG_LEVEL >= WARN) \
[3395]156    printf
[3293]157
158#else
[3395]159#define PRINT2 if (NO)
[3293]160#endif
[3395]161
[3605]162#if HARD_DEBUG_LEVEL >= INFO
[3293]163#define PRINT3 \
[3605]164  if (SOFT_DEBUG_LEVEL >= INFO) \
[3395]165    printf
166#else
167#define PRINT3 if (NO)
[3293]168#endif
[3395]169
[3605]170#if HARD_DEBUG_LEVEL >= DEBUGING
[3293]171#define PRINT4 \
[3605]172  if (SOFT_DEBUG_LEVEL >= DEBUGING) \
[3395]173    printf
[3293]174#else
[3395]175#define PRINT4 if (NO)
[3293]176#endif
[3395]177
[3605]178#if HARD_DEBUG_LEVEL >= vDEBUGING
179#define PRINT5 \
180     if (SOFT_DEBUG_LEVEL >= vDEBUGING) \
181       printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf
182#else
183#define PRINT5 if (NO)
184#endif
[3395]185
[3605]186
[3293]187#else 
[3395]188#define PRINT(x) if (NO)
[3293]189#endif
190
191#define PRINT0 \
[3395]192  printf
[3293]193
194///////////////////////////////////////////////////
195/// COUT: simple cout print with verbose-check  ///
196///////////////////////////////////////////////////
197#ifdef  DEBUG
198#define COUT(x) \
199           COUT ## x
200
[3605]201#if HARD_DEBUG_LEVEL >= 1
[3293]202#define COUT1 \
[3605]203    if (SOFT_DEBUG_LEVEL >= 1 ) \
[3293]204      cout
205#else
[3395]206#define COUT1 if (NO) cout
[3293]207#endif
208     
[3605]209#if HARD_DEBUG_LEVEL >= 2
[3293]210#define COUT2 \
[3605]211     if (SOFT_DEBUG_LEVEL >= 2 ) \
[3293]212       cout
213
214#else
[3395]215#define COUT2 if (NO) cout
[3293]216#endif
217     
[3605]218#if HARD_DEBUG_LEVEL >= 3
[3293]219#define COUT3 \
[3605]220     if (SOFT_DEBUG_LEVEL >= 3 ) \
[3293]221       cout
222#else
[3395]223#define COUT3 if (NO) cout
[3293]224#endif
225     
[3605]226#if HARD_DEBUG_LEVEL >= 4
[3293]227#define COUT4 \
[3605]228     if (SOFT_DEBUG_LEVEL >= 4 ) \
[3293]229       cout
230#else
[3395]231#define COUT4 if (NO) cout
[3293]232#endif
233     
234     
235#else 
[3395]236#define COUT(x) if (NO) cout
[3293]237#endif
238
239#define COUT0 \
240           cout
241
[3204]242#endif /* _DEBUG_H */
Note: See TracBrowser for help on using the repository browser.