[Haskell-beginners] Recursive macros in hsc2hs

Maurí­cio briqueabraque at yahoo.com
Tue Jul 14 22:51:55 EDT 2009


I'm trying to define a macro inside a template that generates
an existing macro:

---

#define hsc_test(hst,ct) \
     { \
         printf("#def inline int b_%s(void){return %s;}\n", hst,ct); \
         printf("foreign import ccall b_%s :: CInt\n", hst); \
     }

---

Contrary to my expectation, the '#def' construct printed at the
first 'printf' is included in the final haskell file, instead of
beeing removed and replaced by a C function definition in a c
header file.

Is it possible to define an hsc_-like construct that generates
code that is again parsed by hsc2hs?

Thanks,
Maurício



More information about the Beginners mailing list