[Geany-Devel] Plugins sharing resources

Lex Trotman elextr at xxxxx
Sat Apr 6 00:18:11 UTC 2013


On 6 April 2013 00:02, William Fraser <william.fraser at virgin.net> wrote:

> I attached an int to each scintilla object to keep track of what's been
> assigned in my markers plugin. The only problem was that some markers are
> used by scintilla, so any plugin would have to make note of which ones were
> being used by the editor (with the problem that you would have to update
> plugins if editor changed) or, you would have to submit code to scintilla
> so that it also used the uniform resource allocation.
>

Hi William,

Which plugin is that?  And how do you know that say the bookmarks plugin
isn't using that marker already?  Thats the sort of problem this is to
solve.

Cheers
Lex



>
>
> -------- Original Message --------
>
> Lex Trotman <elextr at gmail.com> wrote:
>
> 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
>>
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20130406/6d7046e4/attachment-0001.html>


More information about the Devel mailing list