1 /* gdict-debug.h - Debug facilities for Gdict
2  *
3  * Copyright (C) 2006  Emmanuele Bassi <ebassi@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef __GDICT_DEBUG_H__
20 #define __GDICT_DEBUG_H__
21 
22 #include <glib.h>
23 
24 G_BEGIN_DECLS
25 
26 typedef enum {
27   GDICT_DEBUG_MISC    = 1 << 0,
28   GDICT_DEBUG_CONTEXT = 1 << 1,
29   GDICT_DEBUG_DICT    = 1 << 2,
30   GDICT_DEBUG_SOURCE  = 1 << 3,
31   GDICT_DEBUG_LOADER  = 1 << 4,
32   GDICT_DEBUG_CHOOSER = 1 << 5,
33   GDICT_DEBUG_DEFBOX  = 1 << 6,
34   GDICT_DEBUG_SPELLER = 1 << 7
35 } GdictDebugFlags;
36 
37 #ifdef GDICT_ENABLE_DEBUG
38 
39 #define GDICT_NOTE(type,x,a...)                 G_STMT_START {  \
40         if (gdict_debug_flags & GDICT_DEBUG_##type) {           \
41           g_message ("[" #type "]: " G_STRLOC ": " x, ##a);     \
42         }                                       } G_STMT_END
43 
44 #else
45 
46 #define GDICT_NOTE(type,x,a...)
47 
48 #endif /* !GDICT_ENABLE_DEBUG */
49 
50 extern guint gdict_debug_flags;
51 
52 G_END_DECLS
53 
54 #endif /* __GDICT_DEBUG_H__ */
55