summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/src/m_atom.c
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2009-07-03 22:16:11 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2009-07-03 22:16:11 +0000
commit0d4560cb0305029fa5f0739670286176ab47cb65 (patch)
tree9899f4324664a77e6a5884fdd1541818a28a2172 /apps/plugins/pdbox/PDa/src/m_atom.c
parenteabeb928ddfdbe5fc6379efb87d9522803310649 (diff)
downloadrockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.gz
rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.zip
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.c20
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 f2ed3a0b65..4d30c1b3de 100644
--- a/apps/plugins/pdbox/PDa/src/m_atom.c
+++ b/apps/plugins/pdbox/PDa/src/m_atom.c
@@ -3,8 +3,14 @@
3* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ 3* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
4 4
5#include "m_pd.h" 5#include "m_pd.h"
6
7#ifdef ROCKBOX
8#include "plugin.h"
9#include "pdbox.h"
10#else /* ROCKBOX */
6#include <stdio.h> 11#include <stdio.h>
7#include <string.h> 12#include <string.h>
13#endif /* ROCKBOX */
8 14
9 /* convenience routines for checking and getting values of 15 /* convenience routines for checking and getting values of
10 atoms. There's no "pointer" version since there's nothing 16 atoms. There's no "pointer" version since there's nothing
@@ -23,7 +29,9 @@ t_int atom_getint(t_atom *a)
23 29
24t_symbol *atom_getsymbol(t_atom *a) /* LATER think about this more carefully */ 30t_symbol *atom_getsymbol(t_atom *a) /* LATER think about this more carefully */
25{ 31{
32#ifndef ROCKBOX
26 char buf[30]; 33 char buf[30];
34#endif
27 if (a->a_type == A_SYMBOL) return (a->a_w.w_symbol); 35 if (a->a_type == A_SYMBOL) return (a->a_w.w_symbol);
28 else return (&s_float); 36 else return (&s_float);
29} 37}
@@ -33,7 +41,11 @@ t_symbol *atom_gensym(t_atom *a) /* this works better for graph labels */
33 char buf[30]; 41 char buf[30];
34 if (a->a_type == A_SYMBOL) return (a->a_w.w_symbol); 42 if (a->a_type == A_SYMBOL) return (a->a_w.w_symbol);
35 else if (a->a_type == A_FLOAT) 43 else if (a->a_type == A_FLOAT)
44#ifdef ROCKBOX
45 ftoan(a->a_w.w_float, buf, sizeof(buf)-1);
46#else
36 sprintf(buf, "%g", a->a_w.w_float); 47 sprintf(buf, "%g", a->a_w.w_float);
48#endif
37 else strcpy(buf, "???"); 49 else strcpy(buf, "???");
38 return (gensym(buf)); 50 return (gensym(buf));
39} 51}
@@ -76,7 +88,11 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize)
76 strcpy(buf, "(pointer)"); 88 strcpy(buf, "(pointer)");
77 break; 89 break;
78 case A_FLOAT: 90 case A_FLOAT:
91#ifdef ROCKBOX
92 ftoan(a->a_w.w_float, tbuf, sizeof(tbuf)-1);
93#else
79 sprintf(tbuf, "%g", a->a_w.w_float); 94 sprintf(tbuf, "%g", a->a_w.w_float);
95#endif
80 if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf); 96 if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf);
81 else if (a->a_w.w_float < 0) strcpy(buf, "-"); 97 else if (a->a_w.w_float < 0) strcpy(buf, "-");
82 else strcat(buf, "+"); 98 else strcat(buf, "+");
@@ -118,10 +134,10 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize)
118 } 134 }
119 break; 135 break;
120 case A_DOLLAR: 136 case A_DOLLAR:
121 sprintf(buf, "$%d", a->a_w.w_index); 137 snprintf(buf, bufsize-1, "$%d", a->a_w.w_index);
122 break; 138 break;
123 case A_DOLLSYM: 139 case A_DOLLSYM:
124 sprintf(buf, "$%s", a->a_w.w_symbol->s_name); 140 snprintf(buf, bufsize-1, "$%s", a->a_w.w_symbol->s_name);
125 break; 141 break;
126 default: 142 default:
127 bug("atom_string"); 143 bug("atom_string");