1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Peter D'Hoye 2009-07-03 22:16:11 +00:00
parent eabeb928dd
commit 0d4560cb03
113 changed files with 10637 additions and 4420 deletions

View file

@ -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");