Winhugs autoload

Stephen Milborrow milbo@icon.co.za
Tue, 21 Jan 2003 18:39:55 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_0038_01C2C17C.7E136160
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

I have made a small modification to my winhugs which allows you to load
files into winhugs and execute Hugs expressions within the comfort of
your editor.  The convenience may appear small, but prior to the change,
I found the typing/clicking involved in switching windows and reloading my 
Haskell program into winhugs every time I changed it irritating after the 
first hundred times!

The program mod is simple: while waiting for user input, every half-second
winhugs checks to see if the modification time of the file 
"/Program Files/Hugs98/autoload" changed.  If so, winhugs executes the 
file, just as if the user had typed in the text in the file.

Thus a makefile (executed from within your editor) could be

        /progra~1/hugs98/autoload: foo1.hs foo2.hs foo3.hs 
                echo "foo arg1 arg2" >/progra~1/hugs98/autoload
                touch /progra~1/hugs98/autoload

or more simply, when you want winhugs to execute your program just
re-save autoload from within your editor (with the standard Hugs
options enabled "i import chasing" and "A Auto load files").

I am one of those people who take an non-mouse EMACS-centered view 
of the world and like to do everything from within EMACS.  But once in a
while it is nice to try out things directly in winhugs.  With this mod and
running EMACS and winhugs side by side, I get the best of both
worlds.  Invoking EMACS from within winhugs or using runhugs
doesn't work as well for me, as a matter of personal taste.

I have been using this for some time now but was slightly reluctant
to post it to the group because polling a file for
inter-process communication is a bit of hack (even though the
half-second poll takes negligible time).  Also,  storing
a user-written file in the Hugs98 program directory is poor
practice -- but under Windows there seems to be no other obvious
place to store the autoload file.  I didn't want to add an extra
command line flag just to specify the whereabouts of the file.  
In spite of theses issues, I can say that in practice autoloading 
is nice to use.

One file changed viz. Wintext.c.  The diff -u is attached.  The source
base for the diff was Nov2002.  I tested it under Windows 98.
I hereby give permission for anyone to do anything they like with 
the new code.

Stephen

------=_NextPart_000_0038_01C2C17C.7E136160
Content-Type: application/x-gzip;
	name="wintext.diff.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="wintext.diff.gz"

H4sICCpaLT4AA1dpbn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