Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: better definition of debug.h

File size: 5.0 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
[4373]37#define DEBUG           4
38#define vDEBUG          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
[4287]58#define DEBUG_MODULE_WORLD              0
59#define DEBUG_MODULE_PNODE              0
[3655]60#define DEBUG_MODULE_WORLD_ENTITY       0
[4287]61#define DEBUG_MODULE_COMMAND_NODE       0
[3655]62#define DEBUG_MODULE_GRAPHICS           0
[4094]63#define DEBUG_MODULE_LOAD               2
[3591]64
[4287]65#define DEBUG_MODULE_IMPORTER           0
[3655]66#define DEBUG_MODULE_TRACK_MANAGER      0
[3688]67#define DEBUG_MODULE_GARBAGE_COLLECTOR  0
[4287]68#define DEBUG_MODULE_OBJECT_MANAGER     3
[3655]69#define DEBUG_MODULE_LIGHT              0
[3752]70#define DEBUG_MODULE_PLAYER             1
[4287]71#define DEBUG_MODULE_WEAPON             0
[3655]72#define DEBUG_MODULE_MATH               0
[3875]73#define DEBUG_MODULE_FONT               1
74#define DEBUG_MODULE_ANIM               1
[4287]75#define DEBUG_MODULE_PARTICLE           1
[4354]76#define DEBUG_MODULE_EVENT              3
[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 */
[4373]84
[3293]85///////////////////////////////////////////////////
86/// PRINTF: prints with filename and linenumber ///
87///////////////////////////////////////////////////
[4373]88#define PRINTFNO      PRINTF0
89#define PRINTFERR     PRINTF1
90#define PRINTFWARN    PRINTF2
91#define PRINTFINFO    PRINTF3
92#define PRINTFDEBUG   PRINTF4
93#define PRINTFVDEBUG  PRINTF5
[3293]94
[3433]95#ifdef DEBUG
[3590]96
[3205]97#define PRINTF(x) \
98           PRINTF ## x
99
[3592]100#if HARD_DEBUG_LEVEL >= ERR
[3205]101#define PRINTF1 \
[3601]102    if (SOFT_DEBUG_LEVEL >= ERR) \
[3511]103      printf("ERROR::%s:%d:", __FILE__, __LINE__) && printf
[3205]104#else
[3395]105#define PRINTF1 if (NO)
[3205]106#endif
107     
[3592]108#if HARD_DEBUG_LEVEL >= WARN
[3205]109#define PRINTF2 \
[3601]110     if (SOFT_DEBUG_LEVEL >= WARN) \
[3511]111       printf("WARNING::%s:%d:", __FILE__, __LINE__) && printf
[3206]112         
[3205]113#else
[3395]114#define PRINTF2 if (NO)
[3205]115#endif
116     
[3592]117#if HARD_DEBUG_LEVEL >= INFO
[3205]118#define PRINTF3 \
[3601]119     if (SOFT_DEBUG_LEVEL >= INFO) \
[3511]120       printf("INFO::%s:%d:", __FILE__, __LINE__) && printf
[3205]121#else
[3395]122#define PRINTF3 if (NO)
[3205]123#endif
124     
[4373]125#if HARD_DEBUG_LEVEL >= DEBUG
[3205]126#define PRINTF4 \
[4373]127     if (SOFT_DEBUG_LEVEL >= DEBUG) \
[3511]128       printf("DEBUG::%s:%d:", __FILE__, __LINE__) && printf
[3205]129#else
[3395]130#define PRINTF4 if (NO)
[3205]131#endif
132     
[4373]133#if HARD_DEBUG_LEVEL >= vDEBUG
[3548]134#define PRINTF5 \
[4373]135     if (SOFT_DEBUG_LEVEL >= vDEBUG) \
[3548]136       printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf
137#else
138#define PRINTF5 if (NO)
139#endif
140   
[3204]141#else 
[3395]142#define PRINTF(x) if (NO)
[3204]143#endif
144
[3206]145#define PRINTF0 \
[3212]146    printf("%s:%d::", __FILE__, __LINE__) && printf
[3204]147
[3293]148
149///////////////////////////////////////////////////
150///  PRINT: just prints output as is            ///
151///////////////////////////////////////////////////
[4373]152#define PRINTNO      PRINT0
153#define PRINTERR     PRINT1
154#define PRINTWARN    PRINT2
155#define PRINTINFO    PRINT3
156#define PRINTDEBUG   PRINT4
157#define PRINTVDEBUG  PRINT5
158
[3293]159#ifdef  DEBUG
160#define PRINT(x) \
[3395]161  PRINT ## x
[3293]162
[3592]163#if HARD_DEBUG_LEVEL >= ERR
[3395]164#define PRINT1  \
[3601]165  if (SOFT_DEBUG_LEVEL >= ERR)  \
[3395]166    printf
[3293]167#else
[3395]168#define PRINT1 if (NO)
[3293]169#endif
[3395]170
[3592]171#if HARD_DEBUG_LEVEL >= WARN
[3293]172#define PRINT2 \
[3601]173  if (SOFT_DEBUG_LEVEL >= WARN) \
[3395]174    printf
[3293]175
176#else
[3395]177#define PRINT2 if (NO)
[3293]178#endif
[3395]179
[3592]180#if HARD_DEBUG_LEVEL >= INFO
[3293]181#define PRINT3 \
[3601]182  if (SOFT_DEBUG_LEVEL >= INFO) \
[3395]183    printf
184#else
185#define PRINT3 if (NO)
[3293]186#endif
[3395]187
[4373]188#if HARD_DEBUG_LEVEL >= DEBUG
[3293]189#define PRINT4 \
[4373]190  if (SOFT_DEBUG_LEVEL >= DEBUG) \
[3395]191    printf
[3293]192#else
[3395]193#define PRINT4 if (NO)
[3293]194#endif
[3395]195
[4373]196#if HARD_DEBUG_LEVEL >= vDEBUG
[3548]197#define PRINT5 \
[4373]198     if (SOFT_DEBUG_LEVEL >= vDEBUG) \
[3548]199       printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf
200#else
201#define PRINT5 if (NO)
202#endif
[3395]203
[3548]204
[3293]205#else 
[3395]206#define PRINT(x) if (NO)
[3293]207#endif
208
209#define PRINT0 \
[3395]210  printf
[3293]211
[3204]212#endif /* _DEBUG_H */
Note: See TracBrowser for help on using the repository browser.