[SDL] Patch: Console redirection under WinCE

Corona688 tsm at accesscomm.ca
Sun Jan 5 12:08:01 PST 2003


After downloading the latest win32 SDL_main.c from CVS, I was distressed
to see that SDL *still* doesn't support console redirection under
WinCE.  CE is the one platform where file redirection is absolutely
necessary, because it lacks a console output...  My previous patch for
this admittedly modified a lot of code;  hopefully this one will be more
acceptable.

Instead of adding tons'n'tons of #ifdef _WIN32_WCE blocks, I have one
#ifdef block that contains a bunch of defines;  a small amount of the
current code was modified to use these, but on the whole the code's
nearly exactly the same(except Unicoded under CE.)  Also thought it best
to typedef the lone "/" to a "\\" for CE, because the M$ file-handling
routines are, in some places, so badly designed that a forward-slash
causes them to *crash*.

Additionally, since WinCE has no concept of a 'current working
directory', and hence no _getcwd function, I replaced it with

# define DIR_SEPERATOR TEXT("\\")
# define _getcwd(str,len) wcscpy(str,DIR_SEPERATOR);

Also, the path buffers needed to be #ifdef'ed to allow the use of
unicode characters, like this:

#ifndef NO_STDIO_REDIRECT
# ifdef _WIN32_WCE
  static wchar_t stdoutPath[MAX_PATH];
  static wchar_t stderrPath[MAX_PATH];
# else
  static char stdoutPath[MAX_PATH];
  static char stderrPath[MAX_PATH];
# endif
#endif

Additionally, I had to put #ifdef _WIN32_WCE around some NT-specific
code that the CE compiler threw up on.

Lastly, for plain-vanillia Win32, io.h is the wrong include file to have
_getcwd defined;  use direct.h instead.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SDL_main.c
Type: application/x-unknown-content-type-cfile
Size: 8203 bytes
Desc: not available
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20030105/f36a07cc/attachment-0007.bin>


More information about the SDL mailing list