diff options
author | Miller Puckette <millerpuckette@users.sourceforge.net> | 2004-09-06 20:20:36 +0000 |
---|---|---|
committer | Miller Puckette <millerpuckette@users.sourceforge.net> | 2004-09-06 20:20:36 +0000 |
commit | ed932acb5860bf8b9296169676499562a55d139e (patch) | |
tree | dc6a40dba908deb07c175cd40ee19c197318f72d /pd/src/m_atom.c | |
parent | dad636821f6e7d3ead02c157f308c0ceeba9af3d (diff) |
checking in version 0.38test5.
Oops, I realize I forgot some more nice files, will add them and re-commit.
svn path=/trunk/; revision=2010
Diffstat (limited to 'pd/src/m_atom.c')
-rw-r--r-- | pd/src/m_atom.c | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/pd/src/m_atom.c b/pd/src/m_atom.c index 7e30c82f..8ba13131 100644 --- a/pd/src/m_atom.c +++ b/pd/src/m_atom.c @@ -7,8 +7,8 @@ #include <string.h> /* convenience routines for checking and getting values of - atoms. There's no "pointer" version since there's nothing - safe to return if there's an error. */ + atoms. There's no "pointer" version since there's nothing + safe to return if there's an error. */ t_float atom_getfloat(t_atom *a) { @@ -33,7 +33,7 @@ t_symbol *atom_gensym(t_atom *a) /* this works better for graph labels */ char buf[30]; if (a->a_type == A_SYMBOL) return (a->a_w.w_symbol); else if (a->a_type == A_FLOAT) - sprintf(buf, "%g", a->a_w.w_float); + sprintf(buf, "%g", a->a_w.w_float); else strcpy(buf, "???"); return (gensym(buf)); } @@ -73,57 +73,57 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize) case A_SEMI: strcpy(buf, ";"); break; case A_COMMA: strcpy(buf, ","); break; case A_POINTER: - strcpy(buf, "(pointer)"); - break; + strcpy(buf, "(pointer)"); + break; case A_FLOAT: - sprintf(tbuf, "%g", a->a_w.w_float); - if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf); - else if (a->a_w.w_float < 0) strcpy(buf, "-"); - else strcat(buf, "+"); - break; + sprintf(tbuf, "%g", a->a_w.w_float); + if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf); + else if (a->a_w.w_float < 0) strcpy(buf, "-"); + else strcat(buf, "+"); + break; case A_SYMBOL: { - char *sp; - unsigned int len; - int quote; - for (sp = a->a_w.w_symbol->s_name, len = 0, quote = 0; *sp; sp++, len++) - if (*sp == ';' || *sp == ',' || *sp == '\\' || - (*sp == '$' && sp == a->a_w.w_symbol->s_name && sp[1] >= '0' - && sp[1] <= '9')) - quote = 1; - if (quote) - { - char *bp = buf, *ep = buf + (bufsize-2); - sp = a->a_w.w_symbol->s_name; - while (bp < ep && *sp) - { - if (*sp == ';' || *sp == ',' || *sp == '\\' || - (*sp == '$' && bp == buf && sp[1] >= '0' && sp[1] <= '9')) - *bp++ = '\\'; - *bp++ = *sp++; - } - if (*sp) *bp++ = '*'; - *bp = 0; - /* post("quote %s -> %s", a->a_w.w_symbol->s_name, buf); */ - } - else - { - if (len < bufsize-1) strcpy(buf, a->a_w.w_symbol->s_name); - else - { - strncpy(buf, a->a_w.w_symbol->s_name, bufsize - 2); - strcpy(buf + (bufsize - 2), "*"); - } - } + char *sp; + unsigned int len; + int quote; + for (sp = a->a_w.w_symbol->s_name, len = 0, quote = 0; *sp; sp++, len++) + if (*sp == ';' || *sp == ',' || *sp == '\\' || + (*sp == '$' && sp == a->a_w.w_symbol->s_name && sp[1] >= '0' + && sp[1] <= '9')) + quote = 1; + if (quote) + { + char *bp = buf, *ep = buf + (bufsize-2); + sp = a->a_w.w_symbol->s_name; + while (bp < ep && *sp) + { + if (*sp == ';' || *sp == ',' || *sp == '\\' || + (*sp == '$' && bp == buf && sp[1] >= '0' && sp[1] <= '9')) + *bp++ = '\\'; + *bp++ = *sp++; + } + if (*sp) *bp++ = '*'; + *bp = 0; + /* post("quote %s -> %s", a->a_w.w_symbol->s_name, buf); */ + } + else + { + if (len < bufsize-1) strcpy(buf, a->a_w.w_symbol->s_name); + else + { + strncpy(buf, a->a_w.w_symbol->s_name, bufsize - 2); + strcpy(buf + (bufsize - 2), "*"); + } + } } - break; + break; case A_DOLLAR: - sprintf(buf, "$%d", a->a_w.w_index); - break; + sprintf(buf, "$%d", a->a_w.w_index); + break; case A_DOLLSYM: - sprintf(buf, "$%s", a->a_w.w_symbol->s_name); - break; + sprintf(buf, "$%s", a->a_w.w_symbol->s_name); + break; default: - bug("atom_string"); + bug("atom_string"); } } |