[Geany-Devel] Plugins sharing resources

Lex Trotman elextr at xxxxx
Fri Apr 5 02:09:17 UTC 2013


There are several plugins that share limited resources, such as scintilla
markers and indicators.

At the moment there is no coordination for using those resources so plugins
can interfere with one another and possibly with Geany.

The only common thing between plugins and Geany is Geany, so this is a
proposal to add a resources management interface to Geany.

The proposed interface is below, I have tried to make it so it is easy to
expand to resources that are not integers (markers and indicators are all
integers)

enum resource_type { GEANY_RESOURCE_MARKER, GEANY_RESOURCE_INDICATOR };
gboolean alloc_int_resource( enum resource_type, int* resource_num );
void free_int_resource( int resource_num );

This allows extra resources to be added without ABI changes (so long as
they are added to the end of the enum).

If (when) other types of resource need managing then extra functions can be
added again without breaking the ABI.

Automatic release is not suggested because that prevents use of RAII and
similar management schemes in C++ or GC for other plugin languages.  For
plain C plugins just call free_int_resource in the plugin_cleanup function.

Any simpler, more flexible suggestions?

Cheers
Lex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20130405/cdf8e27e/attachment.html>


More information about the Devel mailing list