diff options
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 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 | ||
24 | t_symbol *atom_getsymbol(t_atom *a) /* LATER think about this more carefully */ | 30 | t_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"); |