htod - convert C .h files to D import files
Walter Bright
newshound at digitalmars.com
Mon May 22 02:15:23 PDT 2006
Lionello Lunesu wrote:
> I've been playing around with libcpp (the c preprocessor) from gcc and
> was wondering if that was indeed enough to make a tool like htod.
>
> I mean, do you need to parse the C code further, or is a preprocessor
> (passing you the tokens) enough to do what htod does?
>
> (You'd have to detect the 3 tokens "unsigned long long" yourself and
> replace it with "ulong", but that's find&replace, hardly parsing)
htod does a real parse of the C code, and generates the D output from
the internal symbol table. Parsing it all the way means that the corner
cases work. Also, it means it'll work with C++ header files that have
extern "C" declarations in them.
"unsigned long long" can be:
unsigned long long
long unsigned long
long long unsigned
int unsigned long long
unsigned long const int long
etc.
More information about the Digitalmars-d-announce
mailing list