Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6880
Modified Files: Tag: desiredata desire.c Log Message: manager stack
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.25 retrieving revision 1.1.2.217.2.26 diff -C2 -d -r1.1.2.217.2.25 -r1.1.2.217.2.26 *** desire.c 5 Dec 2006 07:26:01 -0000 1.1.2.217.2.25 --- desire.c 5 Dec 2006 07:39:13 -0000 1.1.2.217.2.26 *************** *** 273,277 **** static t_class *manager_class; t_manager *manager; - t_manager *origin=0; /* 0 means unknown */
void manager_call (void *foo) { --- 273,276 ---- *************** *** 321,333 **** void manager_nevermind (t_gobj *victim) {queue_nevermind(manager->q,victim);}
! /* this has to change later when we get multiple managers (and thus the manager variable will disappear) */ ! /* this also has to change when we get stackable origins */ extern "C" void manager_anything (t_manager *self, t_symbol *s, int argc, t_atom *argv) { ! origin = manager; binbuf_clear(self->b); binbuf_addv(self->b,"s",s); binbuf_add(self->b,argc,argv); binbuf_eval(self->b,0,0,0); ! origin = 0; }
--- 320,351 ---- void manager_nevermind (t_gobj *victim) {queue_nevermind(manager->q,victim);}
! struct t_origin_stack { ! t_manager *head; ! t_origin_stack *tail; ! }; ! t_origin_stack origin_stack_pointee = {manager,0}; ! t_origin_stack *origin_stack = &origin_stack_pointee; ! ! //t_manager *origin=0; /* 0 means unknown */ ! t_manager *pd_origin() {return origin_stack->head;} ! void pd_push_origin(t_manager *orig) { ! t_origin_stack *self = new t_origin_stack; ! self->head = orig; ! self->tail = origin_stack; ! origin_stack = self; ! } ! void pd_pop_origin() { ! t_origin_stack *self = origin_stack->tail; ! delete origin_stack; ! origin_stack = self; ! } ! extern "C" void manager_anything (t_manager *self, t_symbol *s, int argc, t_atom *argv) { ! pd_push_origin(self); binbuf_clear(self->b); binbuf_addv(self->b,"s",s); binbuf_add(self->b,argc,argv); binbuf_eval(self->b,0,0,0); ! pd_pop_origin(); }
*************** *** 847,851 **** void pd_set_newest (t_pd *x) { newest = x; ! if (!origin) return; /* the following only applies to objects created by client */ unsigned short serial = manager->serial++; sys_vgui("serial %d x%lx\n",serial,(long)x); --- 865,869 ---- void pd_set_newest (t_pd *x) { newest = x; ! if (!pd_origin()) return; /* the following only applies to objects created by client */ unsigned short serial = manager->serial++; sys_vgui("serial %d x%lx\n",serial,(long)x);