My own preprocessor

This was a fun little project. I wrote a C++ preprocessor for WrapVTK and will probably add it to VTK itself sometime this week. This preprocessor is specifically meant to be used with a wrapping system, it includes all header files and stores all macros but it does not expand them, instead it allows the wrappers to wrap them. Except for the lack of macro expansion, it is a full preprocessor. It can evaluate expressions and handle #if directives. It can provide an integer value for any macro that will evaluate to an integer after expansion.

The addition of a preprocessor to the VTK wrappers allows a bunch of "hocus pocus" to be removed from the wrapper code. No longer will inscrutable regular expressions be needed to block out odd code chunks that can't be wrapped. No longer will the wrapper-generators need to rely on #ifdefs to decide what types can be wrapped. Instead, the parser will be able to correctly follow the #ifs and #elses in the wrapped header files themselves. Even better, difficult header files like vtkType.h and vtkConfigure.h can be wrapped and all the constants that they define can be made available in Python. It's all good.