Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11836
Modified Files: Tag: desiredata builtins.c Log Message: [unpost] is now reentrant
Index: builtins.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v retrieving revision 1.1.2.37 retrieving revision 1.1.2.38 diff -C2 -d -r1.1.2.37 -r1.1.2.38 *** builtins.c 19 Jul 2007 17:48:25 -0000 1.1.2.37 --- builtins.c 20 Jul 2007 04:04:26 -0000 1.1.2.38 *************** *** 2876,2884 **** } } ! t_atom *p = x->vec + (x->n - 1); union word *w = h->vec + (x->n - 1); for (int i = x->n; i--; p--, w--) { switch (p->a_type) { ! case A_FLOAT: outlet_float( x->out(i),w->w_float); break; case A_SYMBOL: outlet_symbol(x->out(i),w->w_symbol); break; case A_POINTER: --- 2876,2884 ---- } } ! t_atom *p = x->vec + (x->n - 1); union word *w = h->vec + (x->n - 1); for (int i = x->n; i--; p--, w--) { switch (p->a_type) { ! case A_FLOAT: outlet_float( x->out(i),w->w_float ); break; case A_SYMBOL: outlet_symbol(x->out(i),w->w_symbol); break; case A_POINTER: *************** *** 2952,2962 **** /* new desiredata classes are below this point. */
- /* warning: [unpost] is not reentrant yet. */ static t_class *unpost_class; struct t_unpost : t_object { t_outlet *o0,*o1; char buf[MAXPDSTRING]; }; ! static t_unpost *current_unpost;
void *unpost_new (t_symbol *s) { --- 2952,2965 ---- /* new desiredata classes are below this point. */
static t_class *unpost_class; struct t_unpost : t_object { t_outlet *o0,*o1; + }; + struct t_unpost_frame { + t_unpost *self; + //ostringstream os; char buf[MAXPDSTRING]; }; ! static t_unpost_frame *current_unpost;
void *unpost_new (t_symbol *s) { *************** *** 2976,2980 **** p = strchr(b,'\n'); if (!p) break; ! outlet_symbol(current_unpost->o1,gensym2(b,p-b)); b=p+1; } --- 2979,2983 ---- p = strchr(b,'\n'); if (!p) break; ! outlet_symbol(current_unpost->self->o1,gensym2(b,p-b)); b=p+1; } *************** *** 2987,2994 **** void unpost_anything (t_unpost *x, t_symbol *s, int argc, t_atom *argv) { t_printhook backup1 = sys_printhook; ! t_unpost *backup2 = current_unpost; sys_printhook = unpost_printhook; ! current_unpost = x; ! x->buf[0] = 0; outlet_anything(x->o0,s,argc,argv); sys_printhook = backup1; --- 2990,2998 ---- void unpost_anything (t_unpost *x, t_symbol *s, int argc, t_atom *argv) { t_printhook backup1 = sys_printhook; ! t_unpost_frame *backup2 = current_unpost; sys_printhook = unpost_printhook; ! current_unpost = new t_unpost_frame; ! current_unpost->self = x; ! current_unpost->buf[0] = 0; outlet_anything(x->o0,s,argc,argv); sys_printhook = backup1;