[vtk-developers] Tcl wrapping and output array arguments
Jorge Perez
josp.jorge at gmail.com
Mon Mar 30 10:31:34 EDT 2015
I was also studying the vtkWrapTcl.c code, just the part related to the
tasks described in 2).
For instance, regarding to vtkVariant value, the function int
checkFunctionSignature(ClassInfo *data) reject to wrap a method call if the
return value is vtkVariant or expect an argument of type vtkVariant in one
of this checks:
if ((returnType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER) // the return
type is value not a pointer
{
args_ok = 0;
}
....
if ((argType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER) // the argument is
a value not a pointer
{
args_ok = 0;
}
I think that we can wrap (at least manually) some classes (vtkVariant,
vtkBoundingBox, ...) not derived from vtkObject as new Tcl_ObjType and
provide in vtkTclUtil some helper functions to convert from C++ instances
to Tcl_Obj and the other way from Tcl_Obj to C++ instance.
I'm experimenting with this idea: implement new Tcl_ObjType to wrap
vtkVariant and vtkBoundingBox.
By the way the generated C code could be based in Tcl_Obj *objv[] interface
instead of char *argv[]
best regards,
Jorge
2015-03-30 15:26 GMT+02:00 David Lonie <david.lonie at kitware.com>:
> 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
>
> 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.
>
> Sound good? Anything I'm missing?
>
> Thanks a ton!
> Dave
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150330/91d45d1e/attachment.html>
More information about the vtk-developers
mailing list