1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3     anjuta-debug.h
4     Copyright (C) 2003 Naba Kumar  <naba@gnome.org>
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 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19 */
20 
21 #ifndef __ANJUTA_DEBUG__
22 #define __ANJUTA_DEBUG__
23 
24 /**
25  * SECTION:anjuta-debug
26  * @title: Debugging
27  * @short_description: Debug functions
28  * @see_also:
29  * @stability: stable
30  * @include: libanjuta/anjuta-debug.h
31  *
32  * Anjuta debug messages are displayed using the g_debug() function from GLib.
33  *
34  * To display debug messages, Anjuta must have been compiled with
35  * --enable-debug and the environment variable G_MESSAGES_DEBUG should be set
36  * to "all" or to a list separated by whitespace of domains to display.
37  *
38  * By example
39  *<programlisting>
40  * G_MESSAGE_DEBUG=Gtk Anjuta libanjuta-gdb
41  *</programlisting>
42  * will display debug messages from Gtk, Anjuta and gdb plugin only.
43  */
44 
45 /**
46  * DEBUG_PRINT:
47  *
48  * Equivalent to g_debug() showing the FILE, the LINE and the FUNC,
49  * except it has only effect when DEBUG is defined . Used for printing debug
50  * messages.
51  */
52 #if defined (DEBUG)
53 	#if defined (__GNUC__) && (__GNUC__ >= 3) && !defined(__STRICT_ANSI__)
54 		#define DEBUG_PRINT(format, ...) g_debug ("%s:%d (%s) " format, __FILE__, __LINE__, G_STRFUNC, ##__VA_ARGS__)
55 	#else
56 		#define DEBUG_PRINT g_debug
57 	#endif
58 #else
59 	#define DEBUG_PRINT(...)
60 #endif
61 
62 #endif /* _ANJUTA_DEBUG_H_ */
63