00001 #ifndef debug_h
00002 #define debug_h
00003
00004 #include <glib.h>
00005
00006 #define FIXME fprintf(stderr, "Function %s not implemented.\n", __FUNCTION__); \
00007 return NULL;
00008
00009 #undef DEBUG_BINDING
00010 #ifdef DEBUG
00011 #define DEBUG_BINDING
00012 #endif
00013
00014 #ifdef DEBUG_BINDING
00015 static int indent = 0;
00016 static char *getindent()
00017 {
00018 static char buf[LINE_MAX];
00019 g_return_val_if_fail(indent < sizeof(buf), "");
00020 memset(buf, 0, sizeof(buf));
00021 memset(buf, ' ', indent);
00022 return buf;
00023 }
00024 #define DEBUG_ENTRY {\
00025 fprintf(stderr, "%sEntering `%s' at line %d.\n", \
00026 getindent(), __FUNCTION__, __LINE__); \
00027 indent++; \
00028 }
00029 #define DEBUG_CALL {\
00030 fprintf(stderr, "%sIn `%s' at line %d.\n", \
00031 getindent(), __FUNCTION__, __LINE__); \
00032 }
00033 #define DEBUG_EXIT {\
00034 indent--; \
00035 fprintf(stderr, "%sLeaving `%s' at line %d.\n", \
00036 getindent(), __FUNCTION__, __LINE__); \
00037 }
00038 #else
00039 #define DEBUG_ENTRY
00040 #define DEBUG_CALL
00041 #define DEBUG_EXIT
00042 #endif
00043
00044 #endif