Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/defs/debug.h @ 6864

Last change on this file since 6864 was 6864, checked in by patrick, 18 years ago

network: assert included

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