Re: C preprocessor + WinHugs

Ross Paterson <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.hugs
Message-ID <20051030200100.GB14070__1355.08447788215$1130702492$gmane$org@soi.city.ac.uk>
On Sun, Oct 30, 2005 at 02:18:09PM +0000, Neil Mitchell wrote:
> I'm looking into implementing C preprocessing in WinHugs. I've looked
> around and bundling a copy of cpphs seems like the best solution,
> since few windows users will have a cpp hanging around somewhere that
> can be found.

Hugs uses cpphs for preprocessing the libraries, so there should already
be a copy in the distribution.

> I've hacked together a basic implementation, the only
> thing is that its a lot slower, mainly because its being run on every
> single file which is completely unneeded.

Are you using -F?  Actually the preprocessor is run twice on most files,
due to the way Hugs handles imports.

> Is there some way to detect if a hs file requires preprocessing? If
> not, its almost going to be better to stick with no preprocessing, and
> have a faster development environment. The ways I thought of were:
> 
> * Add some magic to the parser, so that if it encounters a # at the
> start of a line, it bails out and restarts again after preprocessing.
> 
> * Only preprocess .cpp.hs or .hscpp or some other special suffix as
> having cpp directives.
> 
> * Look into the file for some sort of command line arguments pragma on
> the first line denoting preprocessing.

None are terribly attractive (and they would only be for cpp).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.