1 /*
2  * xed-debug.h
3  * This file is part of xed
4  *
5  * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
6  * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
7  * Copyright (C) 2002 - 2005 Paolo Maggi
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  */
24 
25 /*
26  * Modified by the xed Team, 1998-2005. See the AUTHORS file for a
27  * list of people on the xed Team.
28  * See the ChangeLog files for a list of changes.
29  *
30  * $Id$
31  */
32 
33 #ifndef __XED_DEBUG_H__
34 #define __XED_DEBUG_H__
35 
36 #include <glib.h>
37 
38 /*
39  * Set an environmental var of the same name to turn on
40  * debugging output. Setting XED_DEBUG will turn on all
41  * sections.
42  */
43 typedef enum {
44 	XED_NO_DEBUG       = 0,
45 	XED_DEBUG_VIEW     = 1 << 0,
46 	XED_DEBUG_SEARCH   = 1 << 1,
47 	XED_DEBUG_PRINT    = 1 << 2,
48 	XED_DEBUG_PREFS    = 1 << 3,
49 	XED_DEBUG_PLUGINS  = 1 << 4,
50 	XED_DEBUG_TAB      = 1 << 5,
51 	XED_DEBUG_DOCUMENT = 1 << 6,
52 	XED_DEBUG_COMMANDS = 1 << 7,
53 	XED_DEBUG_APP      = 1 << 8,
54 	XED_DEBUG_SESSION  = 1 << 9,
55 	XED_DEBUG_UTILS    = 1 << 10,
56 	XED_DEBUG_METADATA = 1 << 11,
57 	XED_DEBUG_WINDOW   = 1 << 12,
58 	XED_DEBUG_LOADER   = 1 << 13,
59 	XED_DEBUG_SAVER    = 1 << 14
60 } XedDebugSection;
61 
62 
63 /* FIXME this is an issue for introspection */
64 #define	DEBUG_VIEW	XED_DEBUG_VIEW,    __FILE__, __LINE__, G_STRFUNC
65 #define	DEBUG_SEARCH	XED_DEBUG_SEARCH,  __FILE__, __LINE__, G_STRFUNC
66 #define	DEBUG_PRINT	XED_DEBUG_PRINT,   __FILE__, __LINE__, G_STRFUNC
67 #define	DEBUG_PREFS	XED_DEBUG_PREFS,   __FILE__, __LINE__, G_STRFUNC
68 #define	DEBUG_PLUGINS	XED_DEBUG_PLUGINS, __FILE__, __LINE__, G_STRFUNC
69 #define	DEBUG_TAB	XED_DEBUG_TAB,     __FILE__, __LINE__, G_STRFUNC
70 #define	DEBUG_DOCUMENT	XED_DEBUG_DOCUMENT,__FILE__, __LINE__, G_STRFUNC
71 #define	DEBUG_COMMANDS	XED_DEBUG_COMMANDS,__FILE__, __LINE__, G_STRFUNC
72 #define	DEBUG_APP	XED_DEBUG_APP,     __FILE__, __LINE__, G_STRFUNC
73 #define	DEBUG_SESSION	XED_DEBUG_SESSION, __FILE__, __LINE__, G_STRFUNC
74 #define	DEBUG_UTILS	XED_DEBUG_UTILS,   __FILE__, __LINE__, G_STRFUNC
75 #define	DEBUG_METADATA	XED_DEBUG_METADATA,__FILE__, __LINE__, G_STRFUNC
76 #define	DEBUG_WINDOW	XED_DEBUG_WINDOW,  __FILE__, __LINE__, G_STRFUNC
77 #define	DEBUG_LOADER	XED_DEBUG_LOADER,  __FILE__, __LINE__, G_STRFUNC
78 #define	DEBUG_SAVER	XED_DEBUG_SAVER,   __FILE__, __LINE__, G_STRFUNC
79 
80 void xed_debug_init (void);
81 
82 void xed_debug (XedDebugSection  section,
83 		  const gchar       *file,
84 		  gint               line,
85 		  const gchar       *function);
86 
87 void xed_debug_message (XedDebugSection  section,
88 			  const gchar       *file,
89 			  gint               line,
90 			  const gchar       *function,
91 			  const gchar       *format, ...) G_GNUC_PRINTF(5, 6);
92 
93 
94 #endif /* __XED_DEBUG_H__ */
95