[Geany-Devel] Adding a plugin
Roger Booth
rbooth at xxxxx
Sun Jun 9 10:41:55 UTC 2013
On 06/09/2013 03:19 AM, Matthew Brush wrote:
> On 13-06-09 03:07 AM, Frank Lanitz wrote:
>> On Sun, 09 Jun 2013 01:46:09 -0700
>> Matthew Brush <mbrush at codebrainz.ca> wrote:
>>
>>> On 13-06-08 02:54 AM, Roger Booth wrote:
>>>> [...]
>>>
>>>> One thing I could ask for is a reference in the docs to where I can
>>>> find the correspondence between api and abi. Maybe thats the wrong
>>>> question, but anyway, how do i know which abi version I need? This
>>>> is in regards to PLUGIN_VERSION_CHECK(xxx)
>>>>
>>>
>>> As mentioned in other replies, there's the wiki page that maps API,
>>> ABI and other versions into a simple table.
>>>
>>> IMO, plugin authors shouldn't have to bother with ABI numbers at all
>>> and API numbers should be transparent. If I want to write a plugin, I
>>> would like to have some boilerplate like:
>>>
>>> #include <geanyplugins.h>
>>>
>>> GEANY_PLUGIN_REGISTER(1, 24, 0, /* min supported geany version */
>>> "Hello World",
>>> "0.01",
>>> "Another hello world",
>>> "You <you at yourdomain.org>");
>>>
>>> void plugin_load(GeanyPlugin *plugin)
>>> {
>>> g_print("Loading plugin '%s'...\n",
>>> geany_plugin_get_name(plugin));
>>> }
>>>
>>> void plugin_unload(GeanyPlugin *plugin)
>>> {
>>> g_print("Unloading plugin '%s'...\n",
>>> geany_plugin_get_name(plugin));
>>> }
>>
>>
>> Well... Not sure whether it's really better than the current approach
>> but patches are welcome ;)
>>
>
> Compared to current approach:
>
> #include <geanyplugin.h>
>
> GeanyFunctions *geany_functions; // WTF is this?
> GeanyPlugin *geany_plugin; // Why is this global?
> GeanyData *geany_data; // WTF?
>
> GEANY_VERSION_CHECK(211 /* WTF!? What is this!? */) /* semi-colon? */
>
> GEANY_SET_INFO("Hello World",
> _("0.01"), /* What stuff to translate? */
> "Another hello world",
> "You <you at yourdomain.org>");
>
> void plugin_init(GeanyData *data /* WTF!? isn't this the global
> GeanyData? */
> {
> /* If you use any custom GObjects, you must register them and
> then you must call the Geany version of the make_resident() function
> from GModule. */
> }
>
> void plugin_cleanup(void /* WTF!? Why not GeanyData or
> GeanyPlugin? */)
> {
> /* free nasty globals here */
> }
>
> Cheers,
> Matthew Brush
>
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel
>
>
Sorry, but I didn't understand exactly what you were attempting to
demonstrate in your example.
Please take pity on an admitted moron here and expand a bit on what is
going on in the example.
Main questions:
where does the magic number 211 come from? GEANY_VERSION_CHECK(211...)
Lex says we're supposed to use API numbers, like 0.19. Please,
as a demo, convert that to an int.
When I try, I get zero. But, like I said, I'm a moron.
in plugin_init you have this WTF comment, but do not answer the
question.
Is the param the same as the global? Param == global: true or
false?
in plugin_cleanup
yes, I clean my dishes. As long as I can find the sink.
More information about the Devel
mailing list