For Java such code has been written already: (at least) Eclipse does this on a routine basis.
Of course this is a much easier problem since Java has no pre-processor. I'm still impressed seeing it in action.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds