aboutsummaryrefslogtreecommitdiff
path: root/externals/vanilla/key.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2009-11-10 21:08:48 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2009-11-10 21:08:48 +0000
commit49180536552f487ca12e2173a93aae6a17ccfcca (patch)
tree93c9729987034227e1283c16380397bc1f957a49 /externals/vanilla/key.c
parent33b135d7fc381a22965586e0567ede4da11eade3 (diff)
split out the objects in x_gui.c into standalone files and put the gfxstub stuff into e_gfxstub.c
svn path=/trunk/; revision=12749
Diffstat (limited to 'externals/vanilla/key.c')
-rw-r--r--externals/vanilla/key.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/externals/vanilla/key.c b/externals/vanilla/key.c
new file mode 100644
index 00000000..d389a9b3
--- /dev/null
+++ b/externals/vanilla/key.c
@@ -0,0 +1,43 @@
+/* Copyright (c) 1997-2000 Miller Puckette.
+* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+
+#include "m_pd.h"
+#include <stdio.h>
+#include <string.h>
+
+static t_symbol *key_sym;
+static t_class *key_class;
+
+typedef struct _key
+{
+ t_object x_obj;
+} t_key;
+
+static void *key_new( void)
+{
+ t_key *x = (t_key *)pd_new(key_class);
+ outlet_new(&x->x_obj, &s_float);
+ pd_bind(&x->x_obj.ob_pd, key_sym);
+ return (x);
+}
+
+static void key_float(t_key *x, t_floatarg f)
+{
+ outlet_float(x->x_obj.ob_outlet, f);
+}
+
+static void key_free(t_key *x)
+{
+ pd_unbind(&x->x_obj.ob_pd, key_sym);
+}
+
+void key_setup(void)
+{
+ key_class = class_new(gensym("key"),
+ (t_newmethod)key_new, (t_method)key_free,
+ sizeof(t_key), CLASS_NOINLET, 0);
+ class_addfloat(key_class, key_float);
+ key_sym = gensym("#key");
+}
+