[Paraview-developers] interesting bug in vtkPVGeneratedModules.h

andy.cedilnik at kitware.com andy.cedilnik at kitware.com
Sun, 21 Dec 2003 11:04:15 -0500


Hi Brian,

My fault here. The ProcessXML was written initially to not handle bad
compilers (Visual Studio and xlC), which do not handle long string
literals. Then I hacked in the check for that which was just plain wrong
and it worked just to annoy me. Anyway, I am redoing the code right now.
I think by Monday it will work fine.

      Andy Cedilnik
      Kitware Inc.

On Fri, Dec 19, 2003 at 04:28:49PM -0700, Wylie, Brian wrote:
> So... lets see... I will try to explain this bug as well as I can...
> 
> My understanding is that files like reader.xml are processed, put into a
> string(s) and put in vtkPVGeneratedModules.h... My recollection is that
> after a while these files got so large that some string lengths were
> exceeded.. so now they're put into multiple strings. Well I just noticed
> that an interesting thing happens. If you have an #ifdef that is not defined
> and it happens to be around a 'divide' location between strings than the
> string declaration (when put into the vtkPVGeneratedModules.h) actually is
> #ifdef'd out. So I get the following error.
> 
> C:\Work\vtk_stuff\ParaView\ParaView\vtkPVGeneratedModules.h(1847) : error
> C2065: 'vtkPVInitializeStandardReadersInterfaces2' : undeclared identifier
> 
> I can avoid this error by simply moving around the modules in readers.xml.
> Here's a code snippet from vtkPVGeneratedModules.h to demonstrate.
> 
> ...
> 
> "  <LabeledToggle label=\"Block Ids\" variable=\"GenerateBlockIdCellArray\"
> trace_name=\"block_ids\" help=\"Select whether the reader generates block
> ids\" default_value=\"1\"/>\n"
> "  <LabeledToggle label=\"Global Node Ids\"
> variable=\"GenerateGlobalNodeIdArray\" trace_name=\"global_node_ids\"
> help=\"Select whether the reader generates global node ids\"
> default_value=\"1\"/>\n"
> "  <LabeledToggle label=\"Global Element Ids\"
> variable=\"GenerateGlobalElementIdArray\" trace_name=\"blobal_element_ids\"
> help=\"Select whether the reader generates global element ids\"
> default_value=\"0\"/>\n"
> " </Module>\n"
> "\n"
> #endif // End of ifdef
> "\n"
> #ifdef PARAVIEW_USE_SAF
> " <Module name=\"SAFReader\" root_name=\"SAFReader\" \n"
> "    output=\"vtkUnstructuredGrid\" \n"
> "    class=\"vtkPVAdvancedReaderModule\" module_type=\"Reader\"
> extensions=\".saf\" \n"
> "    file_description=\"SAF Reader\">\n"
> ;
> 
> // From file C:/Work/vtk_stuff/ParaView/ParaView/Resources/Readers.xml
> static const char* vtkPVInitializeStandardReadersInterfaces2 =
> "  <Source class=\"vtkSAFPVReader\"/>\n"
> "\n"
> "  <Scale variable=\"TimeStep\" type=\"int\" label=\"Time step\"
> trace_name=\"TimeStep\"\n"
> "    help=\"Set the current timestep.\" range_source=\"TimeStepRange\" />\n"
> "\n"
> "  <ArraySelection trace_name=\"variable_sel\" attribute_name=\"Variable\"
> />\n"
> " \n"
> "  <ArraySelection trace_name=\"block_sel\" attribute_name=\"Block\"  />\n"
> " \n"
> " </Module>\n"
> "\n"
> #endif // End of ifdef
> ...
> 
> So... you can see that the #ifdef is around the declaration of
> vtkPVInitializeStandardReadersInterfaces2 and therefore
> vtkPVInitializeStandardReadersInterfaces2  is never declared. :) 
> 
> 	Brian Wylie
> 	Sandia National Laboratories
> 	MS 0822 - Org 9227 - Building 880/A1-J
>      (505) 844-2238   FAX (505) 845-0833
> 
> 
> _______________________________________________
> Paraview-developers mailing list
> Paraview-developers at paraview.org
> http://public.kitware.com/mailman/listinfo/paraview-developers