Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26392
Modified Files: Tag: desiredata m_obj.c Log Message: fixed bug in obj_disconnect
Index: m_obj.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_obj.c,v retrieving revision 1.2.4.3.2.10.2.9 retrieving revision 1.2.4.3.2.10.2.10 diff -C2 -d -r1.2.4.3.2.10.2.9 -r1.2.4.3.2.10.2.10 *** m_obj.c 13 Dec 2006 16:45:19 -0000 1.2.4.3.2.10.2.9 --- m_obj.c 13 Dec 2006 17:33:56 -0000 1.2.4.3.2.10.2.10 *************** *** 246,250 **** typedef struct _outconnect { t_gobj oc_gobj; ! struct _outconnect *oc_next; t_pd *oc_to; t_object *from; --- 246,250 ---- typedef struct _outconnect { t_gobj oc_gobj; ! struct _outconnect *next; t_pd *oc_to; t_object *from; *************** *** 302,327 **** void outlet_bang(t_outlet *x) {ENTER{ t_outconnect *oc; ! for (oc = x->o_connections; oc; oc = oc->oc_next) pd_bang(oc->oc_to); }LEAVE} void outlet_pointer(t_outlet *x, t_gpointer *gp) {ENTER{ t_outconnect *oc; t_gpointer gpointer = *gp; ! for (oc = x->o_connections; oc; oc = oc->oc_next) pd_pointer(oc->oc_to, &gpointer); }LEAVE} void outlet_float(t_outlet *x, t_float f) {ENTER{ t_outconnect *oc; ! for (oc = x->o_connections; oc; oc = oc->oc_next) pd_float(oc->oc_to, f); }LEAVE} void outlet_symbol(t_outlet *x, t_symbol *s) {ENTER{ t_outconnect *oc; ! for (oc = x->o_connections; oc; oc = oc->oc_next) pd_symbol(oc->oc_to, s); }LEAVE} void outlet_list(t_outlet *x, t_symbol *s, int argc, t_atom *argv) {ENTER{ t_outconnect *oc; ! for (oc = x->o_connections; oc; oc = oc->oc_next) pd_list(oc->oc_to, s, argc, argv); }LEAVE} void outlet_anything(t_outlet *x, t_symbol *s, int argc, t_atom *argv) {ENTER{ t_outconnect *oc; ! for (oc = x->o_connections; oc; oc = oc->oc_next) typedmess(oc->oc_to, s, argc, argv); }LEAVE}
--- 302,327 ---- void outlet_bang(t_outlet *x) {ENTER{ t_outconnect *oc; ! for (oc = x->o_connections; oc; oc = oc->next) pd_bang(oc->oc_to); }LEAVE} void outlet_pointer(t_outlet *x, t_gpointer *gp) {ENTER{ t_outconnect *oc; t_gpointer gpointer = *gp; ! for (oc = x->o_connections; oc; oc = oc->next) pd_pointer(oc->oc_to, &gpointer); }LEAVE} void outlet_float(t_outlet *x, t_float f) {ENTER{ t_outconnect *oc; ! for (oc = x->o_connections; oc; oc = oc->next) pd_float(oc->oc_to, f); }LEAVE} void outlet_symbol(t_outlet *x, t_symbol *s) {ENTER{ t_outconnect *oc; ! for (oc = x->o_connections; oc; oc = oc->next) pd_symbol(oc->oc_to, s); }LEAVE} void outlet_list(t_outlet *x, t_symbol *s, int argc, t_atom *argv) {ENTER{ t_outconnect *oc; ! for (oc = x->o_connections; oc; oc = oc->next) pd_list(oc->oc_to, s, argc, argv); }LEAVE} void outlet_anything(t_outlet *x, t_symbol *s, int argc, t_atom *argv) {ENTER{ t_outconnect *oc; ! for (oc = x->o_connections; oc; oc = oc->next) typedmess(oc->oc_to, s, argc, argv); }LEAVE}
*************** *** 365,369 **** if (!o||!i) return 0; oc = wire_new(0,0,0); ! oc->oc_next = 0; oc->oc_to = i; oc->from = from; oc->outlet = outlet; --- 365,369 ---- if (!o||!i) return 0; oc = wire_new(0,0,0); ! oc->next = 0; oc->oc_to = i; oc->from = from; oc->outlet = outlet; *************** *** 372,377 **** /* 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(); --- 372,377 ---- /* LATER we might cache the last "oc" to make this faster. */ if ((oc2 = o->o_connections)) { ! while (oc2->next) oc2 = oc2->next; ! oc2->next = oc; } else o->o_connections = oc; if (o->o_sym == &s_signal) canvas_update_dsp(); *************** *** 379,401 **** }
! 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; ! to = &i->i_pd; ! doit: if (!(oc = o->o_connections)) return; ! if (oc->oc_to == to) { ! o->o_connections = oc->oc_next; pd_free((t_pd *)oc); goto done; } ! while (oc2 = oc->oc_next) { ! if (oc2->oc_to == to) { ! oc->oc_next = oc2->oc_next; ! pd_free((t_pd *)oc); goto done; } --- 379,397 ---- }
! void obj_disconnect(t_object *from, int outlet, t_object *to, int inlet) { ! t_outconnect *oc, *oc2; ! t_outlet *o = find_outlet(from,outlet); ! t_pd *i = find_inlet(to,inlet); ! if (!o||!i) return; if (!(oc = o->o_connections)) return; ! if (oc->oc_to == i) { ! o->o_connections = oc->next; pd_free((t_pd *)oc); goto done; } ! while (oc2 = oc->next) { ! if (oc2->oc_to == i) { ! oc->next = oc2->next; ! pd_free((t_pd *)oc2); goto done; } *************** *** 409,440 ****
int obj_noutlets(t_object *x) { ! int n; t_outlet *o; ! for (o = x->ob_outlet, n = 0; o; o = o->o_next) n++; return n; }
int obj_ninlets(t_object *x) { ! int n; t_inlet *i; ! for (i = x->ob_inlet, n = 0; i; i = i->i_next) n++; ! if (x->ob_pd->c_firstin) n++; return n; }
! t_outconnect *obj_starttraverseoutlet(t_object *x, t_outlet **op, int nout) ! { t_outlet *o = x->ob_outlet; while (nout-- && o) o = o->o_next; *op = o; ! if (o) return (o->o_connections); ! else return (0); }
! t_outconnect *obj_nexttraverseoutlet(t_outconnect *lastconnect, ! t_object **destp, t_inlet **inletp, int *whichp) ! { t_pd *y; y = lastconnect->oc_to; ! if (ISINLET(y)) ! { int n; t_inlet *i = (t_inlet *)y, *i2; --- 405,430 ----
int obj_noutlets(t_object *x) { ! int n=0; t_outlet *o; ! for (o = x->ob_outlet; o; o = o->o_next) n++; return n; }
int obj_ninlets(t_object *x) { ! int n=!!x->ob_pd->c_firstin; t_inlet *i; ! for (i = x->ob_inlet; i; i = i->i_next) n++; return n; }
! t_outconnect *obj_starttraverseoutlet(t_object *x, t_outlet **op, int nout) { t_outlet *o = x->ob_outlet; while (nout-- && o) o = o->o_next; *op = o; ! return o ? o->o_connections : 0; }
! t_outconnect *obj_nexttraverseoutlet(t_outconnect *lastconnect, t_object **destp, t_inlet **inletp, int *whichp) { t_pd *y; y = lastconnect->oc_to; ! if (ISINLET(y)) { int n; t_inlet *i = (t_inlet *)y, *i2; *************** *** 445,464 **** *destp = dest; *inletp = i; ! } ! else ! { *whichp = 0; *inletp = 0; ! *destp = ((t_object *)y); } ! return (lastconnect->oc_next); }
/* this one checks that a pd is indeed a patchable object, and returns it, correctly typed, or zero if the check failed. */ ! t_object *pd_checkobject(t_pd *x) ! { ! if ((*x)->c_patchable) return ((t_object *)x); ! else return (0); }
--- 435,450 ---- *destp = dest; *inletp = i; ! } else { *whichp = 0; *inletp = 0; ! *destp = (t_object *)y; } ! return lastconnect->next; }
/* this one checks that a pd is indeed a patchable object, and returns it, correctly typed, or zero if the check failed. */ ! t_object *pd_checkobject(t_pd *x) { ! return (*x)->c_patchable ? (t_object *)x : 0; }