aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/6.externs/obj2.c
diff options
context:
space:
mode:
authorGuenter Geiger <ggeiger@users.sourceforge.net>2003-05-09 16:04:00 +0000
committerGuenter Geiger <ggeiger@users.sourceforge.net>2003-05-09 16:04:00 +0000
commit9c0e19a3be2288db79e2502e5fa450c3e20a668d (patch)
treeca97ce615e037a533304fc4660dcf372ca3b9cd6 /pd/doc/6.externs/obj2.c
parentef50dd62804d54af7da18d8bd8413c0dccd729b8 (diff)
This commit was generated by cvs2svn to compensate for changes in r610,
which included commits to RCS files with non-trunk default branches. svn path=/trunk/; revision=611
Diffstat (limited to 'pd/doc/6.externs/obj2.c')
-rw-r--r--pd/doc/6.externs/obj2.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/pd/doc/6.externs/obj2.c b/pd/doc/6.externs/obj2.c
new file mode 100644
index 00000000..14cd134a
--- /dev/null
+++ b/pd/doc/6.externs/obj2.c
@@ -0,0 +1,45 @@
+/* code for the "obj2" pd class. This one, in addition to the "obj1"
+code, has an inlet taking numbers. */
+
+#include "m_pd.h"
+
+typedef struct obj2
+{
+ t_object x_ob;
+} t_obj2;
+
+void obj2_float(t_obj2 *x, t_floatarg f)
+{
+ post("obj2: %f", f);
+}
+
+void obj2_rats(t_obj2 *x)
+{
+ post("obj2: rats");
+}
+
+void obj2_ft1(t_obj2 *x, t_floatarg g)
+{
+ post("ft1: %f", g);
+}
+
+t_class *obj2_class;
+
+void *obj2_new(void)
+{
+ t_obj2 *x = (t_obj2 *)pd_new(obj2_class);
+ inlet_new(&x->x_ob, &x->x_ob.ob_pd, gensym("float"), gensym("ft1"));
+ post("obj2_new");
+ return (void *)x;
+}
+
+void obj2_setup(void)
+{
+ post("obj2_setup");
+ obj2_class = class_new(gensym("obj2"), (t_newmethod)obj2_new,
+ 0, sizeof(t_obj2), 0, 0);
+ class_addmethod(obj2_class, (t_method)obj2_rats, gensym("rats"), 0);
+ class_addmethod(obj2_class, (t_method)obj2_ft1, gensym("ft1"), A_FLOAT, 0);
+ class_addfloat(obj2_class, obj2_float);
+}
+