[vtk-developers] Removing the vtkstd headers from VTK master - using STL directly

David Gobbi david.gobbi at gmail.com
Tue Dec 13 16:07:36 EST 2011


Hi Marcus,

The two lines where "vtkstd::" appears as a strcmp argument should be
removed,
rather than converted to "std::".

vtkParseExtras.c line 686, vtkWrapPython.c line 369

If vtkstd is no longer in any VTK headers, the wrappers don't need to look
vtkstd::string.
Fortunately the wrappers already look for std:string.

 - David


On Tue, Dec 13, 2011 at 1:43 PM, Marcus D. Hanwell <
marcus.hanwell at kitware.com> wrote:
> Hi David,
>
> The commit in question is included below for your convenience. We
> should be upgrading the main Gerrit soon, but I could post it there
> too if it makes things easier. I also pushed the topic as it is to the
> stage if you would rather take a look at it there.
>
> Marcus
>
> commit f0432501b6e820b75aed8618fbfe4ce20f51680cAuthor: Marcus D.
> Hanwell <marcus.hanwell at kitware.com>Date:   Tue Dec 13 11:40:39 2011
> -0500
>     ENH: Removed vtkstd:: from the wrapper generators        It isn't
> clear, but I suspect these lines could be removed entirely.    There
> is another wrapper file with some references that should likely
> also be fixed.        Change-Id:
> Ibaaa36648f55da0d7c229d4cfd47f8705fb9e7a6
> diff --git a/Wrapping/vtkParseExtras.c
> b/Wrapping/vtkParseExtras.cindex 8223f25..e4b5603 100644---
> a/Wrapping/vtkParseExtras.c+++ b/Wrapping/vtkParseExtras.c@@ -683,7
> +683,7 @@ size_t vtkParse_BasicTypeFromString(         m = 0;
> if (strncmp(cp, "::", 2) == 0) { m = 2; }         else if (strncmp(cp,
> "std::", 5) == 0) { m = 5; }-        else if (strncmp(cp, "vtkstd::",
> 8) == 0) { m = 8; }+        else if (strncmp(cp, "std::", 8) == 0) { m
> = 8; }          /* advance past the namespace */         tmpcp = cp +
> m;diff --git a/Wrapping/vtkWrapPython.c
> b/Wrapping/vtkWrapPython.cindex 8d3f2c9..0eb6c2c 100644---
> a/Wrapping/vtkWrapPython.c+++ b/Wrapping/vtkWrapPython.c@@ -366,7
> +366,7 @@ static size_t vtkWrapPython_PyTemplateName(const char *name,
> char *pname)   /* look for VTK types that become common python types
> */   if ((n == 12 && strncmp(name, "vtkStdString", n) == 0) ||
> (n == 11 && strncmp(name, "std::string", n) == 0) ||-      (n == 14 &&
> strncmp(name, "vtkstd::string", n) == 0))+      (n == 14 &&
> strncmp(name, "std::string", n) == 0))     {     strcpy(pname, "str");
>     return n;diff --git a/Wrapping/vtkWrapTcl.c
> b/Wrapping/vtkWrapTcl.cindex c5e80f1..e27efa0 100644---
> a/Wrapping/vtkWrapTcl.c+++ b/Wrapping/vtkWrapTcl.c@@ -1059,7 +1059,7
> @@ void vtkParseOutput(FILE *fp, FileInfo *file_info)
> fprintf(fp,"#include \"%s.h\"\n\n",data->Name);   fprintf(fp,"#include
> \"vtkTclUtil.h\"\n");   fprintf(fp,"#include \"vtkStdString.h\"\n");-
> fprintf(fp,"#include <vtkstd/stdexcept>\n");+  fprintf(fp,"#include
> <stdexcept>\n");   fprintf(fp,"#include <vtksys/ios/sstream>\n");   if
> (!data->IsAbstract)     {@@ -1452,7 +1452,7 @@ void
> vtkParseOutput(FILE *fp, FileInfo *file_info)     }    fprintf(fp,"
> }\n");-  fprintf(fp,"  catch (vtkstd::exception &e)\n");+
> fprintf(fp,"  catch (std::exception &e)\n");   fprintf(fp,"    {\n");
>  fprintf(fp,"    Tcl_AppendResult(interp, \"Uncaught exception: \",
> e.what(), \"\\n\", NULL);\n");   fprintf(fp,"    return
> TCL_ERROR;\n");
> On Tue, Dec 13, 2011 at 3:36 PM, David Gobbi <david.gobbi at gmail.com>
wrote:
>> Hi Marcus,
>>
>> I'll take a look when I get home... port 81 is blocked by the firewall
at work.
>>
>>  - David
>>
>>
>> On Tue, Dec 13, 2011 at 10:04 AM, Bill Lorensen <bill.lorensen at gmail.com>
wrote:
>>> They are part of the public API.
>>>
>>> I noticed that Slicer4 uses them, but only in two file. Likewise the
>>> WikiExamples, but only in a couple of examples. In each case I'll
>>> remove the vtkstd.
>>>
>>> Your "remove legacy" approach with complete removal in VTK6 sounds good
to me.
>>>
>>>
>>> On Tue, Dec 13, 2011 at 11:58 AM, Marcus D. Hanwell
>>> <marcus.hanwell at kitware.com> wrote:
>>>> Yes, I thought I would need to do that, but not generate them at all
>>>> if remove legacy is on, and then perhaps remove them in for the 6.0
>>>> release. I can make that change, please let me know if you see any
>>>> other problems.
>>>>
>>>> It isn't clear if they are part of our public API, but as we installed
>>>> them I guess they were.
>>>>
>>>> Marcus
>>>>
>>>> On Tue, Dec 13, 2011 at 11:55 AM, Bill Lorensen <
bill.lorensen at gmail.com> wrote:
>>>>> I think you should keep the old headers around for backward
>>>>> compatibility. You could stick warning pragmas in the headers.
>>>>>
>>>>> On Tue, Dec 13, 2011 at 11:49 AM, Marcus D. Hanwell
>>>>> <marcus.hanwell at kitware.com> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I just pushed a topic to reviewtest that removes vtkstd from VTK. For
>>>>>> testing purposes I removed the generation of vtkstd altogether, but
>>>>>> that could be modified.
>>>>>>
>>>>>> http://reviewtest.source.kitware.com:81/#/t/31/
>>>>>>
>>>>>> This seems to compile for me, and was done largely using a Python
>>>>>> script and a little regex. Are there objections to me merging this
>>>>>> topic in? Should the vtkstd headers be generated for legacy purposes,
>>>>>> I know at least ParaView (which I can fix) is using vtkstd in some
>>>>>> places.
>>>>>>
>>>>>> I could also use some pointers from David Gobbi, as I suspect what I
>>>>>> did to the wrapper code was not quite right.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Marcus
>>>>>> _______________________________________________
>>>>>> Powered by www.kitware.com
>>>>>>
>>>>>> Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
>>>>>>
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Unpaid intern in BillsBasement at noware dot com
>>>
>>>
>>>
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20111213/748baf75/attachment.html>


More information about the vtk-developers mailing list