Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/levelloader/src/defs/debug.h @ 3715

Last change on this file since 3715 was 3605, checked in by bensch, 20 years ago

orxonox/trunk: merged trunk back to levelloader
merged with command:
svn merge -r 3499:HEAD trunk branches/levelloader

Conflicts in
C track_manager.h
C world_entities/player.cc
C world_entities/player.h
C world_entities/environment.h
C lib/coord/p_node.cc
C defs/debug.h
C track_manager.cc
C story_entities/campaign.h

solved in merge-favouring. It was quite easy because Chris only worked on the headers, and he didi it quite clean. Thats the spirit :)

Conflits in world.cc are a MESS: fix it

File size: 5.1 KB
RevLine 
[3395]1/*
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
16/*!
17    \file debug.h
18    \brief Handles output to console for different Verbose-Modes.
[3605]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
[3395]23*/ 
24
[3204]25#ifndef _DEBUG_H
26#define _DEBUG_H
27
[3530]28#if HAVE_CONFIG_H
29#include <config.h> 
30#endif
31
32#include <stdio.h>
33
[3605]34// DEFINE ERROR MODES
[3395]35#define NO              0
[3480]36#define ERR             1
37#define WARN            2
38#define INFO            3
[3395]39#define DEBUGING        4
[3605]40#define vDEBUGING       5
[3293]41
[3605]42extern int verbose;
43
44//definitions
45#ifndef MODULAR_DEBUG
46#define HARD_DEBUG_LEVEL DEBUG
47#define SOFT_DEBUG_LEVEL verbose
48#else /* MODULAR_DEBUG */
49#ifndef DEBUG_MODULE_SOFT
50#define SOFT_DEBUG_LEVEL verbose
51#else /* DEBUG_MODULE_SOFT */
52#define SOFT_DEBUG_LEVEL DEBUG_MODULE_SOFT
53#endif /* DEBUG_MODULE_SOFT */
54
55#ifndef DEBUG_SPECIAL_MODULE
56#define HARD_DEBUG_LEVEL DEBUG
57#else /* DEBUG_SPECIAL_MODULE */
58// DEFINE MODULES \\
59#define DEBUG_MODULE_ORXONOX            0
60#define DEBUG_MODULE_WORLD              0
61#define DEBUG_MODULE_PNODE              2
62#define DEBUG_MODULE_WORLD_ENTITY       0
63#define DEBUG_MODULE_COMMAND_NODE       0
64
65#define DEBUG_MODULE_IMPORTER           0
66#define DEBUG_MODULE_TRACK_MANAGER      0
67#define DEBUG_MODULE_LIGHT              3
68#define DEBUG_MODULE_PLAYER             0
69#define DEBUG_MODULE_MATH               0
70
71#define DEBUG_MODULE_NULL_PARENT        0
72
73
74#define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE
75#endif /* DEBUG_SPECIAL_MODULE */
76#endif /* MODULAR_DEBUG */
[3293]77///////////////////////////////////////////////////
78/// PRINTF: prints with filename and linenumber ///
79///////////////////////////////////////////////////
[3605]80
[3433]81#ifdef DEBUG
[3605]82
[3205]83#define PRINTF(x) \
84           PRINTF ## x
[3605]85
86#if HARD_DEBUG_LEVEL >= ERR
[3205]87#define PRINTF1 \
[3605]88    if (SOFT_DEBUG_LEVEL >= ERR) \
89      printf("ERROR::%s:%d:", __FILE__, __LINE__) && printf
[3205]90#else
[3395]91#define PRINTF1 if (NO)
[3205]92#endif
93     
[3605]94#if HARD_DEBUG_LEVEL >= WARN
[3205]95#define PRINTF2 \
[3605]96     if (SOFT_DEBUG_LEVEL >= WARN) \
97       printf("WARNING::%s:%d:", __FILE__, __LINE__) && printf
[3206]98         
[3205]99#else
[3395]100#define PRINTF2 if (NO)
[3205]101#endif
102     
[3605]103#if HARD_DEBUG_LEVEL >= INFO
[3205]104#define PRINTF3 \
[3605]105     if (SOFT_DEBUG_LEVEL >= INFO) \
106       printf("INFO::%s:%d:", __FILE__, __LINE__) && printf
[3205]107#else
[3395]108#define PRINTF3 if (NO)
[3205]109#endif
110     
[3605]111#if HARD_DEBUG_LEVEL >= DEBUGING
[3205]112#define PRINTF4 \
[3605]113     if (SOFT_DEBUG_LEVEL >= DEBUGING) \
114       printf("DEBUG::%s:%d:", __FILE__, __LINE__) && printf
[3205]115#else
[3395]116#define PRINTF4 if (NO)
[3205]117#endif
118     
[3605]119#if HARD_DEBUG_LEVEL >= vDEBUGING
120#define PRINTF5 \
121     if (SOFT_DEBUG_LEVEL >= vDEBUGING) \
122       printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf
123#else
124#define PRINTF5 if (NO)
125#endif
126   
[3204]127#else 
[3395]128#define PRINTF(x) if (NO)
[3204]129#endif
130
[3206]131#define PRINTF0 \
[3212]132    printf("%s:%d::", __FILE__, __LINE__) && printf
[3204]133
[3293]134
135///////////////////////////////////////////////////
136///  PRINT: just prints output as is            ///
137///////////////////////////////////////////////////
138#ifdef  DEBUG
139#define PRINT(x) \
[3395]140  PRINT ## x
[3605]141
142#if HARD_DEBUG_LEVEL >= ERR
[3395]143#define PRINT1  \
[3605]144  if (SOFT_DEBUG_LEVEL >= ERR)  \
[3395]145    printf
[3293]146#else
[3395]147#define PRINT1 if (NO)
[3293]148#endif
[3395]149
[3605]150#if HARD_DEBUG_LEVEL >= WARN
[3293]151#define PRINT2 \
[3605]152  if (SOFT_DEBUG_LEVEL >= WARN) \
[3395]153    printf
[3293]154
155#else
[3395]156#define PRINT2 if (NO)
[3293]157#endif
[3395]158
[3605]159#if HARD_DEBUG_LEVEL >= INFO
[3293]160#define PRINT3 \
[3605]161  if (SOFT_DEBUG_LEVEL >= INFO) \
[3395]162    printf
163#else
164#define PRINT3 if (NO)
[3293]165#endif
[3395]166
[3605]167#if HARD_DEBUG_LEVEL >= DEBUGING
[3293]168#define PRINT4 \
[3605]169  if (SOFT_DEBUG_LEVEL >= DEBUGING) \
[3395]170    printf
[3293]171#else
[3395]172#define PRINT4 if (NO)
[3293]173#endif
[3395]174
[3605]175#if HARD_DEBUG_LEVEL >= vDEBUGING
176#define PRINT5 \
177     if (SOFT_DEBUG_LEVEL >= vDEBUGING) \
178       printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf
179#else
180#define PRINT5 if (NO)
181#endif
[3395]182
[3605]183
[3293]184#else 
[3395]185#define PRINT(x) if (NO)
[3293]186#endif
187
188#define PRINT0 \
[3395]189  printf
[3293]190
191///////////////////////////////////////////////////
192/// COUT: simple cout print with verbose-check  ///
193///////////////////////////////////////////////////
194#ifdef  DEBUG
195#define COUT(x) \
196           COUT ## x
197
[3605]198#if HARD_DEBUG_LEVEL >= 1
[3293]199#define COUT1 \
[3605]200    if (SOFT_DEBUG_LEVEL >= 1 ) \
[3293]201      cout
202#else
[3395]203#define COUT1 if (NO) cout
[3293]204#endif
205     
[3605]206#if HARD_DEBUG_LEVEL >= 2
[3293]207#define COUT2 \
[3605]208     if (SOFT_DEBUG_LEVEL >= 2 ) \
[3293]209       cout
210
211#else
[3395]212#define COUT2 if (NO) cout
[3293]213#endif
214     
[3605]215#if HARD_DEBUG_LEVEL >= 3
[3293]216#define COUT3 \
[3605]217     if (SOFT_DEBUG_LEVEL >= 3 ) \
[3293]218       cout
219#else
[3395]220#define COUT3 if (NO) cout
[3293]221#endif
222     
[3605]223#if HARD_DEBUG_LEVEL >= 4
[3293]224#define COUT4 \
[3605]225     if (SOFT_DEBUG_LEVEL >= 4 ) \
[3293]226       cout
227#else
[3395]228#define COUT4 if (NO) cout
[3293]229#endif
230     
231     
232#else 
[3395]233#define COUT(x) if (NO) cout
[3293]234#endif
235
236#define COUT0 \
237           cout
238
[3204]239#endif /* _DEBUG_H */
Note: See TracBrowser for help on using the repository browser.