On 2012-07-08 23:22, Jonathan Andrew wrote:
The only disadvantage to the single-file limitation is that in the case
of GTK at least, it has preprocessor directives to keep you from just
#include-ing the single file you want to convert, so I just used sed to
strip out all the #error directives that come up and force it to do my
bidding. I understand DStep doesn't deal with preprocessor yet, but as
far as the CLang front-end it uses goes, it might be helpful to find a
way to turn off #error-s.
sed -i 's/#error/\/\//g' *.h
I added an enhancement request for this:
https://github.com/jacob-carlborg/dstep/issues/3
The next step was to rename all the D reserved words that GTK used as
function arguments - in, out, function, and align are the only ones I
can think of off the top of my head. Easy fix for the user (by no means
am I complaining), but if you want to streamline the conversion,
automatically renaming these kinds of arguments might be a helpful option.
I added this to the issue list as well:
https://github.com/jacob-carlborg/dstep/issues/1
Then, renaming all the duplicate empty struct{} entries in some of the
files. You already know about this, but it was probably the most
time-consuming part of the process for converting GTK, at least. I
couldn't think of an easy way to automate this on my end, because some
of the empty structs were necessary to get it to compile.
BTW, do you have an example of the C code that causes these empty structs?
Finally, putting import statements in all the .d files after I was done.
Still a long way to go on this (500 files).
Imports are already added for most of the files in the C standard
library. I plan to add support for other files as well. Hopefully this
can be done.
Sorry for the long post, this is probably obvious stuff to everybody
else, but I was really impressed with DStep - thank you for creating it!
-Jon
--
/Jacob Carlborg