Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: remake of the SoundEngine (faster, and millions of SoundSources can be defined, as Many are not needed for playing

File size: 5.4 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/*!
[5039]17 * @file debug.h
[4836]18  *  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"
[5174]29#include "shell_buffer.h"
[3590]30
31#include <stdio.h>
32
33// DEFINE ERROR MODES
[3395]34#define NO              0
[3480]35#define ERR             1
36#define WARN            2
37#define INFO            3
[4608]38//#define DEBUG           4
[4373]39#define vDEBUG          5
[3293]40
[3592]41extern int verbose;
42
[3601]43//definitions
[3592]44#ifndef MODULAR_DEBUG
[5440]45 #define HARD_DEBUG_LEVEL DEBUG
46 #define SOFT_DEBUG_LEVEL verbose
[3592]47#else /* MODULAR_DEBUG */
[5440]48 #ifndef DEBUG_MODULE_SOFT
49  #define SOFT_DEBUG_LEVEL verbose
50 #else /* DEBUG_MODULE_SOFT */
51  #define SOFT_DEBUG_LEVEL DEBUG_MODULE_SOFT
52 #endif /* DEBUG_MODULE_SOFT */
[3601]53
[5440]54 #ifndef DEBUG_SPECIAL_MODULE
55  #define HARD_DEBUG_LEVEL DEBUG
56 #else /* DEBUG_SPECIAL_MODULE */
57  ////////////////////
58  // DEFINE MODULES //
59  ////////////////////
60  // FRAMEWORK
61  #define DEBUG_MODULE_BASE                  2
62  #define DEBUG_MODULE_ORXONOX               2
63  #define DEBUG_MODULE_WORLD                 2
64  #define DEBUG_MODULE_NETWORK               2
[5300]65
[5440]66  // LOADING
67  #define DEBUG_MODULE_LOAD                  2
68  #define DEBUG_MODULE_IMPORTER              2
[3591]69
[5440]70  // ENGINES
71  #define DEBUG_MODULE_GRAPHICS              2
[5476]72  #define DEBUG_MODULE_EVENT                 2
[5440]73  #define DEBUG_MODULE_PHYSICS               2
74  #define DEBUG_MODULE_GARBAGE_COLLECTOR     2
75  #define DEBUG_MODULE_OBJECT_MANAGER        2
76  #define DEBUG_MODULE_ANIM                  2
77  #define DEBUG_MODULE_COLLISON_DETECTION    2
78  #define DEBUG_MODULE_SPATIAL_SEPARATION    2
79  #define DEBUG_MODULE_GUI                   2
[5930]80  #define DEBUG_MODULE_SOUND                 2
[5300]81
[5440]82  // MISC
83  #define DEBUG_MODULE_TRACK_MANAGER         2
84  #define DEBUG_MODULE_MATH                  2
[5300]85
[5440]86  #define DEBUG_MODULE_PNODE                 2
87  #define DEBUG_MODULE_WORLD_ENTITY          2
[5300]88
[5440]89  #define DEBUG_MODULE_WEAPON                2
[3439]90
[5440]91  #define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE
92
93 #endif /* DEBUG_SPECIAL_MODULE */
[3592]94#endif /* MODULAR_DEBUG */
[4373]95
[3293]96///////////////////////////////////////////////////
97/// PRINTF: prints with filename and linenumber ///
98///////////////////////////////////////////////////
[4373]99#define PRINTFNO      PRINTF0
100#define PRINTFERR     PRINTF1
101#define PRINTFWARN    PRINTF2
102#define PRINTFINFO    PRINTF3
103#define PRINTFDEBUG   PRINTF4
104#define PRINTFVDEBUG  PRINTF5
[3293]105
[5183]106#if DEBUG <= 3
[5076]107#define PRINTF(x)        PRINT(x)
[5183]108#endif
[5822]109#ifndef NO_SHELL
[5174]110#define PRINT_EXEC       ShellBuffer::addBufferLineStatic
[5822]111#else /* NO_SHELL */
112#define PRINT_EXEC       printf
113#endif
[5075]114
[5076]115#ifndef PRINTF
[3433]116#ifdef DEBUG
[3590]117
[3205]118#define PRINTF(x) \
119           PRINTF ## x
120
[3592]121#if HARD_DEBUG_LEVEL >= ERR
[3205]122#define PRINTF1 \
[3601]123    if (SOFT_DEBUG_LEVEL >= ERR) \
[5299]124      printf("(EE)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
[4608]125#else
[3395]126#define PRINTF1 if (NO)
[3205]127#endif
[4608]128
[3592]129#if HARD_DEBUG_LEVEL >= WARN
[3205]130#define PRINTF2 \
[3601]131     if (SOFT_DEBUG_LEVEL >= WARN) \
[5299]132       printf("(WW)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
[4608]133
134#else
[3395]135#define PRINTF2 if (NO)
[3205]136#endif
[4608]137
[3592]138#if HARD_DEBUG_LEVEL >= INFO
[3205]139#define PRINTF3 \
[3601]140     if (SOFT_DEBUG_LEVEL >= INFO) \
[5299]141       printf("(II)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
[4608]142#else
[3395]143#define PRINTF3 if (NO)
[3205]144#endif
[4608]145
[4373]146#if HARD_DEBUG_LEVEL >= DEBUG
[3205]147#define PRINTF4 \
[4373]148     if (SOFT_DEBUG_LEVEL >= DEBUG) \
[5299]149       printf("(DD)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
[4608]150#else
[3395]151#define PRINTF4 if (NO)
[3205]152#endif
[4608]153
[4373]154#if HARD_DEBUG_LEVEL >= vDEBUG
[3548]155#define PRINTF5 \
[4373]156     if (SOFT_DEBUG_LEVEL >= vDEBUG) \
[5299]157       printf("(VD)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
[4608]158#else
[3548]159#define PRINTF5 if (NO)
160#endif
[4608]161
162#else
[3395]163#define PRINTF(x) if (NO)
[3204]164#endif
165
[3206]166#define PRINTF0 \
[5075]167    printf("%s:%d::", __FILE__, __LINE__) && PRINT_EXEC
[5076]168#endif
[3204]169
[3293]170///////////////////////////////////////////////////
171///  PRINT: just prints output as is            ///
172///////////////////////////////////////////////////
[4373]173#define PRINTNO      PRINT0
174#define PRINTERR     PRINT1
175#define PRINTWARN    PRINT2
176#define PRINTINFO    PRINT3
177#define PRINTDEBUG   PRINT4
178#define PRINTVDEBUG  PRINT5
179
[3293]180#ifdef  DEBUG
181#define PRINT(x) \
[3395]182  PRINT ## x
[3293]183
[3592]184#if HARD_DEBUG_LEVEL >= ERR
[4608]185#define PRINT1  \
186  if (SOFT_DEBUG_LEVEL >= ERR)  \
[5075]187    PRINT_EXEC
[4608]188#else
[3395]189#define PRINT1 if (NO)
[3293]190#endif
[3395]191
[3592]192#if HARD_DEBUG_LEVEL >= WARN
[3293]193#define PRINT2 \
[3601]194  if (SOFT_DEBUG_LEVEL >= WARN) \
[5075]195    PRINT_EXEC
[3293]196
[4608]197#else
[3395]198#define PRINT2 if (NO)
[3293]199#endif
[3395]200
[3592]201#if HARD_DEBUG_LEVEL >= INFO
[3293]202#define PRINT3 \
[3601]203  if (SOFT_DEBUG_LEVEL >= INFO) \
[5075]204    PRINT_EXEC
[4608]205#else
[3395]206#define PRINT3 if (NO)
[3293]207#endif
[3395]208
[4373]209#if HARD_DEBUG_LEVEL >= DEBUG
[3293]210#define PRINT4 \
[4373]211  if (SOFT_DEBUG_LEVEL >= DEBUG) \
[5075]212    PRINT_EXEC
[4608]213#else
[3395]214#define PRINT4 if (NO)
[3293]215#endif
[3395]216
[4373]217#if HARD_DEBUG_LEVEL >= vDEBUG
[3548]218#define PRINT5 \
[4373]219     if (SOFT_DEBUG_LEVEL >= vDEBUG) \
[5299]220       PRINT_EXEC
[4608]221#else
[3548]222#define PRINT5 if (NO)
223#endif
[3395]224
[3548]225
[4608]226#else
[3395]227#define PRINT(x) if (NO)
[3293]228#endif
229
230#define PRINT0 \
[5075]231  PRINT_EXEC
[3293]232
[3204]233#endif /* _DEBUG_H */
Note: See TracBrowser for help on using the repository browser.