Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3530 was 3530, checked in by chris, 19 years ago

orxonox/branches/levelloader: Got the system to compile, the basic backbone now runs. What remains to be done is implementing all necessary functions to load all vital classes into a world

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