summaryrefslogtreecommitdiff
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
parente193fd8d665567c7f3b827c21a1b77af43e2c391 (diff)
WinCE patch merged
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--configure.in9
-rw-r--r--defines.h6
-rw-r--r--dir.c12
-rw-r--r--dln.c25
-rw-r--r--error.c2
-rw-r--r--eval.c2
-rw-r--r--file.c25
-rw-r--r--hash.c2
-rw-r--r--io.c18
-rw-r--r--main.c2
-rw-r--r--missing.h2
-rw-r--r--process.c12
-rw-r--r--rubysig.h2
-rw-r--r--signal.c12
-rw-r--r--st.c2
-rw-r--r--util.c10
-rw-r--r--util.h2
-rw-r--r--win32/win32.c28
-rw-r--r--wince/README.wince62
-rw-r--r--wince/assert.h4
-rw-r--r--wince/config141
-rw-r--r--wince/configure.bat133
-rw-r--r--wince/direct.c54
-rw-r--r--wince/direct.h23
-rw-r--r--wince/dll.mak1547
-rw-r--r--wince/errno.c11
-rw-r--r--wince/errno.h55
-rw-r--r--wince/exe.mak353
-rw-r--r--wince/fcntl.h42
-rw-r--r--wince/io.c222
-rw-r--r--wince/io.h65
-rw-r--r--wince/mswince-ruby17.def814
-rw-r--r--wince/process.c47
-rw-r--r--wince/process.h44
-rw-r--r--wince/signal.c26
-rw-r--r--wince/signal.h71
-rw-r--r--wince/stddef.h5
-rw-r--r--wince/stdio.c36
-rw-r--r--wince/stdlib.c22
-rw-r--r--wince/string.c71
-rw-r--r--wince/time.c299
-rw-r--r--wince/time.h63
-rw-r--r--wince/varargs.h34
-rw-r--r--wince/wince.c535
-rw-r--r--wince/wince.h216
-rw-r--r--wince/wincemain.c16
-rw-r--r--wince/wincon.h7
-rw-r--r--wince/winsock2.c338
48 files changed, 5461 insertions, 68 deletions
diff --git a/configure.in b/configure.in
index 1db8649cd4..df9a331e62 100644
--- a/configure.in
+++ b/configure.in
@@ -808,6 +808,8 @@ if test "$with_dln_a_out" != yes; then
DLDFLAGS="${DLDFLAGS} "'$(DEFFILE)'
rb_cv_dlopen=yes ;;
hiuxmpp) LDSHARED='ld -r' ;;
+ atheos*) LDSHARED="$CC -shared"
+ rb_cv_dlopen=yes ;;
*) LDSHARED='ld' ;;
esac
AC_MSG_RESULT($rb_cv_dlopen)
@@ -955,9 +957,6 @@ rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no, rb_cv_missing_fconvert=no
*djgpp*)
setup=Setup.dj
;;
- atheos*)
- setup=Setup.atheos
- ;;
*)
setup=Setup
;;
@@ -1085,6 +1084,10 @@ if test "$enable_shared" = 'yes'; then
LIBRUBY_DLDFLAGS='-install_name $(libdir)/lib$(RUBY_SO_NAME).dylib -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(MAJOR).$(MINOR)'
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_SO_NAME).dylib'
;;
+ atheos*)
+ LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'
+ LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
+ ;;
*)
;;
esac
diff --git a/defines.h b/defines.h
index cadf52dcf6..55dd9eecf4 100644
--- a/defines.h
+++ b/defines.h
@@ -88,7 +88,7 @@ void xfree _((void*));
/* define RUBY_USE_EUC/SJIS for default kanji-code */
#ifndef DEFAULT_KCODE
-#if defined(MSDOS) || defined(__CYGWIN__) || defined(__human68k__) || defined(__MACOS__) || defined(__EMX__) || defined(OS2) || defined(NT)
+#if defined(MSDOS) || defined(__CYGWIN__) || defined(__human68k__) || defined(__MACOS__) || defined(__EMX__) || defined(OS2) || defined(NT) || defined(_WIN32_WCE)
#define DEFAULT_KCODE KCODE_SJIS
#else
#define DEFAULT_KCODE KCODE_EUC
@@ -106,7 +106,7 @@ void xfree _((void*));
#define HAVE_SYS_WAIT_H /* configure fails to find this */
#endif /* NeXT */
-#ifdef NT
+#if defined(NT) || defined(_WIN32_WCE)
#include "win32/win32.h"
#endif
@@ -141,7 +141,7 @@ void xfree _((void*));
#define DOSISH 1
#endif
-#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(OS2)
+#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(OS2) || defined(_WIN32_WCE)
#define PATH_SEP ";"
#elif defined(riscos)
#define PATH_SEP ","
diff --git a/dir.c b/dir.c
index 0aa41fb89c..065dacda81 100644
--- a/dir.c
+++ b/dir.c
@@ -21,10 +21,10 @@
#include <unistd.h>
#endif
-#if defined HAVE_DIRENT_H && !defined NT
+#if defined HAVE_DIRENT_H && !defined NT && !defined _WIN32_WCE
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
-#elif defined HAVE_DIRECT_H && !defined NT
+#elif defined HAVE_DIRECT_H && !defined NT && !defined _WIN32_WCE
# include <direct.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
@@ -39,7 +39,7 @@
# if HAVE_NDIR_H
# include <ndir.h>
# endif
-# if defined(NT)
+# if defined(NT) || defined(_WIN32_WCE)
# include "win32/dir.h"
# endif
#endif
@@ -79,6 +79,10 @@ char *strchr _((char*,char));
# define CharNext(p) ((p) + 1)
# endif
#endif
+#ifdef _WIN32_WCE
+#undef CharNext
+#define CharNext CharNextA
+#endif
#if defined DOSISH
#define isdirsep(c) ((c) == '/' || (c) == '\\')
static char *
@@ -534,7 +538,7 @@ dir_s_mkdir(argc, argv, obj)
SafeStringValue(path);
rb_secure(2);
-#if !defined(NT)
+#if !defined(NT) && !defined(_WIN32_WCE)
if (mkdir(RSTRING(path)->ptr, mode) == -1)
rb_sys_fail(RSTRING(path)->ptr);
#else
diff --git a/dln.c b/dln.c
index 2fb73be4ff..a4034c6854 100644
--- a/dln.c
+++ b/dln.c
@@ -48,7 +48,7 @@ void *xrealloc();
#endif
#include <stdio.h>
-#if defined(NT) || defined(__VMS)
+#if defined(NT) || defined(__VMS) || defined(_WIN32_WCE)
#include "missing/file.h"
#endif
#include <sys/types.h>
@@ -69,7 +69,7 @@ void *xrealloc();
# include <unistd.h>
#endif
-#ifndef NT
+#if !defined(NT) && !defined(_WIN32_WCE)
char *getenv();
#endif
@@ -1149,6 +1149,15 @@ dln_sym(name)
#include <windows.h>
#endif
+#ifdef _WIN32_WCE
+#undef FormatMessage
+#define FormatMessage FormatMessageA
+#undef LoadLibrary
+#define LoadLibrary LoadLibraryA
+#undef GetProcAddress
+#define GetProcAddress GetProcAddressA
+#endif
+
static const char *
dln_strerror()
{
@@ -1589,7 +1598,7 @@ dln_find_exe(fname, path)
}
if (!path) {
-#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__MACOS__)
+#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__MACOS__) || defined(_WIN32_WCE)
path = "/usr/local/bin;/usr/ucb;/usr/bin;/bin;.";
#else
path = "/usr/local/bin:/usr/ucb:/usr/bin:/bin:.";
@@ -1660,7 +1669,7 @@ dln_find_1(fname, path, exe_flag)
if (strncmp("./", fname, 2) == 0 || strncmp("../", fname, 3) == 0)
return fname;
if (exe_flag && strchr(fname, '/')) return fname;
-#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__EMX__)
+#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__EMX__) || defined(_WIN32_WCE)
if (fname[0] == '\\') return fname;
if (strlen(fname) > 2 && fname[1] == ':') return fname;
if (strncmp(".\\", fname, 2) == 0 || strncmp("..\\", fname, 3) == 0)
@@ -1692,7 +1701,7 @@ dln_find_1(fname, path, exe_flag)
*/
if (*dp == '~' && (l == 1 ||
-#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__EMX__)
+#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__EMX__) || defined(_WIN32_WCE)
dp[1] == '\\' ||
#endif
dp[1] == '/')) {
@@ -1750,7 +1759,7 @@ dln_find_1(fname, path, exe_flag)
}
}
#endif
-#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__EMX__)
+#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__EMX__) || defined(_WIN32_WCE)
if (exe_flag) {
static const char *extension[] = {
#if defined(MSDOS)
@@ -1758,9 +1767,9 @@ dln_find_1(fname, path, exe_flag)
#if defined(DJGPP)
".btm", ".sh", ".ksh", ".pl", ".sed",
#endif
-#elif defined(__EMX__) || defined(NT)
+#elif defined(__EMX__) || defined(NT) || defined(_WIN32_WCE)
".exe", ".com", ".cmd", ".bat",
-/* end of __EMX__ or NT*/
+/* end of __EMX__ or NT or WINCE */
#else
".r", ".R", ".x", ".X", ".bat", ".BAT",
/* __human68k__ */
diff --git a/error.c b/error.c
index 0c7d2bc69d..bd0b13c847 100644
--- a/error.c
+++ b/error.c
@@ -645,7 +645,7 @@ void
rb_sys_fail(mesg)
const char *mesg;
{
-#if !defined(NT) && !defined(__VMS)
+#if !defined(NT) && !defined(__VMS) && !defined(_WIN32_WCE)
char *strerror();
#endif
char *err;
diff --git a/eval.c b/eval.c
index 40470de3ff..d35b9b7395 100644
--- a/eval.c
+++ b/eval.c
@@ -7328,7 +7328,7 @@ win32_set_exception_list(p)
# endif
}
-#ifndef SAVE_WIN32_EXCEPTION_LIST
+#if !defined SAVE_WIN32_EXCEPTION_LIST && !defined _WIN32_WCE
# error unsupported platform
#endif
#endif
diff --git a/file.c b/file.c
index 04af8db766..ebfdcc5735 100644
--- a/file.c
+++ b/file.c
@@ -12,7 +12,7 @@
**********************************************************************/
-#ifdef NT
+#if defined NT || defined _WIN32_WCE
#include "missing/file.h"
#endif
@@ -43,12 +43,12 @@ int flock _((int, int));
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#else
-#ifndef NT
+#if !defined(NT) && !defined(_WIN32_WCE)
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
};
-#endif /* NT */
+#endif /* NT, WINCE */
#endif
VALUE rb_time_new _((time_t, time_t));
@@ -76,6 +76,11 @@ char *strrchr _((const char*,const char));
#define lstat(path,st) stat(path,st)
#endif
+#ifdef _WIN32_WCE
+#undef CharNext
+#define CharNext CharNextA
+#endif
+
VALUE rb_cFile;
VALUE rb_mFileTest;
static VALUE rb_cStat;
@@ -110,7 +115,7 @@ rb_file_path(obj)
return rb_str_new2(fptr->path);
}
-#ifdef NT
+#if defined NT || defined _WIN32_WCE
#include "missing/file.h"
#endif
@@ -440,7 +445,7 @@ static int
group_member(gid)
GETGROUPS_T gid;
{
-#if !defined(NT)
+#if !defined(NT) && !defined(_WIN32_WCE)
if (getgid() == gid)
return Qtrue;
@@ -780,7 +785,7 @@ static VALUE
test_grpowned(obj, fname)
VALUE obj, fname;
{
-#ifndef NT
+#if !defined(NT) && !defined(_WIN32_WCE)
struct stat st;
if (rb_stat(fname, &st) < 0) return Qfalse;
@@ -1115,7 +1120,7 @@ rb_file_chown(obj, owner, group)
rb_secure(2);
GetOpenFile(obj, fptr);
-#if defined(DJGPP) || defined(__CYGWIN32__) || defined(NT) || defined(__EMX__)
+#if defined(DJGPP) || defined(__CYGWIN32__) || defined(NT) || defined(__EMX__) || defined(_WIN32_WCE)
if (!fptr->path) return Qnil;
if (chown(fptr->path, NUM2INT(owner), NUM2INT(group)) == -1)
rb_sys_fail(fptr->path);
@@ -1208,7 +1213,7 @@ rb_file_s_utime(argc, argv)
#else
#ifndef HAVE_UTIME_H
-# ifdef NT
+# if defined NT || defined _WIN32_WCE
# if defined(__BORLANDC__)
# include <utime.h>
# else
@@ -1711,7 +1716,7 @@ rb_file_s_truncate(klass, path, len)
{
int tmpfd;
-# if defined(NT)
+# if defined(NT) || defined(_WIN32_WCE)
if ((tmpfd = open(RSTRING(path)->ptr, O_RDWR)) < 0) {
rb_sys_fail(RSTRING(path)->ptr);
}
@@ -2136,7 +2141,7 @@ static VALUE
rb_stat_grpowned(obj)
VALUE obj;
{
-#ifndef NT
+#if !defined(NT) && !defined(_WIN32_WCE)
if (get_stat(obj)->st_gid == getegid()) return Qtrue;
#endif
return Qfalse;
diff --git a/hash.c b/hash.c
index d759afd296..8a9f8f2fe7 100644
--- a/hash.c
+++ b/hash.c
@@ -942,7 +942,7 @@ rb_hash_update(hash1, hash2)
static int path_tainted = -1;
static char **origenviron;
-#ifdef NT
+#if defined(NT) || defined(_WIN32_WCE)
#define GET_ENVIRON(e) (e = rb_w32_get_environ())
#define FREE_ENVIRON(e) rb_w32_free_environ(e)
static char **my_environ;
diff --git a/io.c b/io.c
index e091e4df4a..5eecc94c34 100644
--- a/io.c
+++ b/io.c
@@ -24,7 +24,7 @@
#include <ctype.h>
#include <errno.h>
-#if defined(MSDOS) || defined(__BOW__) || defined(__CYGWIN__) || defined(NT) || defined(__human68k__) || defined(__EMX__) || defined(__BEOS__)
+#if defined(MSDOS) || defined(__BOW__) || defined(__CYGWIN__) || defined(NT) || defined(__human68k__) || defined(__EMX__) || defined(__BEOS__) || defined(_WIN32_WCE)
# define NO_SAFE_RENAME
#endif
@@ -41,10 +41,10 @@
#endif
#include <sys/types.h>
-#if !defined(DJGPP) && !defined(NT) && !defined(__human68k__)
+#if !defined(DJGPP) && !defined(NT) && !defined(__human68k__) && !defined(_WIN32_WCE)
#include <sys/ioctl.h>
#endif
-#if defined(HAVE_FCNTL_H) || defined(NT)
+#if defined(HAVE_FCNTL_H) || defined(NT) || defined(_WIN32_WCE)
#include <fcntl.h>
#elif defined(HAVE_SYS_FCNTL_H)
#include <sys/fcntl.h>
@@ -1536,7 +1536,7 @@ VALUE
rb_io_binmode(io)
VALUE io;
{
-#if defined(NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__)
+#if defined(NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__) || defined(_WIN32_WCE)
OpenFile *fptr;
GetOpenFile(io, fptr);
@@ -1825,7 +1825,7 @@ rb_file_sysopen(fname, flags, mode)
return rb_file_sysopen_internal(io, fname, flags, mode);
}
-#if defined (NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__VMS)
+#if defined (NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__VMS) || defined(_WIN32_WCE)
static struct pipe_list {
OpenFile *fptr;
struct pipe_list *next;
@@ -1867,7 +1867,7 @@ pipe_del_fptr(fptr)
}
}
-#if defined (NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__VMS)
+#if defined (NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__VMS) || defined(_WIN32_WCE)
static void
pipe_atexit _((void))
{
@@ -1888,7 +1888,7 @@ static void
pipe_finalize(fptr)
OpenFile *fptr;
{
-#if !defined (__CYGWIN__) && !defined(NT)
+#if !defined (__CYGWIN__) && !defined(NT) && !defined(_WIN32_WCE)
extern VALUE rb_last_status;
int status;
if (fptr->f) {
@@ -1951,7 +1951,7 @@ pipe_open(pname, mode)
return (VALUE)port;
}
#else
-#if defined(NT)
+#if defined(NT) || defined(_WIN32_WCE)
int pid;
FILE *fpr, *fpw;
@@ -3469,7 +3469,7 @@ rb_io_s_pipe()
int pipes[2];
VALUE r, w;
-#ifdef NT
+#if defined(NT) || defined(_WIN32_WCE)
if (_pipe(pipes, 1024, O_BINARY) == -1)
#else
if (pipe(pipes) == -1)
diff --git a/main.c b/main.c
index 3c6ccf43a3..7330eb902d 100644
--- a/main.c
+++ b/main.c
@@ -38,7 +38,7 @@ main(argc, argv, envp)
int argc;
char **argv, **envp;
{
-#if defined(NT)
+#if defined(NT) || defined(_WIN32_WCE)
NtInitialize(&argc, &argv);
#endif
#if defined(__MACOS__) && defined(__MWERKS__)
diff --git a/missing.h b/missing.h
index 0649113707..25831c6ab5 100644
--- a/missing.h
+++ b/missing.h
@@ -14,7 +14,7 @@
#if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
-#elif !defined(NT)
+#elif !defined(NT) && !defined(_WIN32_WCE)
# define time_t long
struct timeval {
time_t tv_sec; /* seconds */
diff --git a/process.c b/process.c
index 2a2f9afee2..a0ab34e8dd 100644
--- a/process.c
+++ b/process.c
@@ -42,7 +42,7 @@ struct timeval rb_time_interval _((VALUE));
#include <sys/times.h>
#endif
-#if defined(HAVE_TIMES) || defined(NT)
+#if defined(HAVE_TIMES) || defined(NT) || defined(_WIN32_WCE)
static VALUE S_Tms;
#endif
@@ -74,7 +74,7 @@ get_pid()
static VALUE
get_ppid()
{
-#ifdef NT
+#if defined(NT) || defined(_WIN32_WCE)
return INT2FIX(0);
#else
return INT2FIX(getppid());
@@ -703,7 +703,7 @@ static VALUE
rb_f_fork(obj)
VALUE obj;
{
-#if !defined(__human68k__) && !defined(NT) && !defined(__MACOS__) && !defined(__EMX__) && !defined(__VMS)
+#if !defined(__human68k__) && !defined(NT) && !defined(__MACOS__) && !defined(__EMX__) && !defined(__VMS) && !defined(_WIN32_WCE)
int pid;
rb_secure(2);
@@ -796,7 +796,7 @@ rb_f_system(argc, argv)
int argc;
VALUE *argv;
{
-#if defined(NT) || defined(__EMX__)
+#if defined(NT) || defined(__EMX__) || defined(_WIN32_WCE)
VALUE cmd;
int status;
@@ -1286,7 +1286,7 @@ Init_process()
rb_mProcess = rb_define_module("Process");
-#if !defined(NT) && !defined(DJGPP)
+#if !defined(NT) && !defined(DJGPP) && !defined(_WIN32_WCE)
#ifdef WNOHANG
rb_define_const(rb_mProcess, "WNOHANG", INT2FIX(WNOHANG));
#else
@@ -1358,7 +1358,7 @@ Init_process()
rb_define_module_function(rb_mProcess, "times", rb_proc_times, 0);
-#if defined(HAVE_TIMES) || defined(NT)
+#if defined(HAVE_TIMES) || defined(NT) || defined(_WIN32_WCE)
S_Tms = rb_struct_define("Tms", "utime", "stime", "cutime", "cstime", 0);
#endif
}
diff --git a/rubysig.h b/rubysig.h
index 04c5d5681d..2c1e5f0e0c 100644
--- a/rubysig.h
+++ b/rubysig.h
@@ -13,7 +13,7 @@
#ifndef SIG_H
#define SIG_H
-#ifdef NT
+#if defined(NT) || defined(_WIN32_WCE)
typedef LONG rb_atomic_t;
# define ATOMIC_TEST(var) InterlockedExchange(&(var), 0)
diff --git a/signal.c b/signal.c
index a4331a9f15..d9b5d9b5b4 100644
--- a/signal.c
+++ b/signal.c
@@ -369,7 +369,7 @@ static RETSIGTYPE
sighandler(sig)
int sig;
{
-#ifdef NT
+#if defined(NT) || defined(_WIN32_WCE)
#define IN_MAIN_CONTEXT(f, a) (rb_w32_main_context(a, f) ? (void)0 : f(a))
#else
#define IN_MAIN_CONTEXT(f, a) f(a)
@@ -453,7 +453,7 @@ rb_trap_exec()
}
struct trap_arg {
-#if !defined(NT)
+#if !defined(NT) && !defined(_WIN32_WCE)
# ifdef HAVE_SIGPROCMASK
sigset_t mask;
# else
@@ -594,7 +594,7 @@ trap(arg)
trap_list[sig] = command;
/* enable at least specified signal. */
-#if !defined(NT)
+#if !defined(NT) && !defined(_WIN32_WCE)
#ifdef HAVE_SIGPROCMASK
sigdelset(&arg->mask, sig);
#else
@@ -604,7 +604,7 @@ trap(arg)
return old;
}
-#if !defined(NT)
+#if !defined(NT) && !defined(_WIN32_WCE)
static VALUE
trap_ensure(arg)
struct trap_arg *arg;
@@ -623,7 +623,7 @@ trap_ensure(arg)
void
rb_trap_restore_mask()
{
-#if !defined(NT)
+#if !defined(NT) && !defined(_WIN32_WCE)
# ifdef HAVE_SIGPROCMASK
sigprocmask(SIG_SETMASK, &trap_last_mask, NULL);
# else
@@ -655,7 +655,7 @@ sig_trap(argc, argv)
if (OBJ_TAINTED(arg.cmd)) {
rb_raise(rb_eSecurityError, "Insecure: tainted signal trap");
}
-#if !defined(NT)
+#if !defined(NT) && !defined(_WIN32_WCE)
/* disable interrupt */
# ifdef HAVE_SIGPROCMASK
sigfillset(&arg.mask);
diff --git a/st.c b/st.c
index 5ef0b7c2bb..3d97eebd3b 100644
--- a/st.c
+++ b/st.c
@@ -7,7 +7,7 @@
#include <stdlib.h>
#include "st.h"
-#ifdef NT
+#if defined(NT) || defined(_WIN32_WCE)
#include <malloc.h>
#endif
diff --git a/util.c b/util.c
index 450b865496..14e3c42622 100644
--- a/util.c
+++ b/util.c
@@ -16,7 +16,7 @@
#include <stdio.h>
#include <errno.h>
-#ifdef NT
+#if defined(NT) || defined(_WIN32_WCE)
#include "missing/file.h"
#endif
@@ -75,11 +75,11 @@ scan_hex(start, len, retlen)
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
#endif
-#ifdef NT
+#if defined(NT) || defined(_WIN32_WCE)
#include "missing/file.h"
#endif
-#if defined(MSDOS) || defined(__CYGWIN32__) || defined(NT)
+#if defined(MSDOS) || defined(__CYGWIN32__) || defined(NT) || defined(_WIN32_WCE)
/*
* Copyright (c) 1993, Intergraph Corporation
*
@@ -173,7 +173,7 @@ ruby_add_suffix(str, suffix)
rb_fatal("Cannot do inplace edit on long filename (%ld characters)",
RSTRING(str)->len);
-#if defined(DJGPP) || defined(__CYGWIN32__) || defined(NT)
+#if defined(DJGPP) || defined(__CYGWIN32__) || defined(NT) || defined(_WIN32_WCE)
/* Style 0 */
slen = RSTRING(str)->len;
rb_str_cat(str, suffix, extlen);
@@ -229,7 +229,7 @@ fallback:
memcpy(RSTRING(str)->ptr, buf, RSTRING(str)->len);
}
-#if defined(__CYGWIN32__) || defined(NT)
+#if defined(__CYGWIN32__) || defined(NT) || defined(_WIN32_WCE)
static int
valid_filename(char *s)
{
diff --git a/util.h b/util.h
index 33889b2c32..2fa098a594 100644
--- a/util.h
+++ b/util.h
@@ -39,7 +39,7 @@ unsigned long scan_oct _((const char*, int, int*));
#define scan_hex ruby_scan_hex
unsigned long scan_hex _((const char*, int, int*));
-#if defined(MSDOS) || defined(__CYGWIN32__) || defined(NT)
+#if defined(MSDOS) || defined(__CYGWIN32__) || defined(NT) || defined(_WIN32_WCE)
void ruby_add_suffix();
#define add_suffix ruby_add_suffix
#endif
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();
diff --git a/wince/README.wince b/wince/README.wince
new file mode 100644
index 0000000000..c4c67df378
--- /dev/null
+++ b/wince/README.wince
@@ -0,0 +1,62 @@
+=begin
+
+= How to build ruby using eMbedded Visual C++
+
+== Requirement
+
+(1) eMbedded Visual C++ 3.0 or later.
+
+== How to compile and install
+
+(1) Move to ruby\wince directory.
+
+(2) if you changed install directories of eMVC and SDK from default
+ settings, please modify .\configure.bat in order to set
+ environment valuables such as "PATH", "INCLUDE", and "LIB".
+
+(2) Execute .\configure.bat on "ruby\wince" directory.
+ You can specify the target platform as an argument.
+ For example, run:
+ [CPU] [OS ver.]
+ StrongARM HPC2000 : `configure ARM HPC2K'
+ MIPS PocketPC : `configure MIPS PPC'
+ SH3 PocketPC : `configure SH3 PPC'
+ SH4 HPCPro : `configure SH4 HPCPRO'
+ (caution: "HPCPro" is not supported yet.)
+
+(3) Execute `.\make.bat'.
+
+(4) Copy mswince-ruby17.dll, ruby.exe, and irb.exe to your WinCE machine.
+
+== Icons
+
+Any icon files(*.ico) in the build directory, directories specified with
+((|icondirs|)) make variable and (({win32})) directory under the ruby
+source directory will be included in DLL or executable files, according
+to their base names.
+ $(RUBY_INSTALL_NAME).ico or ruby.ico --> $(RUBY_INSTALL_NAME).exe
+ $(RUBYW_INSTALL_NAME).ico or rubyw.ico --> $(RUBYW_INSTALL_NAME).exe
+ the others --> $(RUBY_SO_NAME).dll
+
+Although no icons are distributed with the ruby source or in the official
+site, you can use anything you like. For example, followings are written
+in Japanese, but you can download at least.
+
+* ((<URL:http://member.nifty.ne.jp/ueivu/rubyico.html>)) or
+ ((<zipped icons|URL:http://member.nifty.ne.jp/ueivu/Ruby_ico.zip>))
+* ((<URL:http://homepage1.nifty.com/a_nakata/ruby/>)) or
+ ((<icon itself|URL:http://homepage1.nifty.com/a_nakata/ruby/RubyIcon.ico>))
+
+== Build examples
+
+ ex.)
+ current directory: C:\
+ ruby source directory: C:\ruby
+ target CPU: StrongARM
+ target OS version: PocketPC
+
+ cd \ruby\wince
+ .\configure ARM PPC
+ .\make.bat
+
+=end
diff --git a/wince/assert.h b/wince/assert.h
new file mode 100644
index 0000000000..04831e48f1
--- /dev/null
+++ b/wince/assert.h
@@ -0,0 +1,4 @@
+#ifndef _ASSERT_H_
+#define _ASSERT_H_
+
+#endif
diff --git a/wince/config b/wince/config
new file mode 100644
index 0000000000..a3982c8ee8
--- /dev/null
+++ b/wince/config
@@ -0,0 +1,141 @@
+/* config.h */
+/* based on mswin32's. */
+#define STDC_HEADERS 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRING_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_OFF_T 1
+#define SIZEOF_INT 4
+#define SIZEOF_SHORT 2
+#define SIZEOF_LONG 4
+#define SIZEOF_LONG_LONG 0
+#define SIZEOF___INT64 8
+#define SIZEOF_OFF_T 4
+#define SIZEOF_VOIDP 4
+#define SIZEOF_FLOAT 4
+#define SIZEOF_DOUBLE 8
+#define HAVE_PROTOTYPES 1
+#define TOKEN_PASTE(x,y) x##y
+#define HAVE_STDARG_PROTOTYPES 1
+#if _MSC_VER > 1100 && !defined NORETURN
+#define NORETURN(x) __declspec(noreturn) x
+#else
+#define NORETURN(x) x
+#endif
+#define HAVE_DECL_SYS_NERR 1
+#define STDC_HEADERS 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRING_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_FCNTL_H 1
+#define HAVE_SYS_UTIME_H 1
+#define HAVE_MEMORY_H 1
+#define uid_t int
+#define gid_t int
+#define HAVE_STRUCT_STAT_ST_RDEV 1
+#define HAVE_ST_RDEV 1
+#define GETGROUPS_T int
+#define RETSIGTYPE void
+#define HAVE_ALLOCA 1
+#define HAVE_DUP2 1
+#define HAVE_MEMCMP 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MKDIR 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_STRERROR 1
+#define HAVE_STRFTIME 1
+#define HAVE_STRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOD 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_FLOCK 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_FINITE 1
+#define HAVE_FMOD 1
+#define HAVE_FREXP 1
+#define HAVE_HYPOT 1
+#define HAVE_MODF 1
+#define HAVE_WAITPID 1
+#define HAVE_CHSIZE 1
+#define HAVE_TIMES 1
+#define HAVE__SETJMP 1
+#define HAVE_TELLDIR 1
+#define HAVE_SEEKDIR 1
+#define HAVE_MKTIME 1
+#define HAVE_COSH 1
+#define HAVE_SINH 1
+#define HAVE_TANH 1
+#define HAVE_EXECVE 1
+#define HAVE_TZNAME 1
+#define HAVE_DAYLIGHT 1
+#define SETPGRP_VOID 1
+#define inline __inline
+#define RSHIFT(x,y) ((x)>>(int)y)
+/*#define FILE_COUNT _cnt*/
+/*#define FILE_READPTR _ptr*/
+#define DEFAULT_KCODE KCODE_NONE
+#define DLEXT ".so"
+#define DLEXT2 ".dll"
+/*#define NT 1*/
+#define RUBY_LIB "/lib/ruby/1.7"
+#define RUBY_SITE_LIB "/lib/ruby/site_ruby"
+#define RUBY_SITE_LIB2 "/lib/ruby/site_ruby/1.7"
+/*#define RUBY_PLATFORM "mips-mswince"*/
+/*#define RUBY_ARCHLIB "/lib/ruby/1.7/mips-mswince"*/
+/*#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/1.7/mips-mswince"*/
+
+
+/* below wince's original definition. */
+#define fdopen _fdopen
+#define dup _dup
+#define _dup2 dup2
+
+#ifdef FormatMessage
+#undef FormatMessage
+#define FormatMessage FormatMessageA
+#endif
+
+#ifdef GetModuleFileName
+#undef GetModuleFileName
+#define GetModuleFileName GetModuleFileNameA
+#endif
+
+#ifdef CharNext
+#undef CharNext
+#define CharNext CharNextA
+#endif
+
+#ifdef CharPrev
+#undef CharPrev
+#define CharPrev CharPrevA
+#endif
+
+#ifdef LoadLibrary
+#undef LoadLibrary
+#define LoadLibrary LoadLibraryA
+#endif
+
+#ifdef GetProcAddress
+#undef GetProcAddress
+#define GetProcAddress GetProcAddressA
+#endif
+
+#if _WIN32_WCE < 300
+ /* for Handheld PC Pro. */
+ #define isascii(c) ( (c>=0x00&&c<=0x7f)?1:0 )
+ #define isspace(c) ( ((c>=0x09&&c<=0x0d)||c==0x20)?1:0 )
+ #define isdigit(c) ( (c>=0x00&&c<=0x09)?1:0 )
+ #define isupper(c) ( (c>='A'&&c<='Z')?1:0 )
+ #define isalpha(c) ( ((c>='A'&&c<='Z')||(c>='a'&&c<='z'))?1:0 )
+ #define isprint(c) ( (c>=0x20&&c<=0x7e)?1:0 )
+ #define isalnum(c) ( (isalpha(c)||isdigit(c))?1:0 )
+ #define iscntrl(c) ( ((c>=0x00&&c<=0x1f)||c==0x7f)?1:0 )
+ #define islower(c) ( (c>='a'&&c<='z')?1:0 )
+ #define ispunct(c) ( !(isalnum(c)||isspace(c))?1:0 )
+ #define isxdigit(c) ( ((c>=0&&c<=9)||(c>='A'&&c<='F')||(c>='a'&&c<='f'))?1:0 )
+#endif
+
diff --git a/wince/configure.bat b/wince/configure.bat
new file mode 100644
index 0000000000..6f79e69e51
--- /dev/null
+++ b/wince/configure.bat
@@ -0,0 +1,133 @@
+@echo off
+
+if "%1"=="" goto error
+if "%2"=="" goto error
+
+if exist make.bat @del make.bat
+
+if "%1"=="MIPS" goto mips
+if "%1"=="ARM" goto arm
+if "%1"=="SH3" goto sh3
+if "%1"=="SH4" goto sh4
+
+:mips
+
+copy config config.h
+echo #define RUBY_PLATFORM "mips-mswince" >> config.h
+echo #define RUBY_ARCHLIB "/lib/ruby/1.7/mips-mswince" >> config.h
+echo #define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/1.7/mips-mswince" >> config.h
+
+if "%2"=="HPC2K" goto mipshpc2k
+if "%2"=="PPC" goto mipsppc
+if "%2"=="HPCPRO" goto mipshpcpro
+
+:mipshpc2k
+ echo nmake /f "dll.mak" CFG=MIPS >> make.bat
+ echo nmake /f "exe.mak" CFG=MIPS >> make.bat
+ set path=c:\program files\microsoft embedded tools\common\evc\bin;C:\Program Files\Microsoft eMbedded Tools\EVC\WCE300\BIN
+ set include=c:\windows ce tools\wce300\hpc2000\include
+ set lib=C:\Windows CE Tools\wce300\hpc2000\lib\mips
+ goto normalend
+:mipsppc
+ echo nmake /f "dll.mak" CFG=MIPS >> make.bat
+ echo nmake /f "exe.mak" CFG=MIPS >> make.bat
+ set path=c:\program files\microsoft embedded tools\common\evc\bin;C:\Program Files\Microsoft eMbedded Tools\EVC\WCE300\BIN
+ set include=c:\windows ce tools\wce300\MS Pocket PC\include
+ set lib=c:\windows ce tools\wce300\MS Pocket PC\lib\mips
+ goto normalend
+:mipshpcpro
+ echo nmake /f "dll.mak" CFG=MIPS CESubsystem=windowsce,2.11 CEVersion=211 >> make.bat
+ echo nmake /f "exe.mak" CFG=MIPS CESubsystem=windowsce,2.11 CEVersion=211 >> make.bat
+ set path=c:\program files\microsoft embedded tools\common\evc\bin;C:\Program Files\Microsoft eMbedded Tools\EVC\WCE211\BIN
+ set include=C:\Windows CE Tools\wce211\MS HPC Pro\include
+ set lib=C:\Windows CE Tools\wce211\MS HPC Pro\lib\mips
+ goto normalend
+
+:arm
+
+copy config config.h
+echo #define RUBY_PLATFORM "arm-mswince" >> config.h
+echo #define RUBY_ARCHLIB "/lib/ruby/1.7/arm-mswince" >> config.h
+echo #define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/1.7/arm-mswince" >> config.h
+
+if "%2"=="HPC2K" goto armhpc2k
+if "%2"=="PPC" goto armppc
+if "%2"=="HPCPRO" goto armhpcpro
+
+:armhpc2k
+ echo nmake /f "dll.mak" CFG=ARM >> make.bat
+ echo nmake /f "exe.mak" CFG=ARM >> make.bat
+ set path=c:\program files\microsoft embedded tools\common\evc\bin;C:\Program Files\Microsoft eMbedded Tools\EVC\WCE300\BIN
+ set include=c:\windows ce tools\wce300\hpc2000\include
+ set lib=C:\Windows CE Tools\wce300\hpc2000\lib\arm
+ goto normalend
+:armppc
+ echo nmake /f "dll.mak" CFG=ARM >> make.bat
+ echo nmake /f "exe.mak" CFG=ARM >> make.bat
+ set path=c:\program files\microsoft embedded tools\common\evc\bin;C:\Program Files\Microsoft eMbedded Tools\EVC\WCE300\BIN
+ set include=c:\windows ce tools\wce300\MS Pocket PC\include
+ set lib=c:\windows ce tools\wce300\MS Pocket PC\lib\arm
+ goto normalend
+:armhpcpro
+ echo nmake /f "dll.mak" CFG=ARM CESubsystem=windowsce,2.11 CEVersion=211 >> make.bat
+ echo nmake /f "exe.mak" CFG=ARM CESubsystem=windowsce,2.11 CEVersion=211 >> make.bat
+ set path=c:\program files\microsoft embedded tools\common\evc\bin;C:\Program Files\Microsoft eMbedded Tools\EVC\WCE211\BIN
+ set include=C:\Windows CE Tools\wce211\MS HPC Pro\include
+ set lib=C:\Windows CE Tools\wce211\MS HPC Pro\lib\arm
+ goto normalend
+
+:sh3
+
+copy config config.h
+echo #define RUBY_PLATFORM "sh3-mswince" >> config.h
+echo #define RUBY_ARCHLIB "/lib/ruby/1.7/sh3-mswince" >> config.h
+echo #define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/1.7/sh3-mswince" >> config.h
+
+if "%2"=="HPC2K" goto error
+if "%2"=="PPC" goto sh3ppc
+if "%2"=="HPCPRO" goto sh3hpcpro
+
+:sh3ppc
+ echo nmake /f "dll.mak" CFG=SH3 >> make.bat
+ echo nmake /f "exe.mak" CFG=SH3 >> make.bat
+ set path=c:\program files\microsoft embedded tools\common\evc\bin;C:\Program Files\Microsoft eMbedded Tools\EVC\WCE300\BIN
+ set include=c:\windows ce tools\wce300\MS Pocket PC\include
+ set lib=c:\windows ce tools\wce300\MS Pocket PC\lib\sh3
+ goto normalend
+:sh3hpcpro
+ echo nmake /f "dll.mak" CFG=SH3 CESubsystem=windowsce,2.11 CEVersion=211 >> make.bat
+ echo nmake /f "exe.mak" CFG=SH3 CESubsystem=windowsce,2.11 CEVersion=211 >> make.bat
+ set path=c:\program files\microsoft embedded tools\common\evc\bin;C:\Program Files\Microsoft eMbedded Tools\EVC\WCE211\BIN
+ set include=C:\Windows CE Tools\wce211\MS HPC Pro\include
+ set lib=C:\Windows CE Tools\wce211\MS HPC Pro\lib\sh3
+ goto normalend
+
+:sh4
+
+copy config config.h
+echo #define RUBY_PLATFORM "sh4-mswince" >> config.h
+echo #define RUBY_ARCHLIB "/lib/ruby/1.7/sh4-mswince" >> config.h
+echo #define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/1.7/sh4-mswince" >> config.h
+
+if "%2"=="HPC2K" goto error
+if "%2"=="PPC" goto error
+if "%2"=="HPCPRO" goto sh4hpcpro
+
+:sh4hpcpro
+ echo nmake /f "dll.mak" CFG=SH4 CESubsystem=windowsce,2.11 CEVersion=211 >> make.bat
+ echo nmake /f "exe.mak" CFG=SH4 CESubsystem=windowsce,2.11 CEVersion=211 >> make.bat
+ set path=c:\program files\microsoft embedded tools\common\evc\bin;C:\Program Files\Microsoft eMbedded Tools\EVC\WCE211\BIN
+ set include=C:\Windows CE Tools\wce211\MS HPC Pro\include
+ set lib=C:\Windows CE Tools\wce211\MS HPC Pro\lib\sh4
+ goto normalend
+
+
+:error
+echo ERROR. Please check arguments.
+goto end
+
+:normalend
+echo configure OK. Please type ".\make.bat".
+goto end
+
+:end
diff --git a/wince/direct.c b/wince/direct.c
new file mode 100644
index 0000000000..6cffc40e3e
--- /dev/null
+++ b/wince/direct.c
@@ -0,0 +1,54 @@
+/***************************************************************
+ direct.c
+***************************************************************/
+
+#include <windows.h>
+#include <tchar.h>
+#include <direct.h>
+#include "wince.h" /* for wce_mbtowc */
+
+/* global for chdir, getcwd */
+static char _currentdir[MAX_PATH+1];
+
+
+char *_getcwd(char* buffer, int maxlen)
+{
+ strcpy( buffer, _currentdir );
+ return buffer;
+}
+
+int _chdir(const char * dirname)
+{
+ if( MAX_PATH < strlen(dirname) )
+ return -1;
+
+ strcpy( _currentdir, dirname );
+ return 0;
+}
+
+int _rmdir(const char * dir)
+{
+ wchar_t *wdir;
+ BOOL rc;
+
+ /* replace with RemoveDirectory. */
+ wdir = wce_mbtowc(dir);
+ rc = RemoveDirectoryW(wdir);
+ free(wdir);
+
+ return rc==TRUE ? 0 : -1;
+}
+
+int _mkdir(const char * dir)
+{
+ wchar_t* wdir;
+ BOOL rc;
+
+ /* replace with CreateDirectory. */
+ wdir = wce_mbtowc(dir);
+ rc = CreateDirectoryW(wdir, NULL);
+ free(wdir);
+
+ return rc==TRUE ? 0 : -1;
+}
+
diff --git a/wince/direct.h b/wince/direct.h
new file mode 100644
index 0000000000..6122a4483a
--- /dev/null
+++ b/wince/direct.h
@@ -0,0 +1,23 @@
+#ifndef DIRECT_H
+#define DIRECT_H 1
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *_getcwd(char* buffer, int maxlen);
+int _chdir(const char * dirname);
+int _rmdir(const char * dir);
+int _mkdir(const char * dir);
+
+#ifdef __cplusplus
+};
+#endif
+
+#define getcwd _getcwd
+#define chdir _chdir
+#define rmdir _rmdir
+#define mkdir _mkdir
+
+#endif
diff --git a/wince/dll.mak b/wince/dll.mak
new file mode 100644
index 0000000000..cc987d1cdb
--- /dev/null
+++ b/wince/dll.mak
@@ -0,0 +1,1547 @@
+
+!IF "$(CFG)" == ""
+CFG=MIPS
+!MESSAGE CFG not specified. Use MIPS.
+!ENDIF
+
+!IF "$(CESubsystem)" == ""
+#CESubsystem=windowsce,2.0
+CESubsystem=windowsce,3.0
+#!MESSAGE CESubsystem not specified. Use windowsce,2.11.
+!MESSAGE CESubsystem not specified. Use windowsce,3.0.
+!ENDIF
+
+!IF "$(CEVersion)" == ""
+#CEVersion=200
+CEVersion=300
+#!MESSAGE CEVersion not specified. Use 211.
+!MESSAGE CEVersion not specified. Use 300.
+!ENDIF
+
+!IF $(CEVersion) < 201
+CECrt=L
+CECrtDebug=Ld
+CECrtMT=T
+CECrtMTDebug=Td
+CENoDefaultLib=corelibc.lib
+CEx86Corelibc=
+!ELSE
+CECrt=C
+CECrtDebug=C
+CECrtMT=C
+CECrtMTDebug=C
+CENoDefaultLib=libc.lib /nodefaultlib:libcd.lib /nodefaultlib:libcmt.lib /nodefaultlib:libcmtd.lib /nodefaultlib:msvcrt.lib /nodefaultlib:msvcrtd.lib
+CEx86Corelibc=corelibc.lib
+!ENDIF
+
+!IF "$(CE_PLATFORM)"==""
+CePlatform=WIN32_PLATFORM_UNKNOWN
+!ELSE
+CePlatform=$(CE_PLATFORM)
+!ENDIF
+
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+!IF "$(CFG)" == "MIPS"
+
+OUTDIR=.\MIPSRel
+INTDIR=.\MIPSRel
+# Begin Custom Macros
+OutDir=.\MIPSRel
+# End Custom Macros
+
+ALL : "$(OUTDIR)\mswince_ruby17.dll"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\acosh.obj"
+ -@erase "$(INTDIR)\array.obj"
+ -@erase "$(INTDIR)\bignum.obj"
+ -@erase "$(INTDIR)\class.obj"
+ -@erase "$(INTDIR)\compar.obj"
+ -@erase "$(INTDIR)\crypt.obj"
+ -@erase "$(INTDIR)\dir.obj"
+ -@erase "$(INTDIR)\dln.obj"
+ -@erase "$(INTDIR)\dmyext.obj"
+ -@erase "$(INTDIR)\dup2.obj"
+ -@erase "$(INTDIR)\enum.obj"
+ -@erase "$(INTDIR)\error.obj"
+ -@erase "$(INTDIR)\eval.obj"
+ -@erase "$(INTDIR)\file.obj"
+ -@erase "$(INTDIR)\gc.obj"
+ -@erase "$(INTDIR)\hash.obj"
+ -@erase "$(INTDIR)\hypot.obj"
+ -@erase "$(INTDIR)\inits.obj"
+ -@erase "$(INTDIR)\io.obj"
+ -@erase "$(INTDIR)\isinf.obj"
+ -@erase "$(INTDIR)\isnan.obj"
+ -@erase "$(INTDIR)\marshal.obj"
+ -@erase "$(INTDIR)\math.obj"
+ -@erase "$(INTDIR)\numeric.obj"
+ -@erase "$(INTDIR)\object.obj"
+ -@erase "$(INTDIR)\pack.obj"
+ -@erase "$(INTDIR)\prec.obj"
+ -@erase "$(INTDIR)\process.obj"
+ -@erase "$(INTDIR)\random.obj"
+ -@erase "$(INTDIR)\range.obj"
+ -@erase "$(INTDIR)\re.obj"
+ -@erase "$(INTDIR)\regex.obj"
+ -@erase "$(INTDIR)\ruby.obj"
+ -@erase "$(INTDIR)\signal.obj"
+ -@erase "$(INTDIR)\sprintf.obj"
+ -@erase "$(INTDIR)\st.obj"
+ -@erase "$(INTDIR)\strftime.obj"
+ -@erase "$(INTDIR)\string.obj"
+ -@erase "$(INTDIR)\struct.obj"
+ -@erase "$(INTDIR)\time.obj"
+ -@erase "$(INTDIR)\util.obj"
+ -@erase "$(INTDIR)\variable.obj"
+ -@erase "$(INTDIR)\version.obj"
+ -@erase "$(INTDIR)\win32.obj"
+ -@erase "$(OUTDIR)\mswince_ruby17.dll"
+ -@erase "$(OUTDIR)\mswince_ruby17.exp"
+ -@erase "$(OUTDIR)\mswince_ruby17.lib"
+ -@erase "$(OUTDIR)\wce\direct.obj"
+ -@erase "$(OUTDIR)\wce\errno.obj"
+ -@erase "$(OUTDIR)\wce\ceio.obj"
+ -@erase "$(OUTDIR)\wce\parse.obj"
+ -@erase "$(OUTDIR)\wce\process.obj"
+ -@erase "$(OUTDIR)\wce\signal.obj"
+ -@erase "$(OUTDIR)\wce\stat.obj"
+ -@erase "$(OUTDIR)\wce\stdio.obj"
+ -@erase "$(OUTDIR)\wce\stdlib.obj"
+ -@erase "$(OUTDIR)\wce\string.obj"
+ -@erase "$(OUTDIR)\wce\cetime.obj"
+ -@erase "$(OUTDIR)\wce\timeb.obj"
+ -@erase "$(OUTDIR)\wce\utime.obj"
+ -@erase "$(OUTDIR)\wce\wince.obj"
+ -@erase "$(OUTDIR)\wce\winsock2.obj"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+ if not exist "$(OUTDIR)/wce" mkdir "$(OUTDIR)/wce"
+ if not exist ".\parse.c" byacc ../parse.y
+ if not exist ".\parse.c" sed -e "s!^extern char \*getenv();!/* & */!;s/^\(#.*\)y\.tab/\1parse/" y.tab.c > ".\parse.c"
+ if exist "y.tab.c" @del y.tab.c
+
+RSC=rc.exe
+CPP=clmips.exe
+CPP_PROJ=/nologo /W1 /I ".." /I "..\missing" /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_USRDLL" /D "MSWINCE_RUBY17_EXPORTS" /D BUFSIZ=512 /D FILENAME_MAX=260 /D TLS_OUT_OF_INDEXES=0xFFFFFFFF /Fp"$(INTDIR)\mswince_ruby17.pch" /YX /Fo"$(INTDIR)\\" /Oxs /M$(CECrtMT) /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\mswince_ruby17.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=commctrl.lib coredll.lib winsock.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /incremental:no /pdb:"$(OUTDIR)\mswince_ruby17.pdb" /nodefaultlib:"$(CENoDefaultLib)" /def:".\mswince-ruby17.def" /out:"$(OUTDIR)\mswince_ruby17.dll" /implib:"$(OUTDIR)\mswince_ruby17.lib" /subsystem:$(CESubsystem) /MACHINE:MIPS
+DEF_FILE= \
+ ".\mswince-ruby17.def"
+LINK32_OBJS= \
+ "$(INTDIR)\array.obj" \
+ "$(INTDIR)\bignum.obj" \
+ "$(INTDIR)\class.obj" \
+ "$(INTDIR)\compar.obj" \
+ "$(INTDIR)\dir.obj" \
+ "$(INTDIR)\dln.obj" \
+ "$(INTDIR)\dmyext.obj" \
+ "$(INTDIR)\enum.obj" \
+ "$(INTDIR)\error.obj" \
+ "$(INTDIR)\eval.obj" \
+ "$(INTDIR)\file.obj" \
+ "$(INTDIR)\gc.obj" \
+ "$(INTDIR)\hash.obj" \
+ "$(INTDIR)\inits.obj" \
+ "$(INTDIR)\io.obj" \
+ "$(INTDIR)\marshal.obj" \
+ "$(INTDIR)\math.obj" \
+ "$(INTDIR)\numeric.obj" \
+ "$(INTDIR)\object.obj" \
+ "$(INTDIR)\pack.obj" \
+ "$(INTDIR)\prec.obj" \
+ "$(INTDIR)\process.obj" \
+ "$(INTDIR)\random.obj" \
+ "$(INTDIR)\range.obj" \
+ "$(INTDIR)\re.obj" \
+ "$(INTDIR)\regex.obj" \
+ "$(INTDIR)\ruby.obj" \
+ "$(INTDIR)\signal.obj" \
+ "$(INTDIR)\sprintf.obj" \
+ "$(INTDIR)\st.obj" \
+ "$(INTDIR)\string.obj" \
+ "$(INTDIR)\struct.obj" \
+ "$(INTDIR)\time.obj" \
+ "$(INTDIR)\util.obj" \
+ "$(INTDIR)\variable.obj" \
+ "$(INTDIR)\version.obj" \
+ "$(INTDIR)\win32.obj" \
+ "$(INTDIR)\acosh.obj" \
+ "$(INTDIR)\crypt.obj" \
+ "$(INTDIR)\dup2.obj" \
+ "$(INTDIR)\hypot.obj" \
+ "$(INTDIR)\isinf.obj" \
+ "$(INTDIR)\isnan.obj" \
+ "$(INTDIR)\strftime.obj" \
+ "$(INTDIR)\wce\direct.obj" \
+ "$(INTDIR)\wce\errno.obj" \
+ "$(INTDIR)\wce\io.obj" \
+ "$(INTDIR)\wce\process.obj" \
+ "$(INTDIR)\wce\signal.obj" \
+ "$(INTDIR)\wce\stat.obj" \
+ "$(INTDIR)\wce\stdio.obj" \
+ "$(INTDIR)\wce\stdlib.obj" \
+ "$(INTDIR)\wce\string.obj" \
+ "$(INTDIR)\wce\time.obj" \
+ "$(INTDIR)\wce\timeb.obj" \
+ "$(INTDIR)\wce\utime.obj" \
+ "$(INTDIR)\wce\wince.obj" \
+ "$(INTDIR)\wce\winsock2.obj" \
+ "$(INTDIR)\wce\parse.obj"
+
+"$(OUTDIR)\mswince_ruby17.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "SH4"
+
+OUTDIR=.\SH4Rel
+INTDIR=.\SH4Rel
+# Begin Custom Macros
+OutDir=.\SH4Rel
+# End Custom Macros
+
+ALL : "$(OUTDIR)\mswince_ruby17.dll"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\acosh.obj"
+ -@erase "$(INTDIR)\array.obj"
+ -@erase "$(INTDIR)\bignum.obj"
+ -@erase "$(INTDIR)\class.obj"
+ -@erase "$(INTDIR)\compar.obj"
+ -@erase "$(INTDIR)\crypt.obj"
+ -@erase "$(INTDIR)\dir.obj"
+ -@erase "$(INTDIR)\dln.obj"
+ -@erase "$(INTDIR)\dmyext.obj"
+ -@erase "$(INTDIR)\dup2.obj"
+ -@erase "$(INTDIR)\enum.obj"
+ -@erase "$(INTDIR)\error.obj"
+ -@erase "$(INTDIR)\eval.obj"
+ -@erase "$(INTDIR)\file.obj"
+ -@erase "$(INTDIR)\gc.obj"
+ -@erase "$(INTDIR)\hash.obj"
+ -@erase "$(INTDIR)\hypot.obj"
+ -@erase "$(INTDIR)\inits.obj"
+ -@erase "$(INTDIR)\io.obj"
+ -@erase "$(INTDIR)\isinf.obj"
+ -@erase "$(INTDIR)\isnan.obj"
+ -@erase "$(INTDIR)\marshal.obj"
+ -@erase "$(INTDIR)\math.obj"
+ -@erase "$(INTDIR)\numeric.obj"
+ -@erase "$(INTDIR)\object.obj"
+ -@erase "$(INTDIR)\pack.obj"
+ -@erase "$(INTDIR)\prec.obj"
+ -@erase "$(INTDIR)\process.obj"
+ -@erase "$(INTDIR)\random.obj"
+ -@erase "$(INTDIR)\range.obj"
+ -@erase "$(INTDIR)\re.obj"
+ -@erase "$(INTDIR)\regex.obj"
+ -@erase "$(INTDIR)\ruby.obj"
+ -@erase "$(INTDIR)\signal.obj"
+ -@erase "$(INTDIR)\sprintf.obj"
+ -@erase "$(INTDIR)\st.obj"
+ -@erase "$(INTDIR)\strftime.obj"
+ -@erase "$(INTDIR)\string.obj"
+ -@erase "$(INTDIR)\struct.obj"
+ -@erase "$(INTDIR)\time.obj"
+ -@erase "$(INTDIR)\util.obj"
+ -@erase "$(INTDIR)\variable.obj"
+ -@erase "$(INTDIR)\version.obj"
+ -@erase "$(INTDIR)\win32.obj"
+ -@erase "$(OUTDIR)\mswince_ruby17.dll"
+ -@erase "$(OUTDIR)\mswince_ruby17.exp"
+ -@erase "$(OUTDIR)\mswince_ruby17.lib"
+ -@erase "$(INTDIR)\wce\direct.obj"
+ -@erase "$(INTDIR)\wce\errno.obj"
+ -@erase "$(INTDIR)\wce\io.obj"
+ -@erase "$(INTDIR)\wce\parse.obj"
+ -@erase "$(INTDIR)\wce\process.obj"
+ -@erase "$(INTDIR)\wce\signal.obj"
+ -@erase "$(INTDIR)\wce\stat.obj"
+ -@erase "$(INTDIR)\wce\stdio.obj"
+ -@erase "$(INTDIR)\wce\stdlib.obj"
+ -@erase "$(INTDIR)\wce\string.obj"
+ -@erase "$(INTDIR)\wce\time.obj"
+ -@erase "$(INTDIR)\wce\timeb.obj"
+ -@erase "$(INTDIR)\wce\utime.obj"
+ -@erase "$(INTDIR)\wce\wince.obj"
+ -@erase "$(INTDIR)\wce\winsock2.obj"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+ if not exist "$(OUTDIR)/wce" mkdir "$(OUTDIR)/wce"
+ if not exist ".\parse.c" byacc ../parse.y
+ if not exist ".\parse.c" sed -e "s!^extern char \*getenv();!/* & */!;s/^\(#.*\)y\.tab/\1parse/" y.tab.c > ".\parse.c"
+ if exist "y.tab.c" @del y.tab.c
+
+RSC=rc.exe
+CPP=shcl.exe
+CPP_PROJ=/nologo /W1 /I ".." /I "..\missing" /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_USRDLL" /D "MSWINCE_RUBY17_EXPORTS" /D BUFSIZ=512 /D FILENAME_MAX=260 /D TLS_OUT_OF_INDEXES=0xFFFFFFFF /Fp"$(INTDIR)\mswince_ruby17.pch" /YX /Fo"$(INTDIR)\\" /Qsh4 /Oxs /M$(CECrtMT) /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\mswince_ruby17.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=commctrl.lib coredll.lib winsock.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /incremental:no /pdb:"$(OUTDIR)\mswince_ruby17.pdb" /nodefaultlib:"$(CENoDefaultLib)" /def:".\mswince-ruby17.def" /out:"$(OUTDIR)\mswince_ruby17.dll" /implib:"$(OUTDIR)\mswince_ruby17.lib" /subsystem:$(CESubsystem) /MACHINE:SH4
+DEF_FILE= \
+ ".\mswince-ruby17.def"
+LINK32_OBJS= \
+ "$(INTDIR)\array.obj" \
+ "$(INTDIR)\bignum.obj" \
+ "$(INTDIR)\class.obj" \
+ "$(INTDIR)\compar.obj" \
+ "$(INTDIR)\dir.obj" \
+ "$(INTDIR)\dln.obj" \
+ "$(INTDIR)\dmyext.obj" \
+ "$(INTDIR)\enum.obj" \
+ "$(INTDIR)\error.obj" \
+ "$(INTDIR)\eval.obj" \
+ "$(INTDIR)\file.obj" \
+ "$(INTDIR)\gc.obj" \
+ "$(INTDIR)\hash.obj" \
+ "$(INTDIR)\inits.obj" \
+ "$(INTDIR)\io.obj" \
+ "$(INTDIR)\marshal.obj" \
+ "$(INTDIR)\math.obj" \
+ "$(INTDIR)\numeric.obj" \
+ "$(INTDIR)\object.obj" \
+ "$(INTDIR)\pack.obj" \
+ "$(INTDIR)\prec.obj" \
+ "$(INTDIR)\process.obj" \
+ "$(INTDIR)\random.obj" \
+ "$(INTDIR)\range.obj" \
+ "$(INTDIR)\re.obj" \
+ "$(INTDIR)\regex.obj" \
+ "$(INTDIR)\ruby.obj" \
+ "$(INTDIR)\signal.obj" \
+ "$(INTDIR)\sprintf.obj" \
+ "$(INTDIR)\st.obj" \
+ "$(INTDIR)\string.obj" \
+ "$(INTDIR)\struct.obj" \
+ "$(INTDIR)\time.obj" \
+ "$(INTDIR)\util.obj" \
+ "$(INTDIR)\variable.obj" \
+ "$(INTDIR)\version.obj" \
+ "$(INTDIR)\win32.obj" \
+ "$(INTDIR)\acosh.obj" \
+ "$(INTDIR)\crypt.obj" \
+ "$(INTDIR)\dup2.obj" \
+ "$(INTDIR)\hypot.obj" \
+ "$(INTDIR)\isinf.obj" \
+ "$(INTDIR)\isnan.obj" \
+ "$(INTDIR)\strftime.obj" \
+ "$(INTDIR)\wce\direct.obj" \
+ "$(INTDIR)\wce\errno.obj" \
+ "$(INTDIR)\wce\io.obj" \
+ "$(INTDIR)\wce\process.obj" \
+ "$(INTDIR)\wce\signal.obj" \
+ "$(INTDIR)\wce\stat.obj" \
+ "$(INTDIR)\wce\stdio.obj" \
+ "$(INTDIR)\wce\stdlib.obj" \
+ "$(INTDIR)\wce\string.obj" \
+ "$(INTDIR)\wce\time.obj" \
+ "$(INTDIR)\wce\timeb.obj" \
+ "$(INTDIR)\wce\utime.obj" \
+ "$(INTDIR)\wce\wince.obj" \
+ "$(INTDIR)\wce\winsock2.obj" \
+ "$(INTDIR)\wce\parse.obj"
+
+"$(OUTDIR)\mswince_ruby17.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "SH3"
+
+OUTDIR=.\SH3Rel
+INTDIR=.\SH3Rel
+# Begin Custom Macros
+OutDir=.\SH3Rel
+# End Custom Macros
+
+ALL : "$(OUTDIR)\mswince_ruby17.dll"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\acosh.obj"
+ -@erase "$(INTDIR)\array.obj"
+ -@erase "$(INTDIR)\bignum.obj"
+ -@erase "$(INTDIR)\class.obj"
+ -@erase "$(INTDIR)\compar.obj"
+ -@erase "$(INTDIR)\crypt.obj"
+ -@erase "$(INTDIR)\dir.obj"
+ -@erase "$(INTDIR)\dln.obj"
+ -@erase "$(INTDIR)\dmyext.obj"
+ -@erase "$(INTDIR)\dup2.obj"
+ -@erase "$(INTDIR)\enum.obj"
+ -@erase "$(INTDIR)\error.obj"
+ -@erase "$(INTDIR)\eval.obj"
+ -@erase "$(INTDIR)\file.obj"
+ -@erase "$(INTDIR)\gc.obj"
+ -@erase "$(INTDIR)\hash.obj"
+ -@erase "$(INTDIR)\hypot.obj"
+ -@erase "$(INTDIR)\inits.obj"
+ -@erase "$(INTDIR)\io.obj"
+ -@erase "$(INTDIR)\isinf.obj"
+ -@erase "$(INTDIR)\isnan.obj"
+ -@erase "$(INTDIR)\marshal.obj"
+ -@erase "$(INTDIR)\math.obj"
+ -@erase "$(INTDIR)\numeric.obj"
+ -@erase "$(INTDIR)\object.obj"
+ -@erase "$(INTDIR)\pack.obj"
+ -@erase "$(INTDIR)\prec.obj"
+ -@erase "$(INTDIR)\process.obj"
+ -@erase "$(INTDIR)\random.obj"
+ -@erase "$(INTDIR)\range.obj"
+ -@erase "$(INTDIR)\re.obj"
+ -@erase "$(INTDIR)\regex.obj"
+ -@erase "$(INTDIR)\ruby.obj"
+ -@erase "$(INTDIR)\signal.obj"
+ -@erase "$(INTDIR)\sprintf.obj"
+ -@erase "$(INTDIR)\st.obj"
+ -@erase "$(INTDIR)\strftime.obj"
+ -@erase "$(INTDIR)\string.obj"
+ -@erase "$(INTDIR)\struct.obj"
+ -@erase "$(INTDIR)\time.obj"
+ -@erase "$(INTDIR)\util.obj"
+ -@erase "$(INTDIR)\variable.obj"
+ -@erase "$(INTDIR)\version.obj"
+ -@erase "$(INTDIR)\win32.obj"
+ -@erase "$(OUTDIR)\mswince_ruby17.dll"
+ -@erase "$(OUTDIR)\mswince_ruby17.exp"
+ -@erase "$(OUTDIR)\mswince_ruby17.lib"
+ -@erase "$(INTDIR)\wce\direct.obj"
+ -@erase "$(INTDIR)\wce\errno.obj"
+ -@erase "$(INTDIR)\wce\io.obj"
+ -@erase "$(INTDIR)\wce\parse.obj"
+ -@erase "$(INTDIR)\wce\process.obj"
+ -@erase "$(INTDIR)\wce\signal.obj"
+ -@erase "$(INTDIR)\wce\stat.obj"
+ -@erase "$(INTDIR)\wce\stdio.obj"
+ -@erase "$(INTDIR)\wce\stdlib.obj"
+ -@erase "$(INTDIR)\wce\string.obj"
+ -@erase "$(INTDIR)\wce\time.obj"
+ -@erase "$(INTDIR)\wce\timeb.obj"
+ -@erase "$(INTDIR)\wce\utime.obj"
+ -@erase "$(INTDIR)\wce\wince.obj"
+ -@erase "$(INTDIR)\wce\winsock2.obj"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+ if not exist "$(OUTDIR)/wce" mkdir "$(OUTDIR)/wce"
+ if not exist ".\parse.c" byacc ../parse.y
+ if not exist ".\parse.c" sed -e "s!^extern char \*getenv();!/* & */!;s/^\(#.*\)y\.tab/\1parse/" y.tab.c > ".\parse.c"
+ if exist "y.tab.c" @del y.tab.c
+
+RSC=rc.exe
+CPP=shcl.exe
+CPP_PROJ=/nologo /W1 /I ".." /I "..\missing" /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_USRDLL" /D "MSWINCE_RUBY17_EXPORTS" /D BUFSIZ=512 /D FILENAME_MAX=260 /D TLS_OUT_OF_INDEXES=0xFFFFFFFF /Fp"$(INTDIR)\mswince_ruby17.pch" /YX /Fo"$(INTDIR)\\" /Oxs /M$(CECrtMT) /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\mswince_ruby17.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=commctrl.lib coredll.lib winsock.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /incremental:no /pdb:"$(OUTDIR)\mswince_ruby17.pdb" /nodefaultlib:"$(CENoDefaultLib)" /def:".\mswince-ruby17.def" /out:"$(OUTDIR)\mswince_ruby17.dll" /implib:"$(OUTDIR)\mswince_ruby17.lib" /subsystem:$(CESubsystem) /MACHINE:SH3
+DEF_FILE= \
+ ".\mswince-ruby17.def"
+LINK32_OBJS= \
+ "$(INTDIR)\array.obj" \
+ "$(INTDIR)\bignum.obj" \
+ "$(INTDIR)\class.obj" \
+ "$(INTDIR)\compar.obj" \
+ "$(INTDIR)\dir.obj" \
+ "$(INTDIR)\dln.obj" \
+ "$(INTDIR)\dmyext.obj" \
+ "$(INTDIR)\enum.obj" \
+ "$(INTDIR)\error.obj" \
+ "$(INTDIR)\eval.obj" \
+ "$(INTDIR)\file.obj" \
+ "$(INTDIR)\gc.obj" \
+ "$(INTDIR)\hash.obj" \
+ "$(INTDIR)\inits.obj" \
+ "$(INTDIR)\io.obj" \
+ "$(INTDIR)\marshal.obj" \
+ "$(INTDIR)\math.obj" \
+ "$(INTDIR)\numeric.obj" \
+ "$(INTDIR)\object.obj" \
+ "$(INTDIR)\pack.obj" \
+ "$(INTDIR)\prec.obj" \
+ "$(INTDIR)\process.obj" \
+ "$(INTDIR)\random.obj" \
+ "$(INTDIR)\range.obj" \
+ "$(INTDIR)\re.obj" \
+ "$(INTDIR)\regex.obj" \
+ "$(INTDIR)\ruby.obj" \
+ "$(INTDIR)\signal.obj" \
+ "$(INTDIR)\sprintf.obj" \
+ "$(INTDIR)\st.obj" \
+ "$(INTDIR)\string.obj" \
+ "$(INTDIR)\struct.obj" \
+ "$(INTDIR)\time.obj" \
+ "$(INTDIR)\util.obj" \
+ "$(INTDIR)\variable.obj" \
+ "$(INTDIR)\version.obj" \
+ "$(INTDIR)\win32.obj" \
+ "$(INTDIR)\acosh.obj" \
+ "$(INTDIR)\crypt.obj" \
+ "$(INTDIR)\dup2.obj" \
+ "$(INTDIR)\hypot.obj" \
+ "$(INTDIR)\isinf.obj" \
+ "$(INTDIR)\isnan.obj" \
+ "$(INTDIR)\strftime.obj" \
+ "$(INTDIR)\wce\direct.obj" \
+ "$(INTDIR)\wce\errno.obj" \
+ "$(INTDIR)\wce\io.obj" \
+ "$(INTDIR)\wce\process.obj" \
+ "$(INTDIR)\wce\signal.obj" \
+ "$(INTDIR)\wce\stat.obj" \
+ "$(INTDIR)\wce\stdio.obj" \
+ "$(INTDIR)\wce\stdlib.obj" \
+ "$(INTDIR)\wce\string.obj" \
+ "$(INTDIR)\wce\time.obj" \
+ "$(INTDIR)\wce\timeb.obj" \
+ "$(INTDIR)\wce\utime.obj" \
+ "$(INTDIR)\wce\wince.obj" \
+ "$(INTDIR)\wce\winsock2.obj" \
+ "$(INTDIR)\wce\parse.obj"
+
+"$(OUTDIR)\mswince_ruby17.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "ARM"
+
+OUTDIR=.\ARMRel
+INTDIR=.\ARMRel
+# Begin Custom Macros
+OutDir=.\ARMRel
+# End Custom Macros
+
+ALL : "$(OUTDIR)\mswince_ruby17.dll"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\acosh.obj"
+ -@erase "$(INTDIR)\array.obj"
+ -@erase "$(INTDIR)\bignum.obj"
+ -@erase "$(INTDIR)\class.obj"
+ -@erase "$(INTDIR)\compar.obj"
+ -@erase "$(INTDIR)\crypt.obj"
+ -@erase "$(INTDIR)\dir.obj"
+ -@erase "$(INTDIR)\dln.obj"
+ -@erase "$(INTDIR)\dmyext.obj"
+ -@erase "$(INTDIR)\dup2.obj"
+ -@erase "$(INTDIR)\enum.obj"
+ -@erase "$(INTDIR)\error.obj"
+ -@erase "$(INTDIR)\eval.obj"
+ -@erase "$(INTDIR)\file.obj"
+ -@erase "$(INTDIR)\gc.obj"
+ -@erase "$(INTDIR)\hash.obj"
+ -@erase "$(INTDIR)\hypot.obj"
+ -@erase "$(INTDIR)\inits.obj"
+ -@erase "$(INTDIR)\io.obj"
+ -@erase "$(INTDIR)\isinf.obj"
+ -@erase "$(INTDIR)\isnan.obj"
+ -@erase "$(INTDIR)\marshal.obj"
+ -@erase "$(INTDIR)\math.obj"
+ -@erase "$(INTDIR)\numeric.obj"
+ -@erase "$(INTDIR)\object.obj"
+ -@erase "$(INTDIR)\pack.obj"
+ -@erase "$(INTDIR)\prec.obj"
+ -@erase "$(INTDIR)\process.obj"
+ -@erase "$(INTDIR)\random.obj"
+ -@erase "$(INTDIR)\range.obj"
+ -@erase "$(INTDIR)\re.obj"
+ -@erase "$(INTDIR)\regex.obj"
+ -@erase "$(INTDIR)\ruby.obj"
+ -@erase "$(INTDIR)\signal.obj"
+ -@erase "$(INTDIR)\sprintf.obj"
+ -@erase "$(INTDIR)\st.obj"
+ -@erase "$(INTDIR)\strftime.obj"
+ -@erase "$(INTDIR)\string.obj"
+ -@erase "$(INTDIR)\struct.obj"
+ -@erase "$(INTDIR)\time.obj"
+ -@erase "$(INTDIR)\util.obj"
+ -@erase "$(INTDIR)\variable.obj"
+ -@erase "$(INTDIR)\version.obj"
+ -@erase "$(INTDIR)\win32.obj"
+ -@erase "$(OUTDIR)\mswince_ruby17.dll"
+ -@erase "$(OUTDIR)\mswince_ruby17.exp"
+ -@erase "$(OUTDIR)\mswince_ruby17.lib"
+ -@erase "$(INTDIR)\wce\direct.obj"
+ -@erase "$(INTDIR)\wce\errno.obj"
+ -@erase "$(INTDIR)\wce\io.obj"
+ -@erase "$(INTDIR)\wce\parse.obj"
+ -@erase "$(INTDIR)\wce\process.obj"
+ -@erase "$(INTDIR)\wce\signal.obj"
+ -@erase "$(INTDIR)\wce\stat.obj"
+ -@erase "$(INTDIR)\wce\stdio.obj"
+ -@erase "$(INTDIR)\wce\stdlib.obj"
+ -@erase "$(INTDIR)\wce\string.obj"
+ -@erase "$(INTDIR)\wce\time.obj"
+ -@erase "$(INTDIR)\wce\timeb.obj"
+ -@erase "$(INTDIR)\wce\utime.obj"
+ -@erase "$(INTDIR)\wce\wince.obj"
+ -@erase "$(INTDIR)\wce\winsock2.obj"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+ if not exist "$(OUTDIR)/wce" mkdir "$(OUTDIR)/wce"
+ if not exist ".\parse.c" byacc ../parse.y
+ if not exist ".\parse.c" sed -e "s!^extern char \*getenv();!/* & */!;s/^\(#.*\)y\.tab/\1parse/" y.tab.c > ".\parse.c"
+ if exist "y.tab.c" @del y.tab.c
+
+RSC=rc.exe
+CPP=clarm.exe
+CPP_PROJ=/nologo /W1 /I ".." /I "..\missing" /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_USRDLL" /D "MSWINCE_RUBY17_EXPORTS" /D BUFSIZ=512 /D FILENAME_MAX=260 /D TLS_OUT_OF_INDEXES=0xFFFFFFFF /Fp"$(INTDIR)\mswince_ruby17.pch" /YX /Fo"$(INTDIR)\\" /Oxs /M$(CECrtMT) /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\mswince_ruby17.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=commctrl.lib coredll.lib winsock.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /incremental:no /pdb:"$(OUTDIR)\mswince_ruby17.pdb" /nodefaultlib:"$(CENoDefaultLib)" /def:".\mswince-ruby17.def" /out:"$(OUTDIR)\mswince_ruby17.dll" /implib:"$(OUTDIR)\mswince_ruby17.lib" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM
+DEF_FILE= \
+ ".\mswince-ruby17.def"
+LINK32_OBJS= \
+ "$(INTDIR)\array.obj" \
+ "$(INTDIR)\bignum.obj" \
+ "$(INTDIR)\class.obj" \
+ "$(INTDIR)\compar.obj" \
+ "$(INTDIR)\dir.obj" \
+ "$(INTDIR)\dln.obj" \
+ "$(INTDIR)\dmyext.obj" \
+ "$(INTDIR)\enum.obj" \
+ "$(INTDIR)\error.obj" \
+ "$(INTDIR)\eval.obj" \
+ "$(INTDIR)\file.obj" \
+ "$(INTDIR)\gc.obj" \
+ "$(INTDIR)\hash.obj" \
+ "$(INTDIR)\inits.obj" \
+ "$(INTDIR)\io.obj" \
+ "$(INTDIR)\marshal.obj" \
+ "$(INTDIR)\math.obj" \
+ "$(INTDIR)\numeric.obj" \
+ "$(INTDIR)\object.obj" \
+ "$(INTDIR)\pack.obj" \
+ "$(INTDIR)\prec.obj" \
+ "$(INTDIR)\process.obj" \
+ "$(INTDIR)\random.obj" \
+ "$(INTDIR)\range.obj" \
+ "$(INTDIR)\re.obj" \
+ "$(INTDIR)\regex.obj" \
+ "$(INTDIR)\ruby.obj" \
+ "$(INTDIR)\signal.obj" \
+ "$(INTDIR)\sprintf.obj" \
+ "$(INTDIR)\st.obj" \
+ "$(INTDIR)\string.obj" \
+ "$(INTDIR)\struct.obj" \
+ "$(INTDIR)\time.obj" \
+ "$(INTDIR)\util.obj" \
+ "$(INTDIR)\variable.obj" \
+ "$(INTDIR)\version.obj" \
+ "$(INTDIR)\win32.obj" \
+ "$(INTDIR)\acosh.obj" \
+ "$(INTDIR)\crypt.obj" \
+ "$(INTDIR)\dup2.obj" \
+ "$(INTDIR)\hypot.obj" \
+ "$(INTDIR)\isinf.obj" \
+ "$(INTDIR)\isnan.obj" \
+ "$(INTDIR)\strftime.obj" \
+ "$(INTDIR)\wce\direct.obj" \
+ "$(INTDIR)\wce\errno.obj" \
+ "$(INTDIR)\wce\io.obj" \
+ "$(INTDIR)\wce\process.obj" \
+ "$(INTDIR)\wce\signal.obj" \
+ "$(INTDIR)\wce\stat.obj" \
+ "$(INTDIR)\wce\stdio.obj" \
+ "$(INTDIR)\wce\stdlib.obj" \
+ "$(INTDIR)\wce\string.obj" \
+ "$(INTDIR)\wce\time.obj" \
+ "$(INTDIR)\wce\timeb.obj" \
+ "$(INTDIR)\wce\utime.obj" \
+ "$(INTDIR)\wce\wince.obj" \
+ "$(INTDIR)\wce\winsock2.obj" \
+ "$(INTDIR)\wce\parse.obj"
+
+"$(OUTDIR)\mswince_ruby17.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF
+
+
+
+..\array.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\st.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\bignum.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\class.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\node.h"\
+ "..\ruby.h"\
+ "..\rubysig.h"\
+ "..\st.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\compar.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\dir.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\dir.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\dln.c : \
+ "..\defines.h"\
+ "..\dln.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\missing\file.h"\
+ "..\ruby.h"\
+ "..\st.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\enum.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\node.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\error.c : \
+ "..\defines.h"\
+ "..\env.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\st.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\eval.c : \
+ "..\defines.h"\
+ "..\dln.h"\
+ "..\env.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\node.h"\
+ "..\ruby.h"\
+ "..\rubysig.h"\
+ "..\st.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\file.c : \
+ "..\defines.h"\
+ "..\dln.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\missing\file.h"\
+ "..\ruby.h"\
+ "..\rubyio.h"\
+ "..\rubysig.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\gc.c : \
+ "..\defines.h"\
+ "..\env.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\node.h"\
+ "..\re.h"\
+ "..\regex.h"\
+ "..\ruby.h"\
+ "..\rubysig.h"\
+ "..\st.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\hash.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\rubysig.h"\
+ "..\st.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\inits.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\io.c : \
+ "..\defines.h"\
+ "..\env.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\rubyio.h"\
+ "..\rubysig.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\marshal.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\rubyio.h"\
+ "..\st.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\math.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\numeric.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\object.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\st.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\pack.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\prec.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\process.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\rubysig.h"\
+ "..\st.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\random.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\range.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\re.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\re.h"\
+ "..\regex.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\regex.c : \
+ "..\defines.h"\
+ "..\regex.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\ruby.c : \
+ "..\defines.h"\
+ "..\dln.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\node.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\signal.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\rubysig.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\sprintf.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\st.c : \
+ "..\st.h"\
+ ".\config.h"\
+
+..\string.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\re.h"\
+ "..\regex.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\struct.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\time.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\util.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\missing\file.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\variable.c : \
+ "..\defines.h"\
+ "..\env.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\node.h"\
+ "..\ruby.h"\
+ "..\st.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\version.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+..\win32\win32.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\rubysig.h"\
+ "..\vms\vms.h"\
+ "..\win32\dir.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+ ".\wince.h"\
+
+..\missing\dup2.c : \
+ ".\config.h"\
+
+..\missing\isinf.c : \
+ ".\config.h"\
+
+..\missing\strftime.c : \
+ ".\config.h"\
+
+.\direct.c : \
+ ".\wince.h"\
+
+.\io.c : \
+ ".\wince.h"\
+
+.\sys\stat.c : \
+ ".\wince.h"\
+
+.\stdio.c : \
+ ".\wince.h"\
+
+.\sys\utime.c : \
+ ".\wince.h"\
+
+.\wince.c : \
+ ".\wince.h"\
+
+.\winsock2.c : \
+ ".\wince.h"\
+
+..\ruby\wince\parse.c : \
+ "..\defines.h"\
+ "..\env.h"\
+ "..\intern.h"\
+ "..\lex.c"\
+ "..\missing.h"\
+ "..\node.h"\
+ "..\regex.h"\
+ "..\ruby.h"\
+ "..\st.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+ ".\config.h"\
+
+
+
+SOURCE=..\array.c
+
+"$(INTDIR)\array.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\bignum.c
+
+"$(INTDIR)\bignum.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\class.c
+
+"$(INTDIR)\class.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\compar.c
+
+"$(INTDIR)\compar.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\dir.c
+
+"$(INTDIR)\dir.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\dln.c
+
+"$(INTDIR)\dln.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\dmyext.c
+
+"$(INTDIR)\dmyext.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\enum.c
+
+"$(INTDIR)\enum.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\error.c
+
+"$(INTDIR)\error.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\eval.c
+
+"$(INTDIR)\eval.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\file.c
+
+"$(INTDIR)\file.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\gc.c
+
+"$(INTDIR)\gc.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\hash.c
+
+"$(INTDIR)\hash.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\inits.c
+
+"$(INTDIR)\inits.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\io.c
+
+"$(INTDIR)\io.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\marshal.c
+
+"$(INTDIR)\marshal.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\math.c
+
+"$(INTDIR)\math.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\numeric.c
+
+"$(INTDIR)\numeric.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\object.c
+
+"$(INTDIR)\object.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\pack.c
+
+"$(INTDIR)\pack.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\prec.c
+
+"$(INTDIR)\prec.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\process.c
+
+"$(INTDIR)\process.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\random.c
+
+"$(INTDIR)\random.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\range.c
+
+"$(INTDIR)\range.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\re.c
+
+"$(INTDIR)\re.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\regex.c
+
+"$(INTDIR)\regex.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\ruby.c
+
+"$(INTDIR)\ruby.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\signal.c
+
+"$(INTDIR)\signal.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\sprintf.c
+
+"$(INTDIR)\sprintf.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\st.c
+
+"$(INTDIR)\st.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\string.c
+
+"$(INTDIR)\string.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\struct.c
+
+"$(INTDIR)\struct.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\time.c
+
+"$(INTDIR)\time.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\util.c
+
+"$(INTDIR)\util.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\variable.c
+
+"$(INTDIR)\variable.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\version.c
+
+"$(INTDIR)\version.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\win32\win32.c
+
+"$(INTDIR)\win32.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\missing\acosh.c
+
+"$(INTDIR)\acosh.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\missing\crypt.c
+
+"$(INTDIR)\crypt.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\missing\dup2.c
+
+"$(INTDIR)\dup2.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\missing\hypot.c
+
+"$(INTDIR)\hypot.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\missing\isinf.c
+
+"$(INTDIR)\isinf.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\missing\isnan.c
+
+"$(INTDIR)\isnan.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=..\missing\strftime.c
+
+"$(INTDIR)\strftime.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!IF "$(CFG)" == "MIPS"
+
+CPP_PROJ=/nologo /W1 /I ".." /I "..\missing" /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_USRDLL" /D "MSWINCE_RUBY17_EXPORTS" /D BUFSIZ=512 /D FILENAME_MAX=260 /D TLS_OUT_OF_INDEXES=0xFFFFFFFF /Fp"$(INTDIR)\mswince_ruby17.pch" /YX /Fo"$(INTDIR)\wce\\" /Oxs /M$(CECrtMT) /c
+
+!ELSEIF "$(CFG)" == "SH4"
+
+CPP_PROJ=/nologo /W1 /I ".." /I "..\missing" /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_USRDLL" /D "MSWINCE_RUBY17_EXPORTS" /D BUFSIZ=512 /D FILENAME_MAX=260 /D TLS_OUT_OF_INDEXES=0xFFFFFFFF /Fp"$(INTDIR)\mswince_ruby17.pch" /YX /Fo"$(INTDIR)\wce\\" /Qsh4 /Oxs /M$(CECrtMT) /c
+
+!ELSEIF "$(CFG)" == "SH3"
+
+CPP_PROJ=/nologo /W1 /I ".." /I "..\missing" /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_USRDLL" /D "MSWINCE_RUBY17_EXPORTS" /D BUFSIZ=512 /D FILENAME_MAX=260 /D TLS_OUT_OF_INDEXES=0xFFFFFFFF /Fp"$(INTDIR)\mswince_ruby17.pch" /YX /Fo"$(INTDIR)\wce\\" /Oxs /M$(CECrtMT) /c
+
+!ELSEIF "$(CFG)" == "ARM"
+
+CPP_PROJ=/nologo /W1 /I ".." /I "..\missing" /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_USRDLL" /D "MSWINCE_RUBY17_EXPORTS" /D BUFSIZ=512 /D FILENAME_MAX=260 /D TLS_OUT_OF_INDEXES=0xFFFFFFFF /Fp"$(INTDIR)\mswince_ruby17.pch" /YX /Fo"$(INTDIR)\wce\\" /Oxs /M$(CECrtMT) /c
+
+!ENDIF
+
+SOURCE=.\direct.c
+
+"$(INTDIR)\wce\direct.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\errno.c
+
+"$(INTDIR)\wce\errno.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\io.c
+
+"$(INTDIR)\wce\io.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\process.c
+
+"$(INTDIR)\wce\process.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\signal.c
+
+"$(INTDIR)\wce\signal.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\sys\stat.c
+
+"$(INTDIR)\wce\stat.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\stdio.c
+
+"$(INTDIR)\wce\stdio.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\stdlib.c
+
+"$(INTDIR)\wce\stdlib.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\string.c
+
+"$(INTDIR)\wce\string.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\time.c
+
+"$(INTDIR)\wce\time.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\sys\timeb.c
+
+"$(INTDIR)\wce\timeb.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\sys\utime.c
+
+"$(INTDIR)\wce\utime.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\wince.c
+
+"$(INTDIR)\wce\wince.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\winsock2.c
+
+"$(INTDIR)\wce\winsock2.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\parse.c
+
+"$(INTDIR)\wce\parse.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
diff --git a/wince/errno.c b/wince/errno.c
new file mode 100644
index 0000000000..705b25428e
--- /dev/null
+++ b/wince/errno.c
@@ -0,0 +1,11 @@
+/***************************************************************
+ errno.c
+***************************************************************/
+
+#include <errno.h>
+
+
+int errno;
+int _doserrno;
+int _sys_nerr;
+
diff --git a/wince/errno.h b/wince/errno.h
new file mode 100644
index 0000000000..2fdd325b32
--- /dev/null
+++ b/wince/errno.h
@@ -0,0 +1,55 @@
+#ifndef ERRNO_H
+#define ERRNO_H 1
+
+
+#define EPERM 1
+#define ENOENT 2
+#define ESRCH 3
+#define EINTR 4
+#define EIO 5
+#define ENXIO 6
+#define E2BIG 7
+#define ENOEXEC 8
+#define EBADF 9
+#define ECHILD 10
+#define EAGAIN 11
+#define ENOMEM 12
+#define EACCES 13
+#define EFAULT 14
+#define EOSERR 15 // rk
+#define EBUSY 16
+#define EEXIST 17
+#define EXDEV 18
+#define ENODEV 19
+#define ENOTDIR 20
+#define EISDIR 21
+#define EINVAL 22
+#define ENFILE 23
+#define EMFILE 24
+#define ENOTTY 25
+#define EFBIG 27
+#define ENOSPC 28
+#define ESPIPE 29
+#define EROFS 30
+#define EMLINK 31
+#define EPIPE 32
+#define EDOM 33
+#define ERANGE 34
+#define EDEADLK 36
+#define ENOSYS 37
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int errno;
+extern int _doserrno;
+extern int _sys_nerr;
+
+#define sys_nerr _sys_nerr
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/wince/exe.mak b/wince/exe.mak
new file mode 100644
index 0000000000..2fb0d4237f
--- /dev/null
+++ b/wince/exe.mak
@@ -0,0 +1,353 @@
+
+!IF "$(CFG)" == ""
+CFG=MIPS
+!MESSAGE CFG not specified. use MIPS.
+!ENDIF
+
+!IF "$(CESubsystem)" == ""
+#CESubsystem=windowsce,2.0
+CESubsystem=windowsce,3.0
+#!MESSAGE CESubsystem not specified. use windowsce,2.11.
+!MESSAGE CESubsystem not specified. use windowsce,3.0.
+!ENDIF
+
+!IF "$(CEVersion)" == ""
+#CEVersion=200
+CEVersion=300
+#!MESSAGE CEVersion not specified. use 211.
+!MESSAGE CEVersion not specified. use 300.
+!ENDIF
+
+!IF $(CEVersion) < 201
+CECrt=L
+CECrtDebug=Ld
+CECrtMT=T
+CECrtMTDebug=Td
+CENoDefaultLib=corelibc.lib
+CEx86Corelibc=
+!ELSE
+CECrt=C
+CECrtDebug=C
+CECrtMT=C
+CECrtMTDebug=C
+CENoDefaultLib=libc.lib /nodefaultlib:libcd.lib /nodefaultlib:libcmt.lib /nodefaultlib:libcmtd.lib /nodefaultlib:msvcrt.lib /nodefaultlib:msvcrtd.lib
+CEx86Corelibc=corelibc.lib
+!ENDIF
+
+!IF "$(CE_PLATFORM)"==""
+CePlatform=WIN32_PLATFORM_UNKNOWN
+!ELSE
+CePlatform=$(CE_PLATFORM)
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+!IF "$(CFG)" == "MIPS"
+
+OUTDIR=.\MIPSRel
+INTDIR=.\MIPSRel
+# Begin Custom Macros
+OutDir=.\MIPSRel
+# End Custom Macros
+
+ALL : "$(OUTDIR)\ruby.exe"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\main.obj"
+ -@erase "$(INTDIR)\wincemain.obj"
+ -@erase "$(OUTDIR)\ruby.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+RSC=rc.exe
+CPP=clmips.exe
+CPP_PROJ=/nologo /W3 /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Fp"$(INTDIR)\ruby.pch" /YX /Fo"$(INTDIR)\\" /Oxs /M$(CECrtMT) /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\ruby.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=commctrl.lib coredll.lib mswince_ruby17.lib /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /incremental:no /pdb:"$(OUTDIR)\ruby.pdb" /nodefaultlib:"$(CENoDefaultLib)" /out:"$(OUTDIR)\ruby.exe" /libpath:"$(OUTDIR)" /subsystem:$(CESubsystem) /MACHINE:MIPS
+LINK32_OBJS= \
+ "$(INTDIR)\main.obj" \
+ "$(INTDIR)\wincemain.obj"
+
+"$(OUTDIR)\ruby.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "SH4"
+
+OUTDIR=.\SH4Rel
+INTDIR=.\SH4Rel
+# Begin Custom Macros
+OutDir=.\SH4Rel
+# End Custom Macros
+
+ALL : "$(OUTDIR)\ruby.exe"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\main.obj"
+ -@erase "$(INTDIR)\wincemain.obj"
+ -@erase "$(OUTDIR)\ruby.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+RSC=rc.exe
+CPP=shcl.exe
+CPP_PROJ=/nologo /W3 /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Fp"$(INTDIR)\ruby.pch" /YX /Fo"$(INTDIR)\\" /Qsh4 /Oxs /M$(CECrtMT) /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\ruby.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=commctrl.lib coredll.lib mswince_ruby17.lib /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /incremental:no /pdb:"$(OUTDIR)\ruby.pdb" /nodefaultlib:"$(CENoDefaultLib)" /out:"$(OUTDIR)\ruby.exe" /libpath:"$(OUTDIR)" /subsystem:$(CESubsystem) /MACHINE:SH4
+LINK32_OBJS= \
+ "$(INTDIR)\main.obj" \
+ "$(INTDIR)\wincemain.obj"
+
+"$(OUTDIR)\ruby.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "SH3"
+
+OUTDIR=.\SH3Rel
+INTDIR=.\SH3Rel
+# Begin Custom Macros
+OutDir=.\SH3Rel
+# End Custom Macros
+
+ALL : "$(OUTDIR)\ruby.exe"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\main.obj"
+ -@erase "$(INTDIR)\wincemain.obj"
+ -@erase "$(OUTDIR)\ruby.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+RSC=rc.exe
+CPP=shcl.exe
+CPP_PROJ=/nologo /W3 /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Fp"$(INTDIR)\ruby.pch" /YX /Fo"$(INTDIR)\\" /Oxs /M$(CECrtMT) /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\ruby.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=commctrl.lib coredll.lib mswince_ruby17.lib /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /incremental:no /pdb:"$(OUTDIR)\ruby.pdb" /nodefaultlib:"$(CENoDefaultLib)" /out:"$(OUTDIR)\ruby.exe" /libpath:"$(OUTDIR)" /subsystem:$(CESubsystem) /MACHINE:SH3
+LINK32_OBJS= \
+ "$(INTDIR)\main.obj" \
+ "$(INTDIR)\wincemain.obj"
+
+"$(OUTDIR)\ruby.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == ARM"
+
+OUTDIR=.\ARMRel
+INTDIR=.\ARMRel
+# Begin Custom Macros
+OutDir=.\ARMRel
+# End Custom Macros
+
+ALL : "$(OUTDIR)\ruby.exe"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\main.obj"
+ -@erase "$(INTDIR)\wincemain.obj"
+ -@erase "$(OUTDIR)\ruby.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+RSC=rc.exe
+CPP=clarm.exe
+CPP_PROJ=/nologo /W3 /I "C:\_develops\eMVT\ruby17\ruby\wince" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Fp"$(INTDIR)\ruby.pch" /YX /Fo"$(INTDIR)\\" /Oxs /M$(CECrtMT) /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\ruby.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=commctrl.lib coredll.lib mswince_ruby17.lib /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /incremental:no /pdb:"$(OUTDIR)\ruby.pdb" /nodefaultlib:"$(CENoDefaultLib)" /out:"$(OUTDIR)\ruby.exe" /libpath:"$(OUTDIR)" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM
+LINK32_OBJS= \
+ "$(INTDIR)\main.obj" \
+ "$(INTDIR)\wincemain.obj"
+
+"$(OUTDIR)\ruby.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF
+
+
+..\main.c : \
+ "..\defines.h"\
+ "..\intern.h"\
+ "..\missing.h"\
+ "..\ruby.h"\
+ "..\vms\vms.h"\
+ "..\win32\win32.h"\
+
+.\wincemain.c : \
+ ".\wince.h"\
+
+
+SOURCE=..\main.c
+
+"$(INTDIR)\main.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+SOURCE=.\wincemain.c
+
+"$(INTDIR)\wincemain.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
diff --git a/wince/fcntl.h b/wince/fcntl.h
new file mode 100644
index 0000000000..5a6bdc71e6
--- /dev/null
+++ b/wince/fcntl.h
@@ -0,0 +1,42 @@
+
+#ifndef FCNTL_H
+#define FCNTL_H 1
+
+
+#define F_SETFL 1
+#define F_SETFD 2
+#define F_GETFL 3
+
+#define _O_RDONLY 0x0000 /* open for reading only */
+#define _O_WRONLY 0x0001 /* open for writing only */
+#define _O_RDWR 0x0002 /* open for reading and writing */
+
+#define _O_NONBLOCK 0x0004
+
+#define _O_APPEND 0x0008 /* writes done at eof */
+#define _O_CREAT 0x0100 /* create and open file */
+#define _O_TRUNC 0x0200 /* open and truncate */
+#define _O_EXCL 0x0400 /* open only if file doesn't already exist */
+#define _O_TEXT 0x4000 /* file mode is text (translated) */
+#define _O_BINARY 0x8000 /* file mode is binary (untranslated) */
+#define _O_ACCMODE 0x10000
+
+#define _O_NOINHERIT 0
+#define O_NOINHERIT _O_NOINHERIT
+
+#define O_RDONLY _O_RDONLY
+#define O_WRONLY _O_WRONLY
+#define O_RDWR _O_RDWR
+
+#define O_NONBLOCK _O_NONBLOCK
+
+#define O_APPEND _O_APPEND
+#define O_CREAT _O_CREAT
+#define O_TRUNC _O_TRUNC
+#define O_EXCL _O_EXCL
+#define O_TEXT _O_TEXT
+#define O_BINARY _O_BINARY
+#define O_ACCMODE _O_ACCMODE
+
+
+#endif
diff --git a/wince/io.c b/wince/io.c
new file mode 100644
index 0000000000..3d3f1bed77
--- /dev/null
+++ b/wince/io.c
@@ -0,0 +1,222 @@
+/***************************************************************
+ io.c
+
+ author : uema2
+ date : Nov 30, 2002
+
+ You can freely use, copy, modify, and redistribute
+ the whole contents.
+***************************************************************/
+
+#include <windows.h>
+#include <stdlib.h>
+#include <io.h>
+#include <fcntl.h>
+#include <time.h>
+#include <errno.h>
+#include "wince.h" /* for wce_mbtowc */
+
+extern int _errno;
+
+
+int _rename(const char *oldname, const char *newname)
+{
+ wchar_t *wold, *wnew;
+ BOOL rc;
+
+ wold = wce_mbtowc(oldname);
+ wnew = wce_mbtowc(newname);
+
+ /* replace with MoveFile. */
+ rc = MoveFileW(wold, wnew);
+
+ free(wold);
+ free(wnew);
+
+ return rc==TRUE ? 0 : -1;
+}
+
+int _unlink(const char *file)
+{
+ wchar_t *wfile;
+ BOOL rc;
+
+ /* replace with DeleteFile. */
+ wfile = wce_mbtowc(file);
+ rc = DeleteFileW(wfile);
+ free(wfile);
+
+ return rc==TRUE ? 0 : -1;
+}
+
+/* replace "open" with "CreateFile", etc. */
+int _open(const char *file, int mode, va_list arg)
+{
+ wchar_t *wfile;
+ DWORD access=0, share=0, create=0;
+ HANDLE h;
+
+ if( (mode&_O_RDWR) != 0 )
+ access = GENERIC_READ|GENERIC_WRITE;
+ else if( (mode&_O_RDONLY) != 0 )
+ access = GENERIC_READ;
+ else if( (mode&_O_WRONLY) != 0 )
+ access = GENERIC_WRITE;
+
+ if( (mode&_O_CREAT) != 0 )
+ create = CREATE_ALWAYS;
+ else
+ create = OPEN_ALWAYS;
+
+ wfile = wce_mbtowc(file);
+
+ h = CreateFileW(wfile, access, share, NULL,
+ create, 0, NULL );
+
+ free(wfile);
+ return (int)h;
+}
+
+int _close(int fd)
+{
+ CloseHandle( (HANDLE)fd );
+ return 0;
+}
+
+int _read(int fd, void *buffer, int length)
+{
+ DWORD dw;
+ ReadFile( (HANDLE)fd, buffer, length, &dw, NULL );
+ return (int)dw;
+}
+
+int _write(int fd, const void *buffer, unsigned count)
+{
+ DWORD dw;
+ WriteFile( (HANDLE)fd, buffer, count, &dw, NULL );
+ return (int)dw;
+}
+
+long _lseek(int handle, long offset, int origin)
+{
+ DWORD flag, ret;
+
+ switch(origin)
+ {
+ case SEEK_SET: flag = FILE_BEGIN; break;
+ case SEEK_CUR: flag = FILE_CURRENT; break;
+ case SEEK_END: flag = FILE_END; break;
+ default: flag = FILE_CURRENT; break;
+ }
+
+ ret = SetFilePointer( (HANDLE)handle, offset, NULL, flag );
+ return ret==0xFFFFFFFF ? -1 : 0;
+}
+
+/* _findfirst, _findnext, _findclose. */
+/* replace them with FindFirstFile, etc. */
+long _findfirst( char *file, struct _finddata_t *fi )
+{
+ HANDLE h;
+ WIN32_FIND_DATAA fda;
+
+ h = FindFirstFileA( file, &fda );
+ if( h==NULL )
+ {
+ errno = EINVAL; return -1;
+ }
+
+ fi->attrib = fda.dwFileAttributes;
+ fi->time_create = wce_FILETIME2time_t( &fda.ftCreationTime );
+ fi->time_access = wce_FILETIME2time_t( &fda.ftLastAccessTime );
+ fi->time_write = wce_FILETIME2time_t( &fda.ftLastWriteTime );
+ fi->size = fda.nFileSizeLow + (fda.nFileSizeHigh<<32);
+ strcpy( fi->name, fda.cFileName );
+
+ return (long)h;
+}
+
+int _findnext( long handle, struct _finddata_t *fi )
+{
+ WIN32_FIND_DATAA fda;
+ BOOL b;
+
+ b = FindNextFileA( (HANDLE)handle, &fda );
+
+ if( b==FALSE )
+ {
+ errno = ENOENT; return -1;
+ }
+
+ fi->attrib = fda.dwFileAttributes;
+ fi->time_create = wce_FILETIME2time_t( &fda.ftCreationTime );
+ fi->time_access = wce_FILETIME2time_t( &fda.ftLastAccessTime );
+ fi->time_write = wce_FILETIME2time_t( &fda.ftLastWriteTime );
+ fi->size = fda.nFileSizeLow + (fda.nFileSizeHigh<<32);
+ strcpy( fi->name, fda.cFileName );
+
+ return 0;
+}
+
+int _findclose( long handle )
+{
+ BOOL b;
+ b = FindClose( (HANDLE)handle );
+ return b==FALSE ? -1 : 0;
+}
+
+/* below functions unsupported... */
+/* I have no idea how to replace... */
+int _chsize(int handle, long size)
+{
+ errno = EACCES;
+ return -1;
+}
+
+int _umask(int cmask)
+{
+ return 0;
+}
+
+int _chmod(const char *path, int mode)
+{
+ return 0;
+}
+
+int _dup( int handle )
+{
+ errno = EBADF;
+ return -1;
+}
+
+int _isatty(int fd)
+{
+ if( fd==(int)_fileno(stdin) ||
+ fd==(int)_fileno(stdout)||
+ fd==(int)_fileno(stderr) )
+ return 1;
+ else
+ return 0;
+}
+
+int _pipe(int *phandles, unsigned int psize, int textmode)
+{
+ return -1;
+}
+
+int _access(const char *filename, int flags)
+{
+ return 0;
+}
+
+int _open_osfhandle( long osfhandle, int flags)
+{
+/* return 0; */
+ return (int)osfhandle;
+}
+
+long _get_osfhandle( int filehandle )
+{
+/* return 0; */
+ return (long)filehandle;
+}
diff --git a/wince/io.h b/wince/io.h
new file mode 100644
index 0000000000..a3033183b7
--- /dev/null
+++ b/wince/io.h
@@ -0,0 +1,65 @@
+
+#ifndef _IO_H_
+#define _IO_H_
+
+#ifndef _FSIZE_T_DEFINED
+typedef unsigned long _fsize_t; /* Could be 64 bits for Win32 */
+#define _FSIZE_T_DEFINED
+#endif
+
+#ifndef _FINDDATA_T_DEFINED
+struct _finddata_t {
+ unsigned attrib;
+ time_t time_create; /* -1 for FAT file systems */
+ time_t time_access; /* -1 for FAT file systems */
+ time_t time_write;
+ _fsize_t size;
+ char name[260];
+};
+#define _FINDDATA_T_DEFINED
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int _chsize(int handle, long size);
+int _rename (const char *oldname, const char *newname);
+int _unlink(const char *file);
+int _umask(int cmask);
+int _chmod(const char *path, int mode);
+int _dup( int handle );
+int _isatty(int fd);
+int _pipe(int *phandles, unsigned int psize, int textmode);
+int _access(const char *filename, int flags);
+int _open_osfhandle ( long osfhandle, int flags);
+long _get_osfhandle( int filehandle );
+int _open(const char *file, int mode,...);
+int _close(int fd);
+int _read(int fd, void *buffer, int length);
+int _write(int fd, const void *buffer, unsigned count);
+long _lseek(int handle, long offset, int origin);
+long _findfirst( char *filespec, struct _finddata_t *fileinfo );
+int _findnext( long handle, struct _finddata_t *fileinfo );
+int _findclose( long handle );
+
+#ifdef __cplusplus
+};
+#endif
+
+#define chsize _chsize
+#define rename _rename
+#define unlink _unlink
+#define open _open
+//#define close _close
+#define read _read
+#define write _write
+#define umask _umask
+#define dup _dup
+#define isatty _isatty
+#define access _access
+#define pipe _pipe
+
+#endif
+
diff --git a/wince/mswince-ruby17.def b/wince/mswince-ruby17.def
new file mode 100644
index 0000000000..930a35b414
--- /dev/null
+++ b/wince/mswince-ruby17.def
@@ -0,0 +1,814 @@
+EXPORTS
+ChildRecord
+GetCurrentThreadHandle
+Init_Array
+Init_Bignum
+Init_Comparable
+Init_Dir
+Init_Enumerable
+Init_Exception
+Init_File
+Init_GC
+Init_Hash
+Init_IO
+Init_Math
+Init_Numeric
+Init_Object
+Init_Precision
+Init_Proc
+Init_Random
+Init_Range
+Init_Regexp
+Init_String
+Init_Struct
+Init_Thread
+Init_Time
+Init_eval
+Init_ext
+Init_heap
+Init_load
+Init_marshal
+Init_pack
+Init_process
+Init_signal
+Init_stack
+Init_sym
+Init_var_tables
+Init_version
+NTLoginName
+NtCmdGlob
+NtCmdHead
+NtCmdTail
+NtFreeCmdLine
+NtInitialize
+NtMakeCmdVector
+NtSyncProcess
+SafeFree
+acosh
+asinh
+atanh
+chown
+crypt
+definekey
+dln_find_exe
+dln_find_file
+dln_load
+do_spawn
+eaccess
+encrypt
+endhostent
+endnetent
+endprotoent
+endservent
+flock
+getegid
+geteuid
+getgid
+getlogin
+getnetbyaddr
+getnetbyname
+getnetent
+getprotoent
+getservent
+gettimeofday
+getuid
+ioctl
+isInternalCmd
+isinf
+isnan
+kill
+link
+pipe_exec
+rb_Array
+rb_Float
+rb_Integer
+rb_String
+rb_add_method
+rb_alias
+rb_alias_variable
+rb_any_to_s
+rb_apply
+rb_argv
+rb_argv0
+rb_ary_aref
+rb_ary_assoc
+rb_ary_clear
+rb_ary_cmp
+rb_ary_concat
+rb_ary_delete
+rb_ary_delete_at
+rb_ary_dup
+rb_ary_each
+rb_ary_entry
+rb_ary_freeze
+rb_ary_includes
+rb_ary_join
+rb_ary_new
+rb_ary_new2
+rb_ary_new3
+rb_ary_new4
+rb_ary_plus
+rb_ary_pop
+rb_ary_push
+rb_ary_rassoc
+rb_ary_reverse
+rb_ary_shift
+rb_ary_sort
+rb_ary_sort_bang
+rb_ary_store
+rb_ary_to_ary
+rb_ary_to_s
+rb_ary_unshift
+rb_assoc_new
+rb_attr
+rb_autoload
+rb_autoload_defined
+rb_autoload_load
+rb_backref_get
+rb_backref_set
+rb_backtrace
+rb_big2dbl
+rb_big2ll
+rb_big2long
+rb_big2str
+rb_big2ull
+rb_big2ulong
+rb_big_2comp
+rb_big_and
+rb_big_clone
+rb_big_divmod
+rb_big_lshift
+rb_big_minus
+rb_big_mul
+rb_big_norm
+rb_big_or
+rb_big_plus
+rb_big_pow
+rb_big_rand
+rb_big_xor
+rb_block_given_p
+rb_bug
+rb_cArray
+rb_cBignum
+rb_cClass
+rb_cData
+rb_cDir
+rb_cFalseClass
+rb_cFile
+rb_cFixnum
+rb_cFloat
+rb_cHash
+rb_cIO
+rb_cInteger
+rb_cModule
+rb_cNilClass
+rb_cNumeric
+rb_cObject
+rb_cProc
+rb_cRange
+rb_cRegexp
+rb_cString
+rb_cStruct
+rb_cSymbol
+rb_cThread
+rb_cTime
+rb_cTrueClass
+rb_call_inits
+rb_call_super
+rb_catch
+rb_check_convert_type
+rb_check_frozen
+rb_check_safe_str
+rb_check_type
+rb_class2name
+rb_class_boot
+rb_class_inherited
+rb_class_instance_methods
+rb_class_new
+rb_class_new_instance
+rb_class_path
+rb_class_private_instance_methods
+rb_class_protected_instance_methods
+rb_class_public_instance_methods
+rb_class_real
+rb_class_tbl
+rb_clear_cache
+rb_cmpint
+rb_compile_cstr
+rb_compile_error
+rb_compile_error_append
+rb_compile_file
+rb_compile_string
+rb_const_assign
+rb_const_defined
+rb_const_defined_at
+rb_const_get
+rb_const_get_at
+rb_const_list
+rb_const_set
+rb_convert_type
+rb_copy_generic_ivar
+rb_cstr2inum
+rb_cstr_to_dbl
+rb_cstr_to_inum
+rb_cv_get
+rb_cv_set
+rb_cvar_defined
+rb_cvar_get
+rb_cvar_set
+rb_data_object_alloc
+rb_dbl2big
+rb_dbl_cmp
+rb_default_rs
+rb_define_alias
+rb_define_attr
+rb_define_class
+rb_define_class_id
+rb_define_class_under
+rb_define_class_variable
+rb_define_const
+rb_define_global_const
+rb_define_global_function
+rb_define_hooked_variable
+rb_define_method
+rb_define_method_id
+rb_define_module
+rb_define_module_function
+rb_define_module_id
+rb_define_module_under
+rb_define_private_method
+rb_define_protected_method
+rb_define_readonly_variable
+rb_define_singleton_method
+rb_define_variable
+rb_define_virtual_variable
+rb_defout
+rb_disable_super
+rb_dvar_curr
+rb_dvar_defined
+rb_dvar_push
+rb_dvar_ref
+rb_eArgError
+rb_eEOFError
+rb_eException
+rb_eFatal
+rb_eFloatDomainError
+rb_eIOError
+rb_eIndexError
+rb_eInterrupt
+rb_eLoadError
+rb_eNameError
+rb_eNoMemError
+rb_eNoMethodError
+rb_eNotImpError
+rb_eRangeError
+rb_eRuntimeError
+rb_eScriptError
+rb_eSecurityError
+rb_eSignal
+rb_eStandardError
+rb_eSyntaxError
+rb_eSystemCallError
+rb_eSystemExit
+rb_eTypeError
+rb_eZeroDivError
+rb_each
+rb_enable_super
+rb_ensure
+rb_env_path_tainted
+rb_eof_error
+rb_eql
+rb_equal
+rb_error_frozen
+rb_eval_cmd
+rb_eval_string
+rb_eval_string_protect
+rb_eval_string_wrap
+rb_exc_fatal
+rb_exc_new
+rb_exc_new2
+rb_exc_new3
+rb_exc_raise
+rb_exec_end_proc
+rb_exit
+rb_extend_object
+rb_f_autoload
+rb_f_exec
+rb_f_global_variables
+rb_f_kill
+rb_f_lambda
+rb_f_require
+rb_f_sprintf
+rb_f_trace_var
+rb_f_untrace_var
+rb_fatal
+rb_fdopen
+rb_file_const
+rb_file_open
+rb_file_s_expand_path
+rb_file_sysopen
+rb_find_file
+rb_find_file_ext
+rb_fix2int
+rb_fix2str
+rb_float_new
+rb_fopen
+rb_frame_last_func
+rb_free_generic_ivar
+rb_frozen_class_p
+rb_fs
+rb_funcall
+rb_funcall2
+rb_funcall3
+rb_gc
+rb_gc_call_finalizer_at_exit
+rb_gc_disable
+rb_gc_enable
+rb_gc_force_recycle
+rb_gc_mark
+rb_gc_mark_frame
+rb_gc_mark_global_tbl
+rb_gc_mark_locations
+rb_gc_mark_maybe
+rb_gc_mark_parser
+rb_gc_mark_threads
+rb_gc_mark_trap_list
+rb_gc_register_address
+rb_gc_stack_start
+rb_gc_start
+rb_gc_unregister_address
+rb_generic_ivar_table
+rb_get_kcode
+rb_getc
+rb_gets
+rb_glob
+rb_global_entry
+rb_global_variable
+rb_globi
+rb_gv_get
+rb_gv_set
+rb_gvar_defined
+rb_gvar_get
+rb_gvar_set
+rb_hash
+rb_hash_aref
+rb_hash_aset
+rb_hash_delete
+rb_hash_delete_if
+rb_hash_freeze
+rb_hash_new
+rb_hash_reject_bang
+rb_hash_select
+rb_id2name
+rb_id_attrset
+rb_include_module
+rb_inspect
+rb_inspecting_p
+rb_int2big
+rb_int2inum
+rb_intern
+rb_interrupt
+rb_invalid_str
+rb_io_addstr
+rb_io_binmode
+rb_io_check_closed
+rb_io_check_readable
+rb_io_check_writable
+rb_io_close
+rb_io_eof
+rb_io_fptr_finalize
+rb_io_fread
+rb_io_getc
+rb_io_gets
+rb_io_mode_flags
+rb_io_print
+rb_io_printf
+rb_io_puts
+rb_io_synchronized
+rb_io_taint_check
+rb_io_unbuffered
+rb_io_ungetc
+rb_io_wait_readable
+rb_io_wait_writable
+rb_io_write
+rb_is_class_id
+rb_is_const_id
+rb_is_instance_id
+rb_is_junk_id
+rb_is_local_id
+rb_iter_break
+rb_iterate
+rb_iterator_p
+rb_iv_get
+rb_iv_set
+rb_ivar_defined
+rb_ivar_get
+rb_ivar_set
+rb_jump_tag
+rb_kcode
+rb_last_status
+rb_lastline_get
+rb_lastline_set
+rb_ll2big
+rb_ll2inum
+rb_load
+rb_load_fail
+rb_load_file
+rb_load_path
+rb_load_protect
+rb_loaderror
+rb_mComparable
+rb_mEnumerable
+rb_mErrno
+rb_mFileTest
+rb_mGC
+rb_mKernel
+rb_mMath
+rb_mPrecision
+rb_mProcess
+rb_make_metaclass
+rb_mark_end_proc
+rb_mark_generic_ivar
+rb_mark_generic_ivar_tbl
+rb_mark_hash
+rb_mark_tbl
+rb_marshal_dump
+rb_marshal_load
+rb_match_busy
+rb_mem_clear
+rb_memcicmp
+rb_memcmp
+rb_memerror
+rb_method_boundp
+rb_mod_ancestors
+rb_mod_class_variables
+rb_mod_clone
+rb_mod_const_at
+rb_mod_const_of
+rb_mod_constants
+rb_mod_dup
+rb_mod_include_p
+rb_mod_included_modules
+rb_mod_module_eval
+rb_mod_name
+rb_mod_remove_const
+rb_mod_remove_cvar
+rb_module_new
+rb_name_class
+rb_name_error
+rb_newobj
+rb_node_newnode
+rb_notimplement
+rb_num2dbl
+rb_num2fix
+rb_num2int
+rb_num2ll
+rb_num2long
+rb_num2ull
+rb_num2ulong
+rb_num_coerce_bin
+rb_num_zerodiv
+rb_obj_alloc
+rb_obj_as_string
+rb_obj_become
+rb_obj_call_init
+rb_obj_class
+rb_obj_clone
+rb_obj_dup
+rb_obj_freeze
+rb_obj_id
+rb_obj_id_obsolete
+rb_obj_instance_eval
+rb_obj_instance_variables
+rb_obj_is_instance_of
+rb_obj_is_kind_of
+rb_obj_remove_instance_variable
+rb_obj_singleton_methods
+rb_obj_taint
+rb_obj_tainted
+rb_obj_type
+rb_obj_untaint
+rb_origenviron
+rb_output_fs
+rb_output_rs
+rb_p
+rb_parser_append_print
+rb_parser_while_loop
+rb_path2class
+rb_path_check
+rb_proc_exec
+rb_proc_new
+rb_proc_times
+rb_progname
+rb_prohibit_interrupt
+rb_protect
+rb_protect_inspect
+rb_provide
+rb_provided
+rb_quad_pack
+rb_quad_unpack
+rb_raise
+rb_range_beg_len
+rb_range_new
+rb_read_check
+rb_read_pending
+rb_reg_adjust_startpos
+rb_reg_last_match
+rb_reg_match
+rb_reg_match2
+rb_reg_match_last
+rb_reg_match_post
+rb_reg_match_pre
+rb_reg_mbclen2
+rb_reg_new
+rb_reg_nth_defined
+rb_reg_nth_match
+rb_reg_options
+rb_reg_quote
+rb_reg_regcomp
+rb_reg_regsub
+rb_reg_search
+rb_remove_method
+rb_require
+rb_rescue
+rb_rescue2
+rb_reserved_word
+rb_respond_to
+rb_rs
+rb_scan_args
+rb_secure
+rb_set_class_path
+rb_set_end_proc
+rb_set_kcode
+rb_set_safe_level
+rb_singleton_class
+rb_singleton_class_attached
+rb_singleton_class_clone
+rb_source_filename
+rb_stderr
+rb_stdin
+rb_stdout
+rb_str2cstr
+rb_str2inum
+rb_str_append
+rb_str_associate
+rb_str_associated
+rb_str_buf_append
+rb_str_buf_cat
+rb_str_buf_cat2
+rb_str_buf_new
+rb_str_buf_new2
+rb_str_cat
+rb_str_cat2
+rb_str_cmp
+rb_str_concat
+rb_str_dump
+rb_str_dup
+rb_str_dup_frozen
+rb_str_freeze
+rb_str_hash
+rb_str_inspect
+rb_str_intern
+rb_str_modify
+rb_str_new
+rb_str_new2
+rb_str_new3
+rb_str_new4
+rb_str_new5
+rb_str_plus
+rb_str_resize
+rb_str_setter
+rb_str_split
+rb_str_substr
+rb_str_times
+rb_str_to_dbl
+rb_str_to_inum
+rb_str_to_str
+rb_str_update
+rb_str_upto
+rb_string_value
+rb_string_value_ptr
+rb_struct_alloc
+rb_struct_aref
+rb_struct_aset
+rb_struct_define
+rb_struct_getmember
+rb_struct_iv_get
+rb_struct_new
+rb_svar
+rb_sym_all_symbols
+rb_sys_fail
+rb_sys_warning
+rb_syswait
+rb_tainted_str_new
+rb_tainted_str_new2
+rb_thread_alone
+rb_thread_atfork
+rb_thread_create
+rb_thread_critical
+rb_thread_current
+rb_thread_fd_close
+rb_thread_fd_writable
+rb_thread_interrupt
+rb_thread_list
+rb_thread_local_aref
+rb_thread_local_aset
+rb_thread_main
+rb_thread_pending
+rb_thread_polling
+rb_thread_run
+rb_thread_schedule
+rb_thread_select
+rb_thread_signal_raise
+rb_thread_sleep
+rb_thread_sleep_forever
+rb_thread_stop
+rb_thread_tick
+rb_thread_trap_eval
+rb_thread_wait_fd
+rb_thread_wait_for
+rb_thread_wakeup
+rb_throw
+rb_time_interval
+rb_time_new
+rb_time_timeval
+rb_to_id
+rb_to_int
+rb_trap_exec
+rb_trap_exit
+rb_trap_immediate
+rb_trap_pending
+rb_trap_restore_mask
+rb_uint2big
+rb_uint2inum
+rb_ull2big
+rb_ull2inum
+rb_undef
+rb_undef_method
+rb_w32_accept
+rb_w32_asynchronize
+rb_w32_bind
+rb_w32_close
+rb_w32_closedir
+rb_w32_connect
+rb_w32_enter_critical
+rb_w32_fclose
+rb_w32_fdclr
+rb_w32_fdisset
+rb_w32_fdset
+rb_w32_free_environ
+rb_w32_get_environ
+rb_w32_get_osfhandle
+rb_w32_getc
+rb_w32_getcwd
+rb_w32_getenv
+rb_w32_gethostbyaddr
+rb_w32_gethostbyname
+rb_w32_gethostname
+rb_w32_getpeername
+rb_w32_getpid
+rb_w32_getprotobyname
+rb_w32_getprotobynumber
+rb_w32_getservbyname
+rb_w32_getservbyport
+rb_w32_getsockname
+rb_w32_getsockopt
+rb_w32_ioctlsocket
+rb_w32_leave_critical
+rb_w32_listen
+rb_w32_main_context
+rb_w32_opendir
+rb_w32_putc
+rb_w32_readdir
+rb_w32_recv
+rb_w32_recvfrom
+rb_w32_rename
+rb_w32_rewinddir
+rb_w32_seekdir
+rb_w32_select
+rb_w32_send
+rb_w32_sendto
+rb_w32_setsockopt
+rb_w32_shutdown
+rb_w32_sleep
+rb_w32_socket
+rb_w32_stat
+rb_w32_strerror
+rb_w32_telldir
+rb_w32_times
+rb_waitpid
+rb_warn
+rb_warning
+rb_with_disable_interrupt
+rb_yield
+re_mbctab
+re_set_syntax
+ruby__end__seen
+ruby_add_suffix
+ruby_class
+ruby_cleanup
+ruby_current_node
+ruby_debug
+ruby_dln_librefs
+ruby_dyna_vars
+ruby_errinfo
+ruby_eval_tree
+ruby_eval_tree_begin
+ruby_exec
+ruby_finalize
+ruby_frame
+ruby_getcwd
+ruby_ignorecase
+ruby_in_compile
+ruby_in_eval
+ruby_incpush
+ruby_init
+ruby_init_loadpath
+ruby_inplace_mode
+ruby_nerrs
+ruby_options
+ruby_parser_stack_on_heap
+ruby_process_options
+ruby_prog_init
+ruby_qsort
+ruby_re_adjust_startpos
+ruby_re_compile_fastmap
+ruby_re_compile_pattern
+ruby_re_copy_registers
+ruby_re_free_pattern
+ruby_re_free_registers
+ruby_re_match
+ruby_re_mbcinit
+ruby_re_search
+ruby_re_set_casetable
+ruby_run
+ruby_safe_level
+ruby_scan_hex
+ruby_scan_oct
+ruby_scope
+ruby_script
+ruby_set_argv
+ruby_set_current_source
+ruby_setenv
+ruby_show_copyright
+ruby_show_version
+ruby_sourcefile
+ruby_sourceline
+ruby_stack_check
+ruby_stack_length
+ruby_stop
+ruby_strdup
+ruby_strtod
+ruby_top_self
+ruby_unsetenv
+ruby_verbose
+ruby_xcalloc
+ruby_xfree
+ruby_xmalloc
+ruby_xrealloc
+ruby_yychar
+ruby_yydebug
+ruby_yylval
+ruby_yyparse
+setgid
+sethostent
+setnetent
+setprotoent
+setservent
+setuid
+st_add_direct
+st_cleanup_safe
+st_copy
+st_delete
+st_delete_safe
+st_foreach
+st_free_table
+st_init_numtable
+st_init_numtable_with_size
+st_init_strtable
+st_init_strtable_with_size
+st_init_table
+st_init_table_with_size
+st_insert
+st_lookup
+wait
+waitpid
+yycheck
+yydefred
+yydgoto
+yyerrflag
+yygindex
+yylen
+yylhs
+yyname
+yynerrs
+yyrindex
+yyrule
+yysindex
+yyss
+yyssp
+yytable
+yyval
+yyvs
+yyvsp
+wce_SetCommandLine
diff --git a/wince/process.c b/wince/process.c
new file mode 100644
index 0000000000..4415ad024e
--- /dev/null
+++ b/wince/process.c
@@ -0,0 +1,47 @@
+/***************************************************************
+ process.c
+***************************************************************/
+
+#include <windows.h>
+#include "process.h"
+
+int _getpid(void)
+{
+ return (int)GetCurrentProcessId();
+}
+
+/* I wonder _exec and _swawn should be replaced with CreateProcess... */
+int _execl(const char *cmdname, const char *arg0,
+ va_list va_args)
+{
+ return 0;
+}
+
+int execv(const char *path, char *const argv[])
+{
+ return 0;
+}
+
+void abort(void)
+{
+}
+
+int _cwait( int *termstat, int procHandle, int action )
+{
+ return 0;
+}
+
+intptr_t _spawnle(int mode,
+ const char *cmdname, const char *arg0,
+ va_list va_argn)
+{
+ return 0;
+}
+
+intptr_t _spawnvpe(int mode,
+ const char *cmdname, const char *const *argv,
+ const char *const *envp)
+{
+ return 0;
+}
+
diff --git a/wince/process.h b/wince/process.h
new file mode 100644
index 0000000000..e4e9a32d1a
--- /dev/null
+++ b/wince/process.h
@@ -0,0 +1,44 @@
+#ifndef PROCESS_H
+#define PROCESS_H 1
+
+
+#define _P_WAIT 0
+#define _P_NOWAIT 1
+#define _P_DETACH 4
+
+#define P_WAIT _P_WAIT
+#define P_NOWAIT _P_NOWAIT
+#define P_DETACH _P_DETACH
+
+#ifndef _INTPTR_T_DEFINED
+typedef int intptr_t;
+#define _INTPTR_T_DEFINED
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int _getpid(void);
+
+int _cwait(int *, int, int);
+void abort(void);
+
+int _execl(const char *, const char *, ...);
+//int _execv(const char *, const char * const *);
+int execv(const char *path, char *const argv[]);
+
+intptr_t _spawnle(int, const char *, const char *, ...);
+intptr_t _spawnvpe(int, const char *, const char * const *,
+ const char * const *);
+
+#ifdef __cplusplus
+};
+#endif
+
+//#define getpid _getpid
+#define execl _execl
+#define execv _execv
+
+
+#endif
diff --git a/wince/signal.c b/wince/signal.c
new file mode 100644
index 0000000000..95f85e0ac8
--- /dev/null
+++ b/wince/signal.c
@@ -0,0 +1,26 @@
+/***************************************************************
+ signal.c
+***************************************************************/
+
+#include <windows.h>
+#include "signal.h"
+
+/* lazy replacement... (^^; */
+int raise(int sig)
+{
+ return 0;
+}
+
+//#ifdef _WIN32_WCE
+//#ifdef _WIN32_WCE_EMULATION
+//void (* signal(int sig, void (*func)))
+//{
+// return sig;
+//}
+//#else
+void (* signal(int sig, void (__cdecl *func)(int)))(int)
+{
+ return sig;
+}
+//#endif
+//#endif
diff --git a/wince/signal.h b/wince/signal.h
new file mode 100644
index 0000000000..95f857dd88
--- /dev/null
+++ b/wince/signal.h
@@ -0,0 +1,71 @@
+#ifndef SIGNAL_H
+#define SIGNAL_H 1
+
+#include <sys/types.h>
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGPIPE 5
+#define SIGFPE 8
+#define SIGUSR1 10
+#define SIGSEGV 11
+#define SIGUSR2 12
+#define SIGTERM 15
+#define SIGCHLD 17
+#define SIGTSTP 20
+#define SIGBREAK 21
+#define SIGABRT 22
+#define NSIG 22
+
+#define SA_NOCLDSTOP 1
+#define SA_SHIRQ 0x04000000
+#define SA_STACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_INTERRUPT 0x20000000
+#define SA_NOMASK 0x40000000
+#define SA_ONESHOT 0x80000000
+
+/* signal action codes */
+
+#define SIG_DFL (void (*)(int))0 /* default signal action */
+#define SIG_IGN (void (*)(int))1 /* ignore signal */
+#define SIG_SGE (void (*)(int))3 /* signal gets error */
+#define SIG_ACK (void (*)(int))4 /* acknowledge */
+#define SIG_ERR (void (*)(int))-1 /* signal error value */
+
+#define SIG_BLOCK 0 /* for blocking signals */
+#define SIG_UNBLOCK 1 /* for unblocking signals */
+#define SIG_SETMASK 2 /* for setting the signal mask */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (* SIGHANDLER)(int);
+typedef void (* sighandler_t)(int);
+
+typedef int sig_atomic_t;
+typedef unsigned int sigset_t;
+
+struct sigaction{
+ sighandler_t sa_handler;
+ sigset_t sa_mask;
+ unsigned long sa_flags;
+ void (*sa_restorer)(void);
+};
+
+int raise(int sig);
+//#ifndef _WIN32_WCE_EMULATION
+ void (* signal(int sig, void (__cdecl *func)(int)))(int);
+//#else
+// void (* signal(int sig, void (*func)));
+//#endif
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/wince/stddef.h b/wince/stddef.h
new file mode 100644
index 0000000000..227725020e
--- /dev/null
+++ b/wince/stddef.h
@@ -0,0 +1,5 @@
+
+#ifndef _STDDEF_H_
+#define _STDDEF_H_
+
+#endif
diff --git a/wince/stdio.c b/wince/stdio.c
new file mode 100644
index 0000000000..9047a9ab0f
--- /dev/null
+++ b/wince/stdio.c
@@ -0,0 +1,36 @@
+/***************************************************************
+ stdio.c
+***************************************************************/
+
+#include <windows.h>
+#include "wince.h" /* for wce_mbtowc */
+
+
+FILE *freopen(const char *filename, const char *mode, FILE *file)
+{
+ wchar_t *wfilename, *wmode;
+ FILE *fp;
+
+ wfilename = wce_mbtowc(filename);
+ wmode = wce_mbtowc(mode);
+
+ fp = _wfreopen(wfilename, wmode, file);
+
+ free(wfilename);
+ free(wmode);
+
+ return fp;
+}
+
+FILE *_fdopen( int handle, const char *mode )
+{
+ wchar_t *wmode;
+ FILE* fp;
+
+ wmode = wce_mbtowc(mode);
+ fp = _wfdopen( (void*)handle, wmode );
+
+ free(wmode);
+ return fp;
+}
+
diff --git a/wince/stdlib.c b/wince/stdlib.c
new file mode 100644
index 0000000000..b3d5f3bb6e
--- /dev/null
+++ b/wince/stdlib.c
@@ -0,0 +1,22 @@
+/***************************************************************
+ stdlib.c
+***************************************************************/
+
+#include <windows.h>
+
+char **environ;
+extern char * rb_w32_getenv(const char *);
+
+/* getenv should replace with rb_w32_getenv. */
+char *getenv(const char *env)
+{
+ return rb_w32_getenv(env);
+}
+
+char *_fullpath(char *absPath, const char *relPath,
+ size_t maxLength)
+{
+ strcpy( absPath, relPath );
+ return absPath;
+}
+
diff --git a/wince/string.c b/wince/string.c
new file mode 100644
index 0000000000..eb95d94d47
--- /dev/null
+++ b/wince/string.c
@@ -0,0 +1,71 @@
+/***************************************************************
+ string.c
+***************************************************************/
+
+#include <windows.h>
+#include "wince.h" /* for wce_mbtowc */
+
+extern char* rb_w32_strerror(int errno);
+
+/* _strdup already exists in stdlib.h? */
+char *strdup(const char * str)
+{
+ char *p;
+
+ p = malloc( strlen(str)+1 );
+ strcpy( p, str );
+ return p;
+}
+
+/* strerror shoud replace with rb_w32_strerror. */
+char* strerror(int errno)
+{
+ return rb_w32_strerror(errno);
+}
+
+/* _strnicmp already exists in stdlib.h? */
+int _strnicmp( const char *s1, const char *s2, size_t count )
+{
+ wchar_t *w1, *w2;
+ int n;
+
+ w1 = wce_mbtowc(s1);
+ w2 = wce_mbtowc(s2);
+
+ n = wcsnicmp(w1, w2, count);
+
+ free(w1);
+ free(w2);
+
+ return n;
+}
+
+#if _WIN32_WCE < 300
+#include "..\missing\strtoul.c"
+
+char *strrchr( const char *p, int c )
+{
+ char *pp;
+ for( pp=(char*)p+strlen(p); pp!=p; p-- )
+ {
+ if( *pp==c ) break;
+ }
+ return pp==p ? NULL : pp;
+}
+
+int _stricmp( const char *s1, const char *s2 )
+{
+ wchar_t *w1, *w2;
+ int n;
+
+ w1 = wce_mbtowc(s1);
+ w2 = wce_mbtowc(s2);
+
+ n = wcsicmp(w1, w2);
+
+ free(w1);
+ free(w2);
+
+ return n;
+}
+#endif
diff --git a/wince/time.c b/wince/time.c
new file mode 100644
index 0000000000..81afe5152f
--- /dev/null
+++ b/wince/time.c
@@ -0,0 +1,299 @@
+/***************************************************************
+ time.c
+
+ author : uema2
+ date : Nov 30, 2002
+
+ You can freely use, copy, modify, and redistribute
+ the whole contents.
+***************************************************************/
+
+/*#define __SCRATCH_TIMEC_DEBUG__ */
+
+#include <windows.h>
+#include <tchar.h>
+#include <time.h>
+
+/* globals */
+const __int64 _onesec_in100ns = (__int64)10000000;
+int timezone, _timezone, altzone;
+int daylight;
+char *tzname[2];
+
+
+/* __int64 <--> FILETIME */
+static __int64 wce_FILETIME2int64(FILETIME f)
+{
+ __int64 t;
+
+ t = f.dwHighDateTime;
+ t <<= 32;
+ t |= f.dwLowDateTime;
+ return t;
+}
+
+static FILETIME wce_int642FILETIME(__int64 t)
+{
+ FILETIME f;
+
+ f.dwHighDateTime = (DWORD)((t >> 32) & 0x00000000FFFFFFFF);
+ f.dwLowDateTime = (DWORD)( t & 0x00000000FFFFFFFF);
+ return f;
+}
+
+/* FILETIME utility */
+static FILETIME wce_getFILETIMEFromYear(WORD year)
+{
+ SYSTEMTIME s={0};
+ FILETIME f;
+
+ s.wYear = year;
+ s.wMonth = 1;
+ s.wDayOfWeek = 1;
+ s.wDay = 1;
+
+ SystemTimeToFileTime( &s, &f );
+ return f;
+}
+
+static time_t wce_getYdayFromSYSTEMTIME(const SYSTEMTIME* s)
+{
+ __int64 t;
+ FILETIME f1, f2;
+
+ f1 = wce_getFILETIMEFromYear( s->wYear );
+ SystemTimeToFileTime( s, &f2 );
+
+ t = wce_FILETIME2int64(f2)-wce_FILETIME2int64(f1);
+
+ return (time_t)((t/_onesec_in100ns)/(60*60*24));
+}
+
+/* tm <--> SYSTEMTIME */
+static SYSTEMTIME wce_tm2SYSTEMTIME(struct tm *t)
+{
+ SYSTEMTIME s;
+
+ s.wYear = t->tm_year + 1900;
+ s.wMonth = t->tm_mon + 1;
+ s.wDayOfWeek = t->tm_wday;
+ s.wDay = t->tm_mday;
+ s.wHour = t->tm_hour;
+ s.wMinute = t->tm_min;
+ s.wSecond = t->tm_sec;
+ s.wMilliseconds = 0;
+
+ return s;
+}
+
+static struct tm wce_SYSTEMTIME2tm(SYSTEMTIME *s)
+{
+ struct tm t;
+
+ t.tm_year = s->wYear - 1900;
+ t.tm_mon = s->wMonth- 1;
+ t.tm_wday = s->wDayOfWeek;
+ t.tm_mday = s->wDay;
+ t.tm_yday = wce_getYdayFromSYSTEMTIME(s);
+ t.tm_hour = s->wHour;
+ t.tm_min = s->wMinute;
+ t.tm_sec = s->wSecond;
+ t.tm_isdst = 0;
+
+ return t;
+}
+
+/* FILETIME <--> time_t */
+time_t wce_FILETIME2time_t(const FILETIME* f)
+{
+ FILETIME f1601, f1970;
+ __int64 t, offset;
+
+ f1601 = wce_getFILETIMEFromYear(1601);
+ f1970 = wce_getFILETIMEFromYear(1970);
+
+ offset = wce_FILETIME2int64(f1970) - wce_FILETIME2int64(f1601);
+
+ t = wce_FILETIME2int64(*f);
+
+ t -= offset;
+ return (time_t)(t / _onesec_in100ns);
+}
+
+FILETIME wce_time_t2FILETIME(const time_t t)
+{
+ FILETIME f, f1970;
+ __int64 time;
+
+ f1970 = wce_getFILETIMEFromYear(1970);
+
+ time = t;
+ time *= _onesec_in100ns;
+ time += wce_FILETIME2int64(f1970);
+
+ f = wce_int642FILETIME(time);
+
+ return f;
+}
+
+/* time.h difinition */
+time_t time( time_t *timer )
+{
+ SYSTEMTIME s;
+ FILETIME f;
+
+ GetSystemTime( &s );
+
+ SystemTimeToFileTime( &s, &f );
+
+ *timer = wce_FILETIME2time_t(&f);
+ return *timer;
+}
+
+struct tm *localtime( const time_t *timer )
+{
+ SYSTEMTIME ss, ls, s;
+ FILETIME sf, lf, f;
+ __int64 t, diff;
+ static struct tm tms;
+
+ GetSystemTime(&ss);
+ GetLocalTime(&ls);
+
+ SystemTimeToFileTime( &ss, &sf );
+ SystemTimeToFileTime( &ls, &lf );
+
+ diff = wce_FILETIME2int64(sf) - wce_FILETIME2int64(lf);
+
+ f = wce_time_t2FILETIME(*timer);
+ t = wce_FILETIME2int64(f) - diff;
+ f = wce_int642FILETIME(t);
+
+ FileTimeToSystemTime( &f, &s );
+
+ tms = wce_SYSTEMTIME2tm(&s);
+
+ return &tms;
+}
+
+time_t mktime(struct tm* pt)
+{
+ SYSTEMTIME ss, ls, s;
+ FILETIME sf, lf, f;
+ __int64 diff;
+
+ GetSystemTime(&ss);
+ GetLocalTime(&ls);
+ SystemTimeToFileTime( &ss, &sf );
+ SystemTimeToFileTime( &ls, &lf );
+
+ diff = (wce_FILETIME2int64(lf)-wce_FILETIME2int64(sf))/_onesec_in100ns;
+
+ s = wce_tm2SYSTEMTIME(pt);
+ SystemTimeToFileTime( &s, &f );
+ return wce_FILETIME2time_t(&f) - (time_t)diff;
+}
+
+struct tm *gmtime(const time_t *t)
+{
+ FILETIME f;
+ SYSTEMTIME s;
+ static struct tm tms;
+
+ f = wce_time_t2FILETIME(*t);
+ FileTimeToSystemTime(&f, &s);
+ tms = wce_SYSTEMTIME2tm(&s);
+ return &tms;
+}
+
+char* ctime( const time_t *t )
+{
+ // Wed Jan 02 02:03:55 1980\n\0
+ static char buf[30]={0};
+ char week[] = "Sun Mon Tue Wed Thr Fri Sat ";
+ char month[]= "Jan Feb Mar Apl May Jun Jul Aug Sep Oct Nov Dec ";
+ struct tm tms;
+
+ tms = *localtime(t);
+
+ strncpy( buf, week+tms.tm_wday*4, 4 );
+ strncpy( buf+4, month+tms.tm_mon*4, 4 );
+ sprintf( buf+8, "%02d ", tms.tm_mday );
+ sprintf( buf+11, "%02d:%02d:%02d %d\n",
+ tms.tm_hour, tms.tm_min, tms.tm_sec, tms.tm_year+1900 );
+ return buf;
+}
+
+char *asctime(const struct tm *pt)
+{
+ static char buf[30]={0};
+ char week[] = "Sun Mon Tue Wed Thr Fri Sat ";
+ char month[]= "Jan Feb Mar Apl May Jun Jul Aug Sep Oct Nov Dec ";
+
+ strncpy( buf, week+pt->tm_wday*4, 4 );
+ strncpy( buf+4, month+pt->tm_mon*4, 4 );
+ sprintf( buf+8, "%02d ", pt->tm_mday );
+ sprintf( buf+11, "%02d:%02d:%02d %d\n",
+ pt->tm_hour, pt->tm_min, pt->tm_sec, pt->tm_year+1900 );
+ return buf;
+}
+
+void tzset()
+{
+ daylight = 1;
+ _timezone = 28800;
+ timezone = 28800;
+}
+
+int clock(void)
+{
+ return 1;
+}
+
+//---------------------------------------------------------------
+#ifdef __SCRATCH_TIMEC_DEBUG__
+
+int main()
+{
+ time_t t1, t2;
+ struct tm tm1, tm2;
+
+ time( &t1 );
+ tm1 = *localtime(&t1);
+ t1 = mktime(&tm1);
+ tm1 = *gmtime(&t1);
+
+ _time( &t2 );
+ tm2 = *_localtime(&t2);
+ t2 = _mktime(&tm2);
+ tm2 = *_gmtime(&t2);
+
+ // time, mktime
+ if( t1==t2 )
+ OutputDebugString( "ok\n" );
+ else
+ {
+ static char buf[128];
+ wsprintf( buf, "ng : %d, %d\n", t1, t2 );
+ OutputDebugString( buf );
+ }
+
+ // localtime, gmtime
+ if( 0==memcmp( &tm1, &tm2, sizeof(struct tm) ) )
+ OutputDebugString( "ok\n" );
+ else
+ OutputDebugString( "ng\n" );
+
+ // ctime
+ OutputDebugString( ctime(&t1) );
+ OutputDebugString( _ctime(&t2) );
+
+ // asctime
+ OutputDebugString( asctime(&tm1) );
+ OutputDebugString( _asctime(&tm2) );
+
+ return 0;
+}
+
+#endif
+
diff --git a/wince/time.h b/wince/time.h
new file mode 100644
index 0000000000..85f774cdca
--- /dev/null
+++ b/wince/time.h
@@ -0,0 +1,63 @@
+#ifndef TIME_H
+#define TIME_H 1
+
+#include <winbase.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int daylight;
+extern int _timezone, timezone;
+extern char *tzname[2];
+
+#if 0
+#define _DAY_SEC (24L * 60L * 60L) /* secs in a day */
+#define _YEAR_SEC (365L * _DAY_SEC) /* secs in a year */
+#define _FOUR_YEAR_SEC (1461L * _DAY_SEC) /* secs in a 4 year interval */
+#define _DEC_SEC 315532800L /* secs in 1970-1979 */
+#define _BASE_YEAR 70L /* 1970 is the base year */
+#define _BASE_DOW 4 /* 01-01-70 was a Thursday */
+#define _LEAP_YEAR_ADJUST 17L /* Leap years 1900 - 1970 */
+#define _MAX_YEAR 138L /* 2038 is the max year */
+#endif
+
+#ifndef _TM_DEFINED
+struct tm {
+ int tm_sec; /* seconds after the minute - [0,59] */
+ int tm_min; /* minutes after the hour - [0,59] */
+ int tm_hour; /* hours since midnight - [0,23] */
+ int tm_mday; /* day of the month - [1,31] */
+ int tm_mon; /* months since January - [0,11] */
+ int tm_year; /* years since 1900 */
+ int tm_wday; /* days since Sunday - [0,6] */
+ int tm_yday; /* days since January 1 - [0,365] */
+ int tm_isdst; /* daylight savings time flag */
+};
+#define _TM_DEFINED
+#endif
+
+
+typedef struct {
+ int yr; // year of interest
+ int yd; // day of year
+ long ms; // milli-seconds in the day
+} transitionTime;
+
+time_t mktime(struct tm* pt);
+time_t time( time_t *timer );
+struct tm *localtime(const time_t *ptime);
+struct tm *gmtime(const time_t *tod);
+char* ctime( const time_t *t );
+char* asctime(const struct tm *tptr);
+void tzset();
+int clock(void);
+time_t wce_FILETIME2time_t(const FILETIME* pf);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/wince/varargs.h b/wince/varargs.h
new file mode 100644
index 0000000000..2d1d476ccd
--- /dev/null
+++ b/wince/varargs.h
@@ -0,0 +1,34 @@
+
+#ifndef VARARGS_H
+#define VARARGS_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _VA_LIST_DEFINED
+typedef char *va_list;
+#define _VA_LIST_DEFINED
+#endif
+
+//#ifdef MIPS
+#define va_alist __va_alist, __va_alist2, __va_alist3, __va_alist4
+#define va_dcl int __va_alist, __va_alist2, __va_alist3, __va_alist4;
+#define va_start(list) list = (char *) &__va_alist
+#define va_end(list)
+#define va_arg(list, mode) ((mode *)(list =\
+ (char *) ((((int)list + (__builtin_alignof(mode)<=4?3:7)) &\
+ (__builtin_alignof(mode)<=4?-4:-8))+sizeof(mode))))[-1]
+#else
+#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
+#define va_dcl va_list va_alist;
+#define va_start(ap) ap = (va_list)&va_alist
+#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
+#define va_end(ap) ap = (va_list)0
+//#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/wince/wince.c b/wince/wince.c
new file mode 100644
index 0000000000..e227fe528e
--- /dev/null
+++ b/wince/wince.c
@@ -0,0 +1,535 @@
+/***************************************************************
+ wince.c
+
+ author : uema2
+ date : Nov 30, 2002
+
+ You can freely use, copy, modify, and redistribute
+ the whole contents.
+***************************************************************/
+
+#include <windows.h>
+#include <tchar.h>
+#include "wince.h"
+
+/* global for GetCommandLineA */
+char *_commandLine;
+
+/* make up Win32API except wce_* functions. */
+
+DWORD GetModuleFileNameA(
+ HMODULE hModule, LPSTR lpFileName,
+ DWORD size )
+{
+ LPWSTR lpFileNameW;
+ LPSTR mb;
+ size_t len;
+
+ lpFileNameW = (LPWSTR)malloc( size*sizeof(wchar_t) );
+ GetModuleFileNameW( hModule, lpFileNameW, size );
+ mb = wce_wctomb(lpFileNameW);
+ len = min(strlen(mb),size);
+ strncpy(lpFileName, mb, len);
+ lpFileName[len-1] = '\0';
+ free(mb);
+ free(lpFileNameW);
+
+ return 0;
+}
+
+#if _WIN32_WCE < 300
+FARPROC GetProcAddressA(HMODULE hModule, LPCSTR lpProcName)
+{
+ FARPROC p;
+ LPWSTR lpwProcName;
+
+ lpwProcName = wce_mbtowc( lpProcName );
+ p = GetProcAddressW( hModule, lpwProcName );
+ free( lpwProcName );
+ return p;
+}
+#endif
+
+char * GetCommandLineA(void)
+{
+ return _commandLine;
+}
+
+/* this is not Win32API. GetCommandLineA helper. */
+void wce_SetCommandLine(LPCWSTR wcmd)
+{
+ char* acmd;
+
+ acmd = wce_wctomb( wcmd );
+ _commandLine = (char*)malloc( strlen(acmd)+5 );
+ sprintf( _commandLine, "ruby %s", acmd );
+ free(acmd);
+}
+
+/* this is not Win32API. GetCommandLineA helper. */
+void wce_FreeCommandLine(void)
+{
+ free(_commandLine);
+ _commandLine = NULL;
+}
+
+/* I have no idea how to replace this. */
+BOOL GetProcessTimes(HANDLE hprocess,
+ LPFILETIME lpCreationTime, LPFILETIME lpExitTime,
+ LPFILETIME lpKernelTime, LPFILETIME lpUserTime)
+{
+ return 0;
+}
+
+/* -------------- file attributes functions. ------------------- */
+DWORD GetFileAttributesA(LPCSTR lpFileName)
+{
+ LPWSTR lpwFileName;
+ DWORD dw;
+
+ lpwFileName = wce_mbtowc(lpFileName);
+ dw = GetFileAttributesW(lpwFileName);
+ free(lpwFileName);
+ return dw;
+}
+
+BOOL SetFileAttributesA(
+ LPCSTR lpFileName, DWORD attributes)
+{
+ LPWSTR lpwFileName;
+ BOOL b;
+
+ lpwFileName = wce_mbtowc(lpFileName);
+ b = SetFileAttributesW(lpwFileName, attributes);
+ free(lpwFileName);
+ return b;
+}
+
+/* --------------- move and remove functions. ------------------- */
+BOOL MoveFileA(LPCSTR fn1, LPCSTR fn2)
+{
+ LPWSTR wfn1, wfn2;
+ BOOL b;
+
+ wfn1 = wce_mbtowc(fn1);
+ wfn2 = wce_mbtowc(fn2);
+ b = MoveFileW(wfn1, wfn2);
+ free(wfn1);
+ free(wfn2);
+ return 0;
+}
+
+BOOL MoveFileEx(LPCSTR oldname, LPCSTR newname, DWORD dwFlags)
+{
+ LPWSTR woldname, wnewname;
+ BOOL b;
+
+ woldname = wce_mbtowc(oldname);
+ wnewname = wce_mbtowc(newname);
+
+ if( (dwFlags&MOVEFILE_REPLACE_EXISTING)!=0 )
+ DeleteFileW( wnewname );
+
+ b = MoveFileW( woldname, wnewname );
+
+ free(woldname);
+ free(wnewname);
+
+ return b;
+}
+
+BOOL DeleteFileA(LPCSTR path)
+{
+ LPWSTR wpath;
+ BOOL b;
+
+ wpath = wce_mbtowc(path);
+ b = DeleteFileW(wpath);
+ free(wpath);
+ return 0;
+}
+
+/* --------------- EnvironmentVariable functions. ----------------- */
+DWORD GetEnvironmentVariable(
+ LPCSTR name, LPSTR value, DWORD size)
+{
+ /* use registry instead of "environment valuable". */
+ HKEY hk;
+ LONG lret;
+ LPBYTE lpData;
+ DWORD dwType=REG_SZ, cbData;
+ TCHAR buf[MAX_PATH]={0};
+ LPWSTR wname;
+ LPSTR avalue;
+
+ lret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+ _T("Software\\ruby_mswince"),
+ 0, KEY_QUERY_VALUE, &hk );
+
+ if ( lret != ERROR_SUCCESS )
+ {
+ strcpy( value, "" );
+ return 0;
+ }
+
+ lpData = (LPBYTE)buf;
+ cbData = MAX_PATH*sizeof(*buf);
+ wname = wce_mbtowc( name );
+
+ lret = RegQueryValueEx( hk, wname,
+ NULL, &dwType, lpData, &cbData );
+ RegCloseKey( hk );
+
+ if ( lret != ERROR_SUCCESS )
+ {
+ strcpy( value, "" );
+ free( wname );
+ return 0;
+ }
+
+ avalue = wce_wctomb( (LPCTSTR)lpData );
+ strcpy( value, avalue );
+ free( avalue );
+ free( wname );
+
+ return strlen(value);
+}
+
+BOOL SetEnvironmentVariable(LPCSTR name, LPCSTR value)
+{
+ /* use registry instead of "environment valuable". */
+ HKEY hk;
+ LONG lret;
+ LPBYTE lpData;
+ DWORD ret, dwType=REG_SZ, cbData;
+ LPWSTR wname, wvalue;
+
+ lret = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ _T("Software\\ruby_mswince"),
+ 0, _T(""), 0,
+ 0, NULL, &hk, &ret );
+ if( lret != ERROR_SUCCESS )
+ return FALSE;
+
+ wname = wce_mbtowc(name);
+ wvalue = wce_mbtowc(value);
+
+ lpData = (LPBYTE)wvalue;
+ cbData = (wcslen(wvalue) + 1) * sizeof(*wvalue);
+ lret = RegSetValueEx( hk, wname,
+ 0, dwType, lpData, cbData );
+ RegCloseKey( hk );
+ free(wname);
+ free(wvalue);
+ return lret == ERROR_SUCCESS;
+}
+
+LPVOID GetEnvironmentStrings(VOID)
+{
+ return NULL;
+}
+
+BOOL FreeEnvironmentStrings(LPSTR lpszEnvironmentBlock)
+{
+ return FALSE;
+}
+
+/* DuplicateHandle, LockFile, etc... */
+/* I have no idea... */
+BOOL GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,
+ DWORD dwProcessGroupID)
+{
+ return 0;
+}
+
+BOOL DuplicateHandle(
+ HANDLE source_process, HANDLE source,
+ HANDLE dest_process, HANDLE *dest,
+ DWORD access, BOOL inherit, DWORD options)
+{
+ return 0;
+}
+
+BOOL LockFile(HANDLE hFile,
+ DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
+ DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh)
+{
+ return FALSE;
+}
+
+BOOL LockFileEx(HANDLE hFile,
+ DWORD dwFlags, DWORD dwReserved,
+ DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh,
+ LPOVERLAPPED lpOverlapped)
+{
+ return FALSE;
+}
+
+BOOL UnlockFile( HFILE hFile,
+ DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
+ DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh)
+{
+ return FALSE;
+}
+
+BOOL UnlockFileEx(HANDLE hFile,
+ DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow,
+ DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped)
+{
+ return FALSE;
+}
+
+/* --------------------- etc, etc, etc... ----------------------- */
+BOOL GetVersionExA(OSVERSIONINFOA *v)
+{
+ OSVERSIONINFOW wv;
+ BOOL b;
+ LPSTR mb;
+
+ b = GetVersionExW(&wv);
+ mb = wce_wctomb(wv.szCSDVersion);
+
+ strcpy( v->szCSDVersion, mb );
+ free(mb);
+ return b;
+}
+
+DWORD WaitForMultipleObjectsEx(DWORD count,
+ const HANDLE *handles, BOOL wait_all,
+ DWORD timeout, BOOL alertable)
+{
+ return WaitForMultipleObjects(
+ count, handles, wait_all,
+ timeout );
+}
+
+BOOL CreateProcessA(LPCSTR appname, LPCSTR commandline,
+ LPSECURITY_ATTRIBUTES att, LPSECURITY_ATTRIBUTES threadatt,
+ BOOL bOpt, DWORD dwFlag, LPVOID lpEnv, LPSTR dir,
+ LPSTARTUPINFO lpsi, LPPROCESS_INFORMATION lppi)
+{
+ LPWSTR wappname, wcommandline, wdir;
+ BOOL b;
+
+ wappname = wce_mbtowc(appname);
+ wcommandline = wce_mbtowc(commandline);
+ wdir = wce_mbtowc(dir);
+
+ b = CreateProcessW(wappname, wcommandline,
+ att, threadatt, bOpt, dwFlag, lpEnv,
+ wdir, lpsi, lppi);
+
+ free(wappname);
+ free(wcommandline);
+ free(wdir);
+
+ return b;
+}
+
+HANDLE CreateEventA(SECURITY_ATTRIBUTES *sa,
+ BOOL manual_reset, BOOL initial_state, LPCSTR name)
+{
+ HANDLE h;
+ LPWSTR wname;
+
+ wname = wce_mbtowc(name);
+ h = CreateEventW(sa, manual_reset,
+ initial_state, wname);
+ free(wname);
+
+ return h;
+}
+
+DWORD FormatMessageA(DWORD dwFlags, LPCVOID lpSource,
+ DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer,
+ DWORD nSize, va_list* args)
+{
+ DWORD dw;
+ LPWSTR lpWBuffer;
+
+ lpWBuffer = wce_mbtowc(lpBuffer);
+ dw = FormatMessageW( dwFlags, lpSource,
+ dwMessageId, dwLanguageId,
+ lpWBuffer, nSize, (va_list*)args );
+ free(lpWBuffer);
+ return dw;
+}
+
+/*---------------- FindFirstFile, FindNextFile ------------------ */
+HANDLE FindFirstFileA(LPCSTR path,
+ WIN32_FIND_DATAA *data)
+{
+ LPWSTR wpath;
+ LPSTR mb;
+ HANDLE h;
+ WIN32_FIND_DATAW wdata;
+
+ wpath = wce_mbtowc(path);
+ h = FindFirstFileW( wpath, &wdata );
+ free(wpath);
+
+ mb = wce_wctomb( wdata.cFileName );
+ strcpy( data->cFileName, mb );
+ free(mb);
+
+ return h;
+}
+
+BOOL FindNextFileA(HANDLE handle,
+ WIN32_FIND_DATAA *data)
+{
+ BOOL b;
+ WIN32_FIND_DATAW wdata;
+ LPSTR mb1;
+
+ b = FindNextFileW(handle, &wdata);
+
+ mb1 = wce_wctomb( wdata.cFileName );
+ strcpy( data->cFileName, mb1 );
+ free(mb1);
+
+ return b;
+}
+
+/* CreateFile doesn't support SECURITY_ATTRIBUTES in WinCE. */
+/* it must be NULL. */
+HANDLE CreateFileA(LPCSTR filename, DWORD access,
+ DWORD sharing, LPSECURITY_ATTRIBUTES sa,
+ DWORD creation, DWORD attributes, HANDLE template)
+{
+ LPWSTR wfilename;
+ HANDLE h;
+
+ wfilename = wce_mbtowc(filename);
+ h = CreateFileW(wfilename, access, sharing,
+ NULL, creation, 0, NULL);
+ free(wfilename);
+
+ return 0;
+}
+
+/* ---------------- CharNext, CharPrev. ---------------------*/
+LPSTR CharNextA(LPCSTR a)
+{
+ char *p=(char *)a;
+ if( TRUE==IsDBCSLeadByteEx(CP_ACP, (BYTE)*a) )
+ p+=2;
+ else
+ p++;
+
+ return p;
+}
+
+LPSTR CharPrevA(LPCSTR start, LPCSTR ptr)
+{
+ if( start==ptr ) return (LPSTR)start;
+ else if( start+1==ptr ) return (LPSTR)start;
+ else if( TRUE==IsDBCSLeadByteEx(CP_ACP, (BYTE)*(ptr-2)) )
+ return (LPSTR)(ptr-2);
+ else
+ return (LPSTR)(ptr-1);
+}
+
+/* WinCE doesn't have "drives". */
+DWORD GetLogicalDrives(VOID)
+{
+ return 0;
+}
+
+/* WinCE doesn't have "user name". */
+BOOL GetUserName(LPSTR lpBuffer, LPDWORD nSize)
+{
+ return 0;
+}
+
+/*------------------- LoadLibrary -----------------------*/
+HINSTANCE LoadLibraryA(LPCSTR libname)
+{
+ HINSTANCE h;
+ LPWSTR wlibname;
+
+ wlibname = wce_mbtowc(libname);
+ h = LoadLibraryW(wlibname);
+ free(wlibname);
+ return h;
+}
+
+HINSTANCE LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile,
+ DWORD dwFlags)
+{
+ HINSTANCE h;
+ LPWSTR wlibname;
+
+ wlibname = wce_mbtowc(lpLibFileName);
+#if _WIN32_WCE < 300
+ h = LoadLibraryW(wlibname);
+#else
+ h = LoadLibraryExW(wlibname, hFile, dwFlags);
+#endif
+ free(wlibname);
+ return h;
+}
+
+/* WinCE doesn't have "CreatePipe". */
+BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe,
+ LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize)
+{
+ return FALSE;
+}
+
+/* WinCE doesn't have "Standard Devices". */
+HANDLE GetStdHandle(DWORD nStdHandle)
+{
+ return NULL;
+}
+
+BOOL SetStdHandle(DWORD nStdHandle, HANDLE h)
+{
+ return FALSE;
+}
+
+#if _WIN32_WCE < 300
+VOID ZeroMemory(PVOID p, DWORD length)
+{
+ memset(p,0,length);
+}
+#endif
+
+
+/* need in ruby/io.c. */
+int ReadDataPending()
+{
+ return 0;
+}
+
+/*---------------- helper functions. ---------------------------- */
+
+/* char -> wchar_t */
+wchar_t* wce_mbtowc(const char* a)
+{
+ int length;
+ wchar_t *wbuf;
+
+ length = MultiByteToWideChar(CP_ACP, 0,
+ a, -1, NULL, 0);
+ wbuf = (wchar_t*)malloc( (length+1)*sizeof(wchar_t) );
+ MultiByteToWideChar(CP_ACP, 0,
+ a, -1, wbuf, length);
+
+ return wbuf;
+}
+
+/* wchar_t -> char */
+char* wce_wctomb(const wchar_t* w)
+{
+ DWORD charlength;
+ char* pChar;
+
+ charlength = WideCharToMultiByte(CP_ACP, 0, w,
+ -1, NULL, 0, NULL, NULL);
+ pChar = (char*)malloc(charlength+1);
+ WideCharToMultiByte(CP_ACP, 0, w,
+ -1, pChar, charlength, NULL, NULL);
+
+ return pChar;
+}
diff --git a/wince/wince.h b/wince/wince.h
new file mode 100644
index 0000000000..2d3d89aa76
--- /dev/null
+++ b/wince/wince.h
@@ -0,0 +1,216 @@
+
+#ifndef _EXT_CE_
+#define _EXT_CE_
+
+/* unique difinition in wince platform. */
+
+#ifndef _MIPS_
+ #define CONTEXT_FLOATING_POINT 0x00000002L
+#endif
+
+/* LockFile difinition. */
+#define LOCKFILE_FAIL_IMMEDIATELY 0x00000001
+#define LOCKFILE_EXCLUSIVE_LOCK 0x00000002
+
+/* Dual Mode difinition. */
+#define STARTF_USESHOWWINDOW 0x00000001
+#define STARTF_USESIZE 0x00000002
+#define STARTF_USEPOSITION 0x00000004
+#define STARTF_USECOUNTCHARS 0x00000008
+#define STARTF_USEFILLATTRIBUTE 0x00000010
+#define STARTF_RUNFULLSCREEN 0x00000020
+#define STARTF_FORCEONFEEDBACK 0x00000040
+#define STARTF_FORCEOFFFEEDBACK 0x00000080
+#define STARTF_USESTDHANDLES 0x00000100
+/* #define STARTF_USEHOTKEY 0x00000200 */
+
+#define STD_INPUT_HANDLE (DWORD)-10
+#define STD_OUTPUT_HANDLE (DWORD)-11
+#define STD_ERROR_HANDLE (DWORD)-12
+
+#define NORMAL_PRIORITY_CLASS 0x00000020
+#define IDLE_PRIORITY_CLASS 0x00000040
+#define HIGH_PRIORITY_CLASS 0x00000080
+#define REALTIME_PRIORITY_CLASS 0x00000100
+
+
+/* WINSOCK.H? */
+#define SO_SYNCHRONOUS_NONALERT 0x20
+
+/* MoveFileEx definition. */
+#define MOVEFILE_REPLACE_EXISTING 0x00000001
+/*
+#define MOVEFILE_COPY_ALLOWED 0x00000002
+#define MOVEFILE_DELAY_UNTIL_REBOOT 0x00000004
+#define MOVEFILE_WRITE_THROUGH 0x00000008
+#define MOVEFILE_CREATE_HARDLINK 0x00000010
+#define MOVEFILE_FAIL_IF_NOT_TRACKABLE 0x00000020
+*/
+
+#define _fgetc fgetc
+#define _fputc fputc
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Win32 API redifinition. */
+
+#ifdef GetCommandLine
+ #undef GetCommandLine
+ #define GetCommandLine GetCommandLineA
+#else
+ #define GetCommandLine GetCommandLineA
+#endif
+
+#ifdef SetFileAttributes
+#undef SetFileAttributes
+#define SetFileAttributes SetFileAttributesA
+#endif
+
+#ifdef GetFileAttributes
+#undef GetFileAttributes
+#define GetFileAttributes GetFileAttributesA
+#endif
+
+#ifdef FormatMessage
+#undef FormatMessage
+#define FormatMessage FormatMessageA
+#endif
+
+#ifdef GetModuleFileName
+#undef GetModuleFileName
+#define GetModuleFileName GetModuleFileNameA
+#endif
+
+#ifdef CreateFile
+#undef CreateFile
+#define CreateFile CreateFileA
+#endif
+
+#ifdef MoveFile
+#undef MoveFile
+#define MoveFile MoveFileA
+#endif
+
+#ifdef DeleteFile
+#undef DeleteFile
+#define DeleteFile DeleteFileA
+#endif
+
+#ifdef CreateProcess
+#undef CreateProcess
+#define CreateProcess CreateProcessA
+#endif
+
+#ifdef CharNext
+#undef CharNext
+#define CharNext CharNextA
+#endif
+
+#ifdef CharPrev
+#undef CharPrev
+#define CharPrev CharPrevA
+#endif
+
+#ifdef WIN32_FIND_DATA
+#undef WIN32_FIND_DATA
+#define WIN32_FIND_DATA WIN32_FIND_DATAA
+#endif
+
+#ifdef FindFirstFile
+#undef FindFirstFile
+#define FindFirstFile FindFirstFileA
+#endif
+
+#ifdef FindNextFile
+#undef FindNextFile
+#define FindNextFile FindNextFileA
+#endif
+
+/* stdio.c */
+FILE *freopen(const char *filename, const char *mode, FILE *file);
+FILE *_fdopen( int handle, const char *mode );
+
+#define fdopen _fdopen
+
+/* stdlib.c */
+char *getenv(const char *charstuff);
+char *_fullpath(char *absPath, const char *relPath, size_t maxLength);
+
+/* string.c */
+char *strdup(const char * str);
+/* char *strerror(int errno); */
+int _strnicmp( const char *s1, const char *s2, size_t count );
+
+#define strnicmp _strnicmp
+
+/* for win32.c */
+BOOL MoveFileEx(LPCSTR oldname, LPCSTR newname, DWORD dwFlags);
+BOOL DuplicateHandle(
+ HANDLE source_process, HANDLE source,
+ HANDLE dest_process, HANDLE *dest,
+ DWORD access, BOOL inherit, DWORD options);
+BOOL LockFile(HANDLE hFile,
+ DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
+ DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh);
+BOOL LockFileEx(HANDLE hFile,
+ DWORD dwFlags, DWORD dwReserved,
+ DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh,
+ LPOVERLAPPED lpOverlapped);
+BOOL UnlockFile( HFILE hFile,
+ DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
+ DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh);
+BOOL UnlockFileEx(HANDLE hFile,
+ DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow,
+ DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped);
+BOOL GetUserName(LPSTR lpBuffer, LPDWORD nSize);
+BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe,
+ LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize);
+HANDLE GetStdHandle(DWORD nStdHandle);
+BOOL SetStdHandle(DWORD nStdHandle, HANDLE h);
+DWORD GetLogicalDrives(VOID);
+DWORD WaitForMultipleObjectsEx(DWORD count,
+ const HANDLE *handles, BOOL wait_all,
+ DWORD timeout, BOOL alertable);
+DWORD GetEnvironmentVariable(LPCSTR name, LPSTR value, DWORD size);
+LPVOID GetEnvironmentStrings(VOID);
+BOOL FreeEnvironmentStrings(LPSTR lpszEnvironmentBlock);
+BOOL GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,
+ DWORD dwProcessGroupID);
+BOOL GetProcessTimes(HANDLE hprocess,
+ LPFILETIME lpCreationTime, LPFILETIME lpExitTime,
+ LPFILETIME lpKernelTime, LPFILETIME lpUserTime);
+
+/* char -> wchar_t, wchar_t -> char */
+wchar_t* wce_mbtowc(const char* a);
+char* wce_wctomb(const wchar_t* w);
+/* other helpers. */
+void wce_SetCommandLine(LPCWSTR wcmd);
+void wce_FreeCommandLine(void);
+
+#if _WIN32_WCE < 300
+ /* for Handheld PC Pro. */
+ char *strrchr( const char *p, int c );
+ int _stricmp( const char *p1, const char *p2 );
+ VOID ZeroMemory(PVOID p, DWORD length);
+
+ #define isascii(c) ( (c>=0x00&&c<=0x7f)?1:0 )
+ #define isspace(c) ( ((c>=0x09&&c<=0x0d)||c==0x20)?1:0 )
+ #define isdigit(c) ( (c>=0x00&&c<=0x09)?1:0 )
+ #define isupper(c) ( (c>='A'&&c<='Z')?1:0 )
+ #define isalpha(c) ( ((c>='A'&&c<='Z')||(c>='a'&&c<='z'))?1:0 )
+ #define isprint(c) ( (c>=0x20&&c<=0x7e)?1:0 )
+ #define isalnum(c) ( (isalpha(c)||isdigit(c))?1:0 )
+ #define iscntrl(c) ( ((c>=0x00&&c<=0x1f)||c==0x7f)?1:0 )
+ #define islower(c) ( (c>='a'&&c<='z')?1:0 )
+ #define ispunct(c) ( !(isalnum(c)||isspace(c))?1:0 )
+ #define isxdigit(c) ( ((c>=0&&c<=9)||(c>='A'&&c<='F')||(c>='a'&&c<='f'))?1:0 )
+#endif
+
+#ifdef __cplusplus
+};
+#endif
+
+
+#endif /* _EXT_CE_ */
diff --git a/wince/wincemain.c b/wince/wincemain.c
new file mode 100644
index 0000000000..5fe5ebec2a
--- /dev/null
+++ b/wince/wincemain.c
@@ -0,0 +1,16 @@
+#include <windows.h>
+#include <stdio.h>
+#include "wince.h"
+
+extern int main(int, char**, char**);
+
+int WINAPI
+WinMain(HINSTANCE current, HINSTANCE prev, LPWSTR wcmd, int showcmd)
+{
+ /* wchar_t -> char */
+ wce_SetCommandLine(wcmd);
+
+ /* main. */
+ return main(0, NULL, NULL);
+}
+
diff --git a/wince/wincon.h b/wince/wincon.h
new file mode 100644
index 0000000000..ea50c6ebc6
--- /dev/null
+++ b/wince/wincon.h
@@ -0,0 +1,7 @@
+
+#ifndef _WINCON_H_
+#define _WINCON_H_
+
+#define CTRL_C_EVENT 0
+
+#endif
diff --git a/wince/winsock2.c b/wince/winsock2.c
new file mode 100644
index 0000000000..9b2a5be600
--- /dev/null
+++ b/wince/winsock2.c
@@ -0,0 +1,338 @@
+/***************************************************************
+ winsock2.c
+***************************************************************/
+
+//#define _WINSOCK2_C_DEBUG_MAIN_
+
+#include <windows.h>
+#include "wince.h"
+#ifdef _WINSOCK2_C_DEBUG_MAIN_
+ #include <winsock.h>
+#endif
+
+#ifndef _WINSOCK2_C_DEBUG_MAIN_
+struct servent{
+ char* s_name; /* official service name */
+ char** s_aliases; /* alias list */
+ short s_port; /* port # */
+ char* s_proto; /* protocol to use */
+};
+struct protoent{
+ char* p_name; /* official protocol name */
+ char** p_aliases; /* alias list */
+ short p_proto; /* protocol # */
+};
+#endif
+
+struct sproto{
+ short num;
+ char name[10];
+};
+struct sserv{
+ short num;
+ char protoname[10];
+ char servname[20];
+};
+
+static struct sproto _proto_table[11]={
+ 0, "ip",
+ 1, "icmp",
+ 3, "ggp",
+ 6, "tcp",
+ 8, "egp",
+ 12, "pup",
+ 17, "udp",
+ 20, "hmp",
+ 22, "xns-idp",
+ 27, "rdp",
+ 66, "rvd",
+};
+
+static struct sserv _serv_table[142]={
+ 7, "tcp", "echo",
+ 7, "udp", "echo",
+ 9, "tcp", "discard",
+ 9, "udp", "discard",
+ 11, "tcp", "systat",
+ 11, "udp", "systat",
+ 13, "tcp", "daytime",
+ 13, "udp", "daytime",
+ 15, "tcp", "netstat",
+ 17, "tcp", "qotd",
+ 17, "udp", "qotd",
+ 19, "tcp", "chargen",
+ 19, "udp", "chargen",
+ 20, "tcp", "ftp-data",
+ 21, "tcp", "ftp",
+ 23, "tcp", "telnet",
+ 25, "tcp", "smtp",
+ 37, "tcp", "time",
+ 37, "udp", "time",
+ 39, "udp", "rlp",
+ 42, "tcp", "name",
+ 42, "udp", "name",
+ 43, "tcp", "whois",
+ 53, "tcp", "domain",
+ 53, "udp", "domain",
+ 53, "tcp", "nameserver",
+ 53, "udp", "nameserver",
+ 57, "tcp", "mtp",
+ 67, "udp", "bootp",
+ 69, "udp", "tftp",
+ 77, "tcp", "rje",
+ 79, "tcp", "finger",
+ 87, "tcp", "link",
+ 95, "tcp", "supdup",
+ 101, "tcp", "hostnames",
+ 102, "tcp", "iso-tsap",
+ 103, "tcp", "dictionary",
+ 103, "tcp", "x400",
+ 104, "tcp", "x400-snd",
+ 105, "tcp", "csnet-ns",
+ 109, "tcp", "pop",
+ 109, "tcp", "pop2",
+ 110, "tcp", "pop3",
+ 111, "tcp", "portmap",
+ 111, "udp", "portmap",
+ 111, "tcp", "sunrpc",
+ 111, "udp", "sunrpc",
+ 113, "tcp", "auth",
+ 115, "tcp", "sftp",
+ 117, "tcp", "path",
+ 117, "tcp", "uucp-path",
+ 119, "tcp", "nntp",
+ 123, "udp", "ntp",
+ 137, "udp", "nbname",
+ 138, "udp", "nbdatagram",
+ 139, "tcp", "nbsession",
+ 144, "tcp", "NeWS",
+ 153, "tcp", "sgmp",
+ 158, "tcp", "tcprepo",
+ 161, "tcp", "snmp",
+ 162, "tcp", "snmp-trap",
+ 170, "tcp", "print-srv",
+ 175, "tcp", "vmnet",
+ 315, "udp", "load",
+ 400, "tcp", "vmnet0",
+ 500, "udp", "sytek",
+ 512, "udp", "biff",
+ 512, "tcp", "exec",
+ 513, "tcp", "login",
+ 513, "udp", "who",
+ 514, "tcp", "shell",
+ 514, "udp", "syslog",
+ 515, "tcp", "printer",
+ 517, "udp", "talk",
+ 518, "udp", "ntalk",
+ 520, "tcp", "efs",
+ 520, "udp", "route",
+ 525, "udp", "timed",
+ 526, "tcp", "tempo",
+ 530, "tcp", "courier",
+ 531, "tcp", "conference",
+ 531, "udp", "rvd-control",
+ 532, "tcp", "netnews",
+ 533, "udp", "netwall",
+ 540, "tcp", "uucp",
+ 543, "tcp", "klogin",
+ 544, "tcp", "kshell",
+ 550, "udp", "new-rwho",
+ 556, "tcp", "remotefs",
+ 560, "udp", "rmonitor",
+ 561, "udp", "monitor",
+ 600, "tcp", "garcon",
+ 601, "tcp", "maitrd",
+ 602, "tcp", "busboy",
+ 700, "udp", "acctmaster",
+ 701, "udp", "acctslave",
+ 702, "udp", "acct",
+ 703, "udp", "acctlogin",
+ 704, "udp", "acctprinter",
+ 704, "udp", "elcsd",
+ 705, "udp", "acctinfo",
+ 706, "udp", "acctslave2",
+ 707, "udp", "acctdisk",
+ 750, "tcp", "kerberos",
+ 750, "udp", "kerberos",
+ 751, "tcp", "kerberos_master",
+ 751, "udp", "kerberos_master",
+ 752, "udp", "passwd_server",
+ 753, "udp", "userreg_server",
+ 754, "tcp", "krb_prop",
+ 888, "tcp", "erlogin",
+ 1109, "tcp", "kpop",
+ 1167, "udp", "phone",
+ 1524, "tcp", "ingreslock",
+ 1666, "udp", "maze",
+ 2049, "udp", "nfs",
+ 2053, "tcp", "knetd",
+ 2105, "tcp", "eklogin",
+ 5555, "tcp", "rmt",
+ 5556, "tcp", "mtb",
+ 9535, "tcp", "man",
+ 9536, "tcp", "w",
+ 9537, "tcp", "mantst",
+ 10000, "tcp", "bnews",
+ 10000, "udp", "rscs0",
+ 10001, "tcp", "queue",
+ 10001, "udp", "rscs1",
+ 10002, "tcp", "poker",
+ 10002, "udp", "rscs2",
+ 10003, "tcp", "gateway",
+ 10003, "udp", "rscs3",
+ 10004, "tcp", "remp",
+ 10004, "udp", "rscs4",
+ 10005, "udp", "rscs5",
+ 10006, "udp", "rscs6",
+ 10007, "udp", "rscs7",
+ 10008, "udp", "rscs8",
+ 10009, "udp", "rscs9",
+ 10010, "udp", "rscsa",
+ 10011, "udp", "rscsb",
+ 10012, "tcp", "qmaster",
+ 10012, "udp", "qmaster",
+};
+
+/* WinCE doesn't have /etc/protocols. */
+struct protoent* getprotobyname(const char* name)
+{
+ static struct protoent pe;
+ int i;
+ int len = strlen(name);
+
+ memset( &pe, 0, sizeof(struct protoent) );
+
+ for(i=0; i<9; i++)
+ {
+ if( 0==strnicmp(_proto_table[i].name, name, len) )
+ {
+ pe.p_name = _proto_table[i].name;
+ pe.p_proto= _proto_table[i].num;
+ break;
+ }
+ }
+
+ return &pe;
+}
+
+struct protoent* getprotobynumber(int proto)
+{
+ static struct protoent pe={0};
+ int i;
+
+ memset( &pe, 0, sizeof(struct protoent) );
+
+ for(i=0; i<9; i++)
+ {
+ if( proto == _proto_table[i].num )
+ {
+ pe.p_name = _proto_table[i].name;
+ pe.p_proto= _proto_table[i].num;
+ break;
+ }
+ }
+
+ return &pe;
+}
+
+/* WinCE doesn't have /etc/services. */
+struct servent* getservbyname(const char* name,
+ const char* proto)
+{
+ static struct servent se;
+ int i;
+ int slen = strlen(name), plen = strlen(proto);
+
+ memset( &se, 0, sizeof(struct servent) );
+
+ if( proto==NULL ) return NULL;
+ if( 0!=strnicmp( proto, "tcp", 3 ) &&
+ 0!=strnicmp( proto, "udp", 3 ) )
+ return NULL;
+
+ for( i=0; i<142; i++ )
+ {
+ if( 0==strnicmp( name, _serv_table[i].servname, slen ) &&
+ 0==strnicmp( proto, _serv_table[i].protoname, plen ) )
+ {
+ char hc, lc;
+ se.s_name = _serv_table[i].servname;
+ se.s_proto= _serv_table[i].protoname;
+ hc = (_serv_table[i].num&0xFF00)>>8;
+ lc = _serv_table[i].num&0xFF;
+ se.s_port = (lc<<8) + hc;
+ break;
+ }
+ }
+
+ return &se;
+}
+
+struct servent* getservbyport(int port, const char* proto)
+{
+ static struct servent se;
+ int i;
+ int plen = strlen(proto);
+ short sport;
+ char lc, hc;
+
+ hc = (port&0xFF00)>>8;
+ lc = port&0xFF;
+
+ sport = (lc<<8) + hc;
+
+ memset( &se, 0, sizeof(struct servent) );
+
+ if( proto==NULL ) return NULL;
+ if( 0!=strnicmp( proto, "tcp", 3 ) &&
+ 0!=strnicmp( proto, "udp", 3 ) )
+ return NULL;
+
+ for( i=0; i<142; i++ )
+ {
+ if( sport == _serv_table[i].num &&
+ 0==strnicmp( proto, _serv_table[i].protoname, plen ) )
+ {
+ se.s_name = _serv_table[i].servname;
+ se.s_proto= _serv_table[i].protoname;
+ se.s_port = port;
+ break;
+ }
+ }
+
+ return &se;
+}
+
+
+#ifdef _WINSOCK2_C_DEBUG_MAIN_
+
+int main()
+{
+ WORD wVersionRequested = MAKEWORD(1,1);
+ WSADATA wsaData;
+ int nErrorStatus;
+ struct protoent pe1, pe2;
+ struct servent se1, se2;
+
+ nErrorStatus = WSAStartup(wVersionRequested, &wsaData);
+ if(nErrorStatus != 0)
+ return -1;
+
+ pe1 = *getprotobyname("UDP");
+ pe2 = *_getprotobyname("UDP");
+
+// pe1 = *getprotobynumber(17);
+// pe2 = *_getprotobynumber(17);
+
+// se1 = *getservbyname("gateway", "tcp");
+// se2 = *_getservbyname("gateway", "tcp");
+
+ se1 = *getservbyport(0x1327, "tcp");
+ se2 = *_getservbyport(0x1327, "tcp");
+
+ WSACleanup();
+
+ return 0;
+}
+
+#endif