Made debugging configurable via xml
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sun, 8 Jul 2007 17:46:27 +0000 (17:46 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sun, 8 Jul 2007 17:46:27 +0000 (17:46 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@281 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/configure.in
navit/src/binding/python/Makefile.am
navit/src/debug.c
navit/src/debug.h
navit/src/plugin.h
navit/src/plugin_def.h
navit/src/xmlconfig.c

index d483a6b..7d08e2c 100644 (file)
@@ -37,7 +37,7 @@ PKG_CHECK_MODULES(NAVIT, [glib-2.0 gmodule-2.0])
 AC_SUBST(NAVIT_CFLAGS)
 AC_SUBST(NAVIT_LIBS)
 
-AC_ARG_ENABLE(MODULE_GUI_GTK, [  --disable-gui-gtk             don't create gui gtk ],
+AC_ARG_ENABLE(gui-gtk, [  --disable-gui-gtk             don't create gui gtk ],
 MODULE_GUI_GTK=$enableval, MODULE_GUI_GTK=yes)
 if test "x$MODULE_GUI_GTK" = "xyes"; then
        PKG_CHECK_MODULES(GTK2, [gtk+-2.0], [gtk2_pkgconfig=yes], [gtk2_pkgconfig=no])
@@ -65,16 +65,19 @@ AC_SUBST(IMLIB2_CFLAGS)
 AC_SUBST(IMLIB2_LIBS)
 
 
-AC_ARG_ENABLE(MODULE_GUI_SDL, [  --disable-speech-speechd             don't create speech speechd ], MODULE_SPEECH_SPEECHD=$enableval, MODULE_SPEECH_SPEECHD=yes)
-AC_CHECK_HEADER(libspeechd.h, AC_DEFINE([HAVE_LIBSPEECHD],[],Define to 1 if you have the <libspeechd.h> header file.) SPEECHD_LIBS="-lspeechd" speechd=yes,  AC_MSG_WARN([*** no libspeechd.h -- Speech output disabled]))
+AC_ARG_ENABLE(speech-speechd, [  --disable-speech-speechd             don't create speech speechd ], MODULE_SPEECH_SPEECHD=$enableval, MODULE_SPEECH_SPEECHD=yes)
+if test "x$MODULE_SPEECH_SPEECHD" = "xyes"; then
+       AC_CHECK_HEADER(libspeechd.h, AC_DEFINE([HAVE_LIBSPEECHD],[],Define to 1 if you have the <libspeechd.h> header file.) SPEECHD_LIBS="-lspeechd" speechd=yes,  AC_MSG_WARN([*** no libspeechd.h -- Speech output disabled]))
+fi
 AC_SUBST(SPEECHD_CFLAGS)
 AC_SUBST(SPEECHD_LIBS)
 AM_CONDITIONAL(SPEECH_SPEECH_DISPATCHER, [test "x$speechd" = "xyes"])
 
 
-AC_ARG_ENABLE(MODULE_GUI_SDL, [  --disable-gui-sdl             don't create gui sdl ], MODULE_GUI_SDL=$enableval, MODULE_GUI_SDL=yes)
-if test "x$MODULE_GUI_GTK" = "xyes"; then
-       AC_CHECK_HEADER(
+AC_ARG_ENABLE(gui-sdl, [  --disable-gui-sdl             don't create gui sdl ], MODULE_GUI_SDL=$enableval, MODULE_GUI_SDL=yes)
+echo "MODULE_GUI_SDL=$MODULE_GUI_SDL"
+if test "x$MODULE_GUI_SDL" = "xyes"; then
+       AC_CHECK_HEADER(n
                SDL/SDL.h,
                AC_DEFINE(
                        [HAVE_LIBSDL],
@@ -149,7 +152,7 @@ if test "$cross_compiling" = no; then
                                py_liblocalmod=`grep '^LOCALMODLIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
                                py_libbasemod=`grep '^BASEMODLIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
                                PYTHON_LIBS="-L$py_libdir/config $py_libs $py_libc $py_libm -lpython$py_ver $py_liblocalmod $py_libbasemod"
-                               PYTHON_LIBS=`echo $PYTHON_LIB | sed -e 's/[ \\t]*/ /g'`
+                               PYTHON_LIBS=`echo $PYTHON_LIBS | sed -e 's/[ \\t]*/ /g'`
                                AC_DEFINE(HAVE_PYTHON, 1, [Define to 1 if you have python])
                                python=yes
                                AC_MSG_RESULT($py_libdir)
index 27dd68d..704fc7d 100644 (file)
@@ -2,3 +2,4 @@ include $(top_srcdir)/Makefile.inc
 AM_CPPFLAGS = @NAVIT_CFLAGS@ @PYTHON_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"binding_python\"
 modulebinding_LTLIBRARIES = libbinding_python.la
 libbinding_python_la_SOURCES = binding_python.c
+libbinding_python_la_LIBADD = @PYTHON_LIBS@
index 4498b9f..1bb1549 100644 (file)
@@ -36,7 +36,7 @@ debug_init(void)
 #if 0
        signal(SIGSEGV, sigsegv);
 #endif
-       debug_hash=g_hash_table_new(g_str_hash, g_str_equal);
+       debug_hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
 }
 
 
@@ -48,12 +48,11 @@ debug_update_level(gpointer key, gpointer value, gpointer user_data)
 }
 
 void
-debug_level_set(char *name, int level)
+debug_level_set(const char *name, int level)
 {
        debug_level=0;
-       g_hash_table_insert(debug_hash, name, (gpointer) level);
+       g_hash_table_insert(debug_hash, g_strdup(name), (gpointer) level);
        g_hash_table_foreach(debug_hash, debug_update_level, NULL);     
-       debug_level_get(name);
 }
 
 int
index 69ced33..b181e21 100644 (file)
@@ -3,6 +3,7 @@ int debug_level;
 
 /* prototypes */
 void debug_init(void);
-void debug_level_set(char *name, int level);
+void debug_level_set(const char *name, int level);
 int debug_level_get(const char *name);
 void debug_print(int level, const char *module, const char *function, const char *fmt, ...);
+/* end of prototypes */
index 61061f9..7cd1a8a 100644 (file)
@@ -7,9 +7,12 @@ extern "C" {
 struct plugin;
 
 enum plugin_type {
-       plugin_type_map,
-       plugin_type_gui,
        plugin_type_graphics,
+       plugin_type_gui,
+       plugin_type_map,
+       plugin_type_osd,
+       plugin_type_speech,
+       plugin_type_vehicle,
        plugin_type_last,
 };
 #endif
index 4108a78..d125ca5 100644 (file)
@@ -1,7 +1,10 @@
 enum projection;
 PLUGIN_FUNC1(draw, struct container *, co)
 PLUGIN_FUNC3(popup, struct container *, map, struct popup *, p, struct popup_item **, list)
-PLUGIN_TYPE(map, (struct map_methods *meth, char *data, char **charset, enum projection *pro)) 
 struct navit;
-PLUGIN_TYPE(gui, (struct navit *nav, struct gui_methods *meth, int w, int h)) 
 PLUGIN_TYPE(graphics, (struct graphics_methods *meth)) 
+PLUGIN_TYPE(gui, (struct navit *nav, struct gui_methods *meth, int w, int h)) 
+PLUGIN_TYPE(map, (struct map_methods *meth, char *data, char **charset, enum projection *pro)) 
+PLUGIN_TYPE(osd, (struct osd_methods *meth)) 
+PLUGIN_TYPE(speech, (struct speech_methods *meth)) 
+PLUGIN_TYPE(vehicle, (struct vehicle_methods *meth)) 
index f5ad4c6..d07dfab 100644 (file)
@@ -1,6 +1,7 @@
 #include <glib.h>
 #include <glib/gprintf.h>
 #include <string.h>
+#include "debug.h"
 #include "coord.h"
 #include "layout.h"
 #include "mapset.h"
@@ -125,6 +126,20 @@ xmlconfig_plugin(struct xmlstate *state)
 }
 
 static int
+xmlconfig_debug(struct xmlstate *state)
+{
+       const char *name,*level;
+       name=find_attribute(state, "name", 1);
+       if (! name)
+               return 0;
+       level=find_attribute(state, "level", 1);
+       if (! level)
+               return 0;
+       debug_level_set(name, convert_number(level));
+       return 1;
+}
+
+static int
 xmlconfig_navit(struct xmlstate *state)
 {
        const char *value,*gui,*graphics;
@@ -407,26 +422,27 @@ struct element_func {
        char *parent;
        int (*func)(struct xmlstate *state);
 } elements[] = {
-       { "plugins", NULL, xmlconfig_plugins},
-       { "plugin", "plugins", xmlconfig_plugin},
+       { "debug", NULL, xmlconfig_debug},
        { "navit", NULL, xmlconfig_navit},
-       { "vehicle", "navit", xmlconfig_vehicle},
-       { "tracking", "navit", xmlconfig_tracking},
-       { "route", "navit", xmlconfig_route},
-       { "speed", "route", xmlconfig_speed},
-       { "navigation", "navit", xmlconfig_navigation},
-       { "announce", "navigation", xmlconfig_announce},
-       { "mapset", "navit", xmlconfig_mapset},
-       { "map",  "mapset", xmlconfig_map},
        { "layout", "navit", xmlconfig_layout},
        { "layer", "layout", xmlconfig_layer},
        { "item", "layer", xmlconfig_item},
-       { "polygon", "item", xmlconfig_polygon},
-       { "polyline", "item", xmlconfig_polyline},
        { "circle", "item", xmlconfig_circle},
-       { "label", "item", xmlconfig_label},
        { "icon", "item", xmlconfig_icon},
        { "image", "item", xmlconfig_image},
+       { "label", "item", xmlconfig_label},
+       { "polygon", "item", xmlconfig_polygon},
+       { "polyline", "item", xmlconfig_polyline},
+       { "mapset", "navit", xmlconfig_mapset},
+       { "map",  "mapset", xmlconfig_map},
+       { "navigation", "navit", xmlconfig_navigation},
+       { "announce", "navigation", xmlconfig_announce},
+       { "tracking", "navit", xmlconfig_tracking},
+       { "route", "navit", xmlconfig_route},
+       { "speed", "route", xmlconfig_speed},
+       { "vehicle", "navit", xmlconfig_vehicle},
+       { "plugins", NULL, xmlconfig_plugins},
+       { "plugin", "plugins", xmlconfig_plugin},
        {},
 };