diff --git a/pd/src/g_traversal.c b/pd/src/g_traversal.c index bdf0d2047500db6a4181ad67c834581179747734..dc8d7b17338a57162016ca2c844aea1de4abbeab 100644 --- a/pd/src/g_traversal.c +++ b/pd/src/g_traversal.c @@ -222,7 +222,7 @@ static void *ptrobj_new(t_symbol *classname, int argc, t_atom *argv) for (; n--; to++) { to->to_outlet = outlet_new(&x->x_obj, &s_pointer); - to->to_type = canvas_makebindsym(atom_getsymbol(argv++)); + to->to_type = template_getbindsym(atom_getsymbol(argv++)); } x->x_otherout = outlet_new(&x->x_obj, &s_pointer); x->x_bangout = outlet_new(&x->x_obj, &s_bang); @@ -304,6 +304,8 @@ static void ptrobj_next(t_ptrobj *x) { ptrobj_vnext(x, 0); } + + /* send a message to the window containing the object pointed to */ static void ptrobj_sendwindow(t_ptrobj *x, t_symbol *s, int argc, t_atom *argv) { t_glist *glist; @@ -330,6 +332,16 @@ static void ptrobj_sendwindow(t_ptrobj *x, t_symbol *s, int argc, t_atom *argv) else pd_error(x, "send-window: no message?"); } + /* send the pointer to the named object */ +static void ptrobj_send(t_ptrobj *x, t_symbol *s) +{ + if (!s->s_thing) + pd_error(x, "%s: no such object", s->s_name); + else if (!gpointer_check(&x->x_gp, 1)) + pd_error(x, "pointer_send: empty pointer"); + else pd_pointer(s->s_thing, &x->x_gp); +} + static void ptrobj_bang(t_ptrobj *x) { t_symbol *templatesym; @@ -391,9 +403,11 @@ static void ptrobj_setup(void) { ptrobj_class = class_new(gensym("pointer"), (t_newmethod)ptrobj_new, (t_method)ptrobj_free, sizeof(t_ptrobj), 0, A_GIMME, 0); + class_addmethod(ptrobj_class, (t_method)ptrobj_next, gensym("next"), 0); + class_addmethod(ptrobj_class, (t_method)ptrobj_send, gensym("send"), + A_SYMBOL, 0); class_addmethod(ptrobj_class, (t_method)ptrobj_traverse, gensym("traverse"), A_SYMBOL, 0); - class_addmethod(ptrobj_class, (t_method)ptrobj_next, gensym("next"), 0); class_addmethod(ptrobj_class, (t_method)ptrobj_vnext, gensym("vnext"), A_DEFFLOAT, 0); class_addmethod(ptrobj_class, (t_method)ptrobj_sendwindow,