[vtk-developers] New wrapper-generator code

David Gobbi david.gobbi at gmail.com
Sun Apr 29 18:00:34 EDT 2012


I've been playing around with the VTK wrapper code, to see how far I
can go to wrap code that mixes ITK and VTK.  That experiment is still
in progress (as part of the WrapVTK/SimVTK/SimITK project), but I
thought it would be worthwhile to push some of the changes to a gerrit
branch so that they can be merged into VTK 6:

http://review.source.kitware.com/#/t/484/

The main changes are:

1) The lex/yacc C++ parser rules have been largely rewritten, so that
the parser can handle very complicated type, class, and template
definitions.  This means that the wrappers can handle a much greater
variety of C++ syntactical constructs without generating the dreaded
"SYNTAX ERROR".  So how robust is the new parser?  Robust enough
to parse every single header file in both ITKv3 and ITKv4.  It can't wrap
ITK classes, but at least it can read the headers without dying.

2) The parser can recurse through included files, to parse all the
superclasses of each class that is being wrapped.  This feature isn't
put to any use yet, but eventually it will greatly reduce the need for
those "vtkHierarchy.txt" files that some of you have had to deal with.

3) The core wrapper code is compiled into a static library called
libvtkWrapperCore.a (or vtkWrapperCore.lib on Windows).  This should
make it easier to write cmake files for external wrappers like the
paraview client/server wrappers.  The wrapper tools (vtkWrapPython,
vtkWrapTcl, etc.) all link this library.  The wrapper tools have also
adopted a compiler-like calling convention:
vtkWrapX -I <include_dir> -D <definition> -o <output_file> <class_header>

I've diff'd the generated wrapper code vs. what was generated before
these changes to ensure that nothing was lost.

 - David



More information about the vtk-developers mailing list