[vtk-developers] New wrapper-generator code

David Gobbi david.gobbi at gmail.com
Tue May 22 12:05:24 EDT 2012


I've updated my wrapper-parser-enhancement branch in gerrit.
http://review.source.kitware.com/#/t/484/
The latest change set (#4) adds the following:

1) The new parser ignores Windows keywords like __stdcall
and __cdecl, instead of generating a syntax error for them.

2) The main wrapper tool library is now called vtkWrappingCore,
instead of vtkWrapperCore (a fairly minor change).

3) The wrapper tools now have a "@file" option, like gcc and
Microsoft's cl.exe, which allows options to be stored in a file
instead of being specified on the command line.

I've tested this patch set on Linux (gcc-4.2), OS X 10.6 (gcc-4.2),
and Windows XP (MSVC 2005).  I haven't tested with ParaView,
but (in theory) the only change that should be needed in ParaView is
for vtkWrapClientServer to link to the new vtkWrappingCore library.

 - David


On Sun, Apr 29, 2012 at 4:00 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> 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