From 02a5595973b61d2cf789b9074167ed73b928d157 Mon Sep 17 00:00:00 2001 From: Guenter Geiger Date: Wed, 13 Nov 2002 08:38:02 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r206, which included commits to RCS files with non-trunk default branches. svn path=/trunk/; revision=207 --- xgui/xgui-lib/recv2.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 xgui/xgui-lib/recv2.c (limited to 'xgui/xgui-lib/recv2.c') diff --git a/xgui/xgui-lib/recv2.c b/xgui/xgui-lib/recv2.c new file mode 100644 index 00000000..f49e374c --- /dev/null +++ b/xgui/xgui-lib/recv2.c @@ -0,0 +1,80 @@ +/* Copyright (c) 2002 Damien HENRY. +* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* recv2 */ + +#include "m_pd.h" + +static t_class *recv2_class; + +typedef struct _recv2 +{ + t_object x_obj; + t_symbol *x_sym; +} t_recv2; + +static void recv2_bang(t_recv2 *x) +{ + outlet_bang(x->x_obj.ob_outlet); +} + +static void recv2_float(t_recv2 *x, t_float f) +{ + outlet_float(x->x_obj.ob_outlet, f); +} + +static void recv2_symbol(t_recv2 *x, t_symbol *s) +{ + outlet_symbol(x->x_obj.ob_outlet, s); +} + +static void recv2_pointer(t_recv2 *x, t_gpointer *gp) +{ + outlet_pointer(x->x_obj.ob_outlet, gp); +} + +static void recv2_list(t_recv2 *x, t_symbol *s, int argc, t_atom *argv) +{ + outlet_list(x->x_obj.ob_outlet, s, argc, argv); +} + +static void recv2_anything(t_recv2 *x, t_symbol *s, int argc, t_atom *argv) +{ + outlet_anything(x->x_obj.ob_outlet, s, argc, argv); +} + +static void recv2_set(t_recv2 *x, t_symbol *s) +{ + pd_unbind(&x->x_obj.ob_pd, x->x_sym); + x->x_sym = s; + pd_bind(&x->x_obj.ob_pd, s); +} + +static void *recv2_new(t_symbol *s) +{ + t_recv2 *x = (t_recv2 *)pd_new(recv2_class); + x->x_sym = s; + pd_bind(&x->x_obj.ob_pd, s); + outlet_new(&x->x_obj, 0); + return (x); +} + +static void recv2_free(t_recv2 *x) +{ + pd_unbind(&x->x_obj.ob_pd, x->x_sym); +} + +void recv2_setup(void) +{ + recv2_class = class_new(gensym("recv2"), (t_newmethod)recv2_new, + (t_method)recv2_free, sizeof(t_recv2), 0, A_DEFSYM, 0); + class_addbang(recv2_class, recv2_bang); + class_addfloat(recv2_class, (t_method)recv2_float); + class_addsymbol(recv2_class, recv2_symbol); + class_addpointer(recv2_class, recv2_pointer); + class_addlist(recv2_class, recv2_list); + class_addanything(recv2_class, recv2_anything); + class_addmethod(recv2_class, (t_method)recv2_set, gensym("@"),A_DEFSYMBOL, 0); + class_sethelpsymbol(recv2_class, gensym("xgui/help_recv2")); +} -- cgit v1.2.1