4 ms·
Yep. As I said in a previous comment, I actually released a tool, called htrans, to do this, which worked very well for a lot of people. It was a hand-coded C
by lobster_johnson 10y ago
Yep. As I said in a previous comment, I actually released a tool, called htrans, to do this, which worked very well for a lot of people.
It was a hand-coded C parser with support for a minimal subset of C++ concepts, needed to successfully translate COM interfaces. It had a bunch of kludges specifically to recognize COM. Handling macros was without doubt the most painful part of it, because I couldn't just run the .h file through a preprocessor; I had to also preserve the macros and try to convert them into declarations, so that "#define FOO 1" would result in "const FOO: Integer = 1;" or whatever. Not too bad with simple things, but sometimes people will abuse macros to declare functions...
htrans worked well enough that I could run it on a bunch of stuff and not need to edit the resulting .pas files at all. Unfortunately, I suspect I've lost the source code.