Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/terrain/src/defs/debug.h @ 8349

Last change on this file since 8349 was 8296, checked in by ponder, 19 years ago
  • volfog_effect.cc didn't compile on macosx, because there's no glX* stuff. Now macosx is handled specially
  • For some reason, PACKAGE_NAME, PACKAGE_VERSION and similar variables were not found. I added them to debug.h, but thats just temporary.
File size: 7.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
[7374]18 * @briefHandles output to console for different Verbose-Modes.
19 *
20 * There are two main modes HARD and SOFT. HARD is precessed during compileTime where SOFT is for runtime.
21 * @li HARD: One can choose between different modes. see: // DEFINE_MODULES
22 * @li SOFT: If you want each module can have its own variable for processing. just pass it to DEBUG_MODULE_SOFT
23 */
[3601]24
[3204]25#ifndef _DEBUG_H
26#define _DEBUG_H
27
[3863]28#include "confincl.h"
[5944]29#ifndef NO_SHELL
[7661]30#include "lib/shell/shell_buffer.h"
[5944]31#endif /* NO_SHELL */
[3590]32
33#include <stdio.h>
[6868]34#include <cassert>
[3590]35
36// DEFINE ERROR MODES
[7729]37#define ORX_NONE            0
38#define ORX_ERR             1
39#define ORX_WARN            2
40#define ORX_INFO            3
41#define ORX_DEBUG           4
42#define ORX_vDEBUG          5
[3293]43
[3592]44extern int verbose;
45
[3601]46//definitions
[3592]47#ifndef MODULAR_DEBUG
[7729]48 #define HARD_DEBUG_LEVEL ORX_DEBUG
[5440]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
[7711]80  #define DEBUG_MODULE_COLLISION_DETECTION   2
[7819]81  #define DEBUG_MODULE_COLLISION_REACTION    2
[5440]82  #define DEBUG_MODULE_SPATIAL_SEPARATION    2
83  #define DEBUG_MODULE_GUI                   2
[5930]84  #define DEBUG_MODULE_SOUND                 2
[5300]85
[5440]86  // MISC
87  #define DEBUG_MODULE_TRACK_MANAGER         2
88  #define DEBUG_MODULE_MATH                  2
[5300]89
[5440]90  #define DEBUG_MODULE_PNODE                 2
91  #define DEBUG_MODULE_WORLD_ENTITY          2
[5300]92
[6834]93  #define DEBUG_MODULE_STORY_ENTITY          2
[7020]94  #define DEBUG_MODULE_GAME_RULES            2
[6834]95
[5440]96  #define DEBUG_MODULE_WEAPON                2
[3439]97
[5440]98  #define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE
99
100 #endif /* DEBUG_SPECIAL_MODULE */
[3592]101#endif /* MODULAR_DEBUG */
[4373]102
[3293]103///////////////////////////////////////////////////
104/// PRINTF: prints with filename and linenumber ///
105///////////////////////////////////////////////////
[7729]106#define PRINTFORX_NONE    PRINTF0
107#define PRINTFORX_ERR     PRINTF1
108#define PRINTFORX_WARN    PRINTF2
109#define PRINTFORX_INFO    PRINTF3
110#define PRINTFORX_DEBUG   PRINTF4
111#define PRINTFORX_VDEBUG  PRINTF5
[3293]112
[8296]113#ifndef ORX_DATADIR
114#define ORX_DATADIR "/usr/share"
115#endif
116#ifndef DEBUG_LEVEL
117#define DEBUG_LEVEL 2
118#endif
[7729]119#if DEBUG_LEVEL <= 3
[5076]120#define PRINTF(x)        PRINT(x)
[5183]121#endif
[5822]122#ifndef NO_SHELL
[7374]123#define PRINT_EXEC       OrxShell::ShellBuffer::addBufferLineStatic
[7161]124#define COUT_EXEC        std::cout
[5822]125#else /* NO_SHELL */
126#define PRINT_EXEC       printf
[7161]127#define COUT_EXEC        std::cout
[5822]128#endif
[5075]129
[5076]130#ifndef PRINTF
[7729]131#ifdef ORX_DEBUG
[3590]132
[3205]133#define PRINTF(x) \
134           PRINTF ## x
135
[7729]136#if HARD_DEBUG_LEVEL >= ORX_ERR
[3205]137#define PRINTF1 \
[7729]138    if (SOFT_DEBUG_LEVEL >= ORX_ERR) \
[8145]139      printf("(EE)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
[4608]140#else
[8145]141#define PRINTF1 if (ORX_NONE) PRINT_EXEC
[3205]142#endif
[4608]143
[7729]144#if HARD_DEBUG_LEVEL >= ORX_WARN
[3205]145#define PRINTF2 \
[7729]146     if (SOFT_DEBUG_LEVEL >= ORX_WARN) \
[8145]147       printf("(WW)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
[4608]148
149#else
[8145]150#define PRINTF2 if (ORX_NONE) PRINT_EXEC
[3205]151#endif
[4608]152
[7729]153#if HARD_DEBUG_LEVEL >= ORX_INFO
[3205]154#define PRINTF3 \
[7729]155     if (SOFT_DEBUG_LEVEL >= ORX_INFO) \
[8145]156       printf("(II)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
[4608]157#else
[8145]158#define PRINTF3 if (ORX_NONE) PRINT_EXEC
[3205]159#endif
[4608]160
[7729]161#if HARD_DEBUG_LEVEL >= ORX_DEBUG
[3205]162#define PRINTF4 \
[7729]163     if (SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
[8145]164       printf("(DD)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
[4608]165#else
[8145]166#define PRINTF4 if (ORX_NONE) PRINT_EXEC
[3205]167#endif
[4608]168
[7729]169#if HARD_DEBUG_LEVEL >= ORX_vDEBUG
[3548]170#define PRINTF5 \
[7729]171     if (SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
[8145]172       printf("(VD)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
[4608]173#else
[8145]174#define PRINTF5 if (ORX_NONE) PRINT_EXEC
[3548]175#endif
[4608]176
177#else
[8282]178#define PRINTF(x) if (ORX_NONE) PRINT_EXEC
[3204]179#endif
180
[3206]181#define PRINTF0 \
[8145]182    printf("%s:%d::", __FILE__, __LINE__), PRINT_EXEC
[5076]183#endif
[3204]184
[3293]185///////////////////////////////////////////////////
186///  PRINT: just prints output as is            ///
187///////////////////////////////////////////////////
[7729]188#define PRINTORX_NONE    PRINT0
189#define PRINTORX_ERR     PRINT1
190#define PRINTORX_WARN    PRINT2
191#define PRINTORX_INFO    PRINT3
192#define PRINTORX_DEBUG   PRINT4
193#define PRINTORX_vDEBUG  PRINT5
[4373]194
[7729]195#ifdef  DEBUG_LEVEL
[3293]196#define PRINT(x) \
[3395]197  PRINT ## x
[3293]198
[7729]199#if HARD_DEBUG_LEVEL >= ORX_ERR
[4608]200#define PRINT1  \
[7729]201  if (SOFT_DEBUG_LEVEL >= ORX_ERR)  \
[5075]202    PRINT_EXEC
[4608]203#else
[8145]204#define PRINT1 if (ORX_NONE) PRINT_EXEC
[3293]205#endif
[3395]206
[7729]207#if HARD_DEBUG_LEVEL >= ORX_WARN
[3293]208#define PRINT2 \
[7729]209  if (SOFT_DEBUG_LEVEL >= ORX_WARN) \
[5075]210    PRINT_EXEC
[3293]211
[4608]212#else
[8145]213#define PRINT2 if (ORX_NONE) PRINT_EXEC
[3293]214#endif
[3395]215
[7729]216#if HARD_DEBUG_LEVEL >= ORX_INFO
[3293]217#define PRINT3 \
[7729]218  if (SOFT_DEBUG_LEVEL >= ORX_INFO) \
[5075]219    PRINT_EXEC
[4608]220#else
[8145]221#define PRINT3 if (ORX_NONE) PRINT_EXEC
[3293]222#endif
[3395]223
[7729]224#if HARD_DEBUG_LEVEL >= ORX_DEBUG
[3293]225#define PRINT4 \
[7729]226  if (SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
[5075]227    PRINT_EXEC
[4608]228#else
[8145]229#define PRINT4 if (ORX_NONE) PRINT_EXEC
[3293]230#endif
[3395]231
[7729]232#if HARD_DEBUG_LEVEL >= ORX_vDEBUG
[3548]233#define PRINT5 \
[7729]234     if (SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
[5299]235       PRINT_EXEC
[4608]236#else
[8145]237#define PRINT5 if (ORX_NONE) PRINT_EXEC
[3548]238#endif
[3395]239
[3548]240
[4608]241#else
[8282]242#define PRINT(x) if (ORX_NONE) PRINT_EXEC
[3293]243#endif
244
245#define PRINT0 \
[5075]246  PRINT_EXEC
[3293]247
[7161]248
249
250////////////////////////////////////////////////////////
251///  COUT: just prints output as is with std::cout   ///
252////////////////////////////////////////////////////////
[7729]253#define COUTORX_NONE    COUT0
254#define COUTORX_ERR     COUT1
255#define COUTORX_WARN    COUT2
256#define COUTORX_INFO    COUT3
257#define COUTORX_DEBUG   COUT4
258#define COUTORX_vDEBUG  COUT5
[7161]259
[7729]260#ifdef  DEBUG_LEVEL
[7161]261#define COUT(x) \
262  COUT ## x
263
[7729]264#if HARD_DEBUG_LEVEL >= ORX_ERR
[7161]265#define COUT1  \
[7729]266  if (SOFT_DEBUG_LEVEL >= ORX_ERR)  \
[7161]267    COUT_EXEC
268#else
[7729]269#define COUT1 if (ORX_NONE)\
[7161]270    COUT_EXEC
271#endif
272
[7729]273#if HARD_DEBUG_LEVEL >= ORX_WARN
[7161]274#define COUT2 \
[7729]275  if (SOFT_DEBUG_LEVEL >= ORX_WARN) \
[7161]276    COUT_EXEC
277
278#else
[7729]279#define COUT2 if (ORX_NONE) \
[7161]280    COUT_EXEC
281#endif
282
[7729]283#if HARD_DEBUG_LEVEL >= ORX_INFO
[7161]284#define COUT3 \
[7729]285  if (SOFT_DEBUG_LEVEL >= ORX_INFO) \
[7161]286    COUT_EXEC
287#else
[7729]288#define COUT3 if (ORX_NONE) \
[7161]289    COUT_EXEC
290#endif
291
[7729]292#if HARD_DEBUG_LEVEL >= ORX_DEBUG
[7161]293#define COUT4 \
[7729]294  if (SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
[7161]295    COUT_EXEC
296#else
[7729]297#define COUT4 if (ORX_NONE) \
[7161]298    COUT_EXEC
299#endif
300
[7729]301#if HARD_DEBUG_LEVEL >= ORX_vDEBUG
[7161]302#define COUT5 \
[7729]303     if (SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
[7161]304       COUT_EXEC
305#else
[7729]306#define COUT5 if (ORX_NONE) \
[7161]307    COUT_EXEC
308#endif
309
310
311#else
[7729]312#define COUT(x) if (ORX_NONE) \
[7161]313    COUT_EXEC
314#endif
315
316#define COUT0 \
317  COUT_EXEC
318
319
[3204]320#endif /* _DEBUG_H */
Note: See TracBrowser for help on using the repository browser.