aboutsummaryrefslogtreecommitdiff
path: root/strcat.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2003-07-30 21:52:27 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2003-07-30 21:52:27 +0000
commitc8f3e3674f08bf56407e478c3160c4392196c118 (patch)
treec02a0612aa9172c4ee8557ecc5626020a2d4d4b8 /strcat.c
separated out all objects into individual files; created a few missing help files; moves all help files to new 0.37 help- standard; removed [reson~] and [abs~] since they are now maintained elsewhere; created Makefile for Linux and Darwinsvn2git-root
svn path=/trunk/externals/markex/; revision=806
Diffstat (limited to 'strcat.c')
-rw-r--r--strcat.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/strcat.c b/strcat.c
new file mode 100644
index 0000000..4c23144
--- /dev/null
+++ b/strcat.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1997-1999 Mark Danks.
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+ */
+
+#include "m_pd.h"
+#include <stdio.h>
+
+/* -------------------------- strcat ------------------------------ */
+
+/* instance structure */
+
+static t_class *strcat_class;
+
+typedef struct _strcat
+{
+ t_object x_obj; /* obligatory object header */
+ t_symbol *a_text; /* the first part of the text */
+ t_symbol *a_symbol; /* the last symbol sent out */
+ t_outlet *t_out1; /* the outlet */
+} t_strcat;
+
+void strcat_sym(t_strcat *x, t_symbol *sym)
+{
+ char temp[64];
+ sprintf(temp, "%s%s", x->a_text->s_name, sym->s_name);
+ x->a_symbol = gensym(temp);
+ outlet_symbol(x->t_out1, x->a_symbol);
+}
+
+void strcat_float(t_strcat *x, t_floatarg n)
+{
+ char temp[64];
+ sprintf(temp, "%s%f", x->a_text->s_name, n);
+ x->a_symbol = gensym(temp);
+ outlet_symbol(x->t_out1, x->a_symbol);
+}
+
+void strcat_bang(t_strcat *x)
+{
+ outlet_symbol(x->t_out1, x->a_symbol);
+}
+
+void *strcat_new(t_symbol *textname) /* init vals in struc */
+{
+ t_strcat *x = (t_strcat *)pd_new(strcat_class);
+ x->t_out1 = outlet_new(&x->x_obj, 0);
+ x->a_text = textname;
+ x->a_symbol = textname;
+ return (x);
+}
+
+void strcat_setup(void)
+{
+ strcat_class = class_new(gensym("strcat"), (t_newmethod)strcat_new, 0,
+ sizeof(t_strcat), 0, A_SYMBOL, 0);
+ class_addsymbol(strcat_class, (t_method)strcat_sym);
+ class_addfloat(strcat_class, (t_method)strcat_float);
+ class_addbang(strcat_class, (t_method)strcat_bang);
+
+ class_sethelpsymbol(strcat_class, gensym("help-strcat"));
+}
+