Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3814 was 3813, checked in by patrick, 20 years ago

orxonox/trunk: finished work on tweaking pnode. pnode is now as fast as it can get:)

File size: 5.3 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.
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
[3590]28#if HAVE_CONFIG_H
29#include <config.h> 
30#endif
31
32#include <stdio.h>
33
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
[3548]40#define vDEBUGING       5
[3293]41
[3592]42extern int verbose;
43
[3601]44//definitions
[3592]45#ifndef MODULAR_DEBUG
46#define HARD_DEBUG_LEVEL DEBUG
[3601]47#define SOFT_DEBUG_LEVEL verbose
[3592]48#else /* MODULAR_DEBUG */
[3601]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
[3590]55#ifndef DEBUG_SPECIAL_MODULE
[3592]56#define HARD_DEBUG_LEVEL DEBUG
57#else /* DEBUG_SPECIAL_MODULE */
[3591]58// DEFINE MODULES \\
[3655]59#define DEBUG_MODULE_ORXONOX            0
[3813]60#define DEBUG_MODULE_WORLD              1
[3752]61#define DEBUG_MODULE_PNODE              1
[3655]62#define DEBUG_MODULE_WORLD_ENTITY       0
[3688]63#define DEBUG_MODULE_COMMAND_NODE       0
[3655]64#define DEBUG_MODULE_GRAPHICS           0
[3685]65#define DEBUG_MODULE_LOAD               0
[3591]66
[3752]67#define DEBUG_MODULE_IMPORTER           1
[3655]68#define DEBUG_MODULE_TRACK_MANAGER      0
[3688]69#define DEBUG_MODULE_GARBAGE_COLLECTOR  0
[3655]70#define DEBUG_MODULE_LIGHT              0
[3752]71#define DEBUG_MODULE_PLAYER             1
[3655]72#define DEBUG_MODULE_MATH               0
[3790]73#define DEBUG_MODULE_FONT               4
[3812]74#define DEBUG_MODULE_ANIM               3
[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.