Enlightenment CVS committal
Author : pfritz
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore
Modified Files:
Ecore_Data.h ecore_path.c ecore_plugin.c
Log Message:
*API BREAK*
rename ecore_plugin_call() to ecore_plugin_symbol_get()
add a version argument to ecore_plugin_load(); it makes it possible to have
different versions for the interface. NULL gives you the old behaivor
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -3 -r1.48 -r1.49
--- Ecore_Data.h 2 Sep 2007 12:21:00 -0000 1.48
+++ Ecore_Data.h 4 Sep 2007 18:23:47 -0000 1.49
@@ -324,15 +324,13 @@
typedef struct _ecore_plugin Ecore_Plugin;
struct _ecore_plugin
{
- int group;
- char *name;
void *handle;
};
/*
* Load the specified plugin
*/
- EAPI Ecore_Plugin *ecore_plugin_load(int group_id, const char *plugin);
+ EAPI Ecore_Plugin *ecore_plugin_load(int group_id, const char *plugin,
const char *version);
/*
* Unload the specified plugin
@@ -342,8 +340,8 @@
/*
* Lookup the specified symbol for the plugin
*/
- EAPI void *ecore_plugin_call(Ecore_Plugin * plugin, const char
*symbol_name);
-
+ EAPI void *ecore_plugin_symbol_get(Ecore_Plugin * plugin, const char
*symbol_name);
+
EAPI Ecore_List *ecore_plugin_available_get(int group_id);
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_path.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- ecore_path.c 2 Sep 2007 17:54:16 -0000 1.15
+++ ecore_path.c 4 Sep 2007 18:23:47 -0000 1.16
@@ -331,7 +331,13 @@
ext = strrchr(ppath, '.');
*ext = '\0';
- ecore_hash_set(plugins, strdup(ppath), (void *)1);
+ if (!ecore_hash_get(plugins, ppath))
+ {
+ char *key;
+
+ key = strdup(ppath);
+ ecore_hash_set(plugins, key, key);
+ }
}
}
ecore_hash_free_key_cb_set(plugins, NULL);
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_plugin.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- ecore_plugin.c 26 Aug 2007 11:17:21 -0000 1.13
+++ ecore_plugin.c 4 Sep 2007 18:23:47 -0000 1.14
@@ -1,3 +1,6 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
#ifndef _WIN32
# include <dlfcn.h>
# include "ecore_private.h"
@@ -15,12 +18,14 @@
* Loads the specified plugin from the specified path group.
* @param group_id The path group to search for the plugin to load
* @param plugin_name The name of the plugin to load.
+ * @param version The interface version of the plugin. With version
+ * equal to NULL the default will be loaded.
* @return A pointer to the newly loaded plugin on success, @c NULL on
* failure.
* @ingroup Ecore_Plugin
*/
EAPI Ecore_Plugin *
-ecore_plugin_load(int group_id, const char *plugin_name)
+ecore_plugin_load(int group_id, const char *plugin_name, const char *version)
{
char *path;
char temp[PATH_MAX];
@@ -30,14 +35,28 @@
CHECK_PARAM_POINTER_RETURN("plugin_name", plugin_name, NULL);
- snprintf(temp, PATH_MAX, "%s.so", plugin_name);
+ if (!version || *version == '\0')
+ snprintf(temp, sizeof(temp), "%s.so", plugin_name);
+ else
+ snprintf(temp, sizeof(temp), "%s.so.%s", plugin_name, version);
+
path = ecore_path_group_find(group_id, temp);
+ if (!path && version)
+ {
+ /* if this file doesn't exist try a different order */
+ snprintf(temp, sizeof(temp), "%s.%s.so", plugin_name, version);
+ path = ecore_path_group_find(group_id, temp);
+ }
+
if (!path)
return NULL;
handle = dlopen(path, RTLD_LAZY);
if (!handle)
- return NULL;
+ {
+ FREE(path);
+ return NULL;
+ }
/*
* Allocate the new plugin and initialize it's fields
@@ -46,12 +65,11 @@
if (!plugin)
{
dlclose(handle);
+ FREE(path);
return NULL;
}
memset(plugin, 0, sizeof(Ecore_Plugin));
- plugin->group = group_id;
- plugin->name = strdup(plugin_name);
plugin->handle = handle;
/*
@@ -91,7 +109,6 @@
dlclose(plugin->handle);
- FREE(plugin->name);
FREE(plugin);
}
@@ -103,7 +120,7 @@
* @ingroup Ecore_Plugin
*/
EAPI void *
-ecore_plugin_call(Ecore_Plugin *plugin, const char *symbol_name)
+ecore_plugin_symbol_get(Ecore_Plugin *plugin, const char *symbol_name)
{
void *ret;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs