diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2009-06-07 19:13:45 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2009-06-07 19:13:45 +0000 |
commit | f1070944c53a49bb161b676b9f83950611eb38a4 (patch) | |
tree | d8914846abda2b79480180e6a0b32dbf25c7ad80 /apps/plugins | |
parent | 7f17fce4248dee254a8f0621b222e8f3c90433a1 (diff) | |
download | rockbox-f1070944c53a49bb161b676b9f83950611eb38a4.tar.gz rockbox-f1070944c53a49bb161b676b9f83950611eb38a4.zip |
pdbox: new patch by wincent. make s_print work on sim.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21202 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/s_print.c | 113 | ||||
-rw-r--r-- | apps/plugins/pdbox/SOURCES | 2 |
2 files changed, 113 insertions, 2 deletions
diff --git a/apps/plugins/pdbox/PDa/src/s_print.c b/apps/plugins/pdbox/PDa/src/s_print.c index d3020782d5..40f881f00e 100644 --- a/apps/plugins/pdbox/PDa/src/s_print.c +++ b/apps/plugins/pdbox/PDa/src/s_print.c | |||
@@ -9,8 +9,29 @@ | |||
9 | #include <string.h> | 9 | #include <string.h> |
10 | #include <errno.h> | 10 | #include <errno.h> |
11 | 11 | ||
12 | #if defined(ROCKBOX) && defined (SIMULATOR) | ||
13 | /* Copied from stdio.h */ | ||
14 | int printf (__const char *__restrict __format, ...); | ||
15 | int vprintf (__const char *__restrict __format, va_list __arg); | ||
16 | int vsprintf (char *__restrict __s, | ||
17 | __const char *__restrict __format, | ||
18 | va_list __arg); | ||
19 | int putchar (int __c); | ||
20 | #endif | ||
21 | |||
12 | void post(char *fmt, ...) | 22 | void post(char *fmt, ...) |
13 | { | 23 | { |
24 | #ifdef ROCKBOX | ||
25 | #ifdef SIMULATOR | ||
26 | va_list ap; | ||
27 | va_start(ap, fmt); | ||
28 | vprintf(fmt, ap); | ||
29 | va_end(ap); | ||
30 | putchar('\n'); | ||
31 | #else /* SIMULATOR */ | ||
32 | (void) fmt; | ||
33 | #endif /* SIMULATOR */ | ||
34 | #else /* ROCKBOX */ | ||
14 | va_list ap; | 35 | va_list ap; |
15 | t_int arg[8]; | 36 | t_int arg[8]; |
16 | int i; | 37 | int i; |
@@ -18,10 +39,28 @@ void post(char *fmt, ...) | |||
18 | vfprintf(stderr, fmt, ap); | 39 | vfprintf(stderr, fmt, ap); |
19 | va_end(ap); | 40 | va_end(ap); |
20 | putc('\n', stderr); | 41 | putc('\n', stderr); |
42 | #endif /* ROCKBOX */ | ||
21 | } | 43 | } |
22 | 44 | ||
23 | void startpost(char *fmt, ...) | 45 | void startpost(char *fmt, ...) |
24 | { | 46 | { |
47 | #ifdef ROCKBOX | ||
48 | #ifdef SIMULATOR | ||
49 | va_list ap; | ||
50 | t_int arg[8]; | ||
51 | unsigned int i; | ||
52 | va_start(ap, fmt); | ||
53 | |||
54 | for (i = 0 ; i < 8; i++) | ||
55 | arg[i] = va_arg(ap, t_int); | ||
56 | |||
57 | va_end(ap); | ||
58 | printf(fmt, arg[0], arg[1], arg[2], arg[3], | ||
59 | arg[4], arg[5], arg[6], arg[7]); | ||
60 | #else /* SIMULATOR */ | ||
61 | (void) fmt; | ||
62 | #endif /* SIMULATOR */ | ||
63 | #else /* ROCKBOX */ | ||
25 | va_list ap; | 64 | va_list ap; |
26 | t_int arg[8]; | 65 | t_int arg[8]; |
27 | int i; | 66 | int i; |
@@ -31,11 +70,20 @@ void startpost(char *fmt, ...) | |||
31 | va_end(ap); | 70 | va_end(ap); |
32 | fprintf(stderr, fmt, arg[0], arg[1], arg[2], arg[3], | 71 | fprintf(stderr, fmt, arg[0], arg[1], arg[2], arg[3], |
33 | arg[4], arg[5], arg[6], arg[7]); | 72 | arg[4], arg[5], arg[6], arg[7]); |
73 | #endif /* ROCKBOX */ | ||
34 | } | 74 | } |
35 | 75 | ||
36 | void poststring(char *s) | 76 | void poststring(char *s) |
37 | { | 77 | { |
78 | #ifdef ROCKBOX | ||
79 | #ifdef SIMULATOR | ||
80 | printf(" %s", s); | ||
81 | #else /* SIMULATOR */ | ||
82 | (void)s; | ||
83 | #endif /* SIMULATOR */ | ||
84 | #else /* ROCKBOX */ | ||
38 | fprintf(stderr, " %s", s); | 85 | fprintf(stderr, " %s", s); |
86 | #endif /* ROCKBOX */ | ||
39 | } | 87 | } |
40 | 88 | ||
41 | void postatom(int argc, t_atom *argv) | 89 | void postatom(int argc, t_atom *argv) |
@@ -51,7 +99,6 @@ void postatom(int argc, t_atom *argv) | |||
51 | 99 | ||
52 | void postfloat(float f) | 100 | void postfloat(float f) |
53 | { | 101 | { |
54 | char buf[80]; | ||
55 | t_atom a; | 102 | t_atom a; |
56 | SETFLOAT(&a, f); | 103 | SETFLOAT(&a, f); |
57 | postatom(1, &a); | 104 | postatom(1, &a); |
@@ -59,11 +106,29 @@ void postfloat(float f) | |||
59 | 106 | ||
60 | void endpost(void) | 107 | void endpost(void) |
61 | { | 108 | { |
109 | #ifdef ROCKBOX | ||
110 | #ifdef SIMULATOR | ||
111 | putchar('\n'); | ||
112 | #endif /* SIMULATOR */ | ||
113 | #else /* ROCKBOX */ | ||
62 | fprintf(stderr, "\n"); | 114 | fprintf(stderr, "\n"); |
115 | #endif /* ROCKBOX */ | ||
63 | } | 116 | } |
64 | 117 | ||
65 | void error(char *fmt, ...) | 118 | void error(char *fmt, ...) |
66 | { | 119 | { |
120 | #ifdef ROCKBOX | ||
121 | #ifdef SIMULATOR | ||
122 | va_list ap; | ||
123 | va_start(ap, fmt); | ||
124 | printf("error: "); | ||
125 | vprintf(fmt, ap); | ||
126 | va_end(ap); | ||
127 | putchar('\n'); | ||
128 | #else /* SIMULATOR */ | ||
129 | (void) fmt; | ||
130 | #endif /* SIMULATOR */ | ||
131 | #else /* ROCKBOX */ | ||
67 | va_list ap; | 132 | va_list ap; |
68 | t_int arg[8]; | 133 | t_int arg[8]; |
69 | int i; | 134 | int i; |
@@ -72,6 +137,7 @@ void error(char *fmt, ...) | |||
72 | vfprintf(stderr, fmt, ap); | 137 | vfprintf(stderr, fmt, ap); |
73 | va_end(ap); | 138 | va_end(ap); |
74 | putc('\n', stderr); | 139 | putc('\n', stderr); |
140 | #endif /* ROCKBOX */ | ||
75 | } | 141 | } |
76 | 142 | ||
77 | /* here's the good way to log errors -- keep a pointer to the | 143 | /* here's the good way to log errors -- keep a pointer to the |
@@ -84,6 +150,27 @@ void canvas_finderror(void *object); | |||
84 | 150 | ||
85 | void pd_error(void *object, char *fmt, ...) | 151 | void pd_error(void *object, char *fmt, ...) |
86 | { | 152 | { |
153 | #ifdef ROCKBOX | ||
154 | #ifdef SIMULATOR | ||
155 | va_list ap; | ||
156 | static int saidit = 0; | ||
157 | |||
158 | va_start(ap, fmt); | ||
159 | vsprintf(error_string, fmt, ap); | ||
160 | va_end(ap); | ||
161 | printf("error: %s\n", error_string); | ||
162 | |||
163 | error_object = object; | ||
164 | if (!saidit) | ||
165 | { | ||
166 | post("... you might be able to track this down from the Find menu."); | ||
167 | saidit = 1; | ||
168 | } | ||
169 | #else /* SIMULATOR */ | ||
170 | (void)object; | ||
171 | (void) fmt; | ||
172 | #endif /* SIMULATOR */ | ||
173 | #else /* ROCKBOX */ | ||
87 | va_list ap; | 174 | va_list ap; |
88 | t_int arg[8]; | 175 | t_int arg[8]; |
89 | int i; | 176 | int i; |
@@ -98,10 +185,14 @@ void pd_error(void *object, char *fmt, ...) | |||
98 | post("... you might be able to track this down from the Find menu."); | 185 | post("... you might be able to track this down from the Find menu."); |
99 | saidit = 1; | 186 | saidit = 1; |
100 | } | 187 | } |
188 | #endif /* ROCKBOX */ | ||
101 | } | 189 | } |
102 | 190 | ||
103 | void glob_finderror(t_pd *dummy) | 191 | void glob_finderror(t_pd *dummy) |
104 | { | 192 | { |
193 | #ifdef ROCKBOX | ||
194 | (void)dummy; | ||
195 | #endif /* ROCKBOX */ | ||
105 | if (!error_object) | 196 | if (!error_object) |
106 | post("no findable error yet."); | 197 | post("no findable error yet."); |
107 | else | 198 | else |
@@ -114,6 +205,25 @@ void glob_finderror(t_pd *dummy) | |||
114 | 205 | ||
115 | void bug(char *fmt, ...) | 206 | void bug(char *fmt, ...) |
116 | { | 207 | { |
208 | #ifdef ROCKBOX | ||
209 | #ifdef SIMULATOR | ||
210 | va_list ap; | ||
211 | t_int arg[8]; | ||
212 | unsigned int i; | ||
213 | |||
214 | va_start(ap, fmt); | ||
215 | for(i = 0; i < 8; i++) | ||
216 | arg[i] = va_arg(ap, t_int); | ||
217 | va_end(ap); | ||
218 | |||
219 | printf("Consistency check failed: "); | ||
220 | printf(fmt, arg[0], arg[1], arg[2], arg[3], | ||
221 | arg[4], arg[5], arg[6], arg[7]); | ||
222 | putchar('\n'); | ||
223 | #else /* SIMULATOR */ | ||
224 | (void) fmt; | ||
225 | #endif /* SIMULATOR */ | ||
226 | #else /* ROCKBOX */ | ||
117 | va_list ap; | 227 | va_list ap; |
118 | t_int arg[8]; | 228 | t_int arg[8]; |
119 | int i; | 229 | int i; |
@@ -125,6 +235,7 @@ void bug(char *fmt, ...) | |||
125 | fprintf(stderr, fmt, arg[0], arg[1], arg[2], arg[3], | 235 | fprintf(stderr, fmt, arg[0], arg[1], arg[2], arg[3], |
126 | arg[4], arg[5], arg[6], arg[7]); | 236 | arg[4], arg[5], arg[6], arg[7]); |
127 | putc('\n', stderr); | 237 | putc('\n', stderr); |
238 | #endif /* ROCKBOX */ | ||
128 | } | 239 | } |
129 | 240 | ||
130 | /* this isn't worked out yet. */ | 241 | /* this isn't worked out yet. */ |
diff --git a/apps/plugins/pdbox/SOURCES b/apps/plugins/pdbox/SOURCES index 4d2284304c..fa4aa92b1d 100644 --- a/apps/plugins/pdbox/SOURCES +++ b/apps/plugins/pdbox/SOURCES | |||
@@ -46,7 +46,7 @@ PDa/src/m_sched.c | |||
46 | /* PDa/src/s_main.c Does not compile, system reasons */ | 46 | /* PDa/src/s_main.c Does not compile, system reasons */ |
47 | /* PDa/src/s_inter.c Does not compile, BSD sockets */ | 47 | /* PDa/src/s_inter.c Does not compile, BSD sockets */ |
48 | /* PDa/src/s_file.c Does not compile, file handling stuff */ | 48 | /* PDa/src/s_file.c Does not compile, file handling stuff */ |
49 | /* PDa/src/s_print.c Does not compile, system reasons */ | 49 | PDa/src/s_print.c |
50 | /* | 50 | /* |
51 | PDa/src/s_loader.c | 51 | PDa/src/s_loader.c |
52 | */ | 52 | */ |