chiark / gitweb /
Implement debug_printf() in the Emscripten front end, since that's the
authorSimon Tatham <anakin@pobox.com>
Fri, 5 Apr 2013 15:49:22 +0000 (15:49 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 5 Apr 2013 15:49:22 +0000 (15:49 +0000)
easiest way to call js_debug with formatted parameters.

[originally from svn r9807]

emcc.c

diff --git a/emcc.c b/emcc.c
index 9badcc9588fdb4ce339852b3f312ced494f4b643..e3bcbf579bd7830e733e6997270c7db2ff1482bd 100644 (file)
--- a/emcc.c
+++ b/emcc.c
@@ -138,6 +138,16 @@ void fatal(char *fmt, ...)
     js_error_box(buf);
 }
 
+void debug_printf(char *fmt, ...)
+{
+    char buf[512];
+    va_list ap;
+    va_start(ap, fmt);
+    vsnprintf(buf, sizeof(buf), fmt, ap);
+    va_end(ap);
+    js_debug(buf);
+}
+
 /*
  * HTMLish names for the colours allocated by the puzzle.
  */