Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4381 was 4381, checked in by bensch, 19 years ago

orxonox/trunk: made include more local. stdincl.h not in base_object.h anymore

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
[4381]76#define DEBUG_MODULE_PHYSICS            1
[4354]77#define DEBUG_MODULE_EVENT              3
[3439]78
[3655]79#define DEBUG_MODULE_NULL_PARENT        0
[3591]80
[3395]81
[3592]82#define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE
83#endif /* DEBUG_SPECIAL_MODULE */
84#endif /* MODULAR_DEBUG */
[4373]85
[3293]86///////////////////////////////////////////////////
87/// PRINTF: prints with filename and linenumber ///
88///////////////////////////////////////////////////
[4373]89#define PRINTFNO      PRINTF0
90#define PRINTFERR     PRINTF1
91#define PRINTFWARN    PRINTF2
92#define PRINTFINFO    PRINTF3
93#define PRINTFDEBUG   PRINTF4
94#define PRINTFVDEBUG  PRINTF5
[3293]95
[3433]96#ifdef DEBUG
[3590]97
[3205]98#define PRINTF(x) \
99           PRINTF ## x
100
[3592]101#if HARD_DEBUG_LEVEL >= ERR
[3205]102#define PRINTF1 \
[3601]103    if (SOFT_DEBUG_LEVEL >= ERR) \
[3511]104      printf("ERROR::%s:%d:", __FILE__, __LINE__) && printf
[3205]105#else
[3395]106#define PRINTF1 if (NO)
[3205]107#endif
108     
[3592]109#if HARD_DEBUG_LEVEL >= WARN
[3205]110#define PRINTF2 \
[3601]111     if (SOFT_DEBUG_LEVEL >= WARN) \
[3511]112       printf("WARNING::%s:%d:", __FILE__, __LINE__) && printf
[3206]113         
[3205]114#else
[3395]115#define PRINTF2 if (NO)
[3205]116#endif
117     
[3592]118#if HARD_DEBUG_LEVEL >= INFO
[3205]119#define PRINTF3 \
[3601]120     if (SOFT_DEBUG_LEVEL >= INFO) \
[3511]121       printf("INFO::%s:%d:", __FILE__, __LINE__) && printf
[3205]122#else
[3395]123#define PRINTF3 if (NO)
[3205]124#endif
125     
[4373]126#if HARD_DEBUG_LEVEL >= DEBUG
[3205]127#define PRINTF4 \
[4373]128     if (SOFT_DEBUG_LEVEL >= DEBUG) \
[3511]129       printf("DEBUG::%s:%d:", __FILE__, __LINE__) && printf
[3205]130#else
[3395]131#define PRINTF4 if (NO)
[3205]132#endif
133     
[4373]134#if HARD_DEBUG_LEVEL >= vDEBUG
[3548]135#define PRINTF5 \
[4373]136     if (SOFT_DEBUG_LEVEL >= vDEBUG) \
[3548]137       printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf
138#else
139#define PRINTF5 if (NO)
140#endif
141   
[3204]142#else 
[3395]143#define PRINTF(x) if (NO)
[3204]144#endif
145
[3206]146#define PRINTF0 \
[3212]147    printf("%s:%d::", __FILE__, __LINE__) && printf
[3204]148
[3293]149
150///////////////////////////////////////////////////
151///  PRINT: just prints output as is            ///
152///////////////////////////////////////////////////
[4373]153#define PRINTNO      PRINT0
154#define PRINTERR     PRINT1
155#define PRINTWARN    PRINT2
156#define PRINTINFO    PRINT3
157#define PRINTDEBUG   PRINT4
158#define PRINTVDEBUG  PRINT5
159
[3293]160#ifdef  DEBUG
161#define PRINT(x) \
[3395]162  PRINT ## x
[3293]163
[3592]164#if HARD_DEBUG_LEVEL >= ERR
[3395]165#define PRINT1  \
[3601]166  if (SOFT_DEBUG_LEVEL >= ERR)  \
[3395]167    printf
[3293]168#else
[3395]169#define PRINT1 if (NO)
[3293]170#endif
[3395]171
[3592]172#if HARD_DEBUG_LEVEL >= WARN
[3293]173#define PRINT2 \
[3601]174  if (SOFT_DEBUG_LEVEL >= WARN) \
[3395]175    printf
[3293]176
177#else
[3395]178#define PRINT2 if (NO)
[3293]179#endif
[3395]180
[3592]181#if HARD_DEBUG_LEVEL >= INFO
[3293]182#define PRINT3 \
[3601]183  if (SOFT_DEBUG_LEVEL >= INFO) \
[3395]184    printf
185#else
186#define PRINT3 if (NO)
[3293]187#endif
[3395]188
[4373]189#if HARD_DEBUG_LEVEL >= DEBUG
[3293]190#define PRINT4 \
[4373]191  if (SOFT_DEBUG_LEVEL >= DEBUG) \
[3395]192    printf
[3293]193#else
[3395]194#define PRINT4 if (NO)
[3293]195#endif
[3395]196
[4373]197#if HARD_DEBUG_LEVEL >= vDEBUG
[3548]198#define PRINT5 \
[4373]199     if (SOFT_DEBUG_LEVEL >= vDEBUG) \
[3548]200       printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf
201#else
202#define PRINT5 if (NO)
203#endif
[3395]204
[3548]205
[3293]206#else 
[3395]207#define PRINT(x) if (NO)
[3293]208#endif
209
210#define PRINT0 \
[3395]211  printf
[3293]212
[3204]213#endif /* _DEBUG_H */
Note: See TracBrowser for help on using the repository browser.