hi Mathieu,
Mathieu Bouchard wrote:
On Wed, 23 Nov 2005, Krzysztof Czaja wrote:
what I wrote was a rough sketch, written only to show that adding per-canvas declarations is not as hard as one might have thought.
Why should new C-based components still use linked lists instead of some other data structure?
for simplicity
. add new member "t_libentry *gl_liblist" to struct _glist; . inherit parent's library list when creating child canvases;
How do you ever get to deallocate t_libentry ?
(also, if there is no reference-counter then you can't share portions of the liblist among several patchers and so there's no point in making it a linked list either. you have to copy the liblist every time)
why not to do it by copying entries? Btw, inheritance should apply only to subpatches, not abstractions.
The order of objects in a glist is important, as this is what is used to generate "#X connect" lines. Do you really mean to save [using] decls first?
you are right, although this might be fixed easily by increasing a value returned by canvas_getindex(x, y) with a count of declaration objects that are y's successors in x. Another way might be to keep a glist properly sorted in the first place (sorting all newly created objects into their proper places).
Krzysztof