summaryrefslogtreecommitdiffstats
path: root/apps/plugins/pdbox
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2009-06-07 19:13:45 +0000
committerDominik Wenger <domonoky@googlemail.com>2009-06-07 19:13:45 +0000
commitf1070944c53a49bb161b676b9f83950611eb38a4 (patch)
treed8914846abda2b79480180e6a0b32dbf25c7ad80 /apps/plugins/pdbox
parent7f17fce4248dee254a8f0621b222e8f3c90433a1 (diff)
downloadrockbox-f1070944c53a49bb161b676b9f83950611eb38a4.tar.gz
rockbox-f1070944c53a49bb161b676b9f83950611eb38a4.tar.bz2
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/pdbox')
-rw-r--r--apps/plugins/pdbox/PDa/src/s_print.c113
-rw-r--r--apps/plugins/pdbox/SOURCES2
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 @@
#include <string.h>
#include <errno.h>
+#if defined(ROCKBOX) && defined (SIMULATOR)
+/* Copied from stdio.h */
+int printf (__const char *__restrict __format, ...);
+int vprintf (__const char *__restrict __format, va_list __arg);
+int vsprintf (char *__restrict __s,
+ __const char *__restrict __format,
+ va_list __arg);
+int putchar (int __c);
+#endif
+
void post(char *fmt, ...)
{
+#ifdef ROCKBOX
+#ifdef SIMULATOR
+ va_list ap;
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ va_end(ap);
+ putchar('\n');
+#else /* SIMULATOR */
+ (void) fmt;
+#endif /* SIMULATOR */
+#else /* ROCKBOX */
va_list ap;
t_int arg[8];
int i;
@@ -18,10 +39,28 @@ void post(char *fmt, ...)
vfprintf(stderr, fmt, ap);
va_end(ap);
putc('\n', stderr);
+#endif /* ROCKBOX */
}
void startpost(char *fmt, ...)
{
+#ifdef ROCKBOX
+#ifdef SIMULATOR
+ va_list ap;
+ t_int arg[8];
+ unsigned int i;
+ va_start(ap, fmt);
+
+ for (i = 0 ; i < 8; i++)
+ arg[i] = va_arg(ap, t_int);
+
+ va_end(ap);
+ printf(fmt, arg[0], arg[1], arg[2], arg[3],
+ arg[4], arg[5], arg[6], arg[7]);
+#else /* SIMULATOR */
+ (void) fmt;
+#endif /* SIMULATOR */
+#else /* ROCKBOX */
va_list ap;
t_int arg[8];
int i;
@@ -31,11 +70,20 @@ void startpost(char *fmt, ...)
va_end(ap);
fprintf(stderr, fmt, arg[0], arg[1], arg[2], arg[3],
arg[4], arg[5], arg[6], arg[7]);
+#endif /* ROCKBOX */
}
void poststring(char *s)
{
+#ifdef ROCKBOX
+#ifdef SIMULATOR
+ printf(" %s", s);
+#else /* SIMULATOR */
+ (void)s;
+#endif /* SIMULATOR */
+#else /* ROCKBOX */
fprintf(stderr, " %s", s);
+#endif /* ROCKBOX */
}
void postatom(int argc, t_atom *argv)
@@ -51,7 +99,6 @@ void postatom(int argc, t_atom *argv)
void postfloat(float f)
{
- char buf[80];
t_atom a;
SETFLOAT(&a, f);
postatom(1, &a);
@@ -59,11 +106,29 @@ void postfloat(float f)
void endpost(void)
{
+#ifdef ROCKBOX
+#ifdef SIMULATOR
+ putchar('\n');
+#endif /* SIMULATOR */
+#else /* ROCKBOX */
fprintf(stderr, "\n");
+#endif /* ROCKBOX */
}
void error(char *fmt, ...)
{
+#ifdef ROCKBOX
+#ifdef SIMULATOR
+ va_list ap;
+ va_start(ap, fmt);
+ printf("error: ");
+ vprintf(fmt, ap);
+ va_end(ap);
+ putchar('\n');
+#else /* SIMULATOR */
+ (void) fmt;
+#endif /* SIMULATOR */
+#else /* ROCKBOX */
va_list ap;
t_int arg[8];
int i;
@@ -72,6 +137,7 @@ void error(char *fmt, ...)
vfprintf(stderr, fmt, ap);
va_end(ap);
putc('\n', stderr);
+#endif /* ROCKBOX */
}
/* here's the good way to log errors -- keep a pointer to the
@@ -84,6 +150,27 @@ void canvas_finderror(void *object);
void pd_error(void *object, char *fmt, ...)
{
+#ifdef ROCKBOX
+#ifdef SIMULATOR
+ va_list ap;
+ static int saidit = 0;
+
+ va_start(ap, fmt);
+ vsprintf(error_string, fmt, ap);
+ va_end(ap);
+ printf("error: %s\n", error_string);
+
+ error_object = object;
+ if (!saidit)
+ {
+ post("... you might be able to track this down from the Find menu.");
+ saidit = 1;
+ }
+#else /* SIMULATOR */
+ (void)object;
+ (void) fmt;
+#endif /* SIMULATOR */
+#else /* ROCKBOX */
va_list ap;
t_int arg[8];
int i;
@@ -98,10 +185,14 @@ void pd_error(void *object, char *fmt, ...)
post("... you might be able to track this down from the Find menu.");
saidit = 1;
}
+#endif /* ROCKBOX */
}
void glob_finderror(t_pd *dummy)
{
+#ifdef ROCKBOX
+ (void)dummy;
+#endif /* ROCKBOX */
if (!error_object)
post("no findable error yet.");
else
@@ -114,6 +205,25 @@ void glob_finderror(t_pd *dummy)
void bug(char *fmt, ...)
{
+#ifdef ROCKBOX
+#ifdef SIMULATOR
+ va_list ap;
+ t_int arg[8];
+ unsigned int i;
+
+ va_start(ap, fmt);
+ for(i = 0; i < 8; i++)
+ arg[i] = va_arg(ap, t_int);
+ va_end(ap);
+
+ printf("Consistency check failed: ");
+ printf(fmt, arg[0], arg[1], arg[2], arg[3],
+ arg[4], arg[5], arg[6], arg[7]);
+ putchar('\n');
+#else /* SIMULATOR */
+ (void) fmt;
+#endif /* SIMULATOR */
+#else /* ROCKBOX */
va_list ap;
t_int arg[8];
int i;
@@ -125,6 +235,7 @@ void bug(char *fmt, ...)
fprintf(stderr, fmt, arg[0], arg[1], arg[2], arg[3],
arg[4], arg[5], arg[6], arg[7]);
putc('\n', stderr);
+#endif /* ROCKBOX */
}
/* 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
/* PDa/src/s_main.c Does not compile, system reasons */
/* PDa/src/s_inter.c Does not compile, BSD sockets */
/* PDa/src/s_file.c Does not compile, file handling stuff */
-/* PDa/src/s_print.c Does not compile, system reasons */
+PDa/src/s_print.c
/*
PDa/src/s_loader.c
*/