On Thu, 27 Nov 2008 18:35:39 +0000, Nick Treleaven nick.treleaven@btinternet.com wrote:
On Mon, 24 Nov 2008 17:20:51 +0000 Nick Treleaven nick.treleaven@btinternet.com wrote:
As using pointers to call plugin API functions is a bit ugly, I've been planning on writing a wrapper shared library. But perhaps that is unnecessary, perhaps macros would do instead:
#define plugin_add_toolbar_item \ p_plugin->add_toolbar_item
Are there any problems with this approach?
The attached script genapi.py currently does this for all API
I know that normally we should avoid macros, but I think for function names this should be OK, I can't think of any good reason why there would be name conflicts.
geanyfunctions.h would have to be included after anything like utils.h. But I think we should add a single header include for plugins, so this would ensure headers were included in the right order. A single header include is probably good anyway in case we want to move declarations or rename any source files.
I'd like to add this to SVN, maybe somehow deprecating pluginmacros.h, but not removing it for a while. In future, genapi.py could add the geanyfunctions-> prefix and we could remove pluginmacros.h.
I'm fine with this, go ahead. It'd be much better to have plugin_add_toolbar_item than p_plugin->add_toolbar_item even though we will get this by macros :).
It makes the code more readable, more easy to write and then the function names match with the API docs.
Regards, Enrico