[PD-cvs] pd/src m_obj.c,1.2.4.3.2.10.2.3,1.2.4.3.2.10.2.4
Mathieu Bouchard
matju at users.sourceforge.net
Wed Dec 13 03:17:17 CET 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14465
Modified Files:
Tag: desiredata
m_obj.c
Log Message:
update_object on wire.
Index: m_obj.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_obj.c,v
retrieving revision 1.2.4.3.2.10.2.3
retrieving revision 1.2.4.3.2.10.2.4
diff -C2 -d -r1.2.4.3.2.10.2.3 -r1.2.4.3.2.10.2.4
*** m_obj.c 13 Dec 2006 01:17:38 -0000 1.2.4.3.2.10.2.3
--- m_obj.c 13 Dec 2006 02:17:15 -0000 1.2.4.3.2.10.2.4
***************
*** 335,344 ****
}
! struct _outconnect
! {
t_gobj oc_gobj;
struct _outconnect *oc_next;
t_pd *oc_to;
! };
struct _outlet
--- 335,346 ----
}
! typedef struct _outconnect {
t_gobj oc_gobj;
struct _outconnect *oc_next;
t_pd *oc_to;
! t_object *from;
! t_object *to;
! short outlet, inlet;
! } t_wire;
struct _outlet
***************
*** 350,354 ****
};
- typedef struct _outconnect t_wire;
t_class *wire_class;
t_wire *wire_new (t_symbol *s, int argc, t_atom *argv) {
--- 352,355 ----
***************
*** 363,368 ****
void wire_save (t_wire *self, t_binbuf *b) {
t_canvas *c = self->oc_gobj.dix->canvas;
! /*binbuf_addv(b, "ssiiii;", gensym("#X"), gensym("connect"),
! canvas_getindex(c,t.from), t.outlet, canvas_getindex(c,t.to), t.inlet);*/
appendix_save(self,b);
}
--- 364,369 ----
void wire_save (t_wire *self, t_binbuf *b) {
t_canvas *c = self->oc_gobj.dix->canvas;
! binbuf_addv(b, "ssiiii;", gensym("#X"), gensym("connect"),
! canvas_getindex(c,self->from), self->outlet, canvas_getindex(c,self->to), self->inlet);
appendix_save(self,b);
}
***************
*** 536,561 ****
}
! t_outconnect *obj_connect(t_object *source, int outno,
! t_object *sink, int inno)
! {
! t_inlet *i;
! t_outlet *o;
! t_pd *to;
! t_outconnect *oc, *oc2;
!
for (o = source->ob_outlet; o && outno; o = o->o_next, outno--) ;
! if (!o) return (0);
!
! if (sink->ob_pd->c_firstin)
! {
! if (!inno)
! {
! to = &sink->ob_pd;
! goto doit;
! }
! else inno--;
! }
for (i = sink->ob_inlet; i && inno; i = i->i_next, inno--) ;
! if (!i) return (0);
to = &i->i_pd;
doit:
--- 537,547 ----
}
! t_outconnect *obj_connect(t_object *source, int outno, t_object *sink, int inno) {
! t_inlet *i; t_outlet *o; t_pd *to; t_outconnect *oc, *oc2;
for (o = source->ob_outlet; o && outno; o = o->o_next, outno--) ;
! if (!o) return 0;
! if (sink->ob_pd->c_firstin) {if (!inno) {to = &sink->ob_pd; goto doit;} else inno--;}
for (i = sink->ob_inlet; i && inno; i = i->i_next, inno--) ;
! if (!i) return 0;
to = &i->i_pd;
doit:
***************
*** 563,597 ****
oc->oc_next = 0;
oc->oc_to = to;
/* append it to the end of the list */
/* LATER we might cache the last "oc" to make this faster. */
! if ((oc2 = o->o_connections))
! {
while (oc2->oc_next) oc2 = oc2->oc_next;
oc2->oc_next = oc;
! }
! else o->o_connections = oc;
if (o->o_sym == &s_signal) canvas_update_dsp();
!
! return (oc);
}
! void obj_disconnect(t_object *source, int outno, t_object *sink, int inno)
! {
! t_inlet *i;
! t_outlet *o;
! t_pd *to;
! t_outconnect *oc, *oc2;
!
! for (o = source->ob_outlet; o && outno; o = o->o_next, outno--)
if (!o) return;
! if (sink->ob_pd->c_firstin)
! {
! if (!inno)
! {
! to = &sink->ob_pd;
! goto doit;
! }
! else inno--;
! }
for (i = sink->ob_inlet; i && inno; i = i->i_next, inno--) ;
if (!i) return;
--- 549,571 ----
oc->oc_next = 0;
oc->oc_to = to;
+ oc->from = source;
+ oc->to = sink;
+ oc->outlet = outno;
+ oc->inlet = inno;
/* append it to the end of the list */
/* LATER we might cache the last "oc" to make this faster. */
! if ((oc2 = o->o_connections)) {
while (oc2->oc_next) oc2 = oc2->oc_next;
oc2->oc_next = oc;
! } else o->o_connections = oc;
if (o->o_sym == &s_signal) canvas_update_dsp();
! return oc;
}
! void obj_disconnect(t_object *source, int outno, t_object *sink, int inno) {
! t_inlet *i; t_outlet *o; t_pd *to; t_outconnect *oc, *oc2;
! for (o = source->ob_outlet; o && outno; o = o->o_next, outno--) ;
if (!o) return;
! if (sink->ob_pd->c_firstin) {if (!inno) {to = &sink->ob_pd; goto doit;} else inno--;}
for (i = sink->ob_inlet; i && inno; i = i->i_next, inno--) ;
if (!i) return;
***************
*** 599,612 ****
doit:
if (!(oc = o->o_connections)) return;
! if (oc->oc_to == to)
! {
o->o_connections = oc->oc_next;
freebytes(oc, sizeof(*oc));
goto done;
}
! while (oc2 = oc->oc_next)
! {
! if (oc2->oc_to == to)
! {
oc->oc_next = oc2->oc_next;
freebytes(oc2, sizeof(*oc2));
--- 573,583 ----
doit:
if (!(oc = o->o_connections)) return;
! if (oc->oc_to == to) {
o->o_connections = oc->oc_next;
freebytes(oc, sizeof(*oc));
goto done;
}
! while (oc2 = oc->oc_next) {
! if (oc2->oc_to == to) {
oc->oc_next = oc2->oc_next;
freebytes(oc2, sizeof(*oc2));
More information about the Pd-cvs
mailing list