summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-10-29 11:45:56 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-10-29 11:45:56 +0000
commitd0c61e4154288e7e1bd0cc0925cb1ce41cca5fb5 (patch)
tree90e88ae744cc43fe367bec29a20680243c192c86 /navit
parentad1fa7a4d381af7cfe57d70017d3aca4751e64bc (diff)
downloadnavit-d0c61e4154288e7e1bd0cc0925cb1ce41cca5fb5.tar.gz
Add:Core:Made it possible to popup a message box for debug messages on wince
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1609 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r--navit/debug.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/navit/debug.c b/navit/debug.c
index 6003911e6..37b22f00c 100644
--- a/navit/debug.c
+++ b/navit/debug.c
@@ -28,6 +28,10 @@
#include "item.h"
#include "debug.h"
+#ifdef DEBUG_WIN32_CE_MESSAGEBOX
+#include <windows.h>
+#include <windowsx.h>
+#endif
int debug_level=0,segv_level=0;
static int dummy;
@@ -107,17 +111,35 @@ debug_level_get(const char *name)
void
debug_vprintf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap)
{
+#ifdef HAVE_API_WIN32_CE
+ char buffer[4096];
+#else
char buffer[mlen+flen+3];
+#endif
FILE *fp=debug_fp;
sprintf(buffer, "%s:%s", module, function);
if (debug_level_get(module) >= level || debug_level_get(buffer) >= level) {
+#ifndef DEBUG_WIN32_CE_MESSAGEBOX
if (! fp)
fp = stderr;
if (prefix)
fprintf(fp,"%s:",buffer);
vfprintf(fp,fmt, ap);
fflush(fp);
+#else
+ wchar_t muni[4096];
+ char xbuffer[4096];
+ int len=0;
+ if (prefix) {
+ strcpy(xbuffer,buffer);
+ len=strlen(buffer);
+ xbuffer[len++]=':';
+ }
+ vsprintf(xbuffer+len,fmt,ap);
+ mbstowcs(muni, xbuffer, strlen(xbuffer)+1);
+ MessageBoxW(NULL, muni, TEXT("Navit - Error"), MB_APPLMODAL|MB_OK|MB_ICONERROR);
+#endif
}
}