Subject: | Patch to compile with MSVC & Mingw |
ActiveState perl v5.8.7 built for MSWin32-x86-multi-thread
Binary build 813
-------
Alexandr Ciornii, http://chorny.net
Subject: | libmegahal.c.patch |
--- libmegahal.c.dist Tue Sep 12 09:46:13 2006
+++ libmegahal.c Tue Sep 12 02:18:03 2006
@@ -101,8 +101,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#ifndef _MSC_VER
#include <unistd.h>
#include <getopt.h>
+#endif
#if !defined(AMIGA) && !defined(__mac_os)
#include <malloc.h>
#endif
@@ -319,7 +321,12 @@
static void usleep(int);
#endif
+#if defined(_MSC_VER) || defined(__MINGW32_VERSION)
+#include <windows.h>
+#define usleep(i) Sleep(i)
+#endif
+
static char *format_output(char *);
static void free_dictionary(DICTIONARY *);
static void free_model(MODEL *);
@@ -2922,14 +2929,14 @@
static bool flag=FALSE;
if(flag==FALSE) {
-#if defined(__mac_os) || defined(DOS)
+#if defined(DOS) || defined(__mac_os) || defined(_MSC_VER) || defined(__MINGW32_VERSION)
srand(time(NULL));
#else
srand48(time(NULL));
#endif
}
flag=TRUE;
-#if defined(__mac_os) || defined(DOS)
+#if defined(DOS) || defined(__mac_os) || defined(_MSC_VER) || defined(__MINGW32_VERSION)
return(rand()%range);
#else
return(floor(drand48()*(double)(range)));