[vtk-developers] Tcl wrapping and output array arguments

David Gobbi david.gobbi at gmail.com
Mon Mar 30 10:29:07 EDT 2015


On Mon, Mar 30, 2015 at 7:26 AM, David Lonie <david.lonie at kitware.com>
wrote:

> On Fri, Mar 27, 2015 at 12:00 PM, David Gobbi <david.gobbi at gmail.com>
> wrote:
>
>> On Fri, Mar 27, 2015 at 9:35 AM, David Lonie <david.lonie at kitware.com>
>> wrote:
>>
>>> On Fri, Mar 27, 2015 at 11:21 AM, David Gobbi <david.gobbi at gmail.com>
>>> wrote:
>>>
>>>> On Fri, Mar 27, 2015 at 8:49 AM, David Lonie <david.lonie at kitware.com>
>>>> wrote:
>>>>
>>> Would you have time to do this? It looks like we're going to need to
>>> bite the bullet and train the wrappers one way or another. No worries, If
>>> you're too busy, I can give it a shot, though I may need to bug you a bit
>>> while going through. But I really wouldn't mind taking some time to learn
>>> how the wrapping mechanisms work.
>>>
>>
>> No, I don't have time.  Feel free to bug me with specific questions.
>>
>
> I've started looking into the wrapping code to add support for methods
> returning vtkBoundingBox. I think I see what needs to happen, let me know
> if anything here sounds wrong:
>
> 1) Teach the parser about vtkBoundingBox: (basically duplicating what I
> see for vtkUnicodeString)
> 1a) Add #define VTK_BOUNDING_BOX to vtkType.h
> 1b) Add VTK_PARSE_BOUNDING_BOX to vtkParseTypeMap in vtkParse.y
> 1c) Add BoundingBox to the type_name definition in vtkParse.y
> 1d) Add BoundingBox detection to the guess_id_type method in vtkParse.y.
> 1e) Add vtkBoundingBox entry in vtkParse.l
>

The situation with vtkUnicodeString is very different from the situation
with vtkBoundingBox.  Most languages have the concept of a "unicode
string", so we want vtkUnicodeString to be directly converted into e.g. a
Python unicode string or a Java string.

The type list in vtkType.h is for types that can be converted to native
types in the wrapper language.  Consider the python wrappers: they do not
convert vtkBoundingBox into an existing python type, instead they wrap it
as a new python type.  If you add VTK_PARSE_BOUNDING_BOX, then you'd also
have to check for it in vtkWrapPython.c, which is messier that the current
situation where all we had to do was add it to the CMakeLists file.


> 2) Teach the wrapper about vtkBoundingBox (Tcl as an example, assuming
> others are similar...)
> 2a) Modify CheckFunctionSignature to allow vtkBoundingBox return types.
> 2b) Modify output_temp to declare the vtkBoundingBox temporary variable.
> 2c) Add a special case for vtkBoundingBox return types in outputFunction
> that converts to a bounds array.
>

CheckFunctionSignature() can recognize vtkBoundingBox by using strcmp to
check whether the class name of the type is "vtkBoundingBox".  In other
words, modify the place where CheckFunctionSignature() looks at
VTK_PARSE_OBJECT types (starting at line 888) and have it check for
"vtkBoundingBox" there.   This makes everything in (1) completely
unnecessary.   The list for (2) is good, though.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150330/6346ed8a/attachment-0001.html>


More information about the vtk-developers mailing list