cpp

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Thu Feb 22 14:55:29 EST 2001


Thu, 22 Feb 2001 11:41:20 -0700, Alastair Reid <reid at cs.utah.edu> pisze:

> 2) Have any desire to spend half a day installing lots of
>    Haskell-related tools (greencard, c2hs, happy, etc.) on their
>    machine before they can try out my tool.  Getting them to install
>    a GHC binary is about the limit of what I can reasonably expect.

hsc2hs is in ghc-4.11.

> In this case, it is very useful to be able to distribute the output
> of all those useful support tools (greencard, c2hs, happy, etc.).

The output can depend on versions of C libraries they have installed
and other details of their system which are detected at configure time.
You would lock the distributed package to a concrete binary-compatible
environment.

> What would (perhaps) be nice is for the support tools to implement
> conditional compilation themselves and for the output file to use
> conditional compilation too.

Sorry, I don't understand this.

For example hsc2hs transforms a .hsc file with #ifdefs and other things
into a .hs file and sometimes also .h and .c files. The .hs file has
conditional compilation resolved; the .h and .c files contain #ifdefs
which mirror the #ifdef structure of the source.

hsc2hs doesn't implement #ifdefs itself, but uses cpp to compile a
C program which outputs the Haskell source.

What would you like to obtain?

> ps Or maybe I should just hack up a perl script that runs greencard
> and friends 2^N times and then packs the results (using diff,
> etc as appropriate) into a convenient file for shipping to users.

Do you mean considering every possible combination of #ifdefed
expressions? Sorry, it won't work. One of my modules contains 98
#ifdefs in a row (generated by macros), which check availability of
errno constants. I will not distribute 316912650057057350374175801344
variants of this file.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTÊPCZA
QRCZAK





More information about the FFI mailing list