Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16168
Modified Files: Tag: desiredata m_pd.c Log Message: added object_table
Index: m_pd.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_pd.c,v retrieving revision 1.3.8.8.2.2 retrieving revision 1.3.8.8.2.3 diff -C2 -d -r1.3.8.8.2.2 -r1.3.8.8.2.3 *** m_pd.c 8 Dec 2006 04:46:18 -0000 1.3.8.8.2.2 --- m_pd.c 13 Dec 2006 05:24:58 -0000 1.3.8.8.2.3 *************** *** 6,10 **** #include "desire.h"
! /* FIXME no out-of-memory testing yet! */
t_pd *pd_new(t_class *c) --- 6,10 ---- #include "desire.h"
! t_hash *object_table;
t_pd *pd_new(t_class *c) *************** *** 14,17 **** --- 14,18 ---- x = (t_pd *)t_getbytes(c->c_size); *x = c; + hash_set(object_table,x,(void*)0); if (c->c_gobj) ((t_gobj *)x)->g_adix = appendix_new((t_gobj *)x); if (c->c_patchable) *************** *** 28,39 **** if (c->c_freemethod) (*(t_gotfn)(c->c_freemethod))(x); if (c->c_gobj) appendix_free((t_gobj *)x); ! if (c->c_patchable) ! { ! while (((t_object *)x)->ob_outlet) ! outlet_free(((t_object *)x)->ob_outlet); ! while (((t_object *)x)->ob_inlet) ! inlet_free(((t_object *)x)->ob_inlet); ! if (((t_object *)x)->ob_binbuf) ! binbuf_free(((t_object *)x)->ob_binbuf); } if (c->c_size) t_freebytes(x, c->c_size); --- 29,38 ---- if (c->c_freemethod) (*(t_gotfn)(c->c_freemethod))(x); if (c->c_gobj) appendix_free((t_gobj *)x); ! hash_delete(object_table,x); ! if (c->c_patchable) { ! t_object *y = (t_object *)x; ! while (y->ob_outlet) outlet_free(y->ob_outlet); ! while (y->ob_inlet) inlet_free(y->ob_inlet); ! if (y->ob_binbuf) binbuf_free(y->ob_binbuf); } if (c->c_size) t_freebytes(x, c->c_size); *************** *** 65,110 **** } t_bindlist;
! static void bindlist_bang(t_bindlist *x) ! { ! t_bindelem *e; ! for (e = x->b_list; e; e = e->e_next) ! pd_bang(e->e_who); } ! ! static void bindlist_float(t_bindlist *x, t_float f) ! { ! t_bindelem *e; ! for (e = x->b_list; e; e = e->e_next) ! pd_float(e->e_who, f); } ! ! static void bindlist_symbol(t_bindlist *x, t_symbol *s) ! { ! t_bindelem *e; ! for (e = x->b_list; e; e = e->e_next) ! pd_symbol(e->e_who, s); } ! ! static void bindlist_pointer(t_bindlist *x, t_gpointer *gp) ! { ! t_bindelem *e; ! for (e = x->b_list; e; e = e->e_next) ! pd_pointer(e->e_who, gp); } ! ! static void bindlist_list(t_bindlist *x, t_symbol *s, ! int argc, t_atom *argv) ! { ! t_bindelem *e; ! for (e = x->b_list; e; e = e->e_next) ! pd_list(e->e_who, s, argc, argv); } ! ! static void bindlist_anything(t_bindlist *x, t_symbol *s, ! int argc, t_atom *argv) ! { ! t_bindelem *e; ! for (e = x->b_list; e; e = e->e_next) ! pd_typedmess(e->e_who, s, argc, argv); }
--- 64,85 ---- } t_bindlist;
! #define bind_each(e,x) for (e = x->b_list; e; e = e->e_next) ! static void bindlist_bang(t_bindlist *x) { ! t_bindelem *e; bind_each(e,x) pd_bang(e->e_who); } ! static void bindlist_float(t_bindlist *x, t_float f) { ! t_bindelem *e; bind_each(e,x) pd_float(e->e_who, f); } ! static void bindlist_symbol(t_bindlist *x, t_symbol *s) { ! t_bindelem *e; bind_each(e,x) pd_symbol(e->e_who, s); } ! static void bindlist_pointer(t_bindlist *x, t_gpointer *gp) { ! t_bindelem *e; bind_each(e,x) pd_pointer(e->e_who, gp); } ! static void bindlist_list(t_bindlist *x, t_symbol *s, int argc, t_atom *argv) { ! t_bindelem *e; bind_each(e,x) pd_list(e->e_who, s, argc, argv); } ! static void bindlist_anything(t_bindlist *x, t_symbol *s, int argc, t_atom *argv) { ! t_bindelem *e; bind_each(e,x) pd_typedmess(e->e_who, s, argc, argv); }
*************** *** 267,294 **** }
! void pd_bang(t_pd *x) ! { ! (*(*x)->c_bangmethod)(x); ! } ! ! void pd_float(t_pd *x, t_float f) ! { ! (*(*x)->c_floatmethod)(x, f); ! } ! ! void pd_pointer(t_pd *x, t_gpointer *gp) ! { ! (*(*x)->c_pointermethod)(x, gp); ! } ! ! void pd_symbol(t_pd *x, t_symbol *s) ! { ! (*(*x)->c_symbolmethod)(x, s); ! } ! void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv) ! { ! (*(*x)->c_listmethod)(x, &s_list, argc, argv); ! }
void mess_init(void); --- 242,251 ---- }
! void pd_bang(t_pd *x) {(*x)->c_bangmethod(x);} ! void pd_float(t_pd *x, t_float f) {(*x)->c_floatmethod(x, f);} ! void pd_pointer(t_pd *x, t_gpointer *gp) {(*x)->c_pointermethod(x, gp);} ! void pd_symbol(t_pd *x, t_symbol *s) {(*x)->c_symbolmethod(x, s);} void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv) ! {(*x)->c_listmethod(x, &s_list, argc, argv);}
void mess_init(void); *************** *** 300,303 **** --- 257,261 ---- void pd_init(void) { + object_table = hash_new(127); mess_init(); obj_init();