aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Geiger <ggeiger@users.sourceforge.net>2003-09-17 07:28:31 +0000
committerGuenter Geiger <ggeiger@users.sourceforge.net>2003-09-17 07:28:31 +0000
commitad378ef9774ccabc4fc7fae6e2e8b131193833a3 (patch)
tree799d2f2abb3284bc13249647c230837dd2529192
parent639b50391267932678b475b6a69074ac8a2203cc (diff)
another useless external
svn path=/trunk/externals/ggee/; revision=982
-rwxr-xr-xcontrol/concat.c67
1 files changed, 67 insertions, 0 deletions
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 <geiger@epy.co.at> */
+
+
+#include <m_pd.h>
+#include <string.h>
+
+/* ------------------------ 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);
+}
+
+