Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/debug.h @ 3461

Last change on this file since 3461 was 3439, checked in by bensch, 20 years ago

orxonox/trunk: evil-color-deflator (and a small patch, so debug.h does what it should)

File size: 3.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.
19*/ 
20
[3204]21#ifndef _DEBUG_H
22#define _DEBUG_H
23
[3395]24#define NO              0
25#define ERROR           1
26#define WARNING         2
27#define INFORMATION     3
28#define DEBUGING        4
[3293]29
[3439]30#if HAVE_CONFIG_H
31#include <config.h> 
32#endif
33
[3395]34#include <stdio.h>
35
[3293]36///////////////////////////////////////////////////
37/// PRINTF: prints with filename and linenumber ///
38///////////////////////////////////////////////////
39
[3433]40#ifdef DEBUG
[3365]41extern int verbose;
[3205]42#define PRINTF(x) \
43           PRINTF ## x
44
[3395]45#if DEBUG >= ERROR
[3205]46#define PRINTF1 \
[3395]47    if (verbose >= ERROR) \
[3212]48      printf("%s:%d::", __FILE__, __LINE__) && printf
[3205]49#else
[3395]50#define PRINTF1 if (NO)
[3205]51#endif
52     
[3395]53#if DEBUG >= WARNING
[3205]54#define PRINTF2 \
[3395]55     if (verbose >= WARNING) \
[3212]56       printf("%s:%d::", __FILE__, __LINE__) && printf
[3206]57         
[3205]58#else
[3395]59#define PRINTF2 if (NO)
[3205]60#endif
61     
[3395]62#if DEBUG >= INFORMATION
[3205]63#define PRINTF3 \
[3395]64     if (verbose >= INFORMATION) \
[3212]65       printf("%s:%d::", __FILE__, __LINE__) && printf
[3205]66#else
[3395]67#define PRINTF3 if (NO)
[3205]68#endif
69     
[3395]70#if DEBUG >= DEBUGING
[3205]71#define PRINTF4 \
[3395]72     if (verbose >= DEBUGING) \
[3212]73       printf("%s:%d::", __FILE__, __LINE__) && printf
[3205]74#else
[3395]75#define PRINTF4 if (NO)
[3205]76#endif
77     
78     
[3204]79#else 
[3395]80#define PRINTF(x) if (NO)
[3204]81#endif
82
[3206]83#define PRINTF0 \
[3212]84    printf("%s:%d::", __FILE__, __LINE__) && printf
[3204]85
[3293]86
87///////////////////////////////////////////////////
88///  PRINT: just prints output as is            ///
89///////////////////////////////////////////////////
90#ifdef  DEBUG
[3395]91extern int verbose;
[3293]92#define PRINT(x) \
[3395]93  PRINT ## x
[3293]94
[3395]95#if DEBUG >= ERROR
96#define PRINT1  \
97  if (verbose >= ERROR) \
98    printf
[3293]99#else
[3395]100#define PRINT1 if (NO)
[3293]101#endif
[3395]102
103#if DEBUG >= WARNING
[3293]104#define PRINT2 \
[3395]105  if (verbose >= WARNING) \
106    printf
[3293]107
108#else
[3395]109#define PRINT2 if (NO)
[3293]110#endif
[3395]111
112#if DEBUG >= INFORMATION
[3293]113#define PRINT3 \
[3395]114  if (verbose >= INFORMATION) \
115    printf
116#else
117#define PRINT3 if (NO)
[3293]118#endif
[3395]119
120#if DEBUG >= DEBUGING
[3293]121#define PRINT4 \
[3395]122  if (verbose >= DEBUGING) \
123    printf
[3293]124#else
[3395]125#define PRINT4 if (NO)
[3293]126#endif
[3395]127
128
[3293]129#else 
[3395]130#define PRINT(x) if (NO)
[3293]131#endif
132
133#define PRINT0 \
[3395]134  printf
[3293]135
136///////////////////////////////////////////////////
137/// COUT: simple cout print with verbose-check  ///
138///////////////////////////////////////////////////
139#ifdef  DEBUG
140#define COUT(x) \
141           COUT ## x
142
143#if DEBUG >= 1
144#define COUT1 \
145    if (verbose >= 1 ) \
146      cout
147#else
[3395]148#define COUT1 if (NO) cout
[3293]149#endif
150     
151#if DEBUG >= 2
152#define COUT2 \
153     if (verbose >= 2 ) \
154       cout
155
156#else
[3395]157#define COUT2 if (NO) cout
[3293]158#endif
159     
160#if DEBUG >= 3
161#define COUT3 \
162     if (verbose >= 3 ) \
163       cout
164#else
[3395]165#define COUT3 if (NO) cout
[3293]166#endif
167     
168#if DEBUG >= 4
169#define COUT4 \
170     if (verbose >= 4 ) \
171       cout
172#else
[3395]173#define COUT4 if (NO) cout
[3293]174#endif
175     
176     
177#else 
[3395]178#define COUT(x) if (NO) cout
[3293]179#endif
180
181#define COUT0 \
182           cout
183
[3204]184#endif /* _DEBUG_H */
Note: See TracBrowser for help on using the repository browser.