DoUML/douml — pull request #74 by jeremysalwen (2014-01-13 23:11:57+00:00)
Title: use mcpp to preprocess sources before CppReverse

This branch is NOT complete as it never actually /uses/ the included code, but it includes all the code to actually do the preprocessing. All that is necessary is a call to j_preprocess in preprocess.h

The arguments are mostly self-explanatory.

fin is the input file
fout is passed by reference. The location of the output file will be placed there.
include_args is the list of arguments to the preprocessor (such as "-I/usr/local/include", etc)
working_dir is the working directory for the preprocessor
errstream is a pointer to a string where the errors the preprocessor outputs will be stored
output_includes is a boolean option. If false, the preprocessor will *not* output text from included files (but will process it for macros).

The return value is an error code (0 indicates no error).

What is needed is the gui code to feed these options to the function j_preprocess, and simply use the preprocessed file as input to the lexer instead of the original.

mcpp will continue outputting through recoverable errors (such as #error directives or missing #includes), but we could include an option to discard the output if any errors occur.

mcpp is also highly portable (although I fiddled with the configuration a bit, so it is possible that it will need some patches to maintain its portability in this stripped form).

I have tested this on 64 bit debian/linux.