Dave Barton confesses:
> [...] A long time ago (so long it had slipped my mind), I
> added Derive to my library, and therefore put a HUGSFLAGS symbol in my
> .bashrc file.  It, of course, had library pointers, and the lib/exts
> directory was excluded.

For a whole bunch of reasons, I gave up on defining HUGSFLAGS in my
.bashrc (or equivalent) some time ago.  My preferred alternative is to
create a script which invokes Hugs with the appropriate flags for
every different project I'm working on.  I give these scripts names
like "vhugs" (a version used for a vision program) and either put them
in $HOME/bin or in the working directory - according to whim and
whether I have to distribute the program to other people.

This approach avoids a whole bunch of problems:
o Dave's problem (testing with "hugs" or "runhugs" would have been fine
  but using his scripot would have failed and Dave would have quickly 
  identified the culprit.
o Easier to share code with people - give them the script as well.
o Easier to cope with having multiple versions of Hugs installed.


All that said, there's a simpler fix for Dave's problem:

  If you do define HUGSFLAGS in your .bashrc  (or even in a script),
  make sure the definition begins or ends with ":" so that you 
  _add_ to the default definition instead of replacing it.

You can see this being used in the attached script.


Alastair


ps Here's a typical script.  The "stty sane" line at the end was required
for this particular project but it probably does no harm in general.


#! /bin/bash

FLAGS=+g

#GC_DIR=$HOME/fptools/green-card/lib/hugs
GC_DIR=$HOME/green-card/lib/hugs

ROBO_DIR=$HOME/RoboHaskell

SCOUT_DIR=$ROBO_DIR/scout

FROB_DIR=$SCOUT_DIR/Frob
ROBOGC_DIR=$SCOUT_DIR/GC
FRAN_DIR=$ROBO_DIR/Fran/src

XVGC_DIR=$ROBO_DIR/XVision/GC

$HOME/bin/hugs $FLAGS -P:$FROB_DIR:$ROBOGC_DIR:$XVGC_DIR:$GC_DIR:$FRAN_DIR $*

# if Hugs crashes it tends to leave the terminal mangled
stty sane

Reply via email to