Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/physics/src/defs/debug.h @ 4225

Last change on this file since 4225 was 4178, checked in by bensch, 20 years ago

orxonox/branches/physics: merged the Trunk into the physics Branche again:
merged with command:
svn merge ../trunk physics -r 3953:HEAD
no important conflicts

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