diff options
| author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-07-03 22:16:11 +0000 |
|---|---|---|
| committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-07-03 22:16:11 +0000 |
| commit | 0d4560cb0305029fa5f0739670286176ab47cb65 (patch) | |
| tree | 9899f4324664a77e6a5884fdd1541818a28a2172 /apps/plugins/pdbox/PDa/src/m_atom.c | |
| parent | eabeb928ddfdbe5fc6379efb87d9522803310649 (diff) | |
| download | rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.zip rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.gz rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.bz2 rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.xz | |
Accept FS #10244 by Wincent Balin: more pdbox work done for GSoC; also some keyword and line-ending fixes by me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21626 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/m_atom.c')
| -rw-r--r-- | apps/plugins/pdbox/PDa/src/m_atom.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/apps/plugins/pdbox/PDa/src/m_atom.c b/apps/plugins/pdbox/PDa/src/m_atom.c index f2ed3a0..4d30c1b 100644 --- a/apps/plugins/pdbox/PDa/src/m_atom.c +++ b/apps/plugins/pdbox/PDa/src/m_atom.c @@ -3,8 +3,14 @@ * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ #include "m_pd.h" + +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#else /* ROCKBOX */ #include <stdio.h> #include <string.h> +#endif /* ROCKBOX */ /* convenience routines for checking and getting values of atoms. There's no "pointer" version since there's nothing @@ -23,7 +29,9 @@ t_int atom_getint(t_atom *a) t_symbol *atom_getsymbol(t_atom *a) /* LATER think about this more carefully */ { +#ifndef ROCKBOX char buf[30]; +#endif if (a->a_type == A_SYMBOL) return (a->a_w.w_symbol); else return (&s_float); } @@ -33,7 +41,11 @@ 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) +#ifdef ROCKBOX + ftoan(a->a_w.w_float, buf, sizeof(buf)-1); +#else sprintf(buf, "%g", a->a_w.w_float); +#endif else strcpy(buf, "???"); return (gensym(buf)); } @@ -76,7 +88,11 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize) strcpy(buf, "(pointer)"); break; case A_FLOAT: +#ifdef ROCKBOX + ftoan(a->a_w.w_float, tbuf, sizeof(tbuf)-1); +#else sprintf(tbuf, "%g", a->a_w.w_float); +#endif if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf); else if (a->a_w.w_float < 0) strcpy(buf, "-"); else strcat(buf, "+"); @@ -118,10 +134,10 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize) } break; case A_DOLLAR: - sprintf(buf, "$%d", a->a_w.w_index); + snprintf(buf, bufsize-1, "$%d", a->a_w.w_index); break; case A_DOLLSYM: - sprintf(buf, "$%s", a->a_w.w_symbol->s_name); + snprintf(buf, bufsize-1, "$%s", a->a_w.w_symbol->s_name); break; default: bug("atom_string"); |