summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-02 07:57:17 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-02 07:57:17 +0000
commit90c4dae08fea47797b3ae574e5dfe35dc66f5631 (patch)
tree4198e3ccd0a5bab17db2a0f82ee7b6c643115c69 /win32
parente193fd8d665567c7f3b827c21a1b77af43e2c391 (diff)
WinCE patch merged
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 4ac661ecfc..6ace01160e 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -29,6 +29,9 @@
#endif
#include "win32.h"
#include "win32/dir.h"
+#ifdef _WIN32_WCE
+#include "wince.h"
+#endif
#ifndef index
#define index(x, y) strchr((x), (y))
#endif
@@ -49,7 +52,7 @@
# undef WIN95
#endif
-#ifdef __BORLANDC__
+#if defined __BORLANDC__ || defined _WIN32_WCE
# define _filbuf _fgetc
# define _flsbuf _fputc
# define enough_to_get(n) (--(n) >= 0)
@@ -91,7 +94,7 @@ static int valid_filename(char *s);
static void StartSockets ();
static char *str_grow(struct RString *str, size_t new_size);
static DWORD wait_events(HANDLE event, DWORD timeout);
-#ifndef __BORLANDC__
+#if !defined(__BORLANDC__) && !defined(_WIN32_WCE)
static int rb_w32_open_osfhandle(long osfhandle, int flags);
#else
#define rb_w32_open_osfhandle(osfhandle, flags) _open_osfhandle(osfhandle, flags)
@@ -287,6 +290,11 @@ NtInitialize(int *argc, char ***argv)
// Initialize Winsock
StartSockets();
+
+#ifdef _WIN32_WCE
+ // free commandline buffer
+ wce_FreeCommandLine();
+#endif
}
char *getlogin()
@@ -1387,7 +1395,7 @@ typedef struct {
#define _CRTIMP __declspec(dllimport)
#endif
-#ifndef __BORLANDC__
+#if !defined(__BORLANDC__) && !defined(_WIN32_WCE)
EXTERN_C _CRTIMP ioinfo * __pioinfo[];
#define IOINFO_L2E 5
@@ -2707,8 +2715,10 @@ static void setup_call(CONTEXT* ctx, struct handler_arg_t *harg)
ctx->Esp = (DWORD)esp;
ctx->Eip = (DWORD)rb_w32_call_handler;
#else
+#ifndef _WIN32_WCE
#error unsupported processor
#endif
+#endif
}
int rb_w32_main_context(int arg, void (*handler)(int))
@@ -2792,13 +2802,16 @@ static void catch_interrupt(void)
int rb_w32_getc(FILE* stream)
{
int c, trap_immediate = rb_trap_immediate;
+#ifndef _WIN32_WCE
if (enough_to_get(stream->FILE_COUNT)) {
c = (unsigned char)*stream->FILE_READPTR++;
rb_trap_immediate = trap_immediate;
}
- else {
+ else
+#endif
+ {
c = _filbuf(stream);
-#ifdef __BORLANDC__
+#if defined __BORLANDC__ || defined _WIN32_WCE
if( ( c == EOF )&&( errno == EPIPE ) )
{
clearerr(stream);
@@ -2814,11 +2827,14 @@ int rb_w32_getc(FILE* stream)
int rb_w32_putc(int c, FILE* stream)
{
int trap_immediate = rb_trap_immediate;
+#ifndef _WIN32_WCE
if (enough_to_put(stream->FILE_COUNT)) {
c = (unsigned char)(*stream->FILE_READPTR++ = (char)c);
rb_trap_immediate = trap_immediate;
}
- else {
+ else
+#endif
+ {
c = _flsbuf(c, stream);
rb_trap_immediate = trap_immediate;
catch_interrupt();