[Hat] Hat on Windows, patches

Neil Mitchell ndmitchell at gmail.com
Tue Jun 27 10:46:05 EDT 2006


Hi,

Attached is a patch and some files required to build Hat on Windows.
These superceed the ones I sent earlier. With this you get the
following tools:

hat-trans, exactly as per Linux
hat-make, a new tool for windows, think hmake -hat but for Windows
(and not as clever)
hat-check, exactly as per Linux
hat-cover, not very useful unless you do -hion and -hioff since the
escape codes are turned off
hat-stack, like Linux minus the syntax hilighting
hat-observe, lots of escape code garbage, but you can still see the answers

The tweaks are:

ntohl, not on Windows
fopen needs a "b" in the list of options
no escape codes, try and eliminate them where possible

The new files are:

Makefile.bat, the root of the hat repo, serves as a Makefile on
Windows - please rename Makefile.bad to .bat, because Gmail won't let
me send a "dangerous executable"
ntohl.h, for include
ntohl.c, for src\hattools, provides the implementation of ntohl
HatMake.hs, for src\hattools, the implementation of hat-make

Most of the user visible changes are because of the lack of escape
codes, which are used in the Linux versions to make a GUI out of the
console. The Windows solution would just be to use the standard GUI,
and turn the tools into slightly more abstract versions which can have
the two interaction methods layered on top of them.

I also want to change hat-cover to have an option to output HTML,
possible combined with HsColour (modified to be a Haskell library as
well as a program) so you can get syntax coloured and nicely
highlighted Haskell code.

Thanks

Neil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hat-windows.patch
Type: application/octet-stream
Size: 6084 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/hat/attachments/20060627/dd8fcd73/hat-windows-0001.obj
-------------- next part --------------

#if defined(WIN32)

/* Windows does not have ntohl, so define it here */
#define htonl(x) ntohl(x)
int ntohl(int x);

#else

/* Unix does, so just use it */
#include <netinet/in.h>		/* for ntohl() macro */

#endif /* WIN32 */





-------------- next part --------------

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;
}





-------------- next part --------------
A non-text attachment was scrubbed...
Name: HatMake.hs
Type: text/x-haskell
Size: 2431 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/hat/attachments/20060627/dd8fcd73/HatMake-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile.bad
Type: application/octet-stream
Size: 1579 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/hat/attachments/20060627/dd8fcd73/Makefile-0001.obj


More information about the Hat mailing list