forked from mobius3/douml
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use mcpp to preprocess sources before CppReverse #74
Open
jeremysalwen
wants to merge
16
commits into
DoUML:master
Choose a base branch
from
jeremysalwen:preprocessor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.