From ce2fbefb32b19ae46634d47233311a5a3d461547 Mon Sep 17 00:00:00 2001 From: abn Date: Mon, 16 Mar 2015 11:41:50 +0100 Subject: [PATCH] Code clean up: removing VTK wrapping code. All former C++ and Python code related to the CORBA wrapping of VTK classes is now removed. --- CMakeLists.txt | 16 - INSTALL | 13 +- idl/CMakeLists.txt | 29 +- idl/PARAVIS_Gen.idl | 127 - idl/PARAVIS_Gen_Types.idl | 46 - idl/{no_wrap => }/PVSERVER_Gen.idl | 5 + idl/create_header.py | 39 - idl/create_header.sh | 28 - idl/create_hints.py | 39 - idl/create_hints.sh | 26 - idl/hints | 258 - idl/hints_paravis | 1 - idl/pythonIDL.py | 2848 ---- idl/vtkWrapIDL.c | 1871 --- idl/wrap.cmake | 84 - src/CMakeLists.txt | 7 - src/ENGINE/CMakeLists.txt | 30 +- src/ENGINE/PARAVIS_Engine_i.cc | 303 - src/ENGINE/PARAVIS_Engine_i.hh | 124 - src/ENGINE/{no_wrap => }/PVSERVER.py | 8 +- src/ENGINE/{no_wrap => }/PVSERVER_utils.py | 0 src/PVGUI/CMakeLists.txt | 65 - src/PVGUI/PARAVIS_Gen_i.cc | 743 - src/PVGUI/PARAVIS_Gen_i.hh | 231 - src/PVGUI/PVGUI_Module.cxx | 7 - src/PVGUI/PVGUI_Module.h | 2 +- src/PVGUI/PVGUI_Module_actions.cxx | 46 +- src/PVGUI/PVGUI_Module_widgets.cxx | 1 - src/PVGUI/PVGUI_ParaViewSettingsPane.h | 2 +- src/PVGUI/PVGUI_Tools.cxx | 28 +- src/PVGUI/PVGUI_Tools.h | 8 - src/PVGUI/PV_Events.h | 250 - src/PVGUI/PV_I.h | 43 - .../PVGUI_MatplotlibMathTextUtilities.cxx | 24 - .../PVGUI_MatplotlibMathTextUtilities.h | 42 - src/PVGUI/deprecated/PV_Tools.cxx | 125 - src/PVGUI/deprecated/PV_Tools.h | 52 - src/PV_SWIG/CMakeLists.txt | 15 +- src/PV_SWIG/no_wrap/paravisSM.py | 30 - src/PV_SWIG/no_wrap/presentations.py | 2659 ---- src/PV_SWIG/no_wrap/pvsimple.py | 111 - src/PV_SWIG/paravis.py | 97 - src/PV_SWIG/paravisSM.py | 3001 +--- src/PV_SWIG/presentations.py | 39 +- src/PV_SWIG/{no_wrap => }/pvserver.py | 6 + src/PV_SWIG/pvsimple.py | 1224 +- src/PV_SWIG/servermanager.diff | 305 - src/PV_SWIG/simple.diff | 305 - src/VTKWrapping/CMakeLists.txt | 87 - src/VTKWrapping/GenerateWrapList.cmake | 27 - src/VTKWrapping/ParaView/lex.yy.c | 5427 ------- src/VTKWrapping/ParaView/vtkParse.tab.c | 12915 ---------------- src/VTKWrapping/ParaView/vtkParseData.c | 938 -- src/VTKWrapping/ParaView/vtkParseData.h | 334 - src/VTKWrapping/ParaView/vtkParseExtras.c | 1380 -- src/VTKWrapping/ParaView/vtkParseExtras.h | 173 - src/VTKWrapping/ParaView/vtkParseHierarchy.c | 1016 -- src/VTKWrapping/ParaView/vtkParseHierarchy.h | 159 - src/VTKWrapping/ParaView/vtkParseMain.c | 514 - src/VTKWrapping/ParaView/vtkParseMain.h | 86 - src/VTKWrapping/ParaView/vtkParsePreprocess.c | 3118 ---- src/VTKWrapping/ParaView/vtkParsePreprocess.h | 254 - src/VTKWrapping/ParaView/vtkParseString.c | 544 - src/VTKWrapping/ParaView/vtkParseString.h | 246 - src/VTKWrapping/ParaView/vtkWrap.c | 1040 -- src/VTKWrapping/ParaView/vtkWrap.h | 250 - src/VTKWrapping/ParaView/vtkWrapHierarchy.c | 977 -- src/VTKWrapping/ParaView/vtkWrapText.c | 986 -- src/VTKWrapping/ParaView/vtkWrapText.h | 61 - src/VTKWrapping/create_class.py | 62 - src/VTKWrapping/create_class.sh | 35 - src/VTKWrapping/getwrapclasses.py | 158 - src/VTKWrapping/readme.txt | 3 - src/VTKWrapping/wrap.cmake | 88 - 74 files changed, 160 insertions(+), 46081 deletions(-) delete mode 100644 idl/PARAVIS_Gen.idl delete mode 100644 idl/PARAVIS_Gen_Types.idl rename idl/{no_wrap => }/PVSERVER_Gen.idl (86%) delete mode 100755 idl/create_header.py delete mode 100755 idl/create_header.sh delete mode 100755 idl/create_hints.py delete mode 100755 idl/create_hints.sh delete mode 100644 idl/hints delete mode 100644 idl/hints_paravis delete mode 100644 idl/pythonIDL.py delete mode 100644 idl/vtkWrapIDL.c delete mode 100755 idl/wrap.cmake delete mode 100644 src/ENGINE/PARAVIS_Engine_i.cc delete mode 100644 src/ENGINE/PARAVIS_Engine_i.hh rename src/ENGINE/{no_wrap => }/PVSERVER.py (96%) rename src/ENGINE/{no_wrap => }/PVSERVER_utils.py (100%) delete mode 100644 src/PVGUI/PARAVIS_Gen_i.cc delete mode 100644 src/PVGUI/PARAVIS_Gen_i.hh delete mode 100644 src/PVGUI/PV_Events.h delete mode 100644 src/PVGUI/PV_I.h delete mode 100644 src/PVGUI/deprecated/PVGUI_MatplotlibMathTextUtilities.cxx delete mode 100644 src/PVGUI/deprecated/PVGUI_MatplotlibMathTextUtilities.h delete mode 100644 src/PVGUI/deprecated/PV_Tools.cxx delete mode 100644 src/PVGUI/deprecated/PV_Tools.h delete mode 100644 src/PV_SWIG/no_wrap/paravisSM.py delete mode 100644 src/PV_SWIG/no_wrap/presentations.py delete mode 100644 src/PV_SWIG/no_wrap/pvsimple.py delete mode 100644 src/PV_SWIG/paravis.py rename src/PV_SWIG/{no_wrap => }/pvserver.py (85%) delete mode 100644 src/PV_SWIG/servermanager.diff delete mode 100644 src/PV_SWIG/simple.diff delete mode 100644 src/VTKWrapping/CMakeLists.txt delete mode 100644 src/VTKWrapping/GenerateWrapList.cmake delete mode 100644 src/VTKWrapping/ParaView/lex.yy.c delete mode 100644 src/VTKWrapping/ParaView/vtkParse.tab.c delete mode 100644 src/VTKWrapping/ParaView/vtkParseData.c delete mode 100644 src/VTKWrapping/ParaView/vtkParseData.h delete mode 100644 src/VTKWrapping/ParaView/vtkParseExtras.c delete mode 100644 src/VTKWrapping/ParaView/vtkParseExtras.h delete mode 100644 src/VTKWrapping/ParaView/vtkParseHierarchy.c delete mode 100644 src/VTKWrapping/ParaView/vtkParseHierarchy.h delete mode 100644 src/VTKWrapping/ParaView/vtkParseMain.c delete mode 100644 src/VTKWrapping/ParaView/vtkParseMain.h delete mode 100644 src/VTKWrapping/ParaView/vtkParsePreprocess.c delete mode 100644 src/VTKWrapping/ParaView/vtkParsePreprocess.h delete mode 100644 src/VTKWrapping/ParaView/vtkParseString.c delete mode 100644 src/VTKWrapping/ParaView/vtkParseString.h delete mode 100644 src/VTKWrapping/ParaView/vtkWrap.c delete mode 100644 src/VTKWrapping/ParaView/vtkWrap.h delete mode 100644 src/VTKWrapping/ParaView/vtkWrapHierarchy.c delete mode 100644 src/VTKWrapping/ParaView/vtkWrapText.c delete mode 100644 src/VTKWrapping/ParaView/vtkWrapText.h delete mode 100755 src/VTKWrapping/create_class.py delete mode 100755 src/VTKWrapping/create_class.sh delete mode 100644 src/VTKWrapping/getwrapclasses.py delete mode 100644 src/VTKWrapping/readme.txt delete mode 100755 src/VTKWrapping/wrap.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a980a903..b5e74ece 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,8 +80,6 @@ OPTION(SALOME_PARAVIS_USE_GEOM_SOURCE "Import a GEOMETRY object to PARAVIS via i OPTION(SALOME_PARAVIS_USE_SMESH_SOURCE "Import a MESH object to PARAVIS via its Corba IOR" ON) CMAKE_DEPENDENT_OPTION(SALOME_LIGHT_ONLY "Build SALOME Light only (no CORBA)" OFF "NOT SALOME_KERNEL_LIGHT_ONLY" ON) -CMAKE_DEPENDENT_OPTION(SALOME_PARAVIS_MINIMAL_CORBA "Build PARAVIS with a minimal CORBA interface" ON - "NOT SALOME_LIGHT_ONLY" ON) IF(SALOME_BUILD_TESTS) ENABLE_TESTING() @@ -249,20 +247,6 @@ MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTH MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED) MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC SALOME_PARAVIS_INSTALL_RES_DATA) -## Generation of the list of VTK classes (to be wrapped into IDLs) -## ===================================== -IF(NOT SALOME_LIGHT_ONLY AND NOT SALOME_PARAVIS_MINIMAL_CORBA) - ADD_DEFINITIONS(-DPARAVIS_WITH_FULL_CORBA) - # TODO: the below requires ParaView in the PYTHONPATH ... not so nice: - MESSAGE(STATUS "Generating list of wrapped VTK classes ...") - LIST(GET PARAVIEW_INCLUDE_DIRS 0 PARAVIEW_INCLUDE_DIR0) - EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/VTKWrapping/getwrapclasses.py ${PARAVIEW_INCLUDE_DIR0} - RESULT_VARIABLE _res) - IF(NOT _res EQUAL 0) - MESSAGE(FATAL_ERROR "Unable to run the Python script retrieving the list of VTK classes.") - ENDIF() -ENDIF() - # Accumulate environment variables for PARAVIS module SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}) diff --git a/INSTALL b/INSTALL index 4aff1376..f1d93cb4 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ Building and installing PARAVIS module -=============================================== +====================================== PARAVIS is a SALOME module that wraps ParaView GUI and makes it available in SALOME GUI. @@ -8,22 +8,23 @@ Like any other SALOME module, PARAVIS requires PARAVIS_ROOT_DIR environment vari installation directory. Specific prerequisites: -- cmake 2.6 or higher should be installed, path to cmake executable +- cmake 2.8.10 or higher should be installed, path to cmake executable should be added to PATH environment variable. -- ParaView-3.7.0, should be installed - +- ParaView-4.3.1, should be installed It also requires common SALOME environment including GUI_ROOT_DIR and other standard SALOME prerequisites. As soon as the environment is set, execute the following commands in a shell: -mkdir PARAVIS_BIN +mkdir PARAVIS_BUILD +cd PARAVIS_BUILD ccmake ../PARAVIS_SRC make make install PARAVIS module can be launched using the following commands: -runSalome --modules="PARAVIS" +salome -mMED,PARAVIS + diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt index 53a1469b..ae091f6c 100644 --- a/idl/CMakeLists.txt +++ b/idl/CMakeLists.txt @@ -24,37 +24,18 @@ INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR}/idl ) +ADD_DEFINITIONS(${OMNIORB_DEFINITIONS}) + # we use PARAVIS specific back-end SET(OMNIORB_IDLPYFLAGS -bpythonIDL -p${CMAKE_CURRENT_SOURCE_DIR}) -IF(NOT SALOME_PARAVIS_MINIMAL_CORBA) - INCLUDE(wrap.cmake) - # Hack to have a -D on the omniidl command line: - # (again, this shouldn't last for long ...) - SET(OMNIORB_IDLCXXFLAGS "${OMNIORB_IDLCXXFLAGS};-DPARAVIS_WITH_FULL_CORBA") - SET(OMNIORB_IDLPYFLAGS "${OMNIORB_IDLPYFLAGS};-DPARAVIS_WITH_FULL_CORBA") - - SET(SalomeIDLPARAVIS_IDLSOURCES - PARAVIS_Gen.idl - PARAVIS_Gen_Types.idl - ${WRAP_IDL} +SET(SalomeIDLPARAVIS_IDLSOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/PVSERVER_Gen.idl ) - SET(_idl_include_dirs +SET(_idl_include_dirs ${CMAKE_CURRENT_SOURCE_DIR} ${KERNEL_ROOT_DIR}/idl/salome - ) -ELSE() - SET(SalomeIDLPARAVIS_IDLSOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/no_wrap/PVSERVER_Gen.idl - ) - SET(_idl_include_dirs - ${CMAKE_CURRENT_SOURCE_DIR}/no_wrap - ${KERNEL_ROOT_DIR}/idl/salome ) -ENDIF() - -ADD_DEFINITIONS(${OMNIORB_DEFINITIONS}) - SET(_idl_link_flags ${KERNEL_SalomeIDLKernel} ) diff --git a/idl/PARAVIS_Gen.idl b/idl/PARAVIS_Gen.idl deleted file mode 100644 index 3eef8526..00000000 --- a/idl/PARAVIS_Gen.idl +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : PARAVIS_Gen.idl -// Author : Vitaly Smetannikov - -/*! \file PARAVIS_Gen.idl This file conatins a set of interfaces of the %PARAVIS module. - * This module provides access to PARAVIEW functionality integrated to %SALOME application. - */ - -#ifndef __PARAVIS_GEN__ -#define __PARAVIS_GEN__ - -#include "SALOME_Exception.idl" -#include "SALOME_GenericObj.idl" -#include "SALOME_Component.idl" -#include "SALOMEDS.idl" -#include "PARAVIS_Gen_Types.idl" - -/*! - The main package of interfaces of the module %PARAVIS. -*/ -module PARAVIS { - - interface vtkObject; - interface vtkSMObject; - interface vtkProcessModule; - interface vtkPVPythonModule; - - /*! - * \brief Base class for all PARAVIS container(wrapper) classes - */ - interface PARAVIS_Base { - boolean IsSame(in PARAVIS_Base theOther); - }; - - - /*! - * \brief The main interface class for PARAVIS server. - * Instantiation of this class has to be done before access to any other PARAVIS interfaces - */ - interface PARAVIS_Gen : Engines::EngineComponent, SALOMEDS::Driver - { - /*! - * \brief Returns IOR of the current object. - */ - string GetIOR(); - - /*! - * \brief Import file to PARAVIS module. - * File can be of any type supported by Paraview and installed plug-ins. - */ - void ImportFile(in string theFileName); - - - void ExecuteScript(in string script); - - /*! - * Returns trace string if trace is activated for current session. - * Otherwise it returns empty string. - */ - string GetTrace(); - - /*! - * \brief Save trace sting to a disk file. - * \param theFileName - name of file. - */ - void SaveTrace(in string theFileName); - - /*! - * \brief Returns list of names of extracted Paraview and VTK classes - */ - string_array GetClassesList(); - - /*! - * \brief Returns container class for the requested Paraview class - */ - PARAVIS_Base CreateClass(in string theClassName); - - /*! - * Returns parameters of current (usually built-in) connection which is active in GUI (Paraview client). - * \param theId - connection ID - * \param theDHost - name of data host - * \param theDPort - number of data port - * \param theRHost - name of representation host - * \param theRPort - number of representation port - * \param theReversed - returns 1 or 0 depending on server resource scheme - */ - void GetConnectionParameters(out long theId, out string theDHost, out long theDPort, - out string theRHost, out long theRPort, out long theReversed); - - /*! - * \brief Activates GUI of PARAVIS module. If module is active then do nothing. - * GUI must be active before call of any server manager API function. - * This function is called on activation paravis python module. - */ - void ActivateModule(); - - - /*! Sets a definite study to be current. - */ - void SetCurrentStudy(in SALOMEDS::Study theStudy); - - /*! Gets the current study. - */ - SALOMEDS::Study GetCurrentStudy(); - - }; - -}; - -#endif diff --git a/idl/PARAVIS_Gen_Types.idl b/idl/PARAVIS_Gen_Types.idl deleted file mode 100644 index f7ce667e..00000000 --- a/idl/PARAVIS_Gen_Types.idl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : PARAVIS_Gen.idl -// Author : Vladimir Turin -// - -/*! \file PARAVIS_Gen_Types.idl This file conatins a set of type declarations of the %PARAVIS module. - * This module provides access to PARAVIEW functionality integrated to %SALOME application. - */ - - -#ifndef __PARAVIS_GEN_TYPES__ -#define __PARAVIS_GEN_TYPES__ - -#/*! - Definition of collection classes for %PARAVIS module. -*/ -module PARAVIS { - - typedef string function; - typedef sequence string_array; - typedef sequence short_array; - typedef sequence long_array; - typedef sequence float_array; - typedef sequence double_array; - typedef sequence char_array; - -}; - -#endif diff --git a/idl/no_wrap/PVSERVER_Gen.idl b/idl/PVSERVER_Gen.idl similarity index 86% rename from idl/no_wrap/PVSERVER_Gen.idl rename to idl/PVSERVER_Gen.idl index 5aaa1eb2..54911b78 100644 --- a/idl/no_wrap/PVSERVER_Gen.idl +++ b/idl/PVSERVER_Gen.idl @@ -29,6 +29,9 @@ /*! The main package of interfaces of the module %PARAVIS. + The main service provided by the interface is to give to the caller the URL of the pvserver, and to launch it + if it is not already started. + The connection to the ParaView's pvserver should then be done using ParaView's API directly. */ module PVSERVER_ORB { @@ -70,6 +73,8 @@ module PVSERVER_ORB { * This avoids multiple attempts to connect from a single thread (makes ParaView crash). */ void SetGUIConnected(in boolean isConnected); + /*! Indicates if the GUI process is already connected to the pvserver. + * This avoids multiple attempts to connect from a single thread (makes ParaView crash). */ boolean GetGUIConnected(); }; diff --git a/idl/create_header.py b/idl/create_header.py deleted file mode 100755 index ec3fbca6..00000000 --- a/idl/create_header.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -import sys -import os - -ffile = "vtkWrapIDL.h" -wfile = os.path.join(sys.argv[1], "wrapfiles.txt") - -ffile_stream = open(ffile, "w") -ffile_stream.write('const char* wrapped_classes[] = {') -ffile_stream.write('\n') -wfile_stream = open(wfile) -for line in wfile_stream: - ffile_stream.write('"'+line.split()[0]+'",') - ffile_stream.write('\n') - pass -wfile_stream.close() -ffile_stream.write('""') -ffile_stream.write('\n') -ffile_stream.write('};') -ffile_stream.write('\n') -ffile_stream.close() diff --git a/idl/create_header.sh b/idl/create_header.sh deleted file mode 100755 index 201fedaf..00000000 --- a/idl/create_header.sh +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -#!/bin/bash - -file=vtkWrapIDL.h -wfile=$1/wrapfiles.txt - -echo 'const char* wrapped_classes[] = {' > $file -awk '{print "\""$1"\",";}' $wfile >> $file -echo '""' >> $file -echo '};' >> $file diff --git a/idl/create_hints.py b/idl/create_hints.py deleted file mode 100755 index dd3988d5..00000000 --- a/idl/create_hints.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -import sys -import os - -CONF_DIR = os.path.dirname(sys.argv[0]) - -content = "" -for filename in [ -# os.path.join(sys.argv[1], "hints"), - os.path.join(CONF_DIR, "hints"), - os.path.join(CONF_DIR, "hints_paravis"), - ]: - stream = open(filename) - content += stream.read() - stream.close() - pass - -filename = "hints" -stream = open(filename, "w") -stream.write(content) -stream.close() diff --git a/idl/create_hints.sh b/idl/create_hints.sh deleted file mode 100755 index 5d243c6f..00000000 --- a/idl/create_hints.sh +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -#!/bin/bash - -CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` - -#cp $1/hints hints -cp ${CONF_DIR}/hints hints -cat ${CONF_DIR}/hints_paravis >> hints diff --git a/idl/hints b/idl/hints deleted file mode 100644 index 79132807..00000000 --- a/idl/hints +++ /dev/null @@ -1,258 +0,0 @@ -vtkAbstractMapper3D GetBounds 307 6 -vtkAbstractMapper3D GetCenter 307 3 -vtkAbstractTransform TransformDoubleNormalAtPoint 307 3 -vtkAbstractTransform TransformDoublePoint 307 3 -vtkAbstractTransform TransformDoubleVectorAtPoint 307 3 -vtkAbstractTransform TransformFloatNormalAtPoint 301 3 -vtkAbstractTransform TransformFloatPoint 301 3 -vtkAbstractTransform TransformFloatVectorAtPoint 301 3 -vtkAbstractTransform TransformNormalAtPoint 307 3 -vtkAbstractTransform TransformPoint 307 3 -vtkAbstractTransform TransformVectorAtPoint 307 3 -vtkAbstractVolumeMapper GetBounds 307 6 -vtkActor GetBounds 307 6 -vtkAlgorithm GetUpdateExtent 304 6 -vtkAnnotatedCubeActor GetBounds 307 6 -vtkAssembly GetBounds 307 6 -vtkAxesActor GetBounds 307 6 -vtkAxisActor GetBounds 307 6 -vtkBoxRepresentation GetBounds 307 6 -vtkCamera GetOrientation 307 3 -vtkCamera GetOrientationWXYZ 307 4 -vtkCell GetBounds 307 6 -vtkCharArray GetValueRange 303 2 -vtkColorTransferFunction GetColor 307 3 -vtkCompositePolyDataMapper2 GetBounds 307 6 -vtkCompositePolyDataMapper GetBounds 307 6 -vtkCoordinate GetComputedDisplayValue 304 2 -vtkCoordinate GetComputedDoubleDisplayValue 307 2 -vtkCoordinate GetComputedDoubleViewportValue 307 2 -vtkCoordinate GetComputedLocalDisplayValue 304 2 -vtkCoordinate GetComputedViewportValue 304 2 -vtkCoordinate GetComputedWorldValue 307 3 -vtkCubeAxesActor2D GetBounds 307 6 -vtkCubeAxesActor2D GetRanges 307 6 -vtkCubeAxesActor GetBounds 307 6 -vtkDataArray GetRange 307 2 -vtkDataArray GetTuple2 307 2 -vtkDataArray GetTuple3 307 3 -vtkDataArray GetTuple4 307 4 -vtkDataArray GetTuple9 307 9 -vtkDataObject GetUpdateExtent 304 6 -vtkDataObject GetWholeBoundingBox 307 6 -vtkDataObject GetWholeExtent 304 6 -vtkDataSet GetBounds 307 6 -vtkDataSet GetCenter 307 3 -vtkDataSet GetPoint 307 3 -vtkDataSet GetScalarRange 307 2 -vtkDICOMImageReader GetImageOrientationPatient 301 6 -vtkDICOMImageReader GetImagePositionPatient 301 3 -vtkDICOMImageReader GetPixelSpacing 307 3 -vtkDirectionEncoder GetDecodedGradient 301 3 -vtkDistanceRepresentation GetPoint1WorldPosition 307 3 -vtkDistanceRepresentation GetPoint2WorldPosition 307 3 -vtkDoubleArray GetValueRange 307 2 -vtkExtentSplitter GetSubExtent 304 6 -vtkExtractUnstructuredGrid GetExtent 307 6 -vtkFloatArray GetValueRange 301 2 -vtkFunctionParser GetVectorResult 307 3 -vtkFunctionParser GetVectorVariableValue 307 3 -vtkGeometryFilter GetExtent 307 6 -vtkGraph GetEdgePoint 307 3 -vtkGraphMapper GetBounds 307 6 -vtkGridSynchronizedTemplates3D GetExecuteExtent 304 6 -vtkHandleRepresentation GetDisplayPosition 307 3 -vtkHandleRepresentation GetWorldPosition 307 3 -vtkHexahedron GetEdgeArray 304 2 -vtkHexahedron GetFaceArray 304 4 -vtkHyperOctree GetPoint 307 3 -vtkHyperStreamline GetStartPosition 307 3 -vtkIDTypeArray GetValueRange 30A 2 -vtkImageAccumulate GetComponentExtent 304 6 -vtkImageActor GetBounds 307 6 -vtkImageActor GetDisplayExtent 304 6 -vtkImageButterworthHighPass GetCutOff 307 3 -vtkImageButterworthLowPass GetCutOff 307 3 -vtkImageClip GetOutputWholeExtent 304 6 -vtkImageConvolve GetKernel3x3 301 9 -vtkImageConvolve GetKernel3x3x3 301 27 -vtkImageConvolve GetKernel5x5 301 25 -vtkImageData GetDimensions 304 3 -vtkImageData GetExtent 304 6 -vtkImageData GetIncrements 30A 3 -vtkImageData GetPoint 307 3 -vtkImageEllipsoidSource GetWholeExtent 304 6 -vtkImageExport GetDataDimensions 304 3 -vtkImageExport GetDataExtent 304 6 -vtkImageExport GetDataOrigin 307 3 -vtkImageExport GetDataSpacing 307 3 -vtkImageMandelbrotSource GetSizeCX 307 4 -vtkImagePadFilter GetOutputWholeExtent 304 6 -vtkImagePlaneWidget GetCenter 307 3 -vtkImagePlaneWidget GetNormal 307 3 -vtkImagePlaneWidget GetOrigin 307 3 -vtkImagePlaneWidget GetPoint1 307 3 -vtkImagePlaneWidget GetPoint2 307 3 -vtkImageReslice GetResliceAxesDirectionCosines 307 9 -vtkImageReslice GetResliceAxesOrigin 307 3 -vtkImageSincInterpolator GetBlurFactors 307 3 -vtkImageSource GetExecuteExtent 304 6 -vtkImageSpatialAlgorithm GetKernelMiddle 304 3 -vtkImageSpatialAlgorithm GetKernelSize 304 3 -vtkImageSpatialFilter GetKernelMiddle 304 3 -vtkImageSpatialFilter GetKernelSize 304 3 -vtkImageTracerWidget GetHandlePosition 307 3 -vtkImageVectorConvolve GetKernel 301 3 -vtkImageViewer GetPosition 304 2 -vtkImageViewer GetSize 304 2 -vtkImplicitFunction FunctionGradient 307 3 -vtkImplicitPlaneRepresentation GetBounds 307 6 -vtkImplicitPlaneRepresentation GetNormal 307 3 -vtkImplicitPlaneRepresentation GetOrigin 307 3 -vtkImplicitPlaneWidget GetNormal 307 3 -vtkImplicitPlaneWidget GetOrigin 307 3 -vtk__Int64Array GetValueRange 30C 2 -vtkIntArray GetValueRange 304 2 -vtkKdNode GetMaxBounds 307 3 -vtkKdNode GetMaxDataBounds 307 3 -vtkKdNode GetMinBounds 307 3 -vtkKdNode GetMinDataBounds 307 3 -vtkLegendBoxActor GetEntryColor 307 3 -vtkLight GetColor 307 3 -vtkLight GetTransformedFocalPoint 307 3 -vtkLight GetTransformedPosition 307 3 -vtkLinearTransform TransformDoubleNormal 307 3 -vtkLinearTransform TransformDoubleVector 307 3 -vtkLinearTransform TransformFloatNormal 301 3 -vtkLinearTransform TransformFloatVector 301 3 -vtkLinearTransform TransformNormal 307 3 -vtkLinearTransform TransformVector 307 3 -vtkLineRepresentation GetBounds 307 6 -vtkLineRepresentation GetPoint1DisplayPosition 307 3 -vtkLineRepresentation GetPoint1WorldPosition 307 3 -vtkLineRepresentation GetPoint2DisplayPosition 307 3 -vtkLineRepresentation GetPoint2WorldPosition 307 3 -vtkLineWidget GetPoint1 307 3 -vtkLineWidget GetPoint2 307 3 -vtkLODProp3D GetBounds 307 6 -vtkLongArray GetValueRange 306 2 -vtkLongLongArray GetValueRange 30B 2 -vtkLookupTable GetColor 307 3 -vtkLookupTable GetRange 307 2 -vtkLookupTable GetTableValue 307 4 -vtkMapper GetBounds 307 6 -vtkMath HSVToRGB 2307 3 -vtkMath RGBToHSV 2307 3 -vtkMath SolveCubic 2307 5 -vtkMath SolveLinear 2307 3 -vtkMath SolveQuadratic 2307 4 -vtkMatrix4x4 MultiplyDoublePoint 307 4 -vtkMatrix4x4 MultiplyFloatPoint 301 4 -vtkMatrix4x4 MultiplyPoint 301 4 -vtkMedicalImageProperties GetNthWindowLevelPreset 307 2 -vtkMedicalImageProperties GetWindowLevelPreset 307 2 -vtkMINCImageReader GetDataRange 307 2 -vtkPainterPolyDataMapper GetBounds 307 6 -vtkParallelopipedRepresentation GetBounds 307 6 -vtkPiecewiseFunction GetRange 307 2 -vtkPlaneWidget GetCenter 307 3 -vtkPlaneWidget GetNormal 307 3 -vtkPlaneWidget GetOrigin 307 3 -vtkPlaneWidget GetPoint1 307 3 -vtkPlaneWidget GetPoint2 307 3 -vtkPointHandleRepresentation2D GetBounds 307 6 -vtkPointHandleRepresentation3D GetBounds 307 6 -vtkPointSet GetPoint 307 3 -vtkPoints GetBounds 307 6 -vtkPoints GetPoint 307 3 -vtkPointWidget GetPosition 307 3 -vtkPolyData GetUpdateExtent 304 6 -vtkPolyDataMapper GetBounds 307 6 -vtkPolygon ConvertEllipseToImplicit 307 5 -vtkPolygon FitEllipse 307 6 -vtkPolyLine ConvertEllipseToImplicit 307 5 -vtkPolyLine EllipseToImplicit 307 3 -vtkPolyLine FitEllipse 307 6 -vtkProjectedPolyDataRayBounder GetRayBounds 301 2 -vtkProp3D GetBounds 307 6 -vtkProp3D GetCenter 307 3 -vtkProp3D GetOrientation 307 3 -vtkProp3D GetOrientationWXYZ 307 4 -vtkProp3D GetXRange 307 2 -vtkProp3D GetYRange 307 2 -vtkProp3D GetZRange 307 2 -vtkPropAssembly GetBounds 307 6 -vtkProperty GetColor 307 3 -vtkProp GetBounds 307 6 -vtkPyramid GetEdgeArray 304 2 -vtkPyramid GetFaceArray 304 4 -vtkQuadricClustering GetNumberOfDivisions 304 3 -vtkRayCaster GetParallelIncrements 301 2 -vtkRayCaster GetParallelStartPosition 301 3 -vtkRectilinearGrid GetExtent 304 6 -vtkRectilinearGrid GetPoint 307 3 -vtkRecursiveSphereDirectionEncoder GetDecodedGradient 301 3 -vtkRenderer ComputeVisiblePropBounds 307 6 -vtkScalarsToColors GetColor 307 3 -vtkScalarsToColors GetRange 307 2 -vtkShortArray GetValueRange 305 2 -vtkSignedCharArray GetValueRange 30D 2 -vtkSliderRepresentation3D GetBounds 307 6 -vtkSphereHandleRepresentation GetBounds 307 6 -vtkSphereRepresentation GetCenter 307 3 -vtkSphereWidget GetCenter 307 3 -vtkSphericalDirectionEncoder GetDecodedGradient 301 3 -vtkSplineWidget GetHandlePosition 307 3 -vtkStreamer GetStartPosition 307 3 -vtkStreamingDemandDrivenPipeline GetWholeExtent 304 6 -vtkStructuredGrid GetDimensions 304 3 -vtkStructuredGrid GetExtent 304 6 -vtkStructuredGrid GetPoint 307 3 -vtkStructuredGrid GetScalarRange 307 2 -vtkStructuredPointsGeometryFilter GetExtent 304 6 -vtkSynchronizedTemplates3D GetExecuteExtent 304 6 -vtkTetra GetEdgeArray 304 2 -vtkTetra GetFaceArray 304 3 -vtkTextActor3D GetBounds 307 6 -vtkTransform GetDoublePoint 307 4 -vtkTransform GetOrientation 307 3 -vtkTransform GetOrientationWXYZ 307 4 -vtkTransform GetPoint 307 4 -vtkTransform GetPosition 307 3 -vtkTransform GetScale 307 3 -vtkTypeInt64Array GetValueRange 30B 2 -vtkTypeInt64Array GetValueRange 30C 2 -vtkTypeUInt64Array GetValueRange 31B 2 -vtkTypeUInt64Array GetValueRange 31C 2 -vtkUnsignedCharArray GetValueRange 313 2 -vtkUnsigned__Int64Array GetValueRange 31C 2 -vtkUnsignedIntArray GetValueRange 314 2 -vtkUnsignedLongArray GetValueRange 316 2 -vtkUnsignedLongLongArray GetValueRange 31B 2 -vtkUnsignedShortArray GetValueRange 315 2 -vtkUnstructuredGrid GetUpdateExtent 304 6 -vtkViewport GetCenter 307 2 -vtkViewport GetOrigin 304 2 -vtkViewport GetSize 304 2 -vtkViewRays GetParallelIncrements 301 2 -vtkViewRays GetParallelStartPosition 301 3 -vtkVolume GetBounds 307 6 -vtkVolumeMapper GetBounds 307 6 -vtkVoxel GetEdgeArray 304 2 -vtkVoxel GetFaceArray 304 4 -vtkWarpLens GetCenter 307 2 -vtkWedge GetEdgeArray 304 2 -vtkWedge GetFaceArray 304 4 -vtkWidgetRepresentation GetBounds 307 6 -vtkWin32OpenGLRenderWindow GetPosition 304 2 -vtkWin32OpenGLRenderWindow GetSize 304 2 -vtkWindow GetPosition 304 2 -vtkWindow GetSize 304 2 -vtkWindowLevelLookupTable GetMaximumTableValue 307 4 -vtkWindowLevelLookupTable GetMinimumTableValue 307 4 -vtkXImageWindow GetPosition 304 2 -vtkXImageWindow GetSize 304 2 -vtkXRenderWindow GetPosition 304 2 -vtkXRenderWindow GetScreenSize 304 2 -vtkXRenderWindow GetSize 304 2 -vtkXYPlotActor GetPlotColor 307 3 diff --git a/idl/hints_paravis b/idl/hints_paravis deleted file mode 100644 index dc3089fc..00000000 --- a/idl/hints_paravis +++ /dev/null @@ -1 +0,0 @@ -vtkPVArrayInformation GetComponentRange 307 2 \ No newline at end of file diff --git a/idl/pythonIDL.py b/idl/pythonIDL.py deleted file mode 100644 index 4954d24d..00000000 --- a/idl/pythonIDL.py +++ /dev/null @@ -1,2848 +0,0 @@ -# -*- python -*- -# Package : omniidl -# python.py Created on: 1999/10/29 -# Author : Duncan Grisby (dpg1) -# -# Copyright (C) 1999 AT&T Laboratories Cambridge -# -# This file is part of omniidl. -# -# omniidl is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. -# -# Description: -# -# Back-end for Python - -# $Id$ -# $Log$ -# Revision 1.1.2.4 2009-11-18 15:56:23 vtn -# Trace support -# -# Revision 1.1.2.3 2009-11-17 12:15:43 vsv -# *** empty log message *** -# -# Revision 1.1.2.2 2009-11-05 14:57:23 vtn -# Added return array support. -# -# Revision 1.1.2.1 2009-11-03 13:14:05 vtn -# Added pathonIDL back-end for omniidl. -# -# Revision 1.33.2.13 2006/10/11 17:44:14 dgrisby -# None is not a keyword, but it cannot be assigned to. -# -# Revision 1.33.2.12 2006/09/29 16:48:03 dgrisby -# Stub changes broke use of package prefix. Thanks Teemu Torma. -# -# Revision 1.33.2.11 2006/09/07 15:28:57 dgrisby -# Remove obsolete check for presence of omniORB.StructBase. -# -# Revision 1.33.2.10 2006/06/21 14:46:26 dgrisby -# Invalid generated code for structs nested inside valuetypes. -# -# Revision 1.33.2.9 2006/01/19 17:28:44 dgrisby -# Merge from omnipy2_develop. -# -# Revision 1.33.2.8 2006/01/18 19:25:13 dgrisby -# Bug inheriting a valuetype from a typedef. -# -# Revision 1.33.2.7 2005/07/29 11:21:36 dgrisby -# Fix long-standing problem with module re-opening by #included files. -# -# Revision 1.33.2.6 2005/01/07 00:22:34 dgrisby -# Big merge from omnipy2_develop. -# -# Revision 1.33.2.5 2004/03/24 22:28:50 dgrisby -# TypeCodes / truncation for inherited state members were broken. -# -# Revision 1.33.2.4 2004/02/16 10:14:18 dgrisby -# Use stream based copy for local calls. -# -# Revision 1.33.2.3 2003/07/10 22:13:25 dgrisby -# Abstract interface support. -# -# Revision 1.33.2.2 2003/05/20 17:10:24 dgrisby -# Preliminary valuetype support. -# -# Revision 1.33.2.1 2003/03/23 21:51:56 dgrisby -# New omnipy3_develop branch. -# -# Revision 1.29.2.14 2002/11/25 21:31:09 dgrisby -# Friendly error messages with file errors, remove code to kill POA -# modules from pre-1.0. -# -# Revision 1.29.2.13 2002/07/04 13:14:52 dgrisby -# Bug with string escapes in Windows filenames. -# -# Revision 1.29.2.12 2002/05/27 01:02:37 dgrisby -# Fix bug with scope lookup in generated code. Fix TypeCode clean-up bug. -# -# Revision 1.29.2.11 2002/01/18 17:41:17 dpg1 -# Support for "docstrings" in IDL. -# -# Revision 1.29.2.10 2002/01/18 15:49:45 dpg1 -# Context support. New system exception construction. Fix None call problem. -# -# Revision 1.29.2.9 2001/12/04 12:17:08 dpg1 -# Incorrect generated code for fixed constants. -# -# Revision 1.29.2.8 2001/08/29 11:57:16 dpg1 -# Const fixes. -# -# Revision 1.29.2.7 2001/06/15 10:59:26 dpg1 -# Apply fixes from omnipy1_develop. -# -# Revision 1.29.2.6 2001/06/13 11:29:04 dpg1 -# Proper omniidl support for wchar/wstring constants. -# -# Revision 1.29.2.5 2001/05/10 15:16:03 dpg1 -# Big update to support new omniORB 4 internals. -# -# Revision 1.29.2.4 2001/04/09 15:22:16 dpg1 -# Fixed point support. -# -# Revision 1.29.2.3 2000/11/22 14:43:58 dpg1 -# Support code set conversion and wchar/wstring. -# -# Revision 1.29.2.2 2000/11/01 15:29:01 dpg1 -# Support for forward-declared structs and unions -# RepoIds in indirections are now resolved at the time of use -# -# Revision 1.29.2.1 2000/10/13 13:55:30 dpg1 -# Initial support for omniORB 4. -# -# Revision 1.29 2000/10/02 17:34:58 dpg1 -# Merge for 1.2 release -# -# Revision 1.27.2.3 2000/08/22 11:52:28 dpg1 -# Generate inherited classes for typedef to struct/union. -# -# Revision 1.27.2.2 2000/08/07 09:19:24 dpg1 -# Long long support -# -# Revision 1.27.2.1 2000/07/18 15:31:29 dpg1 -# Bug with inheritance from typedef -# -# Revision 1.27 2000/07/12 14:32:13 dpg1 -# New no_package option to omniidl backend -# -# Revision 1.26 2000/06/28 12:47:48 dpg1 -# Proper error messages for unsupported IDL constructs. -# -# Revision 1.25 2000/06/27 15:01:48 dpg1 -# Change from POA_M to M__POA mapping. -# Global module only built if necessary. -# -# Revision 1.24 2000/03/29 10:15:47 dpg1 -# Exceptions now more closely follow the interface of -# exceptions.Exception. -# -# Revision 1.23 2000/03/17 12:28:09 dpg1 -# Comma missing in nested union descriptor. -# -# Revision 1.22 2000/03/03 17:41:28 dpg1 -# Major reorganisation to support omniORB 3.0 as well as 2.8. -# -# Revision 1.21 2000/02/23 10:20:52 dpg1 -# Bug in descriptors for single-item enums. -# -# Revision 1.20 2000/01/04 15:29:41 dpg1 -# Fixes to modules generated within a package. -# -# Revision 1.19 1999/12/21 16:06:15 dpg1 -# DOH! global= not module= ! -# -# Revision 1.18 1999/12/21 16:05:11 dpg1 -# New module= option. -# -# Revision 1.17 1999/12/17 11:39:52 dpg1 -# New arguments to put modules and stubs in a specified package. -# -# Revision 1.16 1999/12/15 11:32:42 dpg1 -# -Wbinline option added. -# -# Revision 1.15 1999/12/09 14:12:55 dpg1 -# invokeOp() calls now on a single line. typedef now generates a class -# to be passed to CORBA.id(). -# -# Revision 1.14 1999/12/07 15:35:14 dpg1 -# Bug in currentScope handling. -# -# Revision 1.13 1999/11/30 10:41:20 dpg1 -# Back-ends can now have their own usage string. -# -# Revision 1.12 1999/11/25 11:49:31 dpg1 -# Minor version number bumped since server-side _is_a() required an -# incompatible change. -# -# Revision 1.11 1999/11/25 11:21:36 dpg1 -# Proper support for server-side _is_a(). -# -# Revision 1.10 1999/11/19 11:03:49 dpg1 -# Extremely important spelling correction in a comment. :-) -# -# Revision 1.9 1999/11/12 15:53:48 dpg1 -# New functions omniORB.importIDL() and omniORB.importIDLString(). -# -# Revision 1.8 1999/11/11 15:55:29 dpg1 -# Python back-end interface now supports valuetype declarations. -# Back-ends still don't support them, though. -# -# Revision 1.7 1999/11/10 16:08:22 dpg1 -# Some types weren't registered properly. -# -# Revision 1.6 1999/11/04 11:46:12 dpg1 -# Now uses our own version of the GNU C preprocessor. -# -# Revision 1.5 1999/11/02 12:17:26 dpg1 -# Top-level module name now has a prefix of _0_ to avoid clashes with -# names of nested declarations. -# -# Revision 1.4 1999/11/02 10:54:01 dpg1 -# Two small bugs in union generation. -# -# Revision 1.3 1999/11/02 10:01:46 dpg1 -# Minor fixes. -# -# Revision 1.2 1999/11/01 20:19:55 dpg1 -# Support for union switch types declared inside the switch statement. -# -# Revision 1.1 1999/11/01 16:40:11 dpg1 -# First revision with new front-end. -# - -"""omniORB Python bindings""" - -from omniidl import idlast, idltype, idlutil, idlvisitor, output, main -import sys, string, types, os.path, keyword - -cpp_args = ["-D__OMNIIDL_PYTHON__"] -usage_string = """\ - -Wbstdout Send generated stubs to stdout rather than a file - -Wbinline Output stubs for #included files in line with the main file - -Wbfactories Register value factories for all valuetypes - -Wbpackage=p Put both Python modules and stub files in package p - -Wbmodules=p Put Python modules in package p - -Wbstubs=p Put stub files in package p - -Wbextern=f:p Assume Python stub file for file f is in package p. - -Wbglobal=g Module to use for global IDL scope (default _GlobalIDL)""" - -#""" Uncomment this line to get syntax highlighting on the output strings - -# Output strings - -pymodule_template = """\ -# DO NOT EDIT THIS FILE! -# -# Python module @module@ generated by omniidl - -import omniORB -omniORB.updateModule("@package@@module@") - -# ** 1. Stub files contributing to this module - -# ** 2. Sub-modules - -# ** 3. End""" - -file_start = """\ -# Python stubs generated by omniidl from @filename@ - -import omniORB, _omnipy -from types import * -from omniORB import CORBA, PortableServer -_0_CORBA = CORBA - -_omnipy.checkVersion(3,0, __file__) -""" - -file_end = """\ -_exported_modules = ( @export_string@) - -# The end.""" - -module_start = """ -# -# Start of module "@sname@" -# -__name__ = "@package@@sname@" -_0_@sname@ = omniORB.openModule("@package@@sname@", r"@filename@") -_0_@s_sname@ = omniORB.openModule("@package@@s_sname@", r"@filename@") -""" - -module_end = """ -# -# End of module "@sname@" -# -__name__ = "@package@@modname@" -""" - -import_idl_file = """\ -# #include "@idlfile@" -import @ifilename@""" - -open_imported_module_name = """\ -_0_@imodname@ = omniORB.openModule("@package@@imodname@") -_0_@s_imodname@ = omniORB.openModule("@package@@s_imodname@")""" - -forward_interface = """\ - -# @abstract@interface @ifid@; -_0_@modname@._d_@ifid@ = (omniORB.tcInternal.@tvkind@, "@repoId@", "@ifid@") -omniORB.typeMapping["@repoId@"] = _0_@modname@._d_@ifid@""" - - -interface_class = """\ - -# @abstract@interface @ifid@ -_0_@modname@._d_@ifid@ = (omniORB.tcInternal.@tvkind@, "@repoId@", "@ifid@") -omniORB.typeMapping["@repoId@"] = _0_@modname@._d_@ifid@ -_0_@modname@.@ifid@ = omniORB.newEmptyClass() -class @ifid@ @inherits@: - _NP_RepositoryId = _0_@modname@._d_@ifid@[1] - - def __init__(self, *args, **kw): - raise RuntimeError("Cannot construct objects of this type.") - - _nil = CORBA.Object._nil -""" - -interface_descriptor = """ -_0_@modname@.@ifid@ = @ifid@ -_0_@modname@._tc_@ifid@ = omniORB.tcInternal.createTypeCode(_0_@modname@._d_@ifid@) -omniORB.registerType(@ifid@._NP_RepositoryId, _0_@modname@._d_@ifid@, _0_@modname@._tc_@ifid@)""" - -callables_header = """ -# @ifid@ operations and attributes""" - -attribute_get_descriptor = """\ -@ifid@._d__get_@attr@ = ((),(@descr@,),None)""" - -attribute_set_descriptor = """\ -@ifid@._d__set_@attr@ = ((@descr@,),(),None)""" - -operation_descriptor = """\ -@ifid@._d_@opname@ = (@inds@, @outds@, @excs@@options@)""" - -objref_class = """\ - -# @ifid@ object reference -class _objref_@ifid@ (@inherits@): - _NP_RepositoryId = @ifid@._NP_RepositoryId - - def __init__(self):""" - -objref_inherit_init = """\ - @inclass@.__init__(self)""" - -objref_object_init = """\ - CORBA.Object.__init__(self)""" - -objref_attribute_get = """ - def _get_@attr@(self, *args): - return _omnipy.invoke(self, "_get_@attr@", _0_@modname@.@ifid@._d__get_@attr@, args)""" -objref_attribute_set = """ - def _set_@attr@(self, *args): - return _omnipy.invoke(self, "_set_@attr@", _0_@modname@.@ifid@._d__set_@attr@, args)""" -objref_operation = """ - def @opname@(self, *args): - return _omnipy.invoke(self, "@r_opname@", _0_@modname@.@ifid@._d_@opname@, args)""" -objref_methods = """ - __methods__ = @methods@""" - -objref_register = """ -omniORB.registerObjref(@ifid@._NP_RepositoryId, _objref_@ifid@) -_0_@modname@._objref_@ifid@ = _objref_@ifid@ -del @ifid@, _objref_@ifid@""" - -skeleton_class = """ -# @ifid@ skeleton -__name__ = "@package@@s_modname@" -class @ifid@ (@inherits@): - _NP_RepositoryId = _0_@modname@.@ifid@._NP_RepositoryId -""" - -skeleton_methodmap = """ - _omni_op_d = @methodmap@""" - -skeleton_inheritmap = """\ - _omni_op_d.update(@inheritclass@._omni_op_d)""" - -skeleton_end = """ -@ifid@._omni_skeleton = @ifid@ -_0_@s_modname@.@ifid@ = @ifid@ -omniORB.registerSkeleton(@ifid@._NP_RepositoryId, @ifid@) -del @ifid@ -__name__ = "@package@@modname@"\ -""" - -skeleton_set_skel = """ -@ifid@._omni_skeleton = @ifid@ -""" - -constant_at_module_scope = """\ -_0_@modname@.@cname@ = @value@""" - -constant = """\ -@cname@ = @value@""" - -typedef_header = """\ - -# typedef ... @tdname@ -class @tdname@: - _NP_RepositoryId = "@repoId@" - def __init__(self, *args, **kw): - raise RuntimeError("Cannot construct objects of this type.")""" - -typedef_struct_union_header = """\ - -# typedef ... @tdname@ -class @tdname@ (@parent@): - _NP_RepositoryId = "@repoId@" -""" - -typedef_fixed_header = """\ -# typedef ... @tdname@ -@tdname@ = omniORB.fixedConstructor("@repoId@", @digits@, @scale@)""" - -typedef_at_module_scope = """\ -_0_@modname@.@tdname@ = @tdname@ -_0_@modname@._d_@tdname@ = @desc@ -_0_@modname@._ad_@tdname@ = (omniORB.tcInternal.tv_alias, @tdname@._NP_RepositoryId, "@tdname@", @tddesc@) -_0_@modname@._tc_@tdname@ = omniORB.tcInternal.createTypeCode(_0_@modname@._ad_@tdname@) -omniORB.registerType(@tdname@._NP_RepositoryId, _0_@modname@._ad_@tdname@, _0_@modname@._tc_@tdname@) -del @tdname@""" - -typedef = """\ -_d_@tdname@ = @desc@ -_ad_@tdname@ = (omniORB.tcInternal.tv_alias, @tdname@._NP_RepositoryId, "@tdname@", @tddesc@) -_tc_@tdname@ = omniORB.tcInternal.createTypeCode(_ad_@tdname@) -omniORB.registerType(@tdname@._NP_RepositoryId, _ad_@tdname@, _tc_@tdname@)""" - -forward_struct_descr_at_module_scope = """ -# Forward struct @sname@ -_0_@modname@._d_@sname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"]) -omniORB.typeMapping["@repoId@"] = _0_@modname@._d_@sname@""" - -forward_struct_descr = """ -# Forward struct @sname@ -_d_@sname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"]) -omniORB.typeMapping["@repoId@"] = _d_@sname@""" - -recursive_struct_descr_at_module_scope = """ -# Recursive struct @sname@ -_0_@modname@._d_@sname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"]) -omniORB.typeMapping["@repoId@"] = _0_@modname@._d_@sname@""" - -recursive_struct_descr = """ -# Recursive struct @sname@ -_d_@sname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"]) -_0_@scope@._d_@sname@ = _d_@sname@ -omniORB.typeMapping["@repoId@"] = _d_@sname@""" - -struct_class = """ -# struct @sname@ -_0_@scopedname@ = omniORB.newEmptyClass() -class @sname@ (omniORB.StructBase): - _NP_RepositoryId = "@repoId@" -""" - -struct_class_name = """\ - _NP_ClassName = "@cname@" -""" - -struct_class_init = """\ - def __init__(self@mnames@):""" - -struct_init_member = """\ - self.@mname@ = @mname@""" - -struct_descriptor_at_module_scope = """\ - -_0_@modname@.@sname@ = @sname@ -_0_@modname@._d_@sname@ = (omniORB.tcInternal.tv_struct, @sname@, @sname@._NP_RepositoryId, "@sname@"@mdescs@)""" - -struct_register_at_module_scope = """\ -_0_@modname@._tc_@sname@ = omniORB.tcInternal.createTypeCode(_0_@modname@._d_@sname@) -omniORB.registerType(@sname@._NP_RepositoryId, _0_@modname@._d_@sname@, _0_@modname@._tc_@sname@) -del @sname@""" - -struct_descriptor = """\ - -_d_@sname@ = _0_@scope@._d_@sname@ = (omniORB.tcInternal.tv_struct, @sname@, @sname@._NP_RepositoryId, "@sname@"@mdescs@)""" - -struct_register = """\ -_tc_@sname@ = omniORB.tcInternal.createTypeCode(_d_@sname@) -omniORB.registerType(@sname@._NP_RepositoryId, _d_@sname@, _tc_@sname@)""" - -struct_module_descriptors = """ -_0_@modname@._d_@sname@ = _d_@sname@ -_0_@modname@._tc_@sname@ = _tc_@sname@ -del @sname@, _d_@sname@, _tc_@sname@""" - -exception_class = """\ - -# exception @sname@ -_0_@scopedname@ = omniORB.newEmptyClass() -class @sname@ (CORBA.UserException): - _NP_RepositoryId = "@repoId@" -""" - -exception_class_init = """\ - def __init__(self@mnames@): - CORBA.UserException.__init__(self@mnames@)""" - -exception_init_member = """\ - self.@mname@ = @mname@""" - -exception_descriptor_at_module_scope = """\ - -_0_@modname@.@sname@ = @sname@ -_0_@modname@._d_@sname@ = (omniORB.tcInternal.tv_except, @sname@, @sname@._NP_RepositoryId, "@sname@"@mdescs@) -_0_@modname@._tc_@sname@ = omniORB.tcInternal.createTypeCode(_0_@modname@._d_@sname@) -omniORB.registerType(@sname@._NP_RepositoryId, _0_@modname@._d_@sname@, _0_@modname@._tc_@sname@) -del @sname@""" - -exception_descriptor = """\ - -_d_@sname@ = (omniORB.tcInternal.tv_except, @sname@, @sname@._NP_RepositoryId, "@sname@"@mdescs@) -_tc_@sname@ = omniORB.tcInternal.createTypeCode(_d_@sname@) -omniORB.registerType(@sname@._NP_RepositoryId, _d_@sname@, _tc_@sname@)""" - -forward_union_descr_at_module_scope = """ -# Forward union @uname@ -_0_@modname@._d_@uname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"]) -omniORB.typeMapping["@repoId@"] = _0_@modname@._d_@uname@""" - -forward_union_descr = """ -# Forward union @uname@ -_d_@uname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"]) -omniORB.typeMapping["@repoId@"] = _d_@uname@""" - -recursive_union_descr_at_module_scope = """ -# Recursive union @uname@ -_0_@modname@._d_@uname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"]) -omniORB.typeMapping["@repoId@"] = _0_@modname@._d_@uname@""" - -recursive_union_descr = """ -# Recursive union @uname@ -_d_@uname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"]) -_0_@scope@._d_@uname@ = _d_@uname@ -omniORB.typeMapping["@repoId@"] = _d_@uname@""" - -union_class = """ -# union @uname@ -_0_@scopedname@ = omniORB.newEmptyClass() -class @uname@ (omniORB.Union): - _NP_RepositoryId = "@repoId@"\ -""" - -union_class_name = """\ - _NP_ClassName = "@cname@" -""" - -union_descriptor_at_module_scope = """ -_0_@modname@.@uname@ = @uname@ - -@uname@._m_to_d = {@m_to_d@} -@uname@._d_to_m = {@d_to_m@} -@uname@._def_m = @def_m@ -@uname@._def_d = @def_d@ - -_0_@modname@._m_@uname@ = (@m_un@,) -_0_@modname@._d_@uname@ = (omniORB.tcInternal.tv_union, @uname@, @uname@._NP_RepositoryId, "@uname@", @stype@, @defpos@, _0_@modname@._m_@uname@, @m_def@, {@d_map@})""" - -union_register_at_module_scope = """\ -_0_@modname@._tc_@uname@ = omniORB.tcInternal.createTypeCode(_0_@modname@._d_@uname@) -omniORB.registerType(@uname@._NP_RepositoryId, _0_@modname@._d_@uname@, _0_@modname@._tc_@uname@) -del @uname@""" - -union_descriptor = """ -@uname@._m_to_d = {@m_to_d@} -@uname@._d_to_m = {@d_to_m@} -@uname@._def_m = @def_m@ -@uname@._def_d = @def_d@ - -_m_@uname@ = (@m_un@,) -_d_@uname@ = _0_@scope@._d_@uname@ = (omniORB.tcInternal.tv_union, @uname@, @uname@._NP_RepositoryId, "@uname@", @stype@, @defpos@, _m_@uname@, @m_def@, {@d_map@})""" - -union_register = """\ -_tc_@uname@ = omniORB.tcInternal.createTypeCode(_d_@uname@) -omniORB.registerType(@uname@._NP_RepositoryId, _d_@uname@, _tc_@uname@)""" - - -enum_start = """ -# enum @ename@\ -""" - -enum_item_at_module_scope = """\ -_0_@modname@.@eitem@ = omniORB.EnumItem("@item@", @eval@)""" - -enum_object_and_descriptor_at_module_scope = """\ -_0_@modname@.@ename@ = omniORB.Enum("@repoId@", (@eitems@,)) - -_0_@modname@._d_@ename@ = (omniORB.tcInternal.tv_enum, _0_@modname@.@ename@._NP_RepositoryId, "@ename@", _0_@modname@.@ename@._items) -_0_@modname@._tc_@ename@ = omniORB.tcInternal.createTypeCode(_0_@modname@._d_@ename@) -omniORB.registerType(_0_@modname@.@ename@._NP_RepositoryId, _0_@modname@._d_@ename@, _0_@modname@._tc_@ename@)""" - -enum_item = """\ -@eitem@ = omniORB.EnumItem("@item@", @eval@)""" - -enum_object_and_descriptor = """\ -@ename@ = omniORB.Enum("@repoId@", (@eitems@,)) - -_d_@ename@ = (omniORB.tcInternal.tv_enum, @ename@._NP_RepositoryId, "@ename@", @ename@._items) -_tc_@ename@ = omniORB.tcInternal.createTypeCode(_d_@ename@) -omniORB.registerType(@ename@._NP_RepositoryId, _d_@ename@, _tc_@ename@)""" - - -value_forward_at_module_scope = """\ -# forward valuetype @vname@ -_0_@modname@._d_@vname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"]) -omniORB.typeMapping["@repoId@"] = _0_@modname@._d_@vname@ -""" - -value_class = """ -# valuetype @vname@ -_0_@modname@._d_@vname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"]) -omniORB.typeMapping["@repoId@"] = _0_@modname@._d_@vname@ -_0_@modname@.@vname@ = omniORB.newEmptyClass() - -class @vname@ (@inherits@): - _NP_RepositoryId = "@repoId@" - - def __init__(self, *args, **kwargs): - if args: - if len(args) != @arglen@: - raise TypeError("@vname@() takes @arglen@ argument@s@ " - "(%d given)" % len(args)) - @set_args@ - if kwargs: - self.__dict__.update(kwargs) -""" - -valueabs_class = """\ -class @vname@ (@inherits@): - _NP_RepositoryId = "@repoId@" - - def __init__(self, *args, **kwargs): - raise RuntimeError("Cannot construct objects of this type.") -""" - -value_register_factory = """\ -omniORB.registerValueFactory(@vname@._NP_RepositoryId, @vname@) -""" - -value_descriptor_at_module_scope = """\ -_0_@modname@.@vname@ = @vname@ -_0_@modname@._d_@vname@ = (omniORB.tcInternal.tv_value, @vname@, @vname@._NP_RepositoryId, "@vname@", @modifier@, @tbaseids@, @basedesc@, @mdescs@) -_0_@modname@._tc_@vname@ = omniORB.tcInternal.createTypeCode(_0_@modname@._d_@vname@) -omniORB.registerType(@vname@._NP_RepositoryId, _0_@modname@._d_@vname@, _0_@modname@._tc_@vname@) -del @vname@ -""" - -value_objref_register = """ -omniORB.registerObjref(@ifid@._NP_RepositoryId, _objref_@ifid@) -_0_@modname@._objref_@ifid@ = _objref_@ifid@ -del _objref_@ifid@""" - - -valuebox = """\ - -# valuebox @boxname@ -class @boxname@: - _NP_RepositoryId = "@repoId@" - def __init__(self, *args, **kw): - raise RuntimeError("Cannot construct objects of this type.") - -_0_@modname@.@boxname@ = @boxname@ -_0_@modname@._d_@boxname@ = (omniORB.tcInternal.tv_value_box, @boxname@, @boxname@._NP_RepositoryId, "@boxname@", @boxdesc@) -_0_@modname@._tc_@boxname@ = omniORB.tcInternal.createTypeCode(_0_@modname@._d_@boxname@) -omniORB.registerType(@boxname@._NP_RepositoryId, _0_@modname@._d_@boxname@, _0_@modname@._tc_@boxname@) -omniORB.registerValueFactory(@boxname@._NP_RepositoryId, @boxname@) -del @boxname@ -""" - - -example_start = """\ -#!/usr/bin/env python - -# Python example implementations generated from @filename@ - -import CORBA, PortableServer - -# Import the Python stub modules so type definitions are available. -""" - -example_import_skels = """ -# Import the Python Skeleton modules so skeleton base classes are available. -""" - -example_import = """\ -import @module@""" - -example_classdef = """ - -# Implementation of interface @ccname@ - -class @ifname@_i (@skname@): -@inheritance_note@ - def __init__(self): - # Initialise member variables here - pass -""" - -example_opdef = """\ - # @signature@ - def @opname@(self@args@): - raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) - # *** Implement me - # Must return: @returnspec@ -""" - -example_end = """ -if __name__ == "__main__": - import sys - - # Initialise the ORB - orb = CORBA.ORB_init(sys.argv) - - # As an example, we activate an object in the Root POA - poa = orb.resolve_initial_references("RootPOA") - - # Create an instance of a servant class - servant = @ifname@_i() - - # Activate it in the Root POA - poa.activate_object(servant) - - # Get the object reference to the object - objref = servant._this() - - # Print a stringified IOR for it - print orb.object_to_string(objref) - - # Activate the Root POA's manager - poa._get_the_POAManager().activate() - - # Run the ORB, blocking this thread - orb.run() -""" - - -# Global state -imported_files = {} -exported_modules = {} - -# Command line options -output_inline = 0 -global_module = "_GlobalIDL" -module_package = "" -stub_package = "" -stub_directory = "" -all_factories = 0 -example_impl = 0 -extern_stub_pkgs = {} - -def methgrp_index(metharr,opname): - for i in range(0, len(metharr)): - if len(opname) > 2 and metharr[i] == opname[:-2]: - return i - - return -1 - -def ret_arg(p): - return "args["+str(p)+"]" - -def is_int(p): - return "(type("+ret_arg(p)+") in [IntType, LongType])" - -def is_boolean(p): - return "(type("+ret_arg(p)+") in [IntType, LongType, BooleanType])" - -def is_double(p): - return "(type("+ret_arg(p)+") in [IntType, LongType, FloatType])" - -def is_string(p): - return "(type("+ret_arg(p)+") in [StringType])" - -def is_vtkPtr(p): - return "(type("+ret_arg(p)+") in [InstanceType])" - -def is_list(p): - return "(type("+ret_arg(p)+").count('[]') > 0)" - -def is_any(p): - return "(type("+ret_arg(p)+") in [CORBA.Any])" - -def is_char(p): - return "((type("+ret_arg(p)+") in [StringType]) and (len(" + ret_arg(p) + ") == 1))" - -def error_exit(message): - sys.stderr.write(main.cmdname + ": " + message + "\n") - sys.exit(1) - -def run(tree, args): - global main_idl_file, imported_files, exported_modules, output_inline - global global_module, module_package, stub_package, stub_directory - global all_factories, example_impl, extern_stub_pkgs - - imported_files.clear() - exported_modules.clear() - - # Look at the args: - use_stdout = 0 - create_package = 1 - for arg in args: - - if arg == "stdout": - use_stdout = 1 - create_package = 0 - - elif arg == "no_package": - create_package = 0 - - elif arg == "inline": - output_inline = 1 - - elif arg == "factories": - all_factories = 1 - - elif arg[:8] == "modules=": - module_package = arg[8:] - if module_package != "": - module_package = module_package + "." - - elif arg[:6] == "stubs=": - stub_package = arg[6:] - stub_directory = apply(os.path.join, - string.split(stub_package, ".")) - if stub_package != "": - stub_package = stub_package + "." - - elif arg[:8] == "package=": - module_package = stub_package = arg[8:] - stub_directory = apply(os.path.join, - string.split(stub_package, ".")) - if module_package != "": - module_package = stub_package = module_package + "." - - elif arg[:7] == "global=": - global_module = arg[7:] - if global_module == "": - error_exit("You may not have an unnamed global module.") - - elif arg == "example": - example_impl = 1 - - elif arg[:7] == "extern=": - f_p = string.split(arg[7:], ":", 1) - if len(f_p) == 1: - extern_stub_pkgs[f_p[0]] = None - else: - extern_stub_pkgs[f_p[0]] = f_p[1] - - else: - sys.stderr.write(main.cmdname + ": Warning: Python " \ - "back-end does not understand argument: " + \ - arg + "\n") - - main_idl_file = tree.file() - - outpybasename = outputFileName(main_idl_file) - outpymodule = stub_package + outpybasename - outpyname = os.path.join(stub_directory, outpybasename + ".py") - - imported_files[outpybasename] = 1 - - if create_package: - checkStubPackage(stub_package) - - if use_stdout: - st = output.Stream(sys.stdout, 4) - else: - try: - st = output.Stream(open(outpyname, "w"), 4) - except IOError: - error_exit('Cannot open "%s" for writing.' % outpyname) - - st.out(file_start, filename=main_idl_file) - - pv = PythonVisitor(st, outpymodule) - tree.accept(pv) - - dv = DocstringVisitor(st) - tree.accept(dv) - dv.output() - - exports = exported_modules.keys() - exports.sort() - export_list = map(lambda s: '"' + module_package + s + '"', exports) - if len(export_list) == 1: export_list.append("") - export_string = string.join(export_list, ", ") - - st.out(file_end, export_string=export_string) - - if create_package: - updateModules(exports, outpymodule) - - if example_impl: - implname = os.path.join(stub_directory, outpybasename + "_example.py") - exst = output.Stream(open(implname, "w"), 4) - exst.out(example_start, filename=main_idl_file) - for mod in exports: - exst.out(example_import, module=mod) - exst.out(example_import_skels) - for mod in exports: - exst.out(example_import, module=skeletonModuleName(mod)) - - ev = ExampleVisitor(exst) - tree.accept(ev) - - exst.out(example_end, ifname=ev.first) - - -class PythonVisitor: - def __init__(self, st, outpymodule): - self.st = st - self.outpymodule = outpymodule - - def handleImported(self, node): - global imported_files - - if node.mainFile() or output_inline: - return 0 - else: - ifilename = outputFileName(node.file()) - if not imported_files.has_key(ifilename): - imported_files[ifilename] = 1 - ibasename,ext = os.path.splitext(os.path.basename(node.file())) - if extern_stub_pkgs.has_key(ibasename): - ipackage = extern_stub_pkgs[ibasename] - if ipackage: - fn = ipackage + '.' + ifilename - else: - fn = ifilename - else: - fn = stub_package + ifilename - - self.st.out(import_idl_file, - idlfile=node.file(), - ifilename=fn) - return 1 - - # - # The global module - # - def visitAST(self, node): - self.at_module_scope = 1 - self.at_global_scope = 1 - self.currentScope = ["_0_" + global_module] - - decls_in_global_module = 0 - - for n in node.declarations(): - if not isinstance(n, idlast.Module): - decls_in_global_module = 1 - break - - if decls_in_global_module: - self.modname = global_module - self.st.out(module_start, - sname=global_module, - s_sname=skeletonModuleName(global_module), - filename=node.file(), package=module_package) - else: - self.modname = self.outpymodule - - for n in node.declarations(): - n.accept(self) - - if decls_in_global_module: - exported_modules[global_module] = 1 - self.st.out(module_end, modname=self.outpymodule, - sname=global_module, - package="") - - # - # Module - # - def visitModule(self, node): - if self.handleImported(node): - imodname = dotName(node.scopedName()) - ibasename,ext = os.path.splitext(os.path.basename(node.file())) - - if extern_stub_pkgs.has_key(ibasename): - package = extern_stub_pkgs[ibasename] - if package is None: - package = "" - else: - package = package + "." - else: - package = module_package - - self.st.out(open_imported_module_name, - imodname=imodname, - s_imodname=skeletonModuleName(imodname), - package=package) - - assert self.at_module_scope - - sname = dotName(node.scopedName()) - - if node.mainFile() or output_inline: - self.st.out(module_start, - sname = sname, - s_sname = skeletonModuleName(sname), - filename = node.file(), package=module_package) - - parentmodname = self.modname - self.modname = dotName(node.scopedName()) - - ags = self.at_global_scope - if ags: - self.currentScope = ["_0_" + node.identifier()] - else: - self.currentScope.append(node.identifier()) - - self.at_global_scope = 0 - - for n in node.definitions(): - n.accept(self) - - if ags: - self.currentScope = ["_0_" + global_module] - else: - self.currentScope.pop() - self.at_global_scope = ags - self.modname = parentmodname - - if node.mainFile() or output_inline: - exported_modules[sname] = 1 - self.st.out(module_end, modname=parentmodname, sname=sname, - package=module_package) - - # - # Forward interface - # - def visitForward(self, node): - if self.handleImported(node): return - - assert self.at_module_scope - ifid = mangle(node.identifier()) - repoId = node.repoId() - if node.abstract(): - tvkind = "tv_abstract_interface" - abstract = "abstract " - else: - tvkind = "tv_objref" - abstract = "" - - self.st.out(forward_interface, ifid=ifid, tvkind=tvkind, - repoId=repoId, abstract=abstract, modname=self.modname) - - # - # Interface - # - def visitInterface(self, node): - if self.handleImported(node): return - - assert self.at_module_scope - ifid = mangle(node.identifier()) - - if len(node.inherits()) > 0: - inheritl = [] - for i in node.inherits(): - i = i.fullDecl() - inheritl.append(dotName(fixupScopedName(i.scopedName()))) - - inherits = "(" + string.join(inheritl, ", ") + ")" - else: - inherits = "" - - if node.abstract(): - tvkind = "tv_abstract_interface" - abstract = "abstract " - else: - tvkind = "tv_objref" - abstract = "" - - # Class header - self.st.out(interface_class, ifid=ifid, tvkind=tvkind, - inherits=inherits, repoId=node.repoId(), - abstract=abstract, modname=self.modname) - - # Declarations within the interface - if len(node.declarations()) > 0: - self.st.inc_indent() - self.at_module_scope = 0 - self.currentScope.append(node.identifier()) - - for d in node.declarations(): - d.accept(self) - - self.currentScope.pop() - self.at_module_scope = 1 - self.st.dec_indent() - self.st.out("") - - # Descriptor and TypeCode for the interface - self.st.out(interface_descriptor, - modname = self.modname, ifid = ifid) - - # Attributes and operations - # *** Was there a good reason for putting these in the class def? - if len(node.callables()) > 0: - self.st.out(callables_header, ifid=ifid) - - for c in node.callables(): - if isinstance(c, idlast.Attribute): - - descr = typeToDescriptor(c.attrType()) - - for attr in c.identifiers(): - - self.st.out(attribute_get_descriptor, - attr=attr, descr=descr, ifid=ifid) - - if not c.readonly(): - - self.st.out(attribute_set_descriptor, - attr=attr, descr=descr, ifid=ifid) - else: # Operation - - inds, outds, excs, ctxts, cv = operationToDescriptors(c) - - options = "" - - if cv: - ctxts = ctxts or "None" - - if ctxts: - options = ", " + ctxts - - if cv: - options = options + ", 1" - - # Output the declaration - self.st.out(operation_descriptor, - opname = mangle(c.identifier()), - inds = inds, - outds = outds, - excs = excs, - options = options, - ifid = ifid) - - # Objref class - if node.inherits(): - inheritl = [] - for i in node.inherits(): - i = i.fullDecl() - sn = fixupScopedName(i.scopedName()) - inheritl.append(dotName(sn[:-1] + ["_objref_" + sn[-1]])) - - inherits = string.join(inheritl, ", ") - else: - inherits = "CORBA.Object" - - self.st.out(objref_class, ifid=ifid, inherits=inherits) - - if node.inherits(): - for inclass in inheritl: - self.st.out(objref_inherit_init, inclass=inclass) - else: - self.st.out(objref_object_init) - - # Operations and attributes - methodl = [] - methadd = [] - methdsc = [] - - for c in node.callables(): - - if isinstance(c, idlast.Attribute): - - for attr in c.identifiers(): - - self.st.out(objref_attribute_get, - attr = attr, - ifid = ifid, - modname = self.modname) - - methodl.append('"_get_' + attr + '"') - - if not c.readonly(): - - self.st.out(objref_attribute_set, - attr = attr, - ifid = ifid, - modname = self.modname) - - methodl.append('"_set_' + attr + '"') - - else: # Operation - opname = mangle(c.identifier()) - - if len(opname) > 2 and opname[-2] == '_': - methlen = methgrp_index(methadd,opname) - if methlen < 0: - methodl.append('"' + opname[:-2] + '"') - - methlen = len(methadd) - - methadd = methadd + [opname[:-2]] - - methdsc = methdsc + [""] - methdsc[methlen] = "\n def "+opname[:-2]+"(self, *args):" - - methdsc[methlen] = methdsc[methlen] + "\n " - - methdsc[methlen] = methdsc[methlen] + "if len(args) == " + str(len(c.parameters())) - - for p in range(0,len(c.parameters())): - methdsc[methlen] = methdsc[methlen] + " and " - if c.parameters()[p].paramType().kind() in [idltype.tk_short,idltype.tk_long]: - methdsc[methlen] = methdsc[methlen] + is_int(p) - if c.parameters()[p].paramType().kind() in [idltype.tk_float,idltype.tk_double]: - methdsc[methlen] = methdsc[methlen] + is_double(p) - if c.parameters()[p].paramType().kind() in [idltype.tk_string]: - methdsc[methlen] = methdsc[methlen] + is_string(p) - if c.parameters()[p].paramType().kind() in [idltype.tk_sequence,idltype.tk_alias]: - methdsc[methlen] = methdsc[methlen] + is_list(p) - if c.parameters()[p].paramType().kind() in [idltype.tk_objref]: - methdsc[methlen] = methdsc[methlen] + is_vtkPtr(p) - if c.parameters()[p].paramType().kind() in [idltype.tk_boolean]: - methdsc[methlen] = methdsc[methlen] + is_boolean(p) - if c.parameters()[p].paramType().kind() in [idltype.tk_any]: - methdsc[methlen] = methdsc[methlen] + is_any(p) - if c.parameters()[p].paramType().kind() in [idltype.tk_char]: - methdsc[methlen] = methdsc[methlen] + is_char(p) - if c.parameters()[p].paramType().kind() not in [idltype.tk_boolean,idltype.tk_short,idltype.tk_long,idltype.tk_float,idltype.tk_double,idltype.tk_string,idltype.tk_sequence,idltype.tk_alias,idltype.tk_objref,idltype.tk_any,idltype.tk_char]: - methdsc[methlen] = methdsc[methlen] + " " + str(c.parameters()[p].paramType().kind()) + " == '' " - - methdsc[methlen] = methdsc[methlen] + ":" - methdsc[methlen] = methdsc[methlen] + "\n return self."+opname+"(*args)" - - self.st.out(objref_operation, - opname = opname, - r_opname = c.identifier(), - ifid = ifid, - modname = self.modname) - methodl.append('"' + opname + '"') - - for p in range(0,len(methadd)): - methgrp = methadd[p] - methtmp = methdsc[p] - methtmp = methtmp + "\n print 'Warning: The corresponding method of " + methgrp + " group is not found for ' + str(args)" - self.st.out(methtmp) - - #self.st.out("\n def __eq__(self,other):") - #self.st.out(" return self.IsSame(other)==0") - - # __methods__ assignment - methods = "[" + string.join(methodl, ", ") + "]" - - if node.inherits(): - inheritl = [] - for i in node.inherits(): - i = i.fullDecl() - sn = fixupScopedName(i.scopedName()) - methods = methods + " + " + \ - dotName(sn[:-1] + ["_objref_" + sn[-1]]) + \ - ".__methods__" - else: - methods = methods + " + CORBA.Object.__methods__" - - self.st.out(objref_methods, methods = methods) - - # registerObjRef() - self.st.out(objref_register, ifid = ifid, modname = self.modname) - - # Skeleton class - if node.inherits(): - inheritl = [] - for i in node.inherits(): - i = i.fullDecl() - fsn = fixupScopedName(i.scopedName()) - dsn = dotName(fsn) - ssn = skeletonModuleName(dsn) - inheritl.append(ssn) - - inherits = string.join(inheritl, ", ") - else: - inherits = "PortableServer.Servant" - - self.st.out(skeleton_class, - ifid = ifid, - inherits = inherits, - modname = self.modname, - s_modname = skeletonModuleName(self.modname), - package = module_package) - - # Operations and attributes - methodl = [] - - for c in node.callables(): - if isinstance(c, idlast.Attribute): - - for attr in c.identifiers(): - - methodl.append('"_get_' + attr + '": ' + \ - '_0_' + self.modname + '.' + \ - ifid + '.' + '_d__get_' + attr) - - if not c.readonly(): - - methodl.append('"_set_' + attr + '": ' + \ - '_0_' + self.modname + '.' + \ - ifid + '.' + '_d__set_' + attr) - - else: # Operation - opname = mangle(c.identifier()) - - methodl.append('"' + opname + '": ' + '_0_' + self.modname + \ - '.' + ifid + '.' + '_d_' + opname) - - methodmap = "{" + string.join(methodl, ", ") + "}" - - self.st.out(skeleton_methodmap, methodmap = methodmap) - - if node.inherits(): - for inheritclass in inheritl: - self.st.out(skeleton_inheritmap, inheritclass = inheritclass) - - self.st.out(skeleton_end, - ifid = ifid, - modname = self.modname, - s_modname = skeletonModuleName(self.modname), - package = module_package) - - # - # Constant - # - def visitConst(self, node): - if self.handleImported(node): return - - cname = mangle(node.identifier()) - - if self.at_module_scope: - value = valueToString(node.value(), node.constKind(), []) - else: - value = valueToString(node.value(), node.constKind(), - self.currentScope) - if self.at_module_scope: - self.st.out(constant_at_module_scope, - cname = cname, - value = value, - modname = self.modname) - else: - self.st.out(constant, - cname = cname, - value = value) - - # - # Typedef - # - def visitTypedef(self, node): - if self.handleImported(node): return - - if node.constrType(): - node.aliasType().decl().accept(self) - - for decl in node.declarators(): - tdname = mangle(decl.identifier()) - if self.at_module_scope: - desc = typeAndDeclaratorToDescriptor(node.aliasType(), - decl, []) - tddesc = typeAndDeclaratorToDescriptor(node.aliasType(), - decl, [], 1) - - unaliased_type = node.aliasType().unalias() - - if len(decl.sizes()) == 0 and \ - unaliased_type.kind() in [idltype.tk_struct, - idltype.tk_union]: - - parent = dotName(fixupScopedName(unaliased_type.decl().\ - scopedName())) - - self.st.out(typedef_struct_union_header, - tdname = tdname, - repoId = decl.repoId(), - parent = parent) - - elif len(decl.sizes()) == 0 and\ - unaliased_type.kind() == idltype.tk_fixed: - - self.st.out(typedef_fixed_header, - tdname = tdname, - repoId = decl.repoId(), - digits = unaliased_type.digits(), - scale = unaliased_type.scale()) - - else: - self.st.out(typedef_header, - tdname = tdname, - repoId = decl.repoId()) - - self.st.out(typedef_at_module_scope, - tdname = tdname, - desc = desc, - tddesc = tddesc, - modname = self.modname) - else: - desc = typeAndDeclaratorToDescriptor(node.aliasType(), - decl, - self.currentScope) - tddesc = typeAndDeclaratorToDescriptor(node.aliasType(), - decl, - self.currentScope, 1) - - unaliased_type = node.aliasType().unalias() - - if len(decl.sizes()) == 0 and \ - unaliased_type.kind() in [idltype.tk_struct, - idltype.tk_union]: - - psname = unaliased_type.decl().scopedName() - myscope = decl.scopedName()[:-1] - - # If the struct/union definition is in the same - # scope as the typedef, we must use a relative - # name to refer to the parent class, since the - # enclosing Python class has not yet been fully - # defined. - - if psname[:len(myscope)] == myscope: - parent = dotName(psname[len(myscope):]) - else: - parent = dotName(fixupScopedName(psname)) - - self.st.out(typedef_struct_union_header, - tdname = tdname, - repoId = decl.repoId(), - parent = parent) - else: - self.st.out(typedef_header, - tdname = tdname, - repoId = decl.repoId()) - - self.st.out(typedef, - tdname = tdname, - desc = desc, - tddesc = tddesc) - # - # Struct - # - def visitStruct(self, node): - if self.handleImported(node): return - - sname = mangle(node.identifier()) - - fscopedName = fixupScopedName(node.scopedName(), "") - - if node.recursive(): - if self.at_module_scope: - self.st.out(recursive_struct_descr_at_module_scope, - sname = sname, - repoId = node.repoId(), - modname = self.modname) - else: - self.st.out(recursive_struct_descr, - sname = sname, - repoId = node.repoId(), - scope = dotName(fscopedName[:-1])) - - self.st.out(struct_class, - sname = sname, - repoId = node.repoId(), - scopedname = dotName(fscopedName)) - - if not self.at_module_scope: - self.st.out(struct_class_name, cname = dotName(fscopedName)) - - mnamel = [] - mdescl = [] - for mem in node.members(): - - # Deal with nested declarations - if mem.constrType(): - self.st.inc_indent() - ams = self.at_module_scope - self.at_module_scope = 0 - self.currentScope.append(node.identifier()) - - mem.memberType().decl().accept(self) - - self.currentScope.pop() - self.at_module_scope = ams - self.st.dec_indent() - self.st.out("") - - for decl in mem.declarators(): - mnamel.append(mangle(decl.identifier())) - mdescl.append('"' + mangle(decl.identifier()) + '"') - - if self.at_module_scope: - mdescl.append(\ - typeAndDeclaratorToDescriptor(mem.memberType(), - decl, - [])) - else: - mdescl.append(\ - typeAndDeclaratorToDescriptor(mem.memberType(), - decl, - self.currentScope)) - if len(mnamel) > 0: - mnames = ", " + string.join(mnamel, ", ") - - self.st.out(struct_class_init, mnames = mnames) - - for mname in mnamel: - self.st.out(struct_init_member, mname = mname) - - if len(mdescl) > 0: - mdescs = ", " + string.join(mdescl, ", ") - else: - mdescs = "" - - if self.at_module_scope: - self.st.out(struct_descriptor_at_module_scope, - sname = sname, - mdescs = mdescs, - modname = self.modname) - - self.st.out(struct_register_at_module_scope, - sname = sname, - modname = self.modname) - else: - self.st.out(struct_descriptor, - sname = sname, - mdescs = mdescs, - scope = dotName(fscopedName[:-1])) - - self.st.out(struct_register, sname = sname) - - # - # Forward struct - # - def visitStructForward(self, node): - if self.handleImported(node): return - - sname = mangle(node.identifier()) - - if self.at_module_scope: - self.st.out(forward_struct_descr_at_module_scope, - sname = sname, - repoId = node.repoId(), - modname = self.modname) - else: - self.st.out(forward_struct_descr, - sname = sname, - repoId = node.repoId(), - modname = self.modname) - - # - # Exception - # - def visitException(self, node): - if self.handleImported(node): return - - sname = mangle(node.identifier()) - fscopedName = fixupScopedName(node.scopedName(), "") - self.st.out(exception_class, - sname = sname, - repoId = node.repoId(), - scopedname = dotName(fscopedName)) - - if not self.at_module_scope: - self.st.out(struct_class_name, cname = dotName(fscopedName)) - - mnamel = [] - mdescl = [] - for mem in node.members(): - - # Deal with nested declarations - if mem.constrType(): - self.st.inc_indent() - ams = self.at_module_scope - self.at_module_scope = 0 - self.currentScope.append(node.identifier()) - - mem.memberType().decl().accept(self) - - self.currentScope.pop() - self.at_module_scope = ams - self.st.dec_indent() - self.st.out("") - - for decl in mem.declarators(): - mnamel.append(mangle(decl.identifier())) - mdescl.append('"' + mangle(decl.identifier()) + '"') - - if self.at_module_scope: - mdescl.append(\ - typeAndDeclaratorToDescriptor(mem.memberType(), - decl, - [])) - else: - mdescl.append(\ - typeAndDeclaratorToDescriptor(mem.memberType(), - decl, - self.currentScope)) - - if len(mnamel) > 0: - mnames = ", " + string.join(mnamel, ", ") - else: - mnames = "" - - self.st.out(exception_class_init, mnames = mnames) - - for mname in mnamel: - self.st.out(exception_init_member, mname = mname) - - if len(mdescl) > 0: - mdescs = ", " + string.join(mdescl, ", ") - else: - mdescs = "" - - if self.at_module_scope: - self.st.out(exception_descriptor_at_module_scope, - sname = sname, mdescs = mdescs, modname = self.modname) - else: - self.st.out(exception_descriptor, sname = sname, mdescs = mdescs) - - # - # Union - # - def visitUnion(self, node): - if self.handleImported(node): return - - uname = mangle(node.identifier()) - if self.at_module_scope: - stype = typeToDescriptor(node.switchType(), []) - else: - stype = typeToDescriptor(node.switchType(), self.currentScope) - - fscopedName = fixupScopedName(node.scopedName(), "") - - if node.recursive(): - if self.at_module_scope: - self.st.out(recursive_union_descr_at_module_scope, - uname = uname, - repoId = node.repoId(), - modname = self.modname) - else: - self.st.out(recursive_union_descr, - uname = uname, - repoId = node.repoId(), - scope = dotName(fscopedName[:-1])) - - self.st.out(union_class, - uname = uname, - repoId = node.repoId(), - scopedname = dotName(fscopedName)) - - if not self.at_module_scope: - self.st.out(union_class_name, cname = dotName(fscopedName)) - - if node.constrType(): - self.st.inc_indent() - ams = self.at_module_scope - self.at_module_scope = 0 - self.currentScope.append(node.identifier()) - - node.switchType().decl().accept(self) - - self.currentScope.pop() - self.at_module_scope = ams - self.st.dec_indent() - - def_m = "None" - def_d = "None" - m_def = "None" - defpos = "-1" - m_to_d_l = [] - d_to_m_l = [] - m_un_l = [] - d_map_l = [] - - i = 0 - for case in node.cases(): - - # Deal with nested declarations - if case.constrType(): - self.st.inc_indent() - ams = self.at_module_scope - self.at_module_scope = 0 - self.currentScope.append(node.identifier()) - - case.caseType().decl().accept(self) - - self.currentScope.pop() - self.at_module_scope = ams - self.st.dec_indent() - self.st.out("") - - if self.at_module_scope: - ctype = typeAndDeclaratorToDescriptor(case.caseType(), - case.declarator(), - []) - else: - ctype = typeAndDeclaratorToDescriptor(case.caseType(), - case.declarator(), - self.currentScope) - - cname = mangle(case.declarator().identifier()) - - for label in case.labels(): - if label.default(): - def_m = '"' + cname + '"' - defpos = str(i) - if self.at_module_scope: - def_d = valueToString(label.value(), - label.labelKind(), []) - m_def = "_0_" + self.modname + "._m_" + uname + \ - "[" + defpos + "]" - else: - def_d = valueToString(label.value(), - label.labelKind(), - self.currentScope) - m_def = "_m_" + uname + "[" + defpos + "]" - - m_un_l.append('(' + def_d + ', "' + cname + '", ' +\ - ctype + ')') - else: - if self.at_module_scope: - slabel = valueToString(label.value(), - label.labelKind(), []) - else: - slabel = valueToString(label.value(), - label.labelKind(), - self.currentScope) - - m_to_d_l.append('"' + cname + '": ' + slabel) - d_to_m_l.append(slabel + ': "' + cname + '"') - - m_un_l.append('(' + slabel + ', "' + cname + '", ' +\ - ctype + ')') - - if self.at_module_scope: - d_map_l.append(slabel + ': ' + '_0_' + self.modname + \ - "._m_" + uname + "[" + str(i) + "]") - else: - d_map_l.append(slabel + ': ' + "_m_" + \ - uname + "[" + str(i) + "]") - i = i + 1 - - m_to_d = string.join(m_to_d_l, ", ") - d_to_m = string.join(d_to_m_l, ", ") - m_un = string.join(m_un_l, ", ") - d_map = string.join(d_map_l, ", ") - - if self.at_module_scope: - self.st.out(union_descriptor_at_module_scope, - uname = uname, - m_to_d = m_to_d, - d_to_m = d_to_m, - def_m = def_m, - def_d = def_d, - m_un = m_un, - stype = stype, - defpos = defpos, - m_def = m_def, - d_map = d_map, - modname = self.modname) - - self.st.out(union_register_at_module_scope, - uname = uname, - modname = self.modname) - else: - self.st.out(union_descriptor, - uname = uname, - m_to_d = m_to_d, - d_to_m = d_to_m, - def_m = def_m, - def_d = def_d, - m_un = m_un, - stype = stype, - defpos = defpos, - m_def = m_def, - d_map = d_map, - scope = dotName(fscopedName[:-1])) - - self.st.out(union_register, uname = uname) - - # - # Forward union - # - def visitUnionForward(self, node): - if self.handleImported(node): return - - uname = mangle(node.identifier()) - - if self.at_module_scope: - self.st.out(forward_union_descr_at_module_scope, - uname = uname, - repoId = node.repoId(), - modname = self.modname) - else: - self.st.out(forward_union_descr, - uname = uname, - repoId = node.repoId(), - modname = self.modname) - - # - # Enum - # - def visitEnum(self, node): - if self.handleImported(node): return - - ename = mangle(node.identifier()) - self.st.out(enum_start, ename = ename) - - i=0 - elist = [] - for item in node.enumerators(): - eval = str(i) - - if self.at_module_scope: - self.st.out(enum_item_at_module_scope, - item = item.identifier(), - eitem = mangle(item.identifier()), - eval = eval, - modname = self.modname) - else: - self.st.out(enum_item, - item = item.identifier(), - eitem = mangle(item.identifier()), - eval = eval) - - if self.at_module_scope: - elist.append(dotName(fixupScopedName(item.scopedName()))) - else: - elist.append(mangle(item.identifier())) - - i = i + 1 - - eitems = string.join(elist, ", ") - - if self.at_module_scope: - self.st.out(enum_object_and_descriptor_at_module_scope, - ename = ename, - repoId = node.repoId(), - eitems = eitems, - modname = self.modname) - else: - self.st.out(enum_object_and_descriptor, - ename = ename, - repoId = node.repoId(), - eitems = eitems) - - def visitNative(self, node): - if self.handleImported(node): return - - sys.stderr.write(main.cmdname + \ - ": Warning: ignoring declaration of native " + \ - node.identifier() + "\n") - - def visitValueForward(self, node): - if self.handleImported(node): return - - vname = mangle(node.identifier()) - - self.st.out(value_forward_at_module_scope, - vname=vname, repoId=node.repoId(), modname=self.modname) - - - def visitValueBox(self, node): - if self.handleImported(node): return - - boxname = mangle(node.identifier()) - boxdesc = typeToDescriptor(node.boxedType()) - - self.st.out(valuebox, boxname=boxname, repoId=node.repoId(), - boxdesc=boxdesc, modname=self.modname) - - - def visitValueAbs(self, node): - if self.handleImported(node): return - - vname = mangle(node.identifier()) - - fscopedName = fixupScopedName(node.scopedName(), "") - scopedname = dotName(fscopedName) - - if node.inherits(): - inheritl = [] - for i in node.inherits(): - i = i.fullDecl() - inheritl.append(dotName(fixupScopedName(i.scopedName()))) - - inherits = string.join(inheritl, ", ") - else: - inherits = "_0_CORBA.ValueBase" - - self.st.out(valueabs_class, - vname=vname, scopedname=scopedname, repoId=node.repoId(), - inherits=inherits, modname=self.modname) - - # Declarations within the value - if len(node.declarations()) > 0: - self.st.inc_indent() - self.at_module_scope = 0 - self.currentScope.append(node.identifier()) - - for d in node.declarations(): - d.accept(self) - - self.currentScope.pop() - self.at_module_scope = 1 - self.st.dec_indent() - self.st.out("") - - basedesc = "_0_CORBA.tcInternal.tv_null" - - self.st.out(value_descriptor_at_module_scope, - vname=vname, modifier="_0_CORBA.VM_ABSTRACT", - tbaseids="None", basedesc=basedesc, mdescs="", - modname=self.modname) - - - def visitValue(self, node): - if self.handleImported(node): return - - vname = mangle(node.identifier()) - - fscopedName = fixupScopedName(node.scopedName(), "") - scopedname = dotName(fscopedName) - - if node.inherits(): - inheritl = [] - for i in node.inherits(): - i = i.fullDecl() - inheritl.append(dotName(fixupScopedName(i.scopedName()))) - - else: - inheritl = ["_0_CORBA.ValueBase"] - - skeleton_opl = [] - for i in node.supports(): - i = i.fullDecl() - sn = fixupScopedName(i.scopedName()) - sn[0] = sn[0] + "__POA" - dn = dotName(sn) - inheritl.append(dn) - skeleton_opl.append(dn) - - inherits = string.join(inheritl, ", ") - - # Go up the chain of inherited interfaces, picking out the - # state members - members = [] - ilist = [] - cnode = node - - while 1: - cin = cnode.inherits() - if not cin: - break - i = cin[0].fullDecl() - if not isinstance(i, idlast.Value): - break - ilist.append(i) - cnode = i - - ilist.reverse() - ilist.append(node) - - for i in ilist: - members.extend(i.statemembers()) - - set_argl = [] - - for i in range(len(members)): - member = members[i] - for d in member.declarators(): - set_argl.append("self.%s = args[%d]" % - (mangle(d.identifier()),i)) - - if set_argl: - set_args = string.join(set_argl, "\n") - else: - set_args = "pass" - - if len(set_argl) == 1: - s = "" - else: - s = "s" - - self.st.out(value_class, - vname=vname, scopedname=scopedname, repoId=node.repoId(), - inherits=inherits, set_args=set_args, arglen=len(set_argl), - s=s, modname=self.modname) - - # Declarations within the value - if len(node.declarations()) > 0: - self.st.inc_indent() - self.at_module_scope = 0 - self.currentScope.append(node.identifier()) - - for d in node.declarations(): - d.accept(self) - - self.currentScope.pop() - self.at_module_scope = 1 - self.st.dec_indent() - self.st.out("") - - # Skeleton operation declarations if necessary - if node.supports(): - self.st.out(skeleton_methodmap, methodmap="{}") - for i in skeleton_opl: - self.st.out(skeleton_inheritmap, inheritclass=i) - - self.st.out(skeleton_set_skel, ifid=vname) - - # Register factory if no callables or factories - register_factory = 1 - - if not all_factories: - cnode = node - while 1: - if cnode.callables() or cnode.factories() or cnode.supports(): - register_factory = 0 - break - cin = cnode.inherits() - if not cin: - break - for n in cin: - n = n.fullDecl() - if not isinstance(n, idlast.Value): - register_factory = 0 - break - cnode = cin[0].fullDecl() - - if register_factory: - self.st.out(value_register_factory, vname=vname) - - # If value supports some interfaces, output an objref class for it - if node.supports(): - inheritl = [] - methodl = [] - for i in node.supports(): - i = i.fullDecl() - sn = fixupScopedName(i.scopedName()) - inheritl.append(dotName(sn[:-1] + ["_objref_" + sn[-1]])) - methodl.append(dotName(sn[:-1] + ["_objref_" + sn[-1]]) + - ".__methods__") - - inherits = string.join(inheritl, ", ") - - self.st.out(objref_class, ifid=vname, inherits=inherits) - - for inclass in inheritl: - self.st.out(objref_inherit_init, inclass=inclass) - - methods = string.join(methodl, " + ") - self.st.out(objref_methods, methods = methods) - - # registerObjRef() - self.st.out(value_objref_register, - ifid=vname, modname=self.modname) - - # Modifier - if node.custom(): - modifier = "_0_CORBA.VM_CUSTOM" - elif node.truncatable(): - modifier = "_0_CORBA.VM_TRUNCATABLE" - else: - modifier = "_0_CORBA.VM_NONE" - - # Truncatable bases - tbasel = [] - cnode = node - while 1: - cin = cnode.inherits() - if not cin: - break - i = cin[0] - i = i.fullDecl() - if not isinstance(i, idlast.Value): - break - if cnode.truncatable(): - sn = fixupScopedName(i.scopedName()) - tbasel.append(dotName(sn) + "._NP_RepositoryId") - else: - break - cnode = i - - if tbasel: - tbaseids = "(%s._NP_RepositoryId, %s)" % (vname, - string.join(tbasel, ", ")) - else: - tbaseids = "None" - - basedesc = None - if node.inherits(): - i = node.inherits()[0].fullDecl() - if isinstance(i, idlast.Value): - sn = i.scopedName()[:] - sn[-1] = "_d_" + sn[-1] - basedesc = dotName(fixupScopedName(sn)) - - if basedesc is None: - basedesc = "_0_CORBA.tcInternal.tv_null" - - mlist = [] - for m in node.statemembers(): - for d in m.declarators(): - mlist.append('"%s"' % mangle(d.identifier())) - mlist.append(typeAndDeclaratorToDescriptor(m.memberType(), - d, [])) - if m.memberAccess() == 1: - mlist.append("_0_CORBA.PRIVATE_MEMBER") - else: - mlist.append("_0_CORBA.PUBLIC_MEMBER") - - mdescs = string.join(mlist, ", ") - self.st.out(value_descriptor_at_module_scope, - vname=vname, modifier=modifier, tbaseids=tbaseids, - basedesc=basedesc, mdescs=mdescs, modname=self.modname) - - - -def docConst(node): - if isinstance(node, idlast.Const) and \ - node.constKind() == idltype.tk_string and \ - node.identifier()[-7:] == "__doc__": - return node.identifier()[:-7] - else: - return None - -def nodeId(node): - if hasattr(node, "identifier"): - return node.identifier() - else: - return None - -def docWarning(node): - sys.stderr.write(main.cmdname + \ - ": Warning: Constant '" + node.identifier() + "' looks " - "like a Python docstring, but there is no declaration " - "named '" + node.identifier()[:-7] + "'.\n") - -class DocstringVisitor (idlvisitor.AstVisitor): - def __init__(self, st): - self.docs = [] - self.st = st - - def output(self): - if self.docs: - self.st.out("""\ -# -# Docstrings -# -""") - for nsn, dsn in self.docs: - nsn = fixupScopedName(nsn) - dsn = fixupScopedName(dsn) - - self.st.out("@node@.__doc__ = @doc@", - node=dotName(nsn), doc=dotName(dsn)) - - if self.docs: - self.st.out("") - - def visitAST(self, node): - for n in node.declarations(): - if not output_inline and not n.mainFile(): continue - - d = docConst(n) - if d: - ok = 0 - for o in node.declarations(): - if nodeId(o) == d: - self.docs.append((o.scopedName(), n.scopedName())) - if isinstance(o, idlast.Interface): - sn = o.scopedName()[:] - sn[-1] = "_objref_" + sn[-1] - self.docs.append((sn, n.scopedName())) - ok = 1 - break - if not ok: - docWarning(n) - n.accept(self) - - def visitModule(self, node): - for n in node.definitions(): - d = docConst(n) - if d: - if d == node.identifier(): - self.docs.append((node.scopedName(), n.scopedName())) - else: - ok = 0 - for o in node.definitions(): - if nodeId(o) == d: - self.docs.append((o.scopedName(), n.scopedName())) - if isinstance(o, idlast.Interface): - sn = o.scopedName()[:] - sn[-1] = "_objref_" + sn[-1] - self.docs.append((sn, n.scopedName())) - ok = 1 - break - if not ok: - docWarning(n) - n.accept(self) - - def visitInterface(self, node): - for n in node.declarations(): - d = docConst(n) - if d: - if d == node.identifier(): - self.docs.append((node.scopedName(), n.scopedName())) - sn = node.scopedName()[:] - sn[-1] = "_objref_" + sn[-1] - self.docs.append((sn, n.scopedName())) - else: - ok = 0 - for o in node.declarations(): - if nodeId(o) == d: - self.docs.append((o.scopedName(), n.scopedName())) - ok = 1 - break - - if ok: - continue - - for o in node.callables(): - self.target_id = d - self.target_node = n - self.ok = 0 - o.accept(self) - if self.ok: - break - - if not self.ok: - docWarning(n) - - def visitOperation(self, node): - if node.identifier() == self.target_id: - sn = node.scopedName() + ["im_func"] - sn[-3] = "_objref_" + sn[-3] - self.docs.append((sn, self.target_node.scopedName())) - self.ok = 1 - - def visitAttribute(self, node): - for n in node.declarators(): - if n.identifier() == self.target_id: - sn = n.scopedName() + ["im_func"] - sn[-3] = "_objref_" + sn[-3] - sn[-2] = "_get_" + sn[-2] - self.docs.append((sn, self.target_node.scopedName())) - if not node.readonly(): - sn = sn[:] - sn[-2] = "_set_" + n.identifier() - self.docs.append((sn, self.target_node.scopedName())) - self.ok = 1 - - -class ExampleVisitor (idlvisitor.AstVisitor, idlvisitor.TypeVisitor): - def __init__(self, st): - self.st = st - self.first = None - - def visitAST(self, node): - for n in node.declarations(): - if not output_inline and not n.mainFile(): continue - - if isinstance(n, idlast.Module) or isinstance(n, idlast.Interface): - n.accept(self) - - def visitModule(self, node): - for n in node.definitions(): - if not output_inline and not n.mainFile(): continue - - if isinstance(n, idlast.Module) or isinstance(n, idlast.Interface): - n.accept(self) - - def visitInterface(self, node): - ifname = mangle(node.identifier()) - sname = node.scopedName() - ccname = idlutil.ccolonName(sname) - fsname = fixupScopedName(sname, prefix="") - dname = dotName(fsname) - skname = skeletonModuleName(dname) - - if self.first is None: - self.first = ifname - - if len(node.inherits()) == 1: - inheritance_note = """ - # Note: this interface inherits from another interface. You must - # either multiply inherit from the servant class implementing the - # base interface, or explicitly implement the inherited operations - # here. - # - # Inherited interface: - # -""" - elif node.inherits(): - inheritance_note = """ - # Note: this interface inherits from other interfaces. You must either - # multiply inherit from the servant classes implementing the base - # interfaces, or explicitly implement the inherited operations here. - # - # Inherited interfaces: - # -""" - else: - inheritance_note = "" - - for inh in node.inherits(): - iname = idlutil.ccolonName(inh.fullDecl().scopedName()) - inheritance_note = inheritance_note + " # %s\n" % iname - - self.st.out(example_classdef, ifname=ifname, - ccname=ccname, skname=skname, - inheritance_note = inheritance_note) - - for c in node.callables(): - - if isinstance(c, idlast.Attribute): - - c.attrType().accept(self) - attrtype = self.__result_type - - for attr in c.identifiers(): - - signature = "attribute %s %s" % (attrtype, attr) - - if c.readonly(): - signature = "readonly " + signature - - if not c.readonly(): - self.st.out(example_opdef, - signature = signature, - opname = "_set_" + attr, - args = ", value", - returnspec = "None") - - self.st.out(example_opdef, - signature = signature, - opname = "_get_" + attr, - args = "", - returnspec = "attribute value") - else: - # Operation - innames = [] - outnames = [] - siglist = [] - - c.returnType().accept(self) - rettype = self.__result_type - - if c.returnType().kind() != idltype.tk_void: - outnames.append("result") - - for p in c.parameters(): - if p.is_in(): - innames.append(p.identifier()) - if p.is_out(): - outnames.append(p.identifier()) - - direction = {0:"in", 1:"out", 2:"inout"}[p.direction()] - - p.paramType().accept(self) - siglist.append("%s %s %s" % (direction, - self.__result_type, - p.identifier())) - - signature = "%s %s(%s)" % (rettype, c.identifier(), - string.join(siglist, ", ")) - - if innames: - args = ", " + string.join(innames, ", ") - else: - args = "" - - if outnames: - returnspec = string.join(outnames, ", ") - else: - returnspec = "None" - - self.st.out(example_opdef, - signature = signature, - opname = c.identifier(), - args = args, - returnspec = returnspec) - - - - ttsMap = { - idltype.tk_void: "void", - idltype.tk_short: "short", - idltype.tk_long: "long", - idltype.tk_ushort: "unsigned short", - idltype.tk_ulong: "unsigned long", - idltype.tk_float: "float", - idltype.tk_double: "double", - idltype.tk_boolean: "boolean", - idltype.tk_char: "char", - idltype.tk_octet: "octet", - idltype.tk_any: "any", - idltype.tk_TypeCode: "CORBA::TypeCode", - idltype.tk_Principal: "CORBA::Principal", - idltype.tk_longlong: "long long", - idltype.tk_ulonglong: "unsigned long long", - idltype.tk_longdouble: "long double", - idltype.tk_wchar: "wchar" - } - - def visitBaseType(self, type): - self.__result_type = self.ttsMap[type.kind()] - - def visitStringType(self, type): - if type.bound() == 0: - self.__result_type = "string" - else: - self.__result_type = "string<" + str(type.bound()) + ">" - - def visitWStringType(self, type): - if type.bound() == 0: - self.__result_type = "wstring" - else: - self.__result_type = "wstring<" + str(type.bound()) + ">" - - - def visitDeclaredType(self, type): - self.__result_type = idlutil.ccolonName(type.decl().scopedName()) - - - - - -def operationToDescriptors(op): - """Return the descriptors for an operation. - - Returns a tuple containing strings of (in descriptor, out - descriptor, exception map, context list, contains values) - """ - - indl = [] - outdl = [] - cv = 0 - - if op.returnType() is not None and \ - op.returnType().kind() != idltype.tk_void: - - outdl.append(typeToDescriptor(op.returnType())) - cv = idltype.containsValueType(op.returnType()) - - # Make the lists of in and out parameters - for p in op.parameters(): - - if p.is_in(): - indl.append(typeToDescriptor(p.paramType())) - if p.is_out(): - outdl.append(typeToDescriptor(p.paramType())) - - cv = cv or idltype.containsValueType(p.paramType()) - - # Fudge single-item lists so that single item tuples work - if len(indl) == 1: indl.append("") - if len(outdl) == 1: outdl.append("") - - inds = "(" + string.join(indl, ", ") + ")" - if op.oneway(): - outds = "None" - else: - outds = "(" + string.join(outdl, ", ") + ")" - - # Exceptions - excl = [] - - for e in op.raises(): - sn = fixupScopedName(e.scopedName()) - ename = dotName(sn) - edesc = dotName(sn[:-1] + [ "_d_" + sn[-1]]) - excl.append(ename + "._NP_RepositoryId: " + edesc) - - if len(excl) > 0: - excs = "{" + string.join(excl, ", ") + "}" - else: - excs = "None" - - if op.contexts(): - ctxts = "[" + string.join(map(repr, op.contexts()), ", ") + "]" - else: - ctxts = None - - return inds, outds, excs, ctxts, cv - - - -ttdMap = { - idltype.tk_short: "omniORB.tcInternal.tv_short", - idltype.tk_long: "omniORB.tcInternal.tv_long", - idltype.tk_ushort: "omniORB.tcInternal.tv_ushort", - idltype.tk_ulong: "omniORB.tcInternal.tv_ulong", - idltype.tk_float: "omniORB.tcInternal.tv_float", - idltype.tk_double: "omniORB.tcInternal.tv_double", - idltype.tk_boolean: "omniORB.tcInternal.tv_boolean", - idltype.tk_char: "omniORB.tcInternal.tv_char", - idltype.tk_octet: "omniORB.tcInternal.tv_octet", - idltype.tk_any: "omniORB.tcInternal.tv_any", - idltype.tk_TypeCode: "omniORB.tcInternal.tv_TypeCode", - idltype.tk_Principal: "omniORB.tcInternal.tv_Principal", - idltype.tk_longlong: "omniORB.tcInternal.tv_longlong", - idltype.tk_ulonglong: "omniORB.tcInternal.tv_ulonglong", - idltype.tk_wchar: "omniORB.tcInternal.tv_wchar" -} - -unsupportedMap = { - idltype.tk_longdouble: "long double", -} - -def typeToDescriptor(tspec, from_scope=[], is_typedef=0): - if hasattr(tspec, "python_desc"): - return tspec.python_desc - - if ttdMap.has_key(tspec.kind()): - tspec.python_desc = ttdMap[tspec.kind()] - return tspec.python_desc - - if unsupportedMap.has_key(tspec.kind()): - error_exit("omniORBpy does not support the %s type." % - unsupportedMap[tspec.kind()]) - - if tspec.kind() == idltype.tk_string: - ret = "(omniORB.tcInternal.tv_string," + str(tspec.bound()) + ")" - - elif tspec.kind() == idltype.tk_wstring: - ret = "(omniORB.tcInternal.tv_wstring," + str(tspec.bound()) + ")" - - elif tspec.kind() == idltype.tk_sequence: - ret = "(omniORB.tcInternal.tv_sequence, " + \ - typeToDescriptor(tspec.seqType(), from_scope) + \ - ", " + str(tspec.bound()) + ")" - - elif tspec.kind() == idltype.tk_fixed: - ret = "(omniORB.tcInternal.tv_fixed, " + \ - str(tspec.digits()) + ", " + str(tspec.scale()) + ")" - - elif tspec.kind() == idltype.tk_alias: - sn = fixupScopedName(tspec.scopedName()) - if is_typedef: - return 'omniORB.typeCodeMapping["%s"]._d' % tspec.decl().repoId() - else: - return 'omniORB.typeMapping["%s"]' % tspec.decl().repoId() - - else: - ret = 'omniORB.typeMapping["%s"]' % tspec.decl().repoId() - - tspec.python_desc = ret - return ret - - -def typeAndDeclaratorToDescriptor(tspec, decl, from_scope, is_typedef=0): - desc = typeToDescriptor(tspec, from_scope, is_typedef) - - if len(decl.sizes()) > 0: - sizes = decl.sizes()[:] - sizes.reverse() - for size in sizes: - desc = "(omniORB.tcInternal.tv_array, " + \ - desc + ", " + str(size) + ")" - return desc - -def skeletonModuleName(mname): - """Convert a scoped name string into the corresponding skeleton -module name. e.g. M1.M2.I -> M1__POA.M2.I""" - l = string.split(mname, ".") - l[0] = l[0] + "__POA" - return string.join(l, ".") - -def dotName(scopedName, our_scope=[]): - if scopedName[:len(our_scope)] == our_scope: - l = map(mangle, scopedName[len(our_scope):]) - else: - l = map(mangle, scopedName) - return string.join(l, ".") - -def mangle(name): - if keyword.iskeyword(name): return "_" + name - - # None is a pseudo-keyword that cannot be assigned to. - if name == "None": return "_None" - - return name - -def fixupScopedName(scopedName, prefix="_0_"): - """Add a prefix and _GlobalIDL to the front of a ScopedName if necessary""" - - try: - decl = idlast.findDecl([scopedName[0]]) - except idlast.DeclNotFound: - decl = None - - if isinstance(decl, idlast.Module): - scopedName = [prefix + mangle(scopedName[0])] + scopedName[1:] - else: - scopedName = [prefix + global_module] + scopedName - return scopedName - -def valueToString(val, kind, scope=[]): - if kind == idltype.tk_enum: - return dotName(fixupScopedName(val.scopedName()), scope) - - elif kind in [idltype.tk_string, idltype.tk_char]: - return '"' + idlutil.escapifyString(val) + '"' - - elif kind == idltype.tk_wstring: - return 'u"' + idlutil.escapifyWString(val) + '"' - - elif kind == idltype.tk_wchar: - return 'u"' + idlutil.escapifyWString([val]) + '"' - - elif kind == idltype.tk_long and val == -2147483647 - 1: - return "-2147483647 - 1" - - elif kind in [idltype.tk_float, idltype.tk_double, idltype.tk_longdouble]: - return idlutil.reprFloat(val) - - elif kind == idltype.tk_fixed: - return "CORBA.fixed('" + val + "')" - - else: - return str(val) - -__translate_table = string.maketrans(" -.,", "____") - -def outputFileName(idlname): - global __translate_table - return string.translate(os.path.basename(idlname), __translate_table) - -def checkStubPackage(package): - """Check the given package name for use as a stub directory - - Make sure all fragments of the package name are directories, or - create them. Make __init__.py files in all directories.""" - - if len(package) == 0: - return - - if package[-1] == ".": - package = package[:-1] - - path = "" - for name in string.split(package, "."): - path = os.path.join(path, name) - - if os.path.exists(path): - if not os.path.isdir(path): - error_exit('Output error: "%s" exists and is not ' - 'a directory.' % path) - else: - try: - os.mkdir(path) - except: - error_exit('Cannot create directory "%s".\n' % path) - - initfile = os.path.join(path, "__init__.py") - - if os.path.exists(initfile): - if not os.path.isfile(initfile): - error_exit('Output error: "%s" exists and is not a file.' % - initfile) - else: - try: - open(initfile, "w").write("# omniORB stub directory\n") - except: - error_exit('Cannot create "%s".' % initfile) - - -def updateModules(modules, pymodule): - """Create or update the Python modules corresponding to the IDL - module names""" - - checkStubPackage(module_package) - - poamodules = map(skeletonModuleName, modules) - - real_updateModules(modules, pymodule) - real_updateModules(poamodules, pymodule) - - -def real_updateModules(modules, pymodule): - - for module in modules: - modlist = string.split(module_package, ".") + string.split(module, ".") - modpath = apply(os.path.join, modlist) - modfile = os.path.join(modpath, "__init__.py") - tmpfile = os.path.join(modpath, "new__init__.py") - - if not os.path.exists(modpath): - try: - os.makedirs(modpath) - except: - error_exit('Cannot create path "%s".' % modpath) - - # Make the __init__.py file if it does not already exist - if not os.path.exists(modfile): - try: - f = open(modfile, "w") - except: - error_exit('Cannot create "%s".' % modfile) - - st = output.Stream(f, 4) - - st.out(pymodule_template, module=module, package=module_package) - - f.close() - del f, st - - if not os.path.isfile(modfile): - error_exit('Output error: "%s" exists but is not a file.' % - modfile) - - # Insert the import line for the current IDL file - try: - inf = open(modfile, "r") - except: - error_exit('Cannot open "%s" for reading.' % modfile) - - try: - outf = open(tmpfile, "w") - except: - error_exit('Cannot open "%s" for writing.' % tmpfile) - - line = "" - while line[:7] != "# ** 1.": - line = inf.readline() - if line == "": - error_exit('Output error: "%s" ended before I found a ' - '"# ** 1." tag.\n' - 'Have you left behind some files from a ' - 'different Python ORB?' % modfile) - - outf.write(line) - - already = 0 - outputline = "import " + pymodule + "\n" - - while line != "\n": - line = inf.readline() - if line == "": - error_exit('Output error: "%s" ended while I was ' - 'looking at imports.' % modfile) - - if line != "\n": - outf.write(line) - if line == outputline: - already = 1 - - if not already: - outf.write(outputline) - - outf.write("\n") - - # Output the rest of the file - while line != "": - line = inf.readline() - outf.write(line) - - inf.close() - outf.close() - - try: - os.remove(modfile) - except: - error_exit('Cannot remove "%s".' % modfile) - try: - os.rename(tmpfile, modfile) - except: - error_exit('Cannot rename "%s" to "%s".' % (tmpfile, modfile)) - - # Go round again, importing sub-modules from their parent modules - for module in modules: - modlist = string.split(module, ".") - - if len(modlist) == 1: - continue - - modlist = string.split(module_package, ".") + modlist - submod = modlist[-1] - modpath = apply(os.path.join, modlist[:-1]) - modfile = os.path.join(modpath, "__init__.py") - tmpfile = os.path.join(modpath, "new__init__.py") - - # Insert the import line for the sub-module - try: - inf = open(modfile, "r") - except: - error_exit('Cannot open "%s" for reading.' % modfile) - - try: - outf = open(tmpfile, "w") - except: - error_exit('Cannot open "%s" for writing.' % tmpfile) - - line = "" - while line[:7] != "# ** 2.": - line = inf.readline() - if line == "": - error_exit('Output error: "%s" ended before I found a ' - '"# ** 1." tag.\n' - 'Have you left behind some files from a ' - 'different Python ORB?' % modfile) - - outf.write(line) - - already = 0 - outputline = "import " + submod + "\n" - - while line != "\n": - line = inf.readline() - if line == "": - error_exit('Output error: "%s" ended while I was ' - 'looking at imports.' % modfile) - - if line != "\n": - outf.write(line) - if line == outputline: - already = 1 - - if not already: - outf.write(outputline) - - outf.write("\n") - - # Output the rest of the file - while line != "": - line = inf.readline() - outf.write(line) - - inf.close() - outf.close() - - try: - os.remove(modfile) - except: - error_exit('Cannot remove "%s".' % modfile) - try: - os.rename(tmpfile, modfile) - except: - error_exit('Cannot rename "%s" to "%s".' % (tmpfile, modfile)) diff --git a/idl/vtkWrapIDL.c b/idl/vtkWrapIDL.c deleted file mode 100644 index fbaeff3e..00000000 --- a/idl/vtkWrapIDL.c +++ /dev/null @@ -1,1871 +0,0 @@ -// PARAVIS : ParaView wrapper SALOME module -// -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : vtkWrapIDL.c -// Author : Vladimir TURIN - -#include -#include -#include -#include -#include "vtkConfigure.h" -#include "vtkParse.h" -#include "vtkParseType.h" -#include "vtkParseMain.h" -#include "vtkWrapIDL.h" -#include "vtkWrap.h" - -char* Copyright[] = { - "// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,", - "// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS", - "//", - "// This library is free software; you can redistribute it and/or", - "// modify it under the terms of the GNU Lesser General Public", - "// License as published by the Free Software Foundation; either", - "// version 2.1 of the License.", - "//", - "// This library is distributed in the hope that it will be useful,", - "// but WITHOUT ANY WARRANTY; without even the implied warranty of", - "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU", - "// Lesser General Public License for more details.", - "//", - "// You should have received a copy of the GNU Lesser General Public", - "// License along with this library; if not, write to the Free Software", - "// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA", - "//", - "// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com", - "" -}; - -#define bs 12288 - -HierarchyInfo *hierarchyInfo = NULL; -int numberOfWrappedFunctions = 0; -FunctionInfo *wrappedFunctions[1000]; -extern FunctionInfo *currentFunction; -char *EmptyString = ""; - - -static void add_to_sig(char *sig, const char *add, int *i) -{ - strcpy(&sig[*i],add); - *i += (int)strlen(add); -} - -int IsReturnArg(int I) { - return (I == MAX_ARGS); -} - -void AddReturnArg(char *Result, int *CurrPos) { - add_to_sig(Result,"virtual ",CurrPos); -} - -int IsIn(ValueInfo* Type) { - return 1; - //return ((Type % VTK_PARSE_BASE_TYPE)/0x100 < 1 || (Type % VTK_PARSE_BASE_TYPE)/0x100 > 7); -} - -void AddNotReturnArg(ValueInfo* Type, char *Result, int *CurrPos) { -#if defined(IDL_I_HH) || defined(IDL_I_CC) - ; -#else - if(IsIn(Type)) - add_to_sig(Result,"in ",CurrPos); - else - add_to_sig(Result,"inout ",CurrPos); -#endif -} - -int IsFunction(ValueInfo* Type) { - //return (Type == VTK_PARSE_FUNCTION); - return vtkWrap_IsFunction(Type); -} - -int IsConst(ValueInfo* Type) { - //return ((Type % 0x2000) >= 0x1000); - return vtkWrap_IsConst(Type); -} - -void AddConst(char *Result, int *CurrPos) { -#if defined(IDL_I_HH) || defined(IDL_I_CC) - add_to_sig(Result,"const ",CurrPos); -#else - add_to_sig(Result,"in ",CurrPos); -#endif -} - - -int IsClass(ValueInfo* theType) { - //return ((theType->Type % 0x10) == 0x9); - return vtkWrap_IsObject(theType) || vtkWrap_IsVTKObject(theType); -} - -int IsString(ValueInfo* Type) { - //return (IsChar(Type) && IsArray(Type)); - //return (IsChar(Type) && IsPtr(Type)); - return vtkWrap_IsCharPointer(Type) || vtkWrap_IsString(Type) || (strcmp(Type->Class, "vtkStdString") == 0); -} - -int IsPtr(ValueInfo* Type) { - //return ((Type % VTK_PARSE_BASE_TYPE)/0x100 == 0x1); - return vtkWrap_IsPointer(Type) && (!IsString(Type)) && (!IsClass(Type)); -} - -int IsUnknown(ValueInfo* theType) { - //return ((Type % VTK_PARSE_BASE_TYPE)/0x100 == 0x8); - return (theType->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN; -} - -void AddAtomArg(int I, ValueInfo* Type, char *TypeIDL, char *TypeCorba, char *Result, int *CurrPos) { -#if defined(IDL_I_HH) || defined(IDL_I_CC) - add_to_sig(Result,"CORBA::",CurrPos); - add_to_sig(Result,TypeCorba,CurrPos); - - if (!IsReturnArg(I) && !IsConst(Type) && !IsIn(Type)) - add_to_sig(Result,"&",CurrPos); -#else - add_to_sig(Result,TypeIDL,CurrPos); -#endif - add_to_sig(Result," ",CurrPos); -} - -int IsArray(ValueInfo* Type) { - //return ((Type % VTK_PARSE_BASE_TYPE)/0x100 == 0x3); - return vtkWrap_IsArray(Type); -} - -void AddArrayArg(int I, ValueInfo* Type, char *TypeIDL, char *Result, int *CurrPos) { -#if defined(IDL_I_HH) || defined(IDL_I_CC) - if(!IsReturnArg(I) && !IsConst(Type)) - add_to_sig(Result, "const ",CurrPos); -#endif - add_to_sig(Result, TypeIDL,CurrPos); - add_to_sig(Result, "_array",CurrPos); -#if defined(IDL_I_HH) || defined(IDL_I_CC) - if(IsReturnArg(I)) { - add_to_sig(Result, "*",CurrPos); - } else { - add_to_sig(Result, "&",CurrPos); - } -#else -#endif - add_to_sig(Result, " ",CurrPos); -} - -int IsBoolean(ValueInfo* Type) { - //return ((Type % 0x10) == 0xE); - return vtkWrap_IsBool(Type); -} - -void AddBooleanAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { - AddAtomArg(I,Type,"boolean","Boolean",Result,CurrPos); -} - -int IsChar(ValueInfo* theType) { - //return ((Type % 0x10) == 0x3 || (Type % 0x10) == 0xD); - int aBase = theType->Type & VTK_PARSE_BASE_TYPE; - return (aBase == VTK_PARSE_CHAR) || (aBase == VTK_PARSE_UNSIGNED_CHAR) || (aBase == VTK_PARSE_SIGNED_CHAR); -} - -int IsCharArray(ValueInfo* theType) { - return (IsChar(theType) && IsArray(theType)); -} - -void AddCharAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { - AddAtomArg(I,Type,"char","Char",Result,CurrPos); -} - -void AddCharArrayArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { - AddArrayArg(I,Type,"char",Result,CurrPos); -} - -void AddStringArg(int I, char *Result, int *CurrPos) { -#if defined(IDL_I_HH) || defined(IDL_I_CC) - add_to_sig(Result,"char ",CurrPos); -#else - add_to_sig(Result,"string ",CurrPos); -#endif -} - -int IsFloat(ValueInfo* theType) { - //return ((Type % 0x10) == 0x1); - return (theType->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_FLOAT; -} - -void AddFloatAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { - AddAtomArg(I,Type,"float","Float",Result,CurrPos); -} - -int IsFloatArray(ValueInfo* theType) { - return (IsFloat(theType) && IsArray(theType)); -} - -void AddFloatArrayArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { - AddArrayArg(I,Type,"float",Result,CurrPos); -} - -int IsDouble(ValueInfo* theType) { - //return ((Type % 0x10) == 0x7); - return (theType->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_DOUBLE; -} - -void AddDoubleAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { - AddAtomArg(I,Type,"double","Double",Result,CurrPos); -} - -int IsDoubleArray(ValueInfo* Type) { - return (IsDouble(Type) && IsArray(Type)); -} - -void AddDoubleArrayArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { - AddArrayArg(I,Type,"double",Result,CurrPos); -} - -int IsvtkIdType(ValueInfo* theType) { - //return((Type % 0x10) == 0xA); - return (theType->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_ID_TYPE; -} - -int IsShort(ValueInfo* theType) { - //return ((Type % 0x10) == 0x4 || (Type % 0x10) == 0x5 || (Type % 0x10) == 0xA); - int aVal = theType->Type & VTK_PARSE_BASE_TYPE; - return (aVal == VTK_PARSE_SHORT) || (aVal == VTK_PARSE_UNSIGNED_SHORT); -} - -int IsInt(ValueInfo* theType) { - //return ((Type % 0x10) == 0x4 || (Type % 0x10) == 0x5 || (Type % 0x10) == 0xA); - int aVal = theType->Type & VTK_PARSE_BASE_TYPE; - return (aVal == VTK_PARSE_INT) || - (aVal == VTK_PARSE_ID_TYPE) || (aVal == VTK_PARSE_UNSIGNED_INT) || - (aVal == VTK_PARSE_SSIZE_T) || (aVal == VTK_PARSE_SIZE_T); -} - -int IsShortInt(ValueInfo* theType) { - //return ((Type % 0x10) == 0x4 || (Type % 0x10) == 0x5 || (Type % 0x10) == 0xA); - return (IsShort(theType) || IsInt(theType)); -} - -void AddShortAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { - AddAtomArg(I,Type,"short","Short",Result,CurrPos); -} - -int IsShortArray(ValueInfo* Type) { - return (IsShort(Type) && IsArray(Type)); -} - -int IsIntArray(ValueInfo* Type) { - return (IsInt(Type) && IsArray(Type)); -} - -void AddShortArrayArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { - AddArrayArg(I,Type,"short",Result,CurrPos); -} - -int IsLong(ValueInfo* theType) { - //return ((Type % 0x10) == 0x6 || (Type % 0x10) == 0xB || (Type % 0x10) == 0xC); - unsigned int aVal = theType->Type & VTK_PARSE_BASE_TYPE; - return (aVal == VTK_PARSE_LONG) || (aVal == VTK_PARSE_UNSIGNED_LONG) || - (aVal == VTK_PARSE___INT64) || (aVal == VTK_PARSE_UNSIGNED___INT64) || (aVal == VTK_PARSE_LONG_LONG) || - (aVal == VTK_PARSE_UNSIGNED_LONG_LONG); -} - -void AddLongAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { - AddAtomArg(I,Type,"long","Long",Result,CurrPos); -} - -int IsLongArray(ValueInfo* Type) { - return (IsLong(Type) && IsArray(Type)); -} - -void AddLongArrayArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { - AddArrayArg(I,Type,"long",Result,CurrPos); -} - -void AddClassArg(int I, ValueInfo* Type, const char *Class, char *Result, int *CurrPos) { -#if defined(IDL_I_HH) || defined(IDL_I_CC) - add_to_sig(Result,"PARAVIS_Base",CurrPos); - if(IsReturnArg(I) || IsConst(Type) || IsIn(Type)) { - add_to_sig(Result,"_ptr",CurrPos); - } else { - add_to_sig(Result,"_ptr&",CurrPos); - } - add_to_sig(Result," ",CurrPos); -#else - add_to_sig(Result,"PARAVIS_Base ",CurrPos); -#endif -} - -int _IsVoid(ValueInfo* theType) { - //return ((Type % 0x10) == 0x2); - return (theType->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_VOID; -} - -int IsVoid(ValueInfo* Type) { - return (_IsVoid(Type) && (!IsPtr(Type))); -} - -int IsUnsigned(ValueInfo* theType) { - unsigned int aVal = theType->Type & VTK_PARSE_BASE_TYPE; - switch (aVal) { - case VTK_PARSE_UNSIGNED_CHAR: - case VTK_PARSE_UNSIGNED_INT: - case VTK_PARSE_UNSIGNED_SHORT: - case VTK_PARSE_UNSIGNED_LONG: - case VTK_PARSE_UNSIGNED_ID_TYPE: - case VTK_PARSE_UNSIGNED_LONG_LONG: - case VTK_PARSE_UNSIGNED___INT64: - case VTK_PARSE_UNSIGNED_CHAR_PTR: - case VTK_PARSE_UNSIGNED_INT_PTR: - case VTK_PARSE_UNSIGNED_SHORT_PTR: - case VTK_PARSE_UNSIGNED_LONG_PTR: - case VTK_PARSE_UNSIGNED_ID_TYPE_PTR: - case VTK_PARSE_UNSIGNED_LONG_LONG_PTR: - case VTK_PARSE_UNSIGNED___INT64_PTR: - return 1; - } - return 0; -} - -void AddVoid(char *Result, int *CurrPos) { - add_to_sig(Result,"void ",CurrPos); -} - -int IsVoidPtr(ValueInfo* Type) { - return (_IsVoid(Type) && (IsPtr(Type) || IsArray(Type))); -} - -void AddVoidArg(int I, char *Result, int *CurrPos, ValueInfo* Type) { -#if defined(IDL_I_HH) || defined(IDL_I_CC) - if(!IsReturnArg(I)) { - if(!IsConst(Type)) - add_to_sig(Result,"const ",CurrPos); - add_to_sig(Result,"CORBA::Any& ",CurrPos); - } else { - add_to_sig(Result,"CORBA::Any ",CurrPos); - } -#else - add_to_sig(Result,"any ",CurrPos); -#endif -} - -void AddTypeArray(ValueInfo* Type, char *Result, int *CurrPos) { - if(IsShortInt(Type)) - add_to_sig(Result,"short",CurrPos); - if(IsLong(Type)) - add_to_sig(Result,"long",CurrPos); - if(IsFloat(Type)) - add_to_sig(Result,"float",CurrPos); - if(IsDouble(Type)) - add_to_sig(Result,"double",CurrPos); - if(IsChar(Type)) - add_to_sig(Result,"char",CurrPos); - add_to_sig(Result,"_array",CurrPos); -} - -typedef struct _ReadFuncs -{ - char* Name; - char* Signature; - int EndPos; - int NumPos; -} ReadFuncs; - -ReadFuncs readFunctions[1000]; -int numberOfReadFunctions = 0; - -static int class_has_new = 0; - -void output_type(char* result, int *currPos, int i, ValueInfo* aType, const char *Id) -{ - if (vtkWrap_IsConst(aType)) - add_to_sig(result,"const ",currPos); - - if(IsFloat(aType)) { - if(IsArray(aType)) { - add_to_sig(result,"float",currPos); - } else { - add_to_sig(result,"CORBA::Float",currPos); - } - } - - if(IsDouble(aType)) { - if(IsArray(aType)) { - add_to_sig(result,"double",currPos); - } else { - add_to_sig(result,"CORBA::Double",currPos); - } - } - - if(IsShortInt(aType)) { - if(IsArray(aType)) { - if (IsUnsigned(aType)) - add_to_sig(result,"unsigned ",currPos); - if(IsvtkIdType(aType)) { - add_to_sig(result,"vtkIdType",currPos); - } else { - add_to_sig(result,"int",currPos); - } - } else { - add_to_sig(result,"CORBA::Short",currPos); - } - } - - if(IsLong(aType)) { - if(IsArray(aType)) { - if (IsUnsigned(aType)) - add_to_sig(result,"unsigned ",currPos); - add_to_sig(result,"long",currPos); - } else { - add_to_sig(result,"CORBA::Long",currPos); - } - } - - if(IsString(aType)) { - if(IsReturnArg(i)) - add_to_sig(result,"const ",currPos); - if(strcmp(aType->Class, "vtkStdString") == 0) { - add_to_sig(result,"vtkStdString",currPos); - } else { - add_to_sig(result,"char",currPos); - } - } else if(IsChar(aType)) { - if(IsArray(aType)) { - if (IsUnsigned(aType)) - add_to_sig(result,"unsigned ",currPos); - add_to_sig(result,"char",currPos); - } else { - add_to_sig(result,"CORBA::Char",currPos); - } - } - - if(IsBoolean(aType)) { - add_to_sig(result,"CORBA::Boolean",currPos); - } - - if(IsVoidPtr(aType)) { - add_to_sig(result,"void",currPos); - } - - if(IsClass(aType)) { - add_to_sig(result,"::",currPos); - add_to_sig(result,Id,currPos); - } - - if(IsArray(aType) || IsPtr(aType) || IsClass(aType) || IsString(aType)) { - if(strcmp(aType->Class, "vtkStdString") != 0) { - add_to_sig(result,"*",currPos); - } - } -} - -void output_typedef(char* result, int *currPos, int i, ValueInfo* aType, const char *Id) -{ - add_to_sig(result," typedef ",currPos); - output_type(result,currPos,i,aType,Id); -} - -void output_temp(char* result, int *currPos, int i, ValueInfo* aType, const char *Id, int aCount) -{ - static char buf[bs]; - - /* handle VAR FUNCTIONS */ - if (IsFunction(aType)) { - return; - } - -#if defined(IDL_I_HH) - if(IsReturnArg(i)) { - AddReturnArg(result,currPos); - } -#endif - - if (IsReturnArg(i) && IsVoid(aType) && !IsVoidPtr(aType)) { - AddVoid(result,currPos); - return; - } - - /* for const * return types prototype with const */ - if ( IsConst(aType) || IsString(aType)) { - if(!IsReturnArg(i)) { - AddConst(result,currPos); - } - } else { - if(!IsReturnArg(i)) { - AddNotReturnArg(aType,result,currPos); - } - } - - if(IsFloat(aType)) { - if(IsFloatArray(aType)) { - AddFloatArrayArg(i,aType,result,currPos); - } else { - AddFloatAtomArg(i,aType,result,currPos); - } - } - - if(IsDouble(aType)) { - if(IsDoubleArray(aType)) { - AddDoubleArrayArg(i,aType,result,currPos); - } else { - AddDoubleAtomArg(i,aType,result,currPos); - } - } - - if(IsShortInt(aType)) { - if(IsArray(aType)) { - AddShortArrayArg(i,aType,result,currPos); - } else { - AddShortAtomArg(i,aType,result,currPos); - } - } - - if(IsLong(aType)) { - if(IsLongArray(aType)) { - AddLongArrayArg(i,aType,result,currPos); - } else { - AddLongAtomArg(i,aType,result,currPos); - } - } - - if(IsChar(aType)) { - if(IsString(aType)) { - AddStringArg(i,result,currPos); - } else { - if(IsCharArray(aType)) { - AddCharArrayArg(i,aType,result,currPos); - } else { - AddCharAtomArg(i,aType,result,currPos); - } - } - } else if (IsString(aType)) //!!! VSV - AddStringArg(i,result,currPos); - - if(IsBoolean(aType)) { - AddBooleanAtomArg(i,aType,result,currPos); - } - - if(IsVoid(aType)) { - AddVoidArg(i,result,currPos,aType); - } - - if(IsClass(aType)) { - AddClassArg(i,aType,Id,result,currPos); - } - - if(IsUnknown(aType)) { - return; - } - - if(!IsClass(aType)) { - if(IsPtr(aType)) { - add_to_sig(result," *",currPos); - } -#if defined(IDL_I_HH) || defined(IDL_I_CC) - if(IsString(aType) && !IsIn(aType) && !IsConst(aType) && !IsReturnArg(i)) { - add_to_sig(result,"*&",currPos); - } else { - if(IsString(aType) || (IsReturnArg(i) && IsVoidPtr(aType))) { - add_to_sig(result," *",currPos); - } - } -#endif - } - - if(!IsReturnArg(i)) { - sprintf(buf,"temp%i",i); - add_to_sig(result,buf,currPos); - } - - return; -} - -void read_class_functions(const char* name, const char* classname, FILE* fp) -{ - int len=0; - int curlen=0; - int i, j; - int flen=0; - //int num=0; - int ret_str=0; - FILE *fin; - char buf[bs]; - char buf1[bs]; - char fname[bs]; - static char sig[bs]; - static int slen=8; -#if ! defined(IDL_I_CC) - static int clen=15; -#else - static int clen=7; -#endif - - -#if defined(IDL_I_HH) - sprintf(buf,"PARAVIS_Gen_%s_i.hh",name); -#elif defined(IDL_I_CC) - sprintf(buf,"PARAVIS_Gen_%s_i.cc",name); -#else - sprintf(buf,"PARAVIS_Gen_%s.idl",name); -#endif - if (!(fin = fopen(buf,"r"))) { - fprintf(stderr,"Error opening input file %s\n",buf); - exit(1); - } - while (fgets(sig,bs-1,fin) != 0) { -#if defined(IDL_I_CC) - if(strncmp("#include \"PARAVIS_Gen_vtk",sig,25)==0) { - fprintf(fp, "%s",sig); - } - if(strncmp("#include 1) { - ret_str=0; -#if defined(IDL_I_HH) - strcpy(sig+len,buf); - readFunctions[numberOfReadFunctions].EndPos=strlen(sig); - sscanf(sig+len,"%s %s %s",buf,buf1,fname); - if(fname[0] == '*') { - ret_str=1; - } -#elif defined(IDL_I_CC) - strcpy(buf1,buf); - sscanf(buf1,"%s %s",buf,fname); - - curlen=strlen(sig); - sprintf(sig+curlen,"%s ",buf); - j=strlen(buf)+1; - - if(fname[0] == '*') { - curlen=strlen(sig); - sprintf(sig+curlen," *"); - j+=1; - } - curlen=strlen(sig); - sprintf(sig+curlen,"%s_i::",classname); - - for(i = 0; i < strlen(fname)-1; i++) { - ret_str+=1; - j+=1; - if(fname[i] == ':' && fname[i] == ':') { - ret_str+=1; - j+=1; - break; - } - } - curlen=strlen(sig); - sprintf(sig+curlen,"%s", buf1+j); - - curlen=strlen(sig); - readFunctions[numberOfReadFunctions].EndPos=curlen; - while (fgets(sig+curlen,bs-1-curlen,fin) != 0) { - if(sig[curlen] == '}') - break; - curlen=strlen(sig); - } -#else - strcpy(sig+len,buf); - readFunctions[numberOfReadFunctions].EndPos=strlen(sig); - sscanf(sig+len,"%s _%s",buf,fname); -#endif - flen=strlen(fname); - if(flen>0) { - if(flen>2 && fname[flen-2]=='_') { - flen-=2; - } - readFunctions[numberOfReadFunctions].Name = malloc((flen+1-ret_str)*sizeof(char)); - strncpy(readFunctions[numberOfReadFunctions].Name,fname+ret_str,flen-ret_str); - readFunctions[numberOfReadFunctions].Name[flen-ret_str]='\0'; - -#if defined(IDL_I_HH) - len+=slen+strlen(buf)+1+strlen(buf1)+2+flen+ret_str-1; //spaces+virtual+space+return+space+space+*+name -#elif defined(IDL_I_CC) - len+=2+strlen(buf)+2+strlen(classname)+2+strlen(readFunctions[numberOfReadFunctions].Name)-1; //return+space+space+name - if(fname[0] == '*') { - len+=2; - } - if(fname[flen-2]=='_') { - len+=2; - } -#else - len+=slen+strlen(buf)+2+flen; //spaces+return+space+_+name -#endif - readFunctions[numberOfReadFunctions].NumPos=len; - if(fname[flen]=='_') { - readFunctions[numberOfReadFunctions].NumPos=len+2; //+_+num - } - - len=strlen(sig); - readFunctions[numberOfReadFunctions].Signature = malloc((len+1)*sizeof(char)); - strncpy(readFunctions[numberOfReadFunctions].Signature,sig,len); - readFunctions[numberOfReadFunctions].Signature[len]='\0'; - - numberOfReadFunctions++; - } - } - } - } - fclose (fin); - return; -} - -void get_signature(const char* num, ClassInfo *data) -{ - static char result[bs]; - int currPos = 0; - int currPos_sig = 0; - //int argtype; - int i, j; - static char buf[bs]; - static char buf1[bs]; - int ret = 0; - int found = 0; - int currPos_num = 0; - ValueInfo* aRetVal = NULL; - ValueInfo* aArgVal = NULL; - char *cp; - - aRetVal = currentFunction->ReturnValue; - - add_to_sig(result,"\n",&currPos); - if (currentFunction->Signature) { -#if ! defined(IDL_I_CC) - add_to_sig(result," ",&currPos); -#endif - add_to_sig(result,"//C++: ",&currPos); - add_to_sig(result,currentFunction->Signature,&currPos); - add_to_sig(result,"\n",&currPos); - } - - if(IsClass(aRetVal) && ret == 0) { - found = 0; - for(i = 0; strcmp(wrapped_classes[i],"") != 0 && found == 0; i++) { - if(strcmp(wrapped_classes[i],currentFunction->ReturnValue->Class) == 0) - found = 1; - } - if(!found) - ret = 1; - } - - for (j = 0; j < vtkWrap_CountWrappedParameters(currentFunction); j++) { - aArgVal = currentFunction->Parameters[j]; - if(IsFunction(aArgVal)) - ret == 1; - if(IsClass(aArgVal) && ret == 0) { - found = 0; - for(i = 0; strcmp(wrapped_classes[i],"") != 0 && found == 0; i++) { - if(strcmp(wrapped_classes[i],aArgVal->Class) == 0) - found = 1; - } - if(!found) - ret = 1; - } - } - - if (IsArray(aRetVal) && !IsClass(aRetVal) && !IsString(aRetVal) && currentFunction->HintSize == 0) { - ret = 1; - } - - - if(ret) { - add_to_sig(result,"//\n",&currPos); - /*currentFunction->Signature = (const char*)realloc((void*)currentFunction->Signature, - (size_t)(currPos+1));*/ - //strcpy((char*)currentFunction->Signature,result); - cp = (char *)malloc(currPos+1); - strcpy(cp, result); - currentFunction->Signature = cp; - return; - } - -#if defined(IDL_I_CC) - add_to_sig(result,"struct CreateEventName(",&currPos); - add_to_sig(result,currentFunction->Name,&currPos); - if( strlen(num)!=0 ) { - add_to_sig(result,num,&currPos); - } - add_to_sig(result,")",&currPos); - add_to_sig(result,": public SALOME_Event\n",&currPos); - add_to_sig(result,"{\n",&currPos); - if(!IsVoid(aRetVal)) { - //output_typedef(result,&currPos,MAX_ARGS,aRetVal, currentFunction->ReturnValue->Class); - add_to_sig(result," typedef ",&currPos); - if (vtkWrap_IsConst(aRetVal)) - add_to_sig(result, " const ",&currPos); - if (vtkWrap_IsObject(aRetVal)) - add_to_sig(result, " ::",&currPos); - add_to_sig(result, aRetVal->Class,&currPos); - if (vtkWrap_IsPointer(aRetVal) || vtkWrap_IsArray(aRetVal)) - add_to_sig(result, "*",&currPos); - add_to_sig(result," TResult;\n",&currPos); - add_to_sig(result," TResult myResult;\n",&currPos); - } - - //output_typedef(result, &currPos, 0, 0x309, data->Name); //!!?? - add_to_sig(result," typedef ::",&currPos); - add_to_sig(result,data->Name,&currPos); - add_to_sig(result,"* TObj;\n",&currPos); - add_to_sig(result," TObj myObj;\n",&currPos); - - for (i = 0; i < vtkWrap_CountWrappedParameters(currentFunction); i++) { - aArgVal = currentFunction->Parameters[i]; - //output_typedef(result, &currPos, i, currentFunction->ArgTypes[i], - // currentFunction->ArgClasses[i]); - output_typedef(result, &currPos, i, aArgVal, currentFunction->ArgClasses[i]); - sprintf(buf," TParam%d;\n",i); - add_to_sig(result,buf,&currPos); - sprintf(buf," TParam%d myParam%d;\n",i,i); - add_to_sig(result,buf,&currPos); - } - - add_to_sig(result,"\n",&currPos); - add_to_sig(result," CreateEventName(",&currPos); - add_to_sig(result,currentFunction->Name,&currPos); - if( strlen(num)!=0 ) { - add_to_sig(result,num,&currPos); - } - add_to_sig(result,")",&currPos); - add_to_sig(result,"(TObj theObj",&currPos); - for (i = 0; i < vtkWrap_CountWrappedParameters(currentFunction); i++) { - sprintf(buf,", TParam%d theParam%d",i,i); - add_to_sig(result,buf,&currPos); - } - add_to_sig(result,"):\n",&currPos); - add_to_sig(result," myObj(theObj)",&currPos); - for (i = 0; i < vtkWrap_CountWrappedParameters(currentFunction); i++) { - sprintf(buf,", myParam%d(theParam%d)",i,i); - add_to_sig(result,buf,&currPos); - } - add_to_sig(result,"\n",&currPos); - add_to_sig(result," { }\n",&currPos); - add_to_sig(result,"\n",&currPos); - add_to_sig(result," virtual void Execute()\n",&currPos); - add_to_sig(result," {\n",&currPos); - add_to_sig(result," ",&currPos); - if(!IsVoid(aRetVal)/* && !IsString(aRetVal)*/) { - add_to_sig(result,"myResult = ",&currPos); - } - //if(IsString(aRetVal)) { - //add_to_sig(result,"const char* ret = ",&currPos); - //} - add_to_sig(result,"myObj->",&currPos); - add_to_sig(result,currentFunction->Name,&currPos); - add_to_sig(result,"(",&currPos); - for (i = 0; i < vtkWrap_CountWrappedParameters(currentFunction); i++) { - aArgVal = currentFunction->Parameters[i]; - if(i!=0) - add_to_sig(result,", ",&currPos); - if(IsClass(aArgVal) && IsPtr(aArgVal)) { - add_to_sig(result,"*",&currPos); - } - if (IsString(aArgVal) && IsConst(aArgVal) && strcmp(aArgVal->Class, "vtkStdString") != 0) - sprintf(buf,"checkNullStr(myParam%d)",i); - else - sprintf(buf,"myParam%d",i); - add_to_sig(result,buf,&currPos); - } - add_to_sig(result,");\n",&currPos); - //if(IsString(aRetVal)) { - //add_to_sig(result," myResult = (ret==NULL)?NULL:CORBA::string_dup(\"\");\n",&currPos); - //} - add_to_sig(result," }\n",&currPos); - - add_to_sig(result,"};\n",&currPos); - add_to_sig(result,"//\n",&currPos); -#endif - currPos_sig=currPos; - -#if ! defined(IDL_I_CC) - add_to_sig(result," ",&currPos); -#endif - - output_temp(result,&currPos,MAX_ARGS,aRetVal, - currentFunction->ReturnValue->Class,0); - -#if defined(IDL_I_CC) - add_to_sig(result,data->Name,&currPos); - add_to_sig(result,"_i::",&currPos); -#endif -#if ! defined(IDL_I_HH) && ! defined(IDL_I_CC) - add_to_sig(result,"_",&currPos); -#endif - add_to_sig(result,currentFunction->Name,&currPos); - - if( strlen(num)!=0 ) { - add_to_sig(result,num,&currPos); - } - currPos_num=currPos; - add_to_sig(result," ",&currPos); - - /* print the arg list */ - add_to_sig(result,"(",&currPos); - - for (i = 0; i < vtkWrap_CountWrappedParameters(currentFunction); i++) { - aArgVal = currentFunction->Parameters[i]; - if( i != 0 ) { - add_to_sig(result,", ",&currPos); - } - /* output_temp(result, &currPos, i, currentFunction->ArgTypes[i], - (char*)currentFunction->ArgClasses[i], - currentFunction->ArgCounts[i]);*/ - output_temp(result, &currPos, i, aArgVal, aArgVal->Class, vtkWrap_CountWrappedParameters(currentFunction)); - } - - add_to_sig(result,")",&currPos); -#if defined(IDL_I_CC) - add_to_sig(result," {\n",&currPos); - add_to_sig(result," try {\n",&currPos); - for (i = 0; i < vtkWrap_CountWrappedParameters(currentFunction); i++) { - aArgVal = currentFunction->Parameters[i]; - if(IsClass(aArgVal)) { - sprintf(buf," PARAVIS_Base_i* i_temp%d = GET_SERVANT(temp%d);\n",i,i); - add_to_sig(result,buf,&currPos); - } - - if(IsArray(aArgVal) && !IsString(aArgVal) && !IsClass(aArgVal) && !IsVoid(aArgVal) ) { - sprintf(buf," CORBA::ULong j_temp%d;\n",i); - add_to_sig(result,buf,&currPos); - sprintf(buf," CORBA::ULong l_temp%d = temp%d.length();\n",i,i); - add_to_sig(result,buf,&currPos); - add_to_sig(result," ",&currPos); - - if(IsFloat(aArgVal)) - add_to_sig(result,"float",&currPos); - - if(IsDouble(aArgVal)) - add_to_sig(result,"double",&currPos); - - if(IsChar(aArgVal)) { - if (IsUnsigned(aArgVal)) - add_to_sig(result,"unsigned ",&currPos); - add_to_sig(result,"char",&currPos); - } - - if(IsvtkIdType(aArgVal)) { - if (IsUnsigned(aArgVal)) - add_to_sig(result,"unsigned ",&currPos); - add_to_sig(result,"vtkIdType",&currPos); - } else { - if(IsShortInt(aArgVal)) { - if (IsUnsigned(aArgVal)) - add_to_sig(result,"unsigned ",&currPos); - add_to_sig(result,"int",&currPos); - } - } - - if(IsLong(aArgVal)) { - if (IsUnsigned(aArgVal)) - add_to_sig(result,"unsigned ",&currPos); - add_to_sig(result,"long",&currPos); - } - sprintf(buf,"* a_temp%d = new ",i); - add_to_sig(result,buf,&currPos); - - if(IsFloat(aArgVal)) - add_to_sig(result,"float",&currPos); - - if(IsDouble(aArgVal)) - add_to_sig(result,"double",&currPos); - - if(IsChar(aArgVal)) { - if (IsUnsigned(aArgVal)) - add_to_sig(result,"unsigned ",&currPos); - add_to_sig(result,"char",&currPos); - } - - if(IsvtkIdType(aArgVal)) { - if (IsUnsigned(aArgVal)) - add_to_sig(result,"unsigned ",&currPos); - add_to_sig(result,"vtkIdType",&currPos); - } else { - if(IsShortInt(aArgVal)) { - if (IsUnsigned(aArgVal)) - add_to_sig(result,"unsigned ",&currPos); - add_to_sig(result,"int",&currPos); - } - } - - if(IsLong(aArgVal)) { - if (IsUnsigned(aArgVal)) - add_to_sig(result,"unsigned ",&currPos); - add_to_sig(result,"long",&currPos); - } - - sprintf(buf,"[l_temp%d];\n",i); - add_to_sig(result,buf,&currPos); - - sprintf(buf," for(j_temp%d=0;j_temp%d>=(v_temp%d);\n",i,i); - add_to_sig(result,buf,&currPos); - } - } - add_to_sig(result," ",&currPos); - - if(IsArray(aRetVal) && !IsClass(aRetVal) && !IsString(aRetVal)) { - add_to_sig(result,"CORBA::ULong i_ret;\n",&currPos); - add_to_sig(result," PARAVIS::",&currPos); - AddTypeArray(aRetVal,result,&currPos); - add_to_sig(result,"_var s_ret = new ",&currPos); - AddTypeArray(aRetVal,result,&currPos); - add_to_sig(result,"();\n",&currPos); - sprintf(buf," s_ret->length(%d);\n",currentFunction->HintSize); - add_to_sig(result,buf,&currPos); - add_to_sig(result," ",&currPos); - } - - if(IsArray(aRetVal) && IsUnsigned(aRetVal)) { - add_to_sig(result,"unsigned ",&currPos); - } - - if(IsFloat(aRetVal)) { - if(IsArray(aRetVal)) { - add_to_sig(result,"float* a_ret = ",&currPos); - } else { - add_to_sig(result,"CORBA::Float ret = ",&currPos); - } - } - - if(IsDouble(aRetVal)) { - if(IsArray(aRetVal)) { - add_to_sig(result,"double* a_ret = ",&currPos); - } else { - add_to_sig(result,"CORBA::Double ret = ",&currPos); - } - } - - if(IsShortInt(aRetVal)) { - if(IsArray(aRetVal)) { - if(IsvtkIdType(aRetVal)) { - add_to_sig(result,"vtkIdType",&currPos); - } else { - if(IsShort(aRetVal)) { - add_to_sig(result,"short",&currPos); - } else { - add_to_sig(result,"int",&currPos); - } - } - add_to_sig(result,"* a_ret = ",&currPos); - } else { - add_to_sig(result,"CORBA::Short ret = ",&currPos); - } - } - - if(IsLong(aRetVal)) { - if(IsArray(aRetVal)) { - add_to_sig(result,"long* a_ret = ",&currPos); - } else { - add_to_sig(result,"CORBA::Long ret = ",&currPos); - } - } - - //if(IsChar(aRetVal)) { - if(IsString(aRetVal)) { - add_to_sig(result,"char * ret = CORBA::string_dup(\"\");\n",&currPos); - add_to_sig(result," const char * cret = ",&currPos); - } else if (IsChar(aRetVal)) { //!!! vsv - add_to_sig(result,"CORBA::Char ret = ",&currPos); - } - //} - - if(IsBoolean(aRetVal)) { - add_to_sig(result,"CORBA::Boolean ret = ",&currPos); - } - - if(IsVoidPtr(aRetVal)) { - add_to_sig(result,"void * v_ret = ",&currPos); - } - - if(IsClass(aRetVal)) { - add_to_sig(result,"::",&currPos); - add_to_sig(result,currentFunction->ReturnValue->Class,&currPos); - add_to_sig(result,"* a",&currPos); - add_to_sig(result,currentFunction->ReturnValue->Class,&currPos); - add_to_sig(result," = ",&currPos); - } - if(IsVoid(aRetVal)) { - add_to_sig(result,"if(getVTKObject() != NULL) ProcessVoidEvent",&currPos); - } else { - add_to_sig(result,"(getVTKObject() != NULL) ? ProcessEvent",&currPos); - } - add_to_sig(result,"(\n",&currPos); - add_to_sig(result," new CreateEventName(",&currPos); - add_to_sig(result,currentFunction->Name,&currPos); - if( strlen(num)!=0 ) { - add_to_sig(result,num,&currPos); - } - add_to_sig(result,")",&currPos); - - add_to_sig(result,"((::",&currPos); - add_to_sig(result,data->Name,&currPos); - add_to_sig(result,"*)",&currPos); - add_to_sig(result,"getVTKObject()\n",&currPos); - - for (i = 0; i < vtkWrap_CountWrappedParameters(currentFunction); i++) { - aArgVal = currentFunction->Parameters[i]; - add_to_sig(result," , ",&currPos); - - //if(IsClass(currentFunction->ArgTypes[i]) && IsPtr(currentFunction->ArgTypes[i])) { - //add_to_sig(result,"*(",&currPos); - //} - - if(IsClass(aArgVal)) { - //sprintf(buf,"(i_temp%d != NULL)?dynamic_cast< ::%s*>(i_temp%d->getVTKObject()):NULL",i,currentFunction->ArgClasses[i],i); - sprintf(buf,"(i_temp%d != NULL)?dynamic_cast< ::%s*>(i_temp%d->getVTKObject()):NULL",i,aArgVal->Class,i); - } else { - if(IsArray(aArgVal) && !IsString(aArgVal) && !IsVoid(aArgVal)) { - sprintf(buf,"a_temp%d",i); - } else { - if(IsVoidPtr(aArgVal)) { - sprintf(buf,"(void*)v_temp%d",i); - } else { - if(IsString(aArgVal)) { - sprintf(buf,"c_temp%d",i); - } else { - sprintf(buf,"temp%d",i); - } - } - } - } - - add_to_sig(result,buf,&currPos); - //if(IsClass(currentFunction->ArgTypes[i]) && IsPtr(currentFunction->ArgTypes[i])) { - //add_to_sig(result,")",&currPos); - //} - add_to_sig(result,"\n",&currPos); - } - - add_to_sig(result," )\n",&currPos); - add_to_sig(result," )",&currPos); - if(!IsVoid(aRetVal)) { - add_to_sig(result,":",&currPos); - if(IsClass(aRetVal) || IsString(aRetVal) || IsPtr(aRetVal) || IsArray(aRetVal)) - add_to_sig(result,"NULL",&currPos); - else - add_to_sig(result,"0",&currPos); - } - add_to_sig(result,";\n",&currPos); - if(IsString(aRetVal)) { - add_to_sig(result," if(cret!=NULL) ret=CORBA::string_dup(cret);\n",&currPos); - } - - if(IsClass(aRetVal)) { - add_to_sig(result," if(a",&currPos); - add_to_sig(result,currentFunction->ReturnValue->Class,&currPos); - add_to_sig(result," == NULL) {\n",&currPos); - add_to_sig(result," return PARAVIS::",&currPos); - add_to_sig(result,currentFunction->ReturnValue->Class,&currPos); - add_to_sig(result,"::_nil();\n",&currPos); - add_to_sig(result," }\n",&currPos); - add_to_sig(result," ",&currPos); - add_to_sig(result,"PARAVIS_Base_i* aPtr = ::CreateInstance(a",&currPos); - add_to_sig(result,currentFunction->ReturnValue->Class,&currPos); - add_to_sig(result,", a",&currPos); - add_to_sig(result,currentFunction->ReturnValue->Class,&currPos); - add_to_sig(result,"->GetClassName());\n",&currPos); - add_to_sig(result," aPtr->Init(a",&currPos); - add_to_sig(result,currentFunction->ReturnValue->Class,&currPos); - add_to_sig(result,");\n",&currPos); - } - - for (i = 0; i < vtkWrap_CountWrappedParameters(currentFunction); i++) { - aArgVal = currentFunction->Parameters[i]; - if(IsArray(aArgVal) && !IsVoid(aArgVal) && !IsString(aArgVal) && !IsClass(aArgVal)) { - if (!IsIn(aArgVal)) { - sprintf(buf," for(j_temp%d=0;j_temp%d_this();\n",&currPos); - } else { - if(IsVoid(aRetVal)) { - add_to_sig(result," CORBA::Any* ret = new CORBA::Any;\n",&currPos); - add_to_sig(result," (*ret) <<= v_ret;\n",&currPos); - add_to_sig(result," return ret;\n",&currPos); - } else { - if(IsArray(aRetVal) && !IsString(aRetVal)) { - sprintf(buf," for(i_ret=0; i_ret<%d; i_ret++) {\n",currentFunction->HintSize); - add_to_sig(result,buf,&currPos); - add_to_sig(result," s_ret[i_ret]=a_ret[i_ret];\n",&currPos); - add_to_sig(result," }\n",&currPos); - add_to_sig(result," return s_ret._retn();\n",&currPos); - } else { - add_to_sig(result," return ret;\n",&currPos); - } - } - } - } - - add_to_sig(result," } catch(...) {\n",&currPos); - add_to_sig(result," MESSAGE(\"",&currPos); - //add_to_sig(result,data->ClassName,&currPos); - //add_to_sig(result,"::",&currPos); - add_to_sig(result,currentFunction->Name,&currPos); - add_to_sig(result," - Unknown exception was occured!!!\");\n",&currPos); - - if (IsVoid(aRetVal)&& !IsVoidPtr(aRetVal)) { - add_to_sig(result," return;\n",&currPos); - } else{ - if(IsString(aRetVal)) { - add_to_sig(result," return CORBA::string_dup(\"\");\n",&currPos); - } else { - if(IsClass(aRetVal)) { - add_to_sig(result," return PARAVIS::",&currPos); - add_to_sig(result,currentFunction->ReturnValue->Class,&currPos); - add_to_sig(result,"::_nil();\n",&currPos); - } else { - if(IsArray(aRetVal) && !IsVoid(aRetVal)) { - add_to_sig(result," PARAVIS::",&currPos); - AddTypeArray(aRetVal,result,&currPos); - add_to_sig(result,"_var s_ret = new ",&currPos); - AddTypeArray(aRetVal,result,&currPos); - add_to_sig(result,"();\n",&currPos); - sprintf(buf," s_ret->length(%d);\n",currentFunction->HintSize); - add_to_sig(result,buf,&currPos); - add_to_sig(result," return s_ret._retn();\n",&currPos); - } else { - add_to_sig(result," return 0;\n",&currPos); - } - } - } - } - - add_to_sig(result," }\n",&currPos); - add_to_sig(result,"}\n",&currPos); -#else - add_to_sig(result,";\n",&currPos); -#endif - - if(ret) - { - result[currPos_sig]='\0'; - /*currentFunction->Signature = (const char*)realloc((void*)currentFunction->Signature, - (size_t)(currPos_sig+1));*/ - cp = (char *)malloc(currPos_sig+1); - strcpy(cp, result); - currentFunction->Signature = cp; - //strcpy((char*)currentFunction->Signature,result); - - return; - } - - //if(strcmp(currentFunction->Name,"NewInstance") == 0) { - //currentFunction->Signature[0]='\0'; - //return; - //} - - for(i = 0; i < numberOfReadFunctions; i++) { - if(strcmp(readFunctions[i].Name,currentFunction->Name) == 0) { - j=readFunctions[i].EndPos-readFunctions[i].NumPos; - strncpy(buf,result+currPos_num,j); - strncpy(buf1,readFunctions[i].Signature+readFunctions[i].NumPos,j); - buf[j]=0; - buf1[j]=0; - if(strcmp(buf,buf1) == 0) { - //((char*)currentFunction->Signature)[0]='\0'; - currentFunction->Signature = EmptyString; - return; - } - } - } - /*currentFunction->Signature = (const char*)realloc((void*)currentFunction->Signature, - (size_t)(currPos+1));*/ - //strcpy((char*)currentFunction->Signature, result); - cp = (char *)malloc(currPos+1); - strcpy(cp, result); - currentFunction->Signature = cp; -} - -void outputFunction2(FILE *fp, ClassInfo *data) -{ - int i, j, k, is_vtkobject, fnum, backnum;//, is_static, occ, goto_used; - //int all_legacy; - FunctionInfo *theFunc; - FunctionInfo *backFunc; - const char *theName; - unsigned int theType; - const char *backName; - int backType; - char static num[8]; - //int isSMObject = 0; - int found = 0; - ValueInfo* aArgVal = 0; - ValueInfo* aBackArgVal = 0; - - -#if defined(IDL_I_HH) - fprintf(fp,"#include \"SALOMEconfig.h\"\n"); - fprintf(fp,"#include CORBA_SERVER_HEADER(PARAVIS_Gen_%s)\n",data->Name); - fprintf(fp,"\n"); - fprintf(fp,"#include \"SALOME_GenericObj_i.hh\"\n"); - fprintf(fp,"#include \"PARAVIS_Gen_i.hh\"\n"); - fprintf(fp,"#include \"PARAVIS_Gen_Types.hh\"\n"); - fprintf(fp,"#include \"vtkSmartPointer.h\"\n"); - fprintf(fp,"#include \"SALOME_Event.h\"\n"); - - for(i=0;iNumberOfSuperClasses;i++) - { - fprintf(fp,"#include \"PARAVIS_Gen_%s_i.hh\"\n",data->SuperClasses[i]); - } - - //RNV: to avoid link error on windows via Visual Studio - //undef GetObject macro. - if( strcmp(data->Name, "vtkWebGLExporter") == 0 ) { - fprintf(fp,"#ifdef WIN32\n"); - fprintf(fp," #ifdef GetObject\n"); - fprintf(fp," #undef GetObject\n"); - fprintf(fp," #endif\n"); - fprintf(fp,"#endif\n"); - } - - fprintf(fp,"\nclass %s;\n",data->Name); - fprintf(fp,"\nnamespace PARAVIS\n{\n\n"); -#elif defined(IDL_I_CC) - fprintf(fp,"#include \"SALOME_GenericObj_i.hh\"\n"); - fprintf(fp,"#include \"PARAVIS_Gen_%s_i.hh\"\n",data->Name); - fprintf(fp,"#include \"PV_Tools.h\"\n"); - fprintf(fp,"#include \"SALOME_Event.h\"\n"); - fprintf(fp,"#include <%s.h>\n",data->Name); -#else - fprintf(fp,"#include \"PARAVIS_Gen.idl\"\n"); - fprintf(fp,"#include \"PARAVIS_Gen_Types.idl\"\n"); - - for(i=0;iNumberOfSuperClasses;i++) - { - fprintf(fp,"#include \"PARAVIS_Gen_%s.idl\"\n",data->SuperClasses[i]); - } - - fprintf(fp,"\nmodule PARAVIS\n{\n\n"); -#endif - - is_vtkobject = ((strcmp(data->Name,"vtkObjectBase") == 0) || - (data->NumberOfSuperClasses != 0)); - - for(i = 0; i < data->NumberOfSuperClasses; i++) { - read_class_functions(data->SuperClasses[i],data->Name,fp); - } - - /* create a idl signature for each method */ - for (fnum = 0; fnum < numberOfWrappedFunctions; fnum++) - { - theFunc = wrappedFunctions[fnum]; - currentFunction = theFunc; - //printf("#### %i)Function %s\n", fnum, theFunc->Name); - - /* names of idl methods should be unique */ - num[0]='\0'; - j=-1; - for (i = 0; i < numberOfReadFunctions; i++) { - if(strcmp(currentFunction->Name,readFunctions[i].Name) == 0) - j++; - } - for (i = 0; i < fnum; i++) - { - if( strcmp(currentFunction->Name,wrappedFunctions[i]->Name) == 0 ) - j++; - } - - if(j<0) { - for (i = fnum+1; i < numberOfWrappedFunctions; i++) { - if( strcmp(currentFunction->Name,wrappedFunctions[i]->Name) == 0 ) { - j=0; - break; - } - } - } else { - j++; - } - - if(j>=0) - { - sprintf(num,"_%d",j); - } - get_signature(num,data); - } - /* create external type declarations for all object - return types */ - for (fnum = 0; fnum < numberOfWrappedFunctions; fnum++) - { - theFunc = wrappedFunctions[fnum]; - currentFunction = theFunc; - theName = NULL; - theType = 0; - - for (i = vtkWrap_CountWrappedParameters(theFunc); i >= 0; i--) - { - if (i==0)/* return type */ - { - aArgVal = theFunc->ReturnValue; - //theType = theFunc->ReturnType; - //theName = (char*)theFunc->ReturnClass; - } - else /* arg type */ - { - aArgVal = theFunc->Parameters[i-1]; - //theType = theFunc->ArgTypes[i-1]; - //theName = (char*)theFunc->ArgClasses[i-1]; - } - theType = aArgVal->Type & VTK_PARSE_BASE_TYPE; - theName = aArgVal->Class; - /* check for object types */ - /*if ((theType & VTK_PARSE_BASE_TYPE == 0x309)|| - (theType & VTK_PARSE_BASE_TYPE == 0x109))*/ - if ((theType == VTK_PARSE_OBJECT) || (theType == VTK_PARSE_OBJECT_REF)) - { - /* check that we haven't done this type (no duplicate declarations) */ - for (backnum = fnum; backnum >= 0; backnum--) - { - backFunc = wrappedFunctions[backnum]; - backName = NULL; - backType = 0; - if (backnum == fnum) - k = i+1; - else - k = 0; - for (j = vtkWrap_CountWrappedParameters(backFunc); j >= k; j--) - { - if (j==0) /* return type */ - { - aBackArgVal = backFunc->ReturnValue; - //backType = backFunc->ReturnType; - //backName = (char*)backFunc->ReturnClass; - } - else /* arg type */ - { - aBackArgVal = backFunc->Parameters[j-1]; - //backType = backFunc->ArgTypes[j-1]; - //backName = (char*)backFunc->ArgClasses[j-1]; - } - backType = aBackArgVal->Type & VTK_PARSE_BASE_TYPE; - backName = aBackArgVal->Class; - /*if (((backType % VTK_PARSE_BASE_TYPE == 0x309)|| - (backType % VTK_PARSE_BASE_TYPE == 0x109)))*/ - if ((backType == VTK_PARSE_OBJECT) || (backType == VTK_PARSE_OBJECT_REF)) - { - if(strcmp(theName,backName) == 0) - { - break; - } - } - } - if (j >= k) - { - break; - } - } - if (backnum < 0 && strcmp(data->Name,theName) != 0) - { - found = 0; - for(j = 0; strcmp(wrapped_classes[j],"") != 0 && found == 0; j++) - { - if(strcmp(wrapped_classes[j],theName) == 0) - found = 1; - } - if(found) - { -#if defined(IDL_I_HH) - fprintf(fp," class %s_i;\n",theName); -#elif defined(IDL_I_CC) - fprintf(fp,"#include \"PARAVIS_Gen_%s_i.hh\"\n",theName); - fprintf(fp,"#include <%s.h>\n",theName); -#else - //fprintf(fp,"#include \"PARAVIS_Gen_%s.idl\"\n",theName); - fprintf(fp," interface %s;\n",theName); -#endif - } - } - } - } - } - - //fprintf(fp,"\nmodule PARAVIS\n{\n"); -#if defined(IDL_I_HH) - fprintf(fp,"\n class %s_i : public virtual POA_PARAVIS::%s, public virtual PARAVIS::PARAVIS_Base_i",data->Name,data->Name); - //for(i = 0; i < data->NumberOfSuperClasses; i++) { - // fprintf(fp,", public virtual %s_i",data->SuperClasses[i]); - //} - //fprintf(fp,", public virtual SALOME::GenericObj_i"); - fprintf(fp," {"); - fprintf(fp,"\n public:\n"); - fprintf(fp,"\n %s_i();\n",data->Name); - if(strcmp(data->Name,"vtkSMSessionProxyManager") != 0) { - fprintf(fp,"\n ::vtkObjectBase* GetNew();\n"); - } - -#elif defined(IDL_I_CC) - fprintf(fp,"extern PARAVIS::PARAVIS_Base_i* CreateInstance(::vtkObjectBase* Inst, const QString&);\n"); - fprintf(fp,"\nnamespace PARAVIS\n{\n"); - fprintf(fp,"typedef %s_i current_interface;\n",data->Name); - fprintf(fp,"#define CreateEventName(Function) Event%s ##Function\n",data->Name); - fprintf(fp,"%s_i::%s_i() {\n",data->Name,data->Name); - //fprintf(fp," Init(::%s::New());\n",data->Name); - fprintf(fp,"}\n"); - fprintf(fp,"\n"); - - if(strcmp(data->Name,"vtkSMSessionProxyManager") != 0) { - fprintf(fp,"::vtkObjectBase* %s_i::GetNew() {\n", data->Name); - if(strcmp(data->Name,"vtkSMProxyManager") == 0) { - fprintf(fp," return ::%s::GetProxyManager();\n",data->Name); - } else { - fprintf(fp," return ::%s::New();\n",data->Name); - } - fprintf(fp,"}\n"); - } -#else - fprintf(fp,"\n interface %s : PARAVIS_Base",data->Name); - fprintf(fp,"\n {\n"); -#endif - - for(i = 0; i < numberOfReadFunctions; i++) { - fprintf(fp, "%s\n", readFunctions[i].Signature); - } - - for (fnum = 0; fnum < numberOfWrappedFunctions; fnum++) { - fprintf(fp,"%s\n",wrappedFunctions[fnum]->Signature); - } - -#if defined(IDL_I_HH) - fprintf(fp," };\n"); - fprintf(fp,"}\n"); -#elif defined(IDL_I_CC) - fprintf(fp,"};\n"); -#else - fprintf(fp," };\n"); - fprintf(fp,"};\n"); -#endif - - return; -} - -void outputFunction(FILE *fp, ClassInfo *data) -{ - int i; - //int args_ok = 1; - ValueInfo* aRetVal = NULL;//currentFunction->ReturnValue; - ValueInfo* aArgVal = NULL; - unsigned int aType; - unsigned int argtype; - - fp = fp; - /* some functions will not get wrapped no matter what else, - and some really common functions will appear only in vtkObjectPython */ - if (currentFunction->IsOperator || - currentFunction->ArrayFailure || - !currentFunction->IsPublic || - !currentFunction->Name) - { - return; - } - //printf("#### Check %s\n", currentFunction->Name); - - /* check to see if we can handle the args */ - for (i = 0; i < vtkWrap_CountWrappedParameters(currentFunction); i++) - { - aArgVal = currentFunction->Parameters[i]; - /*printf(" Argument: %s ", vtkWrap_GetTypeName(aArgVal)); - if (vtkWrap_IsArray(aArgVal)) { - printf("!!!! Argument %i is array\n", i); - return; - }*/ - if (vtkWrap_IsStream(aArgVal)) { - //printf("!!!! Argument %i is stream\n", i); - return; - } - if (IsPtr(aArgVal)) { - //printf("!!!! Argument %i is pointer value\n", i); - return; - } - if (IsUnknown(aArgVal)) { - //printf("!!!! Argument %i is unknown value\n", i); - return; - } - if (vtkWrap_IsVoidPointer(aArgVal)) { - //printf("!!!! Argument %i is void pointer\n", i); - return; - } - if (vtkWrap_IsVoidFunction(aArgVal)) { - //printf("!!!! Argument %i is void function\n", i); - return; - } - argtype = (aArgVal->Type & VTK_PARSE_INDIRECT); - if (argtype == VTK_PARSE_POINTER_POINTER){ - //printf("!!!! Argument %i is pointer to pointer\n", i); - return; - } - if (vtkWrap_IsNonConstRef(aArgVal)) { - //printf("!!!! Argument %i is non const ref\n", i); - return; - } - if (vtkWrap_IsSpecialObject(aArgVal)) { - //printf("!!!! Argument %i is special object\n", i); - return; - } - /*if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 9) args_ok = 0; - if ((currentFunction->ArgTypes[i] % 0x10) == 8) args_ok = 0; - if (((currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE)/0x100 != 0x3)&& - (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE != 0x109)&& - ((currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE)/0x100)) args_ok = 0; - if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x313) args_ok = 0; - if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x314) args_ok = 0; - if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x31A) args_ok = 0; - if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x31B) args_ok = 0; - if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x31C) args_ok = 0; - if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x315) args_ok = 0; - if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x316) args_ok = 0;*/ - } - aRetVal = currentFunction->ReturnValue; - if (aRetVal) { - //printf("#### Return type: %s\n", vtkWrap_GetTypeName(aRetVal)); - aType = aRetVal->Type & VTK_PARSE_BASE_TYPE; - if (IsPtr(aRetVal)) { - //printf("!!!! Return Value is pointer\n"); - return; - } - /* eliminate unsigned char * and unsigned short * */ - argtype = (aRetVal->Type & VTK_PARSE_UNQUALIFIED_TYPE); - if ((argtype == VTK_PARSE_UNSIGNED_CHAR_PTR) || (argtype == VTK_PARSE_UNSIGNED_SHORT)) { - //printf("!!!! Return Value is unsigned char or short\n"); - return; - } - - if ((aType == VTK_PARSE_UNKNOWN)) { - //printf("!!!! Return Value is unknown\n"); - return; - } - argtype = (aRetVal->Type & VTK_PARSE_INDIRECT); - if (argtype == VTK_PARSE_POINTER_POINTER){ - //printf("!!!! Return value is pointer to pointer\n", i); - return; - } - if (vtkWrap_IsSpecialObject(aRetVal)) { - //printf("!!!! Return is special object\n", i); - return; - } - } - /*if ((aRetVal % 0x10) == 0x8) args_ok = 0; - if (aRetVal % VTK_PARSE_BASE_TYPE == 0x9) args_ok = 0; - if (((aRetVal % VTK_PARSE_BASE_TYPE)/0x100 != 0x3)&& - (aRetVal % VTK_PARSE_BASE_TYPE != 0x109)&& - ((aRetVal % VTK_PARSE_BASE_TYPE)/0x100)) args_ok = 0; - */ - - /*if (aRetVal % VTK_PARSE_BASE_TYPE == 0x313) args_ok = 0; - if (aRetVal % VTK_PARSE_BASE_TYPE == 0x314) args_ok = 0; - if (aRetVal % VTK_PARSE_BASE_TYPE == 0x31A) args_ok = 0; - if (aRetVal % VTK_PARSE_BASE_TYPE == 0x31B) args_ok = 0; - if (aRetVal % VTK_PARSE_BASE_TYPE == 0x31C) args_ok = 0; - if (aRetVal % VTK_PARSE_BASE_TYPE == 0x315) args_ok = 0; - if (aRetVal % VTK_PARSE_BASE_TYPE == 0x316) args_ok = 0; - - - if (vtkWrap_CountWrappedParameters(currentFunction) && - (currentFunction->ArgTypes[0] == 0x5000) - &&(vtkWrap_CountWrappedParameters(currentFunction) != 0x1)) args_ok = 0;*/ - - /* make sure we have all the info we need for array arguments in */ - /*for (i = 0; i < vtkWrap_CountWrappedParameters(currentFunction); i++) - { - if (((currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE)/0x100 == 0x3)&& - (currentFunction->ArgCounts[i] <= 0)&& - (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE != 0x309)&& - (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE != 0x303)&& - (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE != 0x302)) args_ok = 0; - }*/ - - /* if we need a return type hint make sure we have one */ - //switch (aRetVal % VTK_PARSE_BASE_TYPE) - /*switch (aRetVal->Type % VTK_PARSE_BASE_TYPE) - { - case 0x301: case 0x307: case 0x30A: case 0x30B: case 0x30C: case 0x30D: case 0x30E: - case 0x304: case 0x305: case 0x306: - args_ok = currentFunction->HaveHint; - break; - }*/ - - /* make sure it isn't a Delete or New function */ - if (!strcmp("Delete",currentFunction->Name) || - !strcmp("New",currentFunction->Name)) - { - return; - } - - if (vtkWrap_IsDestructor(data, currentFunction) || vtkWrap_IsConstructor(data, currentFunction)) { - //printf("!!!! Return Value is constructor or destructor\n"); - return; - } - - /* check for New() function */ - if (!strcmp("New",currentFunction->Name) && vtkWrap_CountWrappedParameters(currentFunction) == 0) - { - class_has_new = 1; - } - - if (currentFunction->IsPublic && //args_ok && - strcmp(data->Name,currentFunction->Name) && - strcmp(data->Name, currentFunction->Name + 1)) - { - //printf("#### %i Function %s\n", numberOfWrappedFunctions, currentFunction->Name); - wrappedFunctions[numberOfWrappedFunctions] = currentFunction; - numberOfWrappedFunctions++; - } - - return; -} - -/* print the parsed structures */ -int main(int argc, char *argv[]) -{ - OptionInfo *options; - FileInfo *file_info; - ClassInfo *data; - FILE *fp; - int i; - - /* get command-line args and parse the header file */ - file_info = vtkParse_Main(argc, argv); - - /* get the command-line options */ - options = vtkParse_GetCommandLineOptions(); - - /* get the output file */ - fp = fopen(options->OutputFileName, "w"); - - if (!fp) - { - fprintf(stderr, "Error opening output file %s\n", options->OutputFileName); - exit(1); - } - - /* get the main class */ - if ((data = file_info->MainClass) == NULL) - { - fclose(fp); - exit(0); - } - - /* get the hierarchy info for accurate typing */ - if (options->HierarchyFileName) - { - hierarchyInfo = vtkParseHierarchy_ReadFile(options->HierarchyFileName); - } - -#if defined(IDL_I_HH) - fprintf(fp, "// idl wrapper interface for %s object implementation\n//\n", data->Name); -#elif defined(IDL_I_CC) - fprintf(fp, "// idl wrapper implementation for %s object\n//\n", data->Name); -#else - fprintf(fp, "// idl wrapper for %s object\n//\n", data->Name); -#endif - for (i = 0;1;i++) - { - if(strlen(Copyright[i]) != 0) - { - fprintf(fp,"%s\n",Copyright[i]); - } - else - { - break; - } - } - fprintf(fp,"\n"); -#if defined(IDL_I_HH) - fprintf(fp,"#ifndef PARAVIS_Gen_%s_i_HeaderFile\n",data->Name); - fprintf(fp,"#define PARAVIS_Gen_%s_i_HeaderFile\n",data->Name); - fprintf(fp,"\n"); -#elif defined(IDL_I_CC) -#else - fprintf(fp,"#ifndef __PARAVIS_Gen_%s__\n",data->Name); - fprintf(fp,"#define __PARAVIS_Gen_%s__\n",data->Name); - fprintf(fp,"\n"); -#endif - - /* insert function handling code here */ - for (i = 0; i < data->NumberOfFunctions; i++) - { - currentFunction = data->Functions[i]; -#ifdef VTK_LEGACY_REMOVE - if(currentFunction->IsLegacy) - continue; -#endif - outputFunction(fp, data); - } - //printf("#### NbFunctions %i\n", numberOfWrappedFunctions); - //if (data->NumberOfSuperClasses || (!data->IsAbstract)) - //if (numberOfWrappedFunctions) - // { - outputFunction2(fp, data); - // } - -#if defined(IDL_I_HH) - fprintf(fp,"\n#endif\n"); -#elif defined(IDL_I_CC) -#else - fprintf(fp,"\n#endif\n"); -#endif - - vtkParse_Free(file_info); - - return 0; -} diff --git a/idl/wrap.cmake b/idl/wrap.cmake deleted file mode 100755 index a5e9868b..00000000 --- a/idl/wrap.cmake +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -LIST(GET PARAVIEW_INCLUDE_DIRS 0 PARAVIEW_INCLUDE_DIR0) - -ADD_CUSTOM_COMMAND( - OUTPUT vtkWrapIDL.h - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/create_header.py ${CMAKE_BINARY_DIR} - DEPENDS ${CMAKE_BINARY_DIR}/wrapfiles.txt -) - -ADD_CUSTOM_COMMAND( - OUTPUT hints - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/create_hints.py ${PARAVIEW_LIBRARY_DIR0} -# DEPENDS ${PARAVIEW_LIBRARY_DIR0}/hints ${CMAKE_CURRENT_SOURCE_DIR}/hints_paravis - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/hints ${CMAKE_CURRENT_SOURCE_DIR}/hints_paravis -) - -SET(WRAP_IDL) -#SET(WRAP_SK_FILES) - -IF(EXISTS ${CMAKE_BINARY_DIR}/wrapfiles.txt) - EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c "f = open('${CMAKE_BINARY_DIR}/wrapfiles.txt') ; print f.read(), ; f.close()" - OUTPUT_VARIABLE WRAP_LIST_FULL - ) - - STRING(REGEX MATCHALL "[^\n]+" WRAP_LIST_REG ${WRAP_LIST_FULL}) - FOREACH(STR ${WRAP_LIST_REG}) - - SEPARATE_ARGUMENTS(STR) - LIST(LENGTH STR WRAP_LEN) - SET(DEP) - - LIST(GET STR 0 VAL) - - IF(WRAP_LEN GREATER 1) - MATH(EXPR WRAP_LEN1 "${WRAP_LEN} - 1" ) - - FOREACH(IND RANGE 1 ${WRAP_LEN1}) - LIST(GET STR ${IND} DEP_VAL) - SET(DEP ${DEP} PARAVIS_Gen_${DEP_VAL}.idl) - ENDFOREACH(IND RANGE 1 ${WRAP_LEN1}) - - ENDIF(WRAP_LEN GREATER 1) - - LIST(APPEND WRAP_IDL PARAVIS_Gen_${VAL}.idl) - #SET(WRAP_SK_FILES ${WRAP_SK_FILES} PARAVIS_Gen_${VAL}SK.cc) - SET(vtkWrapIDL_EXEFILE ${PROJECT_BINARY_DIR}/src/VTKWrapping/vtkWrapIDL) - IF(WIN32) - IF(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(vtkWrapIDL_EXEFILE ${PROJECT_BINARY_DIR}/src/VTKWrapping/vtkWrapIDL.exe) - ELSE(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(vtkWrapIDL_EXEFILE ${PROJECT_BINARY_DIR}/src/VTKWrapping/${CMAKE_BUILD_TYPE}/vtkWrapIDL.exe) - ENDIF(CMAKE_BUILD_TOOL STREQUAL nmake) - ENDIF(WIN32) - ADD_CUSTOM_COMMAND( - OUTPUT PARAVIS_Gen_${VAL}.idl - COMMAND ${vtkWrapIDL_EXEFILE} -o PARAVIS_Gen_${VAL}.idl --hints hints ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h - DEPENDS vtkWrapIDL ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h hints ${DEP} - ) - - ENDFOREACH(STR ${WRAP_LIST_REG}) -ENDIF(EXISTS ${CMAKE_BINARY_DIR}/wrapfiles.txt) - -ADD_CUSTOM_TARGET(generate_txt DEPENDS ${CMAKE_BINARY_DIR}/wrapfiles.txt vtkWrapIDL.h hints) -ADD_CUSTOM_TARGET(generate_idl ALL DEPENDS ${CMAKE_BINARY_DIR}/wrapfiles.txt vtkWrapIDL.h hints ${WRAP_IDL}) - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aed9591f..ee27c9a2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,10 +27,6 @@ IF(NOT SALOME_LIGHT_ONLY) ENGINE PVGUI ) - IF(NOT SALOME_PARAVIS_MINIMAL_CORBA) - # Append in first position - LIST(INSERT _subdirs 0 VTKWrapping) - ENDIF() ENDIF(NOT SALOME_LIGHT_ONLY) IF(SALOME_PARAVIS_BUILD_PLUGINS) @@ -41,6 +37,3 @@ FOREACH(dir ${_subdirs}) ADD_SUBDIRECTORY(${dir}) ENDFOREACH() -SET(WRAP_IDL_I_HH "${WRAP_IDL_I_HH}" PARENT_SCOPE) -SET(WRAP_IDL_I_CC "${WRAP_IDL_I_CC}" PARENT_SCOPE) - diff --git a/src/ENGINE/CMakeLists.txt b/src/ENGINE/CMakeLists.txt index d47e955e..d8914e2b 100644 --- a/src/ENGINE/CMakeLists.txt +++ b/src/ENGINE/CMakeLists.txt @@ -17,27 +17,11 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -IF(NOT SALOME_PARAVIS_MINIMAL_CORBA) - INCLUDE_DIRECTORIES( - ${OMNIORB_INCLUDE_DIR} - ${KERNEL_INCLUDE_DIRS} - ${PROJECT_BINARY_DIR}/idl) - - ADD_DEFINITIONS(${KERNEL_DEFINITIONS}) - ADD_DEFINITIONS(${OMNIORB_DEFINITIONS}) - - ADD_LIBRARY(PARAVISEngine PARAVIS_Engine_i.cc) - - TARGET_LINK_LIBRARIES(PARAVISEngine - ${KERNEL_SalomeIDLKernel} ${KERNEL_SalomeNS} ${KERNEL_SalomeContainer} ${KERNEL_SALOMELocalTrace} - ${OMNIORB_LIBRARIES} - SalomeIDLPARAVIS) - INSTALL(TARGETS PARAVISEngine) # doesn't need to be exported - - INSTALL(FILES PARAVIS_Engine_i.hh DESTINATION ${SALOME_INSTALL_HEADERS}) -ELSE() - SET(_bin_SCRIPTS no_wrap/PVSERVER.py no_wrap/PVSERVER_utils.py) - # --- rules --- - SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON}) -ENDIF() +SET(_bin_SCRIPTS + PVSERVER.py + PVSERVER_utils.py + ) +# --- rules --- +SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON}) + \ No newline at end of file diff --git a/src/ENGINE/PARAVIS_Engine_i.cc b/src/ENGINE/PARAVIS_Engine_i.cc deleted file mode 100644 index 6d9bce45..00000000 --- a/src/ENGINE/PARAVIS_Engine_i.cc +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "PARAVIS_Engine_i.hh" -#include "utilities.h" - - -#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) - -#include "SALOME_NamingService.hxx" -#include "Utils_ExceptHandlers.hxx" - -using namespace std; - -#ifdef _DEBUG_ -static int MYDEBUG = 1; -#else -static int MYDEBUG = 0; -#endif - -#ifdef WNT -#if defined PARAVIS_ENGINE_EXPORTS || defined PARAVISEngine_EXPORTS -#define PARAVIS_ENGINE_EXPORT __declspec(dllexport) -#else -#define PARAVIS_ENGINE_EXPORT __declspec(dllimport) -#endif -#else -#define PARAVIS_ENGINE_EXPORT -#endif - -UNEXPECT_CATCH(SalomeException, SALOME::SALOME_Exception); - -extern "C" { -PARAVIS_ENGINE_EXPORT PortableServer::ObjectId* PARAVISEngine_factory(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName) -{ - MESSAGE("PARAVISEngine_factory : "<getId() ; -} -} - -namespace PARAVIS { - //=========================================================================== - PARAVIS_Gen_i::PARAVIS_Gen_i(SALOME::Session_ptr session, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName) : - Engines_Component_i(orb, poa, contId, instanceName, interfaceName) - { - _thisObj = this ; - _id = _poa->activate_object(_thisObj); -#ifndef WIN32 - Engines::EngineComponent_var aComponent = session->GetComponent("libPARAVIS.so"); -#else - Engines::EngineComponent_var aComponent = session->GetComponent("PARAVIS.dll"); -#endif - if (CORBA::is_nil(aComponent)) { - MESSAGE("Component PARAVIS is null"); - return; - } - myParaVisGen = PARAVIS::PARAVIS_Gen::_narrow(aComponent); - } - - //=========================================================================== - PARAVIS_Gen_i::~PARAVIS_Gen_i() - { - if(MYDEBUG) MESSAGE("PARAVIS_Gen_i::~PARAVIS_Gen_i"); - } - - - //=========================================================================== - char* PARAVIS_Gen_i::GetIOR(){ - return myParaVisGen->GetIOR(); - } - - //=========================================================================== - bool PARAVIS_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile & theStream, - const char* theURL, - bool isMultiFile) - { - return myParaVisGen->Load(theComponent,theStream,theURL,isMultiFile); - } - - //=========================================================================== - bool PARAVIS_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile & theStream, - const char* theURL, - bool isMultiFile) - { - return Load(theComponent, theStream, theURL, isMultiFile); - } - - - //=========================================================================== - char* PARAVIS_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, - const char* aLocalPersistentID, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII) - { - return myParaVisGen->LocalPersistentIDToIOR(theSObject, aLocalPersistentID, isMultiFile, isASCII); - } - - //=========================================================================== - SALOMEDS::TMPFile* PARAVIS_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool isMultiFile) - { - return myParaVisGen->Save(theComponent,theURL,isMultiFile); - } - - //=========================================================================== - SALOMEDS::TMPFile* PARAVIS_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool isMultiFile) - { - return myParaVisGen->Save(theComponent,theURL,isMultiFile); - } - - - //=========================================================================== - char* PARAVIS_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, - const char* IORString, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII) - { - return myParaVisGen->IORToLocalPersistentID(theSObject, IORString, isMultiFile, isASCII); - } - - //=========================================================================== - void PARAVIS_Gen_i::ImportFile(const char* theFileName) - { - if (CORBA::is_nil(myParaVisGen)) { - MESSAGE("PARAVIS_Gen_i is null"); - return; - } - myParaVisGen->ImportFile(theFileName); - } - - void PARAVIS_Gen_i::ExecuteScript(const char* script) - { - if (CORBA::is_nil(myParaVisGen)) { - MESSAGE("PARAVIS_Gen_i is null"); - return; - } - myParaVisGen->ExecuteScript(script); - } - - //=========================================================================== - char* PARAVIS_Gen_i::GetTrace() - { - if (CORBA::is_nil(myParaVisGen)) { - MESSAGE("PARAVIS_Gen_i is null"); - return CORBA::string_dup(""); - } - return CORBA::string_dup(myParaVisGen->GetTrace()); - } - - //=========================================================================== - void PARAVIS_Gen_i::SaveTrace(const char* theFileName) - { - if (CORBA::is_nil(myParaVisGen)) { - MESSAGE("PARAVIS_Gen_i is null"); - return ; - } - myParaVisGen->SaveTrace(theFileName); - } - - //=========================================================================== - void PARAVIS_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent) - { - myParaVisGen->Close(theComponent); - } - - - //=========================================================================== - char* PARAVIS_Gen_i::ComponentDataType() - { - return CORBA::string_dup("PARAVIS"); - } - - //=========================================================================== - CORBA::Boolean PARAVIS_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) - { - return myParaVisGen->CanPublishInStudy(theIOR); - } - - - //=========================================================================== - SALOMEDS::SObject_ptr PARAVIS_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theObject, - const char* theName) - throw (SALOME::SALOME_Exception) - { - return myParaVisGen->PublishInStudy(theStudy, theSObject, theObject, theName); - } - - //=========================================================================== - CORBA::Boolean PARAVIS_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) - { - return myParaVisGen->CanCopy(theObject); - } - - - //=========================================================================== - SALOMEDS::TMPFile* PARAVIS_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) - { - return myParaVisGen->CopyFrom(theObject, theObjectID); - } - - - //=========================================================================== - CORBA::Boolean PARAVIS_Gen_i::CanPaste(const char* theComponentName, CORBA::Long theObjectID) - { - return myParaVisGen->CanPaste(theComponentName, theObjectID); - } - - //=========================================================================== - SALOMEDS::SObject_ptr PARAVIS_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, - CORBA::Long theObjectID, - SALOMEDS::SObject_ptr theObject) - { - return myParaVisGen->PasteInto(theStream,theObjectID,theObject); - } - -#ifdef PARAVIS_WITH_FULL_CORBA - //=========================================================================== - PARAVIS::string_array* PARAVIS_Gen_i::GetClassesList() - { - return myParaVisGen->GetClassesList(); - } - - //=========================================================================== - PARAVIS_Base_ptr PARAVIS_Gen_i::CreateClass(const char* theClassName) - { - return myParaVisGen->CreateClass(theClassName); - } -#endif - - //=========================================================================== - void PARAVIS_Gen_i::GetConnectionParameters(CORBA::Long& theId, - CORBA::String_out theDHost, CORBA::Long& theDPort, - CORBA::String_out theRHost, CORBA::Long& theRPort, - CORBA::Long& theReversed) - { - myParaVisGen->GetConnectionParameters(theId, theDHost, theDPort, theRHost, theRPort, theReversed); - } - - //=========================================================================== - void PARAVIS_Gen_i::ActivateModule() - { - myParaVisGen->ActivateModule(); - } - - //=========================================================================== - void PARAVIS_Gen_i::SetCurrentStudy(SALOMEDS::Study_ptr theStudy){ - myParaVisGen->SetCurrentStudy(theStudy); - } - - - //=========================================================================== - SALOMEDS::Study_ptr PARAVIS_Gen_i::GetCurrentStudy(){ - return myParaVisGen->GetCurrentStudy(); - } - char* PARAVIS_Gen_i::getVersion() - { - return myParaVisGen->getVersion(); - } -} diff --git a/src/ENGINE/PARAVIS_Engine_i.hh b/src/ENGINE/PARAVIS_Engine_i.hh deleted file mode 100644 index 70f084fd..00000000 --- a/src/ENGINE/PARAVIS_Engine_i.hh +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef __PARAVIS_ENGINE_I_H__ -#define __PARAVIS_ENGINE_I_H__ - -// IDL headers -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(PARAVIS_Gen) -#include CORBA_SERVER_HEADER(SALOME_Session) -#include CORBA_SERVER_HEADER(SALOMEDS) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -#include "SALOME_Component_i.hxx" - -namespace PARAVIS -{ - /*! - * Implements PARAVIS_Gen interface. - * Ativates corresponded interface in GUI main thread and redirects all calls to that interface. - */ - class PARAVIS_Gen_i : public virtual POA_PARAVIS::PARAVIS_Gen, - public virtual ::Engines_Component_i - { - //! Reference on corresponded interface in GUI thread - PARAVIS_Gen_var myParaVisGen; - - //! Empty Constructor - PARAVIS_Gen_i(); - //! Copy Constructor - PARAVIS_Gen_i(const PARAVIS::PARAVIS_Gen_i &); - public: - //! Constructor - PARAVIS_Gen_i(SALOME::Session_ptr session, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName); - virtual ~PARAVIS_Gen_i(); - - virtual char* GetIOR(); - - virtual void ImportFile(const char* theFileName); - - virtual void ExecuteScript(const char* script); - - virtual char* GetTrace(); - - virtual void SaveTrace(const char* theFileName); - - // inherited methods from SALOMEDS::Driver - virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, bool isMultiFile); - - virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, bool isMultiFile); - - virtual bool Load(SALOMEDS::SComponent_ptr, const SALOMEDS::TMPFile &, - const char* theURL, bool isMultiFile); - - virtual bool LoadASCII(SALOMEDS::SComponent_ptr, const SALOMEDS::TMPFile &, - const char* theURL, bool isMultiFile); - - virtual void Close(SALOMEDS::SComponent_ptr IORSComponent); - - virtual char* ComponentDataType(); - - virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, const char* IORString, - CORBA::Boolean isMultiFile, CORBA::Boolean isASCII); - - virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, const char* aLocalPersistentID, - CORBA::Boolean isMultiFile, CORBA::Boolean isASCII); - - virtual bool CanPublishInStudy(CORBA::Object_ptr theIOR); - - virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theObject, - const char* theName) throw (SALOME::SALOME_Exception); - - virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject); - - virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID); - - virtual CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID); - - virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream, - CORBA::Long theObjectID, SALOMEDS::SObject_ptr theObject); - -#ifdef PARAVIS_WITH_FULL_CORBA - virtual PARAVIS::string_array* GetClassesList(); - virtual PARAVIS_Base_ptr CreateClass(const char* theClassName); -#endif - virtual void GetConnectionParameters(CORBA::Long& theId, - CORBA::String_out theDHost, CORBA::Long& theDPort, - CORBA::String_out theRHost, CORBA::Long& theRPort, - CORBA::Long& theReversed); - - virtual void ActivateModule(); - - - virtual void SetCurrentStudy(SALOMEDS::Study_ptr theStudy); - virtual SALOMEDS::Study_ptr GetCurrentStudy(); - - virtual char* getVersion(); - }; -}; -#endif diff --git a/src/ENGINE/no_wrap/PVSERVER.py b/src/ENGINE/PVSERVER.py similarity index 96% rename from src/ENGINE/no_wrap/PVSERVER.py rename to src/ENGINE/PVSERVER.py index 44fb679a..d5d2213d 100644 --- a/src/ENGINE/no_wrap/PVSERVER.py +++ b/src/ENGINE/PVSERVER.py @@ -32,6 +32,7 @@ import os #from SALOME_utilities import MESSAGE def MESSAGE(m): + """ Debug function """ pass #os.system("echo \"%s\" >> /tmp/paravis_log.txt" % m) @@ -39,8 +40,8 @@ class PVSERVER_Impl: """ The core implementation (non CORBA, or Study related). See the IDL for the documentation. """ - MAX_PVSERVER_PORT_TRIES = 1000 - PVSERVER_DEFAULT_PORT = 11111 + MAX_PVSERVER_PORT_TRIES = 1000 # Maximum number of tries to get a free port for the PVServer + PVSERVER_DEFAULT_PORT = 11111 # First port being tried to launch the pvserver def __init__(self): self.pvserverPort = -1 @@ -65,6 +66,9 @@ class PVSERVER_Impl: """ Private. Identify a free port to launch the PVServer. + This is done by trying to bind a socket on the port. + We are still subject to a race condition between this detection mechanism and the actual launch of the pvserver + itself ... """ def __getFreePort(self, startPort): cnt = 0 diff --git a/src/ENGINE/no_wrap/PVSERVER_utils.py b/src/ENGINE/PVSERVER_utils.py similarity index 100% rename from src/ENGINE/no_wrap/PVSERVER_utils.py rename to src/ENGINE/PVSERVER_utils.py diff --git a/src/PVGUI/CMakeLists.txt b/src/PVGUI/CMakeLists.txt index ac2d963e..0fb87d49 100644 --- a/src/PVGUI/CMakeLists.txt +++ b/src/PVGUI/CMakeLists.txt @@ -34,9 +34,6 @@ INCLUDE_DIRECTORIES(${OMNIORB_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) -# Process viewer: -#ADD_SUBDIRECTORY(view) - # additional preprocessor / compiler flags ADD_DEFINITIONS(${CAS_DEFINITIONS}) ADD_DEFINITIONS(${OMNIORB_DEFINITIONS}) @@ -77,17 +74,9 @@ SET(_moc_HEADERS # header files / no moc processing SET(_other_HEADERS -# PVGUI_OutputWindowAdapter.h PVGUI_Tools.h - PV_I.h - PARAVIS_Gen_i.hh - PV_Events.h ) -IF(NOT SALOME_PARAVIS_MINIMAL_CORBA) - LIST(APPEND _other_HEADERS PV_Tools.h) -ENDIF() - # header files / to install SET(PVGUI_HEADERS ${_moc_HEADERS} ${_other_HEADERS} ${_ui_FORMS_HEADERS}) @@ -146,74 +135,20 @@ SET(_other_SOURCES PVGUI_DataModel.cxx ) -IF(NOT SALOME_PARAVIS_MINIMAL_CORBA) - # Generate headers and sources corresponding to the IDL implementations: - INCLUDE(${PROJECT_SOURCE_DIR}/src/VTKWrapping/wrap.cmake) - - ## From 2.8.10, we should use: - ## SET(CMAKE_POSITION_INDEPENDENT_CODE ON) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") - - # Make the list of wrapped files visible from the top directory (will be used in idl): - SET(WRAP_IDL_I_HH "${WRAP_IDL_I_HH}" PARENT_SCOPE) - SET(WRAP_IDL_I_CC "${WRAP_IDL_I_CC}" PARENT_SCOPE) - - SET(_VTK_wrap_SOURCES - PARAVIS_Gen_i.cc - PARAVIS_CreateClass.cxx - ${WRAP_IDL_I_CC} - ) -ENDIF() - # sources / to compile SET(PVGUI_SOURCES ${_other_SOURCES} ${_moc_SOURCES} ${_rcc_SOURCES} -# ${vtkEDFCutter_SRCS} ${_VTK_wrap_SOURCES} ${_ui_FORMS_HEADERS} ) # --- rules --- - -IF(NOT SALOME_PARAVIS_MINIMAL_CORBA) - ADD_CUSTOM_COMMAND( - OUTPUT PARAVIS_CreateClass.cxx - COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/VTKWrapping/create_class.py ${CMAKE_BINARY_DIR} - DEPENDS ${CMAKE_BINARY_DIR}/wrapfiles.txt - ${PROJECT_BINARY_DIR}/idl/PARAVIS_Gen.hh - ${PROJECT_BINARY_DIR}/idl/PARAVIS_Gen_Types.hh - SalomeIDLPARAVIS - generate_implements - ) - - # All wrapping tools have to be build before generating the above module - NEEDED? - ###ADD_DEPENDENCIES(SalomeIDLPARAVIS vtkWrapIDL_HH vtkWrapIDL_CC vtkWrapIDL) - - # Intermediate target used in PVGUI directory (we can not cross reference - # a generated source file across directories, hence this trick): - INCLUDE_DIRECTORIES( - ${PROJECT_BINARY_DIR}/idl - ${PROJECT_BINARY_DIR}/src/VTKWrapping - ) -ENDIF() - ADD_LIBRARY(PARAVIS ${PVGUI_SOURCES}) -IF(NOT SALOME_PARAVIS_MINIMAL_CORBA) - # Make sure the generation of the VTK wrapping get executed first: - ADD_DEPENDENCIES(PARAVIS PARAVIS_CreateClass.cxx) -ENDIF() - -IF(NOT SALOME_PARAVIS_MINIMAL_CORBA) - # Ensure .hh files corresponding to IDL have been generated first: - ADD_DEPENDENCIES(PARAVIS omniorb_module_SalomeIDLPARAVIS) -ENDIF() - TARGET_LINK_LIBRARIES(PARAVIS ${_link_LIBRARIES}) INSTALL(TARGETS PARAVIS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) - # --- header and resources installation --- INSTALL(FILES ${PVGUI_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_PARAVIS_INSTALL_RES_DATA}") diff --git a/src/PVGUI/PARAVIS_Gen_i.cc b/src/PVGUI/PARAVIS_Gen_i.cc deleted file mode 100644 index d5a9b952..00000000 --- a/src/PVGUI/PARAVIS_Gen_i.cc +++ /dev/null @@ -1,743 +0,0 @@ -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : PARAVIS_Gen_i.cc -// Author : Vitaly Smetannikov -// Module : PARAVIS -// - - -#include "PARAVIS_Gen_i.hh" -#include "PARAVIS_version.h" - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SALOME_Session) -#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) - -#include -#include "PVGUI_Module.h" -#include -#include - -#include -#include - -#include "PV_Events.h" -#include "PV_Tools.h" - -#include "QDomDocument" -#include "QDomNode" -#include "QDomElement" -#include "QFile" -#include "QDir" -#include "QTextStream" - -#ifdef PARAVIS_WITH_FULL_CORBA - // List of VTK classes wrapped into IDL: -# include "vtkWrapIDL.h" -#endif - -#include -#include - - -#ifdef _DEBUG_ -static int MYDEBUG = 1; -#else -static int MYDEBUG = 0; -#endif - -using namespace std; - -extern PARAVIS::PARAVIS_Base_i* CreateInstance(::vtkObjectBase* Inst, const QString&); - -extern "C" -PARAVIS_I_EXPORT PARAVIS::PARAVIS_Gen_ptr GetImpl(CORBA::ORB_ptr theORB, - PortableServer::POA_ptr thePOA, - SALOME_NamingService* theNamingService, - QMutex* theMutex) -{ - if(MYDEBUG) MESSAGE("extern 'C' GetImpl"); - PARAVIS::PARAVIS_Gen_i *aPARAVIS_Gen = new PARAVIS::PARAVIS_Gen_i(theORB, - thePOA, - theNamingService, - theMutex); - return aPARAVIS_Gen->_this(); -} - - - -namespace PARAVIS -{ - - const char* checkNullStr(const char* theStr) - { - if (strcmp(theStr, "NULL") == 0) - return NULL; - else - return theStr; - } - - std::string tabify( const std::string& source, bool isTabify ) - { - std::string result = source; - if ( isTabify && !result.empty() ) { - std::string caret = "\n"; - int idx = result.rfind( caret ); - while ( idx != std::string::npos ) { - result.replace( idx, caret.size(), "\n\t" ); - idx = result.rfind( caret, idx-1 ); - } - result.insert(0, "\t" ); - } - return result; - } - - PARAVIS_Base_i::~PARAVIS_Base_i() { - if(mySmartPointer != NULL) mySmartPointer->Delete(); - } - - void PARAVIS_Base_i::Init(::vtkObjectBase* base) { - if (mySmartPointer != NULL) mySmartPointer->Delete(); - mySmartPointer = base; - } - - ::vtkObjectBase* PARAVIS_Base_i::getVTKObject(PARAVIS_Base_ptr theBase) { - PARAVIS_Base_i* aBase = GET_SERVANT(theBase); - return (aBase != NULL)? aBase->getVTKObject() : NULL; - } - - CORBA::Boolean PARAVIS_Base_i::IsSame(PARAVIS_Base_ptr theOther) - { - PARAVIS_Base_i* aBase = GET_SERVANT(theOther); - if (aBase == NULL) - return false; - return mySmartPointer.GetPointer() == aBase->getVTKObject(); - } - - - - - PARAVIS_Gen_i* PARAVIS_Gen_i::myParavisGenImpl; - CORBA::ORB_var PARAVIS_Gen_i::myOrb; - PortableServer::POA_var PARAVIS_Gen_i::myPoa; - SALOME_LifeCycleCORBA* PARAVIS_Gen_i::myEnginesLifeCycle; - SALOME_NamingService* PARAVIS_Gen_i::myNamingService; - QMutex* PARAVIS_Gen_i::myMutex; - SalomeApp_Application* PARAVIS_Gen_i::mySalomeApp = 0; - - - //---------------------------------------------------------------------------- - PARAVIS_Gen_i::PARAVIS_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, - SALOME_NamingService* theNamingService, QMutex* theMutex) : - Engines_Component_i() - { - if(MYDEBUG) MESSAGE("PARAVIS_Gen_i::PARAVIS_Gen_i"); - if (mySalomeApp) return; - - myMutex = theMutex; - myOrb = CORBA::ORB::_duplicate(theORB); - myPoa = PortableServer::POA::_duplicate(thePOA); - myParavisGenImpl = this; - myNamingService = theNamingService; - - static SALOME_LifeCycleCORBA aEnginesLifeCycle(theNamingService); - myEnginesLifeCycle = &aEnginesLifeCycle; - - CORBA::Object_var anObj = myNamingService->Resolve("/myStudyManager"); - if (!CORBA::is_nil(anObj)) { - SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(anObj); - SALOMEDS::ListOfOpenStudies_var aListOfOpenStudies = aStudyManager->GetOpenStudies(); - if(aListOfOpenStudies->length() > 0) { - CORBA::String_var aStudyName = aListOfOpenStudies[0]; - myStudyDocument = aStudyManager->GetStudyByName(aStudyName); - if (!myStudyDocument->_is_nil()) { - mySalomeApp = ProcessEvent(new TGetGUIApplication(myStudyDocument->StudyId())); - if(!myStudyDocument->GetProperties()->IsLocked()) - FindOrCreateParaVisComponent(myStudyDocument); - } - } else - if(MYDEBUG) MESSAGE("PARAVIS_Gen_i::PARAVIS_Gen_i : there is no opened study in StudyManager !!!"); - } else - if(MYDEBUG) MESSAGE("PARAVIS_Gen_i::PARAVIS_Gen_i : Can't find StudyManager !!!"); - - } - - //---------------------------------------------------------------------------- - PARAVIS_Gen_i::~PARAVIS_Gen_i() - { - if(MYDEBUG) MESSAGE("PARAVIS_Gen_i::~PARAVIS_Gen_i"); - } - - //---------------------------------------------------------------------------- - char* PARAVIS_Gen_i::GetIOR() - { - if(myIOR == ""){ - CORBA::Object_var anObject = _this(); - CORBA::String_var anIOR = myOrb->object_to_string(anObject); - myIOR = anIOR.in(); - } - return CORBA::string_dup(myIOR.c_str()); - } - - //---------------------------------------------------------------------------- - void PARAVIS_Gen_i::ImportFile(const char* theFileName) - { - if(MYDEBUG) MESSAGE("PARAVIS_Gen_i::ImportFile: " <GetStudy(); - SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theComponent); - for (; anIter->More(); anIter->Next()) { - SALOMEDS::SObject_var aSObj = anIter->Value(); - SALOMEDS::GenericAttribute_var anAttr; - if (!aSObj->FindAttribute(anAttr, "AttributeLocalID")) { - continue; - } - SALOMEDS::AttributeLocalID_var anID = SALOMEDS::AttributeLocalID::_narrow(anAttr); - if (!anID->Value() == PVSTATEID) { - continue; - } - if (aSObj->FindAttribute(anAttr, "AttributeString")) { - SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); - QString aStateFile(aStringAttr->Value()); - printf("getAllSavedStates, aStateFile = %s\n", aStateFile.toLatin1().constData()); - // Replace the old path with the new one - if (!theNewPath.isEmpty()) { - QFileInfo aFileInfo(aStateFile); - QString aPath = aFileInfo.path(); - aStateFile.replace(aPath, theNewPath); - aStringAttr->SetValue(aStateFile.toLatin1().constData()); - - printf("getAllSavedStates, aStateFile NEW = %s\n", aStateFile.toLatin1().constData()); - } - aStateFiles<length() == 0) - return false; - - bool aRestore = GetRestoreParam(theComponent); - MESSAGE("PARAVIS_Gen_i::Restore path - "<length() - 1]); - QStringList aEmptyList; - processAllFilesInState(aFile.c_str(), aEmptyList, aTmpDir.c_str(), aRestore); - ProcessVoidEvent(new TLoadStateFile(theApp, aFile.c_str())); - - // Process saved states - QStringList aSavedStates = getAllSavedStates(theComponent, QString(aTmpDir.c_str())); - foreach(QString aState, aSavedStates) { - processAllFilesInState(aState.toLatin1().constData(), - aEmptyList, aTmpDir.c_str(), aRestore); - } - - return true; - } - - //---------------------------------------------------------------------------- - bool PARAVIS_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, const SALOMEDS::TMPFile& theStream, - const char* theURL, bool isMultiFile) - { - return LoadState(mySalomeApp, theComponent, theStream, theURL, isMultiFile); - } - - //---------------------------------------------------------------------------- - bool PARAVIS_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, bool isMultiFile) - { - return LoadState(mySalomeApp, theComponent, theStream, theURL, isMultiFile); - } - - //---------------------------------------------------------------------------- - void PARAVIS_Gen_i::Close(SALOMEDS::SComponent_ptr IORSComponent) - { - } - - //---------------------------------------------------------------------------- - char* PARAVIS_Gen_i::ComponentDataType() - { - return CORBA::string_dup("PARAVIS"); - } - - //---------------------------------------------------------------------------- - char* PARAVIS_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, const char* IORString, - CORBA::Boolean isMultiFile, CORBA::Boolean isASCII) - { - CORBA::String_var aString(""); - return aString._retn(); - } - - //---------------------------------------------------------------------------- - char* PARAVIS_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, - const char* aLocalPersistentID, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII) - { - CORBA::String_var aString(""); - return aString._retn(); - } - - //---------------------------------------------------------------------------- - bool PARAVIS_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) - { - return false; - } - - //---------------------------------------------------------------------------- - SALOMEDS::SObject_ptr PARAVIS_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theObject, - const char* theName) - throw (SALOME::SALOME_Exception) - { - SALOMEDS::SObject_var aResultSO; - return aResultSO._retn(); - } - - //---------------------------------------------------------------------------- - CORBA::Boolean PARAVIS_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) - { - return false; - } - - //---------------------------------------------------------------------------- - SALOMEDS::TMPFile* PARAVIS_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) - { - SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile; - return aStreamFile._retn(); - } - - //---------------------------------------------------------------------------- - CORBA::Boolean PARAVIS_Gen_i::CanPaste(const char* theComponentName, CORBA::Long theObjectID) - { - return false; - } - - //---------------------------------------------------------------------------- - SALOMEDS::SObject_ptr PARAVIS_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, - CORBA::Long theObjectID, SALOMEDS::SObject_ptr theObject) - { - return SALOMEDS::SObject::_nil(); - } - -#ifdef PARAVIS_WITH_FULL_CORBA - //---------------------------------------------------------------------------- - PARAVIS::string_array* PARAVIS_Gen_i::GetClassesList() - { - uint k; - for (k = 0; strcmp(wrapped_classes[k], "") != 0; k++); - PARAVIS::string_array_var aNames = new PARAVIS::string_array(); - aNames->length(k); - for (CORBA::ULong i = 0; i < k; i++) - aNames[i] = CORBA::string_dup(wrapped_classes[i]); - return aNames._retn(); - } - - //---------------------------------------------------------------------------- - PARAVIS_Base_ptr PARAVIS_Gen_i::CreateClass(const char* theClassName) - { - PARAVIS::PARAVIS_Base_i* aClass = CreateInstance(NULL, QString(theClassName)); - return aClass->_this(); - } -#endif - - //---------------------------------------------------------------------------- - void PARAVIS_Gen_i::GetConnectionParameters(CORBA::Long& theId, - CORBA::String_out theDHost, CORBA::Long& theDPort, - CORBA::String_out theRHost, CORBA::Long& theRPort, - CORBA::Long& theReversed) - { - pqServer* aServer = ProcessEvent(new TGetActiveServer(mySalomeApp)); - if (aServer) { - theId = static_cast(aServer->GetConnectionID()); - - pqServerResource serverRes = aServer->getResource(); - theReversed = (serverRes.scheme() == "csrc" || serverRes.scheme() == "cdsrsrc")? 1 : 0; - - theDPort = serverRes.dataServerPort() < 0? serverRes.port() : serverRes.dataServerPort(); - theRPort = serverRes.renderServerPort() < 0 ? 0 : serverRes.renderServerPort(); - - QString dsHost = serverRes.dataServerHost().isEmpty()? serverRes.host() : serverRes.dataServerHost(); - QString rsHost = serverRes.renderServerHost(); - - theDHost = CORBA::string_dup(qPrintable(dsHost)); - theRHost = CORBA::string_dup(qPrintable(rsHost)); - } - } - - - //---------------------------------------------------------------------------- - Engines::TMPFile* PARAVIS_Gen_i::DumpPython(CORBA::Object_ptr theStudy, - CORBA::Boolean theIsPublished, - CORBA::Boolean theIsMultiFile, - CORBA::Boolean& theIsValidScript) - { - theIsValidScript = true; - std::string aResult; - if ( theIsMultiFile ) - aResult += "\ndef RebuildData(theStudy):\n"; - aResult += tabify(ProcessEvent(new TGetTrace(mySalomeApp)), theIsMultiFile ); - if ( theIsMultiFile ) - aResult += "\n\tpass\n"; - CORBA::ULong aSize = aResult.size() + 1; - char* aBuffer = new char[aSize]; - memset(aBuffer, 0, aSize); - strcpy(aBuffer, &aResult[0]); - Engines::TMPFile_var aDump = new Engines::TMPFile(aSize,aSize,(CORBA::Octet*)aBuffer,1); - return aDump._retn(); - } - - //---------------------------------------------------------------------------- - void PARAVIS_Gen_i::ActivateModule() - { - ProcessVoidEvent(new TActivateModule(mySalomeApp)); - } - - //---------------------------------------------------------------------------- - struct TSetStudyEvent: public SALOME_Event { - std::string myStudyName; - typedef SalomeApp_Application* TResult; - TResult myResult; - - TSetStudyEvent(const std::string theStudyName):myStudyName(theStudyName), myResult(0) {} - virtual void Execute() - { - bool isActive = false; - SUIT_Session* aSession = SUIT_Session::session(); - QList anApplications = aSession->applications(); - QList::Iterator anIter = anApplications.begin(); - SUIT_Application* aFirstApp = *anIter; - while (anIter != anApplications.end()) { - SUIT_Application* anApp = *anIter; - if (SUIT_Study* aSStudy = anApp->activeStudy()) { - if (SalomeApp_Study* aStudy = dynamic_cast(aSStudy)) { - if (_PTR(Study) aCStudy = aStudy->studyDS()) { - if(MYDEBUG) MESSAGE("There is an application with active study : StudyId = " - << aCStudy->StudyId() << "; Name = '" << aCStudy->Name() << "'"); - if (myStudyName == aCStudy->Name()) { - isActive = true; - break; - } - } - } - } - anIter++; - } - SalomeApp_Application* anApp = dynamic_cast(aFirstApp); - if (!isActive) { - MESSAGE("!!! anApp->onLoadDoc(myStudyName) !!!"); - // Has to be loaded in an empty or in a new application - anApp->onLoadDoc(myStudyName.c_str()); - } - myResult = anApp; - } - }; - - void PARAVIS_Gen_i::SetCurrentStudy(SALOMEDS::Study_ptr theStudy) - { - if (!CORBA::is_nil(theStudy)) { - CORBA::String_var aName = theStudy->Name(); - std::string aStudyName (aName.in()); - - myStudyDocument = SALOMEDS::Study::_duplicate(theStudy); - SalomeApp_Application* anApp = ProcessEvent(new TSetStudyEvent(aStudyName)); - if (!mySalomeApp) - mySalomeApp = anApp; - } else { - INFOS("CORBA::is_nil(theStudy)"); - } - } - - - //---------------------------------------------------------------------------- - SALOMEDS::Study_ptr PARAVIS_Gen_i::GetCurrentStudy() - { - return SALOMEDS::Study::_duplicate(myStudyDocument); - } - - // Version information - char* PARAVIS_Gen_i::getVersion() - { -#ifdef PARAVIS_DEVELOPMENT - return CORBA::string_dup( PARAVIS_VERSION_STR"dev" ); -#else - return CORBA::string_dup( PARAVIS_VERSION_STR ); -#endif - } -} diff --git a/src/PVGUI/PARAVIS_Gen_i.hh b/src/PVGUI/PARAVIS_Gen_i.hh deleted file mode 100644 index 60073eac..00000000 --- a/src/PVGUI/PARAVIS_Gen_i.hh +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : PARAVIS_Gen_i.hh -// Author : Vitaly Smetannikov -// Module : PARAVIS -// -#ifndef __PARAVIS_GEN_I_H__ -#define __PARAVIS_GEN_I_H__ - -#include "PV_I.h" -#include "vtkSmartPointer.h" - -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(PARAVIS_Gen) -#include CORBA_SERVER_HEADER(SALOMEDS) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -#include "SALOME_NamingService.hxx" -#include "SALOME_LifeCycleCORBA.hxx" - -#include "SALOME_Component_i.hxx" -#include "SALOME_NamingService.hxx" - -#include "vtkSmartPointer.h" - -// QT Includes -#include - -class SalomeApp_Application; -class PVGUI_Module; -class vtkObjectBase; - -//#define PVSTATEID 15555 // now in PVGUI_Tools.h - -namespace PARAVIS -{ - - const char* checkNullStr(const char* theStr); - - /*! - * Base implementation for all container objects for Paravis serevrmanager API classes - */ - class PARAVIS_Base_i : public virtual POA_PARAVIS::PARAVIS_Base - { - public: - //! Constructor - PARAVIS_Base_i() {}; - - //! Destructor - virtual ~PARAVIS_Base_i(); - - //! Initialises internal pointer on existing Paraview class instance - virtual void Init(::vtkObjectBase* base); - - virtual ::vtkObjectBase* GetNew() { return NULL; } - - //! Returns pointer on internal Paraview class instance - virtual ::vtkObjectBase* getVTKObject() - { if (mySmartPointer == NULL) - mySmartPointer = GetNew(); - return mySmartPointer.GetPointer(); - } - - //! The same as previous in static context - static ::vtkObjectBase* getVTKObject(PARAVIS_Base_ptr theBase); - - //! Compares two container objects comparing of their internal pointers - virtual CORBA::Boolean IsSame(PARAVIS_Base_ptr theOther); - - protected: - - //! Pointer on wrapped class - vtkSmartPointer< ::vtkObjectBase> mySmartPointer; - }; - - //---------------------------------------------------------------------------- - class PARAVIS_Gen_i : public virtual POA_PARAVIS::PARAVIS_Gen, - public virtual ::Engines_Component_i - { - //! Copy constructor - PARAVIS_Gen_i(const PARAVIS::PARAVIS_Gen_i &); - public: - - //! Constructor - PARAVIS_Gen_i(CORBA::ORB_ptr theORB, - PortableServer::POA_ptr thePOA, - SALOME_NamingService* theNamingService, - QMutex* theMutex); - - //! Destructor - virtual ~PARAVIS_Gen_i(); - - //! Returns CORBA ID for the current instance - virtual char* GetIOR(); - - //! Import file to PARAVIS module by its name. - virtual void ImportFile(const char* theFileName); - - //! Execute a PARAVIS script on Session - virtual void ExecuteScript(const char* script); - - //! Returns Trace string. If Trace is not activated then empty string is returned - virtual char* GetTrace(); - - //! Save trace sting to a disk file. - virtual void SaveTrace(const char* theFileName); - - //! inherited methods from Engines::Component - virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, - CORBA::Boolean theIsPublished, - CORBA::Boolean theIsMultiFile, - CORBA::Boolean& theIsValidScript); - - //! inherited methods from SALOMEDS::Driver - virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, bool isMultiFile); - - //! inherited methods from SALOMEDS::Driver - virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, bool isMultiFile); - - //! inherited methods from SALOMEDS::Driver - virtual bool Load(SALOMEDS::SComponent_ptr, const SALOMEDS::TMPFile &, - const char* theURL, bool isMultiFile); - - //! inherited methods from SALOMEDS::Driver - virtual bool LoadASCII(SALOMEDS::SComponent_ptr, const SALOMEDS::TMPFile &, - const char* theURL, bool isMultiFile); - - //! inherited methods from SALOMEDS::Driver - virtual void Close(SALOMEDS::SComponent_ptr IORSComponent); - - //! inherited methods from SALOMEDS::Driver - virtual char* ComponentDataType(); - - //! inherited methods from SALOMEDS::Driver - virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, const char* IORString, - CORBA::Boolean isMultiFile, CORBA::Boolean isASCII); - - //! inherited methods from SALOMEDS::Driver - virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, const char* aLocalPersistentID, - CORBA::Boolean isMultiFile, CORBA::Boolean isASCII); - - //! inherited methods from SALOMEDS::Driver. Alwais returns false for this module - virtual bool CanPublishInStudy(CORBA::Object_ptr theIOR); - - //! inherited methods from SALOMEDS::Driver. Does nothing - virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theObject, - const char* theName) throw (SALOME::SALOME_Exception); - - //! inherited methods from SALOMEDS::Driver. Alwais returns false for this module - virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject); - - //! inherited methods from SALOMEDS::Driver. Does nothing - virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID); - - //! inherited methods from SALOMEDS::Driver. Does nothing - virtual CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID); - - //! inherited methods from SALOMEDS::Driver. Does nothing - virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream, - CORBA::Long theObjectID, SALOMEDS::SObject_ptr theObject); - - //! inherited methods from Engines::EngineComponent. Returns module version. - virtual char* getVersion(); - -#ifdef PARAVIS_WITH_FULL_CORBA - //! Implementation of PARAVIS_Gen interface - virtual PARAVIS::string_array* GetClassesList(); - - //! Implementation of PARAVIS_Gen interface - virtual PARAVIS_Base_ptr CreateClass(const char* theClassName); -#endif - - //! Implementation of PARAVIS_Gen interface - virtual void GetConnectionParameters(CORBA::Long& theId, - CORBA::String_out theDHost, CORBA::Long& theDPort, - CORBA::String_out theRHost, CORBA::Long& theRPort, - CORBA::Long& theReversed); - - - //! Implementation of PARAVIS_Gen interface - virtual void ActivateModule(); - - virtual void SetCurrentStudy(SALOMEDS::Study_ptr theStudy); - - virtual SALOMEDS::Study_ptr GetCurrentStudy(); - - //! Returns current ORB - static CORBA::ORB_var GetORB() { return myOrb;} - - //! Returns current POA - static PortableServer::POA_var GetPOA() { return myPoa;} - - //! Returns current implementation instance - static PARAVIS_Gen_i* GetParavisGenImpl() { return myParavisGenImpl;} - - private: - static CORBA::ORB_var myOrb; - static PortableServer::POA_var myPoa; - static PARAVIS_Gen_i* myParavisGenImpl; - static SALOME_LifeCycleCORBA* myEnginesLifeCycle; - static SALOME_NamingService* myNamingService; - static QMutex* myMutex; - - std::string myIOR; - SALOMEDS::Study_var myStudyDocument; - static SalomeApp_Application* mySalomeApp; - - }; - -}; -#endif diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index 1e5504b8..c50b2485 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -29,10 +29,6 @@ #include // Python first #include "PVGUI_Module.h" -//#ifdef PARAVIS_WITH_FULL_CORBA -//# include "PARAVIS_Gen_i.hh" -//#endif - #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) #include CORBA_SERVER_HEADER(SALOMEDS) @@ -137,9 +133,6 @@ #include #include -//#include - - //---------------------------------------------------------------------------- PVGUI_Module* ParavisModule = 0; PVSERVER_ORB::PVSERVER_Gen_var PVGUI_Module::MyEngine; diff --git a/src/PVGUI/PVGUI_Module.h b/src/PVGUI/PVGUI_Module.h index 7fc18892..f955a6e1 100644 --- a/src/PVGUI/PVGUI_Module.h +++ b/src/PVGUI/PVGUI_Module.h @@ -19,7 +19,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // File : PVGUI_Module.h -// Author : Sergey ANIKIN +// Author : Sergey ANIKIN, Adrien BRUNETON // diff --git a/src/PVGUI/PVGUI_Module_actions.cxx b/src/PVGUI/PVGUI_Module_actions.cxx index d6215cb6..f9bd7de2 100644 --- a/src/PVGUI/PVGUI_Module_actions.cxx +++ b/src/PVGUI/PVGUI_Module_actions.cxx @@ -41,12 +41,9 @@ #include #include -// #include -#include -//#include -//#include -#include -#include +//#include +//#include +//#include #include #include @@ -63,30 +60,27 @@ #include #include #include -//#include #include -#include -#include -#include #include #include #include #include #include -#include -#include #include #include #include #include -#include #include +#include + +#include +#include +#include +#include +#include #include #include -#include "PVGUI_Tools.h" - - /*! \brief Create actions for ParaView GUI operations duplicating menus and toolbars in MainWindow class of @@ -536,20 +530,6 @@ void PVGUI_Module::pvCreateMenus() // -- Context menu in the pipeline browser pqPipelineBrowserWidget * pq = guiElements->getPipelineBrowserWidget(); pqParaViewMenuBuilders::buildPipelineBrowserContextMenu( *pq ); - -// // Reload configuration to populate dynamic menus from ParaView: -// PVViewer_ViewManager::ParaviewLoadConfigurations(true); -// -// // Disable all filters for now (for some weird reasons they are all on when starting?) -// QList sub_menus = filtersMenu->findChildren(); -// foreach(QMenu * m, sub_menus) -// { -// QList act_list = m->actions(); -// foreach(QAction * a, act_list) -// { -// a->setEnabled(false); -// } -// } } /*! @@ -643,12 +623,6 @@ void PVGUI_Module::createActions() { QAction* anAction; -// // New ParaView window -// anAction = new QtxAction(tr("MEN_NEW_PV_VIEW"), tr("MEN_NEW_PV_VIEW"), 0, -// this, false, "ParaViS:Create new ParaView view"); -// connect(anAction, SIGNAL(triggered()), this, SLOT(onNewParaViewWindow())); -// registerAction(ParaViewNewWindowId, anAction); - // Save state under the module root object anAction = new QAction(tr("MEN_SAVE_MULTI_STATE"), this); connect(anAction, SIGNAL(triggered()), this, SLOT(onSaveMultiState())); diff --git a/src/PVGUI/PVGUI_Module_widgets.cxx b/src/PVGUI/PVGUI_Module_widgets.cxx index 2f5555bd..7a8af8ff 100644 --- a/src/PVGUI/PVGUI_Module_widgets.cxx +++ b/src/PVGUI/PVGUI_Module_widgets.cxx @@ -56,7 +56,6 @@ #include #include #include -//#include #include #include diff --git a/src/PVGUI/PVGUI_ParaViewSettingsPane.h b/src/PVGUI/PVGUI_ParaViewSettingsPane.h index be4febf2..96c14300 100644 --- a/src/PVGUI/PVGUI_ParaViewSettingsPane.h +++ b/src/PVGUI/PVGUI_ParaViewSettingsPane.h @@ -35,7 +35,7 @@ class QHideEvent; class LightApp_Application; /**! - * Almost identical copy/paste of what is found in + * Almost a copy/paste of what is found in * /Qt/Components/pqSettingsDialog.h * This is (almost) the same, except for the inheritance to QtxUserDefinedContent providing the link * to SALOME preference mechanism. diff --git a/src/PVGUI/PVGUI_Tools.cxx b/src/PVGUI/PVGUI_Tools.cxx index 8216a0ed..f7764b6f 100644 --- a/src/PVGUI/PVGUI_Tools.cxx +++ b/src/PVGUI/PVGUI_Tools.cxx @@ -25,40 +25,22 @@ #include "SALOME_LifeCycleCORBA.hxx" #include "SalomeApp_Application.h" #include "SalomeApp_Study.h" -#include using namespace std; //============================================================================= namespace PARAVIS { -#ifdef PARAVIS_WITH_FULL_CORBA - //------------------------------------------------------------ - PARAVIS_Gen_i* GetParavisGen(const CAM_Module* theModule) - { - static PARAVIS_Gen_i* aGen = NULL; - if(!aGen){ - SALOME_LifeCycleCORBA aLCC(SalomeApp_Application::namingService()); - Engines::EngineComponent_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","PARAVIS"); - PARAVIS_Gen_var aPARAVIS = PARAVIS_Gen::_narrow(aComponent); - if(!CORBA::is_nil(aPARAVIS)){ - aGen = PARAVIS_Gen_i::GetParavisGenImpl(); - } - } - if(!aGen) - throw std::runtime_error("Can not create PARAVIS_Gen"); - return aGen; - } -#endif - - //------------------------------------------------------------ + /** + * Get current study. + */ _PTR(Study) GetCStudy(const CAM_Module* theModule) { if (theModule && theModule->application()) { SalomeApp_Study* activeStudy = - dynamic_cast(theModule->application()->activeStudy()); + dynamic_cast(theModule->application()->activeStudy()); if (activeStudy) { - return activeStudy->studyDS(); + return activeStudy->studyDS(); } } diff --git a/src/PVGUI/PVGUI_Tools.h b/src/PVGUI/PVGUI_Tools.h index 0a64cf97..f5ed5fc0 100644 --- a/src/PVGUI/PVGUI_Tools.h +++ b/src/PVGUI/PVGUI_Tools.h @@ -25,10 +25,6 @@ #ifndef PVGUI_Tools_H #define PVGUI_Tools_H -#ifdef PARAVIS_WITH_FULL_CORBA -# include "PARAVIS_Gen_i.hh" -#endif - #include "SALOMEDSClient_Study.hxx" #define PVSTATEID 15555 @@ -37,10 +33,6 @@ class CAM_Module; namespace PARAVIS { -#ifdef PARAVIS_WITH_FULL_CORBA - PARAVIS_Gen_i* GetParavisGen(const CAM_Module* theModule); -#endif - _PTR(Study) GetCStudy(const CAM_Module* theModule); }; diff --git a/src/PVGUI/PV_Events.h b/src/PVGUI/PV_Events.h deleted file mode 100644 index 0e460cf4..00000000 --- a/src/PVGUI/PV_Events.h +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : PV_Events.h -// Author : Vitaly Smetannikov -// Module : PARAVIS -// - -#ifndef PV_EVENTS_H -#define PV_EVENTS_H - -#include "SALOME_Event.h" -#include "SalomeApp_Study.h" -#include "SalomeApp_Application.h" - -#include "SUIT_Session.h" - - -/*! - * Definition of events - */ -namespace PARAVIS { - - /*! - * Event which returns SalomeApp_Application instance which corresponds to th given study ID - */ - struct TGetGUIApplication: public SALOME_Event - { - int myStudyId; - typedef SalomeApp_Application* TResult; - TResult myResult; - - TGetGUIApplication(const int theStudyId):myStudyId(theStudyId), myResult(0) {} - - virtual void Execute() - { - MESSAGE("Find application for study with id = : " << myStudyId); - SUIT_Session* aSession = SUIT_Session::session(); - QList anApplications = aSession->applications(); - for (int i = 0; i < anApplications.count() && !myResult; i++ ){ - if ( anApplications[i]->activeStudy() && anApplications[i]->activeStudy()->id() == myStudyId ) - myResult = dynamic_cast( anApplications[i] ); - } - if ( !myResult ) { - MESSAGE("Error: application is not found for study with id = : " << myStudyId); - } - } - }; - - /*! - * Parent event for all events what is going to work with PARAVIS module instance - */ - struct TModuleEvent: public SALOME_Event - { - SalomeApp_Application* myApp; - - TModuleEvent(SalomeApp_Application* theApp ):myApp(theApp) {} - - //! Returns pointer on PARAVIS module instance - PVGUI_Module* getModule() - { - PVGUI_Module* aPVModule = 0; - CAM_Application::ModuleList aList = myApp->modules(); - foreach(CAM_Module* aModule, aList) { - if (aModule->moduleName() == "ParaViS") { - aPVModule = dynamic_cast(aModule); - break; - } - } - return aPVModule; - } - }; - - /*! - * Event which activates PARAVIS module if it is not active - */ - struct TActivateModule: public TModuleEvent - { - TActivateModule(SalomeApp_Application* theApp ):TModuleEvent(theApp) {} - - virtual void Execute() - { - PVGUI_Module* aPVModule = getModule(); - if ((aPVModule == 0) || (myApp->activeModule() != aPVModule)) { - myApp->activateModule("ParaViS"); - } - } - }; - - /*! - * Returns trace string collected in PARAVIS module in current session - */ - struct TGetTrace: public TModuleEvent - { - typedef std::string TResult; - TResult myResult; - TGetTrace(SalomeApp_Application* theApp) : - TModuleEvent(theApp) - { - myResult = ""; - } - - virtual void Execute() - { - PVGUI_Module* aPVModule = getModule(); - if (aPVModule) - myResult = qPrintable(aPVModule->getTraceString()); - } - }; - - /*! - * Parent event for all operations with files across PARAVIS module - */ - struct TParavisFileEvent: public TModuleEvent - { - const char* myName; - - TParavisFileEvent(SalomeApp_Application* theApp, const char* theFileName ) : - TModuleEvent(theApp), myName(theFileName) - {} - }; - - /*! - * Event to save trace string inte disk file - */ - struct TSaveTrace: public TParavisFileEvent - { - TSaveTrace(SalomeApp_Application* theApp, const char* theFileName ) : - TParavisFileEvent(theApp, theFileName) - {} - - virtual void Execute() - { - PVGUI_Module* aPVModule = getModule(); - if (aPVModule) - aPVModule->saveTrace(myName); - } - }; - - - /*! - * Event to import file to PARAVIS - */ - struct TImportFile: public TParavisFileEvent - { - TImportFile(SalomeApp_Application* theApp, const char* theFileName ) : - TParavisFileEvent(theApp, theFileName) - {} - - virtual void Execute() - { - PVGUI_Module* aPVModule = getModule(); - if (aPVModule) - aPVModule->openFile(myName); - } - }; - - /*! - * Event to execute a script to PARAVIS - */ - struct TExecuteScript: public TParavisFileEvent - { - TExecuteScript(SalomeApp_Application* theApp, const char* theFileName ) : - TParavisFileEvent(theApp, theFileName) - {} - - virtual void Execute() - { - PVGUI_Module* aPVModule = getModule(); - if (aPVModule) - aPVModule->executeScript(myName); - } - }; - - /*! - * Event to save current Paraview state. - * This event is used for Study saving - */ - struct TSaveStateFile: public TParavisFileEvent - { - TSaveStateFile(SalomeApp_Application* theApp, const char* theFileName ) : - TParavisFileEvent(theApp, theFileName) - {} - - virtual void Execute() - { - PVGUI_Module* aPVModule = getModule(); - if (aPVModule) - aPVModule->saveParaviewState(myName); - } - }; - - - /*! - * Event to restore Paraview state from disk file. - * This event is used for Study restoring - */ - struct TLoadStateFile: public TParavisFileEvent - { - TLoadStateFile(SalomeApp_Application* theApp, const char* theFileName ) : - TParavisFileEvent(theApp, theFileName) - {} - - virtual void Execute() - { - PVGUI_Module* aPVModule = getModule(); - if (aPVModule) - aPVModule->loadParaviewState(myName); - } - }; - - /*! - * Returns currently active Paraview server - */ - struct TGetActiveServer: public TModuleEvent - { - typedef pqServer* TResult; - TResult myResult; - - TGetActiveServer(SalomeApp_Application* theApp ) : - TModuleEvent(theApp), myResult(0) - {} - - virtual void Execute() - { - PVGUI_Module* aPVModule = getModule(); - if (aPVModule) - myResult = aPVModule->getActiveServer(); - } - }; - -}; - - -#endif //PV_EVENTS_H diff --git a/src/PVGUI/PV_I.h b/src/PVGUI/PV_I.h deleted file mode 100644 index 84a60750..00000000 --- a/src/PVGUI/PV_I.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : PARAVIS_I.hxx -// Author : Vitaly Smetannikov -// Module : PARAVIS -// -#ifndef _PARAVIS_I_HXX_ -#define _PARAVIS_I_HXX_ - -#ifdef WNT -# if defined PARAVIS_EXPORTS -# define PARAVIS_I_EXPORT __declspec( dllexport ) -# else -# define PARAVIS_I_EXPORT __declspec( dllimport ) -# endif - -# define COPY_COMMAND "copy /Y" -# define MOVE_COMMAND "move /Y" -# define DELETE_COMMAND "del /F" -#else -# define PARAVIS_I_EXPORT -# define COPY_COMMAND "cp" -# define MOVE_COMMAND "mv" -# define DELETE_COMMAND "rm -f" -#endif - -#endif diff --git a/src/PVGUI/deprecated/PVGUI_MatplotlibMathTextUtilities.cxx b/src/PVGUI/deprecated/PVGUI_MatplotlibMathTextUtilities.cxx deleted file mode 100644 index 2d38c1d2..00000000 --- a/src/PVGUI/deprecated/PVGUI_MatplotlibMathTextUtilities.cxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include - -void PVGUI_MatplotlibMathTextUtilities::Disable() { - vtkMatplotlibMathTextUtilities::MPLMathTextAvailable = vtkMatplotlibMathTextUtilities::UNAVAILABLE; -} diff --git a/src/PVGUI/deprecated/PVGUI_MatplotlibMathTextUtilities.h b/src/PVGUI/deprecated/PVGUI_MatplotlibMathTextUtilities.h deleted file mode 100644 index 700b73d6..00000000 --- a/src/PVGUI/deprecated/PVGUI_MatplotlibMathTextUtilities.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef _PVGUI_MatplotlibMathTextUtilities_h -#define _PVGUI_MatplotlibMathTextUtilities_h - -#include - -/*! -Disable vtkMatplotlibMathTextUtilities. It conflicts with SALOME Python console. - -To use, call PVGUI_MatplotlibMathTextUtilities::Disable() static method. - -This class is based on vtkMatplotlibMathTextUtilities VTK class. -*/ -class PVGUI_MatplotlibMathTextUtilities : public vtkMatplotlibMathTextUtilities -{ -public: - static void Disable(); - -private: - PVGUI_MatplotlibMathTextUtilities(); - ~PVGUI_MatplotlibMathTextUtilities(); -}; - -#endif // !_PVGUI_MatplotlibMathTextUtilities_h diff --git a/src/PVGUI/deprecated/PV_Tools.cxx b/src/PVGUI/deprecated/PV_Tools.cxx deleted file mode 100644 index e8206182..00000000 --- a/src/PVGUI/deprecated/PV_Tools.cxx +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : PV_Tools.cxx -// Author : Alexey PETROV -// Module : VISU -// -#include "PV_Tools.h" -#include "PARAVIS_Gen_i.hh" - -#include -#include CORBA_SERVER_HEADER(SALOME_Session) -#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) - -#include - -#include - -namespace PARAVIS -{ -//---------------------------------------------------------------------------- - SALOMEDS::ListOfFileNames* GetListOfFileNames(const QStringList& theFileNames) - { - SALOMEDS::ListOfFileNames_var aListOfFileNames = new SALOMEDS::ListOfFileNames; - if(!theFileNames.isEmpty()){ - aListOfFileNames->length(theFileNames.size()); - int i = 0; - foreach (QString aName, theFileNames) { - aListOfFileNames[i] = qPrintable(aName); - i++; - } - } - return aListOfFileNames._retn(); - } - - //---------------------------------------------------------------------------- - SALOMEDS::SComponent_var FindOrCreateParaVisComponent(SALOMEDS::Study_ptr theStudyDocument) - { - SALOMEDS::SComponent_var aSComponent = theStudyDocument->FindComponent("PARAVIS"); - if (aSComponent->_is_nil()) { - SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder(); - aStudyBuilder->NewCommand(); - int aLocked = theStudyDocument->GetProperties()->IsLocked(); - if (aLocked) theStudyDocument->GetProperties()->SetLocked(false); - aSComponent = aStudyBuilder->NewComponent("PARAVIS"); - SALOMEDS::GenericAttribute_var anAttr = - aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeName"); - SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); - - CORBA::ORB_var anORB = PARAVIS_Gen_i::GetORB(); - SALOME_NamingService *NamingService = new SALOME_NamingService( anORB ); - CORBA::Object_var objVarN = NamingService->Resolve("/Kernel/ModulCatalog"); - SALOME_ModuleCatalog::ModuleCatalog_var Catalogue = - SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN); - SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent( "PARAVIS" ); - if ( !CORBA::is_nil(Comp) ) { - aName->SetValue( Comp->componentusername() ); - } - - anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributePixMap"); - SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - aPixmap->SetPixMap( "pqAppIcon16.png" ); - - // Create Attribute parameters for future using - anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeParameter"); - - PARAVIS_Gen_var aParaVisGen = PARAVIS_Gen_i::GetParavisGenImpl()->_this(); - aStudyBuilder->DefineComponentInstance(aSComponent, aParaVisGen); - if (aLocked) - theStudyDocument->GetProperties()->SetLocked(true); - aStudyBuilder->CommitCommand(); - } - return aSComponent; - } - - PARAVIS_Base_i* GET_SERVANT(CORBA::Object_ptr aObj) { - //dynamic_cast(PARAVIS_Gen_i::GetPOA()->reference_to_servant(OBJ).in()) - if (CORBA::is_nil(aObj)) - return NULL; - try { - PortableServer::POA_ptr aPOA = PARAVIS_Gen_i::GetPOA(); - PortableServer::ServantBase_var aServant = aPOA->reference_to_servant(aObj); - return dynamic_cast(aServant.in()); - } catch (...) { - MESSAGE("GET_SERVANT: Unknown exception!!!"); - } - return NULL; - } - - void SetRestoreParam(SALOMEDS::SComponent_ptr theComponent, bool theRestore) - { - SALOMEDS::GenericAttribute_var anAttr; - if (theComponent->FindAttribute(anAttr, "AttributeParameter")) { - SALOMEDS::AttributeParameter_var aParams = SALOMEDS::AttributeParameter::_narrow(anAttr); - aParams->SetBool("RestorePath", theRestore); - } - } - - bool GetRestoreParam(SALOMEDS::SComponent_ptr theComponent) - { - SALOMEDS::GenericAttribute_var anAttr; - if (theComponent->FindAttribute(anAttr, "AttributeParameter")) { - SALOMEDS::AttributeParameter_var aParams = SALOMEDS::AttributeParameter::_narrow(anAttr); - if (aParams->IsSet("RestorePath", 2)) { - return aParams->GetBool("RestorePath"); - } - } - return true; - } -}; diff --git a/src/PVGUI/deprecated/PV_Tools.h b/src/PVGUI/deprecated/PV_Tools.h deleted file mode 100644 index 52b913d9..00000000 --- a/src/PVGUI/deprecated/PV_Tools.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : PV_Tools.h -// Author : Vitaly Smetannikov -// Module : PARAVIS -// - -#ifndef __PV_TOOLS_H__ -#define __PV_TOOLS_H__ - -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(SALOMEDS) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -#include - -namespace PARAVIS -{ - class PARAVIS_Base_i; - - SALOMEDS::ListOfFileNames* GetListOfFileNames(const QStringList& theFileNames); - - - SALOMEDS::SComponent_var FindOrCreateParaVisComponent(SALOMEDS::Study_ptr theStudyDocument); - - /*! - * Set/Get flag to restore or not path in paraview state file. - */ - void SetRestoreParam(SALOMEDS::SComponent_ptr theComponent, bool theRestore); - bool GetRestoreParam(SALOMEDS::SComponent_ptr theComponent); - - PARAVIS_Base_i* GET_SERVANT(CORBA::Object_ptr aObj); - -}; - -#endif diff --git a/src/PV_SWIG/CMakeLists.txt b/src/PV_SWIG/CMakeLists.txt index 2c8f4513..769189a2 100644 --- a/src/PV_SWIG/CMakeLists.txt +++ b/src/PV_SWIG/CMakeLists.txt @@ -25,23 +25,14 @@ IF(SALOME_LIGHT_ONLY) presentations.py ) ELSE(SALOME_LIGHT_ONLY) - IF(SALOME_PARAVIS_MINIMAL_CORBA) - # Use another set of Python files redirecting the API directly + # Use a set of Python files redirecting the API directly # to the original ParaView modules. LIST(APPEND _PYFILES_TO_INSTALL - no_wrap/pvserver.py - no_wrap/pvsimple.py - no_wrap/presentations.py - no_wrap/paravisSM.py - ) - ELSE() - LIST(APPEND _PYFILES_TO_INSTALL - paravis.py - paravisSM.py + pvserver.py pvsimple.py presentations.py + paravisSM.py ) - ENDIF() ENDIF(SALOME_LIGHT_ONLY) INSTALL_AND_COMPILE_PYTHON_FILE("${_PYFILES_TO_INSTALL}" ${SALOME_INSTALL_PYTHON}) diff --git a/src/PV_SWIG/no_wrap/paravisSM.py b/src/PV_SWIG/no_wrap/paravisSM.py deleted file mode 100644 index 11d6bf39..00000000 --- a/src/PV_SWIG/no_wrap/paravisSM.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -r""" This module is a direct forward to the initial -'servermanager' module of ParaView. We keep it for backward compatibility only. -""" - -from paraview import servermanager - -for name in dir(servermanager): - if not name.startswith("__"): - globals()[name] = getattr(servermanager, name) -del servermanager - diff --git a/src/PV_SWIG/no_wrap/presentations.py b/src/PV_SWIG/no_wrap/presentations.py deleted file mode 100644 index 979d3380..00000000 --- a/src/PV_SWIG/no_wrap/presentations.py +++ /dev/null @@ -1,2659 +0,0 @@ -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -""" -This module is intended to provide Python API for building presentations -typical for Post-Pro module (Scalar Map, Deformed Shape, Vectors, etc.) -""" - - -from __future__ import division -##from __future__ import print_function - -import os -import re -import warnings -from math import sqrt, sin, cos, radians -from string import upper - -# Do not use pv as a short name. -# It is a name of function from numpy and may be redefined implicitly by 'from numpy import *' call. -# import pvsimple as pv -import pvsimple as pvs -#try: -# # TODO(MZN): to be removed (issue with Point Sprite texture) -# #import paravisSM as sm -#except: -# import paraview.simple as pvs -# import paraview.servermanager as sm - - -# Constants -EPS = 1E-3 -FLT_MIN = 1E-37 -VTK_LARGE_FLOAT = 1E+38 -GAP_COEFFICIENT = 0.0001 - - -# Globals -_current_bar = None -_med_field_sep = '@@][@@' - - -# Enumerations -class PrsTypeEnum: - """ - Post-Pro presentation types. - """ - MESH = 0 - SCALARMAP = 1 - ISOSURFACES = 2 - CUTPLANES = 3 - CUTLINES = 4 - DEFORMEDSHAPE = 5 - DEFORMEDSHAPESCALARMAP = 6 - VECTORS = 7 - PLOT3D = 8 - STREAMLINES = 9 - GAUSSPOINTS = 10 - - _type2name = {MESH: 'Mesh', - SCALARMAP: 'Scalar Map', - ISOSURFACES: 'Iso Surfaces', - CUTPLANES: 'Cut Planes', - CUTLINES: 'Cut Lines', - DEFORMEDSHAPE: 'Deformed Shape', - DEFORMEDSHAPESCALARMAP: 'Deformed Shape And Scalar Map', - VECTORS: 'Vectors', - PLOT3D: 'Plot3D', - STREAMLINES: 'Stream Lines', - GAUSSPOINTS: 'Gauss Points'} - - @classmethod - def get_name(cls, type): - """Return presentaion name by its type.""" - return cls._type2name[type] - - -class EntityType: - """ - Entity types. - """ - NODE = 0 - CELL = 1 - - _type2name = {NODE: 'P1', - CELL: 'P0'} - - _name2type = {'P1': NODE, - 'P0': CELL} - - _type2pvtype = {NODE: 'POINT_DATA', - CELL: 'CELL_DATA'} - - @classmethod - def get_name(cls, type): - """Return entity name (used in full group names) by its type.""" - return cls._type2name[type] - - @classmethod - def get_type(cls, name): - """Return entity type by its name (used in full group names).""" - return cls._name2type[name] - - @classmethod - def get_pvtype(cls, type): - """Return entity type from ['CELL_DATA', 'POINT_DATA']""" - return cls._type2pvtype[type] - - -class Orientation: - """Orientation types. - - Defines a set of plane orientation possibilities: - AUTO: plane orientation should be calculated. - XY: plane formed by X and Y axis. - YZ: plane formed by Y and Z axis. - ZX: plane formed by Z and X axis - - """ - AUTO = 0 - XY = 1 - YZ = 2 - ZX = 3 - - -class GlyphPos: - """Glyph positions. - - Set of elements defining the position of the vector head: - CENTER: in the center of the vector - TAIL: in the tail of the vector - HEAD: in the head of the vector - - """ - CENTER = 0 - TAIL = 1 - HEAD = 2 - - -class GaussType: - """ - Gauss Points primitive types. - """ - SPRITE = 0 - POINT = 1 - SPHERE = 2 - - _type2mode = {SPRITE: 'Texture', - POINT: 'SimplePoint', - SPHERE: 'Sphere (Texture)'} - - @classmethod - def get_mode(cls, type): - """Return paraview point sprite mode by the primitive type.""" - return cls._type2mode[type] - - -# Auxiliary functions - -def get_field_mesh_name(full_field_name): - """Return mesh name of the field by its full name.""" - aList = full_field_name.split('/') - if len(aList) >= 2 : - field_name = full_field_name.split('/')[1] - return field_name - - -def get_field_entity(full_field_name): - """Return entity type of the field by its full name.""" - aList = full_field_name.split(_med_field_sep) - if len(aList) == 2 : - entity_name = full_field_name.split(_med_field_sep)[-1] - entity = EntityType.get_type(entity_name) - return entity - - -def get_field_short_name(full_field_name): - """Return short name of the field by its full name.""" - aList = full_field_name.split('/') - if len(aList) == 4 : - short_name_with_type = full_field_name.split('/')[-1] - short_name = short_name_with_type.split(_med_field_sep)[0] - return short_name - - -def find_mesh_full_name(proxy, short_mesh_name): - """Return full mesh path by short mesh name, if found""" - proxy.UpdatePipeline() - all_mesh_names = get_mesh_full_names(proxy) - for name in all_mesh_names: - if short_mesh_name == get_field_short_name(name): - return name - - -def process_prs_for_test(prs, view, picture_name, show_bar=True): - """Show presentation and record snapshot image. - - Arguments: - prs: the presentation to show - view: the render view - picture_name: the full name of the graphics file to save - show_bar: to show scalar bar or not - - """ - # Show the presentation only - display_only(prs, view) - - # Show scalar bar - if show_bar and _current_bar: - _current_bar.Visibility = 1 - - # Reset the view - reset_view(view) - - # Create a directory for screenshot if necessary - file_name = re.sub("\s+", "_", picture_name) - pic_dir = os.path.dirname(picture_name) - if not os.path.exists(pic_dir): - os.makedirs(pic_dir) - - # Save picture - pvs.WriteImage(file_name, view=view, Magnification=1) - - -def reset_view(view=None): - """Reset the view. - - Set predefined (taken from Post-Pro) camera settings. - If the view is not passed, the active view is used. - - """ - if not view: - view = pvs.GetRenderView() - - # Camera preferences - view.CameraFocalPoint = [0.0, 0.0, 0.0] - view.CameraViewUp = [0.0, 0.0, 1.0] - view.CameraPosition = [738.946, -738.946, 738.946] - - # Turn on the headligth - view.LightSwitch = 1 - view.LightIntensity = 0.5 - - # Use parallel projection - view.CameraParallelProjection = 1 - - view.ResetCamera() - pvs.Render(view=view) - - -def hide_all(view, to_remove=False): - """Hide all representations in the view.""" - if not view: - view = pvs.GetRenderView() - - rep_list = view.Representations - for rep in rep_list: - if hasattr(rep, 'Visibility') and rep.Visibility != 0: - rep.Visibility = 0 - if to_remove: - view.Representations.remove(rep) - pvs.Render(view=view) - - -def display_only(prs, view=None): - """Display only the given presentation in the view.""" - if not view: - view = pvs.GetRenderView() - - rep_list = view.Representations - for rep in rep_list: - if hasattr(rep, 'Visibility'): - rep.Visibility = (rep == prs) - pvs.Render(view=view) - - -def set_visible_lines(xy_prs, lines): - """Set visible only the given lines for XYChartRepresentation.""" - sv = xy_prs.GetProperty("SeriesVisibilityInfo").GetData() - visible = '0' - - for i in xrange(0, len(sv)): - if i % 2 == 0: - line_name = sv[i] - if line_name in lines: - visible = '1' - else: - visible = '0' - else: - sv[i] = visible - - xy_prs.SeriesVisibility = sv - - -def check_vector_mode(vector_mode, nb_components): - """Check vector mode. - - Check if vector mode is correct for the data array with the - given number of components. - - Arguments: - vector_mode: 'Magnitude', 'X', 'Y' or 'Z' - nb_components: number of component in the data array - - Raises: - ValueError: in case of the vector mode is unexistent - or nonapplicable. - - """ - if vector_mode not in ('Magnitude', 'X', 'Y', 'Z'): - raise ValueError("Unexistent vector mode: " + vector_mode) - - if ((nb_components == 1 and (vector_mode == 'Y' or vector_mode == 'Z')) or - (nb_components == 2 and vector_mode == 'Z')): - raise ValueError("Incorrect vector mode " + vector_mode + " for " + - nb_components + "-component field") - - -def get_vector_component(vector_mode): - """Get vector component as ineger. - - Translate vector component notation from string - to integer: - 'Magnitude': -1 - 'X': 0 - 'Y': 1 - 'Z': 2 - - """ - vcomponent = -1 - - if vector_mode == 'X': - vcomponent = 0 - elif vector_mode == 'Y': - vcomponent = 1 - elif vector_mode == 'Z': - vcomponent = 2 - - return vcomponent - - -def get_data_range(proxy, entity, field_name, vector_mode='Magnitude', - cut_off=False): - """Get data range for the field. - - Arguments: - proxy: the pipeline object, containig data array for the field - entity: the field entity - field_name: the field name - vector_mode: the vector mode ('Magnitude', 'X', 'Y' or 'Z') - - Returns: - Data range as [min, max] - - """ - proxy.UpdatePipeline() - entity_data_info = None - field_data = proxy.GetFieldDataInformation() - - if field_name in field_data.keys(): - entity_data_info = field_data - elif entity == EntityType.CELL: - entity_data_info = proxy.GetCellDataInformation() - elif entity == EntityType.NODE: - entity_data_info = proxy.GetPointDataInformation() - - data_range = [] - - if field_name in entity_data_info.keys(): - vcomp = get_vector_component(vector_mode) - data_range = entity_data_info[field_name].GetComponentRange(vcomp) - else: - pv_entity = EntityType.get_pvtype(entity) - warnings.warn("Field " + field_name + - " is unknown for " + pv_entity + "!") - - # Cut off the range - if cut_off and (data_range[0] <= data_range[1]): - data_range = list(data_range) - delta = abs(data_range[1] - data_range[0]) * GAP_COEFFICIENT - data_range[0] += delta - data_range[1] -= delta - - return data_range - - -def get_bounds(proxy): - """Get bounds of the proxy in 3D.""" - proxy.UpdatePipeline() - dataInfo = proxy.GetDataInformation() - bounds_info = dataInfo.GetBounds() - return bounds_info - - -def get_x_range(proxy): - """Get X range of the proxy bounds in 3D.""" - proxy.UpdatePipeline() - bounds_info = get_bounds(proxy) - return bounds_info[0:2] - - -def get_y_range(proxy): - """Get Y range of the proxy bounds in 3D.""" - proxy.UpdatePipeline() - bounds_info = get_bounds(proxy) - return bounds_info[2:4] - - -def get_z_range(proxy): - """Get Z range of the proxy bounds in 3D.""" - proxy.UpdatePipeline() - bounds_info = get_bounds(proxy) - return bounds_info[4:6] - - -def is_planar_input(proxy): - """Check if the given input is planar.""" - proxy.UpdatePipeline() - bounds_info = get_bounds(proxy) - - if (abs(bounds_info[0] - bounds_info[1]) <= FLT_MIN or - abs(bounds_info[2] - bounds_info[3]) <= FLT_MIN or - abs(bounds_info[4] - bounds_info[5]) <= FLT_MIN): - return True - - return False - - -def is_data_on_cells(proxy, field_name): - """Check the existence of a field on cells with the given name.""" - proxy.UpdatePipeline() - cell_data_info = proxy.GetCellDataInformation() - return (field_name in cell_data_info.keys()) - - -def is_empty(proxy): - """Check if the object contains any points or cells. - - Returns: - True: if the given proxy doesn't contain any points or cells - False: otherwise - - """ - proxy.UpdatePipeline() - data_info = proxy.GetDataInformation() - - nb_cells = data_info.GetNumberOfCells() - nb_points = data_info.GetNumberOfPoints() - - return not(nb_cells + nb_points) - - -def get_orientation(proxy): - """Get the optimum cutting plane orientation for Plot 3D.""" - proxy.UpdatePipeline() - orientation = Orientation.XY - - bounds = get_bounds(proxy) - delta = [bounds[1] - bounds[0], - bounds[3] - bounds[2], - bounds[5] - bounds[4]] - - if (delta[0] >= delta[1] and delta[0] >= delta[2]): - if (delta[1] >= delta[2]): - orientation = Orientation.XY - else: - orientation = Orientation.ZX - elif (delta[1] >= delta[0] and delta[1] >= delta[2]): - if (delta[0] >= delta[2]): - orientation = Orientation.XY - else: - orientation = Orientation.YZ - elif (delta[2] >= delta[0] and delta[2] >= delta[1]): - if (delta[0] >= delta[1]): - orientation = Orientation.ZX - else: - orientation = Orientation.YZ - - return orientation - - -def dot_product(a, b): - """Dot product of two 3-vectors.""" - dot = a[0] * b[0] + a[1] * b[1] + a[2] * b[2] - return dot - - -def multiply3x3(a, b): - """Mutltiply one 3x3 matrix by another.""" - c = [[0, 0, 0], - [0, 0, 0], - [0, 0, 0]] - - for i in xrange(3): - c[0][i] = a[0][0] * b[0][i] + a[0][1] * b[1][i] + a[0][2] * b[2][i] - c[1][i] = a[1][0] * b[0][i] + a[1][1] * b[1][i] + a[1][2] * b[2][i] - c[2][i] = a[2][0] * b[0][i] + a[2][1] * b[1][i] + a[2][2] * b[2][i] - - return c - - -def get_rx(ang): - """Get X rotation matrix by angle.""" - rx = [[1.0, 0.0, 0.0], - [0.0, cos(ang), -sin(ang)], - [0.0, sin(ang), cos(ang)]] - - return rx - - -def get_ry(ang): - """Get Y rotation matrix by angle.""" - ry = [[cos(ang), 0.0, sin(ang)], - [0.0, 1.0, 0.0], - [-sin(ang), 0.0, cos(ang)]] - - return ry - - -def get_rz(ang): - """Get Z rotation matrix by angle.""" - rz = [[cos(ang), -sin(ang), 0.0], - [sin(ang), cos(ang), 0.0], - [0.0, 0.0, 1.0]] - - return rz - - -def get_normal_by_orientation(orientation, ang1=0, ang2=0): - """Get normal for the plane by its orientation.""" - i_plane = 0 - rotation = [[], [], []] - rx = ry = rz = [[1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0]] - - normal = [0.0, 0.0, 0.0] - if orientation == Orientation.XY: - if abs(ang1) > EPS: - rx = get_rx(ang1) - if abs(ang2) > EPS: - ry = get_ry(ang2) - rotation = multiply3x3(rx, ry) - i_plane = 2 - elif orientation == Orientation.ZX: - if abs(ang1) > EPS: - rz = get_rz(ang1) - if abs(ang2) > EPS: - rx = get_rx(ang2) - rotation = multiply3x3(rz, rx) - i_plane = 1 - elif orientation == Orientation.YZ: - if abs(ang1) > EPS: - ry = get_ry(ang1) - if abs(ang2) > EPS: - rz = get_rz(ang2) - rotation = multiply3x3(ry, rz) - i_plane = 0 - - for i in xrange(0, 3): - normal[i] = rotation[i][i_plane] - - return normal - - -def get_bound_project(bound_box, dir): - """Get bounds projection""" - bound_points = [[bound_box[0], bound_box[2], bound_box[4]], - [bound_box[1], bound_box[2], bound_box[4]], - [bound_box[0], bound_box[3], bound_box[4]], - [bound_box[1], bound_box[3], bound_box[4]], - [bound_box[0], bound_box[2], bound_box[5]], - [bound_box[1], bound_box[2], bound_box[5]], - [bound_box[0], bound_box[3], bound_box[5]], - [bound_box[1], bound_box[3], bound_box[5]]] - - bound_prj = [0, 0, 0] - bound_prj[0] = dot_product(dir, bound_points[0]) - bound_prj[1] = bound_prj[0] - - for i in xrange(1, 8): - tmp = dot_product(dir, bound_points[i]) - if bound_prj[1] < tmp: - bound_prj[1] = tmp - if bound_prj[0] > tmp: - bound_prj[0] = tmp - - bound_prj[2] = bound_prj[1] - bound_prj[0] - bound_prj[1] = bound_prj[0] + (1.0 - EPS) * bound_prj[2] - bound_prj[0] = bound_prj[0] + EPS * bound_prj[2] - bound_prj[2] = bound_prj[1] - bound_prj[0] - - return bound_prj - - -def get_positions(nb_planes, dir, bounds, displacement): - """Compute plane positions.""" - positions = [] - bound_prj = get_bound_project(bounds, dir) - if nb_planes > 1: - step = bound_prj[2] / (nb_planes - 1) - abs_displacement = step * displacement - start_pos = bound_prj[0] - 0.5 * step + abs_displacement - for i in xrange(nb_planes): - pos = start_pos + i * step - positions.append(pos) - else: - pos = bound_prj[0] + bound_prj[2] * displacement - positions.append(pos) - - return positions - - -def get_contours(scalar_range, nb_contours): - """Generate contour values.""" - contours = [] - for i in xrange(nb_contours): - pos = scalar_range[0] + i * ( - scalar_range[1] - scalar_range[0]) / (nb_contours - 1) - contours.append(pos) - - return contours - - -def get_nb_components(proxy, entity, field_name): - """Return number of components for the field.""" - proxy.UpdatePipeline() - entity_data_info = None - field_data = proxy.GetFieldDataInformation() - - if field_name in field_data.keys(): - entity_data_info = field_data - elif entity == EntityType.CELL: - select_cells_with_data(proxy, on_cells=[field_name]) - entity_data_info = proxy.GetCellDataInformation() - elif entity == EntityType.NODE: - select_cells_with_data(proxy, on_points=[field_name]) - entity_data_info = proxy.GetPointDataInformation() - - nb_comp = None - if field_name in entity_data_info.keys(): - nb_comp = entity_data_info[field_name].GetNumberOfComponents() - else: - pv_entity = EntityType.get_pvtype(entity) - raise ValueError("Field " + field_name + - " is unknown for " + pv_entity + "!") - - return nb_comp - - -def get_scale_factor(proxy): - """Compute scale factor.""" - if not proxy: - return 0.0 - - proxy.UpdatePipeline() - data_info = proxy.GetDataInformation() - - nb_cells = data_info.GetNumberOfCells() - nb_points = data_info.GetNumberOfPoints() - nb_elements = nb_cells if nb_cells > 0 else nb_points - bounds = get_bounds(proxy) - - volume = 1 - vol = dim = 0 - - for i in xrange(0, 6, 2): - vol = abs(bounds[i + 1] - bounds[i]) - if vol > 0: - dim += 1 - volume *= vol - - if nb_elements == 0 or dim < 1 / VTK_LARGE_FLOAT: - return 0 - - volume /= nb_elements - - return pow(volume, 1 / dim) - - -def get_default_scale(prs_type, proxy, entity, field_name): - """Get default scale factor.""" - proxy.UpdatePipeline() - data_range = get_data_range(proxy, entity, field_name) - - if prs_type == PrsTypeEnum.DEFORMEDSHAPE: - EPS = 1.0 / VTK_LARGE_FLOAT - if abs(data_range[1]) > EPS: - scale_factor = get_scale_factor(proxy) - return scale_factor / data_range[1] - elif prs_type == PrsTypeEnum.PLOT3D: - bounds = get_bounds(proxy) - length = sqrt((bounds[1] - bounds[0]) ** 2 + - (bounds[3] - bounds[2]) ** 2 + - (bounds[5] - bounds[4]) ** 2) - - EPS = 0.3 - if data_range[1] > 0: - return length / data_range[1] * EPS - - return 0 - - -def get_calc_magnitude(proxy, array_entity, array_name): - """Compute magnitude for the given vector array via Calculator. - - Returns: - the calculator object. - - """ - proxy.UpdatePipeline() - calculator = None - - # Transform vector array to scalar array if possible - nb_components = get_nb_components(proxy, array_entity, array_name) - if (nb_components > 1): - calculator = pvs.Calculator(proxy) - attribute_mode = "Point Data" - if array_entity != EntityType.NODE: - attribute_mode = "Cell Data" - calculator.AttributeMode = attribute_mode - if (nb_components == 2): - # Workaroud: calculator unable to compute magnitude - # if number of components equal to 2 - func = "sqrt(" + array_name + "_X^2+" + array_name + "_Y^2)" - calculator.Function = func - else: - calculator.Function = "mag(" + array_name + ")" - calculator.ResultArrayName = array_name + "_magnitude" - calculator.UpdatePipeline() - - return calculator - - -def get_add_component_calc(proxy, array_entity, array_name): - """Creates 3-component array from 2-component. - - The first two components is from the original array. The 3rd component - is zero. - If the number of components is not equal to 2 - return original array name. - - Returns: - the calculator object. - - """ - proxy.UpdatePipeline() - calculator = None - - nb_components = get_nb_components(proxy, array_entity, array_name) - if nb_components == 2: - calculator = pvs.Calculator(proxy) - attribute_mode = "Point Data" - if array_entity != EntityType.NODE: - attribute_mode = "Cell Data" - calculator.AttributeMode = attribute_mode - expression = "iHat * " + array_name + "_X + jHat * " + array_name + "_Y + kHat * 0" - calculator.Function = expression - calculator.ResultArrayName = array_name + "_3c" - calculator.UpdatePipeline() - - return calculator - - -def select_all_cells(proxy): - """Select all cell types. - - Used in creation of mesh/submesh presentation. - - """ - proxy.UpdatePipeline() - extractCT = pvs.ExtractCellType() - extractCT.AllGeoTypes = extractCT.GetProperty("GeoTypesInfo")[::2] - extractCT.UpdatePipelineInformation() - - -def select_cells_with_data(proxy, on_points=[], on_cells=[], on_gauss=[]): - """Select cell types with data. - - Only cell types with data for the given fields will be selected. - If no fields defined (neither on points nor on cells) only cell - types with data for even one field (from available) will be selected. - - """ - if not proxy.GetProperty("FieldsTreeInfo"): - return - - proxy.UpdatePipeline() - if not hasattr(proxy, 'Entity'): - fields_info = proxy.GetProperty("FieldsTreeInfo")[::2] - arr_name_with_dis=[elt.split("/")[-1] for elt in fields_info] - - proxy.AllArrays = [] - proxy.UpdatePipeline() - - fields = [] - for name in on_gauss: - fields.append(name+_med_field_sep+'GAUSS') - for name in on_cells: - fields.append(name+_med_field_sep+'P0') - for name in on_points: - fields.append(name+_med_field_sep+'P1') - - field_list = [] - for name in fields: - if arr_name_with_dis.count(name) > 0: - index = arr_name_with_dis.index(name) - field_list.append(fields_info[index]) - - proxy.AllArrays = field_list - proxy.UpdatePipeline() - return len(field_list) != 0 - - # TODO: VTN. Looks like this code is out of date. - - #all_cell_types = proxy.CellTypes.Available - all_cell_types = proxy.Entity.Available - all_arrays = list(proxy.CellArrays.GetData()) - all_arrays.extend(proxy.PointArrays.GetData()) - - if not all_arrays: - file_name = proxy.FileName.split(os.sep)[-1] - print "Warning: " + file_name + " doesn't contain any data array." - - # List of cell types to be selected - cell_types_on = [] - - for cell_type in all_cell_types: - #proxy.CellTypes = [cell_type] - proxy.Entity = [cell_type] - proxy.UpdatePipeline() - - cell_arrays = proxy.GetCellDataInformation().keys() - point_arrays = proxy.GetPointDataInformation().keys() - - if on_points or on_cells: - if on_points is None: - on_points = [] - if on_cells is None: - on_cells = [] - - if (all(array in cell_arrays for array in on_cells) and - all(array in point_arrays for array in on_points)): - # Add cell type to the list - cell_types_on.append(cell_type) - else: - in_arrays = lambda array: ((array in cell_arrays) or - (array in point_arrays)) - if any(in_arrays(array) for array in all_arrays): - cell_types_on.append(cell_type) - - # Select cell types - #proxy.CellTypes = cell_types_on - proxy.Entity = cell_types_on - proxy.UpdatePipeline() - -def if_possible(proxy, field_name, entity, prs_type, extrGrps=None): - """Check if the presentation creation is possible on the given field.""" - proxy.UpdatePipeline() - result = True - if (prs_type == PrsTypeEnum.DEFORMEDSHAPE or - prs_type == PrsTypeEnum.DEFORMEDSHAPESCALARMAP or - prs_type == PrsTypeEnum.VECTORS or - prs_type == PrsTypeEnum.STREAMLINES): - nb_comp = get_nb_components(proxy, entity, field_name) - result = (nb_comp > 1) - elif (prs_type == PrsTypeEnum.GAUSSPOINTS): - result = (entity == EntityType.CELL or - field_name in proxy.QuadraturePointArrays.Available) - elif (prs_type == PrsTypeEnum.MESH): - result = len(get_group_names(extrGrps)) > 0 - - return result - - -def add_scalar_bar(field_name, nb_components, - vector_mode, lookup_table, time_value): - """Add scalar bar with predefined properties.""" - global _current_bar - - # Construct bar title - title = "\n".join([field_name, str(time_value)]) - if nb_components > 1: - title = "\n".join([title, vector_mode]) - - # Create scalar bar - scalar_bar = pvs.CreateScalarBar(Enabled=1) - scalar_bar.Orientation = 'Vertical' - scalar_bar.Title = title - scalar_bar.LookupTable = lookup_table - - # Set default properties same as in Post-Pro - scalar_bar.NumberOfLabels = 5 - scalar_bar.AutomaticLabelFormat = 0 - scalar_bar.LabelFormat = '%-#6.6g' - # Title - scalar_bar.TitleFontFamily = 'Arial' - scalar_bar.TitleFontSize = 8 - scalar_bar.TitleBold = 1 - scalar_bar.TitleItalic = 1 - scalar_bar.TitleShadow = 1 - # Labels - scalar_bar.LabelFontFamily = 'Arial' - scalar_bar.LabelFontSize = 8 - scalar_bar.LabelBold = 1 - scalar_bar.LabelItalic = 1 - scalar_bar.LabelShadow = 1 - - # Add the scalar bar to the view - pvs.GetRenderView().Representations.append(scalar_bar) - - # Reassign the current bar - _current_bar = scalar_bar - - return scalar_bar - - -def get_bar(): - """Get current scalar bar.""" - global _current_bar - - return _current_bar - - -def get_lookup_table(field_name, nb_components, vector_mode='Magnitude'): - """Get lookup table for the given field.""" - lookup_table = pvs.GetLookupTableForArray(field_name, nb_components) - - if vector_mode == 'Magnitude': - lookup_table.VectorMode = vector_mode - elif vector_mode == 'X': - lookup_table.VectorMode = 'Component' - lookup_table.VectorComponent = 0 - elif vector_mode == 'Y': - lookup_table.VectorMode = 'Component' - lookup_table.VectorComponent = 1 - elif vector_mode == 'Z': - lookup_table.VectorMode = 'Component' - lookup_table.VectorComponent = 2 - else: - raise ValueError("Incorrect vector mode: " + vector_mode) - - lookup_table.Discretize = 0 - lookup_table.ColorSpace = 'HSV' - lookup_table.LockScalarRange = 0 - - return lookup_table - - -def get_group_mesh_name(full_group_name): - """Return mesh name of the group by its full name.""" - aList = full_group_name.split('/') - if len(aList) >= 2 : - group_name = full_group_name.split('/')[1] - return group_name - - -def get_group_entity(full_group_name): - """Return entity type of the group by its full name.""" - aList = full_group_name.split('/') - if len(aList) >= 3 : - entity_name = full_group_name.split('/')[2] - entity = EntityType.get_type(entity_name) - return entity - - -def get_group_short_name(full_group_name): - """Return short name of the group by its full name.""" - short_name = re.sub('^GRP_', '', full_group_name) - return short_name - - -def get_mesh_full_names(proxy): - """Return all mesh names in the given proxy as a set.""" - proxy.UpdatePipeline() - fields = proxy.GetProperty("FieldsTreeInfo")[::2] - mesh_full_names = set([item for item in fields if get_field_mesh_name(item) == get_field_short_name(item)]) - return mesh_full_names - - -def get_group_names(extrGrps): - """Return full names of all groups of the given 'ExtractGroup' filter object. - """ - group_names = filter(lambda x:x[:4]=="GRP_",list(extrGrps.GetProperty("GroupsFlagsInfo")[::2])) - return group_names - - -def get_time(proxy, timestamp_nb): - """Get time value by timestamp number.""" - proxy.UpdatePipeline() - # Check timestamp number - timestamps = [] - - if (hasattr(proxy, 'TimestepValues')): - timestamps = proxy.TimestepValues.GetData() - elif (hasattr(proxy.Input, 'TimestepValues')): - timestamps = proxy.Input.TimestepValues.GetData() - - length = len(timestamps) - if (timestamp_nb > 0 and (timestamp_nb - 1) not in xrange(length) ) or (timestamp_nb < 0 and -timestamp_nb > length): - raise ValueError("Timestamp number is out of range: " + str(timestamp_nb)) - - # Return time value - if timestamp_nb > 0: - return timestamps[timestamp_nb - 1] - else: - return timestamps[timestamp_nb] - -def create_prs(prs_type, proxy, field_entity, field_name, timestamp_nb): - """Auxiliary function. - - Build presentation of the given type on the given field and - timestamp number. - Set the presentation properties like visu.CreatePrsForResult() do. - - """ - proxy.UpdatePipeline() - prs = None - - if prs_type == PrsTypeEnum.SCALARMAP: - prs = ScalarMapOnField(proxy, field_entity, field_name, timestamp_nb) - elif prs_type == PrsTypeEnum.CUTPLANES: - prs = CutPlanesOnField(proxy, field_entity, field_name, timestamp_nb, - orientation=Orientation.ZX) - elif prs_type == PrsTypeEnum.CUTLINES: - prs = CutLinesOnField(proxy, field_entity, field_name, timestamp_nb, - orientation1=Orientation.XY, - orientation2=Orientation.ZX) - elif prs_type == PrsTypeEnum.DEFORMEDSHAPE: - prs = DeformedShapeOnField(proxy, field_entity, - field_name, timestamp_nb) - elif prs_type == PrsTypeEnum.DEFORMEDSHAPESCALARMAP: - prs = DeformedShapeAndScalarMapOnField(proxy, field_entity, - field_name, timestamp_nb) - elif prs_type == PrsTypeEnum.VECTORS: - prs = VectorsOnField(proxy, field_entity, field_name, timestamp_nb) - elif prs_type == PrsTypeEnum.PLOT3D: - prs = Plot3DOnField(proxy, field_entity, field_name, timestamp_nb) - elif prs_type == PrsTypeEnum.ISOSURFACES: - prs = IsoSurfacesOnField(proxy, field_entity, field_name, timestamp_nb) - elif prs_type == PrsTypeEnum.GAUSSPOINTS: - prs = GaussPointsOnField(proxy, field_entity, field_name, timestamp_nb) - elif prs_type == PrsTypeEnum.STREAMLINES: - prs = StreamLinesOnField(proxy, field_entity, field_name, timestamp_nb) - else: - raise ValueError("Unexistent presentation type.") - - return prs - - -# Functions for building Post-Pro presentations -def ScalarMapOnField(proxy, entity, field_name, timestamp_nb, - vector_mode='Magnitude'): - """Creates Scalar Map presentation on the given field. - - Arguments: - proxy: the pipeline object, containig data - entity: the entity type from PrsTypeEnum - field_name: the field name - timestamp_nb: the number of time step (1, 2, ...) - vector_mode: the mode of transformation of vector values - into scalar values, applicable only if the field contains vector values. - Possible modes: 'Magnitude', 'X', 'Y' or 'Z'. - - Returns: - Scalar Map as representation object. - - """ - proxy.UpdatePipeline() - # We don't need mesh parts with no data on them - if entity == EntityType.NODE: - select_cells_with_data(proxy, on_points=[field_name]) - else: - select_cells_with_data(proxy, on_cells=[field_name]) - - # Check vector mode - nb_components = get_nb_components(proxy, entity, field_name) - check_vector_mode(vector_mode, nb_components) - - # Get time value - time_value = get_time(proxy, timestamp_nb) - - # Set timestamp - pvs.GetRenderView().ViewTime = time_value - pvs.UpdatePipeline(time_value, proxy) - - # Get Scalar Map representation object - scalarmap = pvs.GetRepresentation(proxy) - - # Get lookup table - lookup_table = get_lookup_table(field_name, nb_components, vector_mode) - - # Set field range if necessary - data_range = get_data_range(proxy, entity, - field_name, vector_mode) - lookup_table.LockScalarRange = 1 - lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] - # Set properties - scalarmap.ColorArrayName = (EntityType.get_pvtype(entity), field_name) - scalarmap.LookupTable = lookup_table - - # Add scalar bar - bar_title = field_name + ", " + str(time_value) - if (nb_components > 1): - bar_title += "\n" + vector_mode - add_scalar_bar(field_name, nb_components, vector_mode, - lookup_table, time_value) - - return scalarmap - - -def CutPlanesOnField(proxy, entity, field_name, timestamp_nb, - nb_planes=10, orientation=Orientation.YZ, - angle1=0, angle2=0, - displacement=0.5, vector_mode='Magnitude'): - """Creates Cut Planes presentation on the given field. - - Arguments: - proxy: the pipeline object, containig data - entity: the entity type from PrsTypeEnum - field_name: the field name - timestamp_nb: the number of time step (1, 2, ...) - nb_planes: number of cutting planes - orientation: cutting planes orientation in 3D space - angle1: rotation of the planes in 3d space around the first axis of the - selected orientation (X axis for XY, Y axis for YZ, Z axis for ZX). - The angle of rotation is set in degrees. Acceptable range: [-45, 45]. - angle2: rotation of the planes in 3d space around the second axis of the - selected orientation. Acceptable range: [-45, 45]. - displacement: the displacement of the planes into one or another side - vector_mode: the mode of transformation of vector values - into scalar values, applicable only if the field contains vector values. - Possible modes: 'Magnitude', 'X', 'Y' or 'Z'. - - Returns: - Cut Planes as representation object. - - """ - proxy.UpdatePipeline() - if entity == EntityType.NODE: - select_cells_with_data(proxy, on_points=[field_name]) - else: - select_cells_with_data(proxy, on_cells=[field_name]) - - # Check vector mode - nb_components = get_nb_components(proxy, entity, field_name) - check_vector_mode(vector_mode, nb_components) - - # Get time value - time_value = get_time(proxy, timestamp_nb) - - # Set timestamp - pvs.GetRenderView().ViewTime = time_value - pvs.UpdatePipeline(time_value, proxy) - - # Create slice filter - slice_filter = pvs.Slice(proxy) - slice_filter.SliceType = "Plane" - - # Set cut planes normal - normal = get_normal_by_orientation(orientation, - radians(angle1), radians(angle2)) - slice_filter.SliceType.Normal = normal - - # Set cut planes positions - positions = get_positions(nb_planes, normal, - get_bounds(proxy), displacement) - slice_filter.SliceOffsetValues = positions - - # Get Cut Planes representation object - cut_planes = pvs.GetRepresentation(slice_filter) - - # Get lookup table - lookup_table = get_lookup_table(field_name, nb_components, vector_mode) - - # Set field range if necessary - data_range = get_data_range(proxy, entity, - field_name, vector_mode) - lookup_table.LockScalarRange = 1 - lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] - - # Set properties - cut_planes.ColorArrayName = (EntityType.get_pvtype(entity), field_name) - cut_planes.LookupTable = lookup_table - - # Add scalar bar - add_scalar_bar(field_name, nb_components, - vector_mode, lookup_table, time_value) - - return cut_planes - - -def CutLinesOnField(proxy, entity, field_name, timestamp_nb, - nb_lines=10, - orientation1=Orientation.XY, - base_angle1=0, base_angle2=0, - orientation2=Orientation.YZ, - cut_angle1=0, cut_angle2=0, - displacement1=0.5, displacement2=0.5, - generate_curves=False, - vector_mode='Magnitude'): - """Creates Cut Lines presentation on the given field. - - Arguments: - proxy: the pipeline object, containig data - entity: the entity type from PrsTypeEnum - field_name: the field name - timestamp_nb: the number of time step (1, 2, ...) - nb_lines: number of lines - orientation1: base plane orientation in 3D space - base_angle1: rotation of the base plane in 3d space around the first - axis of the orientation1 (X axis for XY, Y axis for YZ, Z axis for ZX). - The angle of rotation is set in degrees. Acceptable range: [-45, 45]. - base_angle2: rotation of the base plane in 3d space around the second - axis of the orientation1. Acceptable range: [-45, 45]. - orientation2: cutting planes orientation in 3D space - cut_angle1: rotation of the cut planes in 3d space around the first - axis of the orientation2. Acceptable range: [-45, 45]. - cut_angle2: rotation of the cuting planes in 3d space around the second - axis of the orientation2. Acceptable range: [-45, 45]. - displacement1: base plane displacement - displacement2: cutting planes displacement - generate_curves: if true, 'PlotOverLine' filter will be created - for each cut line - vector_mode: the mode of transformation of vector values - into scalar values, applicable only if the field contains vector values. - Possible modes: 'Magnitude', 'X', 'Y' or 'Z'. - - Returns: - Cut Lines as representation object if generate_curves == False, - (Cut Lines as representation object, list of 'PlotOverLine') otherwise - - """ - proxy.UpdatePipeline() - if entity == EntityType.NODE: - select_cells_with_data(proxy, on_points=[field_name]) - else: - select_cells_with_data(proxy, on_cells=[field_name]) - - # Check vector mode - nb_components = get_nb_components(proxy, entity, field_name) - check_vector_mode(vector_mode, nb_components) - - # Get time value - time_value = get_time(proxy, timestamp_nb) - - # Set timestamp - pvs.GetRenderView().ViewTime = time_value - pvs.UpdatePipeline(time_value, proxy) - - # Create base plane - base_plane = pvs.Slice(proxy) - base_plane.SliceType = "Plane" - - # Set base plane normal - base_normal = get_normal_by_orientation(orientation1, - radians(base_angle1), - radians(base_angle2)) - base_plane.SliceType.Normal = base_normal - - # Set base plane position - base_position = get_positions(1, base_normal, - get_bounds(proxy), displacement1) - base_plane.SliceOffsetValues = base_position - - # Check base plane - base_plane.UpdatePipeline() - if (base_plane.GetDataInformation().GetNumberOfCells() == 0): - base_plane = proxy - - # Create cutting planes - cut_planes = pvs.Slice(base_plane) - cut_planes.SliceType = "Plane" - - # Set cutting planes normal and get positions - cut_normal = get_normal_by_orientation(orientation2, - radians(cut_angle1), - radians(cut_angle2)) - cut_planes.SliceType.Normal = cut_normal - - # Set cutting planes position - cut_positions = get_positions(nb_lines, cut_normal, - get_bounds(base_plane), displacement2) - - # Generate curves - curves = [] - if generate_curves: - index = 0 - for pos in cut_positions: - # Get points for plot over line objects - cut_planes.SliceOffsetValues = pos - cut_planes.UpdatePipeline() - bounds = get_bounds(cut_planes) - point1 = [bounds[0], bounds[2], bounds[4]] - point2 = [bounds[1], bounds[3], bounds[5]] - - # Create plot over line filter - pol = pvs.PlotOverLine(cut_planes, - Source="High Resolution Line Source") - pvs.RenameSource('Y' + str(index), pol) - pol.Source.Point1 = point1 - pol.Source.Point2 = point2 - pol.UpdatePipeline() - curves.append(pol) - - index += 1 - - cut_planes.SliceOffsetValues = cut_positions - cut_planes.UpdatePipeline() - - # Get Cut Lines representation object - cut_lines = pvs.GetRepresentation(cut_planes) - - # Get lookup table - lookup_table = get_lookup_table(field_name, nb_components, vector_mode) - - # Set field range if necessary - data_range = get_data_range(proxy, entity, - field_name, vector_mode) - lookup_table.LockScalarRange = 1 - lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] - - # Set properties - cut_lines.ColorArrayName = (EntityType.get_pvtype(entity), field_name) - cut_lines.LookupTable = lookup_table - - # Set wireframe represenatation mode - cut_lines.Representation = 'Wireframe' - - # Add scalar bar - add_scalar_bar(field_name, nb_components, - vector_mode, lookup_table, time_value) - - result = cut_lines - # If curves were generated return tuple (cut lines, list of curves) - if curves: - result = cut_lines, curves - - return result - - -def CutSegmentOnField(proxy, entity, field_name, timestamp_nb, - point1, point2, vector_mode='Magnitude'): - """Creates Cut Segment presentation on the given field. - - Arguments: - proxy: the pipeline object, containig data - entity: the entity type from PrsTypeEnum - field_name: the field name - timestamp_nb: the number of time step (1, 2, ...) - point1: set the first point of the segment (as [x, y, z]) - point1: set the second point of the segment (as [x, y, z]) - vector_mode: the mode of transformation of vector values - into scalar values, applicable only if the field contains vector values. - Possible modes: 'Magnitude', 'X', 'Y' or 'Z'. - - Returns: - Cut Segment as 3D representation object. - - """ - proxy.UpdatePipeline() - if entity == EntityType.NODE: - select_cells_with_data(proxy, on_points=[field_name]) - else: - select_cells_with_data(proxy, on_cells=[field_name]) - - # Check vector mode - nb_components = get_nb_components(proxy, entity, field_name) - check_vector_mode(vector_mode, nb_components) - - # Get time value - time_value = get_time(proxy, timestamp_nb) - - # Set timestamp - pvs.GetRenderView().ViewTime = time_value - pvs.UpdatePipeline(time_value, proxy) - - # Create plot over line filter - pol = pvs.PlotOverLine(proxy, Source="High Resolution Line Source") - pol.Source.Point1 = point1 - pol.Source.Point2 = point2 - pol.UpdatePipeline() - - # Get Cut Segment representation object - cut_segment = pvs.GetRepresentation(pol) - - # Get lookup table - lookup_table = get_lookup_table(field_name, nb_components, vector_mode) - - # Set field range if necessary - data_range = get_data_range(proxy, entity, - field_name, vector_mode) - lookup_table.LockScalarRange = 1 - lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] - - # Set properties - cut_segment.ColorArrayName = (EntityType.get_pvtype(entity), field_name) - cut_segment.LookupTable = lookup_table - - # Set wireframe represenatation mode - cut_segment.Representation = 'Wireframe' - - # Add scalar bar - add_scalar_bar(field_name, nb_components, - vector_mode, lookup_table, time_value) - - return cut_segment - - -def VectorsOnField(proxy, entity, field_name, timestamp_nb, - scale_factor=None, - glyph_pos=GlyphPos.TAIL, glyph_type='2D Glyph', - is_colored=False, vector_mode='Magnitude'): - """Creates Vectors presentation on the given field. - - Arguments: - proxy: the pipeline object, containig data - entity: the entity type from PrsTypeEnum - field_name: the field name - timestamp_nb: the number of time step (1, 2, ...) - scale_factor: scale factor - glyph_pos: the position of glyphs - glyph_type: the type of glyphs - is_colored: this option allows to color the presentation according to - the corresponding data array values - vector_mode: the mode of transformation of vector values - into scalar values, applicable only if the field contains vector values. - Possible modes: 'Magnitude', 'X', 'Y' or 'Z'. - - Returns: - Vectors as representation object. - - """ - proxy.UpdatePipeline() - if entity == EntityType.NODE: - select_cells_with_data(proxy, on_points=[field_name]) - else: - select_cells_with_data(proxy, on_cells=[field_name]) - - # Check vector mode - nb_components = get_nb_components(proxy, entity, field_name) - check_vector_mode(vector_mode, nb_components) - - # Get time value - time_value = get_time(proxy, timestamp_nb) - - # Set timestamp - pvs.GetRenderView().ViewTime = time_value - pvs.UpdatePipeline(time_value, proxy) - - # Extract only groups with data for the field - source = proxy - - # Cell centers - if is_data_on_cells(proxy, field_name): - cell_centers = pvs.CellCenters(source) - cell_centers.VertexCells = 1 - source = cell_centers - - vector_array = field_name - # If the given vector array has only 2 components, add the third one - if nb_components == 2: - calc = get_add_component_calc(source, EntityType.NODE, field_name) - vector_array = calc.ResultArrayName - source = calc - - # Glyph - glyph = pvs.Glyph(source) - glyph.Vectors = vector_array - glyph.ScaleMode = 'vector' - #glyph.MaskPoints = 0 - - # Set glyph type - glyph.GlyphType = glyph_type - if glyph_type == '2D Glyph': - glyph.GlyphType.GlyphType = 'Arrow' - elif glyph_type == 'Cone': - glyph.GlyphType.Resolution = 7 - glyph.GlyphType.Height = 2 - glyph.GlyphType.Radius = 0.2 - - # Set glyph position if possible - if glyph.GlyphType.GetProperty("Center"): - if (glyph_pos == GlyphPos.TAIL): - glyph.GlyphType.Center = [0.5, 0.0, 0.0] - elif (glyph_pos == GlyphPos.HEAD): - glyph.GlyphType.Center = [-0.5, 0.0, 0.0] - elif (glyph_pos == GlyphPos.CENTER): - glyph.GlyphType.Center = [0.0, 0.0, 0.0] - - if scale_factor is not None: - glyph.ScaleFactor = scale_factor - else: - def_scale = get_default_scale(PrsTypeEnum.DEFORMEDSHAPE, - proxy, entity, field_name) - glyph.ScaleFactor = def_scale - - glyph.UpdatePipeline() - - # Get Vectors representation object - vectors = pvs.GetRepresentation(glyph) - - # Get lookup table - lookup_table = get_lookup_table(field_name, nb_components, vector_mode) - - # Set field range if necessary - data_range = get_data_range(proxy, entity, - field_name, vector_mode) - lookup_table.LockScalarRange = 1 - lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] - - # Set properties - if (is_colored): - vectors.ColorArrayName = 'GlyphVector' - else: - vectors.ColorArrayName = '' - vectors.LookupTable = lookup_table - - vectors.LineWidth = 1.0 - - # Set wireframe represenatation mode - vectors.Representation = 'Wireframe' - - # Add scalar bar - add_scalar_bar(field_name, nb_components, - vector_mode, lookup_table, time_value) - - return vectors - - -def DeformedShapeOnField(proxy, entity, field_name, - timestamp_nb, - scale_factor=None, is_colored=False, - vector_mode='Magnitude'): - """Creates Defromed Shape presentation on the given field. - - Arguments: - proxy: the pipeline object, containig data - entity: the entity type from PrsTypeEnum - field_name: the field name - timestamp_nb: the number of time step (1, 2, ...) - scale_factor: scale factor of the deformation - is_colored: this option allows to color the presentation according to - the corresponding data array values - vector_mode: the mode of transformation of vector values - into scalar values, applicable only if the field contains vector values. - Possible modes: 'Magnitude', 'X', 'Y' or 'Z'. - - Returns: - Defromed Shape as representation object. - - """ - proxy.UpdatePipeline() - # We don't need mesh parts with no data on them - if entity == EntityType.NODE: - select_cells_with_data(proxy, on_points=[field_name]) - else: - select_cells_with_data(proxy, on_cells=[field_name]) - - # Check vector mode - nb_components = get_nb_components(proxy, entity, field_name) - check_vector_mode(vector_mode, nb_components) - - # Get time value - time_value = get_time(proxy, timestamp_nb) - - # Set timestamp - pvs.GetRenderView().ViewTime = time_value - pvs.UpdatePipeline(time_value, proxy) - - # Do merge - source = pvs.MergeBlocks(proxy) - - # Cell data to point data - if is_data_on_cells(proxy, field_name): - cell_to_point = pvs.CellDatatoPointData() - cell_to_point.PassCellData = 1 - source = cell_to_point - - vector_array = field_name - # If the given vector array has only 2 components, add the third one - if nb_components == 2: - calc = get_add_component_calc(source, EntityType.NODE, field_name) - vector_array = calc.ResultArrayName - source = calc - - # Warp by vector - warp_vector = pvs.WarpByVector(source) - warp_vector.Vectors = [vector_array] - if scale_factor is not None: - warp_vector.ScaleFactor = scale_factor - else: - def_scale = get_default_scale(PrsTypeEnum.DEFORMEDSHAPE, - proxy, entity, field_name) - warp_vector.ScaleFactor = def_scale - - # Get Deformed Shape representation object - defshape = pvs.GetRepresentation(warp_vector) - - # Get lookup table - lookup_table = get_lookup_table(field_name, nb_components, vector_mode) - - # Set field range if necessary - data_range = get_data_range(proxy, entity, - field_name, vector_mode) - lookup_table.LockScalarRange = 1 - lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] - - # Set properties - if is_colored: - defshape.ColorArrayName = (EntityType.get_pvtype(entity), field_name) - else: - defshape.ColorArrayName = '' - defshape.LookupTable = lookup_table - - # Set wireframe represenatation mode - defshape.Representation = 'Wireframe' - - # Add scalar bar - add_scalar_bar(field_name, nb_components, - vector_mode, lookup_table, time_value) - - return defshape - - -def DeformedShapeAndScalarMapOnField(proxy, entity, field_name, - timestamp_nb, - scale_factor=None, - scalar_entity=None, - scalar_field_name=None, - vector_mode='Magnitude'): - """Creates Defromed Shape And Scalar Map presentation on the given field. - - Arguments: - proxy: the pipeline object, containig data - entity: the entity type from PrsTypeEnum - field_name: the field name - timestamp_nb: the number of time step (1, 2, ...) - scale_factor: scale factor of the deformation - scalar_entity: scalar field entity - scalar_field_name: scalar field, i.e. the field for coloring - vector_mode: the mode of transformation of vector values - into scalar values, applicable only if the field contains vector values. - Possible modes: 'Magnitude', 'X', 'Y' or 'Z'. - - Returns: - Defromed Shape And Scalar Map as representation object. - - """ - proxy.UpdatePipeline() - # We don't need mesh parts with no data on them - on_points = [] - on_cells = [] - - if entity == EntityType.NODE: - on_points.append(field_name) - else: - on_cells.append(field_name) - - if scalar_entity and scalar_field_name: - if scalar_entity == EntityType.NODE: - on_points.append(scalar_field_name) - else: - on_cells.append(scalar_field_name) - - nb_components = get_nb_components(proxy, entity, field_name) - - # Select fields - select_cells_with_data(proxy, on_points, on_cells) - - # Check vector mode - check_vector_mode(vector_mode, nb_components) - - # Get time value - time_value = get_time(proxy, timestamp_nb) - - # Set timestamp - pvs.GetRenderView().ViewTime = time_value - pvs.UpdatePipeline(time_value, proxy) - - # Set scalar field by default - scalar_field_entity = scalar_entity - scalar_field = scalar_field_name - if (scalar_field_entity is None) or (scalar_field is None): - scalar_field_entity = entity - scalar_field = field_name - - # Do merge - source = pvs.MergeBlocks(proxy) - - # Cell data to point data - if is_data_on_cells(proxy, field_name): - cell_to_point = pvs.CellDatatoPointData(source) - cell_to_point.PassCellData = 1 - source = cell_to_point - - vector_array = field_name - # If the given vector array has only 2 components, add the third one - if nb_components == 2: - calc = get_add_component_calc(source, EntityType.NODE, field_name) - vector_array = calc.ResultArrayName - source = calc - - # Warp by vector - warp_vector = pvs.WarpByVector(source) - warp_vector.Vectors = [vector_array] - if scale_factor is not None: - warp_vector.ScaleFactor = scale_factor - else: - def_scale = get_default_scale(PrsTypeEnum.DEFORMEDSHAPE, - proxy, entity, field_name) - warp_vector.ScaleFactor = def_scale - - # Get Defromed Shape And Scalar Map representation object - defshapemap = pvs.GetRepresentation(warp_vector) - - # Get lookup table - lookup_table = get_lookup_table(scalar_field, nb_components, vector_mode) - - # Set field range if necessary - data_range = get_data_range(proxy, scalar_field_entity, - scalar_field, vector_mode) - lookup_table.LockScalarRange = 1 - lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] - - # Set properties - defshapemap.ColorArrayName = (EntityType.get_pvtype(scalar_field_entity), scalar_field) - defshapemap.LookupTable = lookup_table - - # Add scalar bar - add_scalar_bar(field_name, nb_components, - vector_mode, lookup_table, time_value) - - return defshapemap - - -def Plot3DOnField(proxy, entity, field_name, timestamp_nb, - orientation=Orientation.AUTO, - angle1=0, angle2=0, - position=0.5, is_relative=True, - scale_factor=None, - is_contour=False, nb_contours=32, - vector_mode='Magnitude'): - """Creates Plot 3D presentation on the given field. - - Arguments: - proxy: the pipeline object, containig data - entity: the entity type from PrsTypeEnum - field_name: the field name - timestamp_nb: the number of time step (1, 2, ...) - orientation: the cut plane plane orientation in 3D space, if - the input is planar - will not be taken into account - angle1: rotation of the cut plane in 3d space around the first axis - of the selected orientation (X axis for XY, Y axis for YZ, - Z axis for ZX). - The angle of rotation is set in degrees. Acceptable range: [-45, 45]. - angle2: rotation of the cut plane in 3d space around the second axis - of the selected orientation. Acceptable range: [-45, 45]. - position: position of the cut plane in the object (ranging from 0 to 1). - The value 0.5 corresponds to cutting by halves. - is_relative: defines if the cut plane position is relative or absolute - scale_factor: deformation scale factor - is_contour: if True - Plot 3D will be represented with a set of contours, - otherwise - Plot 3D will be represented with a smooth surface - nb_contours: number of contours, applied if is_contour is True - vector_mode: the mode of transformation of vector values - into scalar values, applicable only if the field contains vector values. - Possible modes: 'Magnitude', 'X', 'Y' or 'Z'. - - Returns: - Plot 3D as representation object. - - """ - proxy.UpdatePipeline() - # We don't need mesh parts with no data on them - if entity == EntityType.NODE: - select_cells_with_data(proxy, on_points=[field_name]) - else: - select_cells_with_data(proxy, on_cells=[field_name]) - - # Check vector mode - nb_components = get_nb_components(proxy, entity, field_name) - check_vector_mode(vector_mode, nb_components) - - # Get time value - time_value = get_time(proxy, timestamp_nb) - - # Set timestamp - pvs.GetRenderView().ViewTime = time_value - pvs.UpdatePipeline(time_value, proxy) - - # Do merge - merge_blocks = pvs.MergeBlocks(proxy) - merge_blocks.UpdatePipeline() - - poly_data = None - - # Cutting plane - - # Define orientation if necessary (auto mode) - plane_orientation = orientation - if (orientation == Orientation.AUTO): - plane_orientation = get_orientation(proxy) - - # Get cutting plane normal - normal = None - - if (not is_planar_input(proxy)): - normal = get_normal_by_orientation(plane_orientation, - radians(angle1), radians(angle2)) - - # Create slice filter - slice_filter = pvs.Slice(merge_blocks) - slice_filter.SliceType = "Plane" - - # Set cutting plane normal - slice_filter.SliceType.Normal = normal - - # Set cutting plane position - if (is_relative): - base_position = get_positions(1, normal, - get_bounds(proxy), position) - slice_filter.SliceOffsetValues = base_position - else: - slice_filter.SliceOffsetValues = position - - slice_filter.UpdatePipeline() - poly_data = slice_filter - else: - normal = get_normal_by_orientation(plane_orientation, 0, 0) - - use_normal = 0 - # Geometry filter - if not poly_data or poly_data.GetDataInformation().GetNumberOfCells() == 0: - geometry_filter = pvs.GeometryFilter(merge_blocks) - poly_data = geometry_filter - use_normal = 1 # TODO(MZN): workaround - - warp_scalar = None - plot3d = None - source = poly_data - - if is_data_on_cells(poly_data, field_name): - # Cell data to point data - cell_to_point = pvs.CellDatatoPointData(poly_data) - cell_to_point.PassCellData = 1 - source = cell_to_point - - scalars = ['POINTS', field_name] - - # Transform vector array to scalar array if necessary - if (nb_components > 1): - calc = get_calc_magnitude(source, EntityType.NODE, field_name) - scalars = ['POINTS', calc.ResultArrayName] - source = calc - - # Warp by scalar - warp_scalar = pvs.WarpByScalar(source) - warp_scalar.Scalars = scalars - warp_scalar.Normal = normal - warp_scalar.UseNormal = use_normal - if scale_factor is not None: - warp_scalar.ScaleFactor = scale_factor - else: - def_scale = get_default_scale(PrsTypeEnum.PLOT3D, - proxy, entity, field_name) - warp_scalar.ScaleFactor = def_scale - - warp_scalar.UpdatePipeline() - source = warp_scalar - - if (is_contour): - # Contours - contour = pvs.Contour(warp_scalar) - contour.PointMergeMethod = "Uniform Binning" - contour.ContourBy = ['POINTS', field_name] - scalar_range = get_data_range(proxy, entity, - field_name, vector_mode) - contour.Isosurfaces = get_contours(scalar_range, nb_contours) - contour.UpdatePipeline() - source = contour - - # Get Plot 3D representation object - plot3d = pvs.GetRepresentation(source) - - # Get lookup table - lookup_table = get_lookup_table(field_name, nb_components, vector_mode) - - # Set field range if necessary - data_range = get_data_range(proxy, entity, - field_name, vector_mode) - lookup_table.LockScalarRange = 1 - lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] - - # Set properties - plot3d.ColorArrayName = (EntityType.get_pvtype(entity), field_name) - plot3d.LookupTable = lookup_table - - # Add scalar bar - add_scalar_bar(field_name, nb_components, - vector_mode, lookup_table, time_value) - - return plot3d - - -def IsoSurfacesOnField(proxy, entity, field_name, timestamp_nb, - custom_range=None, nb_surfaces=10, - is_colored=True, color=None, vector_mode='Magnitude'): - """Creates Iso Surfaces presentation on the given field. - - Arguments: - proxy: the pipeline object, containig data - entity: the entity type from PrsTypeEnum - field_name: the field name - timestamp_nb: the number of time step (1, 2, ...) - custom_range: scalar range, if undefined the source range will be applied - nb_surfaces: number of surfaces, which will be generated - is_colored: this option allows to color the presentation according to - the corresponding data array values. If False - the presentation will - be one-coloured. - color: defines the presentation color as [R, G, B] triple. Taken into - account only if is_colored is False. - vector_mode: the mode of transformation of vector values - into scalar values, applicable only if the field contains vector values. - Possible modes: 'Magnitude', 'X', 'Y' or 'Z'. - - Returns: - Iso Surfaces as representation object. - - """ - proxy.UpdatePipeline() - # We don't need mesh parts with no data on them - if entity == EntityType.NODE: - select_cells_with_data(proxy, on_points=[field_name]) - else: - select_cells_with_data(proxy, on_cells=[field_name]) - - # Check vector mode - nb_components = get_nb_components(proxy, entity, field_name) - check_vector_mode(vector_mode, nb_components) - - # Get time value - time_value = get_time(proxy, timestamp_nb) - - # Set timestamp - pvs.GetRenderView().ViewTime = time_value - pvs.UpdatePipeline(time_value, proxy) - - # Do merge - source = pvs.MergeBlocks(proxy) - - # Transform cell data into point data if necessary - if is_data_on_cells(proxy, field_name): - cell_to_point = pvs.CellDatatoPointData(source) - cell_to_point.PassCellData = 1 - source = cell_to_point - - contour_by = ['POINTS', field_name] - - # Transform vector array to scalar array if necessary - if (nb_components > 1): - calc = get_calc_magnitude(source, EntityType.NODE, field_name) - contour_by = ['POINTS', calc.ResultArrayName] - source = calc - - # Contour filter settings - contour = pvs.Contour(source) - contour.ComputeScalars = 1 - contour.ContourBy = contour_by - - # Specify the range - scalar_range = custom_range - if (scalar_range is None): - scalar_range = get_data_range(proxy, entity, - field_name, cut_off=True) - - # Get contour values for the range - surfaces = get_contours(scalar_range, nb_surfaces) - - # Set contour values - contour.Isosurfaces = surfaces - - # Get Iso Surfaces representation object - isosurfaces = pvs.GetRepresentation(contour) - - # Get lookup table - lookup_table = get_lookup_table(field_name, nb_components, vector_mode) - - # Set field range if necessary - data_range = get_data_range(proxy, entity, - field_name, vector_mode) - lookup_table.LockScalarRange = 1 - lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] - - # Set display properties - if (is_colored): - isosurfaces.ColorArrayName = (EntityType.get_pvtype(entity), field_name) - else: - isosurfaces.ColorArrayName = '' - if color: - isosurfaces.DiffuseColor = color - isosurfaces.LookupTable = lookup_table - - # Add scalar bar - add_scalar_bar(field_name, nb_components, - vector_mode, lookup_table, time_value) - - return isosurfaces - - -def GaussPointsOnField(proxy, entity, field_name, - timestamp_nb, - is_deformed=True, scale_factor=None, - is_colored=True, color=None, - primitive=GaussType.SPRITE, - is_proportional=True, - max_pixel_size=256, - multiplier=None, vector_mode='Magnitude'): - """Creates Gauss Points on the given field. - - Arguments: - - proxy: the pipeline object, containig data - entity: the field entity type from PrsTypeEnum - field_name: the field name - timestamp_nb: the number of time step (1, 2, ...) - is_deformed: defines whether the Gauss Points will be deformed or not - scale_factor -- the scale factor for deformation. Will be taken into - account only if is_deformed is True. - If not passed by user, default scale will be computed. - is_colored -- defines whether the Gauss Points will be multicolored, - using the corresponding data values - color: defines the presentation color as [R, G, B] triple. Taken into - account only if is_colored is False. - primitive: primitive type from GaussType - is_proportional: if True, the size of primitives will depends on - the gauss point value - max_pixel_size: the maximum sizr of the Gauss Points primitive in pixels - multiplier: coefficient between data values and the size of primitives - If not passed by user, default scale will be computed. - vector_mode: the mode of transformation of vector values into - scalar values, applicable only if the field contains vector values. - Possible modes: 'Magnitude' - vector module; - 'X', 'Y', 'Z' - vector components. - - Returns: - Gauss Points as representation object. - - """ - proxy.UpdatePipeline() - # We don't need mesh parts with no data on them - on_gauss = select_cells_with_data(proxy, on_gauss=[field_name]) - if not on_gauss: - if entity == EntityType.NODE: - select_cells_with_data(proxy, on_points=[field_name]) - else: - select_cells_with_data(proxy, on_cells=[field_name]) - - # Check vector mode - nb_components = get_nb_components(proxy, entity, field_name) - check_vector_mode(vector_mode, nb_components) - - # Get time value - time_value = get_time(proxy, timestamp_nb) - - # Set timestamp - pvs.GetRenderView().ViewTime = time_value - proxy.UpdatePipeline(time=time_value) - - source = proxy - - # If no quadrature point array is passed, use cell centers - if on_gauss: - generate_qp = pvs.GenerateQuadraturePoints(source) - generate_qp.QuadratureSchemeDef = ['CELLS', 'ELGA@0'] - source = generate_qp - else: - # Cell centers - cell_centers = pvs.CellCenters(source) - cell_centers.VertexCells = 1 - source = cell_centers - - source.UpdatePipeline() - - # Check if deformation enabled - if is_deformed and nb_components > 1: - vector_array = field_name - # If the given vector array has only 2 components, add the third one - if nb_components == 2: - calc = get_add_component_calc(source, - EntityType.NODE, field_name) - vector_array = calc.ResultArrayName - source = calc - - # Warp by vector - warp_vector = pvs.WarpByVector(source) - warp_vector.Vectors = [vector_array] - if scale_factor is not None: - warp_vector.ScaleFactor = scale_factor - else: - def_scale = get_default_scale(PrsTypeEnum.DEFORMEDSHAPE, proxy, - entity, field_name) - warp_vector.ScaleFactor = def_scale - warp_vector.UpdatePipeline() - source = warp_vector - - # Get Gauss Points representation object - gausspnt = pvs.GetRepresentation(source) - - # Get lookup table - lookup_table = get_lookup_table(field_name, nb_components, vector_mode) - - # Set field range if necessary - data_range = get_data_range(proxy, entity, - field_name, vector_mode) - lookup_table.LockScalarRange = 1 - lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] - - # Set display properties - if is_colored: - gausspnt.ColorArrayName = (EntityType.get_pvtype(entity), field_name) - else: - gausspnt.ColorArrayName = '' - if color: - gausspnt.DiffuseColor = color - - gausspnt.LookupTable = lookup_table - - # Add scalar bar - add_scalar_bar(field_name, nb_components, - vector_mode, lookup_table, time_value) - - # Set point sprite representation - gausspnt.Representation = 'Point Sprite' - - # Point sprite settings - gausspnt.InterpolateScalarsBeforeMapping = 0 - gausspnt.MaxPixelSize = max_pixel_size - - # Render mode - gausspnt.RenderMode = GaussType.get_mode(primitive) - - #if primitive == GaussType.SPRITE: - # Set texture - # TODO(MZN): replace with pvsimple high-level interface - # texture = sm.CreateProxy("textures", "SpriteTexture") - # alphamprop = texture.GetProperty("AlphaMethod") - # alphamprop.SetElement(0, 2) # Clamp - # alphatprop = texture.GetProperty("AlphaThreshold") - # alphatprop.SetElement(0, 63) - # maxprop = texture.GetProperty("Maximum") - # maxprop.SetElement(0, 255) - # texture.UpdateVTKObjects() - - # gausspnt.Texture = texture - #gausspnt.Texture.AlphaMethod = 'Clamp' - #gausspnt.Texture.AlphaThreshold = 63 - #gausspnt.Texture.Maximum= 255 - - # Proportional radius - gausspnt.RadiusUseScalarRange = 0 - gausspnt.RadiusIsProportional = 0 - - if is_proportional: - mult = multiplier - if mult is None: - mult = abs(0.1 / data_range[1]) - - gausspnt.RadiusScalarRange = data_range - gausspnt.RadiusTransferFunctionEnabled = 1 - gausspnt.RadiusMode = 'Scalar' - gausspnt.RadiusArray = ['POINTS', field_name] - if nb_components > 1: - v_comp = get_vector_component(vector_mode) - gausspnt.RadiusVectorComponent = v_comp - gausspnt.RadiusTransferFunctionMode = 'Table' - gausspnt.RadiusScalarRange = data_range - gausspnt.RadiusUseScalarRange = 1 - gausspnt.RadiusIsProportional = 1 - gausspnt.RadiusProportionalFactor = mult - else: - gausspnt.RadiusTransferFunctionEnabled = 0 - gausspnt.RadiusMode = 'Constant' - gausspnt.RadiusArray = ['POINTS', 'Constant Radius'] - - return gausspnt - -def GaussPointsOnField1(proxy, entity, field_name, - timestamp_nb, - is_colored=True, color=None, - primitive=GaussType.SPHERE, - is_proportional=True, - max_pixel_size=256, - multiplier=None, - vector_mode='Magnitude'): - """Creates Gauss Points on the given field. Use GaussPoints() Paraview interface. - - Arguments: - proxy: the pipeline object, containig data - entity: the field entity type from PrsTypeEnum - field_name: the field name - timestamp_nb: the number of time step (1, 2, ...) - is_colored -- defines whether the Gauss Points will be multicolored, - using the corresponding data values - color: defines the presentation color as [R, G, B] triple. Taken into - account only if is_colored is False. - primitive: primitive type from GaussType - is_proportional: if True, the size of primitives will depends on - the gauss point value - max_pixel_size: the maximum sizr of the Gauss Points primitive in pixels - multiplier: coefficient between data values and the size of primitives - If not passed by user, default scale will be computed. - vector_mode: the mode of transformation of vector values into - scalar values, applicable only if the field contains vector values. - Possible modes: 'Magnitude' - vector module; - 'X', 'Y', 'Z' - vector components. - - Returns: - Gauss Points as representation object. - - """ - proxy.UpdatePipeline() - select_cells_with_data(proxy, on_gauss=[field_name]) - - nb_components = get_nb_components(proxy, entity, field_name) - - # Get time value - time_value = get_time(proxy, timestamp_nb) - - # Set timestamp - pvs.GetRenderView().ViewTime = time_value - proxy.UpdatePipeline(time=time_value) - - # Create Gauss Points object - source = pvs.GaussPoints(proxy) - source.UpdatePipeline() - - # Get Gauss Points representation object - gausspnt = pvs.GetRepresentation(source) - - # Get lookup table - lookup_table = get_lookup_table(field_name, nb_components, vector_mode) - - # Set field range if necessary - data_range = get_data_range(proxy, entity, - field_name, vector_mode) - lookup_table.LockScalarRange = 1 - lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] - - # Set display properties - if is_colored: - gausspnt.ColorArrayName = (EntityType.get_pvtype(entity), field_name) - else: - gausspnt.ColorArrayName = '' - if color: - gausspnt.DiffuseColor = color - - gausspnt.LookupTable = lookup_table - - # Add scalar bar - add_scalar_bar(field_name, nb_components, - vector_mode, lookup_table, time_value) - - # Set point sprite representation - gausspnt.Representation = 'Point Sprite' - - # Point sprite settings - gausspnt.InterpolateScalarsBeforeMapping = 0 - gausspnt.MaxPixelSize = max_pixel_size - - # Render mode - gausspnt.RenderMode = GaussType.get_mode(primitive) - - #if primitive == GaussType.SPRITE: - # Set texture - # TODO(MZN): replace with pvsimple high-level interface - # texture = sm.CreateProxy("textures", "SpriteTexture") - # alphamprop = texture.GetProperty("AlphaMethod") - # alphamprop.SetElement(0, 2) # Clamp - # alphatprop = texture.GetProperty("AlphaThreshold") - # alphatprop.SetElement(0, 63) - # maxprop = texture.GetProperty("Maximum") - # maxprop.SetElement(0, 255) - # texture.UpdateVTKObjects() - - # gausspnt.Texture = texture - #gausspnt.Texture.AlphaMethod = 'Clamp' - #gausspnt.Texture.AlphaThreshold = 63 - #gausspnt.Texture.Maximum= 255 - - # Proportional radius - gausspnt.RadiusUseScalarRange = 0 - gausspnt.RadiusIsProportional = 0 - - if is_proportional: - mult = multiplier - if mult is None: - mult = abs(0.1 / data_range[1]) - - gausspnt.RadiusScalarRange = data_range - gausspnt.RadiusTransferFunctionEnabled = 1 - gausspnt.RadiusMode = 'Scalar' - gausspnt.RadiusArray = ['POINTS', field_name] - if nb_components > 1: - v_comp = get_vector_component(vector_mode) - gausspnt.RadiusVectorComponent = v_comp - gausspnt.RadiusTransferFunctionMode = 'Table' - gausspnt.RadiusScalarRange = data_range - gausspnt.RadiusUseScalarRange = 1 - gausspnt.RadiusIsProportional = 1 - gausspnt.RadiusProportionalFactor = mult - else: - gausspnt.RadiusTransferFunctionEnabled = 0 - gausspnt.RadiusMode = 'Constant' - gausspnt.RadiusArray = ['POINTS', 'Constant Radius'] - - return gausspnt - -def StreamLinesOnField(proxy, entity, field_name, timestamp_nb, - direction='BOTH', is_colored=False, color=None, - vector_mode='Magnitude'): - """Creates Stream Lines presentation on the given field. - - Arguments: - proxy: the pipeline object, containig data - entity: the entity type from PrsTypeEnum - field_name: the field name - timestamp_nb: the number of time step (1, 2, ...) - direction: the stream lines direction ('FORWARD', 'BACKWARD' or 'BOTH') - is_colored: this option allows to color the presentation according to - the corresponding data values. If False - the presentation will - be one-coloured. - color: defines the presentation color as [R, G, B] triple. Taken into - account only if is_colored is False. - vector_mode: the mode of transformation of vector values - into scalar values, applicable only if the field contains vector values. - Possible modes: 'Magnitude', 'X', 'Y' or 'Z'. - - Returns: - Stream Lines as representation object. - - """ - proxy.UpdatePipeline() - # We don't need mesh parts with no data on them - if entity == EntityType.NODE: - select_cells_with_data(proxy, on_points=[field_name]) - else: - select_cells_with_data(proxy, on_cells=[field_name]) - - # Check vector mode - nb_components = get_nb_components(proxy, entity, field_name) - check_vector_mode(vector_mode, nb_components) - - # Get time value - time_value = get_time(proxy, timestamp_nb) - - # Set timestamp - pvs.GetRenderView().ViewTime = time_value - pvs.UpdatePipeline(time_value, proxy) - - # Do merge - source = pvs.MergeBlocks(proxy) - - # Cell data to point data - if is_data_on_cells(proxy, field_name): - cell_to_point = pvs.CellDatatoPointData(source) - cell_to_point.PassCellData = 1 - cell_to_point.UpdatePipeline() - source = cell_to_point - - vector_array = field_name - # If the given vector array has only 2 components, add the third one - if nb_components == 2: - calc = get_add_component_calc(source, EntityType.NODE, field_name) - vector_array = calc.ResultArrayName - calc.UpdatePipeline() - source = calc - - # Stream Tracer - stream = pvs.StreamTracer(source) - stream.SeedType = "Point Source" - stream.Vectors = ['POINTS', vector_array] - stream.SeedType = "Point Source" - stream.IntegrationDirection = direction - stream.IntegratorType = 'Runge-Kutta 2' - stream.UpdatePipeline() - - # Get Stream Lines representation object - if is_empty(stream): - return None - streamlines = pvs.GetRepresentation(stream) - - # Get lookup table - lookup_table = get_lookup_table(field_name, nb_components, vector_mode) - - # Set field range if necessary - data_range = get_data_range(proxy, entity, - field_name, vector_mode) - lookup_table.LockScalarRange = 1 - lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] - - # Set properties - if is_colored: - streamlines.ColorArrayName = (EntityType.get_pvtype(entity), field_name) - else: - streamlines.ColorArrayName = '' - if color: - streamlines.DiffuseColor = color - - streamlines.LookupTable = lookup_table - - # Add scalar bar - add_scalar_bar(field_name, nb_components, - vector_mode, lookup_table, time_value) - - return streamlines - - -def MeshOnEntity(proxy, mesh_name, entity): - """Creates submesh of the entity type for the mesh. - - Arguments: - proxy -- the pipeline object, containig data - mesh_name -- the full or short name of mesh field - - Returns: - Submesh as representation object of the given source. - - """ - proxy.UpdatePipeline() - mesh_full_name = None - aList = mesh_name.split('/') - if len(aList) >= 2: - mesh_full_name = mesh_name - else: - mesh_full_name = find_mesh_full_name(proxy, mesh_name) - if not mesh_full_name: - raise RuntimeError, "The given mesh name was not found" - # Select only the given mesh - proxy.AllArrays = [] - proxy.UpdatePipeline() - proxy.AllArrays = [mesh_full_name] - proxy.UpdatePipeline() - - # Get representation object if the submesh is not empty - prs = None - if (proxy.GetDataInformation().GetNumberOfPoints() or - proxy.GetDataInformation().GetNumberOfCells()): - prs = pvs.GetRepresentation(proxy) - prs.ColorArrayName = '' - - return prs - - -def MeshOnGroup(proxy, extrGroups, group_name): - """Creates submesh on the group. - - Arguments: - proxy -- the pipeline object, containig data - group_name -- the full group name - extrGroups -- all extracted groups object - - Returns: - Representation object of the given source with single group - selected. - - """ - proxy.UpdatePipeline() - # Deselect all groups - extrGroups.AllGroups = [] - extrGroups.UpdatePipelineInformation() - # Select only the group with the given name - extrGroups.AllGroups = [group_name] - extrGroups.UpdatePipelineInformation() - - # Get representation object if the submesh is not empty - prs = None - - # Check if the group was set - if len(extrGroups.AllGroups) == 1 and \ - extrGroups.AllGroups[0] == group_name: - # Check if the submesh is not empty - nb_points = proxy.GetDataInformation().GetNumberOfPoints() - nb_cells = proxy.GetDataInformation().GetNumberOfCells() - - if nb_points or nb_cells: -# prs = pvs.GetRepresentation(proxy) - prs = pvs.Show() - prs.ColorArrayName = '' - display_only(prs) - - return prs - - -def CreatePrsForFile(paravis_instance, file_name, prs_types, - picture_dir, picture_ext): - """Build presentations of the given types for the file. - - Build presentations for all fields on all timestamps. - - Arguments: - paravis_instance: ParaVis module instance object - file_name: full path to the MED file - prs_types: the list of presentation types to build - picture_dir: the directory path for saving snapshots - picture_ext: graphics files extension (determines file type) - - """ - # Import MED file - print "Import " + file_name.split(os.sep)[-1] + "..." - - try: - proxy = pvs.MEDReader(FileName=file_name) - if proxy is None: - print "FAILED" - else: - proxy.UpdatePipeline() - print "OK" - except: - print "FAILED" - else: - # Get view - view = pvs.GetRenderView() - - # Create required presentations for the proxy - CreatePrsForProxy(proxy, view, prs_types, - picture_dir, picture_ext) - -def CreatePrsForProxy(proxy, view, prs_types, picture_dir, picture_ext): - """Build presentations of the given types for all fields of the proxy. - - Save snapshots in graphics files (type depends on the given extension). - Stores the files in the given directory. - - Arguments: - proxy: the pipeline object, containig data - view: the render view - prs_types: the list of presentation types to build - picture_dir: the directory path for saving snapshots - picture_ext: graphics files extension (determines file type) - - """ - proxy.UpdatePipeline() - # List of the field names - fields_info = proxy.GetProperty("FieldsTreeInfo")[::2] - - # Add path separator to the end of picture path if necessery - if not picture_dir.endswith(os.sep): - picture_dir += os.sep - - # Mesh Presentation - if PrsTypeEnum.MESH in prs_types: - # Iterate on meshes - mesh_names = get_mesh_full_names(proxy) - for mesh_name in mesh_names: - # Build mesh field presentation - print "Creating submesh for '" + get_field_short_name(mesh_name) + "' mesh... " - prs = MeshOnEntity(proxy, mesh_name, None) - if prs is None: - print "FAILED" - continue - else: - print "OK" - # Construct image file name - pic_name = picture_dir + get_field_short_name(mesh_name) + "." + picture_ext - - # Show and dump the presentation into a graphics file - process_prs_for_test(prs, view, pic_name, False) - - # Create Mesh presentation. Build all groups. - extGrp = pvs.ExtractGroup() - extGrp.UpdatePipelineInformation() - if if_possible(proxy, None, None, PrsTypeEnum.MESH, extGrp): - for group in get_group_names(extGrp): - print "Creating submesh on group " + get_group_short_name(group) + "... " - prs = MeshOnGroup(proxy, extGrp, group) - if prs is None: - print "FAILED" - continue - else: - print "OK" - # Construct image file name - pic_name = picture_dir + get_group_short_name(group) + "." + picture_ext - - # Show and dump the presentation into a graphics file - process_prs_for_test(prs, view, pic_name, False) - - # Presentations on fields - for field in fields_info: - field_name = get_field_short_name(field) - # Ignore mesh presentation - if field_name == get_field_mesh_name(field): - continue - field_entity = get_field_entity(field) - # Clear fields selection state - proxy.AllArrays = [] - proxy.UpdatePipeline() - # Select only the current field: - # necessary for getting the right timestamps - proxy.AllArrays = field - proxy.UpdatePipeline() - - # Get timestamps - entity_data_info = proxy.GetCellDataInformation() - timestamps = proxy.TimestepValues.GetData() - - for prs_type in prs_types: - # Ignore mesh presentation - if prs_type == PrsTypeEnum.MESH: - continue - - # Get name of presentation type - prs_name = PrsTypeEnum.get_name(prs_type) - - # Build the presentation if possible - possible = if_possible(proxy, field_name, - field_entity, prs_type) - if possible: - # Presentation type for graphics file name - f_prs_type = prs_name.replace(' ', '').upper() - - for timestamp_nb in xrange(1, len(timestamps) + 1): - time = timestamps[timestamp_nb - 1] - if (time == 0.0): - scalar_range = get_data_range(proxy, field_entity, - field_name, cut_off=True) - # exclude time stamps with null lenght of scalar range - if (scalar_range[0] == scalar_range[1]): - continue - print "Creating " + prs_name + " on " + field_name + ", time = " + str(time) + "... " - prs = create_prs(prs_type, proxy, - field_entity, field_name, timestamp_nb) - if prs is None: - print "FAILED" - continue - else: - print "OK" - - # Construct image file name - pic_name = picture_dir + field_name + "_" + str(time) + "_" + f_prs_type + "." + picture_ext - - # Show and dump the presentation into a graphics file - process_prs_for_test(prs, view, pic_name) - return diff --git a/src/PV_SWIG/no_wrap/pvsimple.py b/src/PV_SWIG/no_wrap/pvsimple.py deleted file mode 100644 index f9f6a063..00000000 --- a/src/PV_SWIG/no_wrap/pvsimple.py +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# Author: Adrien Bruneton (CEA) - -r""" This module is a direct forward to the initial 'simple' module of ParaView. -On top of that it also establishes a connection to a valid PVServer whose address -is provided by the PARAVIS engine. -""" - -__DEBUG = 0 - -def __my_log(msg): - if __DEBUG: - print "[PARAVIS] %s" % msg - -def __getFromGUI(): - """ Identify if we are running inside SALOME's embedded interpreter. - @return a value strictly greater than 0 if we are in SALOME's embedded interpreter - @return 2 if we are in Salome embedded Python console. - """ - import salome_iapp - ret = 0 - if salome_iapp.IN_SALOME_GUI: - ret += 1 - try: - if __IN_SALOME_GUI_CONSOLE: # only defined if we are in SALOME's embedded console (not only GUI) - ret += 1 - except NameError: - pass - return ret - -def ShowParaviewView(): - """ - If the import is made from SALOME embedded console, the ParaView application needs to - be instanciated to avoid a future crash. - """ - if __getFromGUI(): - __my_log("Initializing ParaView main elements, please be patient ...") - import SalomePyQt - sgPyQt = SalomePyQt.SalomePyQt() - viewIds = sgPyQt.findViews("ParaView") - if len(viewIds): - sgPyQt.setViewVisible(viewIds[0], True) - sgPyQt.activateView(viewIds[0]) - else: - sgPyQt.createView("ParaView") - # Now let the GUI main loop process the initialization event posted above - sgPyQt.processEvents() - __my_log("ParaView initialized.") - -## The below has to called BEFORE importing paraview!!! This is crazy, but it has to be. -ShowParaviewView() - -import paraview -import pvserver -from paraview import simple - -def SalomeConnectToPVServer(): - """ - Automatically connect to the right PVServer when not ("inside SALOME GUI" and "already connected"). - """ - __my_log("Connecting to PVServer ...") - server_url = "" - try: - isGUIConnected = pvserver.myPVServerService.GetGUIConnected() - if isGUIConnected and __getFromGUI(): - __my_log("Importing pvsimple from GUI and already connected. Won't reconnect.") - return - server_url = pvserver.myPVServerService.FindOrStartPVServer(0) - # Extract host and port from URL: - a = server_url.split(':') - b = a[1].split('//') - host, port = b[-1], int(a[-1]) - simple.Connect(host, port) - __my_log("Connected to %s!" % server_url) - if __getFromGUI(): - pvserver.myPVServerService.SetGUIConnected(True) - except Exception as e: - __my_log("*******************************************") - __my_log("** Could not connect to a running PVServer!") - __my_log("*******************************************") - raise e - pass - -if __getFromGUI() < 1: - # Only if not in GUI (otherwise the createView will do the connection) - SalomeConnectToPVServer() -del SalomeConnectToPVServer - -# Forward namespace of simple into current pvsimple: -for name in dir(simple): - if not name.startswith("__"): - globals()[name] = getattr(simple, name) -del simple - diff --git a/src/PV_SWIG/paravis.py b/src/PV_SWIG/paravis.py deleted file mode 100644 index f291df39..00000000 --- a/src/PV_SWIG/paravis.py +++ /dev/null @@ -1,97 +0,0 @@ -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# File : paravis.py -# Module : PARAVIS -# - -import os, new - -import PARAVIS -import SALOME -import SALOME_Session_idl -import SALOMEDS -import SALOME_ModuleCatalog -from omniORB import CORBA -from time import sleep -from salome import * - -myORB = None -myNamingService = None -myLifeCycleCORBA = None -myNamingService = None -myLocalStudyManager = None -myLocalStudy = None -myLocalParavis = None -myDelay = None -mySession = None - -## Initialization of paravis server -def Initialize(theORB, theNamingService, theLifeCycleCORBA, theStudyManager, theStudy, theDelay) : - global myORB, myNamingService, myLifeCycleCORBA, myLocalStudyManager, myLocalStudy - global mySession, myDelay - myDelay = theDelay - myORB = theORB - myNamingService = theNamingService - myLifeCycleCORBA = theLifeCycleCORBA - myLocalStudyManager = theStudyManager - while mySession == None: - mySession = myNamingService.Resolve("/Kernel/Session") - mySession = mySession._narrow(SALOME.Session) - mySession.GetInterface() - myDelay = theDelay - sleep(myDelay) - myLocalParavis = myLifeCycleCORBA.FindOrLoadComponent("FactoryServer", "PARAVIS") - myLocalStudy = theStudy - myLocalParavis.SetCurrentStudy(myLocalStudy) - myLocalParavis.ActivateModule() - return myLocalParavis - - -def ImportFile(theFileName): - "Import a file of any format supported by ParaView" - myParavis.ImportFile(theFileName) - - -def createFunction(theName): - "Create function - constructor of Paravis object" - def MyFunction(): - return myParavis.CreateClass(theName) - return MyFunction - - -def createConstructors(): - "Create constructor functions according to list of extracted classes" - g = globals() - aClassNames = myParavis.GetClassesList(); - for aName in aClassNames: - g[aName] = createFunction(aName) - -## Initialize of a PARAVIS interface -myParavis = Initialize(orb, naming_service,lcc,myStudyManager,myStudy, 2) - -## Initialize constructor functions -createConstructors() - -## Initialize Paravis static objects -vtkSMObject = vtkSMObject() -vtkProcessModule = vtkProcessModule() -vtkPVPythonModule = vtkPVPythonModule() -vtkSMProxyManager = vtkSMProxyManager() - - diff --git a/src/PV_SWIG/paravisSM.py b/src/PV_SWIG/paravisSM.py index 28929ed1..f70949db 100644 --- a/src/PV_SWIG/paravisSM.py +++ b/src/PV_SWIG/paravisSM.py @@ -17,2998 +17,15 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -r"""servermanager is a module for using paraview server manager in Python. -One can always use the server manager API directly. However, this module -provides an interface easier to use from Python by wrapping several VTK -classes around Python classes. - -Note that, upon load, this module will create several sub-modules: sources, -filters and rendering. These modules can be used to instantiate specific -proxy types. For a list, try "dir(servermanager.sources)" - -A simple example: - from paraview.servermanager import * - - # Creates a new built-in session and makes it the active session. - Connect() - - # Creates a new render view on the active session. - renModule = CreateRenderView() - - # Create a new sphere proxy on the active session and register it - # in the sources group. - sphere = sources.SphereSource(registrationGroup="sources", ThetaResolution=16, PhiResolution=32) - - # Create a representation for the sphere proxy and adds it to the render - # module. - display = CreateRepresentation(sphere, renModule) - - renModule.StillRender() +r""" This module is a direct forward to the initial +'servermanager' module of ParaView. We keep it for backward compatibility only, +technically user could directly import 'paraview.servermanager'. """ +from paraview import servermanager - -import re, os, new, sys -from paravis import * - -# VTN: Avoid paraview.* instructions in this file. -# It leads to problems during execution. - -def _wrap_property(proxy, smproperty): - """ Internal function. - Given a server manager property and its domains, returns the - appropriate python object. - """ - property = None - if smproperty.IsA("vtkSMStringVectorProperty"): - al = smproperty.GetDomain("array_list") - if al and al.IsA("vtkSMArraySelectionDomain") and \ - smproperty.GetRepeatable(): - property = ArrayListProperty(proxy, smproperty) - elif al and al.IsA("vtkSMArrayListDomain") and smproperty.GetNumberOfElements() == 5: - property = ArraySelectionProperty(proxy, smproperty) - else: - iter = smproperty.NewDomainIterator() - isFileName = False - while not iter.IsAtEnd(): - # Refer to BUG #9710 to see why optional domains need to be - # ignored. - if iter.GetDomain().IsA("vtkSMFileListDomain") and \ - iter.GetDomain().GetIsOptional() == 0 : - isFileName = True - break - iter.Next() - iter.UnRegister(None) - if isFileName: - property = FileNameProperty(proxy, smproperty) - elif _make_name_valid(smproperty.GetXMLLabel()) == 'ColorArrayName': - property = ColorArrayProperty(proxy, smproperty) - else: - property = VectorProperty(proxy, smproperty) - elif smproperty.IsA("vtkSMVectorProperty"): - if smproperty.IsA("vtkSMIntVectorProperty") and \ - smproperty.GetDomain("enum"): - property = EnumerationProperty(proxy, smproperty) - else: - property = VectorProperty(proxy, smproperty) - elif smproperty.IsA("vtkSMInputProperty"): - property = InputProperty(proxy, smproperty) - elif smproperty.IsA("vtkSMProxyProperty"): - property = ProxyProperty(proxy, smproperty) - else: - property = Property(proxy, smproperty) - return property - -class Proxy(object): - """Proxy for a server side object. A proxy manages the lifetime of - one or more server manager objects. It also provides an interface - to set and get the properties of the server side objects. These - properties are presented as Python properties. For example, - you can set a property Foo using the following: - proxy.Foo = (1,2) - or - proxy.Foo.SetData((1,2)) - or - proxy.Foo[0:2] = (1,2) - For more information, see the documentation of the property which - you can obtain with - help(proxy.Foo). - - This class also provides an iterator which can be used to iterate - over all properties. - eg: - proxy = Proxy(proxy=smproxy) - for property in proxy: - print property - - For advanced users: - This is a python class that wraps a vtkSMProxy.. Makes it easier to - set/get properties. - Instead of: - proxy.GetProperty("Foo").SetElement(0, 1) - proxy.GetProperty("Foo").SetElement(0, 2) - you can do: - proxy.Foo = (1,2) - or - proxy.Foo.SetData((1,2)) - or - proxy.Foo[0:2] = (1,2) - Instead of: - proxy.GetProperty("Foo").GetElement(0) - you can do: - proxy.Foo.GetData()[0] - or - proxy.Foo[0] - For proxy properties, you can use append: - proxy.GetProperty("Bar").AddProxy(foo) - you can do: - proxy.Bar.append(foo) - Properties support most of the list API. See VectorProperty and - ProxyProperty documentation for details. - - Please note that some of the methods accessible through the Proxy - class are not listed by help() because the Proxy objects forward - unresolved attributes to the underlying object. To get the full list, - see also dir(proxy.SMProxy). See also the doxygen based documentation - of the vtkSMProxy C++ class. - """ - - def __init__(self, **args): - """ Default constructor. It can be used to initialize properties - by passing keyword arguments where the key is the name of the - property. In addition registrationGroup and registrationName (optional) - can be specified (as keyword arguments) to automatically register - the proxy with the proxy manager. """ - self.add_attribute('Observed', None) - self.add_attribute('ObserverTag', -1) - self.add_attribute('_Proxy__Properties', {}) - self.add_attribute('_Proxy__LastAttrName', None) - self.add_attribute('SMProxy', None) - self.add_attribute('Port', 0) - - if 'port' in args: - self.Port = args['port'] - del args['port'] - - update = True - if 'no_update' in args: - if args['no_update']: - update = False - del args['no_update'] - - if 'proxy' in args: - self.InitializeFromProxy(args['proxy']) - del args['proxy'] - else: - self.Initialize(None, update) - if 'registrationGroup' in args: - registrationGroup = args['registrationGroup'] - del args['registrationGroup'] - registrationName = self.SMProxy.GetGlobalIDAsString() - if 'registrationName' in args: - registrationName = args['registrationName'] - del args['registrationName'] - pxm = ProxyManager() - pxm.RegisterProxy(registrationGroup, registrationName, self.SMProxy) - if update: - self.UpdateVTKObjects() - for key in args.keys(): - setattr(self, key, args[key]) - # Visit all properties so that they are created - for prop in self: - pass - - def __setattr__(self, name, value): - try: - setter = getattr(self.__class__, name) - setter = setter.__set__ - except AttributeError: - if not hasattr(self, name): - raise AttributeError("Attribute %s does not exist. " % name + - " This class does not allow addition of new attributes to avoid " + - "mistakes due to typos. Use add_attribute() if you really want " + - "to add this attribute.") - self.__dict__[name] = value - else: - setter(self, value) - - def add_attribute(self, name, value): - self.__dict__[name] = value - - def __del__(self): - """Destructor. Cleans up all observers as well as remove - the proxy from the _pyproxies dictionary""" - # Make sure that we remove observers we added - if self.Observed: - observed = self.Observed - tag = self.ObserverTag - self.Observed = None - self.ObserverTag = -1 - observed.RemoveObserver(tag) - if _pyproxies and self.SMProxy and (self.SMProxy, self.Port) in _pyproxies: - del _pyproxies[(self.SMProxy, self.Port)] - - def InitializeFromProxy(self, aProxy, update=True): - """Constructor. Assigns proxy to self.SMProxy, updates the server - object as well as register the proxy in _pyproxies dictionary.""" - import weakref - self.SMProxy = aProxy - if update: - self.SMProxy.UpdateVTKObjects() - _pyproxies[(self.SMProxy, self.Port)] = weakref.ref(self) - - def Initialize(self): - "Overridden by the subclass created automatically" - pass - - def __eq__(self, other): - "Returns true if the underlying SMProxies are the same." - if isinstance(other, Proxy): - try: - if self.Port != other.Port: - return False - except: - pass - ## VSV using IsSame instead == - return self.SMProxy.IsSame(other.SMProxy) - return self.SMProxy.IsSame(other) - - def __ne__(self, other): - "Returns false if the underlying SMProxies are the same." - return not self.__eq__(other) - - def __iter__(self): - "Creates an iterator for the properties." - return PropertyIterator(self) - - def SetPropertyWithName(self, pname, arg): - """Generic method for setting the value of a property.""" - prop = self.GetProperty(pname) - if prop is None: - raise RuntimeError, "Property %s does not exist. Please check the property name for typos." % pname - prop.SetData(arg) - - def GetPropertyValue(self, name): - """Returns a scalar for properties with 1 elements, the property - itself for vectors.""" - p = self.GetProperty(name) - if isinstance(p, VectorProperty): - if p.GetNumberOfElements() == 1 and not p.GetRepeatable(): - if p.SMProperty.IsA("vtkSMStringVectorProperty") or not p.GetArgumentIsArray(): - return p[0] - elif isinstance(p, InputProperty): - if not p.GetMultipleInput(): - if len(p) > 0: - return p[0] - else: - return None - elif isinstance(p, ProxyProperty): - if not p.GetRepeatable(): - if len(p) > 0: - return p[0] - else: - return None - return p - - def GetProperty(self, name): - """Given a property name, returns the property object.""" - if name in self.__Properties and self.__Properties[name](): - return self.__Properties[name]() - smproperty = self.SMProxy.GetProperty(name) - # Maybe they are looking by the label. Try to match that. - if not smproperty: - iter = PropertyIterator(self) - for prop in iter: - if name == _make_name_valid(iter.PropertyLabel): - smproperty = prop.SMProperty - break - if smproperty: - property = _wrap_property(self, smproperty) - if property is not None: - import weakref - self.__Properties[name] = weakref.ref(property) - return property - return None - - def ListProperties(self): - """Returns a list of all property names on this proxy.""" - property_list = [] - iter = self.__iter__() - for property in iter: - name = _make_name_valid(iter.PropertyLabel) - if name: - property_list.append(name) - return property_list - - def __ConvertArgumentsAndCall(self, *args): - """ Internal function. - Used to call a function on SMProxy. Converts input and - output values as appropriate. - """ - newArgs = [] - for arg in args: - if issubclass(type(arg), Proxy) or isinstance(arg, Proxy): - newArgs.append(arg.SMProxy) - else: - newArgs.append(arg) - func = getattr(self.SMProxy, self.__LastAttrName) - retVal = func(*newArgs) - if type(retVal) is type(self.SMProxy) and retVal.IsA("vtkSMProxy"): - return _getPyProxy(retVal) - elif type(retVal) is type(self.SMProxy) and retVal.IsA("vtkSMProperty"): - return _wrap_property(self, retVal) - else: - return retVal - - def __GetActiveCamera(self): - """ This method handles GetActiveCamera specially. It adds - an observer to the camera such that everytime it is modified - the render view updated""" - import weakref - c = self.SMProxy.GetActiveCamera() - # VSV: Observers are not supported -## if not c.HasObserver("ModifiedEvent"): -## self.ObserverTag =c.AddObserver("ModifiedEvent", _makeUpdateCameraMethod(weakref.ref(self))) -## self.Observed = c - return c - - def __getattr__(self, name): - """With the exception of a few overloaded methods, - returns the SMProxy method""" - if not self.SMProxy: - raise AttributeError("class %s has no attribute %s" % ("None", name)) - return None - # Handle GetActiveCamera specially. - if name == "GetActiveCamera" and \ - hasattr(self.SMProxy, "GetActiveCamera"): - return self.__GetActiveCamera - if name == "SaveDefinition" and hasattr(self.SMProxy, "SaveDefinition"): - return self.__SaveDefinition - # If not a property, see if SMProxy has the method - try: - proxyAttr = getattr(self.SMProxy, name) - self.__LastAttrName = name - return self.__ConvertArgumentsAndCall - except: - pass - return getattr(self.SMProxy, name) - -class SourceProxy(Proxy): - """Proxy for a source object. This class adds a few methods to Proxy - that are specific to sources. It also provides access to the output - ports. Output ports can be accessed by name or index: - > op = source[0] - or - > op = source['some name']. - """ - def UpdatePipeline(self, time=None): - """This method updates the server-side VTK pipeline and the associated - data information. Make sure to update a source to validate the output - meta-data.""" - if time != None: - self.SMProxy.UpdatePipeline(time) - else: - self.SMProxy.UpdatePipeline() - # This is here to cause a receive - # on the client side so that progress works properly. - if ActiveConnection and ActiveConnection.IsRemote(): - self.SMProxy.GetDataInformation() - - def FileNameChanged(self): - "Called when the filename of a source proxy is changed." - self.UpdatePipelineInformation() - - def UpdatePipelineInformation(self): - """This method updates the meta-data of the server-side VTK pipeline and - the associated information properties""" - self.SMProxy.UpdatePipelineInformation() - - def GetDataInformation(self, idx=None): - """This method returns a DataInformation wrapper around a - vtkPVDataInformation""" - if idx == None: - idx = self.Port - if self.SMProxy: - return DataInformation( \ - self.SMProxy.GetDataInformation(idx), \ - self.SMProxy, idx) - - def __getitem__(self, idx): - """Given a slice, int or string, returns the corresponding - output port""" - if isinstance(idx, slice): - indices = idx.indices(self.SMProxy.GetNumberOfOutputPorts()) - retVal = [] - for i in range(*indices): - retVal.append(OutputPort(self, i)) - return retVal - elif isinstance(idx, int): - if idx >= self.SMProxy.GetNumberOfOutputPorts() or idx < 0: - raise IndexError - return OutputPort(self, idx) - else: - return OutputPort(self, self.SMProxy.GetOutputPortIndex(idx)) - - def GetPointDataInformation(self): - """Returns the associated point data information.""" - self.UpdatePipeline() - return FieldDataInformation(self.SMProxy, self.Port, "PointData") - - def GetCellDataInformation(self): - """Returns the associated cell data information.""" - self.UpdatePipeline() - return FieldDataInformation(self.SMProxy, self.Port, "CellData") - - def GetFieldDataInformation(self): - """Returns the associated cell data information.""" - self.UpdatePipeline() - return FieldDataInformation(self.SMProxy, self.Port, "FieldData") - - PointData = property(GetPointDataInformation, None, None, "Returns point data information") - CellData = property(GetCellDataInformation, None, None, "Returns cell data information") - FieldData = property(GetFieldDataInformation, None, None, "Returns field data information") - - -class ExodusIIReaderProxy(SourceProxy): - """Special class to define convenience functions for array - selection.""" - - def FileNameChanged(self): - "Called when the filename changes. Selects all variables." - SourceProxy.FileNameChanged(self) - self.SelectAllVariables() - - def SelectAllVariables(self): - "Select all available variables for reading." - for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables', - 'ElementVariables', 'GlobalVariables'): - f = getattr(self, prop) - f.SelectAll() - - def DeselectAllVariables(self): - "Deselects all variables." - for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables', - 'ElementVariables', 'GlobalVariables'): - f = getattr(self, prop) - f.DeselectAll() - -class ViewLayoutProxy(Proxy): - """Special class to define convenience methods for View Layout""" - - def SplitViewHorizontal(self, view, fraction=0.5): - """Split the cell containing the specified view horizontally. - If no fraction is specified, the frame is split into equal parts. - On success returns a positve number that identifying the new cell - location that can be used to assign view to, or split further. - Return -1 on failure.""" - location = self.GetViewLocation(view) - if location == -1: - raise RuntimeError, "View is not present in this layout." - if fraction < 0.0 or fraction > 1.0: - raise RuntimeError, "'fraction' must be in the range [0.0, 1.0]" - return self.SMProxy.SplitHorizontal(location, fraction) - - def SplitViewVertical(self, view=None, fraction=0.5): - """Split the cell containing the specified view horizontally. - If no view is specified, active view is used. - If no fraction is specified, the frame is split into equal parts. - On success returns a positve number that identifying the new cell - location that can be used to assign view to, or split further. - Return -1 on failure.""" - location = self.GetViewLocation(view) - if location == -1: - raise RuntimeError, "View is not present in this layout." - if fraction < 0.0 or fraction > 1.0: - raise RuntimeError, "'fraction' must be in the range [0.0, 1.0]" - return self.SMProxy.SplitVertical(location, fraction) - - def AssignView(self, location, view): - """Assign a view at a particular location. Note that the view's position may - be changed by subsequent Split() calls. Returns true on success.""" - viewproxy = None - if isinstance(view, Proxy): - view = view.SMProxy - return self.SMProxy.AssignView(location, view) - - def GetViewLocation(self, view): - if isinstance(view, Proxy): - view = view.SMProxy - return self.SMProxy.GetViewLocation(view) - -class Property(object): - """Generic property object that provides access to one of the properties of - a server object. This class does not allow setting/getting any values but - provides an interface to update a property using __call__. This can be used - for command properties that correspond to function calls without arguments. - For example, - > proxy.Foo() - would push a Foo property which may cause the proxy to call a Foo method - on the actual VTK object. - - For advanced users: - Python wrapper around a vtkSMProperty with a simple interface. - In addition to all method provided by vtkSMProperty (obtained by - forwarding unknown attributes requests to the underlying SMProxy), - Property and sub-class provide a list API. - - Please note that some of the methods accessible through the Property - class are not listed by help() because the Property objects forward - unresolved attributes to the underlying object. To get the full list, - see also dir(proxy.SMProperty). See also the doxygen based documentation - of the vtkSMProperty C++ class. - """ - def __init__(self, proxy, smproperty): - """Default constructor. Stores a reference to the proxy.""" - import weakref - self.SMProperty = smproperty - self.Proxy = proxy - - def __repr__(self): - """Returns a string representation containing property name - and value""" - if not type(self) is Property: - if self.GetData() is not None: - repr = self.GetData().__repr__() - else: - repr = "None" - else: - repr = "Property name= " - name = self.Proxy.GetPropertyName(self.SMProperty) - if name: - repr += name - else: - repr += "Unknown" - - return repr - - def __call__(self): - """Forces a property update using InvokeCommand.""" - if type(self) is Property: - self.Proxy.SMProxy.InvokeCommand(self._FindPropertyName()) - else: - raise RuntimeError, "Cannot invoke this property" - - def _FindPropertyName(self): - "Returns the name of this property." - return self.Proxy.GetPropertyName(self.SMProperty) - - def _UpdateProperty(self): - "Pushes the value of this property to the server." - # For now, we are updating all properties. This is due to an - # issue with the representations. Their VTK objects are not - # created until Input is set therefore, updating a property - # has no effect. Updating all properties everytime one is - # updated has the effect of pushing values set before Input - # when Input is updated. - # self.Proxy.SMProxy.UpdateProperty(self._FindPropertyName()) - self.Proxy.SMProxy.UpdateVTKObjects() - - def __getattr__(self, name): - "Unknown attribute requests get forwarded to SMProperty." - return getattr(self.SMProperty, name) - - Name = property(_FindPropertyName, None, None, - "Returns the name for the property") - -class GenericIterator(object): - """Iterator for container type objects""" - - def __init__(self, obj): - self.Object = obj - self.index = 0 - - def __iter__(self): - return self - - def next(self): - if self.index >= len(self.Object): - raise StopIteration - - idx = self.index - self.index += 1 - return self.Object[idx] - -class VectorProperty(Property): - """A VectorProperty provides access to one or more values. You can use - a slice to get one or more property values: - > val = property[2] - or - > vals = property[0:5:2] - You can use a slice to set one or more property values: - > property[2] = val - or - > property[1:3] = (1,2) - """ - def ConvertValue(self, value): - return value - - def __len__(self): - """Returns the number of elements.""" - return self.SMProperty.GetNumberOfElements() - - def __iter__(self): - """Implementation of the sequence API""" - return GenericIterator(self) - - def __setitem__(self, idx, value): - """Given a list or tuple of values, sets a slice of values [min, max)""" - if isinstance(idx, slice): - indices = idx.indices(len(self)) - for i, j in zip(range(*indices), value): - self.SMProperty.SetElement(i, self.ConvertValue(j)) - self._UpdateProperty() - elif idx >= len(self) or idx < 0: - raise IndexError - else: - self.SMProperty.SetElement(idx, self.ConvertValue(value)) - self._UpdateProperty() - - def GetElement(self, index): - return self.SMProperty.GetElement(index) - - def __getitem__(self, idx): - """Returns the range [min, max) of elements. Raises an IndexError - exception if an argument is out of bounds.""" - ls = len(self) - if isinstance(idx, slice): - indices = idx.indices(ls) - retVal = [] - for i in range(*indices): - retVal.append(self.GetElement(i)) - return retVal - elif idx >= ls: - raise IndexError - elif idx < 0: - idx = ls + idx - if idx < 0: - raise IndexError - - return self.GetElement(idx) - - def GetData(self): - "Returns all elements as either a list or a single value." - property = self.SMProperty - if property.GetRepeatable() or \ - property.GetNumberOfElements() > 1: - return self[0:len(self)] - elif property.GetNumberOfElements() == 1: - return self.GetElement(0) - - def SetData(self, values): - """Allows setting of all values at once. Requires a single value or - a iterable object.""" - if not hasattr(values, "__iter__"): - values = (values,) - if not self.GetRepeatable() and len(values) != self.GetNumberOfElements(): - raise RuntimeError("This property requires %d values." % self.GetNumberOfElements()) - if self.GetRepeatable(): - # Clean up first - self.SMProperty.SetNumberOfElements(0) - idx = 0 - for val in values: - self.SMProperty.SetElement(idx, self.ConvertValue(val)) - idx += 1 - self._UpdateProperty() - - def Clear(self): - "Removes all elements." - self.SMProperty().SetNumberOfElements(0) - self._UpdateProperty() - -class ColorArrayProperty(VectorProperty): - """This subclass of VectorProperty handles setting of the array to - color by. It handles attribute type as well as well array name.""" - - def GetAvailable(self): - """Returns the list of available arrays as (attribute type, array name - tuples.""" - arrays = [] - for a in self.Proxy.Input.PointData: - arrays.append(('POINT_DATA', a.GetName())) - for a in self.Proxy.Input.CellData: - arrays.append(('CELL_DATA', a.GetName())) - return arrays - - def SetData(self, value): - """Overwritten to enable setting attribute type (the ColorAttributeType - property and the array name. The argument should be the array name - (in which case the first appropriate attribute type is picked) or - a tuple of attribute type and array name.""" - if isinstance(value, tuple) and len(value) == 2: - att = value[0] - arr = value[1] - elif isinstance(value, str): - att = None - arr = value - else: - raise ValueError("Expected a tuple of 2 values or a string.") - - if not arr: - self.SMProperty.SetElement(0, '') - self._UpdateProperty() - return - - found = False - for a in self.Available: - if a[1] == arr and (not att or att == a[0]): - att = a[0] - found = True - break - - if not found: - pvoptions = vtkProcessModule.GetProcessModule().GetOptions() - # if this process is from a parallel batch run in symmetric mpi mode - # then we may not have any points or cells on some processes in which - # case we'll probably be missing the point and cell data too. the - # check below makes sure that we avoid this situation. - if pvoptions.GetProcessType() != 0x40 or pvoptions.GetSymmetricMPIMode() == False \ - or len(self.Available) != 0: - raise ValueError("Could not locate array %s in the input." % arr) - - catt = self.Proxy.GetProperty("ColorAttributeType") - if att != None: - catt.SetData(att) - self.SMProperty.SetElement(0, arr) - self._UpdateProperty() - - Available = property(GetAvailable, None, None, \ - "This read-only property returns the list of arrays that can be colored by.") - - -class EnumerationProperty(VectorProperty): - """Subclass of VectorProperty that is applicable for enumeration type - properties.""" - - def GetElement(self, index): - """Returns the text for the given element if available. Returns - the numerical values otherwise.""" - val = self.SMProperty.GetElement(index) - domain = self.SMProperty.GetDomain("enum") - for i in range(domain.GetNumberOfEntries()): - if domain.GetEntryValue(i) == val: - return domain.GetEntryText(i) - return val - - def ConvertValue(self, value): - """Converts value to type suitable for vtSMProperty::SetElement()""" - if type(value) == str: - domain = self.SMProperty.GetDomain("enum") - if domain.HasEntryText(value): - return domain.GetEntryValueForText(value) - else: - raise ValueError("%s is not a valid value." % value) - return VectorProperty.ConvertValue(self, value) - - def GetAvailable(self): - "Returns the list of available values for the property." - retVal = [] - domain = self.SMProperty.GetDomain("enum") - for i in range(domain.GetNumberOfEntries()): - retVal.append(domain.GetEntryText(i)) - return retVal - - Available = property(GetAvailable, None, None, \ - "This read-only property contains the list of values that can be applied to this property.") - - -class FileNameProperty(VectorProperty): - """Property to set/get one or more file names. - This property updates the pipeline information everytime its value changes. - This is used to keep the array lists up to date.""" - - def _UpdateProperty(self): - "Pushes the value of this property to the server." - VectorProperty._UpdateProperty(self) - self.Proxy.FileNameChanged() - -class ArraySelectionProperty(VectorProperty): - "Property to select an array to be processed by a filter." - - def GetAssociation(self): - val = self.GetElement(3) - if val == "": - return None - for key, value in ASSOCIATIONS.iteritems(): - if value == int(val): - return key - - return None - - def GetArrayName(self): - return self.GetElement(4) - - def __len__(self): - """Returns the number of elements.""" - return 2 - - def __setitem__(self, idx, value): - raise RuntimeError, "This property cannot be accessed using __setitem__" - - def __getitem__(self, idx): - """Returns attribute type for index 0, array name for index 1""" - if isinstance(idx, slice): - indices = idx.indices(len(self)) - retVal = [] - for i in range(*indices): - if i >= 2 or i < 0: - raise IndexError - if i == 0: - retVal.append(self.GetAssociation()) - else: - retVal.append(self.GetArrayName()) - return retVal - elif idx >= 2 or idx < 0: - raise IndexError - - if i == 0: - return self.GetAssociation() - else: - return self.GetArrayName() - - def SetData(self, values): - """Allows setting of all values at once. Requires a single value, - a tuple or list.""" - if not isinstance(values, tuple) and \ - not isinstance(values, list): - values = (values,) - if len(values) == 1: - self.SMProperty.SetElement(4, values[0]) - elif len(values) == 2: - if isinstance(values[0], str): - val = str(ASSOCIATIONS[values[0]]) - else: - # In case user didn't specify valid association, - # just pick POINTS. - val = str(ASSOCIATIONS['POINTS']) - self.SMProperty.SetElement(3, str(val)) - self.SMProperty.SetElement(4, values[1]) - else: - raise RuntimeError, "Expected 1 or 2 values." - self._UpdateProperty() - - def UpdateDefault(self): - "Helper method to set default values." - if self.SMProperty.GetNumberOfElements() != 5: - return - if self.GetElement(4) != '' or \ - self.GetElement(3) != '': - return - - for i in range(0,3): - if self.GetElement(i) == '': - self.SMProperty.SetElement(i, '0') - al = self.SMProperty.GetDomain("array_list") - al.Update(self.SMProperty) - al.SetDefaultValues(self.SMProperty) - -class ArrayListProperty(VectorProperty): - """This property provides a simpler interface for selecting arrays. - Simply assign a list of arrays that should be loaded by the reader. - Use the Available property to get a list of available arrays.""" - - def __init__(self, proxy, smproperty): - VectorProperty.__init__(self, proxy, smproperty) - self.__arrays = [] - - def GetAvailable(self): - "Returns the list of available arrays" - dm = self.GetDomain("array_list") - retVal = [] - for i in range(dm.GetNumberOfStrings()): - retVal.append(dm.GetString(i)) - return retVal - - Available = property(GetAvailable, None, None, \ - "This read-only property contains the list of items that can be read by a reader.") - - def SelectAll(self): - "Selects all arrays." - self.SetData(self.Available) - - def DeselectAll(self): - "Deselects all arrays." - self.SetData([]) - - def __iter__(self): - """Implementation of the sequence API""" - return GenericIterator(self) - - def __len__(self): - """Returns the number of elements.""" - return len(self.GetData()) - - def __setitem__(self, idx, value): - """Given a list or tuple of values, sets a slice of values [min, max)""" - self.GetData() - if isinstance(idx, slice): - indices = idx.indices(len(self)) - for i, j in zip(range(*indices), value): - self.__arrays[i] = j - self.SetData(self.__arrays) - elif idx >= len(self) or idx < 0: - raise IndexError - else: - self.__arrays[idx] = self.ConvertValue(value) - self.SetData(self.__arrays) - - def __getitem__(self, idx): - """Returns the range [min, max) of elements. Raises an IndexError - exception if an argument is out of bounds.""" - self.GetData() - if isinstance(idx, slice): - indices = idx.indices(len(self)) - retVal = [] - for i in range(*indices): - retVal.append(self.__arrays[i]) - return retVal - elif idx >= len(self) or idx < 0: - raise IndexError - return self.__arrays[idx] - - def SetData(self, values): - """Allows setting of all values at once. Requires a single value, - a tuple or list.""" - # Clean up first - iup = self.SMProperty.GetImmediateUpdate() - self.SMProperty.SetImmediateUpdate(False) - # Clean up first - self.SMProperty.SetNumberOfElements(0) - if not isinstance(values, tuple) and \ - not isinstance(values, list): - values = (values,) - fullvalues = [] - - # WARNING: - # The order of the two loops below are delibrately set in this way - # so that values passed in will take precedence. - # This is needed for backward compatibility of the - # property ElementBlocks for vtkExodusIIReader. - # If you attemp to change this, please verify that - # python state files for opening old .ex2 file (<=3.14) still works. - for array in self.Available: - if not values.__contains__(array): - fullvalues.append(array) - fullvalues.append('0') - - for i in range(len(values)): - val = self.ConvertValue(values[i]) - fullvalues.append(val) - fullvalues.append('1') - - - i = 0 - for value in fullvalues: - self.SMProperty.SetElement(i, value) - i += 1 - - self._UpdateProperty() - self.SMProperty.SetImmediateUpdate(iup) - - def GetData(self): - "Returns all elements as a list." - property = self.SMProperty - nElems = property.GetNumberOfElements() - if nElems%2 != 0: - raise ValueError, "The SMProperty with XML label '%s' has a size that is not a multiple of 2." % property.GetXMLLabel() - self.__arrays = [] - for i in range(0, nElems, 2): - if self.GetElement(i+1) != '0': - self.__arrays.append(self.GetElement(i)) - return list(self.__arrays) - -class ProxyProperty(Property): - """A ProxyProperty provides access to one or more proxies. You can use - a slice to get one or more property values: - > proxy = property[2] - or - > proxies = property[0:5:2] - You can use a slice to set one or more property values: - > property[2] = proxy - or - > property[1:3] = (proxy1, proxy2) - You can also append and delete: - > property.append(proxy) - and - > del property[1:2] - - You can also remove all elements with Clear(). - - Note that some properties expect only 1 proxy and will complain if - you set the number of values to be something else. - """ - def __init__(self, proxy, smproperty): - """Default constructor. Stores a reference to the proxy. Also looks - at domains to find valid values.""" - Property.__init__(self, proxy, smproperty) - # Check to see if there is a proxy list domain and, if so, - # initialize ourself. (Should this go in ProxyProperty?) - listdomain = self.GetDomain('proxy_list') - if listdomain: - if listdomain.GetClassName() != 'vtkSMProxyListDomain': - raise ValueError, "Found a 'proxy_list' domain on an InputProperty that is not a ProxyListDomain." - pm = ProxyManager() - group = "pq_helper_proxies." + proxy.GetGlobalIDAsString() - if listdomain.GetNumberOfProxies() == 0: - for i in xrange(listdomain.GetNumberOfProxyTypes()): - igroup = listdomain.GetProxyGroup(i) - name = listdomain.GetProxyName(i) - iproxy = CreateProxy(igroup, name) - listdomain.AddProxy(iproxy) - pm.RegisterProxy(group, proxy.GetPropertyName(smproperty), iproxy) - listdomain.SetDefaultValues(self.SMProperty) - - def GetAvailable(self): - """If this proxy has a list domain, then this function returns the - strings you can use to select from the domain. If there is no such - list domain, the returned list is empty.""" - listdomain = self.GetDomain('proxy_list') - retval = [] - if listdomain: - for i in xrange(listdomain.GetNumberOfProxies()): - proxy = listdomain.GetProxy(i) - retval.append(proxy.GetXMLLabel()) - return retval - - Available = property(GetAvailable, None, None, - """This read only property is a list of strings you can - use to select from the list domain. If there is no - such list domain, the array is empty.""") - - def __iter__(self): - """Implementation of the sequence API""" - return GenericIterator(self) - - def __len__(self): - """Returns the number of elements.""" - return self.SMProperty.GetNumberOfProxies() - - def remove(self, proxy): - """Removes the first occurence of the proxy from the property.""" - self.SMProperty.RemoveProxy(proxy.SMProxy) - self._UpdateProperty() - - def __setitem__(self, idx, value): - """Given a list or tuple of values, sets a slice of values [min, max)""" - if isinstance(idx, slice): - indices = idx.indices(len(self)) - for i, j in zip(range(*indices), value): - self.SMProperty.SetProxy(i, j.SMProxy) - self._UpdateProperty() - elif idx >= len(self) or idx < 0: - raise IndexError - else: - self.SMProperty.SetProxy(idx, value.SMProxy) - self._UpdateProperty() - - def __delitem__(self,idx): - """Removes the element idx""" - if isinstance(idx, slice): - indices = idx.indices(len(self)) - # Collect the elements to delete to a new list first. - # Otherwise indices are screwed up during the actual - # remove loop. - toremove = [] - for i in range(*indices): - toremove.append(self[i]) - for i in toremove: - self.SMProperty.RemoveProxy(i.SMProxy) - self._UpdateProperty() - elif idx >= len(self) or idx < 0: - raise IndexError - else: - self.SMProperty.RemoveProxy(self[idx].SMProxy) - self._UpdateProperty() - - def __getitem__(self, idx): - """Returns the range [min, max) of elements. Raises an IndexError - exception if an argument is out of bounds.""" - if isinstance(idx, slice): - indices = idx.indices(len(self)) - retVal = [] - for i in range(*indices): - retVal.append(_getPyProxy(self.SMProperty.GetProxy(i))) - return retVal - elif idx >= len(self) or idx < 0: - raise IndexError - return _getPyProxy(self.SMProperty.GetProxy(idx)) - - def __getattr__(self, name): - "Unknown attribute requests get forwarded to SMProperty." - return getattr(self.SMProperty, name) - - def index(self, proxy): - idx = 0 - for px in self: - ## VSV: == - if proxy.IsSame(px): - return idx - idx += 1 - raise ValueError("proxy is not in the list.") - - def append(self, proxy): - "Appends the given proxy to the property values." - self.SMProperty.AddProxy(proxy.SMProxy) - self._UpdateProperty() - - def GetData(self): - "Returns all elements as either a list or a single value." - property = self.SMProperty - if property.GetRepeatable() or property.GetNumberOfProxies() > 1: - return self[0:len(self)] - else: - if property.GetNumberOfProxies() > 0: - return _getPyProxy(property.GetProxy(0)) - return None - - def SetData(self, values): - """Allows setting of all values at once. Requires a single value, - a tuple or list.""" - if isinstance(values, str): - position = -1 - try: - position = self.Available.index(values) - except: - raise ValueError, values + " is not a valid object in the domain." - values = self.GetDomain('proxy_list').GetProxy(position) - if not isinstance(values, tuple) and \ - not isinstance(values, list): - values = (values,) - self.SMProperty.RemoveAllProxies() - for value in values: - if isinstance(value, Proxy): - value_proxy = value.SMProxy - else: - value_proxy = value - self.SMProperty.AddProxy(value_proxy) - self._UpdateProperty() - - def Clear(self): - "Removes all elements." - self.SMProperty.RemoveAllProxies() - self._UpdateProperty() - -class InputProperty(ProxyProperty): - """An InputProperty allows making pipeline connections. You can set either - a source proxy or an OutputProperty to an input property: - - > property[0] = proxy - or - > property[0] = OuputPort(proxy, 1) - - > property.append(proxy) - or - > property.append(OutputPort(proxy, 0)) - """ - def __setitem__(self, idx, value): - """Given a list or tuple of values, sets a slice of values [min, max)""" - if isinstance(idx, slice): - indices = idx.indices(len(self)) - for i, j in zip(range(*indices), value): - op = value[i-min] - self.SMProperty.SetInputConnection(i, op.SMProxy, op.Port) - self._UpdateProperty() - elif idx >= len(self) or idx < 0: - raise IndexError - else: - self.SMProperty.SetInputConnection(idx, value.SMProxy, value.Port) - self._UpdateProperty() - - def __getitem__(self, idx): - """Returns the range [min, max) of elements. Raises an IndexError - exception if an argument is out of bounds.""" - if isinstance(idx, slice): - indices = idx.indices(len(self)) - retVal = [] - for i in range(*indices): - port = None - if self.SMProperty.GetProxy(i): - port = OutputPort(_getPyProxy(self.SMProperty.GetProxy(i)),\ - self.SMProperty.GetOutputPortForConnection(i)) - retVal.append(port) - return retVal - elif idx >= len(self) or idx < 0: - raise IndexError - return OutputPort(_getPyProxy(self.SMProperty.GetProxy(idx)),\ - self.SMProperty.GetOutputPortForConnection(idx)) - - def append(self, value): - """Appends the given proxy to the property values. - Accepts Proxy or OutputPort objects.""" - self.SMProperty.AddInputConnection(value.SMProxy, value.Port) - self._UpdateProperty() - - def GetData(self): - """Returns all elements as either a list of OutputPort objects or - a single OutputPort object.""" - property = self.SMProperty - if property.GetRepeatable() or property.GetNumberOfProxies() > 1: - return self[0:len(self)] - else: - if property.GetNumberOfProxies() > 0: - return OutputPort(_getPyProxy(property.GetProxy(0)),\ - self.SMProperty.GetOutputPortForConnection(0)) - return None - - def SetData(self, values): - """Allows setting of all values at once. Requires a single value, - a tuple or list. Accepts Proxy or OutputPort objects.""" - if isinstance(values, str): - ProxyProperty.SetData(self, values) - return - if not isinstance(values, tuple) and \ - not isinstance(values, list): - values = (values,) - self.SMProperty.RemoveAllProxies() - for value in values: - if value: - self.SMProperty.AddInputConnection(value.SMProxy, value.Port) - self._UpdateProperty() - - def _UpdateProperty(self): - "Pushes the value of this property to the server." - ProxyProperty._UpdateProperty(self) - iter = PropertyIterator(self.Proxy) - for prop in iter: - if isinstance(prop, ArraySelectionProperty): - prop.UpdateDefault() - - -class DataInformation(object): - """DataInformation is a contained for meta-data associated with an - output data. - - DataInformation is a python wrapper around a vtkPVDataInformation. - In addition to proving all methods of a vtkPVDataInformation, it provides - a few convenience methods. - - Please note that some of the methods accessible through the DataInformation - class are not listed by help() because the DataInformation objects forward - unresolved attributes to the underlying object. To get the full list, - see also dir(proxy.DataInformation). - See also the doxygen based documentation of the vtkPVDataInformation C++ - class. - """ - def __init__(self, dataInformation, proxy, idx): - """Default constructor. Requires a vtkPVDataInformation, a source proxy - and an output port id.""" - self.DataInformation = dataInformation - self.Proxy = proxy - self.Idx = idx - - def Update(self): - """****Deprecated**** There is no reason anymore to use this method - explicitly, it is called automatically when one gets any value from the - data information object. - Update the data information if necessary. Note that this - does not cause execution of the underlying object. In certain - cases, you may have to call UpdatePipeline() on the proxy.""" - if self.Proxy: - self.Proxy.GetDataInformation(self.Idx) - - def GetDataSetType(self): - """Returns the dataset type as defined in vtkDataObjectTypes.""" - self.Update() - if not self.DataInformation: - raise RuntimeError, "No data information is available" - if self.DataInformation.GetCompositeDataSetType() > -1: - return self.DataInformation.GetCompositeDataSetType() - return self.DataInformation.GetDataSetType() - - def GetDataSetTypeAsString(self): - """Returns the dataset type as a user-friendly string. This is - not the same as the enumaration used by VTK""" - return vtk.vtkDataObjectTypes.GetClassNameFromTypeId(self.GetDataSetType()) - - def __getattr__(self, name): - """Forwards unknown attribute requests to the underlying - vtkPVInformation.""" - if not self.DataInformation: - raise AttributeError("class has no attribute %s" % name) - return None - self.Update() - return getattr(self.DataInformation, name) - -class ArrayInformation(object): - """Meta-information associated with an array. Use the Name - attribute to get the array name. - - Please note that some of the methods accessible through the ArrayInformation - class are not listed by help() because the ArrayInformation objects forward - unresolved attributes to the underlying object. - See the doxygen based documentation of the vtkPVArrayInformation C++ - class for a full list. - """ - def __init__(self, proxy, field, name): - self.Proxy = proxy - self.FieldData = field - self.Name = name - - def __getattr__(self, name): - """Forward unknown methods to vtkPVArrayInformation""" - array = self.FieldData.GetFieldData().GetArrayInformation(self.Name) - if not array: return None - return getattr(array, name) - - def __repr__(self): - """Returns a user-friendly representation string.""" - return "Array: " + self.Name - - def GetRange(self, component=0): - """Given a component, returns its value range as a tuple of 2 values.""" - array = self.FieldData.GetFieldData().GetArrayInformation(self.Name) - range = array.GetComponentRange(component) - return (range[0], range[1]) - -class FieldDataInformationIterator(object): - """Iterator for FieldDataInformation""" - - def __init__(self, info, items=False): - self.FieldDataInformation = info - self.index = 0 - self.items = items - - def __iter__(self): - return self - - def next(self): - if self.index >= self.FieldDataInformation.GetNumberOfArrays(): - raise StopIteration - - self.index += 1 - ai = self.FieldDataInformation[self.index-1] - if self.items: - return (ai.GetName(), ai) - else: - return ai - - -class FieldDataInformation(object): - """Meta-data for a field of an output object (point data, cell data etc...). - Provides easy access to the arrays using the slice interface: - > narrays = len(field_info) - > for i in range(narrays): - > array_info = field_info[i] - - Full slice interface is supported: - > arrays = field_info[0:5:3] - where arrays is a list. - - Array access by name is also possible: - > array_info = field_info['Temperature'] - - The number of arrays can also be accessed using the NumberOfArrays - property. - """ - def __init__(self, proxy, idx, field): - self.Proxy = proxy - self.OutputPort = idx - self.FieldData = field - - def GetFieldData(self): - """Convenience method to get the underlying - vtkPVDataSetAttributesInformation""" - return getattr(self.Proxy.GetDataInformation(self.OutputPort), "Get%sInformation" % self.FieldData)() - - def GetNumberOfArrays(self): - """Returns the number of arrays.""" - self.Proxy.UpdatePipeline() - return self.GetFieldData().GetNumberOfArrays() - - def GetArray(self, idx): - """Given an index or a string, returns an array information. - Raises IndexError if the index is out of bounds.""" - self.Proxy.UpdatePipeline() - if not self.GetFieldData().GetArrayInformation(idx): - return None - if isinstance(idx, str): - return ArrayInformation(self.Proxy, self, idx) - elif idx >= len(self) or idx < 0: - raise IndexError - return ArrayInformation(self.Proxy, self, self.GetFieldData().GetArrayInformation(idx).GetName()) - - def __len__(self): - """Returns the number of arrays.""" - return self.GetNumberOfArrays() - - def __getitem__(self, idx): - """Implements the [] operator. Accepts an array name.""" - if isinstance(idx, slice): - indices = idx.indices(self.GetNumberOfArrays()) - retVal = [] - for i in range(*indices): - retVal.append(self.GetArray(i)) - return retVal - return self.GetArray(idx) - - def keys(self): - """Implementation of the dictionary API""" - kys = [] - narrays = self.GetNumberOfArrays() - for i in range(narrays): - kys.append(self.GetArray(i).GetName()) - return kys - - def values(self): - """Implementation of the dictionary API""" - vals = [] - narrays = self.GetNumberOfArrays() - for i in range(narrays): - vals.append(self.GetArray(i)) - return vals - - def iteritems(self): - """Implementation of the dictionary API""" - return FieldDataInformationIterator(self, True) - - def items(self): - """Implementation of the dictionary API""" - itms = [] - narrays = self.GetNumberOfArrays() - for i in range(narrays): - ai = self.GetArray(i) - itms.append((ai.GetName(), ai)) - return itms - - def has_key(self, key): - """Implementation of the dictionary API""" - if self.GetArray(key): - return True - return False - - def __iter__(self): - """Implementation of the dictionary API""" - return FieldDataInformationIterator(self) - - def __getattr__(self, name): - """Forwards unknown attributes to the underlying - vtkPVDataSetAttributesInformation""" - array = self.GetArray(name) - if array: return array - raise AttributeError("class has no attribute %s" % name) - return None - - NumberOfArrays = property(GetNumberOfArrays, None, None, "Returns the number of arrays.") - -def OutputPort(proxy, outputPort=0): - if not Proxy: - return None - if isinstance(outputPort, str): - outputPort = proxy.GetOutputPortIndex(outputPort) - if outputPort >= proxy.GetNumberOfOutputPorts(): - return None - if proxy.Port == outputPort: - return proxy - newinstance = _getPyProxy(proxy.SMProxy, outputPort) - newinstance.Port = outputPort - newinstance._Proxy__Properties = proxy._Proxy__Properties - return newinstance - -class ProxyManager(object): - """When running scripts from the python shell in the ParaView application, - registering proxies with the proxy manager is the only mechanism to - notify the graphical user interface (GUI) that a proxy - exists. Therefore, unless a proxy is registered, it will not show up in - the user interface. Also, the proxy manager is the only way to get - access to proxies created using the GUI. Proxies created using the GUI - are automatically registered under an appropriate group (sources, - filters, representations and views). To get access to these objects, - you can use proxyManager.GetProxy(group, name). The name is the same - as the name shown in the pipeline browser. - - This class is a python wrapper for vtkSMProxyManager. Note that the - underlying vtkSMProxyManager is a singleton. All instances of this - class will refer to the same object. In addition to all methods provided by - vtkSMProxyManager (all unknown attribute requests are forwarded - to the vtkSMProxyManager), this class provides several convenience - methods. - - Please note that some of the methods accessible through the ProxyManager - class are not listed by help() because the ProxyManager objects forwards - unresolved attributes to the underlying object. To get the full list, - see also dir(proxy.SMProxyManager). See also the doxygen based documentation - of the vtkSMProxyManager C++ class. - """ - - def __init__(self, session=None): - """Constructor. Assigned self.SMProxyManager to - vtkSMProxyManager.GetProxyManager().""" - global ActiveConnection - if not session: - session = ActiveConnection.Session - self.SMProxyManager = session.GetSessionProxyManager() - - def RegisterProxy(self, group, name, aProxy): - """Registers a proxy (either SMProxy or proxy) with the - server manager""" - if isinstance(aProxy, Proxy): - self.SMProxyManager.RegisterProxy(group, name, aProxy.SMProxy) - else: - self.SMProxyManager.RegisterProxy(group, name, aProxy) - - def NewProxy(self, group, name): - """Creates a new proxy of given group and name and returns an SMProxy. - Note that this is a server manager object. You should normally create - proxies using the class objects. For example: - obj = servermanager.sources.SphereSource()""" - if not self.SMProxyManager: - return None - aProxy = self.SMProxyManager.NewProxy(group, name, "NULL") - if not aProxy: - return None - aProxy.UnRegister(None) - return aProxy - - def GetProxy(self, group, name): - """Returns a Proxy registered under a group and name""" - if not self.SMProxyManager: - return None - aProxy = self.SMProxyManager.GetProxy(group, name) - if not aProxy: - return None - return _getPyProxy(aProxy) - - def GetPrototypeProxy(self, group, name): - """Returns a prototype proxy given a group and name. This is an - SMProxy. This is a low-level method. You should not normally - have to call it.""" - if not self.SMProxyManager: - return None - aProxy = self.SMProxyManager.GetPrototypeProxy(group, name) - if not aProxy: - return None - return aProxy - - def GetProxiesInGroup(self, groupname): - """Returns a map of proxies in a particular group.""" - proxies = {} - iter = self.NewGroupIterator(groupname) - for aProxy in iter: - proxies[(iter.GetKey(), aProxy.GetGlobalIDAsString())] = aProxy - return proxies - - def UnRegisterProxy(self, groupname, proxyname, aProxy): - """Unregisters a proxy.""" - if not self.SMProxyManager: - return - if aProxy != None and isinstance(aProxy,Proxy): - aProxy = aProxy.SMProxy - if aProxy: - self.SMProxyManager.UnRegisterProxy(groupname, proxyname, aProxy) - - def GetProxies(self, groupname, proxyname): - """Returns all proxies registered under the given group with the - given name. Note that it is possible to register more than one - proxy with the same name in the same group. Because the proxies - are different, there is no conflict. Use this method instead of - GetProxy() if you know that there are more than one proxy registered - with this name.""" - if not self.SMProxyManager: - return [] - collection = vtk.vtkCollection() - result = [] - self.SMProxyManager.GetProxies(groupname, proxyname, collection) - for i in range(0, collection.GetNumberOfItems()): - aProxy = _getPyProxy(collection.GetItemAsObject(i)) - if aProxy: - result.append(aProxy) - - return result - - def __iter__(self): - """Returns a new ProxyIterator.""" - iter = ProxyIterator() - iter.Begin() - return iter - - def NewGroupIterator(self, group_name): - """Returns a ProxyIterator for a group. The resulting object - can be used to traverse the proxies that are in the given - group.""" - iter = self.__iter__() - iter.SetModeToOneGroup() - iter.Begin(group_name) - return iter - - def NewDefinitionIterator(self, groupname=None): - """Returns an iterator that can be used to iterate over - all groups and types of proxies that the proxy manager - can create.""" - iter = None - if groupname != None: - iter = ProxyDefinitionIterator(self.GetProxyDefinitionManager().NewSingleGroupIterator(groupname,0)) - else: - iter = ProxyDefinitionIterator(self.GetProxyDefinitionManager().NewIterator(0)) - - return iter - - def __ConvertArgumentsAndCall(self, *args): - newArgs = [] - for arg in args: - if issubclass(type(arg), Proxy) or isinstance(arg, Proxy): - newArgs.append(arg.SMProxy) - else: - newArgs.append(arg) - func = getattr(self.SMProxyManager, self.__LastAttrName) - retVal = func(*newArgs) - if type(retVal) is type(self.SMProxyManager) and retVal.IsA("vtkSMProxy"): - return _getPyProxy(retVal) - else: - return retVal - - def __getattr__(self, name): - """Returns attribute from the ProxyManager""" - try: - pmAttr = getattr(self.SMProxyManager, name) - self.__LastAttrName = name - return self.__ConvertArgumentsAndCall - except: - pass - return getattr(self.SMProxyManager, name) - - def LoadState(self, filename, loader = None): - self.SMProxyManager.LoadXMLState(filename, loader) - - def SaveState(self, filename): - self.SMProxyManager.SaveXMLState(filename) - -class PropertyIterator(object): - """Wrapper for a vtkSMPropertyIterator class to satisfy - the python iterator protocol. Note that the list of - properties can also be obtained from the class object's - dictionary. - See the doxygen documentation for vtkSMPropertyIterator C++ - class for details. - """ - - def __init__(self, aProxy): - self.SMIterator = aProxy.NewPropertyIterator() - if self.SMIterator: - self.SMIterator.UnRegister(None) - self.SMIterator.Begin() - self.Key = None - self.PropertyLabel = None - self.Proxy = aProxy - - def __iter__(self): - return self - - def next(self): - if not self.SMIterator: - raise StopIteration - - if self.SMIterator.IsAtEnd(): - self.Key = None - raise StopIteration - self.Key = self.SMIterator.GetKey() - self.PropertyLabel = self.SMIterator.GetPropertyLabel() - self.SMIterator.Next() - return self.Proxy.GetProperty(self.Key) - - def GetProxy(self): - """Returns the proxy for the property last returned by the call to - 'next()'""" - return self.Proxy - - def GetKey(self): - """Returns the key for the property last returned by the call to - 'next()' """ - return self.Key - - def GetProperty(self): - """Returns the property last returned by the call to 'next()' """ - return self.Proxy.GetProperty(self.Key) - - def __getattr__(self, name): - """returns attributes from the vtkSMPropertyIterator.""" - return getattr(self.SMIterator, name) - -class ProxyDefinitionIterator(object): - """Wrapper for a vtkPVProxyDefinitionIterator class to satisfy - the python iterator protocol. - See the doxygen documentation of the vtkPVProxyDefinitionIterator - C++ class for more information.""" - def __init__(self, iter): - self.SMIterator = iter - if self.SMIterator: - self.SMIterator.UnRegister(None) - self.SMIterator.InitTraversal() - self.Group = None - self.Key = None - - def __iter__(self): - return self - - def next(self): - if self.SMIterator.IsDoneWithTraversal(): - self.Group = None - self.Key = None - raise StopIteration - self.Group = self.SMIterator.GetGroupName() - self.Key = self.SMIterator.GetProxyName() - self.SMIterator.GoToNextItem() - return {"group": self.Group, "key":self.Key } - - def GetProxyName(self): - """Returns the key for the proxy definition last returned by the call - to 'next()' """ - return self.Key - - def GetGroup(self): - """Returns the group for the proxy definition last returned by the - call to 'next()' """ - return self.Group - - def __getattr__(self, name): - """returns attributes from the vtkPVProxyDefinitionIterator.""" - return getattr(self.SMIterator, name) - - -class ProxyIterator(object): - """Wrapper for a vtkSMProxyIterator class to satisfy the - python iterator protocol. - See the doxygen documentation of vtkSMProxyIterator C++ class for - more information. - """ - def __init__(self): - self.SMIterator = vtkSMProxyIterator() - self.SMIterator.SetSession(ActiveConnection.Session) - self.SMIterator.Begin() - self.AProxy = None - self.Group = None - self.Key = None - - def __iter__(self): - return self - - def next(self): - if self.SMIterator.IsAtEnd(): - self.AProxy = None - self.Group = None - self.Key = None - raise StopIteration - return None - self.AProxy = _getPyProxy(self.SMIterator.GetProxy()) - self.Group = self.SMIterator.GetGroup() - self.Key = self.SMIterator.GetKey() - self.SMIterator.Next() - return self.AProxy - - def GetProxy(self): - """Returns the proxy last returned by the call to 'next()'""" - return self.AProxy - - def GetKey(self): - """Returns the key for the proxy last returned by the call to - 'next()' """ - return self.Key - - def GetGroup(self): - """Returns the group for the proxy last returned by the call to - 'next()' """ - return self.Group - - def __getattr__(self, name): - """returns attributes from the vtkSMProxyIterator.""" - return getattr(self.SMIterator, name) - -# Caution: Observers must be global methods otherwise we run into memory -# leak when the interpreter get reset from the C++ layer. -def _update_definitions(caller, event): - updateModules(ActiveConnection.Modules) - -class Connection(object): - """ - This is a python representation for a session/connection. - """ - def __init__(self, connectionId, session): - """Default constructor. Creates a Connection with the given - ID, all other data members initialized to None.""" - global MultiServerConnections - global ActiveConnection - self.ID = connectionId - self.Session = session - self.Modules = PVModule() - self.Alive = True - self.DefinitionObserverTag = 0 - self.CustomDefinitionObserverTag = 0 - if MultiServerConnections == None and ActiveConnection: - raise RuntimeError, "Concurrent connections not supported!" - if MultiServerConnections != None and not self in MultiServerConnections: - MultiServerConnections.append(self) - ActiveConnection = self - __InitAfterConnect__(self) - __exposeActiveModules__() - - def __eq__(self, other): - "Returns true if the connection ids are the same." - return (self.ID == other.ID) - - def __repr__(self): - """User friendly string representation""" - return "Connection (%s) [%d]" % (self.Session.GetURI(), self.ID) - - def GetURI(self): - """Get URI of the connection""" - return self.Session.GetURI() - - def IsRemote(self): - """Returns True if the connection to a remote server, False if - it is local (built-in)""" - if self.Session.IsA("vtkSMSessionClient"): - return True - return False - - def GetNumberOfDataPartitions(self): - """Returns the number of partitions on the data server for this - connection""" - return self.Session.GetServerInformation().GetNumberOfProcesses() - - def AttachDefinitionUpdater(self): - """Attach observer to automatically update modules when needed.""" - # VTN: Observers are not supported - # ProxyDefinitionsUpdated = 2000 -## self.DefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2000, _update_definitions) - # CompoundProxyDefinitionsUpdated = 2001 -## self.CustomDefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2001, _update_definitions) - pass - - def close(self): - if self.DefinitionObserverTag: - self.Session.GetProxyDefinitionManager().RemoveObserver(self.DefinitionObserverTag) - self.Session.GetProxyDefinitionManager().RemoveObserver(self.CustomDefinitionObserverTag) - self.Session = None - self.Modules = None - self.Alive = False - - def __del__(self): - if self.Alive: - self.close() - -def SaveState(filename): - """Given a state filename, saves the state of objects registered - with the proxy manager.""" - pm = ProxyManager() - pm.SaveState(filename) - -def LoadState(filename, connection=None): - """Given a state filename and an optional connection, loads the server - manager state.""" - if not connection: - connection = ActiveConnection - if not connection: - raise RuntimeError, "Cannot load state without a connection" - pm = ProxyManager() - pm.LoadState(filename, None) - views = GetRenderViews() - for view in views: - # Make sure that the client window size matches the - # ViewSize property. In paraview, the GUI takes care - # of this. - if view.GetClassName() == "vtkSMIceTDesktopRenderViewProxy": - view.GetRenderWindow().SetSize(view.ViewSize[0], \ - view.ViewSize[1]) - -def InitFromGUI(): - """ - Method used to initialize the Python Shell from the ParaView GUI. - """ - global fromGUI, ActiveConnection -# if not fromGUI: -# print "from paraview.simple import *" - fromGUI = True - # ToggleProgressPrinting() ### FIXME COLLABORATION - enableMultiServer(vtkProcessModule.GetProcessModule().GetMultipleSessionsSupport()) - iter = vtkProcessModule.GetProcessModule().NewSessionIterator(); - iter.InitTraversal() - ActiveConnection = None - activeSession = vtkSMProxyManager.GetProxyManager().GetActiveSession() - tmpActiveConnection = None - while not iter.IsDoneWithTraversal(): - c = Connection(iter.GetCurrentSessionId(), iter.GetCurrentSession()) - if c.Session == activeSession: - tmpActiveConnection = c - iter.GoToNextItem() - iter.UnRegister(None) - if tmpActiveConnection: - ActiveConnection = tmpActiveConnection - -def Connect(ds_host=None, ds_port=11111, rs_host=None, rs_port=22221): - """ - Use this function call to create a new session. On success, - it returns a vtkSMSession object that abstracts the connection. - Otherwise, it returns None. - There are several ways in which this function can be called: - * When called with no arguments, it creates a new session - to the built-in server on the client itself. - * When called with ds_host and ds_port arguments, it - attempts to connect to a server(data and render server on the same server) - on the indicated host:port. - * When called with ds_host, ds_port, rs_host, rs_port, it - creates a new connection to the data server on ds_host:ds_port and to the - render server on rs_host: rs_port. - """ - if ds_host == None: - session = vtkSMSession() - elif rs_host == None: - session = vtkSMSessionClient() - session.Connect("cs://%s:%d" % (ds_host, ds_port)) - else: - session = vtkSMSessionClient() - session.Connect("cdsrs://%s:%d/%s:%d" % (ds_host, ds_port, rs_host, rs_port)) - id = vtkProcessModule.GetProcessModule().RegisterSession(session) - connection = Connection(id, session) - return connection - -def ReverseConnect(port=11111): - """ - Use this function call to create a new session. On success, - it returns a Session object that abstracts the connection. - Otherwise, it returns None. - In reverse connection mode, the client waits for a connection - from the server (client has to be started first). The server - then connects to the client (run pvserver with -rc and -ch - option). - The optional port specified the port to listen to. - """ - session = vtkSMSessionClient() - session.Connect("csrc://hostname:" + port) - id = vtkProcessModule.GetProcessModule().RegisterSession(session) - connection = Connection(id, session) - return connection - -def Disconnect(session=None): - """Disconnects the connection. Make sure to clear the proxy manager - first.""" - global ActiveConnection - global MultiServerConnections - global fromGUI - if fromGUI: - # Let the UI know that we want to disconnect - ActiveConnection.Session.InvokeEvent('ExitEvent') - return - if ActiveConnection and (not session or session == ActiveConnection.Session): - session = ActiveConnection.Session - if MultiServerConnections: - MultiServerConnections.remove(ActiveConnection) - ActiveConnection.close() - ActiveConnection = None - switchActiveConnection() - else: - ActiveConnection.close() - ActiveConnection = None - elif MultiServerConnections: - for connection in MultiServerConnections: - if connection.Session == session: - connection.close() - MultiServerConnections.remove(connection) - if session: - vtkProcessModule.GetProcessModule().UnRegisterSession(session) - return - -def CreateProxy(xml_group, xml_name, session=None): - """Creates a proxy. If session is set, the proxy's session is - set accordingly. If session is None, the current Session is used, if - present. You should not have to use method normally. Instantiate the - appropriate class from the appropriate module, for example: - sph = servermanager.sources.SphereSource()""" - global ActiveConnection - if not session: - session = ActiveConnection.Session - if not session: - raise RuntimeError, "Cannot create objects without a session." - pxm = ProxyManager(session) - return pxm.NewProxy(xml_group, xml_name) - -def GetRenderView(connection=None): - """Return the render view in use. If more than one render view is in - use, return the first one.""" - - render_module = None - for aProxy in ProxyManager(): - if aProxy.IsA("vtkSMRenderViewProxy"): - render_module = aProxy - break - return render_module - -def GetRenderViews(connection=None): - """Returns the set of all render views.""" - render_modules = [] - for aProxy in ProxyManager(): - if aProxy.IsA("vtkSMRenderViewProxy"): - render_modules.append(aProxy) - return render_modules - -def GetContextViews(connection=None): - """Returns the set of all context views.""" - context_modules = [] - for aProxy in ProxyManager(): - if aProxy.IsA("vtkSMContextViewProxy"): - context_modules.append(aProxy) - return context_modules - -def CreateRenderView(session=None, **extraArgs): - """Creates a render window on the particular session. If session - is not specified, then the active session is used, if available. - - This method can also be used to initialize properties by passing - keyword arguments where the key is the name of the property. In addition - registrationGroup and registrationName (optional) can be specified (as - keyword arguments) to automatically register the proxy with the proxy - manager.""" - return _create_view("RenderView", session, **extraArgs) - -def _create_view(view_xml_name, session=None, **extraArgs): - """Creates a view on the particular session. If session - is not specified, then the active session is used, if available. - This method can also be used to initialize properties by passing - keyword arguments where the key is the name of the property.""" - if not session: - session = ActiveConnection.Session - if not session: - raise RuntimeError, "Cannot create view without session." - pxm = ProxyManager() - view_module = None - if view_xml_name: - view_module = CreateProxy("views", view_xml_name, session) - if not view_module: - return None - extraArgs['proxy'] = view_module - python_proxy_name = _make_name_valid(view_module.GetXMLName()) - proxy = rendering.__dict__[python_proxy_name](**extraArgs) - return proxy - -def GetRepresentation(aProxy, view): - for rep in view.Representations: - #VSV: == - try: isRep = rep.Input.IsSame(aProxy) - except: isRep = False - if isRep: return rep - return None - -def CreateRepresentation(aProxy, view, **extraArgs): - """Creates a representation for the proxy and adds it to the render - module. - - This method can also be used to initialize properties by passing - keyword arguments where the key is the name of the property.In addition - registrationGroup and registrationName (optional) can be specified (as - keyword arguments) to automatically register the proxy with the proxy - manager. - - This method tries to create the best possible representation for the given - proxy in the given view. Additionally, the user can specify proxyName - (optional) to create a representation of a particular type.""" - - global rendering - if not aProxy: - raise RuntimeError, "proxy argument cannot be None." - if not view: - raise RuntimeError, "view argument cannot be None." - if "proxyName" in extraArgs: - display = CreateProxy("representations", extraArgs['proxyName'], None) - del extraArgs['proxyName'] - else: - display = view.SMProxy.CreateDefaultRepresentation(aProxy.SMProxy, 0) - if display: - display.UnRegister(None) - if not display: - return None - extraArgs['proxy'] = display - proxy = rendering.__dict__[display.GetXMLName()](**extraArgs) - proxy.Input = aProxy - proxy.UpdateVTKObjects() - view.Representations.append(proxy) - return proxy - -class _ModuleLoader(object): - def find_module(self, fullname, path=None): - if vtkPVPythonModule.HasModule(fullname): - return self - else: - return None - def load_module(self, fullname): - import imp - moduleInfo = vtkPVPythonModule.GetModule(fullname) - if not moduleInfo: - raise ImportError - module = sys.modules.setdefault(fullname, imp.new_module(fullname)) - module.__file__ = "<%s>" % moduleInfo.GetFullName() - module.__loader__ = self - if moduleInfo.GetIsPackage: - module.__path__ = moduleInfo.GetFullName() - code = compile(moduleInfo.GetSource(), module.__file__, 'exec') - exec code in module.__dict__ - return module - -def LoadXML(xmlstring): - """DEPRECATED. Given a server manager XML as a string, parse and process it.""" - raise RuntimeError, "Deprecated. Use LoadPlugin(...) instead." - - -def LoadPlugin(filename, remote=True, connection=None): - """ Given a filename and a session (optional, otherwise uses - ActiveConnection), loads a plugin. It then updates the sources, - filters and rendering modules.""" - - if not connection: - connection = ActiveConnection - if not connection: - raise RuntimeError, "Cannot load a plugin without a connection." - plm = vtkSMProxyManager.GetProxyManager().GetPluginManager() - - if remote: - status = plm.LoadRemotePlugin(filename, connection.Session) - else: - status = plm.LoadLocalPlugin(filename) - - # shouldn't the extension check happend before attempting to load the plugin? - if not status: - raise RuntimeError, "Problem loading plugin %s" % (filename) - else: - # we should never have to call this. The modules should update automatically. - updateModules(connection.Modules) - - -def Fetch(input, arg1=None, arg2=None, idx=0): - """ - A convenience method that moves data from the server to the client, - optionally performing some operation on the data as it moves. - The input argument is the name of the (proxy for a) source or filter - whose output is needed on the client. - - You can use Fetch to do three things: - - If arg1 is None (the default) then all of the data is brought to the client. - In parallel runs an appropriate append Filter merges the - data on each processor into one data object. The filter chosen will be - vtkAppendPolyData for vtkPolyData, vtkAppendRectilinearGrid for - vtkRectilinearGrid, vtkMultiBlockDataGroupFilter for vtkCompositeData, - and vtkAppendFilter for anything else. - - If arg1 is an integer then one particular processor's output is brought to - the client. In serial runs the arg is ignored. If you have a filter that - computes results in parallel and brings them to the root node, then set - arg to be 0. - - If arg1 and arg2 are a algorithms, for example vtkMinMax, the algorithm - will be applied to the data to obtain some result. Here arg1 will be - applied pre-gather and arg2 will be applied post-gather. In parallel - runs the algorithm will be run on each processor to make intermediate - results and then again on the root processor over all of the - intermediate results to create a global result. - - Optional argument idx is used to specify the output port number to fetch the - data from. Default is port 0. - """ - - import types - - reducer = filters.ReductionFilter(Input=OutputPort(input,idx)) - - #create the pipeline that reduces and transmits the data - if arg1 == None: - cdinfo = input.GetDataInformation(idx).GetCompositeDataInformation() - if cdinfo.GetDataIsComposite(): - print "use composite data append" - reducer.PostGatherHelperName = "vtkMultiBlockDataGroupFilter" - - elif input.GetDataInformation(idx).GetDataClassName() == "vtkPolyData": - print "use append poly data filter" - reducer.PostGatherHelperName = "vtkAppendPolyData" - - elif input.GetDataInformation(idx).GetDataClassName() == "vtkRectilinearGrid": - print "use append rectilinear grid filter" - reducer.PostGatherHelperName = "vtkAppendRectilinearGrid" - - elif input.GetDataInformation(idx).IsA("vtkDataSet"): - print "use unstructured append filter" - reducer.PostGatherHelperName = "vtkAppendFilter" - - elif type(arg1) is types.IntType: - reducer.PassThrough = arg1 - - else: - reducer.PreGatherHelper = arg1 - reducer.PostGatherHelper = arg2 - - # reduce - reducer.UpdatePipeline() - dataInfo = reducer.GetDataInformation(0) - dataType = dataInfo.GetDataSetType() - if dataInfo.GetCompositeDataSetType() > 0: - dataType = dataInfo.GetCompositeDataSetType() - - fetcher = filters.ClientServerMoveData(Input=reducer) - fetcher.OutputDataType = dataType - fetcher.WholeExtent = dataInfo.GetExtent()[:] - #fetch - fetcher.UpdatePipeline() - - op = fetcher.GetClientSideObject().GetOutputDataObject(0) - opc = op.NewInstance() - opc.ShallowCopy(op) - opc.UnRegister(None) - return opc - -def AnimateReader(reader, view, filename=None): - """This is a utility function that, given a reader and a view - animates over all time steps of the reader. If the optional - filename is provided, a movie is created (type depends on the - extension of the filename.""" - if not reader: - raise RuntimeError, "No reader was specified, cannot animate." - if not view: - raise RuntimeError, "No view was specified, cannot animate." - # Create an animation scene - scene = animation.AnimationScene() - - # We need to have the reader and the view registered with - # the time keeper. This is how the scene gets its time values. - try: - tk = ProxyManager().GetProxiesInGroup("timekeeper").values()[0] - scene.TimeKeeper = tk - except IndexError: - tk = misc.TimeKeeper() - scene.TimeKeeper = tk - - if not reader in tk.TimeSources: - tk.TimeSources.append(reader) - if not view in tk.Views: - tk.Views.append(view) - - - # with 1 view - scene.ViewModules = [view] - # Update the reader to get the time information - reader.UpdatePipelineInformation() - # Animate from 1st time step to last - scene.StartTime = reader.TimestepValues.GetData()[0] - scene.EndTime = reader.TimestepValues.GetData()[-1] - - # Each frame will correspond to a time step - scene.PlayMode = 2 #Snap To Timesteps - - # Create a special animation cue for time. - cue = animation.TimeAnimationCue() - cue.AnimatedProxy = view - cue.AnimatedPropertyName = "ViewTime" - scene.Cues = [cue] - - if filename: - writer = vtkSMAnimationSceneImageWriter() - writer.SetFileName(filename) - writer.SetFrameRate(1) - writer.SetAnimationScene(scene.SMProxy) - - # Now save the animation. - if not writer.Save(): - raise RuntimeError, "Saving of animation failed!" - else: - scene.Play() - return scene - -def GetProgressPrintingIsEnabled(): - return progressObserverTag is not None - -def SetProgressPrintingEnabled(value): - """Is not supported because of not supported observers""" - pass - -def ToggleProgressPrinting(): - """Turn on/off printing of progress. See SetProgressPrintingEnabled.""" - SetProgressPrintingEnabled(not GetProgressPrintingIsEnabled()) - -def Finalize(): - """Although not required, this can be called at exit to cleanup.""" - global progressObserverTag - # Make sure to remove the observer - if progressObserverTag: - ToggleProgressPrinting() - vtkInitializationHelper.Finalize() - -# Internal methods - -def _getPyProxy(smproxy, outputPort=0): - """Returns a python wrapper for a server manager proxy. This method - first checks if there is already such an object by looking in the - _pyproxies group and returns it if found. Otherwise, it creates a - new one. Proxies register themselves in _pyproxies upon creation.""" - if not smproxy: - return None - if (smproxy, outputPort) in _pyproxies: - return _pyproxies[(smproxy, outputPort)]() - - xmlName = smproxy.GetXMLName() - if smproxy.GetXMLLabel(): - xmlName = smproxy.GetXMLLabel() - classForProxy = _findClassForProxy(_make_name_valid(xmlName), smproxy.GetXMLGroup()) - if classForProxy: - retVal = classForProxy(proxy=smproxy, port=outputPort) - else: - retVal = Proxy(proxy=smproxy, port=outputPort) - return retVal - -def _makeUpdateCameraMethod(rv): - """ This internal method is used to create observer methods """ - if not hasattr(rv(), "BlockUpdateCamera"): - rv().add_attribute("BlockUpdateCamera", False) - def UpdateCamera(obj, string): - if not rv().BlockUpdateCamera: - # used to avoid some nasty recursion that occurs when interacting in - # the GUI. - rv().BlockUpdateCamera = True - rv().SynchronizeCameraProperties() - rv().BlockUpdateCamera = False - return UpdateCamera - -def _createInitialize(group, name): - """Internal method to create an Initialize() method for the sub-classes - of Proxy""" - pgroup = group - pname = name - def aInitialize(self, connection=None, update=True): - if not connection: - connection = ActiveConnection - if not connection: - raise RuntimeError,\ - 'Cannot create a proxy without a session.' - if not connection.Session.GetProxyDefinitionManager().HasDefinition(pgroup, pname): - error_msg = "The connection does not provide any definition for %s." % pname - raise RuntimeError, error_msg - self.InitializeFromProxy(\ - CreateProxy(pgroup, pname, connection.Session), update) - return aInitialize - -def _createGetProperty(pName): - """Internal method to create a GetXXX() method where XXX == pName.""" - propName = pName - def getProperty(self): - return self.GetPropertyValue(propName) - return getProperty - -def _createSetProperty(pName): - """Internal method to create a SetXXX() method where XXX == pName.""" - propName = pName - def setProperty(self, value): - return self.SetPropertyWithName(propName, value) - return setProperty - -def _findClassForProxy(xmlName, xmlGroup): - """Given the xmlName for a proxy, returns a Proxy class. Note - that if there are duplicates, the first one is returned.""" - global sources, filters, writers, rendering, animation, implicit_functions,\ - piecewise_functions, extended_sources, misc - if not xmlName: - return None - if xmlGroup == "sources": - return sources.__dict__[xmlName] - elif xmlGroup == "filters": - return filters.__dict__[xmlName] - elif xmlGroup == "implicit_functions": - return implicit_functions.__dict__[xmlName] - elif xmlGroup == "piecewise_functions": - return piecewise_functions.__dict__[xmlName] - elif xmlGroup == "writers": - return writers.__dict__[xmlName] - elif xmlGroup == "extended_sources": - return extended_sources.__dict__[xmlName] - elif xmlName in rendering.__dict__: - return rendering.__dict__[xmlName] - elif xmlName in animation.__dict__: - return animation.__dict__[xmlName] - elif xmlName in misc.__dict__: - return misc.__dict__[xmlName] - else: - return None - -def _printProgress(caller, event): - """The default event handler for progress. Prints algorithm - name and 1 '.' per 10% progress.""" - global currentAlgorithm, currentProgress - - pm = vtkProcessModule.GetProcessModule() - progress = pm.GetLastProgress() / 10 - # If we got a 100% as the first thing, ignore - # This is to get around the fact that some vtk - # algorithms report 100% more than once (which is - # a bug) - if not currentAlgorithm and progress == 10: - return - alg = pm.GetLastProgressName() - if alg != currentAlgorithm and alg: - if currentAlgorithm: - while currentProgress <= 10: - import sys - sys.stdout.write(".") - currentProgress += 1 - print "]" - currentProgress = 0 - print alg, ": [ ", - currentAlgorithm = alg - while currentProgress <= progress: - import sys - sys.stdout.write(".") - #sys.stdout.write("%d " % pm.GetLastProgress()) - currentProgress += 1 - if progress == 10: - print "]" - currentAlgorithm = None - currentProgress = 0 - -def updateModules(m): - """Called when a plugin is loaded, this method updates - the proxy class object in all known modules.""" - - createModule("sources", m.sources) - createModule("filters", m.filters) - createModule("writers", m.writers) - createModule("representations", m.rendering) - createModule("views", m.rendering) - createModule("lookup_tables", m.rendering) - createModule("textures", m.rendering) - createModule('cameramanipulators', m.rendering) - createModule("animation", m.animation) - createModule("misc", m.misc) - createModule('animation_keyframes', m.animation) - createModule('implicit_functions', m.implicit_functions) - createModule('piecewise_functions', m.piecewise_functions) - createModule("extended_sources", m.extended_sources) - createModule("incremental_point_locators", m.misc) - -def _createModules(m): - """Called when the module is loaded, this creates sub- - modules for all know proxy groups.""" - - m.sources = createModule('sources') - m.filters = createModule('filters') - m.writers = createModule('writers') - m.rendering = createModule('representations') - createModule('views', m.rendering) - createModule("lookup_tables", m.rendering) - createModule("textures", m.rendering) - createModule('cameramanipulators', m.rendering) - m.animation = createModule('animation') - createModule('animation_keyframes', m.animation) - m.implicit_functions = createModule('implicit_functions') - m.piecewise_functions = createModule('piecewise_functions') - m.extended_sources = createModule("extended_sources") - m.misc = createModule("misc") - createModule("incremental_point_locators", m.misc) - -class PVModule(object): - pass - -def _make_name_valid(name): - """Make a string into a valid Python variable name.""" - if not name: - return None - import string - valid_chars = "_%s%s" % (string.ascii_letters, string.digits) - name = str().join([c for c in name if c in valid_chars]) - if not name[0].isalpha(): - name = 'a' + name - return name - -def createModule(groupName, mdl=None): - """Populates a module with proxy classes defined in the given group. - If mdl is not specified, it also creates the module""" - global ActiveConnection - - if not ActiveConnection: - raise RuntimeError, "Please connect to a server using \"Connect\"" - - pxm = ProxyManager() - # Use prototypes to find all proxy types. - pxm.InstantiateGroupPrototypes(groupName) - - debug = False - if not mdl: - debug = True - mdl = PVModule() - definitionIter = pxm.NewDefinitionIterator(groupName) - for i in definitionIter: - proxyName = i['key'] - proto = pxm.GetPrototypeProxy(groupName, proxyName) - if not proto: - print "Error while loading %s/%s %s"%(groupName, i['group'], proxyName) - continue - pname = proxyName - if proto.GetXMLLabel(): - pname = proto.GetXMLLabel() - pname = _make_name_valid(pname) - if not pname: - continue - if pname in mdl.__dict__: - if debug: - print "Warning: %s is being overwritten. This may point to an issue in the ParaView configuration files" % pname - cdict = {} - # Create an Initialize() method for this sub-class. - cdict['Initialize'] = _createInitialize(groupName, proxyName) - iter = PropertyIterator(proto) - # Add all properties as python properties. - for prop in iter: - propName = iter.GetKey() - if (prop.GetInformationOnly() and propName != "TimestepValues" ) \ - or prop.GetIsInternal(): - continue - names = [propName] - names = [iter.PropertyLabel] - - propDoc = None - if prop.GetDocumentation(): - propDoc = prop.GetDocumentation().GetDescription() - for name in names: - name = _make_name_valid(name) - if name: - cdict[name] = property(_createGetProperty(propName), - _createSetProperty(propName), - None, - propDoc) - # Add the documentation as the class __doc__ - if proto.GetDocumentation() and \ - proto.GetDocumentation().GetDescription(): - doc = proto.GetDocumentation().GetDescription() - else: - doc = Proxy.__doc__ - cdict['__doc__'] = doc - # Create the new type - if proto.GetXMLName() == "ExodusIIReader": - superclasses = (ExodusIIReaderProxy,) - elif proto.IsA("vtkSMSourceProxy"): - superclasses = (SourceProxy,) - elif proto.IsA("vtkSMViewLayoutProxy"): - superclasses = (ViewLayoutProxy,) - else: - superclasses = (Proxy,) - - cobj = type(pname, superclasses, cdict) - # Add it to the modules dictionary - mdl.__dict__[pname] = cobj - return mdl - - -def __determineGroup(proxy): - """Internal method""" - if not proxy: - return None - xmlgroup = proxy.GetXMLGroup() - xmlname = proxy.GetXMLName() - if xmlgroup == "sources": - if xmlname in ["BlockSelectionSource", - "FrustumSelectionSource", - "GlobalIDSelectionSource", - "PedigreeIDSelectionSource", - "IDSelectionSource", - "CompositeDataIDSelectionSource", - "HierarchicalDataIDSelectionSource", - "ThresholdSelectionSource", - "LocationSelectionSource"]: - return "selection_sources" - return "sources" - elif xmlgroup == "filters": - return "sources" - elif xmlgroup == "representations": - if xmlname == "ScalarBarWidgetRepresentation": - return "scalar_bars" - return "representations" - elif xmlgroup == "animation_keyframes": - return "animation" - return xmlgroup - -__nameCounter = {} -def __determineName(proxy, group): - global __nameCounter - name = _make_name_valid(proxy.GetXMLLabel()) - if not name: - return None - if not __nameCounter.has_key(name): - __nameCounter[name] = 1 - val = 1 - else: - __nameCounter[name] += 1 - val = __nameCounter[name] - return "%s%d" % (name, val) - -def __getName(proxy, group): - pxm = ProxyManager(proxy.GetSession()) - if isinstance(proxy, Proxy): - proxy = proxy.SMProxy - return pxm.GetProxyName(group, proxy) - -class MissingRegistrationInformation(Exception): - """Exception for missing registration information. Raised when a name or group - is not specified or when a group cannot be deduced.""" - pass - -class MissingProxy(Exception): - """Exception fired when the requested proxy is missing.""" - pass - -def Register(proxy, **extraArgs): - """Registers a proxy with the proxy manager. If no 'registrationGroup' is - specified, then the group is inferred from the type of the proxy. - 'registrationName' may be specified to register with a particular name - otherwise a default name will be created.""" - # TODO: handle duplicate registration - if "registrationGroup" in extraArgs: - registrationGroup = extraArgs["registrationGroup"] - else: - registrationGroup = __determineGroup(proxy) - - if "registrationName" in extraArgs: - registrationName = extraArgs["registrationName"] - else: - registrationName = __determineName(proxy, registrationGroup) - if registrationGroup and registrationName: - pxm = ProxyManager() - pxm.RegisterProxy(registrationGroup, registrationName, proxy) - else: - raise MissingRegistrationInformation, "Registration error %s %s." % (registrationGroup, registrationName) - return (registrationGroup, registrationName) - -def UnRegister(proxy, **extraArgs): - """UnRegisters proxies registered using Register().""" - if "registrationGroup" in extraArgs: - registrationGroup = extraArgs["registrationGroup"] - else: - registrationGroup = __determineGroup(proxy) - - if "registrationName" in extraArgs: - registrationName = extraArgs["registrationName"] - else: - registrationName = __getName(proxy, registrationGroup) - - if registrationGroup and registrationName: - pxm = ProxyManager() - pxm.UnRegisterProxy(registrationGroup, registrationName, proxy) - else: - raise RuntimeError, "UnRegistration error." - return (registrationGroup, registrationName) - -def demo1(): - """This simple demonstration creates a sphere, renders it and delivers - it to the client using Fetch. It returns a tuple of (data, render - view)""" - if not ActiveConnection: - Connect() - ss = sources.Sphere(Radius=2, ThetaResolution=32) - shr = filters.Shrink(Input=OutputPort(ss,0)) - cs = sources.Cone() - app = filters.AppendDatasets() - app.Input = [shr, cs] - rv = CreateRenderView() - rep = CreateRepresentation(app, rv) - rv.ResetCamera() - rv.StillRender() - data = Fetch(ss) - - return (data, rv) - -def demo2(fname="/Users/berk/Work/ParaViewData/Data/disk_out_ref.ex2"): - """This method demonstrates the user of a reader, representation and - view. It also demonstrates how meta-data can be obtained using proxies. - Make sure to pass the full path to an exodus file. Also note that certain - parameters are hard-coded for disk_out_ref.ex2 which can be found - in ParaViewData. This method returns the render view.""" - if not ActiveConnection: - Connect() - # Create the exodus reader and specify a file name - reader = sources.ExodusIIReader(FileName=fname) - # Get the list of point arrays. - arraySelection = reader.PointVariables - print arraySelection.Available - # Select all arrays - arraySelection.SetData(arraySelection.Available) - - # Next create a default render view appropriate for the session type. - rv = CreateRenderView() - # Create the matching representation - rep = CreateRepresentation(reader, rv) - rep.Representation = 1 # Wireframe - # Black background is not pretty - rv.Background = [0.4, 0.4, 0.6] - rv.StillRender() - # Reset the camera to include the whole thing - rv.ResetCamera() - rv.StillRender() - # Change the elevation of the camera. See VTK documentation of vtkCamera - # for camera parameters. - c = rv.GetActiveCamera() - c.Elevation(45) - rv.StillRender() - # Now that the reader execute, let's get some information about it's - # output. - pdi = reader[0].PointData - # This prints a list of all read point data arrays as well as their - # value ranges. - print 'Number of point arrays:', len(pdi) - for i in range(len(pdi)): - ai = pdi[i] - print "----------------" - print "Array:", i, ai.Name, ":" - numComps = ai.GetNumberOfComponents() - print "Number of components:", numComps - for j in range(numComps): - print "Range:", ai.GetRange(j) - # White is boring. Let's color the geometry using a variable. - # First create a lookup table. This object controls how scalar - # values are mapped to colors. See VTK documentation for - # details. - lt = rendering.PVLookupTable() - # Assign it to the representation - rep.LookupTable = lt - # Color by point array called Pres - rep.ColorAttributeType = 0 # point data - rep.ColorArrayName = "Pres" - # Add to RGB points. These are tuples of 4 values. First one is - # the scalar values, the other 3 the RGB values. This list has - # 2 points: Pres: 0.00678, color: blue, Pres: 0.0288, color: red - lt.RGBPoints = [0.00678, 0, 0, 1, 0.0288, 1, 0, 0] - lt.ColorSpace = 1 # HSV - rv.StillRender() - return rv - -def demo3(): - """This method demonstrates the use of servermanager with numpy as - well as pylab for plotting. It creates an artificial data sources, - probes it with a line, delivers the result to the client using Fetch - and plots it using pylab. This demo requires numpy and pylab installed. - It returns a tuple of (data, render view).""" - import paraview.numpy_support - import pylab - - if not ActiveConnection: - Connect() - # Create a synthetic data source - source = sources.Wavelet() - # Let's get some information about the data. First, for the - # source to execute - source.UpdatePipeline() - - di = source.GetDataInformation() - print "Data type:", di.GetPrettyDataTypeString() - print "Extent:", di.GetExtent() - print "Array name:", \ - source[0].PointData[0].Name - - rv = CreateRenderView() - - rep1 = CreateRepresentation(source, rv) - rep1.Representation = 3 # outline - - # Let's apply a contour filter - cf = filters.Contour(Input=source, ContourValues=[200]) - - # Select the array to contour by - #cf.SelectInputScalars = 'RTData' - - rep2 = CreateRepresentation(cf, rv) - - rv.Background = (0.4, 0.4, 0.6) - # Reset the camera to include the whole thing - rv.StillRender() - rv.ResetCamera() - rv.StillRender() - - # Now, let's probe the data - probe = filters.ResampleWithDataset(Input=source) - # with a line - line = sources.Line(Resolution=60) - # that spans the dataset - bounds = di.GetBounds() - print "Bounds: ", bounds - line.Point1 = bounds[0:6:2] - line.Point2 = bounds[1:6:2] - - probe.Source = line - - # Render with the line - rep3 = CreateRepresentation(line, rv) - rv.StillRender() - - # Now deliver it to the client. Remember, this is for small data. - data = Fetch(probe) - # Convert it to a numpy array - data = paraview.numpy_support.vtk_to_numpy( - data.GetPointData().GetArray("RTData")) - # Plot it using matplotlib - pylab.plot(data) - pylab.show() - - return (data, rv, probe) - -def demo4(fname="/Users/berk/Work/ParaViewData/Data/can.ex2"): - """This method demonstrates the user of AnimateReader for - creating animations.""" - if not ActiveConnection: - Connect() - reader = sources.ExodusIIReader(FileName=fname) - view = CreateRenderView() - repr = CreateRepresentation(reader, view) - view.StillRender() - view.ResetCamera() - view.StillRender() - c = view.GetActiveCamera() - c.Elevation(95) - return AnimateReader(reader, view) - - -def demo5(): - """ Simple sphere animation""" - if not ActiveConnection: - Connect() - sphere = sources.Sphere() - view = CreateRenderView() - repr = CreateRepresentation(sphere, view) - - view.StillRender() - view.ResetCamera() - view.StillRender() - - # Create an animation scene - scene = animation.AnimationScene() - # Add 1 view - scene.ViewModules = [view] - - # Create a cue to animate the StartTheta property - cue = animation.KeyFrameAnimationCue() - cue.AnimatedProxy = sphere - cue.AnimatedPropertyName = "StartTheta" - # Add it to the scene's cues - scene.Cues = [cue] - - # Create 2 keyframes for the StartTheta track - keyf0 = animation.CompositeKeyFrame() - keyf0.Type = 2 # Set keyframe interpolation type to Ramp. - # At time = 0, value = 0 - keyf0.KeyTime = 0 - keyf0.KeyValues= [0] - - keyf1 = animation.CompositeKeyFrame() - # At time = 1.0, value = 200 - keyf1.KeyTime = 1.0 - keyf1.KeyValues= [200] - - # Add keyframes. - cue.KeyFrames = [keyf0, keyf1] - - scene.Play() - return scene - -ASSOCIATIONS = { 'POINTS' : 0, 'CELLS' : 1, 'VERTICES' : 4, 'EDGES' : 5, 'ROWS' : 6} - -# Users can set the active connection which will be used by API -# to create proxies etc when no connection argument is passed. -# Connect() automatically sets this if it is not already set. -ActiveConnection = None - -# Fields for multi-server support -MultiServerConnections = None - -# API for multi-server support -def enableMultiServer(multiServer=True): - """This method enable the current servermanager to support several - connections. Once we enable the multi-server support, the user can create - as many connection as he want and switch from one to another in order to - create and manage proxy.""" - global MultiServerConnections, ActiveConnection - if not multiServer and MultiServerConnections: - raise RuntimeError, "Once we enable Multi-Server support we can not get back" - MultiServerConnections = [] - if ActiveConnection: - MultiServerConnections.append(ActiveConnection) - -def switchActiveConnection(newActiveConnection=None): - """Switch active connection to be the provided one or if none just pick the - other one""" - global MultiServerConnections, ActiveConnection - if MultiServerConnections == None: - raise RuntimeError, "enableMultiServer() must be called before" - - # Manage the case when no connection is provided - if newActiveConnection: - ActiveConnection = newActiveConnection - __exposeActiveModules__() - # Update active session for ParaView - if vtkSMProxyManager.GetProxyManager().GetActiveSession() != ActiveConnection.Session: - vtkSMProxyManager.GetProxyManager().SetActiveSession(ActiveConnection.Session) - return ActiveConnection - else: - for connection in MultiServerConnections: - if connection != ActiveConnection: - ActiveConnection = connection - __exposeActiveModules__() - # Update active session for ParaView - if vtkSMProxyManager.GetProxyManager().GetActiveSession() != ActiveConnection.Session: - vtkSMProxyManager.GetProxyManager().SetActiveSession(ActiveConnection.Session) - return ActiveConnection - return None - -# Needs to be called when paraview module is loaded from python instead -# of pvpython, pvbatch or GUI. -if not vtkProcessModule.GetProcessModule(): -# pvoptions = None Not applicable for SALOME Python console -# if paraview.options.batch: -# pvoptions = vtkPVOptions(); -# pvoptions.SetProcessType(0x40) -# if paraview.options.symmetric: -# pvoptions.SetSymmetricMPIMode(True) - vtkInitializationHelper.Initialize(sys.executable, - vtkProcessModule.PROCESS_CLIENT, pvoptions) - -# Initialize progress printing. Can be turned off by calling -# ToggleProgressPrinting() again. -progressObserverTag = None -currentAlgorithm = False -currentProgress = 0 -fromGUI = False -ToggleProgressPrinting() - -_pyproxies = {} - -# Create needed sub-modules -# We can no longer create modules, unless we have connected to a server. -# _createModules() - -# Set up our custom importer (if possible) -loader = _ModuleLoader() -sys.meta_path.append(loader) - -def __InitAfterConnect__(connection): - """ - This function is called everytime after a server connection is made. - Since the ProxyManager and all proxy definitions are changed every time a - new connection is made, we re-create all the modules - """ - _createModules(connection.Modules) - ## VSV fromFilter is alwais False for SALOME because it can't be changed from ParaView code - #if not paraview.fromFilter: - # fromFilter is set when this module is imported from the programmable - # filter -# global _defUpdater -# _defUpdater = __DefinitionUpdater() - connection.AttachDefinitionUpdater() - pass - -def __exposeActiveModules__(): - """Update servermanager submodules to point to the current - ActiveConnection.Modules.*""" - # Expose all active module to the current servermanager module - if ActiveConnection: - for m in [mName for mName in dir(ActiveConnection.Modules) if mName[0] != '_' ]: - exec "global %s;%s = ActiveConnection.Modules.%s" % (m,m,m) - -# Definitions for working in SALOME GUI mode -#aParams = myParavis.GetConnectionParameters() -#ActiveConnection = Connect() -##Connection(aParams[0]) -#ActiveConnection.SetHost(aParams[1], aParams[2], aParams[3], aParams[4], aParams[5]) -#ToggleProgressPrinting() -#fromGUI = True - -InitFromGUI() - -if hasattr(sys, "ps1"): - # session is interactive. - print vtkSMProxyManager.GetParaViewSourceVersion(); - -def GetConnectionFromId(id): - for connection in MultiServerConnections: - if connection.ID == id: - return connection - return None - -def GetConnectionFromSession(session): - for connection in MultiServerConnections: - if connection.Session == session: - return connection - return None - -def GetConnectionAt(index): - return MultiServerConnections[index] - -def GetNumberOfConnections(): - return len(MultiServerConnections) - -#VTN: Problem during execution -#atexit.register(vtkPythonProgrammableFilter.DeleteGlobalPythonInterpretor) +for name in dir(servermanager): + if not name.startswith("__"): + globals()[name] = getattr(servermanager, name) +del servermanager + diff --git a/src/PV_SWIG/presentations.py b/src/PV_SWIG/presentations.py index fa4fc359..979d3380 100644 --- a/src/PV_SWIG/presentations.py +++ b/src/PV_SWIG/presentations.py @@ -1111,8 +1111,7 @@ def ScalarMapOnField(proxy, entity, field_name, timestamp_nb, lookup_table.LockScalarRange = 1 lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] # Set properties - scalarmap.ColorAttributeType = EntityType.get_pvtype(entity) - scalarmap.ColorArrayName = field_name + scalarmap.ColorArrayName = (EntityType.get_pvtype(entity), field_name) scalarmap.LookupTable = lookup_table # Add scalar bar @@ -1196,8 +1195,7 @@ def CutPlanesOnField(proxy, entity, field_name, timestamp_nb, lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] # Set properties - cut_planes.ColorAttributeType = EntityType.get_pvtype(entity) - cut_planes.ColorArrayName = field_name + cut_planes.ColorArrayName = (EntityType.get_pvtype(entity), field_name) cut_planes.LookupTable = lookup_table # Add scalar bar @@ -1338,8 +1336,7 @@ def CutLinesOnField(proxy, entity, field_name, timestamp_nb, lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] # Set properties - cut_lines.ColorAttributeType = EntityType.get_pvtype(entity) - cut_lines.ColorArrayName = field_name + cut_lines.ColorArrayName = (EntityType.get_pvtype(entity), field_name) cut_lines.LookupTable = lookup_table # Set wireframe represenatation mode @@ -1412,8 +1409,7 @@ def CutSegmentOnField(proxy, entity, field_name, timestamp_nb, lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] # Set properties - cut_segment.ColorAttributeType = EntityType.get_pvtype(entity) - cut_segment.ColorArrayName = field_name + cut_segment.ColorArrayName = (EntityType.get_pvtype(entity), field_name) cut_segment.LookupTable = lookup_table # Set wireframe represenatation mode @@ -1487,7 +1483,7 @@ def VectorsOnField(proxy, entity, field_name, timestamp_nb, glyph = pvs.Glyph(source) glyph.Vectors = vector_array glyph.ScaleMode = 'vector' - glyph.MaskPoints = 0 + #glyph.MaskPoints = 0 # Set glyph type glyph.GlyphType = glyph_type @@ -1508,11 +1504,11 @@ def VectorsOnField(proxy, entity, field_name, timestamp_nb, glyph.GlyphType.Center = [0.0, 0.0, 0.0] if scale_factor is not None: - glyph.SetScaleFactor = scale_factor + glyph.ScaleFactor = scale_factor else: def_scale = get_default_scale(PrsTypeEnum.DEFORMEDSHAPE, proxy, entity, field_name) - glyph.SetScaleFactor = def_scale + glyph.ScaleFactor = def_scale glyph.UpdatePipeline() @@ -1627,8 +1623,7 @@ def DeformedShapeOnField(proxy, entity, field_name, # Set properties if is_colored: - defshape.ColorAttributeType = EntityType.get_pvtype(entity) - defshape.ColorArrayName = field_name + defshape.ColorArrayName = (EntityType.get_pvtype(entity), field_name) else: defshape.ColorArrayName = '' defshape.LookupTable = lookup_table @@ -1744,9 +1739,8 @@ def DeformedShapeAndScalarMapOnField(proxy, entity, field_name, lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] # Set properties - defshapemap.ColorArrayName = scalar_field + defshapemap.ColorArrayName = (EntityType.get_pvtype(scalar_field_entity), scalar_field) defshapemap.LookupTable = lookup_table - defshapemap.ColorAttributeType = EntityType.get_pvtype(scalar_field_entity) # Add scalar bar add_scalar_bar(field_name, nb_components, @@ -1914,8 +1908,7 @@ def Plot3DOnField(proxy, entity, field_name, timestamp_nb, lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0] # Set properties - plot3d.ColorAttributeType = EntityType.get_pvtype(entity) - plot3d.ColorArrayName = field_name + plot3d.ColorArrayName = (EntityType.get_pvtype(entity), field_name) plot3d.LookupTable = lookup_table # Add scalar bar @@ -2016,8 +2009,7 @@ def IsoSurfacesOnField(proxy, entity, field_name, timestamp_nb, # Set display properties if (is_colored): - isosurfaces.ColorAttributeType = EntityType.get_pvtype(entity) - isosurfaces.ColorArrayName = field_name + isosurfaces.ColorArrayName = (EntityType.get_pvtype(entity), field_name) else: isosurfaces.ColorArrayName = '' if color: @@ -2141,8 +2133,7 @@ def GaussPointsOnField(proxy, entity, field_name, # Set display properties if is_colored: - gausspnt.ColorAttributeType = EntityType.get_pvtype(entity) - gausspnt.ColorArrayName = field_name + gausspnt.ColorArrayName = (EntityType.get_pvtype(entity), field_name) else: gausspnt.ColorArrayName = '' if color: @@ -2273,8 +2264,7 @@ def GaussPointsOnField1(proxy, entity, field_name, # Set display properties if is_colored: - gausspnt.ColorAttributeType = EntityType.get_pvtype(entity) - gausspnt.ColorArrayName = field_name + gausspnt.ColorArrayName = (EntityType.get_pvtype(entity), field_name) else: gausspnt.ColorArrayName = '' if color: @@ -2426,8 +2416,7 @@ def StreamLinesOnField(proxy, entity, field_name, timestamp_nb, # Set properties if is_colored: - streamlines.ColorAttributeType = EntityType.get_pvtype(entity) - streamlines.ColorArrayName = field_name + streamlines.ColorArrayName = (EntityType.get_pvtype(entity), field_name) else: streamlines.ColorArrayName = '' if color: diff --git a/src/PV_SWIG/no_wrap/pvserver.py b/src/PV_SWIG/pvserver.py similarity index 85% rename from src/PV_SWIG/no_wrap/pvserver.py rename to src/PV_SWIG/pvserver.py index e10c52f7..c00c1ee2 100644 --- a/src/PV_SWIG/no_wrap/pvserver.py +++ b/src/PV_SWIG/pvserver.py @@ -20,6 +20,12 @@ # Module : PARAVIS # +""" +This module does the minimum required to retrieve the PVSERVER engine and make +it available in the global variables myParavis and myPVServerService +(TODO: who needs this ??) +""" + import PVSERVER_utils ## Initialize PARAVIS interface diff --git a/src/PV_SWIG/pvsimple.py b/src/PV_SWIG/pvsimple.py index 2ebabb35..b5f95d9f 100644 --- a/src/PV_SWIG/pvsimple.py +++ b/src/PV_SWIG/pvsimple.py @@ -16,1158 +16,96 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +# Author: Adrien Bruneton (CEA) -r"""simple is a module for using paraview server manager in Python. It -provides a simple convenience layer to functionality provided by the -C++ classes wrapped to Python as well as the servermanager module. - -A simple example: - from paraview.simple import * - - # Create a new sphere proxy on the active connection and register it - # in the sources group. - sphere = Sphere(ThetaResolution=16, PhiResolution=32) - - # Apply a shrink filter - shrink = Shrink(sphere) - - # Turn the visiblity of the shrink object on. - Show(shrink) - - # Render the scene - Render() +r""" This module is a direct forward to the initial 'simple' module of ParaView. +On top of that it also establishes a connection to a valid PVServer whose address +is provided by the PVSERVER engine. """ -import paravisSM - -servermanager = paravisSM - -def enableMultiServer(): - servermanager.enableMultiServer() - -def switchActiveConnection(newActiveConnection=None, ns=None): - if not ns: - ns = globals() - _remove_functions(ns) - servermanager.switchActiveConnection(newActiveConnection) - _add_functions(ns) - -def Disconnect(ns=None, force=True): - if servermanager.ActiveConnection and (force or servermanager.MultiServerConnections == None): - if ns: - _remove_functions(ns) - _remove_functions(globals()) - if not servermanager.fromGUI: - servermanager.ProxyManager().DisableStateUpdateNotification() - servermanager.ProxyManager().UnRegisterProxies() - active_objects.view = None - active_objects.source = None - servermanager.Disconnect() - if not servermanager.fromGUI: - import gc - gc.collect() - -def Connect(ds_host=None, ds_port=11111, rs_host=None, rs_port=11111): - """Creates a connection to a server. Example usage: - > Connect("amber") # Connect to a single server at default port - > Connect("amber", 12345) # Connect to a single server at port 12345 - > Connect("amber", 11111, "vis_cluster", 11111) # connect to data server, render server pair""" - Disconnect(globals(), False) - connection = servermanager.Connect(ds_host, ds_port, rs_host, rs_port) - _add_functions(globals()) - - servermanager.ProxyManager().DisableStateUpdateNotification() - servermanager.ProxyManager().UpdateFromRemote() - tk = servermanager.ProxyManager().GetProxy("timekeeper", "TimeKeeper") - if not tk: - try: - tk = servermanager.misc.TimeKeeper() - servermanager.ProxyManager().RegisterProxy("timekeeper", "TimeKeeper", tk) - except AttributeError: - print "Error: Could not create TimeKeeper" - - scene = servermanager.ProxyManager().GetProxy("animation", "AnimationScene") - if not scene: - try: - scene = AnimationScene() - scene.TimeKeeper = tk - except NameError: - print "Error: Could not create AnimationScene" - - servermanager.ProxyManager().EnableStateUpdateNotification() - servermanager.ProxyManager().TriggerStateUpdate() - - return connection - -def ReverseConnect(port=11111): - """Create a reverse connection to a server. Listens on port and waits for - an incoming connection from the server.""" - Disconnect(globals(), False) - connection = servermanager.ReverseConnect(port) - _add_functions(globals()) - - servermanager.ProxyManager().DisableStateUpdateNotification() - servermanager.ProxyManager().UpdateFromRemote() - tk = servermanager.ProxyManager().GetProxy("timekeeper", "TimeKeeper") - if not tk: - tk = servermanager.misc.TimeKeeper() - servermanager.ProxyManager().RegisterProxy("timekeeper", "TimeKeeper", tk) - - scene = servermanager.ProxyManager().GetProxy("animation", "AnimationScene") - if not scene: - scene = AnimationScene() - scene.TimeKeeper = tk - - servermanager.ProxyManager().EnableStateUpdateNotification() - servermanager.ProxyManager().TriggerStateUpdate() - - return connection - -def _create_view(view_xml_name): - "Creates and returns a 3D render view." - view = servermanager._create_view(view_xml_name) - servermanager.ProxyManager().RegisterProxy("views", \ - "my_view%d" % _funcs_internals.view_counter, view) - active_objects.view = view - _funcs_internals.view_counter += 1 - - tk = servermanager.ProxyManager().GetProxiesInGroup("timekeeper").values()[0] - views = tk.Views - if not view in views: - views.append(view) - try: - scene = GetAnimationScene() - if not view in scene.ViewModules: - scene.ViewModules.append(view) - except servermanager.MissingProxy: - pass - return view - -def CreateRenderView(): - return _create_view("RenderView") - -def CreateXYPlotView(): - return _create_view("XYChartView") - -def CreateBarChartView(): - return _create_view("XYBarChartView") - -def CreateComparativeRenderView(): - return _create_view("ComparativeRenderView") - -def CreateComparativeXYPlotView(): - return _create_view("ComparativeXYPlotView") - -def CreateComparativeBarChartView(): - return _create_view("ComparativeBarChartView") - -def CreateParallelCoordinatesChartView(): - return _create_view("ParallelCoordinatesChartView") - -def Create2DRenderView(): - return _create_view("2DRenderView") - -def OpenDataFile(filename, **extraArgs): - """Creates a reader to read the give file, if possible. - This uses extension matching to determine the best reader possible. - If a reader cannot be identified, then this returns None.""" - session = servermanager.ActiveConnection.Session - reader_factor = servermanager.vtkSMProxyManager.GetProxyManager().GetReaderFactory() - if reader_factor.GetNumberOfRegisteredPrototypes() == 0: - reader_factor.RegisterPrototypes(session, "sources") - first_file = filename - if type(filename) == list: - first_file = filename[0] - if not reader_factor.TestFileReadability(first_file, session): - msg = "File not readable: %s " % first_file - raise RuntimeError, msg - if not reader_factor.CanReadFile(first_file, session): - msg = "File not readable. No reader found for '%s' " % first_file - raise RuntimeError, msg - prototype = servermanager.ProxyManager().GetPrototypeProxy( - reader_factor.GetReaderGroup(), reader_factor.GetReaderName()) - # [ABN]: bug fix for Christian VW (temporary - pvsimple should disappear soon) - from paraview import make_name_valid # make_name_valid is not in paravisSM - xml_name = make_name_valid(prototype.GetXMLLabel()) - reader_func = _create_func(xml_name, servermanager.sources) - if prototype.GetProperty("FileNames"): - reader = reader_func(FileNames=filename, **extraArgs) - else : - reader = reader_func(FileName=filename, **extraArgs) - return reader - -def CreateWriter(filename, proxy=None, **extraArgs): - """Creates a writer that can write the data produced by the source proxy in - the given file format (identified by the extension). If no source is - provided, then the active source is used. This doesn't actually write the - data, it simply creates the writer and returns it.""" - if not filename: - raise RuntimeError, "filename must be specified" - session = servermanager.ActiveConnection.Session - writer_factory = servermanager.vtkSMProxyManager.GetProxyManager().GetWriterFactory() - if writer_factory.GetNumberOfRegisteredPrototypes() == 0: - writer_factory.RegisterPrototypes(session, "writers") - if not proxy: - proxy = GetActiveSource() - if not proxy: - raise RuntimeError, "Could not locate source to write" - writer_proxy = writer_factory.CreateWriter(filename, proxy.SMProxy, proxy.Port) - return servermanager._getPyProxy(writer_proxy) - -def GetRenderView(): - """Returns the active view if there is one. Else creates and returns a new view.""" - view = active_objects.view - if not view: - # it's possible that there's no active view, but a render view exists. - # If so, locate that and return it (before trying to create a new one). - view = servermanager.GetRenderView() - if not view: - view = CreateRenderView() - return view - -def GetRenderViews(): - """Returns all render views as a list.""" - return servermanager.GetRenderViews() - -def GetRepresentation(proxy=None, view=None): - """Given a pipeline object and view, returns the corresponding representation object. - If pipeline object and view are not specified, active objects are used.""" - if not view: - view = active_objects.view - if not proxy: - proxy = active_objects.source - rep = servermanager.GetRepresentation(proxy, view) - if not rep: - rep = servermanager.CreateRepresentation(proxy, view) - servermanager.ProxyManager().RegisterProxy("representations", \ - "my_representation%d" % _funcs_internals.rep_counter, rep) - _funcs_internals.rep_counter += 1 - return rep - -def GetDisplayProperties(proxy=None, view=None): - """Given a pipeline object and view, returns the corresponding representation object. - If pipeline object and/or view are not specified, active objects are used.""" - return GetRepresentation(proxy, view) - -def Show(proxy=None, view=None, **params): - """Turns the visibility of a given pipeline object on in the given view. - If pipeline object and/or view are not specified, active objects are used.""" - if proxy == None: - proxy = GetActiveSource() - if proxy == None: - raise RuntimeError, "Show() needs a proxy argument or that an active source is set." - if not view and not active_objects.view: - CreateRenderView() - rep = GetDisplayProperties(proxy, view) - if rep == None: - raise RuntimeError, "Could not create a representation object for proxy %s" % proxy.GetXMLLabel() - for param in params.keys(): - setattr(rep, param, params[param]) - rep.Visibility = 1 - return rep - -def Hide(proxy=None, view=None): - """Turns the visibility of a given pipeline object off in the given view. - If pipeline object and/or view are not specified, active objects are used.""" - rep = GetDisplayProperties(proxy, view) - rep.Visibility = 0 - -def Render(view=None): - """Renders the given view (default value is active view)""" - if not view: - view = active_objects.view - view.StillRender() - if _funcs_internals.first_render: - # Not all views have a ResetCamera method - try: - view.ResetCamera() - view.StillRender() - except AttributeError: pass - _funcs_internals.first_render = False - return view - -def ResetCamera(view=None): - """Resets the settings of the camera to preserver orientation but include - the whole scene. If an argument is not provided, the active view is - used.""" - if not view: - view = active_objects.view - if hasattr(view, "ResetCamera"): - view.ResetCamera() - if hasattr(view, "ResetDisplay"): - view.ResetDisplay() - Render(view) - -def _DisableFirstRenderCameraReset(): - """Disable the first render camera reset. Normally a ResetCamera is called - automatically when Render is called for the first time after importing - this module.""" - _funcs_internals.first_render = False - -def SetProperties(proxy=None, **params): - """Sets one or more properties of the given pipeline object. If an argument - is not provided, the active source is used. Pass a list of property_name=value - pairs to this function to set property values. For example: - SetProperties(Center=[1, 2, 3], Radius=3.5) - """ - if not proxy: - proxy = active_objects.source - for param in params.keys(): - if not hasattr(proxy, param): - raise AttributeError("object has no property %s" % param) - setattr(proxy, param, params[param]) - -def GetProperty(*arguments, **keywords): - """Get one property of the given pipeline object. If keywords are used, - you can set the proxy and the name of the property that you want to get - like in the following example : - GetProperty({proxy=sphere, name="Radius"}) - If it's arguments that are used, then you have two case: - - if only one argument is used that argument will be - the property name. - - if two arguments are used then the first one will be - the proxy and the second one the property name. - Several example are given below: - GetProperty({name="Radius"}) - GetProperty({proxy=sphereProxy, name="Radius"}) - GetProperty( sphereProxy, "Radius" ) - GetProperty( "Radius" ) - """ - name = None - proxy = None - for key in keywords: - if key == "name": - name = keywords[key] - if key == "proxy": - proxy = keywords[key] - if len(arguments) == 1 : - name = arguments[0] - if len(arguments) == 2 : - proxy = arguments[0] - name = arguments[1] - if not name: - raise RuntimeError, "Expecting at least a property name as input. Otherwise keyword could be used to set 'proxy' and property 'name'" - if not proxy: - proxy = active_objects.source - return proxy.GetProperty(name) - -def SetDisplayProperties(proxy=None, view=None, **params): - """Sets one or more display properties of the given pipeline object. If an argument - is not provided, the active source is used. Pass a list of property_name=value - pairs to this function to set property values. For example: - SetProperties(Color=[1, 0, 0], LineWidth=2) - """ - rep = GetDisplayProperties(proxy, view) - SetProperties(rep, **params) - -def SetViewProperties(view=None, **params): - """Sets one or more properties of the given view. If an argument - is not provided, the active view is used. Pass a list of property_name=value - pairs to this function to set property values. For example: - SetProperties(Background=[1, 0, 0], UseImmediateMode=0) - """ - if not view: - view = active_objects.view - SetProperties(view, **params) - -def RenameSource(newName, proxy=None): - """Renames the given source. If the given proxy is not registered - in the sources group this method will have no effect. If no source is - provided, the active source is used.""" - if not proxy: - proxy = active_objects.source - pxm = servermanager.ProxyManager() - oldName = pxm.GetProxyName("sources", proxy) - if oldName: - pxm.RegisterProxy("sources", newName, proxy) - pxm.UnRegisterProxy("sources", oldName, proxy) - -def FindSource(name): - return servermanager.ProxyManager().GetProxy("sources", name) - -def GetSources(): - """Given the name of a source, return its Python object.""" - return servermanager.ProxyManager().GetProxiesInGroup("sources") +__DEBUG = 0 # increase if you want more verbosity -def GetRepresentations(): - """Returns all representations (display properties).""" - return servermanager.ProxyManager().GetProxiesInGroup("representations") +def __my_log(msg): + if __DEBUG: + print "[PARAVIS] %s" % msg -def UpdatePipeline(time=None, proxy=None): - """Updates (executes) the given pipeline object for the given time as - necessary (i.e. if it did not already execute). If no source is provided, - the active source is used instead.""" - if not proxy: - proxy = active_objects.source - if time: - proxy.UpdatePipeline(time) - else: - proxy.UpdatePipeline() - -def Delete(proxy=None): - """Deletes the given pipeline object or the active source if no argument - is specified.""" - if not proxy: - proxy = active_objects.source - # Unregister any helper proxies stored by a vtkSMProxyListDomain - for prop in proxy: - listdomain = prop.GetDomain('proxy_list') - if listdomain: - if listdomain.GetClassName() != 'vtkSMProxyListDomain': - continue - group = "pq_helper_proxies." + proxy.GetGlobalIDAsString() - for i in xrange(listdomain.GetNumberOfProxies()): - pm = servermanager.ProxyManager() - iproxy = listdomain.GetProxy(i) - name = pm.GetProxyName(group, iproxy) - if iproxy and name: - pm.UnRegisterProxy(group, name, iproxy) - - # Remove source/view from time keeper - tk = servermanager.ProxyManager().GetProxiesInGroup("timekeeper").values()[0] - if isinstance(proxy, servermanager.SourceProxy): - try: - idx = tk.TimeSources.index(proxy) - del tk.TimeSources[idx] - except ValueError: - pass - else: - try: - idx = tk.Views.index(proxy) - del tk.Views[idx] - except ValueError: - pass - servermanager.UnRegister(proxy) - - # If this is a representation, remove it from all views. - if proxy.SMProxy.IsA("vtkSMRepresentationProxy") or \ - proxy.SMProxy.IsA("vtkSMNewWidgetRepresentationProxy"): - for view in GetRenderViews(): - view.Representations.remove(proxy) - # If this is a source, remove the representation iff it has no consumers - # Also change the active source if necessary - elif proxy.SMProxy.IsA("vtkSMSourceProxy"): - sources = servermanager.ProxyManager().GetProxiesInGroup("sources") - for i in range(proxy.GetNumberOfConsumers()): - if proxy.GetConsumerProxy(i) in sources: - raise RuntimeError("Source has consumers. It cannot be deleted " + - "until all consumers are deleted.") - #VSV:== - if proxy.IsSame(GetActiveSource()): - if hasattr(proxy, "Input") and proxy.Input: - if isinstance(proxy.Input, servermanager.Proxy): - SetActiveSource(proxy.Input) - else: - SetActiveSource(proxy.Input[0]) - else: SetActiveSource(None) - for rep in GetRepresentations().values(): - #VSV:== - if rep.Input.IsSame(proxy): - Delete(rep) - # Change the active view if necessary - elif proxy.SMProxy.IsA("vtkSMRenderViewProxy"): - ##VSV:== - if proxy.IsSame(GetActiveView()): - if len(GetRenderViews()) > 0: - SetActiveView(GetRenderViews()[0]) - else: - SetActiveView(None) - -def CreateLookupTable(**params): - """Create and return a lookup table. Optionally, parameters can be given - to assign to the lookup table. - """ - lt = servermanager.rendering.PVLookupTable() - servermanager.Register(lt) - SetProperties(lt, **params) - return lt - -def CreatePiecewiseFunction(**params): - """Create and return a piecewise function. Optionally, parameters can be - given to assign to the piecewise function. +def __getFromGUI(): + """ Identify if we are running inside SALOME's embedded interpreter. + @return a value strictly greater than 0 if we are in SALOME's embedded interpreter + @return 2 if we are in Salome embedded Python console. """ - pfunc = servermanager.piecewise_functions.PiecewiseFunction() - servermanager.Register(pfunc) - SetProperties(pfunc, **params) - return pfunc - -def GetLookupTableForArray(arrayname, num_components, **params): - """Used to get an existing lookuptable for a array or to create one if none - exists. Keyword arguments can be passed in to initialize the LUT if a new - one is created.""" - proxyName = "%d.%s.PVLookupTable" % (int(num_components), arrayname) - lut = servermanager.ProxyManager().GetProxy("lookup_tables", proxyName) - if lut: - return lut - # No LUT exists for this array, create a new one. - # TODO: Change this to go a LookupTableManager that is shared with the GUI, - # so that the GUI and python end up create same type of LUTs. For now, - # python will create a Blue-Red LUT, unless overridden by params. - lut = servermanager.rendering.PVLookupTable( - ColorSpace="HSV", RGBPoints=[0, 0, 0, 1, 1, 1, 0, 0]) - SetProperties(lut, **params) - servermanager.Register(lut, registrationName=proxyName) - return lut + import salome_iapp + ret = 0 + if salome_iapp.IN_SALOME_GUI: + ret += 1 + try: + if __IN_SALOME_GUI_CONSOLE: # only defined if we are in SALOME's embedded console (not only GUI) + ret += 1 + except NameError: + pass + return ret -def CreateScalarBar(**params): - """Create and return a scalar bar widget. The returned widget may - be added to a render view by appending it to the view's representations - The widget must have a valid lookup table before it is added to a view. - It is possible to pass the lookup table (and other properties) as arguments - to this method: - - lt = MakeBlueToRedLt(3.5, 7.5) - bar = CreateScalarBar(LookupTable=lt, Title="Velocity") - GetRenderView().Representations.append(bar) - - By default the returned widget is selectable and resizable. +def ShowParaviewView(): """ - sb = servermanager.rendering.ScalarBarWidgetRepresentation() - servermanager.Register(sb) - sb.Selectable = 1 - sb.Resizable = 1 - sb.Enabled = 1 - sb.Title = "Scalars" - SetProperties(sb, **params) - return sb - -# TODO: Change this to take the array name and number of components. Register -# the lt under the name ncomp.array_name -def MakeBlueToRedLT(min, max): - # Define RGB points. These are tuples of 4 values. First one is - # the scalar values, the other 3 the RGB values. - rgbPoints = [min, 0, 0, 1, max, 1, 0, 0] - return CreateLookupTable(RGBPoints=rgbPoints, ColorSpace="HSV") - -def _find_writer(filename): - """Internal function.""" - extension = None - parts = filename.split('.') - if len(parts) > 1: - extension = parts[-1] - else: - raise RuntimeError, "Filename has no extension, please specify a write" - - if extension == 'png': - return 'vtkPNGWriter' - elif extension == 'bmp': - return 'vtkBMPWriter' - elif extension == 'ppm': - return 'vtkPNMWriter' - elif extension == 'tif' or extension == 'tiff': - return 'vtkTIFFWriter' - elif extension == 'jpg' or extension == 'jpeg': - return 'vtkJPEGWriter' - else: - raise RuntimeError, "Cannot infer filetype from extension:", extension - -def AddCameraLink(viewProxy, viewProxyOther, linkName): - """Create a camera link between two view proxies. A name must be given - so that the link can be referred to by name. If a link with the given - name already exists it will be removed first.""" - if not viewProxyOther: viewProxyOther = GetActiveView() - link = servermanager.vtkSMCameraLink() - link.AddLinkedProxy(viewProxy.SMProxy, 1) - link.AddLinkedProxy(viewProxyOther.SMProxy, 2) - link.AddLinkedProxy(viewProxyOther.SMProxy, 1) - link.AddLinkedProxy(viewProxy.SMProxy, 2) - RemoveCameraLink(linkName) - servermanager.ProxyManager().RegisterLink(linkName, link) - -def RemoveCameraLink(linkName): - """Remove a camera link with the given name.""" - servermanager.ProxyManager().UnRegisterLink(linkName) - -def WriteImage(filename, view=None, **params): - """Saves the given view (or the active one if none is given) as an - image. Optionally, you can specify the writer and the magnification - using the Writer and Magnification named arguments. For example: - WriteImage("foo.mypng", aview, Writer=vtkPNGWriter, Magnification=2) - If no writer is provided, the type is determined from the file extension. - Currently supported extensions are png, bmp, ppm, tif, tiff, jpg and jpeg. - The writer is a VTK class that is capable of writing images. - Magnification is used to determine the size of the written image. The size - is obtained by multiplying the size of the view with the magnification. - Rendering may be done using tiling to obtain the correct size without - resizing the view.""" - if not view: - view = active_objects.view - writer = None - if params.has_key('Writer'): - writer = params['Writer'] - mag = 1 - if params.has_key('Magnification'): - mag = int(params['Magnification']) - if not writer: - writer = _find_writer(filename) - view.WriteImage(filename, writer, mag) - -def AnimateReader(reader=None, view=None, filename=None): - """This is a utility function that, given a reader and a view - animates over all time steps of the reader. If the optional - filename is provided, a movie is created (type depends on the - extension of the filename.""" - if not reader: - reader = active_objects.source - if not view: - view = active_objects.view - - return servermanager.AnimateReader(reader, view, filename) - - -def _create_func(key, module): - """Internal function.""" - - def CreateObject(*input, **params): - """This function creates a new proxy. For pipeline objects that accept inputs, - all non-keyword arguments are assumed to be inputs. All keyword arguments are - assumed to be property,value pairs and are passed to the new proxy.""" - - # Instantiate the actual object from the given module. - px = module.__dict__[key]() - - # Make sure non-keyword arguments are valid - for inp in input: - if inp != None and not isinstance(inp, servermanager.Proxy): - if px.GetProperty("Input") != None: - raise RuntimeError, "Expecting a proxy as input." - else: - raise RuntimeError, "This function does not accept non-keyword arguments." - - # Assign inputs - if px.GetProperty("Input") != None: - if len(input) > 0: - px.Input = input - else: - # If no input is specified, try the active pipeline object - if px.GetProperty("Input").GetRepeatable() and active_objects.get_selected_sources(): - px.Input = active_objects.get_selected_sources() - elif active_objects.source: - px.Input = active_objects.source - else: - if len(input) > 0: - raise RuntimeError, "This function does not expect an input." - - registrationName = None - for nameParam in ['registrationName', 'guiName']: - if nameParam in params: - registrationName = params[nameParam] - del params[nameParam] - - # Pass all the named arguments as property,value pairs - for param in params.keys(): - setattr(px, param, params[param]) - - try: - # Register the proxy with the proxy manager. - if registrationName: - group, name = servermanager.Register(px, registrationName=registrationName) - else: - group, name = servermanager.Register(px) - - - # Register pipeline objects with the time keeper. This is used to extract time values - # from sources. NOTE: This should really be in the servermanager controller layer. - if group == "sources": - has_tk = True - try: - tk = servermanager.ProxyManager().GetProxiesInGroup("timekeeper").values()[0] - except IndexError: - has_tk = False - if has_tk: - sources = tk.TimeSources - if not px in sources: - sources.append(px) - - active_objects.source = px - except servermanager.MissingRegistrationInformation: - pass - - return px - - return CreateObject - -def _create_doc(new, old): - """Internal function.""" - import string - res = "" - for doc in (new, old): - ts = [] - strpd = doc.split('\n') - for s in strpd: - ts.append(s.lstrip()) - res += string.join(ts) - res += '\n' - return res - -def _func_name_valid(name): - """Internal function.""" - valid = True - for c in name: - if c == '(' or c ==')': - valid = False - break - return valid - -def _add_functions(g): - activeModule = servermanager.ActiveConnection.Modules - for m in [activeModule.filters, activeModule.sources, - activeModule.writers, activeModule.animation]: - dt = m.__dict__ - for key in dt.keys(): - cl = dt[key] - if not isinstance(cl, str): - if not key in g and _func_name_valid(key): - g[key] = _create_func(key, m) - exec "g[key].__doc__ = _create_doc(m.%s.__doc__, g[key].__doc__)" % key - -def _remove_functions(g): - list = [] - if servermanager.ActiveConnection: - list = [m for m in dir(servermanager.ActiveConnection.Modules) if m[0] != '_'] - - for m in list: - dt = servermanager.ActiveConnection.Modules.__dict__[m].__dict__ - for key in dt.keys(): - cl = dt[key] - if not isinstance(cl, str) and g.has_key(key): - g.pop(key) - #print "remove %s function" % key - -def GetActiveView(): - """Returns the active view.""" - return active_objects.view - -def SetActiveView(view): - """Sets the active view.""" - active_objects.view = view - -def GetActiveSource(): - """Returns the active source.""" - return active_objects.source - -def SetActiveSource(source): - """Sets the active source.""" - active_objects.source = source - -def GetActiveCamera(): - """Returns the active camera for the active view. The returned object - is an instance of vtkCamera.""" - return GetActiveView().GetActiveCamera() - -def GetAnimationScene(): - """Returns the application-wide animation scene. ParaView has only one - global animation scene. This method provides access to that. Users are - free to create additional animation scenes directly, but those scenes - won't be shown in the ParaView GUI.""" - animation_proxies = servermanager.ProxyManager().GetProxiesInGroup("animation") - scene = None - for aProxy in animation_proxies.values(): - if aProxy.GetXMLName() == "AnimationScene": - scene = aProxy - break - if not scene: - raise servermanager.MissingProxy, "Could not locate global AnimationScene." - return scene - -def WriteAnimation(filename, **params): - """Writes the current animation as a file. Optionally one can specify - arguments that qualify the saved animation files as keyword arguments. - Accepted options are as follows: - * Magnification (integer) : set the maginification factor for the saved - animation. - * Quality (0 [worst] or 1 or 2 [best]) : set the quality of the generated - movie (if applicable). - * Subsampling (integer) : setting whether the movie encoder should use - subsampling of the chrome planes or not, if applicable. Since the human - eye is more sensitive to brightness than color variations, subsampling - can be useful to reduce the bitrate. Default value is 0. - * BackgroundColor (3-tuple of doubles) : set the RGB background color to - use to fill empty spaces in the image. - * FrameRate (double): set the frame rate (if applicable).""" - scene = GetAnimationScene() - # ensures that the TimeKeeper track is created. - GetTimeTrack() - iw = servermanager.vtkSMAnimationSceneImageWriter() - iw.SetAnimationScene(scene.SMProxy) - iw.SetFileName(filename) - if params.has_key("Magnification"): - iw.SetMagnification(int(params["Magnification"])) - if params.has_key("Quality"): - iw.SetQuality(int(params["Quality"])) - if params.has_key("Subsampling"): - iw.SetSubsampling(int(params["Subsampling"])) - if params.has_key("BackgroundColor"): - iw.SetBackgroundColor(params["BackgroundColor"]) - if params.has_key("FrameRate"): - iw.SetFrameRate(float(params["FrameRate"])) - iw.Save() - -def _GetRepresentationAnimationHelper(sourceproxy): - """Internal method that returns the representation animation helper for a - source proxy. It creates a new one if none exists.""" - # ascertain that proxy is a source proxy - if not sourceproxy in GetSources().values(): - return None - for proxy in servermanager.ProxyManager(): - if proxy.GetXMLName() == "RepresentationAnimationHelper" and\ - proxy.GetProperty("Source").IsProxyAdded(sourceproxy.SMProxy): - return proxy - # create a new helper - proxy = servermanager.misc.RepresentationAnimationHelper( - Source=sourceproxy) - servermanager.ProxyManager().RegisterProxy( - "pq_helper_proxies.%s" % sourceproxy.GetGlobalIDAsString(), - "RepresentationAnimationHelper", proxy) - return proxy - -def GetAnimationTrack(propertyname_or_property, index=None, proxy=None): - """Returns an animation cue for the property. If one doesn't exist then a - new one will be created. - Typical usage: - track = GetAnimationTrack("Center", 0, sphere) or - track = GetAnimationTrack(sphere.GetProperty("Radius")) or - - # this returns the track to animate visibility of the active source in - # all views. - track = GetAnimationTrack("Visibility") - - For animating properties on implicit planes etc., use the following - signatures: - track = GetAnimationTrack(slice.SliceType.GetProperty("Origin"), 0) or - track = GetAnimationTrack("Origin", 0, slice.SliceType) - + If the import is made from SALOME embedded console, the ParaView application needs to + be instanciated to avoid a future crash. """ - if not proxy: - proxy = GetActiveSource() - if not isinstance(proxy, servermanager.Proxy): - raise TypeError, "proxy must be a servermanager.Proxy instance" - if isinstance(propertyname_or_property, str): - propertyname = propertyname_or_property - elif isinstance(propertyname_or_property, servermanager.Property): - prop = propertyname_or_property - propertyname = prop.Name - proxy = prop.Proxy - else: - raise TypeError, "propertyname_or_property must be a string or servermanager.Property" - - # To handle the case where the property is actually a "display" property, in - # which case we are actually animating the "RepresentationAnimationHelper" - # associated with the source. - if propertyname in ["Visibility", "Opacity"]: - proxy = _GetRepresentationAnimationHelper(proxy) - if not proxy or not proxy.GetProperty(propertyname): - raise AttributeError, "Failed to locate property %s" % propertyname - - scene = GetAnimationScene() - for cue in scene.Cues: - try: - if cue.AnimatedProxy.IsSame(proxy) and\ - cue.AnimatedPropertyName == propertyname: - if index == None or index.IsSame(cue.AnimatedElement): ##index == cue.AnimatedElement: - return cue - except AttributeError: - pass - - # matching animation track wasn't found, create a new one. - cue = KeyFrameAnimationCue() - cue.AnimatedProxy = proxy - cue.AnimatedPropertyName = propertyname - if index != None: - cue.AnimatedElement = index - scene.Cues.append(cue) - return cue - -def GetCameraTrack(view=None): - """Returns the camera animation track for the given view. If no view is - specified, active view will be used. If no exisiting camera animation track - is found, a new one will be created.""" - if not view: - view = GetActiveView() - if not view: - raise ValueError, "No view specified" - scene = GetAnimationScene() - for cue in scene.Cues: - if cue.AnimatedProxy.IsSame(view) and\ - cue.GetXMLName() == "CameraAnimationCue": - return cue - # no cue was found, create a new one. - cue = CameraAnimationCue() - cue.AnimatedProxy = view - scene.Cues.append(cue) - return cue - -def GetTimeTrack(): - """Returns the animation track used to control the time requested from all - readers/filters during playback. - This is the "TimeKeeper - Time" track shown in ParaView's 'Animation View'. - If none exists, a new one will be created.""" - scene = GetAnimationScene() - tk = scene.TimeKeeper - for cue in scene.Cues: - if cue.GetXMLName() == "TimeAnimationCue" and cue.AnimatedProxy.IsSame(tk)\ - and cue.AnimatedPropertyName == "Time": - return cue - # no cue was found, create a new one. - cue = TimeAnimationCue() - cue.AnimatedProxy = tk - cue.AnimatedPropertyName = "Time" - scene.Cues.append(cue) - return cue - -def LoadXML(xmlstring, ns=None): - """Given a server manager XML as a string, parse and process it. - If you loaded the simple module with from paraview.simple import *, - make sure to pass globals() as the second arguments: - LoadXML(xmlstring, globals()) - Otherwise, the new functions will not appear in the global namespace.""" - if not ns: - ns = globals() - servermanager.LoadXML(xmlstring) - _add_functions(ns) - -def LoadPlugin(filename, remote=True, ns=None): - """Loads a ParaView plugin and updates this module with new constructors - if any. The remote argument (default to True) is to specify whether - the plugin will be loaded on client (remote=False) or on server (remote=True). - If you loaded the simple module with from paraview.simple import *, - make sure to pass globals() as an argument: - LoadPlugin("myplugin", False, globals()), to load on client; - LoadPlugin("myplugin", True, globals()), to load on server; - LoadPlugin("myplugin", ns=globals()), to load on server. - Otherwise, the new functions will not appear in the global namespace.""" - - if not ns: - ns = globals() - servermanager.LoadPlugin(filename, remote) - _add_functions(ns) - -def LoadDistributedPlugin(pluginname, remote=True, ns=None): - """Loads a plugin that's distributed with the executable. This uses the - information known about plugins distributed with ParaView to locate the - shared library for the plugin to load. Raises a RuntimeError if the plugin - was not found.""" - if not servermanager.ActiveConnection: - raise RuntimeError, "Cannot load a plugin without a session." - plm = servermanager.vtkSMProxyManager.GetProxyManager().GetPluginManager() - if remote: - session = servermanager.ActiveConnection.Session - info = plm.GetRemoteInformation(session) - else: - info = plm.GetLocalInformation() - for cc in range(0, info.GetNumberOfPlugins()): - if info.GetPluginName(cc) == pluginname: - return LoadPlugin(info.GetPluginFileName(cc), remote, ns) - raise RuntimeError, "Plugin '%s' not found" % pluginname - -def GetLayouts(): - """Returns the layout proxies on the active session. - Layout proxies are used to place views in a grid.""" - return servermanager.ProxyManager().GetProxiesInGroup("layouts") - -def GetLayout(view=None): - """Return the layout containing the give view, if any. - If no view is specified, active view is used. + if __getFromGUI(): + __my_log("Initializing ParaView main elements, please be patient ...") + import SalomePyQt + sgPyQt = SalomePyQt.SalomePyQt() + viewIds = sgPyQt.findViews("ParaView") + if len(viewIds): + sgPyQt.setViewVisible(viewIds[0], True) + sgPyQt.activateView(viewIds[0]) + else: + sgPyQt.createView("ParaView") + # Now let the GUI main loop process the initialization event posted above + sgPyQt.processEvents() + __my_log("ParaView initialized.") + +## The below has to called BEFORE importing paraview!!! This is crazy, but it has to be. +ShowParaviewView() + +import paraview +import pvserver +from paraview import simple + +def SalomeConnectToPVServer(): """ - if not view: - view = GetActiveView() - if not view: - raise RuntimeError, "No active view was found." - layouts = GetLayouts() - for layout in layouts.values(): - if layout.GetViewLocation(view) != -1: - return layout - return None - - -def SelectCells(query=None, proxy=None): - """Select cells satisfying the query. If query is None, then all cells are - selected. If proxy is None, then the active source is used.""" - if not proxy: - proxy = GetActiveSource() - if not proxy: - raise RuntimeError, "No active source was found." - - if not query: - # This ends up being true for all cells. - query = "id >= 0" - - # Note, selSource is not registered with the proxy manager. - selSource = servermanager.sources.SelectionQuerySource() - selSource.FieldType = "CELL" - selSource.QueryString = str(query) - proxy.SMProxy.SetSelectionInput(proxy.Port, selSource.SMProxy, 0) - return selSource - -def ClearSelection(proxy=None): - """Clears the selection on the active source.""" - if not proxy: - proxy = GetActiveSource() - if not proxy: - raise RuntimeError, "No active source was found." - proxy.SMProxy.SetSelectionInput(proxy.Port, None, 0) - -class ActiveObjects(object): - """This class manages the active objects (source and view). The active - objects are shared between Python and the user interface. This class - is for internal use. Use the Set/Get methods for setting and getting - active objects.""" - def __get_selection_model(self, name, session=None): - "Internal method." - if session and not servermanager.ActiveConnection.Session.IsSame(session): - raise RuntimeError, "Try to set an active object with invalid active connection." - pxm = servermanager.ProxyManager(session) - model = pxm.GetSelectionModel(name) - if not model: - model = servermanager.vtkSMProxySelectionModel() - pxm.RegisterSelectionModel(name, model) - return model - - def set_view(self, view): - "Sets the active view." - active_view_model = self.__get_selection_model("ActiveView") - if view: - active_view_model = self.__get_selection_model("ActiveView", view.GetSession()) - active_view_model.SetCurrentProxy(view.SMProxy, 0) - else: - active_view_model = self.__get_selection_model("ActiveView") - active_view_model.SetCurrentProxy(None, 0) - - def get_view(self): - "Returns the active view." - return servermanager._getPyProxy( - self.__get_selection_model("ActiveView").GetCurrentProxy()) - - def set_source(self, source): - "Sets the active source." - active_sources_model = self.__get_selection_model("ActiveSources") - if source: - # 3 == CLEAR_AND_SELECT - active_sources_model = self.__get_selection_model("ActiveSources", source.GetSession()) - active_sources_model.SetCurrentProxy(source.SMProxy, 3) - else: - active_sources_model = self.__get_selection_model("ActiveSources") - active_sources_model.SetCurrentProxy(None, 3) - - def __convert_proxy(self, px): - "Internal method." - if not px: - return None - if px.IsA("vtkSMSourceProxy"): - return servermanager._getPyProxy(px) - else: - return servermanager.OutputPort( - servermanager._getPyProxy(px.GetSourceProxy()), - px.GetPortIndex()) - - def get_source(self): - "Returns the active source." - return self.__convert_proxy( - self.__get_selection_model("ActiveSources").GetCurrentProxy()) - - def get_selected_sources(self): - "Returns the set of sources selected in the pipeline browser." - model = self.__get_selection_model("ActiveSources") - proxies = [] - for i in xrange(model.GetNumberOfSelectedProxies()): - proxies.append(self.__convert_proxy(model.GetSelectedProxy(i))) - return proxies - - view = property(get_view, set_view) - source = property(get_source, set_source) - -class _funcs_internals: - """Internal class.""" - first_render = True - view_counter = 0 - rep_counter = 0 - -def demo1(): - """Simple demo that create the following pipeline - sphere - shrink - \ - - append - cone - / + Automatically connect to the right PVServer when not ("inside SALOME GUI" and "already connected"). """ - # Create a sphere of radius = 2, theta res. = 32 - # This object becomes the active source. - ss = Sphere(Radius=2, ThetaResolution=32) - # Apply the shrink filter. The Input property is optional. If Input - # is not specified, the filter is applied to the active source. - shr = Shrink(Input=ss) - # Create a cone source. - cs = Cone() - # Append cone and shrink - app = AppendDatasets() - app.Input = [shr, cs] - # Show the output of the append filter. The argument is optional - # as the app filter is now the active object. - Show(app) - # Render the default view. - Render() - -def demo2(fname="/Users/berk/Work/ParaView/ParaViewData/Data/disk_out_ref.ex2"): - """This demo shows the use of readers, data information and display - properties.""" + __my_log("Connecting to PVServer ...") + server_url = "" + try: + isGUIConnected = pvserver.myPVServerService.GetGUIConnected() + if isGUIConnected and __getFromGUI(): + __my_log("Importing pvsimple from GUI and already connected. Won't reconnect.") + return + server_url = pvserver.myPVServerService.FindOrStartPVServer(0) + # Extract host and port from URL: + a = server_url.split(':') + b = a[1].split('//') + host, port = b[-1], int(a[-1]) + simple.Connect(host, port) + __my_log("Connected to %s!" % server_url) + if __getFromGUI(): + pvserver.myPVServerService.SetGUIConnected(True) + except Exception as e: + __my_log("*******************************************") + __my_log("** Could not connect to a running PVServer!") + __my_log("*******************************************") + raise e + pass - # Create the exodus reader and specify a file name - reader = ExodusIIReader(FileName=fname) - # Get the list of point arrays. - avail = reader.PointVariables.Available - print avail - # Select all arrays - reader.PointVariables = avail - - # Turn on the visibility of the reader - Show(reader) - # Set representation to wireframe - SetDisplayProperties(Representation = "Wireframe") - # Black background is not pretty - SetViewProperties(Background = [0.4, 0.4, 0.6]) - Render() - # Change the elevation of the camera. See VTK documentation of vtkCamera - # for camera parameters. - # NOTE: THIS WILL BE SIMPLER - GetActiveCamera().Elevation(45) - Render() - # Now that the reader executed, let's get some information about it's - # output. - pdi = reader[0].PointData - # This prints a list of all read point data arrays as well as their - # value ranges. - print 'Number of point arrays:', len(pdi) - for i in range(len(pdi)): - ai = pdi[i] - print "----------------" - print "Array:", i, " ", ai.Name, ":" - numComps = ai.GetNumberOfComponents() - print "Number of components:", numComps - for j in range(numComps): - print "Range:", ai.GetRange(j) - # White is boring. Let's color the geometry using a variable. - # First create a lookup table. This object controls how scalar - # values are mapped to colors. See VTK documentation for - # details. - # Map min (0.00678) to blue, max (0.0288) to red - SetDisplayProperties(LookupTable = MakeBlueToRedLT(0.00678, 0.0288)) - # Color by point array called Pres - SetDisplayProperties(ColorAttributeType = "POINT_DATA") - SetDisplayProperties(ColorArrayName = "Pres") - Render() - -def PrintTrace(): - print paravisSM.myParavis.GetTrace() - -def SaveTrace(fileName): - paravisSM.myParavis.SaveTrace(fileName) - - -if not servermanager.ActiveConnection: - Connect() -else: - _add_functions(globals()) - -def ImportFile(theFileName): - paravisSM.ImportFile(theFileName) - -active_objects = ActiveObjects() -active_objects.view = GetRenderView() +if __getFromGUI() < 1: + # Only if not in GUI (otherwise the createView will do the connection) + SalomeConnectToPVServer() +del SalomeConnectToPVServer + +# Forward namespace of simple into current pvsimple: +for name in dir(simple): + if not name.startswith("__"): + globals()[name] = getattr(simple, name) +del simple + diff --git a/src/PV_SWIG/servermanager.diff b/src/PV_SWIG/servermanager.diff deleted file mode 100644 index 45875718..00000000 --- a/src/PV_SWIG/servermanager.diff +++ /dev/null @@ -1,305 +0,0 @@ -0a1,19 -> # Copyright (C) 2010-2015 CEA/DEN, EDF R&D -> # -> # This library is free software; you can redistribute it and/or -> # modify it under the terms of the GNU Lesser General Public -> # License as published by the Free Software Foundation; either -> # version 2.1 of the License, or (at your option) any later version. -> # -> # This library is distributed in the hope that it will be useful, -> # but WITHOUT ANY WARRANTY; without even the implied warranty of -> # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -> # Lesser General Public License for more details. -> # -> # You should have received a copy of the GNU Lesser General Public -> # License along with this library; if not, write to the Free Software -> # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -> # -> # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -> # -> -29,43d47 -< #============================================================================== -< # -< # Program: ParaView -< # Module: servermanager.py -< # -< # Copyright (c) Kitware, Inc. -< # All rights reserved. -< # See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. -< # -< # This software is distributed WITHOUT ANY WARRANTY without even -< # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -< # PURPOSE. See the above copyright notice for more information. -< # -< #============================================================================== -< import paraview, re, os, os.path, new, sys, vtk -45,53c49,54 -< if not paraview.compatibility.minor: -< paraview.compatibility.major = 3 -< if not paraview.compatibility.major: -< paraview.compatibility.minor = 5 -< -< from vtkPVClientServerCorePython import * -< from vtkPVServerImplementationPython import * -< from vtkPVServerManagerPython import * -< from vtkPVCommonPython import * ---- -> -> -> import re, os, new, sys -> from paravis import * -> -> -61,62c62 -< if paraview.compatibility.GetVersion() >= 3.5 and \ -< smproperty.IsA("vtkSMStringVectorProperty"): ---- -> if smproperty.IsA("vtkSMStringVectorProperty"): -251,252c251,253 -< return self.SMProxy == other.SMProxy -< return self.SMProxy == other ---- -> ## VSV using IsSame instead == -> return self.SMProxy.IsSame(other.SMProxy) -> return self.SMProxy.IsSame(other) -347,350c348,351 -< if not c.HasObserver("ModifiedEvent"): -< self.ObserverTag =c.AddObserver("ModifiedEvent", \ -< _makeUpdateCameraMethod(weakref.ref(self))) -< self.Observed = c ---- -> # VSV: Observers are not supported -> ## if not c.HasObserver("ModifiedEvent"): -> ## self.ObserverTag =c.AddObserver("ModifiedEvent", _makeUpdateCameraMethod(weakref.ref(self))) -> ## self.Observed = c -454,472c455,472 -< if paraview.compatibility.GetVersion() >= 3.5: -< def FileNameChanged(self): -< "Called when the filename changes. Selects all variables." -< SourceProxy.FileNameChanged(self) -< self.SelectAllVariables() -< -< def SelectAllVariables(self): -< "Select all available variables for reading." -< for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables', -< 'ElementVariables', 'GlobalVariables'): -< f = getattr(self, prop) -< f.SelectAll() -< -< def DeselectAllVariables(self): -< "Deselects all variables." -< for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables', -< 'ElementVariables', 'GlobalVariables'): -< f = getattr(self, prop) -< f.DeselectAll() ---- -> def FileNameChanged(self): -> "Called when the filename changes. Selects all variables." -> SourceProxy.FileNameChanged(self) -> self.SelectAllVariables() -> -> def SelectAllVariables(self): -> "Select all available variables for reading." -> for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables', -> 'ElementVariables', 'GlobalVariables'): -> f = getattr(self, prop) -> f.SelectAll() -> -> def DeselectAllVariables(self): -> "Deselects all variables." -> for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables', -> 'ElementVariables', 'GlobalVariables'): -> f = getattr(self, prop) -> f.DeselectAll() -1110c1110,1111 -< if proxy == px: ---- -> ## VSV: == -> if proxy.IsSame(px): -1329,1332d1329 -< if paraview.compatibility.GetVersion() <= 3.4: -< def Range(self, component=0): -< return self.GetRange(component) -< -1526c1523 -< aProxy = self.SMProxyManager.NewProxy(group, name) ---- -> aProxy = self.SMProxyManager.NewProxy(group, name, "NULL") -1838a1836 -> # VTN: Observers are not supported -1840c1838 -< self.DefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2000, _update_definitions) ---- -> ## self.DefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2000, _update_definitions) -1842c1840 -< self.CustomDefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2001, _update_definitions) ---- -> ## self.CustomDefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2001, _update_definitions) -2056c2054,2055 -< try: isRep = rep.Input == aProxy ---- -> #VSV: == -> try: isRep = rep.Input.IsSame(aProxy) -2287,2303c2286,2287 -< """Turn on/off printing of progress (by default, it is on). You can -< always turn progress off and add your own observer to the process -< module to handle progress in a custom way. See _printProgress for -< an example event observer.""" -< global progressObserverTag -< -< # If value is true and progress printing is currently off... -< if value and not GetProgressPrintingIsEnabled(): -< if fromGUI: -< raise RuntimeError("Printing progress in the GUI is not supported.") -< progressObserverTag = vtkProcessModule.GetProcessModule().AddObserver(\ -< "ProgressEvent", _printProgress) -< -< # If value is false and progress printing is currently on... -< elif GetProgressPrintingIsEnabled(): -< vtkProcessModule.GetProcessModule().RemoveObserver(progressObserverTag) -< progressObserverTag = None ---- -> """Is not supported because of not supported observers""" -> pass -2330,2332c2314,2315 -< if paraview.compatibility.GetVersion() >= 3.5: -< if smproxy.GetXMLLabel(): -< xmlName = smproxy.GetXMLLabel() ---- -> if smproxy.GetXMLLabel(): -> xmlName = smproxy.GetXMLLabel() -2375,2378c2358 -< if paraview.compatibility.GetVersion() >= 3.5: -< return self.GetPropertyValue(propName) -< else: -< return self.GetProperty(propName) ---- -> return self.GetPropertyValue(propName) -2494c2474,2482 -< return paraview.make_name_valid(name) ---- -> """Make a string into a valid Python variable name.""" -> if not name: -> return None -> import string -> valid_chars = "_%s%s" % (string.ascii_letters, string.digits) -> name = str().join([c for c in name if c in valid_chars]) -> if not name[0].isalpha(): -> name = 'a' + name -> return name -2520,2521c2508 -< if paraview.compatibility.GetVersion() >= 3.5 and\ -< proto.GetXMLLabel(): ---- -> if proto.GetXMLLabel(): -2536,2539c2523,2525 -< if paraview.compatibility.GetVersion() >= 3.5: -< if (prop.GetInformationOnly() and propName != "TimestepValues" ) \ -< or prop.GetIsInternal(): -< continue ---- -> if (prop.GetInformationOnly() and propName != "TimestepValues" ) \ -> or prop.GetIsInternal(): -> continue -2541,2542c2527 -< if paraview.compatibility.GetVersion() >= 3.5: -< names = [iter.PropertyLabel] ---- -> names = [iter.PropertyLabel] -2681,2690c2666,2669 -< if paraview.compatibility.GetVersion() <= 3.4: -< ss = sources.SphereSource(Radius=2, ThetaResolution=32) -< shr = filters.ShrinkFilter(Input=OutputPort(ss,0)) -< cs = sources.ConeSource() -< app = filters.Append() -< else: -< ss = sources.Sphere(Radius=2, ThetaResolution=32) -< shr = filters.Shrink(Input=OutputPort(ss,0)) -< cs = sources.Cone() -< app = filters.AppendDatasets() ---- -> ss = sources.Sphere(Radius=2, ThetaResolution=32) -> shr = filters.Shrink(Input=OutputPort(ss,0)) -> cs = sources.Cone() -> app = filters.AppendDatasets() -2711,2714c2690 -< if paraview.compatibility.GetVersion() <= 3.4: -< arraySelection = reader.PointResultArrayStatus -< else: -< arraySelection = reader.PointVariables ---- -> arraySelection = reader.PointVariables -2748,2751c2724 -< if paraview.compatibility.GetVersion() <= 3.4: -< print "Range:", ai.Range(j) -< else: -< print "Range:", ai.GetRange(j) ---- -> print "Range:", ai.GetRange(j) -2782,2785c2755 -< if paraview.compatibility.GetVersion() <= 3.4: -< source = sources.RTAnalyticSource() -< else: -< source = sources.Wavelet() ---- -> source = sources.Wavelet() -2816,2823c2786,2788 -< if paraview.compatibility.GetVersion() <= 3.4: -< probe = filters.Probe(Input=source) -< # with a line -< line = sources.LineSource(Resolution=60) -< else: -< probe = filters.ResampleWithDataset(Input=source) -< # with a line -< line = sources.Line(Resolution=60) ---- -> probe = filters.ResampleWithDataset(Input=source) -> # with a line -> line = sources.Line(Resolution=60) -2867,2870c2832 -< if paraview.compatibility.GetVersion() <= 3.4: -< sphere = sources.SphereSource() -< else: -< sphere = sources.Sphere() ---- -> sphere = sources.Sphere() -2960,2965c2922,2927 -< pvoptions = None -< if paraview.options.batch: -< pvoptions = vtkPVOptions(); -< pvoptions.SetProcessType(0x40) -< if paraview.options.symmetric: -< pvoptions.SetSymmetricMPIMode(True) ---- -> # pvoptions = None Not applicable for SALOME Python console -> # if paraview.options.batch: -> # pvoptions = vtkPVOptions(); -> # pvoptions.SetProcessType(0x40) -> # if paraview.options.symmetric: -> # pvoptions.SetSymmetricMPIMode(True) -2994,2995c2956,2957 -< -< if not paraview.fromFilter: ---- -> ## VSV fromFilter is alwais False for SALOME because it can't be changed from ParaView code -> #if not paraview.fromFilter: -2998,2999c2960,2963 -< connection.AttachDefinitionUpdater() -< pass ---- -> # global _defUpdater -> # _defUpdater = __DefinitionUpdater() -> connection.AttachDefinitionUpdater() -> pass -3008a2973,2982 -> # Definitions for working in SALOME GUI mode -> #aParams = myParavis.GetConnectionParameters() -> #ActiveConnection = Connect() -> ##Connection(aParams[0]) -> #ActiveConnection.SetHost(aParams[1], aParams[2], aParams[3], aParams[4], aParams[5]) -> #ToggleProgressPrinting() -> #fromGUI = True -> -> InitFromGUI() -> diff --git a/src/PV_SWIG/simple.diff b/src/PV_SWIG/simple.diff deleted file mode 100644 index 39ff7776..00000000 --- a/src/PV_SWIG/simple.diff +++ /dev/null @@ -1,305 +0,0 @@ -0a1,19 -> # Copyright (C) 2010-2015 CEA/DEN, EDF R&D -> # -> # This library is free software; you can redistribute it and/or -> # modify it under the terms of the GNU Lesser General Public -> # License as published by the Free Software Foundation; either -> # version 2.1 of the License, or (at your option) any later version. -> # -> # This library is distributed in the hope that it will be useful, -> # but WITHOUT ANY WARRANTY; without even the implied warranty of -> # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -> # Lesser General Public License for more details. -> # -> # You should have received a copy of the GNU Lesser General Public -> # License along with this library; if not, write to the Free Software -> # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -> # -> # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -> # -> -21,34d39 -< #============================================================================== -< # -< # Program: ParaView -< # Module: simple.py -< # -< # Copyright (c) Kitware, Inc. -< # All rights reserved. -< # See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. -< # -< # This software is distributed WITHOUT ANY WARRANTY; without even -< # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -< # PURPOSE. See the above copyright notice for more information. -< # -< #============================================================================== -36,39c41 -< import paraview -< paraview.compatibility.major = 3 -< paraview.compatibility.minor = 5 -< import servermanager ---- -> import paravisSM -41,42c43 -< def enableMultiServer(): -< servermanager.enableMultiServer() ---- -> servermanager = paravisSM -44,56c45,46 -< def switchActiveConnection(newActiveConnection=None, ns=None): -< if not ns: -< ns = globals() -< _remove_functions(ns) -< servermanager.switchActiveConnection(newActiveConnection) -< _add_functions(ns) -< -< def Disconnect(ns=None, force=True): -< if servermanager.ActiveConnection and (force or servermanager.MultiServerConnections == None): -< if ns: -< _remove_functions(ns) -< _remove_functions(globals()) -< servermanager.ProxyManager().DisableStateUpdateNotification() ---- -> def _disconnect(): -> if servermanager.ActiveConnection: -61d50 -< servermanager.Disconnect() -62a52 -> servermanager.Disconnect() -69,70c59,60 -< Disconnect(globals(), False) -< connection = servermanager.Connect(ds_host, ds_port, rs_host, rs_port) ---- -> _disconnect() -> session = servermanager.Connect(ds_host, ds_port, rs_host, rs_port) -73,88c63,67 -< servermanager.ProxyManager().DisableStateUpdateNotification() -< servermanager.ProxyManager().UpdateFromRemote() -< tk = servermanager.ProxyManager().GetProxy("timekeeper", "TimeKeeper") -< if not tk: -< tk = servermanager.misc.TimeKeeper() -< servermanager.ProxyManager().RegisterProxy("timekeeper", "TimeKeeper", tk) -< -< scene = servermanager.ProxyManager().GetProxy("animation", "AnimationScene") -< if not scene: -< scene = AnimationScene() -< scene.TimeKeeper = tk -< -< servermanager.ProxyManager().EnableStateUpdateNotification() -< servermanager.ProxyManager().TriggerStateUpdate() -< -< return connection ---- -> tk = servermanager.misc.TimeKeeper() -> servermanager.ProxyManager().RegisterProxy("timekeeper", "tk", tk) -> scene = AnimationScene() -> scene.TimeKeeper = tk -> return session -93,94c72,73 -< Disconnect(globals(), False) -< connection = servermanager.ReverseConnect(port) ---- -> _disconnect() -> session = servermanager.ReverseConnect(port) -96,112c75,79 -< -< servermanager.ProxyManager().DisableStateUpdateNotification() -< servermanager.ProxyManager().UpdateFromRemote() -< tk = servermanager.ProxyManager().GetProxy("timekeeper", "TimeKeeper") -< if not tk: -< tk = servermanager.misc.TimeKeeper() -< servermanager.ProxyManager().RegisterProxy("timekeeper", "TimeKeeper", tk) -< -< scene = servermanager.ProxyManager().GetProxy("animation", "AnimationScene") -< if not scene: -< scene = AnimationScene() -< scene.TimeKeeper = tk -< -< servermanager.ProxyManager().EnableStateUpdateNotification() -< servermanager.ProxyManager().TriggerStateUpdate() -< -< return connection ---- -> tk = servermanager.misc.TimeKeeper() -> servermanager.ProxyManager().RegisterProxy("timekeeper", "tk", tk) -> scene = AnimationScene() -> scene.TimeKeeper = tk -> return session -121c88 -< ---- -> -161a129,131 -> reader_factor = servermanager.ProxyManager().GetReaderFactory() -> if reader_factor.GetNumberOfRegisteredPrototypes() == 0: -> reader_factor.RegisterPrototypes("sources") -163,165d132 -< reader_factor = servermanager.vtkSMProxyManager.GetProxyManager().GetReaderFactory() -< if reader_factor.GetNumberOfRegisteredPrototypes() == 0: -< reader_factor.RegisterPrototypes(session, "sources") -170,171c137 -< msg = "File not readable: %s " % first_file -< raise RuntimeError, msg ---- -> raise RuntimeError, "File not readable: %s " % first_file -173,174c139 -< msg = "File not readable. No reader found for '%s' " % first_file -< raise RuntimeError, msg ---- -> raise RuntimeError, "File not readable. No reader found for '%s' " % first_file -192,193c157 -< session = servermanager.ActiveConnection.Session -< writer_factory = servermanager.vtkSMProxyManager.GetProxyManager().GetWriterFactory() ---- -> writer_factory = servermanager.ProxyManager().GetWriterFactory() -195c159 -< writer_factory.RegisterPrototypes(session, "writers") ---- -> writer_factory.RegisterPrototypes("writers") -441c405,406 -< if proxy == GetActiveSource(): ---- -> #VSV:== -> if proxy.IsSame(GetActiveSource()): -449c414,415 -< if rep.Input == proxy: ---- -> #VSV:== -> if rep.Input.IsSame(proxy): -453c419,420 -< if proxy == GetActiveView(): ---- -> ##VSV:== -> if proxy.IsSame(GetActiveView()): -691,693c658,659 -< activeModule = servermanager.ActiveConnection.Modules -< for m in [activeModule.filters, activeModule.sources, -< activeModule.writers, activeModule.animation]: ---- -> for m in [servermanager.filters, servermanager.sources, -> servermanager.writers, servermanager.animation]: -699d664 -< #print "add %s function" % key -703,715d667 -< def _remove_functions(g): -< list = [] -< if servermanager.ActiveConnection: -< list = [m for m in dir(servermanager.ActiveConnection.Modules) if m[0] != '_'] -< -< for m in list: -< dt = servermanager.ActiveConnection.Modules.__dict__[m].__dict__ -< for key in dt.keys(): -< cl = dt[key] -< if not isinstance(cl, str) and g.has_key(key): -< g.pop(key) -< #print "remove %s function" % key -< -844c796 -< if cue.AnimatedProxy == proxy and\ ---- -> if cue.AnimatedProxy.IsSame(proxy) and\ -846c798 -< if index == None or index == cue.AnimatedElement: ---- -> if index == None or index.IsSame(cue.AnimatedElement): ##index == cue.AnimatedElement: -870c822 -< if cue.AnimatedProxy == view and\ ---- -> if cue.AnimatedProxy.IsSame(view) and\ -887c839 -< if cue.GetXMLName() == "TimeAnimationCue" and cue.AnimatedProxy == tk\ ---- -> if cue.GetXMLName() == "TimeAnimationCue" and cue.AnimatedProxy.IsSame(tk)\ -929,931c881 -< if not servermanager.ActiveConnection: -< raise RuntimeError, "Cannot load a plugin without a session." -< plm = servermanager.vtkSMProxyManager.GetProxyManager().GetPluginManager() ---- -> plm = servermanager.ProxyManager().GetSession().GetPluginManager() -933,934c883 -< session = servermanager.ActiveConnection.Session -< info = plm.GetRemoteInformation(session) ---- -> info = plm.GetRemoteInformation() -942,959d890 -< def GetLayouts(): -< """Returns the layout proxies on the active session. -< Layout proxies are used to place views in a grid.""" -< return servermanager.ProxyManager().GetProxiesInGroup("layouts") -< -< def GetLayout(view=None): -< """Return the layout containing the give view, if any. -< If no view is specified, active view is used. -< """ -< if not view: -< view = GetActiveView() -< if not view: -< raise RuntimeError, "No active view was found." -< layouts = GetLayouts() -< for layout in layouts.values(): -< if layout.GetViewLocation(view) != -1: -< return layout -< return None -966c897 -< def __get_selection_model(self, name, session=None): ---- -> def __get_selection_model(self, name): -968,970c899 -< if session and session != servermanager.ActiveConnection.Session: -< raise RuntimeError, "Try to set an active object with invalid active connection." -< pxm = servermanager.ProxyManager(session) ---- -> pxm = servermanager.ProxyManager() -979c908 -< active_view_model = self.__get_selection_model("ActiveView") ---- -> active_view_model = self.__get_selection_model("ActiveView") -981d909 -< active_view_model = self.__get_selection_model("ActiveView", view.GetSession()) -984d911 -< active_view_model = self.__get_selection_model("ActiveView") -994c921 -< active_sources_model = self.__get_selection_model("ActiveSources") ---- -> active_sources_model = self.__get_selection_model("ActiveSources") -997d923 -< active_sources_model = self.__get_selection_model("ActiveSources", source.GetSession()) -1000d925 -< active_sources_model = self.__get_selection_model("ActiveSources") -1107a1033,1041 -> def PrintTrace(): -> print paravisSM.myParavis.GetTrace() -> -> def SaveTrace(fileName): -> paravisSM.myParavis.SaveTrace(fileName) -> -> -> _add_functions(globals()) -> -1110,1111d1043 -< else: -< _add_functions(globals()) -1113c1045,1046 -< active_objects = ActiveObjects() ---- -> def ImportFile(theFileName): -> paravisSM.ImportFile(theFileName) -1115,1129c1048,1049 -< def _switchToActiveConnectionCallback(caller, event): -< if servermanager: -< session = servermanager.vtkSMProxyManager.GetProxyManager().GetActiveSession() -< if session and ((not servermanager.ActiveConnection) or session != servermanager.ActiveConnection.Session): -< switchActiveConnection(servermanager.GetConnectionFromSession(session)) -< -< class ActiveSessionObserver: -< def __init__(self): -< self.ObserverTag = servermanager.vtkSMProxyManager.GetProxyManager().AddObserver(9753, _switchToActiveConnectionCallback) -< -< def __del__(self): -< if servermanager: -< servermanager.vtkSMProxyManager.GetProxyManager().RemoveObserver(self.ObserverTag) -< -< active_session_observer = ActiveSessionObserver() ---- -> active_objects = ActiveObjects() -> active_objects.view = GetRenderView() diff --git a/src/VTKWrapping/CMakeLists.txt b/src/VTKWrapping/CMakeLists.txt deleted file mode 100644 index a869652d..00000000 --- a/src/VTKWrapping/CMakeLists.txt +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -## Parser for VTK header files -## =========================== -## -## Everything under the ParaView subdirectory is a pure copy of ParaView source -## code. - -INCLUDE_DIRECTORIES( - ${CMAKE_CURRENT_SOURCE_DIR}/ParaView - ${PROJECT_BINARY_DIR}/idl - ${PROJECT_SOURCE_DIR}/src/PVGUI - ) - -# Wrapper executable generating the headers, source files and IDL files -# corresponding to VTK wrapping: -SET(_wrap_PROGRAMS - vtkWrapIDL_HH - vtkWrapIDL_CC - vtkWrapIDL - ) - -SET(vtkWrapIDL_HH_CPPFLAGS -DIDL_I_HH) -SET(vtkWrapIDL_CC_CPPFLAGS -DIDL_I_CC) -SET(vtkWrapIDL_CPPFLAGS) - -#VTN TODO: vtkParseData supports two types of structures for wrapping. -#We use old structures currently, but is is not influent for results of wrapping. -#It may be necessary to port vtkWrapIDL to new approach in future. -#IF(VTK_LEGACY_REMOVE) -# ADD_DEFINITIONS(-DVTK_PARSE_LEGACY_REMOVE) -#ENDIF() - -ADD_DEFINITIONS(${OMNIORB_DEFINITIONS}) - -FOREACH(name ${_wrap_PROGRAMS}) - ADD_EXECUTABLE(${name} - ParaView/vtkParse.tab.c - ParaView/vtkParsePreprocess.c - ParaView/vtkParseHierarchy.c - ParaView/vtkParseExtras.c - ParaView/vtkParseMain.c - ParaView/vtkParseData.c - ParaView/vtkParseString.c - ParaView/vtkWrap.c -# ParaView/vtkWrapText.c - ${PROJECT_SOURCE_DIR}/idl/vtkWrapIDL.c) - ADD_DEPENDENCIES(${name} generate_txt) - - set_property(SOURCE ParaView/vtkParseMain.c PROPERTY COMPILE_DEFINITIONS - VTK_PARSE_VERSION="${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}") - - SET(flags) - FOREACH(f ${PARAVIEW_INCLUDES} ${VTK_INCLUDES} ${PLATFORM_CPPFLAGS} ${PTHREAD_CFLAGS} ${${name}_CPPFLAGS}) - SET(flags "${flags} ${f}") - ENDFOREACH(f ${PARAVIEW_INCLUDES} ${VTK_INCLUDES} ${PLATFORM_CPPFLAGS} ${PTHREAD_CFLAGS} ${${name}_CPPFLAGS}) - - SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "${flags}") - TARGET_LINK_LIBRARIES(${name} ${PLATFORM_LIBADD}) - - SET(${name}_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${name}) - IF(WIN32) - IF(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(${name}_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${name}.exe) - ELSE(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(${name}_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${name}.exe) - ENDIF(CMAKE_BUILD_TOOL STREQUAL nmake) - ENDIF(WIN32) - INSTALL(FILES ${${name}_EXEFILE} DESTINATION bin/salome PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) -ENDFOREACH(name ${_wrap_PROGRAMS}) \ No newline at end of file diff --git a/src/VTKWrapping/GenerateWrapList.cmake b/src/VTKWrapping/GenerateWrapList.cmake deleted file mode 100644 index 65e17628..00000000 --- a/src/VTKWrapping/GenerateWrapList.cmake +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -##### -# NOT USED ANYMORE ... to be deleted -#### -ADD_CUSTOM_COMMAND( - OUTPUT ${PROJECT_BINARY_DIR}/wrapfiles.txt - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/getwrapclasses.py - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/getwrapclasses.py ${PARAVIEW_PYTHON_EXECUTABLE} -) diff --git a/src/VTKWrapping/ParaView/lex.yy.c b/src/VTKWrapping/ParaView/lex.yy.c deleted file mode 100644 index 2ff339a7..00000000 --- a/src/VTKWrapping/ParaView/lex.yy.c +++ /dev/null @@ -1,5427 +0,0 @@ -#line 2 "lex.yy.c" - -#line 4 "lex.yy.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 37 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -#ifndef __cplusplus -extern int isatty(int); -#endif /* __cplusplus */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#define YY_BUF_SIZE 16384 -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -extern yy_size_t yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires - * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE yylex. - * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-yylineno scanner, because yy_act is - * normally declared as a register variable-- so it is not worth it. - */ - #define YY_LESS_LINENO(n) \ - do { \ - yy_size_t yyl;\ - for ( yyl = n; yyl < yyleng; ++yyl )\ - if ( yytext[yyl] == '\n' )\ - --yylineno;\ - }while(0) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); - -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -typedef int yy_state_type; - -extern int yylineno; - -int yylineno = 1; - -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 199 -#define YY_END_OF_BUFFER 200 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[1339] = - { 0, - 0, 0, 200, 198, 162, 163, 163, 197, 198, 197, - 197, 198, 197, 197, 197, 197, 197, 197, 197, 160, - 159, 197, 197, 197, 197, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 195, 198, 196, 197, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 197, 162, - 11, 11, 14, 197, 198, 162, 190, 0, 0, 15, - 17, 0, 169, 183, 166, 187, 184, 0, 0, 0, - 128, 129, 0, 0, 0, 0, 0, 181, 177, 179, - 178, 180, 176, 174, 0, 154, 1, 13, 182, 155, - - 158, 0, 0, 159, 159, 159, 194, 168, 165, 167, - 173, 191, 189, 192, 170, 153, 153, 153, 153, 0, - 0, 153, 153, 153, 0, 153, 153, 0, 164, 161, - 0, 186, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 82, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 185, 188, 162, 11, 14, 0, 0, - 14, 14, 12, 0, 15, 0, 0, 17, 0, 15, - - 16, 16, 0, 0, 0, 0, 0, 0, 175, 193, - 154, 154, 13, 155, 155, 158, 158, 0, 156, 157, - 159, 156, 171, 172, 153, 153, 153, 153, 0, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 80, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 27, 153, 153, 153, 153, 66, - 153, 84, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 70, 153, 153, 153, 153, 153, 153, 153, 153, 153, - - 86, 12, 14, 12, 12, 12, 12, 0, 0, 0, - 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 154, 0, 154, 155, 0, 155, 158, - 156, 156, 157, 157, 156, 153, 153, 153, 153, 0, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 20, 153, 153, - 31, 153, 26, 153, 153, 153, 153, 153, 153, 153, - 153, 48, 153, 153, 153, 153, 153, 153, 25, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 0, 153, 153, - - 153, 153, 153, 153, 153, 153, 153, 153, 30, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 12, 12, 12, 12, 12, 12, 12, - 12, 0, 0, 15, 0, 15, 15, 16, 16, 0, - 0, 0, 0, 0, 0, 0, 0, 154, 154, 155, - 155, 156, 156, 157, 157, 157, 157, 156, 153, 153, - 153, 153, 140, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 89, 71, 153, 153, 43, 90, 51, - 153, 153, 153, 153, 153, 153, 153, 22, 153, 153, - - 153, 153, 153, 153, 153, 153, 153, 83, 153, 153, - 153, 153, 153, 153, 24, 153, 153, 153, 153, 153, - 0, 153, 153, 153, 153, 69, 153, 153, 49, 153, - 65, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 12, 12, 12, - 12, 12, 12, 12, 2, 3, 0, 0, 15, 15, - 15, 16, 16, 0, 0, 0, 0, 0, 0, 0, - 0, 156, 153, 153, 153, 153, 140, 153, 153, 153, - 134, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 81, 88, 153, 153, 153, - - 153, 153, 153, 67, 21, 153, 153, 60, 55, 56, - 153, 153, 153, 153, 85, 153, 153, 153, 153, 153, - 45, 153, 153, 153, 29, 153, 153, 58, 0, 0, - 0, 0, 153, 44, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 87, 12, 12, 12, 2, 3, - 12, 12, 12, 2, 3, 0, 0, 15, 0, 0, - 0, 0, 0, 0, 0, 0, 153, 153, 153, 153, - 153, 153, 153, 133, 153, 146, 153, 153, 153, 153, - 150, 153, 153, 153, 23, 153, 153, 142, 153, 153, - - 153, 153, 153, 74, 153, 153, 153, 53, 153, 153, - 152, 153, 153, 46, 153, 0, 153, 153, 153, 35, - 35, 153, 153, 0, 0, 0, 0, 0, 0, 137, - 137, 153, 153, 63, 153, 153, 50, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 0, 34, 12, 12, - 12, 2, 3, 12, 12, 12, 0, 0, 0, 0, - 0, 131, 132, 0, 0, 0, 0, 0, 134, 18, - 134, 38, 153, 153, 153, 143, 144, 153, 153, 153, - 153, 153, 153, 153, 153, 32, 33, 153, 153, 73, - - 153, 68, 136, 136, 153, 72, 153, 54, 135, 135, - 0, 153, 0, 79, 153, 0, 42, 36, 36, 153, - 153, 0, 0, 0, 0, 0, 0, 61, 153, 62, - 28, 52, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 0, 12, 12, 12, 5, 12, - 12, 0, 0, 0, 0, 0, 130, 0, 0, 0, - 0, 153, 153, 153, 147, 153, 153, 153, 153, 153, - 153, 57, 153, 64, 153, 0, 47, 0, 153, 153, - 153, 0, 0, 0, 0, 0, 0, 153, 153, 153, - - 153, 153, 153, 153, 91, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 0, 5, 12, 12, 5, 12, 12, 0, 0, 0, - 0, 153, 151, 153, 153, 153, 149, 77, 153, 37, - 37, 0, 0, 0, 153, 153, 153, 0, 0, 0, - 0, 0, 0, 153, 153, 153, 153, 153, 153, 153, - 19, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 5, 12, 12, 12, 12, - 0, 4, 153, 153, 153, 153, 153, 0, 0, 0, - 153, 153, 75, 0, 0, 0, 0, 0, 0, 153, - - 153, 153, 93, 153, 153, 153, 153, 92, 153, 153, - 153, 153, 153, 153, 153, 153, 118, 153, 153, 153, - 153, 153, 153, 12, 12, 12, 12, 0, 153, 153, - 153, 153, 76, 0, 0, 0, 153, 153, 0, 0, - 0, 0, 59, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 138, 153, 120, 122, 124, 114, 153, 153, - 153, 153, 119, 153, 153, 153, 12, 12, 12, 12, - 0, 153, 153, 145, 148, 0, 0, 0, 39, 153, - 141, 0, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - - 153, 153, 121, 123, 125, 153, 153, 153, 12, 12, - 12, 12, 12, 12, 12, 0, 153, 153, 0, 40, - 0, 153, 0, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 126, 127, 153, 153, 153, 153, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 0, 153, 116, 0, - 153, 99, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 6, 153, 0, 41, 78, 153, 153, 153, 153, - - 153, 153, 153, 153, 153, 96, 153, 153, 153, 153, - 153, 153, 153, 153, 139, 153, 153, 12, 12, 12, - 12, 6, 12, 12, 12, 12, 6, 153, 153, 153, - 98, 95, 153, 153, 153, 153, 109, 97, 94, 153, - 153, 153, 153, 108, 153, 153, 153, 12, 12, 12, - 12, 6, 12, 12, 12, 12, 117, 153, 153, 104, - 105, 106, 107, 100, 101, 102, 103, 153, 153, 153, - 12, 12, 12, 12, 12, 12, 12, 12, 153, 153, - 153, 153, 153, 12, 12, 12, 12, 10, 12, 12, - 12, 112, 153, 115, 153, 153, 10, 12, 12, 12, - - 10, 12, 8, 9, 153, 153, 153, 10, 12, 8, - 9, 12, 8, 9, 153, 153, 153, 12, 8, 9, - 12, 153, 153, 111, 12, 7, 153, 153, 7, 7, - 153, 153, 7, 153, 110, 153, 113, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 4, 4, 5, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 6, 7, 8, 9, 1, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 26, 28, 26, 29, 17, 30, - 31, 32, 1, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 41, - 59, 60, 61, 62, 63, 1, 64, 65, 66, 67, - - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 17, 90, 17, 17, 1, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - 91, 91, 91, 91, 91 - } ; - -static yyconst flex_int32_t yy_meta[92] = - { 0, - 1, 2, 3, 4, 5, 2, 1, 1, 1, 1, - 6, 7, 1, 4, 6, 1, 1, 1, 8, 1, - 9, 9, 9, 9, 9, 9, 9, 9, 10, 1, - 1, 1, 1, 11, 11, 11, 11, 11, 11, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 1, 1, - 1, 1, 12, 11, 11, 11, 11, 11, 11, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 1, - 13 - - } ; - -static yyconst flex_int16_t yy_base[1417] = - { 0, - 0, 90, 4032, 4033, 92, 4033, 4033, 4000, 98, 76, - 86, 3970, 113, 4033, 3998, 98, 95, 115, 130, 156, - 174, 93, 122, 3997, 89, 97, 3964, 99, 123, 81, - 140, 155, 102, 124, 186, 151, 4033, 3995, 170, 144, - 142, 163, 162, 145, 172, 108, 94, 152, 188, 176, - 181, 105, 196, 206, 252, 198, 183, 153, 139, 280, - 4033, 4033, 3965, 273, 3952, 269, 4033, 293, 151, 235, - 265, 306, 4033, 4033, 4033, 4033, 4033, 242, 251, 321, - 4033, 4033, 288, 3994, 287, 263, 255, 4033, 4033, 4033, - 4033, 4033, 4007, 4033, 4002, 318, 4033, 0, 4033, 337, - - 366, 385, 0, 395, 0, 414, 4033, 4033, 4033, 4033, - 3989, 4033, 4033, 4033, 3988, 3955, 286, 284, 285, 323, - 3957, 361, 332, 304, 4003, 291, 305, 394, 4033, 4033, - 4012, 4033, 368, 308, 366, 310, 407, 383, 311, 319, - 364, 386, 365, 227, 287, 389, 393, 391, 395, 394, - 398, 404, 397, 417, 420, 421, 422, 423, 424, 425, - 431, 428, 3951, 432, 439, 444, 449, 438, 309, 441, - 459, 451, 455, 362, 462, 512, 461, 465, 466, 467, - 352, 475, 468, 4033, 4033, 548, 4033, 3953, 3992, 3939, - 3950, 529, 529, 468, 3946, 540, 3995, 4033, 600, 574, - - 3944, 543, 3977, 3976, 523, 527, 532, 569, 4033, 4033, - 0, 647, 0, 0, 660, 0, 673, 569, 618, 681, - 0, 700, 4033, 4033, 520, 46, 521, 174, 3975, 3940, - 536, 497, 496, 508, 523, 573, 584, 666, 585, 586, - 603, 594, 593, 667, 3939, 673, 675, 539, 592, 629, - 630, 677, 650, 668, 671, 689, 679, 691, 695, 697, - 696, 698, 700, 702, 3938, 703, 706, 714, 707, 3937, - 704, 3936, 710, 716, 742, 718, 719, 720, 723, 724, - 725, 726, 729, 727, 730, 731, 771, 745, 746, 748, - 3935, 750, 749, 752, 758, 757, 765, 759, 801, 767, - - 3934, 827, 798, 0, 823, 3943, 3942, 3915, 3910, 0, - 829, 892, 982, 0, 1073, 834, 809, 821, 817, 815, - 650, 823, 842, 0, 851, 905, 0, 913, 921, 0, - 934, 0, 1144, 0, 0, 821, 818, 824, 851, 0, - 1139, 901, 800, 822, 823, 852, 900, 833, 902, 1110, - 903, 798, 1113, 904, 909, 1112, 1152, 3929, 1122, 1123, - 3928, 1129, 1179, 806, 1130, 1124, 1131, 1134, 1143, 1153, - 1154, 3927, 1159, 1156, 1158, 1161, 1162, 910, 3926, 854, - 1164, 911, 1185, 1166, 912, 1169, 1172, 916, 1184, 1171, - 1173, 1181, 1187, 1193, 3925, 1191, 1188, 3958, 1195, 1199, - - 1200, 1203, 832, 1206, 1205, 1208, 1211, 1213, 3923, 1216, - 1214, 1217, 1221, 1223, 1222, 1225, 1224, 1228, 1231, 1232, - 1233, 1238, 1260, 0, 1283, 3932, 3931, 1259, 3915, 3925, - 3924, 3905, 3911, 0, 1328, 1419, 1509, 0, 1599, 1278, - 1280, 1392, 1393, 1394, 1404, 1396, 1411, 1432, 0, 1443, - 0, 0, 0, 1669, 0, 0, 0, 0, 1135, 1399, - 1409, 1435, 0, 1255, 1436, 1263, 1434, 1414, 1421, 1419, - 1422, 1258, 1425, 1261, 1379, 1426, 1424, 1467, 1429, 1468, - 1439, 1469, 1441, 3915, 3914, 1509, 1510, 3913, 3912, 1480, - 1471, 1472, 1483, 1489, 1481, 1492, 1497, 3911, 1498, 1499, - - 1500, 1491, 1512, 1513, 1514, 1515, 1557, 3910, 1516, 1558, - 1519, 1520, 1559, 1521, 3909, 1560, 1525, 1586, 3908, 1524, - 1561, 1564, 1562, 1532, 1530, 3907, 1583, 1573, 3906, 1585, - 3905, 1589, 1584, 1587, 1591, 1581, 1604, 1592, 1600, 1605, - 1603, 1608, 1610, 1618, 1621, 3904, 1622, 1627, 3898, 3908, - 3907, 3929, 3924, 3879, 0, 0, 3892, 3878, 0, 1738, - 1828, 0, 1918, 1647, 1680, 1669, 1657, 1658, 1648, 1693, - 1681, 0, 1650, 1664, 1724, 1725, 0, 1663, 1722, 1730, - 1669, 1656, 1662, 1649, 1702, 1709, 1703, 1654, 1710, 1474, - 1714, 1753, 1718, 1726, 1720, 3895, 3894, 3893, 3892, 1741, - - 1721, 1727, 1728, 3891, 3890, 1746, 1731, 3889, 3888, 3887, - 1738, 1742, 1732, 1786, 3886, 1787, 1788, 1750, 1752, 1789, - 1816, 1799, 1790, 1791, 3885, 2008, 1817, 3884, 3864, 3861, - 3862, 1792, 2099, 3880, 1793, 3879, 1427, 1806, 1815, 1818, - 1821, 1822, 1814, 1853, 1807, 1840, 1906, 510, 1823, 1761, - 1854, 1835, 1878, 1876, 3878, 3906, 3901, 3856, 0, 0, - 3891, 3900, 3869, 0, 0, 3858, 3864, 2190, 1914, 1873, - 2043, 1788, 1882, 1915, 1924, 1916, 1897, 1903, 1913, 1909, - 1926, 1929, 1921, 3869, 1904, 3868, 1849, 1910, 3867, 1381, - 3866, 1908, 1911, 1930, 3865, 1912, 1932, 3864, 2012, 2013, - - 1934, 1922, 1936, 3863, 3862, 1979, 2280, 3861, 1937, 1980, - 3860, 1984, 2371, 2075, 1939, 2051, 1992, 1981, 2148, 4033, - 3859, 2462, 2021, 3838, 3845, 3836, 3829, 3845, 3835, 4033, - 3852, 1998, 2099, 3851, 2011, 2019, 3850, 2020, 2026, 2071, - 1942, 1760, 2072, 2073, 2077, 2081, 1989, 2027, 1841, 2082, - 2079, 2083, 2125, 2094, 2105, 2030, 3883, 3848, 3864, 3873, - 3842, 0, 0, 3869, 3853, 3824, 3836, 3839, 2120, 2141, - 2210, 4033, 3873, 2224, 2153, 2119, 2157, 2195, 2124, 3838, - 2168, 3837, 3836, 2178, 3835, 3834, 3833, 2170, 2180, 2172, - 2106, 2112, 2171, 2173, 2179, 3832, 3831, 2175, 2177, 3830, - - 2199, 3829, 4033, 3828, 2198, 3827, 2280, 3826, 4033, 3825, - 2265, 2076, 3812, 3823, 2182, 2317, 4033, 4033, 3822, 2197, - 2209, 3803, 3808, 3801, 3813, 3791, 3807, 3815, 2251, 3814, - 3813, 3812, 2211, 2181, 2258, 2252, 2253, 2264, 2263, 2265, - 2213, 2269, 2275, 2273, 2286, 2274, 2281, 2282, 2287, 2290, - 2363, 2294, 2343, 2371, 2336, 3836, 3820, 3791, 0, 3829, - 3798, 3792, 3802, 2407, 2496, 2414, 4033, 2336, 2340, 2421, - 2422, 2385, 2304, 2386, 3804, 2362, 2364, 2372, 2378, 2379, - 2376, 3803, 2380, 3802, 2553, 3789, 2524, 3785, 2389, 2437, - 2446, 3794, 3782, 3792, 3796, 3790, 3780, 2392, 2383, 2440, - - 2450, 2442, 2206, 2449, 3793, 2297, 2441, 2452, 2471, 2444, - 2455, 2472, 2473, 2457, 2480, 2525, 2526, 2474, 2527, 2528, - 3772, 0, 3812, 3781, 0, 3804, 3772, 3767, 3781, 2518, - 2519, 2536, 3785, 2538, 2534, 2539, 3784, 3783, 2535, 4033, - 3782, 3766, 2616, 3760, 2533, 2541, 2542, 3778, 3758, 3776, - 3756, 3775, 3767, 2486, 2382, 2557, 2548, 2564, 2560, 2568, - 3773, 2566, 2569, 2570, 2565, 2571, 2575, 2576, 2626, 2578, - 2588, 2572, 2604, 2594, 2595, 0, 3787, 3755, 3786, 3749, - 3767, 4033, 2627, 2613, 2600, 3767, 2602, 3746, 3753, 3745, - 3763, 2605, 3762, 3748, 3742, 3746, 0, 3738, 0, 2606, - - 2607, 2619, 3757, 2611, 2617, 2612, 2632, 3756, 2616, 2621, - 2620, 2633, 2625, 2665, 2674, 2675, 3755, 2639, 2641, 2683, - 2643, 2478, 2646, 3770, 3733, 3809, 3742, 3720, 2666, 2676, - 2649, 2678, 3727, 3695, 3686, 2716, 2687, 2650, 0, 3688, - 0, 0, 3675, 2668, 2667, 2686, 2689, 2733, 2679, 2698, - 2701, 2742, 3662, 2724, 3649, 3636, 3623, 3619, 2691, 2709, - 2717, 2734, 3618, 2705, 2699, 2707, 3663, 3596, 2739, 3578, - 3583, 3580, 2720, 3579, 2735, 2779, 3547, 2787, 4033, 2731, - 3566, 3534, 2736, 2739, 2737, 2740, 2760, 2761, 2763, 2764, - 2748, 2756, 2750, 2765, 2769, 2774, 2779, 2784, 2770, 2808, - - 2810, 2773, 3553, 3532, 3519, 2776, 2775, 2777, 2807, 3491, - 3492, 3464, 3433, 3421, 3399, 3392, 2817, 2794, 2858, 4033, - 3383, 2783, 0, 2789, 2782, 2803, 2809, 2813, 2815, 2818, - 2820, 2822, 2793, 2827, 2828, 2832, 2834, 2836, 2838, 2840, - 3397, 3392, 2841, 2842, 2805, 2844, 3386, 3377, 3359, 3335, - 3325, 3316, 3314, 3316, 3303, 3333, 3280, 2854, 3289, 2906, - 2847, 3284, 2869, 2850, 2853, 2859, 2860, 2861, 2870, 2865, - 2851, 2874, 2875, 2876, 2877, 2878, 2882, 2884, 2903, 2887, - 2795, 2888, 3257, 3255, 3264, 3259, 3293, 3253, 3254, 3313, - 3299, 0, 2917, 2956, 4033, 3241, 2900, 2904, 2891, 2897, - - 2905, 2907, 2908, 2910, 2914, 3240, 2915, 2916, 2918, 2919, - 2920, 2921, 2927, 2932, 3225, 2934, 2924, 3214, 3211, 3266, - 3261, 0, 3198, 3176, 3212, 3181, 0, 2953, 2945, 2940, - 3181, 3169, 2941, 2946, 2949, 2950, 3163, 3160, 3155, 2951, - 2952, 2954, 2955, 3149, 2957, 2958, 2963, 3136, 3113, 3144, - 3113, 0, 3093, 3079, 3070, 3065, 3071, 2959, 2971, 3070, - 3069, 3068, 3065, 3056, 3035, 3033, 3031, 2973, 2974, 2993, - 3010, 3019, 3015, 3014, 3006, 3008, 3003, 3002, 2979, 2978, - 2981, 2982, 2983, 2995, 2931, 2894, 2892, 0, 2787, 2700, - 2642, 2443, 2986, 2305, 2985, 2989, 0, 2283, 2239, 1890, - - 0, 1841, 0, 0, 2988, 3004, 2998, 0, 1658, 0, - 0, 1548, 0, 0, 2999, 3000, 3005, 1467, 0, 0, - 1240, 3023, 3007, 1170, 634, 0, 3008, 3011, 0, 0, - 3012, 3017, 0, 3018, 434, 3019, 275, 4033, 3099, 3112, - 3124, 3130, 3135, 3148, 3161, 3174, 3179, 3184, 3197, 3202, - 3208, 3213, 3216, 3229, 3242, 3247, 3252, 3257, 3262, 3267, - 3272, 3285, 3288, 3301, 3304, 3312, 3317, 3322, 3327, 3332, - 3337, 3342, 3347, 3352, 3355, 3368, 3381, 3386, 3399, 3412, - 3417, 3430, 3435, 3440, 3445, 3450, 3455, 3460, 3473, 3486, - 3491, 3504, 3517, 3522, 3535, 3540, 3553, 3566, 3579, 3592, - - 3605, 3618, 3631, 3644, 3657, 3670, 3683, 3696, 3709, 3722, - 3735, 3748, 3761, 3774, 3787, 3800 - } ; - -static yyconst flex_int16_t yy_def[1417] = - { 0, - 1338, 1, 1338, 1338, 1338, 1338, 1338, 1338, 1339, 1338, - 1338, 1340, 1341, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1342, 1338, 1338, 1338, 1338, 1343, 1343, 1343, 1343, 1343, - 1343, 1343, 1343, 1343, 1338, 1338, 1338, 1338, 1343, 1343, - 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, - 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1338, 1338, - 1338, 1338, 1344, 1338, 1338, 1338, 1338, 1339, 1345, 1346, - 1345, 1339, 1338, 1338, 1338, 1338, 1338, 1340, 1340, 1341, - 1338, 1338, 1347, 1347, 1347, 1347, 1347, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1348, 1338, 1349, 1338, 1350, - - 1351, 1338, 1352, 1342, 1353, 1353, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1343, 1343, 1343, 1343, 1345, - 1340, 1343, 1343, 1343, 1346, 1343, 1343, 1338, 1338, 1338, - 1338, 1338, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, - 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, - 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, - 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, - 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, - 1343, 1343, 1343, 1338, 1338, 1338, 1338, 1344, 1338, 1338, - 1344, 1344, 1354, 1338, 1338, 1345, 1346, 1338, 1355, 1339, - - 1338, 1340, 1347, 1338, 1347, 1347, 1347, 1347, 1338, 1338, - 1356, 1356, 1349, 1357, 1357, 1358, 1358, 1338, 1359, 1360, - 1353, 1361, 1338, 1338, 1343, 1343, 1343, 1343, 1338, 1343, - 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, - 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, - 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, - 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, - 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, - 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, - 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1343, - - 1343, 1362, 1344, 1354, 1354, 1354, 1354, 1338, 1338, 1363, - 1345, 1364, 1338, 1365, 1338, 1366, 1347, 1347, 1347, 1347, - 1347, 1347, 1347, 1356, 1338, 1367, 1357, 1338, 1368, 1358, - 1369, 1370, 1371, 1372, 1373, 1374, 1374, 1374, 1374, 1375, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1338, 1374, 1374, - - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1376, 1376, 1376, 1376, 1377, 1377, 1377, - 1377, 1338, 1338, 1378, 1338, 1379, 1380, 1381, 1382, 1347, - 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1383, 1384, 1385, - 1386, 1387, 1370, 1371, 454, 1372, 1372, 1373, 1374, 1374, - 1374, 1374, 1388, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1338, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1376, 1376, 1376, - 1376, 1377, 1377, 1377, 1389, 1390, 1338, 1338, 1391, 1392, - 1393, 1394, 1395, 1396, 1396, 1396, 1396, 1396, 1396, 1396, - 1396, 1387, 1374, 1374, 1374, 1374, 1388, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1338, 1338, - 1338, 1338, 626, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1376, 1376, 1376, 1397, 1398, - 1377, 1377, 1377, 1389, 1390, 1338, 1338, 1392, 1396, 1396, - 1396, 1396, 1396, 1396, 1396, 1396, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - - 1374, 1374, 1374, 1374, 1374, 1374, 626, 1374, 1374, 1374, - 1374, 1374, 626, 1374, 1374, 1338, 1374, 1374, 1374, 1338, - 1374, 626, 1374, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1338, 1374, 1376, 1376, - 1376, 1397, 1398, 1377, 1377, 1377, 1338, 1338, 1396, 1396, - 1338, 1338, 1396, 1396, 1396, 1396, 1396, 1396, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - - 1374, 1374, 1338, 1374, 1374, 1374, 1374, 1374, 1338, 1374, - 1338, 1374, 1338, 1374, 1374, 1338, 1338, 1338, 1374, 1374, - 1374, 1338, 1338, 1338, 1338, 1338, 1338, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1338, 1376, 1376, 1376, 1399, 1377, - 1377, 1338, 1338, 1396, 1396, 1338, 1338, 1396, 1396, 1396, - 1396, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 626, 1338, 1374, 1338, 1374, 1374, - 1374, 1338, 1338, 1338, 1338, 1338, 1338, 1374, 1374, 1374, - - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1338, 1400, 1376, 1376, 1399, 1377, 1377, 1338, 1338, 1396, - 1396, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1338, - 1374, 1338, 1338, 1338, 1374, 1374, 1374, 1338, 1338, 1338, - 1338, 1338, 1338, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1400, 1376, 1376, 1377, 1377, - 1338, 1338, 1374, 1374, 1374, 1374, 1374, 1338, 1338, 1338, - 1374, 1374, 1374, 1338, 1338, 1338, 1401, 1338, 1402, 1374, - - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1376, 1376, 1377, 1377, 1338, 1374, 1374, - 1374, 1374, 1374, 1338, 1338, 1338, 1374, 1374, 1403, 1338, - 1404, 1405, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1376, 1376, 1377, 1377, - 1338, 1374, 1374, 1374, 1374, 1338, 1338, 1338, 1338, 1374, - 1374, 1338, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1376, 1376, - 1377, 1377, 1377, 1377, 1377, 1338, 1374, 1374, 1338, 1338, - 1338, 1374, 1406, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1376, 1376, 1376, 1376, - 1376, 1377, 1377, 1377, 1377, 1377, 1338, 1374, 1374, 1338, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1376, 1376, 1376, 1376, 1376, 1377, 1377, 1377, - 1377, 1407, 1374, 1338, 1338, 1374, 1374, 1374, 1374, 1374, - - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1376, 1376, 1376, - 1376, 1408, 1377, 1377, 1377, 1377, 1407, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1376, 1376, 1376, - 1376, 1408, 1377, 1377, 1377, 1377, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, - 1376, 1376, 1376, 1376, 1377, 1377, 1377, 1377, 1374, 1374, - 1374, 1374, 1374, 1376, 1376, 1376, 1376, 1409, 1377, 1377, - 1377, 1374, 1374, 1374, 1374, 1374, 1410, 1376, 1376, 1376, - - 1409, 1377, 1411, 1412, 1374, 1374, 1374, 1410, 1376, 1413, - 1414, 1377, 1411, 1412, 1374, 1374, 1374, 1376, 1413, 1414, - 1377, 1374, 1374, 1374, 1376, 1415, 1374, 1374, 1416, 1415, - 1374, 1374, 1416, 1374, 1374, 1374, 1374, 0, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338 - } ; - -static yyconst flex_int16_t yy_nxt[4125] = - { 0, - 4, 5, 6, 7, 7, 5, 8, 9, 4, 10, - 11, 12, 13, 14, 15, 16, 14, 17, 18, 19, - 20, 21, 21, 21, 21, 21, 21, 21, 22, 23, - 24, 25, 4, 26, 27, 28, 27, 27, 27, 27, - 27, 27, 27, 27, 29, 27, 27, 27, 27, 30, - 31, 27, 27, 32, 33, 34, 27, 27, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 27, - 27, 46, 27, 27, 47, 48, 49, 50, 51, 27, - 52, 53, 54, 55, 56, 57, 58, 27, 27, 59, - 27, 60, 61, 66, 62, 60, 76, 66, 63, 69, - - 69, 69, 337, 69, 73, 70, 74, 75, 118, 64, - 71, 69, 91, 89, 80, 80, 77, 80, 80, 114, - 115, 107, 65, 81, 108, 92, 93, 82, 90, 94, - 120, 109, 119, 95, 121, 96, 96, 96, 96, 96, - 96, 96, 96, 123, 97, 117, 83, 125, 85, 98, - 110, 111, 112, 130, 126, 131, 118, 72, 195, 118, - 99, 118, 120, 124, 118, 127, 121, 118, 86, 184, - 118, 156, 167, 122, 100, 87, 101, 101, 101, 101, - 101, 101, 101, 101, 154, 118, 118, 128, 128, 155, - 128, 128, 100, 102, 104, 104, 104, 104, 104, 104, - - 104, 104, 118, 133, 118, 122, 118, 118, 339, 134, - 196, 106, 103, 141, 118, 118, 135, 118, 138, 142, - 139, 150, 136, 102, 118, 118, 143, 140, 185, 147, - 183, 151, 137, 144, 118, 157, 118, 145, 118, 148, - 146, 106, 103, 118, 129, 118, 152, 198, 182, 149, - 118, 158, 153, 201, 162, 159, 163, 164, 118, 120, - 118, 165, 202, 121, 166, 160, 168, 169, 118, 179, - 66, 161, 195, 172, 66, 180, 173, 170, 171, 176, - 181, 186, 187, 204, 187, 186, 174, 97, 188, 118, - 250, 204, 193, 175, 69, 69, 69, 199, 69, 189, - - 70, 79, 122, 99, 207, 71, 69, 69, 69, 69, - 79, 69, 190, 200, 118, 204, 204, 208, 71, 69, - 206, 226, 80, 80, 196, 80, 80, 225, 177, 227, - 195, 81, 229, 178, 230, 82, 205, 118, 96, 96, - 96, 96, 96, 96, 96, 96, 118, 118, 118, 118, - 251, 231, 72, 118, 83, 212, 85, 96, 96, 96, - 96, 96, 96, 96, 96, 72, 118, 118, 125, 226, - 118, 118, 118, 118, 215, 234, 86, 245, 283, 228, - 236, 118, 196, 87, 100, 212, 101, 101, 101, 101, - 101, 101, 101, 101, 118, 128, 128, 284, 128, 128, - - 218, 246, 218, 217, 215, 219, 219, 219, 219, 219, - 219, 219, 219, 100, 118, 104, 104, 104, 104, 104, - 104, 104, 104, 118, 118, 299, 118, 118, 118, 218, - 118, 218, 106, 217, 222, 222, 222, 222, 222, 222, - 222, 222, 232, 235, 226, 118, 247, 249, 118, 291, - 233, 118, 129, 118, 244, 118, 118, 118, 254, 118, - 118, 255, 106, 248, 252, 253, 118, 256, 263, 118, - 237, 258, 238, 239, 257, 240, 260, 259, 241, 118, - 261, 262, 118, 118, 118, 118, 118, 118, 242, 243, - 118, 264, 271, 118, 118, 274, 118, 267, 269, 265, - - 118, 118, 266, 118, 268, 273, 118, 272, 279, 270, - 277, 118, 285, 118, 276, 282, 278, 118, 280, 120, - 281, 118, 286, 118, 118, 287, 289, 118, 118, 118, - 118, 191, 293, 303, 305, 290, 295, 118, 297, 288, - 292, 298, 294, 308, 309, 300, 296, 311, 301, 186, - 187, 204, 187, 186, 201, 204, 188, 336, 118, 118, - 204, 752, 122, 306, 317, 338, 307, 189, 343, 342, - 118, 318, 118, 344, 118, 69, 69, 69, 319, 69, - 190, 70, 118, 118, 345, 118, 71, 69, 192, 219, - 219, 219, 219, 219, 219, 219, 219, 204, 118, 196, - - 197, 118, 79, 346, 197, 315, 197, 197, 197, 197, - 197, 197, 198, 361, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 72, 320, 118, 313, 321, 219, 219, - 219, 219, 219, 219, 219, 219, 118, 118, 118, 352, - 322, 323, 351, 347, 118, 118, 118, 362, 197, 197, - 197, 197, 325, 355, 325, 118, 348, 326, 326, 326, - 326, 326, 326, 326, 326, 328, 354, 328, 204, 353, - 329, 329, 329, 329, 329, 329, 329, 329, 218, 197, - 218, 118, 118, 331, 331, 331, 331, 331, 331, 331, - - 331, 220, 220, 220, 220, 220, 220, 220, 220, 363, - 1329, 364, 118, 445, 333, 333, 333, 333, 333, 333, - 222, 222, 222, 222, 222, 222, 222, 222, 118, 118, - 118, 366, 349, 118, 368, 118, 356, 118, 359, 118, - 350, 118, 367, 370, 333, 333, 333, 333, 333, 333, - 358, 118, 360, 118, 371, 365, 369, 118, 118, 118, - 118, 375, 118, 374, 118, 118, 118, 376, 118, 118, - 372, 373, 118, 377, 381, 379, 118, 380, 118, 226, - 118, 118, 118, 378, 384, 118, 118, 118, 118, 118, - 382, 118, 118, 118, 395, 391, 385, 390, 387, 398, - - 191, 392, 389, 388, 118, 394, 393, 118, 118, 386, - 118, 118, 118, 397, 118, 402, 399, 404, 396, 118, - 118, 118, 410, 406, 401, 403, 405, 118, 400, 118, - 422, 409, 425, 118, 407, 411, 195, 204, 412, 408, - 413, 428, 414, 204, 81, 204, 440, 415, 82, 204, - 442, 204, 416, 417, 418, 419, 420, 192, 461, 429, - 118, 426, 118, 118, 427, 441, 460, 459, 118, 468, - 204, 448, 448, 448, 448, 448, 448, 448, 448, 477, - 118, 443, 421, 118, 118, 118, 118, 488, 196, 444, - 470, 435, 197, 462, 118, 118, 197, 469, 197, 197, - - 197, 197, 197, 197, 198, 446, 197, 197, 197, 197, - 197, 197, 447, 118, 118, 473, 118, 526, 502, 471, - 197, 197, 197, 197, 197, 326, 326, 326, 326, 326, - 326, 326, 326, 450, 450, 450, 450, 450, 450, 450, - 450, 329, 329, 329, 329, 329, 329, 329, 329, 467, - 197, 197, 197, 197, 331, 331, 331, 331, 331, 331, - 331, 331, 118, 118, 118, 118, 118, 472, 476, 474, - 479, 118, 118, 118, 118, 507, 504, 501, 118, 510, - 480, 197, 68, 69, 69, 69, 68, 69, 68, 70, - 68, 68, 68, 68, 71, 69, 68, 68, 68, 68, - - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 437, 437, 437, 437, 437, - 437, 437, 437, 437, 437, 437, 437, 437, 437, 437, - 437, 437, 437, 437, 437, 437, 437, 437, 437, 437, - 68, 72, 68, 68, 437, 437, 437, 437, 437, 437, - 437, 437, 437, 437, 437, 437, 437, 437, 437, 437, - 437, 437, 437, 437, 437, 437, 437, 437, 437, 437, - 437, 68, 437, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 201, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - - 78, 78, 78, 78, 78, 78, 439, 439, 439, 439, - 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, - 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, - 439, 78, 79, 78, 78, 439, 439, 439, 439, 439, - 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, - 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, - 439, 439, 78, 439, 454, 454, 454, 454, 454, 454, - 454, 454, 118, 464, 118, 118, 226, 455, 455, 455, - 455, 455, 455, 465, 118, 118, 118, 573, 481, 226, - 475, 118, 118, 118, 466, 478, 118, 118, 483, 485, - - 486, 118, 487, 484, 489, 118, 490, 455, 455, 455, - 455, 455, 455, 491, 118, 118, 118, 492, 118, 482, - 118, 118, 226, 118, 118, 493, 118, 494, 118, 495, - 496, 118, 118, 118, 118, 118, 497, 499, 500, 509, - 498, 118, 512, 118, 506, 503, 118, 118, 508, 118, - 118, 511, 505, 118, 513, 118, 516, 118, 519, 520, - 517, 118, 118, 514, 523, 118, 525, 118, 118, 515, - 118, 522, 527, 118, 524, 118, 118, 530, 118, 118, - 531, 529, 528, 118, 118, 118, 118, 118, 536, 537, - 118, 534, 539, 118, 118, 118, 532, 226, 533, 538, - - 118, 548, 543, 535, 542, 552, 204, 540, 204, 544, - 553, 541, 578, 580, 565, 545, 1326, 118, 546, 549, - 118, 586, 118, 118, 564, 118, 588, 547, 69, 69, - 69, 69, 69, 69, 69, 195, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 560, 560, 560, 560, 560, 560, 560, 560, 560, - 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, - 560, 560, 560, 560, 560, 560, 69, 196, 69, 69, - 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, - - 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, - 560, 560, 560, 560, 560, 560, 560, 69, 560, 197, - 204, 204, 204, 197, 204, 197, 197, 197, 197, 197, - 197, 198, 204, 197, 197, 197, 197, 197, 197, 204, - 566, 118, 575, 118, 589, 790, 574, 197, 197, 197, - 197, 197, 448, 448, 448, 448, 448, 448, 448, 448, - 567, 118, 570, 450, 450, 450, 450, 450, 450, 450, - 450, 118, 576, 579, 568, 581, 118, 197, 197, 197, - 197, 118, 571, 118, 118, 569, 118, 118, 118, 118, - 582, 118, 583, 592, 593, 734, 118, 118, 118, 584, - - 590, 118, 595, 118, 585, 587, 591, 597, 197, 68, - 69, 69, 69, 68, 69, 68, 70, 68, 68, 68, - 68, 71, 69, 68, 68, 68, 68, 68, 68, 118, - 118, 118, 599, 118, 118, 598, 118, 68, 68, 68, - 68, 68, 600, 118, 1325, 118, 603, 601, 596, 594, - 604, 118, 606, 118, 118, 693, 605, 607, 602, 118, - 118, 118, 118, 611, 609, 612, 610, 68, 72, 68, - 68, 118, 118, 608, 118, 118, 118, 118, 118, 618, - 614, 118, 118, 118, 620, 621, 118, 118, 623, 628, - 613, 625, 118, 615, 118, 635, 636, 616, 68, 78, - - 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 201, 78, 78, 78, 78, 78, 78, 78, 78, 118, - 118, 118, 118, 226, 118, 1321, 118, 78, 78, 78, - 78, 78, 629, 633, 624, 118, 638, 630, 631, 617, - 619, 622, 632, 118, 634, 118, 118, 118, 118, 118, - 637, 118, 640, 118, 118, 641, 645, 78, 79, 78, - 78, 639, 118, 644, 642, 118, 118, 118, 626, 643, - 118, 648, 118, 656, 646, 204, 204, 651, 657, 650, - 118, 649, 647, 118, 118, 204, 204, 653, 78, 454, - 454, 454, 454, 454, 454, 454, 454, 204, 652, 669, - - 677, 655, 455, 455, 455, 455, 455, 455, 204, 204, - 671, 118, 118, 670, 678, 681, 118, 684, 118, 685, - 687, 204, 672, 673, 118, 118, 118, 686, 691, 1318, - 674, 118, 455, 455, 455, 455, 455, 455, 69, 69, - 69, 69, 69, 69, 69, 195, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 675, 679, - 680, 682, 676, 683, 118, 118, 69, 69, 69, 69, - 69, 118, 118, 692, 690, 689, 118, 695, 226, 694, - 118, 696, 118, 118, 118, 688, 118, 118, 118, 118, - 118, 697, 118, 118, 118, 709, 69, 196, 69, 69, - - 118, 698, 706, 118, 118, 703, 701, 702, 118, 708, - 704, 705, 118, 707, 118, 118, 204, 716, 716, 714, - 716, 716, 118, 118, 836, 713, 754, 69, 68, 69, - 69, 69, 68, 69, 68, 70, 68, 68, 68, 68, - 71, 69, 68, 68, 68, 68, 68, 68, 118, 118, - 118, 118, 118, 118, 226, 118, 68, 68, 68, 68, - 68, 118, 774, 727, 710, 712, 717, 711, 118, 118, - 718, 715, 719, 728, 729, 732, 118, 118, 118, 118, - 118, 735, 736, 118, 118, 118, 68, 72, 68, 68, - 753, 740, 737, 746, 745, 738, 739, 118, 741, 722, - - 742, 204, 118, 118, 743, 843, 757, 744, 770, 756, - 204, 118, 1312, 226, 787, 118, 118, 68, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 201, - 78, 78, 78, 78, 78, 78, 78, 78, 118, 755, - 118, 747, 204, 204, 204, 775, 78, 78, 78, 78, - 78, 748, 204, 749, 779, 780, 781, 750, 758, 118, - 751, 782, 784, 783, 769, 118, 118, 1311, 118, 785, - 118, 118, 118, 118, 118, 118, 78, 79, 78, 78, - 776, 778, 791, 118, 118, 786, 794, 777, 118, 792, - 788, 118, 118, 793, 118, 795, 118, 798, 118, 118, - - 799, 118, 805, 800, 118, 835, 812, 78, 720, 720, - 720, 720, 720, 720, 720, 720, 720, 720, 720, 720, - 720, 720, 720, 720, 720, 720, 720, 720, 721, 721, - 721, 721, 721, 721, 721, 721, 720, 720, 720, 720, - 720, 118, 118, 118, 771, 771, 118, 771, 771, 226, - 226, 118, 716, 716, 118, 716, 716, 772, 226, 815, - 118, 802, 806, 841, 808, 828, 720, 720, 720, 720, - 118, 204, 814, 118, 118, 118, 811, 811, 830, 811, - 811, 118, 118, 118, 820, 831, 821, 832, 118, 118, - 842, 773, 118, 833, 796, 797, 854, 720, 721, 730, - - 730, 730, 730, 730, 730, 730, 730, 730, 730, 730, - 730, 730, 730, 730, 730, 730, 730, 730, 730, 731, - 731, 731, 731, 731, 731, 731, 731, 730, 730, 730, - 730, 730, 813, 118, 118, 118, 226, 118, 118, 118, - 838, 118, 887, 118, 118, 118, 845, 204, 204, 816, - 816, 834, 816, 816, 837, 839, 118, 730, 730, 730, - 730, 118, 840, 847, 844, 846, 848, 118, 118, 204, - 849, 852, 684, 829, 118, 850, 817, 864, 851, 878, - 691, 204, 869, 853, 865, 204, 118, 118, 730, 731, - 69, 69, 69, 69, 69, 69, 69, 195, 69, 69, - - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 118, 771, 771, 873, 771, 771, 684, 226, 69, 69, - 69, 69, 69, 204, 772, 866, 866, 868, 866, 866, - 118, 870, 118, 118, 118, 118, 226, 118, 867, 118, - 118, 118, 118, 118, 118, 879, 875, 691, 69, 196, - 69, 69, 204, 880, 876, 877, 881, 882, 871, 118, - 118, 118, 889, 900, 883, 884, 811, 811, 118, 811, - 811, 118, 891, 118, 899, 118, 907, 959, 890, 69, - 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, - 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, - - 804, 804, 804, 804, 804, 804, 804, 804, 803, 803, - 803, 803, 803, 118, 118, 118, 1310, 226, 816, 816, - 118, 816, 816, 901, 902, 118, 118, 118, 898, 904, - 905, 118, 906, 903, 908, 118, 118, 118, 803, 803, - 803, 803, 118, 118, 118, 817, 886, 909, 118, 118, - 915, 911, 118, 910, 912, 913, 118, 916, 914, 118, - 918, 933, 885, 961, 204, 1309, 118, 118, 204, 803, - 804, 809, 809, 809, 809, 809, 809, 809, 809, 809, - 809, 809, 809, 809, 809, 809, 809, 809, 809, 809, - 809, 810, 810, 810, 810, 810, 810, 810, 810, 809, - - 809, 809, 809, 809, 917, 118, 920, 629, 771, 771, - 774, 771, 771, 631, 930, 866, 866, 921, 866, 866, - 919, 772, 226, 934, 118, 118, 118, 1001, 867, 809, - 809, 809, 809, 118, 118, 204, 932, 937, 118, 935, - 118, 118, 118, 939, 118, 118, 936, 118, 118, 204, - 204, 118, 691, 691, 118, 773, 945, 954, 938, 955, - 809, 810, 818, 818, 818, 818, 818, 818, 818, 818, - 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, - 818, 818, 819, 819, 819, 819, 819, 819, 819, 819, - 818, 818, 818, 818, 818, 774, 931, 771, 771, 118, - - 771, 771, 118, 118, 118, 118, 118, 956, 118, 958, - 772, 118, 118, 1065, 118, 965, 962, 118, 946, 118, - 818, 818, 818, 818, 204, 943, 943, 947, 943, 943, - 957, 960, 963, 118, 118, 118, 118, 966, 964, 969, - 118, 973, 118, 967, 773, 970, 204, 204, 118, 1000, - 968, 818, 819, 940, 940, 940, 940, 940, 940, 940, - 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, - 940, 940, 940, 941, 941, 941, 941, 941, 941, 941, - 941, 940, 940, 940, 940, 940, 118, 118, 118, 118, - 118, 983, 774, 774, 984, 118, 118, 118, 118, 985, - - 118, 118, 972, 118, 118, 975, 986, 974, 992, 971, - 118, 940, 940, 940, 940, 991, 987, 943, 943, 118, - 943, 943, 118, 1002, 993, 1003, 118, 118, 118, 1004, - 118, 118, 118, 118, 118, 1009, 1005, 118, 118, 1013, - 118, 1010, 940, 941, 1007, 1006, 1008, 1014, 1011, 1015, - 118, 1012, 1016, 1017, 1020, 1021, 118, 118, 1018, 1019, - 1029, 460, 118, 1031, 118, 1030, 118, 118, 118, 118, - 1044, 1045, 1023, 118, 118, 118, 1022, 1049, 118, 118, - 1043, 118, 118, 118, 1033, 1038, 1047, 118, 118, 118, - 1051, 1055, 1048, 1046, 118, 118, 1056, 989, 1050, 1057, - - 1052, 118, 1053, 118, 1060, 118, 1061, 1054, 118, 1062, - 1063, 118, 118, 1073, 1072, 226, 1058, 1078, 1078, 1304, - 1078, 1078, 1059, 1074, 226, 1064, 1066, 118, 118, 118, - 118, 1085, 1081, 1083, 1086, 1103, 118, 118, 118, 1104, - 1075, 118, 1092, 1093, 1079, 118, 1094, 1100, 118, 118, - 1101, 118, 1080, 118, 1084, 1087, 1088, 1089, 1105, 1090, - 118, 118, 1102, 118, 1095, 1096, 1097, 118, 1098, 118, - 1118, 118, 226, 1108, 1111, 1112, 1107, 1303, 1091, 118, - 1119, 1119, 118, 1119, 1119, 1106, 118, 1099, 1078, 1078, - 1113, 1078, 1078, 118, 1122, 118, 118, 118, 118, 118, - - 1126, 118, 118, 1127, 118, 1128, 1129, 1120, 1130, 1131, - 118, 1132, 118, 1134, 1136, 1079, 1124, 1125, 118, 1137, - 1114, 1133, 118, 118, 1138, 118, 118, 118, 1135, 1139, - 1141, 118, 118, 1140, 1142, 118, 118, 118, 118, 118, - 1159, 118, 1147, 1148, 118, 118, 118, 1144, 1146, 1163, - 1143, 118, 1145, 1158, 226, 118, 118, 118, 1149, 1119, - 1119, 1216, 1119, 1119, 1161, 118, 1162, 118, 1164, 1302, - 118, 118, 118, 1171, 1165, 118, 1166, 118, 1167, 118, - 118, 1168, 118, 1169, 118, 1181, 1120, 1170, 1150, 118, - 118, 1193, 1172, 1173, 118, 1174, 118, 1175, 118, 1176, - - 118, 1177, 118, 118, 118, 1178, 118, 1194, 1194, 118, - 1194, 1194, 118, 118, 1197, 118, 118, 1179, 1180, 1198, - 1182, 118, 118, 118, 1201, 1202, 1203, 118, 1206, 1196, - 1199, 118, 118, 1200, 1195, 1204, 118, 118, 118, 118, - 118, 1209, 1210, 1211, 118, 1205, 118, 1212, 1214, 118, - 118, 1217, 1228, 118, 1207, 1208, 1215, 1194, 1194, 118, - 1194, 1194, 118, 1229, 1213, 118, 118, 118, 1231, 118, - 118, 1230, 118, 1300, 1232, 1299, 118, 118, 118, 118, - 118, 118, 118, 118, 1195, 1233, 118, 1234, 1235, 118, - 1236, 1237, 1238, 1239, 118, 1245, 118, 1257, 1240, 1241, - - 1242, 1243, 118, 118, 1244, 1246, 1247, 118, 118, 1298, - 1258, 118, 118, 118, 118, 118, 118, 118, 1260, 118, - 118, 118, 1268, 1261, 1259, 118, 1262, 1263, 1264, 1265, - 1270, 1266, 1267, 118, 1269, 118, 118, 1282, 1283, 1279, - 118, 118, 1280, 118, 118, 118, 1296, 118, 118, 1316, - 118, 118, 1306, 1281, 1307, 118, 1292, 1305, 1294, 1293, - 118, 118, 118, 1323, 1295, 1315, 118, 118, 1327, 118, - 118, 1331, 1328, 118, 118, 1322, 1297, 1334, 1317, 118, - 118, 118, 1324, 1291, 1290, 118, 1289, 1288, 1287, 1286, - 1285, 1332, 1284, 118, 1335, 118, 1337, 118, 1336, 68, - - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 78, 78, 78, 78, 78, 78, 118, 78, - 78, 78, 78, 78, 78, 84, 84, 118, 84, 84, - 118, 118, 118, 118, 84, 84, 84, 105, 105, 1278, - 105, 105, 105, 116, 1277, 116, 116, 116, 191, 191, - 1276, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 197, 1275, 1274, 1273, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 203, 203, 203, - 203, 203, 211, 1272, 211, 211, 211, 213, 213, 1271, - - 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, - 214, 118, 214, 214, 214, 216, 216, 118, 216, 216, - 216, 220, 118, 220, 221, 118, 221, 221, 221, 304, - 304, 118, 304, 304, 304, 304, 304, 304, 304, 304, - 304, 304, 312, 118, 1256, 1255, 312, 312, 312, 312, - 312, 312, 312, 312, 312, 324, 1254, 324, 324, 324, - 327, 1253, 327, 327, 327, 330, 1251, 330, 330, 330, - 332, 1250, 332, 332, 332, 334, 1249, 334, 334, 334, - 335, 1248, 335, 335, 335, 424, 424, 118, 424, 424, - 424, 424, 424, 424, 424, 424, 424, 424, 434, 434, - - 434, 436, 118, 118, 1226, 436, 436, 436, 436, 436, - 436, 436, 436, 436, 438, 438, 438, 84, 1225, 1224, - 1223, 1222, 84, 84, 84, 449, 1221, 449, 449, 449, - 451, 1220, 451, 451, 451, 452, 1219, 452, 452, 452, - 453, 1218, 453, 453, 453, 456, 118, 456, 456, 456, - 457, 118, 457, 457, 457, 458, 982, 458, 458, 458, - 116, 1192, 116, 116, 116, 463, 463, 463, 424, 424, - 1191, 424, 424, 424, 424, 424, 424, 424, 424, 424, - 424, 304, 304, 1190, 304, 304, 304, 304, 304, 304, - 304, 304, 304, 304, 559, 1189, 559, 559, 559, 436, - - 1188, 1187, 1186, 436, 436, 436, 436, 436, 436, 436, - 436, 436, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 561, 561, 561, 561, 562, 1185, 562, 562, 562, - 563, 563, 563, 563, 563, 563, 563, 563, 563, 563, - 563, 563, 563, 211, 1184, 211, 211, 211, 324, 1183, - 324, 324, 324, 214, 118, 214, 214, 214, 327, 118, - 327, 327, 327, 572, 1160, 572, 572, 572, 577, 1157, - 577, 577, 577, 664, 664, 1156, 664, 664, 664, 664, - 664, 664, 664, 664, 664, 664, 665, 665, 1155, 665, - 665, 665, 665, 665, 665, 665, 665, 665, 665, 559, - - 1154, 559, 559, 559, 668, 668, 668, 668, 668, 668, - 668, 668, 668, 668, 668, 668, 668, 561, 561, 561, - 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - 562, 1153, 562, 562, 562, 563, 563, 563, 563, 563, - 563, 563, 563, 563, 563, 563, 563, 563, 203, 203, - 203, 203, 203, 762, 762, 1152, 762, 762, 762, 762, - 762, 762, 762, 762, 762, 762, 763, 763, 1151, 763, - 763, 763, 763, 763, 763, 763, 763, 763, 763, 925, - 925, 118, 925, 925, 925, 925, 925, 925, 925, 925, - 925, 925, 976, 976, 118, 976, 976, 976, 976, 976, - - 976, 976, 976, 976, 976, 720, 720, 720, 720, 720, - 720, 720, 720, 720, 720, 118, 1123, 720, 730, 730, - 730, 730, 730, 730, 730, 730, 730, 730, 118, 1121, - 730, 803, 803, 803, 803, 803, 803, 803, 803, 803, - 803, 118, 1117, 803, 809, 809, 809, 809, 809, 809, - 809, 809, 809, 809, 1116, 1115, 809, 818, 818, 818, - 818, 818, 818, 818, 818, 818, 818, 1110, 1109, 818, - 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, - 118, 118, 940, 1227, 1227, 118, 1227, 1227, 1227, 1227, - 1227, 1227, 1227, 1227, 1227, 1227, 1252, 1252, 118, 1252, - - 1252, 1252, 1252, 1252, 1252, 1252, 1252, 1252, 1252, 1301, - 1301, 118, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, - 1301, 1301, 1308, 1308, 118, 1308, 1308, 1308, 1308, 1308, - 1308, 1308, 1308, 1308, 1308, 1313, 1313, 118, 1313, 1313, - 1313, 1313, 1313, 1313, 1313, 1313, 1313, 1313, 1314, 1314, - 1082, 1314, 1314, 1314, 1314, 1314, 1314, 1314, 1314, 1314, - 1314, 1319, 1319, 1077, 1319, 1319, 1319, 1319, 1319, 1319, - 1319, 1319, 1319, 1319, 1320, 1320, 1076, 1320, 1320, 1320, - 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1330, 1330, 118, - 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, - - 1333, 1333, 1071, 1333, 1333, 1333, 1333, 1333, 1333, 1333, - 1333, 1333, 1333, 1070, 1069, 1068, 1067, 118, 118, 118, - 1042, 1041, 1040, 1039, 118, 1037, 1036, 1035, 1034, 1032, - 1028, 1027, 1026, 1025, 1024, 118, 999, 998, 997, 996, - 995, 994, 990, 988, 118, 118, 118, 118, 982, 981, - 980, 979, 978, 977, 729, 118, 953, 952, 951, 950, - 949, 948, 944, 942, 118, 118, 118, 929, 928, 927, - 926, 924, 923, 922, 118, 118, 118, 118, 897, 896, - 895, 894, 893, 892, 118, 118, 888, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 874, 872, 118, - - 118, 204, 863, 862, 861, 860, 859, 858, 857, 856, - 118, 855, 118, 118, 118, 827, 826, 825, 824, 823, - 822, 118, 807, 118, 801, 118, 118, 118, 118, 789, - 118, 118, 768, 767, 766, 765, 764, 761, 760, 759, - 118, 733, 118, 726, 725, 724, 723, 118, 118, 118, - 118, 118, 118, 118, 700, 699, 118, 118, 667, 666, - 663, 662, 661, 660, 659, 658, 654, 118, 118, 118, - 627, 118, 118, 118, 118, 118, 118, 118, 558, 557, - 556, 555, 554, 551, 550, 118, 521, 518, 118, 118, - 118, 118, 433, 432, 431, 430, 423, 118, 383, 118, - - 118, 357, 341, 340, 316, 204, 314, 198, 310, 192, - 194, 302, 192, 275, 130, 198, 79, 118, 224, 223, - 210, 209, 204, 194, 192, 132, 118, 113, 88, 79, - 67, 1338, 3, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338 - } ; - -static yyconst flex_int16_t yy_chk[4125] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 2, 5, 2, 2, 11, 5, 2, 9, - - 9, 9, 226, 9, 10, 9, 10, 10, 226, 2, - 9, 9, 17, 16, 13, 13, 11, 13, 13, 25, - 25, 22, 2, 13, 22, 17, 17, 13, 16, 18, - 29, 23, 28, 18, 29, 18, 18, 18, 18, 18, - 18, 18, 18, 30, 19, 26, 13, 31, 13, 19, - 23, 23, 23, 36, 33, 36, 47, 9, 69, 26, - 19, 28, 32, 30, 33, 34, 32, 52, 13, 59, - 46, 47, 52, 29, 20, 13, 20, 20, 20, 20, - 20, 20, 20, 20, 46, 29, 34, 35, 35, 46, - 35, 35, 21, 20, 21, 21, 21, 21, 21, 21, - - 21, 21, 31, 39, 41, 32, 40, 44, 228, 39, - 69, 21, 20, 41, 48, 58, 39, 32, 40, 41, - 40, 44, 39, 20, 43, 42, 42, 40, 59, 43, - 58, 44, 39, 42, 45, 48, 228, 42, 50, 43, - 42, 21, 20, 51, 35, 57, 45, 70, 57, 43, - 49, 49, 45, 78, 50, 49, 50, 50, 53, 55, - 56, 51, 79, 55, 51, 49, 53, 53, 54, 56, - 66, 49, 71, 54, 66, 56, 54, 53, 53, 55, - 56, 60, 60, 87, 60, 60, 54, 64, 60, 144, - 144, 86, 64, 54, 68, 68, 68, 70, 68, 60, - - 68, 78, 55, 64, 86, 68, 68, 72, 72, 72, - 79, 72, 60, 72, 55, 85, 83, 87, 72, 72, - 85, 118, 80, 80, 71, 80, 80, 117, 55, 119, - 120, 80, 124, 55, 126, 80, 83, 1337, 96, 96, - 96, 96, 96, 96, 96, 96, 118, 119, 117, 145, - 145, 127, 68, 126, 80, 96, 80, 100, 100, 100, - 100, 100, 100, 100, 100, 72, 124, 127, 122, 123, - 134, 169, 136, 139, 100, 134, 80, 139, 169, 123, - 136, 140, 120, 80, 101, 96, 101, 101, 101, 101, - 101, 101, 101, 101, 123, 128, 128, 169, 128, 128, - - 102, 140, 102, 101, 100, 102, 102, 102, 102, 102, - 102, 102, 102, 104, 181, 104, 104, 104, 104, 104, - 104, 104, 104, 122, 174, 181, 141, 143, 135, 106, - 133, 106, 104, 101, 106, 106, 106, 106, 106, 106, - 106, 106, 133, 135, 137, 138, 141, 143, 142, 174, - 133, 146, 128, 148, 138, 147, 150, 149, 147, 153, - 151, 147, 104, 142, 146, 146, 152, 147, 153, 137, - 137, 149, 137, 137, 148, 137, 151, 150, 137, 154, - 151, 152, 155, 156, 157, 158, 159, 160, 137, 137, - 162, 154, 160, 161, 164, 162, 1335, 156, 158, 154, - - 168, 165, 155, 170, 157, 161, 166, 160, 166, 159, - 165, 167, 170, 172, 164, 168, 165, 173, 167, 176, - 167, 171, 171, 177, 175, 171, 172, 178, 179, 180, - 183, 192, 177, 192, 193, 173, 178, 182, 180, 171, - 175, 180, 177, 194, 194, 182, 179, 196, 183, 186, - 186, 205, 186, 186, 202, 206, 186, 225, 233, 232, - 207, 648, 176, 193, 205, 227, 193, 186, 232, 231, - 234, 206, 648, 233, 176, 200, 200, 200, 207, 200, - 186, 200, 225, 227, 234, 235, 200, 200, 192, 218, - 218, 218, 218, 218, 218, 218, 218, 208, 231, 196, - - 199, 248, 202, 235, 199, 202, 199, 199, 199, 199, - 199, 199, 199, 248, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 200, 208, 236, 200, 208, 219, 219, - 219, 219, 219, 219, 219, 219, 237, 239, 240, 240, - 208, 208, 239, 236, 249, 243, 242, 249, 199, 199, - 199, 199, 212, 243, 212, 241, 237, 212, 212, 212, - 212, 212, 212, 212, 212, 215, 242, 215, 321, 241, - 215, 215, 215, 215, 215, 215, 215, 215, 217, 199, - 217, 250, 251, 217, 217, 217, 217, 217, 217, 217, - - 217, 220, 220, 220, 220, 220, 220, 220, 220, 250, - 1325, 251, 253, 321, 220, 220, 220, 220, 220, 220, - 222, 222, 222, 222, 222, 222, 222, 222, 238, 244, - 254, 253, 238, 255, 255, 246, 244, 247, 247, 252, - 238, 257, 254, 257, 220, 220, 220, 220, 220, 220, - 246, 256, 247, 258, 258, 252, 256, 259, 261, 260, - 262, 262, 263, 261, 264, 266, 271, 263, 267, 269, - 259, 260, 273, 264, 269, 267, 268, 268, 274, 275, - 276, 277, 278, 266, 273, 279, 280, 281, 282, 284, - 271, 283, 285, 286, 284, 280, 274, 279, 276, 287, - - 303, 281, 278, 277, 275, 283, 282, 288, 289, 275, - 290, 293, 292, 286, 294, 290, 288, 292, 285, 296, - 295, 298, 298, 294, 289, 290, 293, 297, 288, 300, - 300, 297, 302, 287, 295, 299, 311, 317, 299, 296, - 299, 305, 299, 320, 316, 319, 317, 299, 316, 318, - 319, 322, 299, 299, 299, 299, 299, 303, 338, 305, - 352, 302, 343, 299, 302, 318, 337, 336, 364, 343, - 323, 325, 325, 325, 325, 325, 325, 325, 325, 352, - 337, 320, 299, 336, 344, 345, 338, 364, 311, 320, - 345, 311, 312, 339, 403, 348, 312, 344, 312, 312, - - 312, 312, 312, 312, 312, 322, 312, 312, 312, 312, - 312, 312, 323, 339, 346, 348, 380, 403, 380, 346, - 312, 312, 312, 312, 312, 326, 326, 326, 326, 326, - 326, 326, 326, 328, 328, 328, 328, 328, 328, 328, - 328, 329, 329, 329, 329, 329, 329, 329, 329, 342, - 312, 312, 312, 312, 331, 331, 331, 331, 331, 331, - 331, 331, 347, 342, 349, 351, 354, 347, 351, 349, - 354, 355, 378, 382, 385, 385, 382, 378, 388, 388, - 355, 312, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 315, 315, 315, 315, 315, 315, 315, - 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - - 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - 315, 315, 315, 315, 333, 333, 333, 333, 333, 333, - 333, 333, 350, 341, 356, 353, 341, 333, 333, 333, - 333, 333, 333, 341, 359, 360, 366, 459, 356, 357, - 350, 362, 365, 367, 341, 353, 368, 459, 359, 362, - - 363, 341, 363, 360, 365, 369, 366, 333, 333, 333, - 333, 333, 333, 367, 357, 370, 371, 368, 374, 357, - 375, 373, 383, 376, 377, 369, 381, 370, 384, 371, - 373, 386, 1324, 390, 387, 391, 374, 376, 377, 387, - 375, 363, 390, 392, 384, 381, 389, 383, 386, 393, - 397, 389, 383, 396, 391, 394, 394, 399, 396, 397, - 394, 400, 401, 392, 400, 402, 402, 405, 404, 393, - 406, 399, 404, 407, 401, 408, 411, 406, 410, 412, - 407, 405, 404, 413, 415, 414, 417, 416, 413, 414, - 418, 411, 416, 419, 420, 421, 408, 423, 410, 415, - - 422, 425, 419, 412, 418, 428, 440, 416, 441, 420, - 428, 417, 464, 466, 441, 421, 1321, 464, 422, 425, - 472, 472, 423, 474, 440, 466, 474, 423, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 436, - 442, 443, 444, 436, 446, 436, 436, 436, 436, 436, - 436, 436, 445, 436, 436, 436, 436, 436, 436, 447, - 442, 475, 461, 690, 475, 690, 460, 436, 436, 436, - 436, 436, 448, 448, 448, 448, 448, 448, 448, 448, - 443, 460, 446, 450, 450, 450, 450, 450, 450, 450, - 450, 461, 462, 465, 444, 467, 468, 436, 436, 436, - 436, 470, 447, 469, 471, 445, 477, 473, 476, 637, - 468, 479, 469, 478, 479, 637, 467, 462, 465, 470, - - 476, 481, 481, 483, 471, 473, 477, 483, 436, 437, - 437, 437, 437, 437, 437, 437, 437, 437, 437, 437, - 437, 437, 437, 437, 437, 437, 437, 437, 437, 478, - 480, 482, 487, 491, 492, 486, 590, 437, 437, 437, - 437, 437, 490, 495, 1318, 493, 492, 490, 482, 480, - 493, 494, 495, 502, 496, 590, 494, 496, 491, 497, - 499, 500, 501, 501, 499, 502, 500, 437, 437, 437, - 437, 486, 487, 497, 503, 504, 505, 506, 509, 509, - 504, 511, 512, 514, 511, 512, 520, 517, 514, 520, - 503, 517, 525, 505, 524, 524, 525, 506, 437, 439, - - 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, - 439, 439, 439, 439, 439, 439, 439, 439, 439, 507, - 510, 513, 516, 518, 523, 1312, 522, 439, 439, 439, - 439, 439, 521, 522, 516, 528, 528, 521, 521, 507, - 510, 513, 521, 536, 523, 527, 533, 530, 518, 534, - 527, 532, 532, 535, 538, 533, 537, 439, 439, 439, - 439, 530, 539, 536, 534, 541, 537, 540, 518, 535, - 542, 540, 543, 548, 538, 564, 569, 543, 548, 542, - 544, 541, 539, 545, 547, 567, 568, 545, 439, 454, - 454, 454, 454, 454, 454, 454, 454, 566, 544, 564, - - 573, 547, 454, 454, 454, 454, 454, 454, 565, 571, - 566, 584, 573, 565, 574, 578, 588, 581, 582, 582, - 584, 570, 567, 568, 583, 578, 574, 583, 588, 1309, - 569, 581, 454, 454, 454, 454, 454, 454, 560, 560, - 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, - 560, 560, 560, 560, 560, 560, 560, 560, 570, 575, - 576, 579, 571, 580, 585, 587, 560, 560, 560, 560, - 560, 586, 589, 589, 587, 586, 591, 592, 600, 591, - 593, 593, 595, 601, 579, 585, 575, 576, 594, 602, - 603, 594, 580, 607, 613, 613, 560, 560, 560, 560, - - 611, 595, 607, 600, 612, 602, 600, 601, 606, 612, - 603, 606, 618, 611, 619, 592, 672, 621, 621, 619, - 621, 621, 742, 650, 742, 618, 650, 560, 561, 561, - 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - 561, 561, 561, 561, 561, 561, 561, 561, 614, 616, - 617, 620, 623, 624, 627, 635, 561, 561, 561, 561, - 561, 622, 672, 632, 614, 617, 622, 616, 638, 645, - 623, 620, 624, 632, 632, 635, 643, 639, 621, 627, - 640, 638, 639, 641, 642, 649, 561, 561, 561, 561, - 649, 643, 640, 646, 645, 641, 642, 652, 644, 627, - - 644, 670, 646, 749, 644, 749, 653, 644, 670, 652, - 673, 687, 1302, 654, 687, 644, 651, 561, 563, 563, - 563, 563, 563, 563, 563, 563, 563, 563, 563, 563, - 563, 563, 563, 563, 563, 563, 563, 563, 654, 651, - 653, 647, 669, 674, 676, 673, 563, 563, 563, 563, - 563, 647, 675, 647, 677, 678, 679, 647, 654, 677, - 647, 680, 682, 681, 669, 678, 685, 1300, 647, 683, - 692, 680, 688, 693, 696, 679, 563, 563, 563, 563, - 674, 676, 692, 683, 702, 685, 696, 675, 681, 693, - 688, 682, 694, 694, 697, 697, 701, 701, 703, 709, - - 702, 715, 709, 703, 741, 741, 715, 563, 626, 626, - 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, - 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, - 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, - 626, 706, 710, 718, 671, 671, 712, 671, 671, 699, - 700, 747, 716, 716, 717, 716, 716, 671, 723, 718, - 732, 706, 710, 747, 712, 732, 626, 626, 626, 626, - 626, 671, 717, 735, 699, 700, 714, 714, 735, 714, - 714, 736, 738, 723, 723, 736, 723, 738, 739, 748, - 748, 671, 756, 739, 699, 700, 756, 626, 626, 633, - - 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, - 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, - 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, - 633, 633, 716, 740, 743, 744, 733, 714, 812, 745, - 744, 751, 812, 746, 750, 752, 751, 776, 769, 719, - 719, 740, 719, 719, 743, 745, 754, 633, 633, 633, - 633, 733, 746, 753, 750, 752, 753, 755, 791, 770, - 753, 754, 779, 733, 792, 753, 719, 769, 753, 792, - 791, 775, 776, 755, 770, 777, 779, 753, 633, 633, - 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, - - 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, - 719, 771, 771, 784, 771, 771, 781, 789, 668, 668, - 668, 668, 668, 778, 771, 774, 774, 775, 774, 774, - 781, 777, 788, 793, 790, 794, 801, 798, 774, 799, - 784, 795, 789, 834, 815, 793, 788, 794, 668, 668, - 668, 668, 774, 795, 789, 790, 798, 799, 778, 820, - 805, 801, 815, 834, 801, 805, 811, 811, 903, 811, - 811, 821, 821, 833, 833, 841, 841, 903, 820, 668, - 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, - 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, - - 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, - 707, 707, 707, 829, 836, 837, 1299, 807, 816, 816, - 835, 816, 816, 835, 836, 839, 838, 840, 829, 838, - 839, 842, 840, 837, 842, 844, 846, 843, 707, 707, - 707, 707, 807, 847, 848, 816, 811, 843, 845, 849, - 849, 845, 850, 844, 846, 847, 852, 850, 848, 906, - 852, 873, 807, 906, 868, 1298, 873, 1294, 869, 707, - 707, 713, 713, 713, 713, 713, 713, 713, 713, 713, - 713, 713, 713, 713, 713, 713, 713, 713, 713, 713, - 713, 713, 713, 713, 713, 713, 713, 713, 713, 713, - - 713, 713, 713, 713, 851, 853, 854, 855, 864, 864, - 868, 864, 864, 855, 869, 866, 866, 855, 866, 866, - 853, 864, 872, 874, 876, 851, 877, 955, 866, 713, - 713, 713, 713, 854, 878, 864, 872, 878, 881, 876, - 879, 880, 883, 883, 955, 899, 877, 872, 874, 870, - 871, 889, 879, 880, 898, 864, 889, 898, 881, 899, - 713, 713, 722, 722, 722, 722, 722, 722, 722, 722, - 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, - 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, - 722, 722, 722, 722, 722, 870, 871, 865, 865, 890, - - 865, 865, 900, 907, 902, 1292, 910, 900, 891, 902, - 865, 904, 901, 1022, 908, 910, 907, 911, 890, 914, - 722, 722, 722, 722, 865, 887, 887, 891, 887, 887, - 901, 904, 908, 909, 912, 913, 918, 911, 909, 914, - 1022, 918, 915, 912, 865, 915, 930, 931, 954, 954, - 913, 722, 722, 885, 885, 885, 885, 885, 885, 885, - 885, 885, 885, 885, 885, 885, 885, 885, 885, 885, - 885, 885, 885, 885, 885, 885, 885, 885, 885, 885, - 885, 885, 885, 885, 885, 885, 887, 916, 917, 919, - 920, 932, 930, 931, 934, 945, 935, 939, 932, 935, - - 934, 936, 917, 946, 947, 920, 936, 919, 946, 916, - 957, 885, 885, 885, 885, 945, 939, 943, 943, 956, - 943, 943, 959, 956, 947, 957, 958, 965, 962, 958, - 960, 963, 964, 966, 972, 964, 959, 967, 968, 968, - 970, 965, 885, 885, 962, 960, 963, 969, 966, 969, - 971, 967, 969, 969, 972, 973, 974, 975, 970, 971, - 983, 984, 985, 985, 987, 984, 973, 992, 1000, 1001, - 1001, 1002, 975, 1004, 1006, 984, 974, 1007, 1009, 1005, - 1000, 1002, 1011, 1010, 987, 992, 1005, 1013, 969, 983, - 1010, 1014, 1006, 1004, 1007, 1012, 1015, 943, 1009, 1016, - - 1011, 1018, 1012, 1019, 1020, 1021, 1020, 1013, 1023, 1020, - 1020, 1031, 1038, 1030, 1029, 1032, 1018, 1036, 1036, 1291, - 1036, 1036, 1019, 1031, 1037, 1021, 1023, 1014, 1029, 1045, - 1044, 1046, 1038, 1044, 1047, 1060, 1015, 1016, 1030, 1061, - 1032, 1049, 1049, 1050, 1036, 1020, 1051, 1054, 1046, 1037, - 1054, 1047, 1037, 1059, 1045, 1048, 1048, 1048, 1062, 1048, - 1050, 1065, 1059, 1051, 1052, 1052, 1052, 1064, 1052, 1066, - 1073, 1060, 1075, 1066, 1069, 1069, 1065, 1290, 1048, 1061, - 1076, 1076, 1073, 1076, 1076, 1064, 1054, 1052, 1078, 1078, - 1069, 1078, 1078, 1080, 1080, 1048, 1062, 1075, 1083, 1085, - - 1085, 1084, 1086, 1086, 1052, 1087, 1088, 1076, 1089, 1090, - 1091, 1091, 1093, 1093, 1095, 1078, 1083, 1084, 1092, 1096, - 1069, 1092, 1087, 1088, 1097, 1089, 1090, 1094, 1094, 1098, - 1100, 1095, 1099, 1099, 1101, 1102, 1096, 1107, 1106, 1108, - 1118, 1097, 1109, 1109, 1125, 1122, 1098, 1106, 1108, 1125, - 1102, 1124, 1107, 1117, 1117, 1133, 1118, 1181, 1109, 1119, - 1119, 1181, 1119, 1119, 1122, 1126, 1124, 1145, 1126, 1289, - 1100, 1127, 1101, 1133, 1127, 1128, 1128, 1129, 1129, 1117, - 1130, 1130, 1131, 1131, 1132, 1145, 1119, 1132, 1109, 1134, - 1135, 1158, 1134, 1135, 1136, 1136, 1137, 1137, 1138, 1138, - - 1139, 1139, 1140, 1143, 1144, 1140, 1146, 1160, 1160, 1161, - 1160, 1160, 1164, 1171, 1163, 1165, 1158, 1143, 1144, 1163, - 1146, 1166, 1167, 1168, 1166, 1167, 1168, 1170, 1171, 1161, - 1164, 1163, 1169, 1165, 1160, 1169, 1172, 1173, 1174, 1175, - 1176, 1174, 1175, 1176, 1177, 1170, 1178, 1177, 1179, 1180, - 1182, 1182, 1193, 1199, 1172, 1173, 1180, 1194, 1194, 1200, - 1194, 1194, 1197, 1197, 1178, 1179, 1198, 1201, 1199, 1202, - 1203, 1198, 1204, 1287, 1200, 1286, 1205, 1207, 1208, 1193, - 1209, 1210, 1211, 1212, 1194, 1201, 1217, 1202, 1203, 1213, - 1204, 1205, 1207, 1208, 1214, 1214, 1216, 1228, 1209, 1210, - - 1211, 1212, 1230, 1233, 1213, 1216, 1217, 1229, 1234, 1285, - 1229, 1235, 1236, 1240, 1241, 1228, 1242, 1243, 1233, 1245, - 1246, 1258, 1245, 1234, 1230, 1247, 1235, 1236, 1240, 1241, - 1247, 1242, 1243, 1259, 1246, 1268, 1269, 1269, 1270, 1258, - 1280, 1279, 1259, 1281, 1282, 1283, 1283, 1295, 1293, 1306, - 1305, 1296, 1295, 1268, 1296, 1270, 1279, 1293, 1281, 1280, - 1307, 1315, 1316, 1316, 1282, 1305, 1306, 1317, 1322, 1323, - 1327, 1327, 1323, 1328, 1331, 1315, 1284, 1331, 1307, 1332, - 1334, 1336, 1317, 1278, 1277, 1322, 1276, 1275, 1274, 1273, - 1272, 1328, 1271, 1267, 1332, 1266, 1336, 1265, 1334, 1339, - - 1339, 1339, 1339, 1339, 1339, 1339, 1339, 1339, 1339, 1339, - 1339, 1339, 1340, 1340, 1340, 1340, 1340, 1340, 1264, 1340, - 1340, 1340, 1340, 1340, 1340, 1341, 1341, 1263, 1341, 1341, - 1262, 1261, 1260, 1257, 1341, 1341, 1341, 1342, 1342, 1256, - 1342, 1342, 1342, 1343, 1255, 1343, 1343, 1343, 1344, 1344, - 1254, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, - 1345, 1345, 1345, 1345, 1346, 1253, 1251, 1250, 1346, 1346, - 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1347, 1347, 1347, - 1347, 1347, 1348, 1249, 1348, 1348, 1348, 1349, 1349, 1248, - - 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, - 1350, 1244, 1350, 1350, 1350, 1351, 1351, 1239, 1351, 1351, - 1351, 1352, 1238, 1352, 1353, 1237, 1353, 1353, 1353, 1354, - 1354, 1232, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, - 1354, 1354, 1355, 1231, 1226, 1225, 1355, 1355, 1355, 1355, - 1355, 1355, 1355, 1355, 1355, 1356, 1224, 1356, 1356, 1356, - 1357, 1223, 1357, 1357, 1357, 1358, 1221, 1358, 1358, 1358, - 1359, 1220, 1359, 1359, 1359, 1360, 1219, 1360, 1360, 1360, - 1361, 1218, 1361, 1361, 1361, 1362, 1362, 1215, 1362, 1362, - 1362, 1362, 1362, 1362, 1362, 1362, 1362, 1362, 1363, 1363, - - 1363, 1364, 1206, 1196, 1191, 1364, 1364, 1364, 1364, 1364, - 1364, 1364, 1364, 1364, 1365, 1365, 1365, 1366, 1190, 1189, - 1188, 1187, 1366, 1366, 1366, 1367, 1186, 1367, 1367, 1367, - 1368, 1185, 1368, 1368, 1368, 1369, 1184, 1369, 1369, 1369, - 1370, 1183, 1370, 1370, 1370, 1371, 1162, 1371, 1371, 1371, - 1372, 1159, 1372, 1372, 1372, 1373, 1157, 1373, 1373, 1373, - 1374, 1156, 1374, 1374, 1374, 1375, 1375, 1375, 1376, 1376, - 1155, 1376, 1376, 1376, 1376, 1376, 1376, 1376, 1376, 1376, - 1376, 1377, 1377, 1154, 1377, 1377, 1377, 1377, 1377, 1377, - 1377, 1377, 1377, 1377, 1378, 1153, 1378, 1378, 1378, 1379, - - 1152, 1151, 1150, 1379, 1379, 1379, 1379, 1379, 1379, 1379, - 1379, 1379, 1380, 1380, 1380, 1380, 1380, 1380, 1380, 1380, - 1380, 1380, 1380, 1380, 1380, 1381, 1149, 1381, 1381, 1381, - 1382, 1382, 1382, 1382, 1382, 1382, 1382, 1382, 1382, 1382, - 1382, 1382, 1382, 1383, 1148, 1383, 1383, 1383, 1384, 1147, - 1384, 1384, 1384, 1385, 1142, 1385, 1385, 1385, 1386, 1141, - 1386, 1386, 1386, 1387, 1121, 1387, 1387, 1387, 1388, 1116, - 1388, 1388, 1388, 1389, 1389, 1115, 1389, 1389, 1389, 1389, - 1389, 1389, 1389, 1389, 1389, 1389, 1390, 1390, 1114, 1390, - 1390, 1390, 1390, 1390, 1390, 1390, 1390, 1390, 1390, 1391, - - 1113, 1391, 1391, 1391, 1392, 1392, 1392, 1392, 1392, 1392, - 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1393, 1393, 1393, - 1393, 1393, 1393, 1393, 1393, 1393, 1393, 1393, 1393, 1393, - 1394, 1112, 1394, 1394, 1394, 1395, 1395, 1395, 1395, 1395, - 1395, 1395, 1395, 1395, 1395, 1395, 1395, 1395, 1396, 1396, - 1396, 1396, 1396, 1397, 1397, 1111, 1397, 1397, 1397, 1397, - 1397, 1397, 1397, 1397, 1397, 1397, 1398, 1398, 1110, 1398, - 1398, 1398, 1398, 1398, 1398, 1398, 1398, 1398, 1398, 1399, - 1399, 1105, 1399, 1399, 1399, 1399, 1399, 1399, 1399, 1399, - 1399, 1399, 1400, 1400, 1104, 1400, 1400, 1400, 1400, 1400, - - 1400, 1400, 1400, 1400, 1400, 1401, 1401, 1401, 1401, 1401, - 1401, 1401, 1401, 1401, 1401, 1103, 1082, 1401, 1402, 1402, - 1402, 1402, 1402, 1402, 1402, 1402, 1402, 1402, 1081, 1077, - 1402, 1403, 1403, 1403, 1403, 1403, 1403, 1403, 1403, 1403, - 1403, 1074, 1072, 1403, 1404, 1404, 1404, 1404, 1404, 1404, - 1404, 1404, 1404, 1404, 1071, 1070, 1404, 1405, 1405, 1405, - 1405, 1405, 1405, 1405, 1405, 1405, 1405, 1068, 1067, 1405, - 1406, 1406, 1406, 1406, 1406, 1406, 1406, 1406, 1406, 1406, - 1063, 1058, 1406, 1407, 1407, 1057, 1407, 1407, 1407, 1407, - 1407, 1407, 1407, 1407, 1407, 1407, 1408, 1408, 1056, 1408, - - 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1409, - 1409, 1055, 1409, 1409, 1409, 1409, 1409, 1409, 1409, 1409, - 1409, 1409, 1410, 1410, 1053, 1410, 1410, 1410, 1410, 1410, - 1410, 1410, 1410, 1410, 1410, 1411, 1411, 1043, 1411, 1411, - 1411, 1411, 1411, 1411, 1411, 1411, 1411, 1411, 1412, 1412, - 1040, 1412, 1412, 1412, 1412, 1412, 1412, 1412, 1412, 1412, - 1412, 1413, 1413, 1035, 1413, 1413, 1413, 1413, 1413, 1413, - 1413, 1413, 1413, 1413, 1414, 1414, 1034, 1414, 1414, 1414, - 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1415, 1415, 1033, - 1415, 1415, 1415, 1415, 1415, 1415, 1415, 1415, 1415, 1415, - - 1416, 1416, 1028, 1416, 1416, 1416, 1416, 1416, 1416, 1416, - 1416, 1416, 1416, 1027, 1026, 1025, 1024, 1017, 1008, 1003, - 998, 996, 995, 994, 993, 991, 990, 989, 988, 986, - 981, 980, 979, 978, 977, 961, 953, 952, 951, 950, - 949, 948, 944, 942, 941, 938, 937, 933, 929, 928, - 927, 926, 924, 923, 921, 905, 897, 896, 895, 894, - 893, 892, 888, 886, 884, 882, 875, 863, 862, 861, - 860, 858, 857, 856, 832, 831, 830, 828, 827, 826, - 825, 824, 823, 822, 819, 814, 813, 810, 808, 806, - 804, 802, 800, 797, 796, 787, 786, 785, 783, 782, - - 780, 773, 768, 767, 766, 765, 764, 761, 760, 759, - 758, 757, 737, 734, 731, 729, 728, 727, 726, 725, - 724, 721, 711, 708, 705, 704, 698, 695, 691, 689, - 686, 684, 667, 666, 663, 662, 661, 658, 657, 656, - 655, 636, 634, 631, 630, 629, 628, 625, 615, 610, - 609, 608, 605, 604, 599, 598, 597, 596, 558, 557, - 554, 553, 552, 551, 550, 549, 546, 531, 529, 526, - 519, 515, 508, 498, 489, 488, 485, 484, 433, 432, - 431, 430, 429, 427, 426, 409, 398, 395, 379, 372, - 361, 358, 309, 308, 307, 306, 301, 291, 272, 270, - - 265, 245, 230, 229, 204, 203, 201, 197, 195, 191, - 190, 189, 188, 163, 131, 125, 121, 116, 115, 111, - 95, 93, 84, 65, 63, 38, 27, 24, 15, 12, - 8, 3, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1338, 1338, 1338, 1338 - } ; - -/* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[200] = - { 0, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - }; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "vtkParse.l" -#line 3 "vtkParse.l" - -/* - -This file must be translated to C and modified to build everywhere. - -Run flex like this: - - flex --nodefault -olex.yy.c vtkParse.l - -Modify lex.yy.c: - - convert tabs to spaces (8 spaces per tab) - - remove extra space from end of lines - - remove blank lines from end of file - - replace "int yyl" with "yy_size_t yyl" - - compile with gcc and "-Wsign-compare", there should be no warnings - -*/ - -/* We do not care of interactive mode */ -#define YY_NEVER_INTERACTIVE 1 - -/* Do not include unistd.h in generated source. */ -#define YY_NO_UNISTD_H - -/* Skip declaring this function. It is a macro. */ -#define YY_SKIP_YYWRAP - -#ifdef _WIN32 -#pragma warning ( disable : 4018 ) -#pragma warning ( disable : 4127 ) -#pragma warning ( disable : 4131 ) -#pragma warning ( disable : 4244 ) -#pragma warning ( disable : 4251 ) -#pragma warning ( disable : 4267 ) -#pragma warning ( disable : 4305 ) -#pragma warning ( disable : 4309 ) -#pragma warning ( disable : 4706 ) -#pragma warning ( disable : 4786 ) -#endif - -#define SKIP_MATCH_MAXLEN 15 - -/* - * Skip ahead until one of the strings is found, - * then skip to the end of the line. - * Return 0 if no match found. - */ -static int skip_comment(); -static int skip_trailing_comment(const char *text, size_t l); -static int skip_ahead_multi(const char *strings[]); -static int skip_ahead_until(const char *text); -static int skip_to_next_directive(); -static int skip_conditional_block(); - -static const char *raw_string(const char *begin); - -static void preprocessor_directive(const char *text, size_t l); -static void print_preprocessor_error(int result, const char *cp, size_t n); -static const char *get_macro_arguments(); - -static void push_buffer(); -static int pop_buffer(); - -static void push_include(const char *filename); -static void pop_include(); - -static void push_macro(MacroInfo *macro); -static void pop_macro(); -static int in_macro(); - -#line 1922 "lex.yy.c" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy (void ); - -int yyget_debug (void ); - -void yyset_debug (int debug_flag ); - -YY_EXTRA_TYPE yyget_extra (void ); - -void yyset_extra (YY_EXTRA_TYPE user_defined ); - -FILE *yyget_in (void ); - -void yyset_in (FILE * in_str ); - -FILE *yyget_out (void ); - -void yyset_out (FILE * out_str ); - -yy_size_t yyget_leng (void ); - -char *yyget_text (void ); - -int yyget_lineno (void ); - -void yyset_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap (void ); -#else -extern int yywrap (void ); -#endif -#endif - - static void yyunput (int c,char *buf_ptr ); - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - -#line 79 "vtkParse.l" - - -#line 2110 "lex.yy.c" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); - yy_current_state += YY_AT_BOL(); -yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 1339 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 4033 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) - { - yy_size_t yyl; - for ( yyl = 0; yyl < yyleng; ++yyl ) - if ( yytext[yyl] == '\n' ) - - yylineno++; -; - } - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 81 "vtkParse.l" -{ skip_comment(); } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 83 "vtkParse.l" -{ - if (!IgnoreBTX) { - skip_ahead_until("//ETX"); - } - } - YY_BREAK -case 3: -YY_RULE_SETUP -#line 89 "vtkParse.l" -/* eat mismatched ETX */ - YY_BREAK -case 4: -YY_RULE_SETUP -#line 91 "vtkParse.l" -{ - skip_ahead_until("@end"); - } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 95 "vtkParse.l" -{ - size_t pos = 1; - while (yytext[pos-1] != 'M' || yytext[pos] != 'E') - { - pos++; - } - data->NameComment = vtkstrndup(&yytext[pos + 1], yyleng - pos - 1); - } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 104 "vtkParse.l" -{ setCommentState(1); } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 105 "vtkParse.l" -{ setCommentState(2); } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 106 "vtkParse.l" -{ setCommentState(3); } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 107 "vtkParse.l" -{ setCommentState(3); } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 108 "vtkParse.l" -{ setCommentState(4); } - YY_BREAK -case 11: -/* rule 11 can match eol */ -YY_RULE_SETUP -#line 109 "vtkParse.l" -{ closeOrClearComment(); } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 110 "vtkParse.l" -{ - size_t pos = 2; - while (yytext[pos-2] != '/' || yytext[pos-1] != '/') pos++; - addCommentLine(&yytext[pos], yyleng - pos); - } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 116 "vtkParse.l" -/* eat C++ comments */ - YY_BREAK -case 14: -/* rule 14 can match eol */ -YY_RULE_SETUP -#line 118 "vtkParse.l" -{ - skip_trailing_comment(yytext, yyleng); - preprocessor_directive(yytext, yyleng); - } - YY_BREAK -case 15: -/* rule 15 can match eol */ -YY_RULE_SETUP -#line 123 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(STRING_LITERAL); - } - YY_BREAK -case 16: -/* rule 16 can match eol */ -YY_RULE_SETUP -#line 128 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(CHAR_LITERAL); - } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 133 "vtkParse.l" -{ - yylval.str = raw_string(yytext); - return(STRING_LITERAL); - } - YY_BREAK -case 18: -YY_RULE_SETUP -#line 138 "vtkParse.l" -/* ignore EXPORT macros */ - YY_BREAK -case 19: -YY_RULE_SETUP -#line 140 "vtkParse.l" -{ /* let the wrappers see the parameter */ - const char *args = NULL; - const char *cp; - size_t l = 0; - args = get_macro_arguments(); - if (args) - { - cp = args; - if (*cp == '(') { cp++; } - while (*cp == ' ' || *cp == '\t') { cp++; } - l = vtkParse_SkipId(cp); - if (l) - { - yylval.str = vtkstrndup(cp, l); - free((char *)args); - return(ID); - } - free((char *)args); - } - } - YY_BREAK -case 20: -YY_RULE_SETUP -#line 161 "vtkParse.l" -return(AUTO); - YY_BREAK -case 21: -YY_RULE_SETUP -#line 163 "vtkParse.l" -return(DOUBLE); - YY_BREAK -case 22: -YY_RULE_SETUP -#line 164 "vtkParse.l" -return(FLOAT); - YY_BREAK -case 23: -YY_RULE_SETUP -#line 165 "vtkParse.l" -return(INT64__); - YY_BREAK -case 24: -YY_RULE_SETUP -#line 166 "vtkParse.l" -return(SHORT); - YY_BREAK -case 25: -YY_RULE_SETUP -#line 167 "vtkParse.l" -return(LONG); - YY_BREAK -case 26: -YY_RULE_SETUP -#line 168 "vtkParse.l" -return(CHAR); - YY_BREAK -case 27: -YY_RULE_SETUP -#line 169 "vtkParse.l" -return(INT); - YY_BREAK -case 28: -YY_RULE_SETUP -#line 171 "vtkParse.l" -return(UNSIGNED); - YY_BREAK -case 29: -YY_RULE_SETUP -#line 172 "vtkParse.l" -return(SIGNED); - YY_BREAK -case 30: -YY_RULE_SETUP -#line 174 "vtkParse.l" -return(VOID); - YY_BREAK -case 31: -YY_RULE_SETUP -#line 175 "vtkParse.l" -return(BOOL); - YY_BREAK -case 32: -YY_RULE_SETUP -#line 177 "vtkParse.l" -return(CHAR16_T); - YY_BREAK -case 33: -YY_RULE_SETUP -#line 178 "vtkParse.l" -return(CHAR32_T); - YY_BREAK -case 34: -YY_RULE_SETUP -#line 179 "vtkParse.l" -return(WCHAR_T); - YY_BREAK -case 35: -/* rule 35 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 181 "vtkParse.l" -{ - yylval.str = (yytext[3] == ':' ? "std::size_t" : "size_t"); - return(SIZE_T); - } - YY_BREAK -case 36: -/* rule 36 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 186 "vtkParse.l" -{ - yylval.str = (yytext[3] == ':' ? "std::ssize_t" : "ssize_t"); - return(SSIZE_T); - } - YY_BREAK -case 37: -/* rule 37 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 191 "vtkParse.l" -{ - yylval.str = (yytext[3] == ':' ? "std::nullptr_t" : "nullptr_t"); - return(NULLPTR_T); - } - YY_BREAK -case 38: -YY_RULE_SETUP -#line 196 "vtkParse.l" -/* ignore the Q_OBJECT macro from Qt */ - YY_BREAK -case 39: -/* rule 39 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 197 "vtkParse.l" -return(PUBLIC); - YY_BREAK -case 40: -/* rule 40 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 198 "vtkParse.l" -return(PRIVATE); - YY_BREAK -case 41: -/* rule 41 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 199 "vtkParse.l" -return(PROTECTED); - YY_BREAK -case 42: -/* rule 42 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 200 "vtkParse.l" -return(PROTECTED); - YY_BREAK -case 43: -YY_RULE_SETUP -#line 202 "vtkParse.l" -return(CLASS); - YY_BREAK -case 44: -YY_RULE_SETUP -#line 203 "vtkParse.l" -return(STRUCT); - YY_BREAK -case 45: -YY_RULE_SETUP -#line 204 "vtkParse.l" -return(PUBLIC); - YY_BREAK -case 46: -YY_RULE_SETUP -#line 205 "vtkParse.l" -return(PRIVATE); - YY_BREAK -case 47: -YY_RULE_SETUP -#line 206 "vtkParse.l" -return(PROTECTED); - YY_BREAK -case 48: -YY_RULE_SETUP -#line 207 "vtkParse.l" -return(ENUM); - YY_BREAK -case 49: -YY_RULE_SETUP -#line 208 "vtkParse.l" -return(UNION); - YY_BREAK -case 50: -YY_RULE_SETUP -#line 209 "vtkParse.l" -return(VIRTUAL); - YY_BREAK -case 51: -YY_RULE_SETUP -#line 210 "vtkParse.l" -return(CONST); - YY_BREAK -case 52: -YY_RULE_SETUP -#line 211 "vtkParse.l" -return(VOLATILE); - YY_BREAK -case 53: -YY_RULE_SETUP -#line 212 "vtkParse.l" -return(MUTABLE); - YY_BREAK -case 54: -YY_RULE_SETUP -#line 213 "vtkParse.l" -return(OPERATOR); - YY_BREAK -case 55: -YY_RULE_SETUP -#line 214 "vtkParse.l" -return(FRIEND); - YY_BREAK -case 56: -YY_RULE_SETUP -#line 215 "vtkParse.l" -return(INLINE); - YY_BREAK -case 57: -YY_RULE_SETUP -#line 216 "vtkParse.l" -return(CONSTEXPR); - YY_BREAK -case 58: -YY_RULE_SETUP -#line 217 "vtkParse.l" -return(STATIC); - YY_BREAK -case 59: -YY_RULE_SETUP -#line 218 "vtkParse.l" -return(THREAD_LOCAL); - YY_BREAK -case 60: -YY_RULE_SETUP -#line 219 "vtkParse.l" -return(EXTERN); - YY_BREAK -case 61: -YY_RULE_SETUP -#line 220 "vtkParse.l" -return(TEMPLATE); - YY_BREAK -case 62: -YY_RULE_SETUP -#line 221 "vtkParse.l" -return(TYPENAME); - YY_BREAK -case 63: -YY_RULE_SETUP -#line 222 "vtkParse.l" -return(TYPEDEF); - YY_BREAK -case 64: -YY_RULE_SETUP -#line 223 "vtkParse.l" -return(NAMESPACE); - YY_BREAK -case 65: -YY_RULE_SETUP -#line 224 "vtkParse.l" -return(USING); - YY_BREAK -case 66: -YY_RULE_SETUP -#line 225 "vtkParse.l" -return(NEW); - YY_BREAK -case 67: -YY_RULE_SETUP -#line 226 "vtkParse.l" -return(DELETE); - YY_BREAK -case 68: -YY_RULE_SETUP -#line 227 "vtkParse.l" -return(EXPLICIT); - YY_BREAK -case 69: -YY_RULE_SETUP -#line 228 "vtkParse.l" -return(THROW); - YY_BREAK -case 70: -YY_RULE_SETUP -#line 229 "vtkParse.l" -return(TRY); - YY_BREAK -case 71: -YY_RULE_SETUP -#line 230 "vtkParse.l" -return(CATCH); - YY_BREAK -case 72: -YY_RULE_SETUP -#line 231 "vtkParse.l" -return(NOEXCEPT); - YY_BREAK -case 73: -YY_RULE_SETUP -#line 232 "vtkParse.l" -return(DECLTYPE); - YY_BREAK -case 74: -YY_RULE_SETUP -#line 233 "vtkParse.l" -return(DEFAULT); - YY_BREAK -case 75: -YY_RULE_SETUP -#line 235 "vtkParse.l" -return(STATIC_CAST); - YY_BREAK -case 76: -YY_RULE_SETUP -#line 236 "vtkParse.l" -return(DYNAMIC_CAST); - YY_BREAK -case 77: -YY_RULE_SETUP -#line 237 "vtkParse.l" -return(CONST_CAST); - YY_BREAK -case 78: -YY_RULE_SETUP -#line 238 "vtkParse.l" -return(REINTERPRET_CAST); - YY_BREAK -case 79: -YY_RULE_SETUP -#line 240 "vtkParse.l" -/* irrelevant to wrappers */ - YY_BREAK -case 80: -YY_RULE_SETUP -#line 242 "vtkParse.l" -return(OP_LOGIC_AND); - YY_BREAK -case 81: -YY_RULE_SETUP -#line 243 "vtkParse.l" -return(OP_AND_EQ); - YY_BREAK -case 82: -YY_RULE_SETUP -#line 244 "vtkParse.l" -return(OP_LOGIC_OR); - YY_BREAK -case 83: -YY_RULE_SETUP -#line 245 "vtkParse.l" -return(OP_OR_EQ); - YY_BREAK -case 84: -YY_RULE_SETUP -#line 246 "vtkParse.l" -return('!'); - YY_BREAK -case 85: -YY_RULE_SETUP -#line 247 "vtkParse.l" -return(OP_LOGIC_NEQ); - YY_BREAK -case 86: -YY_RULE_SETUP -#line 248 "vtkParse.l" -return('^'); - YY_BREAK -case 87: -YY_RULE_SETUP -#line 249 "vtkParse.l" -return(OP_XOR_EQ); - YY_BREAK -case 88: -YY_RULE_SETUP -#line 250 "vtkParse.l" -return('&'); - YY_BREAK -case 89: -YY_RULE_SETUP -#line 251 "vtkParse.l" -return('|'); - YY_BREAK -case 90: -YY_RULE_SETUP -#line 252 "vtkParse.l" -return('~'); - YY_BREAK -case 91: -YY_RULE_SETUP -#line 254 "vtkParse.l" -return(IdType); - YY_BREAK -case 92: -YY_RULE_SETUP -#line 255 "vtkParse.l" -return(SetMacro); - YY_BREAK -case 93: -YY_RULE_SETUP -#line 256 "vtkParse.l" -return(GetMacro); - YY_BREAK -case 94: -YY_RULE_SETUP -#line 257 "vtkParse.l" -return(SetStringMacro); - YY_BREAK -case 95: -YY_RULE_SETUP -#line 258 "vtkParse.l" -return(GetStringMacro); - YY_BREAK -case 96: -YY_RULE_SETUP -#line 259 "vtkParse.l" -return(SetClampMacro); - YY_BREAK -case 97: -YY_RULE_SETUP -#line 260 "vtkParse.l" -return(SetObjectMacro); - YY_BREAK -case 98: -YY_RULE_SETUP -#line 261 "vtkParse.l" -return(GetObjectMacro); - YY_BREAK -case 99: -YY_RULE_SETUP -#line 262 "vtkParse.l" -return(BooleanMacro); - YY_BREAK -case 100: -YY_RULE_SETUP -#line 263 "vtkParse.l" -return(SetVector2Macro); - YY_BREAK -case 101: -YY_RULE_SETUP -#line 264 "vtkParse.l" -return(SetVector3Macro); - YY_BREAK -case 102: -YY_RULE_SETUP -#line 265 "vtkParse.l" -return(SetVector4Macro); - YY_BREAK -case 103: -YY_RULE_SETUP -#line 266 "vtkParse.l" -return(SetVector6Macro); - YY_BREAK -case 104: -YY_RULE_SETUP -#line 267 "vtkParse.l" -return(GetVector2Macro); - YY_BREAK -case 105: -YY_RULE_SETUP -#line 268 "vtkParse.l" -return(GetVector3Macro); - YY_BREAK -case 106: -YY_RULE_SETUP -#line 269 "vtkParse.l" -return(GetVector4Macro); - YY_BREAK -case 107: -YY_RULE_SETUP -#line 270 "vtkParse.l" -return(GetVector6Macro); - YY_BREAK -case 108: -YY_RULE_SETUP -#line 271 "vtkParse.l" -return(SetVectorMacro); - YY_BREAK -case 109: -YY_RULE_SETUP -#line 272 "vtkParse.l" -return(GetVectorMacro); - YY_BREAK -case 110: -YY_RULE_SETUP -#line 273 "vtkParse.l" -return(ViewportCoordinateMacro); - YY_BREAK -case 111: -YY_RULE_SETUP -#line 274 "vtkParse.l" -return(WorldCoordinateMacro); - YY_BREAK -case 112: -YY_RULE_SETUP -#line 275 "vtkParse.l" -return(TypeMacro); - YY_BREAK -case 113: -YY_RULE_SETUP -#line 276 "vtkParse.l" -return(TypeMacro); - YY_BREAK -case 114: -YY_RULE_SETUP -#line 277 "vtkParse.l" -return(TypeMacro); - YY_BREAK -case 115: -YY_RULE_SETUP -#line 278 "vtkParse.l" -return(TypeMacro); - YY_BREAK -case 116: -YY_RULE_SETUP -#line 279 "vtkParse.l" -; - YY_BREAK -case 117: -YY_RULE_SETUP -#line 280 "vtkParse.l" -return(VTK_BYTE_SWAP_DECL); - YY_BREAK -case 118: -YY_RULE_SETUP -#line 281 "vtkParse.l" -return(TypeInt8); - YY_BREAK -case 119: -YY_RULE_SETUP -#line 282 "vtkParse.l" -return(TypeUInt8); - YY_BREAK -case 120: -YY_RULE_SETUP -#line 283 "vtkParse.l" -return(TypeInt16); - YY_BREAK -case 121: -YY_RULE_SETUP -#line 284 "vtkParse.l" -return(TypeUInt16); - YY_BREAK -case 122: -YY_RULE_SETUP -#line 285 "vtkParse.l" -return(TypeInt32); - YY_BREAK -case 123: -YY_RULE_SETUP -#line 286 "vtkParse.l" -return(TypeUInt32); - YY_BREAK -case 124: -YY_RULE_SETUP -#line 287 "vtkParse.l" -return(TypeInt64); - YY_BREAK -case 125: -YY_RULE_SETUP -#line 288 "vtkParse.l" -return(TypeUInt64); - YY_BREAK -case 126: -YY_RULE_SETUP -#line 289 "vtkParse.l" -return(TypeFloat32); - YY_BREAK -case 127: -YY_RULE_SETUP -#line 290 "vtkParse.l" -return(TypeFloat64); - YY_BREAK -case 128: -/* rule 128 can match eol */ -YY_RULE_SETUP -#line 292 "vtkParse.l" -{ - size_t i = 1; - size_t j; - while (yytext[i]==' ' || yytext[i]=='\t' || - yytext[i]=='\r' || yytext[i]=='\n') { i++; } - j = i; - while (yytext[j]!='&') { j++; } - yylval.str = vtkstrndup(&yytext[i], j-i); - return(LA); - } - YY_BREAK -case 129: -/* rule 129 can match eol */ -YY_RULE_SETUP -#line 303 "vtkParse.l" -{ - size_t i = 1; - size_t j; - while (yytext[i]==' ' || yytext[i]=='\t' || - yytext[i]=='\r' || yytext[i]=='\n') { i++; } - j = i; - while (yytext[j]!='*') { j++; } - yylval.str = vtkstrndup(&yytext[i], j-i); - return(LP); - } - YY_BREAK -case 130: -/* rule 130 can match eol */ -YY_RULE_SETUP -#line 314 "vtkParse.l" -{ - yylval.str = ""; - return(LP); - } - YY_BREAK -case 131: -/* rule 131 can match eol */ -YY_RULE_SETUP -#line 319 "vtkParse.l" -{ - yylval.str = ""; - return(LP); - } - YY_BREAK -case 132: -/* rule 132 can match eol */ -YY_RULE_SETUP -#line 324 "vtkParse.l" -{ - yylval.str = ""; - return(LP); - } - YY_BREAK -case 133: -YY_RULE_SETUP -#line 329 "vtkParse.l" -return('*'); - YY_BREAK -case 134: -YY_RULE_SETUP -#line 331 "vtkParse.l" -/* misc unused win32 macros */ - YY_BREAK -case 135: -/* rule 135 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 333 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(OSTREAM); - } - YY_BREAK -case 136: -/* rule 136 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 338 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(ISTREAM); - } - YY_BREAK -case 137: -/* rule 137 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 343 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(StdString); - } - YY_BREAK -case 138: -YY_RULE_SETUP -#line 348 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(StdString); - } - YY_BREAK -case 139: -YY_RULE_SETUP -#line 353 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(UnicodeString); - } - YY_BREAK -case 140: -YY_RULE_SETUP -#line 358 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(QT_ID); - } - YY_BREAK -case 141: -YY_RULE_SETUP -#line 363 "vtkParse.l" -get_macro_arguments(); /* C++11 */ - YY_BREAK -case 142: -YY_RULE_SETUP -#line 365 "vtkParse.l" -get_macro_arguments(); /* C++11 */ - YY_BREAK -case 143: -YY_RULE_SETUP -#line 367 "vtkParse.l" -get_macro_arguments(); /* C11 */ - YY_BREAK -case 144: -YY_RULE_SETUP -#line 369 "vtkParse.l" -get_macro_arguments(); /* C11 */ - YY_BREAK -case 145: -YY_RULE_SETUP -#line 371 "vtkParse.l" -return(THREAD_LOCAL); /* C11 */ - YY_BREAK -case 146: -YY_RULE_SETUP -#line 373 "vtkParse.l" -/* C11 */ - YY_BREAK -case 147: -YY_RULE_SETUP -#line 375 "vtkParse.l" -/* C11 */ - YY_BREAK -case 148: -YY_RULE_SETUP -#line 377 "vtkParse.l" -get_macro_arguments(); /* gcc attributes */ - YY_BREAK -case 149: -YY_RULE_SETUP -#line 379 "vtkParse.l" -get_macro_arguments(); /* Windows linkage */ - YY_BREAK -case 150: -YY_RULE_SETUP -#line 381 "vtkParse.l" -/* Windows */ - YY_BREAK -case 151: -YY_RULE_SETUP -#line 383 "vtkParse.l" -{ - const char *args = get_macro_arguments(); - if (args && args[0] != '\0' && args[1] != '\0') - { - size_t l = strlen(args); - push_macro(NULL); - push_buffer(); - macroName = "VTK_LEGACY"; - macroUsed = 0; - macroEnded = 0; - yy_switch_to_buffer(yy_scan_bytes(&args[1],l-2)); - } - free((char *)args); - } - YY_BREAK -case 152: -YY_RULE_SETUP -#line 398 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(NULLPTR); - } - YY_BREAK -case 153: -YY_RULE_SETUP -#line 403 "vtkParse.l" -{ - const char *name = vtkstrndup(yytext, yyleng); - MacroInfo *macro = vtkParsePreprocess_GetMacro(preprocessor, name); - int expanded = 0; - if (macro) - { - const char *args = NULL; - const char *emacro = NULL; - - /* make sure that vtkNotUsed is never expanded */ - MacroInfo *ex; - ex = vtkParsePreprocess_GetMacro(preprocessor, "vtkNotUsed"); - if (ex) - { - ex->IsExcluded = 1; - } - - if (macro->IsFunction) - { - args = get_macro_arguments(); - if (args) - { - emacro = vtkParsePreprocess_ExpandMacro(preprocessor, macro, args); - if (!emacro) - { - print_preprocessor_error(VTK_PARSE_MACRO_NUMARGS, NULL, 0); - exit(1); - } - free((char *)args); - } - } - else if (macro->Definition && macro->Definition[0]) - { - /* first see if macro evaluates to a constant value */ - preproc_int_t val; - int is_unsigned; - int r; - macro->IsExcluded = 1; - r = vtkParsePreprocess_EvaluateExpression( - preprocessor, macro->Definition, &val, &is_unsigned); - macro->IsExcluded = 0; - /* if it isn't a constant expression, then expand it */ - if (r >= VTK_PARSE_MACRO_UNDEFINED) - { - emacro = vtkParsePreprocess_ExpandMacro(preprocessor, macro, NULL); - if (!emacro) - { - print_preprocessor_error(r, NULL, 0); - exit(1); - } - } - } - else - { - /* macros with no definition expand to nothing */ - expanded = 1; - } - if (emacro) - { - /* invoke the parser on any expanded macros */ - push_macro(macro); - push_buffer(); - yy_switch_to_buffer(yy_scan_string(emacro)); - vtkParsePreprocess_FreeMacroExpansion(preprocessor, macro, emacro); - expanded = 1; - } - } - if (!expanded) - { - /* if no macro expansion occurred, return the ID */ - yylval.str = name; - if (yyleng > 3 && name[0] == 'v' && name[1] == 't' && name[2] == 'k') - { - return(VTK_ID); - } - else if (name[0] == 'Q') - { - return(QT_ID); - } - else - { - return(ID); - } - } - } - YY_BREAK -case 154: -YY_RULE_SETUP -#line 489 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(FLOAT_LITERAL); - } - YY_BREAK -case 155: -YY_RULE_SETUP -#line 494 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(FLOAT_LITERAL); - } - YY_BREAK -case 156: -YY_RULE_SETUP -#line 499 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(FLOAT_LITERAL); - } - YY_BREAK -case 157: -YY_RULE_SETUP -#line 504 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(HEX_LITERAL); - } - YY_BREAK -case 158: -YY_RULE_SETUP -#line 509 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(OCT_LITERAL); - } - YY_BREAK -case 159: -YY_RULE_SETUP -#line 514 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(INT_LITERAL); - } - YY_BREAK -case 160: -YY_RULE_SETUP -#line 519 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(ZERO); - } - YY_BREAK -case 161: -/* rule 161 can match eol */ -YY_RULE_SETUP -#line 524 "vtkParse.l" -/* escaped newlines */ - YY_BREAK -case 162: -YY_RULE_SETUP -#line 525 "vtkParse.l" -/* whitespace */ - YY_BREAK -case 163: -/* rule 163 can match eol */ -YY_RULE_SETUP -#line 526 "vtkParse.l" -/* whitespace */ - YY_BREAK -case 164: -/* rule 164 can match eol */ -YY_RULE_SETUP -#line 528 "vtkParse.l" -return(BEGIN_ATTRIB); - YY_BREAK -case 165: -YY_RULE_SETUP -#line 530 "vtkParse.l" -return('{'); - YY_BREAK -case 166: -YY_RULE_SETUP -#line 531 "vtkParse.l" -return('}'); - YY_BREAK -case 167: -YY_RULE_SETUP -#line 532 "vtkParse.l" -return('['); - YY_BREAK -case 168: -YY_RULE_SETUP -#line 533 "vtkParse.l" -return(']'); - YY_BREAK -case 169: -YY_RULE_SETUP -#line 534 "vtkParse.l" -return('#'); - YY_BREAK -case 170: -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp = yy_bp + 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 536 "vtkParse.l" -return(OP_RSHIFT_A); - YY_BREAK -case 171: -YY_RULE_SETUP -#line 538 "vtkParse.l" -return(OP_LSHIFT_EQ); - YY_BREAK -case 172: -YY_RULE_SETUP -#line 539 "vtkParse.l" -return(OP_RSHIFT_EQ); - YY_BREAK -case 173: -YY_RULE_SETUP -#line 540 "vtkParse.l" -return(OP_LSHIFT); - YY_BREAK -case 174: -YY_RULE_SETUP -#line 541 "vtkParse.l" -return(OP_DOT_POINTER); - YY_BREAK -case 175: -YY_RULE_SETUP -#line 542 "vtkParse.l" -return(OP_ARROW_POINTER); - YY_BREAK -case 176: -YY_RULE_SETUP -#line 543 "vtkParse.l" -return(OP_ARROW); - YY_BREAK -case 177: -YY_RULE_SETUP -#line 544 "vtkParse.l" -return(OP_INCR); - YY_BREAK -case 178: -YY_RULE_SETUP -#line 545 "vtkParse.l" -return(OP_DECR); - YY_BREAK -case 179: -YY_RULE_SETUP -#line 546 "vtkParse.l" -return(OP_PLUS_EQ); - YY_BREAK -case 180: -YY_RULE_SETUP -#line 547 "vtkParse.l" -return(OP_MINUS_EQ); - YY_BREAK -case 181: -YY_RULE_SETUP -#line 548 "vtkParse.l" -return(OP_TIMES_EQ); - YY_BREAK -case 182: -YY_RULE_SETUP -#line 549 "vtkParse.l" -return(OP_DIVIDE_EQ); - YY_BREAK -case 183: -YY_RULE_SETUP -#line 550 "vtkParse.l" -return(OP_REMAINDER_EQ); - YY_BREAK -case 184: -YY_RULE_SETUP -#line 551 "vtkParse.l" -return(OP_AND_EQ); - YY_BREAK -case 185: -YY_RULE_SETUP -#line 552 "vtkParse.l" -return(OP_OR_EQ); - YY_BREAK -case 186: -YY_RULE_SETUP -#line 553 "vtkParse.l" -return(OP_XOR_EQ); - YY_BREAK -case 187: -YY_RULE_SETUP -#line 554 "vtkParse.l" -return(OP_LOGIC_AND); - YY_BREAK -case 188: -YY_RULE_SETUP -#line 555 "vtkParse.l" -return(OP_LOGIC_OR); - YY_BREAK -case 189: -YY_RULE_SETUP -#line 556 "vtkParse.l" -return(OP_LOGIC_EQ); - YY_BREAK -case 190: -YY_RULE_SETUP -#line 557 "vtkParse.l" -return(OP_LOGIC_NEQ); - YY_BREAK -case 191: -YY_RULE_SETUP -#line 558 "vtkParse.l" -return(OP_LOGIC_LEQ); - YY_BREAK -case 192: -YY_RULE_SETUP -#line 559 "vtkParse.l" -return(OP_LOGIC_GEQ); - YY_BREAK -case 193: -YY_RULE_SETUP -#line 560 "vtkParse.l" -return(ELLIPSIS); - YY_BREAK -case 194: -YY_RULE_SETUP -#line 561 "vtkParse.l" -return(DOUBLE_COLON); - YY_BREAK -case 195: -YY_RULE_SETUP -#line 563 "vtkParse.l" -return('['); - YY_BREAK -case 196: -YY_RULE_SETUP -#line 564 "vtkParse.l" -return(']'); - YY_BREAK -case 197: -YY_RULE_SETUP -#line 566 "vtkParse.l" -return(yytext[0]); - YY_BREAK -case YY_STATE_EOF(INITIAL): -#line 568 "vtkParse.l" -{ if (!pop_buffer()) { yyterminate(); } } - YY_BREAK -case 198: -YY_RULE_SETUP -#line 570 "vtkParse.l" -{ return(OTHER); } - YY_BREAK -case 199: -YY_RULE_SETUP -#line 572 "vtkParse.l" -YY_FATAL_ERROR( "flex scanner jammed" ); - YY_BREAK -#line 3481 "lex.yy.c" - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - yy_size_t num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - yy_size_t new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - yy_state_type yy_current_state; - char *yy_cp; - - yy_current_state = (yy_start); - yy_current_state += YY_AT_BOL(); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 1339 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - int yy_is_jam; - char *yy_cp = (yy_c_buf_p); - - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 1339 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 1338); - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, char * yy_bp ) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - yy_size_t number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - if ( c == '\n' ){ - --yylineno; - } - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); - if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol ) - - yylineno++; -; - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - yy_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) -{ - - return yy_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - yy_size_t i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno (void) -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -yy_size_t yyget_leng (void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text (void) -{ - return yytext; -} - -/** Set the current line number. - * @param line_number - * - */ -void yyset_lineno (int line_number ) -{ - - yylineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * in_str ) -{ - yyin = in_str ; -} - -void yyset_out (FILE * out_str ) -{ - yyout = out_str ; -} - -int yyget_debug (void) -{ - return yy_flex_debug; -} - -void yyset_debug (int bdebug ) -{ - yy_flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - /* We do not touch yylineno unless the option is enabled. */ - yylineno = 1; - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE *) 0; - yyout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 572 "vtkParse.l" - - - -/* - * Return a parenthetical macro arg list as a new string. - */ -const char *get_macro_arguments() -{ - char *cp = NULL; - size_t i = 0; - int depth; - int ws = 0; - int sl = 0; - int c1 = input(); - - if (c1 == '\0') - { - if (pop_buffer() == 0) - { - return NULL; - } - } - - while (c1 == ' ' || c1 == '\t' || c1 == '\r' || c1 == '\n') - { - c1 = input(); - } - - cp = (char *)malloc(4); - - if (c1 != '(') - { - unput(c1); - return NULL; - } - - cp[i++] = '('; - depth = 1; - c1 = input(); - - for (;;) - { - ws = 0; - sl = 0; - /* skip all whitespace */ - while (c1 == ' ' || c1 == '\t' || c1 == '\r' || c1 == '\n') - { - ws = 1; - c1 = input(); - } - if (c1 == '/') - { - c1 = input(); - if (c1 == '*') - { - /* skip a C style comment */ - ws = 1; - if (skip_comment() == 0) - { - return NULL; - } - c1 = input(); - } - else if (c1 == '/') - { - /* skip a C++ style comment */ - ws = 1; - do { c1 = input(); } - while (c1 != '\n' && c1 != '\0'); - if (c1 == '\0') - { - return NULL; - } - c1 = input(); - } - else - { - sl = 1; - } - } - if (ws) - { - /* add a single space to replace any whitespace */ - cp[i++] = ' '; - if (i >= 4 && (i & (i-1)) == 0) - { - cp = (char *)realloc(cp, 2*i); - } - } - if (sl) - { - /* add a single space to replace any whitespace */ - cp[i++] = '/'; - if (i >= 4 && (i & (i-1)) == 0) - { - cp = (char *)realloc(cp, 2*i); - } - } - if (c1 == '\"' || c1 == '\'') - { - int c2 = c1; - int escaped = 2; - int firstloop = 1; - do - { - if (escaped) - { - --escaped; - } - if (!firstloop) - { - c1 = input(); - } - firstloop = 0; - if (c1 == '\0') - { - break; - } - if (escaped == 0 && c1 == '\\') - { - escaped = 2; - } - cp[i++] = (char)c1; - if (i >= 4 && (i & (i-1)) == 0) - { - cp = (char *)realloc(cp, 2*i); - } - } - while (c1 != c2 || escaped); - } - else if (c1 != '\0') - { - cp[i++] = (char)c1; - if (i >= 4 && (i & (i-1)) == 0) - { - cp = (char *)realloc(cp, 2*i); - } - cp[i] = '\0'; - if (c1 == '(') - { - depth++; - } - if (c1 == ')') - { - if (--depth == 0) - { - break; - } - } - } - else - { - return NULL; - } - c1 = input(); - } - - return cp; -} - -/* - * Skip a C-style comment, return 0 if unterminated. - */ -int skip_comment() -{ - int savelineno = yylineno; - int c1 = 0, c2 = input(); - for (;;) - { - if (c2 == 0 || c2 == EOF) - { - yylineno = savelineno; - print_preprocessor_error(VTK_PARSE_SYNTAX_ERROR, - "Cannot find end of comment.", 27); - exit(1); - } - if (c1 == '*' && c2 == '/') break; - c1 = c2; c2 = input(); - } - return 1; -} - -/* - * If token contains a comment, make sure whole comment is skipped. - */ -int skip_trailing_comment(const char *text, size_t l) -{ - const char *cp = text; - const char *ep = text + l; - int incomment = 0; - - while (cp < ep) - { - while (cp < ep && *cp != '/' && *cp != '\"') { cp++; }; - if (cp >= ep) - { - break; - } - else if (cp[0] == '/' && cp[1] == '*') - { - incomment = 1; - cp += 2; - while (cp < ep && *cp != '*') { cp++; }; - if (cp[0] == '*' && cp[1] == '/') - { - incomment = 0; - cp += 2; - } - else - { - cp++; - } - } - else if (cp[0] == '\"') - { - cp++; - while (cp < ep) - { - while (cp < ep && *cp != '\\' && *cp != '\"') { cp++; }; - if (cp >= ep) - { - break; - } - else if (*cp == '\"') - { - cp++; - break; - } - else /* if (*cp == '\\') */ - { - cp += 2; - } - } - } - else - { - cp++; - } - } - - if (incomment) - { - return skip_comment(); - } - - return 1; -} - -/* - * Skip ahead until the next preprocessor directive. - * This will eat the '#' that starts the directive. - * Return 0 if none found. - */ -int skip_to_next_directive() -{ - /* state == 0 at the start of a line */ - int state = 0; - int c; - - c = input(); - - while (c != 0 && c != EOF) - { - /* whitespace */ - if (c == ' ' || c == '\t') - { - c = input(); - } - /* newline renews the start-of-line state */ - else if (c == '\n') - { - state = 0; - c = input(); - } - /* skip comments */ - else if (c == '/') - { - state = 1; - if ( (c = input()) == '*') - { - if (skip_comment() == 0) - { - return 0; - } - c = input(); - } - } - /* skip escaped characters */ - else if (c == '\\') - { - state = 1; - if ( (c = input()) == '\r') - { - if ( (c = input()) == '\n') - { - c = input(); - } - } - else if (c != 0 && c != EOF) - { - c = input(); - } - } - /* any other chars except '#' at start of line */ - else if (c != '#' || state != 0) - { - state = 1; - c = input(); - } - else - { - break; - } - } - - return c; -} - -/* - * Skip to the next #else or #elif or #endif - */ -int skip_conditional_block() -{ - static char *linebuf = NULL; - static size_t linemaxlen = 80; - size_t i; - int c; - int result; - - if (linebuf == 0) - { - linebuf = (char *)malloc(linemaxlen); - } - - for (;;) - { - if (skip_to_next_directive() == 0) - { - return 0; - } - c = input(); - while (c == ' ' || c == '\t') - { - c = input(); - } - if (c == 0 || c == EOF) - { - return 0; - } - - /* eat the whole line */ - i = 0; - linebuf[i++] = '#'; - while (c != 0 && c != EOF && c != '\n') - { - if (i >= linemaxlen-5) - { - linemaxlen += i+5; - linebuf = (char *)realloc(linebuf, linemaxlen); - } - linebuf[i++] = c; - /* be sure to skip escaped newlines */ - if (c == '\\') - { - c = input(); - linebuf[i++] = c; - if (c == '\r') - { - c = input(); - linebuf[i++] = c; - } - } - c = input(); - } - linebuf[i++] = c; - - result = vtkParsePreprocess_HandleDirective(preprocessor, linebuf); - if (result != VTK_PARSE_SKIP && result != VTK_PARSE_OK) - { - print_preprocessor_error(result, linebuf, i); - } - else if (result != VTK_PARSE_SKIP) - { - break; - } - } - - return 1; -} - -/* - * Skip ahead until one of the strings is found, - * then skip to the end of the line. - */ -int skip_ahead_multi(const char *strings[]) -{ - char textbuf[SKIP_MATCH_MAXLEN+1]; - int c = 0; - size_t i; - - for (i = 0; i < (SKIP_MATCH_MAXLEN+1); i++) - { - textbuf[i] = '\0'; - } - - for (;;) - { - for (i = 0; i < SKIP_MATCH_MAXLEN; i++) - { - textbuf[i] = textbuf[i+1]; - } - - c = input(); - if (c == 0 || c == EOF) - { - print_preprocessor_error(VTK_PARSE_SYNTAX_ERROR, NULL, 0); - return 0; - } - - textbuf[SKIP_MATCH_MAXLEN-1] = c; - - for (i = 0; strings[i]; i++) - { - if (strcmp(&textbuf[SKIP_MATCH_MAXLEN-strlen(strings[i])], - strings[i]) == 0) - { - break; - } - } - if (strings[i]) - { - break; - } - } - - while (c != 0 && c != EOF && c != '\n') - { - c = input(); - } - - return 1; -} - -/* - * Skip ahead until the string is found. - */ -int skip_ahead_until(const char *text) -{ - const char *strings[2]; - strings[0] = text; - strings[1] = NULL; - - return skip_ahead_multi(strings); -} - -/* - * Convert a raw string into a non-raw string. - */ -const char *raw_string(const char *begin) -{ - int savelineno = yylineno; - char *textbuf; - int c = 0; - const char *delim; - const char *cp = begin; - char *dp; - char *result; - size_t i, j, n; - size_t m = 1024; - - result = (char *)malloc(m); - dp = result; - - while (*cp != '\"') - { - *dp++ = *cp++; - } - --dp; - *dp++ = *cp++; - - delim = cp; - - for (n = 0;; n++) - { - if (delim[n] == '(') { break; } - } - - textbuf = (char *)malloc(n+1); - - for (i = 0; i < n+1; i++) - { - c = input(); - textbuf[i] = c; - } - - while (c != EOF) - { - if (textbuf[0] == ')' && (n == 0 || strncmp(&textbuf[1], delim, n) == 0)) - { - break; - } - - j = dp - result; - if (j > m - 8) - { - m += 1024; - result = (char *)realloc(result, m); - dp = result + j; - } - - if ((*textbuf >= ' ' && *textbuf <= '~') || - (*textbuf & 0x80) != 0) - { - *dp++ = *textbuf; - } - else switch (*textbuf) - { - case '\a': *dp++ = '\\'; *dp++ = 'a'; break; - case '\b': *dp++ = '\\'; *dp++ = 'b'; break; - case '\f': *dp++ = '\\'; *dp++ = 'f'; break; - case '\n': *dp++ = '\\'; *dp++ = 'n'; break; - case '\r': *dp++ = '\\'; *dp++ = 'r'; break; - case '\t': *dp++ = '\\'; *dp++ = 't'; break; - case '\v': *dp++ = '\\'; *dp++ = 'v'; break; - case '\\': *dp++ = '\\'; *dp++ = '\\'; break; - case '\'': *dp++ = '\\'; *dp++ = '\''; break; - case '\"': *dp++ = '\\'; *dp++ = '\"'; break; - default: - sprintf(dp, "\\%3.3o", *textbuf); - dp += 4; - break; - } - - for (i = 0; i < n; i++) - { - textbuf[i] = textbuf[i+1]; - } - - c = input(); - textbuf[n] = c; - } - - if (c == EOF || '\"' != input()) - { - yylineno = savelineno; - print_preprocessor_error(VTK_PARSE_SYNTAX_ERROR, - "Unterminated raw string.", 24); - exit(1); - } - - *dp++ = '\"'; - - c = input(); - if (c == '_') - { - do - { - *dp++ = c; - c = input(); - } - while (vtkParse_CharType(c, CPRE_IDGIT)); - } - unput(c); - - *dp = '\0'; - cp = vtkstrdup(result); - free(result); - free(textbuf); - - return cp; -} - -/* - * buffer stack, used for macro expansion and include files - */ -static size_t buffer_stack_size = 0; -static YY_BUFFER_STATE *buffer_stack = NULL; - -/* - * push the current buffer onto the buffer stack. - */ -void push_buffer() -{ - size_t n = buffer_stack_size; - if (buffer_stack == NULL) - { - buffer_stack = (YY_BUFFER_STATE *)malloc(4*sizeof(YY_BUFFER_STATE)); - } - /* grow the stack whenever size reaches a power of two */ - else if (n >= 4 && (n & (n-1)) == 0) - { - buffer_stack = (YY_BUFFER_STATE *)realloc( - buffer_stack, 2*n*sizeof(YY_BUFFER_STATE)); - } - buffer_stack[buffer_stack_size++] = YY_CURRENT_BUFFER; -} - -/* - * pop the buffer stack and restore the previous buffer - */ -int pop_buffer() -{ - if (in_macro()) - { - pop_macro(); - } - else - { - pop_include(); - } - if (buffer_stack_size == 0) - { - return 0; - } - yy_delete_buffer(YY_CURRENT_BUFFER); - yy_switch_to_buffer(buffer_stack[--buffer_stack_size]); - return 1; -} - -/* - * include stack, to tell what include is being evaluated - */ -static size_t include_stack_size = 0; -static FileInfo **include_stack = NULL; -static int *lineno_stack = NULL; - -/* - * push the current include onto the include stack. - */ -void push_include(const char *filename) -{ - FileInfo *file_info = NULL; - int same_file = 0; - size_t n = include_stack_size; - - if (include_stack == NULL) - { - include_stack = (FileInfo **)malloc(4*sizeof(FileInfo *)); - lineno_stack = (int *)malloc(4*sizeof(int)); - } - - /* grow the stack whenever size reaches a power of two */ - else if (n >= 4 && (n & (n-1)) == 0) - { - include_stack = (FileInfo **)realloc( - include_stack, 2*n*sizeof(FileInfo *)); - lineno_stack = (int *)realloc( - lineno_stack, 2*n*sizeof(int)); - } - - lineno_stack[include_stack_size] = yyget_lineno(); - yyset_lineno(0); - include_stack[include_stack_size++] = data; - - /* if the file is including itself */ - if (filename == data->FileName || - (filename != 0 && data->FileName != 0 && - strcmp(filename, data->FileName) == 0)) - { - same_file = 1; - } - - /* make a new fileinfo, but only if we are in the base namespace - * and only if the only items added so far are constants */ - if (!same_file && currentNamespace == data->Contents && - data->Contents->NumberOfItems == data->Contents->NumberOfConstants) - { - file_info = (FileInfo *)malloc(sizeof(FileInfo)); - vtkParse_InitFile(file_info); - file_info->FileName = vtkstrdup(filename); - file_info->Contents = (NamespaceInfo *)malloc(sizeof(NamespaceInfo)); - vtkParse_InitNamespace(file_info->Contents); - vtkParse_AddIncludeToFile(data, file_info); - file_info->Strings = data->Strings; - data = file_info; - currentNamespace = file_info->Contents; - } -} - -/* - * pop the include stack - */ -void pop_include() -{ - if (include_stack_size > 0) - { - --include_stack_size; - fclose(yyin); - yyset_lineno(lineno_stack[include_stack_size]); - if (data != include_stack[include_stack_size]) - { - data = include_stack[include_stack_size]; - currentNamespace = data->Contents; - } - } -} - - -/* - * macro stack, to tell what macro is being evaluated - */ -static size_t macro_stack_size = 0; -static MacroInfo **macro_stack = NULL; - -/* - * push the current macro onto the macro stack. - */ -void push_macro(MacroInfo *macro) -{ - size_t n = macro_stack_size; - if (macro_stack == NULL) - { - macro_stack = (MacroInfo **)malloc(4*sizeof(MacroInfo *)); - } - /* grow the stack whenever size reaches a power of two */ - else if (n >= 4 && (n & (n-1)) == 0) - { - macro_stack = (MacroInfo **)realloc( - macro_stack, 2*n*sizeof(MacroInfo *)); - } - macro_stack[macro_stack_size++] = macro; - if (macro) - { - macro->IsExcluded = 1; - if (macro_stack_size == 1) - { - macroName = macro->Name; - macroUsed = 0; - macroEnded = 0; - } - } -} - -/* - * pop the macro stack - */ -void pop_macro() -{ - MacroInfo *macro; - - if (macro_stack_size > 0) - { - macro = macro_stack[--macro_stack_size]; - if (macro) - { - macro->IsExcluded = 0; - } - } - macroEnded = 1; -} - -/* - * are we currently processing a macro? - */ -int in_macro() -{ - return (macro_stack_size > 0); -} - -/* - * print a preprocessor error code with filename and line number. - */ -void print_preprocessor_error(int result, const char *cp, size_t n) -{ - const char *text = ""; - - switch (result) - { - case VTK_PARSE_OK: - case VTK_PARSE_SKIP: - return; - case VTK_PARSE_PREPROC_DOUBLE: - text = "double in preprocessor conditional"; - break; - case VTK_PARSE_PREPROC_FLOAT: - text = "float in preprocessor conditional"; - break; - case VTK_PARSE_PREPROC_STRING: - text = "string in preprocessor conditional"; - break; - case VTK_PARSE_MACRO_UNDEFINED: - text = "undefined macro"; - break; - case VTK_PARSE_MACRO_REDEFINED: - text = "redefined macro"; - break; - case VTK_PARSE_FILE_NOT_FOUND: - text = "file not found"; - break; - case VTK_PARSE_FILE_OPEN_ERROR: - text = "can\'t open file"; - break; - case VTK_PARSE_FILE_READ_ERROR: - text = "input/output error"; - break; - case VTK_PARSE_MACRO_NUMARGS: - text = "wrong number of macro args"; - break; - case VTK_PARSE_SYNTAX_ERROR: - text = "syntax error"; - break; - } - - /* be silent about missing include files */ - if (result == VTK_PARSE_FILE_NOT_FOUND) - { - return; - } - - print_parser_error(text, cp, n); -} - -/* - * print an error with filename and line number. - */ -void print_parser_error(const char *text, const char *cp, size_t n) -{ - size_t j = 0; - const char *fn = "(none)"; - - if (CommandName) - { - fprintf(yyout, "%s: ", CommandName); - } - - if (data->FileName) - { - fn = data->FileName; - } - fprintf(yyout, "In %s:", fn); - for (j = 0; j < include_stack_size; j++) - { - fprintf(yyout, "%i:\nIn %s:", - lineno_stack[j], include_stack[j]->FileName); - } - fprintf(yyout, "%i:", yylineno); - - if (cp) - { - fprintf(yyout, " %s: %*.*s\n", text, (int)n, (int)n, cp); - } - else if (text) - { - fprintf(yyout, " %s.\n", text); - } - else - { - fprintf(yyout, "\n"); - } -} - -/* - * Execute a preprocessor directive. - */ -void preprocessor_directive(const char *text, size_t l) -{ - int result = 0; - size_t n = 0; - const char *cp = text; - const char *ep = text + l; - const char *directive = NULL; - - /* find the directive, store its length in "n" */ - while (*cp == ' ' || *cp == '\t') { cp++; } - if (*cp == '#') { cp++; } - while ((*cp == ' ' || *cp == '\t') && cp < ep) { cp++; } - directive = cp; - while (*cp >= 'a' && *cp <= 'z' && cp < ep) { cp++; } - n = cp - directive; - while ((*cp == ' ' || *cp == '\t') && cp < ep) { cp++; } - - if (n == 7 && strncmp(directive, "include", n) == 0) - { - /* include files */ - int already_loaded = 0; - if (*cp == '<' || *cp == '\"') - { - /* if asked to recurse into header files */ - if (Recursive && ep - cp > 3) - { - const char *dp; - dp = vtkParsePreprocess_FindIncludeFile(preprocessor, - &cp[1], (*cp != '\"'), &already_loaded); - if (dp) - { - yyin = fopen(dp, "r"); - if (yyin) - { - push_include(dp); - push_buffer(); - yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); - return; - } - } - } - } - } - - /* let the preprocessor handle the directive */ - result = vtkParsePreprocess_HandleDirective(preprocessor, text); - - if (result == VTK_PARSE_SKIP) - { - skip_conditional_block(); - } - else if (result != VTK_PARSE_OK) - { - print_preprocessor_error(result, text, l); - if ((result & VTK_PARSE_FATAL_ERROR) != 0) - { - exit(1); - } - } - else if (n == 6 && strncmp(directive, "define", n) == 0 && - ep - cp > 4 && strncmp(cp, "VTK", 3) == 0) - { - /* macros that start with "VTK" */ - MacroInfo *macro; - - macro = vtkParsePreprocess_GetMacro(preprocessor, cp); - if (macro && macro->Definition && !macro->IsFunction) - { - /* if macro evaluates to a constant, add it as a constant */ - macro->IsExcluded = 1; - if (guess_constant_type(macro->Definition) == 0) - { - result = VTK_PARSE_MACRO_UNDEFINED; - } - macro->IsExcluded = 0; - if (result < VTK_PARSE_MACRO_UNDEFINED) - { - add_constant( - vtkstrdup(macro->Name), vtkstrdup(macro->Definition), 0, NULL, 1); - } - } - } -} diff --git a/src/VTKWrapping/ParaView/vtkParse.tab.c b/src/VTKWrapping/ParaView/vtkParse.tab.c deleted file mode 100644 index 6c3443d1..00000000 --- a/src/VTKWrapping/ParaView/vtkParse.tab.c +++ /dev/null @@ -1,12915 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton implementation for Bison GLR parsers in C - - Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C GLR parser skeleton written by Paul Hilfinger. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.4.1" - -/* Skeleton name. */ -#define YYSKELETON_NAME "glr.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - - - - -/* Copy the first part of user declarations. */ - -/* Line 172 of glr.c */ -#line 15 "vtkParse.y" - - -/* - -This file must be translated to C and modified to build everywhere. - -Run yacc like this: - - yacc -b vtkParse vtkParse.y - -Modify vtkParse.tab.c: - - convert TABs to spaces (eight per tab) - - remove spaces from ends of lines, s/ *$//g - - replace all instances of "static inline" with "static". -*/ - -/* -The purpose of this parser is to read C++ header files in order to -generate data structures that describe the C++ interface of a library, -one header file at a time. As such, it is not a complete C++ parser. -It only parses what is relevant to the interface and skips the rest. - -While the parser reads method definitions, type definitions, and -template definitions it generates a "signature" which is a string -that matches (apart from whitespace) the text that was parsed. - -While parsing types, the parser creates an unsigned int that describes -the type as well as creating other data structures for arrays, function -pointers, etc. The parser also creates a typeId string, which is either -a simple id that gives the class name or type name, or is "function" for -function pointer types, or "method" for method pointer types. -*/ - -/* -Conformance Notes: - -This parser was designed empirically and incrementally. It has been -refactored to make it more similar to the C++ 1998 grammar, but there -are still many very significant differences. - -The most significant difference between this parser and a "standard" -parser is that it only parses declarations in detail. All other -statements and expressions are parsed as arbitrary sequences of symbols, -without any syntactic analysis. - -The "unqualified_id" does not directly include "operator_function_id" or -"conversion_function_id" (e.g. ids like "operator=" or "operator int*"). -Instead, these two id types are used to allow operator functions to be -handled by their own rules, rather than by the generic function rules. -These ids can only be used in function declarations and using declarations. - -Types are handled quite differently from the C++ BNF. These differences -represent a prolonged (and ultimately successful) attempt to empirically -create a yacc parser without any shift/reduce conflicts. The rules for -types are organized according to the way that types are usually defined -in working code, rather than strictly according to C++ grammar. - -The declaration specifier "typedef" can only appear at the beginning -of a declaration sequence. There are also restrictions on where class -and enum specifiers can be used: you can declare a new struct within a -variable declaration, but not within a parameter declaration. - -The lexer returns each of "(scope::*", "(*", "(a::b::*", etc. as single -tokens. The C++ BNF, in contrast, would consider these to be a "(" -followed by a "ptr_operator". The lexer concatenates these tokens in -order to eliminate shift/reduce conflicts in the parser. However, this -means that this parser will only recognize "scope::*" as valid if it is -preceded by "(", e.g. as part of a member function pointer specification. - -An odd bit of C++ ambiguity is that y(x); can be interpreted variously -as declaration of variable "x" of type "y", as a function call if "y" -is the name of a function, or as a constructor if "y" is the name of -a class. This parser always interprets this pattern as a constructor -declaration, because function calls are ignored by the parser, and -variable declarations of the form y(x); are exceedingly rare compared -to the more usual form y x; without parentheses. -*/ - -#include -#include -#include -#define yyerror(a) print_parser_error(a, NULL, 0) -#define yywrap() 1 - -/* Make sure yacc-generated code knows we have included stdlib.h. */ -#ifndef _STDLIB_H -# define _STDLIB_H -#endif -#define YYINCLUDED_STDLIB_H - -/* Borland and MSVC do not define __STDC__ properly. */ -#if !defined(__STDC__) -# if defined(_MSC_VER) || defined(__BORLANDC__) -# define __STDC__ 1 -# endif -#endif - -/* Disable warnings in generated code. */ -#if defined(_MSC_VER) -# pragma warning (disable: 4127) /* conditional expression is constant */ -# pragma warning (disable: 4244) /* conversion to smaller integer type */ -#endif -#if defined(__BORLANDC__) -# pragma warn -8004 /* assigned a value that is never used */ -# pragma warn -8008 /* conditional is always true */ -# pragma warn -8066 /* unreachable code */ -#endif - -/* Map from the type anonymous_enumeration in vtkType.h to the - VTK wrapping type system number for the type. */ - -#include "vtkParse.h" -#include "vtkParsePreprocess.h" -#include "vtkParseData.h" -#include "vtkType.h" - -static unsigned int vtkParseTypeMap[] = - { - VTK_PARSE_VOID, /* VTK_VOID 0 */ - 0, /* VTK_BIT 1 */ - VTK_PARSE_CHAR, /* VTK_CHAR 2 */ - VTK_PARSE_UNSIGNED_CHAR, /* VTK_UNSIGNED_CHAR 3 */ - VTK_PARSE_SHORT, /* VTK_SHORT 4 */ - VTK_PARSE_UNSIGNED_SHORT, /* VTK_UNSIGNED_SHORT 5 */ - VTK_PARSE_INT, /* VTK_INT 6 */ - VTK_PARSE_UNSIGNED_INT, /* VTK_UNSIGNED_INT 7 */ - VTK_PARSE_LONG, /* VTK_LONG 8 */ - VTK_PARSE_UNSIGNED_LONG, /* VTK_UNSIGNED_LONG 9 */ - VTK_PARSE_FLOAT, /* VTK_FLOAT 10 */ - VTK_PARSE_DOUBLE, /* VTK_DOUBLE 11 */ - VTK_PARSE_ID_TYPE, /* VTK_ID_TYPE 12 */ - VTK_PARSE_STRING, /* VTK_STRING 13 */ - 0, /* VTK_OPAQUE 14 */ - VTK_PARSE_SIGNED_CHAR, /* VTK_SIGNED_CHAR 15 */ - VTK_PARSE_LONG_LONG, /* VTK_LONG_LONG 16 */ - VTK_PARSE_UNSIGNED_LONG_LONG, /* VTK_UNSIGNED_LONG_LONG 17 */ - VTK_PARSE___INT64, /* VTK___INT64 18 */ - VTK_PARSE_UNSIGNED___INT64, /* VTK_UNSIGNED___INT64 19 */ - 0, /* VTK_VARIANT 20 */ - 0, /* VTK_OBJECT 21 */ - VTK_PARSE_UNICODE_STRING /* VTK_UNICODE_STRING 22 */ - }; - -/* Define some constants to simplify references to the table lookup in - the primitive_type production rule code. */ -#define VTK_PARSE_INT8 vtkParseTypeMap[VTK_TYPE_INT8] -#define VTK_PARSE_UINT8 vtkParseTypeMap[VTK_TYPE_UINT8] -#define VTK_PARSE_INT16 vtkParseTypeMap[VTK_TYPE_INT16] -#define VTK_PARSE_UINT16 vtkParseTypeMap[VTK_TYPE_UINT16] -#define VTK_PARSE_INT32 vtkParseTypeMap[VTK_TYPE_INT32] -#define VTK_PARSE_UINT32 vtkParseTypeMap[VTK_TYPE_UINT32] -#define VTK_PARSE_INT64 vtkParseTypeMap[VTK_TYPE_INT64] -#define VTK_PARSE_UINT64 vtkParseTypeMap[VTK_TYPE_UINT64] -#define VTK_PARSE_FLOAT32 vtkParseTypeMap[VTK_TYPE_FLOAT32] -#define VTK_PARSE_FLOAT64 vtkParseTypeMap[VTK_TYPE_FLOAT64] - -#define vtkParseDebug(s1, s2) \ - if ( parseDebug ) { fprintf(stderr, " %s %s\n", s1, s2); } - -/* the tokenizer */ -int yylex(void); - -/* global variables */ -FileInfo *data = NULL; -int parseDebug; - -/* the "preprocessor" */ -PreprocessInfo *preprocessor = NULL; - -/* include dirs specified on the command line */ -int NumberOfIncludeDirectories= 0; -const char **IncludeDirectories; - -/* macros specified on the command line */ -int NumberOfDefinitions = 0; -const char **Definitions; - -/* options that can be set by the programs that use the parser */ -int IgnoreBTX = 0; -int Recursive = 0; -const char *CommandName = NULL; - -/* various state variables */ -NamespaceInfo *currentNamespace = NULL; -ClassInfo *currentClass = NULL; -FunctionInfo *currentFunction = NULL; -TemplateInfo *currentTemplate = NULL; -const char *currentEnumName = NULL; -const char *currentEnumValue = NULL; -unsigned int currentEnumType = 0; -parse_access_t access_level = VTK_ACCESS_PUBLIC; - -/* functions from vtkParse.l */ -void print_parser_error(const char *text, const char *cp, size_t n); - -/* helper functions */ -const char *type_class(unsigned int type, const char *classname); -void start_class(const char *classname, int is_struct_or_union); -void end_class(); -void add_base_class(ClassInfo *cls, const char *name, int access_lev, - unsigned int extra); -void output_friend_function(void); -void output_function(void); -void reject_function(void); -void set_return(FunctionInfo *func, unsigned int type, - const char *typeclass, int count); -void add_parameter(FunctionInfo *func, unsigned int type, - const char *classname, int count); -void add_template_parameter(unsigned int datatype, - unsigned int extra, const char *funcSig); -void add_using(const char *name, int is_namespace); -void start_enum(const char *name, int is_scoped, - unsigned int type, const char *basename); -void add_enum(const char *name, const char *value); -void end_enum(); -unsigned int guess_constant_type(const char *value); -void add_constant(const char *name, const char *value, - unsigned int type, const char *typeclass, int global); -const char *add_const_scope(const char *name); -void prepend_scope(char *cp, const char *arg); -unsigned int guess_id_type(const char *cp); -unsigned int add_indirection(unsigned int tval, unsigned int ptr); -unsigned int add_indirection_to_array(unsigned int ptr); -void handle_complex_type(ValueInfo *val, unsigned int datatype, - unsigned int extra, const char *funcSig); -void handle_function_type(ValueInfo *param, const char *name, - const char *funcSig); -void add_legacy_parameter(FunctionInfo *func, ValueInfo *param); - -void outputSetVectorMacro(const char *var, unsigned int paramType, - const char *typeText, int n); -void outputGetVectorMacro(const char *var, unsigned int paramType, - const char *typeText, int n); - - -/*---------------------------------------------------------------- - * String utility methods - * - * Strings are centrally allocated and are const, and they are not - * freed until the program exits. If they need to be freed before - * then, vtkParse_FreeStringCache() can be called. - */ - -/* duplicate the first n bytes of a string and terminate */ -static const char *vtkstrndup(const char *in, size_t n) -{ - return vtkParse_CacheString(data->Strings, in, n); -} - -/* duplicate a string */ -static const char *vtkstrdup(const char *in) -{ - if (in) - { - in = vtkParse_CacheString(data->Strings, in, strlen(in)); - } - - return in; -} - -/* helper function for concatenating strings */ -static const char *vtkstrncat(size_t n, const char **str) -{ - char *cp; - size_t i; - size_t j[8]; - size_t m = 0; - - for (i = 0; i < n; i++) - { - j[i] = 0; - if (str[i]) - { - j[i] = strlen(str[i]); - m += j[i]; - } - } - cp = vtkParse_NewString(data->Strings, m); - m = 0; - for (i = 0; i < n; i++) - { - if (j[i]) - { - strncpy(&cp[m], str[i], j[i]); - m += j[i]; - } - } - cp[m] = '\0'; - - return cp; -} - -/* concatenate strings */ -static const char *vtkstrcat(const char *str1, const char *str2) -{ - const char *cp[2]; - - cp[0] = str1; - cp[1] = str2; - return vtkstrncat(2, cp); -} - -static const char *vtkstrcat3(const char *str1, const char *str2, - const char *str3) -{ - const char *cp[3]; - - cp[0] = str1; - cp[1] = str2; - cp[2] = str3; - return vtkstrncat(3, cp); -} - -static const char *vtkstrcat4(const char *str1, const char *str2, - const char *str3, const char *str4) -{ - const char *cp[4]; - - cp[0] = str1; - cp[1] = str2; - cp[2] = str3; - cp[3] = str4; - return vtkstrncat(4, cp); -} - -static const char *vtkstrcat5(const char *str1, const char *str2, - const char *str3, const char *str4, - const char *str5) -{ - const char *cp[5]; - - cp[0] = str1; - cp[1] = str2; - cp[2] = str3; - cp[3] = str4; - cp[4] = str5; - return vtkstrncat(5, cp); -} - -static const char *vtkstrcat7(const char *str1, const char *str2, - const char *str3, const char *str4, - const char *str5, const char *str6, - const char *str7) -{ - const char *cp[7]; - - cp[0] = str1; - cp[1] = str2; - cp[2] = str3; - cp[3] = str4; - cp[4] = str5; - cp[5] = str6; - cp[6] = str7; - return vtkstrncat(7, cp); -} - -/*---------------------------------------------------------------- - * Comments - */ - -/* "private" variables */ -char *commentText = NULL; -size_t commentLength = 0; -size_t commentAllocatedLength = 0; -int commentState = 0; - -const char *getComment() -{ - if (commentState != 0) - { - return commentText; - } - return NULL; -} - -void clearComment() -{ - commentLength = 0; - if (commentText) - { - commentText[commentLength] = '\0'; - } - commentState = 0; -} - -void addCommentLine(const char *line, size_t n) -{ - if (commentState <= 0) - { - clearComment(); - return; - } - - if (commentText == NULL) - { - commentAllocatedLength = n+80; - commentText = (char *)malloc(commentAllocatedLength); - commentLength = 0; - commentText[0] = '\0'; - } - else if (commentLength + n + 2 > commentAllocatedLength) - { - commentAllocatedLength = commentAllocatedLength + commentLength + n + 2; - commentText = (char *)realloc(commentText, commentAllocatedLength); - } - - if (n > 0) - { - memcpy(&commentText[commentLength], line, n); - } - commentLength += n; - commentText[commentLength++] = '\n'; - commentText[commentLength] = '\0'; -} - -void closeComment() -{ - switch (commentState) - { - case 1: - /* Make comment persist until a new comment starts */ - commentState = -1; - break; - case 2: - data->Description = vtkstrdup(getComment()); - clearComment(); - break; - case 3: - data->SeeAlso = vtkstrdup(getComment()); - clearComment(); - break; - case 4: - data->Caveats = vtkstrdup(getComment()); - clearComment(); - break; - } -} - -void closeOrClearComment() -{ - if (commentState < 0) - { - clearComment(); - } - else - { - closeComment(); - } -} - -void setCommentState(int state) -{ - switch (state) - { - case 0: - closeComment(); - break; - default: - closeComment(); - clearComment(); - break; - } - - commentState = state; -} - - -/*---------------------------------------------------------------- - * Macros - */ - -/* "private" variables */ -const char *macroName = NULL; -int macroUsed = 0; -int macroEnded = 0; - -const char *getMacro() -{ - if (macroUsed == 0) - { - macroUsed = macroEnded; - return macroName; - } - return NULL; -} - - -/*---------------------------------------------------------------- - * Namespaces - * - * operates on: currentNamespace - */ - -/* "private" variables */ -NamespaceInfo *namespaceStack[10]; -int namespaceDepth = 0; - -/* enter a namespace */ -void pushNamespace(const char *name) -{ - int i; - NamespaceInfo *oldNamespace = currentNamespace; - - for (i = 0; i < oldNamespace->NumberOfNamespaces; i++) - { - /* see if the namespace already exists */ - if (strcmp(name, oldNamespace->Namespaces[i]->Name) == 0) - { - currentNamespace = oldNamespace->Namespaces[i]; - } - } - - /* create a new namespace */ - if (i == oldNamespace->NumberOfNamespaces) - { - currentNamespace = (NamespaceInfo *)malloc(sizeof(NamespaceInfo)); - vtkParse_InitNamespace(currentNamespace); - currentNamespace->Name = name; - vtkParse_AddNamespaceToNamespace(oldNamespace, currentNamespace); - } - - namespaceStack[namespaceDepth++] = oldNamespace; -} - -/* leave the namespace */ -void popNamespace() -{ - currentNamespace = namespaceStack[--namespaceDepth]; -} - - -/*---------------------------------------------------------------- - * Classes - * - * operates on: currentClass, access_level - */ - -/* "private" variables */ -ClassInfo *classStack[10]; -parse_access_t classAccessStack[10]; -int classDepth = 0; - -/* start an internal class definition */ -void pushClass() -{ - classAccessStack[classDepth] = access_level; - classStack[classDepth++] = currentClass; -} - -/* leave the internal class */ -void popClass() -{ - currentClass = classStack[--classDepth]; - access_level = classAccessStack[classDepth]; -} - - -/*---------------------------------------------------------------- - * Templates - * - * operates on: currentTemplate - */ - -/* "private" variables */ -TemplateInfo *templateStack[10]; -int templateDepth = 0; - -/* begin a template */ -void startTemplate() -{ - currentTemplate = (TemplateInfo *)malloc(sizeof(TemplateInfo)); - vtkParse_InitTemplate(currentTemplate); -} - -/* clear a template, if set */ -void clearTemplate() -{ - if (currentTemplate) - { - free(currentTemplate); - } - currentTemplate = NULL; -} - -/* push the template onto the stack, and start a new one */ -void pushTemplate() -{ - templateStack[templateDepth++] = currentTemplate; - startTemplate(); -} - -/* pop a template off the stack */ -void popTemplate() -{ - currentTemplate = templateStack[--templateDepth]; -} - -/*---------------------------------------------------------------- - * Function signatures - * - * operates on: currentFunction - */ - -/* "private" variables */ -int sigClosed = 0; -size_t sigMark[10]; -size_t sigLength = 0; -size_t sigAllocatedLength = 0; -int sigMarkDepth = 0; -char *signature = NULL; - -/* start a new signature */ -void startSig() -{ - signature = NULL; - sigLength = 0; - sigAllocatedLength = 0; - sigClosed = 0; - sigMarkDepth = 0; - sigMark[0] = 0; -} - -/* get the signature */ -const char *getSig() -{ - return signature; -} - -/* get the signature length */ -size_t getSigLength() -{ - return sigLength; -} - -/* reset the sig to the specified length */ -void resetSig(size_t n) -{ - if (n < sigLength) - { - sigLength = n; - } -} - -/* reallocate Signature if n chars cannot be appended */ -void checkSigSize(size_t n) -{ - const char *ccp; - - if (sigAllocatedLength == 0) - { - sigLength = 0; - sigAllocatedLength = 80 + n; - signature = vtkParse_NewString(data->Strings, sigAllocatedLength); - signature[0] = '\0'; - } - else if (sigLength + n > sigAllocatedLength) - { - sigAllocatedLength += sigLength + n; - ccp = signature; - signature = vtkParse_NewString(data->Strings, sigAllocatedLength); - strncpy(signature, ccp, sigLength); - signature[sigLength] = '\0'; - } -} - -/* close the signature, i.e. allow no more additions to it */ -void closeSig() -{ - sigClosed = 1; -} - -/* re-open the signature */ -void openSig() -{ - sigClosed = 0; -} - -/* insert text at the beginning of the signature */ -void preSig(const char *arg) -{ - if (!sigClosed) - { - size_t n = strlen(arg); - checkSigSize(n); - if (n > 0) - { - memmove(&signature[n], signature, sigLength); - strncpy(signature, arg, n); - sigLength += n; - } - signature[sigLength] = '\0'; - } -} - -/* append text to the end of the signature */ -void postSig(const char *arg) -{ - if (!sigClosed) - { - size_t n = strlen(arg); - checkSigSize(n); - if (n > 0) - { - strncpy(&signature[sigLength], arg, n); - sigLength += n; - } - signature[sigLength] = '\0'; - } -} - -/* set a mark in the signature for later operations */ -void markSig() -{ - sigMark[sigMarkDepth] = 0; - if (signature) - { - sigMark[sigMarkDepth] = sigLength; - } - sigMarkDepth++; -} - -/* get the contents of the sig from the mark, and clear the mark */ -const char *copySig() -{ - const char *cp = NULL; - if (sigMarkDepth > 0) - { - sigMarkDepth--; - } - if (signature) - { - cp = &signature[sigMark[sigMarkDepth]]; - } - return vtkstrdup(cp); -} - -/* swap the signature text using the mark as the radix */ -void swapSig() -{ - if (sigMarkDepth > 0) - { - sigMarkDepth--; - } - if (signature && sigMark[sigMarkDepth] > 0) - { - size_t i, m, n, nn; - char c; - char *cp; - cp = signature; - n = sigLength; - m = sigMark[sigMarkDepth]; - nn = m/2; - for (i = 0; i < nn; i++) - { - c = cp[i]; cp[i] = cp[m-i-1]; cp[m-i-1] = c; - } - nn = (n-m)/2; - for (i = 0; i < nn; i++) - { - c = cp[i+m]; cp[i+m] = cp[n-i-1]; cp[n-i-1] = c; - } - nn = n/2; - for (i = 0; i < nn; i++) - { - c = cp[i]; cp[i] = cp[n-i-1]; cp[n-i-1] = c; - } - } -} - -/* chop the last space from the signature */ -void chopSig(void) -{ - if (signature) - { - size_t n = sigLength; - if (n > 0 && signature[n-1] == ' ') - { - signature[n-1] = '\0'; - sigLength--; - } - } -} - -/*---------------------------------------------------------------- - * Subroutines for building a type - */ - -/* "private" variables */ -unsigned int storedType; -unsigned int typeStack[10]; -int typeDepth = 0; - -/* save the type on the stack */ -void pushType() -{ - typeStack[typeDepth++] = storedType; -} - -/* pop the type stack */ -void popType() -{ - storedType = typeStack[--typeDepth]; -} - -/* clear the storage type */ -void clearType() -{ - storedType = 0; -} - -/* save the type */ -void setTypeBase(unsigned int base) -{ - storedType &= ~(unsigned int)(VTK_PARSE_BASE_TYPE); - storedType |= base; -} - -/* set a type modifier bit */ -void setTypeMod(unsigned int mod) -{ - storedType |= mod; -} - -/* modify the indirection (pointers, refs) in the storage type */ -void setTypePtr(unsigned int ind) -{ - storedType &= ~(unsigned int)(VTK_PARSE_INDIRECT | VTK_PARSE_RVALUE); - ind &= (VTK_PARSE_INDIRECT | VTK_PARSE_RVALUE); - storedType |= ind; -} - -/* retrieve the storage type */ -unsigned int getType() -{ - return storedType; -} - -/* combine two primitive type parts, e.g. "long int" */ -unsigned int buildTypeBase(unsigned int a, unsigned int b) -{ - unsigned int base = (a & VTK_PARSE_BASE_TYPE); - unsigned int basemod = (b & VTK_PARSE_BASE_TYPE); - - switch (base) - { - case 0: - base = basemod; - break; - case VTK_PARSE_UNSIGNED_INT: - base = (basemod | VTK_PARSE_UNSIGNED); - break; - case VTK_PARSE_INT: - base = basemod; - if (base == VTK_PARSE_CHAR) - { - base = VTK_PARSE_SIGNED_CHAR; - } - break; - case VTK_PARSE_CHAR: - if (basemod == VTK_PARSE_INT) - { - base = VTK_PARSE_SIGNED_CHAR; - } - else if (basemod == VTK_PARSE_UNSIGNED_INT) - { - base = VTK_PARSE_UNSIGNED_CHAR; - } - break; - case VTK_PARSE_SHORT: - if (basemod == VTK_PARSE_UNSIGNED_INT) - { - base = VTK_PARSE_UNSIGNED_SHORT; - } - break; - case VTK_PARSE_LONG: - if (basemod == VTK_PARSE_UNSIGNED_INT) - { - base = VTK_PARSE_UNSIGNED_LONG; - } - else if (basemod == VTK_PARSE_LONG) - { - base = VTK_PARSE_LONG_LONG; - } - else if (basemod == VTK_PARSE_DOUBLE) - { - base = VTK_PARSE_LONG_DOUBLE; - } - break; - case VTK_PARSE_UNSIGNED_LONG: - if (basemod == VTK_PARSE_LONG) - { - base = VTK_PARSE_UNSIGNED_LONG_LONG; - } - break; - case VTK_PARSE_LONG_LONG: - if (basemod == VTK_PARSE_UNSIGNED_INT) - { - base = VTK_PARSE_UNSIGNED_LONG_LONG; - } - break; - case VTK_PARSE___INT64: - if (basemod == VTK_PARSE_UNSIGNED_INT) - { - base = VTK_PARSE_UNSIGNED___INT64; - } - break; - case VTK_PARSE_DOUBLE: - if (basemod == VTK_PARSE_LONG) - { - base = VTK_PARSE_LONG_DOUBLE; - } - break; - } - - return ((a & ~(unsigned int)(VTK_PARSE_BASE_TYPE)) | base); -} - - -/*---------------------------------------------------------------- - * Array information - */ - -/* "private" variables */ -int numberOfDimensions = 0; -const char **arrayDimensions = NULL; - -/* clear the array counter */ -void clearArray(void) -{ - numberOfDimensions = 0; - arrayDimensions = NULL; -} - -/* add another dimension */ -void pushArraySize(const char *size) -{ - vtkParse_AddStringToArray(&arrayDimensions, &numberOfDimensions, - size); -} - -/* add another dimension to the front */ -void pushArrayFront(const char *size) -{ - int i; - - vtkParse_AddStringToArray(&arrayDimensions, &numberOfDimensions, 0); - - for (i = numberOfDimensions-1; i > 0; i--) - { - arrayDimensions[i] = arrayDimensions[i-1]; - } - - arrayDimensions[0] = size; -} - -/* get the number of dimensions */ -int getArrayNDims() -{ - return numberOfDimensions; -} - -/* get the whole array */ -const char **getArray() -{ - if (numberOfDimensions > 0) - { - return arrayDimensions; - } - return NULL; -} - -/*---------------------------------------------------------------- - * Variables and Parameters - */ - -/* "private" variables */ -const char *currentVarName = 0; -const char *currentVarValue = 0; -const char *currentId = 0; - -/* clear the var Id */ -void clearVarName(void) -{ - currentVarName = NULL; -} - -/* set the var Id */ -void setVarName(const char *text) -{ - currentVarName = text; -} - -/* return the var id */ -const char *getVarName() -{ - return currentVarName; -} - -/* variable value -------------- */ - -/* clear the var value */ -void clearVarValue(void) -{ - currentVarValue = NULL; -} - -/* set the var value */ -void setVarValue(const char *text) -{ - currentVarValue = text; -} - -/* return the var value */ -const char *getVarValue() -{ - return currentVarValue; -} - -/* variable type -------------- */ - -/* clear the current Id */ -void clearTypeId(void) -{ - currentId = NULL; -} - -/* set the current Id, it is sticky until cleared */ -void setTypeId(const char *text) -{ - if (currentId == NULL) - { - currentId = text; - } -} - -/* set the signature and type together */ -void typeSig(const char *text) -{ - postSig(text); - postSig(" "); - - if (currentId == 0) - { - setTypeId(text); - } -} - -/* return the current Id */ -const char *getTypeId() -{ - return currentId; -} - -/*---------------------------------------------------------------- - * Specifically for function pointers, the scope (i.e. class) that - * the function is a method of. - */ - -const char *pointerScopeStack[10]; -int pointerScopeDepth = 0; - -/* save the scope for scoped method pointers */ -void scopeSig(const char *scope) -{ - if (scope && scope[0] != '\0') - { - postSig(scope); - } - else - { - scope = NULL; - } - pointerScopeStack[pointerScopeDepth++] = vtkstrdup(scope); -} - -/* get the scope back */ -const char *getScope() -{ - return pointerScopeStack[--pointerScopeDepth]; -} - -/*---------------------------------------------------------------- - * Function stack - * - * operates on: currentFunction - */ - -/* "private" variables */ -FunctionInfo *functionStack[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -const char *functionVarNameStack[10]; -const char *functionTypeIdStack[10]; -int functionDepth = 0; - -void pushFunction() -{ - functionStack[functionDepth] = currentFunction; - currentFunction = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - vtkParse_InitFunction(currentFunction); - if (!functionStack[functionDepth]) - { - startSig(); - } - functionVarNameStack[functionDepth] = getVarName(); - functionTypeIdStack[functionDepth] = getTypeId(); - pushType(); - clearType(); - clearVarName(); - clearTypeId(); - functionDepth++; - functionStack[functionDepth] = 0; -} - -void popFunction() -{ - FunctionInfo *newFunction = currentFunction; - - --functionDepth; - currentFunction = functionStack[functionDepth]; - clearVarName(); - if (functionVarNameStack[functionDepth]) - { - setVarName(functionVarNameStack[functionDepth]); - } - clearTypeId(); - if (functionTypeIdStack[functionDepth]) - { - setTypeId(functionTypeIdStack[functionDepth]); - } - popType(); - - functionStack[functionDepth+1] = newFunction; -} - -FunctionInfo *getFunction() -{ - return functionStack[functionDepth+1]; -} - -/*---------------------------------------------------------------- - * Utility methods - */ - -/* prepend a scope:: to a name */ -void prepend_scope(char *cp, const char *arg) -{ - size_t i, j, m, n; - int depth; - - m = strlen(cp); - n = strlen(arg); - i = m; - while (i > 0 && - (vtkParse_CharType(cp[i-1], CPRE_IDGIT) || - cp[i-1] == ':' || cp[i-1] == '>')) - { - i--; - if (cp[i] == '>') - { - depth = 1; - while (i > 0) - { - i--; - if (cp[i] == '<') - { - if (--depth == 0) - { - break; - } - } - if (cp[i] == '>') - { - depth++; - } - } - } - } - - for (j = m; j > i; j--) - { - cp[j+n+1] = cp[j-1]; - } - for (j = 0; j < n; j++) - { - cp[j+i] = arg[j]; - } - cp[n+i] = ':'; cp[n+i+1] = ':'; - cp[m+n+2] = '\0'; -} - -/* expand a type by including pointers from another */ -unsigned int add_indirection(unsigned int type1, unsigned int type2) -{ - unsigned int ptr1 = (type1 & VTK_PARSE_POINTER_MASK); - unsigned int ptr2 = (type2 & VTK_PARSE_POINTER_MASK); - unsigned int reverse = 0; - unsigned int result; - - /* one of type1 or type2 will only have VTK_PARSE_INDIRECT, but - * we don't know which one. */ - result = ((type1 & ~VTK_PARSE_POINTER_MASK) | - (type2 & ~VTK_PARSE_POINTER_MASK)); - - /* if there are two ampersands, it is an rvalue reference */ - if ((type1 & type2 & VTK_PARSE_REF) != 0) - { - result |= VTK_PARSE_RVALUE; - } - - while (ptr2) - { - reverse = ((reverse << 2) | (ptr2 & VTK_PARSE_POINTER_LOWMASK)); - ptr2 = ((ptr2 >> 2) & VTK_PARSE_POINTER_MASK); - } - - while (reverse) - { - ptr1 = ((ptr1 << 2) | (reverse & VTK_PARSE_POINTER_LOWMASK)); - reverse = ((reverse >> 2) & VTK_PARSE_POINTER_MASK); - - /* make sure we don't exceed the VTK_PARSE_POINTER bitfield */ - if ((ptr1 & VTK_PARSE_POINTER_MASK) != ptr1) - { - ptr1 = VTK_PARSE_BAD_INDIRECT; - break; - } - } - - return (ptr1 | result); -} - -/* There is only one array, so add any parenthetical indirection to it */ -unsigned int add_indirection_to_array(unsigned int type) -{ - unsigned int ptrs = (type & VTK_PARSE_POINTER_MASK); - unsigned int result = (type & ~VTK_PARSE_POINTER_MASK); - unsigned int reverse = 0; - - if ((type & VTK_PARSE_INDIRECT) == VTK_PARSE_BAD_INDIRECT) - { - return (result | VTK_PARSE_BAD_INDIRECT); - } - - while (ptrs) - { - reverse = ((reverse << 2) | (ptrs & VTK_PARSE_POINTER_LOWMASK)); - ptrs = ((ptrs >> 2) & VTK_PARSE_POINTER_MASK); - } - - /* I know the reversal makes no difference, but it is still - * nice to add the pointers in the correct order, just in - * case const pointers are thrown into the mix. */ - while (reverse) - { - pushArrayFront(""); - reverse = ((reverse >> 2) & VTK_PARSE_POINTER_MASK); - } - - return result; -} - - - -/* Line 172 of glr.c */ -#line 1322 "vtkParse.tab.c" - - - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - ID = 258, - VTK_ID = 259, - QT_ID = 260, - StdString = 261, - UnicodeString = 262, - OSTREAM = 263, - ISTREAM = 264, - LP = 265, - LA = 266, - STRING_LITERAL = 267, - INT_LITERAL = 268, - HEX_LITERAL = 269, - OCT_LITERAL = 270, - FLOAT_LITERAL = 271, - CHAR_LITERAL = 272, - ZERO = 273, - NULLPTR = 274, - SSIZE_T = 275, - SIZE_T = 276, - NULLPTR_T = 277, - BEGIN_ATTRIB = 278, - STRUCT = 279, - CLASS = 280, - UNION = 281, - ENUM = 282, - PUBLIC = 283, - PRIVATE = 284, - PROTECTED = 285, - CONST = 286, - VOLATILE = 287, - MUTABLE = 288, - STATIC = 289, - THREAD_LOCAL = 290, - VIRTUAL = 291, - EXPLICIT = 292, - INLINE = 293, - CONSTEXPR = 294, - FRIEND = 295, - EXTERN = 296, - OPERATOR = 297, - TEMPLATE = 298, - THROW = 299, - TRY = 300, - CATCH = 301, - NOEXCEPT = 302, - DECLTYPE = 303, - TYPENAME = 304, - TYPEDEF = 305, - NAMESPACE = 306, - USING = 307, - NEW = 308, - DELETE = 309, - DEFAULT = 310, - STATIC_CAST = 311, - DYNAMIC_CAST = 312, - CONST_CAST = 313, - REINTERPRET_CAST = 314, - OP_LSHIFT_EQ = 315, - OP_RSHIFT_EQ = 316, - OP_LSHIFT = 317, - OP_RSHIFT_A = 318, - OP_DOT_POINTER = 319, - OP_ARROW_POINTER = 320, - OP_ARROW = 321, - OP_INCR = 322, - OP_DECR = 323, - OP_PLUS_EQ = 324, - OP_MINUS_EQ = 325, - OP_TIMES_EQ = 326, - OP_DIVIDE_EQ = 327, - OP_REMAINDER_EQ = 328, - OP_AND_EQ = 329, - OP_OR_EQ = 330, - OP_XOR_EQ = 331, - OP_LOGIC_AND = 332, - OP_LOGIC_OR = 333, - OP_LOGIC_EQ = 334, - OP_LOGIC_NEQ = 335, - OP_LOGIC_LEQ = 336, - OP_LOGIC_GEQ = 337, - ELLIPSIS = 338, - DOUBLE_COLON = 339, - OTHER = 340, - AUTO = 341, - VOID = 342, - BOOL = 343, - FLOAT = 344, - DOUBLE = 345, - INT = 346, - SHORT = 347, - LONG = 348, - INT64__ = 349, - CHAR = 350, - CHAR16_T = 351, - CHAR32_T = 352, - WCHAR_T = 353, - SIGNED = 354, - UNSIGNED = 355, - IdType = 356, - TypeInt8 = 357, - TypeUInt8 = 358, - TypeInt16 = 359, - TypeUInt16 = 360, - TypeInt32 = 361, - TypeUInt32 = 362, - TypeInt64 = 363, - TypeUInt64 = 364, - TypeFloat32 = 365, - TypeFloat64 = 366, - SetMacro = 367, - GetMacro = 368, - SetStringMacro = 369, - GetStringMacro = 370, - SetClampMacro = 371, - SetObjectMacro = 372, - GetObjectMacro = 373, - BooleanMacro = 374, - SetVector2Macro = 375, - SetVector3Macro = 376, - SetVector4Macro = 377, - SetVector6Macro = 378, - GetVector2Macro = 379, - GetVector3Macro = 380, - GetVector4Macro = 381, - GetVector6Macro = 382, - SetVectorMacro = 383, - GetVectorMacro = 384, - ViewportCoordinateMacro = 385, - WorldCoordinateMacro = 386, - TypeMacro = 387, - VTK_BYTE_SWAP_DECL = 388 - }; -#endif - - -#ifndef YYSTYPE -typedef union YYSTYPE -{ - -/* Line 215 of glr.c */ -#line 1293 "vtkParse.y" - - const char *str; - unsigned int integer; - - - -/* Line 215 of glr.c */ -#line 1481 "vtkParse.tab.c" -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -#endif - -#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED -typedef struct YYLTYPE -{ - - char yydummy; - -} YYLTYPE; -# define YYLTYPE_IS_DECLARED 1 -# define YYLTYPE_IS_TRIVIAL 1 -#endif - - - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -/* Default (constant) value used for initialization for null - right-hand sides. Unlike the standard yacc.c template, - here we set the default value of $$ to a zeroed-out value. - Since the default value is undefined, this behavior is - technically correct. */ -static YYSTYPE yyval_default; - -/* Copy the second part of user declarations. */ - - -/* Line 243 of glr.c */ -#line 1528 "vtkParse.tab.c" - -#include -#include -#include - -#ifndef YY_ -# if YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#define YYUSE(e) ((void) (e)) - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; -#endif -{ - return i; -} -#endif - -#ifndef YYFREE -# define YYFREE free -#endif -#ifndef YYMALLOC -# define YYMALLOC malloc -#endif -#ifndef YYREALLOC -# define YYREALLOC realloc -#endif - -#define YYSIZEMAX ((size_t) -1) - -#ifdef __cplusplus - typedef bool yybool; -#else - typedef unsigned char yybool; -#endif -#define yytrue 1 -#define yyfalse 0 - -#ifndef YYSETJMP -# include -# define YYJMP_BUF jmp_buf -# define YYSETJMP(env) setjmp (env) -# define YYLONGJMP(env, val) longjmp (env, val) -#endif - -/*-----------------. -| GCC extensions. | -`-----------------*/ - -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if (! defined __GNUC__ || __GNUC__ < 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__) -# define __attribute__(Spec) /* empty */ -# endif -#endif - - -#ifdef __cplusplus -# define YYOPTIONAL_LOC(Name) /* empty */ -#else -# define YYOPTIONAL_LOC(Name) Name __attribute__ ((__unused__)) -#endif - -#ifndef YYASSERT -# define YYASSERT(condition) ((void) ((condition) || (abort (), 0))) -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 3 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 9147 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 157 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 276 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 701 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 1182 -/* YYMAXRHS -- Maximum number of symbols on right-hand side of rule. */ -#define YYMAXRHS 10 -/* YYMAXLEFT -- Maximum number of symbols to the left of a handle - accessed by $0, $-1, etc., in any rule. */ -#define YYMAXLEFT 0 - -/* YYTRANSLATE(X) -- Bison symbol number corresponding to X. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 388 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const unsigned char yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 153, 2, 2, 2, 149, 146, 2, - 140, 141, 147, 152, 139, 151, 156, 150, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 138, 134, - 142, 137, 148, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 143, 2, 144, 155, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 135, 154, 136, 145, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const unsigned short int yyprhs[] = -{ - 0, 0, 3, 5, 6, 7, 12, 14, 16, 18, - 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, - 40, 42, 44, 47, 49, 52, 55, 58, 61, 64, - 70, 75, 81, 86, 87, 94, 100, 102, 105, 110, - 114, 120, 125, 131, 132, 138, 139, 147, 152, 153, - 159, 162, 164, 166, 168, 172, 177, 180, 182, 184, - 185, 187, 188, 189, 194, 198, 200, 202, 204, 206, - 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, - 228, 230, 233, 236, 238, 241, 244, 247, 250, 253, - 257, 260, 264, 266, 271, 274, 279, 284, 285, 287, - 288, 290, 292, 294, 296, 302, 306, 313, 318, 324, - 325, 331, 336, 340, 342, 345, 348, 349, 350, 354, - 356, 360, 361, 363, 364, 369, 376, 379, 381, 387, - 394, 398, 403, 409, 413, 415, 418, 424, 430, 437, - 443, 450, 453, 454, 458, 461, 463, 465, 466, 467, - 476, 478, 482, 484, 487, 490, 493, 497, 501, 506, - 507, 516, 520, 521, 527, 529, 530, 535, 536, 537, - 543, 544, 545, 551, 552, 553, 554, 562, 563, 565, - 567, 569, 570, 572, 573, 577, 579, 582, 585, 588, - 591, 594, 598, 603, 606, 610, 613, 617, 622, 625, - 630, 636, 640, 642, 644, 647, 649, 652, 656, 657, - 658, 668, 671, 672, 677, 678, 686, 689, 691, 695, - 696, 699, 700, 704, 706, 709, 711, 714, 716, 718, - 720, 723, 726, 727, 729, 730, 734, 738, 740, 742, - 749, 750, 757, 758, 766, 767, 768, 775, 776, 783, - 784, 787, 789, 793, 797, 798, 799, 802, 804, 805, - 810, 814, 816, 817, 818, 824, 825, 827, 828, 832, - 833, 836, 841, 844, 845, 848, 849, 850, 855, 858, - 859, 861, 865, 866, 873, 877, 878, 884, 885, 889, - 891, 892, 893, 894, 902, 904, 905, 908, 911, 915, - 919, 922, 924, 927, 929, 932, 933, 935, 938, 943, - 945, 947, 949, 950, 952, 953, 956, 958, 961, 962, - 968, 969, 970, 973, 975, 977, 979, 981, 983, 986, - 989, 992, 995, 998, 1001, 1004, 1007, 1011, 1015, 1019, - 1020, 1026, 1028, 1030, 1032, 1033, 1039, 1040, 1044, 1046, - 1048, 1050, 1052, 1054, 1056, 1058, 1060, 1062, 1064, 1066, - 1068, 1070, 1072, 1074, 1076, 1078, 1080, 1082, 1084, 1086, - 1088, 1090, 1092, 1094, 1096, 1098, 1100, 1101, 1105, 1107, - 1109, 1111, 1113, 1116, 1120, 1122, 1124, 1126, 1128, 1130, - 1132, 1135, 1137, 1139, 1141, 1143, 1145, 1147, 1149, 1151, - 1154, 1157, 1158, 1162, 1163, 1168, 1170, 1174, 1179, 1181, - 1183, 1184, 1189, 1192, 1195, 1198, 1199, 1203, 1204, 1209, - 1212, 1213, 1217, 1218, 1223, 1225, 1227, 1229, 1231, 1234, - 1237, 1240, 1243, 1246, 1248, 1250, 1252, 1254, 1256, 1258, - 1260, 1262, 1264, 1266, 1268, 1270, 1272, 1274, 1276, 1278, - 1280, 1282, 1284, 1286, 1288, 1290, 1292, 1294, 1296, 1298, - 1300, 1302, 1304, 1306, 1308, 1310, 1312, 1314, 1316, 1318, - 1320, 1322, 1324, 1327, 1330, 1333, 1334, 1339, 1340, 1342, - 1344, 1347, 1348, 1351, 1352, 1353, 1360, 1361, 1369, 1370, - 1371, 1372, 1382, 1383, 1389, 1390, 1396, 1397, 1398, 1409, - 1410, 1418, 1419, 1420, 1421, 1431, 1438, 1439, 1447, 1448, - 1456, 1457, 1465, 1466, 1474, 1475, 1483, 1484, 1492, 1493, - 1501, 1502, 1510, 1511, 1521, 1522, 1532, 1537, 1542, 1550, - 1551, 1553, 1556, 1559, 1563, 1567, 1569, 1571, 1573, 1575, - 1578, 1581, 1584, 1586, 1588, 1590, 1592, 1594, 1596, 1598, - 1600, 1602, 1604, 1606, 1608, 1610, 1612, 1614, 1616, 1618, - 1620, 1622, 1624, 1626, 1628, 1630, 1632, 1634, 1636, 1638, - 1640, 1642, 1644, 1646, 1648, 1650, 1652, 1654, 1656, 1658, - 1660, 1662, 1664, 1666, 1668, 1670, 1672, 1674, 1676, 1678, - 1680, 1682, 1684, 1686, 1688, 1690, 1692, 1694, 1696, 1698, - 1700, 1702, 1704, 1706, 1708, 1710, 1712, 1714, 1716, 1718, - 1720, 1722, 1724, 1726, 1728, 1730, 1733, 1735, 1737, 1739, - 1740, 1744, 1746, 1748, 1750, 1752, 1754, 1756, 1758, 1760, - 1762, 1764, 1766, 1768, 1770, 1771, 1774, 1776, 1778, 1780, - 1782, 1784, 1786, 1788, 1790, 1792, 1793, 1796, 1797, 1800, - 1802, 1804, 1806, 1808, 1810, 1811, 1816, 1818, 1820, 1821, - 1826, 1827, 1833, 1834, 1839, 1840, 1845, 1846, 1851, 1852, - 1857, 1858, 1861, 1862, 1865, 1867, 1869, 1871, 1873, 1875, - 1877, 1879, 1881, 1883, 1885, 1887, 1889, 1891, 1893, 1895, - 1897, 1899, 1901, 1903, 1905, 1907, 1911, 1915, 1920, 1924, - 1926, 1928 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const short int yyrhs[] = -{ - 158, 0, -1, 159, -1, -1, -1, 159, 160, 367, - 161, -1, 218, -1, 216, -1, 219, -1, 168, -1, - 191, -1, 165, -1, 167, -1, 164, -1, 206, -1, - 289, -1, 192, -1, 170, -1, 239, -1, 162, -1, - 163, -1, 371, -1, 319, 134, -1, 134, -1, 221, - 170, -1, 221, 239, -1, 221, 202, -1, 221, 162, - -1, 221, 219, -1, 41, 43, 428, 425, 134, -1, - 43, 428, 425, 134, -1, 41, 12, 135, 159, 136, - -1, 51, 135, 424, 136, -1, -1, 51, 332, 166, - 135, 159, 136, -1, 51, 332, 137, 321, 134, -1, - 169, -1, 221, 169, -1, 176, 367, 177, 134, -1, - 176, 367, 134, -1, 335, 176, 367, 177, 134, -1, - 171, 333, 291, 134, -1, 335, 171, 333, 291, 134, - -1, -1, 173, 172, 135, 180, 136, -1, -1, 176, - 367, 177, 179, 138, 174, 186, -1, 176, 367, 177, - 179, -1, -1, 176, 367, 138, 175, 186, -1, 176, - 367, -1, 25, -1, 24, -1, 26, -1, 322, 178, - 367, -1, 326, 322, 178, 367, -1, 178, 367, -1, - 331, -1, 327, -1, -1, 3, -1, -1, -1, 180, - 181, 367, 183, -1, 180, 182, 138, -1, 28, -1, - 29, -1, 30, -1, 216, -1, 219, -1, 168, -1, - 191, -1, 185, -1, 206, -1, 289, -1, 192, -1, - 170, -1, 243, -1, 184, -1, 163, -1, 371, -1, - 133, 431, -1, 319, 134, -1, 134, -1, 221, 170, - -1, 221, 243, -1, 221, 184, -1, 221, 219, -1, - 40, 204, -1, 40, 221, 204, -1, 40, 168, -1, - 40, 244, 265, -1, 187, -1, 186, 139, 367, 187, - -1, 319, 233, -1, 36, 189, 319, 233, -1, 190, - 188, 319, 233, -1, -1, 36, -1, -1, 190, -1, - 28, -1, 29, -1, 30, -1, 196, 367, 319, 197, - 134, -1, 196, 367, 134, -1, 335, 196, 367, 319, - 197, 134, -1, 193, 333, 291, 134, -1, 335, 193, - 333, 291, 134, -1, -1, 195, 135, 194, 199, 136, - -1, 196, 367, 319, 197, -1, 196, 367, 197, -1, - 27, -1, 27, 25, -1, 27, 24, -1, -1, -1, - 138, 198, 342, -1, 200, -1, 199, 139, 200, -1, - -1, 331, -1, -1, 331, 137, 201, 399, -1, 341, - 233, 322, 331, 203, 134, -1, 137, 425, -1, 429, - -1, 176, 367, 177, 179, 205, -1, 335, 176, 367, - 177, 179, 205, -1, 176, 367, 205, -1, 335, 176, - 367, 205, -1, 135, 424, 136, 425, 134, -1, 138, - 425, 134, -1, 207, -1, 335, 207, -1, 50, 341, - 215, 209, 134, -1, 50, 171, 333, 208, 134, -1, - 50, 335, 171, 333, 208, 134, -1, 50, 193, 333, - 208, 134, -1, 50, 335, 193, 333, 208, 134, -1, - 210, 209, -1, -1, 209, 139, 210, -1, 295, 215, - -1, 298, -1, 212, -1, -1, -1, 233, 309, 140, - 213, 278, 141, 214, 305, -1, 211, -1, 52, 217, - 134, -1, 319, -1, 49, 319, -1, 322, 254, -1, - 322, 249, -1, 326, 322, 254, -1, 326, 322, 249, - -1, 52, 51, 319, 134, -1, -1, 52, 319, 367, - 137, 220, 341, 296, 134, -1, 43, 142, 414, -1, - -1, 43, 142, 222, 223, 414, -1, 225, -1, -1, - 223, 139, 224, 225, -1, -1, -1, 226, 352, 296, - 227, 235, -1, -1, -1, 228, 234, 296, 229, 235, - -1, -1, -1, -1, 230, 221, 25, 231, 296, 232, - 235, -1, -1, 83, -1, 25, -1, 49, -1, -1, - 236, -1, -1, 137, 237, 238, -1, 410, -1, 238, - 410, -1, 240, 265, -1, 245, 265, -1, 241, 265, - -1, 242, 265, -1, 341, 233, 256, -1, 341, 233, - 322, 256, -1, 322, 270, -1, 335, 322, 270, -1, - 322, 246, -1, 335, 322, 246, -1, 341, 233, 322, - 250, -1, 244, 265, -1, 322, 254, 367, 134, -1, - 335, 322, 254, 367, 134, -1, 341, 233, 256, -1, - 245, -1, 270, -1, 335, 270, -1, 246, -1, 335, - 246, -1, 341, 233, 250, -1, -1, -1, 249, 140, - 247, 278, 141, 367, 248, 257, 262, -1, 255, 341, - -1, -1, 252, 251, 257, 262, -1, -1, 254, 367, - 140, 253, 278, 141, 367, -1, 255, 395, -1, 42, - -1, 268, 257, 262, -1, -1, 257, 258, -1, -1, - 44, 259, 418, -1, 31, -1, 137, 18, -1, 3, - -1, 260, 418, -1, 260, -1, 261, -1, 47, -1, - 137, 54, -1, 137, 55, -1, -1, 263, -1, -1, - 66, 264, 348, -1, 135, 424, 136, -1, 266, -1, - 134, -1, 45, 275, 135, 424, 136, 267, -1, -1, - 267, 46, 431, 135, 424, 136, -1, -1, 320, 367, - 140, 269, 278, 141, 367, -1, -1, -1, 273, 271, - 275, 272, 257, 262, -1, -1, 320, 140, 274, 278, - 141, 367, -1, -1, 138, 276, -1, 277, -1, 276, - 139, 277, -1, 319, 431, 233, -1, -1, -1, 279, - 280, -1, 282, -1, -1, 280, 139, 281, 282, -1, - 280, 139, 83, -1, 83, -1, -1, -1, 283, 341, - 296, 284, 285, -1, -1, 286, -1, -1, 137, 287, - 399, -1, -1, 288, 422, -1, 341, 290, 292, 134, - -1, 298, 285, -1, -1, 294, 292, -1, -1, -1, - 292, 139, 293, 294, -1, 295, 290, -1, -1, 360, - -1, 233, 308, 302, -1, -1, 300, 367, 306, 141, - 297, 302, -1, 233, 309, 311, -1, -1, 300, 307, - 141, 299, 302, -1, -1, 10, 301, 365, -1, 11, - -1, -1, -1, -1, 140, 303, 278, 141, 367, 304, - 305, -1, 312, -1, -1, 305, 33, -1, 305, 31, - -1, 305, 44, 431, -1, 305, 47, 431, -1, 305, - 47, -1, 296, -1, 360, 296, -1, 298, -1, 360, - 298, -1, -1, 309, -1, 320, 367, -1, 320, 367, - 138, 310, -1, 15, -1, 13, -1, 14, -1, -1, - 312, -1, -1, 313, 314, -1, 315, -1, 314, 315, - -1, -1, 143, 316, 317, 144, 367, -1, -1, -1, - 318, 399, -1, 320, -1, 321, -1, 331, -1, 327, - -1, 329, -1, 324, 178, -1, 324, 329, -1, 322, - 320, -1, 326, 320, -1, 326, 321, -1, 325, 326, - -1, 327, 326, -1, 329, 326, -1, 322, 325, 326, - -1, 322, 327, 326, -1, 322, 329, 326, -1, -1, - 322, 43, 323, 327, 326, -1, 145, -1, 332, -1, - 84, -1, -1, 332, 142, 328, 408, 414, -1, -1, - 48, 330, 418, -1, 4, -1, 5, -1, 3, -1, - 9, -1, 8, -1, 6, -1, 7, -1, 22, -1, - 21, -1, 20, -1, 102, -1, 103, -1, 104, -1, - 105, -1, 106, -1, 107, -1, 108, -1, 109, -1, - 110, -1, 111, -1, 101, -1, 3, -1, 5, -1, - 4, -1, 9, -1, 8, -1, 6, -1, 7, -1, - -1, 333, 334, 367, -1, 336, -1, 359, -1, 50, - -1, 40, -1, 336, 367, -1, 335, 336, 367, -1, - 337, -1, 338, -1, 339, -1, 39, -1, 33, -1, - 41, -1, 41, 12, -1, 34, -1, 35, -1, 38, - -1, 36, -1, 37, -1, 31, -1, 32, -1, 339, - -1, 340, 339, -1, 342, 295, -1, -1, 345, 343, - 333, -1, -1, 335, 345, 344, 333, -1, 346, -1, - 176, 367, 177, -1, 196, 367, 319, 367, -1, 357, - -1, 329, -1, -1, 49, 347, 319, 367, -1, 327, - 367, -1, 321, 367, -1, 349, 295, -1, -1, 346, - 350, 333, -1, -1, 335, 346, 351, 333, -1, 353, - 295, -1, -1, 356, 354, 333, -1, -1, 335, 345, - 355, 333, -1, 357, -1, 329, -1, 327, -1, 321, - -1, 24, 319, -1, 26, 319, -1, 196, 319, -1, - 359, 367, -1, 358, 367, -1, 6, -1, 7, -1, - 8, -1, 9, -1, 3, -1, 4, -1, 5, -1, - 22, -1, 20, -1, 21, -1, 102, -1, 103, -1, - 104, -1, 105, -1, 106, -1, 107, -1, 108, -1, - 109, -1, 110, -1, 111, -1, 101, -1, 86, -1, - 87, -1, 88, -1, 89, -1, 90, -1, 95, -1, - 96, -1, 97, -1, 98, -1, 91, -1, 92, -1, - 93, -1, 94, -1, 99, -1, 100, -1, 361, -1, - 362, -1, 366, -1, 366, 361, -1, 146, 367, -1, - 77, 367, -1, -1, 147, 367, 364, 365, -1, -1, - 340, -1, 363, -1, 366, 363, -1, -1, 367, 368, - -1, -1, -1, 23, 369, 404, 370, 144, 144, -1, - -1, 112, 140, 331, 139, 372, 341, 141, -1, -1, - -1, -1, 113, 140, 373, 331, 139, 374, 341, 375, - 141, -1, -1, 114, 140, 376, 331, 141, -1, -1, - 115, 140, 377, 331, 141, -1, -1, -1, 116, 140, - 331, 139, 378, 341, 379, 139, 425, 141, -1, -1, - 117, 140, 331, 139, 380, 341, 141, -1, -1, -1, - -1, 118, 140, 381, 331, 139, 382, 341, 383, 141, - -1, 119, 140, 331, 139, 341, 141, -1, -1, 120, - 140, 331, 139, 384, 341, 141, -1, -1, 124, 140, - 331, 139, 385, 341, 141, -1, -1, 121, 140, 331, - 139, 386, 341, 141, -1, -1, 125, 140, 331, 139, - 387, 341, 141, -1, -1, 122, 140, 331, 139, 388, - 341, 141, -1, -1, 126, 140, 331, 139, 389, 341, - 141, -1, -1, 123, 140, 331, 139, 390, 341, 141, - -1, -1, 127, 140, 331, 139, 391, 341, 141, -1, - -1, 128, 140, 331, 139, 392, 341, 139, 13, 141, - -1, -1, 129, 140, 331, 139, 393, 341, 139, 13, - 141, -1, 130, 140, 331, 141, -1, 131, 140, 331, - 141, -1, 132, 140, 331, 139, 319, 394, 141, -1, - -1, 139, -1, 140, 141, -1, 143, 144, -1, 53, - 143, 144, -1, 54, 143, 144, -1, 142, -1, 148, - -1, 139, -1, 137, -1, 63, 148, -1, 63, 63, - -1, 12, 3, -1, 396, -1, 149, -1, 147, -1, - 150, -1, 151, -1, 152, -1, 153, -1, 145, -1, - 146, -1, 154, -1, 155, -1, 53, -1, 54, -1, - 60, -1, 61, -1, 62, -1, 64, -1, 65, -1, - 66, -1, 69, -1, 70, -1, 71, -1, 72, -1, - 73, -1, 67, -1, 68, -1, 74, -1, 75, -1, - 76, -1, 77, -1, 78, -1, 79, -1, 80, -1, - 81, -1, 82, -1, 50, -1, 49, -1, 25, -1, - 24, -1, 26, -1, 43, -1, 28, -1, 30, -1, - 29, -1, 31, -1, 34, -1, 35, -1, 39, -1, - 38, -1, 36, -1, 37, -1, 48, -1, 55, -1, - 41, -1, 52, -1, 51, -1, 42, -1, 27, -1, - 44, -1, 47, -1, 58, -1, 57, -1, 56, -1, - 59, -1, 15, -1, 13, -1, 14, -1, 16, -1, - 17, -1, 12, -1, 18, -1, 19, -1, 400, -1, - 399, 400, -1, 402, -1, 412, -1, 142, -1, -1, - 148, 401, 403, -1, 63, -1, 403, -1, 84, -1, - 415, -1, 418, -1, 422, -1, 396, -1, 138, -1, - 156, -1, 397, -1, 398, -1, 359, -1, 358, -1, - -1, 404, 406, -1, 402, -1, 142, -1, 148, -1, - 63, -1, 405, -1, 137, -1, 139, -1, 406, -1, - 134, -1, -1, 408, 411, -1, -1, 409, 407, -1, - 412, -1, 402, -1, 410, -1, 137, -1, 139, -1, - -1, 142, 413, 408, 414, -1, 148, -1, 63, -1, - -1, 143, 416, 404, 144, -1, -1, 23, 417, 404, - 144, 144, -1, -1, 140, 419, 404, 141, -1, -1, - 10, 420, 404, 141, -1, -1, 11, 421, 404, 141, - -1, -1, 135, 423, 409, 136, -1, -1, 424, 426, - -1, -1, 425, 427, -1, 427, -1, 134, -1, 428, - -1, 142, -1, 429, -1, 431, -1, 430, -1, 84, - -1, 83, -1, 396, -1, 63, -1, 138, -1, 156, - -1, 148, -1, 137, -1, 139, -1, 397, -1, 398, - -1, 359, -1, 358, -1, 85, -1, 135, 424, 136, - -1, 143, 424, 144, -1, 23, 424, 144, 144, -1, - 432, 424, 141, -1, 140, -1, 10, -1, 11, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = -{ - 0, 1467, 1467, 1469, 1471, 1470, 1481, 1482, 1483, 1484, - 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, - 1495, 1496, 1497, 1498, 1501, 1502, 1503, 1504, 1505, 1508, - 1509, 1516, 1523, 1524, 1524, 1528, 1535, 1536, 1539, 1540, - 1541, 1544, 1545, 1548, 1548, 1563, 1562, 1568, 1574, 1573, - 1578, 1584, 1585, 1586, 1589, 1591, 1593, 1596, 1597, 1600, - 1601, 1603, 1605, 1604, 1613, 1617, 1618, 1619, 1622, 1623, - 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, 1633, - 1634, 1635, 1636, 1637, 1640, 1641, 1642, 1643, 1646, 1647, - 1648, 1649, 1652, 1653, 1656, 1658, 1661, 1666, 1667, 1670, - 1671, 1674, 1675, 1676, 1687, 1688, 1689, 1693, 1694, 1698, - 1698, 1711, 1717, 1725, 1726, 1727, 1730, 1731, 1731, 1735, - 1736, 1738, 1739, 1740, 1740, 1748, 1752, 1753, 1756, 1758, - 1760, 1761, 1764, 1765, 1773, 1774, 1777, 1778, 1780, 1782, - 1784, 1788, 1790, 1791, 1794, 1797, 1798, 1801, 1802, 1801, - 1806, 1840, 1843, 1844, 1845, 1847, 1849, 1851, 1855, 1858, - 1858, 1889, 1892, 1891, 1909, 1911, 1910, 1915, 1917, 1915, - 1919, 1921, 1919, 1923, 1924, 1926, 1923, 1937, 1938, 1941, - 1942, 1944, 1945, 1948, 1948, 1958, 1959, 1967, 1968, 1969, - 1970, 1973, 1976, 1977, 1978, 1981, 1982, 1983, 1986, 1987, - 1988, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2004, 2009, - 2003, 2021, 2025, 2025, 2037, 2036, 2045, 2049, 2052, 2061, - 2062, 2065, 2065, 2066, 2067, 2073, 2078, 2079, 2080, 2083, - 2086, 2087, 2089, 2090, 2093, 2093, 2101, 2102, 2103, 2106, - 2108, 2109, 2113, 2112, 2125, 2126, 2125, 2145, 2145, 2149, - 2150, 2153, 2154, 2157, 2163, 2164, 2164, 2167, 2168, 2168, - 2170, 2172, 2176, 2178, 2176, 2202, 2203, 2206, 2206, 2208, - 2208, 2216, 2219, 2278, 2279, 2281, 2282, 2282, 2285, 2288, - 2289, 2293, 2304, 2304, 2323, 2325, 2325, 2343, 2343, 2345, - 2349, 2350, 2351, 2350, 2356, 2358, 2359, 2360, 2361, 2362, - 2363, 2366, 2367, 2371, 2372, 2376, 2377, 2380, 2381, 2385, - 2386, 2387, 2390, 2391, 2394, 2394, 2397, 2398, 2401, 2401, - 2405, 2406, 2406, 2413, 2414, 2417, 2418, 2419, 2420, 2421, - 2424, 2426, 2428, 2432, 2434, 2436, 2438, 2440, 2442, 2444, - 2444, 2449, 2452, 2455, 2458, 2458, 2466, 2466, 2475, 2476, - 2477, 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 2486, - 2487, 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2502, - 2503, 2504, 2505, 2506, 2507, 2508, 2514, 2515, 2518, 2519, - 2521, 2522, 2525, 2526, 2529, 2530, 2531, 2532, 2535, 2536, - 2537, 2538, 2539, 2543, 2544, 2545, 2548, 2549, 2552, 2553, - 2561, 2564, 2564, 2566, 2566, 2570, 2571, 2573, 2577, 2578, - 2580, 2580, 2582, 2584, 2588, 2591, 2591, 2593, 2593, 2597, - 2600, 2600, 2602, 2602, 2606, 2607, 2609, 2611, 2613, 2615, - 2617, 2621, 2622, 2625, 2626, 2627, 2628, 2629, 2630, 2631, - 2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639, 2640, 2641, - 2642, 2643, 2644, 2645, 2648, 2649, 2650, 2651, 2652, 2653, - 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661, 2662, 2682, - 2683, 2684, 2685, 2688, 2692, 2696, 2696, 2700, 2701, 2716, - 2717, 2733, 2734, 2737, 2737, 2737, 2744, 2744, 2754, 2755, - 2755, 2754, 2764, 2764, 2774, 2774, 2783, 2783, 2783, 2816, - 2815, 2826, 2827, 2827, 2826, 2836, 2854, 2854, 2859, 2859, - 2864, 2864, 2869, 2869, 2874, 2874, 2879, 2879, 2884, 2884, - 2889, 2889, 2894, 2894, 2911, 2911, 2925, 2962, 3000, 3037, - 3038, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, - 3054, 3055, 3056, 3059, 3060, 3061, 3062, 3063, 3064, 3065, - 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, - 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, - 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3095, 3096, 3097, - 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, - 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, - 3118, 3119, 3120, 3121, 3122, 3123, 3126, 3127, 3128, 3129, - 3130, 3131, 3132, 3133, 3140, 3141, 3144, 3145, 3146, 3147, - 3147, 3148, 3151, 3152, 3155, 3156, 3157, 3158, 3188, 3188, - 3189, 3190, 3191, 3192, 3215, 3216, 3219, 3220, 3221, 3222, - 3225, 3226, 3227, 3230, 3231, 3233, 3234, 3236, 3237, 3240, - 3241, 3244, 3245, 3246, 3250, 3249, 3263, 3264, 3267, 3267, - 3269, 3269, 3273, 3273, 3275, 3275, 3277, 3277, 3281, 3281, - 3286, 3287, 3289, 3290, 3293, 3294, 3297, 3298, 3301, 3302, - 3303, 3304, 3305, 3306, 3307, 3308, 3308, 3308, 3308, 3308, - 3309, 3310, 3311, 3312, 3313, 3316, 3319, 3320, 3323, 3326, - 3326, 3326 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "ID", "VTK_ID", "QT_ID", "StdString", - "UnicodeString", "OSTREAM", "ISTREAM", "LP", "LA", "STRING_LITERAL", - "INT_LITERAL", "HEX_LITERAL", "OCT_LITERAL", "FLOAT_LITERAL", - "CHAR_LITERAL", "ZERO", "NULLPTR", "SSIZE_T", "SIZE_T", "NULLPTR_T", - "BEGIN_ATTRIB", "STRUCT", "CLASS", "UNION", "ENUM", "PUBLIC", "PRIVATE", - "PROTECTED", "CONST", "VOLATILE", "MUTABLE", "STATIC", "THREAD_LOCAL", - "VIRTUAL", "EXPLICIT", "INLINE", "CONSTEXPR", "FRIEND", "EXTERN", - "OPERATOR", "TEMPLATE", "THROW", "TRY", "CATCH", "NOEXCEPT", "DECLTYPE", - "TYPENAME", "TYPEDEF", "NAMESPACE", "USING", "NEW", "DELETE", "DEFAULT", - "STATIC_CAST", "DYNAMIC_CAST", "CONST_CAST", "REINTERPRET_CAST", - "OP_LSHIFT_EQ", "OP_RSHIFT_EQ", "OP_LSHIFT", "OP_RSHIFT_A", - "OP_DOT_POINTER", "OP_ARROW_POINTER", "OP_ARROW", "OP_INCR", "OP_DECR", - "OP_PLUS_EQ", "OP_MINUS_EQ", "OP_TIMES_EQ", "OP_DIVIDE_EQ", - "OP_REMAINDER_EQ", "OP_AND_EQ", "OP_OR_EQ", "OP_XOR_EQ", "OP_LOGIC_AND", - "OP_LOGIC_OR", "OP_LOGIC_EQ", "OP_LOGIC_NEQ", "OP_LOGIC_LEQ", - "OP_LOGIC_GEQ", "ELLIPSIS", "DOUBLE_COLON", "OTHER", "AUTO", "VOID", - "BOOL", "FLOAT", "DOUBLE", "INT", "SHORT", "LONG", "INT64__", "CHAR", - "CHAR16_T", "CHAR32_T", "WCHAR_T", "SIGNED", "UNSIGNED", "IdType", - "TypeInt8", "TypeUInt8", "TypeInt16", "TypeUInt16", "TypeInt32", - "TypeUInt32", "TypeInt64", "TypeUInt64", "TypeFloat32", "TypeFloat64", - "SetMacro", "GetMacro", "SetStringMacro", "GetStringMacro", - "SetClampMacro", "SetObjectMacro", "GetObjectMacro", "BooleanMacro", - "SetVector2Macro", "SetVector3Macro", "SetVector4Macro", - "SetVector6Macro", "GetVector2Macro", "GetVector3Macro", - "GetVector4Macro", "GetVector6Macro", "SetVectorMacro", "GetVectorMacro", - "ViewportCoordinateMacro", "WorldCoordinateMacro", "TypeMacro", - "VTK_BYTE_SWAP_DECL", "';'", "'{'", "'}'", "'='", "':'", "','", "'('", - "')'", "'<'", "'['", "']'", "'~'", "'&'", "'*'", "'>'", "'%'", "'/'", - "'-'", "'+'", "'!'", "'|'", "'^'", "'.'", "$accept", "translation_unit", - "opt_declaration_seq", "$@1", "declaration", "template_declaration", - "explicit_instantiation", "linkage_specification", - "namespace_definition", "$@2", "namespace_alias_definition", - "forward_declaration", "simple_forward_declaration", "class_definition", - "class_specifier", "$@3", "class_head", "$@4", "$@5", "class_key", - "class_head_name", "class_name", "opt_final", "member_specification", - "$@6", "member_access_specifier", "member_declaration", - "template_member_declaration", "friend_declaration", - "base_specifier_list", "base_specifier", "opt_virtual", - "opt_access_specifier", "access_specifier", "opaque_enum_declaration", - "enum_definition", "enum_specifier", "$@7", "enum_head", "enum_key", - "opt_enum_base", "$@8", "enumerator_list", "enumerator_definition", - "$@9", "nested_variable_initialization", "ignored_initializer", - "ignored_class", "ignored_class_body", "typedef_declaration", - "basic_typedef_declaration", "typedef_declarator_list", - "typedef_declarator_list_cont", "typedef_declarator", - "typedef_direct_declarator", "function_direct_declarator", "$@10", - "$@11", "typedef_declarator_id", "using_declaration", "using_id", - "using_directive", "alias_declaration", "$@12", "template_head", "$@13", - "template_parameter_list", "$@14", "template_parameter", "$@15", "$@16", - "$@17", "$@18", "$@19", "$@20", "$@21", "opt_ellipsis", - "class_or_typename", "opt_template_parameter_initializer", - "template_parameter_initializer", "$@22", "template_parameter_value", - "function_definition", "function_declaration", - "nested_method_declaration", "nested_operator_declaration", - "method_definition", "method_declaration", "operator_declaration", - "conversion_function", "$@23", "$@24", "conversion_function_id", - "operator_function_nr", "$@25", "operator_function_sig", "$@26", - "operator_function_id", "operator_sig", "function_nr", - "function_trailer_clause", "function_trailer", "$@27", "noexcept_sig", - "function_body_as_trailer", "opt_trailing_return_type", - "trailing_return_type", "$@28", "function_body", "function_try_block", - "handler_seq", "function_sig", "$@29", "structor_declaration", "$@30", - "$@31", "structor_sig", "$@32", "opt_ctor_initializer", - "mem_initializer_list", "mem_initializer", - "parameter_declaration_clause", "$@33", "parameter_list", "$@34", - "parameter_declaration", "$@35", "$@36", "opt_initializer", - "initializer", "$@37", "$@38", "variable_declaration", - "init_declarator_id", "opt_declarator_list", "declarator_list_cont", - "$@39", "init_declarator", "opt_ptr_operator_seq", - "direct_abstract_declarator", "$@40", "direct_declarator", "$@41", - "lp_or_la", "$@42", "opt_array_or_parameters", "$@43", "$@44", - "function_qualifiers", "abstract_declarator", "declarator", - "opt_declarator_id", "declarator_id", "bitfield_size", - "opt_array_decorator_seq", "array_decorator_seq", "$@45", - "array_decorator_seq_impl", "array_decorator", "$@46", - "array_size_specifier", "$@47", "id_expression", "unqualified_id", - "qualified_id", "nested_name_specifier", "$@48", "tilde_sig", - "identifier_sig", "scope_operator_sig", "template_id", "$@49", - "decltype_specifier", "$@50", "simple_id", "identifier", - "opt_decl_specifier_seq", "decl_specifier2", "decl_specifier_seq", - "decl_specifier", "storage_class_specifier", "function_specifier", - "cv_qualifier", "cv_qualifier_seq", "store_type", "store_type_specifier", - "$@51", "$@52", "type_specifier", "trailing_type_specifier", "$@53", - "trailing_type_specifier_seq", "trailing_type_specifier_seq2", "$@54", - "$@55", "tparam_type", "tparam_type_specifier2", "$@56", "$@57", - "tparam_type_specifier", "simple_type_specifier", "type_name", - "primitive_type", "ptr_operator_seq", "reference", "rvalue_reference", - "pointer", "$@58", "ptr_cv_qualifier_seq", "pointer_seq", - "attribute_specifier_seq", "attribute_specifier", "$@59", "$@60", - "declaration_macro", "$@61", "$@62", "$@63", "$@64", "$@65", "$@66", - "$@67", "$@68", "$@69", "$@70", "$@71", "$@72", "$@73", "$@74", "$@75", - "$@76", "$@77", "$@78", "$@79", "$@80", "$@81", "$@82", "opt_comma", - "operator_id", "operator_id_no_delim", "keyword", "literal", - "constant_expression", "constant_expression_item", "$@83", - "common_bracket_item", "common_bracket_item_no_scope_operator", - "any_bracket_contents", "bracket_pitem", "any_bracket_item", - "braces_item", "angle_bracket_contents", "braces_contents", - "angle_bracket_pitem", "angle_bracket_item", "angle_brackets_sig", - "$@84", "right_angle_bracket", "brackets_sig", "$@85", "$@86", - "parentheses_sig", "$@87", "$@88", "$@89", "braces_sig", "$@90", - "ignored_items", "ignored_expression", "ignored_item", - "ignored_item_no_semi", "ignored_item_no_angle", "ignored_braces", - "ignored_brackets", "ignored_parentheses", "ignored_left_parenthesis", 0 -}; -#endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned short int yyr1[] = -{ - 0, 157, 158, 159, 160, 159, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 162, 162, 162, 162, 162, 163, - 163, 164, 165, 166, 165, 167, 168, 168, 169, 169, - 169, 170, 170, 172, 171, 174, 173, 173, 175, 173, - 173, 176, 176, 176, 177, 177, 177, 178, 178, 179, - 179, 180, 181, 180, 180, 182, 182, 182, 183, 183, - 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, - 183, 183, 183, 183, 184, 184, 184, 184, 185, 185, - 185, 185, 186, 186, 187, 187, 187, 188, 188, 189, - 189, 190, 190, 190, 191, 191, 191, 192, 192, 194, - 193, 195, 195, 196, 196, 196, 197, 198, 197, 199, - 199, 200, 200, 201, 200, 202, 203, 203, 204, 204, - 204, 204, 205, 205, 206, 206, 207, 207, 207, 207, - 207, 208, 209, 209, 210, 211, 211, 213, 214, 212, - 215, 216, 217, 217, 217, 217, 217, 217, 218, 220, - 219, 221, 222, 221, 223, 224, 223, 226, 227, 225, - 228, 229, 225, 230, 231, 232, 225, 233, 233, 234, - 234, 235, 235, 237, 236, 238, 238, 239, 239, 239, - 239, 240, 241, 241, 241, 242, 242, 242, 243, 243, - 243, 244, 244, 244, 244, 245, 245, 245, 247, 248, - 246, 249, 251, 250, 253, 252, 254, 255, 256, 257, - 257, 259, 258, 258, 258, 258, 258, 258, 258, 260, - 261, 261, 262, 262, 264, 263, 265, 265, 265, 266, - 267, 267, 269, 268, 271, 272, 270, 274, 273, 275, - 275, 276, 276, 277, 278, 279, 278, 280, 281, 280, - 280, 280, 283, 284, 282, 285, 285, 287, 286, 288, - 286, 289, 290, 291, 291, 292, 293, 292, 294, 295, - 295, 296, 297, 296, 298, 299, 298, 301, 300, 300, - 302, 303, 304, 302, 302, 305, 305, 305, 305, 305, - 305, 306, 306, 307, 307, 308, 308, 309, 309, 310, - 310, 310, 311, 311, 313, 312, 314, 314, 316, 315, - 317, 318, 317, 319, 319, 320, 320, 320, 320, 320, - 321, 321, 321, 322, 322, 322, 322, 322, 322, 323, - 322, 324, 325, 326, 328, 327, 330, 329, 331, 331, - 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, - 331, 331, 331, 331, 331, 331, 331, 331, 331, 332, - 332, 332, 332, 332, 332, 332, 333, 333, 334, 334, - 334, 334, 335, 335, 336, 336, 336, 336, 337, 337, - 337, 337, 337, 338, 338, 338, 339, 339, 340, 340, - 341, 343, 342, 344, 342, 345, 345, 345, 346, 346, - 347, 346, 346, 346, 348, 350, 349, 351, 349, 352, - 354, 353, 355, 353, 356, 356, 356, 356, 356, 356, - 356, 357, 357, 358, 358, 358, 358, 358, 358, 358, - 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, - 358, 358, 358, 358, 359, 359, 359, 359, 359, 359, - 359, 359, 359, 359, 359, 359, 359, 359, 359, 360, - 360, 360, 360, 361, 362, 364, 363, 365, 365, 366, - 366, 367, 367, 369, 370, 368, 372, 371, 373, 374, - 375, 371, 376, 371, 377, 371, 378, 379, 371, 380, - 371, 381, 382, 383, 371, 371, 384, 371, 385, 371, - 386, 371, 387, 371, 388, 371, 389, 371, 390, 371, - 391, 371, 392, 371, 393, 371, 371, 371, 371, 394, - 394, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 396, 396, 396, 396, 396, 396, 396, - 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, - 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, - 396, 396, 396, 396, 396, 396, 396, 397, 397, 397, - 397, 397, 397, 397, 397, 397, 397, 397, 397, 397, - 397, 397, 397, 397, 397, 397, 397, 397, 397, 397, - 397, 397, 397, 397, 397, 397, 398, 398, 398, 398, - 398, 398, 398, 398, 399, 399, 400, 400, 400, 401, - 400, 400, 402, 402, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 404, 404, 405, 405, 405, 405, - 406, 406, 406, 407, 407, 408, 408, 409, 409, 410, - 410, 411, 411, 411, 413, 412, 414, 414, 416, 415, - 417, 415, 419, 418, 420, 418, 421, 418, 423, 422, - 424, 424, 425, 425, 426, 426, 427, 427, 428, 428, - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - 428, 428, 428, 428, 428, 429, 430, 430, 431, 432, - 432, 432 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = -{ - 0, 2, 1, 0, 0, 4, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 1, 2, 2, 2, 2, 2, 5, - 4, 5, 4, 0, 6, 5, 1, 2, 4, 3, - 5, 4, 5, 0, 5, 0, 7, 4, 0, 5, - 2, 1, 1, 1, 3, 4, 2, 1, 1, 0, - 1, 0, 0, 4, 3, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 2, 1, 2, 2, 2, 2, 2, 3, - 2, 3, 1, 4, 2, 4, 4, 0, 1, 0, - 1, 1, 1, 1, 5, 3, 6, 4, 5, 0, - 5, 4, 3, 1, 2, 2, 0, 0, 3, 1, - 3, 0, 1, 0, 4, 6, 2, 1, 5, 6, - 3, 4, 5, 3, 1, 2, 5, 5, 6, 5, - 6, 2, 0, 3, 2, 1, 1, 0, 0, 8, - 1, 3, 1, 2, 2, 2, 3, 3, 4, 0, - 8, 3, 0, 5, 1, 0, 4, 0, 0, 5, - 0, 0, 5, 0, 0, 0, 7, 0, 1, 1, - 1, 0, 1, 0, 3, 1, 2, 2, 2, 2, - 2, 3, 4, 2, 3, 2, 3, 4, 2, 4, - 5, 3, 1, 1, 2, 1, 2, 3, 0, 0, - 9, 2, 0, 4, 0, 7, 2, 1, 3, 0, - 2, 0, 3, 1, 2, 1, 2, 1, 1, 1, - 2, 2, 0, 1, 0, 3, 3, 1, 1, 6, - 0, 6, 0, 7, 0, 0, 6, 0, 6, 0, - 2, 1, 3, 3, 0, 0, 2, 1, 0, 4, - 3, 1, 0, 0, 5, 0, 1, 0, 3, 0, - 2, 4, 2, 0, 2, 0, 0, 4, 2, 0, - 1, 3, 0, 6, 3, 0, 5, 0, 3, 1, - 0, 0, 0, 7, 1, 0, 2, 2, 3, 3, - 2, 1, 2, 1, 2, 0, 1, 2, 4, 1, - 1, 1, 0, 1, 0, 2, 1, 2, 0, 5, - 0, 0, 2, 1, 1, 1, 1, 1, 2, 2, - 2, 2, 2, 2, 2, 2, 3, 3, 3, 0, - 5, 1, 1, 1, 0, 5, 0, 3, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 3, 1, 1, - 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, - 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 2, 0, 3, 0, 4, 1, 3, 4, 1, 1, - 0, 4, 2, 2, 2, 0, 3, 0, 4, 2, - 0, 3, 0, 4, 1, 1, 1, 1, 2, 2, - 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 2, 0, 4, 0, 1, 1, - 2, 0, 2, 0, 0, 6, 0, 7, 0, 0, - 0, 9, 0, 5, 0, 5, 0, 0, 10, 0, - 7, 0, 0, 0, 9, 6, 0, 7, 0, 7, - 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, - 0, 7, 0, 9, 0, 9, 4, 4, 7, 0, - 1, 2, 2, 3, 3, 1, 1, 1, 1, 2, - 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 2, 1, 1, 1, 0, - 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 2, 0, 2, 1, - 1, 1, 1, 1, 0, 4, 1, 1, 0, 4, - 0, 5, 0, 4, 0, 4, 0, 4, 0, 4, - 0, 2, 0, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 3, 4, 3, 1, - 1, 1 -}; - -/* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none). */ -static const unsigned char yydprec[] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 -}; - -/* YYMERGER[RULE-NUM] -- Index of merging function for rule #RULE-NUM. */ -static const unsigned char yymerger[] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 -}; - -/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE - doesn't specify something else to do. Zero means the default is an - error. */ -static const unsigned short int yydefact[] = -{ - 3, 0, 4, 1, 481, 0, 437, 438, 439, 433, - 434, 435, 436, 441, 442, 440, 483, 52, 51, 53, - 113, 396, 397, 388, 391, 392, 394, 395, 393, 387, - 389, 217, 0, 346, 410, 0, 0, 0, 343, 454, - 455, 456, 457, 458, 463, 464, 465, 466, 459, 460, - 461, 462, 467, 468, 453, 443, 444, 445, 446, 447, - 448, 449, 450, 451, 452, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 23, 341, 5, 19, - 20, 13, 11, 12, 9, 36, 17, 376, 43, 481, - 10, 16, 376, 0, 481, 14, 134, 7, 6, 8, - 0, 18, 0, 0, 0, 0, 205, 0, 0, 15, - 0, 323, 481, 0, 0, 0, 0, 481, 409, 325, - 342, 0, 481, 384, 385, 386, 177, 279, 401, 405, - 408, 481, 481, 482, 21, 634, 115, 114, 390, 0, - 437, 438, 439, 433, 434, 435, 436, 700, 701, 611, - 607, 608, 606, 609, 610, 612, 613, 441, 442, 440, - 670, 580, 579, 581, 599, 583, 585, 584, 586, 587, - 588, 591, 592, 590, 589, 595, 598, 582, 600, 601, - 593, 578, 577, 597, 596, 553, 554, 594, 604, 603, - 602, 605, 555, 556, 557, 684, 558, 559, 560, 566, - 567, 561, 562, 563, 564, 565, 568, 569, 570, 571, - 572, 573, 574, 575, 576, 682, 681, 694, 453, 443, - 444, 445, 446, 447, 448, 449, 450, 451, 452, 670, - 688, 685, 689, 699, 162, 670, 549, 550, 544, 687, - 543, 545, 546, 547, 548, 551, 552, 686, 693, 692, - 683, 690, 691, 672, 678, 680, 679, 670, 0, 0, - 437, 438, 439, 433, 434, 435, 436, 389, 376, 481, - 376, 481, 481, 0, 481, 409, 0, 177, 369, 371, - 370, 374, 375, 373, 372, 670, 33, 350, 348, 349, - 353, 354, 352, 351, 357, 356, 355, 0, 0, 368, - 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - 0, 481, 324, 0, 0, 326, 327, 0, 488, 492, - 494, 0, 0, 501, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 279, 0, - 50, 279, 109, 116, 0, 0, 27, 37, 24, 481, - 26, 28, 0, 25, 0, 177, 249, 238, 670, 187, - 237, 189, 190, 188, 208, 481, 0, 211, 22, 413, - 339, 195, 193, 244, 330, 0, 326, 327, 328, 58, - 329, 57, 0, 333, 331, 332, 334, 412, 335, 344, - 376, 481, 376, 481, 135, 206, 0, 481, 403, 382, - 287, 289, 178, 0, 275, 265, 177, 481, 481, 481, - 400, 280, 469, 470, 479, 471, 376, 432, 431, 484, - 3, 672, 0, 0, 657, 656, 167, 161, 0, 0, - 0, 664, 666, 662, 347, 481, 390, 279, 50, 279, - 116, 330, 376, 376, 150, 146, 142, 0, 145, 0, - 0, 0, 153, 0, 151, 0, 155, 154, 0, 0, - 350, 348, 349, 353, 354, 352, 351, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 381, 380, - 0, 275, 177, 481, 378, 379, 61, 39, 48, 406, - 481, 0, 0, 58, 0, 0, 121, 105, 117, 112, - 481, 481, 0, 0, 0, 0, 0, 0, 255, 0, - 0, 249, 247, 336, 337, 338, 645, 279, 50, 279, - 116, 196, 194, 383, 376, 477, 207, 212, 481, 0, - 191, 219, 312, 481, 0, 0, 267, 272, 266, 0, - 0, 303, 0, 177, 474, 473, 475, 472, 480, 402, - 660, 639, 623, 668, 641, 628, 642, 637, 658, 638, - 629, 633, 632, 0, 627, 630, 631, 636, 622, 640, - 635, 624, 625, 626, 4, 0, 675, 677, 0, 671, - 674, 676, 695, 0, 164, 0, 0, 0, 696, 30, - 673, 698, 634, 634, 634, 411, 0, 142, 177, 406, - 0, 481, 279, 279, 0, 312, 481, 326, 327, 32, - 0, 0, 3, 158, 159, 0, 553, 554, 0, 538, - 537, 0, 535, 0, 536, 216, 542, 157, 156, 486, - 0, 0, 0, 496, 499, 0, 0, 506, 510, 514, - 518, 508, 512, 516, 520, 522, 524, 526, 527, 0, - 41, 274, 278, 377, 62, 0, 60, 38, 47, 56, - 481, 58, 0, 0, 107, 0, 119, 122, 0, 111, - 407, 481, 481, 0, 250, 251, 0, 670, 236, 0, - 262, 406, 0, 245, 255, 0, 0, 406, 0, 481, - 404, 398, 478, 288, 219, 0, 232, 284, 313, 0, - 307, 197, 192, 271, 276, 0, 270, 285, 304, 477, - 634, 647, 634, 0, 31, 29, 697, 165, 163, 0, - 0, 0, 427, 426, 425, 0, 177, 279, 420, 424, - 179, 180, 177, 0, 0, 0, 0, 137, 141, 144, - 139, 111, 0, 0, 136, 279, 147, 307, 35, 4, - 0, 541, 0, 0, 540, 539, 531, 532, 0, 489, - 493, 495, 0, 0, 502, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 529, 65, 66, 67, - 44, 481, 0, 101, 102, 103, 99, 49, 92, 97, - 177, 45, 54, 481, 110, 121, 123, 118, 104, 0, - 325, 0, 177, 0, 481, 261, 256, 257, 0, 340, - 219, 0, 652, 653, 654, 650, 651, 646, 649, 345, - 42, 40, 108, 111, 399, 232, 214, 225, 223, 221, - 229, 234, 0, 220, 227, 228, 218, 233, 318, 315, - 316, 0, 242, 279, 621, 618, 619, 268, 614, 616, - 617, 290, 476, 0, 0, 0, 485, 167, 428, 429, - 430, 422, 305, 168, 481, 419, 376, 171, 174, 665, - 667, 663, 138, 140, 143, 255, 34, 177, 533, 534, - 0, 0, 497, 0, 0, 505, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 530, 0, 0, 64, - 0, 100, 481, 98, 0, 94, 0, 55, 120, 0, - 672, 0, 127, 252, 253, 240, 209, 258, 177, 232, - 481, 645, 106, 213, 255, 0, 0, 224, 230, 231, - 226, 321, 317, 310, 311, 309, 308, 255, 277, 0, - 615, 291, 286, 294, 0, 644, 669, 643, 648, 659, - 166, 376, 290, 306, 181, 177, 421, 181, 177, 0, - 0, 487, 490, 0, 500, 503, 507, 511, 515, 519, - 509, 513, 517, 521, 0, 0, 528, 0, 389, 0, - 0, 83, 79, 70, 76, 63, 78, 72, 71, 75, - 73, 68, 69, 0, 77, 0, 202, 203, 74, 0, - 323, 0, 0, 177, 80, 177, 0, 177, 46, 124, - 126, 125, 239, 219, 260, 262, 263, 246, 248, 0, - 0, 222, 0, 415, 235, 279, 0, 0, 0, 620, - 255, 661, 423, 281, 183, 169, 182, 301, 0, 177, - 172, 175, 148, 160, 0, 672, 0, 0, 0, 90, - 481, 88, 0, 0, 0, 0, 177, 81, 84, 86, - 87, 0, 85, 0, 198, 82, 481, 204, 0, 0, - 95, 93, 96, 0, 232, 259, 265, 655, 481, 417, - 376, 414, 481, 322, 481, 0, 0, 282, 302, 181, - 295, 491, 0, 504, 523, 525, 0, 481, 89, 0, - 91, 481, 0, 0, 0, 481, 201, 0, 210, 264, - 215, 376, 416, 319, 243, 481, 184, 185, 290, 176, - 149, 498, 670, 672, 406, 130, 0, 481, 0, 199, - 0, 670, 418, 292, 186, 283, 297, 296, 0, 300, - 0, 0, 0, 59, 0, 406, 131, 200, 0, 295, - 298, 299, 672, 133, 128, 59, 0, 241, 293, 0, - 129, 132 -}; - -/* YYPDEFGOTO[NTERM-NUM]. */ -static const short int yydefgoto[] = -{ - -1, 1, 2, 4, 88, 356, 90, 91, 92, 461, - 93, 94, 95, 358, 97, 349, 98, 926, 675, 375, - 509, 510, 678, 674, 801, 802, 1005, 1079, 1007, 807, - 808, 924, 920, 809, 100, 101, 102, 516, 103, 359, - 519, 688, 685, 686, 929, 360, 931, 1071, 1145, 105, - 106, 616, 624, 617, 454, 455, 895, 1110, 456, 107, - 320, 108, 361, 770, 362, 436, 603, 877, 604, 605, - 974, 606, 977, 607, 978, 1109, 882, 752, 1055, 1056, - 1106, 1136, 363, 112, 113, 114, 1082, 1015, 1016, 116, - 528, 1033, 117, 546, 714, 547, 944, 548, 118, 550, - 716, 853, 945, 854, 855, 856, 857, 946, 369, 370, - 1032, 551, 957, 1017, 531, 830, 383, 704, 526, 694, - 695, 699, 700, 826, 1035, 827, 828, 1096, 557, 558, - 725, 559, 119, 414, 500, 555, 863, 501, 502, 883, - 1138, 415, 871, 416, 545, 962, 1050, 1169, 1140, 1058, - 562, 972, 552, 956, 717, 963, 719, 859, 860, 951, - 1046, 1047, 810, 121, 282, 283, 530, 124, 125, 126, - 284, 536, 285, 268, 129, 130, 348, 503, 376, 132, - 133, 134, 135, 712, 1076, 137, 426, 544, 138, 139, - 269, 1044, 1045, 1100, 1131, 746, 747, 886, 971, 748, - 140, 141, 142, 421, 422, 423, 424, 729, 713, 425, - 690, 143, 145, 583, 144, 778, 478, 901, 1064, 479, - 480, 782, 983, 783, 483, 904, 1066, 786, 790, 787, - 791, 788, 792, 789, 793, 794, 795, 917, 645, 584, - 585, 586, 867, 868, 959, 587, 588, 429, 589, 590, - 968, 705, 874, 836, 837, 870, 941, 437, 591, 732, - 730, 592, 614, 612, 613, 593, 731, 432, 439, 599, - 600, 601, 264, 265, 266, 267 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -1028 -static const short int yypact[] = -{ - -1028, 108, 115, -1028, -1028, 6791, 217, 221, 231, 247, - 250, 288, 291, -71, -29, -12, -1028, -1028, -1028, -1028, - 285, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - 129, -1028, 4328, -1028, -1028, 8663, 173, 7489, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, 148, 150, 192, 246, 269, 273, - 292, 300, 304, 329, 342, -51, -10, 20, 128, 135, - 143, 185, 209, 214, 218, 222, 230, 254, 284, 289, - 299, 306, 314, 326, 354, 358, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, 113, -1028, -1028, -1028, -1028, -1028, -1028, - 8336, -1028, 164, 164, 164, 164, -1028, 375, 8663, -1028, - 123, -1028, 341, 1951, 9036, 437, 7756, 166, 196, -1028, - 7, 8445, -1028, -1028, -1028, -1028, 256, 140, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, 383, 4790, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, 15, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, 55, 7756, - -7, -3, 4, 28, 152, 162, 179, 511, -1028, -1028, - -1028, -1028, -1028, 7778, 437, 437, 8663, 256, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, 395, -7, -3, 4, - 28, 152, 162, 179, -1028, -1028, -1028, 7756, 7756, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - 400, 406, -1028, 1951, 7756, 437, 437, 6747, -1028, -1028, - -1028, 6747, 6747, -1028, 6747, 6747, 6747, 6747, 6747, 6747, - 6747, 6747, 6747, 6747, 6747, 6747, 6747, 6747, 8191, 407, - 8001, 8191, -1028, 7424, 403, 7756, -1028, -1028, -1028, -1028, - -1028, -1028, 8336, -1028, 8554, 463, 409, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, 8663, -1028, -1028, 525, - -1028, -1028, -1028, -1028, 410, 437, 437, 437, -1028, -1028, - -1028, -1028, 7, -1028, -1028, -1028, -1028, 525, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, 1951, -1028, -1028, 525, - -1028, -1028, -1028, 7826, -1028, 158, 74, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, 366, -1028, 525, 525, 5714, - -1028, -1028, 2172, 2326, -1028, -1028, 228, -1028, 2480, 3558, - 2634, -1028, -1028, -1028, -1028, -1028, -1028, 8219, 8110, 8219, - 7598, -1028, -1028, -1028, -1028, -1028, -1028, 7890, -1028, 2788, - 412, 416, -1028, 428, -1028, 57, -1028, -1028, 6638, 1951, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, 425, 6747, 6747, - 6747, 426, 427, 6747, 429, 432, 433, 436, 438, 442, - 443, 445, 447, 448, 449, 450, 452, 451, -1028, -1028, - 460, -1028, 256, -1028, -1028, -1028, -1028, -1028, -1028, 54, - -1028, 9011, 649, 437, 437, 464, 6747, -1028, -1028, -1028, - 206, -1028, 7644, 8554, 7826, 7756, 444, 2942, 461, 8990, - 676, 409, -1028, -1028, -1028, -1028, -1028, 8191, 8110, 8191, - 7598, -1028, -1028, 525, -1028, 499, -1028, -1028, -1028, 1610, - -1028, -1028, 458, -1028, 1951, 122, -1028, -1028, -1028, 468, - 7890, -1028, 467, 256, 525, 525, 525, -1028, -1028, 1417, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, 466, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, 481, 3712, -1028, -1028, 474, -1028, - -1028, -1028, -1028, 181, -1028, 8772, 77, 576, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, 525, 488, -1028, 256, 64, - 489, 189, 8219, 8219, 183, 239, -1028, -1028, -1028, -1028, - 490, 437, -1028, -1028, -1028, 623, 484, 485, 27, -1028, - -1028, 495, -1028, 486, -1028, -1028, -1028, -1028, -1028, -1028, - 492, 496, 497, -1028, -1028, 501, 8663, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, 7756, - -1028, 502, -1028, 525, 67, 7378, -1028, -1028, 504, 525, - -1028, 437, 437, 9011, -1028, 335, -1028, 506, 8663, 510, - 525, -1028, -1028, 1951, 508, -1028, 65, -1028, -1028, 518, - 562, -1028, 437, -1028, 461, 5868, 515, 84, 526, 206, - 1417, -1028, 499, -1028, -1028, 70, 117, -1028, -1028, 519, - 109, -1028, -1028, -1028, -1028, 6176, -1028, -1028, -1028, 499, - -1028, -1028, -1028, 521, -1028, -1028, -1028, -1028, -1028, 7756, - 7756, 7756, -1028, 437, 437, 8663, 256, 140, -1028, -1028, - -1028, -1028, 256, 638, 4944, 5098, 5252, -1028, 527, -1028, - -1028, -1028, 533, 534, -1028, 140, -1028, 78, -1028, 535, - 8663, -1028, 528, 529, -1028, -1028, -1028, -1028, 8663, -1028, - -1028, -1028, 8663, 8663, -1028, 546, 8663, 8663, 8663, 8663, - 8663, 8663, 8663, 8663, 8663, 8663, 530, -1028, -1028, -1028, - -1028, -1028, 536, -1028, -1028, -1028, 382, 537, -1028, 653, - 463, -1028, 525, -1028, -1028, 6747, -1028, -1028, -1028, 83, - 324, 7756, 463, 3096, -1028, -1028, 551, -1028, 8663, -1028, - -1028, 552, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, 560, -1028, 117, -1028, -1028, -1028, -1028, - -1028, -1028, 89, -1028, 55, -1028, -1028, -1028, -1028, 519, - -1028, 514, -1028, 140, -1028, 6022, -1028, 6176, -1028, -1028, - -1028, 345, -1028, 5406, 4482, 5560, -1028, 228, -1028, -1028, - -1028, -1028, 7890, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, 461, -1028, 256, -1028, -1028, - 554, 8663, -1028, 555, 8663, -1028, 557, 559, 561, 563, - 564, 565, 566, 567, 570, 571, -1028, 572, 1787, -1028, - 7756, -1028, -1028, -1028, 7756, -1028, 7378, 525, -1028, 6176, - -1028, 569, -1028, -1028, -1028, -1028, 525, 632, 256, 117, - -1028, -1028, -1028, -1028, 461, 55, 8881, -1028, -1028, -1028, - -1028, 574, -1028, -1028, -1028, -1028, -1028, 461, -1028, 6484, - -1028, -1028, -1028, -1028, 575, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, 345, -1028, 584, 50, 1417, 584, 256, 581, - 589, -1028, -1028, 585, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, 713, 714, -1028, 7038, 226, 7709, - 65, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, 6923, -1028, 164, -1028, -1028, -1028, 595, - 410, 1951, 7153, 256, -1028, 463, 1981, 463, 537, 6176, - 4636, -1028, 684, -1028, -1028, -1028, -1028, -1028, 525, 5868, - 590, -1028, 8881, -1028, -1028, 140, 588, 6176, 592, -1028, - 461, -1028, 1417, -1028, -1028, -1028, -1028, -1028, 598, 256, - -1028, -1028, -1028, -1028, 600, -1028, 602, 604, 606, -1028, - -1028, -1028, 805, 164, 410, 7268, 463, -1028, -1028, -1028, - -1028, 6923, -1028, 7268, -1028, -1028, -1028, -1028, 1951, 7826, - -1028, -1028, -1028, 65, 117, -1028, 158, -1028, -1028, -1028, - -1028, -1028, -1028, 6176, -1028, 607, 6330, -1028, -1028, 584, - -1028, -1028, 3866, -1028, -1028, -1028, 7936, -1028, -1028, 805, - -1028, -1028, 7826, 7268, 90, -1028, -1028, 614, -1028, -1028, - 525, -1028, 1417, 525, 525, -1028, 6330, -1028, 345, -1028, - 434, -1028, -1028, -1028, 95, -1028, 7936, -1028, 8072, -1028, - 93, -1028, 1417, 525, -1028, -1028, -1028, -1028, 65, 65, - 3250, 4020, 373, 56, 8072, 107, -1028, -1028, 3404, -1028, - -1028, -1028, -1028, -1028, -1028, 59, 373, -1028, 434, 4174, - -1028, -1028 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const short int yypgoto[] = -{ - -1028, -1028, -401, -1028, -1028, 745, -167, -1028, -1028, -1028, - -1028, -847, -99, -2, -31, -1028, -1028, -1028, -1028, 21, - -404, -107, -828, -1028, -1028, -1028, -1028, -166, -1028, -173, - -272, -1028, -1028, -49, -163, -159, -27, -1028, -1028, 11, - -483, -1028, -1028, -54, -1028, -1028, -1028, -309, -771, -156, - -119, -409, 147, 0, -1028, -1028, -1028, -1028, 149, -152, - -1028, -1028, 18, -1028, 25, -1028, -1028, -1028, -109, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, 405, -1028, -923, -1028, - -1028, -1028, 766, -1028, -1028, -1028, -145, -218, 26, -121, - -1028, -1028, -268, -502, -1028, -1028, -1028, -310, -296, -526, - -690, -1028, -1028, -1028, -1028, -802, -1028, -1028, -80, -1028, - -1028, -1028, -1028, -117, -1028, -1028, -1028, -1028, 249, -1028, - -40, -684, -1028, -1028, -1028, -253, -1028, -1028, -313, -1028, - -1028, -1028, -131, 287, -302, 293, -1028, -73, -136, -713, - -1028, -251, -1028, -699, -1028, -930, -1028, -1028, -374, -1028, - -1028, -1028, -432, -1028, -1028, -478, -1028, -1028, -63, -1028, - -1028, -1028, 1119, 1082, 1110, 14, -1028, -1028, -32, 700, - -5, -1028, 45, -1028, 930, -21, 397, -1028, 94, 998, - -1028, -1028, -497, -1028, 943, 110, -1028, -1028, -124, -876, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - 195, 51, 440, -402, 376, -1028, 377, -1028, 75, -1028, - 493, -1028, -1028, -1028, -115, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, - -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, -1028, 9, - 121, 174, -835, -822, -1028, -633, -151, -458, -1028, -65, - -1028, -130, -1028, -1027, -1028, -683, -1028, -582, -1028, -1028, - -1028, -259, -1028, -1028, -1028, 251, -1028, -181, -426, -1028, - -421, 36, -8, -1028, -658, -1028 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -655 -static const short int yytable[] = -{ - 127, 420, 381, 96, 278, 595, 382, 408, 280, 444, - 405, 357, 404, 467, 563, 296, 104, 388, 610, 123, - 831, 738, 838, 109, 845, 625, 99, 468, 722, 594, - 110, 115, 325, 371, 372, 373, 458, 689, 822, 887, - 620, 260, 1053, 943, 619, 960, 281, 884, 711, 515, - 128, 323, 721, 884, 1060, 466, 279, 676, 433, 676, - 410, 411, 676, -357, 438, 441, 442, 676, 263, -357, - 1043, 1003, 835, 16, 718, 157, 158, -369, 434, 1137, - 16, -371, 326, 258, 410, 411, 440, 676, -370, 327, - 774, 385, 869, 16, 1029, 797, 798, 799, 676, 131, - 400, 16, 750, 392, 402, -356, 16, 947, 3, 1154, - 676, -356, -374, 16, 459, -2, 16, 549, 386, 389, - 847, 325, -355, 839, 123, 701, 751, 417, -355, 286, - 328, 99, 16, 412, 707, -369, 115, 1037, 761, -371, - 939, 148, 403, 948, 949, 406, -370, 718, 848, 399, - 1069, 417, 401, 261, 754, 755, 756, 412, 260, 648, - 329, 849, 408, 435, 850, 561, 1099, 722, 387, 390, - -374, 326, 149, 468, 610, 775, 288, 289, 290, 291, - 292, 293, 294, 851, 980, 431, 1139, 527, 677, -59, - 677, 721, -59, 841, 634, 443, 418, 419, 884, -59, - 258, 647, -59, 800, 364, 243, 262, 960, 1155, 366, - 846, 979, 1103, 762, 763, 844, 861, 417, 841, -59, - 418, 419, -59, 862, 1149, 1036, 843, 1167, 549, 677, - -59, 769, 711, -59, 869, 706, -375, 708, 446, 884, - 408, 841, -59, 405, 434, -59, -373, 861, 352, 862, - 38, 385, 408, -170, 852, 452, 723, 378, 549, 453, - 1040, 724, 1057, -372, 325, 1061, 410, 411, 330, 149, - 261, -173, 873, 1048, 875, 331, 884, -170, 386, 884, - 38, 960, -368, 332, -358, 541, 418, 419, -368, 542, - -358, 385, 1128, -269, -375, 556, 869, 281, 367, 368, - -326, -369, 325, 325, -373, -371, -326, 279, 295, 146, - 147, 618, 728, 618, 326, -370, 1162, 764, 386, 325, - 737, -372, 765, 262, -116, 333, -359, 518, 387, 435, - -327, -374, -359, 400, -375, 1162, -327, 1176, 469, 412, - -116, -116, 1077, 1094, 518, 513, 1108, 1176, 325, 334, - 325, -350, 326, 326, 335, -348, 838, -350, 336, -369, - 884, -348, 337, -371, 511, -349, 1105, 458, 387, 326, - 338, -349, -373, -370, 385, -372, 123, 1166, 406, 766, - -360, -353, -314, 279, -354, 401, -360, -353, 115, -374, - -354, 1174, -375, 1166, 339, 514, 869, 549, 326, 408, - 326, 386, 405, -361, 680, 1180, 835, -362, 325, -361, - 803, 804, 805, -362, 869, 288, 289, 290, 291, 292, - 293, 294, -352, 838, 340, -351, -363, 554, -352, 341, - -373, -351, -363, -372, -364, 1127, 392, 385, -365, 342, - -364, 260, 260, 513, -365, 325, 343, 260, 260, 260, - 973, 387, 627, 838, 344, 631, 523, 1097, 326, 239, - 33, 930, 511, -366, 386, 1156, 345, 1157, 260, -366, - 869, 814, 259, 835, 815, -324, -367, 646, 1158, 385, - 581, 1159, -367, 258, 258, 961, 618, 618, -314, 258, - 258, 258, 400, 514, 346, 326, 38, 5, 347, 351, - 1170, 1171, 628, 835, 1030, 514, 681, 631, 1142, 392, - 258, 1143, 418, 419, 387, 374, 823, 325, 430, 325, - 325, 38, 385, 446, 513, 702, 683, 953, 954, 955, - 21, 22, 460, 513, 464, 325, 260, 406, 693, 392, - -152, 413, 506, 511, 279, 244, 412, 525, 16, 386, - 532, 632, 511, 261, 261, 627, 682, 514, 646, 261, - 261, 261, 633, 1126, 649, 653, 654, 326, 656, 326, - 326, 657, 658, 1059, 514, 659, 813, 660, 258, 697, - 261, 661, 662, 514, 663, 326, 664, 665, 666, 259, - 669, 667, 350, 668, 670, 950, 1126, 353, 684, 387, - 743, -314, -254, 573, 260, 628, 262, 262, 727, 610, - 733, 885, 262, 262, 262, 379, 741, 734, 736, 354, - 397, 881, 757, 760, 768, 409, 771, 772, 773, 618, - 777, 779, 753, 262, 427, 428, 776, 780, 781, 1112, - 784, 724, 811, 816, 818, 825, 258, 821, 261, 840, - 744, 385, 288, 289, 290, 291, 292, 293, 294, 824, - 842, 385, 858, 888, 325, 876, 765, 892, 893, 916, - 325, 896, 898, 899, 919, 447, 922, 449, 681, 288, - 289, 290, 291, 292, 293, 294, 1041, 905, 386, 923, - 937, 610, 457, 940, 942, 981, 984, 33, 986, 745, - 987, 262, 988, 1031, 989, 990, 991, 992, 993, 994, - 995, 1086, 1144, 996, 326, 1034, 261, 1161, -320, 1051, - 326, 1054, 1062, 1063, 1065, 549, 1067, 1068, 682, 1085, - 1093, 1098, 1102, 1104, 325, 325, 325, 324, 387, 1107, - 610, 1111, 1163, 1113, 1165, 1114, 1179, 1115, 1135, 1151, - 89, 1002, 1006, 1028, 1091, 1008, 581, 921, 610, 1009, - 1175, 928, 1010, 1118, 758, 894, 1011, 759, 970, 262, - 524, 111, 448, 1014, 450, 379, 581, 397, 1125, 1073, - 703, 933, 1095, 1129, 326, 326, 326, 1018, 505, 672, - 958, 505, 549, 549, 671, 1178, 952, 537, 817, 539, - 749, 567, 568, 1024, 872, 581, 581, 581, 1049, 967, - 726, 1039, 932, 0, 465, 0, 325, 0, 0, 0, - 0, 560, 0, 569, 0, 393, 549, 396, 398, 17, - 18, 19, 260, 0, 0, 0, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 0, 277, 0, 0, 622, - 623, 0, 522, 0, 0, 0, 0, 0, 0, 0, - 0, 392, 0, 0, 0, 0, 326, 0, 529, 582, - 0, 0, 259, 259, 258, 0, 0, 627, 259, 259, - 259, 0, 0, 0, 0, 0, 0, 505, 0, 505, - 0, 0, 0, 0, 538, 0, 540, 0, 408, 259, - 543, 405, 0, 404, 0, 1087, 0, 560, 0, 1101, - 564, 565, 566, 127, 357, 325, 1004, 0, 581, 325, - 0, 325, 0, 0, 581, 581, 581, 628, 0, 104, - 0, 0, 1021, 0, 0, 1084, 1012, 0, 615, 99, - 0, 710, 0, 1013, 261, 0, 0, 0, 136, 0, - 0, 408, 0, 0, 405, 0, 0, 0, 1087, 408, - 0, 1160, 405, 128, 0, 326, 1087, 259, 560, 326, - 1168, 326, 0, 357, 0, 0, 0, 505, 287, 505, - 581, 0, 0, 0, 396, 398, 0, 0, 0, 385, - 0, 400, 127, 1120, 325, 402, 673, 262, 0, 408, - 0, 0, 405, 679, 0, 0, 1087, 0, 127, 505, - 581, 1078, 1022, 323, 465, 0, 386, 127, 1070, 0, - 0, 325, 1072, 457, 0, 396, 398, 1021, 0, 0, - 0, 1080, 0, 403, 99, 259, 1088, 0, 1081, 260, - 1042, 715, 128, 401, 326, 0, 720, 0, 0, 0, - 512, 0, 400, 365, 391, 0, 385, 0, 128, 0, - 0, 377, 505, 505, 0, 0, 387, 128, 392, 0, - 127, 326, 0, 0, 0, 0, 127, 0, 127, 1078, - 581, 258, 0, 386, 627, 533, 534, 535, 0, 0, - 581, 1075, 400, 1117, 0, 1021, 1121, 1088, 581, 1080, - 0, 392, 279, 0, 401, 0, 1081, 1083, 0, 0, - 0, 513, 0, 0, 0, 122, 0, 627, 127, 767, - 128, 260, 0, 0, 120, 0, 128, 0, 128, 407, - 511, 0, 0, 387, 628, 0, 0, 1088, 0, 0, - 1147, 513, 0, 513, 279, 582, 0, 322, 512, 0, - 505, 261, 0, 0, 581, 0, 321, 581, 0, 513, - 511, 514, 511, 258, 0, 582, 1119, 628, 128, 260, - 260, 0, 0, 812, 0, 1123, 0, 260, 511, 0, - 0, 0, 0, 0, 0, 819, 0, 581, 260, 0, - 0, 514, 0, 514, 582, 582, 582, 0, 0, 0, - 0, 0, 0, 0, 262, 384, 0, 0, 394, 514, - 0, 258, 258, 396, 398, 925, 0, 0, 0, 258, - 0, 0, 0, 0, 0, 0, 0, 934, 0, 512, - 258, 0, 0, 261, 0, 0, 395, 0, 512, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 477, 0, 0, - 0, 481, 482, 259, 484, 485, 486, 487, 488, 489, - 490, 491, 492, 493, 494, 495, 496, 497, 0, 0, - 391, 261, 261, 976, 407, 0, 262, 0, 0, 261, - 0, 0, 0, 0, 918, 0, 0, 0, 0, 0, - 261, 0, 0, 0, 0, 365, 927, 582, 0, 0, - 0, 0, 0, 582, 582, 582, 0, 936, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 396, 0, 0, 262, 262, 0, 0, 0, 0, - 0, 0, 262, 0, 0, 0, 504, 0, 0, 504, - 0, 0, 0, 262, 0, 0, 0, 0, 0, 0, - 0, 0, 407, 0, 0, 451, 0, 0, 1052, 582, - 0, 0, 0, 0, 407, 0, 0, 975, 391, 322, - 0, 534, 535, 0, 0, 0, 0, 0, 445, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 582, - 0, 0, 829, 0, 0, 451, 394, 0, 650, 651, - 652, 377, 0, 655, 0, 1026, 505, 322, 322, 0, - 0, 0, 0, 0, 0, 0, 462, 463, 1089, 0, - 1090, 0, 1092, 1038, 395, 0, 0, 0, 0, 0, - 0, 391, 0, 396, 398, 504, 687, 504, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 498, 277, 391, - 0, 0, 0, 322, 0, 322, 0, 499, 391, 582, - 259, 0, 520, 0, 521, 0, 0, 0, 0, 582, - 0, 1122, 0, 0, 0, 0, 0, 582, 384, 0, - 0, 0, 505, 0, 0, 553, 0, 1132, 0, 0, - 0, 0, 0, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 0, 0, - 0, 407, 0, 0, 0, 0, 0, 0, 1152, 0, - 0, 0, 0, 0, 0, 504, 0, 504, 0, 626, - 0, 0, 0, 582, 0, 0, 582, 0, 0, 0, - 0, 451, 259, 0, 0, 0, 0, 0, 0, 0, - 322, 0, 0, 1116, 0, 0, 0, 504, 0, 621, - 630, 0, 505, 0, 0, 0, 582, 0, 0, 1124, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1130, 505, 0, 0, 1133, 0, 1134, 0, 785, - 259, 259, 0, 0, 0, 0, 692, 0, 259, 0, - 1146, 0, 0, 391, 1148, 0, 0, 0, 1150, 259, - 504, 504, 635, 820, 0, 0, 0, 0, 1153, 0, - 0, 0, 322, 0, 0, 322, 692, 0, 0, 0, - 1164, 691, 626, 0, 696, 0, 0, 0, 0, 0, - 322, 0, 0, 0, 0, 0, 0, 0, 0, 709, - 0, 0, 0, 636, 637, 0, 0, 0, 0, 0, - 202, 203, 204, 638, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, 0, 0, 0, 0, 0, 0, 324, - 0, 0, 0, 0, 0, 0, 0, 0, 504, 0, - 0, 0, 0, 897, 0, 742, 0, 0, 0, 0, - 0, 900, 0, 0, 0, 902, 903, 0, 0, 906, - 907, 908, 909, 910, 911, 912, 913, 914, 915, 0, - 0, 0, 0, 407, 0, 687, 0, 639, 0, 640, - 641, 0, 642, 643, 0, 246, 247, 248, 644, 250, - 251, 252, 253, 254, 255, 256, 0, 0, 0, 0, - 0, 938, 0, 0, 0, 692, 0, 0, 0, 322, - 0, 0, 0, 0, 0, 322, 0, 0, 796, 0, - 6, 7, 8, 9, 10, 11, 12, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, - 16, 17, 18, 19, 20, 0, 512, 0, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 997, 998, 31, - 32, 0, 0, 0, 0, 33, 34, 35, 0, 999, - 0, 0, 0, 0, 982, 0, 512, 985, 512, 322, - 322, 322, 0, 0, 0, 0, 0, 0, 878, 879, - 880, 1023, 0, 0, 512, 0, 0, 0, 0, 0, - 0, 38, 0, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 1000, 1001, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 322, 87, 0, 0, 0, 0, 0, 0, 0, - 696, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 297, 298, 299, 300, 301, 302, - 303, 0, 0, 0, 626, 0, 0, 0, 0, 0, - 0, 304, 305, 306, 504, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 297, 298, 299, 300, 301, 302, - 303, 0, 0, 31, 380, 0, 0, 0, 0, 33, - 1020, 304, 305, 306, 16, 0, 0, 0, 0, 803, - 804, 805, 0, 0, 0, 0, 0, 806, 0, 0, - 407, 0, 0, 0, 0, 0, 0, 0, 122, 33, - 322, 0, 0, 0, 322, 0, 322, 1019, 0, 1025, - 407, 0, 0, 1027, 0, 0, 391, 0, 0, 0, - 504, 0, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 0, 0, 38, 0, 0, 0, 0, - 0, 0, 0, 407, 0, 0, 391, 0, 391, 1074, - 0, 407, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 0, 391, 1074, 87, 0, 0, 0, - 0, 0, 0, 451, 1074, 0, 0, 0, 0, 322, - 0, 0, 0, 0, 0, 0, 0, 407, 321, 0, - 0, 407, 0, 0, 0, 0, 87, 0, 0, 0, - 504, 0, 0, 0, 0, 0, 322, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 504, 0, 0, 0, 0, 0, 0, 1074, 0, 0, - 0, 0, 0, 1074, 0, 1074, 0, 0, 0, 0, - 451, 553, 0, 0, 0, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 692, 1074, 179, 180, 181, 182, - 183, 184, 0, 185, 186, 187, 188, 0, 0, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 596, 239, 0, 240, - 241, 242, 243, 0, 597, 245, 598, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 0, 0, - 179, 180, 181, 182, 183, 184, 0, 185, 186, 187, - 188, 0, 0, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 596, 239, 602, 240, 241, 242, 243, 0, 597, 245, - 0, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 0, 0, 179, 180, 181, 182, 183, 184, - 0, 185, 186, 187, 188, 0, 0, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 596, 239, 0, 240, 241, 242, - 243, 0, 597, 245, 608, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 0, 0, 179, 180, - 181, 182, 183, 184, 0, 185, 186, 187, 188, 0, - 0, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 596, 239, - 0, 240, 241, 242, 243, 611, 597, 245, 0, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 0, 0, 179, 180, 181, 182, 183, 184, 0, 185, - 186, 187, 188, 0, 0, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 596, 239, 629, 240, 241, 242, 243, 0, - 597, 245, 0, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 0, 0, 179, 180, 181, 182, - 183, 184, 0, 185, 186, 187, 188, 0, 0, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 596, 239, 698, 240, - 241, 242, 243, 0, 597, 245, 0, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 0, 0, - 179, 180, 181, 182, 183, 184, 0, 185, 186, 187, - 188, 0, 0, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 596, 239, 935, 240, 241, 242, 243, 0, 597, 245, - 0, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 0, 0, 179, 180, 181, 182, 183, 184, - 0, 185, 186, 187, 188, 0, 0, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 596, 239, 1172, 240, 241, 242, - 243, 0, 597, 245, 0, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 0, 0, 179, 180, - 181, 182, 183, 184, 0, 185, 186, 187, 188, 0, - 0, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 596, 239, - 1177, 240, 241, 242, 243, 0, 597, 245, 0, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 0, 0, 179, 180, 181, 182, 183, 184, 0, 185, - 186, 187, 188, 0, 0, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 609, 239, 0, 240, 241, 242, 243, 0, - 597, 245, 0, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 0, 0, 179, 180, 181, 182, - 183, 184, 0, 185, 186, 187, 188, 0, 0, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 735, 239, 0, 240, - 241, 242, 243, 0, 597, 245, 0, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 0, 0, - 179, 180, 181, 182, 183, 184, 0, 185, 186, 187, - 188, 0, 0, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 239, 0, 240, 241, 242, 243, 1141, 597, 245, - 0, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 0, 0, 179, 180, 181, 182, 183, 184, - 0, 185, 186, 187, 188, 0, 0, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1173, 239, 0, 240, 241, 242, - 243, 0, 597, 245, 0, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 0, 0, 179, 180, - 181, 182, 183, 184, 0, 185, 186, 187, 188, 0, - 0, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1181, 239, - 0, 240, 241, 242, 243, 0, 597, 245, 0, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 0, 0, 179, 180, 181, 182, 183, 184, 0, 185, - 186, 187, 188, 0, 0, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 239, 0, 240, 241, 242, 243, 0, - 244, 245, 0, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 150, 151, 152, 153, 154, - 155, 156, 441, 442, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 570, 171, 172, 173, 174, - 175, 176, 177, 178, 0, 0, 179, 180, 181, 182, - 183, 184, 0, 185, 186, 187, 188, 0, 0, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 571, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 0, 572, 0, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 965, 573, 966, 574, - 575, 576, 443, 0, 577, 578, 0, 246, 247, 248, - 579, 250, 251, 252, 253, 254, 255, 256, 580, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 0, 0, - 179, 180, 181, 182, 183, 184, 0, 185, 186, 187, - 188, 0, 0, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 239, 0, 240, 241, 242, 243, 0, 597, 245, - 0, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 0, 0, 179, 180, 181, 182, 183, 184, - 0, 185, 186, 187, 188, 0, 0, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 239, 0, 240, 241, 242, - 243, 0, 0, 245, 0, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 150, 151, 152, - 153, 154, 155, 156, 441, 442, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 570, 171, 172, - 173, 174, 175, 176, 177, 178, 0, 0, 179, 180, - 181, 182, 183, 184, 0, 185, 186, 187, 188, 0, - 0, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 571, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 0, 572, 0, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 573, - 0, 574, 575, 576, 443, 889, 577, 578, 0, 246, - 247, 248, 579, 250, 251, 252, 253, 254, 255, 256, - 580, 150, 151, 152, 153, 154, 155, 156, 441, 442, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 570, 171, 172, 173, 174, 175, 176, 177, 178, - 0, 0, 179, 180, 181, 182, 183, 184, 0, 185, - 186, 187, 188, 0, 0, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 571, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, 0, 572, 0, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 573, 0, 574, 575, 576, 443, 890, - 577, 578, 0, 246, 247, 248, 579, 250, 251, 252, - 253, 254, 255, 256, 580, 150, 151, 152, 153, 154, - 155, 156, 441, 442, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 570, 171, 172, 173, 174, - 175, 176, 177, 178, 0, 0, 179, 180, 181, 182, - 183, 184, 0, 185, 186, 187, 188, 0, 0, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 571, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 0, 572, 0, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 573, 0, 574, - 575, 576, 443, 891, 577, 578, 0, 246, 247, 248, - 579, 250, 251, 252, 253, 254, 255, 256, 580, 150, - 151, 152, 153, 154, 155, 156, 441, 442, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 570, - 171, 172, 173, 174, 175, 176, 177, 178, 0, 0, - 179, 180, 181, 182, 183, 184, 0, 185, 186, 187, - 188, 0, 0, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 571, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, 0, - 572, 0, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 573, 0, 574, 575, 576, 443, 0, 577, 578, - 964, 246, 247, 248, 579, 250, 251, 252, 253, 254, - 255, 256, 580, 150, 151, 152, 153, 154, 155, 156, - 441, 442, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 570, 171, 172, 173, 174, 175, 176, - 177, 178, 0, 0, 179, 180, 181, 182, 183, 184, - 0, 185, 186, 187, 188, 0, 0, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 571, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, 0, 572, 0, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 573, 0, 574, 575, 576, - 443, 0, 577, 578, 969, 246, 247, 248, 579, 250, - 251, 252, 253, 254, 255, 256, 580, 150, 151, 152, - 153, 154, 155, 156, 441, 442, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 570, 171, 172, - 173, 174, 175, 176, 177, 178, 0, 0, 179, 180, - 181, 182, 183, 184, 0, 185, 186, 187, 188, 0, - 0, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 571, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 0, 572, 0, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 573, - 0, 574, 575, 576, 443, 0, 577, 578, 0, 246, - 247, 248, 579, 250, 251, 252, 253, 254, 255, 256, - 580, 150, 151, 152, 153, 154, 155, 156, 441, 442, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 570, 171, 172, 173, 174, 175, 176, 177, 178, - 0, 0, 179, 180, 181, 182, 183, 184, 0, 185, - 186, 187, 188, 0, 0, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 434, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, 0, 572, 0, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 573, 0, 832, 575, 833, 443, 0, - 834, 578, 0, 246, 247, 248, 435, 250, 251, 252, - 253, 254, 255, 256, 580, -618, -618, -618, -618, -618, - -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, - -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, - -618, -618, -618, -618, 0, 0, -618, -618, -618, -618, - -618, -618, 0, -618, -618, -618, -618, 0, 0, -618, - -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, - -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, - -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, - -618, -618, -618, -618, -618, 0, -618, 0, -618, -618, - -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, - -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, - -618, -618, -618, -618, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -618, 0, -654, - -618, -618, -618, 0, -618, -618, 0, -618, -618, -618, - -618, -618, -618, -618, -618, -618, -618, -618, -618, 150, - 151, 152, 153, 154, 155, 156, 441, 442, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 570, - 171, 172, 173, 174, 175, 176, 177, 178, 0, 0, - 179, 180, 181, 182, 183, 184, 0, 185, 186, 187, - 188, 0, 0, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 864, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, 0, - 572, 0, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 573, 0, 0, 575, 0, 443, 0, 865, 578, - 0, 246, 247, 248, 866, 250, 251, 252, 253, 254, - 255, 256, 580, 150, 151, 152, 153, 154, 155, 156, - 441, 442, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 570, 171, 172, 173, 174, 175, 176, - 177, 178, 0, 0, 179, 180, 181, 182, 183, 184, - 0, 185, 186, 187, 188, 0, 0, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 0, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, 0, 572, 0, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 573, 0, 0, 575, 0, - 443, 0, 834, 578, 0, 246, 247, 248, 0, 250, - 251, 252, 253, 254, 255, 256, 580, 150, 151, 152, - 153, 154, 155, 156, 441, 442, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 570, 171, 172, - 173, 174, 175, 176, 177, 178, 0, 0, 179, 180, - 181, 182, 183, 184, 0, 185, 186, 187, 188, 0, - 0, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 0, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 0, 0, 0, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 573, - 0, 0, 575, 0, 443, 0, 0, 578, 0, 246, - 247, 248, 0, 250, 251, 252, 253, 254, 255, 256, - 580, 270, 271, 272, 273, 274, 275, 276, 0, 0, - 635, 0, 0, 0, 0, 0, 0, 0, 167, 168, - 169, 0, 17, 18, 19, 20, 0, 0, 0, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 0, 277, - 0, 0, 0, 0, 0, 0, 33, 34, 0, 0, - 0, 636, 637, 0, 0, 0, 0, 0, 202, 203, - 204, 638, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, 0, 38, 0, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 470, 471, 472, 473, 474, 475, 476, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 304, 305, 306, - 0, 0, 0, 0, 0, 639, 0, 640, 641, 0, - 642, 643, 0, 246, 247, 248, 644, 250, 251, 252, - 253, 254, 255, 256, 6, 7, 8, 9, 10, 11, - 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 13, 14, 15, 16, 17, 18, 19, 20, 0, - 0, 0, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 0, 30, 31, 32, 0, 0, 0, 0, 33, - 34, 35, 36, 37, 0, 0, 0, 0, 309, 310, - 311, 312, 313, 314, 315, 316, 317, 318, 319, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 38, 0, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 0, 86, 6, 7, 8, 9, - 10, 11, 12, 0, 0, 0, 87, 0, 0, 0, - 0, 0, 0, 13, 14, 15, 0, 17, 18, 19, - 20, 0, 0, 0, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 0, 277, 31, 354, 0, 0, 0, - 0, 33, 34, 0, 0, 355, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 38, 0, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 0, 0, 0, 0, 0, - 0, 6, 7, 8, 9, 10, 11, 12, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, - 15, 0, 17, 18, 19, 20, 0, 0, 87, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 0, 277, - 31, 354, 0, 0, 0, 0, 33, 34, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 38, 0, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, - 10, 11, 12, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 13, 14, 15, 0, 17, 18, 19, - 20, 0, 0, 87, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 0, 277, 31, 0, 0, 0, 0, - 0, 33, 34, 35, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 38, 0, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 0, 0, 0, 0, 0, - 0, 6, 7, 8, 9, 10, 11, 12, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, - 15, 0, 17, 18, 19, 20, 0, 0, 87, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 0, 277, - 31, 0, 0, 0, 0, 0, 33, 34, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 38, 0, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 0, 297, 298, 299, 300, 301, 302, 303, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 304, 305, - 306, 0, 0, 0, 0, 0, 803, 804, 805, 0, - 0, 0, 0, 87, 806, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 33, 297, 298, 299, - 300, 301, 302, 303, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 304, 305, 306, 16, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 33, 0, 0, 0, 0, 0, 0, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 0, 0, 297, 298, 299, 300, 301, 302, 303, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 38, 304, - 305, 306, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 87, 0, 309, 310, 311, 312, 313, - 314, 315, 316, 317, 318, 319, 0, 33, 307, 0, - 308, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 517, 0, - 0, 0, 518, 0, 0, 0, 0, 0, 0, 87, - 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 297, 298, 299, 300, 301, 302, 303, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 304, 305, - 306, 16, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 87, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 33, 297, 298, 299, - 300, 301, 302, 303, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 304, 305, 306, 16, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 33, 0, 0, 0, 0, 0, 0, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 0, 0, 297, 298, 299, 300, 301, 302, 303, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 38, 304, - 305, 306, 0, 0, 0, 0, 518, 0, 0, 0, - 0, 0, 0, 87, 0, 309, 310, 311, 312, 313, - 314, 315, 316, 317, 318, 319, 0, 33, 307, 297, - 298, 299, 300, 301, 302, 303, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 304, 305, 306, 0, - 0, 297, 298, 299, 300, 301, 302, 303, 0, 87, - 0, 0, 0, 38, 0, 0, 0, 0, 304, 305, - 306, 0, 0, 0, 33, 0, 0, 0, 0, 0, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 380, 0, 0, 0, 0, 33, 0, 0, 297, - 298, 299, 300, 301, 302, 303, 0, 0, 0, 0, - 38, 0, 0, 0, 0, 0, 304, 305, 306, 0, - 0, 0, 0, 0, 87, 0, 0, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 318, 319, 31, 0, - 0, 0, 0, 0, 33, 0, 0, 0, 0, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 0, 0, 0, 297, 298, 299, 300, 301, 302, 303, - 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, - 304, 305, 306, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 87, 0, 0, 0, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 318, 319, 33, 297, - 298, 299, 300, 301, 302, 303, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 304, 305, 306, 16, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, - 0, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 0, 0, 297, 298, 299, 300, 301, 302, - 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 38, 304, 305, 306, 16, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 87, 0, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 318, 319, 0, 33, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 507, 1142, 0, 0, 1143, 297, 298, 299, 300, 301, - 302, 303, 0, 0, 0, 38, 0, 0, 0, 0, - 0, 0, 304, 305, 306, 16, 0, 0, 0, 0, - 0, 0, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 297, 298, 299, 300, 301, 302, 303, - 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 304, 305, 306, 16, 0, 507, 0, 0, 0, 508, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 38, 0, 33, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 309, 310, 311, 312, 313, 314, 315, - 316, 317, 318, 319, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 38, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1142, 0, 0, - 1143, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 498, 277, 0, 0, 0, 0, 0, 0, 0, - 0, 499, 0, 0, 0, 0, 0, 0, 508, 0, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 498, - 277, 0, 0, 0, 0, 0, 0, 0, 417, 499, - 0, 0, 0, 0, 0, 0, 0, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 0, 0, 0, 0, 417, 0, 0, 0, - 0, 0, 0, 0, 0, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 0, 0, 0, 0, 0, -273, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 418, 419, 270, - 271, 272, 273, 274, 275, 276, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 167, 168, 169, 0, - 17, 18, 19, 20, 0, 418, 419, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 0, 277, 31, 354, - 0, 0, 0, 0, 33, 34, 0, 0, 355, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 38, 0, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 270, 271, - 272, 273, 274, 275, 276, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 167, 168, 169, 0, 17, - 18, 19, 20, 0, 0, 0, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 0, 277, 31, 0, 0, - 0, 0, 0, 33, 34, 35, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 38, - 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 228, 229, 230, 231, - 232, 233, 234, 235, 236, 237, 238, 270, 271, 272, - 273, 274, 275, 276, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 167, 168, 169, 0, 17, 18, - 19, 20, 0, 0, 0, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 0, 277, 31, 0, 0, 0, - 0, 0, 33, 34, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 38, 0, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 270, 271, 272, 273, - 274, 275, 276, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 167, 168, 169, 0, 17, 18, 19, - 20, 0, 0, 0, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 0, 277, 0, 0, 0, 0, 0, - 0, 33, 34, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 38, 0, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 228, 229, 230, 231, 232, 233, - 234, 235, 236, 237, 238, 270, 271, 272, 273, 274, - 275, 276, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 167, 168, 169, 0, 739, 0, 740, 20, - 0, 0, 0, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 0, 277, 0, 0, 0, 0, 0, 0, - 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 38, 0, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 270, 271, 272, 273, 274, 275, - 276, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 167, 168, 169, 0, 0, 0, 0, 0, 0, - 0, 0, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 0, 277, 0, 0, 0, 0, 0, 0, 33, - 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 38, 0, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 228, 229, 230, 231, 232, 233, 234, 235, - 236, 237, 238, 297, 298, 299, 300, 301, 302, 303, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 304, 305, 306, 16, 297, 298, 299, 300, 301, 302, - 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 304, 305, 306, 0, 0, 0, 0, 33, 297, - 298, 299, 300, 301, 302, 303, 0, 0, 0, 0, - 0, 0, 0, 0, 380, 0, 304, 305, 306, 33, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 38, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, - 0, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 318, 319 -}; - -/* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of - list of conflicting reductions corresponding to action entry for - state STATE-NUM in yytable. 0 means no conflicts. The list in - yyconfl is terminated by a rule number of 0. */ -static const unsigned char yyconflp[] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 247, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 249, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 9, 11, 13, 15, - 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, - 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, - 57, 59, 61, 63, 0, 0, 65, 67, 69, 71, - 73, 75, 0, 77, 79, 81, 83, 0, 0, 85, - 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, - 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, - 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, - 147, 149, 151, 153, 155, 0, 157, 0, 159, 161, - 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, - 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, - 203, 205, 207, 209, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 211, 0, 0, - 213, 215, 217, 0, 219, 221, 0, 223, 225, 227, - 229, 231, 233, 235, 237, 239, 241, 243, 245, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by - 0, pointed into by YYCONFLP. */ -static const short int yyconfl[] = -{ - 0, 406, 0, 406, 0, 406, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 654, 0, 654, - 0, 654, 0, 654, 0, 654, 0, 406, 0, 406, - 0 -}; - -static const short int yycheck[] = -{ - 5, 137, 123, 5, 35, 431, 123, 131, 35, 268, - 131, 110, 131, 323, 416, 36, 5, 124, 439, 5, - 704, 603, 705, 5, 714, 457, 5, 323, 554, 430, - 5, 5, 37, 113, 114, 115, 287, 520, 696, 752, - 449, 32, 972, 845, 448, 867, 35, 746, 545, 351, - 5, 37, 554, 752, 977, 323, 35, 3, 239, 3, - 10, 11, 3, 134, 245, 10, 11, 3, 32, 140, - 946, 918, 705, 23, 552, 10, 11, 84, 63, 1106, - 23, 84, 37, 32, 10, 11, 267, 3, 84, 140, - 63, 123, 725, 23, 929, 28, 29, 30, 3, 5, - 131, 23, 25, 124, 131, 134, 23, 18, 0, 1136, - 3, 140, 84, 23, 295, 0, 23, 413, 123, 124, - 3, 126, 134, 705, 110, 529, 49, 77, 140, 35, - 140, 110, 23, 83, 538, 142, 110, 939, 621, 142, - 830, 12, 131, 54, 55, 131, 142, 625, 31, 142, - 997, 77, 131, 32, 612, 613, 614, 83, 149, 469, - 140, 44, 286, 148, 47, 416, 1042, 693, 123, 124, - 142, 126, 43, 469, 595, 148, 3, 4, 5, 6, - 7, 8, 9, 66, 897, 149, 1109, 368, 134, 135, - 134, 693, 138, 134, 137, 140, 146, 147, 897, 135, - 149, 469, 138, 136, 110, 140, 32, 1029, 1138, 45, - 140, 895, 1047, 622, 623, 712, 138, 77, 134, 135, - 146, 147, 138, 140, 134, 938, 709, 134, 524, 134, - 135, 632, 729, 138, 867, 537, 84, 539, 12, 938, - 364, 134, 135, 364, 63, 138, 84, 138, 135, 140, - 84, 283, 376, 25, 137, 286, 134, 134, 554, 286, - 944, 139, 975, 84, 269, 978, 10, 11, 140, 43, - 149, 43, 730, 957, 732, 140, 975, 49, 283, 978, - 84, 1103, 134, 140, 134, 406, 146, 147, 140, 406, - 140, 323, 1094, 135, 142, 137, 929, 286, 134, 135, - 134, 84, 307, 308, 142, 84, 140, 286, 135, 24, - 25, 447, 563, 449, 269, 84, 1144, 134, 323, 324, - 139, 142, 139, 149, 135, 140, 134, 138, 283, 148, - 134, 84, 140, 364, 84, 1163, 140, 1165, 324, 83, - 134, 135, 1000, 1033, 138, 350, 1059, 1175, 353, 140, - 355, 134, 307, 308, 140, 134, 1039, 140, 140, 142, - 1059, 140, 140, 142, 350, 134, 1050, 618, 323, 324, - 140, 140, 84, 142, 406, 84, 362, 1148, 364, 140, - 134, 134, 143, 362, 134, 364, 140, 140, 362, 142, - 140, 1162, 142, 1164, 140, 350, 1029, 693, 353, 523, - 355, 406, 523, 134, 511, 1176, 1039, 134, 413, 140, - 28, 29, 30, 140, 1047, 3, 4, 5, 6, 7, - 8, 9, 134, 1106, 140, 134, 134, 413, 140, 140, - 142, 140, 140, 142, 134, 1093, 457, 469, 134, 140, - 140, 432, 433, 448, 140, 450, 140, 438, 439, 440, - 882, 406, 457, 1136, 140, 460, 362, 1039, 413, 135, - 48, 137, 448, 134, 469, 31, 140, 33, 459, 140, - 1103, 136, 32, 1106, 139, 134, 134, 468, 44, 511, - 429, 47, 140, 432, 433, 140, 622, 623, 143, 438, - 439, 440, 523, 448, 140, 450, 84, 4, 140, 102, - 1158, 1159, 457, 1136, 930, 460, 511, 512, 135, 530, - 459, 138, 146, 147, 469, 140, 697, 522, 135, 524, - 525, 84, 554, 12, 529, 530, 512, 13, 14, 15, - 31, 32, 137, 538, 134, 540, 527, 523, 524, 560, - 134, 136, 135, 529, 523, 142, 83, 138, 23, 554, - 140, 135, 538, 432, 433, 560, 511, 512, 549, 438, - 439, 440, 134, 1089, 139, 139, 139, 522, 139, 524, - 525, 139, 139, 975, 529, 139, 683, 139, 527, 135, - 459, 139, 139, 538, 139, 540, 139, 139, 139, 149, - 139, 141, 99, 141, 134, 854, 1122, 104, 134, 554, - 605, 143, 141, 135, 595, 560, 432, 433, 141, 1030, - 144, 747, 438, 439, 440, 122, 605, 136, 144, 43, - 127, 745, 134, 134, 134, 132, 3, 143, 143, 765, - 144, 139, 607, 459, 141, 142, 141, 141, 141, 1065, - 139, 139, 138, 137, 134, 83, 595, 139, 527, 134, - 605, 683, 3, 4, 5, 6, 7, 8, 9, 141, - 134, 693, 143, 25, 669, 144, 139, 134, 134, 139, - 675, 136, 144, 144, 138, 278, 139, 280, 683, 3, - 4, 5, 6, 7, 8, 9, 945, 141, 693, 36, - 139, 1112, 287, 141, 134, 141, 141, 48, 141, 605, - 141, 527, 141, 134, 141, 141, 141, 141, 141, 139, - 139, 1021, 1116, 141, 669, 83, 595, 1143, 144, 144, - 675, 137, 141, 134, 139, 1021, 13, 13, 683, 134, - 46, 141, 144, 141, 739, 740, 741, 37, 693, 141, - 1161, 141, 1146, 141, 1148, 141, 1172, 141, 141, 135, - 5, 918, 918, 926, 1026, 918, 705, 806, 1179, 918, - 1164, 815, 918, 1072, 617, 765, 918, 618, 877, 595, - 365, 5, 279, 918, 281, 282, 725, 284, 1088, 997, - 531, 821, 1035, 1096, 739, 740, 741, 918, 348, 502, - 863, 351, 1088, 1089, 501, 1169, 859, 400, 688, 402, - 605, 425, 425, 918, 729, 754, 755, 756, 959, 874, - 559, 941, 820, -1, 321, -1, 821, -1, -1, -1, - -1, 416, -1, 426, -1, 125, 1122, 127, 128, 24, - 25, 26, 823, -1, -1, -1, 31, 32, 33, 34, - 35, 36, 37, 38, 39, -1, 41, -1, -1, 452, - 453, -1, 359, -1, -1, -1, -1, -1, -1, -1, - -1, 882, -1, -1, -1, -1, 821, -1, 375, 429, - -1, -1, 432, 433, 823, -1, -1, 882, 438, 439, - 440, -1, -1, -1, -1, -1, -1, 447, -1, 449, - -1, -1, -1, -1, 401, -1, 403, -1, 1022, 459, - 407, 1022, -1, 1022, -1, 1022, -1, 502, -1, 1045, - 417, 418, 419, 918, 1013, 920, 918, -1, 867, 924, - -1, 926, -1, -1, 873, 874, 875, 882, -1, 918, - -1, -1, 918, -1, -1, 1015, 918, -1, 445, 918, - -1, 544, -1, 918, 823, -1, -1, -1, 5, -1, - -1, 1075, -1, -1, 1075, -1, -1, -1, 1075, 1083, - -1, 1142, 1083, 918, -1, 920, 1083, 527, 563, 924, - 1151, 926, -1, 1072, -1, -1, -1, 537, 35, 539, - 929, -1, -1, -1, 284, 285, -1, -1, -1, 1021, - -1, 1022, 997, 1073, 999, 1022, 503, 823, -1, 1123, - -1, -1, 1123, 510, -1, -1, 1123, -1, 1013, 569, - 959, 1013, 918, 999, 521, -1, 1021, 1022, 997, -1, - -1, 1026, 997, 618, -1, 325, 326, 1013, -1, -1, - -1, 1013, -1, 1022, 1013, 595, 1022, -1, 1013, 1030, - 946, 548, 997, 1022, 999, -1, 553, -1, -1, -1, - 350, -1, 1083, 110, 124, -1, 1088, -1, 1013, -1, - -1, 118, 622, 623, -1, -1, 1021, 1022, 1089, -1, - 1075, 1026, -1, -1, -1, -1, 1081, -1, 1083, 1081, - 1029, 1030, -1, 1088, 1089, 385, 386, 387, -1, -1, - 1039, 997, 1123, 1072, -1, 1081, 1075, 1083, 1047, 1081, - -1, 1122, 1081, -1, 1083, -1, 1081, 1013, -1, -1, - -1, 1116, -1, -1, -1, 5, -1, 1122, 1123, 626, - 1075, 1112, -1, -1, 5, -1, 1081, -1, 1083, 131, - 1116, -1, -1, 1088, 1089, -1, -1, 1123, -1, -1, - 1119, 1146, -1, 1148, 1123, 705, -1, 37, 448, -1, - 710, 1030, -1, -1, 1103, -1, 37, 1106, -1, 1164, - 1146, 1116, 1148, 1112, -1, 725, 1072, 1122, 1123, 1160, - 1161, -1, -1, 680, -1, 1081, -1, 1168, 1164, -1, - -1, -1, -1, -1, -1, 692, -1, 1136, 1179, -1, - -1, 1146, -1, 1148, 754, 755, 756, -1, -1, -1, - -1, -1, -1, -1, 1030, 123, -1, -1, 126, 1164, - -1, 1160, 1161, 513, 514, 810, -1, -1, -1, 1168, - -1, -1, -1, -1, -1, -1, -1, 822, -1, 529, - 1179, -1, -1, 1112, -1, -1, 126, -1, 538, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 327, -1, -1, - -1, 331, 332, 823, 334, 335, 336, 337, 338, 339, - 340, 341, 342, 343, 344, 345, 346, 347, -1, -1, - 350, 1160, 1161, 886, 286, -1, 1112, -1, -1, 1168, - -1, -1, -1, -1, 801, -1, -1, -1, -1, -1, - 1179, -1, -1, -1, -1, 362, 813, 867, -1, -1, - -1, -1, -1, 873, 874, 875, -1, 824, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 631, -1, -1, 1160, 1161, -1, -1, -1, -1, - -1, -1, 1168, -1, -1, -1, 348, -1, -1, 351, - -1, -1, -1, 1179, -1, -1, -1, -1, -1, -1, - -1, -1, 364, -1, -1, 283, -1, -1, 971, 929, - -1, -1, -1, -1, 376, -1, -1, 884, 448, 269, - -1, 681, 682, -1, -1, -1, -1, -1, 269, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 959, - -1, -1, 702, -1, -1, 323, 324, -1, 478, 479, - 480, 468, -1, 483, -1, 922, 976, 307, 308, -1, - -1, -1, -1, -1, -1, -1, 307, 308, 1023, -1, - 1025, -1, 1027, 940, 324, -1, -1, -1, -1, -1, - -1, 511, -1, 743, 744, 447, 516, 449, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 529, - -1, -1, -1, 353, -1, 355, -1, 50, 538, 1029, - 1030, -1, 353, -1, 355, -1, -1, -1, -1, 1039, - -1, 1076, -1, -1, -1, -1, -1, 1047, 406, -1, - -1, -1, 1052, -1, -1, 413, -1, 1100, -1, -1, - -1, -1, -1, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, -1, -1, - -1, 523, -1, -1, -1, -1, -1, -1, 1131, -1, - -1, -1, -1, -1, -1, 537, -1, 539, -1, 457, - -1, -1, -1, 1103, -1, -1, 1106, -1, -1, -1, - -1, 469, 1112, -1, -1, -1, -1, -1, -1, -1, - 450, -1, -1, 1070, -1, -1, -1, 569, -1, 450, - 460, -1, 1132, -1, -1, -1, 1136, -1, -1, 1086, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 1098, 1152, -1, -1, 1102, -1, 1104, -1, 656, - 1160, 1161, -1, -1, -1, -1, 524, -1, 1168, -1, - 1117, -1, -1, 683, 1121, -1, -1, -1, 1125, 1179, - 622, 623, 12, 693, -1, -1, -1, -1, 1135, -1, - -1, -1, 522, -1, -1, 525, 554, -1, -1, -1, - 1147, 522, 560, -1, 525, -1, -1, -1, -1, -1, - 540, -1, -1, -1, -1, -1, -1, -1, -1, 540, - -1, -1, -1, 53, 54, -1, -1, -1, -1, -1, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, -1, -1, -1, -1, -1, -1, 999, - -1, -1, -1, -1, -1, -1, -1, -1, 710, -1, - -1, -1, -1, 770, -1, 605, -1, -1, -1, -1, - -1, 778, -1, -1, -1, 782, 783, -1, -1, 786, - 787, 788, 789, 790, 791, 792, 793, 794, 795, -1, - -1, -1, -1, 745, -1, 815, -1, 137, -1, 139, - 140, -1, 142, 143, -1, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, -1, -1, -1, -1, - -1, 828, -1, -1, -1, 693, -1, -1, -1, 669, - -1, -1, -1, -1, -1, 675, -1, -1, 669, -1, - 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, - 23, 24, 25, 26, 27, -1, 1116, -1, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, -1, -1, -1, -1, 48, 49, 50, -1, 52, - -1, -1, -1, -1, 901, -1, 1146, 904, 1148, 739, - 740, 741, -1, -1, -1, -1, -1, -1, 739, 740, - 741, 918, -1, -1, 1164, -1, -1, -1, -1, -1, - -1, 84, -1, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 821, 145, -1, -1, -1, -1, -1, -1, -1, - 821, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 3, 4, 5, 6, 7, 8, - 9, -1, -1, -1, 882, -1, -1, -1, -1, -1, - -1, 20, 21, 22, 976, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 3, 4, 5, 6, 7, 8, - 9, -1, -1, 42, 43, -1, -1, -1, -1, 48, - 918, 20, 21, 22, 23, -1, -1, -1, -1, 28, - 29, 30, -1, -1, -1, -1, -1, 36, -1, -1, - 1022, -1, -1, -1, -1, -1, -1, -1, 918, 48, - 920, -1, -1, -1, 924, -1, 926, 918, -1, 920, - 1042, -1, -1, 924, -1, -1, 1116, -1, -1, -1, - 1052, -1, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, -1, -1, 84, -1, -1, -1, -1, - -1, -1, -1, 1075, -1, -1, 1146, -1, 1148, 997, - -1, 1083, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, -1, 1164, 1013, 145, -1, -1, -1, - -1, -1, -1, 1021, 1022, -1, -1, -1, -1, 999, - -1, -1, -1, -1, -1, -1, -1, 1119, 999, -1, - -1, 1123, -1, -1, -1, -1, 145, -1, -1, -1, - 1132, -1, -1, -1, -1, -1, 1026, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 1152, -1, -1, -1, -1, -1, -1, 1075, -1, -1, - -1, -1, -1, 1081, -1, 1083, -1, -1, -1, -1, - 1088, 1089, -1, -1, -1, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 1122, 1123, 34, 35, 36, 37, - 38, 39, -1, 41, 42, 43, 44, -1, -1, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 134, 135, -1, 137, - 138, 139, 140, -1, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, - 34, 35, 36, 37, 38, 39, -1, 41, 42, 43, - 44, -1, -1, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 134, 135, 136, 137, 138, 139, 140, -1, 142, 143, - -1, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, -1, -1, 34, 35, 36, 37, 38, 39, - -1, 41, 42, 43, 44, -1, -1, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 134, 135, -1, 137, 138, 139, - 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, -1, -1, 34, 35, - 36, 37, 38, 39, -1, 41, 42, 43, 44, -1, - -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 134, 135, - -1, 137, 138, 139, 140, 141, 142, 143, -1, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - -1, -1, 34, 35, 36, 37, 38, 39, -1, 41, - 42, 43, 44, -1, -1, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 134, 135, 136, 137, 138, 139, 140, -1, - 142, 143, -1, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, -1, -1, 34, 35, 36, 37, - 38, 39, -1, 41, 42, 43, 44, -1, -1, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 134, 135, 136, 137, - 138, 139, 140, -1, 142, 143, -1, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, - 34, 35, 36, 37, 38, 39, -1, 41, 42, 43, - 44, -1, -1, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 134, 135, 136, 137, 138, 139, 140, -1, 142, 143, - -1, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, -1, -1, 34, 35, 36, 37, 38, 39, - -1, 41, 42, 43, 44, -1, -1, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 134, 135, 136, 137, 138, 139, - 140, -1, 142, 143, -1, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, -1, -1, 34, 35, - 36, 37, 38, 39, -1, 41, 42, 43, 44, -1, - -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 134, 135, - 136, 137, 138, 139, 140, -1, 142, 143, -1, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - -1, -1, 34, 35, 36, 37, 38, 39, -1, 41, - 42, 43, 44, -1, -1, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 134, 135, -1, 137, 138, 139, 140, -1, - 142, 143, -1, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, -1, -1, 34, 35, 36, 37, - 38, 39, -1, 41, 42, 43, 44, -1, -1, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 134, 135, -1, 137, - 138, 139, 140, -1, 142, 143, -1, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, - 34, 35, 36, 37, 38, 39, -1, 41, 42, 43, - 44, -1, -1, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 135, -1, 137, 138, 139, 140, 141, 142, 143, - -1, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, -1, -1, 34, 35, 36, 37, 38, 39, - -1, 41, 42, 43, 44, -1, -1, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 134, 135, -1, 137, 138, 139, - 140, -1, 142, 143, -1, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, -1, -1, 34, 35, - 36, 37, 38, 39, -1, 41, 42, 43, 44, -1, - -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 134, 135, - -1, 137, 138, 139, 140, -1, 142, 143, -1, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - -1, -1, 34, 35, 36, 37, 38, 39, -1, 41, - 42, 43, 44, -1, -1, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 135, -1, 137, 138, 139, 140, -1, - 142, 143, -1, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, -1, -1, 34, 35, 36, 37, - 38, 39, -1, 41, 42, 43, 44, -1, -1, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, -1, 84, -1, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 134, 135, 136, 137, - 138, 139, 140, -1, 142, 143, -1, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, - 34, 35, 36, 37, 38, 39, -1, 41, 42, 43, - 44, -1, -1, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 135, -1, 137, 138, 139, 140, -1, 142, 143, - -1, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, -1, -1, 34, 35, 36, 37, 38, 39, - -1, 41, 42, 43, 44, -1, -1, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 135, -1, 137, 138, 139, - 140, -1, -1, 143, -1, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, -1, -1, 34, 35, - 36, 37, 38, 39, -1, 41, 42, 43, 44, -1, - -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, -1, 84, -1, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, - -1, 137, 138, 139, 140, 141, 142, 143, -1, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - -1, -1, 34, 35, 36, 37, 38, 39, -1, 41, - 42, 43, 44, -1, -1, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, -1, 84, -1, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 135, -1, 137, 138, 139, 140, 141, - 142, 143, -1, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, -1, -1, 34, 35, 36, 37, - 38, 39, -1, 41, 42, 43, 44, -1, -1, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, -1, 84, -1, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 135, -1, 137, - 138, 139, 140, 141, 142, 143, -1, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, - 34, 35, 36, 37, 38, 39, -1, 41, 42, 43, - 44, -1, -1, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, -1, - 84, -1, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 135, -1, 137, 138, 139, 140, -1, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, -1, -1, 34, 35, 36, 37, 38, 39, - -1, 41, 42, 43, 44, -1, -1, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, -1, 84, -1, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 135, -1, 137, 138, 139, - 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, -1, -1, 34, 35, - 36, 37, 38, 39, -1, 41, 42, 43, 44, -1, - -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, -1, 84, -1, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, - -1, 137, 138, 139, 140, -1, 142, 143, -1, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - -1, -1, 34, 35, 36, 37, 38, 39, -1, 41, - 42, 43, 44, -1, -1, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, -1, 84, -1, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 135, -1, 137, 138, 139, 140, -1, - 142, 143, -1, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, -1, -1, 34, 35, 36, 37, - 38, 39, -1, 41, 42, 43, 44, -1, -1, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, -1, 84, -1, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 135, -1, 137, - 138, 139, 140, -1, 142, 143, -1, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, - 34, 35, 36, 37, 38, 39, -1, 41, 42, 43, - 44, -1, -1, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, -1, - 84, -1, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 135, -1, -1, 138, -1, 140, -1, 142, 143, - -1, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, -1, -1, 34, 35, 36, 37, 38, 39, - -1, 41, 42, 43, 44, -1, -1, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, -1, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, -1, 84, -1, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 135, -1, -1, 138, -1, - 140, -1, 142, 143, -1, 145, 146, 147, -1, 149, - 150, 151, 152, 153, 154, 155, 156, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, -1, -1, 34, 35, - 36, 37, 38, 39, -1, 41, 42, 43, 44, -1, - -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, -1, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, -1, -1, -1, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, - -1, -1, 138, -1, 140, -1, -1, 143, -1, 145, - 146, 147, -1, 149, 150, 151, 152, 153, 154, 155, - 156, 3, 4, 5, 6, 7, 8, 9, -1, -1, - 12, -1, -1, -1, -1, -1, -1, -1, 20, 21, - 22, -1, 24, 25, 26, 27, -1, -1, -1, 31, - 32, 33, 34, 35, 36, 37, 38, 39, -1, 41, - -1, -1, -1, -1, -1, -1, 48, 49, -1, -1, - -1, 53, 54, -1, -1, -1, -1, -1, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, -1, 84, -1, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, - -1, -1, -1, -1, -1, 137, -1, 139, 140, -1, - 142, 143, -1, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 3, 4, 5, 6, 7, 8, - 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 20, 21, 22, 23, 24, 25, 26, 27, -1, - -1, -1, 31, 32, 33, 34, 35, 36, 37, 38, - 39, -1, 41, 42, 43, -1, -1, -1, -1, 48, - 49, 50, 51, 52, -1, -1, -1, -1, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 84, -1, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, -1, 134, 3, 4, 5, 6, - 7, 8, 9, -1, -1, -1, 145, -1, -1, -1, - -1, -1, -1, 20, 21, 22, -1, 24, 25, 26, - 27, -1, -1, -1, 31, 32, 33, 34, 35, 36, - 37, 38, 39, -1, 41, 42, 43, -1, -1, -1, - -1, 48, 49, -1, -1, 52, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, -1, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, -1, -1, -1, -1, -1, - -1, 3, 4, 5, 6, 7, 8, 9, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, - 22, -1, 24, 25, 26, 27, -1, -1, 145, 31, - 32, 33, 34, 35, 36, 37, 38, 39, -1, 41, - 42, 43, -1, -1, -1, -1, 48, 49, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 84, -1, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - -1, -1, -1, -1, -1, -1, 3, 4, 5, 6, - 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 20, 21, 22, -1, 24, 25, 26, - 27, -1, -1, 145, 31, 32, 33, 34, 35, 36, - 37, 38, 39, -1, 41, 42, -1, -1, -1, -1, - -1, 48, 49, 50, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, -1, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, -1, -1, -1, -1, -1, - -1, 3, 4, 5, 6, 7, 8, 9, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, - 22, -1, 24, 25, 26, 27, -1, -1, 145, 31, - 32, 33, 34, 35, 36, 37, 38, 39, -1, 41, - 42, -1, -1, -1, -1, -1, 48, 49, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 84, -1, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - -1, 3, 4, 5, 6, 7, 8, 9, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, - 22, -1, -1, -1, -1, -1, 28, 29, 30, -1, - -1, -1, -1, 145, 36, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 48, 3, 4, 5, - 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 20, 21, 22, 23, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 84, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 48, -1, -1, -1, -1, -1, -1, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - -1, -1, 3, 4, 5, 6, 7, 8, 9, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 84, 20, - 21, 22, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 145, -1, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, -1, 48, 49, -1, - 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 134, -1, - -1, -1, 138, -1, -1, -1, -1, -1, -1, 145, - -1, -1, -1, 84, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 3, 4, 5, 6, 7, 8, 9, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, - 22, 23, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 145, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 48, 3, 4, 5, - 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 20, 21, 22, 23, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 84, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 48, -1, -1, -1, -1, -1, -1, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - -1, -1, 3, 4, 5, 6, 7, 8, 9, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 84, 20, - 21, 22, -1, -1, -1, -1, 138, -1, -1, -1, - -1, -1, -1, 145, -1, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, -1, 48, 49, 3, - 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 20, 21, 22, -1, - -1, 3, 4, 5, 6, 7, 8, 9, -1, 145, - -1, -1, -1, 84, -1, -1, -1, -1, 20, 21, - 22, -1, -1, -1, 48, -1, -1, -1, -1, -1, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 43, -1, -1, -1, -1, 48, -1, -1, 3, - 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, - 84, -1, -1, -1, -1, -1, 20, 21, 22, -1, - -1, -1, -1, -1, 145, -1, -1, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 42, -1, - -1, -1, -1, -1, 48, -1, -1, -1, -1, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - -1, -1, -1, 3, 4, 5, 6, 7, 8, 9, - -1, 145, -1, -1, -1, -1, -1, -1, -1, -1, - 20, 21, 22, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 145, -1, -1, -1, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 48, 3, - 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 145, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 48, -1, -1, -1, -1, -1, - -1, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, -1, -1, 3, 4, 5, 6, 7, 8, - 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 84, 20, 21, 22, 23, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 145, -1, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, -1, 48, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 134, 135, -1, -1, 138, 3, 4, 5, 6, 7, - 8, 9, -1, -1, -1, 84, -1, -1, -1, -1, - -1, -1, 20, 21, 22, 23, -1, -1, -1, -1, - -1, -1, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 3, 4, 5, 6, 7, 8, 9, - 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 20, 21, 22, 23, -1, 134, -1, -1, -1, 138, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 84, -1, 48, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, - 138, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, -1, -1, -1, -1, -1, -1, -1, - -1, 50, -1, -1, -1, -1, -1, -1, 138, -1, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, -1, -1, -1, -1, -1, -1, -1, 77, 50, - -1, -1, -1, -1, -1, -1, -1, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, -1, -1, -1, -1, 77, -1, -1, -1, - -1, -1, -1, -1, -1, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 146, 147, 3, - 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 20, 21, 22, -1, - 24, 25, 26, 27, -1, 146, 147, 31, 32, 33, - 34, 35, 36, 37, 38, 39, -1, 41, 42, 43, - -1, -1, -1, -1, 48, 49, -1, -1, 52, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 84, -1, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 3, 4, - 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 20, 21, 22, -1, 24, - 25, 26, 27, -1, -1, -1, 31, 32, 33, 34, - 35, 36, 37, 38, 39, -1, 41, 42, -1, -1, - -1, -1, -1, 48, 49, 50, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, - -1, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 3, 4, 5, - 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 20, 21, 22, -1, 24, 25, - 26, 27, -1, -1, -1, 31, 32, 33, 34, 35, - 36, 37, 38, 39, -1, 41, 42, -1, -1, -1, - -1, -1, 48, 49, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 84, -1, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 3, 4, 5, 6, - 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 20, 21, 22, -1, 24, 25, 26, - 27, -1, -1, -1, 31, 32, 33, 34, 35, 36, - 37, 38, 39, -1, 41, -1, -1, -1, -1, -1, - -1, 48, 49, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, -1, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 3, 4, 5, 6, 7, - 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 20, 21, 22, -1, 24, -1, 26, 27, - -1, -1, -1, 31, 32, 33, 34, 35, 36, 37, - 38, 39, -1, 41, -1, -1, -1, -1, -1, -1, - 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 84, -1, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 3, 4, 5, 6, 7, 8, - 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, - -1, -1, 31, 32, 33, 34, 35, 36, 37, 38, - 39, -1, 41, -1, -1, -1, -1, -1, -1, 48, - 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 84, -1, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 3, 4, 5, 6, 7, 8, 9, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 20, 21, 22, 23, 3, 4, 5, 6, 7, 8, - 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 20, 21, 22, -1, -1, -1, -1, 48, 3, - 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, - -1, -1, -1, -1, 43, -1, 20, 21, 22, 48, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 48, -1, -1, -1, -1, -1, - -1, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const unsigned short int yystos[] = -{ - 0, 158, 159, 0, 160, 367, 3, 4, 5, 6, - 7, 8, 9, 20, 21, 22, 23, 24, 25, 26, - 27, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 41, 42, 43, 48, 49, 50, 51, 52, 84, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 134, 145, 161, 162, - 163, 164, 165, 167, 168, 169, 170, 171, 173, 176, - 191, 192, 193, 195, 196, 206, 207, 216, 218, 219, - 221, 239, 240, 241, 242, 245, 246, 249, 255, 289, - 319, 320, 321, 322, 324, 325, 326, 327, 329, 331, - 332, 335, 336, 337, 338, 339, 341, 342, 345, 346, - 357, 358, 359, 368, 371, 369, 24, 25, 12, 43, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 34, - 35, 36, 37, 38, 39, 41, 42, 43, 44, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 135, - 137, 138, 139, 140, 142, 143, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 358, 359, - 396, 397, 398, 428, 429, 430, 431, 432, 330, 347, - 3, 4, 5, 6, 7, 8, 9, 41, 171, 176, - 193, 196, 321, 322, 327, 329, 335, 341, 3, 4, - 5, 6, 7, 8, 9, 135, 332, 3, 4, 5, - 6, 7, 8, 9, 20, 21, 22, 49, 51, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 217, 319, 321, 322, 326, 327, 329, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 333, 172, - 367, 333, 135, 367, 43, 52, 162, 169, 170, 196, - 202, 219, 221, 239, 335, 341, 45, 134, 135, 265, - 266, 265, 265, 265, 140, 176, 335, 341, 134, 367, - 43, 246, 270, 273, 320, 325, 327, 329, 178, 327, - 329, 331, 332, 326, 320, 321, 326, 367, 326, 142, - 171, 176, 193, 196, 207, 246, 322, 336, 345, 367, - 10, 11, 83, 233, 290, 298, 300, 77, 146, 147, - 295, 360, 361, 362, 363, 366, 343, 367, 367, 404, - 135, 428, 424, 424, 63, 148, 222, 414, 424, 425, - 424, 10, 11, 140, 418, 319, 12, 333, 367, 333, - 367, 320, 171, 193, 211, 212, 215, 233, 298, 424, - 137, 166, 319, 319, 134, 367, 249, 254, 255, 322, - 3, 4, 5, 6, 7, 8, 9, 331, 373, 376, - 377, 331, 331, 381, 331, 331, 331, 331, 331, 331, - 331, 331, 331, 331, 331, 331, 331, 331, 40, 50, - 291, 294, 295, 334, 336, 359, 135, 134, 138, 177, - 178, 322, 326, 327, 329, 291, 194, 134, 138, 197, - 319, 319, 367, 335, 233, 138, 275, 424, 247, 367, - 323, 271, 140, 326, 326, 326, 328, 333, 367, 333, - 367, 246, 270, 367, 344, 301, 250, 252, 254, 255, - 256, 268, 309, 320, 322, 292, 137, 285, 286, 288, - 233, 298, 307, 360, 367, 367, 367, 361, 363, 333, - 23, 63, 84, 135, 137, 138, 139, 142, 143, 148, - 156, 358, 359, 370, 396, 397, 398, 402, 403, 405, - 406, 415, 418, 422, 159, 425, 134, 142, 144, 426, - 427, 428, 136, 223, 225, 226, 228, 230, 144, 134, - 427, 141, 420, 421, 419, 367, 208, 210, 295, 177, - 208, 319, 333, 333, 209, 309, 320, 327, 329, 136, - 321, 327, 135, 134, 137, 12, 53, 54, 63, 137, - 139, 140, 142, 143, 148, 395, 396, 249, 254, 139, - 331, 331, 331, 139, 139, 331, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 141, 141, 139, - 134, 292, 290, 367, 180, 175, 3, 134, 179, 367, - 178, 327, 329, 322, 134, 199, 200, 331, 198, 197, - 367, 319, 320, 322, 276, 277, 319, 135, 136, 278, - 279, 177, 327, 275, 274, 408, 291, 177, 291, 319, - 333, 339, 340, 365, 251, 367, 257, 311, 312, 313, - 367, 250, 256, 134, 139, 287, 422, 141, 298, 364, - 417, 423, 416, 144, 136, 134, 144, 139, 414, 24, - 26, 196, 321, 327, 329, 335, 352, 353, 356, 357, - 25, 49, 234, 221, 404, 404, 404, 134, 209, 215, - 134, 197, 208, 208, 134, 139, 140, 367, 134, 159, - 220, 3, 143, 143, 63, 148, 141, 144, 372, 139, - 141, 141, 378, 380, 139, 341, 384, 386, 388, 390, - 385, 387, 389, 391, 392, 393, 319, 28, 29, 30, - 136, 181, 182, 28, 29, 30, 36, 186, 187, 190, - 319, 138, 367, 178, 136, 139, 137, 342, 134, 367, - 331, 139, 431, 424, 141, 83, 280, 282, 283, 326, - 272, 278, 137, 139, 142, 402, 410, 411, 412, 414, - 134, 134, 134, 197, 339, 257, 140, 3, 31, 44, - 47, 66, 137, 258, 260, 261, 262, 263, 143, 314, - 315, 138, 140, 293, 63, 142, 148, 399, 400, 402, - 412, 299, 365, 404, 409, 404, 144, 224, 319, 319, - 319, 345, 233, 296, 300, 295, 354, 296, 25, 141, - 141, 141, 134, 134, 210, 213, 136, 341, 144, 144, - 341, 374, 341, 341, 382, 141, 341, 341, 341, 341, - 341, 341, 341, 341, 341, 341, 139, 394, 367, 138, - 189, 190, 139, 36, 188, 233, 174, 367, 200, 201, - 137, 203, 429, 277, 233, 136, 367, 139, 341, 257, - 141, 413, 134, 262, 253, 259, 264, 18, 54, 55, - 418, 316, 315, 13, 14, 15, 310, 269, 294, 401, - 400, 140, 302, 312, 144, 134, 136, 406, 407, 144, - 225, 355, 308, 309, 227, 367, 333, 229, 231, 278, - 296, 141, 341, 379, 141, 341, 141, 141, 141, 141, - 141, 141, 141, 141, 139, 139, 141, 40, 41, 52, - 133, 134, 163, 168, 170, 183, 184, 185, 191, 192, - 206, 216, 219, 221, 243, 244, 245, 270, 289, 319, - 320, 322, 335, 341, 371, 319, 367, 319, 186, 399, - 425, 134, 267, 248, 83, 281, 296, 262, 367, 408, - 278, 418, 335, 346, 348, 349, 317, 318, 278, 403, - 303, 144, 333, 302, 137, 235, 236, 296, 306, 360, - 235, 296, 141, 134, 375, 139, 383, 13, 13, 168, - 176, 204, 221, 244, 320, 335, 341, 431, 170, 184, - 219, 221, 243, 335, 265, 134, 254, 270, 322, 233, - 233, 187, 233, 46, 257, 282, 284, 414, 141, 346, - 350, 295, 144, 399, 141, 278, 237, 141, 296, 232, - 214, 141, 425, 141, 141, 141, 367, 176, 204, 335, - 265, 176, 233, 335, 367, 254, 256, 431, 262, 285, - 367, 351, 333, 367, 367, 141, 238, 410, 297, 235, - 305, 141, 135, 138, 177, 205, 367, 176, 367, 134, - 367, 135, 333, 367, 410, 302, 31, 33, 44, 47, - 424, 425, 179, 177, 367, 177, 205, 134, 424, 304, - 431, 431, 136, 134, 205, 177, 179, 136, 305, 425, - 205, 134 -}; - - -/* Prevent warning if -Wmissing-prototypes. */ -int yyparse (void); - -/* Error token number */ -#define YYTERROR 1 - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - - -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) ((void)Rhs) -#endif - - -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ -#define YYLEX yylex () - -YYSTYPE yylval; - -YYLTYPE yylloc; - -int yynerrs; -int yychar; - -static const int YYEOF = 0; -static const int YYEMPTY = -2; - -typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG; - -#define YYCHK(YYE) \ - do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; } \ - while (YYID (0)) - -#if YYDEBUG - -# ifndef YYFPRINTF -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, Type, \ - Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; - -#else /* !YYDEBUG */ - -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) - -#endif /* !YYDEBUG */ - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - -/* Minimum number of free items on the stack allowed after an - allocation. This is to allow allocation and initialization - to be completed by functions that call yyexpandGLRStack before the - stack is expanded, thus insuring that all necessary pointers get - properly redirected to new data. */ -#define YYHEADROOM 2 - -#ifndef YYSTACKEXPANDABLE -# if (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)) -# define YYSTACKEXPANDABLE 1 -# else -# define YYSTACKEXPANDABLE 0 -# endif -#endif - -#if YYSTACKEXPANDABLE -# define YY_RESERVE_GLRSTACK(Yystack) \ - do { \ - if (Yystack->yyspaceLeft < YYHEADROOM) \ - yyexpandGLRStack (Yystack); \ - } while (YYID (0)) -#else -# define YY_RESERVE_GLRSTACK(Yystack) \ - do { \ - if (Yystack->yyspaceLeft < YYHEADROOM) \ - yyMemoryExhausted (Yystack); \ - } while (YYID (0)) -#endif - - -#if YYERROR_VERBOSE - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static size_t -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - size_t yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return strlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -#endif /* !YYERROR_VERBOSE */ - -/** State numbers, as in LALR(1) machine */ -typedef int yyStateNum; - -/** Rule numbers, as in LALR(1) machine */ -typedef int yyRuleNum; - -/** Grammar symbol */ -typedef short int yySymbol; - -/** Item references, as in LALR(1) machine */ -typedef short int yyItemNum; - -typedef struct yyGLRState yyGLRState; -typedef struct yyGLRStateSet yyGLRStateSet; -typedef struct yySemanticOption yySemanticOption; -typedef union yyGLRStackItem yyGLRStackItem; -typedef struct yyGLRStack yyGLRStack; - -struct yyGLRState { - /** Type tag: always true. */ - yybool yyisState; - /** Type tag for yysemantics. If true, yysval applies, otherwise - * yyfirstVal applies. */ - yybool yyresolved; - /** Number of corresponding LALR(1) machine state. */ - yyStateNum yylrState; - /** Preceding state in this stack */ - yyGLRState* yypred; - /** Source position of the first token produced by my symbol */ - size_t yyposn; - union { - /** First in a chain of alternative reductions producing the - * non-terminal corresponding to this state, threaded through - * yynext. */ - yySemanticOption* yyfirstVal; - /** Semantic value for this state. */ - YYSTYPE yysval; - } yysemantics; - /** Source location for this state. */ - YYLTYPE yyloc; -}; - -struct yyGLRStateSet { - yyGLRState** yystates; - /** During nondeterministic operation, yylookaheadNeeds tracks which - * stacks have actually needed the current lookahead. During deterministic - * operation, yylookaheadNeeds[0] is not maintained since it would merely - * duplicate yychar != YYEMPTY. */ - yybool* yylookaheadNeeds; - size_t yysize, yycapacity; -}; - -struct yySemanticOption { - /** Type tag: always false. */ - yybool yyisState; - /** Rule number for this reduction */ - yyRuleNum yyrule; - /** The last RHS state in the list of states to be reduced. */ - yyGLRState* yystate; - /** The lookahead for this reduction. */ - int yyrawchar; - YYSTYPE yyval; - YYLTYPE yyloc; - /** Next sibling in chain of options. To facilitate merging, - * options are chained in decreasing order by address. */ - yySemanticOption* yynext; -}; - -/** Type of the items in the GLR stack. The yyisState field - * indicates which item of the union is valid. */ -union yyGLRStackItem { - yyGLRState yystate; - yySemanticOption yyoption; -}; - -struct yyGLRStack { - int yyerrState; - - - YYJMP_BUF yyexception_buffer; - yyGLRStackItem* yyitems; - yyGLRStackItem* yynextFree; - size_t yyspaceLeft; - yyGLRState* yysplitPoint; - yyGLRState* yylastDeleted; - yyGLRStateSet yytops; -}; - -#if YYSTACKEXPANDABLE -static void yyexpandGLRStack (yyGLRStack* yystackp); -#endif - -static void yyFail (yyGLRStack* yystackp, const char* yymsg) - __attribute__ ((__noreturn__)); -static void -yyFail (yyGLRStack* yystackp, const char* yymsg) -{ - if (yymsg != NULL) - yyerror (yymsg); - YYLONGJMP (yystackp->yyexception_buffer, 1); -} - -static void yyMemoryExhausted (yyGLRStack* yystackp) - __attribute__ ((__noreturn__)); -static void -yyMemoryExhausted (yyGLRStack* yystackp) -{ - YYLONGJMP (yystackp->yyexception_buffer, 2); -} - -#if YYDEBUG || YYERROR_VERBOSE -/** A printable representation of TOKEN. */ -static const char* -yytokenName (yySymbol yytoken) -{ - if (yytoken == YYEMPTY) - return ""; - - return yytname[yytoken]; -} -#endif - -/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting - * at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred - * containing the pointer to the next state in the chain. */ -static void yyfillin (yyGLRStackItem *, int, int); -static void -yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1) -{ - yyGLRState* s; - int i; - s = yyvsp[yylow0].yystate.yypred; - for (i = yylow0-1; i >= yylow1; i -= 1) - { - YYASSERT (s->yyresolved); - yyvsp[i].yystate.yyresolved = yytrue; - yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval; - yyvsp[i].yystate.yyloc = s->yyloc; - s = yyvsp[i].yystate.yypred = s->yypred; - } -} - -/* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in - * YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1. - * For convenience, always return YYLOW1. */ -static int yyfill (yyGLRStackItem *, int *, int, yybool); - -static int -yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal) -{ - if (!yynormal && yylow1 < *yylow) - { - yyfillin (yyvsp, *yylow, yylow1); - *yylow = yylow1; - } - return yylow1; -} - -/** Perform user action for rule number YYN, with RHS length YYRHSLEN, - * and top stack item YYVSP. YYLVALP points to place to put semantic - * value ($$), and yylocp points to place for location information - * (@$). Returns yyok for normal return, yyaccept for YYACCEPT, - * yyerr for YYERROR, yyabort for YYABORT. */ -/*ARGSUSED*/ static YYRESULTTAG -yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, - YYSTYPE* yyvalp, - YYLTYPE* YYOPTIONAL_LOC (yylocp), - yyGLRStack* yystackp - ) -{ - yybool yynormal = - (yystackp->yysplitPoint == NULL); - int yylow; -# undef yyerrok -# define yyerrok (yystackp->yyerrState = 0) -# undef YYACCEPT -# define YYACCEPT return yyaccept -# undef YYABORT -# define YYABORT return yyabort -# undef YYERROR -# define YYERROR return yyerrok, yyerr -# undef YYRECOVERING -# define YYRECOVERING() (yystackp->yyerrState != 0) -# undef yyclearin -# define yyclearin (yychar = YYEMPTY) -# undef YYFILL -# define YYFILL(N) yyfill (yyvsp, &yylow, N, yynormal) -# undef YYBACKUP -# define YYBACKUP(Token, Value) \ - return yyerror (YY_("syntax error: cannot back up")), \ - yyerrok, yyerr - - yylow = 1; - if (yyrhslen == 0) - *yyvalp = yyval_default; - else - *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval; - YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen); - - switch (yyn) - { - case 4: - -/* Line 936 of glr.c */ -#line 1471 "vtkParse.y" - { - startSig(); - clearType(); - clearTypeId(); - clearTemplate(); - closeComment(); - } - break; - - case 33: - -/* Line 936 of glr.c */ -#line 1524 "vtkParse.y" - { pushNamespace((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 34: - -/* Line 936 of glr.c */ -#line 1525 "vtkParse.y" - { popNamespace(); } - break; - - case 43: - -/* Line 936 of glr.c */ -#line 1548 "vtkParse.y" - { pushType(); } - break; - - case 44: - -/* Line 936 of glr.c */ -#line 1549 "vtkParse.y" - { - const char *name = (currentClass ? currentClass->Name : NULL); - popType(); - clearTypeId(); - if (name) - { - setTypeId(name); - setTypeBase(guess_id_type(name)); - } - end_class(); - } - break; - - case 45: - -/* Line 936 of glr.c */ -#line 1563 "vtkParse.y" - { - start_class((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (5))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (5))].yystate.yysemantics.yysval.integer)); - currentClass->IsFinal = (((yyGLRStackItem const *)yyvsp)[YYFILL ((4) - (5))].yystate.yysemantics.yysval.integer); - } - break; - - case 47: - -/* Line 936 of glr.c */ -#line 1569 "vtkParse.y" - { - start_class((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (4))].yystate.yysemantics.yysval.integer)); - currentClass->IsFinal = (((yyGLRStackItem const *)yyvsp)[YYFILL ((4) - (4))].yystate.yysemantics.yysval.integer); - } - break; - - case 48: - -/* Line 936 of glr.c */ -#line 1574 "vtkParse.y" - { - start_class(NULL, (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (3))].yystate.yysemantics.yysval.integer)); - } - break; - - case 50: - -/* Line 936 of glr.c */ -#line 1579 "vtkParse.y" - { - start_class(NULL, (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.integer)); - } - break; - - case 51: - -/* Line 936 of glr.c */ -#line 1584 "vtkParse.y" - { ((*yyvalp).integer) = 0; } - break; - - case 52: - -/* Line 936 of glr.c */ -#line 1585 "vtkParse.y" - { ((*yyvalp).integer) = 1; } - break; - - case 53: - -/* Line 936 of glr.c */ -#line 1586 "vtkParse.y" - { ((*yyvalp).integer) = 2; } - break; - - case 54: - -/* Line 936 of glr.c */ -#line 1590 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (3))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (3))].yystate.yysemantics.yysval.str)); } - break; - - case 55: - -/* Line 936 of glr.c */ -#line 1592 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat3("::", (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (4))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str)); } - break; - - case 59: - -/* Line 936 of glr.c */ -#line 1600 "vtkParse.y" - { ((*yyvalp).integer) = 0; } - break; - - case 60: - -/* Line 936 of glr.c */ -#line 1601 "vtkParse.y" - { ((*yyvalp).integer) = (strcmp((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str), "final") == 0); } - break; - - case 62: - -/* Line 936 of glr.c */ -#line 1605 "vtkParse.y" - { - startSig(); - clearType(); - clearTypeId(); - clearTemplate(); - closeComment(); - } - break; - - case 65: - -/* Line 936 of glr.c */ -#line 1617 "vtkParse.y" - { access_level = VTK_ACCESS_PUBLIC; } - break; - - case 66: - -/* Line 936 of glr.c */ -#line 1618 "vtkParse.y" - { access_level = VTK_ACCESS_PRIVATE; } - break; - - case 67: - -/* Line 936 of glr.c */ -#line 1619 "vtkParse.y" - { access_level = VTK_ACCESS_PROTECTED; } - break; - - case 91: - -/* Line 936 of glr.c */ -#line 1649 "vtkParse.y" - { output_friend_function(); } - break; - - case 94: - -/* Line 936 of glr.c */ -#line 1657 "vtkParse.y" - { add_base_class(currentClass, (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str), access_level, (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.integer)); } - break; - - case 95: - -/* Line 936 of glr.c */ -#line 1659 "vtkParse.y" - { add_base_class(currentClass, (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (4))].yystate.yysemantics.yysval.integer), - (VTK_PARSE_VIRTUAL | (((yyGLRStackItem const *)yyvsp)[YYFILL ((4) - (4))].yystate.yysemantics.yysval.integer))); } - break; - - case 96: - -/* Line 936 of glr.c */ -#line 1662 "vtkParse.y" - { add_base_class(currentClass, (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (4))].yystate.yysemantics.yysval.integer), - ((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (4))].yystate.yysemantics.yysval.integer) | (((yyGLRStackItem const *)yyvsp)[YYFILL ((4) - (4))].yystate.yysemantics.yysval.integer))); } - break; - - case 97: - -/* Line 936 of glr.c */ -#line 1666 "vtkParse.y" - { ((*yyvalp).integer) = 0; } - break; - - case 98: - -/* Line 936 of glr.c */ -#line 1667 "vtkParse.y" - { ((*yyvalp).integer) = VTK_PARSE_VIRTUAL; } - break; - - case 99: - -/* Line 936 of glr.c */ -#line 1670 "vtkParse.y" - { ((*yyvalp).integer) = access_level; } - break; - - case 101: - -/* Line 936 of glr.c */ -#line 1674 "vtkParse.y" - { ((*yyvalp).integer) = VTK_ACCESS_PUBLIC; } - break; - - case 102: - -/* Line 936 of glr.c */ -#line 1675 "vtkParse.y" - { ((*yyvalp).integer) = VTK_ACCESS_PRIVATE; } - break; - - case 103: - -/* Line 936 of glr.c */ -#line 1676 "vtkParse.y" - { ((*yyvalp).integer) = VTK_ACCESS_PROTECTED; } - break; - - case 109: - -/* Line 936 of glr.c */ -#line 1698 "vtkParse.y" - { pushType(); } - break; - - case 110: - -/* Line 936 of glr.c */ -#line 1699 "vtkParse.y" - { - popType(); - clearTypeId(); - if ((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (5))].yystate.yysemantics.yysval.str) != NULL) - { - setTypeId((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (5))].yystate.yysemantics.yysval.str)); - setTypeBase(guess_id_type((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (5))].yystate.yysemantics.yysval.str))); - } - end_enum(); - } - break; - - case 111: - -/* Line 936 of glr.c */ -#line 1712 "vtkParse.y" - { - start_enum((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (4))].yystate.yysemantics.yysval.integer), (((yyGLRStackItem const *)yyvsp)[YYFILL ((4) - (4))].yystate.yysemantics.yysval.integer), getTypeId()); - clearTypeId(); - ((*yyvalp).str) = (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str); - } - break; - - case 112: - -/* Line 936 of glr.c */ -#line 1718 "vtkParse.y" - { - start_enum(NULL, (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (3))].yystate.yysemantics.yysval.integer), (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.integer), getTypeId()); - clearTypeId(); - ((*yyvalp).str) = NULL; - } - break; - - case 113: - -/* Line 936 of glr.c */ -#line 1725 "vtkParse.y" - { ((*yyvalp).integer) = 0; } - break; - - case 114: - -/* Line 936 of glr.c */ -#line 1726 "vtkParse.y" - { ((*yyvalp).integer) = 1; } - break; - - case 115: - -/* Line 936 of glr.c */ -#line 1727 "vtkParse.y" - { ((*yyvalp).integer) = 1; } - break; - - case 116: - -/* Line 936 of glr.c */ -#line 1730 "vtkParse.y" - { ((*yyvalp).integer) = 0; } - break; - - case 117: - -/* Line 936 of glr.c */ -#line 1731 "vtkParse.y" - { pushType(); } - break; - - case 118: - -/* Line 936 of glr.c */ -#line 1732 "vtkParse.y" - { ((*yyvalp).integer) = getType(); popType(); } - break; - - case 122: - -/* Line 936 of glr.c */ -#line 1739 "vtkParse.y" - { add_enum((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str), NULL); } - break; - - case 123: - -/* Line 936 of glr.c */ -#line 1740 "vtkParse.y" - { postSig("="); markSig(); } - break; - - case 124: - -/* Line 936 of glr.c */ -#line 1741 "vtkParse.y" - { chopSig(); add_enum((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (4))].yystate.yysemantics.yysval.str), copySig()); } - break; - - case 147: - -/* Line 936 of glr.c */ -#line 1801 "vtkParse.y" - { pushFunction(); postSig("("); } - break; - - case 148: - -/* Line 936 of glr.c */ -#line 1802 "vtkParse.y" - { postSig(")"); } - break; - - case 149: - -/* Line 936 of glr.c */ -#line 1803 "vtkParse.y" - { ((*yyvalp).integer) = (VTK_PARSE_FUNCTION | (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (8))].yystate.yysemantics.yysval.integer)); popFunction(); } - break; - - case 150: - -/* Line 936 of glr.c */ -#line 1807 "vtkParse.y" - { - ValueInfo *item = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(item); - item->ItemType = VTK_TYPEDEF_INFO; - item->Access = access_level; - - handle_complex_type(item, getType(), (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.integer), getSig()); - - if (getVarName()) - { - item->Name = getVarName(); - } - - if (item->Class == NULL) - { - vtkParse_FreeValue(item); - } - else if (currentClass) - { - vtkParse_AddTypedefToClass(currentClass, item); - } - else - { - vtkParse_AddTypedefToNamespace(currentNamespace, item); - } - } - break; - - case 151: - -/* Line 936 of glr.c */ -#line 1840 "vtkParse.y" - { add_using((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (3))].yystate.yysemantics.yysval.str), 0); } - break; - - case 153: - -/* Line 936 of glr.c */ -#line 1844 "vtkParse.y" - { ((*yyvalp).str) = (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str); } - break; - - case 154: - -/* Line 936 of glr.c */ -#line 1846 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 155: - -/* Line 936 of glr.c */ -#line 1848 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 156: - -/* Line 936 of glr.c */ -#line 1850 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat3((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (3))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (3))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.str)); } - break; - - case 157: - -/* Line 936 of glr.c */ -#line 1852 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat3((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (3))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (3))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.str)); } - break; - - case 158: - -/* Line 936 of glr.c */ -#line 1855 "vtkParse.y" - { add_using((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str), 1); } - break; - - case 159: - -/* Line 936 of glr.c */ -#line 1858 "vtkParse.y" - { markSig(); } - break; - - case 160: - -/* Line 936 of glr.c */ -#line 1860 "vtkParse.y" - { - ValueInfo *item = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(item); - item->ItemType = VTK_TYPEDEF_INFO; - item->Access = access_level; - - handle_complex_type(item, getType(), (((yyGLRStackItem const *)yyvsp)[YYFILL ((6) - (8))].yystate.yysemantics.yysval.integer), copySig()); - - item->Name = (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (8))].yystate.yysemantics.yysval.str); - - if (currentTemplate) - { - vtkParse_FreeValue(item); - } - else if (currentClass) - { - vtkParse_AddTypedefToClass(currentClass, item); - } - else - { - vtkParse_AddTypedefToNamespace(currentNamespace, item); - } - } - break; - - case 161: - -/* Line 936 of glr.c */ -#line 1890 "vtkParse.y" - { postSig("template<> "); clearTypeId(); } - break; - - case 162: - -/* Line 936 of glr.c */ -#line 1892 "vtkParse.y" - { - postSig("template<"); - pushType(); - clearType(); - clearTypeId(); - startTemplate(); - } - break; - - case 163: - -/* Line 936 of glr.c */ -#line 1900 "vtkParse.y" - { - chopSig(); - if (getSig()[getSigLength()-1] == '>') { postSig(" "); } - postSig("> "); - clearTypeId(); - popType(); - } - break; - - case 165: - -/* Line 936 of glr.c */ -#line 1911 "vtkParse.y" - { chopSig(); postSig(", "); clearType(); clearTypeId(); } - break; - - case 167: - -/* Line 936 of glr.c */ -#line 1915 "vtkParse.y" - { markSig(); } - break; - - case 168: - -/* Line 936 of glr.c */ -#line 1917 "vtkParse.y" - { add_template_parameter(getType(), (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.integer), copySig()); } - break; - - case 170: - -/* Line 936 of glr.c */ -#line 1919 "vtkParse.y" - { markSig(); } - break; - - case 171: - -/* Line 936 of glr.c */ -#line 1921 "vtkParse.y" - { add_template_parameter(0, (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.integer), copySig()); } - break; - - case 173: - -/* Line 936 of glr.c */ -#line 1923 "vtkParse.y" - { pushTemplate(); markSig(); } - break; - - case 174: - -/* Line 936 of glr.c */ -#line 1924 "vtkParse.y" - { postSig("class "); } - break; - - case 175: - -/* Line 936 of glr.c */ -#line 1926 "vtkParse.y" - { - int i; - TemplateInfo *newTemplate = currentTemplate; - popTemplate(); - add_template_parameter(0, (((yyGLRStackItem const *)yyvsp)[YYFILL ((5) - (5))].yystate.yysemantics.yysval.integer), copySig()); - i = currentTemplate->NumberOfParameters-1; - currentTemplate->Parameters[i]->Template = newTemplate; - } - break; - - case 177: - -/* Line 936 of glr.c */ -#line 1937 "vtkParse.y" - { ((*yyvalp).integer) = 0; } - break; - - case 178: - -/* Line 936 of glr.c */ -#line 1938 "vtkParse.y" - { postSig("..."); ((*yyvalp).integer) = VTK_PARSE_PACK; } - break; - - case 179: - -/* Line 936 of glr.c */ -#line 1941 "vtkParse.y" - { postSig("class "); } - break; - - case 180: - -/* Line 936 of glr.c */ -#line 1942 "vtkParse.y" - { postSig("typename "); } - break; - - case 183: - -/* Line 936 of glr.c */ -#line 1948 "vtkParse.y" - { postSig("="); markSig(); } - break; - - case 184: - -/* Line 936 of glr.c */ -#line 1950 "vtkParse.y" - { - int i = currentTemplate->NumberOfParameters-1; - ValueInfo *param = currentTemplate->Parameters[i]; - chopSig(); - param->Value = copySig(); - } - break; - - case 187: - -/* Line 936 of glr.c */ -#line 1967 "vtkParse.y" - { output_function(); } - break; - - case 188: - -/* Line 936 of glr.c */ -#line 1968 "vtkParse.y" - { output_function(); } - break; - - case 189: - -/* Line 936 of glr.c */ -#line 1969 "vtkParse.y" - { reject_function(); } - break; - - case 190: - -/* Line 936 of glr.c */ -#line 1970 "vtkParse.y" - { reject_function(); } - break; - - case 198: - -/* Line 936 of glr.c */ -#line 1986 "vtkParse.y" - { output_function(); } - break; - - case 208: - -/* Line 936 of glr.c */ -#line 2004 "vtkParse.y" - { - postSig("("); - currentFunction->IsExplicit = ((getType() & VTK_PARSE_EXPLICIT) != 0); - set_return(currentFunction, getType(), getTypeId(), 0); - } - break; - - case 209: - -/* Line 936 of glr.c */ -#line 2009 "vtkParse.y" - { postSig(")"); } - break; - - case 210: - -/* Line 936 of glr.c */ -#line 2011 "vtkParse.y" - { - postSig(";"); - closeSig(); - currentFunction->IsOperator = 1; - currentFunction->Name = "operator typecast"; - currentFunction->Comment = vtkstrdup(getComment()); - vtkParseDebug("Parsed operator", "operator typecast"); - } - break; - - case 211: - -/* Line 936 of glr.c */ -#line 2022 "vtkParse.y" - { ((*yyvalp).str) = copySig(); } - break; - - case 212: - -/* Line 936 of glr.c */ -#line 2025 "vtkParse.y" - { postSig(")"); } - break; - - case 213: - -/* Line 936 of glr.c */ -#line 2027 "vtkParse.y" - { - postSig(";"); - closeSig(); - currentFunction->Name = (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (4))].yystate.yysemantics.yysval.str); - currentFunction->Comment = vtkstrdup(getComment()); - vtkParseDebug("Parsed operator", currentFunction->Name); - } - break; - - case 214: - -/* Line 936 of glr.c */ -#line 2037 "vtkParse.y" - { - postSig("("); - currentFunction->IsOperator = 1; - set_return(currentFunction, getType(), getTypeId(), 0); - } - break; - - case 216: - -/* Line 936 of glr.c */ -#line 2046 "vtkParse.y" - { chopSig(); ((*yyvalp).str) = vtkstrcat(copySig(), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 217: - -/* Line 936 of glr.c */ -#line 2049 "vtkParse.y" - { markSig(); postSig("operator "); } - break; - - case 218: - -/* Line 936 of glr.c */ -#line 2053 "vtkParse.y" - { - postSig(";"); - closeSig(); - currentFunction->Name = (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (3))].yystate.yysemantics.yysval.str); - currentFunction->Comment = vtkstrdup(getComment()); - vtkParseDebug("Parsed func", currentFunction->Name); - } - break; - - case 221: - -/* Line 936 of glr.c */ -#line 2065 "vtkParse.y" - { postSig(" throw "); } - break; - - case 222: - -/* Line 936 of glr.c */ -#line 2065 "vtkParse.y" - { chopSig(); } - break; - - case 223: - -/* Line 936 of glr.c */ -#line 2066 "vtkParse.y" - { postSig(" const"); currentFunction->IsConst = 1; } - break; - - case 224: - -/* Line 936 of glr.c */ -#line 2068 "vtkParse.y" - { - postSig(" = 0"); - currentFunction->IsPureVirtual = 1; - if (currentClass) { currentClass->IsAbstract = 1; } - } - break; - - case 225: - -/* Line 936 of glr.c */ -#line 2074 "vtkParse.y" - { - postSig(" "); postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); - if (strcmp((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str), "final") == 0) { currentFunction->IsFinal = 1; } - } - break; - - case 226: - -/* Line 936 of glr.c */ -#line 2078 "vtkParse.y" - { chopSig(); } - break; - - case 229: - -/* Line 936 of glr.c */ -#line 2083 "vtkParse.y" - { postSig(" noexcept"); } - break; - - case 230: - -/* Line 936 of glr.c */ -#line 2086 "vtkParse.y" - { currentFunction->IsDeleted = 1; } - break; - - case 234: - -/* Line 936 of glr.c */ -#line 2093 "vtkParse.y" - { postSig(" -> "); clearType(); clearTypeId(); } - break; - - case 235: - -/* Line 936 of glr.c */ -#line 2095 "vtkParse.y" - { - chopSig(); - set_return(currentFunction, getType(), getTypeId(), 0); - } - break; - - case 242: - -/* Line 936 of glr.c */ -#line 2113 "vtkParse.y" - { - postSig("("); - set_return(currentFunction, getType(), getTypeId(), 0); - } - break; - - case 243: - -/* Line 936 of glr.c */ -#line 2117 "vtkParse.y" - { postSig(")"); } - break; - - case 244: - -/* Line 936 of glr.c */ -#line 2125 "vtkParse.y" - { closeSig(); } - break; - - case 245: - -/* Line 936 of glr.c */ -#line 2126 "vtkParse.y" - { openSig(); } - break; - - case 246: - -/* Line 936 of glr.c */ -#line 2128 "vtkParse.y" - { - postSig(";"); - closeSig(); - if (getType() & VTK_PARSE_VIRTUAL) - { - currentFunction->IsVirtual = 1; - } - if (getType() & VTK_PARSE_EXPLICIT) - { - currentFunction->IsExplicit = 1; - } - currentFunction->Name = (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (6))].yystate.yysemantics.yysval.str); - currentFunction->Comment = vtkstrdup(getComment()); - vtkParseDebug("Parsed func", currentFunction->Name); - } - break; - - case 247: - -/* Line 936 of glr.c */ -#line 2145 "vtkParse.y" - { pushType(); postSig("("); } - break; - - case 248: - -/* Line 936 of glr.c */ -#line 2147 "vtkParse.y" - { popType(); postSig(")"); } - break; - - case 255: - -/* Line 936 of glr.c */ -#line 2164 "vtkParse.y" - { clearType(); clearTypeId(); } - break; - - case 257: - -/* Line 936 of glr.c */ -#line 2167 "vtkParse.y" - { clearType(); clearTypeId(); } - break; - - case 258: - -/* Line 936 of glr.c */ -#line 2168 "vtkParse.y" - { clearType(); clearTypeId(); postSig(", "); } - break; - - case 260: - -/* Line 936 of glr.c */ -#line 2171 "vtkParse.y" - { currentFunction->IsVariadic = 1; postSig(", ..."); } - break; - - case 261: - -/* Line 936 of glr.c */ -#line 2173 "vtkParse.y" - { currentFunction->IsVariadic = 1; postSig("..."); } - break; - - case 262: - -/* Line 936 of glr.c */ -#line 2176 "vtkParse.y" - { markSig(); } - break; - - case 263: - -/* Line 936 of glr.c */ -#line 2178 "vtkParse.y" - { - ValueInfo *param = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(param); - - handle_complex_type(param, getType(), (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.integer), copySig()); - add_legacy_parameter(currentFunction, param); - - if (getVarName()) - { - param->Name = getVarName(); - } - - vtkParse_AddParameterToFunction(currentFunction, param); - } - break; - - case 264: - -/* Line 936 of glr.c */ -#line 2193 "vtkParse.y" - { - int i = currentFunction->NumberOfParameters-1; - if (getVarValue()) - { - currentFunction->Parameters[i]->Value = getVarValue(); - } - } - break; - - case 265: - -/* Line 936 of glr.c */ -#line 2202 "vtkParse.y" - { clearVarValue(); } - break; - - case 267: - -/* Line 936 of glr.c */ -#line 2206 "vtkParse.y" - { postSig("="); clearVarValue(); markSig(); } - break; - - case 268: - -/* Line 936 of glr.c */ -#line 2207 "vtkParse.y" - { chopSig(); setVarValue(copySig()); } - break; - - case 269: - -/* Line 936 of glr.c */ -#line 2208 "vtkParse.y" - { clearVarValue(); markSig(); } - break; - - case 270: - -/* Line 936 of glr.c */ -#line 2209 "vtkParse.y" - { chopSig(); setVarValue(copySig()); } - break; - - case 272: - -/* Line 936 of glr.c */ -#line 2220 "vtkParse.y" - { - unsigned int type = getType(); - ValueInfo *var = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(var); - var->ItemType = VTK_VARIABLE_INFO; - var->Access = access_level; - - handle_complex_type(var, type, (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.integer), getSig()); - - var->Name = getVarName(); - - if (getVarValue()) - { - var->Value = getVarValue(); - } - - /* Is this a typedef? */ - if ((type & VTK_PARSE_TYPEDEF) != 0) - { - var->ItemType = VTK_TYPEDEF_INFO; - if (currentClass) - { - vtkParse_AddTypedefToClass(currentClass, var); - } - else - { - vtkParse_AddTypedefToNamespace(currentNamespace, var); - } - } - /* Is this a constant? */ - else if (((type & VTK_PARSE_CONST) != 0) && var->Value != NULL && - (((type & VTK_PARSE_INDIRECT) == 0) || - ((type & VTK_PARSE_INDIRECT) == VTK_PARSE_ARRAY))) - { - var->ItemType = VTK_CONSTANT_INFO; - if (currentClass) - { - vtkParse_AddConstantToClass(currentClass, var); - } - else - { - vtkParse_AddConstantToNamespace(currentNamespace, var); - } - } - /* This is a true variable i.e. not constant */ - else - { - if (currentClass) - { - vtkParse_AddVariableToClass(currentClass, var); - } - else - { - vtkParse_AddVariableToNamespace(currentNamespace, var); - } - } - } - break; - - case 276: - -/* Line 936 of glr.c */ -#line 2282 "vtkParse.y" - { postSig(", "); } - break; - - case 279: - -/* Line 936 of glr.c */ -#line 2288 "vtkParse.y" - { setTypePtr(0); } - break; - - case 280: - -/* Line 936 of glr.c */ -#line 2289 "vtkParse.y" - { setTypePtr((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.integer)); } - break; - - case 281: - -/* Line 936 of glr.c */ -#line 2294 "vtkParse.y" - { - if ((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.integer) == VTK_PARSE_FUNCTION) - { - ((*yyvalp).integer) = (VTK_PARSE_FUNCTION_PTR | (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (3))].yystate.yysemantics.yysval.integer)); - } - else - { - ((*yyvalp).integer) = (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (3))].yystate.yysemantics.yysval.integer); - } - } - break; - - case 282: - -/* Line 936 of glr.c */ -#line 2304 "vtkParse.y" - { postSig(")"); } - break; - - case 283: - -/* Line 936 of glr.c */ -#line 2306 "vtkParse.y" - { - const char *scope = getScope(); - unsigned int parens = add_indirection((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (6))].yystate.yysemantics.yysval.integer), (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (6))].yystate.yysemantics.yysval.integer)); - if ((((yyGLRStackItem const *)yyvsp)[YYFILL ((6) - (6))].yystate.yysemantics.yysval.integer) == VTK_PARSE_FUNCTION) - { - if (scope) { scope = vtkstrndup(scope, strlen(scope) - 2); } - getFunction()->Class = scope; - ((*yyvalp).integer) = (parens | VTK_PARSE_FUNCTION); - } - else if ((((yyGLRStackItem const *)yyvsp)[YYFILL ((6) - (6))].yystate.yysemantics.yysval.integer) == VTK_PARSE_ARRAY) - { - ((*yyvalp).integer) = add_indirection_to_array(parens); - } - } - break; - - case 284: - -/* Line 936 of glr.c */ -#line 2324 "vtkParse.y" - { ((*yyvalp).integer) = (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (3))].yystate.yysemantics.yysval.integer); } - break; - - case 285: - -/* Line 936 of glr.c */ -#line 2325 "vtkParse.y" - { postSig(")"); } - break; - - case 286: - -/* Line 936 of glr.c */ -#line 2327 "vtkParse.y" - { - const char *scope = getScope(); - unsigned int parens = add_indirection((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (5))].yystate.yysemantics.yysval.integer), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (5))].yystate.yysemantics.yysval.integer)); - if ((((yyGLRStackItem const *)yyvsp)[YYFILL ((5) - (5))].yystate.yysemantics.yysval.integer) == VTK_PARSE_FUNCTION) - { - if (scope) { scope = vtkstrndup(scope, strlen(scope) - 2); } - getFunction()->Class = scope; - ((*yyvalp).integer) = (parens | VTK_PARSE_FUNCTION); - } - else if ((((yyGLRStackItem const *)yyvsp)[YYFILL ((5) - (5))].yystate.yysemantics.yysval.integer) == VTK_PARSE_ARRAY) - { - ((*yyvalp).integer) = add_indirection_to_array(parens); - } - } - break; - - case 287: - -/* Line 936 of glr.c */ -#line 2343 "vtkParse.y" - { postSig("("); scopeSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); postSig("*"); } - break; - - case 288: - -/* Line 936 of glr.c */ -#line 2344 "vtkParse.y" - { ((*yyvalp).integer) = (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.integer); } - break; - - case 289: - -/* Line 936 of glr.c */ -#line 2345 "vtkParse.y" - { postSig("("); scopeSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); postSig("&"); - ((*yyvalp).integer) = VTK_PARSE_REF; } - break; - - case 290: - -/* Line 936 of glr.c */ -#line 2349 "vtkParse.y" - { ((*yyvalp).integer) = 0; } - break; - - case 291: - -/* Line 936 of glr.c */ -#line 2350 "vtkParse.y" - { pushFunction(); postSig("("); } - break; - - case 292: - -/* Line 936 of glr.c */ -#line 2351 "vtkParse.y" - { postSig(")"); } - break; - - case 293: - -/* Line 936 of glr.c */ -#line 2352 "vtkParse.y" - { - ((*yyvalp).integer) = VTK_PARSE_FUNCTION; - popFunction(); - } - break; - - case 294: - -/* Line 936 of glr.c */ -#line 2356 "vtkParse.y" - { ((*yyvalp).integer) = VTK_PARSE_ARRAY; } - break; - - case 297: - -/* Line 936 of glr.c */ -#line 2360 "vtkParse.y" - { currentFunction->IsConst = 1; } - break; - - case 302: - -/* Line 936 of glr.c */ -#line 2368 "vtkParse.y" - { ((*yyvalp).integer) = add_indirection((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.integer), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.integer)); } - break; - - case 304: - -/* Line 936 of glr.c */ -#line 2373 "vtkParse.y" - { ((*yyvalp).integer) = add_indirection((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.integer), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.integer)); } - break; - - case 305: - -/* Line 936 of glr.c */ -#line 2376 "vtkParse.y" - { clearVarName(); chopSig(); } - break; - - case 307: - -/* Line 936 of glr.c */ -#line 2380 "vtkParse.y" - { setVarName((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 308: - -/* Line 936 of glr.c */ -#line 2382 "vtkParse.y" - { setVarName((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (4))].yystate.yysemantics.yysval.str)); } - break; - - case 312: - -/* Line 936 of glr.c */ -#line 2390 "vtkParse.y" - { clearArray(); } - break; - - case 314: - -/* Line 936 of glr.c */ -#line 2394 "vtkParse.y" - { clearArray(); } - break; - - case 318: - -/* Line 936 of glr.c */ -#line 2401 "vtkParse.y" - { postSig("["); } - break; - - case 319: - -/* Line 936 of glr.c */ -#line 2402 "vtkParse.y" - { postSig("]"); } - break; - - case 320: - -/* Line 936 of glr.c */ -#line 2405 "vtkParse.y" - { pushArraySize(""); } - break; - - case 321: - -/* Line 936 of glr.c */ -#line 2406 "vtkParse.y" - { markSig(); } - break; - - case 322: - -/* Line 936 of glr.c */ -#line 2406 "vtkParse.y" - { chopSig(); pushArraySize(copySig()); } - break; - - case 328: - -/* Line 936 of glr.c */ -#line 2420 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat("~", (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 329: - -/* Line 936 of glr.c */ -#line 2421 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat("~", (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 330: - -/* Line 936 of glr.c */ -#line 2425 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 331: - -/* Line 936 of glr.c */ -#line 2427 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 332: - -/* Line 936 of glr.c */ -#line 2429 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 333: - -/* Line 936 of glr.c */ -#line 2433 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 334: - -/* Line 936 of glr.c */ -#line 2435 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 335: - -/* Line 936 of glr.c */ -#line 2437 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 336: - -/* Line 936 of glr.c */ -#line 2439 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat3((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (3))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (3))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.str)); } - break; - - case 337: - -/* Line 936 of glr.c */ -#line 2441 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat3((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (3))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (3))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.str)); } - break; - - case 338: - -/* Line 936 of glr.c */ -#line 2443 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat3((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (3))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (3))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.str)); } - break; - - case 339: - -/* Line 936 of glr.c */ -#line 2444 "vtkParse.y" - { postSig("template "); } - break; - - case 340: - -/* Line 936 of glr.c */ -#line 2446 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat4((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (5))].yystate.yysemantics.yysval.str), "template ", (((yyGLRStackItem const *)yyvsp)[YYFILL ((4) - (5))].yystate.yysemantics.yysval.str), (((yyGLRStackItem const *)yyvsp)[YYFILL ((5) - (5))].yystate.yysemantics.yysval.str)); } - break; - - case 341: - -/* Line 936 of glr.c */ -#line 2449 "vtkParse.y" - { postSig("~"); } - break; - - case 342: - -/* Line 936 of glr.c */ -#line 2452 "vtkParse.y" - { postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); } - break; - - case 343: - -/* Line 936 of glr.c */ -#line 2455 "vtkParse.y" - { ((*yyvalp).str) = "::"; postSig(((*yyvalp).str)); } - break; - - case 344: - -/* Line 936 of glr.c */ -#line 2458 "vtkParse.y" - { markSig(); postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str)); postSig("<"); } - break; - - case 345: - -/* Line 936 of glr.c */ -#line 2460 "vtkParse.y" - { - chopSig(); if (getSig()[getSigLength()-1] == '>') { postSig(" "); } - postSig(">"); ((*yyvalp).str) = copySig(); clearTypeId(); - } - break; - - case 346: - -/* Line 936 of glr.c */ -#line 2466 "vtkParse.y" - { markSig(); postSig("decltype"); } - break; - - case 347: - -/* Line 936 of glr.c */ -#line 2467 "vtkParse.y" - { chopSig(); ((*yyvalp).str) = copySig(); clearTypeId(); } - break; - - case 348: - -/* Line 936 of glr.c */ -#line 2475 "vtkParse.y" - { postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); } - break; - - case 349: - -/* Line 936 of glr.c */ -#line 2476 "vtkParse.y" - { postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); } - break; - - case 350: - -/* Line 936 of glr.c */ -#line 2477 "vtkParse.y" - { postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); } - break; - - case 351: - -/* Line 936 of glr.c */ -#line 2478 "vtkParse.y" - { postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); } - break; - - case 352: - -/* Line 936 of glr.c */ -#line 2479 "vtkParse.y" - { postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); } - break; - - case 353: - -/* Line 936 of glr.c */ -#line 2480 "vtkParse.y" - { postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); } - break; - - case 354: - -/* Line 936 of glr.c */ -#line 2481 "vtkParse.y" - { postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); } - break; - - case 355: - -/* Line 936 of glr.c */ -#line 2482 "vtkParse.y" - { postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); } - break; - - case 356: - -/* Line 936 of glr.c */ -#line 2483 "vtkParse.y" - { postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); } - break; - - case 357: - -/* Line 936 of glr.c */ -#line 2484 "vtkParse.y" - { postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); } - break; - - case 358: - -/* Line 936 of glr.c */ -#line 2485 "vtkParse.y" - { ((*yyvalp).str) = "vtkTypeInt8"; postSig(((*yyvalp).str)); } - break; - - case 359: - -/* Line 936 of glr.c */ -#line 2486 "vtkParse.y" - { ((*yyvalp).str) = "vtkTypeUInt8"; postSig(((*yyvalp).str)); } - break; - - case 360: - -/* Line 936 of glr.c */ -#line 2487 "vtkParse.y" - { ((*yyvalp).str) = "vtkTypeInt16"; postSig(((*yyvalp).str)); } - break; - - case 361: - -/* Line 936 of glr.c */ -#line 2488 "vtkParse.y" - { ((*yyvalp).str) = "vtkTypeUInt16"; postSig(((*yyvalp).str)); } - break; - - case 362: - -/* Line 936 of glr.c */ -#line 2489 "vtkParse.y" - { ((*yyvalp).str) = "vtkTypeInt32"; postSig(((*yyvalp).str)); } - break; - - case 363: - -/* Line 936 of glr.c */ -#line 2490 "vtkParse.y" - { ((*yyvalp).str) = "vtkTypeUInt32"; postSig(((*yyvalp).str)); } - break; - - case 364: - -/* Line 936 of glr.c */ -#line 2491 "vtkParse.y" - { ((*yyvalp).str) = "vtkTypeInt64"; postSig(((*yyvalp).str)); } - break; - - case 365: - -/* Line 936 of glr.c */ -#line 2492 "vtkParse.y" - { ((*yyvalp).str) = "vtkTypeUInt64"; postSig(((*yyvalp).str)); } - break; - - case 366: - -/* Line 936 of glr.c */ -#line 2493 "vtkParse.y" - { ((*yyvalp).str) = "vtkTypeFloat32"; postSig(((*yyvalp).str)); } - break; - - case 367: - -/* Line 936 of glr.c */ -#line 2494 "vtkParse.y" - { ((*yyvalp).str) = "vtkTypeFloat64"; postSig(((*yyvalp).str)); } - break; - - case 368: - -/* Line 936 of glr.c */ -#line 2495 "vtkParse.y" - { ((*yyvalp).str) = "vtkIdType"; postSig(((*yyvalp).str)); } - break; - - case 379: - -/* Line 936 of glr.c */ -#line 2520 "vtkParse.y" - { setTypeBase(buildTypeBase(getType(), (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.integer))); } - break; - - case 380: - -/* Line 936 of glr.c */ -#line 2521 "vtkParse.y" - { setTypeMod(VTK_PARSE_TYPEDEF); } - break; - - case 381: - -/* Line 936 of glr.c */ -#line 2522 "vtkParse.y" - { setTypeMod(VTK_PARSE_FRIEND); } - break; - - case 384: - -/* Line 936 of glr.c */ -#line 2529 "vtkParse.y" - { setTypeMod((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.integer)); } - break; - - case 385: - -/* Line 936 of glr.c */ -#line 2530 "vtkParse.y" - { setTypeMod((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.integer)); } - break; - - case 386: - -/* Line 936 of glr.c */ -#line 2531 "vtkParse.y" - { setTypeMod((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.integer)); } - break; - - case 387: - -/* Line 936 of glr.c */ -#line 2532 "vtkParse.y" - { postSig("constexpr "); ((*yyvalp).integer) = 0; } - break; - - case 388: - -/* Line 936 of glr.c */ -#line 2535 "vtkParse.y" - { postSig("mutable "); ((*yyvalp).integer) = VTK_PARSE_MUTABLE; } - break; - - case 389: - -/* Line 936 of glr.c */ -#line 2536 "vtkParse.y" - { ((*yyvalp).integer) = 0; } - break; - - case 390: - -/* Line 936 of glr.c */ -#line 2537 "vtkParse.y" - { ((*yyvalp).integer) = 0; } - break; - - case 391: - -/* Line 936 of glr.c */ -#line 2538 "vtkParse.y" - { postSig("static "); ((*yyvalp).integer) = VTK_PARSE_STATIC; } - break; - - case 392: - -/* Line 936 of glr.c */ -#line 2540 "vtkParse.y" - { postSig("thread_local "); ((*yyvalp).integer) = VTK_PARSE_THREAD_LOCAL; } - break; - - case 393: - -/* Line 936 of glr.c */ -#line 2543 "vtkParse.y" - { ((*yyvalp).integer) = 0; } - break; - - case 394: - -/* Line 936 of glr.c */ -#line 2544 "vtkParse.y" - { postSig("virtual "); ((*yyvalp).integer) = VTK_PARSE_VIRTUAL; } - break; - - case 395: - -/* Line 936 of glr.c */ -#line 2545 "vtkParse.y" - { postSig("explicit "); ((*yyvalp).integer) = VTK_PARSE_EXPLICIT; } - break; - - case 396: - -/* Line 936 of glr.c */ -#line 2548 "vtkParse.y" - { postSig("const "); ((*yyvalp).integer) = VTK_PARSE_CONST; } - break; - - case 397: - -/* Line 936 of glr.c */ -#line 2549 "vtkParse.y" - { postSig("volatile "); ((*yyvalp).integer) = VTK_PARSE_VOLATILE; } - break; - - case 399: - -/* Line 936 of glr.c */ -#line 2554 "vtkParse.y" - { ((*yyvalp).integer) = ((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.integer) | (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.integer)); } - break; - - case 401: - -/* Line 936 of glr.c */ -#line 2564 "vtkParse.y" - { setTypeBase((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.integer)); } - break; - - case 403: - -/* Line 936 of glr.c */ -#line 2566 "vtkParse.y" - { setTypeBase((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.integer)); } - break; - - case 406: - -/* Line 936 of glr.c */ -#line 2572 "vtkParse.y" - { postSig(" "); setTypeId((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = guess_id_type((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.str)); } - break; - - case 407: - -/* Line 936 of glr.c */ -#line 2574 "vtkParse.y" - { postSig(" "); setTypeId((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = guess_id_type((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str)); } - break; - - case 409: - -/* Line 936 of glr.c */ -#line 2579 "vtkParse.y" - { postSig(" "); setTypeId((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = 0; } - break; - - case 410: - -/* Line 936 of glr.c */ -#line 2580 "vtkParse.y" - { postSig("typename "); } - break; - - case 411: - -/* Line 936 of glr.c */ -#line 2581 "vtkParse.y" - { postSig(" "); setTypeId((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = guess_id_type((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str)); } - break; - - case 412: - -/* Line 936 of glr.c */ -#line 2583 "vtkParse.y" - { postSig(" "); setTypeId((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = guess_id_type((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 413: - -/* Line 936 of glr.c */ -#line 2585 "vtkParse.y" - { postSig(" "); setTypeId((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = guess_id_type((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 415: - -/* Line 936 of glr.c */ -#line 2591 "vtkParse.y" - { setTypeBase((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.integer)); } - break; - - case 417: - -/* Line 936 of glr.c */ -#line 2593 "vtkParse.y" - { setTypeBase((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.integer)); } - break; - - case 420: - -/* Line 936 of glr.c */ -#line 2600 "vtkParse.y" - { setTypeBase((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.integer)); } - break; - - case 422: - -/* Line 936 of glr.c */ -#line 2602 "vtkParse.y" - { setTypeBase((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.integer)); } - break; - - case 425: - -/* Line 936 of glr.c */ -#line 2608 "vtkParse.y" - { postSig(" "); setTypeId((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = 0; } - break; - - case 426: - -/* Line 936 of glr.c */ -#line 2610 "vtkParse.y" - { postSig(" "); setTypeId((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = guess_id_type((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); } - break; - - case 427: - -/* Line 936 of glr.c */ -#line 2612 "vtkParse.y" - { postSig(" "); setTypeId((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = guess_id_type((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); } - break; - - case 428: - -/* Line 936 of glr.c */ -#line 2614 "vtkParse.y" - { postSig(" "); setTypeId((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = guess_id_type((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 429: - -/* Line 936 of glr.c */ -#line 2616 "vtkParse.y" - { postSig(" "); setTypeId((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = guess_id_type((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 430: - -/* Line 936 of glr.c */ -#line 2618 "vtkParse.y" - { postSig(" "); setTypeId((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = guess_id_type((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 431: - -/* Line 936 of glr.c */ -#line 2621 "vtkParse.y" - { setTypeId(""); } - break; - - case 433: - -/* Line 936 of glr.c */ -#line 2625 "vtkParse.y" - { typeSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = VTK_PARSE_STRING; } - break; - - case 434: - -/* Line 936 of glr.c */ -#line 2626 "vtkParse.y" - { typeSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = VTK_PARSE_UNICODE_STRING;} - break; - - case 435: - -/* Line 936 of glr.c */ -#line 2627 "vtkParse.y" - { typeSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = VTK_PARSE_OSTREAM; } - break; - - case 436: - -/* Line 936 of glr.c */ -#line 2628 "vtkParse.y" - { typeSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = VTK_PARSE_ISTREAM; } - break; - - case 437: - -/* Line 936 of glr.c */ -#line 2629 "vtkParse.y" - { typeSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = VTK_PARSE_UNKNOWN; } - break; - - case 438: - -/* Line 936 of glr.c */ -#line 2630 "vtkParse.y" - { typeSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = VTK_PARSE_OBJECT; } - break; - - case 439: - -/* Line 936 of glr.c */ -#line 2631 "vtkParse.y" - { typeSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = VTK_PARSE_QOBJECT; } - break; - - case 440: - -/* Line 936 of glr.c */ -#line 2632 "vtkParse.y" - { typeSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = VTK_PARSE_NULLPTR_T; } - break; - - case 441: - -/* Line 936 of glr.c */ -#line 2633 "vtkParse.y" - { typeSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = VTK_PARSE_SSIZE_T; } - break; - - case 442: - -/* Line 936 of glr.c */ -#line 2634 "vtkParse.y" - { typeSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); ((*yyvalp).integer) = VTK_PARSE_SIZE_T; } - break; - - case 443: - -/* Line 936 of glr.c */ -#line 2635 "vtkParse.y" - { typeSig("vtkTypeInt8"); ((*yyvalp).integer) = VTK_PARSE_INT8; } - break; - - case 444: - -/* Line 936 of glr.c */ -#line 2636 "vtkParse.y" - { typeSig("vtkTypeUInt8"); ((*yyvalp).integer) = VTK_PARSE_UINT8; } - break; - - case 445: - -/* Line 936 of glr.c */ -#line 2637 "vtkParse.y" - { typeSig("vtkTypeInt16"); ((*yyvalp).integer) = VTK_PARSE_INT16; } - break; - - case 446: - -/* Line 936 of glr.c */ -#line 2638 "vtkParse.y" - { typeSig("vtkTypeUInt16"); ((*yyvalp).integer) = VTK_PARSE_UINT16; } - break; - - case 447: - -/* Line 936 of glr.c */ -#line 2639 "vtkParse.y" - { typeSig("vtkTypeInt32"); ((*yyvalp).integer) = VTK_PARSE_INT32; } - break; - - case 448: - -/* Line 936 of glr.c */ -#line 2640 "vtkParse.y" - { typeSig("vtkTypeUInt32"); ((*yyvalp).integer) = VTK_PARSE_UINT32; } - break; - - case 449: - -/* Line 936 of glr.c */ -#line 2641 "vtkParse.y" - { typeSig("vtkTypeInt64"); ((*yyvalp).integer) = VTK_PARSE_INT64; } - break; - - case 450: - -/* Line 936 of glr.c */ -#line 2642 "vtkParse.y" - { typeSig("vtkTypeUInt64"); ((*yyvalp).integer) = VTK_PARSE_UINT64; } - break; - - case 451: - -/* Line 936 of glr.c */ -#line 2643 "vtkParse.y" - { typeSig("vtkTypeFloat32"); ((*yyvalp).integer) = VTK_PARSE_FLOAT32; } - break; - - case 452: - -/* Line 936 of glr.c */ -#line 2644 "vtkParse.y" - { typeSig("vtkTypeFloat64"); ((*yyvalp).integer) = VTK_PARSE_FLOAT64; } - break; - - case 453: - -/* Line 936 of glr.c */ -#line 2645 "vtkParse.y" - { typeSig("vtkIdType"); ((*yyvalp).integer) = VTK_PARSE_ID_TYPE; } - break; - - case 454: - -/* Line 936 of glr.c */ -#line 2648 "vtkParse.y" - { postSig("auto "); ((*yyvalp).integer) = 0; } - break; - - case 455: - -/* Line 936 of glr.c */ -#line 2649 "vtkParse.y" - { postSig("void "); ((*yyvalp).integer) = VTK_PARSE_VOID; } - break; - - case 456: - -/* Line 936 of glr.c */ -#line 2650 "vtkParse.y" - { postSig("bool "); ((*yyvalp).integer) = VTK_PARSE_BOOL; } - break; - - case 457: - -/* Line 936 of glr.c */ -#line 2651 "vtkParse.y" - { postSig("float "); ((*yyvalp).integer) = VTK_PARSE_FLOAT; } - break; - - case 458: - -/* Line 936 of glr.c */ -#line 2652 "vtkParse.y" - { postSig("double "); ((*yyvalp).integer) = VTK_PARSE_DOUBLE; } - break; - - case 459: - -/* Line 936 of glr.c */ -#line 2653 "vtkParse.y" - { postSig("char "); ((*yyvalp).integer) = VTK_PARSE_CHAR; } - break; - - case 460: - -/* Line 936 of glr.c */ -#line 2654 "vtkParse.y" - { postSig("char16_t "); ((*yyvalp).integer) = VTK_PARSE_CHAR16_T; } - break; - - case 461: - -/* Line 936 of glr.c */ -#line 2655 "vtkParse.y" - { postSig("char32_t "); ((*yyvalp).integer) = VTK_PARSE_CHAR32_T; } - break; - - case 462: - -/* Line 936 of glr.c */ -#line 2656 "vtkParse.y" - { postSig("wchar_t "); ((*yyvalp).integer) = VTK_PARSE_WCHAR_T; } - break; - - case 463: - -/* Line 936 of glr.c */ -#line 2657 "vtkParse.y" - { postSig("int "); ((*yyvalp).integer) = VTK_PARSE_INT; } - break; - - case 464: - -/* Line 936 of glr.c */ -#line 2658 "vtkParse.y" - { postSig("short "); ((*yyvalp).integer) = VTK_PARSE_SHORT; } - break; - - case 465: - -/* Line 936 of glr.c */ -#line 2659 "vtkParse.y" - { postSig("long "); ((*yyvalp).integer) = VTK_PARSE_LONG; } - break; - - case 466: - -/* Line 936 of glr.c */ -#line 2660 "vtkParse.y" - { postSig("__int64 "); ((*yyvalp).integer) = VTK_PARSE___INT64; } - break; - - case 467: - -/* Line 936 of glr.c */ -#line 2661 "vtkParse.y" - { postSig("signed "); ((*yyvalp).integer) = VTK_PARSE_INT; } - break; - - case 468: - -/* Line 936 of glr.c */ -#line 2662 "vtkParse.y" - { postSig("unsigned "); ((*yyvalp).integer) = VTK_PARSE_UNSIGNED_INT; } - break; - - case 472: - -/* Line 936 of glr.c */ -#line 2685 "vtkParse.y" - { ((*yyvalp).integer) = ((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.integer) | (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.integer)); } - break; - - case 473: - -/* Line 936 of glr.c */ -#line 2689 "vtkParse.y" - { postSig("&"); ((*yyvalp).integer) = VTK_PARSE_REF; } - break; - - case 474: - -/* Line 936 of glr.c */ -#line 2693 "vtkParse.y" - { postSig("&&"); ((*yyvalp).integer) = (VTK_PARSE_RVALUE | VTK_PARSE_REF); } - break; - - case 475: - -/* Line 936 of glr.c */ -#line 2696 "vtkParse.y" - { postSig("*"); } - break; - - case 476: - -/* Line 936 of glr.c */ -#line 2697 "vtkParse.y" - { ((*yyvalp).integer) = (((yyGLRStackItem const *)yyvsp)[YYFILL ((4) - (4))].yystate.yysemantics.yysval.integer); } - break; - - case 477: - -/* Line 936 of glr.c */ -#line 2700 "vtkParse.y" - { ((*yyvalp).integer) = VTK_PARSE_POINTER; } - break; - - case 478: - -/* Line 936 of glr.c */ -#line 2702 "vtkParse.y" - { - if (((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.integer) & VTK_PARSE_CONST) != 0) - { - ((*yyvalp).integer) = VTK_PARSE_CONST_POINTER; - } - if (((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.integer) & VTK_PARSE_VOLATILE) != 0) - { - ((*yyvalp).integer) = VTK_PARSE_BAD_INDIRECT; - } - } - break; - - case 480: - -/* Line 936 of glr.c */ -#line 2718 "vtkParse.y" - { - unsigned int n; - n = (((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (2))].yystate.yysemantics.yysval.integer) << 2) | (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.integer)); - if ((n & VTK_PARSE_INDIRECT) != n) - { - n = VTK_PARSE_BAD_INDIRECT; - } - ((*yyvalp).integer) = n; - } - break; - - case 483: - -/* Line 936 of glr.c */ -#line 2737 "vtkParse.y" - { closeSig(); } - break; - - case 484: - -/* Line 936 of glr.c */ -#line 2737 "vtkParse.y" - { openSig(); } - break; - - case 486: - -/* Line 936 of glr.c */ -#line 2744 "vtkParse.y" - {preSig("void Set"); postSig("(");} - break; - - case 487: - -/* Line 936 of glr.c */ -#line 2745 "vtkParse.y" - { - postSig("a);"); - currentFunction->Macro = "vtkSetMacro"; - currentFunction->Name = vtkstrcat("Set", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str)); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, getType(), getTypeId(), 0); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - } - break; - - case 488: - -/* Line 936 of glr.c */ -#line 2754 "vtkParse.y" - {postSig("Get");} - break; - - case 489: - -/* Line 936 of glr.c */ -#line 2755 "vtkParse.y" - {markSig();} - break; - - case 490: - -/* Line 936 of glr.c */ -#line 2755 "vtkParse.y" - {swapSig();} - break; - - case 491: - -/* Line 936 of glr.c */ -#line 2756 "vtkParse.y" - { - postSig("();"); - currentFunction->Macro = "vtkGetMacro"; - currentFunction->Name = vtkstrcat("Get", (((yyGLRStackItem const *)yyvsp)[YYFILL ((4) - (9))].yystate.yysemantics.yysval.str)); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, getType(), getTypeId(), 0); - output_function(); - } - break; - - case 492: - -/* Line 936 of glr.c */ -#line 2764 "vtkParse.y" - {preSig("void Set");} - break; - - case 493: - -/* Line 936 of glr.c */ -#line 2765 "vtkParse.y" - { - postSig("(char *);"); - currentFunction->Macro = "vtkSetStringMacro"; - currentFunction->Name = vtkstrcat("Set", (((yyGLRStackItem const *)yyvsp)[YYFILL ((4) - (5))].yystate.yysemantics.yysval.str)); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_CHAR_PTR, "char", 0); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - } - break; - - case 494: - -/* Line 936 of glr.c */ -#line 2774 "vtkParse.y" - {preSig("char *Get");} - break; - - case 495: - -/* Line 936 of glr.c */ -#line 2775 "vtkParse.y" - { - postSig("();"); - currentFunction->Macro = "vtkGetStringMacro"; - currentFunction->Name = vtkstrcat("Get", (((yyGLRStackItem const *)yyvsp)[YYFILL ((4) - (5))].yystate.yysemantics.yysval.str)); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_CHAR_PTR, "char", 0); - output_function(); - } - break; - - case 496: - -/* Line 936 of glr.c */ -#line 2783 "vtkParse.y" - {startSig(); markSig();} - break; - - case 497: - -/* Line 936 of glr.c */ -#line 2783 "vtkParse.y" - {closeSig();} - break; - - case 498: - -/* Line 936 of glr.c */ -#line 2785 "vtkParse.y" - { - const char *typeText; - chopSig(); - typeText = copySig(); - - currentFunction->Macro = "vtkSetClampMacro"; - currentFunction->Name = vtkstrcat("Set", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (10))].yystate.yysemantics.yysval.str)); - currentFunction->Signature = - vtkstrcat5("void ", currentFunction->Name, "(", typeText, ");"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, getType(), getTypeId(), 0); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = "vtkSetClampMacro"; - currentFunction->Name = vtkstrcat3("Get", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (10))].yystate.yysemantics.yysval.str), "MinValue"); - currentFunction->Signature = - vtkstrcat4(typeText, " ", currentFunction->Name, "();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, getType(), getTypeId(), 0); - output_function(); - - currentFunction->Macro = "vtkSetClampMacro"; - currentFunction->Name = vtkstrcat3("Get", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (10))].yystate.yysemantics.yysval.str), "MaxValue"); - currentFunction->Signature = - vtkstrcat4(typeText, " ", currentFunction->Name, "();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, getType(), getTypeId(), 0); - output_function(); - } - break; - - case 499: - -/* Line 936 of glr.c */ -#line 2816 "vtkParse.y" - {preSig("void Set"); postSig("("); } - break; - - case 500: - -/* Line 936 of glr.c */ -#line 2817 "vtkParse.y" - { - postSig("*);"); - currentFunction->Macro = "vtkSetObjectMacro"; - currentFunction->Name = vtkstrcat("Set", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str)); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_OBJECT_PTR, getTypeId(), 0); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - } - break; - - case 501: - -/* Line 936 of glr.c */ -#line 2826 "vtkParse.y" - {postSig("*Get");} - break; - - case 502: - -/* Line 936 of glr.c */ -#line 2827 "vtkParse.y" - {markSig();} - break; - - case 503: - -/* Line 936 of glr.c */ -#line 2827 "vtkParse.y" - {swapSig();} - break; - - case 504: - -/* Line 936 of glr.c */ -#line 2828 "vtkParse.y" - { - postSig("();"); - currentFunction->Macro = "vtkGetObjectMacro"; - currentFunction->Name = vtkstrcat("Get", (((yyGLRStackItem const *)yyvsp)[YYFILL ((4) - (9))].yystate.yysemantics.yysval.str)); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_OBJECT_PTR, getTypeId(), 0); - output_function(); - } - break; - - case 505: - -/* Line 936 of glr.c */ -#line 2837 "vtkParse.y" - { - currentFunction->Macro = "vtkBooleanMacro"; - currentFunction->Name = vtkstrcat((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (6))].yystate.yysemantics.yysval.str), "On"); - currentFunction->Comment = vtkstrdup(getComment()); - currentFunction->Signature = - vtkstrcat3("void ", currentFunction->Name, "();"); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = "vtkBooleanMacro"; - currentFunction->Name = vtkstrcat((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (6))].yystate.yysemantics.yysval.str), "Off"); - currentFunction->Comment = vtkstrdup(getComment()); - currentFunction->Signature = - vtkstrcat3("void ", currentFunction->Name, "();"); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - } - break; - - case 506: - -/* Line 936 of glr.c */ -#line 2854 "vtkParse.y" - {startSig(); markSig();} - break; - - case 507: - -/* Line 936 of glr.c */ -#line 2855 "vtkParse.y" - { - chopSig(); - outputSetVectorMacro((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str), getType(), copySig(), 2); - } - break; - - case 508: - -/* Line 936 of glr.c */ -#line 2859 "vtkParse.y" - {startSig(); markSig();} - break; - - case 509: - -/* Line 936 of glr.c */ -#line 2860 "vtkParse.y" - { - chopSig(); - outputGetVectorMacro((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str), getType(), copySig(), 2); - } - break; - - case 510: - -/* Line 936 of glr.c */ -#line 2864 "vtkParse.y" - {startSig(); markSig();} - break; - - case 511: - -/* Line 936 of glr.c */ -#line 2865 "vtkParse.y" - { - chopSig(); - outputSetVectorMacro((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str), getType(), copySig(), 3); - } - break; - - case 512: - -/* Line 936 of glr.c */ -#line 2869 "vtkParse.y" - {startSig(); markSig();} - break; - - case 513: - -/* Line 936 of glr.c */ -#line 2870 "vtkParse.y" - { - chopSig(); - outputGetVectorMacro((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str), getType(), copySig(), 3); - } - break; - - case 514: - -/* Line 936 of glr.c */ -#line 2874 "vtkParse.y" - {startSig(); markSig();} - break; - - case 515: - -/* Line 936 of glr.c */ -#line 2875 "vtkParse.y" - { - chopSig(); - outputSetVectorMacro((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str), getType(), copySig(), 4); - } - break; - - case 516: - -/* Line 936 of glr.c */ -#line 2879 "vtkParse.y" - {startSig(); markSig();} - break; - - case 517: - -/* Line 936 of glr.c */ -#line 2880 "vtkParse.y" - { - chopSig(); - outputGetVectorMacro((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str), getType(), copySig(), 4); - } - break; - - case 518: - -/* Line 936 of glr.c */ -#line 2884 "vtkParse.y" - {startSig(); markSig();} - break; - - case 519: - -/* Line 936 of glr.c */ -#line 2885 "vtkParse.y" - { - chopSig(); - outputSetVectorMacro((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str), getType(), copySig(), 6); - } - break; - - case 520: - -/* Line 936 of glr.c */ -#line 2889 "vtkParse.y" - {startSig(); markSig();} - break; - - case 521: - -/* Line 936 of glr.c */ -#line 2890 "vtkParse.y" - { - chopSig(); - outputGetVectorMacro((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str), getType(), copySig(), 6); - } - break; - - case 522: - -/* Line 936 of glr.c */ -#line 2894 "vtkParse.y" - {startSig(); markSig();} - break; - - case 523: - -/* Line 936 of glr.c */ -#line 2896 "vtkParse.y" - { - const char *typeText; - chopSig(); - typeText = copySig(); - currentFunction->Macro = "vtkSetVectorMacro"; - currentFunction->Name = vtkstrcat("Set", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (9))].yystate.yysemantics.yysval.str)); - currentFunction->Signature = - vtkstrcat7("void ", currentFunction->Name, "(", typeText, - " a[", (((yyGLRStackItem const *)yyvsp)[YYFILL ((8) - (9))].yystate.yysemantics.yysval.str), "]);"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, (VTK_PARSE_POINTER | getType()), - getTypeId(), (int)strtol((((yyGLRStackItem const *)yyvsp)[YYFILL ((8) - (9))].yystate.yysemantics.yysval.str), NULL, 0)); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - } - break; - - case 524: - -/* Line 936 of glr.c */ -#line 2911 "vtkParse.y" - {startSig();} - break; - - case 525: - -/* Line 936 of glr.c */ -#line 2913 "vtkParse.y" - { - chopSig(); - currentFunction->Macro = "vtkGetVectorMacro"; - currentFunction->Name = vtkstrcat("Get", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (9))].yystate.yysemantics.yysval.str)); - postSig(" *"); - postSig(currentFunction->Name); - postSig("();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, (VTK_PARSE_POINTER | getType()), - getTypeId(), (int)strtol((((yyGLRStackItem const *)yyvsp)[YYFILL ((8) - (9))].yystate.yysemantics.yysval.str), NULL, 0)); - output_function(); - } - break; - - case 526: - -/* Line 936 of glr.c */ -#line 2926 "vtkParse.y" - { - currentFunction->Macro = "vtkViewportCoordinateMacro"; - currentFunction->Name = vtkstrcat3("Get", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str), "Coordinate"); - currentFunction->Signature = - vtkstrcat3("vtkCoordinate *", currentFunction->Name, "();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_OBJECT_PTR, "vtkCoordinate", 0); - output_function(); - - currentFunction->Macro = "vtkViewportCoordinateMacro"; - currentFunction->Name = vtkstrcat("Set", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str)); - currentFunction->Signature = - vtkstrcat3("void ", currentFunction->Name, "(double, double);"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); - add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = "vtkViewportCoordinateMacro"; - currentFunction->Name = vtkstrcat("Set", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str)); - currentFunction->Signature = - vtkstrcat3("void ", currentFunction->Name, "(double a[2]);"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_DOUBLE_PTR, "double", 2); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = "vtkViewportCoordinateMacro"; - currentFunction->Name = vtkstrcat("Get", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str)); - currentFunction->Signature = - vtkstrcat3("double *", currentFunction->Name, "();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_DOUBLE_PTR, "double", 2); - output_function(); - } - break; - - case 527: - -/* Line 936 of glr.c */ -#line 2963 "vtkParse.y" - { - currentFunction->Macro = "vtkWorldCoordinateMacro"; - currentFunction->Name = vtkstrcat3("Get", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str), "Coordinate"); - currentFunction->Signature = - vtkstrcat3("vtkCoordinate *", currentFunction->Name, "();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_OBJECT_PTR, "vtkCoordinate", 0); - output_function(); - - currentFunction->Macro = "vtkWorldCoordinateMacro"; - currentFunction->Name = vtkstrcat("Set", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str)); - currentFunction->Signature = - vtkstrcat3("void ", currentFunction->Name, "(double, double, double);"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); - add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); - add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = "vtkWorldCoordinateMacro"; - currentFunction->Name = vtkstrcat("Set", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str)); - currentFunction->Signature = - vtkstrcat3("void ", currentFunction->Name, "(double a[3]);"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_DOUBLE_PTR, "double", 3); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = "vtkWorldCoordinateMacro"; - currentFunction->Name = vtkstrcat("Get", (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.str)); - currentFunction->Signature = - vtkstrcat3("double *", currentFunction->Name, "();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_DOUBLE_PTR, "double", 3); - output_function(); - } - break; - - case 528: - -/* Line 936 of glr.c */ -#line 3001 "vtkParse.y" - { - currentFunction->Macro = "vtkTypeMacro"; - currentFunction->Name = "GetClassName"; - currentFunction->Signature = "const char *GetClassName();"; - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, (VTK_PARSE_CONST | VTK_PARSE_CHAR_PTR), - "char", 0); - output_function(); - - currentFunction->Macro = "vtkTypeMacro"; - currentFunction->Name = "IsA"; - currentFunction->Signature = "int IsA(const char *name);"; - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, (VTK_PARSE_CONST | VTK_PARSE_CHAR_PTR), - "char", 0); - set_return(currentFunction, VTK_PARSE_INT, "int", 0); - output_function(); - - currentFunction->Macro = "vtkTypeMacro"; - currentFunction->Name = "NewInstance"; - currentFunction->Signature = vtkstrcat((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str), " *NewInstance();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_OBJECT_PTR, (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str), 0); - output_function(); - - currentFunction->Macro = "vtkTypeMacro"; - currentFunction->Name = "SafeDownCast"; - currentFunction->Signature = - vtkstrcat((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str), " *SafeDownCast(vtkObject* o);"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_OBJECT_PTR, "vtkObject", 0); - set_return(currentFunction, (VTK_PARSE_STATIC | VTK_PARSE_OBJECT_PTR), - (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (7))].yystate.yysemantics.yysval.str), 0); - output_function(); - } - break; - - case 531: - -/* Line 936 of glr.c */ -#line 3045 "vtkParse.y" - { ((*yyvalp).str) = "()"; } - break; - - case 532: - -/* Line 936 of glr.c */ -#line 3046 "vtkParse.y" - { ((*yyvalp).str) = "[]"; } - break; - - case 533: - -/* Line 936 of glr.c */ -#line 3047 "vtkParse.y" - { ((*yyvalp).str) = " new[]"; } - break; - - case 534: - -/* Line 936 of glr.c */ -#line 3048 "vtkParse.y" - { ((*yyvalp).str) = " delete[]"; } - break; - - case 535: - -/* Line 936 of glr.c */ -#line 3049 "vtkParse.y" - { ((*yyvalp).str) = "<"; } - break; - - case 536: - -/* Line 936 of glr.c */ -#line 3050 "vtkParse.y" - { ((*yyvalp).str) = ">"; } - break; - - case 537: - -/* Line 936 of glr.c */ -#line 3051 "vtkParse.y" - { ((*yyvalp).str) = ","; } - break; - - case 538: - -/* Line 936 of glr.c */ -#line 3052 "vtkParse.y" - { ((*yyvalp).str) = "="; } - break; - - case 539: - -/* Line 936 of glr.c */ -#line 3053 "vtkParse.y" - { ((*yyvalp).str) = ">>"; } - break; - - case 540: - -/* Line 936 of glr.c */ -#line 3054 "vtkParse.y" - { ((*yyvalp).str) = ">>"; } - break; - - case 541: - -/* Line 936 of glr.c */ -#line 3055 "vtkParse.y" - { ((*yyvalp).str) = vtkstrcat("\"\" ", (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.str)); } - break; - - case 543: - -/* Line 936 of glr.c */ -#line 3059 "vtkParse.y" - { ((*yyvalp).str) = "%"; } - break; - - case 544: - -/* Line 936 of glr.c */ -#line 3060 "vtkParse.y" - { ((*yyvalp).str) = "*"; } - break; - - case 545: - -/* Line 936 of glr.c */ -#line 3061 "vtkParse.y" - { ((*yyvalp).str) = "/"; } - break; - - case 546: - -/* Line 936 of glr.c */ -#line 3062 "vtkParse.y" - { ((*yyvalp).str) = "-"; } - break; - - case 547: - -/* Line 936 of glr.c */ -#line 3063 "vtkParse.y" - { ((*yyvalp).str) = "+"; } - break; - - case 548: - -/* Line 936 of glr.c */ -#line 3064 "vtkParse.y" - { ((*yyvalp).str) = "!"; } - break; - - case 549: - -/* Line 936 of glr.c */ -#line 3065 "vtkParse.y" - { ((*yyvalp).str) = "~"; } - break; - - case 550: - -/* Line 936 of glr.c */ -#line 3066 "vtkParse.y" - { ((*yyvalp).str) = "&"; } - break; - - case 551: - -/* Line 936 of glr.c */ -#line 3067 "vtkParse.y" - { ((*yyvalp).str) = "|"; } - break; - - case 552: - -/* Line 936 of glr.c */ -#line 3068 "vtkParse.y" - { ((*yyvalp).str) = "^"; } - break; - - case 553: - -/* Line 936 of glr.c */ -#line 3069 "vtkParse.y" - { ((*yyvalp).str) = " new"; } - break; - - case 554: - -/* Line 936 of glr.c */ -#line 3070 "vtkParse.y" - { ((*yyvalp).str) = " delete"; } - break; - - case 555: - -/* Line 936 of glr.c */ -#line 3071 "vtkParse.y" - { ((*yyvalp).str) = "<<="; } - break; - - case 556: - -/* Line 936 of glr.c */ -#line 3072 "vtkParse.y" - { ((*yyvalp).str) = ">>="; } - break; - - case 557: - -/* Line 936 of glr.c */ -#line 3073 "vtkParse.y" - { ((*yyvalp).str) = "<<"; } - break; - - case 558: - -/* Line 936 of glr.c */ -#line 3074 "vtkParse.y" - { ((*yyvalp).str) = ".*"; } - break; - - case 559: - -/* Line 936 of glr.c */ -#line 3075 "vtkParse.y" - { ((*yyvalp).str) = "->*"; } - break; - - case 560: - -/* Line 936 of glr.c */ -#line 3076 "vtkParse.y" - { ((*yyvalp).str) = "->"; } - break; - - case 561: - -/* Line 936 of glr.c */ -#line 3077 "vtkParse.y" - { ((*yyvalp).str) = "+="; } - break; - - case 562: - -/* Line 936 of glr.c */ -#line 3078 "vtkParse.y" - { ((*yyvalp).str) = "-="; } - break; - - case 563: - -/* Line 936 of glr.c */ -#line 3079 "vtkParse.y" - { ((*yyvalp).str) = "*="; } - break; - - case 564: - -/* Line 936 of glr.c */ -#line 3080 "vtkParse.y" - { ((*yyvalp).str) = "/="; } - break; - - case 565: - -/* Line 936 of glr.c */ -#line 3081 "vtkParse.y" - { ((*yyvalp).str) = "%="; } - break; - - case 566: - -/* Line 936 of glr.c */ -#line 3082 "vtkParse.y" - { ((*yyvalp).str) = "++"; } - break; - - case 567: - -/* Line 936 of glr.c */ -#line 3083 "vtkParse.y" - { ((*yyvalp).str) = "--"; } - break; - - case 568: - -/* Line 936 of glr.c */ -#line 3084 "vtkParse.y" - { ((*yyvalp).str) = "&="; } - break; - - case 569: - -/* Line 936 of glr.c */ -#line 3085 "vtkParse.y" - { ((*yyvalp).str) = "|="; } - break; - - case 570: - -/* Line 936 of glr.c */ -#line 3086 "vtkParse.y" - { ((*yyvalp).str) = "^="; } - break; - - case 571: - -/* Line 936 of glr.c */ -#line 3087 "vtkParse.y" - { ((*yyvalp).str) = "&&"; } - break; - - case 572: - -/* Line 936 of glr.c */ -#line 3088 "vtkParse.y" - { ((*yyvalp).str) = "||"; } - break; - - case 573: - -/* Line 936 of glr.c */ -#line 3089 "vtkParse.y" - { ((*yyvalp).str) = "=="; } - break; - - case 574: - -/* Line 936 of glr.c */ -#line 3090 "vtkParse.y" - { ((*yyvalp).str) = "!="; } - break; - - case 575: - -/* Line 936 of glr.c */ -#line 3091 "vtkParse.y" - { ((*yyvalp).str) = "<="; } - break; - - case 576: - -/* Line 936 of glr.c */ -#line 3092 "vtkParse.y" - { ((*yyvalp).str) = ">="; } - break; - - case 577: - -/* Line 936 of glr.c */ -#line 3095 "vtkParse.y" - { ((*yyvalp).str) = "typedef"; } - break; - - case 578: - -/* Line 936 of glr.c */ -#line 3096 "vtkParse.y" - { ((*yyvalp).str) = "typename"; } - break; - - case 579: - -/* Line 936 of glr.c */ -#line 3097 "vtkParse.y" - { ((*yyvalp).str) = "class"; } - break; - - case 580: - -/* Line 936 of glr.c */ -#line 3098 "vtkParse.y" - { ((*yyvalp).str) = "struct"; } - break; - - case 581: - -/* Line 936 of glr.c */ -#line 3099 "vtkParse.y" - { ((*yyvalp).str) = "union"; } - break; - - case 582: - -/* Line 936 of glr.c */ -#line 3100 "vtkParse.y" - { ((*yyvalp).str) = "template"; } - break; - - case 583: - -/* Line 936 of glr.c */ -#line 3101 "vtkParse.y" - { ((*yyvalp).str) = "public"; } - break; - - case 584: - -/* Line 936 of glr.c */ -#line 3102 "vtkParse.y" - { ((*yyvalp).str) = "protected"; } - break; - - case 585: - -/* Line 936 of glr.c */ -#line 3103 "vtkParse.y" - { ((*yyvalp).str) = "private"; } - break; - - case 586: - -/* Line 936 of glr.c */ -#line 3104 "vtkParse.y" - { ((*yyvalp).str) = "const"; } - break; - - case 587: - -/* Line 936 of glr.c */ -#line 3105 "vtkParse.y" - { ((*yyvalp).str) = "static"; } - break; - - case 588: - -/* Line 936 of glr.c */ -#line 3106 "vtkParse.y" - { ((*yyvalp).str) = "thread_local"; } - break; - - case 589: - -/* Line 936 of glr.c */ -#line 3107 "vtkParse.y" - { ((*yyvalp).str) = "constexpr"; } - break; - - case 590: - -/* Line 936 of glr.c */ -#line 3108 "vtkParse.y" - { ((*yyvalp).str) = "inline"; } - break; - - case 591: - -/* Line 936 of glr.c */ -#line 3109 "vtkParse.y" - { ((*yyvalp).str) = "virtual"; } - break; - - case 592: - -/* Line 936 of glr.c */ -#line 3110 "vtkParse.y" - { ((*yyvalp).str) = "explicit"; } - break; - - case 593: - -/* Line 936 of glr.c */ -#line 3111 "vtkParse.y" - { ((*yyvalp).str) = "decltype"; } - break; - - case 594: - -/* Line 936 of glr.c */ -#line 3112 "vtkParse.y" - { ((*yyvalp).str) = "default"; } - break; - - case 595: - -/* Line 936 of glr.c */ -#line 3113 "vtkParse.y" - { ((*yyvalp).str) = "extern"; } - break; - - case 596: - -/* Line 936 of glr.c */ -#line 3114 "vtkParse.y" - { ((*yyvalp).str) = "using"; } - break; - - case 597: - -/* Line 936 of glr.c */ -#line 3115 "vtkParse.y" - { ((*yyvalp).str) = "namespace"; } - break; - - case 598: - -/* Line 936 of glr.c */ -#line 3116 "vtkParse.y" - { ((*yyvalp).str) = "operator"; } - break; - - case 599: - -/* Line 936 of glr.c */ -#line 3117 "vtkParse.y" - { ((*yyvalp).str) = "enum"; } - break; - - case 600: - -/* Line 936 of glr.c */ -#line 3118 "vtkParse.y" - { ((*yyvalp).str) = "throw"; } - break; - - case 601: - -/* Line 936 of glr.c */ -#line 3119 "vtkParse.y" - { ((*yyvalp).str) = "noexcept"; } - break; - - case 602: - -/* Line 936 of glr.c */ -#line 3120 "vtkParse.y" - { ((*yyvalp).str) = "const_cast"; } - break; - - case 603: - -/* Line 936 of glr.c */ -#line 3121 "vtkParse.y" - { ((*yyvalp).str) = "dynamic_cast"; } - break; - - case 604: - -/* Line 936 of glr.c */ -#line 3122 "vtkParse.y" - { ((*yyvalp).str) = "static_cast"; } - break; - - case 605: - -/* Line 936 of glr.c */ -#line 3123 "vtkParse.y" - { ((*yyvalp).str) = "reinterpret_cast"; } - break; - - case 618: - -/* Line 936 of glr.c */ -#line 3146 "vtkParse.y" - { postSig("< "); } - break; - - case 619: - -/* Line 936 of glr.c */ -#line 3147 "vtkParse.y" - { postSig("> "); } - break; - - case 621: - -/* Line 936 of glr.c */ -#line 3148 "vtkParse.y" - { postSig(">"); } - break; - - case 623: - -/* Line 936 of glr.c */ -#line 3152 "vtkParse.y" - { chopSig(); postSig("::"); } - break; - - case 627: - -/* Line 936 of glr.c */ -#line 3159 "vtkParse.y" - { - if ((((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str))[0] == '+' || ((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str))[0] == '-' || - ((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str))[0] == '*' || ((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str))[0] == '&') && - ((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str))[1] == '\0') - { - int c1 = 0; - size_t l; - const char *cp; - chopSig(); - cp = getSig(); - l = getSigLength(); - if (l != 0) { c1 = cp[l-1]; } - if (c1 != 0 && c1 != '(' && c1 != '[' && c1 != '=') - { - postSig(" "); - } - postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); - if (vtkParse_CharType(c1, (CPRE_IDGIT|CPRE_QUOTE)) || - c1 == ')' || c1 == ']') - { - postSig(" "); - } - } - else - { - postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); - postSig(" "); - } - } - break; - - case 628: - -/* Line 936 of glr.c */ -#line 3188 "vtkParse.y" - { postSig(":"); postSig(" "); } - break; - - case 629: - -/* Line 936 of glr.c */ -#line 3188 "vtkParse.y" - { postSig("."); } - break; - - case 630: - -/* Line 936 of glr.c */ -#line 3189 "vtkParse.y" - { postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); postSig(" "); } - break; - - case 631: - -/* Line 936 of glr.c */ -#line 3190 "vtkParse.y" - { postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); postSig(" "); } - break; - - case 633: - -/* Line 936 of glr.c */ -#line 3193 "vtkParse.y" - { - int c1 = 0; - size_t l; - const char *cp; - chopSig(); - cp = getSig(); - l = getSigLength(); - if (l != 0) { c1 = cp[l-1]; } - while (vtkParse_CharType(c1, CPRE_IDGIT) && l != 0) - { - --l; - c1 = cp[l-1]; - } - if (l < 2 || cp[l-1] != ':' || cp[l-2] != ':') - { - cp = add_const_scope(&cp[l]); - resetSig(l); - postSig(cp); - } - postSig(" "); - } - break; - - case 637: - -/* Line 936 of glr.c */ -#line 3220 "vtkParse.y" - { postSig("< "); } - break; - - case 638: - -/* Line 936 of glr.c */ -#line 3221 "vtkParse.y" - { postSig("> "); } - break; - - case 639: - -/* Line 936 of glr.c */ -#line 3222 "vtkParse.y" - { postSig(">"); } - break; - - case 641: - -/* Line 936 of glr.c */ -#line 3226 "vtkParse.y" - { postSig("= "); } - break; - - case 642: - -/* Line 936 of glr.c */ -#line 3227 "vtkParse.y" - { chopSig(); postSig(", "); } - break; - - case 644: - -/* Line 936 of glr.c */ -#line 3231 "vtkParse.y" - { chopSig(); postSig(";"); } - break; - - case 652: - -/* Line 936 of glr.c */ -#line 3245 "vtkParse.y" - { postSig("= "); } - break; - - case 653: - -/* Line 936 of glr.c */ -#line 3246 "vtkParse.y" - { chopSig(); postSig(", "); } - break; - - case 654: - -/* Line 936 of glr.c */ -#line 3250 "vtkParse.y" - { - chopSig(); - if (getSig()[getSigLength()-1] == '<') { postSig(" "); } - postSig("<"); - } - break; - - case 655: - -/* Line 936 of glr.c */ -#line 3256 "vtkParse.y" - { - chopSig(); - if (getSig()[getSigLength()-1] == '>') { postSig(" "); } - postSig("> "); - } - break; - - case 658: - -/* Line 936 of glr.c */ -#line 3267 "vtkParse.y" - { postSig("["); } - break; - - case 659: - -/* Line 936 of glr.c */ -#line 3268 "vtkParse.y" - { chopSig(); postSig("] "); } - break; - - case 660: - -/* Line 936 of glr.c */ -#line 3269 "vtkParse.y" - { postSig("[["); } - break; - - case 661: - -/* Line 936 of glr.c */ -#line 3270 "vtkParse.y" - { chopSig(); postSig("]] "); } - break; - - case 662: - -/* Line 936 of glr.c */ -#line 3273 "vtkParse.y" - { postSig("("); } - break; - - case 663: - -/* Line 936 of glr.c */ -#line 3274 "vtkParse.y" - { chopSig(); postSig(") "); } - break; - - case 664: - -/* Line 936 of glr.c */ -#line 3275 "vtkParse.y" - { postSig("("); postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); postSig("*"); } - break; - - case 665: - -/* Line 936 of glr.c */ -#line 3276 "vtkParse.y" - { chopSig(); postSig(") "); } - break; - - case 666: - -/* Line 936 of glr.c */ -#line 3277 "vtkParse.y" - { postSig("("); postSig((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.str)); postSig("&"); } - break; - - case 667: - -/* Line 936 of glr.c */ -#line 3278 "vtkParse.y" - { chopSig(); postSig(") "); } - break; - - case 668: - -/* Line 936 of glr.c */ -#line 3281 "vtkParse.y" - { postSig("{ "); } - break; - - case 669: - -/* Line 936 of glr.c */ -#line 3281 "vtkParse.y" - { postSig("} "); } - break; - - - -/* Line 936 of glr.c */ -#line 9710 "vtkParse.tab.c" - default: break; - } - - return yyok; -# undef yyerrok -# undef YYABORT -# undef YYACCEPT -# undef YYERROR -# undef YYBACKUP -# undef yyclearin -# undef YYRECOVERING -} - - -/*ARGSUSED*/ static void -yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) -{ - YYUSE (yy0); - YYUSE (yy1); - - switch (yyn) - { - - default: break; - } -} - - /* Bison grammar-table manipulation. */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} - -/** Number of symbols composing the right hand side of rule #RULE. */ -static int -yyrhsLength (yyRuleNum yyrule) -{ - return yyr2[yyrule]; -} - -static void -yydestroyGLRState (char const *yymsg, yyGLRState *yys) -{ - if (yys->yyresolved) - yydestruct (yymsg, yystos[yys->yylrState], - &yys->yysemantics.yysval); - else - { -#if YYDEBUG - if (yydebug) - { - if (yys->yysemantics.yyfirstVal) - YYFPRINTF (stderr, "%s unresolved ", yymsg); - else - YYFPRINTF (stderr, "%s incomplete ", yymsg); - yy_symbol_print (stderr, yystos[yys->yylrState], - NULL); - YYFPRINTF (stderr, "\n"); - } -#endif - - if (yys->yysemantics.yyfirstVal) - { - yySemanticOption *yyoption = yys->yysemantics.yyfirstVal; - yyGLRState *yyrh; - int yyn; - for (yyrh = yyoption->yystate, yyn = yyrhsLength (yyoption->yyrule); - yyn > 0; - yyrh = yyrh->yypred, yyn -= 1) - yydestroyGLRState (yymsg, yyrh); - } - } -} - -/** Left-hand-side symbol for rule #RULE. */ -static yySymbol -yylhsNonterm (yyRuleNum yyrule) -{ - return yyr1[yyrule]; -} - -#define yyis_pact_ninf(yystate) \ - ((yystate) == YYPACT_NINF) - -/** True iff LR state STATE has only a default reduction (regardless - * of token). */ -static yybool -yyisDefaultedState (yyStateNum yystate) -{ - return yyis_pact_ninf (yypact[yystate]); -} - -/** The default reduction for STATE, assuming it has one. */ -static yyRuleNum -yydefaultAction (yyStateNum yystate) -{ - return yydefact[yystate]; -} - -#define yyis_table_ninf(yytable_value) \ - YYID (0) - -/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN. - * Result R means - * R < 0: Reduce on rule -R. - * R = 0: Error. - * R > 0: Shift to state R. - * Set *CONFLICTS to a pointer into yyconfl to 0-terminated list of - * conflicting reductions. - */ -static void -yygetLRActions (yyStateNum yystate, int yytoken, - int* yyaction, const short int** yyconflicts) -{ - int yyindex = yypact[yystate] + yytoken; - if (yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken) - { - *yyaction = -yydefact[yystate]; - *yyconflicts = yyconfl; - } - else if (! yyis_table_ninf (yytable[yyindex])) - { - *yyaction = yytable[yyindex]; - *yyconflicts = yyconfl + yyconflp[yyindex]; - } - else - { - *yyaction = 0; - *yyconflicts = yyconfl + yyconflp[yyindex]; - } -} - -static yyStateNum -yyLRgotoState (yyStateNum yystate, yySymbol yylhs) -{ - int yyr; - yyr = yypgoto[yylhs - YYNTOKENS] + yystate; - if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate) - return yytable[yyr]; - else - return yydefgoto[yylhs - YYNTOKENS]; -} - -static yybool -yyisShiftAction (int yyaction) -{ - return 0 < yyaction; -} - -static yybool -yyisErrorAction (int yyaction) -{ - return yyaction == 0; -} - - /* GLRStates */ - -/** Return a fresh GLRStackItem. Callers should call - * YY_RESERVE_GLRSTACK afterwards to make sure there is sufficient - * headroom. */ - -static yyGLRStackItem* -yynewGLRStackItem (yyGLRStack* yystackp, yybool yyisState) -{ - yyGLRStackItem* yynewItem = yystackp->yynextFree; - yystackp->yyspaceLeft -= 1; - yystackp->yynextFree += 1; - yynewItem->yystate.yyisState = yyisState; - return yynewItem; -} - -/** Add a new semantic action that will execute the action for rule - * RULENUM on the semantic values in RHS to the list of - * alternative actions for STATE. Assumes that RHS comes from - * stack #K of *STACKP. */ -static void -yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate, - yyGLRState* rhs, yyRuleNum yyrule) -{ - yySemanticOption* yynewOption = - &yynewGLRStackItem (yystackp, yyfalse)->yyoption; - yynewOption->yystate = rhs; - yynewOption->yyrule = yyrule; - if (yystackp->yytops.yylookaheadNeeds[yyk]) - { - yynewOption->yyrawchar = yychar; - yynewOption->yyval = yylval; - yynewOption->yyloc = yylloc; - } - else - yynewOption->yyrawchar = YYEMPTY; - yynewOption->yynext = yystate->yysemantics.yyfirstVal; - yystate->yysemantics.yyfirstVal = yynewOption; - - YY_RESERVE_GLRSTACK (yystackp); -} - - /* GLRStacks */ - -/** Initialize SET to a singleton set containing an empty stack. */ -static yybool -yyinitStateSet (yyGLRStateSet* yyset) -{ - yyset->yysize = 1; - yyset->yycapacity = 16; - yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]); - if (! yyset->yystates) - return yyfalse; - yyset->yystates[0] = NULL; - yyset->yylookaheadNeeds = - (yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]); - if (! yyset->yylookaheadNeeds) - { - YYFREE (yyset->yystates); - return yyfalse; - } - return yytrue; -} - -static void yyfreeStateSet (yyGLRStateSet* yyset) -{ - YYFREE (yyset->yystates); - YYFREE (yyset->yylookaheadNeeds); -} - -/** Initialize STACK to a single empty stack, with total maximum - * capacity for all stacks of SIZE. */ -static yybool -yyinitGLRStack (yyGLRStack* yystackp, size_t yysize) -{ - yystackp->yyerrState = 0; - yynerrs = 0; - yystackp->yyspaceLeft = yysize; - yystackp->yyitems = - (yyGLRStackItem*) YYMALLOC (yysize * sizeof yystackp->yynextFree[0]); - if (!yystackp->yyitems) - return yyfalse; - yystackp->yynextFree = yystackp->yyitems; - yystackp->yysplitPoint = NULL; - yystackp->yylastDeleted = NULL; - return yyinitStateSet (&yystackp->yytops); -} - - -#if YYSTACKEXPANDABLE -# define YYRELOC(YYFROMITEMS,YYTOITEMS,YYX,YYTYPE) \ - &((YYTOITEMS) - ((YYFROMITEMS) - (yyGLRStackItem*) (YYX)))->YYTYPE - -/** If STACK is expandable, extend it. WARNING: Pointers into the - stack from outside should be considered invalid after this call. - We always expand when there are 1 or fewer items left AFTER an - allocation, so that we can avoid having external pointers exist - across an allocation. */ -static void -yyexpandGLRStack (yyGLRStack* yystackp) -{ - yyGLRStackItem* yynewItems; - yyGLRStackItem* yyp0, *yyp1; - size_t yysize, yynewSize; - size_t yyn; - yysize = yystackp->yynextFree - yystackp->yyitems; - if (YYMAXDEPTH - YYHEADROOM < yysize) - yyMemoryExhausted (yystackp); - yynewSize = 2*yysize; - if (YYMAXDEPTH < yynewSize) - yynewSize = YYMAXDEPTH; - yynewItems = (yyGLRStackItem*) YYMALLOC (yynewSize * sizeof yynewItems[0]); - if (! yynewItems) - yyMemoryExhausted (yystackp); - for (yyp0 = yystackp->yyitems, yyp1 = yynewItems, yyn = yysize; - 0 < yyn; - yyn -= 1, yyp0 += 1, yyp1 += 1) - { - *yyp1 = *yyp0; - if (*(yybool *) yyp0) - { - yyGLRState* yys0 = &yyp0->yystate; - yyGLRState* yys1 = &yyp1->yystate; - if (yys0->yypred != NULL) - yys1->yypred = - YYRELOC (yyp0, yyp1, yys0->yypred, yystate); - if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != NULL) - yys1->yysemantics.yyfirstVal = - YYRELOC(yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption); - } - else - { - yySemanticOption* yyv0 = &yyp0->yyoption; - yySemanticOption* yyv1 = &yyp1->yyoption; - if (yyv0->yystate != NULL) - yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate); - if (yyv0->yynext != NULL) - yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption); - } - } - if (yystackp->yysplitPoint != NULL) - yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems, - yystackp->yysplitPoint, yystate); - - for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1) - if (yystackp->yytops.yystates[yyn] != NULL) - yystackp->yytops.yystates[yyn] = - YYRELOC (yystackp->yyitems, yynewItems, - yystackp->yytops.yystates[yyn], yystate); - YYFREE (yystackp->yyitems); - yystackp->yyitems = yynewItems; - yystackp->yynextFree = yynewItems + yysize; - yystackp->yyspaceLeft = yynewSize - yysize; -} -#endif - -static void -yyfreeGLRStack (yyGLRStack* yystackp) -{ - YYFREE (yystackp->yyitems); - yyfreeStateSet (&yystackp->yytops); -} - -/** Assuming that S is a GLRState somewhere on STACK, update the - * splitpoint of STACK, if needed, so that it is at least as deep as - * S. */ -static void -yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys) -{ - if (yystackp->yysplitPoint != NULL && yystackp->yysplitPoint > yys) - yystackp->yysplitPoint = yys; -} - -/** Invalidate stack #K in STACK. */ -static void -yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk) -{ - if (yystackp->yytops.yystates[yyk] != NULL) - yystackp->yylastDeleted = yystackp->yytops.yystates[yyk]; - yystackp->yytops.yystates[yyk] = NULL; -} - -/** Undelete the last stack that was marked as deleted. Can only be - done once after a deletion, and only when all other stacks have - been deleted. */ -static void -yyundeleteLastStack (yyGLRStack* yystackp) -{ - if (yystackp->yylastDeleted == NULL || yystackp->yytops.yysize != 0) - return; - yystackp->yytops.yystates[0] = yystackp->yylastDeleted; - yystackp->yytops.yysize = 1; - YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n")); - yystackp->yylastDeleted = NULL; -} - -static void -yyremoveDeletes (yyGLRStack* yystackp) -{ - size_t yyi, yyj; - yyi = yyj = 0; - while (yyj < yystackp->yytops.yysize) - { - if (yystackp->yytops.yystates[yyi] == NULL) - { - if (yyi == yyj) - { - YYDPRINTF ((stderr, "Removing dead stacks.\n")); - } - yystackp->yytops.yysize -= 1; - } - else - { - yystackp->yytops.yystates[yyj] = yystackp->yytops.yystates[yyi]; - /* In the current implementation, it's unnecessary to copy - yystackp->yytops.yylookaheadNeeds[yyi] since, after - yyremoveDeletes returns, the parser immediately either enters - deterministic operation or shifts a token. However, it doesn't - hurt, and the code might evolve to need it. */ - yystackp->yytops.yylookaheadNeeds[yyj] = - yystackp->yytops.yylookaheadNeeds[yyi]; - if (yyj != yyi) - { - YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n", - (unsigned long int) yyi, (unsigned long int) yyj)); - } - yyj += 1; - } - yyi += 1; - } -} - -/** Shift to a new state on stack #K of STACK, corresponding to LR state - * LRSTATE, at input position POSN, with (resolved) semantic value SVAL. */ -static void -yyglrShift (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState, - size_t yyposn, - YYSTYPE* yyvalp, YYLTYPE* yylocp) -{ - yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; - - yynewState->yylrState = yylrState; - yynewState->yyposn = yyposn; - yynewState->yyresolved = yytrue; - yynewState->yypred = yystackp->yytops.yystates[yyk]; - yynewState->yysemantics.yysval = *yyvalp; - yynewState->yyloc = *yylocp; - yystackp->yytops.yystates[yyk] = yynewState; - - YY_RESERVE_GLRSTACK (yystackp); -} - -/** Shift stack #K of YYSTACK, to a new state corresponding to LR - * state YYLRSTATE, at input position YYPOSN, with the (unresolved) - * semantic value of YYRHS under the action for YYRULE. */ -static void -yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState, - size_t yyposn, yyGLRState* rhs, yyRuleNum yyrule) -{ - yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; - - yynewState->yylrState = yylrState; - yynewState->yyposn = yyposn; - yynewState->yyresolved = yyfalse; - yynewState->yypred = yystackp->yytops.yystates[yyk]; - yynewState->yysemantics.yyfirstVal = NULL; - yystackp->yytops.yystates[yyk] = yynewState; - - /* Invokes YY_RESERVE_GLRSTACK. */ - yyaddDeferredAction (yystackp, yyk, yynewState, rhs, yyrule); -} - -/** Pop the symbols consumed by reduction #RULE from the top of stack - * #K of STACK, and perform the appropriate semantic action on their - * semantic values. Assumes that all ambiguities in semantic values - * have been previously resolved. Set *VALP to the resulting value, - * and *LOCP to the computed location (if any). Return value is as - * for userAction. */ -static YYRESULTTAG -yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, - YYSTYPE* yyvalp, YYLTYPE* yylocp) -{ - int yynrhs = yyrhsLength (yyrule); - - if (yystackp->yysplitPoint == NULL) - { - /* Standard special case: single stack. */ - yyGLRStackItem* rhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk]; - YYASSERT (yyk == 0); - yystackp->yynextFree -= yynrhs; - yystackp->yyspaceLeft += yynrhs; - yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate; - return yyuserAction (yyrule, yynrhs, rhs, - yyvalp, yylocp, yystackp); - } - else - { - /* At present, doAction is never called in nondeterministic - * mode, so this branch is never taken. It is here in - * anticipation of a future feature that will allow immediate - * evaluation of selected actions in nondeterministic mode. */ - int yyi; - yyGLRState* yys; - yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; - yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred - = yystackp->yytops.yystates[yyk]; - for (yyi = 0; yyi < yynrhs; yyi += 1) - { - yys = yys->yypred; - YYASSERT (yys); - } - yyupdateSplit (yystackp, yys); - yystackp->yytops.yystates[yyk] = yys; - return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, - yyvalp, yylocp, yystackp); - } -} - -#if !YYDEBUG -# define YY_REDUCE_PRINT(Args) -#else -# define YY_REDUCE_PRINT(Args) \ -do { \ - if (yydebug) \ - yy_reduce_print Args; \ -} while (YYID (0)) - -/*----------------------------------------------------------. -| Report that the RULE is going to be reduced on stack #K. | -`----------------------------------------------------------*/ - -/*ARGSUSED*/ static void -yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, - YYSTYPE* yyvalp, YYLTYPE* yylocp) -{ - int yynrhs = yyrhsLength (yyrule); - yybool yynormal __attribute__ ((__unused__)) = - (yystackp->yysplitPoint == NULL); - yyGLRStackItem* yyvsp = (yyGLRStackItem*) yystackp->yytops.yystates[yyk]; - int yylow = 1; - int yyi; - YYUSE (yyvalp); - YYUSE (yylocp); - YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n", - (unsigned long int) yyk, yyrule - 1, - (unsigned long int) yyrline[yyrule]); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(((yyGLRStackItem const *)yyvsp)[YYFILL ((yyi + 1) - (yynrhs))].yystate.yysemantics.yysval) - ); - YYFPRINTF (stderr, "\n"); - } -} -#endif - -/** Pop items off stack #K of STACK according to grammar rule RULE, - * and push back on the resulting nonterminal symbol. Perform the - * semantic action associated with RULE and store its value with the - * newly pushed state, if FORCEEVAL or if STACK is currently - * unambiguous. Otherwise, store the deferred semantic action with - * the new state. If the new state would have an identical input - * position, LR state, and predecessor to an existing state on the stack, - * it is identified with that existing state, eliminating stack #K from - * the STACK. In this case, the (necessarily deferred) semantic value is - * added to the options for the existing state's semantic value. - */ -static YYRESULTTAG -yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, - yybool yyforceEval) -{ - size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn; - - if (yyforceEval || yystackp->yysplitPoint == NULL) - { - YYSTYPE yysval; - YYLTYPE yyloc = {0}; - - YY_REDUCE_PRINT ((yystackp, yyk, yyrule, &yysval, &yyloc)); - YYCHK (yydoAction (yystackp, yyk, yyrule, &yysval, - &yyloc)); - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc); - yyglrShift (yystackp, yyk, - yyLRgotoState (yystackp->yytops.yystates[yyk]->yylrState, - yylhsNonterm (yyrule)), - yyposn, &yysval, &yyloc); - } - else - { - size_t yyi; - int yyn; - yyGLRState* yys, *yys0 = yystackp->yytops.yystates[yyk]; - yyStateNum yynewLRState; - - for (yys = yystackp->yytops.yystates[yyk], yyn = yyrhsLength (yyrule); - 0 < yyn; yyn -= 1) - { - yys = yys->yypred; - YYASSERT (yys); - } - yyupdateSplit (yystackp, yys); - yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule)); - YYDPRINTF ((stderr, - "Reduced stack %lu by rule #%d; action deferred. Now in state %d.\n", - (unsigned long int) yyk, yyrule - 1, yynewLRState)); - for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) - if (yyi != yyk && yystackp->yytops.yystates[yyi] != NULL) - { - yyGLRState* yyp, *yysplit = yystackp->yysplitPoint; - yyp = yystackp->yytops.yystates[yyi]; - while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn) - { - if (yyp->yylrState == yynewLRState && yyp->yypred == yys) - { - yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule); - yymarkStackDeleted (yystackp, yyk); - YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n", - (unsigned long int) yyk, - (unsigned long int) yyi)); - return yyok; - } - yyp = yyp->yypred; - } - } - yystackp->yytops.yystates[yyk] = yys; - yyglrShiftDefer (yystackp, yyk, yynewLRState, yyposn, yys0, yyrule); - } - return yyok; -} - -static size_t -yysplitStack (yyGLRStack* yystackp, size_t yyk) -{ - if (yystackp->yysplitPoint == NULL) - { - YYASSERT (yyk == 0); - yystackp->yysplitPoint = yystackp->yytops.yystates[yyk]; - } - if (yystackp->yytops.yysize >= yystackp->yytops.yycapacity) - { - yyGLRState** yynewStates; - yybool* yynewLookaheadNeeds; - - yynewStates = NULL; - - if (yystackp->yytops.yycapacity - > (YYSIZEMAX / (2 * sizeof yynewStates[0]))) - yyMemoryExhausted (yystackp); - yystackp->yytops.yycapacity *= 2; - - yynewStates = - (yyGLRState**) YYREALLOC (yystackp->yytops.yystates, - (yystackp->yytops.yycapacity - * sizeof yynewStates[0])); - if (yynewStates == NULL) - yyMemoryExhausted (yystackp); - yystackp->yytops.yystates = yynewStates; - - yynewLookaheadNeeds = - (yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds, - (yystackp->yytops.yycapacity - * sizeof yynewLookaheadNeeds[0])); - if (yynewLookaheadNeeds == NULL) - yyMemoryExhausted (yystackp); - yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds; - } - yystackp->yytops.yystates[yystackp->yytops.yysize] - = yystackp->yytops.yystates[yyk]; - yystackp->yytops.yylookaheadNeeds[yystackp->yytops.yysize] - = yystackp->yytops.yylookaheadNeeds[yyk]; - yystackp->yytops.yysize += 1; - return yystackp->yytops.yysize-1; -} - -/** True iff Y0 and Y1 represent identical options at the top level. - * That is, they represent the same rule applied to RHS symbols - * that produce the same terminal symbols. */ -static yybool -yyidenticalOptions (yySemanticOption* yyy0, yySemanticOption* yyy1) -{ - if (yyy0->yyrule == yyy1->yyrule) - { - yyGLRState *yys0, *yys1; - int yyn; - for (yys0 = yyy0->yystate, yys1 = yyy1->yystate, - yyn = yyrhsLength (yyy0->yyrule); - yyn > 0; - yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1) - if (yys0->yyposn != yys1->yyposn) - return yyfalse; - return yytrue; - } - else - return yyfalse; -} - -/** Assuming identicalOptions (Y0,Y1), destructively merge the - * alternative semantic values for the RHS-symbols of Y1 and Y0. */ -static void -yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1) -{ - yyGLRState *yys0, *yys1; - int yyn; - for (yys0 = yyy0->yystate, yys1 = yyy1->yystate, - yyn = yyrhsLength (yyy0->yyrule); - yyn > 0; - yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1) - { - if (yys0 == yys1) - break; - else if (yys0->yyresolved) - { - yys1->yyresolved = yytrue; - yys1->yysemantics.yysval = yys0->yysemantics.yysval; - } - else if (yys1->yyresolved) - { - yys0->yyresolved = yytrue; - yys0->yysemantics.yysval = yys1->yysemantics.yysval; - } - else - { - yySemanticOption** yyz0p; - yySemanticOption* yyz1; - yyz0p = &yys0->yysemantics.yyfirstVal; - yyz1 = yys1->yysemantics.yyfirstVal; - while (YYID (yytrue)) - { - if (yyz1 == *yyz0p || yyz1 == NULL) - break; - else if (*yyz0p == NULL) - { - *yyz0p = yyz1; - break; - } - else if (*yyz0p < yyz1) - { - yySemanticOption* yyz = *yyz0p; - *yyz0p = yyz1; - yyz1 = yyz1->yynext; - (*yyz0p)->yynext = yyz; - } - yyz0p = &(*yyz0p)->yynext; - } - yys1->yysemantics.yyfirstVal = yys0->yysemantics.yyfirstVal; - } - } -} - -/** Y0 and Y1 represent two possible actions to take in a given - * parsing state; return 0 if no combination is possible, - * 1 if user-mergeable, 2 if Y0 is preferred, 3 if Y1 is preferred. */ -static int -yypreference (yySemanticOption* y0, yySemanticOption* y1) -{ - yyRuleNum r0 = y0->yyrule, r1 = y1->yyrule; - int p0 = yydprec[r0], p1 = yydprec[r1]; - - if (p0 == p1) - { - if (yymerger[r0] == 0 || yymerger[r0] != yymerger[r1]) - return 0; - else - return 1; - } - if (p0 == 0 || p1 == 0) - return 0; - if (p0 < p1) - return 3; - if (p1 < p0) - return 2; - return 0; -} - -static YYRESULTTAG yyresolveValue (yyGLRState* yys, - yyGLRStack* yystackp); - - -/** Resolve the previous N states starting at and including state S. If result - * != yyok, some states may have been left unresolved possibly with empty - * semantic option chains. Regardless of whether result = yyok, each state - * has been left with consistent data so that yydestroyGLRState can be invoked - * if necessary. */ -static YYRESULTTAG -yyresolveStates (yyGLRState* yys, int yyn, - yyGLRStack* yystackp) -{ - if (0 < yyn) - { - YYASSERT (yys->yypred); - YYCHK (yyresolveStates (yys->yypred, yyn-1, yystackp)); - if (! yys->yyresolved) - YYCHK (yyresolveValue (yys, yystackp)); - } - return yyok; -} - -/** Resolve the states for the RHS of OPT, perform its user action, and return - * the semantic value and location. Regardless of whether result = yyok, all - * RHS states have been destroyed (assuming the user action destroys all RHS - * semantic values if invoked). */ -static YYRESULTTAG -yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp, - YYSTYPE* yyvalp, YYLTYPE* yylocp) -{ - yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; - int yynrhs; - int yychar_current; - YYSTYPE yylval_current; - YYLTYPE yylloc_current; - YYRESULTTAG yyflag; - - yynrhs = yyrhsLength (yyopt->yyrule); - yyflag = yyresolveStates (yyopt->yystate, yynrhs, yystackp); - if (yyflag != yyok) - { - yyGLRState *yys; - for (yys = yyopt->yystate; yynrhs > 0; yys = yys->yypred, yynrhs -= 1) - yydestroyGLRState ("Cleanup: popping", yys); - return yyflag; - } - - yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yyopt->yystate; - yychar_current = yychar; - yylval_current = yylval; - yylloc_current = yylloc; - yychar = yyopt->yyrawchar; - yylval = yyopt->yyval; - yylloc = yyopt->yyloc; - yyflag = yyuserAction (yyopt->yyrule, yynrhs, - yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, - yyvalp, yylocp, yystackp); - yychar = yychar_current; - yylval = yylval_current; - yylloc = yylloc_current; - return yyflag; -} - -#if YYDEBUG -static void -yyreportTree (yySemanticOption* yyx, int yyindent) -{ - int yynrhs = yyrhsLength (yyx->yyrule); - int yyi; - yyGLRState* yys; - yyGLRState* yystates[1 + YYMAXRHS]; - yyGLRState yyleftmost_state; - - for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred) - yystates[yyi] = yys; - if (yys == NULL) - { - yyleftmost_state.yyposn = 0; - yystates[0] = &yyleftmost_state; - } - else - yystates[0] = yys; - - if (yyx->yystate->yyposn < yys->yyposn + 1) - YYFPRINTF (stderr, "%*s%s -> \n", - yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), - yyx->yyrule - 1); - else - YYFPRINTF (stderr, "%*s%s -> \n", - yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), - yyx->yyrule - 1, (unsigned long int) (yys->yyposn + 1), - (unsigned long int) yyx->yystate->yyposn); - for (yyi = 1; yyi <= yynrhs; yyi += 1) - { - if (yystates[yyi]->yyresolved) - { - if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn) - YYFPRINTF (stderr, "%*s%s \n", yyindent+2, "", - yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1])); - else - YYFPRINTF (stderr, "%*s%s \n", yyindent+2, "", - yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1]), - (unsigned long int) (yystates[yyi - 1]->yyposn + 1), - (unsigned long int) yystates[yyi]->yyposn); - } - else - yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2); - } -} -#endif - -/*ARGSUSED*/ static YYRESULTTAG -yyreportAmbiguity (yySemanticOption* yyx0, - yySemanticOption* yyx1) -{ - YYUSE (yyx0); - YYUSE (yyx1); - -#if YYDEBUG - YYFPRINTF (stderr, "Ambiguity detected.\n"); - YYFPRINTF (stderr, "Option 1,\n"); - yyreportTree (yyx0, 2); - YYFPRINTF (stderr, "\nOption 2,\n"); - yyreportTree (yyx1, 2); - YYFPRINTF (stderr, "\n"); -#endif - - yyerror (YY_("syntax is ambiguous")); - return yyabort; -} - -/** Starting at and including state S1, resolve the location for each of the - * previous N1 states that is unresolved. The first semantic option of a state - * is always chosen. */ -static void -yyresolveLocations (yyGLRState* yys1, int yyn1, - yyGLRStack *yystackp) -{ - if (0 < yyn1) - { - yyresolveLocations (yys1->yypred, yyn1 - 1, yystackp); - if (!yys1->yyresolved) - { - yySemanticOption *yyoption; - yyGLRStackItem yyrhsloc[1 + YYMAXRHS]; - int yynrhs; - int yychar_current; - YYSTYPE yylval_current; - YYLTYPE yylloc_current; - yyoption = yys1->yysemantics.yyfirstVal; - YYASSERT (yyoption != NULL); - yynrhs = yyrhsLength (yyoption->yyrule); - if (yynrhs > 0) - { - yyGLRState *yys; - int yyn; - yyresolveLocations (yyoption->yystate, yynrhs, - yystackp); - for (yys = yyoption->yystate, yyn = yynrhs; - yyn > 0; - yys = yys->yypred, yyn -= 1) - yyrhsloc[yyn].yystate.yyloc = yys->yyloc; - } - else - { - /* Both yyresolveAction and yyresolveLocations traverse the GSS - in reverse rightmost order. It is only necessary to invoke - yyresolveLocations on a subforest for which yyresolveAction - would have been invoked next had an ambiguity not been - detected. Thus the location of the previous state (but not - necessarily the previous state itself) is guaranteed to be - resolved already. */ - yyGLRState *yyprevious = yyoption->yystate; - yyrhsloc[0].yystate.yyloc = yyprevious->yyloc; - } - yychar_current = yychar; - yylval_current = yylval; - yylloc_current = yylloc; - yychar = yyoption->yyrawchar; - yylval = yyoption->yyval; - yylloc = yyoption->yyloc; - YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs); - yychar = yychar_current; - yylval = yylval_current; - yylloc = yylloc_current; - } - } -} - -/** Resolve the ambiguity represented in state S, perform the indicated - * actions, and set the semantic value of S. If result != yyok, the chain of - * semantic options in S has been cleared instead or it has been left - * unmodified except that redundant options may have been removed. Regardless - * of whether result = yyok, S has been left with consistent data so that - * yydestroyGLRState can be invoked if necessary. */ -static YYRESULTTAG -yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp) -{ - yySemanticOption* yyoptionList = yys->yysemantics.yyfirstVal; - yySemanticOption* yybest; - yySemanticOption** yypp; - yybool yymerge; - YYSTYPE yysval; - YYRESULTTAG yyflag; - YYLTYPE *yylocp = &yys->yyloc; - - yybest = yyoptionList; - yymerge = yyfalse; - for (yypp = &yyoptionList->yynext; *yypp != NULL; ) - { - yySemanticOption* yyp = *yypp; - - if (yyidenticalOptions (yybest, yyp)) - { - yymergeOptionSets (yybest, yyp); - *yypp = yyp->yynext; - } - else - { - switch (yypreference (yybest, yyp)) - { - case 0: - yyresolveLocations (yys, 1, yystackp); - return yyreportAmbiguity (yybest, yyp); - break; - case 1: - yymerge = yytrue; - break; - case 2: - break; - case 3: - yybest = yyp; - yymerge = yyfalse; - break; - default: - /* This cannot happen so it is not worth a YYASSERT (yyfalse), - but some compilers complain if the default case is - omitted. */ - break; - } - yypp = &yyp->yynext; - } - } - - if (yymerge) - { - yySemanticOption* yyp; - int yyprec = yydprec[yybest->yyrule]; - yyflag = yyresolveAction (yybest, yystackp, &yysval, - yylocp); - if (yyflag == yyok) - for (yyp = yybest->yynext; yyp != NULL; yyp = yyp->yynext) - { - if (yyprec == yydprec[yyp->yyrule]) - { - YYSTYPE yysval_other; - YYLTYPE yydummy; - yyflag = yyresolveAction (yyp, yystackp, &yysval_other, - &yydummy); - if (yyflag != yyok) - { - yydestruct ("Cleanup: discarding incompletely merged value for", - yystos[yys->yylrState], - &yysval); - break; - } - yyuserMerge (yymerger[yyp->yyrule], &yysval, &yysval_other); - } - } - } - else - yyflag = yyresolveAction (yybest, yystackp, &yysval, yylocp); - - if (yyflag == yyok) - { - yys->yyresolved = yytrue; - yys->yysemantics.yysval = yysval; - } - else - yys->yysemantics.yyfirstVal = NULL; - return yyflag; -} - -static YYRESULTTAG -yyresolveStack (yyGLRStack* yystackp) -{ - if (yystackp->yysplitPoint != NULL) - { - yyGLRState* yys; - int yyn; - - for (yyn = 0, yys = yystackp->yytops.yystates[0]; - yys != yystackp->yysplitPoint; - yys = yys->yypred, yyn += 1) - continue; - YYCHK (yyresolveStates (yystackp->yytops.yystates[0], yyn, yystackp - )); - } - return yyok; -} - -static void -yycompressStack (yyGLRStack* yystackp) -{ - yyGLRState* yyp, *yyq, *yyr; - - if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == NULL) - return; - - for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = NULL; - yyp != yystackp->yysplitPoint; - yyr = yyp, yyp = yyq, yyq = yyp->yypred) - yyp->yypred = yyr; - - yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems; - yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1; - yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems; - yystackp->yysplitPoint = NULL; - yystackp->yylastDeleted = NULL; - - while (yyr != NULL) - { - yystackp->yynextFree->yystate = *yyr; - yyr = yyr->yypred; - yystackp->yynextFree->yystate.yypred = &yystackp->yynextFree[-1].yystate; - yystackp->yytops.yystates[0] = &yystackp->yynextFree->yystate; - yystackp->yynextFree += 1; - yystackp->yyspaceLeft -= 1; - } -} - -static YYRESULTTAG -yyprocessOneStack (yyGLRStack* yystackp, size_t yyk, - size_t yyposn) -{ - int yyaction; - const short int* yyconflicts; - yyRuleNum yyrule; - - while (yystackp->yytops.yystates[yyk] != NULL) - { - yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState; - YYDPRINTF ((stderr, "Stack %lu Entering state %d\n", - (unsigned long int) yyk, yystate)); - - YYASSERT (yystate != YYFINAL); - - if (yyisDefaultedState (yystate)) - { - yyrule = yydefaultAction (yystate); - if (yyrule == 0) - { - YYDPRINTF ((stderr, "Stack %lu dies.\n", - (unsigned long int) yyk)); - yymarkStackDeleted (yystackp, yyk); - return yyok; - } - YYCHK (yyglrReduce (yystackp, yyk, yyrule, yyfalse)); - } - else - { - yySymbol yytoken; - yystackp->yytops.yylookaheadNeeds[yyk] = yytrue; - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); - - while (*yyconflicts != 0) - { - size_t yynewStack = yysplitStack (yystackp, yyk); - YYDPRINTF ((stderr, "Splitting off stack %lu from %lu.\n", - (unsigned long int) yynewStack, - (unsigned long int) yyk)); - YYCHK (yyglrReduce (yystackp, yynewStack, - *yyconflicts, yyfalse)); - YYCHK (yyprocessOneStack (yystackp, yynewStack, - yyposn)); - yyconflicts += 1; - } - - if (yyisShiftAction (yyaction)) - break; - else if (yyisErrorAction (yyaction)) - { - YYDPRINTF ((stderr, "Stack %lu dies.\n", - (unsigned long int) yyk)); - yymarkStackDeleted (yystackp, yyk); - break; - } - else - YYCHK (yyglrReduce (yystackp, yyk, -yyaction, - yyfalse)); - } - } - return yyok; -} - -/*ARGSUSED*/ static void -yyreportSyntaxError (yyGLRStack* yystackp) -{ - if (yystackp->yyerrState == 0) - { -#if YYERROR_VERBOSE - int yyn; - yyn = yypact[yystackp->yytops.yystates[0]->yylrState]; - if (YYPACT_NINF < yyn && yyn <= YYLAST) - { - yySymbol yytoken = YYTRANSLATE (yychar); - size_t yysize0 = yytnamerr (NULL, yytokenName (yytoken)); - size_t yysize = yysize0; - size_t yysize1; - yybool yysize_overflow = yyfalse; - char* yymsg = NULL; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytokenName (yytoken); - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytokenName (yyx); - yysize1 = yysize + yytnamerr (NULL, yytokenName (yyx)); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + strlen (yyf); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - - if (!yysize_overflow) - yymsg = (char *) YYMALLOC (yysize); - - if (yymsg) - { - char *yyp = yymsg; - int yyi = 0; - while ((*yyp = *yyf)) - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - yyerror (yymsg); - YYFREE (yymsg); - } - else - { - yyerror (YY_("syntax error")); - yyMemoryExhausted (yystackp); - } - } - else -#endif /* YYERROR_VERBOSE */ - yyerror (YY_("syntax error")); - yynerrs += 1; - } -} - -/* Recover from a syntax error on *YYSTACKP, assuming that *YYSTACKP->YYTOKENP, - yylval, and yylloc are the syntactic category, semantic value, and location - of the lookahead. */ -/*ARGSUSED*/ static void -yyrecoverSyntaxError (yyGLRStack* yystackp) -{ - size_t yyk; - int yyj; - - if (yystackp->yyerrState == 3) - /* We just shifted the error token and (perhaps) took some - reductions. Skip tokens until we can proceed. */ - while (YYID (yytrue)) - { - yySymbol yytoken; - if (yychar == YYEOF) - yyFail (yystackp, NULL); - if (yychar != YYEMPTY) - { - yytoken = YYTRANSLATE (yychar); - yydestruct ("Error: discarding", - yytoken, &yylval); - } - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - yyj = yypact[yystackp->yytops.yystates[0]->yylrState]; - if (yyis_pact_ninf (yyj)) - return; - yyj += yytoken; - if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken) - { - if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0) - return; - } - else if (yytable[yyj] != 0 && ! yyis_table_ninf (yytable[yyj])) - return; - } - - /* Reduce to one stack. */ - for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1) - if (yystackp->yytops.yystates[yyk] != NULL) - break; - if (yyk >= yystackp->yytops.yysize) - yyFail (yystackp, NULL); - for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1) - yymarkStackDeleted (yystackp, yyk); - yyremoveDeletes (yystackp); - yycompressStack (yystackp); - - /* Now pop stack until we find a state that shifts the error token. */ - yystackp->yyerrState = 3; - while (yystackp->yytops.yystates[0] != NULL) - { - yyGLRState *yys = yystackp->yytops.yystates[0]; - yyj = yypact[yys->yylrState]; - if (! yyis_pact_ninf (yyj)) - { - yyj += YYTERROR; - if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR - && yyisShiftAction (yytable[yyj])) - { - /* Shift the error token having adjusted its location. */ - YYLTYPE yyerrloc = {0}; - YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]], - &yylval, &yyerrloc); - yyglrShift (yystackp, 0, yytable[yyj], - yys->yyposn, &yylval, &yyerrloc); - yys = yystackp->yytops.yystates[0]; - break; - } - } - - if (yys->yypred != NULL) - yydestroyGLRState ("Error: popping", yys); - yystackp->yytops.yystates[0] = yys->yypred; - yystackp->yynextFree -= 1; - yystackp->yyspaceLeft += 1; - } - if (yystackp->yytops.yystates[0] == NULL) - yyFail (yystackp, NULL); -} - -#define YYCHK1(YYE) \ - do { \ - switch (YYE) { \ - case yyok: \ - break; \ - case yyabort: \ - goto yyabortlab; \ - case yyaccept: \ - goto yyacceptlab; \ - case yyerr: \ - goto yyuser_error; \ - default: \ - goto yybuglab; \ - } \ - } while (YYID (0)) - - -/*----------. -| yyparse. | -`----------*/ - -int -yyparse (void) -{ - int yyresult; - yyGLRStack yystack; - yyGLRStack* const yystackp = &yystack; - size_t yyposn; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yychar = YYEMPTY; - yylval = yyval_default; - - - if (! yyinitGLRStack (yystackp, YYINITDEPTH)) - goto yyexhaustedlab; - switch (YYSETJMP (yystack.yyexception_buffer)) - { - case 0: break; - case 1: goto yyabortlab; - case 2: goto yyexhaustedlab; - default: goto yybuglab; - } - yyglrShift (&yystack, 0, 0, 0, &yylval, &yylloc); - yyposn = 0; - - while (YYID (yytrue)) - { - /* For efficiency, we have two loops, the first of which is - specialized to deterministic operation (single stack, no - potential ambiguity). */ - /* Standard mode */ - while (YYID (yytrue)) - { - yyRuleNum yyrule; - int yyaction; - const short int* yyconflicts; - - yyStateNum yystate = yystack.yytops.yystates[0]->yylrState; - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) - goto yyacceptlab; - if (yyisDefaultedState (yystate)) - { - yyrule = yydefaultAction (yystate); - if (yyrule == 0) - { - - yyreportSyntaxError (&yystack); - goto yyuser_error; - } - YYCHK1 (yyglrReduce (&yystack, 0, yyrule, yytrue)); - } - else - { - yySymbol yytoken; - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); - if (*yyconflicts != 0) - break; - if (yyisShiftAction (yyaction)) - { - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - yychar = YYEMPTY; - yyposn += 1; - yyglrShift (&yystack, 0, yyaction, yyposn, &yylval, &yylloc); - if (0 < yystack.yyerrState) - yystack.yyerrState -= 1; - } - else if (yyisErrorAction (yyaction)) - { - - yyreportSyntaxError (&yystack); - goto yyuser_error; - } - else - YYCHK1 (yyglrReduce (&yystack, 0, -yyaction, yytrue)); - } - } - - while (YYID (yytrue)) - { - yySymbol yytoken_to_shift; - size_t yys; - - for (yys = 0; yys < yystack.yytops.yysize; yys += 1) - yystackp->yytops.yylookaheadNeeds[yys] = yychar != YYEMPTY; - - /* yyprocessOneStack returns one of three things: - - - An error flag. If the caller is yyprocessOneStack, it - immediately returns as well. When the caller is finally - yyparse, it jumps to an error label via YYCHK1. - - - yyok, but yyprocessOneStack has invoked yymarkStackDeleted - (&yystack, yys), which sets the top state of yys to NULL. Thus, - yyparse's following invocation of yyremoveDeletes will remove - the stack. - - - yyok, when ready to shift a token. - - Except in the first case, yyparse will invoke yyremoveDeletes and - then shift the next token onto all remaining stacks. This - synchronization of the shift (that is, after all preceding - reductions on all stacks) helps prevent double destructor calls - on yylval in the event of memory exhaustion. */ - - for (yys = 0; yys < yystack.yytops.yysize; yys += 1) - YYCHK1 (yyprocessOneStack (&yystack, yys, yyposn)); - yyremoveDeletes (&yystack); - if (yystack.yytops.yysize == 0) - { - yyundeleteLastStack (&yystack); - if (yystack.yytops.yysize == 0) - yyFail (&yystack, YY_("syntax error")); - YYCHK1 (yyresolveStack (&yystack)); - YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); - - yyreportSyntaxError (&yystack); - goto yyuser_error; - } - - /* If any yyglrShift call fails, it will fail after shifting. Thus, - a copy of yylval will already be on stack 0 in the event of a - failure in the following loop. Thus, yychar is set to YYEMPTY - before the loop to make sure the user destructor for yylval isn't - called twice. */ - yytoken_to_shift = YYTRANSLATE (yychar); - yychar = YYEMPTY; - yyposn += 1; - for (yys = 0; yys < yystack.yytops.yysize; yys += 1) - { - int yyaction; - const short int* yyconflicts; - yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState; - yygetLRActions (yystate, yytoken_to_shift, &yyaction, - &yyconflicts); - /* Note that yyconflicts were handled by yyprocessOneStack. */ - YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long int) yys)); - YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc); - yyglrShift (&yystack, yys, yyaction, yyposn, - &yylval, &yylloc); - YYDPRINTF ((stderr, "Stack %lu now in state #%d\n", - (unsigned long int) yys, - yystack.yytops.yystates[yys]->yylrState)); - } - - if (yystack.yytops.yysize == 1) - { - YYCHK1 (yyresolveStack (&yystack)); - YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); - yycompressStack (&yystack); - break; - } - } - continue; - yyuser_error: - yyrecoverSyntaxError (&yystack); - yyposn = yystack.yytops.yystates[0]->yyposn; - } - - yyacceptlab: - yyresult = 0; - goto yyreturn; - - yybuglab: - YYASSERT (yyfalse); - goto yyabortlab; - - yyabortlab: - yyresult = 1; - goto yyreturn; - - yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - goto yyreturn; - - yyreturn: - if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - YYTRANSLATE (yychar), - &yylval); - - /* If the stack is well-formed, pop the stack until it is empty, - destroying its entries as we go. But free the stack regardless - of whether it is well-formed. */ - if (yystack.yyitems) - { - yyGLRState** yystates = yystack.yytops.yystates; - if (yystates) - { - size_t yysize = yystack.yytops.yysize; - size_t yyk; - for (yyk = 0; yyk < yysize; yyk += 1) - if (yystates[yyk]) - { - while (yystates[yyk]) - { - yyGLRState *yys = yystates[yyk]; - if (yys->yypred != NULL) - yydestroyGLRState ("Cleanup: popping", yys); - yystates[yyk] = yys->yypred; - yystack.yynextFree -= 1; - yystack.yyspaceLeft += 1; - } - break; - } - } - yyfreeGLRStack (&yystack); - } - - /* Make sure YYID is used. */ - return YYID (yyresult); -} - -/* DEBUGGING ONLY */ -#if YYDEBUG -static void yypstack (yyGLRStack* yystackp, size_t yyk) - __attribute__ ((__unused__)); -static void yypdumpstack (yyGLRStack* yystackp) __attribute__ ((__unused__)); - -static void -yy_yypstack (yyGLRState* yys) -{ - if (yys->yypred) - { - yy_yypstack (yys->yypred); - YYFPRINTF (stderr, " -> "); - } - YYFPRINTF (stderr, "%d@%lu", yys->yylrState, - (unsigned long int) yys->yyposn); -} - -static void -yypstates (yyGLRState* yyst) -{ - if (yyst == NULL) - YYFPRINTF (stderr, ""); - else - yy_yypstack (yyst); - YYFPRINTF (stderr, "\n"); -} - -static void -yypstack (yyGLRStack* yystackp, size_t yyk) -{ - yypstates (yystackp->yytops.yystates[yyk]); -} - -#define YYINDEX(YYX) \ - ((YYX) == NULL ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems) - - -static void -yypdumpstack (yyGLRStack* yystackp) -{ - yyGLRStackItem* yyp; - size_t yyi; - for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1) - { - YYFPRINTF (stderr, "%3lu. ", - (unsigned long int) (yyp - yystackp->yyitems)); - if (*(yybool *) yyp) - { - YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld", - yyp->yystate.yyresolved, yyp->yystate.yylrState, - (unsigned long int) yyp->yystate.yyposn, - (long int) YYINDEX (yyp->yystate.yypred)); - if (! yyp->yystate.yyresolved) - YYFPRINTF (stderr, ", firstVal: %ld", - (long int) YYINDEX (yyp->yystate - .yysemantics.yyfirstVal)); - } - else - { - YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld", - yyp->yyoption.yyrule - 1, - (long int) YYINDEX (yyp->yyoption.yystate), - (long int) YYINDEX (yyp->yyoption.yynext)); - } - YYFPRINTF (stderr, "\n"); - } - YYFPRINTF (stderr, "Tops:"); - for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) - YYFPRINTF (stderr, "%lu: %ld; ", (unsigned long int) yyi, - (long int) YYINDEX (yystackp->yytops.yystates[yyi])); - YYFPRINTF (stderr, "\n"); -} -#endif - - - -/* Line 2634 of glr.c */ -#line 3328 "vtkParse.y" - -#include -#include "lex.yy.c" - -/* fill in the type name if none given */ -const char *type_class(unsigned int type, const char *classname) -{ - if (classname) - { - if (classname[0] == '\0') - { - switch ((type & VTK_PARSE_BASE_TYPE)) - { - case 0: - classname = "auto"; - break; - case VTK_PARSE_VOID: - classname = "void"; - break; - case VTK_PARSE_BOOL: - classname = "bool"; - break; - case VTK_PARSE_FLOAT: - classname = "float"; - break; - case VTK_PARSE_DOUBLE: - classname = "double"; - break; - case VTK_PARSE_LONG_DOUBLE: - classname = "long double"; - break; - case VTK_PARSE_CHAR: - classname = "char"; - break; - case VTK_PARSE_CHAR16_T: - classname = "char16_t"; - break; - case VTK_PARSE_CHAR32_T: - classname = "char32_t"; - break; - case VTK_PARSE_WCHAR_T: - classname = "wchar_t"; - break; - case VTK_PARSE_UNSIGNED_CHAR: - classname = "unsigned char"; - break; - case VTK_PARSE_SIGNED_CHAR: - classname = "signed char"; - break; - case VTK_PARSE_SHORT: - classname = "short"; - break; - case VTK_PARSE_UNSIGNED_SHORT: - classname = "unsigned short"; - break; - case VTK_PARSE_INT: - classname = "int"; - break; - case VTK_PARSE_UNSIGNED_INT: - classname = "unsigned int"; - break; - case VTK_PARSE_LONG: - classname = "long"; - break; - case VTK_PARSE_UNSIGNED_LONG: - classname = "unsigned long"; - break; - case VTK_PARSE_LONG_LONG: - classname = "long long"; - break; - case VTK_PARSE_UNSIGNED_LONG_LONG: - classname = "unsigned long long"; - break; - case VTK_PARSE___INT64: - classname = "__int64"; - break; - case VTK_PARSE_UNSIGNED___INT64: - classname = "unsigned __int64"; - break; - } - } - } - - return classname; -} - -/* check whether this is the class we are looking for */ -void start_class(const char *classname, int is_struct_or_union) -{ - ClassInfo *outerClass = currentClass; - pushClass(); - currentClass = (ClassInfo *)malloc(sizeof(ClassInfo)); - vtkParse_InitClass(currentClass); - currentClass->Name = classname; - if (is_struct_or_union == 1) - { - currentClass->ItemType = VTK_STRUCT_INFO; - } - if (is_struct_or_union == 2) - { - currentClass->ItemType = VTK_UNION_INFO; - } - - if (classname && classname[strlen(classname)-1] != '>') - { - if (outerClass) - { - vtkParse_AddClassToClass(outerClass, currentClass); - } - else - { - vtkParse_AddClassToNamespace(currentNamespace, currentClass); - } - } - - /* template information */ - if (currentTemplate) - { - currentClass->Template = currentTemplate; - currentTemplate = NULL; - } - - /* comment, if any */ - currentClass->Comment = vtkstrdup(getComment()); - - access_level = VTK_ACCESS_PRIVATE; - if (is_struct_or_union) - { - access_level = VTK_ACCESS_PUBLIC; - } - - vtkParse_InitFunction(currentFunction); - startSig(); - clearComment(); -} - -/* reached the end of a class definition */ -void end_class() -{ - /* add default constructors */ - vtkParse_AddDefaultConstructors(currentClass, data->Strings); - - popClass(); -} - -/* add a base class to the specified class */ -void add_base_class(ClassInfo *cls, const char *name, int al, - unsigned int extra) -{ - /* "extra" can contain VTK_PARSE_VIRTUAL and VTK_PARSE_PACK */ - if (cls && al == VTK_ACCESS_PUBLIC && - (extra & VTK_PARSE_VIRTUAL) == 0 && - (extra & VTK_PARSE_PACK) == 0) - { - vtkParse_AddStringToArray(&cls->SuperClasses, - &cls->NumberOfSuperClasses, - name); - } -} - -/* add a using declaration or directive */ -void add_using(const char *name, int is_namespace) -{ - size_t i; - UsingInfo *item; - - item = (UsingInfo *)malloc(sizeof(UsingInfo)); - vtkParse_InitUsing(item); - if (is_namespace) - { - item->Name = NULL; - item->Scope = name; - } - else - { - i = strlen(name); - while (i > 0 && name[i-1] != ':') { i--; } - item->Name = vtkstrdup(&name[i]); - while (i > 0 && name[i-1] == ':') { i--; } - item->Scope = vtkstrndup(name, i); - } - - if (currentClass) - { - vtkParse_AddUsingToClass(currentClass, item); - } - else - { - vtkParse_AddUsingToNamespace(currentNamespace, item); - } -} - -/* start a new enum */ -void start_enum(const char *name, int is_scoped, - unsigned int type, const char *basename) -{ - EnumInfo *item; - - currentEnumType = (type ? type : VTK_PARSE_INT); - currentEnumName = "int"; - currentEnumValue = NULL; - - if (type == 0 && is_scoped) - { - type = VTK_PARSE_INT; - } - - if (name) - { - currentEnumName = name; - item = (EnumInfo *)malloc(sizeof(EnumInfo)); - vtkParse_InitEnum(item); - item->Name = name; - item->Access = access_level; - - if (currentClass) - { - vtkParse_AddEnumToClass(currentClass, item); - } - else - { - vtkParse_AddEnumToNamespace(currentNamespace, item); - } - - if (type) - { - vtkParse_AddStringToArray(&item->SuperClasses, - &item->NumberOfSuperClasses, - type_class(type, basename)); - } - - if (is_scoped) - { - pushClass(); - currentClass = item; - } - } -} - -/* finish the enum */ -void end_enum() -{ - if (currentClass && currentClass->ItemType == VTK_ENUM_INFO) - { - popClass(); - } - - currentEnumName = NULL; - currentEnumValue = NULL; -} - -/* add a constant to the enum */ -void add_enum(const char *name, const char *value) -{ - static char text[2048]; - int i; - long j; - - if (value) - { - strcpy(text, value); - currentEnumValue = value; - } - else if (currentEnumValue) - { - i = strlen(text); - while (i > 0 && text[i-1] >= '0' && - text[i-1] <= '9') { i--; } - - if (i == 0 || text[i-1] == ' ' || - (i > 1 && text[i-2] == ' ' && - (text[i-1] == '-' || text[i-1] == '+'))) - { - if (i > 0 && text[i-1] != ' ') - { - i--; - } - j = (int)strtol(&text[i], NULL, 10); - sprintf(&text[i], "%li", j+1); - } - else - { - i = strlen(text); - strcpy(&text[i], " + 1"); - } - currentEnumValue = vtkstrdup(text); - } - else - { - strcpy(text, "0"); - currentEnumValue = "0"; - } - - add_constant(name, currentEnumValue, currentEnumType, currentEnumName, 2); -} - -/* for a macro constant, guess the constant type, doesn't do any math */ -unsigned int guess_constant_type(const char *valstring) -{ - unsigned int valtype = 0; - size_t k; - int i; - int is_name = 0; - - if (valstring == NULL || valstring[0] == '\0') - { - return 0; - } - - k = vtkParse_SkipId(valstring); - if (valstring[k] == '\0') - { - is_name = 1; - } - - if (strcmp(valstring, "true") == 0 || strcmp(valstring, "false") == 0) - { - return VTK_PARSE_BOOL; - } - - if (strcmp(valstring, "nullptr") == 0) - { - return VTK_PARSE_NULLPTR_T; - } - - if (valstring[0] == '\'') - { - return VTK_PARSE_CHAR; - } - - if (strncmp(valstring, "VTK_TYPE_CAST(", 14) == 0 || - strncmp(valstring, "static_cast<", 12) == 0 || - strncmp(valstring, "const_cast<", 11) == 0 || - strncmp(valstring, "(", 1) == 0) - { - const char *cp; - size_t n; - int is_unsigned = 0; - - cp = &valstring[1]; - if (valstring[0] == 'c') - { - cp = &valstring[11]; - } - else if (valstring[0] == 's') - { - cp = &valstring[12]; - } - else if (valstring[0] == 'V') - { - cp = &valstring[14]; - } - - if (strncmp(cp, "unsigned ", 9) == 0) - { - is_unsigned = 1; - cp += 9; - } - - n = strlen(cp); - for (k = 0; k < n && cp[k] != ',' && - cp[k] != '>' && cp[k] != ')'; k++) { ; }; - - if (strncmp(cp, "long long", k) == 0) - { valtype = VTK_PARSE_LONG_LONG; } - else if (strncmp(cp, "__int64", k) == 0) - { valtype = VTK_PARSE___INT64; } - else if (strncmp(cp, "long", k) == 0) - { valtype = VTK_PARSE_LONG; } - else if (strncmp(cp, "short", k) == 0) - { valtype = VTK_PARSE_SHORT; } - else if (strncmp(cp, "signed char", k) == 0) - { valtype = VTK_PARSE_SIGNED_CHAR; } - else if (strncmp(cp, "char", k) == 0) - { valtype = VTK_PARSE_CHAR; } - else if (strncmp(cp, "int", k) == 0 || - strncmp(cp, "signed", k) == 0) - { valtype = VTK_PARSE_INT; } - else if (strncmp(cp, "float", k) == 0) - { valtype = VTK_PARSE_FLOAT; } - else if (strncmp(cp, "double", k) == 0) - { valtype = VTK_PARSE_DOUBLE; } - else if (strncmp(cp, "char *", k) == 0) - { valtype = VTK_PARSE_CHAR_PTR; } - - if (is_unsigned) - { - if (valtype == 0) { valtype = VTK_PARSE_INT; } - valtype = (valtype | VTK_PARSE_UNSIGNED); - } - - if (valtype != 0) - { - return valtype; - } - } - - /* check the current scope */ - if (is_name) - { - NamespaceInfo *scope = currentNamespace; - if (namespaceDepth > 0) - { - scope = namespaceStack[0]; - } - - for (i = 0; i < scope->NumberOfConstants; i++) - { - if (strcmp(scope->Constants[i]->Name, valstring) == 0) - { - return scope->Constants[i]->Type; - } - } - } - - /* check for preprocessor macros */ - if (is_name) - { - MacroInfo *macro = vtkParsePreprocess_GetMacro( - preprocessor, valstring); - - if (macro && !macro->IsFunction) - { - return guess_constant_type(macro->Definition); - } - } - - /* fall back to the preprocessor to evaluate the constant */ - { - preproc_int_t val; - int is_unsigned; - int result = vtkParsePreprocess_EvaluateExpression( - preprocessor, valstring, &val, &is_unsigned); - - if (result == VTK_PARSE_PREPROC_DOUBLE) - { - return VTK_PARSE_DOUBLE; - } - else if (result == VTK_PARSE_PREPROC_FLOAT) - { - return VTK_PARSE_FLOAT; - } - else if (result == VTK_PARSE_PREPROC_STRING) - { - return VTK_PARSE_CHAR_PTR; - } - else if (result == VTK_PARSE_OK) - { - if (is_unsigned) - { - if ((preproc_uint_t)val <= VTK_UNSIGNED_INT_MAX) - { - return VTK_PARSE_UNSIGNED_INT; - } - else - { -#if defined(VTK_TYPE_USE_LONG_LONG) - return VTK_PARSE_UNSIGNED_LONG_LONG; -#elif defined(VTK_TYPE_USE___INT64) - return VTK_PARSE_UNSIGNED___INT64; -#else - return VTK_PARSE_UNSIGNED_LONG; -#endif - } - } - else - { - if (val >= VTK_INT_MIN && val <= VTK_INT_MAX) - { - return VTK_PARSE_INT; - } - else - { -#if defined(VTK_TYPE_USE_LONG_LONG) - return VTK_PARSE_LONG_LONG; -#elif defined(VTK_TYPE_USE___INT64) - return VTK_PARSE___INT64; -#else - return VTK_PARSE_LONG; -#endif - } - } - } - } - - return 0; -} - -/* add a constant to the current class or namespace */ -void add_constant(const char *name, const char *value, - unsigned int type, const char *typeclass, int flag) -{ - ValueInfo *con = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(con); - con->ItemType = VTK_CONSTANT_INFO; - con->Name = name; - con->Value = value; - con->Type = type; - con->Class = type_class(type, typeclass); - - if (flag == 2) - { - con->IsEnum = 1; - } - - if (flag == 1) - { - /* actually a macro, need to guess the type */ - ValueInfo **cptr = data->Contents->Constants; - int n = data->Contents->NumberOfConstants; - int i; - - con->Access = VTK_ACCESS_PUBLIC; - if (con->Type == 0) - { - con->Type = guess_constant_type(con->Value); - } - - for (i = 0; i < n; i++) - { - if (strcmp(cptr[i]->Name, con->Name) == 0) - { - break; - } - } - - if (i == n) - { - vtkParse_AddConstantToNamespace(data->Contents, con); - } - else - { - vtkParse_FreeValue(con); - } - } - else if (currentClass) - { - con->Access = access_level; - vtkParse_AddConstantToClass(currentClass, con); - } - else - { - con->Access = VTK_ACCESS_PUBLIC; - vtkParse_AddConstantToNamespace(currentNamespace, con); - } -} - -/* if the name is a const in this namespace, the scope it */ -const char *add_const_scope(const char *name) -{ - static char text[256]; - NamespaceInfo *scope = currentNamespace; - int i, j; - int addscope = 0; - - strcpy(text, name); - - if (currentClass) - { - for (j = 0; j < currentClass->NumberOfConstants; j++) - { - if (strcmp(currentClass->Constants[j]->Name, text) == 0) - { - prepend_scope(text, currentClass->Name); - addscope = 1; - } - } - } - i = namespaceDepth; - while (scope && scope->Name) - { - if (addscope) - { - prepend_scope(text, scope->Name); - } - else - { - for (j = 0; j < scope->NumberOfConstants; j++) - { - if (strcmp(scope->Constants[j]->Name, text) == 0) - { - prepend_scope(text, scope->Name); - addscope = 1; - } - } - } - - scope = 0; - if (i > 0) - { - scope = namespaceStack[--i]; - } - } - - return text; -} - -/* guess the type from the ID */ -unsigned int guess_id_type(const char *cp) -{ - unsigned int t = 0; - - if (cp) - { - size_t i; - const char *dp; - - i = strlen(cp); - while (i > 0 && cp[i-1] != ':') { i--; } - dp = &cp[i]; - - if (strcmp(dp, "vtkStdString") == 0 || - strcmp(cp, "std::string") == 0) - { - t = VTK_PARSE_STRING; - } - else if (strcmp(dp, "vtkUnicodeString") == 0) - { - t = VTK_PARSE_UNICODE_STRING; - } - else if (strncmp(dp, "vtk", 3) == 0) - { - t = VTK_PARSE_OBJECT; - } - else if (strncmp(dp, "Q", 1) == 0 || - strncmp(cp, "Qt::", 4) == 0) - { - t = VTK_PARSE_QOBJECT; - } - else - { - t = VTK_PARSE_UNKNOWN; - } - } - - return t; -} - -/* add a template parameter to the current template */ -void add_template_parameter( - unsigned int datatype, unsigned int extra, const char *funcSig) -{ - ValueInfo *param = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(param); - handle_complex_type(param, datatype, extra, funcSig); - param->Name = getVarName(); - vtkParse_AddParameterToTemplate(currentTemplate, param); -} - -/* add a parameter to a function */ -void add_parameter(FunctionInfo *func, unsigned int type, - const char *typeclass, int count) -{ - char text[64]; - ValueInfo *param = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(param); - - param->Type = type; - param->Class = type_class(type, typeclass); - - if (count) - { - param->Count = count; - sprintf(text, "%i", count); - vtkParse_AddStringToArray(¶m->Dimensions, ¶m->NumberOfDimensions, - vtkstrdup(text)); - } - - add_legacy_parameter(func, param); - - vtkParse_AddParameterToFunction(func, param); -} - -/* set the return type for the current function */ -void set_return(FunctionInfo *func, unsigned int type, - const char *typeclass, int count) -{ - char text[64]; - ValueInfo *val = (ValueInfo *)malloc(sizeof(ValueInfo)); - - vtkParse_InitValue(val); - val->Type = type; - val->Class = type_class(type, typeclass); - - if (count) - { - val->Count = count; - sprintf(text, "%i", count); - vtkParse_AddStringToArray(&val->Dimensions, &val->NumberOfDimensions, - vtkstrdup(text)); - } - - func->ReturnValue = val; - -#ifndef VTK_PARSE_LEGACY_REMOVE - func->ReturnType = val->Type; - func->ReturnClass = val->Class; - func->HaveHint = (count > 0); - func->HintSize = count; -#endif -} - -int count_from_dimensions(ValueInfo *val) -{ - int count, i, n; - const char *cp; - - /* count is the product of the dimensions */ - count = 0; - if (val->NumberOfDimensions) - { - count = 1; - for (i = 0; i < val->NumberOfDimensions; i++) - { - n = 0; - cp = val->Dimensions[i]; - if (cp[0] != '\0') - { - while (*cp != '\0' && *cp >= '0' && *cp <= '9') { cp++; } - while (*cp != '\0' && (*cp == 'u' || *cp == 'l' || - *cp == 'U' || *cp == 'L')) { cp++; } - if (*cp == '\0') - { - n = (int)strtol(val->Dimensions[i], NULL, 0); - } - } - count *= n; - } - } - - return count; -} - -/* deal with types that include function pointers or arrays */ -void handle_complex_type( - ValueInfo *val, unsigned int datatype, unsigned int extra, - const char *funcSig) -{ - FunctionInfo *func = 0; - - /* remove specifiers like "friend" and "typedef" */ - datatype &= VTK_PARSE_QUALIFIED_TYPE; - - /* remove the pack specifier caused by "..." */ - if ((extra & VTK_PARSE_PACK) != 0) - { - val->IsPack = 1; - extra ^= VTK_PARSE_PACK; - } - - /* if "extra" was set, parentheses were involved */ - if ((extra & VTK_PARSE_BASE_TYPE) == VTK_PARSE_FUNCTION) - { - /* the current type becomes the function return type */ - func = getFunction(); - func->ReturnValue = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(func->ReturnValue); - func->ReturnValue->Type = datatype; - func->ReturnValue->Class = type_class(datatype, getTypeId()); - if (funcSig) { func->Signature = vtkstrdup(funcSig); } - val->Function = func; - -#ifndef VTK_PARSE_LEGACY_REMOVE - func->ReturnType = func->ReturnValue->Type; - func->ReturnClass = func->ReturnValue->Class; -#endif - - /* the val type is whatever was inside the parentheses */ - clearTypeId(); - setTypeId(func->Class ? "method" : "function"); - datatype = (extra & (VTK_PARSE_UNQUALIFIED_TYPE | VTK_PARSE_RVALUE)); - } - else if ((extra & VTK_PARSE_INDIRECT) == VTK_PARSE_BAD_INDIRECT) - { - datatype = (datatype | VTK_PARSE_BAD_INDIRECT); - } - else if ((extra & VTK_PARSE_INDIRECT) != 0) - { - extra = (extra & (VTK_PARSE_INDIRECT | VTK_PARSE_RVALUE)); - - if ((extra & VTK_PARSE_REF) != 0) - { - datatype = (datatype | (extra & (VTK_PARSE_REF | VTK_PARSE_RVALUE))); - extra = (extra & ~(VTK_PARSE_REF | VTK_PARSE_RVALUE)); - } - - if (extra != 0 && getArrayNDims() > 0) - { - /* pointer represents an unsized array bracket */ - datatype = add_indirection(datatype, VTK_PARSE_ARRAY); - extra = ((extra >> 2) & VTK_PARSE_POINTER_MASK); - } - - datatype = add_indirection(datatype, extra); - } - - if (getArrayNDims() == 1) - { - if ((datatype & VTK_PARSE_POINTER_LOWMASK) != VTK_PARSE_ARRAY) - { - /* turn the first set of brackets into a pointer */ - datatype = add_indirection(datatype, VTK_PARSE_POINTER); - } - else - { - pushArrayFront(""); - } - } - else if (getArrayNDims() > 1) - { - if ((datatype & VTK_PARSE_POINTER_LOWMASK) != VTK_PARSE_ARRAY) - { - /* turn the first set of brackets into a pointer */ - datatype = add_indirection(datatype, VTK_PARSE_ARRAY); - } - else - { - pushArrayFront(""); - } - } - - /* get the data type */ - val->Type = datatype; - val->Class = type_class(datatype, getTypeId()); - - /* copy contents of all brackets to the ArgDimensions */ - val->NumberOfDimensions = getArrayNDims(); - val->Dimensions = getArray(); - clearArray(); - - /* count is the product of the dimensions */ - val->Count = count_from_dimensions(val); -} - -/* add a parameter to the legacy part of the FunctionInfo struct */ -void add_legacy_parameter(FunctionInfo *func, ValueInfo *param) -{ -#ifndef VTK_PARSE_LEGACY_REMOVE - int i = func->NumberOfArguments; - - if (i < MAX_ARGS) - { - func->NumberOfArguments = i + 1; - func->ArgTypes[i] = param->Type; - func->ArgClasses[i] = param->Class; - func->ArgCounts[i] = param->Count; - - /* legacy wrappers need VTK_PARSE_FUNCTION without POINTER */ - if (param->Type == VTK_PARSE_FUNCTION_PTR) - { - /* check for signature "void (*func)(void *)" */ - if (param->Function->NumberOfParameters == 1 && - param->Function->Parameters[0]->Type == VTK_PARSE_VOID_PTR && - param->Function->Parameters[0]->NumberOfDimensions == 0 && - param->Function->ReturnValue->Type == VTK_PARSE_VOID) - { - func->ArgTypes[i] = VTK_PARSE_FUNCTION; - } - } - } - else - { - func->ArrayFailure = 1; - } -#endif -} - - -/* reject the function, do not output it */ -void reject_function() -{ - vtkParse_InitFunction(currentFunction); - startSig(); - getMacro(); -} - -/* a simple routine that updates a few variables */ -void output_function() -{ - const char *macro = getMacro(); - size_t n; - int i, j; - int match; - - /* reject template specializations */ - n = strlen(currentFunction->Name); - if (currentFunction->Name[n-1] == '>') - { - /* make sure there is a matching angle bracket */ - while (n > 0 && currentFunction->Name[n-1] != '<') { n--; } - if (n > 0) - { - reject_function(); - return; - } - } - - /* friend */ - if (currentFunction->ReturnValue && - currentFunction->ReturnValue->Type & VTK_PARSE_FRIEND) - { - currentFunction->ReturnValue->Type ^= VTK_PARSE_FRIEND; - output_friend_function(); - return; - } - - /* typedef */ - if (currentFunction->ReturnValue && - currentFunction->ReturnValue->Type & VTK_PARSE_TYPEDEF) - { - /* for now, reject it instead of turning a method into a typedef */ - currentFunction->ReturnValue->Type ^= VTK_PARSE_TYPEDEF; - reject_function(); - return; - } - - /* static */ - if (currentFunction->ReturnValue && - currentFunction->ReturnValue->Type & VTK_PARSE_STATIC) - { - currentFunction->IsStatic = 1; - } - - /* virtual */ - if (currentFunction->ReturnValue && - currentFunction->ReturnValue->Type & VTK_PARSE_VIRTUAL) - { - currentFunction->IsVirtual = 1; - } - - /* the signature */ - if (!currentFunction->Signature) - { - currentFunction->Signature = getSig(); - } - - /* template information */ - if (currentTemplate) - { - currentFunction->Template = currentTemplate; - currentTemplate = NULL; - } - - /* a void argument is the same as no parameters */ - if (currentFunction->NumberOfParameters == 1 && - (currentFunction->Parameters[0]->Type & VTK_PARSE_UNQUALIFIED_TYPE) == - VTK_PARSE_VOID) - { - currentFunction->NumberOfParameters = 0; - } - - /* is it defined in a legacy macro? */ - if (macro && strcmp(macro, "VTK_LEGACY") == 0) - { - currentFunction->IsLegacy = 1; - } - - /* set public, protected */ - if (currentClass) - { - currentFunction->Access = access_level; - } - else - { - currentFunction->Access = VTK_ACCESS_PUBLIC; - } - -#ifndef VTK_PARSE_LEGACY_REMOVE - /* a void argument is the same as no parameters */ - if (currentFunction->NumberOfArguments == 1 && - (currentFunction->ArgTypes[0] & VTK_PARSE_UNQUALIFIED_TYPE) == - VTK_PARSE_VOID) - { - currentFunction->NumberOfArguments = 0; - } - - /* if return type is void, set return class to void */ - if (currentFunction->ReturnClass == NULL && - (currentFunction->ReturnType & VTK_PARSE_UNQUALIFIED_TYPE) == - VTK_PARSE_VOID) - { - currentFunction->ReturnClass = "void"; - } - - /* set legacy flags */ - if (currentClass) - { - currentFunction->IsPublic = (access_level == VTK_ACCESS_PUBLIC); - currentFunction->IsProtected = (access_level == VTK_ACCESS_PROTECTED); - } - else - { - currentFunction->IsPublic = 1; - currentFunction->IsProtected = 0; - } - - /* check for too many parameters */ - if (currentFunction->NumberOfParameters > MAX_ARGS) - { - currentFunction->ArrayFailure = 1; - } - - for (i = 0; i < currentFunction->NumberOfParameters; i++) - { - ValueInfo *param = currentFunction->Parameters[i]; - /* tell old wrappers that multi-dimensional arrays are bad */ - if ((param->Type & VTK_PARSE_POINTER_MASK) != 0) - { - if (((param->Type & VTK_PARSE_INDIRECT) == VTK_PARSE_BAD_INDIRECT) || - ((param->Type & VTK_PARSE_POINTER_LOWMASK) != VTK_PARSE_POINTER)) - { - currentFunction->ArrayFailure = 1; - } - } - - /* allow only "void (*func)(void *)" as a valid function pointer */ - if ((param->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_FUNCTION) - { - if (i != 0 || param->Type != VTK_PARSE_FUNCTION_PTR || - currentFunction->NumberOfParameters != 2 || - currentFunction->Parameters[1]->Type != VTK_PARSE_VOID_PTR || - param->Function->NumberOfParameters != 1 || - param->Function->Parameters[0]->Type != VTK_PARSE_VOID_PTR || - param->Function->Parameters[0]->NumberOfDimensions != 0 || - param->Function->ReturnValue->Type != VTK_PARSE_VOID) - { - currentFunction->ArrayFailure = 1; - } - } - } -#endif /* VTK_PARSE_LEGACY_REMOVE */ - - if (currentClass) - { - /* is it a delete function */ - if (currentFunction->Name && !strcmp("Delete",currentFunction->Name)) - { - currentClass->HasDelete = 1; - } - - currentFunction->Class = currentClass->Name; - vtkParse_AddFunctionToClass(currentClass, currentFunction); - - currentFunction = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - } - else - { - /* make sure this function isn't a repeat */ - match = 0; - for (i = 0; i < currentNamespace->NumberOfFunctions; i++) - { - if (currentNamespace->Functions[i]->Name && - strcmp(currentNamespace->Functions[i]->Name, - currentFunction->Name) == 0) - { - if (currentNamespace->Functions[i]->NumberOfParameters == - currentFunction->NumberOfParameters) - { - for (j = 0; j < currentFunction->NumberOfParameters; j++) - { - if (currentNamespace->Functions[i]->Parameters[j]->Type == - currentFunction->Parameters[j]->Type) - { - if (currentFunction->Parameters[j]->Type == VTK_PARSE_OBJECT && - strcmp(currentNamespace->Functions[i]->Parameters[j]->Class, - currentFunction->Parameters[j]->Class) == 0) - { - break; - } - } - } - if (j == currentFunction->NumberOfParameters) - { - match = 1; - break; - } - } - } - } - - if (!match) - { - vtkParse_AddFunctionToNamespace(currentNamespace, currentFunction); - - currentFunction = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - } - } - - vtkParse_InitFunction(currentFunction); - startSig(); -} - -/* output a function that is not a method of the current class */ -void output_friend_function() -{ - ClassInfo *tmpc = currentClass; - currentClass = NULL; - output_function(); - currentClass = tmpc; -} - -void outputSetVectorMacro(const char *var, unsigned int paramType, - const char *typeText, int n) -{ - static const char *mnames[] = { - NULL, NULL, - "vtkSetVector2Macro", "vtkSetVector3Macro", "vtkSetVector4Macro", - NULL, - "vtkSetVector6Macro", - NULL }; - char ntext[32]; - int i, m; - m = (n > 7 ? 0 : n); - - sprintf(ntext, "%i", n); - - currentFunction->Macro = mnames[m]; - currentFunction->Name = vtkstrcat("Set", var); - startSig(); - postSig("void "); - postSig(currentFunction->Name); - postSig("("); - postSig(typeText); - for (i = 1; i < n; i++) - { - postSig(", "); - postSig(typeText); - } - postSig(");"); - for (i = 0; i < n; i++) - { - add_parameter(currentFunction, paramType, getTypeId(), 0); - } - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = mnames[m]; - currentFunction->Name = vtkstrcat("Set", var); - currentFunction->Signature = - vtkstrcat7("void ", currentFunction->Name, "(", typeText, - " a[", ntext, "]);"); - add_parameter(currentFunction, (VTK_PARSE_POINTER | paramType), - getTypeId(), n); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); -} - -void outputGetVectorMacro(const char *var, unsigned int paramType, - const char *typeText, int n) -{ - static const char *mnames[] = { - NULL, NULL, - "vtkGetVector2Macro", "vtkGetVector3Macro", "vtkGetVector4Macro", - NULL, - "vtkGetVector6Macro", - NULL }; - int m; - m = (n > 7 ? 0 : n); - - currentFunction->Macro = mnames[m]; - currentFunction->Name = vtkstrcat("Get", var); - currentFunction->Signature = - vtkstrcat4(typeText, " *", currentFunction->Name, "();"); - set_return(currentFunction, (VTK_PARSE_POINTER | paramType), getTypeId(), n); - output_function(); -} - -/* Set a flag to ignore BTX/ETX markers in the files */ -void vtkParse_SetIgnoreBTX(int option) -{ - if (option) - { - IgnoreBTX = 1; - } - else - { - IgnoreBTX = 0; - } -} - -/* Set a flag to recurse into included files */ -void vtkParse_SetRecursive(int option) -{ - if (option) - { - Recursive = 1; - } - else - { - Recursive = 0; - } -} - -/* Set the global variable that stores the current executable */ -void vtkParse_SetCommandName(const char *name) -{ - CommandName = name; -} - -/* Parse a header file and return a FileInfo struct */ -FileInfo *vtkParse_ParseFile( - const char *filename, FILE *ifile, FILE *errfile) -{ - int i, j; - int ret; - FileInfo *file_info; - char *main_class; - - /* "data" is a global variable used by the parser */ - data = (FileInfo *)malloc(sizeof(FileInfo)); - vtkParse_InitFile(data); - data->Strings = (StringCache *)malloc(sizeof(StringCache)); - vtkParse_InitStringCache(data->Strings); - - /* "preprocessor" is a global struct used by the parser */ - preprocessor = (PreprocessInfo *)malloc(sizeof(PreprocessInfo)); - vtkParsePreprocess_Init(preprocessor, filename); - preprocessor->Strings = data->Strings; - vtkParsePreprocess_AddStandardMacros(preprocessor, VTK_PARSE_NATIVE); - - /* add include files specified on the command line */ - for (i = 0; i < NumberOfIncludeDirectories; i++) - { - vtkParsePreprocess_IncludeDirectory(preprocessor, IncludeDirectories[i]); - } - - /* add macros specified on the command line */ - for (i = 0; i < NumberOfDefinitions; i++) - { - const char *cp = Definitions[i]; - - if (*cp == 'U') - { - vtkParsePreprocess_RemoveMacro(preprocessor, &cp[1]); - } - else if (*cp == 'D') - { - const char *definition = &cp[1]; - while (*definition != '=' && *definition != '\0') - { - definition++; - } - if (*definition == '=') - { - definition++; - } - else - { - definition = NULL; - } - vtkParsePreprocess_AddMacro(preprocessor, &cp[1], definition); - } - } - - /* should explicitly check for vtkConfigure.h, or even explicitly load it */ -#ifdef VTK_USE_64BIT_IDS - vtkParsePreprocess_AddMacro(preprocessor, "VTK_USE_64BIT_IDS", NULL); -#endif - - data->FileName = vtkstrdup(filename); - - clearComment(); - - namespaceDepth = 0; - currentNamespace = (NamespaceInfo *)malloc(sizeof(NamespaceInfo)); - vtkParse_InitNamespace(currentNamespace); - data->Contents = currentNamespace; - - templateDepth = 0; - currentTemplate = NULL; - - currentFunction = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - vtkParse_InitFunction(currentFunction); - startSig(); - - parseDebug = 0; - if (getenv("DEBUG") != NULL) - { - parseDebug = 1; - } - - yyset_in(ifile); - yyset_out(errfile); - ret = yyparse(); - - if (ret) - { - return NULL; - } - - free(currentFunction); - yylex_destroy(); - - /* The main class name should match the file name */ - i = strlen(filename); - j = i; - while (i > 0) - { - --i; - if (filename[i] == '.') - { - j = i; - } - if (filename[i] == '/' || filename[i] == '\\') - { - i++; - break; - } - } - main_class = (char *)malloc(j-i+1); - strncpy(main_class, &filename[i], j-i); - main_class[j-i] = '\0'; - - /* special treatment of the main class in the file */ - for (i = 0; i < currentNamespace->NumberOfClasses; i++) - { - if (strcmp(currentNamespace->Classes[i]->Name, main_class) == 0) - { - data->MainClass = currentNamespace->Classes[i]; - break; - } - } - free(main_class); - - vtkParsePreprocess_Free(preprocessor); - preprocessor = NULL; - macroName = NULL; - - file_info = data; - data = NULL; - - return file_info; -} - -/* Read a hints file and update the FileInfo */ -int vtkParse_ReadHints(FileInfo *file_info, FILE *hfile, FILE *errfile) -{ - char h_cls[512]; - char h_func[512]; - unsigned int h_type, type; - int h_value; - FunctionInfo *func_info; - ClassInfo *class_info; - NamespaceInfo *contents; - int i, j; - int lineno = 0; - int n; - - contents = file_info->Contents; - - /* read each hint line in succession */ - while ((n = fscanf(hfile,"%s %s %x %i", h_cls, h_func, &h_type, &h_value)) - != EOF) - { - lineno++; - if (n < 4) - { - fprintf(errfile, "Wrapping: error parsing hints file line %i\n", lineno); - exit(1); - } - - /* erase "ref" and qualifiers from hint type */ - type = ((h_type & VTK_PARSE_BASE_TYPE) | - (h_type & VTK_PARSE_POINTER_LOWMASK)); - - /* find the matching class */ - for (i = 0; i < contents->NumberOfClasses; i++) - { - class_info = contents->Classes[i]; - - if (strcmp(h_cls, class_info->Name) == 0) - { - /* find the matching function */ - for (j = 0; j < class_info->NumberOfFunctions; j++) - { - func_info = class_info->Functions[j]; - - if ((strcmp(h_func, func_info->Name) == 0) && - func_info->ReturnValue && - (type == ((func_info->ReturnValue->Type & ~VTK_PARSE_REF) & - VTK_PARSE_UNQUALIFIED_TYPE))) - { - /* types that hints are accepted for */ - switch (func_info->ReturnValue->Type & VTK_PARSE_UNQUALIFIED_TYPE) - { - case VTK_PARSE_FLOAT_PTR: - case VTK_PARSE_VOID_PTR: - case VTK_PARSE_DOUBLE_PTR: - case VTK_PARSE_ID_TYPE_PTR: - case VTK_PARSE_LONG_LONG_PTR: - case VTK_PARSE_UNSIGNED_LONG_LONG_PTR: - case VTK_PARSE___INT64_PTR: - case VTK_PARSE_UNSIGNED___INT64_PTR: - case VTK_PARSE_INT_PTR: - case VTK_PARSE_UNSIGNED_INT_PTR: - case VTK_PARSE_SHORT_PTR: - case VTK_PARSE_UNSIGNED_SHORT_PTR: - case VTK_PARSE_LONG_PTR: - case VTK_PARSE_UNSIGNED_LONG_PTR: - case VTK_PARSE_SIGNED_CHAR_PTR: - case VTK_PARSE_UNSIGNED_CHAR_PTR: - case VTK_PARSE_CHAR_PTR: - { - if (func_info->ReturnValue->NumberOfDimensions == 0) - { - char text[64]; - sprintf(text, "%i", h_value); - func_info->ReturnValue->Count = h_value; - vtkParse_AddStringToArray( - &func_info->ReturnValue->Dimensions, - &func_info->ReturnValue->NumberOfDimensions, - vtkParse_CacheString( - file_info->Strings, text, strlen(text))); -#ifndef VTK_PARSE_LEGACY_REMOVE - func_info->HaveHint = 1; - func_info->HintSize = h_value; -#endif - } - break; - } - default: - { - fprintf(errfile, - "Wrapping: unhandled hint type %#x\n", h_type); - } - } - } - } - } - } - } - - return 1; -} - -/* Free the FileInfo struct returned by vtkParse_ParseFile() */ -void vtkParse_Free(FileInfo *file_info) -{ - vtkParse_FreeFile(file_info); - vtkParse_FreeStringCache(file_info->Strings); - free(file_info->Strings); - free(file_info); -} - -/** Define a preprocessor macro. Function macros are not supported. */ -void vtkParse_DefineMacro(const char *name, const char *definition) -{ - size_t n = vtkParse_SkipId(name); - size_t l; - char *cp; - - if (definition == NULL) - { - definition = ""; - } - - l = n + strlen(definition) + 3; - cp = (char *)malloc(l); - cp[0] = 'D'; - strncpy(&cp[1], name, n); - cp[n+1] = '\0'; - if (definition[0] != '\0') - { - cp[n+1] = '='; - strcpy(&cp[n+2], definition); - } - cp[l] = '\0'; - - vtkParse_AddStringToArray(&Definitions, &NumberOfDefinitions, cp); -} - -/** Undefine a preprocessor macro. */ -void vtkParse_UndefineMacro(const char *name) -{ - size_t n = vtkParse_SkipId(name); - char *cp; - - cp = (char *)malloc(n+2); - cp[0] = 'U'; - strncpy(&cp[1], name, n); - cp[n+1] = '\0'; - - vtkParse_AddStringToArray(&Definitions, &NumberOfDefinitions, cp); -} - -/** Add an include directory, for use with the "-I" option. */ -void vtkParse_IncludeDirectory(const char *dirname) -{ - size_t n = strlen(dirname); - char *cp; - int i; - - for (i = 0; i < NumberOfIncludeDirectories; i++) - { - if (strncmp(IncludeDirectories[i], dirname, n) == 0 && - IncludeDirectories[i][n] == '\0') - { - return; - } - } - - cp = (char *)malloc(n+1); - strcpy(cp, dirname); - - vtkParse_AddStringToArray( - &IncludeDirectories, &NumberOfIncludeDirectories, cp); -} - -/** Return the full path to a header file. */ -const char *vtkParse_FindIncludeFile(const char *filename) -{ - static StringCache cache = {0, 0, 0, 0}; - static PreprocessInfo info = {0, 0, 0, 0, 0, 0, &cache, 0, 0, 0}; - int val; - int i; - - /* add include files specified on the command line */ - for (i = 0; i < NumberOfIncludeDirectories; i++) - { - vtkParsePreprocess_IncludeDirectory(&info, IncludeDirectories[i]); - } - - return vtkParsePreprocess_FindIncludeFile(&info, filename, 0, &val); -} diff --git a/src/VTKWrapping/ParaView/vtkParseData.c b/src/VTKWrapping/ParaView/vtkParseData.c deleted file mode 100644 index 95a73730..00000000 --- a/src/VTKWrapping/ParaView/vtkParseData.c +++ /dev/null @@ -1,938 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseData.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in May 2010 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -#include "vtkParseData.h" -#include -#include - -/* Initialize the FileInfo struct */ -void vtkParse_InitFile(FileInfo *file_info) -{ - /* file info */ - file_info->FileName = NULL; - file_info->NameComment = NULL; - file_info->Description = NULL; - file_info->Caveats = NULL; - file_info->SeeAlso = NULL; - - file_info->NumberOfIncludes = 0; - file_info->Includes = NULL; - file_info->MainClass = NULL; - file_info->Contents = NULL; - - file_info->Strings = NULL; -} - -/* Free the FileInfo struct */ -void vtkParse_FreeFile(FileInfo *file_info) -{ - int i, n; - - n = file_info->NumberOfIncludes; - for (i = 0; i < n; i++) - { - vtkParse_FreeFile(file_info->Includes[i]); - free(file_info->Includes[i]); - } - if (file_info->Includes) - { - free(file_info->Includes); - } - - vtkParse_FreeNamespace(file_info->Contents); - file_info->Contents = NULL; -} - -/* Initialize a TemplateInfo struct */ -void vtkParse_InitTemplate(TemplateInfo *info) -{ - info->NumberOfParameters = 0; - info->Parameters = NULL; -} - -/* Copy a TemplateInfo struct */ -void vtkParse_CopyTemplate(TemplateInfo *info, const TemplateInfo *orig) -{ - int i, n; - - n = orig->NumberOfParameters; - info->NumberOfParameters = n; - info->Parameters = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); - - for (i = 0; i < n; i++) - { - info->Parameters[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_CopyValue(info->Parameters[i], orig->Parameters[i]); - } -} - -/* Free a TemplateInfo struct */ -void vtkParse_FreeTemplate(TemplateInfo *template_info) -{ - int j, m; - - m = template_info->NumberOfParameters; - for (j = 0; j < m; j++) - { - vtkParse_FreeValue(template_info->Parameters[j]); - } - - free(template_info); -} - - -/* Initialize a Function struct */ -void vtkParse_InitFunction(FunctionInfo *func) -{ -#ifndef VTK_PARSE_LEGACY_REMOVE - int i; -#endif - - func->ItemType = VTK_FUNCTION_INFO; - func->Access = VTK_ACCESS_PUBLIC; - func->Name = NULL; - func->Comment = NULL; - func->Class = NULL; - func->Signature = NULL; - func->Template = NULL; - func->NumberOfParameters = 0; - func->Parameters = NULL; - func->ReturnValue = NULL; - func->Macro = NULL; - func->SizeHint = NULL; - func->IsStatic = 0; - func->IsVirtual = 0; - func->IsPureVirtual = 0; - func->IsOperator = 0; - func->IsVariadic = 0; - func->IsConst = 0; - func->IsDeleted = 0; - func->IsFinal = 0; - func->IsExplicit = 0; - func->IsLegacy = 0; - -#ifndef VTK_PARSE_LEGACY_REMOVE - /* everything below here is legacy information, * - * maintained only for backwards compatibility */ - func->NumberOfArguments = 0; - func->ReturnType = VTK_PARSE_VOID; - func->ReturnClass = NULL; - func->HaveHint = 0; - func->HintSize = 0; - func->ArrayFailure = 0; - func->IsPublic = 0; - func->IsProtected = 0; - - for (i = 0; i < MAX_ARGS; i++) - { - func->ArgTypes[i] = 0; - func->ArgClasses[i] = 0; - func->ArgCounts[i] = 0; - } -#endif -} - -/* Copy a Function struct */ -void vtkParse_CopyFunction(FunctionInfo *func, const FunctionInfo *orig) -{ - int i, n; - - func->ItemType = orig->ItemType; - func->Access = orig->Access; - func->Name = orig->Name; - func->Comment = orig->Comment; - func->Class = orig->Class; - func->Signature = orig->Signature; - func->Template = NULL; - - if (orig->Template) - { - func->Template = (TemplateInfo *)malloc(sizeof(TemplateInfo)); - vtkParse_CopyTemplate(func->Template, orig->Template); - } - - n = orig->NumberOfParameters; - func->NumberOfParameters = n; - if (n) - { - func->Parameters = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); - for (i = 0; i < n; i++) - { - func->Parameters[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_CopyValue(func->Parameters[i], orig->Parameters[i]); - } - } - - func->ReturnValue = NULL; - if (orig->ReturnValue) - { - func->ReturnValue = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_CopyValue(func->ReturnValue, orig->ReturnValue); - } - - func->Macro = orig->Macro; - func->SizeHint = orig->SizeHint; - func->IsStatic = orig->IsStatic; - func->IsVirtual = orig->IsVirtual; - func->IsPureVirtual = orig->IsPureVirtual; - func->IsOperator = orig->IsOperator; - func->IsVariadic = orig->IsVariadic; - func->IsConst = orig->IsConst; - func->IsDeleted = orig->IsDeleted; - func->IsFinal = orig->IsFinal; - func->IsExplicit = orig->IsExplicit; - func->IsLegacy = orig->IsLegacy; - -#ifndef VTK_PARSE_LEGACY_REMOVE - /* everything below here is legacy information, * - * maintained only for backwards compatibility */ - func->NumberOfArguments = orig->NumberOfArguments; - func->ReturnType = orig->ReturnType; - func->ReturnClass = orig->ReturnClass; - func->HaveHint = orig->HaveHint; - func->HintSize = orig->HintSize; - func->ArrayFailure = orig->ArrayFailure; - func->IsPublic = orig->IsPublic; - func->IsProtected = orig->IsProtected; - - for (i = 0; i < MAX_ARGS; i++) - { - func->ArgTypes[i] = orig->ArgTypes[i]; - func->ArgClasses[i] = orig->ArgClasses[i]; - func->ArgCounts[i] = orig->ArgCounts[i]; - } -#endif -} - -/* Free a Function struct */ -void vtkParse_FreeFunction(FunctionInfo *function_info) -{ - int j, m; - - if (function_info->Template) - { - vtkParse_FreeTemplate(function_info->Template); - } - - m = function_info->NumberOfParameters; - for (j = 0; j < m; j++) { vtkParse_FreeValue(function_info->Parameters[j]); } - if (m > 0) { free(function_info->Parameters); } - - if (function_info->ReturnValue) - { - vtkParse_FreeValue(function_info->ReturnValue); - } - - free(function_info); -} - - -/* Initialize a Value struct */ -void vtkParse_InitValue(ValueInfo *val) -{ - val->ItemType = VTK_VARIABLE_INFO; - val->Access = VTK_ACCESS_PUBLIC; - val->Name = NULL; - val->Comment = NULL; - val->Value = NULL; - val->Type = 0; - val->Class = NULL; - val->Count = 0; - val->CountHint = NULL; - val->NumberOfDimensions = 0; - val->Dimensions = NULL; - val->Function = NULL; - val->Template = NULL; - val->IsStatic = 0; - val->IsEnum = 0; - val->IsPack = 0; -} - -/* Copy a Value struct */ -void vtkParse_CopyValue(ValueInfo *val, const ValueInfo *orig) -{ - int i, n; - - val->ItemType = orig->ItemType; - val->Access = orig->Access; - val->Name = orig->Name; - val->Comment = orig->Comment; - val->Value = orig->Value; - val->Type = orig->Type; - val->Class = orig->Class; - val->Count = orig->Count; - val->CountHint = orig->CountHint; - - n = orig->NumberOfDimensions; - val->NumberOfDimensions = n; - if (n) - { - val->Dimensions = (const char **)malloc(n*sizeof(char *)); - for (i = 0; i < n; i++) - { - val->Dimensions[i] = orig->Dimensions[i]; - } - } - - val->Function = NULL; - if (orig->Function) - { - val->Function = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - vtkParse_CopyFunction(val->Function, orig->Function); - } - - val->Template = NULL; - if (orig->Template) - { - val->Template = (TemplateInfo *)malloc(sizeof(TemplateInfo)); - vtkParse_CopyTemplate(val->Template, orig->Template); - } - - val->IsStatic = orig->IsStatic; - val->IsEnum = orig->IsEnum; - val->IsPack = orig->IsPack; -} - -/* Free a Value struct */ -void vtkParse_FreeValue(ValueInfo *value_info) -{ - if (value_info->NumberOfDimensions) - { - free((char **)value_info->Dimensions); - } - if (value_info->Function) - { - vtkParse_FreeFunction(value_info->Function); - } - if (value_info->Template) - { - vtkParse_FreeTemplate(value_info->Template); - } - - free(value_info); -} - - -/* Initialize an Enum struct */ -void vtkParse_InitEnum(EnumInfo *item) -{ - vtkParse_InitClass(item); - item->ItemType = VTK_ENUM_INFO; -} - -/* Copy an Enum struct */ -void vtkParse_CopyEnum(EnumInfo *item, const EnumInfo *orig) -{ - vtkParse_CopyClass(item, orig); -} - -/* Free an Enum struct */ -void vtkParse_FreeEnum(EnumInfo *enum_info) -{ - free(enum_info); -} - - -/* Initialize a Using struct */ -void vtkParse_InitUsing(UsingInfo *item) -{ - item->ItemType = VTK_USING_INFO; - item->Access = VTK_ACCESS_PUBLIC; - item->Name = NULL; - item->Comment = NULL; - item->Scope = NULL; -} - -/* Copy a Using struct */ -void vtkParse_CopyUsing(UsingInfo *item, const UsingInfo *orig) -{ - item->ItemType = orig->ItemType; - item->Access = orig->Access; - item->Name = orig->Name; - item->Comment = orig->Comment; - item->Scope = orig->Scope; -} - -/* Free a Using struct */ -void vtkParse_FreeUsing(UsingInfo *using_info) -{ - free(using_info); -} - - -/* Initialize a Class struct */ -void vtkParse_InitClass(ClassInfo *cls) -{ - cls->ItemType = VTK_CLASS_INFO; - cls->Access = VTK_ACCESS_PUBLIC; - cls->Name = NULL; - cls->Comment = NULL; - cls->Template = NULL; - cls->NumberOfSuperClasses = 0; - cls->SuperClasses = NULL; - cls->NumberOfItems = 0; - cls->Items = NULL; - cls->NumberOfClasses = 0; - cls->Classes = NULL; - cls->NumberOfFunctions = 0; - cls->Functions = NULL; - cls->NumberOfConstants = 0; - cls->Constants = NULL; - cls->NumberOfVariables = 0; - cls->Variables = NULL; - cls->NumberOfEnums = 0; - cls->Enums = NULL; - cls->NumberOfTypedefs = 0; - cls->Typedefs = NULL; - cls->NumberOfUsings = 0; - cls->Usings = NULL; - cls->NumberOfNamespaces = 0; - cls->Namespaces = NULL; - cls->IsAbstract = 0; - cls->IsFinal = 0; - cls->HasDelete = 0; -} - -/* Copy a Class struct */ -void vtkParse_CopyClass(ClassInfo *cls, const ClassInfo *orig) -{ - int i, n; - - cls->ItemType = orig->ItemType; - cls->Access = orig->Access; - cls->Name = orig->Name; - cls->Comment = orig->Comment; - cls->Template = NULL; - - if (orig->Template) - { - cls->Template = (TemplateInfo *)malloc(sizeof(TemplateInfo)); - vtkParse_CopyTemplate(cls->Template, orig->Template); - } - - n = orig->NumberOfSuperClasses; - cls->NumberOfSuperClasses = n; - if (n) - { - cls->SuperClasses = (const char **)malloc(n*sizeof(char *)); - for (i = 0; i < n; i++) - { - cls->SuperClasses[i] = orig->SuperClasses[i]; - } - } - - n = orig->NumberOfItems; - cls->NumberOfItems = n; - if (n) - { - cls->Items = (ItemInfo *)malloc(n*sizeof(ItemInfo)); - for (i = 0; i < n; i++) - { - cls->Items[i].Type = orig->Items[i].Type; - cls->Items[i].Index = orig->Items[i].Index; - } - } - - n = orig->NumberOfClasses; - cls->NumberOfClasses = n; - if (n) - { - cls->Classes = (ClassInfo **)malloc(n*sizeof(ClassInfo *)); - for (i = 0; i < n; i++) - { - cls->Classes[i] = (ClassInfo *)malloc(sizeof(ClassInfo)); - vtkParse_CopyClass(cls->Classes[i], orig->Classes[i]); - } - } - - n = orig->NumberOfFunctions; - cls->NumberOfFunctions = n; - if (n) - { - cls->Functions = (FunctionInfo **)malloc(n*sizeof(FunctionInfo *)); - for (i = 0; i < n; i++) - { - cls->Functions[i] = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - vtkParse_CopyFunction(cls->Functions[i], orig->Functions[i]); - } - } - - n = orig->NumberOfConstants; - cls->NumberOfConstants = n; - if (n) - { - cls->Constants = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); - for (i = 0; i < n; i++) - { - cls->Constants[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_CopyValue(cls->Constants[i], orig->Constants[i]); - } - } - - n = orig->NumberOfVariables; - cls->NumberOfVariables = n; - if (n) - { - cls->Variables = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); - for (i = 0; i < n; i++) - { - cls->Variables[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_CopyValue(cls->Variables[i], orig->Variables[i]); - } - } - - n = orig->NumberOfEnums; - cls->NumberOfEnums = n; - if (n) - { - cls->Enums = (EnumInfo **)malloc(n*sizeof(EnumInfo *)); - for (i = 0; i < n; i++) - { - cls->Enums[i] = (EnumInfo *)malloc(sizeof(EnumInfo)); - vtkParse_CopyEnum(cls->Enums[i], orig->Enums[i]); - } - } - - n = orig->NumberOfTypedefs; - cls->NumberOfTypedefs = n; - if (n) - { - cls->Typedefs = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); - for (i = 0; i < n; i++) - { - cls->Typedefs[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_CopyValue(cls->Typedefs[i], orig->Typedefs[i]); - } - } - - n = orig->NumberOfUsings; - cls->NumberOfUsings = n; - if (n) - { - cls->Usings = (UsingInfo **)malloc(n*sizeof(UsingInfo *)); - for (i = 0; i < n; i++) - { - cls->Usings[i] = (UsingInfo *)malloc(sizeof(UsingInfo)); - vtkParse_CopyUsing(cls->Usings[i], orig->Usings[i]); - } - } - - n = orig->NumberOfNamespaces; - cls->NumberOfNamespaces = n; - if (n) - { - cls->Namespaces = (NamespaceInfo **)malloc(n*sizeof(NamespaceInfo *)); - for (i = 0; i < n; i++) - { - cls->Namespaces[i] = (NamespaceInfo *)malloc(sizeof(NamespaceInfo)); - vtkParse_CopyNamespace(cls->Namespaces[i], orig->Namespaces[i]); - } - } - - cls->IsAbstract = orig->IsAbstract; - cls->IsFinal = orig->IsFinal; - cls->HasDelete = orig->HasDelete; -} - -/* Free a Class struct */ -void vtkParse_FreeClass(ClassInfo *class_info) -{ - int j, m; - - if (class_info->Template) { vtkParse_FreeTemplate(class_info->Template); } - - m = class_info->NumberOfSuperClasses; - if (m > 0) { free((char **)class_info->SuperClasses); } - - m = class_info->NumberOfClasses; - for (j = 0; j < m; j++) { vtkParse_FreeClass(class_info->Classes[j]); } - if (m > 0) { free(class_info->Classes); } - - m = class_info->NumberOfFunctions; - for (j = 0; j < m; j++) { vtkParse_FreeFunction(class_info->Functions[j]); } - if (m > 0) { free(class_info->Functions); } - - m = class_info->NumberOfConstants; - for (j = 0; j < m; j++) { vtkParse_FreeValue(class_info->Constants[j]); } - if (m > 0) { free(class_info->Constants); } - - m = class_info->NumberOfVariables; - for (j = 0; j < m; j++) { vtkParse_FreeValue(class_info->Variables[j]); } - if (m > 0) { free(class_info->Variables); } - - m = class_info->NumberOfEnums; - for (j = 0; j < m; j++) { vtkParse_FreeEnum(class_info->Enums[j]); } - if (m > 0) { free(class_info->Enums); } - - m = class_info->NumberOfTypedefs; - for (j = 0; j < m; j++) { vtkParse_FreeValue(class_info->Typedefs[j]); } - if (m > 0) { free(class_info->Typedefs); } - - m = class_info->NumberOfUsings; - for (j = 0; j < m; j++) { vtkParse_FreeUsing(class_info->Usings[j]); } - if (m > 0) { free(class_info->Usings); } - - m = class_info->NumberOfNamespaces; - for (j = 0; j < m; j++) { vtkParse_FreeNamespace(class_info->Namespaces[j]); } - if (m > 0) { free(class_info->Namespaces); } - - if (class_info->NumberOfItems > 0) { free(class_info->Items); } - - free(class_info); -} - - -/* Initialize a Namespace struct */ -void vtkParse_InitNamespace(NamespaceInfo *name_info) -{ - vtkParse_InitClass(name_info); - name_info->ItemType = VTK_NAMESPACE_INFO; -} - -/* Copy a Namespace struct */ -void vtkParse_CopyNamespace(NamespaceInfo *ninfo, const NamespaceInfo *orig) -{ - vtkParse_CopyClass(ninfo, orig); -} - -/* Free a Namespace struct */ -void vtkParse_FreeNamespace(NamespaceInfo *namespace_info) -{ - vtkParse_FreeClass(namespace_info); -} - - -/* This method is used for extending dynamic arrays in a progression of - * powers of two. If "n" reaches a power of two, then the array size is - * doubled so that "n" can be safely incremented. */ -static void *array_size_check( - void *arraymem, size_t size, int n) -{ - /* if empty, alloc for the first time */ - if (n == 0) - { - return malloc(size); - } - /* if count is power of two, reallocate with double size */ - else if ((n & (n-1)) == 0) - { - return realloc(arraymem, (n << 1)*size); - } - - /* no reallocation, just return the original array */ - return arraymem; -} - - -/* Utility method to add an included file to a FileInfo */ -void vtkParse_AddIncludeToFile( - FileInfo *file_info, FileInfo *include_file) -{ - file_info->Includes = (FileInfo **)array_size_check( - (FileInfo **)file_info->Includes, sizeof(FileInfo *), - file_info->NumberOfIncludes); - - file_info->Includes[file_info->NumberOfIncludes++] = include_file; - - if (!include_file->Strings) - { - include_file->Strings = file_info->Strings; - } -} - -/* Utility method to add a const char pointer to an array */ -void vtkParse_AddStringToArray( - const char ***valueArray, int *count, const char *value) -{ - *valueArray = (const char **)array_size_check( - (char **)*valueArray, sizeof(const char *), *count); - - (*valueArray)[(*count)++] = value; -} - -/* Utility method to add an item to an array */ -void vtkParse_AddItemToArray( - ItemInfo **valueArray, int *count, parse_item_t type, int idx) -{ - int n = *count; - ItemInfo *values = *valueArray; - - values = (ItemInfo *)array_size_check(values, sizeof(ItemInfo), n); - - values[n].Type = type; - values[n].Index = idx; - *count = n+1; - *valueArray = values; -} - -/* Add a ClassInfo to a ClassInfo */ -void vtkParse_AddClassToClass(ClassInfo *info, ClassInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfClasses); - info->Classes = (ClassInfo **)array_size_check( - info->Classes, sizeof(ClassInfo *), info->NumberOfClasses); - info->Classes[info->NumberOfClasses++] = item; -} - -/* Add a FunctionInfo to a ClassInfo */ -void vtkParse_AddFunctionToClass(ClassInfo *info, FunctionInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfFunctions); - info->Functions = (FunctionInfo **)array_size_check( - info->Functions, sizeof(FunctionInfo *), info->NumberOfFunctions); - info->Functions[info->NumberOfFunctions++] = item; -} - -/* Add a EnumInfo to a ClassInfo */ -void vtkParse_AddEnumToClass(ClassInfo *info, EnumInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfEnums); - info->Enums = (EnumInfo **)array_size_check( - info->Enums, sizeof(EnumInfo *), info->NumberOfEnums); - info->Enums[info->NumberOfEnums++] = item; -} - -/* Add a Constant ValueInfo to a ClassInfo */ -void vtkParse_AddConstantToClass(ClassInfo *info, ValueInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfConstants); - info->Constants = (ValueInfo **)array_size_check( - info->Constants, sizeof(ValueInfo *), info->NumberOfConstants); - info->Constants[info->NumberOfConstants++] = item; -} - -/* Add a Variable ValueInfo to a ClassInfo */ -void vtkParse_AddVariableToClass(ClassInfo *info, ValueInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfVariables); - info->Variables = (ValueInfo **)array_size_check( - info->Variables, sizeof(ValueInfo *), info->NumberOfVariables); - info->Variables[info->NumberOfVariables++] = item; -} - -/* Add a Typedef ValueInfo to a ClassInfo */ -void vtkParse_AddTypedefToClass(ClassInfo *info, ValueInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfTypedefs); - info->Typedefs = (ValueInfo **)array_size_check( - info->Typedefs, sizeof(ValueInfo *), info->NumberOfTypedefs); - info->Typedefs[info->NumberOfTypedefs++] = item; -} - -/* Add a UsingInfo to a ClassInfo */ -void vtkParse_AddUsingToClass(ClassInfo *info, UsingInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfUsings); - info->Usings = (UsingInfo **)array_size_check( - info->Usings, sizeof(UsingInfo *), info->NumberOfUsings); - info->Usings[info->NumberOfUsings++] = item; -} - - -/* Add a NamespaceInfo to a NamespaceInfo */ -void vtkParse_AddNamespaceToNamespace(NamespaceInfo *info, NamespaceInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfNamespaces); - info->Namespaces = (NamespaceInfo **)array_size_check( - info->Namespaces, sizeof(NamespaceInfo *), info->NumberOfNamespaces); - info->Namespaces[info->NumberOfNamespaces++] = item; -} - -/* Add a ClassInfo to a NamespaceInfo */ -void vtkParse_AddClassToNamespace(NamespaceInfo *info, ClassInfo *item) -{ - vtkParse_AddClassToClass(info, item); -} - -/* Add a FunctionInfo to a NamespaceInfo */ -void vtkParse_AddFunctionToNamespace(NamespaceInfo *info, FunctionInfo *item) -{ - vtkParse_AddFunctionToClass(info, item); -} - -/* Add a EnumInfo to a NamespaceInfo */ -void vtkParse_AddEnumToNamespace(NamespaceInfo *info, EnumInfo *item) -{ - vtkParse_AddEnumToClass(info, item); -} - -/* Add a Constant ValueInfo to a NamespaceInfo */ -void vtkParse_AddConstantToNamespace(NamespaceInfo *info, ValueInfo *item) -{ - vtkParse_AddConstantToClass(info, item); -} - -/* Add a Variable ValueInfo to a NamespaceInfo */ -void vtkParse_AddVariableToNamespace(NamespaceInfo *info, ValueInfo *item) -{ - vtkParse_AddVariableToClass(info, item); -} - -/* Add a Typedef ValueInfo to a NamespaceInfo */ -void vtkParse_AddTypedefToNamespace(NamespaceInfo *info, ValueInfo *item) -{ - vtkParse_AddTypedefToClass(info, item); -} - -/* Add a UsingInfo to a NamespaceInfo */ -void vtkParse_AddUsingToNamespace(NamespaceInfo *info, UsingInfo *item) -{ - vtkParse_AddUsingToClass(info, item); -} - - -/* Add a ValueInfo parameter to a FunctionInfo */ -void vtkParse_AddParameterToFunction(FunctionInfo *info, ValueInfo *item) -{ - info->Parameters = (ValueInfo **)array_size_check( - info->Parameters, sizeof(ValueInfo *), info->NumberOfParameters); - info->Parameters[info->NumberOfParameters++] = item; -} - - -/* Add a ValueInfo to a TemplateInfo */ -void vtkParse_AddParameterToTemplate(TemplateInfo *info, ValueInfo *item) -{ - info->Parameters = (ValueInfo **)array_size_check( - info->Parameters, sizeof(ValueInfo *), info->NumberOfParameters); - info->Parameters[info->NumberOfParameters++] = item; -} - - -/* Add default constructors if they do not already exist */ -void vtkParse_AddDefaultConstructors(ClassInfo *cls, StringCache *cache) -{ - FunctionInfo *func; - ValueInfo *param; - size_t k, l; - int i, n; - int default_constructor = 1; - int copy_constructor = 1; - char *tname; - const char *ccname; - - if (cls == NULL || cls->Name == NULL) - { - return; - } - - n = cls->NumberOfFunctions; - for (i = 0; i < n; i++) - { - func = cls->Functions[i]; - if (func->Name && strcmp(func->Name, cls->Name) == 0) - { - default_constructor = 0; - - if (func->NumberOfParameters == 1) - { - param = func->Parameters[0]; - if (param->Class && - strcmp(param->Class, cls->Name) == 0 && - (param->Type & VTK_PARSE_POINTER_MASK) == 0) - { - copy_constructor = 0; - } - } - } - } - - if (default_constructor) - { - func = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - vtkParse_InitFunction(func); - func->Class = cls->Name; - func->Name = cls->Name; - k = strlen(cls->Name); - tname = vtkParse_NewString(cache, k + 2); - strcpy(tname, cls->Name); - strcpy(&tname[k], "()"); - func->Signature = tname; - vtkParse_AddFunctionToClass(cls, func); - } - - if (copy_constructor) - { - ccname = cls->Name; - - if (cls->Template) - { - /* specialize the name */ - n = cls->Template->NumberOfParameters; - - k = strlen(cls->Name) + 2; - for (i = 0; i < n; i++) - { - if (cls->Template->Parameters[i]->Name) - { - k += strlen(cls->Template->Parameters[i]->Name) + 2; - } - } - tname = vtkParse_NewString(cache, k); - strcpy(tname, cls->Name); - k = strlen(tname); - tname[k++] = '<'; - for (i = 0; i < n; i++) - { - if (cls->Template->Parameters[i]->Name) - { - strcpy(&tname[k], cls->Template->Parameters[i]->Name); - k += strlen(cls->Template->Parameters[i]->Name); - } - if (i+1 < n) - { - tname[k++] = ','; - tname[k++] = ' '; - } - } - tname[k++] = '>'; - tname[k] = '\0'; - ccname = tname; - } - - func = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - vtkParse_InitFunction(func); - func->Class = cls->Name; - func->Name = cls->Name; - k = strlen(cls->Name); - l = strlen(ccname); - tname = vtkParse_NewString(cache, k + l + 9); - strcpy(tname, cls->Name); - strcpy(&tname[k], "(const &"); - strcpy(&tname[k+8], ccname); - strcpy(&tname[k+8+l], ")"); - func->Signature = tname; - param = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(param); - param->Type = (VTK_PARSE_OBJECT_REF | VTK_PARSE_CONST); - param->Class = ccname; - vtkParse_AddParameterToFunction(func, param); - vtkParse_AddFunctionToClass(cls, func); - } -} diff --git a/src/VTKWrapping/ParaView/vtkParseData.h b/src/VTKWrapping/ParaView/vtkParseData.h deleted file mode 100644 index 7c81c456..00000000 --- a/src/VTKWrapping/ParaView/vtkParseData.h +++ /dev/null @@ -1,334 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseData.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in May 2010 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -/* - Data structures used by vtkParse. -*/ - -#ifndef VTK_PARSE_DATA_H -#define VTK_PARSE_DATA_H - -#include "vtkParseType.h" -#include "vtkParseString.h" - -/* legacy */ -#ifndef VTK_PARSE_LEGACY_REMOVE -#define MAX_ARGS 20 -#endif - -/** - * Access flags - */ -typedef enum _parse_access_t -{ - VTK_ACCESS_PUBLIC = 0, - VTK_ACCESS_PROTECTED = 1, - VTK_ACCESS_PRIVATE = 2 -} parse_access_t; - -/** - * ItemType constants - */ -typedef enum _parse_item_t -{ - VTK_NAMESPACE_INFO = 1, - VTK_CLASS_INFO = 2, - VTK_STRUCT_INFO = 3, - VTK_UNION_INFO = 4, - VTK_ENUM_INFO = 5, - VTK_FUNCTION_INFO = 6, - VTK_VARIABLE_INFO = 7, - VTK_CONSTANT_INFO = 8, - VTK_TYPEDEF_INFO = 9, - VTK_USING_INFO = 10 -} parse_item_t; - -/** - * ItemInfo just contains an index - */ -typedef struct _ItemInfo -{ - parse_item_t Type; - int Index; -} ItemInfo; - -/* forward declarations */ -struct _ValueInfo; -struct _FunctionInfo; -struct _FileInfo; -typedef struct _ValueInfo ValueInfo; -typedef struct _FunctionInfo FunctionInfo; -typedef struct _FileInfo FileInfo; - -/** - * TemplateInfo holds template definitions - */ -typedef struct _TemplateInfo -{ - int NumberOfParameters; - ValueInfo **Parameters; -} TemplateInfo; - -/** - * ValueInfo is for typedefs, constants, variables, - * function parameters, and return values - * - * Note that Dimensions is an array of char pointers, in - * order to support dimensions that are sized according to - * template parameter values or according to named constants. - */ -struct _ValueInfo -{ - parse_item_t ItemType; - parse_access_t Access; - const char *Name; - const char *Comment; - const char *Value; /* for vars or default paramter values */ - unsigned int Type; /* as defined in vtkParseType.h */ - const char *Class; /* classname for type */ - int Count; /* total number of values, if known */ - const char *CountHint; /* hint about how to get the count */ - int NumberOfDimensions; /* dimensionality for arrays */ - const char **Dimensions; /* dimensions for arrays */ - FunctionInfo *Function; /* for function pointer values */ - TemplateInfo *Template; /* template parameters, or NULL */ - int IsStatic; /* for class variables only */ - int IsEnum; /* for constants only */ - int IsPack; /* for pack expansions */ -}; - -/** - * FunctionInfo is for functions and methods - */ -struct _FunctionInfo -{ - parse_item_t ItemType; - parse_access_t Access; - const char *Name; - const char *Comment; - const char *Class; /* class name for methods */ - const char *Signature; /* function signature as text */ - TemplateInfo *Template; /* template parameters, or NULL */ - int NumberOfParameters; - ValueInfo **Parameters; - ValueInfo *ReturnValue; /* NULL for constructors and destructors */ - const char *Macro; /* the macro that defined this function */ - const char *SizeHint; /* hint the size e.g. for operator[] */ - int IsOperator; - int IsVariadic; - int IsLegacy; /* marked as a legacy method or function */ - int IsStatic; /* methods only */ - int IsVirtual; /* methods only */ - int IsPureVirtual; /* methods only */ - int IsConst; /* methods only */ - int IsDeleted; /* methods only */ - int IsFinal; /* methods only */ - int IsExplicit; /* constructors only */ -#ifndef VTK_PARSE_LEGACY_REMOVE - int NumberOfArguments; /* legacy */ - unsigned int ArgTypes[MAX_ARGS]; /* legacy */ - const char *ArgClasses[MAX_ARGS];/* legacy */ - int ArgCounts[MAX_ARGS]; /* legacy */ - unsigned int ReturnType; /* legacy */ - const char *ReturnClass; /* legacy */ - int HaveHint; /* legacy */ - int HintSize; /* legacy */ - int ArrayFailure;/* legacy */ - int IsPublic; /* legacy */ - int IsProtected; /* legacy */ -#endif -}; - -/** - * UsingInfo is for using directives - */ -typedef struct _UsingInfo -{ - parse_item_t ItemType; - parse_access_t Access; - const char *Name; /* null for using whole namespace */ - const char *Comment; - const char *Scope; /* the namespace or class */ -} UsingInfo; - -/** - * ClassInfo is for classes, structs, unions, and namespaces - */ -typedef struct _ClassInfo -{ - parse_item_t ItemType; - parse_access_t Access; - const char *Name; - const char *Comment; - TemplateInfo *Template; - int NumberOfSuperClasses; - const char **SuperClasses; - int NumberOfItems; - ItemInfo *Items; - int NumberOfClasses; - struct _ClassInfo **Classes; - int NumberOfFunctions; - FunctionInfo **Functions; - int NumberOfConstants; - ValueInfo **Constants; - int NumberOfVariables; - ValueInfo **Variables; - int NumberOfEnums; - struct _ClassInfo **Enums; - int NumberOfTypedefs; - ValueInfo **Typedefs; - int NumberOfUsings; - UsingInfo **Usings; - int NumberOfNamespaces; - struct _ClassInfo **Namespaces; - int IsAbstract; - int IsFinal; - int HasDelete; -} ClassInfo; - -/** - * EnumInfo is for enums - * For scoped enums, the constants are in the enum itself, but for - * standard enums, the constants are at the same level as the enum. - */ -typedef struct _ClassInfo EnumInfo; - -/** - * Namespace is for namespaces - */ -typedef struct _ClassInfo NamespaceInfo; - -/** - * FileInfo is for header files - */ -struct _FileInfo -{ - const char *FileName; - const char *NameComment; - const char *Description; - const char *Caveats; - const char *SeeAlso; - - int NumberOfIncludes; - struct _FileInfo **Includes; - ClassInfo *MainClass; - NamespaceInfo *Contents; - StringCache *Strings; -}; - - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Initializer methods - */ -/*@{*/ -void vtkParse_InitFile(FileInfo *file_info); -void vtkParse_InitNamespace(NamespaceInfo *namespace_info); -void vtkParse_InitClass(ClassInfo *cls); -void vtkParse_InitFunction(FunctionInfo *func); -void vtkParse_InitValue(ValueInfo *val); -void vtkParse_InitEnum(EnumInfo *item); -void vtkParse_InitUsing(UsingInfo *item); -void vtkParse_InitTemplate(TemplateInfo *arg); -/*@}*/ - -/** - * Copy methods - * - * Strings are not deep-copied, they are assumed to be persistent. - */ -/*@{*/ -void vtkParse_CopyNamespace(NamespaceInfo *data, const NamespaceInfo *orig); -void vtkParse_CopyClass(ClassInfo *data, const ClassInfo *orig); -void vtkParse_CopyFunction(FunctionInfo *data, const FunctionInfo *orig); -void vtkParse_CopyValue(ValueInfo *data, const ValueInfo *orig); -void vtkParse_CopyEnum(EnumInfo *data, const EnumInfo *orig); -void vtkParse_CopyUsing(UsingInfo *data, const UsingInfo *orig); -void vtkParse_CopyTemplate(TemplateInfo *data, const TemplateInfo *orig); -/*@}*/ - -/** - * Free methods - * - * Strings are not freed, they are assumed to be persistent. - */ -/*@{*/ -void vtkParse_FreeFile(FileInfo *file_info); -void vtkParse_FreeNamespace(NamespaceInfo *namespace_info); -void vtkParse_FreeClass(ClassInfo *cls); -void vtkParse_FreeFunction(FunctionInfo *func); -void vtkParse_FreeValue(ValueInfo *val); -void vtkParse_FreeEnum(EnumInfo *item); -void vtkParse_FreeUsing(UsingInfo *item); -void vtkParse_FreeTemplate(TemplateInfo *arg); -/*@}*/ - - -/** - * Add a string to an array of strings, grow array as necessary. - */ -void vtkParse_AddStringToArray( - const char ***valueArray, int *count, const char *value); - -/** - * Expand the Item array for classes and namespaces. - */ -void vtkParse_AddItemToArray( - ItemInfo **valueArray, int *count, parse_item_t type, int idx); - - -/** - * Add various items to the structs. - */ -/*@{*/ -void vtkParse_AddIncludeToFile(FileInfo *info, FileInfo *item); -void vtkParse_AddClassToClass(ClassInfo *info, ClassInfo *item); -void vtkParse_AddFunctionToClass(ClassInfo *info, FunctionInfo *item); -void vtkParse_AddEnumToClass(ClassInfo *info, EnumInfo *item); -void vtkParse_AddConstantToClass(ClassInfo *info, ValueInfo *item); -void vtkParse_AddVariableToClass(ClassInfo *info, ValueInfo *item); -void vtkParse_AddTypedefToClass(ClassInfo *info, ValueInfo *item); -void vtkParse_AddUsingToClass(ClassInfo *info, UsingInfo *item); -void vtkParse_AddNamespaceToNamespace(NamespaceInfo *info,NamespaceInfo *item); -void vtkParse_AddClassToNamespace(NamespaceInfo *info, ClassInfo *item); -void vtkParse_AddFunctionToNamespace(NamespaceInfo *info, FunctionInfo *item); -void vtkParse_AddEnumToNamespace(NamespaceInfo *info, EnumInfo *item); -void vtkParse_AddConstantToNamespace(NamespaceInfo *info, ValueInfo *item); -void vtkParse_AddVariableToNamespace(NamespaceInfo *info, ValueInfo *item); -void vtkParse_AddTypedefToNamespace(NamespaceInfo *info, ValueInfo *item); -void vtkParse_AddUsingToNamespace(NamespaceInfo *info, UsingInfo *item); -void vtkParse_AddParameterToFunction(FunctionInfo *info, ValueInfo *item); -void vtkParse_AddParameterToTemplate(TemplateInfo *info, ValueInfo *item); -/*@}*/ - -/** - * Add default constructors to a class if they do not already exist - */ -void vtkParse_AddDefaultConstructors(ClassInfo *data, StringCache *cache); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/VTKWrapping/ParaView/vtkParseExtras.c b/src/VTKWrapping/ParaView/vtkParseExtras.c deleted file mode 100644 index fd04c019..00000000 --- a/src/VTKWrapping/ParaView/vtkParseExtras.c +++ /dev/null @@ -1,1380 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseExtras.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2011 David Gobbi. - - Contributed to the VisualizationToolkit by the author in May 2011 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -#include "vtkParseExtras.h" -#include "vtkParseString.h" -#include "vtkType.h" -#include -#include -#include -#include -#include - -/* skip over an expression in brackets */ -static size_t vtkparse_bracket_len(const char *text) -{ - size_t i = 0; - size_t j = 1; - char bc = text[0]; - char tc = 0; - char semi = ';'; - char c; - - if (bc == '(') { tc = ')'; } - else if (bc == '[') { tc = ']'; } - else if (bc == '{') { tc = '}'; semi = '\0'; } - else if (bc == '<') { tc = '>'; } - else { return 0; } - - do - { - i += j; - j = 1; - c = text[i]; - if (vtkParse_CharType(c, CPRE_QUOTE)) - { - j = vtkParse_SkipQuotes(&text[i]); - } - else if (c == bc || c == '(' || c == '[' || c == '{') - { - j = vtkparse_bracket_len(&text[i]); - } - } - while (c != tc && c != ')' && c != ']' && c != '}' && - c != '\0' && c != '\n' && c != semi && j != 0); - - if (c == tc) - { - i++; - } - - return i; -} - -/* skip over a name that is neither scoped or templated, return the - * total number of characters in the name */ -size_t vtkParse_IdentifierLength(const char *text) -{ - return vtkParse_SkipId(text); -} - -/* skip over a name that might be templated, return the - * total number of characters in the name */ -size_t vtkParse_UnscopedNameLength(const char *text) -{ - size_t i = 0; - - i += vtkParse_SkipId(text); - if (text[i] == '<') - { - i += vtkparse_bracket_len(&text[i]); - if (text[i-1] != '>') - { - fprintf(stderr, "Bad template args %*.*s\n", (int)i, (int)i, text); - assert(text[i-1] == '>'); - return 0; - } - } - - return i; -} - -/* skip over a name that might be scoped or templated, return the - * total number of characters in the name */ -size_t vtkParse_NameLength(const char *text) -{ - size_t i = 0; - do - { - if (text[i] == ':' && text[i+1] == ':') { i += 2; } - i += vtkParse_UnscopedNameLength(&text[i]); - } - while (text[i] == ':' && text[i+1] == ':'); - return i; -} - -/* Search and replace, return the initial string if no replacements - * occurred, otherwise return a new string. */ -static const char *vtkparse_string_replace( - StringCache *cache, const char *str1, - int n, const char *name[], const char *val[]) -{ - const char *cp = str1; - char result_store[1024]; - size_t resultMaxLen = 1024; - char *result, *tmp; - int k; - size_t i, j, l, m; - size_t lastPos, nameBegin, nameEnd; - int replaced = 0; - int any_replaced = 0; - - result = result_store; - - if (n == 0) - { - return str1; - } - - i = 0; - j = 0; - result[j] = '\0'; - - while (cp[i] != '\0') - { - lastPos = i; - - /* skip all chars that aren't part of a name */ - while (!vtkParse_CharType(cp[i], CPRE_ID) && cp[i] != '\0') - { - if (vtkParse_CharType(cp[i], CPRE_QUOTE)) - { - i += vtkParse_SkipQuotes(&cp[i]); - } - else if (vtkParse_CharType(cp[i], CPRE_QUOTE)) - { - i += vtkParse_SkipNumber(&cp[i]); - } - else - { - i++; - } - } - nameBegin = i; - - /* skip all chars that are part of a name */ - i += vtkParse_SkipId(&cp[i]); - nameEnd = i; - - /* search through the list of names to replace */ - replaced = 0; - m = nameEnd - nameBegin; - for (k = 0; k < n; k++) - { - l = strlen(name[k]); - if (l > 0 && l == m && strncmp(&cp[nameBegin], name[k], l) == 0) - { - m = strlen(val[k]); - replaced = 1; - any_replaced = 1; - break; - } - } - - /* expand the storage space if needed */ - if (j + m + (nameBegin - lastPos) + 1 >= resultMaxLen) - { - resultMaxLen *= 2; - tmp = (char *)malloc(resultMaxLen); - strcpy(tmp, result); - if (result != result_store) - { - free(result); - } - result = tmp; - } - - /* copy the old bits */ - if (nameBegin > lastPos) - { - strncpy(&result[j], &cp[lastPos], nameBegin - lastPos); - j += (nameBegin - lastPos); - } - - /* do the replacement */ - if (replaced) - { - strncpy(&result[j], val[k], m); - j += m; - /* guard against creating double ">>" */ - if (val[k][m-1] == '>' && cp[nameEnd] == '>') - { - result[j++] = ' '; - } - } - else if (nameEnd > nameBegin) - { - strncpy(&result[j], &cp[nameBegin], nameEnd - nameBegin); - j += (nameEnd - nameBegin); - } - - result[j] = '\0'; - } - - if (cache) - { - if (any_replaced) - { - /* use the efficient CacheString method */ - cp = vtkParse_CacheString(cache, result, j); - if (result != result_store) - { - free(result); - } - } - } - else - { - if (any_replaced) - { - /* return a string that was allocated with malloc */ - if (result == result_store) - { - tmp = (char *)malloc(strlen(result) + 1); - strcpy(tmp, result); - result = tmp; - } - cp = result; - } - } - - return cp; -} - -/* Wherever one of the specified names exists inside a Value or inside - * a Dimension size, replace it with the corresponding val string. */ -void vtkParse_ExpandValues( - ValueInfo *valinfo, StringCache *cache, - int n, const char *name[], const char *val[]) -{ - int j, m, dim, count; - const char *cp; - - if (valinfo->Value) - { - valinfo->Value = vtkparse_string_replace( - cache, valinfo->Value, n, name, val); - } - - m = valinfo->NumberOfDimensions; - if (m) - { - count = 1; - for (j = 0; j < m; j++) - { - cp = valinfo->Dimensions[j]; - if (cp) - { - cp = vtkparse_string_replace(cache, cp, n, name, val); - valinfo->Dimensions[j] = cp; - - /* check whether dimension has become an integer literal */ - if (cp[0] == '0' && (cp[1] == 'x' || cp[1] == 'X')) { cp += 2; } - while (*cp >= '0' && *cp <= '9') { cp++; } - while (*cp == 'u' || *cp == 'l' || *cp == 'U' || *cp == 'L') { cp++; } - dim = 0; - if (*cp == '\0') - { - dim = (int)strtol(valinfo->Dimensions[j], NULL, 0); - } - count *= dim; - } - } - - /* update count if all values are integer literals */ - if (count) - { - valinfo->Count = count; - } - } -} - -/* Expand a typedef within a type declaration. */ -void vtkParse_ExpandTypedef( - ValueInfo *valinfo, ValueInfo *typedefinfo) -{ - const char *classname; - unsigned int baseType; - unsigned int pointers; - unsigned int refbit; - unsigned int qualifiers; - unsigned int tmp1, tmp2; - int i; - - classname = typedefinfo->Class; - baseType = (typedefinfo->Type & VTK_PARSE_BASE_TYPE); - pointers = (typedefinfo->Type & VTK_PARSE_POINTER_MASK); - refbit = (valinfo->Type & VTK_PARSE_REF); - qualifiers = (typedefinfo->Type & VTK_PARSE_CONST); - - /* handle const */ - if ((valinfo->Type & VTK_PARSE_CONST) != 0) - { - if ((pointers & VTK_PARSE_POINTER_LOWMASK) != 0) - { - if ((pointers & VTK_PARSE_POINTER_LOWMASK) != VTK_PARSE_ARRAY) - { - /* const turns into const pointer */ - pointers = (pointers & ~VTK_PARSE_POINTER_LOWMASK); - pointers = (pointers | VTK_PARSE_CONST_POINTER); - } - } - else - { - /* const remains as const value */ - qualifiers = (qualifiers | VTK_PARSE_CONST); - } - } - - /* make a reversed copy of the pointer bitfield */ - tmp1 = (valinfo->Type & VTK_PARSE_POINTER_MASK); - tmp2 = 0; - while (tmp1) - { - tmp2 = ((tmp2 << 2) | (tmp1 & VTK_PARSE_POINTER_LOWMASK)); - tmp1 = ((tmp1 >> 2) & VTK_PARSE_POINTER_MASK); - } - - /* turn pointers into zero-element arrays where necessary */ - if ((pointers & VTK_PARSE_POINTER_LOWMASK) == VTK_PARSE_ARRAY) - { - tmp2 = ((tmp2 >> 2) & VTK_PARSE_POINTER_MASK); - while (tmp2) - { - vtkParse_AddStringToArray( - &valinfo->Dimensions, &valinfo->NumberOfDimensions, ""); - tmp2 = ((tmp2 >> 2) & VTK_PARSE_POINTER_MASK); - } - } - else - { - /* combine the pointers */ - while (tmp2) - { - pointers = ((pointers << 2) | (tmp2 & VTK_PARSE_POINTER_LOWMASK)); - tmp2 = ((tmp2 >> 2) & VTK_PARSE_POINTER_MASK); - } - } - - /* combine the arrays */ - for (i = 0; i < typedefinfo->NumberOfDimensions; i++) - { - vtkParse_AddStringToArray( - &valinfo->Dimensions, &valinfo->NumberOfDimensions, - typedefinfo->Dimensions[i]); - } - if (valinfo->NumberOfDimensions > 1) - { - pointers = ((pointers & ~VTK_PARSE_POINTER_LOWMASK) | VTK_PARSE_ARRAY); - } - - /* put everything together */ - valinfo->Type = (baseType | pointers | refbit | qualifiers); - valinfo->Class = classname; - valinfo->Function = typedefinfo->Function; - valinfo->Count *= typedefinfo->Count; -} - -/* Expand any unrecognized types within a variable, parameter, or typedef - * that match any of the supplied typedefs. The expansion is done in-place. */ -void vtkParse_ExpandTypedefs( - ValueInfo *val, StringCache *cache, - int n, const char *names[], const char *values[], - ValueInfo *typedefinfo[]) -{ - int i; - - if (((val->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_OBJECT || - (val->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN) && - val->Class != 0) - { - for (i = 0; i < n; i++) - { - if (typedefinfo[i] && strcmp(val->Class, typedefinfo[i]->Name) == 0) - { - vtkParse_ExpandTypedef(val, typedefinfo[i]); - break; - } - } - if (i == n) - { - /* in case type appears as a template arg of another type */ - val->Class = vtkparse_string_replace( - cache, val->Class, n, names, values); - } - } -} - -/* Helper struct for VTK-specific types */ -struct vtk_type_struct -{ - size_t len; - const char *name; - unsigned int type; -}; - -/* Simple utility for mapping VTK types to VTK_PARSE types */ -unsigned int vtkParse_MapType(int vtktype) -{ - static unsigned int typemap[] = - { - VTK_PARSE_VOID, /* VTK_VOID 0 */ - 0, /* VTK_BIT 1 */ - VTK_PARSE_CHAR, /* VTK_CHAR 2 */ - VTK_PARSE_UNSIGNED_CHAR, /* VTK_UNSIGNED_CHAR 3 */ - VTK_PARSE_SHORT, /* VTK_SHORT 4 */ - VTK_PARSE_UNSIGNED_SHORT, /* VTK_UNSIGNED_SHORT 5 */ - VTK_PARSE_INT, /* VTK_INT 6 */ - VTK_PARSE_UNSIGNED_INT, /* VTK_UNSIGNED_INT 7 */ - VTK_PARSE_LONG, /* VTK_LONG 8 */ - VTK_PARSE_UNSIGNED_LONG, /* VTK_UNSIGNED_LONG 9 */ - VTK_PARSE_FLOAT, /* VTK_FLOAT 10 */ - VTK_PARSE_DOUBLE, /* VTK_DOUBLE 11 */ - VTK_PARSE_ID_TYPE, /* VTK_ID_TYPE 12 */ - VTK_PARSE_STRING, /* VTK_STRING 13 */ - 0, /* VTK_OPAQUE 14 */ - VTK_PARSE_SIGNED_CHAR, /* VTK_SIGNED_CHAR 15 */ - VTK_PARSE_LONG_LONG, /* VTK_LONG_LONG 16 */ - VTK_PARSE_UNSIGNED_LONG_LONG, /* VTK_UNSIGNED_LONG_LONG 17 */ - VTK_PARSE___INT64, /* VTK___INT64 18 */ - VTK_PARSE_UNSIGNED___INT64, /* VTK_UNSIGNED___INT64 19 */ - 0, /* VTK_VARIANT 20 */ - 0, /* VTK_OBJECT 21 */ - VTK_PARSE_UNICODE_STRING /* VTK_UNICODE_STRING 22 */ - }; - - if (vtktype > 0 && vtktype <= VTK_UNICODE_STRING) - { - return typemap[vtktype]; - } - return 0; -} - -/* Get a type from a type name, and return the number of characters used. - * If the "classname" argument is not NULL, then it is used to return - * the short name for the type, e.g. "long int" becomes "long", while - * typedef names and class names are returned unchanged. If "const" - * appears in the type name, then the const bit flag is set for the - * type, but "const" will not appear in the returned classname. */ -size_t vtkParse_BasicTypeFromString( - const char *text, unsigned int *type_ptr, - const char **classname_ptr, size_t *len_ptr) -{ - /* The various typedefs and types specific to VTK */ - static struct vtk_type_struct vtktypes[] = { - { 9, "vtkIdType", VTK_ID_TYPE }, - { 12, "vtkStdString", VTK_STRING }, - { 16, "vtkUnicodeString", VTK_UNICODE_STRING }, - { 11, "vtkTypeInt8", VTK_TYPE_INT8 }, - { 12, "vtkTypeUInt8", VTK_TYPE_UINT8 }, - { 12, "vtkTypeInt16", VTK_TYPE_INT16 }, - { 13, "vtkTypeUInt16", VTK_TYPE_UINT16 }, - { 12, "vtkTypeInt32", VTK_TYPE_INT32 }, - { 13, "vtkTypeUInt32", VTK_TYPE_UINT32 }, - { 12, "vtkTypeInt64", VTK_TYPE_INT64 }, - { 13, "vtkTypeUInt64", VTK_TYPE_UINT64 }, - { 14, "vtkTypeFloat32", VTK_TYPE_FLOAT32 }, - { 14, "vtkTypeFloat64", VTK_TYPE_FLOAT64 }, - { 0, 0, 0 } }; - - /* Other typedefs and types */ - static struct vtk_type_struct stdtypes[] = { - { 6, "size_t", VTK_PARSE_SIZE_T }, - { 7, "ssize_t", VTK_PARSE_SSIZE_T }, - { 7, "ostream", VTK_PARSE_OSTREAM }, - { 7, "istream", VTK_PARSE_ISTREAM }, - { 8, "string", VTK_PARSE_STRING }, - { 0, 0, 0 } }; - - const char *cp = text; - const char *tmpcp; - size_t k, n, m; - int i; - unsigned int const_bits = 0; - unsigned int static_bits = 0; - unsigned int unsigned_bits = 0; - unsigned int base_bits = 0; - const char *classname = NULL; - size_t len = 0; - - while (vtkParse_CharType(*cp, CPRE_HSPACE)) { cp++; } - - while (vtkParse_CharType(*cp, CPRE_ID) || - (cp[0] == ':' && cp[1] == ':')) - { - /* skip all chars that are part of a name */ - n = vtkParse_NameLength(cp); - - if ((n == 6 && strncmp("static", cp, n) == 0) || - (n == 4 && strncmp("auto", cp, n) == 0) || - (n == 8 && strncmp("register", cp, n) == 0) || - (n == 8 && strncmp("volatile", cp, n) == 0)) - { - if (strncmp("static", cp, n) == 0) - { - static_bits = VTK_PARSE_STATIC; - } - } - else if (n == 5 && strncmp(cp, "const", n) == 0) - { - const_bits |= VTK_PARSE_CONST; - } - else if (n == 8 && strncmp(cp, "unsigned", n) == 0) - { - unsigned_bits |= VTK_PARSE_UNSIGNED; - if (base_bits == 0) - { - classname = "int"; - base_bits = VTK_PARSE_INT; - } - } - else if (n == 6 && strncmp(cp, "signed", n) == 0) - { - if (base_bits == VTK_PARSE_CHAR) - { - classname = "signed char"; - base_bits = VTK_PARSE_SIGNED_CHAR; - } - else - { - classname = "int"; - base_bits = VTK_PARSE_INT; - } - } - else if (n == 3 && strncmp(cp, "int", n) == 0) - { - if (base_bits == 0) - { - classname = "int"; - base_bits = VTK_PARSE_INT; - } - } - else if (n == 4 && strncmp(cp, "long", n) == 0) - { - if (base_bits == VTK_PARSE_DOUBLE) - { - classname = "long double"; - base_bits = VTK_PARSE_LONG_DOUBLE; - } - else if (base_bits == VTK_PARSE_LONG) - { - classname = "long long"; - base_bits = VTK_PARSE_LONG_LONG; - } - else - { - classname = "long"; - base_bits = VTK_PARSE_LONG; - } - } - else if (n == 5 && strncmp(cp, "short", n) == 0) - { - classname = "short"; - base_bits = VTK_PARSE_SHORT; - } - else if (n == 4 && strncmp(cp, "char", n) == 0) - { - if (base_bits == VTK_PARSE_INT && unsigned_bits != VTK_PARSE_UNSIGNED) - { - classname = "signed char"; - base_bits = VTK_PARSE_SIGNED_CHAR; - } - else - { - classname = "char"; - base_bits = VTK_PARSE_CHAR; - } - } - else if (n == 5 && strncmp(cp, "float", n) == 0) - { - classname = "float"; - base_bits = VTK_PARSE_FLOAT; - } - else if (n == 6 && strncmp(cp, "double", n) == 0) - { - if (base_bits == VTK_PARSE_LONG) - { - classname = "long double"; - base_bits = VTK_PARSE_LONG_DOUBLE; - } - else - { - classname = "double"; - base_bits = VTK_PARSE_DOUBLE; - } - } - else if (n == 4 && strncmp(cp, "bool", n) == 0) - { - classname = "bool"; - base_bits = VTK_PARSE_BOOL; - } - else if (n == 4 && strncmp(cp, "void", n) == 0) - { - classname = "void"; - base_bits = VTK_PARSE_VOID; - } - else if (n == 7 && strncmp(cp, "__int64", n) == 0) - { - classname = "__int64"; - base_bits = VTK_PARSE___INT64; - } - else - { - /* if type already found, break */ - if (base_bits != 0) - { - break; - } - - /* check vtk typedefs */ - if (strncmp(cp, "vtk", 3) == 0) - { - for (i = 0; vtktypes[i].len != 0; i++) - { - if (n == vtktypes[i].len && strncmp(cp, vtktypes[i].name, n) == 0) - { - classname = vtktypes[i].name; - base_bits = vtkParse_MapType((int)vtktypes[i].type); - } - } - } - - /* check standard typedefs */ - if (base_bits == 0) - { - 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; } - - /* advance past the namespace */ - tmpcp = cp + m; - - for (i = 0; stdtypes[i].len != 0; i++) - { - if (n == stdtypes[i].len && strncmp(tmpcp, stdtypes[i].name, n) == 0) - { - classname = stdtypes[i].name; - base_bits = stdtypes[i].type; - } - } - - /* include the namespace if present */ - if (base_bits != 0 && m > 0) - { - classname = cp; - len = n; - } - } - - /* anything else is assumed to be a class, enum, or who knows */ - if (base_bits == 0) - { - base_bits = VTK_PARSE_UNKNOWN; - classname = cp; - len = n; - - /* VTK classes all start with vtk */ - if (strncmp(classname, "vtk", 3) == 0) - { - base_bits = VTK_PARSE_OBJECT; - /* make sure the "vtk" isn't just part of the namespace */ - for (k = 0; k < n; k++) - { - if (cp[k] == ':') - { - base_bits = VTK_PARSE_UNKNOWN; - break; - } - } - } - /* Qt objects and enums */ - else if (classname[0] == 'Q' && - ((classname[1] >= 'A' && classname[2] <= 'Z') || - strncmp(classname, "Qt::", 4) == 0)) - { - base_bits = VTK_PARSE_QOBJECT; - } - } - } - - cp += n; - while (vtkParse_CharType(*cp, CPRE_HSPACE)) { cp++; } - } - - if ((unsigned_bits & VTK_PARSE_UNSIGNED) != 0) - { - switch (base_bits) - { - case VTK_PARSE_CHAR: - classname = "unsigned char"; - break; - case VTK_PARSE_SHORT: - classname = "unsigned short"; - break; - case VTK_PARSE_INT: - classname = "unsigned int"; - break; - case VTK_PARSE_LONG: - classname = "unsigned long"; - break; - case VTK_PARSE_LONG_LONG: - classname = "unsigned long long"; - break; - case VTK_PARSE___INT64: - classname = "unsigned __int64"; - break; - } - } - - *type_ptr = (static_bits | const_bits | unsigned_bits | base_bits); - - if (classname_ptr) - { - *classname_ptr = classname; - if (len == 0) - { - len = strlen(classname); - } - *len_ptr = len; - } - - return (size_t)(cp - text); -} - -/* Parse a type description in "text" and generate a typedef named "name" */ -size_t vtkParse_ValueInfoFromString( - ValueInfo *data, StringCache *cache, const char *text) -{ - const char *cp = text; - size_t n; - int m, count; - unsigned int base_bits = 0; - unsigned int pointer_bits = 0; - unsigned int ref_bits = 0; - const char *classname = NULL; - - /* get the basic type with qualifiers */ - cp += vtkParse_BasicTypeFromString(cp, &base_bits, &classname, &n); - - data->Class = vtkParse_CacheString(cache, classname, n); - - if ((base_bits & VTK_PARSE_STATIC) != 0) - { - data->IsStatic = 1; - } - - /* look for pointers (and const pointers) */ - while (*cp == '*') - { - cp++; - pointer_bits = (pointer_bits << 2); - while (vtkParse_CharType(*cp, CPRE_HSPACE)) { cp++; } - if (strncmp(cp, "const", 5) == 0 && - !vtkParse_CharType(cp[5], CPRE_IDGIT)) - { - cp += 5; - while (vtkParse_CharType(*cp, CPRE_HSPACE)) { cp++; } - pointer_bits = (pointer_bits | VTK_PARSE_CONST_POINTER); - } - else - { - pointer_bits = (pointer_bits | VTK_PARSE_POINTER); - } - pointer_bits = (pointer_bits & VTK_PARSE_POINTER_MASK); - } - - /* look for ref */ - if (*cp == '&') - { - cp++; - while (vtkParse_CharType(*cp, CPRE_HSPACE)) { cp++; } - ref_bits = VTK_PARSE_REF; - } - - /* look for the variable name */ - if (vtkParse_CharType(*cp, CPRE_ID)) - { - /* skip all chars that are part of a name */ - n = vtkParse_SkipId(cp); - data->Name = vtkParse_CacheString(cache, cp, n); - cp += n; - while (vtkParse_CharType(*cp, CPRE_HSPACE)) { cp++; } - } - - /* look for array brackets */ - if (*cp == '[') - { - count = 1; - - while (*cp == '[') - { - n = vtkparse_bracket_len(cp); - if (n > 1) - { - cp++; - n -= 2; - } - while (vtkParse_CharType(*cp, CPRE_HSPACE)) { cp++; n--; } - while (n > 0 && vtkParse_CharType(cp[n-1], CPRE_HSPACE)) { n--; } - vtkParse_AddStringToArray( - &data->Dimensions, - &data->NumberOfDimensions, - vtkParse_CacheString(cache, cp, n)); - m = 0; - if (vtkParse_CharType(*cp, CPRE_DIGIT) && - vtkParse_SkipNumber(cp) == n) - { - m = (int)strtol(cp, NULL, 0); - } - count *= m; - - cp += n; - while (vtkParse_CharType(*cp, CPRE_HSPACE)) { cp++; } - if (*cp == ']') { cp++; } - while (vtkParse_CharType(*cp, CPRE_HSPACE)) { cp++; } - } - } - - /* add pointer indirection to correspond to first array dimension */ - if (data->NumberOfDimensions > 1) - { - pointer_bits = ((pointer_bits << 2) | VTK_PARSE_ARRAY); - } - else if (data->NumberOfDimensions == 1) - { - pointer_bits = ((pointer_bits << 2) | VTK_PARSE_POINTER); - } - pointer_bits = (pointer_bits & VTK_PARSE_POINTER_MASK); - - /* (Add code here to look for "=" followed by a value ) */ - - data->Type = (pointer_bits | ref_bits | base_bits); - - return (cp - text); -} - -/* Generate a C++ declaration string from a ValueInfo struct */ -const char *vtkParse_ValueInfoToString( - ValueInfo *data, int *needs_free) -{ - unsigned int pointer_bits = (data->Type & VTK_PARSE_POINTER_MASK); - unsigned int ref_bits = (data->Type & VTK_PARSE_REF); - unsigned int qualifier_bits = (data->Type & VTK_PARSE_CONST); - unsigned int reverse_bits = 0; - unsigned int pointer_type = 0; - const char *classname = data->Class; - const char *name = data->Name; - char *text = NULL; - size_t i = 0; - size_t l; - int j = 0; - - if (pointer_bits == 0 && ref_bits == 0 && qualifier_bits == 0 && - name == NULL) - { - if (needs_free) - { - *needs_free = 0; - } - return classname; - } - - /* compute the length of string to allocate */ - l = 6; /* for const */ - l += 4*7; /* for pointers */ - l += 1; /* for ref */ - l += strlen(classname) + 1; /* for type */ - for (j = 0; j < data->NumberOfDimensions; j++) - { - l += 2 + strlen(data->Dimensions[j]); - } - l++; /* for NULL */ - l += 4; /* for safety */ - - text = (char *)malloc(l); - - if ((qualifier_bits & VTK_PARSE_CONST) != 0) - { - strcpy(&text[i], "const "); - i += 6; - } - - strcpy(&text[i], classname); - i += strlen(classname); - text[i++] = ' '; - - while (pointer_bits != 0) - { - reverse_bits <<= 2; - reverse_bits |= (pointer_bits & VTK_PARSE_POINTER_LOWMASK); - pointer_bits = ((pointer_bits >> 2) & VTK_PARSE_POINTER_MASK); - } - - while (reverse_bits != 0) - { - pointer_type = (reverse_bits & VTK_PARSE_POINTER_LOWMASK); - if (pointer_type == VTK_PARSE_ARRAY || - (reverse_bits == VTK_PARSE_POINTER && - data->NumberOfDimensions > 0)) - { - break; - } - else if (pointer_type == VTK_PARSE_POINTER) - { - text[i++] = '*'; - } - else if (pointer_type == VTK_PARSE_CONST_POINTER) - { - strcpy(&text[i], "*const "); - i += 7; - } - - reverse_bits = ((reverse_bits >> 2) & VTK_PARSE_POINTER_MASK); - } - - if (ref_bits) - { - text[i++] = '&'; - } - - if (name) - { - strcpy(&text[i], name); - i += strlen(name); - } - - for (j = 0; j < data->NumberOfDimensions; j++) - { - text[i++] = '['; - if (data->Dimensions[j]) - { - strcpy(&text[i], data->Dimensions[j]); - i += strlen(data->Dimensions[j]); - } - text[i++] = ']'; - } - - text[i] = '\0'; - - /* make sure enough space was allocated */ - assert(i < l); - - if (needs_free) - { - *needs_free = 1; - } - - return text; -} - -/* Search and replace, return the initial string if no replacements - * occurred, otherwise return a new string allocated with malloc. */ -const char *vtkParse_StringReplace( - const char *str1, int n, const char *name[], const char *val[]) -{ - return vtkparse_string_replace(NULL, str1, n, name, val); -} - -/* substitute generic types and values with actual types and values */ -static void func_substitution( - FunctionInfo *data, StringCache *cache, - int m, const char *arg_names[], - const char *arg_values[], ValueInfo *arg_types[]); - -static void value_substitution( - ValueInfo *data, StringCache *cache, - int m, const char *arg_names[], - const char *arg_values[], ValueInfo *arg_types[]) -{ - vtkParse_ExpandTypedefs(data, cache, m, arg_names, arg_values, arg_types); - vtkParse_ExpandValues(data, cache, m, arg_names, arg_values); - - if (data->Function) - { - func_substitution( - data->Function, cache, m, arg_names, arg_values, arg_types); - } -} - -static void func_substitution( - FunctionInfo *data, StringCache *cache, - int m, const char *arg_names[], - const char *arg_values[], ValueInfo *arg_types[]) -{ - int i, n; - - n = data->NumberOfParameters; - for (i = 0; i < n; i++) - { - value_substitution( - data->Parameters[i], cache, m, arg_names, arg_values, arg_types); - } - - if (data->ReturnValue) - { - value_substitution( - data->ReturnValue, cache, m, arg_names, arg_values, arg_types); - } - - if (data->Signature) - { - data->Signature = - vtkparse_string_replace( - cache, data->Signature, m, arg_names, arg_values); - } - - /* legacy information for old wrappers */ -#ifndef VTK_PARSE_LEGACY_REMOVE - n = data->NumberOfArguments; - for (i = 0; i < n; i++) - { - data->ArgTypes[i] = data->Parameters[i]->Type; - data->ArgClasses[i] = data->Parameters[i]->Class; - if (data->Parameters[i]->NumberOfDimensions == 1 && - data->Parameters[i]->Count > 0) - { - data->ArgCounts[i] = data->Parameters[i]->Count; - } - } - - if (data->ReturnValue) - { - data->ReturnType = data->ReturnValue->Type; - data->ReturnClass = data->ReturnValue->Class; - if (data->ReturnValue->NumberOfDimensions == 1 && - data->ReturnValue->Count > 0) - { - data->HintSize = data->ReturnValue->Count; - data->HaveHint = 1; - } - } -#endif /* VTK_PARSE_LEGACY_REMOVE */ -} - -static void class_substitution( - ClassInfo *data, StringCache *cache, - int m, const char *arg_names[], - const char *arg_values[], ValueInfo *arg_types[]) -{ - int i, n; - - /* superclasses may be templated */ - n = data->NumberOfSuperClasses; - for (i = 0; i < n; i++) - { - data->SuperClasses[i] = vtkparse_string_replace( - cache, data->SuperClasses[i], m, arg_names, arg_values); - } - - n = data->NumberOfClasses; - for (i = 0; i < n; i++) - { - class_substitution( - data->Classes[i], cache, m, arg_names, arg_values, arg_types); - } - - n = data->NumberOfFunctions; - for (i = 0; i < n; i++) - { - func_substitution( - data->Functions[i], cache, m, arg_names, arg_values, arg_types); - } - - n = data->NumberOfConstants; - for (i = 0; i < n; i++) - { - value_substitution( - data->Constants[i], cache, m, arg_names, arg_values, arg_types); - } - - n = data->NumberOfVariables; - for (i = 0; i < n; i++) - { - value_substitution( - data->Variables[i], cache, m, arg_names, arg_values, arg_types); - } - - n = data->NumberOfTypedefs; - for (i = 0; i < n; i++) - { - value_substitution( - data->Typedefs[i], cache, m, arg_names, arg_values, arg_types); - } -} - -/* Extract template args from a comma-separated list enclosed - * in angle brackets. Returns zero if no angle brackets found. */ -size_t vtkParse_DecomposeTemplatedType( - const char *text, const char **classname, - int nargs, const char ***argp, const char *defaults[]) -{ - size_t i, j, k, n; - const char *arg; - char *new_text; - const char **template_args = NULL; - int template_arg_count = 0; - - n = vtkParse_NameLength(text); - - /* is the class templated? */ - for (i = 0; i < n; i++) - { - if (text[i] == '<') - { - break; - } - } - - if (classname) - { - new_text = (char *)malloc(i + 1); - strncpy(new_text, text, i); - new_text[i] = '\0'; - *classname = new_text; - } - - if (text[i] == '<') - { - i++; - /* extract the template arguments */ - for (;;) - { - while (vtkParse_CharType(text[i], CPRE_HSPACE)) { i++; } - j = i; - while (text[j] != ',' && text[j] != '>' && - text[j] != '\n' && text[j] != '\0') - { - if (text[j] == '<' || text[j] == '(' || - text[j] == '[' || text[j] == '{') - { - j += vtkparse_bracket_len(&text[j]); - } - else if (vtkParse_CharType(text[j], CPRE_QUOTE)) - { - j += vtkParse_SkipQuotes(&text[j]); - } - else - { - j++; - } - } - - k = j; - while (vtkParse_CharType(text[k-1], CPRE_HSPACE)) { --k; } - - new_text = (char *)malloc(k-i + 1); - strncpy(new_text, &text[i], k-i); - new_text[k-i] = '\0'; - vtkParse_AddStringToArray(&template_args, &template_arg_count, - new_text); - - assert(template_arg_count <= nargs); - - i = j + 1; - - if (text[j] != ',') - { - break; - } - } - } - - while (template_arg_count < nargs) - { - assert(defaults != NULL); - arg = defaults[template_arg_count]; - assert(arg != NULL); - new_text = (char *)malloc(strlen(arg + 1)); - strcpy(new_text, arg); - vtkParse_AddStringToArray(&template_args, &template_arg_count, new_text); - } - - *argp = template_args; - - return i; -} - -/* Free the list of strings returned by ExtractTemplateArgs. */ -void vtkParse_FreeTemplateDecomposition( - const char *name, int n, const char **args) -{ - int i; - - if (name) - { - free((char *)name); - } - - if (n > 0) - { - for (i = 0; i < n; i++) - { - free((char *)args[i]); - } - - free((char **)args); - } -} - -/* Instantiate a class template by substituting the provided arguments. */ -void vtkParse_InstantiateClassTemplate( - ClassInfo *data, StringCache *cache, int n, const char *args[]) -{ - TemplateInfo *t = data->Template; - const char **new_args = NULL; - const char **arg_names = NULL; - ValueInfo **arg_types = NULL; - int i, m; - char *new_name; - size_t k; - - if (t == NULL) - { - fprintf(stderr, "vtkParse_InstantiateClassTemplate: " - "this class is not templated.\n"); - return; - } - - m = t->NumberOfParameters; - if (n > m) - { - fprintf(stderr, "vtkParse_InstantiateClassTemplate: " - "too many template args.\n"); - return; - } - - for (i = n; i < m; i++) - { - if (t->Parameters[i]->Value == NULL || - t->Parameters[i]->Value[0] == '\0') - { - fprintf(stderr, "vtkParse_InstantiateClassTemplate: " - "too few template args.\n"); - return; - } - } - - new_args = (const char **)malloc(m*sizeof(char **)); - for (i = 0; i < n; i++) - { - new_args[i] = args[i]; - } - for (i = n; i < m; i++) - { - new_args[i] = t->Parameters[i]->Value; - } - args = new_args; - - arg_names = (const char **)malloc(m*sizeof(char **)); - arg_types = (ValueInfo **)malloc(m*sizeof(ValueInfo *)); - for (i = 0; i < m; i++) - { - arg_names[i] = t->Parameters[i]->Name; - arg_types[i] = NULL; - if (t->Parameters[i]->Type == 0) - { - arg_types[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(arg_types[i]); - vtkParse_ValueInfoFromString(arg_types[i], cache, args[i]); - arg_types[i]->ItemType = VTK_TYPEDEF_INFO; - arg_types[i]->Name = arg_names[i]; - } - } - - /* no longer a template (has been instantiated) */ - if (data->Template) - { - vtkParse_FreeTemplate(data->Template); - } - data->Template = NULL; - - /* append template args to class name */ - k = strlen(data->Name) + 2; - for (i = 0; i < m; i++) - { - k += strlen(args[i]) + 2; - } - new_name = (char *)malloc(k); - strcpy(new_name, data->Name); - k = strlen(new_name); - new_name[k++] = '<'; - for (i = 0; i < m; i++) - { - strcpy(&new_name[k], args[i]); - k += strlen(args[i]); - if (i+1 < m) - { - new_name[k++] = ','; - new_name[k++] = ' '; - } - } - if (new_name[k-1] == '>') - { - new_name[k++] = ' '; - } - new_name[k++] = '>'; - new_name[k] = '\0'; - - data->Name = vtkParse_CacheString(cache, new_name, k); - free(new_name); - - /* do the template arg substitution */ - class_substitution(data, cache, m, arg_names, args, arg_types); - - /* free all allocated arrays */ - free((char **)new_args); - free((char **)arg_names); - - for (i = 0; i < m; i++) - { - if (arg_types[i]) - { - vtkParse_FreeValue(arg_types[i]); - } - } - free(arg_types); -} - -/* Get a zero-terminated array of the types in vtkTemplateMacro. */ -const char **vtkParse_GetTemplateMacroTypes() -{ - static const char *types[] = { - "char", "signed char", "unsigned char", "short", "unsigned short", - "int", "unsigned int", "long", "unsigned long", -#ifdef VTK_TYPE_USE_LONG_LONG - "long long", "unsigned long long", -#endif -#ifdef VTK_TYPE_USE___INT64 - "__int64", "unsigned __int64", -#endif - "float", "double", NULL }; - - return types; -} - -/* Get a zero-terminated array of the types in vtkArray. */ -const char **vtkParse_GetArrayTypes() -{ - static const char *types[] = { - "char", "signed char", "unsigned char", "short", "unsigned short", - "int", "unsigned int", "long", "unsigned long", -#ifdef VTK_TYPE_USE_LONG_LONG - "long long", "unsigned long long", -#endif -#ifdef VTK_TYPE_USE___INT64 - "__int64", "unsigned __int64", -#endif - "float", "double", - "vtkStdString", "vtkUnicodeString", "vtkVariant", NULL }; - - return types; -} diff --git a/src/VTKWrapping/ParaView/vtkParseExtras.h b/src/VTKWrapping/ParaView/vtkParseExtras.h deleted file mode 100644 index 3f3dceca..00000000 --- a/src/VTKWrapping/ParaView/vtkParseExtras.h +++ /dev/null @@ -1,173 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseExtras.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2011 David Gobbi. - - Contributed to the VisualizationToolkit by the author in May 2011 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -/** - * This file contains extra utilities for parsing and wrapping. - */ - -#ifndef VTK_PARSE_EXTRAS_H -#define VTK_PARSE_EXTRAS_H - -#include "vtkParseData.h" -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Skip over a sequence of characters that begin with an alphabetic - * character or an underscore, and include only alphanumeric - * characters or underscores. Return the number of characters. - */ -size_t vtkParse_IdentifierLength(const char *text); - -/** - * Skip over a name, including any namespace prefixes and - * any template arguments. Return the number of characters. - * Examples are "name", "::name", "name", "name::name2", - * "::name::name2". - */ -size_t vtkParse_NameLength(const char *text); - -/** - * Skip over a name, including any template arguments, but stopping - * if a '::' is encoutered. Return the number of characters. - * Examples are "name" and "name" - */ -size_t vtkParse_UnscopedNameLength(const char *text); - -/** - * Skip over a literal, which may be a number, a char in single - * quotes, a string in double quotes, or a name, or a name followed - * by arguments in parentheses. - */ -size_t vtkParse_LiteralLength(const char *text); - -/** - * Get a type from a type name, and return the number of characters used. - * If the "classname" argument is not NULL, then it is used to return - * the short name for the type, e.g. "long int" becomes "long", while - * typedef names and class names are returned unchanged. If "const" - * appears in the type name, then the const bit flag is set for the - * type, but "const" will not appear in the returned classname. - */ -size_t vtkParse_BasicTypeFromString( - const char *text, unsigned int *type, - const char **classname, size_t *classname_len); - -/** - * Generate a ValueInfo by parsing the type from the provided text. - * Only simple text strings are supported, e.g. "const T **". - * Returns the number of characters consumed. - */ -size_t vtkParse_ValueInfoFromString( - ValueInfo *val, StringCache *cache, const char *text); - -/** - * Generate a declaration string from a ValueInfo struct. If the - * "nf" arg is set, the returned string must be freed. - * Only simple text strings are supported, e.g. "const T **". - * The variable or typedef name, if present, is ignored. - */ -const char *vtkParse_ValueInfoToString(ValueInfo *val, int *nf); - -/** - * Expand a typedef within a variable, parameter, or typedef declaration. - * The expansion is done in-place. - */ -void vtkParse_ExpandTypedef(ValueInfo *valinfo, ValueInfo *typedefinfo); - -/** - * Expand any unrecognized types within a variable, parameter, or typedef - * that match any of the supplied typedefs. The expansion is done in-place. - */ -void vtkParse_ExpandTypedefs( - ValueInfo *valinfo, StringCache *cache, - int n, const char *name[], const char *val[], - ValueInfo *typedefinfo[]); - -/** - * Wherever one of the specified names exists inside a Value or inside - * a Dimension size, replace it with the corresponding val string. - * This is used to replace constants with their values. - */ -void vtkParse_ExpandValues( - ValueInfo *valinfo, StringCache *cache, - int n, const char *name[], const char *val[]); - -/** - * Search and replace, return the initial string if no replacements - * occurred, else return a new string allocated with malloc. */ -const char *vtkParse_StringReplace( - const char *str1, int n, const char *name[], const char *val[]); - -/** - * Extract the class name and template args from a templated - * class type ID. Returns the full number of characters that - * were consumed during the decomposition. - */ -size_t vtkParse_DecomposeTemplatedType( - const char *text, const char **classname, - int n, const char ***args, const char *defaults[]); - -/** - * Free the list of strings returned by ExtractTemplateArgs. - */ -void vtkParse_FreeTemplateDecomposition( - const char *classname, int n, const char **args); - -/** - * Instantiate a class template by substituting the provided arguments - * for the template parameters. If "n" is less than the number of template - * parameters, then default parameter values (if present) will be used. - * If an error occurs, the error will be printed to stderr and NULL will - * be returned. - */ -void vtkParse_InstantiateClassTemplate( - ClassInfo *data, StringCache *cache, int n, const char *args[]); - -/** - * Instantiate a function or class method template by substituting the - * provided arguments for the template parameters. If "n" is less than - * the number of template parameters, then default parameter values - * (if present) will be used. If an error occurs, the error will be - * printed to stderr and NULL will be returned. - */ -void vtkParse_IntantiateFunctionTemplate( - FunctionInfo *data, int n, const char *args[]); - -/** - * Get a zero-terminated array of the types in vtkTemplateMacro. - */ -const char **vtkParse_GetTemplateMacroTypes(); - -/** - * Get a zero-terminated array of the types in vtkArray. - */ -const char **vtkParse_GetArrayTypes(); - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/VTKWrapping/ParaView/vtkParseHierarchy.c b/src/VTKWrapping/ParaView/vtkParseHierarchy.c deleted file mode 100644 index 9fe18687..00000000 --- a/src/VTKWrapping/ParaView/vtkParseHierarchy.c +++ /dev/null @@ -1,1016 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseHierarchy.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in June 2010 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -#include "vtkParseHierarchy.h" -#include "vtkParseExtras.h" -#include -#include -#include -#include -#include - -static size_t skip_space(const char *text) -{ - size_t i = 0; - while (isspace(text[i]) && text[i] != '\n') { i++; } - return i; -} - -static size_t skip_expression(const char *text, const char *delims) -{ - char newdelims[2]; - size_t i = 0; - size_t j; - int use_angle = 0; - char c; - - for (j = 0; delims[j] != '\0'; j++) - { - if (delims[j] == '>') - { - use_angle = 1; - } - } - - while (text[i] != '\0') - { - c = text[i]; - j = 0; - while (c != delims[j] && delims[j] != '\0') { j++; } - if (delims[j] != '\0' || c == '\0') { break; } - if (c == '\"' || c == '\'') - { - char d = c; - i++; - while (text[i] != d && text[i] != '\0') - { - if (text[i] == '\\' && text[i+1] != '\0') { i++; } - i++; - } - c = text[i]; - if (c == '\0') { break; } - } - i++; - if (c == '(' || c == '[' || c == '{' || (use_angle && c == '<')) - { - if (c == '(') { newdelims[0] = ')'; } - if (c == '[') { newdelims[0] = ']'; } - if (c == '{') { newdelims[0] = '}'; } - if (c == '<') { newdelims[0] = '>'; } - newdelims[1] = '\0'; - - i += skip_expression(&text[i], newdelims); - - if (text[i] == newdelims[0]) { i++; } else { break; } - } - } - - return i; -} - -/* helper: comparison of entries */ -static int compare_hierarchy_entries(const void *vp1, const void *vp2) -{ - const HierarchyEntry *entry1 = (const HierarchyEntry *)vp1; - const HierarchyEntry *entry2 = (const HierarchyEntry *)vp2; - - return strcmp(entry1->Name, entry2->Name); -} - -/* helper: sort the entries to facilitate searching */ -static void sort_hierarchy_entries(HierarchyInfo *info) -{ - qsort(info->Entries, info->NumberOfEntries, sizeof(HierarchyEntry), - &compare_hierarchy_entries); -} - -/* Find an entry with a binary search */ -HierarchyEntry *vtkParseHierarchy_FindEntry( - const HierarchyInfo *info, const char *classname) -{ - HierarchyEntry key; - HierarchyEntry *entry; - size_t i, n; - char name[32]; - char *cp; - - /* use classname as-is for the search if possible */ - cp = (char *)classname; - - /* get portion of name before final template parameters */ - n = vtkParse_UnscopedNameLength(classname); - i = 0; - while (classname[i+n] == ':' && classname[i+n+1] == ':') - { - i += n + 2; - n = vtkParse_UnscopedNameLength(&classname[i]); - } - i += vtkParse_IdentifierLength(&classname[i]); - - /* create a new (shorter) search string if necessary */ - if (classname[i] != '\0') - { - /* use stack space if possible */ - cp = name; - /* otherwise, use malloc */ - if (i > 31) - { - cp = (char *)malloc(i+1); - } - strncpy(cp, classname, i); - cp[i] = '\0'; - } - - key.Name = cp; - - entry = (HierarchyEntry *)bsearch(&key, info->Entries, - info->NumberOfEntries, sizeof(HierarchyEntry), - &compare_hierarchy_entries); - - if (cp != classname && cp != name) - { - free(cp); - } - - return entry; -} - - -/* read a hierarchy file into a HeirarchyInfo struct, or return NULL */ -HierarchyInfo *vtkParseHierarchy_ReadFile(const char *filename) -{ - HierarchyInfo *info; - HierarchyEntry *entry; - int maxClasses = 500; - FILE *fp; - char *line; - char *cp; - const char *ccp; - size_t maxlen = 15; - size_t i, j, n, m; - unsigned int bits, pointers; - static const char *delims = ">,="; - - fp = fopen(filename, "r"); - - if (fp == NULL) - { - return NULL; - } - - line = (char *)malloc(maxlen); - - info = (HierarchyInfo *)malloc(sizeof(HierarchyInfo)); - info->NumberOfEntries = 0; - info->Entries = (HierarchyEntry *)malloc(maxClasses*sizeof(HierarchyEntry)); - info->Strings = (StringCache *)malloc(sizeof(StringCache)); - vtkParse_InitStringCache(info->Strings); - - while (fgets(line, (int)maxlen, fp)) - { - n = strlen(line); - - /* if buffer not long enough, increase it */ - while (n == maxlen-1 && line[n-1] != '\n' && !feof(fp)) - { - maxlen *= 2; - line = (char *)realloc(line, maxlen); - if (!fgets(&line[n], (int)(maxlen-n), fp)) { break; } - n += strlen(&line[n]); - } - - while (n > 0 && isspace(line[n-1])) - { - n--; - } - line[n] = '\0'; - - if (line[0] == '\0') - { - continue; - } - - if (info->NumberOfEntries == maxClasses) - { - maxClasses *= 2; - info->Entries = (HierarchyEntry *)realloc( - info->Entries, sizeof(HierarchyEntry)*maxClasses*2); - } - - entry = &info->Entries[info->NumberOfEntries++]; - entry->Name = NULL; - entry->HeaderFile = NULL; - entry->Module = NULL; - entry->NumberOfTemplateParameters = 0; - entry->TemplateParameters = NULL; - entry->TemplateDefaults = NULL; - entry->NumberOfProperties = 0; - entry->Properties = NULL; - entry->NumberOfSuperClasses = 0; - entry->SuperClasses = NULL; - entry->SuperClassIndex = NULL; - entry->Typedef = NULL; - entry->IsTypedef = 0; - entry->IsEnum = 0; - - i = skip_space(line); - n = vtkParse_NameLength(&line[i]); - for (m = 0; m < n; m++) - { - if (line[i+m] == '<') { break; } - } - - entry->Name = vtkParse_CacheString(info->Strings, &line[i], m); - i += m; - - if (line[i] == '<') - { - i++; - i += skip_space(&line[i]); - - for (j = 0; line[i] != '>' && line[i] != '\0'; j++) - { - if (j == 0) - { - entry->TemplateParameters = (const char **)malloc(sizeof(char *)); - entry->TemplateDefaults = (const char **)malloc(sizeof(char *)); - } - else - { - entry->TemplateParameters = (const char **)realloc( - (char **)entry->TemplateParameters, (j+1)*sizeof(char *)); - entry->TemplateDefaults = (const char **)realloc( - (char **)entry->TemplateDefaults, (j+1)*sizeof(char *)); - } - entry->NumberOfTemplateParameters++; - entry->TemplateDefaults[j] = NULL; - - m = skip_expression(&line[i], delims); - while (m > 0 && (line[i+m-1] == ' ' || line[i+m-1] == '\t')) - { - --m; - } - - entry->TemplateParameters[j] = - vtkParse_CacheString(info->Strings, &line[i], m); - i += m; - i += skip_space(&line[i]); - - if (line[i] == '=') - { - i++; - i += skip_space(&line[i]); - m = skip_expression(&line[i], delims); - while (m > 0 && (line[i+m-1] == ' ' || line[i+m-1] == '\t')) - { - --m; - } - entry->TemplateDefaults[j] = - vtkParse_CacheString(info->Strings, &line[i], m); - i += m; - i += skip_space(&line[i]); - } - - if (line[i] == ',') - { - i++; - i += skip_space(&line[i]); - } - } - - if (line[i] == '>') - { - i++; - i += skip_space(&line[i]); - } - - if (line[i] == ':' && line[i+1] == ':') - { - i += 2; - m = vtkParse_NameLength(&line[i]); - n = strlen(entry->Name); - cp = vtkParse_NewString(info->Strings, n+m+2); - strcpy(cp, entry->Name); - strcpy(&cp[n], "::"); - strncpy(&cp[n+2], &line[i], m); - i += m; - cp[n+m+2] = '\0'; - entry->Name = cp; - } - } - - i += skip_space(&line[i]); - - /* classes (and possibly enums) */ - if (line[i] == ':') - { - i++; - i += skip_space(&line[i]); - n = vtkParse_NameLength(&line[i]); - /* check for enum indicators */ - if ((n == 3 && strncmp(&line[i], "int", n)) || - (n == 4 && strncmp(&line[i], "enum", n))) - { - entry->IsEnum = 1; - i += n; - i += skip_space(&line[i]); - } - /* else check for superclasses */ - else for (j = 0; ; j++) - { - if (j == 0) - { - entry->SuperClasses = (const char **)malloc(sizeof(char *)); - entry->SuperClassIndex = (int *)malloc(sizeof(int)); - } - else - { - entry->SuperClasses = (const char **)realloc( - (char **)entry->SuperClasses, (j+1)*sizeof(char *)); - entry->SuperClassIndex = (int *)realloc( - entry->SuperClassIndex, (j+1)*sizeof(int)); - } - entry->NumberOfSuperClasses++; - - i += skip_space(&line[i]); - n = vtkParse_NameLength(&line[i]); - entry->SuperClasses[j] = - vtkParse_CacheString(info->Strings, &line[i], n); - entry->SuperClassIndex[j] = -1; - i += n; - - i += skip_space(&line[i]); - if (line[i] != ',') - { - break; - } - i++; - } - } - - /* read typedefs */ - else if (line[i] == '=') - { - i++; - i += skip_space(&line[i]); - entry->IsTypedef = 1; - entry->Typedef = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(entry->Typedef); - - /* type is a reference (does this ever occur?) */ - if (line[i] == '&') - { - i++; - i += skip_space(&line[i]); - entry->Typedef->Type |= VTK_PARSE_REF; - } - - /* type has array dimensions */ - if (line[i] == '[') - { - entry->Typedef->Count = 1; - } - - while (line[i] == '[') - { - i++; - n = 0; - while (line[i+n] != ']' && line[i+n] != '\n' && line[i+n] != '\0') - { - n++; - } - ccp = vtkParse_CacheString(info->Strings, &line[i], n); - vtkParse_AddStringToArray(&entry->Typedef->Dimensions, - &entry->Typedef->NumberOfDimensions, ccp); - if (ccp[0] >= '0' && ccp[0] <= '9') - { - entry->Typedef->Count *= (int)strtol(ccp, NULL, 0); - } - else - { - entry->Typedef->Count = 0; - } - i += n; - if (line[i] == ']') - { - i++; - } - } - i += skip_space(&line[i]); - - /* look for pointers (and const pointers) */ - bits = 0; - while (line[i] == '*' || strncmp(&line[i], "const*", 6) == 0) - { - bits = (bits << 2); - if (line[i] == '*') - { - bits = (bits | VTK_PARSE_POINTER); - } - else - { - bits = (bits | VTK_PARSE_CONST_POINTER); - i += 5; - } - bits = (bits & VTK_PARSE_POINTER_MASK); - i++; - i += skip_space(&line[i]); - } - - /* need to reverse to get correct pointer order */ - pointers = 0; - while (bits) - { - pointers = (pointers << 2); - pointers = (pointers | (bits & VTK_PARSE_POINTER_LOWMASK)); - bits = ((bits >> 2) & VTK_PARSE_POINTER_MASK); - } - - /* add pointer indirection to correspond to first array dimension */ - if (entry->Typedef->NumberOfDimensions > 1) - { - pointers = ((pointers << 2) | VTK_PARSE_ARRAY); - } - else if (entry->Typedef->NumberOfDimensions == 1) - { - pointers = ((pointers << 2) | VTK_PARSE_POINTER); - } - - /* include the pointers in the type */ - entry->Typedef->Type |= (pointers & VTK_PARSE_POINTER_MASK); - - /* read the base type (and const) */ - bits = 0; - i += vtkParse_BasicTypeFromString(&line[i], &bits, &ccp, &n); - entry->Typedef->Class = vtkParse_CacheString(info->Strings, ccp, n); - entry->Typedef->Type |= bits; - } - - /* get the header file */ - if (line[i] == ';') - { - i++; - i += skip_space(&line[i]); - n = 0; - while(line[i+n] != '\0' && line[i+n] != ';' && - !isspace(line[i+n])) { n++; }; - entry->HeaderFile = vtkParse_CacheString(info->Strings, &line[i], n); - - i += n; - i += skip_space(&line[i]); - - /* get the module */ - if (line[i] == ';') - { - i++; - i += skip_space(&line[i]); - n = 0; - while(line[i+n] != '\0' && line[i+n] != ';' && - !isspace(line[i+n])) { n++; }; - entry->Module = vtkParse_CacheString(info->Strings, &line[i], n); - - i += n; - i += skip_space(&line[i]); - } - - /* get all flags */ - while (line[i] == ';') - { - i++; - i += skip_space(&line[i]); - if (entry->NumberOfProperties == 0) - { - entry->Properties = (const char **)malloc(sizeof(char **)); - } - else - { - entry->Properties = (const char **)realloc( - (char **)entry->Properties, - (entry->NumberOfProperties+1)*sizeof(char **)); - } - n = 0; - while (line[i+n] != '\0' && line[i+n] != '\n' && line[i+n] != ';') - { n++; } - if (n && skip_space(&line[i]) != n) - { - entry->Properties[entry->NumberOfProperties++] = - vtkParse_CacheString(info->Strings, &line[i], n); - } - i += n; - } - } - } - - if (!feof(fp)) - { - vtkParseHierarchy_Free(info); - info = NULL; - } - - free(line); - - sort_hierarchy_entries(info); - - fclose(fp); - - return info; -} - -/* free a HierarchyInfo struct */ -void vtkParseHierarchy_Free(HierarchyInfo *info) -{ - HierarchyEntry *entry; - int i; - - for (i = 0; i < info->NumberOfEntries; i++) - { - entry = &info->Entries[i]; - if (entry->NumberOfTemplateParameters) - { - free((char **)entry->TemplateParameters); - free((char **)entry->TemplateDefaults); - } - if (entry->NumberOfSuperClasses) - { - free((char **)entry->SuperClasses); - free(entry->SuperClassIndex); - } - if (entry->NumberOfProperties) - { - free((char **)entry->Properties); - } - } - - free(info->Entries); - free(info); -} - - -/* Check whether class is derived from baseclass. You must supply - * the entry for the class (returned by FindEntry) as well as the - * classname. If the class is templated, the classname can include - * template args in angle brackets. If you provide a pointer for - * baseclass_with_args, then it will be used to return the name of - * name of the baseclass with template args in angle brackets. */ - -int vtkParseHierarchy_IsTypeOfTemplated( - const HierarchyInfo *info, - const HierarchyEntry *entry, const char *classname, - const char *baseclass, const char **baseclass_with_args) -{ - HierarchyEntry *tmph; - const char *name = NULL; - const char *supername; - char *tmp; - int templated; - int baseclass_is_template_parameter; - int supername_needs_free = 0; - int classname_needs_free = 0; - int i, j, k; - int nargs; - const char **args; - size_t m; - int iterating = 1; - int rval = 0; - - while (iterating) - { - iterating = 0; - templated = 0; - baseclass_is_template_parameter = 0; - nargs = 0; - args = NULL; - - /* if classname is the same as baseclass, done! */ - if (strcmp(entry->Name, baseclass) == 0) - { - if (baseclass_with_args) - { - if (!classname_needs_free) - { - tmp = (char *)malloc(strlen(classname) + 1); - strcpy(tmp, classname); - classname = tmp; - } - *baseclass_with_args = classname; - classname_needs_free = 0; - } - rval = 1; - break; - } - else if (entry->NumberOfSuperClasses == 0) - { - rval = 0; - break; - } - - /* if class is templated */ - if (entry->NumberOfTemplateParameters) - { - /* check for template args for classname */ - m = strlen(entry->Name); - if (classname[m] == '<') - { - templated = 1; - - nargs = entry->NumberOfTemplateParameters; - vtkParse_DecomposeTemplatedType(classname, &name, nargs, &args, - entry->TemplateDefaults); - } - } - - /* check all baseclasses */ - for (j = 0; j < entry->NumberOfSuperClasses && rval == 0; j++) - { - supername = entry->SuperClasses[j]; - - if (templated) - { - for (k = 0; k < entry->NumberOfTemplateParameters; k++) - { - /* check if the baseclass itself is a template parameter */ - m = strlen(entry->TemplateParameters[k]); - if (strncmp(entry->TemplateParameters[k], supername, m) == 0 && - !isalnum(supername[m]) && supername[m] != '_') - { - baseclass_is_template_parameter = 1; - break; - } - } - - /* use the class template args to find baseclass template args */ - supername = vtkParse_StringReplace( - supername, entry->NumberOfTemplateParameters, entry->TemplateParameters, args); - if (supername != entry->SuperClasses[j]) - { - supername_needs_free = 1; - } - } - - /* check the cached index for the baseclass entry */ - i = entry->SuperClassIndex[j]; - if (i == -1) - { - /* index was not set yet, so search for the entry */ - tmph = vtkParseHierarchy_FindEntry(info, supername); - while (tmph && tmph->IsTypedef) - { - if (tmph->Typedef->Class) - { - tmph = vtkParseHierarchy_FindEntry(info, tmph->Typedef->Class); - continue; - } - break; - } - - if (tmph) - { - i = (int)(tmph - info->Entries); - } - else - { - /* entry not found, don't try again */ - /* i = -2; messes things up for templates */ - /* fprintf(stderr, "not found \"%s\"\n", entry->SuperClasses[j]); */ - } - - /* if baseclass is a template parameter, its entry cannot be cached */ - if (!baseclass_is_template_parameter) - { - /* cache the position of the baseclass */ - ((HierarchyEntry *)entry)->SuperClassIndex[j] = i; - } - } - - /* if entry was found, continue down the chain */ - if (i >= 0) - { - if (classname_needs_free) - { - free((char *)classname); - } - classname = supername; - classname_needs_free = supername_needs_free; - supername_needs_free = 0; - - /* use the iteration loop instead of recursion */ - if (j+1 >= entry->NumberOfSuperClasses) - { - entry = &info->Entries[i]; - iterating = 1; - } - - /* recurse for multiple inheritance */ - else - { - rval = vtkParseHierarchy_IsTypeOfTemplated( - info, &info->Entries[i], classname, baseclass, - baseclass_with_args); - } - } - - if (supername_needs_free) - { - free((char *)supername); - supername_needs_free = 0; - } - - } /* end of loop over superclasses */ - - if (templated) - { - vtkParse_FreeTemplateDecomposition(name, nargs, args); - } - - } /* end of "while (iterating)" */ - - if (classname_needs_free) - { - free((char *)classname); - } - - if (baseclass_with_args && !rval) - { - *baseclass_with_args = NULL; - } - - return rval; -} - -int vtkParseHierarchy_IsTypeOf( - const HierarchyInfo *info, const HierarchyEntry *entry, - const char *baseclass) -{ - return vtkParseHierarchy_IsTypeOfTemplated( - info, entry, entry->Name, baseclass, NULL); -} - -/* Free args returned by IsTypeOfTemplated */ -void vtkParseHierarchy_FreeTemplateArgs(int n, const char *args[]) -{ - int i; - - for (i = 0; i < n; i++) - { - free((char *)args[i]); - } - - free((char **)args); -} - -/* Given a classname with template parameters, get the superclass name - * with corresponding template parameters. Returns null if 'i' is out - * of range, i.e. greater than or equal to the number of superclasses. - * The returned classname must be freed with "free()". */ -const char *vtkParseHierarchy_TemplatedSuperClass( - const HierarchyEntry *entry, const char *classname, int i) -{ - const char *supername = NULL; - const char *name; - const char **args; - char *cp; - size_t j; - - if (i < entry->NumberOfSuperClasses) - { - supername = entry->SuperClasses[i]; - j = vtkParse_IdentifierLength(classname); - - if (classname[j] == '<') - { - vtkParse_DecomposeTemplatedType(classname, &name, - entry->NumberOfTemplateParameters, &args, entry->TemplateDefaults); - supername = vtkParse_StringReplace(entry->SuperClasses[i], - entry->NumberOfTemplateParameters, entry->TemplateParameters, args); - vtkParse_FreeTemplateDecomposition( - name, entry->NumberOfTemplateParameters, args); - } - - if (supername == entry->SuperClasses[i]) - { - cp = (char *)malloc(strlen(supername) + 1); - strcpy(cp, supername); - supername = cp; - } - } - - return supername; -} - -/* get the specified property, or return NULL */ -const char *vtkParseHierarchy_GetProperty( - const HierarchyEntry *entry, const char *property) -{ - int i; - size_t k; - - if (entry) - { - for (i = 0; i < entry->NumberOfProperties; i++) - { - /* skip the property name, everything after is the property */ - k = vtkParse_NameLength(entry->Properties[i]); - if (k == strlen(property) && - strncmp(entry->Properties[i], property, k) == 0) - { - if (entry->Properties[i][k] == ' ' || - entry->Properties[i][k] == '=') { k++; } - return &entry->Properties[i][k]; - } - } - } - - return NULL; -} - -/* Expand all unrecognized types in a ValueInfo struct by - * using the typedefs in the HierarchyInfo struct. */ -int vtkParseHierarchy_ExpandTypedefsInValue( - const HierarchyInfo *info, ValueInfo *val, StringCache *cache, - const char *scope) -{ - char text[128]; - char *cp; - const char *newclass; - size_t n, m; - int i; - HierarchyEntry *entry; - int scope_needs_free = 0; - int result = 1; - - while (((val->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_OBJECT || - (val->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN) && - val->Class != 0) - { - entry = 0; - - /* search for the type in the provided scope */ - while (entry == 0 && scope != 0) - { - cp = text; - n = strlen(scope); - m = strlen(val->Class); - /* only malloc if more than 128 chars needed */ - if (n + m + 2 >= 128) - { - cp = (char *)malloc(n+m+3); - } - - /* scope the name */ - strncpy(cp, scope, n); - cp[n++] = ':'; - cp[n++] = ':'; - strncpy(&cp[n], val->Class, m); - cp[n+m] = '\0'; - - entry = vtkParseHierarchy_FindEntry(info, cp); - - if (cp != text) { free(cp); } - - /* if not found, try inherited scopes */ - if (entry == 0) - { - entry = vtkParseHierarchy_FindEntry(info, scope); - scope = 0; - scope_needs_free = 0; - if (entry && entry->NumberOfSuperClasses) - { - for (i = 0; i+1 < entry->NumberOfSuperClasses; i++) - { - if (scope_needs_free) { free((char *)scope); } - scope = vtkParseHierarchy_ExpandTypedefsInName( - info, entry->SuperClasses[i], NULL); - scope_needs_free = (scope != entry->SuperClasses[i]); - /* recurse if more than one superclass */ - if (vtkParseHierarchy_ExpandTypedefsInValue( - info, val, cache, scope)) - { - if (scope_needs_free) { free((char *)scope); } - return 1; - } - } - if (scope_needs_free) { free((char *)scope); } - scope = vtkParseHierarchy_ExpandTypedefsInName( - info, entry->SuperClasses[i], NULL); - scope_needs_free = (scope != entry->SuperClasses[i]); - } - entry = 0; - } - } - - /* if not found, try again with no scope */ - if (entry == 0) - { - entry = vtkParseHierarchy_FindEntry(info, val->Class); - } - - if (entry && entry->IsTypedef) - { - vtkParse_ExpandTypedef(val, entry->Typedef); - } - else if (entry) - { - newclass = vtkParseHierarchy_ExpandTypedefsInName( - info, val->Class, scope); - if (newclass != val->Class) - { - val->Class = vtkParse_CacheString(cache, newclass, strlen(newclass)); - free((char *)newclass); - } - result = 1; - break; - } - else - { - result = 0; - break; - } - } - - if (scope_needs_free) { free((char *)scope); } - - return result; -} - -/* Expand typedefs found in an expression stored as a string. - * The value of "text" will be returned if no expansion occurred, - * else a new string is returned that must be freed with "free()". */ -const char *vtkParseHierarchy_ExpandTypedefsInName( - const HierarchyInfo *info, const char *name, const char *scope) -{ - char text[128]; - char *cp; - size_t n, m; - const char *newname = name; - HierarchyEntry *entry = NULL; - - /* note: unlike ExpandTypedefsInValue, this does not yet recurse - * or look in superclass scopes */ - - /* doesn't yet handle names that are scoped or templated */ - m = vtkParse_IdentifierLength(name); - if (name[m] != '\0') - { - return name; - } - - if (scope) - { - cp = text; - n = strlen(scope); - m = strlen(name); - /* only malloc if more than 128 chars needed */ - if (n + m + 2 >= 128) - { - cp = (char *)malloc(n+m+3); - } - - /* scope the name */ - strncpy(cp, scope, n); - cp[n++] = ':'; - cp[n++] = ':'; - strncpy(&cp[n], name, m); - cp[n+m] = '\0'; - - entry = vtkParseHierarchy_FindEntry(info, cp); - - if (cp != text) { free(cp); } - } - - if (!entry) - { - entry = vtkParseHierarchy_FindEntry(info, name); - } - - newname = NULL; - if (entry && entry->IsTypedef && entry->Typedef->Class) - { - newname = entry->Typedef->Class; - } - if (newname) - { - cp = (char *)malloc(strlen(newname) + 1); - strcpy(cp, newname); - name = cp; - } - - return name; -} diff --git a/src/VTKWrapping/ParaView/vtkParseHierarchy.h b/src/VTKWrapping/ParaView/vtkParseHierarchy.h deleted file mode 100644 index 876702c1..00000000 --- a/src/VTKWrapping/ParaView/vtkParseHierarchy.h +++ /dev/null @@ -1,159 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseHierarchy.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in June 2010 - under the terms of the Visualization Toolkit 2008 copyright. ---------------------------------------------------------------------------*/ - -/** - This file contains utility functions for loading and parsing - a VTK hierarchy file. The file contains entries like the - following (one per line in the file): - - classname [ : superclass ] ; header.h ; vtkKit [; flags] - - For each typedef, the output file will have a line like this: - - name = &[2][3]* const type ; header.h ; vtkKit [; flags] - - For each enum, the output file will have: - - enumname : enum ; header.h ; vtkKit [; flags] - -*/ - -#ifndef VTK_PARSE_HIERARCHY_H -#define VTK_PARSE_HIERARCHY_H - -/* Need the ValueInfo struct for typedefs */ -#include "vtkParseData.h" - -/** - * One entry from the hierarchy file. - * It contains a class name, the superclasses, and the header file. - */ -typedef struct _HierarchyEntry -{ - const char *Name; /* the class or type name */ - const char *HeaderFile; /* header file the class is defined in */ - const char *Module; /* library the class is defined in */ - int NumberOfTemplateParameters; /* number of template params */ - const char **TemplateParameters; - const char **TemplateDefaults; - int NumberOfProperties; /* number of properties */ - const char **Properties; - int NumberOfSuperClasses; /* number of superclasses */ - const char **SuperClasses; - int *SuperClassIndex; /* for internal use only */ - ValueInfo *Typedef; /* for typedefs */ - int IsEnum; /* this entry is for an enum type */ - int IsTypedef; /* this entry is for a typedef */ -} HierarchyEntry; - -/** - * All the entries from a hierarchy file. - */ -typedef struct _HierarchyInfo -{ - int NumberOfEntries; - HierarchyEntry *Entries; - StringCache *Strings; -} HierarchyInfo; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Read a hierarchy file into a HeirarchyInfo struct, or return NULL - */ -HierarchyInfo *vtkParseHierarchy_ReadFile(const char *filename); - -/** - * Free a HierarchyInfo struct - */ -void vtkParseHierarchy_Free(HierarchyInfo *info); - -/** - * Return the entry for a class or type, or null if not found - */ -HierarchyEntry *vtkParseHierarchy_FindEntry( - const HierarchyInfo *info, const char *classname); - -/** - * Get properties for the class. Returns NULL if the property - * is not set, and returns either an empty string or a value string - * if the property is set. The properties supported are as follows: - * "WRAP_EXCLUDE", "WRAP_SPECIAL", and "ABSTRACT" - */ -const char *vtkParseHierarchy_GetProperty( - const HierarchyEntry *entry, const char *property); - -/** - * Check whether class is derived from baseclass. - */ -int vtkParseHierarchy_IsTypeOf(const HierarchyInfo *info, - const HierarchyEntry *entry, const char *baseclass); - -/** - * Check whether class is derived from baseclass. You must supply - * the entry for the class (returned by FindEntry) as well as the - * classname. The classname can include template args in angle brackets. - * The baseclass_with_args parameter, if not set to NULL, will be used - * to return the name of base class with the template args in angle - * brackets that classname was derived from. If not set to NULL, - * this should be freed with free() to avoid a memory leak. - */ -int vtkParseHierarchy_IsTypeOfTemplated(const HierarchyInfo *info, - const HierarchyEntry *entry, const char *classname, - const char *baseclass, const char **baseclass_with_args); - -/** - * Free the template args returned by IsTypeOfTemplated - */ -void vtkParseHierarchy_FreeTemplateArgs(int n, const char *args[]); - -/** - * Given a classname with template parameters, get the superclass name - * with corresponding template parameters. Returns null if 'i' is out - * of range, i.e. greater than or equal to the number of superclasses. - * The returned classname must be freed with "free()". - */ -const char *vtkParseHierarchy_TemplatedSuperClass( - const HierarchyEntry *entry, const char *classname, int i); - -/** - * Expand all unrecognized types in a ValueInfo struct by - * using the typedefs in the HierarchyInfo struct. - */ -int vtkParseHierarchy_ExpandTypedefsInValue( - const HierarchyInfo *info, ValueInfo *data, StringCache *cache, - const char *scope); - -/** - * Expand typedefs found in a name stored as a string. The value - * of "text" will be returned if no expansion occurred, else a new - * string is returned that must be freed with "free()". - */ -const char *vtkParseHierarchy_ExpandTypedefsInName( - const HierarchyInfo *info, const char *text, const char *scope); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/VTKWrapping/ParaView/vtkParseMain.c b/src/VTKWrapping/ParaView/vtkParseMain.c deleted file mode 100644 index 96fa88c1..00000000 --- a/src/VTKWrapping/ParaView/vtkParseMain.c +++ /dev/null @@ -1,514 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseMain.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -/* - -This file provides a unified front-end for the wrapper generators. - -*/ - -#include "vtkParse.h" -#include "vtkParseData.h" -#include "vtkParseMain.h" -#include -#include -#include -#include - -/* This is the struct that contains the options */ -OptionInfo options; - -/* Get the base filename */ -static const char *parse_exename(const char *cmd) -{ - const char *exename; - - /* remove directory part of exe name */ - for (exename = cmd + strlen(cmd); exename > cmd; --exename) - { - char pc = exename[-1]; - if (pc == ':' || pc == '/' || pc == '\\') - { - break; - } - } - - return exename; -} - -/* Print the help */ -static void parse_print_help(FILE *fp, const char *cmd, int multi) -{ - fprintf(fp, - "Usage: %s [options] infile... \n" - " --help print this help message\n" - " --version print the VTK version\n" - " -o the output file\n" - " -I add an include directory\n" - " -D define a preprocessor macro\n" - " -U undefine a preprocessor macro\n" - " @ read arguments from a file\n", - parse_exename(cmd)); - - /* args for describing a singe header file input */ - if (!multi) - { - fprintf(fp, - " --hints the hints file to use\n" - " --types the type hierarchy file to use\n" - " --concrete force concrete class (ignored, deprecated)\n" - " --abstract force abstract class (ignored, deprecated)\n" - " --vtkobject vtkObjectBase-derived class (ignored, deprecated)\n" - " --special non-vtkObjectBase class (ignored, deprecated)\n"); - } -} - -/* append an arg to the arglist */ -static void parse_append_arg(int *argn, char ***args, char *arg) -{ - /* if argn is a power of two, allocate more space */ - if (*argn > 0 && (*argn & (*argn - 1)) == 0) - { - *args = (char **)realloc(*args, 2*(*argn)*sizeof(char *)); - } - /* append argument to list */ - (*args)[*argn] = arg; - (*argn)++; -} - -/* read options from a file, return zero on error */ -static int read_option_file( - StringCache *strings, const char *filename, int *argn, char ***args) -{ - static int option_file_stack_max = 10; - static int option_file_stack_size = 0; - static const char *option_file_stack[10]; - FILE *fp; - char *line; - const char *ccp; - char *argstring; - char *arg; - size_t maxlen = 15; - size_t i, n; - int j; - int in_string; - - fp = fopen(filename, "r"); - - if (fp == NULL) - { - return 0; - } - - line = (char *)malloc(maxlen); - - /* read the file line by line */ - while (fgets(line, (int)maxlen, fp)) - { - n = strlen(line); - - /* if buffer not long enough, increase it */ - while (n == maxlen-1 && line[n-1] != '\n' && !feof(fp)) - { - maxlen *= 2; - line = (char *)realloc(line, maxlen); - if (!fgets(&line[n], (int)(maxlen-n), fp)) { break; } - n += strlen(&line[n]); - } - - /* allocate a string to hold the parsed arguments */ - argstring = vtkParse_NewString(strings, n); - arg = argstring; - i = 0; - - /* break the line into individual options */ - ccp = line; - in_string = 0; - while (*ccp != '\0') - { - for (;;) - { - if (*ccp == '\\') - { - ccp++; - } - else if (*ccp == '\"' || *ccp == '\'') - { - if (!in_string) - { - in_string = *ccp++; - continue; - } - else if (*ccp == in_string) - { - in_string = 0; - ccp++; - continue; - } - } - else if (!in_string && isspace(*ccp)) - { - do { ccp++; } while (isspace(*ccp)); - break; - } - if (*ccp == '\0') - { - break; - } - /* append character to argument */ - arg[i++] = *ccp++; - } - arg[i++] = '\0'; - - if (arg[0] == '@') - { - /* recursively expand '@file' option */ - if (option_file_stack_size == option_file_stack_max) - { - fprintf(stderr, "%s: @file recursion is too deep.\n", - (*args)[0]); - exit(1); - } - /* avoid reading the same file recursively */ - option_file_stack[option_file_stack_size++] = filename; - for (j = 0; j < option_file_stack_size; j++) - { - if (strcmp(&arg[1], option_file_stack[j]) == 0) - { - break; - } - } - if (j < option_file_stack_size) - { - parse_append_arg(argn, args, arg); - } - else if (read_option_file(strings, &arg[1], argn, args) == 0) - { - parse_append_arg(argn, args, arg); - } - option_file_stack_size--; - } - else if (arg[0] != '\0') - { - parse_append_arg(argn, args, arg); - } - /* prepare for next arg */ - arg += i; - i = 0; - } - } - - return 1; -} - -/* expand any "@file" args that occur in the command-line args */ -static void parse_expand_args( - StringCache *strings, int argc, char *argv[], int *argn, char ***args) -{ - int i; - - *argn = 0; - *args = (char **)malloc(sizeof(char *)); - - for (i = 0; i < argc; i++) - { - /* check for "@file" unless this is the command name */ - if (i > 0 || argv[i][0] == '@') - { - /* if read_option_file returns null, add "@file" to the args */ - /* (this mimics the way that gcc expands @file arguments) */ - if (read_option_file(strings, &argv[i][1], argn, args) == 0) - { - parse_append_arg(argn, args, argv[i]); - } - } - else - { - /* append any other arg */ - parse_append_arg(argn, args, argv[i]); - } - } -} - -/* Check the options: "multi" should be zero for wrapper tools that - * only take one input file, or one for wrapper tools that take multiple - * input files. Returns zero for "--version" or "--help", or returns -1 - * if an error occurred. Otherwise, it returns the number of args - * that were successfully parsed. */ -static int parse_check_options(int argc, char *argv[], int multi) -{ - int i; - size_t j; - char *cp; - char c; - - options.NumberOfFiles = 0; - options.Files = NULL; - options.InputFileName = NULL; - options.OutputFileName = NULL; - options.HierarchyFileName = 0; - options.HintFileName = 0; - - for (i = 1; i < argc; i++) - { - if (strcmp(argv[i], "--help") == 0) - { - parse_print_help(stdout, argv[0], multi); - return 0; - } - else if (strcmp(argv[i], "--version") == 0) - { - const char *ver = VTK_PARSE_VERSION; - fprintf(stdout, "%s %s\n", parse_exename(argv[0]), ver); - return 0; - } - else if (argv[i][0] != '-') - { - if (options.NumberOfFiles == 0) - { - options.Files = (char **)malloc(sizeof(char *)); - } - else if ((options.NumberOfFiles & (options.NumberOfFiles - 1)) == 0) - { - options.Files = (char **)realloc( - options.Files, 2*options.NumberOfFiles*sizeof(char *)); - } - options.Files[options.NumberOfFiles++] = argv[i]; - } - else if (argv[i][0] == '-' && isalpha(argv[i][1])) - { - c = argv[i][1]; - cp = &argv[i][2]; - if (*cp == '\0') - { - i++; - if (i >= argc || argv[i][0] == '-') - { - return -1; - } - cp = argv[i]; - } - - if (c == 'o') - { - options.OutputFileName = cp; - } - else if (c == 'I') - { - vtkParse_IncludeDirectory(cp); - } - else if (c == 'D') - { - j = 0; - while (cp[j] != '\0' && cp[j] != '=') { j++; } - if (cp[j] == '=') { j++; } - vtkParse_DefineMacro(cp, &cp[j]); - } - else if (c == 'U') - { - vtkParse_UndefineMacro(cp); - } - } - else if (!multi && strcmp(argv[i], "--hints") == 0) - { - i++; - if (i >= argc || argv[i][0] == '-') - { - return -1; - } - options.HintFileName = argv[i]; - } - else if (!multi && strcmp(argv[i], "--types") == 0) - { - i++; - if (i >= argc || argv[i][0] == '-') - { - return -1; - } - options.HierarchyFileName = argv[i]; - } - else if (strcmp(argv[i], "--vtkobject") == 0 || - strcmp(argv[i], "--special") == 0 || - strcmp(argv[i], "--abstract") == 0 || - strcmp(argv[i], "--concrete") == 0) - { - fprintf(stderr, "Warning: the %s option is deprecated " - "and will be ignored.\n", argv[i]); - } - } - - return i; -} - -/* Return a pointer to the static OptionInfo struct */ -OptionInfo *vtkParse_GetCommandLineOptions() -{ - return &options; -} - -/* Command-line argument handler for wrapper tools */ -FileInfo *vtkParse_Main(int argc, char *argv[]) -{ - int argi; - int expected_files; - FILE *ifile; - FILE *hfile = 0; - FileInfo *data; - StringCache strings; - int argn; - char **args; - - /* set the command name for diagnostics */ - vtkParse_SetCommandName(parse_exename(argv[0])); - - /* expand any "@file" args */ - vtkParse_InitStringCache(&strings); - parse_expand_args(&strings, argc, argv, &argn, &args); - - /* read the args into the static OptionInfo struct */ - argi = parse_check_options(argn, args, 0); - - /* was output file already specified by the "-o" option? */ - expected_files = (options.OutputFileName == NULL ? 2 : 1); - - /* verify number of args, print usage if not valid */ - if (argi == 0) - { - free(args); - exit(0); - } - else if (argi < 0 || options.NumberOfFiles != expected_files) - { - parse_print_help(stderr, args[0], 0); - exit(1); - } - - /* open the input file */ - options.InputFileName = options.Files[0]; - - if (!(ifile = fopen(options.InputFileName, "r"))) - { - fprintf(stderr, "Error opening input file %s\n", options.InputFileName); - exit(1); - } - - if (options.OutputFileName == NULL && - options.NumberOfFiles > 1) - { - /* allow outfile to be given after infile, if "-o" option not used */ - options.OutputFileName = options.Files[1]; - fprintf(stderr, "Deprecated: specify output file with \"-o\".\n"); - } - - /* free the expanded args */ - free(args); - - /* open the hint file, if given on the command line */ - if (options.HintFileName && options.HintFileName[0] != '\0') - { - if (!(hfile = fopen(options.HintFileName, "r"))) - { - fprintf(stderr, "Error opening hint file %s\n", options.HintFileName); - fclose(ifile); - exit(1); - } - } - - /* make sure than an output file was given on the command line */ - if (options.OutputFileName == NULL) - { - fprintf(stderr, "No output file was specified\n"); - fclose(ifile); - if (hfile) - { - fclose(hfile); - } - exit(1); - } - - /* if a hierarchy is was given, then BTX/ETX can be ignored */ - vtkParse_SetIgnoreBTX(0); - if (options.HierarchyFileName) - { - vtkParse_SetIgnoreBTX(1); - } - - /* parse the input file */ - data = vtkParse_ParseFile(options.InputFileName, ifile, stderr); - - if (!data) - { - exit(1); - } - - /* fill in some blanks by using the hints file */ - if (hfile) - { - vtkParse_ReadHints(data, hfile, stderr); - } - - if (data->MainClass) - { - /* mark class as abstract unless it has New() method */ - int nfunc = data->MainClass->NumberOfFunctions; - int ifunc; - for (ifunc = 0; ifunc < nfunc; ifunc++) - { - FunctionInfo *func = data->MainClass->Functions[ifunc]; - if (func && func->Access == VTK_ACCESS_PUBLIC && - func->Name && strcmp(func->Name, "New") == 0 && - func->NumberOfParameters == 0) - { - break; - } - } - data->MainClass->IsAbstract = ((ifunc == nfunc) ? 1 : 0); - } - - return data; -} - -/* Command-line argument handler for wrapper tools */ -void vtkParse_MainMulti(int argc, char *argv[]) -{ - int argi; - int argn; - char **args; - StringCache strings; - - /* set the command name for diagnostics */ - vtkParse_SetCommandName(parse_exename(argv[0])); - - /* expand any "@file" args */ - vtkParse_InitStringCache(&strings); - parse_expand_args(&strings, argc, argv, &argn, &args); - - /* read the args into the static OptionInfo struct */ - argi = parse_check_options(argn, args, 1); - free(args); - - if (argi == 0) - { - exit(0); - } - else if (argi < 0 || options.NumberOfFiles == 0) - { - parse_print_help(stderr, argv[0], 1); - exit(1); - } - - /* the input file */ - options.InputFileName = options.Files[0]; -} diff --git a/src/VTKWrapping/ParaView/vtkParseMain.h b/src/VTKWrapping/ParaView/vtkParseMain.h deleted file mode 100644 index 6bf6f406..00000000 --- a/src/VTKWrapping/ParaView/vtkParseMain.h +++ /dev/null @@ -1,86 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseMain.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -/** - vtkParseMain.h provides argument parsing for the wrapper executables. - - Usage: vtkWrap [options] infile ... - - -D add a macro definition - -U cancel a macro definition - -I add an include directory - -o specify the output file - @ read arguments from a file - --help print a help message and exit - --version print the VTK version number and exit - --hints hints file - --types type hierarchy file - - Notes: - - 1) The "-o" option is needed when there are multiple input files. - Otherwise, the output file can be given after the input file. - - 2) The "@file" option allows arguments to be stored in a file, - instead of given on the command line. The use of such a file - is sometimes necessary to avoid overflowing the 8191-character - command-line limit on Windows. If the file is not found, then - "@file" will be passed as as a command-line parameter. -*/ - -#ifndef VTK_PARSE_MAIN_H -#define VTK_PARSE_MAIN_H - -#include "vtkParseData.h" -#include - -/** - * Options for the wrappers - */ -typedef struct _OptionInfo -{ - int NumberOfFiles; /* the total number of file arguments */ - char **Files; /* all of the file arguments */ - char *InputFileName; /* the first file argument */ - char *OutputFileName; /* the second file, or the "-o" file */ - char *HintFileName; /* the file preceded by "--hints" */ - char *HierarchyFileName; /* the file preceded by "--types" */ -} OptionInfo; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Return the options provided on the command line - */ -OptionInfo *vtkParse_GetCommandLineOptions(); - -/** - * The main function, parses the file and returns the result. - */ -FileInfo *vtkParse_Main(int argc, char *argv[]); - -/** - * A main function that can take multiple input files. - * It does not parse the files. It will exit on error. - */ -void vtkParse_MainMulti(int argc, char *argv[]); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/VTKWrapping/ParaView/vtkParsePreprocess.c b/src/VTKWrapping/ParaView/vtkParsePreprocess.c deleted file mode 100644 index deb3efcc..00000000 --- a/src/VTKWrapping/ParaView/vtkParsePreprocess.c +++ /dev/null @@ -1,3118 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParsePreprocess.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in June 2010 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -#include "vtkParsePreprocess.h" -#include -#include -#include -#include -#include - -/** - This file handles preprocessor directives via a simple - recursive-descent parser that only evaluates integers. -*/ - -#define PREPROC_DEBUG 0 - -/** Block size for reading files */ -#define FILE_BUFFER_SIZE 8192 - -/** Size of hash table must be a power of two */ -#define PREPROC_HASH_TABLE_SIZE 1024u - -/** Hashes for preprocessor keywords */ -#define HASH_IFDEF 0x0fa4b283u -#define HASH_IFNDEF 0x04407ab1u -#define HASH_IF 0x00597834u -#define HASH_ELIF 0x7c964b25u -#define HASH_ELSE 0x7c964c6eu -#define HASH_ENDIF 0x0f60b40bu -#define HASH_DEFINED 0x088998d4u -#define HASH_DEFINE 0xf8804a70u -#define HASH_UNDEF 0x10823b97u -#define HASH_INCLUDE 0x9e36af89u -#define HASH_ERROR 0x0f6321efu -#define HASH_LINE 0x7c9a15adu -#define HASH_PRAGMA 0x1566a9fdu - -/** Extend dynamic arrays in a progression of powers of two. - * Whenever "n" reaches a power of two, then the array size is - * doubled so that "n" can be safely incremented. */ -static void *preproc_array_check( - void *arraymem, size_t size, int n) -{ - /* if empty, alloc for the first time */ - if (n == 0) - { - return malloc(size); - } - /* if count is power of two, reallocate with double size */ - else if ((n & (n-1)) == 0) - { - return realloc(arraymem, (n << 1)*size); - } - - /* no reallocation, just return the original array */ - return arraymem; -} - -/** Convert string to int. */ -static preproc_int_t string_to_preproc_int(const char *cp, int base) -{ -#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) - return _strtoi64(cp, NULL, base); -#else - return strtoll(cp, NULL, base); -#endif -} - -/** Convert string to unsigned int. */ -static preproc_uint_t string_to_preproc_uint(const char *cp, int base) -{ -#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) - return _strtoui64(cp, NULL, base); -#else - return strtoull(cp, NULL, base); -#endif -} - -/** Tokenize and compare two strings */ -static int preproc_identical(const char *text1, const char *text2) -{ - int result = 1; - - if (text1 != text2) - { - result = 0; - - if (text1 && text2) - { - StringTokenizer t1; - StringTokenizer t2; - - vtkParse_InitTokenizer(&t1, text1, WS_PREPROC); - vtkParse_InitTokenizer(&t2, text2, WS_PREPROC); - - do - { - if (t1.tok != t2.tok || - t1.hash != t2.hash || - t1.len != t2.len || - strncmp(t1.text, t2.text, t1.len) != 0) - { - break; - } - vtkParse_NextToken(&t1); - vtkParse_NextToken(&t2); - } - while (t1.tok && t2.tok); - - result = (t1.tok == 0 && t2.tok == 0); - } - } - - return result; -} - -/** Create a new preprocessor macro. */ -static MacroInfo *preproc_new_macro( - PreprocessInfo *info, const char *name, const char *definition) -{ - MacroInfo *macro = (MacroInfo *)malloc(sizeof(MacroInfo)); - vtkParsePreprocess_InitMacro(macro); - - if (name) - { - size_t n = vtkParse_SkipId(name); - macro->Name = vtkParse_CacheString(info->Strings, name, n); - } - - if (definition) - { - size_t n; - const char *cp = definition; - StringTokenizer tokens; - vtkParse_InitTokenizer(&tokens, cp, WS_PREPROC); - - do - { - cp = tokens.text + tokens.len; - } - while (vtkParse_NextToken(&tokens)); - - n = cp - definition; - macro->Definition = vtkParse_CacheString(info->Strings, definition, n); - } - - macro->IsExternal = info->IsExternal; - - return macro; -} - -/** Free a preprocessor macro struct. */ -static void preproc_free_macro(MacroInfo *info) -{ - free(info); -} - -/** Find a preprocessor macro, return 0 if not found. */ -static MacroInfo *preproc_find_macro( - PreprocessInfo *info, StringTokenizer *token) -{ - unsigned int m = PREPROC_HASH_TABLE_SIZE - 1; - unsigned int i = (token->hash & m); - const char *name = token->text; - size_t l = token->len; - MacroInfo ***htable = info->MacroHashTable; - MacroInfo **hptr; - const char *mname; - - if (htable && ((hptr = htable[i]) != NULL) && *hptr) - { - do - { - mname = (*hptr)->Name; - if (mname[0] == name[0] && - strncmp(mname, name, l) == 0 && - mname[l] == '\0') - { - return *hptr; - } - hptr++; - } - while (*hptr); - } - - return NULL; -} - -/** Return the address of the macro within the hash table. - * If "insert" is nonzero, add a new location if macro not found. */ -static MacroInfo **preproc_macro_location( - PreprocessInfo *info, StringTokenizer *token, int insert) -{ - MacroInfo ***htable = info->MacroHashTable; - unsigned int m = PREPROC_HASH_TABLE_SIZE - 1; - unsigned int i = (token->hash & m); - const char *name = token->text; - size_t l = token->len; - size_t n; - MacroInfo **hptr; - const char *mname; - - if (htable == NULL) - { - if (!insert) - { - return NULL; - } - - m = PREPROC_HASH_TABLE_SIZE; - htable = (MacroInfo ***)malloc(m*sizeof(MacroInfo **)); - info->MacroHashTable = htable; - do { *htable++ = NULL; } while (--m); - htable = info->MacroHashTable; - } - - hptr = htable[i]; - - if (hptr == NULL) - { - if (!insert) - { - return NULL; - } - - hptr = (MacroInfo **)malloc(2*sizeof(MacroInfo *)); - hptr[0] = NULL; - hptr[1] = NULL; - htable[i] = hptr; - } - else if (*hptr) - { - /* see if macro is already there */ - n = 0; - do - { - mname = (*hptr)->Name; - if (mname[0] == name[0] && - strncmp(mname, name, l) == 0 && - mname[l] == '\0') - { - break; - } - n++; - hptr++; - } - while (*hptr); - - if (*hptr == NULL) - { - if (!insert) - { - return NULL; - } - - /* if n+1 is a power of two, double allocated space */ - if (n > 0 && (n & (n+1)) == 0) - { - hptr = htable[i]; - hptr = (MacroInfo **)realloc(hptr, (2*(n+1))*sizeof(MacroInfo *)); - htable[i] = hptr; - hptr += n; - } - - /* add a terminating null */ - hptr[1] = NULL; - } - } - - return hptr; -} - -/** Remove a preprocessor macro. Returns 0 if macro not found. */ -static int preproc_remove_macro( - PreprocessInfo *info, StringTokenizer *token) -{ - MacroInfo **hptr; - - hptr = preproc_macro_location(info, token, 0); - - if (hptr && *hptr) - { - preproc_free_macro(*hptr); - - do - { - hptr[0] = hptr[1]; - hptr++; - } - while (*hptr); - - return 1; - } - - return 0; -} - -/** A simple way to add a preprocessor macro definition. */ -static MacroInfo *preproc_add_macro_definition( - PreprocessInfo *info, const char *name, const char *definition) -{ - StringTokenizer token; - MacroInfo *macro; - MacroInfo **macro_p; - - vtkParse_InitTokenizer(&token, name, WS_PREPROC); - - macro = preproc_new_macro(info, name, definition); - macro_p = preproc_macro_location(info, &token, 1); -#if PREPROC_DEBUG - if (*macro_p) - { - fprintf(stderr, "duplicate macro definition %s\n", name); - } -#endif - *macro_p = macro; - - return macro; -} - -/** Skip over parentheses, return nonzero if not closed. */ -static int preproc_skip_parentheses(StringTokenizer *tokens) -{ - int depth = 0; - - if (tokens->tok == '(') - { - depth = 1; - - while (depth > 0 && vtkParse_NextToken(tokens)) - { - if (tokens->tok == '(') - { - depth++; - } - else if (tokens->tok == ')') - { - depth--; - } - } - } - - if (tokens->tok == ')') - { - vtkParse_NextToken(tokens); - return VTK_PARSE_OK; - } - -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; -} - - -/** Evaluate a char literal to an integer value. */ -static int preproc_evaluate_char( - const char *cp, preproc_int_t *val, int *is_unsigned) -{ - if (cp[0] == '\'') - { - cp++; - if (*cp != '\\') - { - *val = *cp; - } - else if (*cp != '\'' && *cp != '\n' && *cp != '\0') - { - cp++; - if (*cp == 'a') { *val = '\a'; } - else if (*cp == 'b') { *val = '\b'; } - else if (*cp == 'f') { *val = '\f'; } - else if (*cp == 'n') { *val = '\n'; } - else if (*cp == 'r') { *val = '\r'; } - else if (*cp == 'b') { *val = '\b'; } - else if (*cp == 't') { *val = '\t'; } - else if (*cp == 'v') { *val = '\v'; } - else if (*cp == '\'') { *val = '\''; } - else if (*cp == '\"') { *val = '\"'; } - else if (*cp == '\\') { *val = '\\'; } - else if (*cp == '\?') { *val = '\?'; } - else if (*cp == '0') - { - *val = string_to_preproc_int(cp, 8); - do { cp++; } while (*cp >= '0' && *cp <= '7'); - } - else if (*cp == 'x') - { - *val = string_to_preproc_int(cp+1, 16); - do { cp++; } while (vtkParse_CharType(*cp, CPRE_HEX)); - } - } - if (*cp != '\'') - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - cp++; - *is_unsigned = 0; - return VTK_PARSE_OK; - } - -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; -} - -/* Evaluate an integer, ignoring any suffixes except 'u'. */ -static int preproc_evaluate_integer( - const char *cp, preproc_int_t *val, int *is_unsigned) -{ - const char *ep; - int base = 0; - ep = cp; - - if (cp[0] == '0' && (cp[1] == 'x' || cp[1] == 'X')) - { - cp += 2; - base = 16; - *is_unsigned = 1; - ep = cp; - while (vtkParse_CharType(*ep, CPRE_HEX)) - { - ep++; - } - } - else if (cp[0] == '0' && vtkParse_CharType(cp[1], CPRE_DIGIT)) - { - cp += 1; - base = 8; - *is_unsigned = 1; - ep = cp; - while (*ep >= '0' && *ep <= '7') - { - ep++; - } - } - else - { - base = 10; - *is_unsigned = 0; - while (vtkParse_CharType(*ep, CPRE_DIGIT)) - { - ep++; - } - } - - for (;;) - { - if (ep[0] == 'i' && ep[1] == '6' && ep[2] == '4') { ep += 3; } - else if (*ep == 'u') { *is_unsigned = 1; ep++; } - else if (*ep == 'l' || *ep == 'L') { ep++; } - else { break; } - } - - if (*is_unsigned) - { - *val = (preproc_int_t)string_to_preproc_uint(cp, base); - } - else - { - *val = string_to_preproc_int(cp, base); - } - - if (*ep == '.' || *ep == 'e' || *ep == 'E') - { - return VTK_PARSE_PREPROC_DOUBLE; - } - - return VTK_PARSE_OK; -} - -/* forward declaration */ -static int preproc_evaluate_expression( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned); - -/** Evaluate a single item in an expression. */ -static int preproc_evaluate_single( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int result = VTK_PARSE_OK; - - while (tokens->tok == TOK_ID) - { - /* handle the "defined" keyword */ - if (tokens->hash == HASH_DEFINED && tokens->len == 7 && - strncmp("defined", tokens->text, tokens->len) == 0) - { - int paren = 0; - vtkParse_NextToken(tokens); - - if (tokens->tok == '(') - { - paren = 1; - vtkParse_NextToken(tokens); - } - if (tokens->tok != TOK_ID) - { - *val = 0; - *is_unsigned = 0; -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - - /* do the name lookup */ - *is_unsigned = 0; - *val = (preproc_find_macro(info, tokens) != 0); - - vtkParse_NextToken(tokens); - if (paren) - { - if (tokens->tok != ')') - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - vtkParse_NextToken(tokens); - } - - return result; - } - else - { - /* look up and evaluate the macro */ - MacroInfo *macro = preproc_find_macro(info, tokens); - const char *args = NULL; - const char *expansion = NULL; - const char *cp; - vtkParse_NextToken(tokens); - *val = 0; - *is_unsigned = 0; - - if (macro == NULL || macro->IsExcluded) - { - return VTK_PARSE_MACRO_UNDEFINED; - } - else if (macro->IsFunction) - { - /* expand function macros using the arguments */ - args = tokens->text; - if (tokens->tok != '(' || - preproc_skip_parentheses(tokens) != VTK_PARSE_OK) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - } - expansion = vtkParsePreprocess_ExpandMacro(info, macro, args); - if (expansion == NULL) - { - free((char *)args); -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return (args ? VTK_PARSE_MACRO_NUMARGS : VTK_PARSE_SYNTAX_ERROR); - } - cp = expansion; - cp += vtkParse_SkipWhitespace(cp, WS_PREPROC); - if (*cp != '\0') - { - macro->IsExcluded = 1; - result = vtkParsePreprocess_EvaluateExpression( - info, expansion, val, is_unsigned); - macro->IsExcluded = 0; - vtkParsePreprocess_FreeMacroExpansion( - info, macro, expansion); - return result; - } - vtkParsePreprocess_FreeMacroExpansion(info, macro, expansion); - } - /* if macro expansion was empty, continue */ - } - - if (tokens->tok == '(') - { - vtkParse_NextToken(tokens); - result = preproc_evaluate_expression(info, tokens, val, is_unsigned); - if ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok == ')') - { - vtkParse_NextToken(tokens); - return result; - } -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - return result; - } - else if (tokens->tok == TOK_NUMBER) - { - result = preproc_evaluate_integer(tokens->text, val, is_unsigned); - if (tokens->text[tokens->len-1] == 'f' || - tokens->text[tokens->len-1] == 'F') - { - result = VTK_PARSE_PREPROC_FLOAT; - } - vtkParse_NextToken(tokens); - return result; - } - else if (tokens->tok == TOK_CHAR) - { - result = preproc_evaluate_char(tokens->text, val, is_unsigned); - vtkParse_NextToken(tokens); - return result; - } - else if (tokens->tok == TOK_STRING) - { - *val = 0; - *is_unsigned = 0; - vtkParse_NextToken(tokens); - while (tokens->tok == TOK_STRING) - { - vtkParse_NextToken(tokens); - } - return VTK_PARSE_PREPROC_STRING; - } - - *val = 0; - *is_unsigned = 0; -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d \"%*.*s\"\n", __LINE__, - (int)tokens->len, (int)tokens->len, tokens->text); -#endif - return VTK_PARSE_SYNTAX_ERROR; -} - -static int preproc_evaluate_unary( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int op = tokens->tok; - int result = VTK_PARSE_OK; - - if (op != '+' && op != '-' && op != '~' && op != '!') - { - return preproc_evaluate_single(info, tokens, val, is_unsigned); - } - - vtkParse_NextToken(tokens); - - result = preproc_evaluate_unary(info, tokens, val, is_unsigned); - if ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (op == '~') { *val = ~(*val); } - else if (op == '!') { *val = !(*val); *is_unsigned = 0; } - else if (op == '-') { *val = -(*val); } - return result; - } - - return result; -} - -static int preproc_evaluate_multiply( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int op; - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_unary(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - op = tokens->tok; - if (op != '*' && op != '/' && op != '%') - { - return result; - } - - vtkParse_NextToken(tokens); - - result = preproc_evaluate_unary(info, tokens, &rval, &rtype); - - *is_unsigned = (*is_unsigned || rtype); - - if (*is_unsigned) - { - if (op == '*') - { - *val = (preproc_int_t)((preproc_uint_t)*val * - (preproc_uint_t)rval); - } - else if (op == '/') - { - if (rval != 0) - { - *val = (preproc_int_t)((preproc_uint_t)*val / - (preproc_uint_t)rval); - } - else - { - *val = 2147483647; - } - } - else if (op == '%') - { - if (rval != 0) - { - *val = (preproc_int_t)((preproc_uint_t)*val % - (preproc_uint_t)rval); - } - else - { - *val = 2147483647; - } - } - } - else - { - if (op == '*') - { - *val = *val * rval; - } - else if (op == '/') - { - if (rval != 0) - { - *val = *val / rval; - } - else if (*val < 0) - { - *val = -2147483647; - } - else - { - *val = 2147483647; - } - } - else if (op == '%') - { - if (rval != 0) - { - *val = *val % rval; - } - else if (*val < 0) - { - *val = -2147483647; - } - else - { - *val = 2147483647; - } - } - } - } - - return result; -} - -static int preproc_evaluate_add( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int op; - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_multiply(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - op = tokens->tok; - if (op != '+' && op != '-') - { - return result; - } - - vtkParse_NextToken(tokens); - - result = preproc_evaluate_multiply(info, tokens, &rval, &rtype); - - *is_unsigned = (*is_unsigned || rtype); - - if (op == '+') - { - *val = *val + rval; - } - else if (op == '-') - { - *val = *val - rval; - } - } - - return result; -} - -static int preproc_evaluate_bitshift( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int op; - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_add(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - op = tokens->tok; - - if (op != TOK_LSHIFT && op != TOK_RSHIFT) - { - return result; - } - - vtkParse_NextToken(tokens); - - result = preproc_evaluate_add(info, tokens, &rval, &rtype); - - if (*is_unsigned) - { - if (op == TOK_LSHIFT) - { - *val = (preproc_int_t)((preproc_uint_t)*val << rval); - } - else if (op == TOK_RSHIFT) - { - *val = (preproc_int_t)((preproc_uint_t)*val >> rval); - } - } - else - { - if (op == TOK_LSHIFT) - { - *val = *val << rval; - } - else if (op == TOK_RSHIFT) - { - *val = *val >> rval; - } - } - } - - return result; -} - -static int preproc_evaluate_compare( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int op; - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_bitshift(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - op = tokens->tok; - if (op != '<' && op != '>' && op != TOK_LE && op != TOK_GE) - { - return result; - } - - vtkParse_NextToken(tokens); - - result = preproc_evaluate_bitshift(info, tokens, &rval, &rtype); - - *is_unsigned = (*is_unsigned || rtype); - - if (*is_unsigned) - { - if (op == TOK_LE) - { - *val = ((preproc_uint_t)*val <= (preproc_uint_t)rval); - } - else if (op == '<') - { - *val = ((preproc_uint_t)*val < (preproc_uint_t)rval); - } - else if (op == TOK_GE) - { - *val = ((preproc_uint_t)*val >= (preproc_uint_t)rval); - } - else if (op == '>') - { - *val = ((preproc_uint_t)*val > (preproc_uint_t)rval); - } - } - else - { - if (op == TOK_LE) - { - *val = (*val <= rval); - } - else if (op == '<') - { - *val = (*val < rval); - } - else if (op == TOK_GE) - { - *val = (*val >= rval); - } - else if (op == '>') - { - *val = (*val > rval); - } - } - *is_unsigned = 0; - } - - return result; -} - -static int preproc_evaluate_equal( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int op; - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_compare(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - op = tokens->tok; - if (op != TOK_EQ && op != TOK_NE) - { - return result; - } - - vtkParse_NextToken(tokens); - - result = preproc_evaluate_compare(info, tokens, &rval, &rtype); - - if (op == TOK_EQ) - { - *val = (*val == rval); - } - else if (op == TOK_NE) - { - *val = (*val != rval); - } - *is_unsigned = 0; - } - - return result; -} - -static int preproc_evaluate_and( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_equal(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != '&') - { - return result; - } - - vtkParse_NextToken(tokens); - - result = preproc_evaluate_equal(info, tokens, &rval, &rtype); - - *is_unsigned = (*is_unsigned || rtype); - *val = (*val & rval); - } - - return result; -} - -static int preproc_evaluate_xor( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_and(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != '^') - { - return result; - } - - vtkParse_NextToken(tokens); - - result = preproc_evaluate_and(info, tokens, &rval, &rtype); - - *is_unsigned = (*is_unsigned || rtype); - *val = (*val ^ rval); - } - - return result; -} - -static int preproc_evaluate_or( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_xor(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != '|') - { - return result; - } - - vtkParse_NextToken(tokens); - - result = preproc_evaluate_xor(info, tokens, &rval, &rtype); - - *is_unsigned = (*is_unsigned || rtype); - *val = (*val | rval); - } - - return result; -} - -static int preproc_evaluate_logic_and( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_or(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != TOK_AND) - { - return result; - } - - vtkParse_NextToken(tokens); - - if (*val == 0) - { - /* short circuit */ - while (tokens->tok != 0 && tokens->tok != ')' && - tokens->tok != ':' && tokens->tok != '?' && - tokens->tok != ',' && tokens->tok != TOK_OR) - { - if (tokens->tok == '(') - { - if (preproc_skip_parentheses(tokens) != VTK_PARSE_OK) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - result = VTK_PARSE_SYNTAX_ERROR; - } - } - else - { - vtkParse_NextToken(tokens); - } - } - - *is_unsigned = 0; - - return result; - } - - result = preproc_evaluate_or(info, tokens, &rval, &rtype); - - *is_unsigned = 0; - *val = (rval != 0); - } - - return result; -} - -static int preproc_evaluate_logic_or( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_logic_and(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != TOK_OR) - { - return result; - } - - vtkParse_NextToken(tokens); - - if (*val != 0) - { - /* short circuit */ - while (tokens->tok != 0 && tokens->tok != ')' && - tokens->tok != ':' && tokens->tok != '?' && - tokens->tok != ',') - { - if (tokens->tok == '(') - { - if (preproc_skip_parentheses(tokens) != VTK_PARSE_OK) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - result = VTK_PARSE_SYNTAX_ERROR; - } - } - else - { - vtkParse_NextToken(tokens); - } - } - - *is_unsigned = 0; - - return result; - } - - result = preproc_evaluate_logic_and(info, tokens, &rval, &rtype); - - *is_unsigned = 0; - *val = (rval != 0); - } - - return result; -} - -/** Evaluate an arimetic *expression. */ -int preproc_evaluate_expression( - PreprocessInfo *info, StringTokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - preproc_int_t rval, sval; - int rtype, stype; - int result; - - result = preproc_evaluate_logic_or(info, tokens, val, is_unsigned); - if ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != '?') - { - return result; - } - - vtkParse_NextToken(tokens); - - result = preproc_evaluate_expression(info, tokens, &rval, &rtype); - if ((result & VTK_PARSE_FATAL_ERROR) != 0) - { - return result; - } - - if (tokens->tok != ':') - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - - vtkParse_NextToken(tokens); - - result = preproc_evaluate_expression(info, tokens, &sval, &stype); - if ((result & VTK_PARSE_FATAL_ERROR) != 0) - { - return result; - } - - if (*val != 0) - { - *val = rval; - *is_unsigned = rtype; - } - else - { - *val = sval; - *is_unsigned = stype; - } - } - - return result; -} - -/** Evaluate a conditional *expression. - * Returns VTK_PARSE_OK if the expression is true, - * or VTK_PARSE_SKIP of the expression is false. */ -int preproc_evaluate_conditional( - PreprocessInfo *info, StringTokenizer *tokens) -{ - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_expression(info, tokens, &rval, &rtype); - if ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != 0) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - return (rval == 0 ? VTK_PARSE_SKIP : VTK_PARSE_OK); - } - - return result; -} - -/** - * Handle any of the following directives: - * #if, #ifdef, #ifndef, #elif, #else, #endif - * A return value of VTK_PARSE_SKIP means that - * the following code block should be skipped. - */ -static int preproc_evaluate_if( - PreprocessInfo *info, StringTokenizer *tokens) -{ - MacroInfo *macro; - int v1, v2; - int result = VTK_PARSE_OK; - - if (tokens->hash == HASH_IF || - tokens->hash == HASH_IFDEF || - tokens->hash == HASH_IFNDEF) - { - if (info->ConditionalDepth == 0) - { - if (tokens->hash == HASH_IF) - { - vtkParse_NextToken(tokens); - result = preproc_evaluate_conditional(info, tokens); - } - else - { - v1 = (tokens->hash != HASH_IFNDEF); - vtkParse_NextToken(tokens); - if (tokens->tok != TOK_ID) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - macro = preproc_find_macro(info, tokens); - v2 = (macro && !macro->IsExcluded); - vtkParse_NextToken(tokens); - result = ( (v1 ^ v2) ? VTK_PARSE_SKIP : VTK_PARSE_OK); - } - - if (result != VTK_PARSE_SKIP) - { - /* mark as done, so that the "else" clause is skipped */ - info->ConditionalDone = 1; - } - else - { - /* mark as not done, so that "else" clause is not skipped */ - info->ConditionalDone = 0; - /* skip the "if" clause */ - info->ConditionalDepth = 1; - } - } - else - { - /* increase the skip depth */ - info->ConditionalDepth++; - } - } - else if (tokens->hash == HASH_ELIF || - tokens->hash == HASH_ELSE) - { - if (info->ConditionalDepth == 0) - { - /* preceding clause was not skipped, so must skip this one */ - info->ConditionalDepth = 1; - } - else if (info->ConditionalDepth == 1 && - info->ConditionalDone == 0) - { - if (tokens->hash == HASH_ELIF) - { - vtkParse_NextToken(tokens); - result = preproc_evaluate_conditional(info, tokens); - } - else - { - vtkParse_NextToken(tokens); - } - if (result != VTK_PARSE_SKIP) - { - /* do not skip this clause */ - info->ConditionalDepth = 0; - /* make sure remaining else/elif clauses are skipped */ - info->ConditionalDone = 1; - } - } - } - else if (tokens->hash == HASH_ENDIF) - { - vtkParse_NextToken(tokens); - if (info->ConditionalDepth > 0) - { - /* decrease the skip depth */ - info->ConditionalDepth--; - } - if (info->ConditionalDepth == 0) - { - /* set "done" flag for the context that is being returned to */ - info->ConditionalDone = 1; - } - } - - return result; -} - -/** - * Handle the #define and #undef directives. - */ -static int preproc_evaluate_define( - PreprocessInfo *info, StringTokenizer *tokens) -{ - MacroInfo **macro_p; - MacroInfo *macro; - int is_function; - int is_variadic; - const char *name; - size_t namelen; - const char *definition = 0; - int n = 0; - const char **params = NULL; - const char *param; - size_t l; - - if (tokens->hash == HASH_DEFINE) - { - vtkParse_NextToken(tokens); - if (tokens->tok != TOK_ID) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - - macro_p = preproc_macro_location(info, tokens, 1); - name = tokens->text; - namelen = tokens->len; - vtkParse_NextToken(tokens); - - is_function = 0; - is_variadic = 0; - if (name[namelen] == '(') - { - is_function = 1; - vtkParse_NextToken(tokens); - while (tokens->tok != 0 && tokens->tok != ')') - { - if (tokens->tok != TOK_ID && tokens->tok != TOK_ELLIPSIS) - { - if (params) { free((char **)params); } -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - - param = tokens->text; - l = tokens->len; - - if (tokens->tok == TOK_ELLIPSIS) - { - is_variadic = 1; - param = "__VA_ARGS__"; - l = 11; - } - - /* add to the arg list */ - params = (const char **)preproc_array_check( - (char **)params, sizeof(char *), n); - params[n++] = vtkParse_CacheString(info->Strings, param, l); - - vtkParse_NextToken(tokens); - - /* check for gnu cpp "arg..." parameter */ - if (tokens->tok == TOK_ELLIPSIS) - { - is_variadic = 1; - vtkParse_NextToken(tokens); - } - - if (tokens->tok == ',') - { - vtkParse_NextToken(tokens); - } - else if (tokens->tok != ')') - { - if (params) { free((char **)params); } -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - } - vtkParse_NextToken(tokens); - } - - if (tokens->tok) - { - definition = tokens->text; - } - - macro = *macro_p; - if (macro) - { - if (preproc_identical(macro->Definition, definition)) - { - return VTK_PARSE_OK; - } - if (params) { free((char **)params); } -#if PREPROC_DEBUG - fprintf(stderr, "macro redefined %d\n", __LINE__); -#endif - return VTK_PARSE_MACRO_REDEFINED; - } - - macro = preproc_new_macro(info, name, definition); - macro->IsFunction = is_function; - macro->IsVariadic = is_variadic; - macro->NumberOfParameters = n; - macro->Parameters = params; - *macro_p = macro; - - return VTK_PARSE_OK; - } - else if (tokens->hash == HASH_UNDEF) - { - vtkParse_NextToken(tokens); - if (tokens->tok != TOK_ID) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - preproc_remove_macro(info, tokens); - return VTK_PARSE_OK; - } - - return VTK_PARSE_OK; -} - -/** - * Add an include file to the list. Return 0 if it is already there. - */ -static int preproc_add_include_file(PreprocessInfo *info, const char *name) -{ - int i, n; - - n = info->NumberOfIncludeFiles; - for (i = 0; i < n; i++) - { - if (strcmp(info->IncludeFiles[i], name) == 0) - { - return 0; - } - } - - info->IncludeFiles = (const char **)preproc_array_check( - (char **)info->IncludeFiles, sizeof(char *), info->NumberOfIncludeFiles); - info->IncludeFiles[info->NumberOfIncludeFiles++] = - vtkParse_CacheString(info->Strings, name, strlen(name)); - - return 1; -} - -/** - * Find an include file. If "cache_only" is set, then do a check to - * see if the file was previously found without going to the filesystem. - */ -const char *preproc_find_include_file( - PreprocessInfo *info, const char *filename, int system_first, - int cache_only) -{ - int i, n, ii, nn; - size_t j, m; - struct stat fs; - const char *directory; - char *output; - size_t outputsize = 16; - int count; - - /* allow filename to be terminated by quote or bracket */ - m = 0; - while (filename[m] != '\"' && filename[m] != '>' && - filename[m] != '\n' && filename[m] != '\0') { m++; } - - /* search file system for the file */ - output = (char *)malloc(outputsize); - - if (system_first != 0) - { - system_first = 1; - } - - if (cache_only != 0) - { - cache_only = 1; - } - - /* check for absolute path of form DRIVE: or /path/to/file */ - j = 0; - while (vtkParse_CharType(filename[j], CPRE_IDGIT)) { j++; } - - if (filename[j] == ':' || filename[0] == '/' || filename[0] == '\\') - { - if (m+1 > outputsize) - { - outputsize += m+1; - output = (char *)realloc(output, outputsize); - } - strncpy(output, filename, m); - output[m] = '\0'; - - nn = info->NumberOfIncludeFiles; - for (ii = 0; ii < nn; ii++) - { - if (strcmp(output, info->IncludeFiles[ii]) == 0) - { - free(output); - return info->IncludeFiles[ii]; - } - } - - if (cache_only) - { - free(output); - return NULL; - } - - info->IncludeFiles = (const char **)preproc_array_check( - (char **)info->IncludeFiles, sizeof(char *), - info->NumberOfIncludeFiles); - info->IncludeFiles[info->NumberOfIncludeFiles++] = output; - - return output; - } - - /* Make sure the current filename is already added */ - if (info->FileName) - { - preproc_add_include_file(info, info->FileName); - } - - /* Check twice. First check the cache, then stat the files. */ - for (count = 0; count < (2-cache_only); count++) - { - n = info->NumberOfIncludeDirectories; - for (i = 0; i < (n+1-system_first); i++) - { - /* search the directory of the file being processed */ - if (i == 0 && system_first == 0) - { - if (info->FileName) - { - j = strlen(info->FileName); - while (j > 0) - { - if (info->FileName[j-1] == '/') { break; } - j--; - } - if (m+j+1 > outputsize) - { - outputsize += m+j+1; - output = (char *)realloc(output, outputsize); - } - if (j > 0) - { - strncpy(output, info->FileName, j); - } - strncpy(&output[j], filename, m); - output[j+m] = '\0'; - } - else - { - if (m+1 > outputsize) - { - outputsize += m+1; - output = (char *)realloc(output, outputsize); - } - strncpy(output, filename, m); - output[m] = '\0'; - } - } - /* check all the search paths */ - else - { - directory = info->IncludeDirectories[i-1+system_first]; - j = strlen(directory); - if (j + m + 2 > outputsize) - { - outputsize += j+m+2; - output = (char *)realloc(output, outputsize); - } - - strncpy(output, directory, j); - if (directory[j-1] != '/') { output[j++] = '/'; } - strncpy(&output[j], filename, m); - output[j+m] = '\0'; - } - - if (count == 0) - { - nn = info->NumberOfIncludeFiles; - for (ii = 0; ii < nn; ii++) - { - if (strcmp(output, info->IncludeFiles[ii]) == 0) - { - free(output); - return info->IncludeFiles[ii]; - } - } - } - else if (stat(output, &fs) == 0) - { - nn = info->NumberOfIncludeFiles; - info->IncludeFiles = (const char **)preproc_array_check( - (char **)info->IncludeFiles, sizeof(char *), nn); - info->IncludeFiles[info->NumberOfIncludeFiles++] = - vtkParse_CacheString(info->Strings, output, strlen(output)); - free(output); - return info->IncludeFiles[nn]; - } - } - } - - free(output); - return NULL; -} - -/** - * Convert a raw string into a normal string. This is a helper - * function for preproc_include_file() to allow raw strings to - * be used in preprocessor directives. - */ -void preproc_escape_string( - char **linep, size_t *linelenp, size_t *jp, size_t d, size_t dl) -{ - char *line = *linep; - char *r = 0; - size_t linelen = *linelenp; - size_t l = *jp - d - 2*dl - 2; - size_t i; - size_t j = d; - - if (l != 0) - { - r = (char *)malloc(l); - memcpy(r, &line[j+dl+1], l); - } - - /* remove the "R" prefix */ - if (j >= 2 && line[j-1] == '\"' && line[j-2] == 'R') - { - line[j - 2] = '\"'; - j--; - } - - for (i = 0; i < l; i++) - { - /* expand line buffer as necessary */ - while (j+4 > linelen) - { - linelen *= 2; - line = (char *)realloc(line, linelen); - } - - if ((r[i] >= ' ' && r[i] <= '~') || (r[i] & 0x80) != 0) - { - line[j++] = r[i]; - } - else switch (r[i]) - { - case '\a': line[j++] = '\\'; line[j++] = 'a'; break; - case '\b': line[j++] = '\\'; line[j++] = 'b'; break; - case '\f': line[j++] = '\\'; line[j++] = 'f'; break; - case '\n': line[j++] = '\\'; line[j++] = 'n'; break; - case '\r': line[j++] = '\\'; line[j++] = 'r'; break; - case '\t': line[j++] = '\\'; line[j++] = 't'; break; - case '\v': line[j++] = '\\'; line[j++] = 'v'; break; - case '\\': line[j++] = '\\'; line[j++] = '\\'; break; - case '\'': line[j++] = '\\'; line[j++] = '\''; break; - case '\"': line[j++] = '\\'; line[j++] = '\"'; break; - default: - sprintf(&line[j], "\\%3.3o", r[i]); - j += 4; - break; - } - } - - free(r); - *linep = line; - *linelenp = linelen; - *jp = j; -} - -/** - * Include a file. All macros defined in the included file - * will have their IsExternal flag set. - */ -static int preproc_include_file( - PreprocessInfo *info, const char *filename, int system_first) -{ - const char *switchchars = "\n\r\"\'\?\\/*()"; - char switchchar[256]; - char *tbuf; - size_t tbuflen = FILE_BUFFER_SIZE; - char *line; - size_t linelen = 80; - size_t i, j, n, r; - size_t d = 0; - size_t dn = 0; - int state = 0; - int result = VTK_PARSE_OK; - FILE *fp = NULL; - const char *path = NULL; - const char *save_filename; - int save_external; - - /* check to see if the file has aleady been included */ - path = preproc_find_include_file(info, filename, system_first, 1); - if (path != 0) - { -#if PREPROC_DEBUG - int k = 0; - while (filename[k] != '>' && filename[k] != '\"' && - filename[k] != '\n' && filename[k] != '\0') { k++; } - if (filename[k] == '>') - fprintf(stderr, "already loaded file <%*.*s>\n", k, k, filename); - else - fprintf(stderr, "already loaded file \"%*.*s\"\n", k, k, filename); -#endif - - return VTK_PARSE_OK; - } - /* go to the filesystem */ - path = preproc_find_include_file(info, filename, system_first, 0); - if (path == NULL) - { -#if PREPROC_DEBUG - int k = 0; - while (filename[k] != '>' && filename[k] != '\"' && - filename[k] != '\n' && filename[k] != '\0') { k++; } - if (filename[k] == '>') - fprintf(stderr, "couldn't find file <%*.*s>\n", k, k, filename); - else - fprintf(stderr, "couldn't find file \"%*.*s\"\n", k, k, filename); -#endif - return VTK_PARSE_FILE_NOT_FOUND; - } - -#if PREPROC_DEBUG - fprintf(stderr, "including file %s\n", path); -#endif - fp = fopen(path, "r"); - - if (fp == NULL) - { -#if PREPROC_DEBUG - fprintf(stderr, "couldn't open file %s\n", path); -#endif - return VTK_PARSE_FILE_OPEN_ERROR; - } - - save_external = info->IsExternal; - save_filename = info->FileName; - info->IsExternal = 1; - info->FileName = path; - - /* make a table of interesting characters */ - memset(switchchar, '\0', 256); - n = strlen(switchchars) + 1; - for (i = 0; i < n; i++) - { - switchchar[(unsigned char)(switchchars[i])] = 1; - } - - tbuf = (char *)malloc(tbuflen+4); - line = (char *)malloc(linelen); - - /* the buffer must hold a whole line for it to be processed */ - j = 0; - i = 0; - n = 0; - r = 0; - - do - { - if (i >= n) - { - /* recycle unused lookahead chars */ - if (r) - { - r = n + 2 - i; - if (r == 2) - { - tbuf[0] = tbuf[tbuflen-2]; - tbuf[1] = tbuf[tbuflen-1]; - } - else if (r == 1) - { - tbuf[0] = tbuf[tbuflen-1]; - } - } - - /* read the next chunk of the file */ - i = 0; - if (feof(fp)) - { - /* still have the lookahead chars left */ - n = r; - r = 0; - } - else - { - /* fill the remainder of the buffer */ - errno = 0; - tbuflen = r + FILE_BUFFER_SIZE; - while ((n = fread(&tbuf[r], 1, tbuflen-r, fp)) == 0 && ferror(fp)) - { - if (errno != EINTR) - { - fclose(fp); - free(tbuf); - free(line); - info->IsExternal = save_external; - return VTK_PARSE_FILE_READ_ERROR; - } - errno = 0; - clearerr(fp); - } - - if (n + r < tbuflen) - { - /* this only occurs if the final fread does not fill the buffer */ - n += r; - r = 0; - } - else - { - /* set a lookahead reserve of two chars */ - n -= (2 - r); - r = 2; - } - - /* guard against lookahead past last char in file */ - tbuf[n + r] = '\0'; - } - } - - /* copy the characters until end of line is found */ - while (i < n) - { - /* expand line buffer as necessary */ - while (j+4 > linelen) - { - linelen *= 2; - line = (char *)realloc(line, linelen); - } - - /* check for uninteresting characters first */ - if (!switchchar[(unsigned char)(tbuf[i])]) - { - line[j++] = tbuf[i++]; - } - else if (state == '(') - { - /* look for end of raw string delimiter */ - if (tbuf[i] == '(') - { - dn = j - d; - state = ')'; - } - line[j++] = tbuf[i++]; - } - else if (state == ')') - { - /* look for end of raw string */ - if (tbuf[i] == '\"') - { - if ((j - d) > 2*dn+1 && line[j-dn-1] == ')' && - strncmp(&line[d], &line[j-dn], dn) == 0) - { - preproc_escape_string(&line, &linelen, &j, d, dn); - state = 0; - } - } - line[j++] = tbuf[i++]; - } -#ifdef PREPROC_TRIGRAPHS - else if (tbuf[i] == '?' && tbuf[i+1] == '?') - { - i += 2; - switch (tbuf[i]) - { - case '=': tbuf[i] = '#'; break; - case '/': tbuf[i] = '\\'; break; - case '\'': tbuf[i] = '^'; break; - case '(': tbuf[i] = '['; break; - case ')': tbuf[i] = ']'; break; - case '!': tbuf[i] = '|'; break; - case '<': tbuf[i] = '{'; break; - case '>': tbuf[i] = '}'; break; - case '-': tbuf[i] = '~'; break; - default: line[j++] = tbuf[--i]; - } - } -#endif - else if (tbuf[i] == '\\' && tbuf[i+1] == '\n') - { - i += 2; - } - else if (tbuf[i] == '\\' && tbuf[i+1] == '\r' && tbuf[i+2] == '\n') - { - i += 3; - } - else if (tbuf[i] == '\r' && tbuf[i+1] == '\n') - { - i++; - } - else if (state == '*') - { - if (tbuf[i] == '*' && tbuf[i+1] == '/') - { - line[j++] = tbuf[i++]; - line[j++] = tbuf[i++]; - state = 0; - } - else - { - line[j++] = tbuf[i++]; - } - } - else if (state == '/' && tbuf[i] != '\n') - { - line[j++] = tbuf[i++]; - } - else if (state == '\'' || state == '\"') - { - if (tbuf[i] == state) - { - line[j++] = tbuf[i++]; - state = 0; - } - else if (tbuf[i] == '\\' && tbuf[i+1] != '\0') - { - line[j++] = tbuf[i++]; - line[j++] = tbuf[i++]; - } - else - { - line[j++] = tbuf[i++]; - } - } - else if (tbuf[i] == '/') - { - if (tbuf[i+1] == '*' || tbuf[i+1] == '/') - { - state = tbuf[i+1]; - line[j++] = tbuf[i++]; - } - line[j++] = tbuf[i++]; - } - else if (tbuf[i] == '\"' || tbuf[i] == '\'') - { - state = tbuf[i]; - /* check for raw string prefixes */ - if (state == '\"' && j > 0 && line[j-1] == 'R' && - ((j > 2 && - (line[j-3] == 'u' || line[j-2] == '8') && - (j == 3 || - !vtkParse_CharType(line[j-4], CPRE_IDGIT|CPRE_QUOTE))) || - (j > 1 && - (line[j-2] == 'u' || line[j-2] == 'U' || line[j-2] == 'L') && - (j == 2 || - !vtkParse_CharType(line[j-3], CPRE_IDGIT|CPRE_QUOTE))) || - (j == 1 || - !vtkParse_CharType(line[j-2], CPRE_IDGIT|CPRE_QUOTE)))) - { - state = '('; - d = j + 1; - } - line[j++] = tbuf[i++]; - } - else if (tbuf[i] != '\n' && tbuf[i] != '\0') - { - line[j++] = tbuf[i++]; - } - else - { - line[j++] = tbuf[i++]; - break; - } - } - - if (i < n || n == 0) - { - const char *cp = line; - line[j] = '\0'; - j = 0; - cp += vtkParse_SkipWhitespace(cp, WS_PREPROC); - if (*cp == '#') - { - vtkParsePreprocess_HandleDirective(info, line); - } - } - } - while (n > 0); - - free(tbuf); - free(line); - fclose(fp); - - info->IsExternal = save_external; - info->FileName = save_filename; - - return result; -} - -/** - * Handle the #include directive. The header file will - * only go through the preprocessor. - */ -static int preproc_evaluate_include( - PreprocessInfo *info, StringTokenizer *tokens) -{ - const char *cp; - const char *filename; - - if (tokens->hash == HASH_INCLUDE) - { - vtkParse_NextToken(tokens); - - cp = tokens->text; - - if (tokens->tok == TOK_ID) - { - MacroInfo *macro = preproc_find_macro(info, tokens); - if (macro && !macro->IsExcluded && macro->Definition) - { - cp = macro->Definition; - } - else - { -#if PREPROC_DEBUG - fprintf(stderr, "couldn't find macro %*.*s.\n", - (int)tokens->len, (int)tokens->len, tokens->text); -#endif - return VTK_PARSE_MACRO_UNDEFINED; - } - } - - if (*cp == '\"') - { - filename = cp + 1; - cp += vtkParse_SkipQuotes(cp); - if (cp <= filename + 1 || *(cp-1) != '\"') - { - return VTK_PARSE_SYNTAX_ERROR; - } - - return preproc_include_file(info, filename, 0); - } - else if (*cp == '<') - { - cp++; - filename = cp; - while (*cp != '>' && *cp != '\n' && *cp != '\0') { cp++; } - if (*cp != '>') - { - return VTK_PARSE_SYNTAX_ERROR; - } - - return preproc_include_file(info, filename, 1); - } - } - - return VTK_PARSE_OK; -} - -/** - * Handle any recognized directive. - * Unrecognized directives are ignored. - */ -int vtkParsePreprocess_HandleDirective( - PreprocessInfo *info, const char *directive) -{ - int result = VTK_PARSE_OK; - StringTokenizer tokens; - - vtkParse_InitTokenizer(&tokens, directive, WS_PREPROC); - - if (tokens.tok != '#') - { - return VTK_PARSE_SYNTAX_ERROR; - } - - vtkParse_NextToken(&tokens); - - if (tokens.tok == TOK_ID) - { - if ((tokens.hash == HASH_IFDEF && tokens.len == 5 && - strncmp("ifdef", tokens.text, tokens.len) == 0) || - (tokens.hash == HASH_IFNDEF && tokens.len == 6 && - strncmp("ifndef", tokens.text, tokens.len) == 0) || - (tokens.hash == HASH_IF && tokens.len == 2 && - strncmp("if", tokens.text, tokens.len) == 0) || - (tokens.hash == HASH_ELIF && tokens.len == 4 && - strncmp("elif", tokens.text, tokens.len) == 0) || - (tokens.hash == HASH_ELSE && tokens.len == 4 && - strncmp("else", tokens.text, tokens.len) == 0) || - (tokens.hash == HASH_ENDIF && tokens.len == 5 && - strncmp("endif", tokens.text, tokens.len) == 0)) - { - result = preproc_evaluate_if(info, &tokens); - while (tokens.tok) { vtkParse_NextToken(&tokens); } -#if PREPROC_DEBUG - { - size_t n = tokens.text - directive; - - if (result == VTK_PARSE_SKIP) - { - fprintf(stderr, "SKIP: "); - } - else if (result == VTK_PARSE_OK) - { - fprintf(stderr, "READ: "); - } - else - { - fprintf(stderr, "ERR%-2.2d ", result); - } - fprintf(stderr, "%*.*s\n", (int)n, (int)n, directive); - } -#endif - } - else if (info->ConditionalDepth == 0) - { - if ((tokens.hash == HASH_DEFINE && tokens.len == 6 && - strncmp("define", tokens.text, tokens.len) == 0) || - (tokens.hash == HASH_UNDEF && tokens.len == 5 && - strncmp("undef", tokens.text, tokens.len) == 0)) - { - result = preproc_evaluate_define(info, &tokens); - } - else if (tokens.hash == HASH_INCLUDE && tokens.len == 7 && - strncmp("include", tokens.text, tokens.len) == 0) - { - result = preproc_evaluate_include(info, &tokens); - } - } - } - - if (info->ConditionalDepth > 0) - { - return VTK_PARSE_SKIP; - } - - return result; -} - -/** - * Evaluate a preprocessor expression. - * If no errors occurred, the result will be VTK_PARSE_OK. - */ -int vtkParsePreprocess_EvaluateExpression( - PreprocessInfo *info, const char *text, - preproc_int_t *val, int *is_unsigned) -{ - StringTokenizer tokens; - vtkParse_InitTokenizer(&tokens, text, WS_PREPROC); - - return preproc_evaluate_expression(info, &tokens, val, is_unsigned); -} - -/** Add a macro for defining a macro */ -#define PREPROC_MACRO_TO_STRING2(x) #x -#define PREPROC_MACRO_TO_STRING(x) PREPROC_MACRO_TO_STRING2(x) -#define PREPROC_ADD_MACRO(info, x) \ -preproc_add_macro_definition(info, #x, PREPROC_MACRO_TO_STRING2(x)) - -/** - * Add all standard preprocessory macros. Specify the platform. - */ -void vtkParsePreprocess_AddStandardMacros( - PreprocessInfo *info, int platform) -{ - int save_external = info->IsExternal; - info->IsExternal = 1; - - /* a special macro to indicate that this is the wrapper */ - preproc_add_macro_definition(info, "__WRAP__", "1"); - - /* language macros - assume that we are wrapping C++ code */ - preproc_add_macro_definition(info, "__cplusplus", "1"); - - /* stdc version macros */ -#ifdef __STDC__ - PREPROC_ADD_MACRO(info, __STDC__); -#endif -#ifdef __STDC_VERSION__ - PREPROC_ADD_MACRO(info, __STDC_VERSION__); -#endif -#ifdef __STDC_HOSTED__ - PREPROC_ADD_MACRO(info, __STDC_HOSTED__); -#endif - - if (platform == VTK_PARSE_NATIVE) - { -#ifdef WIN32 - PREPROC_ADD_MACRO(info, WIN32); -#endif -#ifdef _WIN32 - PREPROC_ADD_MACRO(info, _WIN32); -#endif -#ifdef _MSC_VER - PREPROC_ADD_MACRO(info, _MSC_VER); -#endif - -#ifdef __BORLAND__ - PREPROC_ADD_MACRO(info, __BORLAND__); -#endif - -#ifdef __CYGWIN__ - PREPROC_ADD_MACRO(info, __CYGWIN__); -#endif -#ifdef MINGW - PREPROC_ADD_MACRO(info, MINGW); -#endif -#ifdef __MINGW32__ - PREPROC_ADD_MACRO(info, __MINGW32__); -#endif - -#ifdef __linux__ - PREPROC_ADD_MACRO(info, __linux__); -#endif -#ifdef __LINUX__ - PREPROC_ADD_MACRO(info, __LINUX__); -#endif - -#ifdef __APPLE__ - PREPROC_ADD_MACRO(info, __APPLE__); -#endif -#ifdef __MACH__ - PREPROC_ADD_MACRO(info, __MACH__); -#endif -#ifdef __DARWIN__ - PREPROC_ADD_MACRO(info, __DARWIN__); -#endif - -#ifdef __GNUC__ - PREPROC_ADD_MACRO(info, __GNUC__); -#endif -#ifdef __LP64__ - PREPROC_ADD_MACRO(info, __LP64__); -#endif -#ifdef __BIG_ENDIAN__ - PREPROC_ADD_MACRO(info, __BIG_ENDIAN__); -#endif -#ifdef __LITTLE_ENDIAN__ - PREPROC_ADD_MACRO(info, __LITTLE_ENDIAN__); -#endif - } - - info->IsExternal = save_external; -} - -/** - * Add a preprocessor macro, including a definition. - */ -int vtkParsePreprocess_AddMacro( - PreprocessInfo *info, const char *name, const char *definition) -{ - StringTokenizer token; - MacroInfo **macro_p; - MacroInfo *macro; - - vtkParse_InitTokenizer(&token, name, WS_PREPROC); - macro_p = preproc_macro_location(info, &token, 1); - if (*macro_p) - { - macro = *macro_p; - if (preproc_identical(macro->Definition, definition)) - { - return VTK_PARSE_OK; - } - else - { - return VTK_PARSE_MACRO_REDEFINED; - } - } - - macro = preproc_new_macro(info, name, definition); - macro->IsExternal = 1; - *macro_p = macro; - - return VTK_PARSE_OK; -} - -/** - * Return a preprocessor macro struct, or NULL if not found. - */ -MacroInfo *vtkParsePreprocess_GetMacro( - PreprocessInfo *info, const char *name) -{ - StringTokenizer token; - MacroInfo *macro; - - vtkParse_InitTokenizer(&token, name, WS_PREPROC); - macro = preproc_find_macro(info, &token); - - if (macro && !macro->IsExcluded) - { - return macro; - } - - return NULL; -} - -/** - * Remove a preprocessor macro. - */ -int vtkParsePreprocess_RemoveMacro( - PreprocessInfo *info, const char *name) -{ - StringTokenizer token; - - vtkParse_InitTokenizer(&token, name, WS_PREPROC); - - if (preproc_remove_macro(info, &token)) - { - return VTK_PARSE_OK; - } - - return VTK_PARSE_MACRO_UNDEFINED; -} - -/** - * Expand a macro, argstring is ignored if not a function macro - */ -const char *vtkParsePreprocess_ExpandMacro( - PreprocessInfo *info, MacroInfo *macro, const char *argstring) -{ - const char *cp = argstring; - int n = 0; - int j = 0; - const char *stack_values[8]; - const char **values = NULL; - const char *pp = NULL; - const char *dp = NULL; - const char *wp = NULL; - char stack_rp[128]; - char *rp = NULL; - size_t rs = 0; - size_t i = 0; - size_t l = 0; - size_t k = 0; - int stringify = 0; - int noexpand = 0; - int empty_variadic = 0; - int depth = 1; - int c; - - if (macro->IsFunction) - { - if (argstring == NULL || *cp != '(') - { - return NULL; - } - - /* break the string into individual argument values */ - values = stack_values; - - cp++; - values[n++] = cp; - while (depth > 0 && *cp != '\0') - { - while (*cp != '\0') - { - if (*cp == '\"' || *cp == '\'') - { - cp += vtkParse_SkipQuotes(cp); - } - else if (cp[0] == '/' && (cp[1] == '*' || cp[1] == '/')) - { - cp += vtkParse_SkipComment(cp); - } - else if (*cp == '(') - { - cp++; - depth++; - } - else if (*cp == ')') - { - cp++; - if (--depth == 0) - { - break; - } - } - else if (*cp == ',') - { - cp++; - if (depth == 1) - { - break; - } - } - else if (*cp != '\0') - { - cp++; - } - } - if (n >= 8 && (n & (n-1)) == 0) - { - if (values != stack_values) - { - values = (const char **)realloc( - (char **)values, 2*n*sizeof(const char **)); - } - else - { - values = (const char **)malloc(2*n*sizeof(const char **)); - memcpy((char **)values, stack_values, 8*sizeof(const char **)); - } - } - - values[n++] = cp; - } - --n; - - /* diagnostic: print out the values */ -#if PREPROC_DEBUG - for (j = 0; j < n; j++) - { - size_t m = values[j+1] - values[j] - 1; - fprintf(stderr, "arg %i: %*.*s\n", - (int)j, (int)m, (int)m, values[j]); - } -#endif - - /* one arg that is only whitespace can also be no args*/ - if (macro->NumberOfParameters == 0 && n == 1) - { - const char *tp = values[0]; - tp += vtkParse_SkipWhitespace(tp, WS_PREPROC); - if (tp + 1 >= values[1]) - { - n = 0; - } - } - - /* allow the variadic arg to be empty */ - if (macro->IsVariadic && n == macro->NumberOfParameters-1) - { - empty_variadic = 1; - } - - /* check for correct number of arguments */ - if (n < (macro->NumberOfParameters - empty_variadic) || - (n > macro->NumberOfParameters && !macro->IsVariadic)) - { - if (values != stack_values) { free((char **)values); } -#if PREPROC_DEBUG - fprintf(stderr, "wrong number of macro args to %s, %lu != %lu\n", - macro->Name, n, macro->NumberOfParameters); -#endif - return NULL; - } - } - - cp = macro->Definition; - cp = (cp ? cp : ""); - dp = cp; - rp = stack_rp; - rp[0] = '\0'; - rs = 128; - - while (*cp != '\0') - { - pp = cp; - wp = cp; - stringify = 0; - noexpand = 0; - /* skip all chars that aren't part of a name */ - while (!vtkParse_CharType(*cp, CPRE_ID) && *cp != '\0') - { - dp = cp; - cp += vtkParse_SkipWhitespace(cp, WS_PREPROC); - if (cp > dp) - { - dp = cp; - } - else if (vtkParse_CharType(*cp, CPRE_QUOTE)) - { - cp += vtkParse_SkipQuotes(cp); - dp = cp; - wp = cp; - noexpand = 0; - } - else if (vtkParse_CharType(*cp, CPRE_DIGIT)) - { - cp += vtkParse_SkipNumber(cp); - dp = cp; - wp = cp; - noexpand = 0; - } - else if (cp[0] == '#' && cp[1] == '#') - { - noexpand = 1; - dp = wp; - cp += 2; - wp = cp; - cp += vtkParse_SkipWhitespace(cp, WS_PREPROC); - break; - } - else if (*cp == '#') - { - stringify = 1; - dp = cp; - wp = cp; - cp++; - cp += vtkParse_SkipWhitespace(cp, WS_PREPROC); - break; - } - else - { - cp++; - dp = cp; - wp = cp; - } - } - l = dp - pp; - if (l > 0) - { - if (i + l + 1 >= rs) - { - rs += rs + i + l + 1; - if (rp != stack_rp) - { - rp = (char *)realloc(rp, rs); - } - else - { - rp = (char *)malloc(rs); - memcpy(rp, stack_rp, i); - } - } - strncpy(&rp[i], pp, l); - i += l; - rp[i] = '\0'; - } - - /* get the name */ - pp = cp; - l = vtkParse_SkipId(cp); - cp += l; - if (l > 0) - { - for (j = 0; j < macro->NumberOfParameters; j++) - { - /* check whether the name matches a parameter */ - if (strncmp(pp, macro->Parameters[j], l) == 0 && - macro->Parameters[j][l] == '\0') - { - if (macro->IsVariadic && j == macro->NumberOfParameters-1) - { - /* if variadic arg, use all remaining args */ - pp = values[j] - empty_variadic; - l = values[n] - pp - 1; - } - else - { - /* else just get one arg */ - pp = values[j]; - l = values[j+1] - pp - 1; - } - /* remove leading whitespace from argument */ - c = *pp; - while (vtkParse_CharType(c, CPRE_WHITE)) - { - c = *(++pp); - l--; - } - /* remove trailing whitespace from argument */ - if (l > 0) - { - c = pp[l - 1]; - while (vtkParse_CharType(c, CPRE_WHITE)) - { - if (--l == 0) - { - break; - } - c = pp[l-1]; - } - } - /* check if followed by "##" */ - wp = cp; - wp += vtkParse_SkipWhitespace(wp, WS_PREPROC); - if (wp[0] == '#' && wp[1] == '#') - { - noexpand = 1; - } - break; - } - } - if (stringify) - { - /* compute number of chars that will be added */ - stringify = 2; - for (k = 0; k < l; k++) - { - c = pp[k]; - if (c == '\\' || c == '\"') - { - stringify++; - } - } - } - if (i + l + stringify + 1 >= rs) - { - rs += rs + i + l + 1; - if (rp != stack_rp) - { - rp = (char *)realloc(rp, rs); - } - else - { - rp = (char *)malloc(rs); - memcpy(rp, stack_rp, i); - } - } - if (stringify) - { - /* convert argument into a string, due to "#" */ - rp[i++] = '\"'; - for (k = 0; k < l; k++) - { - c = pp[k]; - if (c == '\\' || c == '\"') - { - rp[i++] = '\\'; - } - rp[i++] = c; - } - rp[i++] = '\"'; - } - else if (empty_variadic && j == macro->NumberOfParameters-1) - { - /* remove trailing comma before empty variadic (non-standard) */ - k = i; - if (k > 0) - { - do - { - c = rp[--k]; - } - while (k > 0 && vtkParse_CharType(c, CPRE_WHITE)); - if (rp[k] == ',') - { - i = k; - } - } - } - else if (noexpand) - { - /* do not expand args that will be concatenated with "##" */ - strncpy(&rp[i], pp, l); - i += l; - } - else - { - /* process the arguments before substituting them */ - const char *text; - int is_excluded = macro->IsExcluded; - macro->IsExcluded = 1; - strncpy(&rp[i], pp, l); - rp[i + l] = '\0'; - text = vtkParsePreprocess_ProcessString(info, &rp[i]); - if (text) - { - l = strlen(text); - if (text != &rp[i]) - { - char *tp = NULL; - if (i + l + 1 >= rs) - { - rs += rs + i + l + 1; - tp = rp; - rp = (char *)malloc(rs); - memcpy(rp, tp, i); - } - strncpy(&rp[i], text, l); - vtkParsePreprocess_FreeProcessedString(info, text); - if (tp && tp != stack_rp) - { - free(tp); - } - } - } - macro->IsExcluded = is_excluded; - i += l; - } - rp[i] = '\0'; - } - } - - if (values != stack_values) { free((char **)values); } - - if (!macro->IsFunction && macro->Definition && - strcmp(rp, macro->Definition) == 0) - { - if (rp != stack_rp) { free(rp); } - return macro->Definition; - } - - if (rp == stack_rp) - { - rp = (char *)malloc(strlen(stack_rp) + 1); - strcpy(rp, stack_rp); - } - - return rp; -} - -/** - * Process a string - */ -const char *vtkParsePreprocess_ProcessString( - PreprocessInfo *info, const char *text) -{ - char stack_rp[128]; - char *rp; - char *ep; - size_t i = 0; - size_t rs = 128; - int last_tok = 0; - StringTokenizer tokens; - vtkParse_InitTokenizer(&tokens, text, WS_PREPROC); - - rp = stack_rp; - rp[0] = '\0'; - - while (tokens.tok) - { - size_t l = tokens.len; - size_t j; - const char *cp = tokens.text; - const char *dp; - - if (tokens.tok == TOK_STRING && last_tok == TOK_STRING) - { - if (i > 0) - { - do { --i; } while (i > 0 && rp[i] != '\"'); - } - while (*cp != '\"' && l > 1) { cp++; l--; } - if (*cp == '\"' && l > 1) { cp++; l--; } - } - - if (i + l + 2 >= rs) - { - rs += rs + i + l + 2; - if (rp == stack_rp) - { - rp = (char *)malloc(rs); - memcpy(rp, stack_rp, i); - } - else - { - rp = (char *)realloc(rp, rs); - } - } - - /* copy the token, removing backslash-newline */ - dp = cp; - ep = &rp[i]; - for (j = 0; j < l; j++) - { - if (*dp == '\\') - { - if (dp[1] == '\n') { dp += 2; } - else if (dp[1] == '\r' && dp[2] == '\n') { dp += 3; } - else { *ep++ = *dp++; } - } - else - { - *ep++ = *dp++; - } - } - l = ep - &rp[i]; - - if (tokens.tok == TOK_ID) - { - MacroInfo *macro = preproc_find_macro(info, &tokens); - if (macro && !macro->IsExcluded) - { - const char *args = NULL; - int expand = 1; - - if (macro->IsFunction) - { - /* expand function macros using the arguments */ - vtkParse_NextToken(&tokens); - if (tokens.tok == '(') - { - int depth = 1; - args = tokens.text; - while (depth > 0 && vtkParse_NextToken(&tokens)) - { - if (tokens.tok == '(') - { - depth++; - } - else if (tokens.tok == ')') - { - depth--; - } - } - if (tokens.tok != ')') - { - if (rp != stack_rp) { free(rp); } - return NULL; - } - } - else - { - /* unput the last token if it isn't "(" */ - tokens.len = l; - tokens.text = cp; - expand = 0; - } - } - if (expand) - { - const char *expansion; - const char *processed; - expansion = vtkParsePreprocess_ExpandMacro(info, macro, args); - if (expansion == NULL) - { - if (rp != stack_rp) { free(rp); } - return NULL; - } - macro->IsExcluded = 1; - processed = vtkParsePreprocess_ProcessString(info, expansion); - macro->IsExcluded = 0; - if (processed == NULL) - { - vtkParsePreprocess_FreeMacroExpansion(info, macro, expansion); - if (rp != stack_rp) { free(rp); } - return NULL; - } - l = strlen(processed); - if (l > 0) - { - if (i + l + 2 >= rs) - { - rs += rs + i + l + 2; - if (rp == stack_rp) - { - rp = (char *)malloc(rs); - memcpy(rp, stack_rp, i); - } - else - { - rp = (char *)realloc(rp, rs); - } - } - strncpy(&rp[i], processed, l); - } - if (processed != expansion) - { - vtkParsePreprocess_FreeProcessedString(info, processed); - } - vtkParsePreprocess_FreeMacroExpansion(info, macro, expansion); - } - } - } - - i += l; - - last_tok = tokens.tok; - l = tokens.len; - cp = tokens.text; - if (vtkParse_NextToken(&tokens) && tokens.text > cp + l) - { - rp[i++] = ' '; - } - } - rp[i] = '\0'; - - if (strcmp(rp, text) == 0) - { - /* no change, return */ - if (rp != stack_rp) { free(rp); } - return text; - } - else - { - /* string changed, recursively reprocess */ - const char *tp = vtkParsePreprocess_ProcessString(info, rp); - if (rp != tp) - { - if (rp != stack_rp) { free(rp); } - return tp; - } - if (rp == stack_rp) - { - rp = (char *)malloc(strlen(stack_rp) + 1); - strcpy(rp, stack_rp); - } - } - - return rp; -} - -/** - * Free a string returned by ExpandMacro - */ -void vtkParsePreprocess_FreeMacroExpansion( - PreprocessInfo *info, MacroInfo *macro, const char *text) -{ - /* only free expansion if it is different from definition */ - if (info && text != macro->Definition) - { - free((char *)text); - } -} - -/** - * Free a string returned by ProcessString - */ -void vtkParsePreprocess_FreeProcessedString( - PreprocessInfo *info, const char *text) -{ - if (info) - { - free((char *)text); - } -} - -/** - * Add an include directory. - */ -void vtkParsePreprocess_IncludeDirectory( - PreprocessInfo *info, const char *name) -{ - int i, n; - - n = info->NumberOfIncludeDirectories; - for (i = 0; i < n; i++) - { - if (strcmp(name, info->IncludeDirectories[i]) == 0) - { - return; - } - } - - info->IncludeDirectories = (const char **)preproc_array_check( - (char **)info->IncludeDirectories, sizeof(char *), - info->NumberOfIncludeDirectories); - info->IncludeDirectories[info->NumberOfIncludeDirectories++] = - vtkParse_CacheString(info->Strings, name, strlen(name)); -} - -/** - * Find an include file in the path. If system_first is set, - * then the current directory is not searched. - */ -const char *vtkParsePreprocess_FindIncludeFile( - PreprocessInfo *info, const char *filename, int system_first, - int *already_loaded) -{ - const char *cp; - cp = preproc_find_include_file(info, filename, system_first, 1); - if (cp) - { - *already_loaded = 1; - return cp; - } - - *already_loaded = 0; - return preproc_find_include_file(info, filename, system_first, 0); -} - -/** - * Initialize a preprocessor macro struct - */ -void vtkParsePreprocess_InitMacro(MacroInfo *macro) -{ - macro->Name = NULL; - macro->Definition = NULL; - macro->Comment = NULL; - macro->NumberOfParameters = 0; - macro->Parameters = NULL; - macro->IsFunction = 0; - macro->IsVariadic = 0; - macro->IsExternal = 0; - macro->IsExcluded = 0; -} - -/** - * Free a preprocessor macro struct - */ -void vtkParsePreprocess_FreeMacro(MacroInfo *macro) -{ - free((char **)macro->Parameters); - - free(macro); -} - -/** - * Initialize a preprocessor struct - */ -void vtkParsePreprocess_Init( - PreprocessInfo *info, const char *filename) -{ - info->FileName = NULL; - info->MacroHashTable = NULL; - info->NumberOfIncludeDirectories = 0; - info->IncludeDirectories = NULL; - info->NumberOfIncludeFiles = 0; - info->IncludeFiles = NULL; - info->Strings = NULL; - info->IsExternal = 0; - info->ConditionalDepth = 0; - info->ConditionalDone = 0; - - if (filename) - { - char *cp = (char *)malloc(strlen(filename) + 1); - strcpy(cp, filename); - info->FileName = cp; - } -} - -/** - * Free a preprocessor struct and its contents - */ -void vtkParsePreprocess_Free(PreprocessInfo *info) -{ - int i, n; - MacroInfo **mptr; - - free((char *)info->FileName); - - if (info->MacroHashTable) - { - n = PREPROC_HASH_TABLE_SIZE; - for (i = 0; i < n; i++) - { - mptr = info->MacroHashTable[i]; - if (mptr) - { - while (*mptr) - { - vtkParsePreprocess_FreeMacro(*mptr++); - } - } - free(info->MacroHashTable[i]); - } - free(info->MacroHashTable); - } - - free((char **)info->IncludeDirectories); - free((char **)info->IncludeFiles); - - free(info); -} diff --git a/src/VTKWrapping/ParaView/vtkParsePreprocess.h b/src/VTKWrapping/ParaView/vtkParsePreprocess.h deleted file mode 100644 index 528294e7..00000000 --- a/src/VTKWrapping/ParaView/vtkParsePreprocess.h +++ /dev/null @@ -1,254 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParsePreprocess.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in June 2010 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -/** - This file provides subroutines to assist in preprocessing - C/C++ header files. It evaluates preprocessor directives - and stores a list of all preprocessor macros. - - The preprocessing is done in-line while the file is being - parsed. Macros that are defined in the file are stored but - are not automatically expanded. The parser can query the - macro definitions, expand them into plain text, or ask the - preprocessor to evaluate them and return an integer result. - - The typical usage of this preprocessor is that the main - parser will pass any lines that begin with '#' to the - vtkParsePreprocess_HandleDirective() function, which will - evaluate the line and provide a return code. The return - code will tell the main parser if a syntax error or macro - lookup error occurred, and will also let the parser know - if an #if or #else directive requires that the next block - of code be skipped. -*/ - -#ifndef VTK_PARSE_PREPROCESS_H -#define VTK_PARSE_PREPROCESS_H - -#include "vtkParseString.h" - -/** - * The preprocessor int type. Use the compiler's longest int type. - */ -#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) -typedef __int64 preproc_int_t; -typedef unsigned __int64 preproc_uint_t; -#else -typedef long long preproc_int_t; -typedef unsigned long long preproc_uint_t; -#endif - -/** - * Struct to describe a preprocessor symbol. - */ -typedef struct _MacroInfo -{ - const char *Name; - const char *Definition; - const char *Comment; /* unused */ - int NumberOfParameters; /* only if IsFunction == 1 */ - const char **Parameters; /* symbols for parameters */ - int IsFunction; /* this macro requires arguments */ - int IsVariadic; /* this macro can take unlimited arguments */ - int IsExternal; /* this macro is from an included file */ - int IsExcluded; /* do not expand this macro */ -} MacroInfo; - -/** - * Contains all symbols defined thus far (including those defined - * in any included header files). - */ -typedef struct _PreprocessInfo -{ - const char *FileName; /* the file that is being parsed */ - MacroInfo ***MacroHashTable; /* hash table for macro lookup */ - int NumberOfIncludeDirectories; - const char **IncludeDirectories; - int NumberOfIncludeFiles; /* all included files */ - const char **IncludeFiles; - StringCache *Strings; /* to aid string allocation */ - int IsExternal; /* label all macros as "external" */ - int ConditionalDepth; /* internal state variable */ - int ConditionalDone; /* internal state variable */ -} PreprocessInfo; - -/** - * Platforms. Always choose native unless crosscompiling. - */ -enum _preproc_platform_t { - VTK_PARSE_NATIVE = 0 -}; - -/** - * Directive return values. - */ -enum _preproc_return_t { - VTK_PARSE_OK = 0, - VTK_PARSE_SKIP = 1, /* skip next block */ - VTK_PARSE_PREPROC_DOUBLE = 2, /* encountered a double */ - VTK_PARSE_PREPROC_FLOAT = 3, /* encountered a float */ - VTK_PARSE_PREPROC_STRING = 4, /* encountered a string */ - VTK_PARSE_MACRO_UNDEFINED = 5, /* macro lookup failed */ - VTK_PARSE_MACRO_REDEFINED = 6, /* attempt to redefine a macro */ - VTK_PARSE_FILE_NOT_FOUND = 7, /* include file not found */ - VTK_PARSE_FILE_OPEN_ERROR = 8, /* include file not readable */ - VTK_PARSE_FILE_READ_ERROR = 9, /* error during read */ - VTK_PARSE_MACRO_NUMARGS = 10, /* wrong number of args to func macro */ - VTK_PARSE_SYNTAX_ERROR = 11 /* any and all syntax errors */ -}; - -/** - * Bitfield for fatal errors. - */ -#define VTK_PARSE_FATAL_ERROR 0xF8 - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Handle a preprocessor directive. Return value VTK_PARSE_OK - * means that no errors occurred, while VTK_PARSE_SKIP means that - * a conditional directive was encountered and the next code - * block should be skipped. The preprocessor has an internal state - * machine that keeps track of conditional if/else/endif directives. - * All other return values indicate errors, and it is up to the - * parser to decide which errors are fatal. The preprocessor - * only considers syntax errors and I/O errors to be fatal. - */ -int vtkParsePreprocess_HandleDirective( - PreprocessInfo *info, const char *directive); - -/** - * Evaluate a preprocessor expression, providing an integer result - * in "val", and whether it is unsigned in "is_unsigned". A return - * value of VTK_PARSE_OK means that no errors occurred, while - * VTK_PREPROC_DOUBLE, VTK_PREPROC_FLOAT, and VTK_PREPROC_STRING - * indicate that the preprocessor encountered a non-integer value. - * Error return values are VTK_PARSE_MACRO_UNDEFINED and - * VTK_PARSE_SYNTAX_ERRORS. Undefined macros evaluate to zero. - */ -int vtkParsePreprocess_EvaluateExpression( - PreprocessInfo *info, const char *text, - preproc_int_t *val, int *is_unsigned); - -/** - * Add all standard preprocessor symbols. Use VTK_PARSE_NATIVE - * as the platform. In the future, other platform specifiers - * might be added to allow crosscompiling. - */ -void vtkParsePreprocess_AddStandardMacros( - PreprocessInfo *info, int platform); - -/** - * Add a preprocessor symbol, including a definition. Return - * values are VTK_PARSE_OK and VTK_PARSE_MACRO_REDEFINED. - */ -int vtkParsePreprocess_AddMacro( - PreprocessInfo *info, const char *name, const char *definition); - -/** - * Remove a preprocessor symbol. Return values are VTK_PARSE_OK - * and VTK_PARSE_MACRO_UNDEFINED. - */ -int vtkParsePreprocess_RemoveMacro( - PreprocessInfo *info, const char *name); - -/** - * Return a preprocessor symbol struct, or NULL if not found. - */ -MacroInfo *vtkParsePreprocess_GetMacro( - PreprocessInfo *info, const char *name); - -/** - * Expand a macro. A function macro must be given an argstring - * with args in parentheses, otherwise the argstring can be NULL. - * returns NULL if the wrong number of arguments were given. - */ -const char *vtkParsePreprocess_ExpandMacro( - PreprocessInfo *info, MacroInfo *macro, const char *argstring); - -/** - * Free an expanded macro - */ -void vtkParsePreprocess_FreeMacroExpansion( - PreprocessInfo *info, MacroInfo *macro, const char *text); - -/** - * Fully process a string with the preprocessor, and - * return a new string or NULL if a fatal error occurred. - */ -const char *vtkParsePreprocess_ProcessString( - PreprocessInfo *info, const char *text); - -/** - * Free a processed string. Only call this method if - * the string returned by ProcessString is different from - * the original string, because ProcessString will just - * return the original string if no processing was needed. - */ -void vtkParsePreprocess_FreeProcessedString( - PreprocessInfo *info, const char *text); - -/** - * Add an include directory. The directories that were added - * first will be searched first. - */ -void vtkParsePreprocess_IncludeDirectory( - PreprocessInfo *info, const char *name); - -/** - * Find an include file in the path. If system_first is set, then - * the current directory is ignored unless it is explicitly in the - * path. A null return value indicates that the file was not found. - * If already_loaded is set, then the file was already loaded. This - * preprocessor never loads the same file twice. - */ -const char *vtkParsePreprocess_FindIncludeFile( - PreprocessInfo *info, const char *filename, int system_first, - int *already_loaded); - -/** - * Initialize a preprocessor symbol struct. - */ -void vtkParsePreprocess_InitMacro(MacroInfo *symbol); - -/** - * Free a preprocessor macro struct - */ -void vtkParsePreprocess_FreeMacro(MacroInfo *macro); - -/** - * Initialize a preprocessor struct. - */ -void vtkParsePreprocess_Init( - PreprocessInfo *info, const char *filename); - -/** - * Free a preprocessor struct and its contents; - */ -void vtkParsePreprocess_Free(PreprocessInfo *info); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/VTKWrapping/ParaView/vtkParseString.c b/src/VTKWrapping/ParaView/vtkParseString.c deleted file mode 100644 index 0ebbc0c8..00000000 --- a/src/VTKWrapping/ParaView/vtkParseString.c +++ /dev/null @@ -1,544 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseString.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2012 David Gobbi. - - Contributed to the VisualizationToolkit by the author in April 2012 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -#include "vtkParseString.h" -#include -#include - - -/*---------------------------------------------------------------- - * String tokenization methods - * - * Strings must be broken into C++ tokens. - * A hash is computed for ids, but not for other tokens. - * Comments are generally considered to be whitespace, but - * WS_COMMENT can be used to consider comments as tokens. - */ - -/** Array for quick lookup of char types */ -unsigned char parse_charbits[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, - CPRE_HSPACE, /* tab */ - CPRE_VSPACE, CPRE_VSPACE, CPRE_VSPACE, /* newline, vtab, form feed */ - CPRE_HSPACE, /* carriage return */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - CPRE_HSPACE, /* ' ' */ - 0, CPRE_QUOTE, 0, 0, 0, 0, CPRE_QUOTE, 0, 0, /* !"#$%&'() */ - 0, CPRE_SIGN, 0, CPRE_SIGN, 0, 0, /* *+,-./ */ - CPRE_DIGIT|CPRE_HEX, /* 0 */ - CPRE_DIGIT|CPRE_HEX, CPRE_DIGIT|CPRE_HEX, - CPRE_DIGIT|CPRE_HEX, CPRE_DIGIT|CPRE_HEX, - CPRE_DIGIT|CPRE_HEX, CPRE_DIGIT|CPRE_HEX, - CPRE_DIGIT|CPRE_HEX, CPRE_DIGIT|CPRE_HEX, - CPRE_DIGIT|CPRE_HEX, /* 9 */ - 0, 0, 0, 0, 0, 0, 0, /* :;<=>?@ */ - CPRE_ID|CPRE_HEX, /* A */ - CPRE_ID|CPRE_HEX, CPRE_ID|CPRE_HEX, CPRE_ID|CPRE_HEX, /* BCD */ - CPRE_ID|CPRE_HEX|CPRE_EXP, /* E */ - CPRE_ID|CPRE_HEX, CPRE_ID, CPRE_ID, CPRE_ID, /* FGHI */ - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* JKLM */ - CPRE_ID, CPRE_ID, CPRE_ID|CPRE_EXP, CPRE_ID, /* NOPQ */ - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* RSTU */ - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* VWXY */ - CPRE_ID, /* Z */ - 0, 0, 0, 0, /* [\\]^ */ - CPRE_ID, /* _ */ - 0, /* ` */ - CPRE_ID|CPRE_HEX, /* a */ - CPRE_ID|CPRE_HEX, CPRE_ID|CPRE_HEX, CPRE_ID|CPRE_HEX, /* bcd */ - CPRE_ID|CPRE_HEX|CPRE_EXP, /* e */ - CPRE_ID|CPRE_HEX, CPRE_ID, CPRE_ID, CPRE_ID, /* fghi */ - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* jklm */ - CPRE_ID, CPRE_ID, CPRE_ID|CPRE_EXP, CPRE_ID, /* nopq */ - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* rstu */ - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* vwxy */ - CPRE_ID, /* z */ - 0, 0, 0, 0, /* {|}~ */ - 0, /* '\x7f' */ - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, -}; - -#define parse_chartype(c, bits) \ - ((parse_charbits[(unsigned char)(c)] & (bits)) != 0) - -/** Skip over a comment. */ -size_t vtkParse_SkipComment(const char *text) -{ - const char *cp = text; - - if (cp[0] == '/') - { - if (cp[1] == '/') - { - cp += 2; - while (*cp != '\n' && *cp != '\0') - { - if (cp[0] == '\\') - { - if (cp[1] == '\n') { cp++; } - else if (cp[1] == '\r' && cp[2] == '\n') { cp += 2; } - } - cp++; - } - } - else if (cp[1] == '*') - { - cp += 2; - while (*cp != '\0') - { - if (cp[0] == '*' && cp[1] == '/') { cp += 2; break; } - cp++; - } - } - } - - return cp - text; -} - -/** Skip over whitespace. */ -size_t vtkParse_SkipWhitespace(const char *text, parse_space_t spacetype) -{ - const char *cp = text; - - for (;;) - { - if (parse_chartype(*cp, spacetype)) - { - do - { - cp++; - } - while (parse_chartype(*cp, spacetype)); - } - if (cp[0] == '\\') - { - if (cp[1] == '\n') - { - cp += 2; - } - else if (cp[1] == '\r' && cp[2] == '\n') - { - cp += 3; - } - else - { - break; - } - } - else if (cp[0] == '/' && (spacetype & WS_COMMENT) != WS_COMMENT) - { - if (cp[1] == '/' || cp[1] == '*') - { - cp += vtkParse_SkipComment(cp); - } - else - { - break; - } - } - else - { - break; - } - } - - return cp - text; -} - -/** Skip over string and char literals. */ -size_t vtkParse_SkipQuotes(const char *text) -{ - const char *cp = text; - const char qc = *cp; - - if (parse_chartype(*cp, CPRE_QUOTE)) - { - cp++; - while (*cp != qc && *cp != '\n' && *cp != '\0') - { - if (*cp++ == '\\') - { - if (cp[0] == '\r' && cp[1] == '\n') { cp += 2; } - else if (*cp != '\0') { cp++; } - } - } - } - if (*cp == qc) - { - cp++; - } - - return cp - text; -} - -/** Skip over a number. */ -size_t vtkParse_SkipNumber(const char *text) -{ - const char *cp = text; - - if (parse_chartype(cp[0], CPRE_DIGIT) || - (cp[0] == '.' && parse_chartype(cp[1], CPRE_DIGIT))) - { - do - { - char c = *cp++; - if (parse_chartype(c, CPRE_EXP) && - parse_chartype(*cp, CPRE_SIGN)) - { - cp++; - } - } - while (parse_chartype(*cp, CPRE_IDGIT) || *cp == '.'); - } - - return cp - text; -} - -/** Skip over a name. */ -size_t vtkParse_SkipId(const char *text) -{ - const char *cp = text; - - if (parse_chartype(*cp, CPRE_ID)) - { - do - { - cp++; - } - while (parse_chartype(*cp, CPRE_IDGIT)); - } - - return cp - text; -} - -/** A simple 32-bit hash function based on "djb2". */ -#define parse_hash_name(cp, h) \ - h = 5381; \ - do { h = (h << 5) + h + (unsigned char)*cp++; } \ - while (parse_chartype(*cp, CPRE_IDGIT)); - -unsigned int vtkParse_HashId(const char *cp) -{ - unsigned int h = 0; - - if (parse_chartype(*cp, CPRE_ID)) - { - parse_hash_name(cp, h); - } - - return h; -} - -/** Skip a string or */ -size_t parse_skip_quotes_with_suffix(const char *cp) -{ - size_t l = vtkParse_SkipQuotes(cp); - if (l && cp[l] == '_') - { - l += vtkParse_SkipId(cp + l); - } - return l; -} - -/** Return the next token, or 0 if none left. */ -int vtkParse_NextToken(StringTokenizer *tokens) -{ - const char *cp = tokens->text + tokens->len; - - /* avoid extra function call for simple whitespace */ - if (parse_chartype(*cp, tokens->ws)) - { - do { cp++; } while (parse_chartype(*cp, tokens->ws)); - } - /* function call is necessary if slash encountered */ - if (*cp == '/' || *cp == '\\') - { - cp += vtkParse_SkipWhitespace(cp, tokens->ws); - } - - if (parse_chartype(*cp, CPRE_ID)) - { - const char *ep = cp; - unsigned int h; - - /* use a macro to compute the hash */ - parse_hash_name(ep, h); - - tokens->tok = TOK_ID; - tokens->hash = h; - tokens->text = cp; - tokens->len = ep - cp; - - /* check if this is a prefixed string */ - if (parse_chartype(*ep, CPRE_QUOTE) && - ((*ep == '\'' && tokens->len == 1 && - (*cp == 'u' || *cp == 'U' || *cp == 'L')) || - (*ep == '\"' && tokens->len == 1 && - (*cp == 'U' || *cp == 'u' || *cp == 'L')) || - (*ep == '\"' && tokens->len == 2 && cp[0] == 'u' && cp[1] == '8'))) - { - tokens->tok = (*ep == '\"' ? TOK_STRING : TOK_CHAR); - tokens->hash = 0; - tokens->len += parse_skip_quotes_with_suffix(ep); - } - else - { - /* check if this ID is a named operator */ - static const char *op_str_array[32] = { - "compl", 0, 0, 0, 0, "bitor", "or", 0, 0, 0, 0, "not_eq", - 0, "and_eq", 0, 0, 0, 0, 0, "xor_eq", 0, 0, "not", "bitand", - "and", 0, 0, "or_eq", 0, 0, "xor", 0 }; - static unsigned char op_len_array[32] = { - 5, 0, 0, 0, 0, 5, 2, 0, 0, 0, 0, 6, - 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 3, 6, - 3, 0, 0, 5, 0, 0, 3, 0 }; - static int op_tok_array[32] = { - '~', 0, 0, 0, 0, '|', TOK_OR, 0, 0, 0, 0, TOK_NE, - 0, TOK_AND_EQ, 0, 0, 0, 0, 0, TOK_XOR_EQ, 0, 0, '!', '&', - TOK_AND, 0, 0, TOK_OR_EQ, 0, 0, '^', 0 }; - - h &= 0x1f; - ep = op_str_array[h]; - if (ep && tokens->len == op_len_array[h] && - strncmp(cp, ep, tokens->len) == 0) - { - tokens->tok = op_tok_array[h]; - tokens->hash = 0; - } - } - } - else if (parse_chartype(*cp, CPRE_QUOTE)) - { - tokens->tok = (*cp == '\"' ? TOK_STRING : TOK_CHAR); - tokens->hash = 0; - tokens->text = cp; - tokens->len = parse_skip_quotes_with_suffix(cp); - } - else if (parse_chartype(*cp, CPRE_DIGIT) || - (cp[0] == '.' && parse_chartype(cp[1], CPRE_DIGIT))) - { - tokens->tok = TOK_NUMBER; - tokens->hash = 0; - tokens->text = cp; - tokens->len = vtkParse_SkipNumber(cp); - } - else if (cp[0] == '/' && (cp[1] == '/' || cp[1] == '*')) - { - tokens->tok = TOK_COMMENT; - tokens->hash = 0; - tokens->text = cp; - tokens->len = vtkParse_SkipComment(cp); - } - else - { - int t = cp[0]; - size_t l = 1; - - switch (cp[0]) - { - case ':': - if (cp[1] == ':') { l = 2; t = TOK_SCOPE; } - else if (cp[1] == '>') { l = 2; t = ']'; } - break; - case '.': - if (cp[1] == '.' && cp[2] == '.') { l = 3; t = TOK_ELLIPSIS; } - else if (cp[1] == '*') { l = 2; t = TOK_DOT_STAR; } - break; - case '=': - if (cp[1] == '=') { l = 2; t = TOK_EQ; } - break; - case '!': - if (cp[1] == '=') { l = 2; t = TOK_NE; } - break; - case '<': - if (cp[1] == '<' && cp[2] == '=') { l = 3; t = TOK_LSHIFT_EQ; } - else if (cp[1] == '<') { l = 2; t = TOK_LSHIFT; } - else if (cp[1] == '=') { l = 2; t = TOK_LE; } - else if (cp[1] == '%') { l = 2; t = '{'; } - else if (cp[1] == ':') { l = 2; t = '['; } - break; - case '>': - if (cp[1] == '>' && cp[2] == '=') { l = 3; t = TOK_RSHIFT_EQ; } - else if (cp[1] == '>') { l = 2; t = TOK_RSHIFT; } - else if (cp[1] == '=') { l = 2; t = TOK_GE; } - break; - case '&': - if (cp[1] == '=') { l = 2; t = TOK_AND_EQ; } - else if (cp[1] == '&') { l = 2; t = TOK_AND; } - break; - case '|': - if (cp[1] == '=') { l = 2; t = TOK_OR_EQ; } - else if (cp[1] == '|') { l = 2; t = TOK_OR; } - break; - case '^': - if (cp[1] == '=') { l = 2; t = TOK_XOR_EQ; } - break; - case '*': - if (cp[1] == '=') { l = 2; t = TOK_MUL_EQ; } - break; - case '/': - if (cp[1] == '=') { l = 2; t = TOK_DIV_EQ; } - break; - case '%': - if (cp[1] == '=') { l = 2; t = TOK_MOD_EQ; } - else if (cp[1] == '>') { l = 2; t = '}'; } - else if (cp[1] == ':') { - if (cp[2] == '%' && cp[3] == ':') { l = 4; t = TOK_DBLHASH; } - else { l = 2; t = '#'; } } - break; - case '+': - if (cp[1] == '+') { l = 2; t = TOK_INCR; } - else if (cp[1] == '=') { l = 2; t = TOK_ADD_EQ; } - break; - case '-': - if (cp[1] == '>' && cp[2] == '*') { l = 3; t = TOK_ARROW_STAR; } - else if (cp[1] == '>') { l = 2; t = TOK_ARROW; } - else if (cp[1] == '-') { l = 2; t = TOK_DECR; } - else if (cp[1] == '=') { l = 2; t = TOK_SUB_EQ; } - break; - case '#': - if (cp[1] == '#') { l = 2; t = TOK_DBLHASH; } - break; - case '\n': - case '\0': - { l = 0; t = 0; } - break; - } - - tokens->tok = t; - tokens->hash = 0; - tokens->text = cp; - tokens->len = l; - } - - return tokens->tok; -} - -/** Initialize the tokenizer. */ -void vtkParse_InitTokenizer( - StringTokenizer *tokens, const char *text, parse_space_t wstype) -{ - tokens->tok = 0; - tokens->hash = 0; - tokens->text = text; - tokens->len = 0; - tokens->ws = wstype; - vtkParse_NextToken(tokens); -} - - -/*---------------------------------------------------------------- - * String allocation methods - * - * Strings are centrally allocated and are const. They should not - * be freed until the parse is complete and all the data structures - * generated by the parse have been freed. - */ - -/* allocate a string of n+1 bytes */ -void vtkParse_InitStringCache(StringCache *cache) -{ - cache->NumberOfChunks = 0; - cache->Chunks = NULL; - cache->ChunkSize = 0; - cache->Position = 0; -} - -/* allocate a string of n+1 bytes */ -char *vtkParse_NewString(StringCache *cache, size_t n) -{ - size_t nextPosition; - char *cp; - - if (cache->ChunkSize == 0) - { - cache->ChunkSize = 8176; - } - - // align next start position on an 8-byte boundary - nextPosition = (((cache->Position + n + 8) | 7 ) - 7); - - if (cache->NumberOfChunks == 0 || nextPosition > cache->ChunkSize) - { - if (n + 1 > cache->ChunkSize) - { - cache->ChunkSize = n + 1; - } - cp = (char *)malloc(cache->ChunkSize); - - /* if empty, alloc for the first time */ - if (cache->NumberOfChunks == 0) - { - cache->Chunks = (char **)malloc(sizeof(char *)); - } - /* if count is power of two, reallocate with double size */ - else if ((cache->NumberOfChunks & (cache->NumberOfChunks-1)) == 0) - { - cache->Chunks = (char **)realloc( - cache->Chunks, (2*cache->NumberOfChunks)*sizeof(char *)); - } - - cache->Chunks[cache->NumberOfChunks++] = cp; - - cache->Position = 0; - nextPosition = (((n + 8) | 7) - 7); - } - - cp = &cache->Chunks[cache->NumberOfChunks-1][cache->Position]; - cp[0] = '\0'; - - cache->Position = nextPosition; - - return cp; -} - -/* free all allocated strings */ -void vtkParse_FreeStringCache(StringCache *cache) -{ - unsigned long i; - - for (i = 0; i < cache->NumberOfChunks; i++) - { - free(cache->Chunks[i]); - } - if (cache->Chunks) - { - free(cache->Chunks); - } - - cache->Chunks = NULL; - cache->NumberOfChunks = 0; -} - -/* duplicate the first n bytes of a string and terminate it */ -const char *vtkParse_CacheString(StringCache *cache, const char *in, size_t n) -{ - char *res = NULL; - - res = vtkParse_NewString(cache, n); - strncpy(res, in, n); - res[n] = '\0'; - - return res; -} diff --git a/src/VTKWrapping/ParaView/vtkParseString.h b/src/VTKWrapping/ParaView/vtkParseString.h deleted file mode 100644 index 47621e94..00000000 --- a/src/VTKWrapping/ParaView/vtkParseString.h +++ /dev/null @@ -1,246 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseString.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2012 David Gobbi. - - Contributed to the VisualizationToolkit by the author in April 2012 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -/** - This file provides string handling routines. - - The two important jobs done by these routines are string tokenization - and string cacheing. - - Tokenization is done as per the rules of a C++ preprocessor, and - breaks the strings into ids, literals, and operators. Any string - is a valid input for the tokenizer, and it is up to the parser to - decide if the resulting tokens are valid within the grammar. The - two primary tokenization functions are vtkParse_InitTokenizer() - and vtkParse_NextToken(). - - Cacheing refers to how string memory management is done. The - parser uses "const char *" for all strings, and expects all strings - to be persistent and constant. These conditions are automatically - met by static strings, but dynamically-generated strings must be - cached until the parse is complete. The primary cacheing functions - are vtkParse_CacheString() and vtkParse_FreeStringCache(). -*/ - -#ifndef VTK_PARSE_STRING_H -#define VTK_PARSE_STRING_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Various important char types for tokenization - */ -typedef enum _parse_char_type -{ - CPRE_ID = 0x01, /* A-Z a-z and _ */ - CPRE_DIGIT = 0x02, /* 0-9 */ - CPRE_IDGIT = 0x03, /* 0-9 A-Z a-z and _ */ - CPRE_HEX = 0x04, /* 0-9A-Fa-f */ - CPRE_EXP = 0x08, /* EPep (exponents for floats) */ - CPRE_SIGN = 0x10, /* +- (sign for floats) */ - CPRE_QUOTE = 0x20, /* " and ' */ - CPRE_HSPACE = 0x40, /* space, tab, carriage return */ - CPRE_VSPACE = 0x80, /* newline, vertical tab, form feed */ - CPRE_WHITE = 0xC0, /* all whitespace characters */ -} parse_char_type; - -/** - * Character type lookup table - */ -extern unsigned char parse_charbits[256]; - -/** - * Macro to check if a char is of a certain type - */ -#define vtkParse_CharType(c, bits) \ - ((parse_charbits[(unsigned char)(c)] & (bits)) != 0) - -/** - * Whitespace types that can be used with the tokenizer. - * - WS_DEFAULT treats newlines and formfeeds as regular whitespace. - * - WS_PREPROC treats newline as end-of-line, not as whitespace. - * - WS_COMMENT treats comments as tokens, not as whitespace. - */ -typedef enum _parse_space_t -{ - WS_DEFAULT = CPRE_WHITE, /* skip all whitespace */ - WS_PREPROC = CPRE_HSPACE, /* skip horizontal whitespace only */ - WS_COMMENT = (CPRE_WHITE | 0x100), /* comments as tokens */ -} parse_space_t; - -/** - * Preprocessor tokens for C++. - */ -typedef enum _preproc_token_t -{ - TOK_OTHER = 257, - TOK_ID, /* any id */ - TOK_CHAR, /* char literal */ - TOK_STRING, /* string literal */ - TOK_NUMBER, /* any numeric literal */ - TOK_COMMENT, /* C or C++ comment */ - TOK_DBLHASH, /* ## */ - TOK_SCOPE, /* :: */ - TOK_INCR, /* ++ */ - TOK_DECR, /* -- */ - TOK_RSHIFT, /* >> */ - TOK_LSHIFT, /* << */ - TOK_AND, /* && */ - TOK_OR, /* || */ - TOK_EQ, /* == */ - TOK_NE, /* != */ - TOK_GE, /* >= */ - TOK_LE, /* <= */ - TOK_ADD_EQ, /* += */ - TOK_SUB_EQ, /* -= */ - TOK_MUL_EQ, /* *= */ - TOK_DIV_EQ, /* /= */ - TOK_MOD_EQ, /* %= */ - TOK_AND_EQ, /* &= */ - TOK_OR_EQ, /* |= */ - TOK_XOR_EQ, /* ^= */ - TOK_ARROW, /* -> */ - TOK_DOT_STAR, /* .* */ - TOK_ARROW_STAR,/* ->* */ - TOK_RSHIFT_EQ, /* >>= */ - TOK_LSHIFT_EQ, /* <<= */ - TOK_ELLIPSIS, /* ... */ -} preproc_token_t; - -/** - * A struct for going through a string one token at a time. - * If ws is set to WS_PREPROC, then tokenization stops when a - * newline or null is encountered. If ws is set to WS_DEFAULT, - * then tokenization only stops when a null is encountered. If - * ws is set to WS_COMMENT, then tokenization stops only when - * a null is encountered, and comments are returned as tokens - * instead of being skipped as whitespace. - */ -typedef struct _StringTokenizer -{ - int tok; /* the current token */ - unsigned int hash; /* the hash of the current token, if it is an id */ - const char *text; /* the text for the current token, not null-teminated */ - size_t len; /* the length of the current token */ - parse_space_t ws; /* controls what to consider as whitespace */ -} StringTokenizer; - -/** - * Initialize the tokenizer and get the first token. - */ -void vtkParse_InitTokenizer( - StringTokenizer *tokens, const char *text, parse_space_t wstype); - -/** - * Return the next preprocessor token, or '0' if none left. - */ -int vtkParse_NextToken(StringTokenizer *tokens); - -/** - * Skip over whitespace. - * Return the number of chars until the first non-whitespace token. - * Set spacetype to WS_DEFAULT, WS_PREPROC, or WS_COMMENT. - */ -size_t vtkParse_SkipWhitespace( - const char *cp, parse_space_t spacetype); - -/** - * Skip over a comment, C style or C++ style. - * Return the number of chars until the end of the comment. - */ -size_t vtkParse_SkipComment(const char *cp); - -/** - * Skip over a string in double or single quotes. - * Return the number of chars until the end of the quotes. - */ -size_t vtkParse_SkipQuotes(const char *cp); - -/** - * Skip over a number. Uses preprocessor semantics. - * Return the number of chars until the end of the number. - */ -size_t vtkParse_SkipNumber(const char *cp); - -/** - * Skip over an identifier. - * Return the number of chars until the end of the identifier. - */ -size_t vtkParse_SkipId(const char *cp); - -/** - * Compute the hash for a id, for use in hash table lookups. - * This stops at the first non-Id character, so it is safe to use - * on a string that is not null-terminated as long as there is either - * whitespace or an operator character before the end of the string. - * It can be used on null-terminated strings as well, of course. - */ -unsigned int vtkParse_HashId(const char *cp); - - -/** - * StringCache provides a simple way of allocating strings centrally. - * It eliminates the need to allocate and free each individual string, - * which makes the code simpler and more efficient. - */ -typedef struct _StringCache -{ - unsigned long NumberOfChunks; - char **Chunks; - size_t ChunkSize; - size_t Position; -} StringCache; - -/** - * Initialize the string cache. - */ -void vtkParse_InitStringCache(StringCache *cache); - -/** - * Alocate a new string from the cache. - * A total of n+1 bytes will be allocated, to leave room for null. - */ -char *vtkParse_NewString(StringCache *cache, size_t n); - -/** - * Cache a string so that it can then be used in the vtkParse data - * structures. The string will last until the application exits. - * At most 'n' chars will be copied, and the string will be terminated. - * If a null pointer is provided, then a null pointer will be returned. - */ -const char *vtkParse_CacheString( - StringCache *cache, const char *cp, size_t n); - -/** - * Free all strings that were created with vtkParse_NewString() or - * with vtkParse_CacheString(). - */ -void vtkParse_FreeStringCache(StringCache *cache); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/VTKWrapping/ParaView/vtkWrap.c b/src/VTKWrapping/ParaView/vtkWrap.c deleted file mode 100644 index d9846b9b..00000000 --- a/src/VTKWrapping/ParaView/vtkWrap.c +++ /dev/null @@ -1,1040 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkWrap.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -#include "vtkWrap.h" -#include "vtkParseData.h" -#include "vtkParseExtras.h" -#include "vtkParseString.h" -#include -#include -#include - -/* -------------------------------------------------------------------- */ -/* Common types. */ - -int vtkWrap_IsVoid(ValueInfo *val) -{ - if (val == 0) - { - return 1; - } - - return ((val->Type & VTK_PARSE_UNQUALIFIED_TYPE) == VTK_PARSE_VOID); -} - -int vtkWrap_IsVoidFunction(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); - - if (t == VTK_PARSE_FUNCTION_PTR || t == VTK_PARSE_FUNCTION) - { - /* check for signature "void (*func)(void *)" */ - if (val->Function->NumberOfParameters == 1 && - val->Function->Parameters[0]->Type == VTK_PARSE_VOID_PTR && - val->Function->Parameters[0]->NumberOfDimensions == 0 && - val->Function->ReturnValue->Type == VTK_PARSE_VOID) - { - return 1; - } - } - - return 0; -} - -int vtkWrap_IsVoidPointer(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_VOID && vtkWrap_IsPointer(val)); -} - -int vtkWrap_IsCharPointer(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_CHAR && vtkWrap_IsPointer(val)); -} - -int vtkWrap_IsPODPointer(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t != VTK_PARSE_CHAR && vtkWrap_IsNumeric(val) && - vtkWrap_IsPointer(val)); -} - -int vtkWrap_IsVTKObject(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); - return (t == VTK_PARSE_OBJECT_PTR && - val->Class[0] == 'v' && strncmp(val->Class, "vtk", 3) == 0); -} - -int vtkWrap_IsSpecialObject(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); - return ((t == VTK_PARSE_OBJECT || - t == VTK_PARSE_OBJECT_REF) && - val->Class[0] == 'v' && strncmp(val->Class, "vtk", 3) == 0); -} - -int vtkWrap_IsQtObject(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - if (t == VTK_PARSE_QOBJECT && - val->Class[0] == 'Q' && isupper(val->Class[1])) - { - return 1; - } - return 0; -} - -int vtkWrap_IsQtEnum(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); - if ((t == VTK_PARSE_QOBJECT || t == VTK_PARSE_QOBJECT_REF) && - val->Class[0] == 'Q' && strncmp("Qt::", val->Class, 4) == 0) - { - return 1; - } - return 0; -} - - -/* -------------------------------------------------------------------- */ -/* The base types, all are mutually exclusive. */ - -int vtkWrap_IsObject(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_OBJECT || - t == VTK_PARSE_QOBJECT); -} - -int vtkWrap_IsFunction(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_FUNCTION); -} - -int vtkWrap_IsStream(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_ISTREAM || - t == VTK_PARSE_OSTREAM); -} - -int vtkWrap_IsNumeric(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - - t = (t & ~VTK_PARSE_UNSIGNED); - switch (t) - { - case VTK_PARSE_FLOAT: - case VTK_PARSE_DOUBLE: - case VTK_PARSE_CHAR: - case VTK_PARSE_SHORT: - case VTK_PARSE_INT: - case VTK_PARSE_LONG: - case VTK_PARSE_ID_TYPE: - case VTK_PARSE_LONG_LONG: - case VTK_PARSE___INT64: - case VTK_PARSE_SIGNED_CHAR: - case VTK_PARSE_SSIZE_T: - case VTK_PARSE_BOOL: - return 1; - } - - return 0; -} - -int vtkWrap_IsString(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_STRING || - t == VTK_PARSE_UNICODE_STRING); -} - -/* -------------------------------------------------------------------- */ -/* Subcategories */ - -int vtkWrap_IsBool(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_BOOL); -} - -int vtkWrap_IsChar(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_CHAR); -} - -int vtkWrap_IsInteger(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - - if (t != VTK_PARSE_UNSIGNED_CHAR) - { - t = (t & ~VTK_PARSE_UNSIGNED); - } - switch (t) - { - case VTK_PARSE_SHORT: - case VTK_PARSE_INT: - case VTK_PARSE_LONG: - case VTK_PARSE_ID_TYPE: - case VTK_PARSE_LONG_LONG: - case VTK_PARSE___INT64: - case VTK_PARSE_UNSIGNED_CHAR: - case VTK_PARSE_SIGNED_CHAR: - case VTK_PARSE_SSIZE_T: - return 1; - } - - return 0; -} - -int vtkWrap_IsRealNumber(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_FLOAT || t == VTK_PARSE_DOUBLE); -} - -/* -------------------------------------------------------------------- */ -/* These are mutually exclusive, as well. */ - -int vtkWrap_IsScalar(ValueInfo *val) -{ - unsigned int i = (val->Type & VTK_PARSE_POINTER_MASK); - return (i == 0); -} - -int vtkWrap_IsPointer(ValueInfo *val) -{ - unsigned int i = (val->Type & VTK_PARSE_POINTER_MASK); - return (i == VTK_PARSE_POINTER && val->Count == 0 && - val->CountHint == 0 && val->NumberOfDimensions <= 1); -} - -int vtkWrap_IsArray(ValueInfo *val) -{ - unsigned int i = (val->Type & VTK_PARSE_POINTER_MASK); - return (i == VTK_PARSE_POINTER && val->NumberOfDimensions <= 1 && - (val->Count != 0 || val->CountHint != 0)); -} - -int vtkWrap_IsNArray(ValueInfo *val) -{ - int j = 0; - unsigned int i = (val->Type & VTK_PARSE_POINTER_MASK); - if (i != VTK_PARSE_ARRAY || val->NumberOfDimensions <= 1) - { - return 0; - } - for (j = 0; j < val->NumberOfDimensions; j++) - { - if (val->Dimensions[j] == NULL || val->Dimensions[j][0] == '\0') - { - return 0; - } - } - return 1; -} - - -/* -------------------------------------------------------------------- */ -/* Other type properties, not mutually exclusive. */ - -int vtkWrap_IsNonConstRef(ValueInfo *val) -{ - return ((val->Type & VTK_PARSE_REF) != 0 && - (val->Type & VTK_PARSE_CONST) == 0); -} - -int vtkWrap_IsConstRef(ValueInfo *val) -{ - return ((val->Type & VTK_PARSE_REF) != 0 && - (val->Type & VTK_PARSE_CONST) != 0); -} - -int vtkWrap_IsRef(ValueInfo *val) -{ - return ((val->Type & VTK_PARSE_REF) != 0); -} - -int vtkWrap_IsConst(ValueInfo *val) -{ - return ((val->Type & VTK_PARSE_CONST) != 0); -} - -/* -------------------------------------------------------------------- */ -/* Hints */ - -int vtkWrap_IsNewInstance(ValueInfo *val) -{ - return ((val->Type & VTK_PARSE_NEWINSTANCE) != 0); -} - -/* -------------------------------------------------------------------- */ -/* Constructor/Destructor checks */ - -int vtkWrap_IsConstructor(ClassInfo *c, FunctionInfo *f) - -{ - size_t i, m; - const char *cp = c->Name; - - if (cp && f->Name && !vtkWrap_IsDestructor(c, f)) - { - /* remove namespaces and template parameters from the name */ - m = vtkParse_UnscopedNameLength(cp); - while (cp[m] == ':' && cp[m+1] == ':') - { - cp += m + 2; - m = vtkParse_UnscopedNameLength(cp); - } - for (i = 0; i < m; i++) - { - if (cp[i] == '<') - { - break; - } - } - - return (i == strlen(f->Name) && strncmp(cp, f->Name, i) == 0); - } - - return 0; -} - -int vtkWrap_IsDestructor(ClassInfo *c, FunctionInfo *f) -{ - size_t i; - const char *cp; - - if (c->Name && f->Name) - { - cp = f->Signature; - for (i = 0; cp[i] != '\0' && cp[i] != '('; i++) - { - if (cp[i] == '~') - { - return 1; - } - } - } - - return 0; -} - -int vtkWrap_IsSetVectorMethod(FunctionInfo *f) -{ - if (f->Macro && strncmp(f->Macro, "vtkSetVector", 12) == 0) - { - return 1; - } - - return 0; -} - -int vtkWrap_IsGetVectorMethod(FunctionInfo *f) -{ - if (f->Macro && strncmp(f->Macro, "vtkGetVector", 12) == 0) - { - return 1; - } - - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Argument counting */ - -int vtkWrap_CountWrappedParameters(FunctionInfo *f) -{ - int totalArgs = f->NumberOfParameters; - - if (totalArgs > 0 && - (f->Parameters[0]->Type & VTK_PARSE_BASE_TYPE) - == VTK_PARSE_FUNCTION) - { - totalArgs = 1; - } - else if (totalArgs == 1 && - (f->Parameters[0]->Type & VTK_PARSE_UNQUALIFIED_TYPE) - == VTK_PARSE_VOID) - { - totalArgs = 0; - } - - return totalArgs; -} - -int vtkWrap_CountRequiredArguments(FunctionInfo *f) -{ - int requiredArgs = 0; - int totalArgs; - int i; - - totalArgs = vtkWrap_CountWrappedParameters(f); - - for (i = 0; i < totalArgs; i++) - { - if (f->Parameters[i]->Value == NULL || - vtkWrap_IsArray(f->Parameters[i]) || - vtkWrap_IsNArray(f->Parameters[i])) - { - requiredArgs = i+1; - } - } - - return requiredArgs; -} - -/* -------------------------------------------------------------------- */ -/* Check whether the class is derived from vtkObjectBase. */ - -int vtkWrap_IsVTKObjectBaseType( - HierarchyInfo *hinfo, const char *classname) -{ - HierarchyEntry *entry; - - if (hinfo) - { - entry = vtkParseHierarchy_FindEntry(hinfo, classname); - if (entry) - { - if (vtkParseHierarchy_IsTypeOf(hinfo, entry, "vtkObjectBase")) - { - return 1; - } - return 0; - } - } - - /* fallback if no HierarchyInfo */ - if (strncmp("vtk", classname, 3) == 0) - { - return 1; - } - - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Check if the WRAP_SPECIAL flag is set for the class. */ - -int vtkWrap_IsSpecialType( - HierarchyInfo *hinfo, const char *classname) -{ - HierarchyEntry *entry; - - if (hinfo) - { - entry = vtkParseHierarchy_FindEntry(hinfo, classname); - if (entry && vtkParseHierarchy_GetProperty(entry, "WRAP_SPECIAL")) - { - return 1; - } - return 0; - } - - /* fallback if no HierarchyInfo */ - if (strncmp("vtk", classname, 3) == 0) - { - return -1; - } - - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Check if the class is derived from superclass */ - -int vtkWrap_IsTypeOf( - HierarchyInfo *hinfo, const char *classname, const char *superclass) -{ - HierarchyEntry *entry; - - if (strcmp(classname, superclass) == 0) - { - return 1; - } - - if (hinfo) - { - entry = vtkParseHierarchy_FindEntry(hinfo, classname); - if (entry && vtkParseHierarchy_IsTypeOf(hinfo, entry, superclass)) - { - return 1; - } - } - - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Make a guess about whether a class is wrapped */ - -int vtkWrap_IsClassWrapped( - HierarchyInfo *hinfo, const char *classname) -{ - if (hinfo) - { - HierarchyEntry *entry; - entry = vtkParseHierarchy_FindEntry(hinfo, classname); - - if (entry) - { - if (!vtkParseHierarchy_GetProperty(entry, "WRAP_EXCLUDE") || - vtkParseHierarchy_GetProperty(entry, "WRAP_SPECIAL")) - { - return 1; - } - } - } - else if (strncmp("vtk", classname, 3) == 0) - { - return 1; - } - - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Check whether the destructor is public */ -int vtkWrap_HasPublicDestructor(ClassInfo *data) -{ - FunctionInfo *func; - int i; - - for (i = 0; i < data->NumberOfFunctions; i++) - { - func = data->Functions[i]; - - if (vtkWrap_IsDestructor(data, func) && - func->Access != VTK_ACCESS_PUBLIC) - { - return 0; - } - } - - return 1; -} - -/* -------------------------------------------------------------------- */ -/* Check whether the copy constructor is public */ -int vtkWrap_HasPublicCopyConstructor(ClassInfo *data) -{ - FunctionInfo *func; - int i; - - for (i = 0; i < data->NumberOfFunctions; i++) - { - func = data->Functions[i]; - - if (vtkWrap_IsConstructor(data, func) && - func->NumberOfParameters == 1 && - func->Parameters[0]->Class && - strcmp(func->Parameters[0]->Class, data->Name) == 0 && - func->Access != VTK_ACCESS_PUBLIC) - { - return 0; - } - } - - return 1; -} - -/* -------------------------------------------------------------------- */ -/* Get the size for subclasses of vtkTuple */ -int vtkWrap_GetTupleSize(ClassInfo *data, HierarchyInfo *hinfo) -{ - HierarchyEntry *entry; - const char *classname = NULL; - size_t m; - int size = 0; - - entry = vtkParseHierarchy_FindEntry(hinfo, data->Name); - if (entry && vtkParseHierarchy_IsTypeOfTemplated( - hinfo, entry, data->Name, "vtkTuple", &classname)) - { - /* attempt to get count from template parameter */ - if (classname) - { - m = strlen(classname); - if (m > 2 && classname[m - 1] == '>' && - isdigit(classname[m-2]) && (classname[m-3] == ' ' || - classname[m-3] == ',' || classname[m-3] == '<')) - { - size = classname[m-2] - '0'; - } - free((char *)classname); - } - } - - return size; -} - -/* -------------------------------------------------------------------- */ -/* This sets the CountHint for vtkDataArray methods where the - * tuple size is equal to GetNumberOfComponents. */ -void vtkWrap_FindCountHints( - ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo) -{ - int i; - int count; - const char *countMethod; - FunctionInfo *theFunc; - - /* add hints for vtkInformation get methods */ - if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkInformation")) - { - countMethod = "Length(temp0)"; - - for (i = 0; i < data->NumberOfFunctions; i++) - { - theFunc = data->Functions[i]; - - if (strcmp(theFunc->Name, "Get") == 0 && - theFunc->NumberOfParameters >= 1 && - theFunc->Parameters[0]->Type == VTK_PARSE_OBJECT_PTR && - (strcmp(theFunc->Parameters[0]->Class, - "vtkInformationIntegerVectorKey") == 0 || - strcmp(theFunc->Parameters[0]->Class, - "vtkInformationDoubleVectorKey") == 0)) - { - if (theFunc->ReturnValue && theFunc->ReturnValue->Count == 0 && - theFunc->NumberOfParameters == 1) - { - theFunc->ReturnValue->CountHint = countMethod; - } - } - } - } - - /* add hints for array GetTuple methods */ - if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkDataArray")) - { - countMethod = "GetNumberOfComponents()"; - - for (i = 0; i < data->NumberOfFunctions; i++) - { - theFunc = data->Functions[i]; - - if ((strcmp(theFunc->Name, "GetTuple") == 0 || - strcmp(theFunc->Name, "GetTupleValue") == 0) && - theFunc->ReturnValue && theFunc->ReturnValue->Count == 0 && - theFunc->NumberOfParameters == 1 && - theFunc->Parameters[0]->Type == VTK_PARSE_ID_TYPE) - { - theFunc->ReturnValue->CountHint = countMethod; - } - else if ((strcmp(theFunc->Name, "SetTuple") == 0 || - strcmp(theFunc->Name, "SetTupleValue") == 0 || - strcmp(theFunc->Name, "GetTuple") == 0 || - strcmp(theFunc->Name, "GetTupleValue") == 0 || - strcmp(theFunc->Name, "InsertTuple") == 0 || - strcmp(theFunc->Name, "InsertTupleValue") == 0) && - theFunc->NumberOfParameters == 2 && - theFunc->Parameters[0]->Type == VTK_PARSE_ID_TYPE && - theFunc->Parameters[1]->Count == 0) - { - theFunc->Parameters[1]->CountHint = countMethod; - } - else if ((strcmp(theFunc->Name, "InsertNextTuple") == 0 || - strcmp(theFunc->Name, "InsertNextTupleValue") == 0) && - theFunc->NumberOfParameters == 1 && - theFunc->Parameters[0]->Count == 0) - { - theFunc->Parameters[0]->CountHint = countMethod; - } - } - } - - /* add hints for interpolator Interpolate methods */ - if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkAbstractImageInterpolator")) - { - countMethod = "GetNumberOfComponents()"; - - for (i = 0; i < data->NumberOfFunctions; i++) - { - theFunc = data->Functions[i]; - - if (strcmp(theFunc->Name, "Interpolate") == 0 && - theFunc->NumberOfParameters == 2 && - theFunc->Parameters[0]->Type == (VTK_PARSE_DOUBLE_PTR|VTK_PARSE_CONST) && - theFunc->Parameters[0]->Count == 3 && - theFunc->Parameters[1]->Type == VTK_PARSE_DOUBLE_PTR && - theFunc->Parameters[1]->Count == 0) - { - theFunc->Parameters[1]->CountHint = countMethod; - } - } - } - - for (i = 0; i < data->NumberOfFunctions; i++) - { - theFunc = data->Functions[i]; - - /* hints for constructors that take arrays */ - if (vtkWrap_IsConstructor(data, theFunc) && - theFunc->NumberOfParameters == 1 && - vtkWrap_IsPointer(theFunc->Parameters[0]) && - vtkWrap_IsNumeric(theFunc->Parameters[0]) && - theFunc->Parameters[0]->Count == 0 && - hinfo) - { - count = vtkWrap_GetTupleSize(data, hinfo); - if (count) - { - char counttext[24]; - sprintf(counttext, "%d", count); - theFunc->Parameters[0]->Count = count; - vtkParse_AddStringToArray( - &theFunc->Parameters[0]->Dimensions, - &theFunc->Parameters[0]->NumberOfDimensions, - vtkParse_CacheString(finfo->Strings, counttext, strlen(counttext))); - } - } - - /* hints for operator[] index range */ - if (theFunc->IsOperator && theFunc->Name && - strcmp(theFunc->Name, "operator[]") == 0) - { - if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkTuple")) - { - theFunc->SizeHint = "GetSize()"; - } - else if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArrayCoordinates") || - vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArrayExtents") || - vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArraySort")) - { - theFunc->SizeHint = "GetDimensions()"; - } - else if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArrayExtentsList") || - vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArrayWeights")) - { - theFunc->SizeHint = "GetCount()"; - } - } - } -} - -/* -------------------------------------------------------------------- */ -/* This sets the NewInstance hint for generator methods. */ -void vtkWrap_FindNewInstanceMethods( - ClassInfo *data, HierarchyInfo *hinfo) -{ - int i; - FunctionInfo *theFunc; - - for (i = 0; i < data->NumberOfFunctions; i++) - { - theFunc = data->Functions[i]; - if (theFunc->Name && theFunc->ReturnValue && - vtkWrap_IsVTKObject(theFunc->ReturnValue) && - vtkWrap_IsVTKObjectBaseType(hinfo, theFunc->ReturnValue->Class)) - { - if (strcmp(theFunc->Name, "NewInstance") == 0 || - strcmp(theFunc->Name, "CreateInstance") == 0 || - (strcmp(theFunc->Name, "CreateLookupTable") == 0 && - strcmp(data->Name, "vtkColorSeries") == 0) || - (strcmp(theFunc->Name, "CreateImageReader2") == 0 && - strcmp(data->Name, "vtkImageReader2Factory") == 0) || - (strcmp(theFunc->Name, "CreateDataArray") == 0 && - strcmp(data->Name, "vtkDataArray") == 0) || - (strcmp(theFunc->Name, "CreateArray") == 0 && - strcmp(data->Name, "vtkAbstractArray") == 0) || - (strcmp(theFunc->Name, "CreateArray") == 0 && - strcmp(data->Name, "vtkArray") == 0) || - (strcmp(theFunc->Name, "GetQueryInstance") == 0 && - strcmp(data->Name, "vtkSQLDatabase") == 0) || - (strcmp(theFunc->Name, "CreateFromURL") == 0 && - strcmp(data->Name, "vtkSQLDatabase") == 0) || - (strcmp(theFunc->Name, "MakeTransform") == 0 && - vtkWrap_IsTypeOf(hinfo, data->Name, "vtkAbstractTransform"))) - { - theFunc->ReturnValue->Type |= VTK_PARSE_NEWINSTANCE; - } - } - } -} - - -/* -------------------------------------------------------------------- */ -/* Expand all typedef types that are used in function arguments */ -void vtkWrap_ExpandTypedefs( - ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo) -{ - int i, j, n; - FunctionInfo *funcInfo; - const char *newclass; - - n = data->NumberOfSuperClasses; - for (i = 0; i < n; i++) - { - newclass = vtkParseHierarchy_ExpandTypedefsInName( - hinfo, data->SuperClasses[i], NULL); - if (newclass != data->SuperClasses[i]) - { - data->SuperClasses[i] = - vtkParse_CacheString(finfo->Strings, newclass, strlen(newclass)); - free((char *)newclass); - } - } - - n = data->NumberOfFunctions; - for (i = 0; i < n; i++) - { - funcInfo = data->Functions[i]; - if (funcInfo->Access == VTK_ACCESS_PUBLIC) - { - for (j = 0; j < funcInfo->NumberOfParameters; j++) - { - vtkParseHierarchy_ExpandTypedefsInValue( - hinfo, funcInfo->Parameters[j], finfo->Strings, data->Name); - } - if (funcInfo->ReturnValue) - { - vtkParseHierarchy_ExpandTypedefsInValue( - hinfo, funcInfo->ReturnValue, finfo->Strings, data->Name); - } - } - } -} - - -/* -------------------------------------------------------------------- */ -/* get the type name */ - -const char *vtkWrap_GetTypeName(ValueInfo *val) -{ - unsigned int aType = val->Type; - const char *aClass = val->Class; - - /* print the type itself */ - switch (aType & VTK_PARSE_BASE_TYPE) - { - case VTK_PARSE_FLOAT: return "float"; - case VTK_PARSE_DOUBLE: return "double"; - case VTK_PARSE_INT: return "int"; - case VTK_PARSE_SHORT: return "short"; - case VTK_PARSE_LONG: return "long"; - case VTK_PARSE_VOID: return "void "; - case VTK_PARSE_CHAR: return "char"; - case VTK_PARSE_UNSIGNED_INT: return "unsigned int"; - case VTK_PARSE_UNSIGNED_SHORT: return "unsigned short"; - case VTK_PARSE_UNSIGNED_LONG: return "unsigned long"; - case VTK_PARSE_UNSIGNED_CHAR: return "unsigned char"; - case VTK_PARSE_ID_TYPE: return "vtkIdType"; - case VTK_PARSE_LONG_LONG: return "long long"; - case VTK_PARSE___INT64: return "__int64"; - case VTK_PARSE_UNSIGNED_LONG_LONG: return "unsigned long long"; - case VTK_PARSE_UNSIGNED___INT64: return "unsigned __int64"; - case VTK_PARSE_SIGNED_CHAR: return "signed char"; - case VTK_PARSE_BOOL: return "bool"; - case VTK_PARSE_UNICODE_STRING: return "vtkUnicodeString"; - case VTK_PARSE_SSIZE_T: return "ssize_t"; - case VTK_PARSE_SIZE_T: return "size_t"; - } - - return aClass; -} - -/* -------------------------------------------------------------------- */ -/* variable declarations */ - -void vtkWrap_DeclareVariable( - FILE *fp, ValueInfo *val, const char *name, int i, int flags) -{ - unsigned int aType; - int j; - - if (val == NULL) - { - return; - } - - aType = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); - - /* do nothing for void */ - if (aType == VTK_PARSE_VOID || - (aType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_FUNCTION) - { - return; - } - - /* add a couple spaces */ - fprintf(fp," "); - - /* for const * return types, prepend with const */ - if ((flags & VTK_WRAP_RETURN) != 0) - { - if ((val->Type & VTK_PARSE_CONST) != 0 && - (aType & VTK_PARSE_INDIRECT) != 0) - { - fprintf(fp,"const "); - } - } - /* do the same for "const char *" with initializer */ - else - { - if ((val->Type & VTK_PARSE_CONST) != 0 && - aType == VTK_PARSE_CHAR_PTR && - val->Value && - strcmp(val->Value, "0") != 0 && - strcmp(val->Value, "NULL") != 0) - { - fprintf(fp,"const "); - } - } - - /* print the type name */ - fprintf(fp, "%s ", vtkWrap_GetTypeName(val)); - - /* indirection */ - if ((flags & VTK_WRAP_RETURN) != 0) - { - /* ref and pointer return values are stored as pointers */ - if ((aType & VTK_PARSE_INDIRECT) == VTK_PARSE_POINTER || - (aType & VTK_PARSE_INDIRECT) == VTK_PARSE_REF) - { - fprintf(fp, "*"); - } - } - else - { - /* objects refs and pointers are always handled via pointers, - * other refs are passed by value */ - if (aType == VTK_PARSE_CHAR_PTR || - aType == VTK_PARSE_VOID_PTR || - aType == VTK_PARSE_OBJECT_PTR || - aType == VTK_PARSE_OBJECT_REF || - aType == VTK_PARSE_OBJECT || - vtkWrap_IsQtObject(val)) - { - fprintf(fp, "*"); - } - /* arrays of unknown size are handled via pointers */ - else if (val->CountHint || vtkWrap_IsPODPointer(val)) - { - fprintf(fp, "*"); - } - } - - /* the variable name */ - if (i >= 0) - { - fprintf(fp,"%s%i", name, i); - } - else - { - fprintf(fp,"%s", name); - } - - if ((flags & VTK_WRAP_ARG) != 0) - { - /* print the array decorators */ - if (((aType & VTK_PARSE_POINTER_MASK) != 0) && - aType != VTK_PARSE_CHAR_PTR && - aType != VTK_PARSE_VOID_PTR && - aType != VTK_PARSE_OBJECT_PTR && - !vtkWrap_IsQtObject(val) && - val->CountHint == NULL && - !vtkWrap_IsPODPointer(val)) - { - if (val->NumberOfDimensions == 1 && val->Count > 0) - { - fprintf(fp, "[%d]", val->Count); - } - else - { - for (j = 0; j < val->NumberOfDimensions; j++) - { - fprintf(fp, "[%s]", val->Dimensions[j]); - } - } - } - - /* add a default value */ - else if (val->Value) - { - fprintf(fp, " = %s", val->Value); - } - else if (aType == VTK_PARSE_CHAR_PTR || - aType == VTK_PARSE_VOID_PTR || - aType == VTK_PARSE_OBJECT_PTR || - aType == VTK_PARSE_OBJECT_REF || - aType == VTK_PARSE_OBJECT || - vtkWrap_IsQtObject(val)) - { - fprintf(fp, " = NULL"); - } - else if (val->CountHint || vtkWrap_IsPODPointer(val)) - { - fprintf(fp, " = NULL"); - } - else if (aType == VTK_PARSE_BOOL) - { - fprintf(fp, " = false"); - } - } - - /* finish off with a semicolon */ - if ((flags & VTK_WRAP_NOSEMI) == 0) - { - fprintf(fp, ";\n"); - } -} - -void vtkWrap_DeclareVariableSize( - FILE *fp, ValueInfo *val, const char *name, int i) -{ - char idx[32]; - int j; - - idx[0] = '\0'; - if (i >= 0) - { - sprintf(idx, "%d", i); - } - - if (val->NumberOfDimensions > 1) - { - fprintf(fp, - " static int %s%s[%d] = ", - name, idx, val->NumberOfDimensions); - - for (j = 0; j < val->NumberOfDimensions; j++) - { - fprintf(fp, "%c %s", ((j == 0) ? '{' : ','), val->Dimensions[j]); - } - - fprintf(fp, " };\n"); - } - else if (val->Count != 0 || val->CountHint || vtkWrap_IsPODPointer(val)) - { - fprintf(fp, - " %sint %s%s = %d;\n", - (val->Count == 0 ? "" : "const "), name, idx, - (val->Count == 0 ? 0 : val->Count)); - } - else if (val->NumberOfDimensions == 1) - { - fprintf(fp, - " const int %s%s = %s;\n", - name, idx, val->Dimensions[0]); - } -} diff --git a/src/VTKWrapping/ParaView/vtkWrap.h b/src/VTKWrapping/ParaView/vtkWrap.h deleted file mode 100644 index 04d216db..00000000 --- a/src/VTKWrapping/ParaView/vtkWrap.h +++ /dev/null @@ -1,250 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkWrap.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -/** - * vtkWrap provides useful functions for generating wrapping code. -*/ - -#ifndef VTK_WRAP_H -#define VTK_WRAP_H - -#include "vtkParse.h" -#include "vtkParseHierarchy.h" - -/** - * For use with vtkWrap_DeclareVariable. - */ -/*@{*/ -#define VTK_WRAP_RETURN 1 -#define VTK_WRAP_ARG 2 -#define VTK_WRAP_NOSEMI 4 -/*@}*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Check for common types. - * IsPODPointer is for unsized arrays of POD types. - */ -/*@{*/ -int vtkWrap_IsVoid(ValueInfo *val); -int vtkWrap_IsVoidFunction(ValueInfo *val); -int vtkWrap_IsVoidPointer(ValueInfo *val); -int vtkWrap_IsCharPointer(ValueInfo *val); -int vtkWrap_IsPODPointer(ValueInfo *val); -int vtkWrap_IsVTKObject(ValueInfo *val); -int vtkWrap_IsSpecialObject(ValueInfo *val); -int vtkWrap_IsQtObject(ValueInfo *val); -int vtkWrap_IsQtEnum(ValueInfo *val); -/*@}*/ - -/** - * The basic types, all are mutually exclusive. - * Note that enums are considered to be objects, - * bool and char are considered to be numeric. - */ -/*@{*/ -int vtkWrap_IsObject(ValueInfo *val); -int vtkWrap_IsFunction(ValueInfo *val); -int vtkWrap_IsStream(ValueInfo *val); -int vtkWrap_IsNumeric(ValueInfo *val); -int vtkWrap_IsString(ValueInfo *val); -/*@}*/ - -/** - * Subcategories of numeric types. In this categorization, - * bool and char are not considered to be integers. - */ -/*@{*/ -int vtkWrap_IsBool(ValueInfo *val); -int vtkWrap_IsChar(ValueInfo *val); -int vtkWrap_IsInteger(ValueInfo *val); -int vtkWrap_IsRealNumber(ValueInfo *val); -/*@}*/ - -/** - * Arrays and pointers. These are mutually exclusive. - * IsPointer() does not include pointers to pointers. - * IsArray() and IsNArray() do not include unsized arrays. - * Arrays of pointers are not included in any of these. - */ -/*@{*/ -int vtkWrap_IsScalar(ValueInfo *val); -int vtkWrap_IsPointer(ValueInfo *val); -int vtkWrap_IsArray(ValueInfo *val); -int vtkWrap_IsNArray(ValueInfo *val); -/*@}*/ - -/** - * Properties that can combine with other properties. - */ -/*@{*/ -int vtkWrap_IsNonConstRef(ValueInfo *val); -int vtkWrap_IsConstRef(ValueInfo *val); -int vtkWrap_IsRef(ValueInfo *val); -int vtkWrap_IsConst(ValueInfo *val); -/*@}*/ - -/** - * Hints. - * NewInstance objects must be freed by the caller. - */ -/*@{*/ -int vtkWrap_IsNewInstance(ValueInfo *val); -/*@}*/ - - -/** - * Check whether the class is derived from vtkObjectBase. - * If "hinfo" is NULL, this just checks that the class - * name starts with "vtk". - */ -int vtkWrap_IsVTKObjectBaseType( - HierarchyInfo *hinfo, const char *classname); - -/** - * Check if the WRAP_SPECIAL flag is set for the class. - * If "hinfo" is NULL, it defaults to just checking if - * the class starts with "vtk" and returns -1 if so. - */ -int vtkWrap_IsSpecialType( - HierarchyInfo *hinfo, const char *classname); - -/** - * Check if the class is derived from superclass. - * If "hinfo" is NULL, then only an exact match to the - * superclass will succeed. - */ -int vtkWrap_IsTypeOf( - HierarchyInfo *hinfo, const char *classname, const char *superclass); - -/** - * Check whether a class is wrapped. If "hinfo" is NULL, - * it just checks that the class starts with "vtk". - */ -int vtkWrap_IsClassWrapped( - HierarchyInfo *hinfo, const char *classname); - -/** - * Check whether the destructor is public - */ -int vtkWrap_HasPublicDestructor(ClassInfo *data); - -/** - * Check whether the copy constructor is public - */ -int vtkWrap_HasPublicCopyConstructor(ClassInfo *data); - -/** - * Expand all typedef types that are used in function arguments. - * This should be done before any wrapping is done, to make sure - * that the wrappers see the real types. - */ -void vtkWrap_ExpandTypedefs( - ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo); - -/** - * Apply any hints about array sizes, e.g. hint that the - * GetNumberOfComponents() method gives the tuple size. - */ -void vtkWrap_FindCountHints( - ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo); - -/** - * Get the size of a fixed-size tuple - */ -int vtkWrap_GetTupleSize(ClassInfo *data, HierarchyInfo *hinfo); - -/** - * Apply any hints about methods that return a new object instance, - * i.e. factory methods and the like. Reference counts must be - * handled differently for such returned objects. - */ -void vtkWrap_FindNewInstanceMethods( - ClassInfo *data, HierarchyInfo *hinfo); - -/** - * Get the name of a type. The name will not include "const". - */ -const char *vtkWrap_GetTypeName(ValueInfo *val); - -/** - * True if the method a constructor of the class. - */ -int vtkWrap_IsConstructor(ClassInfo *c, FunctionInfo *f); - -/** - * True if the method a destructor of the class. - */ -int vtkWrap_IsDestructor(ClassInfo *c, FunctionInfo *f); - -/** - * Check if a method is from a SetVector method. - */ -int vtkWrap_IsSetVectorMethod(FunctionInfo *f); - -/** - * Check if a method is from a GetVector method. - */ -int vtkWrap_IsGetVectorMethod(FunctionInfo *f); - -/** - * Count the number of parameters that are wrapped. - * This skips the "void *" parameter that follows - * wrapped function pointer parameters. - */ -int vtkWrap_CountWrappedParameters(FunctionInfo *f); - -/** - * Count the number of args that are required. - * This counts to the last argument that does not - * have a default value. Array args are not allowed - * to have default values. - */ -int vtkWrap_CountRequiredArguments(FunctionInfo *f); - -/** - * Write a variable declaration to a file. - * Void is automatically ignored, and nothing is written for - * function pointers - * Set "idx" to -1 to avoid writing an idx. - * Set "flags" to VTK_WRAP_RETURN to write a return value, - * or to VTK_WRAP_ARG to write a temp argument variable. - * The following rules apply: - * - if VTK_WRAP_NOSEMI is set, then no semicolon/newline is printed - * - if VTK_WRAP_RETURN is set, then "&" becomes "*" - * - if VTK_WRAP_ARG is set, "&" becomes "*" only for object - * types, and is removed for all other types. - * - "const" is removed except for return values with "&" or "*". - */ -void vtkWrap_DeclareVariable( - FILE *fp, ValueInfo *v, const char *name, int idx, int flags); - -/** - * Write an "int" size variable for arrays, initialized to - * the array size if the size is greater than zero. - * For N-dimensional arrays, write a static array of ints. - */ -void vtkWrap_DeclareVariableSize( - FILE *fp, ValueInfo *v, const char *name, int idx); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/VTKWrapping/ParaView/vtkWrapHierarchy.c b/src/VTKWrapping/ParaView/vtkWrapHierarchy.c deleted file mode 100644 index f53fec9d..00000000 --- a/src/VTKWrapping/ParaView/vtkWrapHierarchy.c +++ /dev/null @@ -1,977 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkWrapHierarchy.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in June 2010 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -/** - The vtkWrapHierarchy program builds a text file that describes the - class hierarchy. - For each class, the output file will have a line in the following - format: - - classname [ : superclass ] ; header.h ; kit [; flags] - - For each enum type, - - enumname : enum ; header.h ; kit [; flags] - - For each typedef, - - name = [2][3]* const int ; header.h ; kit [; flags] - -*/ - -#include "vtkParse.h" -#include "vtkParseData.h" -#include "vtkParseMain.h" -#include "vtkParsePreprocess.h" -#include -#include -#include -#include -#ifdef _WIN32 -# include -#else -# include -#endif - -/** - * Helper to append a text line to an array of lines - */ -static char **append_unique_line(char **lines, char *line, size_t *np) -{ - size_t l, n; - - n = *np; - - /* check to make sure this line isn't a duplicate */ - for (l = 0; l < n; l++) - { - if (strcmp(line, lines[l]) == 0) - { - break; - } - } - if (l == n) - { - /* allocate more memory if n+1 is a power of two */ - if (((n+1) & n) == 0) - { - lines = (char **)realloc(lines, (n+1)*2*sizeof(char *)); - } - - lines[n] = (char *)malloc(strlen(line)+1); - strcpy(lines[n++], line); - lines[n] = NULL; - } - - *np = n; - return lines; -} - -/** - * Helper to append to a line, given the end marker - */ -static char *append_to_line( - char *line, const char *text, size_t *pos, size_t *maxlen) -{ - size_t n; - - n = strlen(text); - - if ((*pos) + n + 1 > (*maxlen)) - { - *maxlen = ((*pos) + n + 1 + 2*(*maxlen)); - line = (char *)realloc(line, (*maxlen)); - } - - strcpy(&line[*pos], text); - *pos = (*pos) + n; - - return line; -} - -/** - * Append scope to line - */ -static char *append_scope_to_line( - char *line, size_t *m, size_t *maxlen, const char *scope) -{ - if (scope && scope[0] != '\0') - { - line = append_to_line(line, scope, m, maxlen); - line = append_to_line(line, "::", m, maxlen); - } - - return line; -} - -/** - * Append template info - */ -static char *append_template_to_line( - char *line, size_t *m, size_t *maxlen, TemplateInfo *template_args) -{ - ValueInfo *arg; - int j; - - line = append_to_line(line, "<", m, maxlen); - - for (j = 0; j < template_args->NumberOfParameters; j++) - { - arg = template_args->Parameters[j]; - if (arg->Name) - { - line = append_to_line(line, arg->Name, m, maxlen); - } - if (arg->Value && arg->Value[0] != '\n') - { - line = append_to_line(line, "=", m, maxlen); - line = append_to_line(line, arg->Value, m, maxlen); - } - if (j+1 < template_args->NumberOfParameters) - { - line = append_to_line(line, ",", m, maxlen); - } - } - - line = append_to_line(line, ">", m, maxlen); - - return line; -} - -/** - * Append class info - */ -static char *append_class_to_line( - char *line, size_t *m, size_t *maxlen, ClassInfo *class_info) -{ - int j; - - line = append_to_line(line, class_info->Name, m, maxlen); - - if (class_info->Template) - { - line = append_template_to_line(line, m, maxlen, class_info->Template); - } - - line = append_to_line(line, " ", m, maxlen); - - if (class_info->NumberOfSuperClasses) - { - line = append_to_line(line, ": ", m, maxlen); - } - - for (j = 0; j < class_info->NumberOfSuperClasses; j++) - { - line = append_to_line(line, class_info->SuperClasses[j], m, maxlen); - line = append_to_line(line, " ", m, maxlen); - if (j+1 < class_info->NumberOfSuperClasses) - { - line = append_to_line(line, ", ", m, maxlen); - } - } - - return line; -} - -/** - * Append enum info - */ -static char *append_enum_to_line( - char *line, size_t *m, size_t *maxlen, EnumInfo *enum_info) -{ - line = append_to_line(line, enum_info->Name, m, maxlen); - line = append_to_line(line, " : enum ", m, maxlen); - - return line; -} - -/** - * Append the trailer, i.e. the filename and flags - */ -static char *append_trailer( - char *line, size_t *m, size_t *maxlen, - const char *header_file, const char *module_name, const char *flags) -{ - line = append_to_line(line, "; ", m, maxlen); - line = append_to_line(line, header_file, m, maxlen); - - line = append_to_line(line, " ; ", m, maxlen); - line = append_to_line(line, module_name, m, maxlen); - - if (flags && flags[0] != '\0') - { - line = append_to_line(line, " ; ", m, maxlen); - line = append_to_line(line, flags, m, maxlen); - } - - return line; -} - -/** - * Append typedef info - */ -static char *append_typedef_to_line( - char *line, size_t *m, size_t *maxlen, ValueInfo *typedef_info) -{ - unsigned int type; - int ndims; - int dim; - - line = append_to_line(line, typedef_info->Name, m, maxlen); - line = append_to_line(line, " = ", m, maxlen); - - type = typedef_info->Type; - - if ((type & VTK_PARSE_REF) != 0) - { - line = append_to_line(line, "&", m, maxlen); - } - - ndims = typedef_info->NumberOfDimensions; - - for (dim = 0; dim < ndims; dim++) - { - line = append_to_line(line, "[", m, maxlen); - line = append_to_line(line, typedef_info->Dimensions[dim], - m, maxlen); - line = append_to_line(line, "]", m, maxlen); - } - - type = (type & VTK_PARSE_POINTER_MASK); - if (ndims > 0 && (type & VTK_PARSE_POINTER_LOWMASK) == VTK_PARSE_ARRAY) - { - type = ((type >> 2) & VTK_PARSE_POINTER_MASK); - } - else if (ndims == 1) - { - type = ((type >> 2) & VTK_PARSE_POINTER_MASK); - } - - /* pointers are printed after brackets, and are intentionally - * printed in reverse order as compared to C++ declarations */ - while (type) - { - unsigned int bits = (type & VTK_PARSE_POINTER_LOWMASK); - type = ((type >> 2) & VTK_PARSE_POINTER_MASK); - - if (bits == VTK_PARSE_POINTER) - { - line = append_to_line(line, "*", m, maxlen); - } - else if (bits == VTK_PARSE_CONST_POINTER) - { - line = append_to_line(line, "const*", m, maxlen); - } - else - { - line = append_to_line(line, "[]", m, maxlen); - } - } - - if (line[*m-1] != ' ') - { - line = append_to_line(line, " ", m, maxlen); - } - - if ((type & VTK_PARSE_CONST) != 0) - { - line = append_to_line(line, "const ", m, maxlen); - } - - line = append_to_line(line, typedef_info->Class, m, maxlen); - line = append_to_line(line, " ", m, maxlen); - - return line; -} - -/** - * Append all types in a class - */ -static char **append_class_contents( - char **lines, size_t *np, ClassInfo *data, - const char *scope, const char *header_file, const char *module_name) -{ - int i; - const char *tmpflags; - char *new_scope; - char *line; - size_t m, n, maxlen; - size_t scope_m, scope_maxlen; - - /* append the name to the scope */ - new_scope = 0; - n = 0; - m = 0; - if (scope) - { - n = strlen(scope); - } - if (data->Name) - { - m = strlen(data->Name); - } - if (m && (n || data->Template)) - { - scope_maxlen = n + m + 3; - scope_m = 0; - new_scope = (char *)malloc(scope_maxlen); - new_scope[0] = '\0'; - if (n) - { - new_scope = append_to_line(new_scope, scope, &scope_m, &scope_maxlen); - new_scope = append_to_line(new_scope, "::", &scope_m, &scope_maxlen); - } - new_scope = append_to_line(new_scope, data->Name, &scope_m, &scope_maxlen); - if (data->Template) - { - new_scope = append_template_to_line( - new_scope, &scope_m, &scope_maxlen, data->Template); - } - scope = new_scope; - } - else if (m) - { - scope = data->Name; - } - - /* start with a buffer of 15 chars and grow from there */ - maxlen = 15; - m = 0; - line = (char *)malloc(maxlen); - - /* add a line for each type that is found */ - for (i = 0; i < data->NumberOfItems; i++) - { - m = 0; - line[m] = '\0'; - - tmpflags = 0; - - if (data->Items[i].Type == VTK_CLASS_INFO || - data->Items[i].Type == VTK_STRUCT_INFO) - { - ClassInfo *class_info = - data->Classes[data->Items[i].Index]; - - line = append_scope_to_line(line, &m, &maxlen, scope); - line = append_class_to_line(line, &m, &maxlen, class_info); - tmpflags = "WRAP_EXCLUDE"; - } - else if (data->Items[i].Type == VTK_ENUM_INFO) - { - line = append_scope_to_line(line, &m, &maxlen, scope); - line = append_enum_to_line(line, &m, &maxlen, - data->Enums[data->Items[i].Index]); - } - else if (data->Items[i].Type == VTK_TYPEDEF_INFO) - { - line = append_scope_to_line(line, &m, &maxlen, scope); - line = append_typedef_to_line(line, &m, &maxlen, - data->Typedefs[data->Items[i].Index]); - } - else - { - /* unhandled file element */ - continue; - } - - /* append filename and flags */ - line = append_trailer( - line, &m, &maxlen, header_file, module_name, tmpflags); - - /* append the line to the file */ - lines = append_unique_line(lines, line, np); - - /* for classes, add all typed defined within the class */ - if ((data->Items[i].Type == VTK_CLASS_INFO || - data->Items[i].Type == VTK_STRUCT_INFO) && - data->Classes[data->Items[i].Index]->Name) - { - lines = append_class_contents(lines, np, - data->Classes[data->Items[i].Index], - scope, header_file, module_name); - } - } - - free(line); - - if (new_scope != 0) - { - free(new_scope); - } - - return lines; -} - - -/** - * Append all types in a namespace - */ -static char **append_namespace_contents( - char **lines, size_t *np, NamespaceInfo *data, ClassInfo *main_class, - const char *scope, const char *header_file, const char *module_name, - const char *flags) -{ - int i; - const char *tmpflags; - char *line; - char *new_scope; - size_t n, m, maxlen; - - /* append the name to the scope */ - new_scope = 0; - n = 0; - m = 0; - if (scope) - { - n = strlen(scope); - } - if (data->Name) - { - m = strlen(data->Name); - } - if (m && n) - { - new_scope = (char *)malloc(m + n + 3); - if (n) - { - strncpy(new_scope, scope, n); - new_scope[n++] = ':'; - new_scope[n++] = ':'; - } - strncpy(&new_scope[n], data->Name, m); - new_scope[n+m] = '\0'; - scope = new_scope; - } - else if (m) - { - scope = data->Name; - } - - /* start with a buffer of 15 chars and grow from there */ - maxlen = 15; - m = 0; - line = (char *)malloc(maxlen); - - /* add a line for each type that is found */ - for (i = 0; i < data->NumberOfItems; i++) - { - tmpflags = 0; - m = 0; - line[m] = '\0'; - - if (data->Items[i].Type == VTK_CLASS_INFO || - data->Items[i].Type == VTK_STRUCT_INFO) - { - ClassInfo *class_info = - data->Classes[data->Items[i].Index]; - - /* all but the main class in each file is excluded from wrapping */ - tmpflags = "WRAP_EXCLUDE"; - if (class_info == main_class) - { - tmpflags = flags; - } - - line = append_scope_to_line(line, &m, &maxlen, scope); - line = append_class_to_line(line, &m, &maxlen, class_info); - } - else if (data->Items[i].Type == VTK_ENUM_INFO) - { - line = append_scope_to_line(line, &m, &maxlen, scope); - line = append_enum_to_line(line, &m, &maxlen, - data->Enums[data->Items[i].Index]); - } - else if (data->Items[i].Type == VTK_TYPEDEF_INFO) - { - line = append_scope_to_line(line, &m, &maxlen, scope); - line = append_typedef_to_line(line, &m, &maxlen, - data->Typedefs[data->Items[i].Index]); - } - else if (data->Items[i].Type != VTK_NAMESPACE_INFO) - { - /* unhandled file element */ - continue; - } - - if (data->Items[i].Type != VTK_NAMESPACE_INFO) - { - /* append filename and flags */ - line = append_trailer( - line, &m, &maxlen, header_file, module_name, tmpflags); - - /* append the line to the file */ - lines = append_unique_line(lines, line, np); - } - - /* for classes, add all typed defined within the class */ - if ((data->Items[i].Type == VTK_CLASS_INFO || - data->Items[i].Type == VTK_STRUCT_INFO) && - data->Classes[data->Items[i].Index]->Name) - { - lines = append_class_contents(lines, np, - data->Classes[data->Items[i].Index], - scope, header_file, module_name); - } - - /* for namespaces, add all types in the namespace */ - if (data->Items[i].Type == VTK_NAMESPACE_INFO && - data->Namespaces[data->Items[i].Index]->Name) - { - lines = append_namespace_contents(lines, np, - data->Namespaces[data->Items[i].Index], 0, - scope, header_file, module_name, "WRAP_EXCLUDE"); - } - } - - free(line); - - if (new_scope != 0) - { - free(new_scope); - } - - return lines; -} - -/** - * Read a header file with vtkParse.tab.c - * - * If "lines" is provided, the file contents - * will be appended to them. - */ -static char **vtkWrapHierarchy_ParseHeaderFile( - FILE *fp, const char *filename, const char *module_name, - const char *flags, char **lines) -{ - FileInfo *data; - const char *header_file; - size_t k, n; - - /* start with just a single output line and grow from there */ - if (lines == NULL) - { - lines = (char **)malloc(sizeof(char *)); - lines[0] = NULL; - } - - /* always ignore BTX markers when building hierarchy files */ - vtkParse_SetIgnoreBTX(1); - - /* the "concrete" flag doesn't matter, just set to zero */ - data = vtkParse_ParseFile(filename, fp, stderr); - - if (!data) - { - free(lines); - return 0; - } - - /* find the last line in "lines" */ - n = 0; - while (lines[n] != NULL) - { - n++; - } - - k = strlen(data->FileName) - 1; - while (k > 0 && data->FileName[k-1] != '/' && data->FileName[k-1] != '\\') - { - k--; - } - header_file = &data->FileName[k]; - - /* append the file contents to the output */ - lines = append_namespace_contents( - lines, &n, data->Contents, data->MainClass, 0, - header_file, module_name, flags); - - vtkParse_Free(data); - - return lines; -} - -/** - * Read a hierarchy file into "lines" without duplicating lines - */ -static char **vtkWrapHierarchy_ReadHierarchyFile(FILE *fp, char **lines) -{ - char *line; - size_t maxlen = 15; - size_t i, n; - - line = (char *)malloc(maxlen); - - if (lines == NULL) - { - lines = (char **)malloc(sizeof(char *)); - lines[0] = NULL; - } - - while (fgets(line, (int)maxlen, fp)) - { - n = strlen(line); - - /* if buffer not long enough, increase it */ - while (n == maxlen-1 && line[n-1] != '\n' && !feof(fp)) - { - maxlen *= 2; - line = (char *)realloc(line, maxlen); - if (!fgets(&line[n], (int)(maxlen-n), fp)) { break; } - n += strlen(&line[n]); - } - - while (n > 0 && isspace(line[n-1])) - { - n--; - } - line[n] = '\0'; - - if (line[0] == '\0') - { - continue; - } - - for (i = 0; lines[i] != NULL; i++) - { - if (strcmp(line, lines[i]) == 0) - { - break; - } - } - - if (lines[i] == NULL) - { - /* allocate more memory if n+1 is a power of two */ - if (((i+1) & i) == 0) - { - lines = (char **)realloc(lines, (i+1)*2*sizeof(char *)); - } - - lines[i] = (char *)malloc(n+1); - strcpy(lines[i], line); - lines[i+1] = NULL; - } - } - - free(line); - - if (!feof(fp)) - { - free(lines); - return 0; - } - - return lines; -} - -/** - * Compare a file to "lines", return 0 if they are different - */ -static int vtkWrapHierarchy_CompareHierarchyFile(FILE *fp, char *lines[]) -{ - unsigned char *matched; - char *line; - size_t maxlen = 15; - size_t i, n; - - line = (char *)malloc(maxlen); - - for (i = 0; lines[i] != NULL; i++) { ; }; - matched = (unsigned char *)malloc(i); - memset(matched, 0, i); - - while (fgets(line, (int)maxlen, fp)) - { - n = strlen(line); - - /* if buffer not long enough, increase it */ - while (n == maxlen-1 && line[n-1] != '\n' && !feof(fp)) - { - maxlen *= 2; - line = (char *)realloc(line, maxlen); - if (!fgets(&line[n], (int)(maxlen-n), fp)) { break; } - n += strlen(&line[n]); - } - - while (n > 0 && isspace(line[n-1])) - { - n--; - } - line[n] = '\0'; - - if (line[0] == '\0') - { - continue; - } - - for (i = 0; lines[i] != NULL; i++) - { - if (strcmp(line, lines[i]) == 0) - { - break; - } - } - - if (lines[i] == NULL) - { - free(matched); - return 0; - } - - matched[i] = 1; - } - - for (i = 0; lines[i] != NULL; i++) - { - if (matched[i] == 0) - { - free(matched); - return 0; - } - } - - free(line); - free(matched); - - if (!feof(fp)) - { - return 0; - } - - return 1; -} - -/** - * Write "lines" to a hierarchy file - */ -static int vtkWrapHierarchy_WriteHierarchyFile(FILE *fp, char *lines[]) -{ - size_t i; - - for (i = 0; lines[i] != NULL; i++) - { - if (fprintf(fp, "%s\n", lines[i]) < 0) - { - return 0; - } - } - - return 1; -} - -/** - * Try to parse a header file, print error and exit if fail - */ -static char **vtkWrapHierarchy_TryParseHeaderFile( - const char *file_name, const char *module_name, - const char *flags, char **lines) -{ - FILE *input_file; - - input_file = fopen(file_name, "r"); - - if (!input_file) - { - fprintf(stderr, "vtkWrapHierarchy: couldn't open file %s\n", - file_name); - exit(1); - } - - lines = vtkWrapHierarchy_ParseHeaderFile( - input_file, file_name, module_name, flags, lines); - - if (!lines) - { - fclose(input_file); - exit(1); - } - fclose(input_file); - - return lines; -} - -/** - * Try to read a file, print error and exit if fail - */ -static char **vtkWrapHierarchy_TryReadHierarchyFile( - const char *file_name, char **lines) -{ - FILE *input_file; - - input_file = fopen(file_name, "r"); - if (!input_file) - { - fprintf(stderr, "vtkWrapHierarchy: couldn't open file %s\n", - file_name); - exit(1); - } - - lines = vtkWrapHierarchy_ReadHierarchyFile(input_file, lines); - if (!lines) - { - fclose(input_file); - fprintf(stderr, "vtkWrapHierarchy: error reading file %s\n", - file_name); - exit(1); - } - fclose(input_file); - - return lines; -} - -/** - * Try to write a file, print error and exit if fail - */ -static int vtkWrapHierarchy_TryWriteHierarchyFile( - const char *file_name, char *lines[]) -{ - FILE *output_file; - int matched = 0; - - output_file = fopen(file_name, "r"); - if (output_file && vtkWrapHierarchy_CompareHierarchyFile(output_file, lines)) - { - matched = 1; - } - if (output_file) - { - fclose(output_file); - } - - if (!matched) - { - int tries = 1; - output_file = fopen(file_name, "w"); - while (!output_file && tries < 5) - { - /* There are two CMAKE_CUSTOM_COMMANDS for vtkWrapHierarchy, - * make sure they do not collide. */ - tries++; -#ifdef _WIN32 - Sleep(1000); -#else - sleep(1); -#endif - output_file = fopen(file_name, "r+"); - if (output_file && - vtkWrapHierarchy_CompareHierarchyFile(output_file, lines)) - { - /* if the contents match, no need to write it */ - fclose(output_file); - return 0; - } - if (output_file) - { - /* close and open in order to truncate the file */ - fclose(output_file); - output_file = fopen(file_name, "w"); - } - } - if (!output_file) - { - fprintf(stderr, "vtkWrapHierarchy: tried %i times to write %s\n", - tries, file_name); - exit(1); - } - if (!vtkWrapHierarchy_WriteHierarchyFile(output_file, lines)) - { - fclose(output_file); - fprintf(stderr, "vtkWrapHierarchy: error writing file %s\n", - file_name); - exit(1); - } - fclose(output_file); - } - - return 0; -} - -static int string_compare(const void *vp1, const void *vp2) -{ - return strcmp(*(const char **)vp1, *(const char **)vp2); -} - -int main(int argc, char *argv[]) -{ - OptionInfo *options; - int i; - size_t j, n; - char **lines = 0; - char **files = 0; - char *flags; - char *module_name; - - /* parse command-line options */ - vtkParse_MainMulti(argc, argv); - options = vtkParse_GetCommandLineOptions(); - - /* make sure than an output file was given on the command line */ - if (options->OutputFileName == NULL) - { - fprintf(stderr, "No output file was specified\n"); - exit(1); - } - - /* read the data file */ - files = vtkWrapHierarchy_TryReadHierarchyFile( - options->InputFileName, files); - - /* read in all the prior files */ - for (i = 1; i < options->NumberOfFiles; i++) - { - lines = vtkWrapHierarchy_TryReadHierarchyFile( - options->Files[i], lines); - } - - /* merge the files listed in the data file */ - for (i = 0; files[i] != NULL; i++) - { - /* look for semicolon that marks the module name */ - module_name = files[i]; - while(*module_name != ';' && *module_name != '\0') { module_name++; }; - if (*module_name == ';') { *module_name++ = '\0'; } - - /* look for semicolon that marks start of flags */ - flags = module_name; - while(*flags != ';' && *flags != '\0') { flags++; }; - if (*flags == ';') { *flags++ = '\0'; } - - lines = vtkWrapHierarchy_TryParseHeaderFile( - files[i], module_name, flags, lines); - } - - /* sort the lines to ease lookups in the file */ - for (n = 0; lines[n]; n++) { ; }; - qsort(lines, n, sizeof(char *), &string_compare); - - /* write the file, if it has changed */ - vtkWrapHierarchy_TryWriteHierarchyFile(options->OutputFileName, lines); - - for (j = 0; j < n; j++) - { - free(lines[j]); - } - - free(files); - free(lines); - return 0; -} diff --git a/src/VTKWrapping/ParaView/vtkWrapText.c b/src/VTKWrapping/ParaView/vtkWrapText.c deleted file mode 100644 index d95f28a5..00000000 --- a/src/VTKWrapping/ParaView/vtkWrapText.c +++ /dev/null @@ -1,986 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkWrapText.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -#include "vtkWrapText.h" -#include "vtkWrap.h" -#include -#include -#include -#include - -/* -------------------------------------------------------------------- */ -/* Convert special characters in a string into their escape codes - * so that the string can be quoted in a source file. The specified - * maxlen must be at least 32 chars, and should not be over 2047 since - * that is the maximum length of a string literal on some systems */ - -const char *vtkWrapText_QuoteString( - const char *comment, size_t maxlen) -{ - static char *result = 0; - static size_t oldmaxlen = 0; - size_t i, j, n; - - if (maxlen > oldmaxlen) - { - if (result) - { - free(result); - } - result = (char *)malloc((size_t)(maxlen+1)); - oldmaxlen = maxlen; - } - - if (comment == NULL) - { - return ""; - } - - j = 0; - - n = strlen(comment); - for (i = 0; i < n; i++) - { - if (comment[i] == '\"') - { - strcpy(&result[j],"\\\""); - j += 2; - } - else if (comment[i] == '\\') - { - strcpy(&result[j],"\\\\"); - j += 2; - } - else if (comment[i] == '\n') - { - strcpy(&result[j],"\\n"); - j += 2; - } - else if ((comment[i] & 0x80) != 0 || isprint(comment[i])) - { - // all characters in extended-ASCII set are printable. Some compilers (VS - // 2010, in debug mode) asserts when isprint() is passed a negative value. - // Hence, we simply skip the check. - result[j] = comment[i]; - j++; - } - else - { - sprintf(&result[j],"\\%3.3o",comment[i]); - j += 4; - } - if (j >= maxlen - 21) - { - sprintf(&result[j]," ...\\n [Truncated]\\n"); - j += (int)strlen(" ...\\n [Truncated]\\n"); - break; - } - } - result[j] = '\0'; - - return result; -} - -/* -------------------------------------------------------------------- */ -/* A simple string that grows as necessary. */ - -struct vtkWPString -{ - char *str; - size_t len; - size_t maxlen; -}; - -/* -- append ---------- */ -static void vtkWPString_Append( - struct vtkWPString *str, const char *text) -{ - size_t n = strlen(text); - - if (str->len + n + 1 > str->maxlen) - { - str->maxlen = (str->len + n + 1 + 2*str->maxlen); - str->str = (char *)realloc(str->str, str->maxlen); - } - - strncpy(&str->str[str->len], text, n); - str->len += n; - str->str[str->len] = '\0'; -} - -/* -- add a char ---------- */ -static void vtkWPString_PushChar( - struct vtkWPString *str, char c) -{ - if (str->len + 2 > str->maxlen) - { - str->maxlen = (str->len + 2 + 2*str->maxlen); - str->str = (char *)realloc(str->str, str->maxlen); - } - - str->str[str->len++] = c; - str->str[str->len] = '\0'; -} - -/* -- strip any of the given chars from the end ---------- */ -static void vtkWPString_Strip( - struct vtkWPString *str, const char *trailers) -{ - size_t k = str->len; - char *cp = str->str; - size_t j = 0; - size_t n; - - if (cp) - { - n = strlen(trailers); - - while (k > 0 && j < n) - { - for (j = 0; j < n; j++) - { - if (cp[k-1] == trailers[j]) - { - k--; - break; - } - } - } - - str->len = k; - str->str[k] = '\0'; - } -} - -/* -- Return the last char ---------- */ -static char vtkWPString_LastChar( - struct vtkWPString *str) -{ - if (str->str && str->len > 0) - { - return str->str[str->len-1]; - } - return '\0'; -} - -/* -- do a linebreak on a method declaration ---------- */ -static void vtkWPString_BreakSignatureLine( - struct vtkWPString *str, size_t *linestart, size_t indentation) -{ - size_t i = 0; - size_t m = 0; - size_t j = *linestart; - size_t l = str->len; - size_t k = str->len; - char *text = str->str; - char delim; - - if (!text) - { - return; - } - - while (l > j && text[l-1] != '\n' && text[l-1] != ',' && - text[l-1] != '(' && text[l-1] != ')') - { - /* treat each string as a unit */ - if (l > 4 && (text[l-1] == '\'' || text[l-1] == '\"')) - { - delim = text[l-1]; - l -= 2; - while (l > 3 && (text[l-1] != delim || text[l-3] == '\\')) - { - l--; - if (text[l-1] == '\\') - { - l--; - } - } - l -= 2; - } - else - { - l--; - } - } - - /* if none of these chars was found, split is impossible */ - if (text[l-1] != ',' && text[l-1] != '(' && - text[l-1] != ')' && text[l-1] != '\n') - { - j++; - } - - else - { - /* Append some chars to guarantee size */ - vtkWPString_PushChar(str, '\n'); - vtkWPString_PushChar(str, '\n'); - for (i = 0; i < indentation; i++) - { - vtkWPString_PushChar(str, ' '); - } - /* re-get the char pointer, it may have been reallocated */ - text = str->str; - - if (k > l) - { - m = 0; - while (m < indentation+2 && text[l+m] == ' ') - { - m++; - } - memmove(&text[l+indentation+2-m], &text[l], k-l); - k += indentation+2-m; - } - else - { - k += indentation+2; - } - text[l++] = '\\'; text[l++] = 'n'; - j = l; - for (i = 0; i < indentation; i++) - { - text[l++] = ' '; - } - } - - str->len = k; - - /* return the new line start position */ - *linestart = j; -} - -/* -- do a linebreak on regular text ---------- */ -static void vtkWPString_BreakCommentLine( - struct vtkWPString *str, size_t *linestart, size_t indent) -{ - size_t i = 0; - size_t j = *linestart; - size_t l = str->len; - char *text = str->str; - - if (!text) - { - return; - } - - /* try to break the line at a word */ - while (l > 0 && text[l-1] != ' ' && text[l-1] != '\n') - { - l--; - } - if (l > 0 && text[l-1] != '\n' && l-j > indent) - { - /* replace space with newline */ - text[l-1] = '\n'; - j = l; - - /* Append some chars to guarantee size */ - vtkWPString_PushChar(str, '\n'); - vtkWPString_PushChar(str, '\n'); - for (i = 0; i < indent; i++) - { - vtkWPString_PushChar(str, ' '); - } - /* re-get the char pointer, it may have been reallocated */ - text = str->str; - str->len -= indent+2; - - if (str->len > l && indent > 0) - { - memmove(&text[l+indent], &text[l], str->len-l); - memset(&text[l], ' ', indent); - str->len += indent; - } - } - else - { - /* long word, just split the word */ - vtkWPString_PushChar(str, '\n'); - j = str->len; - for (i = 0; i < indent; i++) - { - vtkWPString_PushChar(str, ' '); - } - } - - /* return the new line start position */ - *linestart = j; -} - -/* -------------------------------------------------------------------- */ -/* Format a signature to a 70 char linewidth and char limit */ -const char *vtkWrapText_FormatSignature( - const char *signature, size_t width, size_t maxlen) -{ - static struct vtkWPString staticString = { NULL, 0, 0 }; - struct vtkWPString *text; - size_t i, j, n; - const char *cp = signature; - char delim; - size_t lastSigStart = 0; - size_t sigCount = 0; - - text = &staticString; - text->len = 0; - - if (signature == 0) - { - return ""; - } - - i = 0; - j = 0; - - while (cp[i] != '\0') - { - while (text->len - j < width && cp[i] != '\n' && cp[i] != '\0') - { - /* escape quotes */ - if (cp[i] == '\"' || cp[i] == '\'') - { - delim = cp[i]; - vtkWPString_PushChar(text, '\\'); - vtkWPString_PushChar(text, cp[i++]); - while (cp[i] != delim && cp[i] != '\0') - { - if (cp[i] == '\\') - { - vtkWPString_PushChar(text, '\\'); - } - vtkWPString_PushChar(text, cp[i++]); - } - if (cp[i] == delim) - { - vtkWPString_PushChar(text, '\\'); - vtkWPString_PushChar(text, cp[i++]); - } - } - /* remove items that trail the closing parenthesis */ - else if (cp[i] == ')') - { - vtkWPString_PushChar(text, cp[i++]); - if (strncmp(&cp[i], " const", 6) == 0) - { - i += 6; - } - if (strncmp(&cp[i], " = 0", 4) == 0) - { - i += 4; - } - if (cp[i] == ';') - { - i++; - } - } - /* anything else */ - else - { - vtkWPString_PushChar(text, cp[i++]); - } - } - - /* break the line (try to break after a comma) */ - if (cp[i] != '\n' && cp[i] != '\0') - { - vtkWPString_BreakSignatureLine(text, &j, 4); - } - /* reached end of line: do next signature */ - else - { - vtkWPString_Strip(text, " \r\t"); - if (cp[i] != '\0') - { - sigCount++; - /* if sig count is even, check length against maxlen */ - if ((sigCount & 1) == 0) - { - n = strlen(text->str); - if (n >= maxlen) - { - break; - } - lastSigStart = n; - } - - i++; - vtkWPString_PushChar(text, '\\'); - vtkWPString_PushChar(text, 'n'); - } - /* mark the position of the start of the line */ - j = text->len; - } - } - - vtkWPString_Strip(text, " \r\t"); - - if (strlen(text->str) >= maxlen) - { - /* terminate before the current signature */ - text->str[lastSigStart] = '\0'; - } - - return text->str; -} - -/* -------------------------------------------------------------------- */ -/* Format a comment to a 70 char linewidth, in several steps: - * 1) remove html tags, convert

and
into breaks - * 2) remove doxygen tags like \em - * 3) remove extra whitespace (except paragraph breaks) - * 4) re-break the lines - */ - -const char *vtkWrapText_FormatComment( - const char *comment, size_t width) -{ - static struct vtkWPString staticString = { NULL, 0, 0 }; - struct vtkWPString *text; - const char *cp; - size_t i, j, l; - size_t indent = 0; - int nojoin = 0; - int start; - - text = &staticString; - text->len = 0; - - if (comment == 0) - { - return ""; - } - - i = 0; j = 0; l = 0; - start = 1; - cp = comment; - - /* skip any leading whitespace */ - while (cp[i] == '\n' || cp[i] == '\r' || - cp[i] == '\t' || cp[i] == ' ') - { - i++; - } - - while (cp[i] != '\0') - { - /* Add characters until the output line is complete */ - while (cp[i] != '\0' && text->len-j < width) - { - /* if the end of the line was found, see how next line begins */ - if (start) - { - /* eat the leading space */ - if (cp[i] == ' ') - { - i++; - } - - /* skip ahead to find any interesting first characters */ - l = i; - while (cp[l] == ' ' || cp[l] == '\t' || cp[l] == '\r') - { - l++; - } - - /* check for new section */ - if (cp[l] == '.' && strncmp(&cp[l], ".SECTION", 8) == 0) - { - vtkWPString_Strip(text, "\n"); - if (text->len > 0) - { - vtkWPString_PushChar(text, '\n'); - vtkWPString_PushChar(text, '\n'); - } - i = l+8; - while (cp[i] == '\r' || cp[i] == '\t' || cp[i] == ' ') - { - i++; - } - while (cp[i] != '\n' && cp[i] != '\0') - { - vtkWPString_PushChar(text, cp[i++]); - } - vtkWPString_Strip(text, " \t\r"); - - if (vtkWPString_LastChar(text) != ':') - { - vtkWPString_PushChar(text, ':'); - } - vtkWPString_PushChar(text, '\n'); - vtkWPString_PushChar(text, '\n'); - j = text->len; - indent = 0; - if (cp[i] == '\n') - { - i++; - } - start = 1; - continue; - } - - /* handle doxygen tags that appear at start of line */ - if (cp[l] == '\\' || cp[l] == '@') - { - if (strncmp(&cp[l+1], "brief", 5) == 0 || - strncmp(&cp[l+1], "short", 5) == 0 || - strncmp(&cp[l+1], "pre", 3) == 0 || - strncmp(&cp[l+1], "post", 4) == 0 || - strncmp(&cp[l+1], "param", 5) == 0 || - strncmp(&cp[l+1], "tparam", 6) == 0 || - strncmp(&cp[l+1], "cmdparam", 8) == 0 || - strncmp(&cp[l+1], "exception", 9) == 0 || - strncmp(&cp[l+1], "return", 6) == 0 || - strncmp(&cp[l+1], "li", 2) == 0) - { - nojoin = 2; - indent = 4; - if (text->len > 0 && vtkWPString_LastChar(text) != '\n') - { - vtkWPString_PushChar(text, '\n'); - } - j = text->len; - i = l; - } - } - - /* handle bullets and numbering */ - else if (cp[l] == '-' || cp[l] == '*' || cp[l] == '#' || - (cp[l] >= '0' && cp[l] <= '9' && - (cp[l+1] == ')' || cp[l+1] == '.') && cp[l+2] == ' ')) - { - indent = 0; - while (indent < 3 && cp[l+indent] != ' ') - { - indent++; - } - indent++; - if (text->len > 0 && vtkWPString_LastChar(text) != '\n') - { - vtkWPString_PushChar(text, '\n'); - } - j = text->len; - i = l; - } - - /* keep paragraph breaks */ - else if (cp[l] == '\n') - { - i = l+1; - vtkWPString_Strip(text, "\n"); - if (text->len > 0) - { - vtkWPString_PushChar(text, '\n'); - vtkWPString_PushChar(text, '\n'); - } - nojoin = 0; - indent = 0; - j = text->len; - start = 1; - continue; - } - - /* add newline if nojoin is not set */ - else if (nojoin || - (cp[i] == ' ' && !indent)) - { - if (nojoin == 2) - { - nojoin = 0; - indent = 0; - } - vtkWPString_PushChar(text, '\n'); - j = text->len; - } - - /* do line joining */ - else if (text->len > 0 && vtkWPString_LastChar(text) != '\n') - { - i = l; - vtkWPString_PushChar(text, ' '); - } - } - - /* handle quotes */ - if (cp[i] == '\"') - { - size_t q = i; - size_t r = text->len; - - /* try to keep the quote whole */ - vtkWPString_PushChar(text, cp[i++]); - while (cp[i] != '\"' && cp[i] != '\r' && - cp[i] != '\n' && cp[i] != '\0') - { - vtkWPString_PushChar(text, cp[i++]); - } - /* if line ended before quote did, then reset */ - if (cp[i] != '\"') - { - i = q; - text->len = r; - } - } - else if (cp[i] == '\'') - { - size_t q = i; - size_t r = text->len; - - /* try to keep the quote whole */ - vtkWPString_PushChar(text, cp[i++]); - while (cp[i] != '\'' && cp[i] != '\r' && - cp[i] != '\n' && cp[i] != '\0') - { - vtkWPString_PushChar(text, cp[i++]); - } - /* if line ended before quote did, then reset */ - if (cp[i] != '\'') - { - i = q; - text->len = r; - } - } - - /* handle simple html tags */ - else if (cp[i] == '<') - { - l = i+1; - if (cp[l] == '/') { l++; } - while ((cp[l] >= 'a' && cp[l] <= 'z') || - (cp[l] >= 'a' && cp[l] <= 'z')) { l++; } - if (cp[l] == '>') - { - if (cp[i+1] == 'p' || cp[i+1] == 'P' || - (cp[i+1] == 'b' && cp[i+2] == 'r') || - (cp[i+1] == 'B' && cp[i+2] == 'R')) - { - vtkWPString_Strip(text, " \n"); - vtkWPString_PushChar(text, '\n'); - vtkWPString_PushChar(text, '\n'); - j = text->len; - indent = 0; - } - i = l+1; - while (cp[i] == '\r' || cp[i] == '\t' || cp[i] == ' ') - { - i++; - } - } - } - else if (cp[i] == '\\' || cp[i] == '@') - { - /* handle simple doxygen tags */ - if (strncmp(&cp[i+1], "em ", 3) == 0) - { - i += 4; - } - else if (strncmp(&cp[i+1], "a ", 2) == 0 || - strncmp(&cp[i+1], "e ", 2) == 0 || - strncmp(&cp[i+1], "c ", 2) == 0 || - strncmp(&cp[i+1], "b ", 2) == 0 || - strncmp(&cp[i+1], "p ", 2) == 0 || - strncmp(&cp[i+1], "f$", 2) == 0 || - strncmp(&cp[i+1], "f[", 2) == 0 || - strncmp(&cp[i+1], "f]", 2) == 0) - { - if (i > 0 && cp[i-1] != ' ') - { - vtkWPString_PushChar(text, ' '); - } - if (cp[i+1] == 'f') - { - if (cp[i+2] == '$') - { - vtkWPString_PushChar(text, '$'); - } - else - { - vtkWPString_PushChar(text, '\\'); - vtkWPString_PushChar(text, cp[i+2]); - } - } - i += 3; - } - else if (cp[i+1] == '&' || cp[i+1] == '$' || cp[i+1] == '#' || - cp[i+1] == '<' || cp[i+1] == '>' || cp[i+1] == '%' || - cp[i+1] == '@' || cp[i+1] == '\\' || cp[i+1] == '\"') - { - i++; - } - else if (cp[i+1] == 'n') - { - vtkWPString_Strip(text, " \n"); - vtkWPString_PushChar(text, '\n'); - vtkWPString_PushChar(text, '\n'); - indent = 0; - i += 2; - j = text->len; - } - else if (strncmp(&cp[i+1], "code", 4) == 0) - { - nojoin = 1; - i += 5; - while (cp[i] == ' ' || cp[i] == '\r' || - cp[i] == '\t' || cp[i] == '\n') - { - i++; - } - } - else if (strncmp(&cp[i+1], "endcode", 7) == 0) - { - nojoin = 0; - i += 8; - l = i; - while (cp[l] == ' ' || cp[l] == '\t' || cp[l] == '\r') - { - l++; - } - if (cp[l] == '\n') - { - i = l; - vtkWPString_PushChar(text, '\n'); - j = text->len; - } - } - else if (strncmp(&cp[i+1], "verbatim", 8) == 0) - { - i += 9; - while (cp[i] != '\0' && ((cp[i] != '@' && cp[i] != '\\') || - strncmp(&cp[i+1], "endverbatim", 11) != 0)) - { - if (cp[i] != '\r') - { - vtkWPString_PushChar(text, cp[i]); - } - if (cp[i] == '\n') - { - j = text->len; - } - i++; - } - if (cp[i] != '\0') - { - i += 12; - } - } - } - - /* search for newline */ - start = 0; - l = i; - while (cp[l] == ' ' || cp[l] == '\t' || cp[l] == '\r') - { - l++; - } - if (cp[l] == '\n') - { - i = l+1; - start = 1; - } - - /* append */ - else if (cp[i] != '\0') - { - vtkWPString_PushChar(text, cp[i++]); - } - - } /* while (cp[i] != '\0' && text->len-j < width) */ - - if (cp[i] == '\0') - { - break; - } - - vtkWPString_BreakCommentLine(text, &j, indent); - } - - /* remove any trailing blank lines */ - vtkWPString_Strip(text, "\n"); - vtkWPString_PushChar(text, '\n'); - - return text->str; -} - -/* -------------------------------------------------------------------- */ -/* Create a signature for the python version of a method. */ - -static void vtkWrapText_PythonTypeSignature( - struct vtkWPString *result, const char *delims[2], ValueInfo *arg); - -static void vtkWrapText_PythonArraySignature( - struct vtkWPString *result, const char *classname, - const char *delims[2], int ndim, const char **dims); - -const char *vtkWrapText_PythonSignature( - FunctionInfo *currentFunction) -{ - /* string is intentionally not freed until the program exits */ - static struct vtkWPString staticString = { NULL, 0, 0 }; - struct vtkWPString *result; - ValueInfo *arg, *ret; - const char *parens[2] = { "(", ")" }; - const char *braces[2] = { "[", "]" }; - const char **delims; - int i, n; - - n = vtkWrap_CountWrappedParameters(currentFunction); - - result = &staticString; - result->len = 0; - - /* print out the name of the method */ - vtkWPString_Append(result, "V."); - vtkWPString_Append(result, currentFunction->Name); - - /* print the arg list */ - vtkWPString_Append(result, "("); - - for (i = 0; i < n; i++) - { - arg = currentFunction->Parameters[i]; - - if (i != 0) - { - vtkWPString_Append(result, ", "); - } - - delims = parens; - if (!vtkWrap_IsConst(arg) && - !vtkWrap_IsSetVectorMethod(currentFunction)) - { - delims = braces; - } - - vtkWrapText_PythonTypeSignature(result, delims, arg); - } - - vtkWPString_Append(result, ")"); - - /* if this is a void method, we are finished */ - /* otherwise, print "->" and the return type */ - ret = currentFunction->ReturnValue; - if (ret && (ret->Type & VTK_PARSE_UNQUALIFIED_TYPE) != VTK_PARSE_VOID) - { - vtkWPString_Append(result, " -> "); - - vtkWrapText_PythonTypeSignature(result, parens, ret); - } - - if (currentFunction->Signature) - { - vtkWPString_Append(result, "\nC++: "); - vtkWPString_Append(result, currentFunction->Signature); - } - - return result->str; -} - -static void vtkWrapText_PythonTypeSignature( - struct vtkWPString *result, const char *braces[2], ValueInfo *arg) -{ - char text[32]; - const char *dimension; - const char *classname = ""; - - if (vtkWrap_IsVoid(arg)) - { - classname = "void"; - } - else if (vtkWrap_IsObject(arg)) - { - classname = arg->Class; - } - else if (vtkWrap_IsFunction(arg)) - { - classname = "function"; - } - else if (vtkWrap_IsString(arg) || vtkWrap_IsCharPointer(arg)) - { - classname = "string"; - if ((arg->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNICODE_STRING) - { - classname = "unicode"; - } - } - else if (vtkWrap_IsChar(arg)) - { - classname = "char"; - } - else if (vtkWrap_IsBool(arg)) - { - classname = "bool"; - } - else if (vtkWrap_IsRealNumber(arg)) - { - classname = "float"; - } - else if (vtkWrap_IsInteger(arg)) - { - classname = "int"; - } - - if ((vtkWrap_IsArray(arg) && arg->CountHint) || - vtkWrap_IsPODPointer(arg)) - { - vtkWPString_Append(result, braces[0]); - vtkWPString_Append(result, classname); - vtkWPString_Append(result, ", ..."); - vtkWPString_Append(result, braces[1]); - } - else if (vtkWrap_IsArray(arg)) - { - sprintf(text, "%d", arg->Count); - dimension = text; - vtkWrapText_PythonArraySignature(result, classname, braces, - 1, &dimension); - } - else if (vtkWrap_IsNArray(arg)) - { - vtkWrapText_PythonArraySignature(result, classname, braces, - arg->NumberOfDimensions, arg->Dimensions); - } - else - { - vtkWPString_Append(result, classname); - } -} - -static void vtkWrapText_PythonArraySignature( - struct vtkWPString *result, const char *classname, - const char *braces[2], int ndim, const char **dims) -{ - int j, n; - - vtkWPString_Append(result, braces[0]); - n = (int)strtoul(dims[0], 0, 0); - if (ndim > 1) - { - for (j = 0; j < n; j++) - { - if (j != 0) { vtkWPString_Append(result, ", "); } - vtkWrapText_PythonArraySignature(result, classname, - braces, ndim-1, dims+1); - } - } - else - { - for (j = 0; j < n; j++) - { - if (j != 0) { vtkWPString_Append(result, ", "); } - vtkWPString_Append(result, classname); - } - } - vtkWPString_Append(result, braces[1]); -} diff --git a/src/VTKWrapping/ParaView/vtkWrapText.h b/src/VTKWrapping/ParaView/vtkWrapText.h deleted file mode 100644 index bc3a7f15..00000000 --- a/src/VTKWrapping/ParaView/vtkWrapText.h +++ /dev/null @@ -1,61 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkWrapText.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -/** - * vtkWrap provides useful functions for generating wrapping code. -*/ - -#ifndef VTK_WRAP_TEXT_H -#define VTK_WRAP_TEXT_H - -#include "vtkParse.h" -#include "vtkParseHierarchy.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Quote a string for inclusion in a C string literal. The "maxlen" - * should be set to a value between 32 and 2047. Values over 2047 - * will result in string literals too long for some compilers. If - * the string is truncated, a "..." will be appended. - */ -const char *vtkWrapText_QuoteString(const char *comment, size_t maxlen); - -/** - * Format a doxygen comment for plain text, and word-wrap at - * the specified width. A 70-char width is recommended. - */ -const char *vtkWrapText_FormatComment(const char *comment, size_t width); - -/** - * Format a method signature by applying word-wrap at the specified - * width and taking special care not to split any literals or names. - * A width of 70 chars is recommended. - */ -const char *vtkWrapText_FormatSignature( - const char *signature, size_t width, size_t maxlen); - -/** - * Produce a python signature for a method, for use in documentation. - */ -const char *vtkWrapText_PythonSignature(FunctionInfo *currentFunction); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/VTKWrapping/create_class.py b/src/VTKWrapping/create_class.py deleted file mode 100755 index 2e4708b1..00000000 --- a/src/VTKWrapping/create_class.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -import sys -import os - -ffile = "PARAVIS_CreateClass.cxx" -wfile = os.path.join(sys.argv[1], "wrapfiles.txt") - -ffile_stream = open(ffile, "w") - -ffile_stream.write('#include ' + '\n') -ffile_stream.write('#include ' + '\n') -ffile_stream.write('#include "PARAVIS_Gen_i.hh"' + '\n') -wfile_stream = open(wfile) -for line in wfile_stream: - if line.split()[0] == "vtkWebGLExporter" : - ffile_stream.write('#ifdef WIN32\n') - ffile_stream.write(' #ifdef GetObject\n') - ffile_stream.write(' #undef GetObject\n') - ffile_stream.write(' #endif\n') - ffile_stream.write('#endif\n') - pass - ffile_stream.write('#include "PARAVIS_Gen_%s_i.hh"'%(line.split()[0]) + '\n') - pass -wfile_stream.close() -ffile_stream.write('' + '\n') -ffile_stream.write('PARAVIS::PARAVIS_Base_i* CreateInstance(::vtkObjectBase* Inst, const QString& theClassName)' + '\n') -ffile_stream.write('{' + '\n') -wfile_stream = open(wfile) -lst = [] -for line in wfile_stream: - lst.append(line.split()[0]) - pass -wfile_stream.close() -lst.reverse() -for item in lst: - ffile_stream.write(' if(theClassName == "%s" || (Inst != NULL && Inst->IsA("%s")))'%(item, item) + '\n') - ffile_stream.write(' return new PARAVIS::%s_i();'%(item) + '\n') - pass -ffile_stream.write('' + '\n') -ffile_stream.write(' cerr << "The class " << theClassName.toStdString() << " is not created!" << endl;' + '\n') -ffile_stream.write(' return new PARAVIS::PARAVIS_Base_i();' + '\n') -ffile_stream.write('}' + '\n') -ffile_stream.close() diff --git a/src/VTKWrapping/create_class.sh b/src/VTKWrapping/create_class.sh deleted file mode 100755 index e7aac197..00000000 --- a/src/VTKWrapping/create_class.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -file=PARAVIS_CreateClass.cxx -wfile=$1/wrapfiles.txt - -echo '#include ' > $file -echo '#include ' >> $file -echo '#include "PARAVIS_Gen_i.hh"' >> $file -awk '{print "#include \"PARAVIS_Gen_"$1"_i.hh\"";}' $wfile >> $file -echo '' >> $file -echo 'PARAVIS::PARAVIS_Base_i* CreateInstance(::vtkObjectBase* Inst, const QString& theClassName)' >> $file -echo '{' >> $file -awk 'BEGIN {lst="";} {lst=lst" "$1;} END{i=split(lst,arr);for(j=i;j>0;j--) {print " if(theClassName == \""arr[j]"\" || (Inst != NULL && Inst->IsA(\""arr[j]"\")))";print " return new PARAVIS::"arr[j]"_i();"}}' $wfile >> $file -echo '' >> $file -echo ' cerr << "The class " << theClassName.toStdString() << " is not created!" << endl;' >> $file -echo ' return new PARAVIS::PARAVIS_Base_i();' >> $file -echo '}' >> $file diff --git a/src/VTKWrapping/getwrapclasses.py b/src/VTKWrapping/getwrapclasses.py deleted file mode 100644 index 32b2a668..00000000 --- a/src/VTKWrapping/getwrapclasses.py +++ /dev/null @@ -1,158 +0,0 @@ -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -import paraview, os, sys -import string -import re - -classeslistsm = [] -classeslistvtk = [] - -from vtkPVCommonPython import * -from vtkPVClientServerCoreCorePython import * -from vtkPVClientServerCoreDefaultPython import * -from vtkPVClientServerCoreRenderingPython import * -from vtkPVServerImplementationCorePython import * -from vtkPVServerImplementationDefaultPython import * -from vtkPVServerImplementationRenderingPython import * -from vtkPVServerManagerApplicationPython import * -from vtkPVServerManagerCorePython import * -from vtkPVServerManagerDefaultPython import * -from vtkPVServerManagerRenderingPython import * -try: - from vtkPVVTKExtensionsCorePython import * -except: - pass -try: - from vtkPVVTKExtensionsDefaultPython import * -except: - pass -try: - from vtkPVVTKExtensionsRenderingPython import * -except: - pass -try: - from vtkPVVTKExtensionsWebGLExporterPython import * -except: - pass - -l1 = dir() -for a in l1: - if a.startswith("vtk") and (len(a) > 3): - classeslistsm.append(a) - -from paraview.vtk import * -l2 = dir() - -for a in l2: - if (a not in l1) and a.startswith("vtk"): - classeslistvtk.append(a) - -dic=dict() - -non_wrap_list = ["vtkVariant", "vtkTimeStamp"] - -pv_classes_new=classeslistsm -while len(pv_classes_new): - pv_classes_cur=pv_classes_new - pv_classes_new=[] - for c in pv_classes_cur: - ## ignore non wrappable classes - if c in non_wrap_list: - continue - filename=sys.argv[1]+"/"+c+".h" - if os.path.isfile(filename): - c_new=[] - f=open(filename) - for line in f: - if re.match('\s*/',line) is None: - if re.match('\s*public\s*:',line): - continue - - m=re.match('\s*class\s+(vtk\w+)\s*;',line) - if m is not None: - cn=m.group(1) - if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk and issubclass(globals()[cn], vtkObjectBase): - pv_classes_new.append(cn) - continue - - m=re.match('\s*struct\s+(vtk\w+)\s*;',line) - if m is not None: - cn=m.group(1) - if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk and issubclass(globals()[cn], vtkObjectBase): - pv_classes_new.append(cn) - continue - - m=re.match('\s*#include\s+"(vtk\w+)\.h"',line) - if m is not None: - cn=m.group(1) - if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk and issubclass(globals()[cn], vtkObjectBase): - pv_classes_new.append(cn) - continue - - cm=re.findall('public\s+(vtk\w+)',line) - if len(cm) == 0: - continue - for cn in cm: - ## do not extract Call Back classes - if cn.count('vtkClassMemberCallback'): - continue - if cn not in dic.keys() and cn not in pv_classes_new: - pv_classes_new.append(cn) - if cn not in c_new: - c_new.append(cn) - f.close() - dic[c]=[0, c_new] - - -pv_classes_sort=[] - -def collect_dic(cc): - ret=[] - for c in cc: - if c not in dic.keys(): - continue - if len(dic[c][1]) and dic[c][0] == 0: - ret+=collect_dic(dic[c][1]) - if dic[c][0] == 0: - ret.append(c) - dic[c][0]=1 - return ret - -pv_classes_sort=collect_dic(dic.keys()) - -wf_str="" -if(os.path.exists('wrapfiles.txt')): - wf_txt=open('wrapfiles.txt','r') - strs=wf_txt.readlines() - wf_txt.close() - for s in strs: - wf_str+=s -str="" - -for c in pv_classes_sort: - str+=c - for cc in dic[c][1]: - str+=' '+cc - str+='\n' - -if(str!=wf_str): - wf_txt=open('wrapfiles.txt','w') - wf_txt.write(str) - wf_txt.close() diff --git a/src/VTKWrapping/readme.txt b/src/VTKWrapping/readme.txt deleted file mode 100644 index c7fff31b..00000000 --- a/src/VTKWrapping/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -The files under the ParaView directory are a pure copy from ParaView sources. -They are needed for the extractor build. -They have to be updated if the corresponding files in ParaView are changed \ No newline at end of file diff --git a/src/VTKWrapping/wrap.cmake b/src/VTKWrapping/wrap.cmake deleted file mode 100755 index 97e57623..00000000 --- a/src/VTKWrapping/wrap.cmake +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright (C) 2010-2015 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -LIST(GET PARAVIEW_INCLUDE_DIRS 0 PARAVIEW_INCLUDE_DIR0) - -SET(WRAP_IDL_I_HH) -SET(WRAP_IDL_I_CC) - -IF(EXISTS ${CMAKE_BINARY_DIR}/wrapfiles.txt) - EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c "f = open('${CMAKE_BINARY_DIR}/wrapfiles.txt') ; print f.read(), ; f.close()" - OUTPUT_VARIABLE WRAP_LIST_FULL - ) - - STRING(REGEX MATCHALL "[^\n]+" WRAP_LIST_REG ${WRAP_LIST_FULL}) - FOREACH(_str ${WRAP_LIST_REG}) - - SEPARATE_ARGUMENTS(_str) - LIST(LENGTH _str WRAP_LEN) - SET(DEP_HH) - SET(DEP_CC) - - LIST(GET _str 0 VAL) - - IF(WRAP_LEN GREATER 1) - MATH(EXPR WRAP_LEN1 "${WRAP_LEN} - 1" ) - - FOREACH(IND RANGE 1 ${WRAP_LEN1}) - LIST(GET _str ${IND} DEP_VAL) - SET(DEP_HH ${DEP_HH} PARAVIS_Gen_${DEP_VAL}_i.hh) - SET(DEP_CC ${DEP_CC} PARAVIS_Gen_${DEP_VAL}_i.cc) - ENDFOREACH(IND RANGE 1 ${WRAP_LEN1}) - - ENDIF(WRAP_LEN GREATER 1) - - LIST(APPEND WRAP_IDL_I_HH PARAVIS_Gen_${VAL}_i.hh) - LIST(APPEND WRAP_IDL_I_CC PARAVIS_Gen_${VAL}_i.cc) - - SET(vtkWrapIDL_HH_EXEFILE ${CMAKE_BINARY_DIR}/src/VTKWrapping/vtkWrapIDL_HH) - IF(WIN32) - IF(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(vtkWrapIDL_HH_EXEFILE ${CMAKE_BINARY_DIR}/src/VTKWrapping/vtkWrapIDL_HH.exe) - ELSE(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(vtkWrapIDL_HH_EXEFILE ${CMAKE_BINARY_DIR}/src/VTKWrapping/${CMAKE_BUILD_TYPE}/vtkWrapIDL_HH.exe) - ENDIF(CMAKE_BUILD_TOOL STREQUAL nmake) - ENDIF(WIN32) - - ADD_CUSTOM_COMMAND( - OUTPUT PARAVIS_Gen_${VAL}_i.hh - COMMAND ${vtkWrapIDL_HH_EXEFILE} -o PARAVIS_Gen_${VAL}_i.hh --hints ${CMAKE_BINARY_DIR}/idl/hints ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h - DEPENDS vtkWrapIDL_HH ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h ${CMAKE_BINARY_DIR}/idl/hints ${DEP_HH} - ) - - SET(vtkWrapIDL_CC_EXEFILE ${CMAKE_BINARY_DIR}/src/VTKWrapping/vtkWrapIDL_CC) - IF(WIN32) - IF(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(vtkWrapIDL_CC_EXEFILE ${CMAKE_BINARY_DIR}/src/VTKWrapping/vtkWrapIDL_CC.exe) - ELSE(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(vtkWrapIDL_CC_EXEFILE ${CMAKE_BINARY_DIR}/src/VTKWrapping/${CMAKE_BUILD_TYPE}/vtkWrapIDL_CC.exe) - ENDIF(CMAKE_BUILD_TOOL STREQUAL nmake) - ENDIF(WIN32) - - ADD_CUSTOM_COMMAND( - OUTPUT PARAVIS_Gen_${VAL}_i.cc - COMMAND ${vtkWrapIDL_CC_EXEFILE} -o PARAVIS_Gen_${VAL}_i.cc --hints ${CMAKE_BINARY_DIR}/idl/hints ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h - DEPENDS PARAVIS_Gen_${VAL}_i.hh vtkWrapIDL_CC ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h ${CMAKE_BINARY_DIR}/idl/hints ${DEP_CC} - ) - - ENDFOREACH(_str ${WRAP_LIST_REG}) -ENDIF(EXISTS ${CMAKE_BINARY_DIR}/wrapfiles.txt) - -ADD_CUSTOM_TARGET(generate_implements ALL DEPENDS ${CMAKE_BINARY_DIR}/wrapfiles.txt ${WRAP_IDL_I_HH} ${WRAP_IDL_I_CC}) -- 2.39.2