diff options
Diffstat (limited to 'navit')
59 files changed, 149 insertions, 133 deletions
diff --git a/navit/event.c b/navit/event.c index 96d2e0dd8..667e5bdc3 100644 --- a/navit/event.c +++ b/navit/event.c @@ -129,7 +129,7 @@ event_request_system(const char *system, const char *requestor) } return 1; } - event_type_new=plugin_get_event_type(system); + event_type_new=plugin_get_category_event(system); if (! event_type_new) { dbg(lvl_error,"unsupported event system '%s' requested from '%s'\n", system, requestor); return 0; diff --git a/navit/event_glib.c b/navit/event_glib.c index 9ffb12cbc..e9bad6c40 100644 --- a/navit/event_glib.c +++ b/navit/event_glib.c @@ -196,5 +196,5 @@ event_glib_new(struct event_methods *meth) void event_glib_init(void) { - plugin_register_event_type("glib", event_glib_new); + plugin_register_category_event("glib", event_glib_new); } diff --git a/navit/font/freetype/font_freetype.c b/navit/font/freetype/font_freetype.c index f41eff314..0508c5870 100644 --- a/navit/font/freetype/font_freetype.c +++ b/navit/font/freetype/font_freetype.c @@ -658,7 +658,7 @@ font_freetype_new(void *meth) void plugin_init(void) { - plugin_register_font_type("freetype", font_freetype_new); + plugin_register_category_font("freetype", font_freetype_new); #ifdef HAVE_FONTCONFIG FcInit(); #endif diff --git a/navit/graphics.c b/navit/graphics.c index 1813a8c36..7680d96ce 100644 --- a/navit/graphics.c +++ b/navit/graphics.c @@ -274,7 +274,7 @@ struct graphics * graphics_new(struct attr *parent, struct attr **attrs) return NULL; } - graphicstype_new=plugin_get_graphics_type(type_attr->u.str); + graphicstype_new=plugin_get_category_graphics(type_attr->u.str); if (! graphicstype_new) { dbg(lvl_error,"Failed to load graphics plugin %s.\n", type_attr->u.str); return NULL; diff --git a/navit/graphics/android/graphics_android.c b/navit/graphics/android/graphics_android.c index 41f441c96..0d6aa30d2 100644 --- a/navit/graphics/android/graphics_android.c +++ b/navit/graphics/android/graphics_android.c @@ -1198,6 +1198,6 @@ void plugin_init(void) { dbg(lvl_debug,"enter\n"); - plugin_register_graphics_type("android", graphics_android_new); - plugin_register_event_type("android", event_android_new); + plugin_register_category_graphics("android", graphics_android_new); + plugin_register_category_event("android", event_android_new); } diff --git a/navit/graphics/gd/graphics_gd.c b/navit/graphics/gd/graphics_gd.c index 908007a0e..3ef6c520b 100644 --- a/navit/graphics/gd/graphics_gd.c +++ b/navit/graphics/gd/graphics_gd.c @@ -826,7 +826,7 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin dbg(lvl_debug,"enter\n"); ret=g_new0(struct graphics_priv, 1); *meth=graphics_methods; - font_freetype_new=plugin_get_font_type("freetype"); + font_freetype_new=plugin_get_category_font("freetype"); if (!font_freetype_new) return NULL; font_freetype_new(&ret->freetype_methods); @@ -855,7 +855,7 @@ graphics_gd_new(struct navit *nav, struct graphics_methods *meth, struct attr ** struct font_priv * (*font_freetype_new)(void *meth); struct graphics_priv *ret; event_request_system("glib","graphics_gd_new"); - font_freetype_new=plugin_get_font_type("freetype"); + font_freetype_new=plugin_get_category_font("freetype"); if (!font_freetype_new) return NULL; *meth=graphics_methods; @@ -881,5 +881,5 @@ graphics_gd_new(struct navit *nav, struct graphics_methods *meth, struct attr ** void plugin_init(void) { - plugin_register_graphics_type("gd", graphics_gd_new); + plugin_register_category_graphics("gd", graphics_gd_new); } diff --git a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c index 9d6dd998b..387003c40 100644 --- a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c +++ b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c @@ -1081,7 +1081,7 @@ static struct graphics_priv * graphics_gtk_drawing_area_new_helper(struct graphics_methods *meth) { struct font_priv * (*font_freetype_new)(void *meth); - font_freetype_new=plugin_get_font_type("freetype"); + font_freetype_new=plugin_get_category_font("freetype"); if (!font_freetype_new) return NULL; struct graphics_priv *this=g_new0(struct graphics_priv,1); @@ -1150,5 +1150,5 @@ plugin_init(void) #ifdef HAVE_API_WIN32 setlocale(LC_NUMERIC, "C"); /* WIN32 gtk resets LC_NUMERIC */ #endif - plugin_register_graphics_type("gtk_drawing_area", graphics_gtk_drawing_area_new); + plugin_register_category_graphics("gtk_drawing_area", graphics_gtk_drawing_area_new); } diff --git a/navit/graphics/null/graphics_null.c b/navit/graphics/null/graphics_null.c index ce4dc6de2..ecac7d528 100644 --- a/navit/graphics/null/graphics_null.c +++ b/navit/graphics/null/graphics_null.c @@ -354,6 +354,6 @@ event_null_new(struct event_methods *meth) void plugin_init(void) { - plugin_register_graphics_type("null", graphics_null_new); - plugin_register_event_type("null", event_null_new); + plugin_register_category_graphics("null", graphics_null_new); + plugin_register_category_event("null", event_null_new); } diff --git a/navit/graphics/opengl/graphics_opengl.c b/navit/graphics/opengl/graphics_opengl.c index da82cd107..98230f0dc 100644 --- a/navit/graphics/opengl/graphics_opengl.c +++ b/navit/graphics/opengl/graphics_opengl.c @@ -1440,7 +1440,7 @@ static struct graphics_priv * graphics_opengl_new_helper(struct graphics_methods *meth) { struct font_priv *(*font_freetype_new) (void *meth); - font_freetype_new = plugin_get_font_type("freetype"); + font_freetype_new = plugin_get_category_font("freetype"); if (!font_freetype_new) { return NULL; @@ -1817,6 +1817,6 @@ event_opengl_new(struct event_methods *meth) void plugin_init(void) { - plugin_register_graphics_type("opengl", graphics_opengl_new); - plugin_register_event_type("opengl", event_opengl_new); + plugin_register_category_graphics("opengl", graphics_opengl_new); + plugin_register_category_event("opengl", event_opengl_new); } diff --git a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp b/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp index 3a7509b0d..65163ea9d 100644 --- a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp +++ b/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp @@ -854,7 +854,7 @@ static struct graphics_priv * graphics_qt_qpainter_new(struct navit *nav, struct return NULL; #endif #ifdef QT_QPAINTER_USE_FREETYPE - font_freetype_new=(struct font_priv *(*)(void *))plugin_get_font_type("freetype"); + font_freetype_new=(struct font_priv *(*)(void *))plugin_get_category_font("freetype"); if (!font_freetype_new) { dbg(lvl_error,"no freetype\n"); return NULL; @@ -921,9 +921,9 @@ static struct graphics_priv * graphics_qt_qpainter_new(struct navit *nav, struct //############################################################################################################## void plugin_init(void) { - plugin_register_graphics_type("qt_qpainter", graphics_qt_qpainter_new); + plugin_register_category_graphics("qt_qpainter", graphics_qt_qpainter_new); #ifdef QT_QPAINTER_USE_EVENT_QT - plugin_register_event_type("qt", event_qt_new); + plugin_register_category_event("qt", event_qt_new); #endif } diff --git a/navit/graphics/sdl/event.c b/navit/graphics/sdl/event.c index cd4b81802..f96b079b3 100644 --- a/navit/graphics/sdl/event.c +++ b/navit/graphics/sdl/event.c @@ -377,5 +377,5 @@ event_sdl_new(struct event_methods* methods) { /* ---------- SDL Eventhandling ---------- */ void sdl_event_init(void) { - plugin_register_event_type("sdl", event_sdl_new); + plugin_register_category_event("sdl", event_sdl_new); } diff --git a/navit/graphics/sdl/event_sdl.c b/navit/graphics/sdl/event_sdl.c index d640d5edb..28fe4fafb 100644 --- a/navit/graphics/sdl/event_sdl.c +++ b/navit/graphics/sdl/event_sdl.c @@ -339,5 +339,5 @@ event_sdl_new(struct event_methods* methods) void event_sdl_register(void) { - plugin_register_event_type("sdl", event_sdl_new); + plugin_register_category_event("sdl", event_sdl_new); } diff --git a/navit/graphics/sdl/graphics_sdl.c b/navit/graphics/sdl/graphics_sdl.c index b0cc66776..b1a9c17b9 100644 --- a/navit/graphics/sdl/graphics_sdl.c +++ b/navit/graphics/sdl/graphics_sdl.c @@ -986,7 +986,7 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin struct font_priv *(*font_freetype_new) (void *meth); - font_freetype_new = plugin_get_font_type ("freetype"); + font_freetype_new = plugin_get_category_font ("freetype"); if (!font_freetype_new) { @@ -1407,7 +1407,7 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr * this->cbl = cbl; /* initialize fonts */ - font_freetype_new = plugin_get_font_type("freetype"); + font_freetype_new = plugin_get_category_font("freetype"); if (!font_freetype_new) { g_free(this); @@ -1852,9 +1852,9 @@ void plugin_init(void) { #ifdef USE_WEBOS - plugin_register_event_type("sdl", event_sdl_new); + plugin_register_category_event("sdl", event_sdl_new); #endif - plugin_register_graphics_type("sdl", graphics_sdl_new); + plugin_register_category_graphics("sdl", graphics_sdl_new); } // vim: sw=4 ts=8 diff --git a/navit/graphics/win32/graphics_win32.c b/navit/graphics/win32/graphics_win32.c index 609e61ce8..3d8fa351d 100644 --- a/navit/graphics/win32/graphics_win32.c +++ b/navit/graphics/win32/graphics_win32.c @@ -1845,6 +1845,6 @@ static struct event_priv * void plugin_init(void) { - plugin_register_graphics_type("win32", graphics_win32_new); - plugin_register_event_type("win32", event_win32_new); + plugin_register_category_graphics("win32", graphics_win32_new); + plugin_register_category_event("win32", event_win32_new); } diff --git a/navit/gui.c b/navit/gui.c index ab16d8a9e..9b2ba4971 100644 --- a/navit/gui.c +++ b/navit/gui.c @@ -45,7 +45,7 @@ gui_new(struct attr *parent, struct attr **attrs) return NULL; } - guitype_new=plugin_get_gui_type(type_attr->u.str); + guitype_new=plugin_get_category_gui(type_attr->u.str); if (! guitype_new) return NULL; diff --git a/navit/gui/gtk/gui_gtk_window.c b/navit/gui/gtk/gui_gtk_window.c index 71bd26315..1741a54a0 100644 --- a/navit/gui/gtk/gui_gtk_window.c +++ b/navit/gui/gtk/gui_gtk_window.c @@ -808,5 +808,5 @@ plugin_init(void) #endif - plugin_register_gui_type("gtk", gui_gtk_new); + plugin_register_category_gui("gtk", gui_gtk_new); } diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c index 072c6feca..fd450b57c 100644 --- a/navit/gui/internal/gui_internal.c +++ b/navit/gui/internal/gui_internal.c @@ -3452,5 +3452,5 @@ static struct gui_priv * gui_internal_new(struct navit *nav, struct gui_methods //############################################################################################################## void plugin_init(void) { - plugin_register_gui_type("internal", gui_internal_new); + plugin_register_category_gui("internal", gui_internal_new); } diff --git a/navit/gui/qml/gui_qml.cpp b/navit/gui/qml/gui_qml.cpp index cee0574bd..7a1016473 100644 --- a/navit/gui/qml/gui_qml.cpp +++ b/navit/gui/qml/gui_qml.cpp @@ -473,5 +473,5 @@ static struct gui_priv * gui_qml_new(struct navit *nav, struct gui_methods *meth } void plugin_init(void) { - plugin_register_gui_type("qml",gui_qml_new); + plugin_register_category_gui("qml",gui_qml_new); } diff --git a/navit/gui/win32/gui_win32.c b/navit/gui/win32/gui_win32.c index bdbdb357d..8a8cb37b9 100644 --- a/navit/gui/win32/gui_win32.c +++ b/navit/gui/win32/gui_win32.c @@ -639,5 +639,5 @@ static struct gui_priv *win32_gui_new( struct navit *nav, struct gui_methods *me void plugin_init(void) { - plugin_register_gui_type("win32", win32_gui_new); + plugin_register_category_gui("win32", win32_gui_new); } diff --git a/navit/map.c b/navit/map.c index 51cda59be..2736da9f8 100644 --- a/navit/map.c +++ b/navit/map.c @@ -24,7 +24,7 @@ * This file contains the code that makes navit able to load maps. Because * navit is able to open maps in different formats, this code does not handle * any map format itself. This is done by map plugins which register to this - * code by calling plugin_register_map_type(). + * code by calling plugin_register_category_map(). * * When opening a new map, the map plugin will return a pointer to a map_priv * struct, which can be defined by the map plugin and contains whatever private @@ -99,7 +99,7 @@ map_new(struct attr *parent, struct attr **attrs) dbg(lvl_error,"missing type\n"); return NULL; } - maptype_new=plugin_get_map_type(type->u.str); + maptype_new=plugin_get_category_map(type->u.str); if (! maptype_new) { dbg(lvl_error,"invalid type '%s'\n", type->u.str); return NULL; diff --git a/navit/map/binfile/binfile.c b/navit/map/binfile/binfile.c index 4ca4c6bf5..6b5108659 100644 --- a/navit/map/binfile/binfile.c +++ b/navit/map/binfile/binfile.c @@ -2848,6 +2848,6 @@ plugin_init(void) if (sizeof(struct zip_cd) != 46) { dbg(lvl_error,"error: sizeof(struct zip_cd)=%zu\n",sizeof(struct zip_cd)); } - plugin_register_map_type("binfile", map_new_binfile); + plugin_register_category_map("binfile", map_new_binfile); } diff --git a/navit/map/csv/csv.c b/navit/map/csv/csv.c index ea36432d1..ec647a920 100644 --- a/navit/map/csv/csv.c +++ b/navit/map/csv/csv.c @@ -878,6 +878,6 @@ void plugin_init(void) { dbg(lvl_debug,"csv: plugin_init\n"); - plugin_register_map_type("csv", map_new_csv); + plugin_register_category_map("csv", map_new_csv); } diff --git a/navit/map/filter/filter.c b/navit/map/filter/filter.c index 63817ecc7..cecae7fc0 100644 --- a/navit/map/filter/filter.c +++ b/navit/map/filter/filter.c @@ -430,6 +430,6 @@ void plugin_init(void) { dbg(lvl_debug,"filter: plugin_init\n"); - plugin_register_map_type("filter", map_filter_new); + plugin_register_category_map("filter", map_filter_new); } diff --git a/navit/map/garmin/garmin.c b/navit/map/garmin/garmin.c index 609bcab0e..d00cb9794 100644 --- a/navit/map/garmin/garmin.c +++ b/navit/map/garmin/garmin.c @@ -993,5 +993,5 @@ gmap_new(struct map_methods *meth, struct attr **attrs, struct callback_list *cb void plugin_init(void) { - plugin_register_map_type("garmin", gmap_new); + plugin_register_category_map("garmin", gmap_new); } diff --git a/navit/map/garmin_img/garmin_img.c b/navit/map/garmin_img/garmin_img.c index 58fe489da..f7dccf89c 100644 --- a/navit/map/garmin_img/garmin_img.c +++ b/navit/map/garmin_img/garmin_img.c @@ -1508,6 +1508,6 @@ map_new_garmin_img(struct map_methods *meth, struct attr **attrs) void plugin_init(void) { - plugin_register_map_type("garmin_img", map_new_garmin_img); + plugin_register_category_map("garmin_img", map_new_garmin_img); } diff --git a/navit/map/mg/map.c b/navit/map/mg/map.c index 9b0805e2d..13561e154 100644 --- a/navit/map/mg/map.c +++ b/navit/map/mg/map.c @@ -609,5 +609,5 @@ map_new_mg(struct map_methods *meth, struct attr **attrs, struct callback_list * void plugin_init(void) { - plugin_register_map_type("mg", map_new_mg); + plugin_register_category_map("mg", map_new_mg); } diff --git a/navit/map/shapefile/shapefile.c b/navit/map/shapefile/shapefile.c index e67aaafee..e3eb4b723 100644 --- a/navit/map/shapefile/shapefile.c +++ b/navit/map/shapefile/shapefile.c @@ -682,7 +682,7 @@ void plugin_init(void) { dbg(lvl_debug,"shapefile: plugin_init\n"); - plugin_register_map_type("shapefile", map_new_shapefile); + plugin_register_category_map("shapefile", map_new_shapefile); } /************************************************************************/ diff --git a/navit/map/textfile/textfile.c b/navit/map/textfile/textfile.c index d70f989f9..43be12368 100644 --- a/navit/map/textfile/textfile.c +++ b/navit/map/textfile/textfile.c @@ -394,6 +394,6 @@ void plugin_init(void) { dbg(lvl_debug,"textfile: plugin_init\n"); - plugin_register_map_type("textfile", map_new_textfile); + plugin_register_category_map("textfile", map_new_textfile); } diff --git a/navit/navigation.c b/navit/navigation.c index 92b73796d..cdad6331c 100644 --- a/navit/navigation.c +++ b/navit/navigation.c @@ -4444,7 +4444,7 @@ navigation_set_route(struct navigation *this_, struct route *route) void navigation_init(void) { - plugin_register_map_type("navigation", navigation_map_new); + plugin_register_category_map("navigation", navigation_map_new); } struct object_func navigation_func = { diff --git a/navit/osd.c b/navit/osd.c index a2b88b0ad..a0c9183d1 100644 --- a/navit/osd.c +++ b/navit/osd.c @@ -52,7 +52,7 @@ osd_new(struct attr *parent, struct attr **attrs) if (! type) return NULL; - new=plugin_get_osd_type(type->u.str); + new=plugin_get_category_osd(type->u.str); if (! new) { dbg(lvl_error, "invalid OSD type '%s'\n", type->u.str); return NULL; diff --git a/navit/osd/core/osd_core.c b/navit/osd/core/osd_core.c index 4d38591e2..9b43a160b 100644 --- a/navit/osd/core/osd_core.c +++ b/navit/osd/core/osd_core.c @@ -3880,21 +3880,21 @@ osd_auxmap_new(struct navit *nav, struct osd_methods *meth, struct attr **attrs) void plugin_init(void) { - plugin_register_osd_type("compass", osd_compass_new); - plugin_register_osd_type("navigation_next_turn", osd_nav_next_turn_new); - plugin_register_osd_type("button", osd_button_new); - plugin_register_osd_type("toggle_announcer", osd_nav_toggle_announcer_new); - plugin_register_osd_type("speed_warner", osd_speed_warner_new); - plugin_register_osd_type("speed_cam", osd_speed_cam_new); - plugin_register_osd_type("text", osd_text_new); - plugin_register_osd_type("gps_status", osd_gps_status_new); - plugin_register_osd_type("volume", osd_volume_new); - plugin_register_osd_type("scale", osd_scale_new); - plugin_register_osd_type("image", osd_image_new); - plugin_register_osd_type("stopwatch", osd_stopwatch_new); - plugin_register_osd_type("odometer", osd_odometer_new); - plugin_register_osd_type("auxmap", osd_auxmap_new); - plugin_register_osd_type("cmd_interface", osd_cmd_interface_new); - plugin_register_osd_type("route_guard", osd_route_guard_new); - plugin_register_osd_type("navigation_status", osd_navigation_status_new); + plugin_register_category_osd("compass", osd_compass_new); + plugin_register_category_osd("navigation_next_turn", osd_nav_next_turn_new); + plugin_register_category_osd("button", osd_button_new); + plugin_register_category_osd("toggle_announcer", osd_nav_toggle_announcer_new); + plugin_register_category_osd("speed_warner", osd_speed_warner_new); + plugin_register_category_osd("speed_cam", osd_speed_cam_new); + plugin_register_category_osd("text", osd_text_new); + plugin_register_category_osd("gps_status", osd_gps_status_new); + plugin_register_category_osd("volume", osd_volume_new); + plugin_register_category_osd("scale", osd_scale_new); + plugin_register_category_osd("image", osd_image_new); + plugin_register_category_osd("stopwatch", osd_stopwatch_new); + plugin_register_category_osd("odometer", osd_odometer_new); + plugin_register_category_osd("auxmap", osd_auxmap_new); + plugin_register_category_osd("cmd_interface", osd_cmd_interface_new); + plugin_register_category_osd("route_guard", osd_route_guard_new); + plugin_register_category_osd("navigation_status", osd_navigation_status_new); } diff --git a/navit/plugin.c b/navit/plugin.c index 2edf9ed74..8c61bc9b7 100644 --- a/navit/plugin.c +++ b/navit/plugin.c @@ -378,9 +378,9 @@ plugins_destroy(struct plugins *pls) } static void * -find_by_name(enum plugin_type type, const char *name) +find_by_name(enum plugin_category category, const char *name) { - GList *name_list=plugin_types[type]; + GList *name_list=plugin_categories[category]; while (name_list) { struct name_val *nv=name_list->data; if (!g_ascii_strcasecmp(nv->name, name)) @@ -391,23 +391,23 @@ find_by_name(enum plugin_type type, const char *name) } void * -plugin_get_type(enum plugin_type type, const char *type_name, const char *name) +plugin_get_category(enum plugin_category category, const char *category_name, const char *name) { GList *plugin_list; struct plugin *pl; char *mod_name, *filename=NULL, *corename=NULL; void *result=NULL; - dbg(lvl_debug, "type=\"%s\", name=\"%s\"\n", type_name, name); + dbg(lvl_debug, "category=\"%s\", name=\"%s\"\n", category_name, name); - if ((result=find_by_name(type, name))) { + if ((result=find_by_name(category, name))) { return result; } if (!pls) return NULL; plugin_list=pls->list; - filename=g_strjoin("", "lib", type_name, "_", name, NULL); - corename=g_strjoin("", "lib", type_name, "_", "core", NULL); + filename=g_strjoin("", "lib", category_name, "_", name, NULL); + corename=g_strjoin("", "lib", category_name, "_", "core", NULL); while (plugin_list) { pl=plugin_list->data; if ((mod_name=g_strrstr(pl->name, "/"))) @@ -421,7 +421,7 @@ plugin_get_type(enum plugin_type type, const char *type_name, const char *name) plugin_set_active(pl, 0); if (plugin_get_active(pl)) plugin_call_init(pl); - if ((result=find_by_name(type, name))) { + if ((result=find_by_name(category, name))) { g_free(filename); g_free(corename); return result; diff --git a/navit/plugin.h b/navit/plugin.h index 23901b4ed..4687a6460 100644 --- a/navit/plugin.h +++ b/navit/plugin.h @@ -25,16 +25,32 @@ extern "C" { struct plugin; -enum plugin_type { - plugin_type_graphics, - plugin_type_gui, - plugin_type_map, - plugin_type_osd, - plugin_type_speech, - plugin_type_vehicle, - plugin_type_event, - plugin_type_font, - plugin_type_last, +/** + * @brief All existing plugin categories. + * + * Plugins are grouped into categories. Plugins within one category offer the same + * functionality (GUI, graphics, map etc.). Consequently the category determines the API + * offered by a plugin. + */ +enum plugin_category { + /** Category for plugins which implement a graphics backend. */ + plugin_category_graphics, + /** Category for plugins which implement a GUI frontend. */ + plugin_category_gui, + /** Category for plugins which implement a driver for providing/loading map data. */ + plugin_category_map, + /** Category for plugins which implement an OSD. */ + plugin_category_osd, + /** Category for plugins which implement speech output. */ + plugin_category_speech, + /** Category for plugins which supply position data (typically from a GPS receiver). */ + plugin_category_vehicle, + /** Category for plugins which implement/wrap an event subsystem. */ + plugin_category_event, + /** Category for plugins which load fonts. */ + plugin_category_font, + /** Dummy for last entry. */ + plugin_category_last, }; #endif @@ -44,7 +60,7 @@ struct popup_item; #undef PLUGIN_FUNC1 #undef PLUGIN_FUNC3 #undef PLUGIN_FUNC4 -#undef PLUGIN_TYPE +#undef PLUGIN_CATEGORY #define PLUGIN_PROTO(name,...) void name(__VA_ARGS__) #ifdef PLUGIN_C @@ -81,25 +97,25 @@ struct name_val { void *val; }; -GList *plugin_types[plugin_type_last]; +GList *plugin_categories[plugin_category_last]; -#define PLUGIN_TYPE(type,newargs) \ -struct type##_priv; \ -struct type##_methods; \ +#define PLUGIN_CATEGORY(category,newargs) \ +struct category##_priv; \ +struct category##_methods; \ void \ -plugin_register_##type##_type(const char *name, struct type##_priv *(*new_) newargs) \ +plugin_register_category_##category(const char *name, struct category##_priv *(*new_) newargs) \ { \ struct name_val *nv; \ nv=g_new(struct name_val, 1); \ nv->name=g_strdup(name); \ nv->val=new_; \ - plugin_types[plugin_type_##type]=g_list_append(plugin_types[plugin_type_##type], nv); \ + plugin_categories[plugin_category_##category]=g_list_append(plugin_categories[plugin_category_##category], nv); \ } \ \ void * \ -plugin_get_##type##_type(const char *name) \ +plugin_get_category_##category(const char *name) \ { \ - return plugin_get_type(plugin_type_##type, #type, name); \ + return plugin_get_category(plugin_category_##category, #category, name); \ } #else @@ -115,11 +131,11 @@ void plugin_call_##name(t1 p1,t2 p2,t3 p3); void plugin_register_##name(void(*func)(t1 p1,t2 p2,t3 p3,t4 p4)); \ void plugin_call_##name(t1 p1,t2 p2,t3 p3,t4 p4); -#define PLUGIN_TYPE(type,newargs) \ -struct type##_priv; \ -struct type##_methods; \ -void plugin_register_##type##_type(const char *name, struct type##_priv *(*new_) newargs); \ -void *plugin_get_##type##_type(const char *name); +#define PLUGIN_CATEGORY(category,newargs) \ +struct category##_priv; \ +struct category##_methods; \ +void plugin_register_category_##category(const char *name, struct category##_priv *(*new_) newargs); \ +void *plugin_get_category_##category(const char *name); #endif @@ -148,7 +164,7 @@ struct plugins *plugins_new(void); struct plugin *plugin_new(struct attr *parent, struct attr ** attrs); void plugins_init(struct plugins *pls); void plugins_destroy(struct plugins *pls); -void *plugin_get_type(enum plugin_type type, const char *type_name, const char *name); +void *plugin_get_category(enum plugin_category category, const char *category_name, const char *name); /* end of prototypes */ #ifdef __cplusplus diff --git a/navit/plugin/j1850/j1850.c b/navit/plugin/j1850/j1850.c index b4648bcfe..26e18057d 100644 --- a/navit/plugin/j1850/j1850.c +++ b/navit/plugin/j1850/j1850.c @@ -502,5 +502,5 @@ plugin_init(void) struct attr callback,navit; struct attr_iter *iter; - plugin_register_osd_type("j1850", osd_j1850_new); + plugin_register_category_osd("j1850", osd_j1850_new); } diff --git a/navit/plugin/pedestrian/pedestrian.c b/navit/plugin/pedestrian/pedestrian.c index 444543694..7e5a4361d 100644 --- a/navit/plugin/pedestrian/pedestrian.c +++ b/navit/plugin/pedestrian/pedestrian.c @@ -1369,8 +1369,8 @@ plugin_init(void) (*jnienv)->CallVoidMethod(jnienv, android_activity, Activity_setRequestedOrientation, 0); #endif - plugin_register_osd_type("marker", osd_marker_new); - plugin_register_map_type("route_occluded", map_route_occluded_new); + plugin_register_category_osd("marker", osd_marker_new); + plugin_register_category_map("route_occluded", map_route_occluded_new); callback.type=attr_callback; callback.u.callback=callback_new_attr_0(callback_cast(pedestrian_navit), attr_navit); config_add_attr(config, &callback); diff --git a/navit/plugin_def.h b/navit/plugin_def.h index 01acea7bf..985160e6f 100644 --- a/navit/plugin_def.h +++ b/navit/plugin_def.h @@ -23,11 +23,11 @@ struct callback_list; struct gui; PLUGIN_FUNC1(draw, struct container *, co) PLUGIN_FUNC3(popup, struct container *, map, struct popup *, p, struct popup_item **, list) -PLUGIN_TYPE(graphics, (struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)) -PLUGIN_TYPE(gui, (struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui)) -PLUGIN_TYPE(map, (struct map_methods *meth, struct attr **attrs, struct callback_list *cbl)) -PLUGIN_TYPE(osd, (struct navit *nav, struct osd_methods *meth, struct attr **attrs)) -PLUGIN_TYPE(speech, (struct speech_methods *meth, struct attr **attrs, struct attr *parent)) -PLUGIN_TYPE(vehicle, (struct vehicle_methods *meth, struct callback_list *cbl, struct attr **attrs)) -PLUGIN_TYPE(event, (struct event_methods *meth)) -PLUGIN_TYPE(font, (void *meth)) +PLUGIN_CATEGORY(graphics, (struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)) +PLUGIN_CATEGORY(gui, (struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui)) +PLUGIN_CATEGORY(map, (struct map_methods *meth, struct attr **attrs, struct callback_list *cbl)) +PLUGIN_CATEGORY(osd, (struct navit *nav, struct osd_methods *meth, struct attr **attrs)) +PLUGIN_CATEGORY(speech, (struct speech_methods *meth, struct attr **attrs, struct attr *parent)) +PLUGIN_CATEGORY(vehicle, (struct vehicle_methods *meth, struct callback_list *cbl, struct attr **attrs)) +PLUGIN_CATEGORY(event, (struct event_methods *meth)) +PLUGIN_CATEGORY(font, (void *meth)) diff --git a/navit/route.c b/navit/route.c index 3fdc38964..e367c3855 100644 --- a/navit/route.c +++ b/navit/route.c @@ -4202,8 +4202,8 @@ route_attr_iter_destroy(struct attr_iter *iter) void route_init(void) { - plugin_register_map_type("route", route_map_new); - plugin_register_map_type("route_graph", route_graph_map_new); + plugin_register_category_map("route", route_map_new); + plugin_register_category_map("route_graph", route_graph_map_new); } void diff --git a/navit/speech.c b/navit/speech.c index d3b09ae3a..cabd998dc 100644 --- a/navit/speech.c +++ b/navit/speech.c @@ -45,7 +45,7 @@ speech_new(struct attr *parent, struct attr **attrs) return NULL; } dbg(lvl_debug,"type='%s'\n", attr->u.str); - speech_new=plugin_get_speech_type(attr->u.str); + speech_new=plugin_get_category_speech(attr->u.str); dbg(lvl_debug,"new=%p\n", speech_new); if (! speech_new) { dbg(lvl_error,"wrong type '%s'\n", attr->u.str); diff --git a/navit/speech/android/speech_android.c b/navit/speech/android/speech_android.c index 3323245aa..2b3f2612c 100644 --- a/navit/speech/android/speech_android.c +++ b/navit/speech/android/speech_android.c @@ -145,5 +145,5 @@ speech_android_new(struct speech_methods *meth, struct attr **attrs, struct attr void plugin_init(void) { - plugin_register_speech_type("android", speech_android_new); + plugin_register_category_speech("android", speech_android_new); } diff --git a/navit/speech/cmdline/speech_cmdline.c b/navit/speech/cmdline/speech_cmdline.c index 49252f346..490811ce5 100644 --- a/navit/speech/cmdline/speech_cmdline.c +++ b/navit/speech/cmdline/speech_cmdline.c @@ -261,5 +261,5 @@ speechd_new(struct speech_methods *meth, struct attr **attrs, struct attr *paren void plugin_init(void) { - plugin_register_speech_type("cmdline", speechd_new); + plugin_register_category_speech("cmdline", speechd_new); } diff --git a/navit/speech/dbus/speech_dbus.c b/navit/speech/dbus/speech_dbus.c index 53ab46f03..0fdfb71ab 100644 --- a/navit/speech/dbus/speech_dbus.c +++ b/navit/speech/dbus/speech_dbus.c @@ -73,5 +73,5 @@ speech_dbus_new(struct speech_methods *meth, struct attr **attrs, struct attr *p void plugin_init(void) { - plugin_register_speech_type("dbus", speech_dbus_new); + plugin_register_category_speech("dbus", speech_dbus_new); } diff --git a/navit/speech/espeak/speak.c b/navit/speech/espeak/speak.c index 523679b38..329a05d01 100644 --- a/navit/speech/espeak/speak.c +++ b/navit/speech/espeak/speak.c @@ -514,5 +514,5 @@ espeak_new(struct speech_methods *meth, struct attr **attrs, struct attr *parent void plugin_init(void) { - plugin_register_speech_type("espeak", espeak_new); + plugin_register_category_speech("espeak", espeak_new); } diff --git a/navit/speech/speech_dispatcher/speech_speech_dispatcher.c b/navit/speech/speech_dispatcher/speech_speech_dispatcher.c index 05228187c..d22b3f795 100644 --- a/navit/speech/speech_dispatcher/speech_speech_dispatcher.c +++ b/navit/speech/speech_dispatcher/speech_speech_dispatcher.c @@ -77,5 +77,5 @@ speechd_new(struct speech_methods *meth, struct attr **attrs, struct attr *attr) void plugin_init(void) { - plugin_register_speech_type("speech_dispatcher", speechd_new); + plugin_register_category_speech("speech_dispatcher", speechd_new); } diff --git a/navit/track.c b/navit/track.c index 7e9f6fdff..5c16e4261 100644 --- a/navit/track.c +++ b/navit/track.c @@ -1227,5 +1227,5 @@ tracking_map_new(struct map_methods *meth, struct attr **attrs, struct callback_ void tracking_init(void) { - plugin_register_map_type("tracking", tracking_map_new); + plugin_register_category_map("tracking", tracking_map_new); } diff --git a/navit/vehicle.c b/navit/vehicle.c index a280fb024..33cecb0e9 100644 --- a/navit/vehicle.c +++ b/navit/vehicle.c @@ -122,7 +122,7 @@ vehicle_new(struct attr *parent, struct attr **attrs) *colon = '\0'; dbg(lvl_debug, "source='%s' type='%s'\n", source->u.str, type); - vehicletype_new = plugin_get_vehicle_type(type); + vehicletype_new = plugin_get_category_vehicle(type); if (!vehicletype_new) { dbg(lvl_error, "invalid source '%s': unknown type '%s'\n", source->u.str, type); g_free(type); diff --git a/navit/vehicle/android/vehicle_android.c b/navit/vehicle/android/vehicle_android.c index d4b784a0e..89882d048 100644 --- a/navit/vehicle/android/vehicle_android.c +++ b/navit/vehicle/android/vehicle_android.c @@ -292,5 +292,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("android", vehicle_android_new_android); + plugin_register_category_vehicle("android", vehicle_android_new_android); } diff --git a/navit/vehicle/demo/vehicle_demo.c b/navit/vehicle/demo/vehicle_demo.c index c5cf7e045..59a119204 100644 --- a/navit/vehicle/demo/vehicle_demo.c +++ b/navit/vehicle/demo/vehicle_demo.c @@ -298,5 +298,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("demo", vehicle_demo_new); + plugin_register_category_vehicle("demo", vehicle_demo_new); } diff --git a/navit/vehicle/file/vehicle_file.c b/navit/vehicle/file/vehicle_file.c index f7a0024b9..bb6134042 100644 --- a/navit/vehicle/file/vehicle_file.c +++ b/navit/vehicle/file/vehicle_file.c @@ -1046,8 +1046,8 @@ vehicle_file_new_file(struct vehicle_methods void plugin_init(void) { dbg(lvl_debug, "vehicle_file:plugin_init:enter\n"); - plugin_register_vehicle_type("file", vehicle_file_new_file); - plugin_register_vehicle_type("pipe", vehicle_file_new_file); - plugin_register_vehicle_type("socket", vehicle_file_new_file); - plugin_register_vehicle_type("serial", vehicle_file_new_file); + plugin_register_category_vehicle("file", vehicle_file_new_file); + plugin_register_category_vehicle("pipe", vehicle_file_new_file); + plugin_register_category_vehicle("socket", vehicle_file_new_file); + plugin_register_category_vehicle("serial", vehicle_file_new_file); } diff --git a/navit/vehicle/file/vehicle_pipe.c b/navit/vehicle/file/vehicle_pipe.c index 0750edef3..420390d4e 100644 --- a/navit/vehicle/file/vehicle_pipe.c +++ b/navit/vehicle/file/vehicle_pipe.c @@ -23,5 +23,5 @@ void plugin_init(void) { - plugin_get_vehicle_type("file"); + plugin_get_category_vehicle("file"); } diff --git a/navit/vehicle/file/vehicle_serial.c b/navit/vehicle/file/vehicle_serial.c index 0750edef3..420390d4e 100644 --- a/navit/vehicle/file/vehicle_serial.c +++ b/navit/vehicle/file/vehicle_serial.c @@ -23,5 +23,5 @@ void plugin_init(void) { - plugin_get_vehicle_type("file"); + plugin_get_category_vehicle("file"); } diff --git a/navit/vehicle/file/vehicle_socket.c b/navit/vehicle/file/vehicle_socket.c index 0750edef3..420390d4e 100644 --- a/navit/vehicle/file/vehicle_socket.c +++ b/navit/vehicle/file/vehicle_socket.c @@ -23,5 +23,5 @@ void plugin_init(void) { - plugin_get_vehicle_type("file"); + plugin_get_category_vehicle("file"); } diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c index 73d9e648d..a8c29cd97 100644 --- a/navit/vehicle/gpsd/vehicle_gpsd.c +++ b/navit/vehicle/gpsd/vehicle_gpsd.c @@ -471,5 +471,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("gpsd", vehicle_gpsd_new_gpsd); + plugin_register_category_vehicle("gpsd", vehicle_gpsd_new_gpsd); } diff --git a/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c b/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c index dda774e35..fa5eb8780 100644 --- a/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c +++ b/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c @@ -244,5 +244,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("gpsd_dbus", vehicle_gpsd_dbus_new); + plugin_register_category_vehicle("gpsd_dbus", vehicle_gpsd_dbus_new); } diff --git a/navit/vehicle/gypsy/vehicle_gypsy.c b/navit/vehicle/gypsy/vehicle_gypsy.c index 2ff9389f7..589e53a3f 100644 --- a/navit/vehicle/gypsy/vehicle_gypsy.c +++ b/navit/vehicle/gypsy/vehicle_gypsy.c @@ -493,5 +493,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("gypsy", vehicle_gypsy_new_gypsy); + plugin_register_category_vehicle("gypsy", vehicle_gypsy_new_gypsy); } diff --git a/navit/vehicle/iphone/vehicle_iphone.c b/navit/vehicle/iphone/vehicle_iphone.c index 4c25c0235..94fec114a 100644 --- a/navit/vehicle/iphone/vehicle_iphone.c +++ b/navit/vehicle/iphone/vehicle_iphone.c @@ -161,5 +161,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("iphone", vehicle_iphone_new); + plugin_register_category_vehicle("iphone", vehicle_iphone_new); } diff --git a/navit/vehicle/maemo/vehicle_maemo.c b/navit/vehicle/maemo/vehicle_maemo.c index 661202d67..d686a6a03 100644 --- a/navit/vehicle/maemo/vehicle_maemo.c +++ b/navit/vehicle/maemo/vehicle_maemo.c @@ -325,5 +325,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("maemo", vehicle_maemo_new_maemo); + plugin_register_category_vehicle("maemo", vehicle_maemo_new_maemo); } diff --git a/navit/vehicle/null/vehicle_null.c b/navit/vehicle/null/vehicle_null.c index 134538cc3..643945c71 100644 --- a/navit/vehicle/null/vehicle_null.c +++ b/navit/vehicle/null/vehicle_null.c @@ -179,5 +179,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("null", vehicle_null_new_null); + plugin_register_category_vehicle("null", vehicle_null_new_null); } diff --git a/navit/vehicle/webos/vehicle_webos.c b/navit/vehicle/webos/vehicle_webos.c index e0a849b97..a5bba4bce 100644 --- a/navit/vehicle/webos/vehicle_webos.c +++ b/navit/vehicle/webos/vehicle_webos.c @@ -381,6 +381,6 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("webos", vehicle_webos_new); + plugin_register_category_vehicle("webos", vehicle_webos_new); } diff --git a/navit/vehicle/wince/vehicle_wince.c b/navit/vehicle/wince/vehicle_wince.c index 8dd3e40db..38cab3f1c 100644 --- a/navit/vehicle/wince/vehicle_wince.c +++ b/navit/vehicle/wince/vehicle_wince.c @@ -949,6 +949,6 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("wince", vehicle_wince_new); - plugin_register_vehicle_type("file", vehicle_wince_new); + plugin_register_category_vehicle("wince", vehicle_wince_new); + plugin_register_category_vehicle("file", vehicle_wince_new); } |