From f4c3bf1dd65f969c0297bfe1c72799dd8c565a91 Mon Sep 17 00:00:00 2001 From: "U-SLAVA-DFB8FF805\\Slava" Date: Sat, 13 Dec 2008 04:49:16 -0600 Subject: [PATCH 1/2] Fix compile warning and fix (sleep) primitive on Windows --- vm/os-windows.c | 4 ++-- vm/os-windows.h | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/vm/os-windows.c b/vm/os-windows.c index ee2c721111..c3e9e50cee 100755 --- a/vm/os-windows.c +++ b/vm/os-windows.c @@ -166,7 +166,7 @@ long getpagesize(void) return g_pagesize; } -void sleep_micros(DWORD usec) +void sleep_micros(u64 usec) { - Sleep(usec); + Sleep((DWORD)(usec / 1000)); } diff --git a/vm/os-windows.h b/vm/os-windows.h index af9b75bca5..227d44af77 100755 --- a/vm/os-windows.h +++ b/vm/os-windows.h @@ -20,17 +20,18 @@ typedef wchar_t F_CHAR; #define STRNCMP wcsncmp #define STRDUP _wcsdup -#define FIXNUM_FORMAT "%Id" #define CELL_FORMAT "%lu" -#define CELL_HEX_FORMAT "%Ix" #ifdef WIN64 + #define CELL_HEX_FORMAT "%Ix" #define CELL_HEX_PAD_FORMAT "%016Ix" + #define FIXNUM_FORMAT "%Id" #else + #define CELL_HEX_FORMAT "%lx" #define CELL_HEX_PAD_FORMAT "%08lx" + #define FIXNUM_FORMAT "%ld" #endif -#define FIXNUM_FORMAT "%Id" #define OPEN_READ(path) _wfopen(path,L"rb") #define OPEN_WRITE(path) _wfopen(path,L"wb") @@ -49,7 +50,7 @@ void ffi_dlopen(F_DLL *dll); void *ffi_dlsym(F_DLL *dll, F_SYMBOL *symbol); void ffi_dlclose(F_DLL *dll); -void sleep_micros(DWORD msec); +void sleep_micros(u64 msec); INLINE void init_signals(void) {} INLINE void early_init(void) {} From cccacdaa5a80502fc410e0101400d023ff82be4a Mon Sep 17 00:00:00 2001 From: "U-SLAVA-DFB8FF805\\Slava" Date: Sat, 13 Dec 2008 04:49:28 -0600 Subject: [PATCH 2/2] io.backend.windows.nt needs to set io-backend --- basis/io/backend/windows/nt/nt.factor | 2 ++ 1 file changed, 2 insertions(+) diff --git a/basis/io/backend/windows/nt/nt.factor b/basis/io/backend/windows/nt/nt.factor index e41293b6de..bb8175b35c 100755 --- a/basis/io/backend/windows/nt/nt.factor +++ b/basis/io/backend/windows/nt/nt.factor @@ -118,3 +118,5 @@ M: winnt (wait-to-read) ( port -- ) ] with-destructors ; M: winnt (init-stdio) init-c-stdio ; + +winnt set-io-backend