
15 Jul
2009
15 Jul
'09
9:37 a.m.
I'm trying to define a macro inside a template that generates an existing macro:
Won't fly; cpp doesn't scan its own output recursively, so if you generate a #define in a macro it will appear in the output unexpanded.
But isn't this also scanned by hsc2hs? After all, #def (not #define) is not a cpp macro, but an instruction for hsc2hs to insert code in a header file. In hsc2hs, a construct like: #test is actually handled by a function definition with name hsc_test, which outputs an expansion. I can't find, however, something like hsc_def that I could call from my function. If I could get my code to be first processed by cpp and only then by hsc2hs, I think the problem would be solved. Is it possible to do that? Maurício