From faada59567f8cb252f4a909116595ce309ff5828 Mon Sep 17 00:00:00 2001 From: "N.N." Date: Fri, 23 May 2003 12:29:55 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r647, which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/miXed/; revision=648 --- cyclone/hammer/forward.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 cyclone/hammer/forward.c (limited to 'cyclone/hammer/forward.c') diff --git a/cyclone/hammer/forward.c b/cyclone/hammer/forward.c new file mode 100644 index 0000000..995e765 --- /dev/null +++ b/cyclone/hammer/forward.c @@ -0,0 +1,71 @@ +/* Copyright (c) 1997-2002 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +typedef struct _forward +{ + t_object x_ob; + t_symbol *x_sym; +} t_forward; + +static t_class *forward_class; + +static void forward_bang(t_forward *x) +{ + if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing); +} + +static void forward_float(t_forward *x, t_float f) +{ + if (x->x_sym->s_thing) pd_float(x->x_sym->s_thing, f); +} + +static void forward_symbol(t_forward *x, t_symbol *s) +{ + if (x->x_sym->s_thing) pd_symbol(x->x_sym->s_thing, s); +} + +static void forward_pointer(t_forward *x, t_gpointer *gp) +{ + if (x->x_sym->s_thing) pd_pointer(x->x_sym->s_thing, gp); +} + +static void forward_list(t_forward *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_sym->s_thing) pd_list(x->x_sym->s_thing, s, ac, av); +} + +static void forward_anything(t_forward *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_sym->s_thing) typedmess(x->x_sym->s_thing, s, ac, av); +} + +static void forward_send(t_forward *x, t_symbol *s) +{ + /* CHECKED: 'send' without arguments erases destination */ + if (s) x->x_sym = s; +} + +static void *forward_new(t_symbol *s) +{ + t_forward *x = (t_forward *)pd_new(forward_class); + x->x_sym = s; + return (x); +} + +void forward_setup(void) +{ + forward_class = class_new(gensym("forward"), + (t_newmethod)forward_new, 0, + sizeof(t_forward), 0, A_DEFSYM, 0); + class_addbang(forward_class, forward_bang); + class_addfloat(forward_class, forward_float); + class_addsymbol(forward_class, forward_symbol); + class_addpointer(forward_class, forward_pointer); + class_addlist(forward_class, forward_list); + class_addanything(forward_class, forward_anything); + class_addmethod(forward_class, (t_method)forward_send, + gensym("send"), A_DEFSYM, 0); +} -- cgit v1.2.1