Closed heasm66 closed 5 months ago
In David Kinder's win32-version these changes are done:
--- finished/source/confusion/macros.cpp 2009-07-21 04:52:06.000000000 +0100 +++ msvc/confusion/macros.cpp 2009-08-01 08:00:25.250000000 +0100 @@ -15,8 +15,10 @@ /* along with this program. If not, see <http://www.gnu.org/licenses/>. */ /*****************************************************************************/ #include <sys/stat.h> +#ifndef _WIN32 #include <sys/time.h> #include <sys/resource.h> +#endif #include <stdarg.h> #include <stdlib.h> #include <string.h> @@ -5467,6 +5469,9 @@ act->v.f->result = args; mdl_longjmp_to(act->v.f, LONGJMP_MAPRET); +#ifdef _WIN32 + return 0; +#endif } mdl_value_t *mdl_builtin_eval_mapstop(mdl_value_t *form, mdl_value_t *args) @@ -5479,6 +5484,9 @@ act->v.f->result = args; mdl_longjmp_to(act->v.f, LONGJMP_MAPSTOP); +#ifdef _WIN32 + return 0; +#endif } mdl_value_t *mdl_builtin_eval_mapleave(mdl_value_t *form, mdl_value_t *args) @@ -5496,6 +5504,9 @@ act->v.f->result = val; mdl_longjmp_to(act->v.f, LONGJMP_MAPLEAVE); +#ifdef _WIN32 + return 0; +#endif } // Arithmetic predicates (8.2.1) @@ -6184,8 +6195,12 @@ #ifdef MDL32 return mdl_new_float(fabsf(num->v.fl)); #else +#ifdef _WIN32 + return mdl_new_float(fabs((double)num->v.w)); +#else return mdl_new_float(fabs(num->v.w)); #endif +#endif } else if (num->type == MDL_TYPE_FIX) { @@ -7461,6 +7476,9 @@ if (cursor) mdl_error("Too many args to erret"); mdl_internal_erret(result, frame); +#ifdef _WIN32 + return 0; +#endif } mdl_value_t *mdl_builtin_eval_retry(mdl_value_t *form, mdl_value_t *args) @@ -7476,6 +7494,9 @@ if (!frame) frame = mdl_local_symbol_lookup_pname("L-ERR !-INTERRUPTS!-", cur_frame); if (!frame) mdl_error("No frame in RETRY!"); mdl_longjmp_to(frame->v.f, LONGJMP_RETRY); +#ifdef _WIN32 + return 0; +#endif } mdl_value_t *mdl_builtin_eval_unwind(mdl_value_t *form, mdl_value_t *args) @@ -8098,10 +8119,16 @@ return &mdl_value_false; } +#ifdef _WIN32 +extern "C" const char copying[]; +#endif + mdl_value_t *mdl_builtin_eval_copying(mdl_value_t *form, mdl_value_t *args) /* SUBR */ { +#ifndef _WIN32 extern const char copying[]; +#endif mdl_value_t *chan = NULL; ARGSETUP(args); NOMOREARGS(args); --- finished/source/confusion/macros.hpp 2009-07-21 04:52:06.000000000 +0100 +++ msvc/confusion/macros.hpp 2009-07-31 07:48:16.546875000 +0100 @@ -23,6 +23,9 @@ #include <setjmp.h> #include <float.h> #include "mdl_builtin_types.h" +#ifdef _WIN32 +#include "mdl_win32.h" +#endif // PRIMTYPES and TYPES must be specified in order, with // naming and commenting convention as below, or @@ -196,5 +199,5 @@ bool mdl_chan_at_eof(mdl_value_t *chan); mdl_charclass_t mdl_get_charclass(MDL_INT ch); int mdl_read_from_chan(mdl_value_t *chan); -void mdl_error(const char *err) __attribute__((noreturn)); +void mdl_error(const char *err) __declspec(noreturn); void mdl_toplevel(FILE *restorefile); --- finished/source/confusion/mdl_binary_io.cpp 2009-07-21 04:52:06.000000000 +0100 +++ msvc/confusion/mdl_binary_io.cpp 2009-07-31 08:36:02.031250000 +0100 @@ -21,11 +21,19 @@ #include "mdl_assoc.hpp" #include <vector> #include <map> +#ifdef _WIN32 +#include <hash_set> +#else #include <ext/hash_set> +#endif #include <string.h> +#ifdef _WIN32 +using stdext::hash_set; +#else using __gnu_cxx::hash_set; using __gnu_cxx::hash; +#endif using std::vector; using std::map; using std::pair; @@ -62,6 +70,13 @@ { return this->ptr == that.ptr; } + +#ifdef _WIN32 + bool operator < (const obj_in_image_t &that) const + { + return this->ptr < that.ptr; + } +#endif } obj_in_image_t; class hash_obj_in_image @@ -73,7 +88,15 @@ } }; +#ifdef _WIN32 +inline size_t hash_value(const obj_in_image_t& o) +{ + return (size_t)o.ptr; +} +typedef hash_set<struct obj_in_image_t> obj_image_hash_t; +#else typedef hash_set<struct obj_in_image_t, hash_obj_in_image> obj_image_hash_t; +#endif typedef vector<struct obj_in_image_t, traceable_allocator<struct obj_in_image_t> > obj_image_list_t; typedef map<intptr_t, struct mdl_value_t *> chan_map_t; --- finished/source/confusion/mdl_internal_defs.h 2009-07-21 04:52:06.000000000 +0100 +++ msvc/confusion/mdl_internal_defs.h 2009-07-31 07:48:31.500000000 +0100 @@ -470,13 +470,13 @@ bool addspacebefore // add a space if no break ); -void mdl_internal_erret(mdl_value_t *result, mdl_value_t *frame) __attribute__((noreturn)); -void mdl_longjmp_to(mdl_frame_t *frame, int value) __attribute__((noreturn)); +void mdl_internal_erret(mdl_value_t *result, mdl_value_t *frame) __declspec(noreturn); +void mdl_longjmp_to(mdl_frame_t *frame, int value) __declspec(noreturn); void mdl_write_image(FILE *f, mdl_value_t *save_arg); bool mdl_read_image(FILE *f); -mdl_value_t *mdl_call_error(const char *errstr, ...) __attribute__((sentinel)); -mdl_value_t *mdl_call_error_ext(const char *errstr, const char *reason, ...) __attribute__((sentinel)); +mdl_value_t *mdl_call_error(const char *errstr, ...) ; +mdl_value_t *mdl_call_error_ext(const char *errstr, const char *reason, ...) ; mdl_value_t *mdl_boolean_value(bool v); bool mdl_is_true(mdl_value_t *item); bool mdl_internal_struct_is_empty(mdl_value_t *arg);
In David Kinder's win32-version these changes are done: