diff options
-rw-r--r-- | k_cext.c | 20 | ||||
-rw-r--r-- | k_cext.h | 7 |
2 files changed, 24 insertions, 3 deletions
@@ -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); +} @@ -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( |