Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/collision_detection/src/defs/debug.h @ 5957

Last change on this file since 5957 was 5882, checked in by patrick, 19 years ago

collision_detection: very much work on the cd engine, now the obbs do assemble again, but not yet correctly. Much more debug work to come..

File size: 5.3 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
[5717]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
[5882]77  #define DEBUG_MODULE_COLLISION_DETECTION   4
[5440]78  #define DEBUG_MODULE_SPATIAL_SEPARATION    2
79  #define DEBUG_MODULE_GUI                   2
[5300]80
[5440]81  // MISC
82  #define DEBUG_MODULE_TRACK_MANAGER         2
83  #define DEBUG_MODULE_MATH                  2
[5300]84
[5440]85  #define DEBUG_MODULE_PNODE                 2
86  #define DEBUG_MODULE_WORLD_ENTITY          2
[5300]87
[5440]88  #define DEBUG_MODULE_WEAPON                2
[3439]89
[5440]90  #define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE
91
92 #endif /* DEBUG_SPECIAL_MODULE */
[3592]93#endif /* MODULAR_DEBUG */
[4373]94
[3293]95///////////////////////////////////////////////////
96/// PRINTF: prints with filename and linenumber ///
97///////////////////////////////////////////////////
[4373]98#define PRINTFNO      PRINTF0
99#define PRINTFERR     PRINTF1
100#define PRINTFWARN    PRINTF2
101#define PRINTFINFO    PRINTF3
102#define PRINTFDEBUG   PRINTF4
103#define PRINTFVDEBUG  PRINTF5
[3293]104
[5183]105#if DEBUG <= 3
[5076]106#define PRINTF(x)        PRINT(x)
[5183]107#endif
[5174]108#define PRINT_EXEC       ShellBuffer::addBufferLineStatic
[5075]109
[5076]110#ifndef PRINTF
[3433]111#ifdef DEBUG
[3590]112
[3205]113#define PRINTF(x) \
114           PRINTF ## x
115
[3592]116#if HARD_DEBUG_LEVEL >= ERR
[3205]117#define PRINTF1 \
[3601]118    if (SOFT_DEBUG_LEVEL >= ERR) \
[5299]119      printf("(EE)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
[4608]120#else
[3395]121#define PRINTF1 if (NO)
[3205]122#endif
[4608]123
[3592]124#if HARD_DEBUG_LEVEL >= WARN
[3205]125#define PRINTF2 \
[3601]126     if (SOFT_DEBUG_LEVEL >= WARN) \
[5299]127       printf("(WW)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
[4608]128
129#else
[3395]130#define PRINTF2 if (NO)
[3205]131#endif
[4608]132
[3592]133#if HARD_DEBUG_LEVEL >= INFO
[3205]134#define PRINTF3 \
[3601]135     if (SOFT_DEBUG_LEVEL >= INFO) \
[5299]136       printf("(II)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
[4608]137#else
[3395]138#define PRINTF3 if (NO)
[3205]139#endif
[4608]140
[4373]141#if HARD_DEBUG_LEVEL >= DEBUG
[3205]142#define PRINTF4 \
[4373]143     if (SOFT_DEBUG_LEVEL >= DEBUG) \
[5299]144       printf("(DD)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
[4608]145#else
[3395]146#define PRINTF4 if (NO)
[3205]147#endif
[4608]148
[4373]149#if HARD_DEBUG_LEVEL >= vDEBUG
[3548]150#define PRINTF5 \
[4373]151     if (SOFT_DEBUG_LEVEL >= vDEBUG) \
[5299]152       printf("(VD)::%s:%d:", __FILE__, __LINE__) && PRINT_EXEC
[4608]153#else
[3548]154#define PRINTF5 if (NO)
155#endif
[4608]156
157#else
[3395]158#define PRINTF(x) if (NO)
[3204]159#endif
160
[3206]161#define PRINTF0 \
[5075]162    printf("%s:%d::", __FILE__, __LINE__) && PRINT_EXEC
[5076]163#endif
[3204]164
[3293]165///////////////////////////////////////////////////
166///  PRINT: just prints output as is            ///
167///////////////////////////////////////////////////
[4373]168#define PRINTNO      PRINT0
169#define PRINTERR     PRINT1
170#define PRINTWARN    PRINT2
171#define PRINTINFO    PRINT3
172#define PRINTDEBUG   PRINT4
173#define PRINTVDEBUG  PRINT5
174
[3293]175#ifdef  DEBUG
176#define PRINT(x) \
[3395]177  PRINT ## x
[3293]178
[3592]179#if HARD_DEBUG_LEVEL >= ERR
[4608]180#define PRINT1  \
181  if (SOFT_DEBUG_LEVEL >= ERR)  \
[5075]182    PRINT_EXEC
[4608]183#else
[3395]184#define PRINT1 if (NO)
[3293]185#endif
[3395]186
[3592]187#if HARD_DEBUG_LEVEL >= WARN
[3293]188#define PRINT2 \
[3601]189  if (SOFT_DEBUG_LEVEL >= WARN) \
[5075]190    PRINT_EXEC
[3293]191
[4608]192#else
[3395]193#define PRINT2 if (NO)
[3293]194#endif
[3395]195
[3592]196#if HARD_DEBUG_LEVEL >= INFO
[3293]197#define PRINT3 \
[3601]198  if (SOFT_DEBUG_LEVEL >= INFO) \
[5075]199    PRINT_EXEC
[4608]200#else
[3395]201#define PRINT3 if (NO)
[3293]202#endif
[3395]203
[4373]204#if HARD_DEBUG_LEVEL >= DEBUG
[3293]205#define PRINT4 \
[4373]206  if (SOFT_DEBUG_LEVEL >= DEBUG) \
[5075]207    PRINT_EXEC
[4608]208#else
[3395]209#define PRINT4 if (NO)
[3293]210#endif
[3395]211
[4373]212#if HARD_DEBUG_LEVEL >= vDEBUG
[3548]213#define PRINT5 \
[4373]214     if (SOFT_DEBUG_LEVEL >= vDEBUG) \
[5299]215       PRINT_EXEC
[4608]216#else
[3548]217#define PRINT5 if (NO)
218#endif
[3395]219
[3548]220
[4608]221#else
[3395]222#define PRINT(x) if (NO)
[3293]223#endif
224
225#define PRINT0 \
[5075]226  PRINT_EXEC
[3293]227
[3204]228#endif /* _DEBUG_H */
Note: See TracBrowser for help on using the repository browser.