Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3598 was 3597, checked in by bensch, 20 years ago

orxonox/trunk: Light is now a World-entity.

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