aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-07-13 08:34:55 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-07-13 08:34:55 +0000
commitf0556454d553afbbfb27a8e1ded6195580995020 (patch)
treef601a20f9915886876f9630563e05d46cd1662e8
parente674edc9d95beb8618552820634af28561398999 (diff)
fixed 2 bugs:
-> tokens like "1-5" were parsed as float "1" instead of symbol "1-5" -> emtpy symbols became float "0" instead of "bang" remaining issues: hex-tokens (e.g. "0x123") are parsed to floats and not to symbols; not sure whether this is good. svn path=/trunk/externals/zexy/; revision=3342
-rw-r--r--src/symbol2list.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/symbol2list.c b/src/symbol2list.c
index 95dc0c4..d9eadb2 100644
--- a/src/symbol2list.c
+++ b/src/symbol2list.c
@@ -44,9 +44,13 @@ STATIC_INLINE void string2atom(t_atom *ap, char* cp, int clen){
t_float ftest;
strncpy(buffer, cp, clen);
buffer[clen]=0;
- // post("converting buffer '%s' %d", buffer, clen);
ftest=strtod(buffer, endptr);
- if (*endptr == buffer){
+ /* what should we do with the special cases of hexadecimal values, "INF" and "NAN" ???
+ * strtod() parses them to numeric values:
+ * symbol "hallo 0x12" will become "list hallo 18"
+ * do we want this ??
+ */
+ if (buffer+clen!=*endptr){
/* strtof() failed, we have a symbol */
SETSYMBOL(ap, gensym(buffer));
} else {
@@ -118,6 +122,10 @@ static void symbol2list_process(t_symbol2list *x)
if(cp)string2atom(x->argv+i, cp, strlen(cp));
}
static void symbol2list_bang(t_symbol2list *x){
+ if(!(x->s) || x->s==&s_){
+ outlet_bang(x->x_obj.ob_outlet);
+ return;
+ }
symbol2list_process(x);
if(x->argc)outlet_list(x->x_obj.ob_outlet, 0, x->argc, x->argv);
}