]> gitweb.factorcode.org Git - factor.git/commitdiff
moved some os-windows functions into the vm
authorPhil Dawes <phil@phildawes.net>
Tue, 18 Aug 2009 18:52:11 +0000 (19:52 +0100)
committerPhil Dawes <phil@phildawes.net>
Wed, 16 Sep 2009 07:16:29 +0000 (08:16 +0100)
vm/os-windows.cpp
vm/os-windows.hpp
vm/vm.hpp

index 8acd20705857c84dc03a16d57968563d3cbb8c6c..38c8b944a4750b01ca68ed3e757a7a206c0cec4b 100644 (file)
@@ -12,43 +12,23 @@ void factorvm::init_ffi()
                fatal_error("GetModuleHandle(\"" FACTOR_DLL_NAME "\") failed", 0);
 }
 
-void init_ffi()
-{
-       return vm->init_ffi();
-}
-
 void factorvm::ffi_dlopen(dll *dll)
 {
        dll->dll = LoadLibraryEx((WCHAR *)alien_offset(dll->path), NULL, 0);
 }
 
-void ffi_dlopen(dll *dll)
-{
-       return vm->ffi_dlopen(dll);
-}
-
 void *factorvm::ffi_dlsym(dll *dll, symbol_char *symbol)
 {
        return (void *)GetProcAddress(dll ? (HMODULE)dll->dll : hFactorDll, symbol);
 }
 
-void *ffi_dlsym(dll *dll, symbol_char *symbol)
-{
-       return vm->ffi_dlsym(dll,symbol);
-}
-
 void factorvm::ffi_dlclose(dll *dll)
 {
        FreeLibrary((HMODULE)dll->dll);
        dll->dll = NULL;
 }
 
-void ffi_dlclose(dll *dll)
-{
-       return vm->ffi_dlclose(dll);
-}
-
-bool windows_stat(vm_char *path)
+bool factorvm::windows_stat(vm_char *path)
 {
        BY_HANDLE_FILE_INFORMATION bhfi;
        HANDLE h = CreateFileW(path,
@@ -76,14 +56,15 @@ bool windows_stat(vm_char *path)
        return ret;
 }
 
-void windows_image_path(vm_char *full_path, vm_char *temp_path, unsigned int length)
+
+void factorvm::windows_image_path(vm_char *full_path, vm_char *temp_path, unsigned int length)
 {
        snwprintf(temp_path, length-1, L"%s.image", full_path); 
        temp_path[sizeof(temp_path) - 1] = 0;
 }
 
 /* You must free() this yourself. */
-const vm_char *default_image_path()
+const vm_char *factorvm::default_image_path()
 {
        vm_char full_path[MAX_UNICODE_PATH];
        vm_char *ptr;
@@ -110,11 +91,6 @@ const vm_char *factorvm::vm_executable_path()
        return safe_strdup(full_path);
 }
 
-const vm_char *vm_executable_path()
-{
-       return vm->vm_executable_path();
-}
-
 
 inline void factorvm::vmprim_existsp()
 {
@@ -152,11 +128,6 @@ segment *factorvm::alloc_segment(cell size)
        return block;
 }
 
-segment *alloc_segment(cell size)
-{
-       return vm->alloc_segment(size);
-}
-
 void factorvm::dealloc_segment(segment *block)
 {
        SYSTEM_INFO si;
@@ -166,11 +137,6 @@ void factorvm::dealloc_segment(segment *block)
        free(block);
 }
 
-void dealloc_segment(segment *block)
-{
-       return vm->dealloc_segment(block);
-}
-
 long factorvm::getpagesize()
 {
        static long g_pagesize = 0;
@@ -183,19 +149,9 @@ long factorvm::getpagesize()
        return g_pagesize;
 }
 
-long getpagesize()
-{
-       return vm->getpagesize();
-}
-
 void factorvm::sleep_micros(u64 usec)
 {
        Sleep((DWORD)(usec / 1000));
 }
 
-void sleep_micros(u64 usec)
-{
-       return vm->sleep_micros(usec);
-}
-
 }
index 27e27752890c092d20957212b48db349c748f455..e5617213f4a1a01649fae94f690a607b3e471b08 100644 (file)
@@ -41,18 +41,9 @@ typedef wchar_t vm_char;
 /* Difference between Jan 1 00:00:00 1601 and Jan 1 00:00:00 1970 */
 #define EPOCH_OFFSET 0x019db1ded53e8000LL
 
-void init_ffi();
-void ffi_dlopen(dll *dll);
-void *ffi_dlsym(dll *dll, symbol_char *symbol);
-void ffi_dlclose(dll *dll);
-
-void sleep_micros(u64 msec);
 
 inline static void init_signals() {}
 inline static void early_init() {}
-const vm_char *vm_executable_path();
-const vm_char *default_image_path();
-long getpagesize ();
 
 s64 current_micros();
 
index 9ee5a2d81fcc3c2d08f377b85b5907f4158d009b..4257d17fd95eee8cc30a0c730e23770aeefe0a4f 100644 (file)
--- a/vm/vm.hpp
+++ b/vm/vm.hpp
@@ -660,6 +660,9 @@ struct factorvm {
        segment *alloc_segment(cell size);
        const vm_char *vm_executable_path();
        inline void vmprim_existsp();
+       const vm_char *default_image_path();
+       void windows_image_path(vm_char *full_path, vm_char *temp_path, unsigned int length);
+       bool windows_stat(vm_char *path);
        // next method here:    
 #endif