Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3628 was 3467, checked in by bensch, 20 years ago

orxonox/branches: added branche textEngine

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