aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2008-09-15 17:23:48 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2008-09-15 17:23:48 +0000
commitd2c9616b79f1b01dbeb2586c7cb3d6374c579839 (patch)
tree67084eacda3220eb371a447ad9f0d817dd48f72d /src
parent591854adb9ab77e04766c9ed01b28be9fd9b02a0 (diff)
added a class to test for the existance of other classes
svn path=/trunk/externals/iem/iemguts/; revision=10286
Diffstat (limited to 'src')
-rw-r--r--src/classtest.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/classtest.c b/src/classtest.c
new file mode 100644
index 0000000..b8a8a7b
--- /dev/null
+++ b/src/classtest.c
@@ -0,0 +1,72 @@
+
+/******************************************************
+ *
+ * classtest - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 2007:forum::für::umläute:2007
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+
+/*
+ * this object provides a way to send messages to upstream canvases
+ * by default it sends messages to the containing canvas, but you can give the
+ * "depth" as argument;
+ * e.g. [classtest 1] will send messages to the parent of the containing canvas
+ */
+
+#include "m_pd.h"
+#include "g_canvas.h"
+
+int glist_getindex(t_glist *x, t_gobj *y);
+
+/* ------------------------- classtest ---------------------------- */
+
+static t_class *classtest_class;
+
+typedef struct _classtest
+{
+ t_object x_obj;
+ t_outlet *x_out;
+} t_classtest;
+
+static void classtest_symbol(t_classtest *x, t_symbol*s)
+{
+ t_float result=0.;
+ if(0!=zgetfn(&pd_objectmaker, s))
+ result=1.;
+
+ outlet_float(x->x_out, result);
+
+
+
+}
+
+static void classtest_free(t_classtest *x)
+{
+ outlet_free(x->x_out);
+}
+
+static void *classtest_new(t_floatarg f)
+{
+ t_classtest *x = (t_classtest *)pd_new(classtest_class);
+
+ x->x_out = outlet_new(&x->x_obj, &s_float);
+ return (x);
+}
+
+void classtest_setup(void)
+{
+ classtest_class = class_new(gensym("classtest"), (t_newmethod)classtest_new,
+ (t_method)classtest_free, sizeof(t_classtest), 0,
+ 0);
+ class_addsymbol(classtest_class, (t_method)classtest_symbol);
+}