Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/nico/src/debug.h @ 3943

Last change on this file since 3943 was 3399, checked in by bensch, 20 years ago

orxonox/branches/nico: merged trunk into branches/nico
merged with command:
svn merge ../trunk/ nico/ -r 3238:HEAD
resolved conflict in favor of branches/nico.

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