Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3879 was 3875, checked in by patrick, 20 years ago

orxonox/trunk: weapon manager now works in player, cleaning up the rest

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