1 /*
2  * pluma-debug.h
3  * This file is part of pluma
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  * Copyright (C) 2012-2021 MATE Developers
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 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., 51 Franklin St, Fifth Floor,
23  * Boston, MA 02110-1301, USA.
24  */
25 
26 /*
27  * Modified by the pluma Team, 1998-2005. See the AUTHORS file for a
28  * list of people on the pluma Team.
29  * See the ChangeLog files for a list of changes.
30  *
31  * $Id$
32  */
33 
34 #ifndef __PLUMA_DEBUG_H__
35 #define __PLUMA_DEBUG_H__
36 
37 #include <glib.h>
38 
39 /*
40  * Set an environmental var of the same name to turn on
41  * debugging output. Setting PLUMA_DEBUG will turn on all
42  * sections.
43  */
44 typedef enum {
45 	PLUMA_NO_DEBUG       = 0,
46 	PLUMA_DEBUG_VIEW     = 1 << 0,
47 	PLUMA_DEBUG_SEARCH   = 1 << 1,
48 	PLUMA_DEBUG_PRINT    = 1 << 2,
49 	PLUMA_DEBUG_PREFS    = 1 << 3,
50 	PLUMA_DEBUG_PLUGINS  = 1 << 4,
51 	PLUMA_DEBUG_TAB      = 1 << 5,
52 	PLUMA_DEBUG_DOCUMENT = 1 << 6,
53 	PLUMA_DEBUG_COMMANDS = 1 << 7,
54 	PLUMA_DEBUG_APP      = 1 << 8,
55 	PLUMA_DEBUG_SESSION  = 1 << 9,
56 	PLUMA_DEBUG_UTILS    = 1 << 10,
57 	PLUMA_DEBUG_METADATA = 1 << 11,
58 	PLUMA_DEBUG_WINDOW   = 1 << 12,
59 	PLUMA_DEBUG_LOADER   = 1 << 13,
60 	PLUMA_DEBUG_SAVER    = 1 << 14
61 } PlumaDebugSection;
62 
63 
64 /* FIXME this is an issue for introspection */
65 #define	DEBUG_VIEW	PLUMA_DEBUG_VIEW,    __FILE__, __LINE__, G_STRFUNC
66 #define	DEBUG_SEARCH	PLUMA_DEBUG_SEARCH,  __FILE__, __LINE__, G_STRFUNC
67 #define	DEBUG_PRINT	PLUMA_DEBUG_PRINT,   __FILE__, __LINE__, G_STRFUNC
68 #define	DEBUG_PREFS	PLUMA_DEBUG_PREFS,   __FILE__, __LINE__, G_STRFUNC
69 #define	DEBUG_PLUGINS	PLUMA_DEBUG_PLUGINS, __FILE__, __LINE__, G_STRFUNC
70 #define	DEBUG_TAB	PLUMA_DEBUG_TAB,     __FILE__, __LINE__, G_STRFUNC
71 #define	DEBUG_DOCUMENT	PLUMA_DEBUG_DOCUMENT,__FILE__, __LINE__, G_STRFUNC
72 #define	DEBUG_COMMANDS	PLUMA_DEBUG_COMMANDS,__FILE__, __LINE__, G_STRFUNC
73 #define	DEBUG_APP	PLUMA_DEBUG_APP,     __FILE__, __LINE__, G_STRFUNC
74 #define	DEBUG_SESSION	PLUMA_DEBUG_SESSION, __FILE__, __LINE__, G_STRFUNC
75 #define	DEBUG_UTILS	PLUMA_DEBUG_UTILS,   __FILE__, __LINE__, G_STRFUNC
76 #define	DEBUG_METADATA	PLUMA_DEBUG_METADATA,__FILE__, __LINE__, G_STRFUNC
77 #define	DEBUG_WINDOW	PLUMA_DEBUG_WINDOW,  __FILE__, __LINE__, G_STRFUNC
78 #define	DEBUG_LOADER	PLUMA_DEBUG_LOADER,  __FILE__, __LINE__, G_STRFUNC
79 #define	DEBUG_SAVER	PLUMA_DEBUG_SAVER,   __FILE__, __LINE__, G_STRFUNC
80 
81 void pluma_debug_init (void);
82 
83 void pluma_debug (PlumaDebugSection  section,
84 		  const gchar       *file,
85 		  gint               line,
86 		  const gchar       *function);
87 
88 void pluma_debug_message (PlumaDebugSection  section,
89 			  const gchar       *file,
90 			  gint               line,
91 			  const gchar       *function,
92 			  const gchar       *format, ...) G_GNUC_PRINTF(5, 6);
93 
94 
95 #endif /* __PLUMA_DEBUG_H__ */
96