diff options
Diffstat (limited to 'libgdict/gdict-debug.h')
-rw-r--r-- | libgdict/gdict-debug.h | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/libgdict/gdict-debug.h b/libgdict/gdict-debug.h index b9cfb78..03c6d70 100644 --- a/libgdict/gdict-debug.h +++ b/libgdict/gdict-debug.h @@ -17,8 +17,39 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, */ -#ifdef GDICT_ENABLE_DEBUG -void _gdict_debug (const gchar *fmt, ...); +#ifndef __GDICT_DEBUG_H__ +#define __GDICT_DEBUG_H__ + +#include <glib.h> + +G_BEGIN_DECLS + +typedef enum { + GDICT_DEBUG_MISC = 1 << 0, + GDICT_DEBUG_CONTEXT = 1 << 1, + GDICT_DEBUG_DICT = 1 << 2, + GDICT_DEBUG_SOURCE = 1 << 3, + GDICT_DEBUG_LOADER = 1 << 4, + GDICT_DEBUG_CHOOSER = 1 << 5, + GDICT_DEBUG_DEFBOX = 1 << 6, + GDICT_DEBUG_SPELLER = 1 << 7 +} GdictDebugFlags; + +#ifndef GDICT_ENABLE_DEBUG + +#define GDICT_NOTE(type,x,a...) G_STMT_START { \ + if (gdict_debug_flags & GDICT_DEBUG_##type) { \ + g_message ("[" #type "]: " x, ##a); \ + } } G_STMT_END + #else -#define _gdict_debug(...) -#endif + +#define GDICT_NOTE(type,x,a...) + +#endif /* !GDICT_ENABLE_DEBUG */ + +extern guint gdict_debug_flags; + +G_END_DECLS + +#endif /* __GDICT_DEBUG_H__ */ |