<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 30, 2015 at 8:31 AM, Jorge Perez <span dir="ltr"><<a href="mailto:josp.jorge@gmail.com" target="_blank">josp.jorge@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I was also studying the vtkWrapTcl.c code, just the part related to the tasks described in 2). <br><br>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:<br><br><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:11px;font-family:Consolas;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">if ((returnType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER) // the return type is value not a pointer<br></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:11px;font-family:Consolas;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">{</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:11px;font-family:Consolas;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">args_ok = 0;</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:11px;font-family:Consolas;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">}</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:36pt">....</p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:11px;font-family:Consolas;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">if ((argType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER) // the argument is a value not a pointer<br></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:11px;font-family:Consolas;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">{</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:11px;font-family:Consolas;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">args_ok = 0;</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:11px;font-family:Consolas;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">}</span></p></div></blockquote><div><br></div><div>Yes, exactly. You want to add "if" statements that allow "special" types like vtkVariant and vtkBoundingBox to get through. </div><div><br></div><div> if ((argType & VTK_PARSE_INDIRECT) == VTK_PARSE_REF || /* pass by reference e.g. "¶m" */</div><div> (argType & VTK_PARSE_INDIRECT) == 0) /* pass-by-value */</div><div> {</div><div> if (strcmp(currentFunction->ReturnClass, "vtkVariant") == 0 ||</div><div> strcmp(currentFunction->ReturnClass, "vtkBoundingox") == 0)</div><div> {</div><div> /* is a special object passed by reference or passed by value */</div><div> }</div><div> else</div><div> {</div><div> /* is unrecognized */</div><div> args_ok = 0;</div><div> }</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:6.24pt">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.</p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:6.24pt"><br></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:6.24pt">I'm experimenting with this idea: implement new Tcl_ObjType to wrap vtkVariant and vtkBoundingBox.<br></p></div></blockquote><div><br></div><div>Sounds like it should work, but it has been so long since I've worked with Tcl that I don't remember anything about creating new tcl object types!</div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:6.24pt">By the way the generated C code could be based in Tcl_Obj *objv[] interface instead of char *argv[]</p></div></blockquote><div><br></div><div>If you think it would be a good change, put it on <a href="http://gitlab.kitware.com">gitlab.kitware.com</a> and I'll take a look.</div><div><br></div><div>Cheers,</div><div> - David <br></div></div></div></div>