Hi Henri - This is a reflection of Pd's extremely data-hiding programming style - the idea is to keep the structures hidden so that if they are changed it doesn't break stuff.
And yes, it gets awkward in spots - especially because ugen sorting and the like have to have accessor functions that count inlets/outlets and so on. The way Pd's internal code finds out about connections (in order to draw them for instance) can be seen in the function canvas_drawlines() for example - which uses the functions linetraverser_start() and linetraverser_next() to find them. cheers Miller On Tue, Nov 20, 2018 at 04:37:03PM +0000, Henri Augusto Bisognini wrote: > Hi. > > I'm starting to dwelve into pd's C side of things. I'm having a really hard > time figuring stuff out. (i have mainly experience with more high-level > languages like Java, etc) > > I'm trying to experiment with some editor features and i've been wandering: > > why the _inlet and _outlet structures are defined in m_obj.c instead of > m_pd.h ? > > This way i can't access the structure members. I'm trying to traverse an > t_object's t_outlets linked list but > > t_outlet *o = selected_object->te_outlet; > o = o->o_next; > but this throws me an "dereferencing incomplete type" error since there is no > definition for t_outlet inside m_pd. > > The same goes for accessing members of t_outconnect for example, but there > are two methods that allows you to traverse the connections linked list > obj_starttraverseoutlet() (m_imp.h)(m_obj.c) > obj_nexttraverseoutlet() (m_imp.h)(m_obj.c) > But i couldn't find any method to traverse an t_object's linked list of > t_outlets. The only three methods that seems to return t_outlets pointers are > > t_outlet *outlet_new(t_object *owner, t_symbol *s) > (m_obj.c) > t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *s) > (g_graph.c) > and > t_outlet *voutlet_getit(t_pd *x) (g_io.c) > which i currently do not understand but doesn't seem to be what i'm looking > for. > > How could i traverse from, lets say the g_editor.c file, all the t_inlets and > t_outlets of an t_object? > > Btw, on a second question, what exactly are vinlets and voutlets? > > Cheers, > Henri. > _______________________________________________ > Pd-dev mailing list > [email protected] > https://lists.puredata.info/listinfo/pd-dev _______________________________________________ Pd-dev mailing list [email protected] https://lists.puredata.info/listinfo/pd-dev
