[Geany-Devel] Plugins sharing resources

Lex Trotman elextr at xxxxx
Fri Apr 5 09:20:55 UTC 2013


Update:

Matthew has pointed out on IRC that the markers and indicators are per
scintilla object, not global.  He has a suggested alternative API which he
will post after its tested.

Cheers
Lex


On 5 April 2013 13:09, Lex Trotman <elextr at gmail.com> wrote:

> 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/58d51d15/attachment.html>


More information about the Devel mailing list