From ad378ef9774ccabc4fc7fae6e2e8b131193833a3 Mon Sep 17 00:00:00 2001 From: Guenter Geiger Date: Wed, 17 Sep 2003 07:28:31 +0000 Subject: another useless external svn path=/trunk/externals/ggee/; revision=982 --- control/concat.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 control/concat.c diff --git a/control/concat.c b/control/concat.c new file mode 100755 index 0000000..502705d --- /dev/null +++ b/control/concat.c @@ -0,0 +1,67 @@ +/* (C) Guenter Geiger */ + + +#include +#include + +/* ------------------------ concat ----------------------------- */ + +#define MAX_ELEMENTS 256 + +static t_class *concat_class; + + +typedef struct _concat +{ + t_object x_obj; + t_symbol* x_sym; +} t_concat; + + +void concat_float(t_concat *x,t_float f) +{ + char* nsym; + int len = (12+strlen(x->x_sym)); + nsym = getbytes(len); + + sprintf(nsym,"%g",f); + strcat(nsym,x->x_sym->s_name); + + outlet_symbol(x->x_obj.ob_outlet,gensym(nsym)); + freebytes(nsym,len); +} + +void concat_symbol(t_concat *x,t_symbol* s) +{ + char* nsym; + int len = (strlen(s->s_name)+strlen(x->x_sym)); + nsym = getbytes(len); + + strcpy(nsym,s->s_name); + strcat(nsym,x->x_sym->s_name); + + outlet_symbol(x->x_obj.ob_outlet,gensym(nsym)); + freebytes(nsym,len); +} + + +static void *concat_new(t_symbol* s) +{ + t_concat *x = (t_concat *)pd_new(concat_class); + outlet_new(&x->x_obj,&s_float); + symbolinlet_new(&x->x_obj, &x->x_sym); + x->x_sym = s; + return (x); +} + + + +void concat_setup(void) +{ + concat_class = class_new(gensym("concat"), (t_newmethod)concat_new, 0, + sizeof(t_concat),0, A_DEFSYM,0); + class_addsymbol(concat_class,concat_symbol); + class_addfloat(concat_class,concat_float); +} + + -- cgit v1.2.1