"Fossies" - the Fresh Open Source Software Archive 
Member "utrac-0.3.2/src/debug.h" (4 Jan 2009, 3032 Bytes) of package /linux/privat/old/utrac-0.3.2.tgz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "debug.h" see the
Fossies "Dox" file reference documentation.
1 /***************************************************************************
2 * debug.h
3 *
4 * Tue Oct 5 11:27:20 2004
5 * Copyright 2004 Alliance MCA
6 * Written by : Antoine Calando (antoine@alliancemca.net)
7 ****************************************************************************/
8
9 /*
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 */
24
25 /*!
26 * \file debug.h
27 * \author Antoine Calando (antoine@alliancemca.net)
28 *
29 * \note EC ##args est une directive propre à gcc.
30 * \note AC The solution is not to use these macro with only one argument
31 * and to create a new macro (with 1 argument) for these cases.
32 */
33
34 #ifndef _DEBUG_H
35 #define _DEBUG_H
36
37 /*************** types ************************/
38 #include <sys/types.h>
39
40 #ifndef __cplusplus
41 /* typedef unsigned short int bool;
42 #ifndef true
43 #define true 1
44 #endif
45 #ifndef false
46 #define false 0
47 #endif*/
48 #endif //__cplusplus
49 /*typedef unsigned char uchar;*/
50 #ifndef NULL
51 #define NULL 0
52 #endif
53
54 /******************** Debugging stuff ******************/
55
56 #ifndef UT_DEBUG
57 #define UT_DEBUG 1
58 #endif
59
60 #if UT_DEBUG>=1
61 #define DBG1(msg, args...) \
62 { fprintf(stderr, "DEBUG %s:%d: " msg "\n", __FILE__, __LINE__, ## args); }
63 #else
64 #define DBG1(msg, args...)
65 #endif
66
67 #if UT_DEBUG>=2
68 #define DBG2(msg, args...) \
69 { fprintf(stderr, "DEBUG %s:%d: " msg "\n", __FILE__, __LINE__, ## args); }
70 #else
71 #define DBG2(msg, args...)
72 #endif
73
74 #if UT_DEBUG>=3
75 #define DBG(msg, args...) DBG3(msg, ## args)
76 #define DBG3(msg, args...) \
77 { fprintf(stderr, "DEBUG %s:%d:" msg "\n", __FILE__, __LINE__, ## args); }
78 #define DBG3_S(msg, args...) \
79 { fprintf(stderr, msg, ## args); }
80
81 #else
82 #define DBG(msg, args...)
83 #define DBG3(msg, args...)
84 #define DBG3_S(msg, args...)
85 #endif
86
87 #if UT_DEBUG>=1
88 #define ASSERT(expr) \
89 if(!(expr)) { \
90 fprintf(stderr, "\nASSERT %s:%d: ******* Assertion " #expr " failed! ******* \n", __FILE__, __LINE__); \
91 }
92 #define ASSERT_MSG(expr, msg, args...) \
93 if(!(expr)) { \
94 fprintf(stderr, "\nASSERT %s:%d: ******* Assertion " #expr " failed!" msg " ******* \n", __FILE__, __LINE__, ## args); \
95 }
96 #define ERROR(msg, args...) \
97 { fprintf(stderr, "ERROR %s:%d:" msg "\n", __FILE__, __LINE__, ## args); \
98 exit (-1); }
99 #else
100 #define ASSERT(expr)
101 #define ASSERT_MSG(expr, msg, args...)
102 #define ERROR(msg, args...)
103 #endif
104
105
106
107 #endif /* _DEBUG_H */