From 93d4fbc43ddaf5cd05a47b7f2bd1620c76af0d88 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 3 Dec 2008 08:44:07 -0700 Subject: [PATCH] fix platform=windows and process=interpret builds --- src/interpret.cpp | 28 +++++++++++++++++++++++++++- src/windows.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 69 insertions(+), 5 deletions(-) diff --git a/src/interpret.cpp b/src/interpret.cpp index 604a97d43f..db55168865 100644 --- a/src/interpret.cpp +++ b/src/interpret.cpp @@ -2876,7 +2876,7 @@ class MyProcessor: public Processor { { return vm::makeMethod (t, vmFlags, returnCode, parameterCount, parameterFootprint, flags, - offset, name, spec, class_, code, 0); + offset, 0, name, spec, class_, code, 0); } virtual object @@ -3056,6 +3056,32 @@ class MyProcessor: public Processor { return 0; } + virtual void compileThunks(vm::Thread*, BootImage*, uint8_t*, unsigned*, + unsigned) + { + abort(s); + } + + virtual void compileMethod(vm::Thread*, Zone*, uint8_t*, unsigned*, unsigned, + object*, object*, DelayedPromise**, object) + { + abort(s); + } + + virtual void visitRoots(BootImage*, HeapWalker*) { + abort(s); + } + + virtual unsigned* makeCallTable(vm::Thread*, BootImage*, HeapWalker*, + uint8_t*) + { + abort(s); + } + + virtual void boot(vm::Thread*, BootImage* image) { + expect(s, image == 0); + } + virtual void dispose(vm::Thread* t) { t->m->heap->free(t, sizeof(Thread)); } diff --git a/src/windows.cpp b/src/windows.cpp index de295d90b0..59c6bbacce 100644 --- a/src/windows.cpp +++ b/src/windows.cpp @@ -11,6 +11,7 @@ #include "sys/stat.h" #include "windows.h" #include "sys/timeb.h" +#include "dirent.h" #undef max #undef min @@ -422,6 +423,31 @@ class MySystem: public System { HANDLE file; }; + class Directory: public System::Directory { + public: + Directory(System* s, DIR* directory): s(s), directory(directory) { } + + virtual const char* next() { + if (directory) { + dirent* e = readdir(directory); + if (e) { + return e->d_name; + } + } + return 0; + } + + virtual void dispose() { + if (directory) { + closedir(directory); + } + s->free(this); + } + + System* s; + DIR* directory; + }; + class Library: public System::Library { public: Library(System* s, HMODULE handle, const char* name, bool mapName): @@ -630,19 +656,31 @@ class MySystem: public System { return status; } + virtual Status open(System::Directory** directory, const char* name) { + Status status = 1; + + DIR* d = opendir(name); + if (d) { + *directory = new (allocate(this, sizeof(Directory))) Directory(this, d); + status = 0; + } + + return status; + } + virtual FileType identify(const char* name) { struct _stat s; int r = _stat(name, &s); if (r == 0) { if (S_ISREG(s.st_mode)) { - return File; + return TypeFile; } else if (S_ISDIR(s.st_mode)) { - return Directory; + return TypeDirectory; } else { - return Unknown; + return TypeUnknown; } } else { - return DoesNotExist; + return TypeDoesNotExist; } }