Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: the Sky is farther now

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