From ed932acb5860bf8b9296169676499562a55d139e Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Mon, 6 Sep 2004 20:20:36 +0000 Subject: checking in version 0.38test5. Oops, I realize I forgot some more nice files, will add them and re-commit. svn path=/trunk/; revision=2010 --- pd/src/m_pd.c | 168 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 84 insertions(+), 84 deletions(-) (limited to 'pd/src/m_pd.c') diff --git a/pd/src/m_pd.c b/pd/src/m_pd.c index 7ae53082..429799ef 100644 --- a/pd/src/m_pd.c +++ b/pd/src/m_pd.c @@ -12,13 +12,13 @@ t_pd *pd_new(t_class *c) { t_pd *x; if (!c) - bug ("pd_new: apparently called before setup routine"); + bug ("pd_new: apparently called before setup routine"); x = (t_pd *)t_getbytes(c->c_size); *x = c; if (c->c_patchable) { - ((t_object *)x)->ob_inlet = 0; - ((t_object *)x)->ob_outlet = 0; + ((t_object *)x)->ob_inlet = 0; + ((t_object *)x)->ob_outlet = 0; } return (x); } @@ -29,12 +29,12 @@ void pd_free(t_pd *x) if (c->c_freemethod) (*(t_gotfn)(c->c_freemethod))(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); + 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); } @@ -43,12 +43,12 @@ void gobj_save(t_gobj *x, t_binbuf *b) { t_class *c = x->g_pd; if (c->c_savefn) - (c->c_savefn)(x, b); + (c->c_savefn)(x, b); } /* deal with several objects bound to the same symbol. If more than one, we actually bind a collection object to the symbol, which forwards messages sent -to the symbol. */ +to the symbol. */ static t_class *bindlist_class; @@ -68,28 +68,28 @@ 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); + 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); + 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); + 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); + pd_pointer(e->e_who, gp); } static void bindlist_list(t_bindlist *x, t_symbol *s, @@ -97,7 +97,7 @@ static void bindlist_list(t_bindlist *x, t_symbol *s, { t_bindelem *e; for (e = x->b_list; e; e = e->e_next) - pd_list(e->e_who, s, argc, argv); + pd_list(e->e_who, s, argc, argv); } static void bindlist_anything(t_bindlist *x, t_symbol *s, @@ -105,13 +105,13 @@ static void bindlist_anything(t_bindlist *x, t_symbol *s, { t_bindelem *e; for (e = x->b_list; e; e = e->e_next) - pd_typedmess(e->e_who, s, argc, argv); + pd_typedmess(e->e_who, s, argc, argv); } void m_pd_setup(void) { bindlist_class = class_new(gensym("bindlist"), 0, 0, - sizeof(t_bindlist), CLASS_PD, 0); + sizeof(t_bindlist), CLASS_PD, 0); class_addbang(bindlist_class, bindlist_bang); class_addfloat(bindlist_class, (t_method)bindlist_float); class_addsymbol(bindlist_class, bindlist_symbol); @@ -124,26 +124,26 @@ void pd_bind(t_pd *x, t_symbol *s) { if (s->s_thing) { - if (*s->s_thing == bindlist_class) - { - t_bindlist *b = (t_bindlist *)s->s_thing; - t_bindelem *e = (t_bindelem *)getbytes(sizeof(t_bindelem)); - e->e_next = b->b_list; - e->e_who = x; - b->b_list = e; - } - else - { - t_bindlist *b = (t_bindlist *)pd_new(bindlist_class); - t_bindelem *e1 = (t_bindelem *)getbytes(sizeof(t_bindelem)); - t_bindelem *e2 = (t_bindelem *)getbytes(sizeof(t_bindelem)); - b->b_list = e1; - e1->e_who = x; - e1->e_next = e2; - e2->e_who = s->s_thing; - e2->e_next = 0; - s->s_thing = &b->b_pd; - } + if (*s->s_thing == bindlist_class) + { + t_bindlist *b = (t_bindlist *)s->s_thing; + t_bindelem *e = (t_bindelem *)getbytes(sizeof(t_bindelem)); + e->e_next = b->b_list; + e->e_who = x; + b->b_list = e; + } + else + { + t_bindlist *b = (t_bindlist *)pd_new(bindlist_class); + t_bindelem *e1 = (t_bindelem *)getbytes(sizeof(t_bindelem)); + t_bindelem *e2 = (t_bindelem *)getbytes(sizeof(t_bindelem)); + b->b_list = e1; + e1->e_who = x; + e1->e_next = e2; + e2->e_who = s->s_thing; + e2->e_next = 0; + s->s_thing = &b->b_pd; + } } else s->s_thing = x; } @@ -153,30 +153,30 @@ void pd_unbind(t_pd *x, t_symbol *s) if (s->s_thing == x) s->s_thing = 0; else if (s->s_thing && *s->s_thing == bindlist_class) { - /* bindlists always have at least two elements... if the number - goes down to one, get rid of the bindlist and bind the symbol - straight to the remaining element. */ - - t_bindlist *b = (t_bindlist *)s->s_thing; - t_bindelem *e, *e2; - if ((e = b->b_list)->e_who == x) - { - b->b_list = e->e_next; - freebytes(e, sizeof(t_bindelem)); - } - else for (e = b->b_list; e2 = e->e_next; e = e2) - if (e2->e_who == x) - { - e->e_next = e2->e_next; - freebytes(e2, sizeof(t_bindelem)); - break; - } - if (!b->b_list->e_next) - { - s->s_thing = b->b_list->e_who; - freebytes(b->b_list, sizeof(t_bindelem)); - pd_free(&b->b_pd); - } + /* bindlists always have at least two elements... if the number + goes down to one, get rid of the bindlist and bind the symbol + straight to the remaining element. */ + + t_bindlist *b = (t_bindlist *)s->s_thing; + t_bindelem *e, *e2; + if ((e = b->b_list)->e_who == x) + { + b->b_list = e->e_next; + freebytes(e, sizeof(t_bindelem)); + } + else for (e = b->b_list; e2 = e->e_next; e = e2) + if (e2->e_who == x) + { + e->e_next = e2->e_next; + freebytes(e2, sizeof(t_bindelem)); + break; + } + if (!b->b_list->e_next) + { + s->s_thing = b->b_list->e_who; + freebytes(b->b_list, sizeof(t_bindelem)); + pd_free(&b->b_pd); + } } else pd_error(x, "%s: couldn't unbind", s->s_name); } @@ -191,20 +191,20 @@ t_pd *pd_findbyclass(t_symbol *s, t_class *c) if (*s->s_thing == c) return (s->s_thing); if (*s->s_thing == bindlist_class) { - t_bindlist *b = (t_bindlist *)s->s_thing; - t_bindelem *e, *e2; - int warned = 0; - for (e = b->b_list; e; e = e->e_next) - if (*e->e_who == c) - { - if (x && !warned) - { - zz(); - post("warning: %s: multiply defined", s->s_name); - warned = 1; - } - x = e->e_who; - } + t_bindlist *b = (t_bindlist *)s->s_thing; + t_bindelem *e, *e2; + int warned = 0; + for (e = b->b_list; e; e = e->e_next) + if (*e->e_who == c) + { + if (x && !warned) + { + zz(); + post("warning: %s: multiply defined", s->s_name); + warned = 1; + } + x = e->e_who; + } } return x; } @@ -227,8 +227,8 @@ int pd_setloadingabstraction(t_symbol *sym) { t_gstack *foo = gstack_head; for (foo = gstack_head; foo; foo = foo->g_next) - if (foo->g_loadingabstraction == sym) - return (1); + if (foo->g_loadingabstraction == sym) + return (1); pd_loadingabstraction = sym; return (0); } @@ -249,18 +249,18 @@ void pd_popsym(t_pd *x) if (!gstack_head || s__X.s_thing != x) bug("gstack_pop"); else { - t_gstack *headwas = gstack_head; - s__X.s_thing = headwas->g_what; - gstack_head = headwas->g_next; - t_freebytes(headwas, sizeof(*headwas)); - lastpopped = x; + t_gstack *headwas = gstack_head; + s__X.s_thing = headwas->g_what; + gstack_head = headwas->g_next; + t_freebytes(headwas, sizeof(*headwas)); + lastpopped = x; } } void pd_doloadbang(void) { if (lastpopped) - pd_vmess(lastpopped, gensym("loadbang"), ""); + pd_vmess(lastpopped, gensym("loadbang"), ""); lastpopped = 0; } -- cgit v1.2.1