Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/branches/textEngine: merged trunk here.
merged with command:
svn merge ../trunk textEngine -r 3467:HEAD
no conflicts

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