Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/defs/debug.h @ 3584

Last change on this file since 3584 was 3548, checked in by bensch, 20 years ago

orxonox/trunk: debug information in importer set like they should be

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