From 443240e438dd631a234f5cf0bf6d3f4fcdefa2a5 Mon Sep 17 00:00:00 2001 From: martin-s Date: Tue, 5 May 2009 13:13:27 +0000 Subject: [PATCH] Fix:speech_cmdline:Add support for win32/wince git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@2252 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/configure.in | 3 +++ navit/navit/speech/cmdline/speech_cmdline.c | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/navit/configure.in b/navit/configure.in index c6aea55..bf5bc8b 100644 --- a/navit/configure.in +++ b/navit/configure.in @@ -220,6 +220,9 @@ AC_TRY_LINK([#include ], [fsync(0);],AC_MSG_RESULT(yes);AC_DEFINE(HAVE AC_MSG_CHECKING(for system) AC_TRY_LINK([#include ], [system("/bin/true");],AC_MSG_RESULT(yes);AC_DEFINE(HAVE_SYSTEM, 1, [Define to 1 if you have the `system' function.]),speech_cmdline=no; speech_cmdline_reason="not supported without system()"; AC_MSG_RESULT(no)) +AC_MSG_CHECKING(for CreateProcess) +AC_TRY_LINK([#include ], [CreateProcess(NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL);],AC_MSG_RESULT(yes);AC_DEFINE(HAVE_CREATEPROCESS, 1, [Define to 1 if you have the `CreateProcess' function.]);speech_cmdline=yes; speech_cmdline_reason="CreateProcess exists", AC_MSG_RESULT(no)) + AC_ARG_ENABLE(graphics-sdl, [ --disable-graphics-sdl don't create graphics sdl], enable_graphics_sdl=$enableval, enable_graphics_sdl=yes) if test "x${enable_graphics_sdl}" = "xyes" ; then if test -z "$SDL_CONFIG"; then diff --git a/navit/navit/speech/cmdline/speech_cmdline.c b/navit/navit/speech/cmdline/speech_cmdline.c index f401c86..ba8979e 100644 --- a/navit/navit/speech/cmdline/speech_cmdline.c +++ b/navit/navit/speech/cmdline/speech_cmdline.c @@ -23,6 +23,10 @@ #include "item.h" #include "plugin.h" #include "speech.h" +#ifdef HAVE_API_WIN32_BASE +#include +#include "util.h" +#endif #ifdef USE_EXEC #include #include @@ -64,11 +68,32 @@ speechd_say(struct speech_priv *this, const char *text) } return 0; #else +#ifdef HAVE_API_WIN32_BASE + char *cmdline,*p; + PROCESS_INFORMATION pr; + LPCWSTR cmd,arg; + int ret; + + + cmdline=g_strdup_printf(this->cmdline, text); + p=cmdline; + while (*p != ' ' && *p != '\0') + p++; + if (*p == ' ') + *p++='\0'; + cmd = newSysString(cmdline); + arg = newSysString(p); + ret=!CreateProcess(cmd, arg, NULL, NULL, 0, CREATE_NEW_CONSOLE, NULL, NULL, NULL, &pr); + g_free(cmd); + g_free(arg); + return ret; +#else char *cmdline; cmdline=g_strdup_printf(this->cmdline, text); return system(cmdline); #endif +#endif } static void -- 2.7.4