Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/levelloader/src/defs/debug.h @ 3557

Last change on this file since 3557 was 3542, checked in by chris, 20 years ago

orxonox/branches/levelloader: First incarnation of a debugworld loaded from a XML-File in place, compilability in place, all necessary basic loading constuctors in place. Unfortunately the code still generates interferences with the old hardcoded debugworld resulting in SegFault crash.

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