I know that I can kick the the preprocessor to spit out output with the -E
option in my particular circumstance. For generated code this preprocessor output is murderous. For example I have a 4gl application and Informix converts this into C which in turn gets spit out to a horrible ugly mess.
What I want is an editor that will allow me to specify what preprocessor values are in effect and show me only the relevant code. I have something very basic working in Vim matching #ifdef
and #endif
, but the code is riddled with more advanced constructs such is #ifndef
, #if
, and #else
. To make matters worse, the constructs are logically more complex, and I don't think my Vim scripting skills are adequate for me to get what I want out of it. For example:
#if DLEVEL > 5
#define SIGNAL 1
#if STACKUSE == 1
#define STACK 200
#else
#define STACK 100
#endif
#else
#define SIGNAL 0
#if STACKUSE == 1
#define STACK 100
#else
#define STACK 50
#endif
#endif
#if DLEVEL == 0
#define STACK 0
#elif DLEVEL == 1
#define STACK 100
#elif DLEVEL > 5
display( debugptr );
#else
#define STACK 200
#endif
Includes defining an expression evaluator if I want to tackle it. This has to be a solved problem! If you have Vim suggestions or other ones please let me know.