From f0556454d553afbbfb27a8e1ded6195580995020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 13 Jul 2005 08:34:55 +0000 Subject: 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 --- src/symbol2list.c | 12 ++++++++++-- 1 file 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); } -- cgit v1.2.1