>>Google has some hits for '"macro processor" "implemented in java"'
>>http://www.google.com/search?q=%22macro+processor%22+%22implemented+in+java%22
[quoted text clipped - 13 lines]
>
> I'll continue looking.
You could exec() to gcc with the -E option, to have it do
preprocessing only. I tried the following and it worked for both
includes and for macro expansion.
Process expanding=Runtime.getRuntime().exec(
new String[]{"gcc", // program name
"-E", // Preprocessing (includes and macro expansion) only
"-P", // Do not generate '#line' commands.
"-undef", // Do not predefine any nonstandard macros.
"-o", "expandedoutputfile.xml", // Where to put result
"-nostdinc", // Search only directories specified with -I
"-Idirectorycontainingfilestobeincluded",
"-Ianotherdirectorycontainingfilestobeincluded",
"-x", "c", // Treat source file as .c regardless of its name
"inputfile.xml"} // The source file to be expanded
);
This would also get you conditional compilation.
--Mike Amling