Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/heightMap/src/defs/debug.h @ 5045

Last change on this file since 5045 was 4122, checked in by bensch, 20 years ago

orxonox/branches/heightMap: merged the Trunk back into branches/heightMap:
merged with Command
svn merge -r 3918:HEAD trunk branches/heightMap
conflicts resolved in favor of the Trunk

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