aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Blechmann <timblech@users.sourceforge.net>2004-06-29 20:49:31 +0000
committerTim Blechmann <timblech@users.sourceforge.net>2004-06-29 20:49:31 +0000
commit0b19477ee90a4c4f6d563dce46c3c2817c8263a8 (patch)
tree4013e83cd9bfbbf30707282142d39f0605ca60f6
parentfccbe2b4b829460a905a675e41119e90da8a4c44 (diff)
support for $0 values
svn path=/trunk/externals/k_cext/; revision=1839
-rw-r--r--k_cext.c20
-rw-r--r--k_cext.h7
2 files changed, 24 insertions, 3 deletions
diff --git a/k_cext.c b/k_cext.c
index a414562..4333aee 100644
--- a/k_cext.c
+++ b/k_cext.c
@@ -32,7 +32,6 @@ int instancenumber=0; // Can not be static because of the win-port.
static t_class *k_cext_class;
static t_class *k_cfunc_class;
-
int k_cext_intcompare(const void *p1, const void *p2)
{
int i = *((int *)p1);
@@ -333,3 +332,22 @@ void k_cext_setup(void)
void k_cfunc_setup(void){
k_cext_setup();
}
+
+/* TB: for accessing $0 values */
+t_float k_cext_getvalue(char c[])
+{
+ while ( isspace(c[0]) )
+ {
+ c++;
+ }
+ return (*(value_get(gensym(c))));
+}
+
+int k_cext_setvalue(char c[],float f)
+{
+ while ( isspace(c[0]) )
+ {
+ c++;
+ }
+ return value_setfloat(gensym(c),f);
+}
diff --git a/k_cext.h b/k_cext.h
index 636d45f..d140823 100644
--- a/k_cext.h
+++ b/k_cext.h
@@ -23,6 +23,7 @@
#include <string.h>
#include <math.h>
#include <stdbool.h>
+#include <ctype.h>
#ifdef _MSC_VER
typedef int bool;
#define true 1
@@ -107,9 +108,11 @@ do{ \
#define FLOATSORT(a,b) qsort((void *)(a),b, sizeof (float), k_cext_floatcompare);
/* TB: values and bang outlets */
-#define VALUE(char) (*(value_get(gensym(char))))
-#define SETVALUE(char,float) value_setfloat(gensym(char),float)
#define Ob(a) outlet_bang(x->outlets[a]);
+t_float k_cext_getvalue(char c[]);
+int k_cext_setvalue(char c[],float f);
+#define VALUE(char) k_cext_getvalue(char)
+#define SETVALUE(char,float) k_cext_setvalue(char,float)
#define IF if(