diff options
author | horwitz <horwitz@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-07-01 12:58:52 +0000 |
---|---|---|
committer | horwitz <horwitz@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-07-01 12:58:52 +0000 |
commit | 673c6a951921d3e41392a79b5a3b68117cca9b2b (patch) | |
tree | 3faa8572f6bfa3e4fc6f60517228f1ab4f35361d /navit/plugin.c | |
parent | 41879f2848804e84571b88da16e2ffddd6039e4a (diff) | |
download | navit-673c6a951921d3e41392a79b5a3b68117cca9b2b.tar.gz |
Core:Add:Add support for ondemand module loading. (still broken)
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1188 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/plugin.c')
-rw-r--r-- | navit/plugin.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/navit/plugin.c b/navit/plugin.c index b54802750..cf2204797 100644 --- a/navit/plugin.c +++ b/navit/plugin.c @@ -40,7 +40,7 @@ struct plugin { struct plugins { GHashTable *hash; GList *list; -}; +} *pls; struct plugin * plugin_new(char *plugin) @@ -142,6 +142,7 @@ plugins_new(void) { struct plugins *ret=g_new0(struct plugins, 1); ret->hash=g_hash_table_new(g_str_hash, g_str_equal); + pls=ret; return ret; } @@ -235,10 +236,13 @@ plugins_destroy(struct plugins *pls) } void * -plugin_get_type(enum plugin_type type, const char *name) +plugin_get_type(enum plugin_type type, const char *type_name, const char *name) { - GList *l; + dbg(0, "type=\"%s\", name=\"%s\"\n", type_name, name); + GList *l,*lpls; struct name_val *nv; + struct plugin *pl; + char *mod_name; l=plugin_types[type]; while (l) { nv=l->data; @@ -246,5 +250,30 @@ plugin_get_type(enum plugin_type type, const char *name) return nv->val; l=g_list_next(l); } + lpls=pls->list; + while (lpls) { + pl=lpls->data; + if ((mod_name=g_strrstr(pl->name, "/"))) + mod_name++; + else + mod_name=pl->name; + if (!g_ascii_strncasecmp(mod_name+3, type_name, strlen(type_name)) + && !g_ascii_strncasecmp(mod_name+4+strlen(type_name), name, strlen(name))) { + dbg(0, "pl->name=\"%s\"\n",pl->name) ; + if (plugin_get_active(pl)) + if (!plugin_load(pl)) + plugin_set_active(pl, 0); + if (plugin_get_active(pl)) + plugin_call_init(pl); + l=plugin_types[type]; + while (l) { + nv=l->data; + if (!g_ascii_strcasecmp(nv->name, name)) + return nv->val; + l=g_list_next(l); + } + } + lpls=g_list_next(lpls); + } return NULL; } |