Re: Hat and Windows
"Neil Mitchell" <[email protected]> Tue, 27 Jun 2006 11:10:57 +0100
| Newsgroups | gmane.comp.lang.haskell.hat |
|---|---|
| Message-ID | <[email protected]> |
Hi, Continuing on the "Hat on Windows" stuff I have now written hat-make, which builds a program for Hat tracing on Windows. I'll send this over once I have written a Windows makefile which builds the Hat stuff. Attached is a patch to fix hat-c.c, and a new ntohl.h file to be added in hat\include. Since ntohl.h is not available on Windows and is used in a few of the Hat tools it makes sense to separate this off. Thanks Neil On 6/26/06, Olaf Chitil <[email protected]> wrote: > Neil Mitchell wrote: > > > > > I've tried to get Hat compiling on Windows today, and have had some > > success. I found the following problems and fixes: > > Sounds great. Neither Malcolm nor I know much about Windows. So it's > great that you are getting Hat to work under Windows. > > Ciao, > Olaf > > PS: Concerning Int vs Integer I agree with Malcolm that it would only > partially solve the problem with the defaulting rule; I think changing > all Integers to Int is a too complex hack for a too unclear gain. I > hardly ever had problems with the defaulting rule (except for one-line > test programs), but that probably depends a lot on the kind of programs > one writes. > _______________________________________________ > Hat mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/hat > _______________________________________________ Hat mailing list [email protected] http://www.haskell.org/mailman/listinfo/hat
ntohl.h
(text/plain, 430 B)
#if defined(WIN32)
/* Windows does not have ntohl, so define it here */
#define htonl(x) ntohl(x)
int ntohl(int x){
int ret;
unsigned char* pr = (unsigned char*) &ret;
unsigned char* px = (unsigned char*) &x;
pr[0] =px[3]; pr[1] = px[2]; pr[2] = px[1]; pr[3] = px[0];
return ret;
}
#else
/* Unix does, so just use it */
#include <netinet/in.h> /* for ntohl() macro */
#endif /* WIN32 */
hat-c.c.patch
(application/octet-stream, 1.7 KB)
Index: src/hatlib/hat-c.c
===================================================================
RCS file: /home/cvs/root/hat/src/hatlib/hat-c.c,v
retrieving revision 1.41
diff -u -r1.41 hat-c.c
--- src/hatlib/hat-c.c 8 Jul 2005 14:43:39 -0000 1.41
+++ src/hatlib/hat-c.c 27 Jun 2006 10:05:22 -0000
@@ -8,7 +8,7 @@
#include <stdlib.h>
#include <string.h>
#include <signal.h>
-#include <netinet/in.h> /* for ntohl() macro */
+#include "ntohl.h"
#include "hat-c.h"
@@ -104,7 +104,7 @@
strcpy(filename,progname);
strcat(filename,".hat"); /* the .hat file holds the archive */
- HatFile = fopen(filename,"w"); /* of redex trails */
+ HatFile = fopen(filename,"wb"); /* of redex trails */
p = ftell(HatFile); /* should be 0 */
fprintf(HatFile,"Hat%s",FILEVERSION); /* initialise file */
fputc(0,HatFile);
@@ -116,14 +116,16 @@
strcpy(filename,progname); /* the .output file is a copy of */
strcat(filename,".hat.output"); /* stdout */
- HatOutput = fopen(filename,"w");
+ HatOutput = fopen(filename,"wb");
strcpy(filename,progname); /* the .bridge file links the output */
strcat(filename,".hat.bridge"); /* to the archived trails */
- HatBridge = fopen(filename,"w");
+ HatBridge = fopen(filename,"wb");
controlC = False;
/* SIGQUIT here before, why? */
+#if defined(SIGQUIT)
signal(SIGQUIT, hat_Interrupt); /* install handler for abortion? */
+#endif
signal(SIGABRT, hat_Interrupt); /* install handler for abortion? */
signal(SIGFPE, hat_ArithmeticError);
signal(SIGINT, hat_Interrupt); /* install handler for Control-C */