From: vsr Date: Mon, 5 Dec 2011 10:05:33 +0000 (+0000) Subject: Merge from V6_4_BR 05/12/2011 X-Git-Tag: V6_5_0a1~66 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bb8213241da104f45bbf65892a9fc56e68f7f29f;p=modules%2Fkernel.git Merge from V6_4_BR 05/12/2011 --- diff --git a/Makefile.am b/Makefile.am index 19467830f..9987fba72 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,6 +46,8 @@ DISTCLEANFILES = a.out local-install.sh hack_libtool aclocal.m4 configure salome salomeinclude_DATA = KERNEL_version.h EXTRA_DIST = \ + build_cmake \ + build_cmake.bat \ build_configure \ clean_configure \ LICENCE \ diff --git a/adm_local/unix/config_files/README b/adm_local/unix/config_files/README deleted file mode 100644 index feb997b16..000000000 --- a/adm_local/unix/config_files/README +++ /dev/null @@ -1,3 +0,0 @@ -This file is only here for CVS: -CVS does not always create empty directory, and adm_local/unix/config_file -is needed by build_configure. diff --git a/bin/appliskel/CatalogResources.xml b/bin/appliskel/CatalogResources.xml deleted file mode 100644 index 9e09ed5fc..000000000 --- a/bin/appliskel/CatalogResources.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/bin/appliskel/README b/bin/appliskel/README index fbcc09b55..dec94eab2 100644 --- a/bin/appliskel/README +++ b/bin/appliskel/README @@ -22,24 +22,22 @@ See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ======================================= Set of scripts for a SALOME application ======================================= -*html version of this document is produced with docutils*:: - rest2html < doc.txt > doc.html - -This document corresponds to SALOME2 3.1. (alpha version) - -+-------------------------------------------+ -| **WORK in PROGRESS, INCOMPLETE DOCUMENT** | -+-------------------------------------------+ +This document corresponds to SALOME 6.4.0 SALOME Application concept -------------------------- -See SALOME_Application_ to define your own configuration of SALOME and run it -on one or several computers. This is the recommended way of configuration. - -.. _SALOME_Application: ../../doc/SALOME_Application.html +See the documentation of KERNEL module for more information on SALOME +Application concept and to learn how to define your own configuration of +SALOME and run it on one or several computers. The recommended way to create +a new application is with the script appli_gen.py that can be found in KERNEL +installation. An application has probably already been generated for you if +you downloaded a binary version of SALOME. +To find all the files described below, please refer to a generated +application as some of them are generated automatically and thus are not +present in this appliskel directory. User run scripts ---------------- @@ -67,11 +65,6 @@ runTests with a running SALOME session. runSession tries to use an already existing naming service definition from a running session (hostname & port number). -killCurrentPort - Kills the last SALOME session corresponding to this application, and - intially launched from this computer. - Cleans associated config files. - SALOME internal run scripts --------------------------- @@ -92,7 +85,7 @@ runRemote.sh arguments define the command to execute. -The following files must be adapted to your environment and SALOME Application +The following files can be adapted to your environment and SALOME Application ------------------------------------------------------------------------------ - CatalogResources.xml @@ -101,10 +94,9 @@ The following files must be adapted to your environment and SALOME Application - env.d/envProducts.sh - env.d/envSalome.sh -CatalogRessources.xml - This files describes all the computer the application can use. The given - example is minimal and suppose ${APPLI} is the same relative path - to ${HOME}, on all the computers. A different directory can be set on a +CatalogResources.xml + This files describes all the computers the application can use. The default + file is minimal. A specific application directory can be set on a particular computer with a line:: appliPath="my/specific/path/on/this/computer" @@ -116,23 +108,21 @@ SalomeApp.xml Proposal for env.d scripts ~~~~~~~~~~~~~~~~~~~~~~~~~~ -Each user **must define** his own configuration for these scripts, following -the above rules. **The following is only an example not working as it is**. - -atFirst.sh - Sets the computer configuration not directly related to SALOME, - like useful tools, default PATH. +Each user can define his own configuration for these scripts, following +the above rules. The generated files are good examples to start with. envProducts.sh Sets the SALOME prerequisites. -envSALOME.sh +configSalome.sh Sets all the MODULE_ROOT_DIR that can be used in the SALOME application. - SalomeAppConfig is also defined by:: +configGUI.sh + Sets variables necessary for SALOME GUI. + SalomeAppConfig is defined by:: export SalomeAppConfig=${HOME}/${APPLI} where SalomeAppConfig designates the directory containing SalomeApp.xml. Note that ${APPLI} is already defined by the calling scripts when - env.d/envSalome.sh is sourced. + env.d/configGUI.sh is sourced. diff --git a/bin/appliskel/SalomeApp.xml b/bin/appliskel/SalomeApp.xml deleted file mode 100644 index fcadb01a1..000000000 --- a/bin/appliskel/SalomeApp.xml +++ /dev/null @@ -1,95 +0,0 @@ - -
- - - - - -
-
- - - - - - - - - - - - - -
-
- - -
-
- - - - - - - - - - - - - - - - - - - - - - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - - -
-
- - -
- - -
- - -
-
- -
-
- - -
- -
- - -
-
diff --git a/bin/appliskel/env.d/atFirst.sh b/bin/appliskel/env.d/atFirst.sh deleted file mode 100644 index a55705987..000000000 --- a/bin/appliskel/env.d/atFirst.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 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 -# - -#------------------------------------------------ -# to be sourced first, used in following scripts -#------------------------------------------------ -# -export LD_LIBRARY_PATH="." -export PATH="/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/prascle/bin:." -export PYTHONPATH="" - -export RAC=${HOME} -export PAKSAL=/opt -export PUB=${RAC}/public -export TARP=${RAC}/tarpublic -export PYPACKAGES=${PUB}/site_packages - -# ------------------------------------------------ -# ---- gdb 5.3 - -export PATH=${PAKSAL}/gdb53/bin:${PATH} -export LD_LIBRARY_PATH=${PAKSAL}/gdb53/lib:${LD_LIBRARY_PATH} - -# ------------------------------------------------ -# ---- ddd 3.3.7 - -export PATH=${PAKSAL}/ddd337/bin:${PATH} -export LD_LIBRARY_PATH=${PAKSAL}/ddd337/lib:${LD_LIBRARY_PATH} - -# ------------------------------------------------ -# --- Java 1.4 - -export JDKHOME=${PUB}/j2sdk_nb/j2sdk1.4.2 -export JAVAHOME=${PUB}/j2sdk_nb/j2sdk1.4.2 -export PATH=${JAVAHOME}/bin:${PATH} -export LD_LIBRARY_PATH=${JAVAHOME}/lib:${LD_LIBRARY_PATH} -export LD_LIBRARY_PATH=${JAVAHOME}/jre/lib/i386:${LD_LIBRARY_PATH} -export LD_LIBRARY_PATH=${JAVAHOME}/jre/lib/i386/client:${LD_LIBRARY_PATH} - -# ------------------------------------------------ -# --- gsl -1.4 - -export GSLHOME=${PAKSAL}/gsl-1.4 -export PATH=${GSLHOME}/bin:${PATH} -export LD_LIBRARY_PATH=${GSLHOME}/lib:${LD_LIBRARY_PATH} - -# ------------------------------------------------ -# --- fltk 1.1.4 - -export FLTKHOME=${PAKSAL}/fltk114 -export PATH=${FLTKHOME}/bin:${PATH} -export LD_LIBRARY_PATH=${FLTKHOME}/lib:${LD_LIBRARY_PATH} - -# ------------------------------------------------ -# --- gmsh 1.48 - -export GMSHHOME=${PAKSAL}/gmsh148 -export PATH=${GMSHHOME}/bin:${PATH} - -# ------------------------------------------------ -# ---- tkcvs, tkdiffb, cvs - -export PATH=${PAKSAL}/tkcvs7.2/bin:${PAKSAL}/cvs1.11.14/bin:${PATH} diff --git a/bin/appliskel/env.d/envProducts.sh b/bin/appliskel/env.d/envProducts.sh deleted file mode 100644 index b08694689..000000000 --- a/bin/appliskel/env.d/envProducts.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/sh -# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 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 -# - -# ------------------------------------------------ -# ---- openpbs -# -export OPENPBS=/optroot/openpbs2316 -export PATH=${OPENPBS}/bin:${PATH} -export LD_LIBRARY_PATH=${OPENPBS}/lib:${LD_LIBRARY_PATH} - -#------------------------------------------------------------------------------ - -export INSTALL_ROOT=/home/prascle/PAL_SALOME141 -#------ gcc ------ -export GCC_ROOT=/usr -export CXX=${GCC_ROOT}/bin/g++ -export CC=${GCC_ROOT}/bin/gcc -## -#------ boost ------ -export BOOSTDIR=${INSTALL_ROOT}/boost-1.30.2 -## - -#------ tcltk ------ -export TCLHOME=/usr - -#------ Python ------ -export PYTHONHOME=/usr -export PYTHONPATH=${PYPACKAGES}:${PYTHONPATH} -## -#------ Qt ------ -#export QTDIR=/usr/lib/qt-3.0.5 -export QTDIR=/usr/lib/qt3-gcc3.2 -export PATH=${PATH}:${QTDIR}/bin -export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${QTDIR}/lib -## -#------ Sip ------ -export SIPDIR=/usr -export PYQTDIR=/usr -## -#------ PyQt ------ -export PYQT_SIPS=/usr/share/sip/qt -export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/python2.2/site-packages -## -#------ Swig ------ -export SWIG_ROOT=${INSTALL_ROOT}/SWIG-1.3.17 -export PATH=${SWIG_ROOT}/bin:${PATH} -export LD_LIBRARY_PATH=${SWIG_ROOT}/lib:${LD_LIBRARY_PATH} -## -#------ OpenCascade ------ -export CASROOT=/opt/CAS52patch -export LD_LIBRARY_PATH=${CASROOT}/Linux/lib:${LD_LIBRARY_PATH} -export PATH=${CASROOT}/Linux/bin:${PATH} -# Variable for Foundation Classes : -export CSF_UnitsLexicon=${CASROOT}/src/UnitsAPI/Lexi_Expr.dat -export CSF_UnitsDefinition=${CASROOT}/src/UnitsAPI/Units.dat -# Variable for DataExchange : -export CSF_SHMessage=${CASROOT}/src/SHMessage -export CSF_XSMessage=${CASROOT}/src/XSMessage -# Variable for Font : -export CSF_MDTVFontDirectory=${CASROOT}/src/FontMFT -export CSF_MDTVTexturesDirectory=${CASROOT}/src/Textures -## -export CSF_LANGUAGE=us -export MMGT_CLEAR=1 -export CSF_EXCEPTION_PROMPT=1 -export CSF_StandardDefaults=${CASROOT}/src/StdResource -export CSF_PluginDefaults=${CASROOT}/src/StdResource -export CSF_XCAFDefaults=${CASROOT}/src/StdResource -export CSF_GraphicShr=${CASROOT}/Linux/lib/libTKOpenGl.so -export CSF_IGESDefaults=${CASROOT}/src/XSTEPResource -export CSF_STEPDefaults=${CASROOT}/src/XSTEPResource -## -#export TCLLIBPATH=$TCLHOME/lib -## -#------ Qwt ------ -export QWTHOME=${INSTALL_ROOT}/qwt-0.4.1 -export LD_LIBRARY_PATH=${QWTHOME}/lib:${LD_LIBRARY_PATH} -## -#------ Hdf ------ -export HDF5HOME=${INSTALL_ROOT}/hdf5-1.4.4 -export PATH=${HDF5HOME}/bin:$PATH -export LD_LIBRARY_PATH=${HDF5HOME}/lib:${LD_LIBRARY_PATH} -## -#------ Med ------ -export MED2HOME=/opt/med2.2.2 -export PATH=${MED2HOME}/bin:${PATH} -export LD_LIBRARY_PATH=${MED2HOME}/lib:${LD_LIBRARY_PATH} -## -#------ Vtk ------ -export VTKHOME=${INSTALL_ROOT}/VTK-4.2.2 -export PATH=${VTKHOME}/bin:${PATH} -export LD_LIBRARY_PATH=${VTKHOME}/lib/vtk:${LD_LIBRARY_PATH} -export PYTHONPATH=${VTKHOME}/lib/vtk:${VTKHOME}/lib/python2.2/site-packages/vtk_python:${PYTHONPATH} -## -#------ netgen ------ -export NETGENROOT=${INSTALL_ROOT}/netgen4.3 -export NETGEN_HOME=${INSTALL_ROOT}/netgen4.3 -## -#------ OmniORB ------ -export OMNIORBDIR=${INSTALL_ROOT}/omniORB-3.0.5 -export OMNIORB_CONFIG=${OMNIORBDIR}/.omniORB.cfg -export PYTHONPATH=${OMNIORBDIR}/lib/python:${OMNIORBDIR}/lib/i586_linux_2.0_glibc2.1:${PYTHONPATH} -export PATH=$OMNIORBDIR/bin/i586_linux_2.0_glibc2.1:$PATH -export LD_LIBRARY_PATH=$OMNIORBDIR/lib/i586_linux_2.0_glibc2.1:$LD_LIBRARY_PATH -## -#------ Numeric ------ -export PYTHONPATH=${INSTALL_ROOT}/Numeric-22.0/lib/python2.2/site-packages/Numeric:${PYTHONPATH} -## -#------ HappyDoc ------ -export PATH=${INSTALL_ROOT}/HappyDoc-r2_1/bin:${PATH} -export PYTHONPATH=${INSTALL_ROOT}/HappyDoc-r2_1/lib/python2.2/site-packages:${PYTHONPATH} -## -#------ Doxygen ------ -export PATH=${INSTALL_ROOT}/doxygen-1.3-rc2/bin:${PATH} -## -#------ Graphviz ------ -export PATH=${INSTALL_ROOT}/graphviz-1.9/bin:${PATH} -export LD_LIBRARY_PATH=${INSTALL_ROOT}/graphviz-1.9/lib/graphviz:${LD_LIBRARY_PATH} -## - -#------------------------------------------------------------------------------ diff --git a/bin/appliskel/env.d/envSalome.sh b/bin/appliskel/env.d/envSalome.sh deleted file mode 100644 index a7d810ee8..000000000 --- a/bin/appliskel/env.d/envSalome.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 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 -# - -# --- example to adapt to your own configuration --- -# --- envSalome.sh gives a set of MODULE_ROOT_DIR, to source -# --- you must at least define and export KERNEL_ROOT_DIR -# -REPINST=/home/prascle/SALOME2/Install - -export KERNEL_ROOT_DIR=${REPINST}/KERNEL_V301 - -export GUI_ROOT_DIR=${REPINST}/GUI_V301 -#export SalomeAppConfig=${GUI_ROOT_DIR}/share/salome/resources/gui -export SalomeAppConfig=${HOME}/${APPLI} - -export GEOM_ROOT_DIR=${REPINST}/GEOM_V301 -export MED_ROOT_DIR=${REPINST}/MED_V301 -export SMESH_ROOT_DIR=${REPINST}/SMESH_V301 -export VISU_ROOT_DIR=${REPINST}/VISU_V301 -export NETGENPLUGIN_ROOT_DIR=${REPINST}/NETGENPLUGIN_V301 -export COMPONENT_ROOT_DIR=${REPINST}/COMPONENT_V301 -export PYCALCULATOR_ROOT_DIR=${REPINST}/PYCALCULATOR_V301 -export PYHELLO_ROOT_DIR=${REPINST}/PYHELLO_V301 -export PYTIX_ROOT_DIR=${REPINST}/PYTIX_V301 - diff --git a/bin/appliskel/killCurrentPort b/bin/appliskel/killCurrentPort deleted file mode 100755 index 462a40f69..000000000 --- a/bin/appliskel/killCurrentPort +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 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 -# - -# --- retrieve APPLI path, relative to $HOME, set ${APPLI} - -APPLI_HOME=`dirname $0` -export APPLI=`${APPLI_HOME}/getAppliPath.py` - -# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) - -. ${HOME}/${APPLI}/envd ${HOME}/${APPLI} - -# --- find omniORB configuration relative to current session if any - -fileOmniConfig=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg - -if [ -f $fileOmniConfig ]; then - OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg - export OMNIORB_CONFIG -fi - -currentPort=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port` -echo $currentPort - -# --- kill current salome session -${KERNEL_ROOT_DIR}/bin/salome/shutdownSalome.py -${KERNEL_ROOT_DIR}/bin/salome/killSalomeWithPort.py $currentPort - -# --- delete config files - -if [ -s $fileOmniConfig ]; then - refConfig=`ls -l $fileOmniConfig | awk '{print \$NF}'` - if [ -f $refConfig ]; then - rm $refConfig - fi - rm $fileOmniConfig -fi diff --git a/bin/appliskel/runParam b/bin/appliskel/runParam deleted file mode 100755 index a84f6b3eb..000000000 --- a/bin/appliskel/runParam +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 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 -# - -./KillCurrentPort - -./runAppli --logger - diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index eddc8f524..caf138cd1 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -26,7 +26,7 @@ import xml.sax import optparse import types -from salome_utils import verbose, setVerbose, getPortNumber +from salome_utils import verbose, setVerbose, getPortNumber, getHomeDir # names of tags in XML configuration file doc_tag = "document" @@ -74,6 +74,7 @@ plugins_nam = "plugins" # values passed as arguments, NOT read from XML config file, but set from within this script appname_nam = "appname" port_nam = "port" +salomecfgname = "salome" salomeappname = "SalomeApp" script_nam = "pyscript" @@ -115,20 +116,20 @@ def version(): # Calculate and return configuration file unique ID # For example: for SALOME version 3.1.0a1 the id is 300999701 ### -def version_id( fname ): +def version_id(fname): + major = minor = release = dev1 = dev2 = 0 vers = fname.split(".") - major = int(vers[0]) - minor = int(vers[1]) - mr = re.search(r'^([0-9]+)([A-Za-z]?)([0-9]*)',vers[2]) - release = dev = 0 - if mr: - release = int(mr.group(1)) - dev1 = dev2 = 0 - if len(mr.group(2)): dev1 = ord(mr.group(2)) - if len(mr.group(3)): dev2 = int(mr.group(3)) - dev = dev1 * 100 + dev2 - else: - return None + if len(vers) > 0: major = int(vers[0]) + if len(vers) > 1: minor = int(vers[1]) + if len(vers) > 2: + mr = re.search(r'^([0-9]+)([A-Za-z]?)([0-9]*)',vers[2]) + if mr: + release = int(mr.group(1)) + if mr.group(2).strip(): dev1 = ord(mr.group(2).strip()) + if mr.group(3).strip(): dev2 = int(mr.group(3).strip()) + pass + pass + dev = dev1 * 100 + dev2 ver = major ver = ver * 100 + minor ver = ver * 100 + release @@ -137,37 +138,75 @@ def version_id( fname ): return ver ### -# Get user configuration file name +# Get default user configuration file name +# For SALOME, it is: +# - on Linux: ~/.config/salome/.SalomeApprc.[version] +# - on Windows: ~/SalomeApp.xml.[version] +# where [version] is a version number ### -def userFile(appname): +def defaultUserFile(appname=salomeappname, cfgname=salomecfgname): v = version() - if not v: - return "" # not unknown version + if v: v = ".%s" % v if sys.platform == "win32": - filename = "%s\%s.xml.%s" % (os.environ['HOME'], appname, v) + filename = os.path.join(getHomeDir(), "%s.xml%s" % (appname, v)) else: - filename = "%s/.%src.%s" % (os.environ['HOME'], appname, v) - if os.path.exists(filename): - return filename # user preferences file for the current version exists - # initial id - id0 = version_id( v ) - # get all existing user preferences files + if cfgname: + filename = os.path.join(getHomeDir(), ".config", cfgname, ".%src%s" % (appname, v)) + pass + else: + filename = os.path.join(getHomeDir(), ".%src%s" % (appname, v)) + pass + pass + return filename + +### +# Get user configuration file name +### +def userFile(appname, cfgname): + # get app version + v = version() + if not v: return None # unknown version + + # get default user file name + filename = defaultUserFile(appname, cfgname) + if not filename: return None # default user file name is bad + + # check that default user file exists + if os.path.exists(filename): return filename # user file is found + + # otherwise try to detect any appropriate user file + + # ... calculate default version id + id0 = version_id(v) + if not id0: return None # bad version id -> can't detect appropriate file + + # ... get all existing user preferences files if sys.platform == "win32": - files = glob.glob( os.environ['HOME'] + "\." + appname + ".xml.*" ) + files = glob.glob(os.path.join(getHomeDir(), "%s.xml.*" % appname)) else: - files = glob.glob( os.environ['HOME'] + "/." + appname + "rc.*" ) - f2v = {} - for file in files: - match = re.search( r'\.%src\.([a-zA-Z0-9.]+)$'%appname, file ) - if match: f2v[file] = match.group(1) - last_file = "" - last_version = 0 - for file in f2v: - ver = version_id( f2v[file] ) - if ver and abs(last_version-id0) > abs(ver-id0): - last_version = ver - last_file = file - return last_file + files = [] + if cfgname: files += glob.glob(os.path.join(getHomeDir(), ".config", cfgname, ".%src.*" % appname)) + files += glob.glob(os.path.join(getHomeDir(), ".%src.*" % appname)) + pass + + # ... loop through all files and find most appopriate file (with closest id) + appr_id = -1 + appr_file = "" + for f in files: + if sys.platform == "win32": + match = re.search( r'%s\.xml\.([a-zA-Z0-9.]+)$'%appname, f ) + else: + match = re.search( r'\.%src\.([a-zA-Z0-9.]+)$'%appname, f ) + if match: + ver = version_id(match.group(1)) + if not ver: continue # bad version id -> skip file + if appr_id < 0 or abs(appr_id-id0) > abs(ver-id0): + appr_id = ver + appr_file = f + pass + pass + pass + return appr_file # -- @@ -323,12 +362,12 @@ class xml_parser: if os.path.exists(absfname + ext) : absfname += ext if absfname in self.importHistory : - if verbose(): print "Configure parser: file %s is already imported" % absfname + if verbose(): print "Configure parser: Warning : file %s is already imported" % absfname return # already imported break pass else: - if verbose(): print "Configure parser: Error : file %s does NOT exists" % absfname + if verbose(): print "Configure parser: Error : file %s does not exist" % absfname return # importing file @@ -494,9 +533,9 @@ def CreateOptionParser (theAdditionalOptions=[]): dest="py_scripts", help=help_str) - # Configuration XML file. Default: $(HOME)/.SalomeApprc.$(version). + # Configuration XML file. Default: see defaultUserFile() function help_str = "Parse application settings from the " - help_str += "instead of default $(HOME)/.SalomeApprc.$(version)" + help_str += "instead of default %s" % defaultUserFile() o_r = optparse.Option("-r", "--resources", metavar="", @@ -770,7 +809,7 @@ def CreateOptionParser (theAdditionalOptions=[]): args = {} #def get_env(): #args = [] -def get_env(theAdditionalOptions=[], appname="SalomeApp"): +def get_env(theAdditionalOptions=[], appname=salomeappname, cfgname=salomecfgname): ### # Collect launch configuration files: # - The environment variable "Config" (SalomeAppConfig) which can @@ -786,8 +825,9 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): # has higher priority: it means that if some configuration options # is found in the next analyzed cofiguration file - it will be replaced # - The last configuration file which is parsed is user configuration file - # situated in the home directory: "~/.rc[.]" (~/SalomeApprc.3.2.0) - # (if it exists) + # situated in the home directory (if it exists): + # * ~/.config/salome/.rc[.]" for Linux (e.g. ~/.config/salome/.SalomeApprc.6.4.0) + # * ~/.xml[.] for Windows (e.g. ~/SalomeApp.xml.6.4.0) # - Command line options have the highest priority and replace options # specified in configuration file(s) ### @@ -854,33 +894,33 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): # parse SalomeApp.xml files in directories specified by SalomeAppConfig env variable for dir in dirs: - #filename = dir+'/'+appname+'.xml' - filename = dir+'/'+salomeappname+'.xml' + filename = os.path.join(dir, appname+'.xml') if not os.path.exists(filename): - print "Configure parser: Warning : could not find configuration file %s" % filename + if verbose(): print "Configure parser: Warning : can not find configuration file %s" % filename else: try: p = xml_parser(filename, _opts) _opts = p.opts except: - print "Configure parser: Error : can not read configuration file %s" % filename + if verbose(): print "Configure parser: Error : can not read configuration file %s" % filename pass # parse user configuration file # It can be set via --resources= command line option - # or is given by default from ${HOME}/.rc. + # or is given from default location (see defaultUserFile() function) # If user file for the current version is not found the nearest to it is used user_config = cmd_opts.resources if not user_config: - user_config = userFile(appname) + user_config = userFile(appname, cfgname) + if verbose(): print "Configure parser: user configuration file is", user_config if not user_config or not os.path.exists(user_config): - print "Configure parser: Warning : could not find user configuration file" + if verbose(): print "Configure parser: Warning : can not find user configuration file" else: try: p = xml_parser(user_config, _opts) _opts = p.opts except: - print 'Configure parser: Error : can not read user configuration file' + if verbose(): print 'Configure parser: Error : can not read user configuration file' user_config = "" args = _opts diff --git a/bin/salome_utils.py b/bin/salome_utils.py index 4cd3bca8a..4d2ae82e5 100644 --- a/bin/salome_utils.py +++ b/bin/salome_utils.py @@ -40,6 +40,7 @@ __all__ = [ 'getAppName', 'getPortNumber', 'getTmpDir', + 'getHomeDir', 'generateFileName', 'makeTmpDir', 'uniteFiles', @@ -200,6 +201,30 @@ def getPortNumber(use_default=True): # --- +def getHomeDir(): + """ + Get home directory. + """ + import os, sys + if sys.platform == "win32": + # for Windows the home directory is detected in the following way: + # 1. try USERPROFILE env variable + # 2. try combination of HOMEDRIVE and HOMEPATH env variables + # 3. try HOME env variable + # TODO: on Windows, also GetUserProfileDirectoryW() system function might be used + dir = os.getenv("USERPROFILE") + if not dir and os.getenv("HOMEDRIVE") and os.getenv("HOMEPATH"): + dir = os.path.join(os.getenv("HOMEDRIVE"), os.getenv("HOMEPATH")) + if not dir: + dir = os.getenv("HOME") + pass + else: + # for Linux: use HOME variable + dir = os.getenv("HOME") + pass + return dir +# --- + def getTmpDir(): """ Get directory to be used for the temporary files. diff --git a/bin/virtual_salome.py b/bin/virtual_salome.py index 02502849e..5a25222ee 100644 --- a/bin/virtual_salome.py +++ b/bin/virtual_salome.py @@ -205,17 +205,14 @@ def link_module(options): if not os.path.exists(module_lib_py_dir): print "Python directory %s does not exist" % module_lib_py_dir else: - # __GBO__ specific action for the package salome + # Specific action for the package salome module_lib_pypkg_dir=os.path.join(module_lib_py_dir,"salome") lib_pypkg_dir=os.path.join(lib_py_dir,"salome") mkdir(lib_pypkg_dir) - # __GBO__ mkdir(lib_py_shared_dir) for fn in os.listdir(module_lib_py_dir): if fn == "shared_modules": continue - # __GBO__ if fn == "salome": continue - # __GBO__ symlink(os.path.join(module_lib_py_dir, fn), os.path.join(lib_py_dir, fn)) pass if os.path.exists(module_lib_py_shared_dir): @@ -223,13 +220,11 @@ def link_module(options): symlink(os.path.join(module_lib_py_shared_dir, fn), os.path.join(lib_py_shared_dir, fn)) pass pass - # __GBO__ if os.path.exists(module_lib_pypkg_dir): for fn in os.listdir(module_lib_pypkg_dir): symlink(os.path.join(module_lib_pypkg_dir, fn), os.path.join(lib_pypkg_dir, fn)) pass pass - # __GBO__ else: if verbose: print module_lib_py_shared_dir, " doesn't exist" @@ -265,14 +260,14 @@ def link_module(options): if os.path.exists(module_share_dir): mkdir(share_dir) for fn in os.listdir(module_share_dir): - if fn=="resources": - #resources : create it and link content - mkdir(os.path.join(share_dir,"resources")) - for ffn in os.listdir(os.path.join(module_share_dir,"resources")): - symlink(os.path.join(module_share_dir, "resources", ffn), os.path.join(share_dir,"resources", ffn)) - else: - #other directories (not resources) - symlink(os.path.join(module_share_dir, fn), os.path.join(share_dir, fn)) + if fn in ["resources","plugins"] : + # Create the directory and then link the content + mkdir(os.path.join(share_dir,fn)) + for ffn in os.listdir(os.path.join(module_share_dir,fn)): + symlink(os.path.join(module_share_dir, fn, ffn), os.path.join(share_dir,fn, ffn)) + else: + #other directories (not resources) + symlink(os.path.join(module_share_dir, fn), os.path.join(share_dir, fn)) else: print "share/salome directory %s does not exist" % module_share_dir pass diff --git a/configure.ac b/configure.ac index 6943c530d..3bb0d9f57 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ # ================================================================ #AC_PREREQ(2.59) # -AC_INIT([Salome2 Project], [6.3.1], [paul.rascle@edf.fr], [SalomeKERNEL]) +AC_INIT([Salome2 Project], [6.4.0], [paul.rascle@edf.fr], [SalomeKERNEL]) # AC_CONFIG_AUX_DIR defines an alternative directory where to find the auxiliary # scripts such as config.guess, install-sh, ... @@ -614,4 +614,5 @@ AC_OUTPUT([ \ src/Utils/Makefile \ src/Utils/Test/Makefile \ src/KernelHelpers/Makefile \ + src/KernelHelpers/Test/Makefile \ ]) diff --git a/doc/Makefile.am b/doc/Makefile.am index a5b1d2b66..75f6ea45f 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -29,7 +29,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am SUBDIRS = salome docutils -EXTRA_DIST = configuration_examples +EXTRA_DIST = configuration_examples README.cluster-CCRT docs: usr_docs diff --git a/doc/docutils/Makefile.am b/doc/docutils/Makefile.am index 217fd91de..513aa541e 100644 --- a/doc/docutils/Makefile.am +++ b/doc/docutils/Makefile.am @@ -41,11 +41,14 @@ SPHINXBUILD = sphinx-build PAPEROPT_a4 = -D latex_paper_size=a4 ALLSPHINXOPTS = -d doctrees $(PAPEROPT_a4) $(SPHINXOPTS) $(SOURCEDIR) +if WITH_PACO_PARALLEL +SPHINX_PYTHONPATH = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(prefix)/lib64/python$(PYTHON_VERSION)/site-packages/salome:$(prefix)/bin/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages:$(OMNIORB_ROOT)/lib64/python$(PYTHON_VERSION)/site-packages:$(PACOPATH)/lib/python$(PYTHON_VERSION):$(PACOPATH)/lib/python +else SPHINX_PYTHONPATH = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(prefix)/lib64/python$(PYTHON_VERSION)/site-packages/salome:$(prefix)/bin/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages:$(OMNIORB_ROOT)/lib64/python$(PYTHON_VERSION)/site-packages +endif SPHINX_LD_LIBRARY_PATH = $(OMNIORB_ROOT)/lib - .PHONY: latex if SPHINX_IS_OK diff --git a/doc/docutils/archives/UnitTests.txt b/doc/docutils/archives/UnitTests.txt index 987db0ec1..f30f38202 100644 --- a/doc/docutils/archives/UnitTests.txt +++ b/doc/docutils/archives/UnitTests.txt @@ -30,10 +30,6 @@ General structure of KERNEL_SRC KERNEL_SRC Some README files and configuration tools for build -KERNEL_SRC/adm_local - Part of the configuration files, other modules have a directory with the - same name. Not used in KERNEL. - KERNEL_SRC/bin Python and shell scripts used at run time. Kit to install a SALOME Application. diff --git a/doc/salome/Makefile.am b/doc/salome/Makefile.am index 52c2f45b7..125ba27c4 100644 --- a/doc/salome/Makefile.am +++ b/doc/salome/Makefile.am @@ -42,4 +42,5 @@ dev_docs: EXTRA_DIST= main.dox install.dox \ kernel_resources.dox kernel_services.dox kernel_services_cpphelpers.dox \ salome_application.dox unittests.dox \ - salome_file.dox kernel_salome.dox + salome_file.dox kernel_salome.dox \ + examples diff --git a/doc/salome/tui/Makefile.am b/doc/salome/tui/Makefile.am index 19d8e199a..1863baab0 100644 --- a/doc/salome/tui/Makefile.am +++ b/doc/salome/tui/Makefile.am @@ -46,4 +46,4 @@ install-data-local: fi; uninstall-local: - rm -rf $(DESTDIR)$(docdir)/tui/KERNEL + -test -d $(DESTDIR)$(docdir)/tui/KERNEL && chmod -R +w $(DESTDIR)$(docdir)/tui/KERNEL && rm -rf $(DESTDIR)$(docdir)/tui/KERNEL diff --git a/doc/salome/unittests.dox b/doc/salome/unittests.dox index 5173b8d83..517b80cd1 100644 --- a/doc/salome/unittests.dox +++ b/doc/salome/unittests.dox @@ -15,10 +15,6 @@ the unit tests. - KERNEL_SRC :\n Some README files and configuration tools for build -- KERNEL_SRC/adm_local :\n - Part of the configuration files, other modules have a directory with the - same name. Not used in KERNEL. - - KERNEL_SRC/bin :\n Python and shell scripts used at run time. Kit to install a %SALOME Application. diff --git a/idl/Makefile.am b/idl/Makefile.am index e16582ec7..54119fdb3 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -72,7 +72,7 @@ OTHER_IDL_FILES = \ EXTRA_DIST= $(BASEIDL_FILES) $(MPIIDL_FILES) $(OTHER_IDL_FILES) \ SALOME_Component.xml DSC_Engines.xml SALOME_Ports.xml \ SALOME_PACOExtension.xml SALOME_ParamPorts.xml \ - SALOME_GenericObj.xml + SALOME_GenericObj.xml SALOME_Exception.xml # This variable defines the files to be installed salomeidl_DATA = $(IDL_FILES) diff --git a/resources/Makefile.am b/resources/Makefile.am index e96744c43..ef8cd463b 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -35,13 +35,21 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am if WITHONLYLAUNCHER dist_salomeres_DATA=\ - CatalogResources.xml \ CatalogModulePersonnel.xml_skel + + # VSR: little trick to avoid putting if generated files to the distribution archive + nodist_salomeres_DATA=\ + CatalogResources.xml else dist_salomeres_DATA=\ - CatalogResources.xml \ CatalogModulePersonnel.xml_skel \ channel.cfg \ - KERNELCatalog.xml \ SALOMEDS_Resources + + # VSR: little trick to avoid putting if generated files to the distribution archive + nodist_salomeres_DATA=\ + CatalogResources.xml \ + KERNELCatalog.xml endif + +EXTRA_DIST = CatalogDataType.xml diff --git a/salome_adm/cmake_files/FindKERNEL.cmake b/salome_adm/cmake_files/FindKERNEL.cmake index f80d15833..a4fbbd993 100644 --- a/salome_adm/cmake_files/FindKERNEL.cmake +++ b/salome_adm/cmake_files/FindKERNEL.cmake @@ -61,3 +61,4 @@ FIND_LIBRARY(SALOMETraceCollectorTest SALOMETraceCollectorTest ${KERNEL_ROOT_DIR FIND_LIBRARY(TOOLSDS TOOLSDS ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(UtilsTest UtilsTest ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(with_loggerTraceCollector with_loggerTraceCollector ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(SalomeKernelHelpers SalomeKernelHelpers ${KERNEL_ROOT_DIR}/lib/salome) diff --git a/salome_adm/cmake_files/am2cmake.py b/salome_adm/cmake_files/am2cmake.py index e74e5a1e9..b93e4bfaf 100644 --- a/salome_adm/cmake_files/am2cmake.py +++ b/salome_adm/cmake_files/am2cmake.py @@ -245,6 +245,7 @@ class CMakeFile(object): "TOOLSDS", "UtilsTest", "with_loggerTraceCollector", + "SalomeKernelHelpers", ] gui_list = [ "caf", @@ -770,8 +771,8 @@ class CMakeFile(object): pass # -- newlines.append(""" - set(VERSION 6.3.1) - set(XVERSION 0x060301) + set(VERSION 6.4.0) + set(XVERSION 0x060400) """) pass # -- @@ -779,13 +780,19 @@ class CMakeFile(object): SET(VERSION_INFO 0.0.0) SET(SOVERSION_INFO 0) SET(SUBDIRS) - SET(AM_CPPFLAGS -I${CMAKE_BINARY_DIR ) + SET(AM_CPPFLAGS -I${CMAKE_BINARY_DIR} ) SET(AM_CXXFLAGS -I${CMAKE_BINARY_DIR}) SET(LDADD) SET(pythondir lib/python${PYTHON_VERSION}/site-packages) SET(salomepythondir ${pythondir}/salome) SET(salomepypkgdir ${salomepythondir}/salome) """) + + if self.module == "smesh" and self.root[-len('SMESH_PY'):] == 'SMESH_PY': + newlines.append(""" + SET(smeshpypkgdir ${salomepythondir}/salome/smesh) + """) + pass if self.module == "netgen": newlines.append(r''' SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DNO_PARALLEL_THREADS -DOCCGEOMETRY -I${CMAKE_CURRENT_SOURCE_DIR}) @@ -807,8 +814,8 @@ class CMakeFile(object): if self.module == "gui": newlines.append(r''' IF(KERNEL_ROOT_DIR) - SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DWITH_SALOMEDS_OBSERVER) - SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DWITH_SALOMEDS_OBSERVER) + SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DWITH_SALOMEDS_OBSERVER -DSUIT_ENABLE_PYTHON) + SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DWITH_SALOMEDS_OBSERVER -DSUIT_ENABLE_PYTHON) ENDIF(KERNEL_ROOT_DIR) ''') pass @@ -1014,6 +1021,14 @@ class CMakeFile(object): # -- fields = value.split() + + #rnv: Temporary solution for windows platform: + #rnv: To remove GUI_SRC/tools directory, because it contains shell scripts + #rnv: Will be fixed in the future + from sys import platform + if platform == "win32" and self.module == 'gui' and self.root[-len('GUI_SRC'):] == 'GUI_SRC' and key.endswith("SUBDIRS"): + fields.remove("tools") + for i in range(len(fields)): newlines.append("%s %s"%(spaces, fields[i])) pass @@ -1446,6 +1461,28 @@ class CMakeFile(object): ''') pass + # -- + # -- + key = "MOC_FILES_HXX" + if self.__thedict__.has_key(key): + newlines.append(''' + FOREACH(output ${MOC_FILES_HXX}) + ''') + newlines.append(''' + STRING(REGEX REPLACE _moc.cxx .hxx input ${output}) + ''') + newlines.append(''' + SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input}) + SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output}) + ADD_CUSTOM_COMMAND( + OUTPUT ${output} + COMMAND ${QT_MOC_EXECUTABLE} ${MOC_FLAGS} ${input} -o ${output} + MAIN_DEPENDENCY ${input} + ) + ENDFOREACH(output ${MOC_FILES_HXX}) + ''') + pass + # -- # -- key = "UIC_FILES" @@ -1536,7 +1573,7 @@ class CMakeFile(object): SET(input_path ${CMAKE_CURRENT_SOURCE_DIR}/${input}) IF (NOT EXISTS ${input_path}) SET(input_path ${CMAKE_CURRENT_BINARY_DIR}/${input}) - ENDIF (NOT EXISTS input_path) + ENDIF (NOT EXISTS ${input_path}) ADD_CUSTOM_COMMAND( OUTPUT ${output} COMMAND ${QT_UIC_EXECUTABLE} -o ${output} ${input_path} @@ -1549,7 +1586,7 @@ class CMakeFile(object): SET(input_path ${CMAKE_CURRENT_SOURCE_DIR}/${input}) IF (NOT EXISTS ${input_path}) SET(input_path ${CMAKE_CURRENT_BINARY_DIR}/${input}) - ENDIF (NOT EXISTS input_path) + ENDIF (NOT EXISTS ${input_path}) ADD_CUSTOM_COMMAND( OUTPUT ${output} COMMAND ${QT_MOC_EXECUTABLE} ${MOC_FLAGS} ${input_path} -o ${output} @@ -1689,6 +1726,14 @@ class CMakeFile(object): SET(libadd ${libadd} ${dir}/LIBI77.lib) ENDIF(name STREQUAL ${target}) ENDFOREACH(target ${targets}) + ELSE(WINDOWS) + SET(targets) + SET(targets ${targets} MEFISTO2D) + FOREACH(target ${targets}) + IF(name STREQUAL ${target}) + SET(libadd ${libadd} -lf2c) + ENDIF(name STREQUAL ${target}) + ENDFOREACH(target ${targets}) ENDIF(WINDOWS) ''') # -- @@ -1767,6 +1812,8 @@ class CMakeFile(object): SET(targets ${targets} MEDEngine) SET(targets ${targets} SMESHEngine) SET(targets ${targets} SMESH) + SET(targets ${targets} SalomeIDLSPADDER) + SET(targets ${targets} MeshJobManagerEngine) SET(targets ${targets} StdMeshersEngine) SET(targets ${targets} VISUEngineImpl) FOREACH(target ${targets}) @@ -2372,7 +2419,6 @@ if __name__ == "__main__": pass pass # -- - from sys import stdout for f in files: if f in ["Makefile.am", "Makefile.am.cmake"]: convertAmFile(the_root, root, dirs, files, f, module) @@ -2381,6 +2427,7 @@ if __name__ == "__main__": pass pass # + from sys import stdout if nok: if nok == 1: msg = "%s file has been converted to cmake"%(nok) diff --git a/salome_adm/unix/config_files/check_hdf5.m4 b/salome_adm/unix/config_files/check_hdf5.m4 index 01f96f50c..9dfb4101e 100644 --- a/salome_adm/unix/config_files/check_hdf5.m4 +++ b/salome_adm/unix/config_files/check_hdf5.m4 @@ -35,6 +35,7 @@ AC_ARG_WITH(hdf5, AC_SUBST(HDF5_INCLUDES) AC_SUBST(HDF5_LIBS) AC_SUBST(HDF5_MT_LIBS) +AC_SUBST(HDF5HOME) HDF5_INCLUDES="" HDF5_LIBS="" diff --git a/src/Basics/Basics_Utils.cxx b/src/Basics/Basics_Utils.cxx index eacda61be..8c19e413d 100644 --- a/src/Basics/Basics_Utils.cxx +++ b/src/Basics/Basics_Utils.cxx @@ -21,6 +21,7 @@ // Autor : Alexander A. BORODIN // Module : SALOME // + #include "Basics_Utils.hxx" #include #include @@ -29,10 +30,9 @@ #include #include #include -#else -#include #endif + namespace Kernel_Utils { std::string GetHostname() diff --git a/src/Basics/Basics_Utils.hxx b/src/Basics/Basics_Utils.hxx index 507217dbe..97e6a51f8 100644 --- a/src/Basics/Basics_Utils.hxx +++ b/src/Basics/Basics_Utils.hxx @@ -26,13 +26,15 @@ #define _Basics_UTILS_HXX_ #include "SALOME_Basics.hxx" - #include #include + #ifndef WIN32 #include #else -#include +#include +#include +#pragma comment(lib,"winmm.lib") #endif @@ -68,7 +70,7 @@ namespace Kernel_Utils // Helper macro for time analysis // ============================================================= // - +#ifndef WIN32 #define START_TIMING(name) static long name##tcount=0;static long name##cumul;long name##tt0; timeval name##tv; gettimeofday(&name##tv,0); \ name##tt0=name##tv.tv_usec+name##tv.tv_sec*1000000; \ if(name##tcount==0)std::cerr<<__FILE__<<":"<<__LINE__<<":"<<#name< #include "Container_init_python.hxx" diff --git a/src/Container/Container_init_python.hxx b/src/Container/Container_init_python.hxx index 783a7fcf9..4dc515f56 100644 --- a/src/Container/Container_init_python.hxx +++ b/src/Container/Container_init_python.hxx @@ -33,6 +33,10 @@ #include #include // must be before Python.h ! + +#ifdef _XOPEN_SOURCE +#undef _XOPEN_SOURCE +#endif #include diff --git a/src/DSC/DSC_User/Datastream/Calcium/Calcium.c b/src/DSC/DSC_User/Datastream/Calcium/Calcium.c deleted file mode 100644 index 2fba4fddf..000000000 --- a/src/DSC/DSC_User/Datastream/Calcium/Calcium.c +++ /dev/null @@ -1,357 +0,0 @@ -// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 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 -// - -// File : Calcium.c -// Author : Eric Fayolle (EDF) -// Module : KERNEL -// -#include "calcium.h" -#include "calciumf.h" -#include "CalciumFortranInt.h" -#include -#include -#include -#include - -// Interface C de SalomeCalcium - -typedef int InfoType; -typedef char bool; - -//TODO: ajouter les prototypes pour eviter les pbs de passage par valeur -InfoType ecp_fint_ (void * component, char* nomVar, float t); -InfoType ecp_fini_ (void * component, char* nomVar, int i); -InfoType ecp_efft_ (void * component, char* nomVar, float t); -InfoType ecp_effi_ (void * component, char* nomVar, int i); - -/************************************/ -/* INTERFACES DE LECTURE EN 0 COPIE */ -/************************************/ - -/* Definition des méthodes calcium étendues en 0 copie */ -/* Le buffer est alloué par le port pas par l'utilisateur */ -/* Remarquer le type ** de data */ -/* L'utilisateur devra appeler ecp_..._free pour désallouer le buffer interne */ -/* Attention en cas de lectures multiples : le buffer retourné est le même */ -/* Attention si les niveaux sont actifs le buffer peut être supprimé automatiquement par calcium. */ - -#define CALCIUM_EXT_LECT_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \ - InfoType ecp_##_name (void * component, int mode, \ - _timeType * ti, _timeType * tf, int * i, \ - char * nomvar, int bufferLength, \ - int * nRead, _type _qual ** data ) { \ - size_t _nRead; \ - long _i=*i; \ - fflush(stdout); \ - fflush(stderr); \ - \ - InfoType info = ecp_lecture_##_typeName (component, mode, ti, tf, &_i, \ - nomvar, bufferLength, &_nRead, \ - data ); \ - /* std::cout << "-------- CalciumInterface(C Part), Valeur de data : " << std::endl; */ \ - /* std::cout << "Ptr :" << *data << std::endl; */ \ - /* for (int j=0; j<_nRead;++j) */ \ - /* printf("--- Valeur de data[%d] : %d \n",j,(*data)[j]); */ \ - /* std::cout << "Ptr :" << *data << std::endl; */ \ - /* */ \ - /* std::cerr << "-------- CalciumInterface(C Part) MARK 2 ------------------" << std::endl; */ \ - if(mode == CP_SEQUENTIEL) \ - *i = _i; \ - *nRead=_nRead; \ - /* std::cerr << "-------- CalciumInterface(C Part) MARK 3 ------------------" << std::endl; */ \ - \ - return info; \ - }; \ - void ecp_##_name##_free ( _type _qual * data) { \ - ecp_lecture_##_typeName##_free(data); \ - }; - - -/* L'interface de cette routine diffère de celle obtenue par la macro : - CALCIUM_LECT_INTERFACE_C_. - Le paramètre supplémentaire strSize indique la taille fixe et identique - des chaînes stockées dans data (les ports CALCIUM n'en n'ont pas besoin) -*/ -InfoType ecp_lch(void * component, int mode, float * ti, float * tf, int * i, - char * nomvar, int bufferLength, int * nRead, - char *** data, int strSize) { - - size_t _nRead; - long _i=*i; - fflush(stdout);fflush(stderr); - - InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i, - nomvar, bufferLength, &_nRead, - data);/*, strSize ); - strSize est inutile pour les ports CALCIUM - qui gèrent des tailles quelconques de chaines. */ - if(mode == CP_SEQUENTIEL) - *i = _i; - *nRead=_nRead; - fflush(stdout);fflush(stderr); - return info; -}; - -void ecp_lch_free (char* * data) { \ - ecp_lecture_str_free(data); \ -}; - - -#define STAR * -/*REVERIFIER MAINTENANT 0 COPY avec int2integer*/ -CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int2integer,); -CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,); -CALCIUM_EXT_LECT_INTERFACE_C_(ldb,double,double,double,); -CALCIUM_EXT_LECT_INTERFACE_C_(llo,float,int,bool,); -CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,); -/* CALCIUM_EXT_LECT_INTERFACE_C_(lch,float,char,STAR[]); */ - - -/**************************************/ -/* INTERFACES DE LECTURE AVEC RECOPIE */ -/**************************************/ - -#define CALCIUM_LECT_INTERFACE_C_(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \ - _calInt cp_##_name (void * component, _calInt mode, \ - _timeType * ti, _timeType * tf, _calInt * i, \ - char * nomvar, _calInt bufferLength, \ - _calInt * nRead, _type _qual * data \ - lastarg ) { \ - \ - int _mode = (int) mode; \ - size_t _bufferLength = bufferLength; \ - size_t _nRead; \ - long _i =*i; \ - fflush(stdout); \ - fflush(stderr); \ - \ - if ( (data == NULL) || (_bufferLength < 1) ) return CPNTNULL; \ - \ - _calInt info = ecp_lecture_##_typeName (component, _mode, ti, tf, &_i, \ - nomvar, _bufferLength, &_nRead, \ - &data ); \ - if(mode == CP_SEQUENTIEL) \ - *i = _i; \ - *nRead=_nRead; \ - fflush(stdout); \ - fflush(stderr); \ - \ - return info; \ - }; \ - void cp_##_name##_free ( _type _qual * data) { \ - ecp_lecture_##_typeName##_free(data); \ - }; - - -/* L'interface de cette routine diffère de celle obtenue par la macro : - CALCIUM_LECT_INTERFACE_C_. - Le paramètre supplémentaire strSize indique la taille fixe et identique - des chaînes stockées dans data (les ports CALCIUM n'en n'ont pas besoin) -*/ - -/* InfoType cp_lch(void * component, int mode, float * ti, float * tf, int * i, */ -/* char * nomvar, int bufferLength, int * nRead, */ -/* char ** data, int strSize) { */ - -/* size_t _nRead; */ -/* long _i=*i; */ -/* fflush(stdout);fflush(stderr); */ -/* fprintf(stderr,"Beginning of cp_lch: %s %d %f\n",nomvar,*i,*ti); */ -/* if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; */ -/* InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i, */ -/* nomvar, bufferLength, &_nRead, */ -/* &data);*/ -/*, strSize ); */ -/* strSize est inutile pour les ports CALCIUM */ -/* qui gèrent des tailles quelconques de chaines. */ -/* if(mode == CP_SEQUENTIEL) */ -/* *i = _i; */ -/* *nRead=_nRead; */ -/* fprintf(stderr,"End of cp_lch: %s %d \n",nomvar,*i); */ -/* fflush(stdout);fflush(stderr); */ -/* return info; */ -/* }; */ - - -/* Definition des méthodes calcium standard */ -/* CALCIUM_LECT_INTERFACE_C_( , , , - , , ,)*/ - -CALCIUM_LECT_INTERFACE_C_(len,float ,int,int ,int2integer,,); -/*llg ne fonctionnera pas toujours correctement (port calcium_integer) si sizeof(long) == 64 bits && cal_int==int (32 bits) - sinon problème de conversion de 64bits vers 32bits */ -CALCIUM_LECT_INTERFACE_C_(llg,float ,int,long ,long2integer,,); - -CALCIUM_LECT_INTERFACE_C_(lln,float ,int,long ,long,,); - -CALCIUM_LECT_INTERFACE_C_(lre,float ,int,float ,float,,); -CALCIUM_LECT_INTERFACE_C_(ldb,double,int,double ,double,,); -CALCIUM_LECT_INTERFACE_C_(llo,float ,int,int ,bool,,); -CALCIUM_LECT_INTERFACE_C_(lcp,float ,int,float ,cplx,,); -#define STAR * -#define LCH_LAST_PARAM ,int strsize -CALCIUM_LECT_INTERFACE_C_(lch,float ,int,char ,str,STAR, LCH_LAST_PARAM ); - - -/* Definition des méthodes calcium destinées à l'interfaçage fortran - avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */ - -CALCIUM_LECT_INTERFACE_C_(len_fort_,float ,cal_int,cal_int ,integer,,); -CALCIUM_LECT_INTERFACE_C_(lin_fort_,float ,cal_int,int ,int2integer,,); -/*llg_fort_ ne fonctionnera pas toujours correctement (port calcium_integer) si sizeof(long) == 64 bits && cal_int==int (32 bits) - sinon problème de conversion de 64bits vers 32bits */ -CALCIUM_LECT_INTERFACE_C_(llg_fort_,float ,cal_int,long ,long2integer,,); - -CALCIUM_LECT_INTERFACE_C_(lre_fort_,float ,cal_int,float ,float,,); -CALCIUM_LECT_INTERFACE_C_(ldb_fort_,double,cal_int,double ,double,,); -CALCIUM_LECT_INTERFACE_C_(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ -CALCIUM_LECT_INTERFACE_C_(lcp_fort_,float ,cal_int,float ,cplx,,); -CALCIUM_LECT_INTERFACE_C_(lch_fort_,float ,cal_int,char ,str,STAR, LCH_LAST_PARAM ); - -CALCIUM_LECT_INTERFACE_C_(lln_fort_,float ,cal_int,long ,long,,); - -/**********************************************/ -/* INTERFACES DE DÉBUT ET DE FIN DE COUPLAGE */ -/**********************************************/ - -InfoType cp_cd (void * component, char * instanceName) { - InfoType info = ecp_cd_(component,instanceName); - return info; -} - -InfoType cp_fin (void * component, int code) { - /* TODO : gérer avec les callbacks des ports DSC */ - - InfoType info = ecp_fin_(component,code); - - return info; -} - - -/***************************/ -/* INTERFACES D'ECRITURE */ -/***************************/ - -#define CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \ - _calInt cp_##_name (void * component, _calInt mode, \ - _timeType t, _calInt i, \ - char * nomvar, _calInt nbelem, \ - _type _qual * data \ - lastarg ) { \ - \ - int _mode = mode; \ - long _i = i; \ - size_t _nbelem = nbelem; \ - _timeType _t = t; \ - fflush(stdout); \ - fflush(stderr); \ - if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; \ - \ - _calInt info = ecp_ecriture_##_typeName (component, _mode, &_t, _i, \ - nomvar, _nbelem, \ - data ); \ - fflush(stdout); \ - fflush(stderr); \ - \ - return info; \ - }; \ - - - - -/* InfoType cp_ech(void * component, int mode, float t, int i, */ -/* char * nomvar, int nbelem, */ -/* char ** data, int strSize) { */ - -/*long _i=i;*/ -/* fflush(stdout);fflush(stderr); */ -/* fprintf(stderr,"Beginning of cp_ech: %s %d %f\n",nomvar,i,t); */ -/* if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; */ - -/* InfoType info = ecp_ecriture_str (component, mode, &t, i, */ -/* nomvar, nbelem, */ -/* data); */ -/*, strSize );*/ -/* fprintf(stderr,"End of cp_ech: %s %d \n",nomvar,i); */ -/* fflush(stdout); */ -/* fflush(stderr); */ - -/* return info; */ -/* }; */ - -/* Definition des méthodes calcium standard */ -/* CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,type,_typeName,_qual) */ -CALCIUM_ECR_INTERFACE_C_(een,float ,int,int ,int2integer,,); -/*elg ne fonctionnera pas toujours correctement (port calcium_integer) si sizeof(long) == 64 bits && cal_int==int (32 bits) - sinon problème de conversion de 64bits vers 32bits */ -CALCIUM_ECR_INTERFACE_C_(elg,float ,int,long ,long2integer,,); -CALCIUM_ECR_INTERFACE_C_(ere,float ,int,float ,float,,); -CALCIUM_ECR_INTERFACE_C_(edb,double,int,double,double,,); -CALCIUM_ECR_INTERFACE_C_(elo,float ,int,int ,bool,,); -CALCIUM_ECR_INTERFACE_C_(ecp,float ,int,float ,cplx,,); -CALCIUM_ECR_INTERFACE_C_(ech,float ,int,char ,str,STAR,LCH_LAST_PARAM ); - -CALCIUM_ECR_INTERFACE_C_(eln,float ,int,long ,long,,); - -/* Definition des méthodes calcium destinées à l'interfaçage fortran - avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */ - -CALCIUM_ECR_INTERFACE_C_(een_fort_,float ,cal_int,cal_int,integer,,); -/*elg_fort_ ne fonctionnera pas toujours correctement (port calcium_integer) si sizeof(long) == 64 bits && cal_int==int (32 bits) - sinon problème de conversion de 64bits vers 32bits */ -CALCIUM_ECR_INTERFACE_C_(elg_fort_,float ,cal_int,long ,long2integer,,); -CALCIUM_ECR_INTERFACE_C_(ein_fort_,float ,cal_int,int ,int2integer,,); -CALCIUM_ECR_INTERFACE_C_(ere_fort_,float ,cal_int,float ,float,,); -CALCIUM_ECR_INTERFACE_C_(edb_fort_,double,cal_int,double,double,,); -CALCIUM_ECR_INTERFACE_C_(elo_fort_,float ,cal_int,int ,bool,,); -CALCIUM_ECR_INTERFACE_C_(ecp_fort_,float ,cal_int,float ,cplx,,); -CALCIUM_ECR_INTERFACE_C_(ech_fort_,float ,cal_int,char ,str,STAR,LCH_LAST_PARAM ); - -CALCIUM_ECR_INTERFACE_C_(eln_fort_,float ,cal_int,long ,long,,); - -/***************************/ -/* Interface for cleaning */ -/***************************/ - -InfoType cp_fini (void * component, char * nomvar, int i) -{ - InfoType info = ecp_fini_(component,nomvar,i); - return info; -} - -InfoType cp_fint (void * component, char * nomvar, float t) -{ - InfoType info = ecp_fint_(component,nomvar,t); - return info; -} - -InfoType cp_effi (void * component, char * nomvar, int i) -{ - InfoType info = ecp_effi_(component,nomvar,i); - return info; -} - -InfoType cp_efft (void * component, char * nomvar, float t) -{ - InfoType info = ecp_efft_(component,nomvar,t); - return info; -} diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c b/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c new file mode 100644 index 000000000..2fba4fddf --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c @@ -0,0 +1,357 @@ +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 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 +// + +// File : Calcium.c +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// +#include "calcium.h" +#include "calciumf.h" +#include "CalciumFortranInt.h" +#include +#include +#include +#include + +// Interface C de SalomeCalcium + +typedef int InfoType; +typedef char bool; + +//TODO: ajouter les prototypes pour eviter les pbs de passage par valeur +InfoType ecp_fint_ (void * component, char* nomVar, float t); +InfoType ecp_fini_ (void * component, char* nomVar, int i); +InfoType ecp_efft_ (void * component, char* nomVar, float t); +InfoType ecp_effi_ (void * component, char* nomVar, int i); + +/************************************/ +/* INTERFACES DE LECTURE EN 0 COPIE */ +/************************************/ + +/* Definition des méthodes calcium étendues en 0 copie */ +/* Le buffer est alloué par le port pas par l'utilisateur */ +/* Remarquer le type ** de data */ +/* L'utilisateur devra appeler ecp_..._free pour désallouer le buffer interne */ +/* Attention en cas de lectures multiples : le buffer retourné est le même */ +/* Attention si les niveaux sont actifs le buffer peut être supprimé automatiquement par calcium. */ + +#define CALCIUM_EXT_LECT_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \ + InfoType ecp_##_name (void * component, int mode, \ + _timeType * ti, _timeType * tf, int * i, \ + char * nomvar, int bufferLength, \ + int * nRead, _type _qual ** data ) { \ + size_t _nRead; \ + long _i=*i; \ + fflush(stdout); \ + fflush(stderr); \ + \ + InfoType info = ecp_lecture_##_typeName (component, mode, ti, tf, &_i, \ + nomvar, bufferLength, &_nRead, \ + data ); \ + /* std::cout << "-------- CalciumInterface(C Part), Valeur de data : " << std::endl; */ \ + /* std::cout << "Ptr :" << *data << std::endl; */ \ + /* for (int j=0; j<_nRead;++j) */ \ + /* printf("--- Valeur de data[%d] : %d \n",j,(*data)[j]); */ \ + /* std::cout << "Ptr :" << *data << std::endl; */ \ + /* */ \ + /* std::cerr << "-------- CalciumInterface(C Part) MARK 2 ------------------" << std::endl; */ \ + if(mode == CP_SEQUENTIEL) \ + *i = _i; \ + *nRead=_nRead; \ + /* std::cerr << "-------- CalciumInterface(C Part) MARK 3 ------------------" << std::endl; */ \ + \ + return info; \ + }; \ + void ecp_##_name##_free ( _type _qual * data) { \ + ecp_lecture_##_typeName##_free(data); \ + }; + + +/* L'interface de cette routine diffère de celle obtenue par la macro : + CALCIUM_LECT_INTERFACE_C_. + Le paramètre supplémentaire strSize indique la taille fixe et identique + des chaînes stockées dans data (les ports CALCIUM n'en n'ont pas besoin) +*/ +InfoType ecp_lch(void * component, int mode, float * ti, float * tf, int * i, + char * nomvar, int bufferLength, int * nRead, + char *** data, int strSize) { + + size_t _nRead; + long _i=*i; + fflush(stdout);fflush(stderr); + + InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i, + nomvar, bufferLength, &_nRead, + data);/*, strSize ); + strSize est inutile pour les ports CALCIUM + qui gèrent des tailles quelconques de chaines. */ + if(mode == CP_SEQUENTIEL) + *i = _i; + *nRead=_nRead; + fflush(stdout);fflush(stderr); + return info; +}; + +void ecp_lch_free (char* * data) { \ + ecp_lecture_str_free(data); \ +}; + + +#define STAR * +/*REVERIFIER MAINTENANT 0 COPY avec int2integer*/ +CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int2integer,); +CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,); +CALCIUM_EXT_LECT_INTERFACE_C_(ldb,double,double,double,); +CALCIUM_EXT_LECT_INTERFACE_C_(llo,float,int,bool,); +CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,); +/* CALCIUM_EXT_LECT_INTERFACE_C_(lch,float,char,STAR[]); */ + + +/**************************************/ +/* INTERFACES DE LECTURE AVEC RECOPIE */ +/**************************************/ + +#define CALCIUM_LECT_INTERFACE_C_(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \ + _calInt cp_##_name (void * component, _calInt mode, \ + _timeType * ti, _timeType * tf, _calInt * i, \ + char * nomvar, _calInt bufferLength, \ + _calInt * nRead, _type _qual * data \ + lastarg ) { \ + \ + int _mode = (int) mode; \ + size_t _bufferLength = bufferLength; \ + size_t _nRead; \ + long _i =*i; \ + fflush(stdout); \ + fflush(stderr); \ + \ + if ( (data == NULL) || (_bufferLength < 1) ) return CPNTNULL; \ + \ + _calInt info = ecp_lecture_##_typeName (component, _mode, ti, tf, &_i, \ + nomvar, _bufferLength, &_nRead, \ + &data ); \ + if(mode == CP_SEQUENTIEL) \ + *i = _i; \ + *nRead=_nRead; \ + fflush(stdout); \ + fflush(stderr); \ + \ + return info; \ + }; \ + void cp_##_name##_free ( _type _qual * data) { \ + ecp_lecture_##_typeName##_free(data); \ + }; + + +/* L'interface de cette routine diffère de celle obtenue par la macro : + CALCIUM_LECT_INTERFACE_C_. + Le paramètre supplémentaire strSize indique la taille fixe et identique + des chaînes stockées dans data (les ports CALCIUM n'en n'ont pas besoin) +*/ + +/* InfoType cp_lch(void * component, int mode, float * ti, float * tf, int * i, */ +/* char * nomvar, int bufferLength, int * nRead, */ +/* char ** data, int strSize) { */ + +/* size_t _nRead; */ +/* long _i=*i; */ +/* fflush(stdout);fflush(stderr); */ +/* fprintf(stderr,"Beginning of cp_lch: %s %d %f\n",nomvar,*i,*ti); */ +/* if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; */ +/* InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i, */ +/* nomvar, bufferLength, &_nRead, */ +/* &data);*/ +/*, strSize ); */ +/* strSize est inutile pour les ports CALCIUM */ +/* qui gèrent des tailles quelconques de chaines. */ +/* if(mode == CP_SEQUENTIEL) */ +/* *i = _i; */ +/* *nRead=_nRead; */ +/* fprintf(stderr,"End of cp_lch: %s %d \n",nomvar,*i); */ +/* fflush(stdout);fflush(stderr); */ +/* return info; */ +/* }; */ + + +/* Definition des méthodes calcium standard */ +/* CALCIUM_LECT_INTERFACE_C_( , , , + , , ,)*/ + +CALCIUM_LECT_INTERFACE_C_(len,float ,int,int ,int2integer,,); +/*llg ne fonctionnera pas toujours correctement (port calcium_integer) si sizeof(long) == 64 bits && cal_int==int (32 bits) + sinon problème de conversion de 64bits vers 32bits */ +CALCIUM_LECT_INTERFACE_C_(llg,float ,int,long ,long2integer,,); + +CALCIUM_LECT_INTERFACE_C_(lln,float ,int,long ,long,,); + +CALCIUM_LECT_INTERFACE_C_(lre,float ,int,float ,float,,); +CALCIUM_LECT_INTERFACE_C_(ldb,double,int,double ,double,,); +CALCIUM_LECT_INTERFACE_C_(llo,float ,int,int ,bool,,); +CALCIUM_LECT_INTERFACE_C_(lcp,float ,int,float ,cplx,,); +#define STAR * +#define LCH_LAST_PARAM ,int strsize +CALCIUM_LECT_INTERFACE_C_(lch,float ,int,char ,str,STAR, LCH_LAST_PARAM ); + + +/* Definition des méthodes calcium destinées à l'interfaçage fortran + avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */ + +CALCIUM_LECT_INTERFACE_C_(len_fort_,float ,cal_int,cal_int ,integer,,); +CALCIUM_LECT_INTERFACE_C_(lin_fort_,float ,cal_int,int ,int2integer,,); +/*llg_fort_ ne fonctionnera pas toujours correctement (port calcium_integer) si sizeof(long) == 64 bits && cal_int==int (32 bits) + sinon problème de conversion de 64bits vers 32bits */ +CALCIUM_LECT_INTERFACE_C_(llg_fort_,float ,cal_int,long ,long2integer,,); + +CALCIUM_LECT_INTERFACE_C_(lre_fort_,float ,cal_int,float ,float,,); +CALCIUM_LECT_INTERFACE_C_(ldb_fort_,double,cal_int,double ,double,,); +CALCIUM_LECT_INTERFACE_C_(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ +CALCIUM_LECT_INTERFACE_C_(lcp_fort_,float ,cal_int,float ,cplx,,); +CALCIUM_LECT_INTERFACE_C_(lch_fort_,float ,cal_int,char ,str,STAR, LCH_LAST_PARAM ); + +CALCIUM_LECT_INTERFACE_C_(lln_fort_,float ,cal_int,long ,long,,); + +/**********************************************/ +/* INTERFACES DE DÉBUT ET DE FIN DE COUPLAGE */ +/**********************************************/ + +InfoType cp_cd (void * component, char * instanceName) { + InfoType info = ecp_cd_(component,instanceName); + return info; +} + +InfoType cp_fin (void * component, int code) { + /* TODO : gérer avec les callbacks des ports DSC */ + + InfoType info = ecp_fin_(component,code); + + return info; +} + + +/***************************/ +/* INTERFACES D'ECRITURE */ +/***************************/ + +#define CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \ + _calInt cp_##_name (void * component, _calInt mode, \ + _timeType t, _calInt i, \ + char * nomvar, _calInt nbelem, \ + _type _qual * data \ + lastarg ) { \ + \ + int _mode = mode; \ + long _i = i; \ + size_t _nbelem = nbelem; \ + _timeType _t = t; \ + fflush(stdout); \ + fflush(stderr); \ + if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; \ + \ + _calInt info = ecp_ecriture_##_typeName (component, _mode, &_t, _i, \ + nomvar, _nbelem, \ + data ); \ + fflush(stdout); \ + fflush(stderr); \ + \ + return info; \ + }; \ + + + + +/* InfoType cp_ech(void * component, int mode, float t, int i, */ +/* char * nomvar, int nbelem, */ +/* char ** data, int strSize) { */ + +/*long _i=i;*/ +/* fflush(stdout);fflush(stderr); */ +/* fprintf(stderr,"Beginning of cp_ech: %s %d %f\n",nomvar,i,t); */ +/* if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; */ + +/* InfoType info = ecp_ecriture_str (component, mode, &t, i, */ +/* nomvar, nbelem, */ +/* data); */ +/*, strSize );*/ +/* fprintf(stderr,"End of cp_ech: %s %d \n",nomvar,i); */ +/* fflush(stdout); */ +/* fflush(stderr); */ + +/* return info; */ +/* }; */ + +/* Definition des méthodes calcium standard */ +/* CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,type,_typeName,_qual) */ +CALCIUM_ECR_INTERFACE_C_(een,float ,int,int ,int2integer,,); +/*elg ne fonctionnera pas toujours correctement (port calcium_integer) si sizeof(long) == 64 bits && cal_int==int (32 bits) + sinon problème de conversion de 64bits vers 32bits */ +CALCIUM_ECR_INTERFACE_C_(elg,float ,int,long ,long2integer,,); +CALCIUM_ECR_INTERFACE_C_(ere,float ,int,float ,float,,); +CALCIUM_ECR_INTERFACE_C_(edb,double,int,double,double,,); +CALCIUM_ECR_INTERFACE_C_(elo,float ,int,int ,bool,,); +CALCIUM_ECR_INTERFACE_C_(ecp,float ,int,float ,cplx,,); +CALCIUM_ECR_INTERFACE_C_(ech,float ,int,char ,str,STAR,LCH_LAST_PARAM ); + +CALCIUM_ECR_INTERFACE_C_(eln,float ,int,long ,long,,); + +/* Definition des méthodes calcium destinées à l'interfaçage fortran + avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */ + +CALCIUM_ECR_INTERFACE_C_(een_fort_,float ,cal_int,cal_int,integer,,); +/*elg_fort_ ne fonctionnera pas toujours correctement (port calcium_integer) si sizeof(long) == 64 bits && cal_int==int (32 bits) + sinon problème de conversion de 64bits vers 32bits */ +CALCIUM_ECR_INTERFACE_C_(elg_fort_,float ,cal_int,long ,long2integer,,); +CALCIUM_ECR_INTERFACE_C_(ein_fort_,float ,cal_int,int ,int2integer,,); +CALCIUM_ECR_INTERFACE_C_(ere_fort_,float ,cal_int,float ,float,,); +CALCIUM_ECR_INTERFACE_C_(edb_fort_,double,cal_int,double,double,,); +CALCIUM_ECR_INTERFACE_C_(elo_fort_,float ,cal_int,int ,bool,,); +CALCIUM_ECR_INTERFACE_C_(ecp_fort_,float ,cal_int,float ,cplx,,); +CALCIUM_ECR_INTERFACE_C_(ech_fort_,float ,cal_int,char ,str,STAR,LCH_LAST_PARAM ); + +CALCIUM_ECR_INTERFACE_C_(eln_fort_,float ,cal_int,long ,long,,); + +/***************************/ +/* Interface for cleaning */ +/***************************/ + +InfoType cp_fini (void * component, char * nomvar, int i) +{ + InfoType info = ecp_fini_(component,nomvar,i); + return info; +} + +InfoType cp_fint (void * component, char * nomvar, float t) +{ + InfoType info = ecp_fint_(component,nomvar,t); + return info; +} + +InfoType cp_effi (void * component, char * nomvar, int i) +{ + InfoType info = ecp_effi_(component,nomvar,i); + return info; +} + +InfoType cp_efft (void * component, char * nomvar, float t) +{ + InfoType info = ecp_efft_(component,nomvar,t); + return info; +} diff --git a/src/DSC/DSC_User/Datastream/Calcium/Makefile.am b/src/DSC/DSC_User/Datastream/Calcium/Makefile.am index 5df23c0b8..76f7779d9 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/Makefile.am +++ b/src/DSC/DSC_User/Datastream/Calcium/Makefile.am @@ -124,7 +124,7 @@ libSalomeCalcium_la_LDFLAGS = -no-undefined -version-info=0:0:0 AM_CFLAGS = -fexceptions lib_LTLIBRARIES = libCalciumC.la -libCalciumC_la_SOURCES = Calcium.c Calcium.cxx calciumf.c +libCalciumC_la_SOURCES = CalciumC.c Calcium.cxx calciumf.c libCalciumC_la_CXXFLAGS = $(COMMON_CPPFLAGS) # diff --git a/src/KERNEL_PY/kernel/Makefile.am b/src/KERNEL_PY/kernel/Makefile.am index 91c7852c7..a817b7ea2 100644 --- a/src/KERNEL_PY/kernel/Makefile.am +++ b/src/KERNEL_PY/kernel/Makefile.am @@ -28,7 +28,6 @@ mypkgpython_PYTHON = \ deprecation.py \ logger.py \ termcolor.py \ - logconfig.py \ unittester.py \ pyunittester.py \ enumerate.py \ @@ -36,7 +35,11 @@ mypkgpython_PYTHON = \ datamodeler.py \ testdata.py \ diclookup.py \ - threadhelper.py + threadhelper.py \ + syshelper.py + +nodist_mypkgpython_PYTHON = \ + logconfig.py # This set of modules required a running SALOME application. mypkgpython_PYTHON += \ diff --git a/src/KERNEL_PY/kernel/deprecation.py b/src/KERNEL_PY/kernel/deprecation.py index 9d53be0e2..c571d0812 100644 --- a/src/KERNEL_PY/kernel/deprecation.py +++ b/src/KERNEL_PY/kernel/deprecation.py @@ -21,6 +21,16 @@ """ This module provides several functions to indicate the deprecation of a module, a method or a function. + +Example:: + + from salome.kernel.deprecation import deprecated + + @deprecated("Deprecated since version 6.3.0. Consider replacement with " + "newFunction()") + def oldFunction(): + ... + """ import sys @@ -112,4 +122,8 @@ def __show_colored_warning(message, category, filename, else: file.write(str) +# Enable warnings for deprecated functions and modules (in Python 2.7, they +# are disabled by default) +warnings.filterwarnings("always", "Call to *", DeprecationWarning) +warnings.filterwarnings("always", "Importation of *", DeprecationWarning) warnings.showwarning = __show_colored_warning diff --git a/src/KERNEL_PY/kernel/kernelpy_autotest.sh.in b/src/KERNEL_PY/kernel/kernelpy_autotest.sh.in index 2608dbb95..1c169192b 100644 --- a/src/KERNEL_PY/kernel/kernelpy_autotest.sh.in +++ b/src/KERNEL_PY/kernel/kernelpy_autotest.sh.in @@ -41,7 +41,8 @@ listfiles="\ datamodeler.py \ testdata.py \ diclookup.py \ - pyunittester.py \ + syshelper.py \ + pyunittester.py \ __init__.py" # This files should be add to the list @@ -71,7 +72,7 @@ cd $MODULE_PYTHON_DIR for file in $listfiles; do # Uncomment this line (and comment the next one) to display # the start line of a test and not only the result: - #python $file | grep '^\[TEST' + #python $package_path/$file | grep '^\[TEST' python $package_path/$file | grep '^\[TEST' | grep -v 'test in progress' done cd $here diff --git a/src/KERNEL_PY/kernel/services.py b/src/KERNEL_PY/kernel/services.py index 032242bf6..8ccc81335 100644 --- a/src/KERNEL_PY/kernel/services.py +++ b/src/KERNEL_PY/kernel/services.py @@ -36,7 +36,7 @@ import salome if salome.lcc is None: try: salome.salome_init() - except RuntimeError, e: + except Exception, e: print e # Note that the salome module provides you with standard SALOME diff --git a/src/KERNEL_PY/kernel/studyedit.py b/src/KERNEL_PY/kernel/studyedit.py index f31c6ede6..8d7c1a3ab 100644 --- a/src/KERNEL_PY/kernel/studyedit.py +++ b/src/KERNEL_PY/kernel/studyedit.py @@ -40,9 +40,13 @@ def getActiveStudyId(): ``salome.myStudyId`` variable. """ salome.salome_init() - # _GBO_WARN: note that salome.getActiveStudy() returns an id. It - # should return the study or be renammed in getActiveStudyId. - return salome.getActiveStudy() + # Warning: we don't use salome.getActiveStudy() here because it doesn't + # work properly when called from Salome modules (multi-study interpreter + # issue) + if salome.hasDesktop(): + return salome.sg.getActiveStudyId() + else: + return salome.myStudyId def getActiveStudy(): return salome.myStudyManager.GetStudyByID(getActiveStudyId()) diff --git a/src/KERNEL_PY/kernel/syshelper.py b/src/KERNEL_PY/kernel/syshelper.py new file mode 100644 index 000000000..dbc92c3ae --- /dev/null +++ b/src/KERNEL_PY/kernel/syshelper.py @@ -0,0 +1,114 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 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 +# + +__author__="gboulant" +__date__ ="$21 mai 2010 18:00:23$" + + +def findFiles(rootpath, excludes=[]): + """ + This looks after files recursively from the specified rootpath, + but without visiting directories whose basename is in the list + @param excludes. + """ + if not os.path.exists(rootpath): + raise RuntimeError("the path %s does not exists"%rootpath) + + exclude_options="" + for excludepath in excludes: + exclude_options+="-e %s "%excludepath + + listfiles=[] + stream=os.popen("find %s -type f | grep -v -e '\.svn' %s 2>/dev/null"%(rootpath,exclude_options)) + for line in stream.readlines(): + listfiles.append(line.split('\n')[0]) + + return listfiles + +import sys +from stat import ST_MODE, S_ISDIR, S_ISREG +def walktree(rootpath, callback, **kwargs): + ''' + This recursively descends the directory tree rooted at rootpath, + calling the callback function for each regular file + ''' + for f in os.listdir(rootpath): + pathname = os.path.join(rootpath, f) + try: + mode = os.stat(pathname)[ST_MODE] + except OSError, e: + # It probably means that the file is a broken inode + mode = -1 + if S_ISDIR(mode): + # It's a directory, recurse into it + walktree(pathname, callback, **kwargs) + elif S_ISREG(mode): + # It's a file, call the callback function + callback(pathname, **kwargs) + else: + # Unknown file type, print a message + print 'Skipping %s' % pathname + + +# +# ============================================================= +# Use cases and unit test functions +# ============================================================= +# +import os +try: + TESTDOCDIR=os.path.join(os.environ["KERNEL_ROOT_DIR"],"share") +except KeyError: + TESTDOCDIR="/tmp" + +def TEST_findFiles(): + print "########## find 1" + rootpath=TESTDOCDIR + listfiles=findFiles(rootpath) + for filename in listfiles: + print filename + + print "########## find 2" + excludes=[os.path.join(TESTDOCDIR,"doc")] + listfiles=findFiles(rootpath,excludes) + for filename in listfiles: + print filename + + return True + +# This is the test callback function +def visitfile_withargs(file, rootid): + print 'visiting file %s (rootid=%s)'%(file,str(rootid)) + +def visitfile_withoutargs(file): + print 'visiting file %s'%(file) + +def TEST_walktree(): + #walktree(TESTDOCDIR, visitfile_withargs, rootid=2) + walktree(TESTDOCDIR, visitfile_withoutargs) + return True + +if __name__ == "__main__": + import unittester + unittester.run("syshelper", "TEST_findFiles") + unittester.run("syshelper", "TEST_walktree") diff --git a/src/KernelHelpers/KernelHelpers.hxx b/src/KernelHelpers/KernelHelpers.hxx new file mode 100755 index 000000000..2871196d5 --- /dev/null +++ b/src/KernelHelpers/KernelHelpers.hxx @@ -0,0 +1,39 @@ +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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 +// + +// File : SALOME_Basics.hxx +// Author : Roman NIKOLAEV +// Module : SALOME +// $Header$ +// +#ifndef _SALOME_KERNEL_HELPERS_HXX_ +#define _SALOME_KERNEL_HELPERS_HXX_ + + +#ifdef WIN32 +# if defined KERNELHELPERS_EXPORTS || defined SalomeKernelHelpers_EXPORTS +# define KERNELHELPERS_EXPORT __declspec( dllexport ) +# else +# define KERNELHELPERS_EXPORT __declspec( dllimport ) +# endif +#else +# define KERNELHELPERS_EXPORT +#endif + +#endif //_SALOME_KERNEL_HELPERS_HXX_ diff --git a/src/KernelHelpers/KernelHelpersUseCases.cxx b/src/KernelHelpers/KernelHelpersUseCases.cxx new file mode 100644 index 000000000..4c986cb74 --- /dev/null +++ b/src/KernelHelpers/KernelHelpersUseCases.cxx @@ -0,0 +1,120 @@ +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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 +// +// Author: Guillaume Boulant (EDF/R&D) + +#include "SALOME_KernelServices.hxx" +#include "Basics_Utils.hxx" + +#include +#include CORBA_CLIENT_HEADER(SALOME_TestComponent) + +bool TEST_corba() { + CORBA::ORB_var orb = KERNEL::getORB(); + if ( CORBA::is_nil(orb) ) { + LOG("TEST_Corba: orb ERROR"); + return false; + } + SALOME_NamingService * ns = KERNEL::getNamingService(); + if ( ns == NULL ) { + LOG("TEST_Corba: ns ERROR"); + return false; + + } + SALOME_LifeCycleCORBA * lcc = KERNEL::getLifeCycleCORBA(); + if ( lcc == NULL ) { + LOG("TEST_Corba: lcc ERROR"); + return false; + } + LOG("TEST_Corba: OK"); + return true; +} + +#include +bool TEST_getLifeCycleCORBA() { + Engines::EngineComponent_var component = + KERNEL::getLifeCycleCORBA()->FindOrLoad_Component( "FactoryServer","SalomeTestComponent" ); + + Engines::TestComponent_var engine = Engines::TestComponent::_narrow(component); + char * coucou_res = engine->Coucou(123.); + const char * coucou_ref = "L = 123"; + LOG(coucou_res); + if ( strcmp(coucou_res, coucou_ref) == 0 ) { + return false; + } + return true; +} + +bool TEST_getStudyManager() { + SALOMEDS::Study_ptr myTestStudy = KERNEL::getStudyManager()->NewStudy("kerneltest"); + if ( CORBA::is_nil(myTestStudy) ) { + return false; + } + + // One can use the study to store some general properties + myTestStudy->SetString("material","wood"); + myTestStudy->SetReal("volume",3.23); + + // The study is characterized by an ID + int myTestStudyId = myTestStudy->StudyId(); + LOG("TestComponentImpl::testkernel: study id = "<getPID(); + LOG("["< #include CORBA_CLIENT_HEADER(SALOMEDS) #include CORBA_SERVER_HEADER(SALOME_Component) #include -class SALOME_StudyEditor { +class KERNELHELPERS_EXPORT SALOME_StudyEditor { public: SALOME_StudyEditor(int studyId); diff --git a/src/KernelHelpers/Test/KernelHelpersUnitTests.cxx b/src/KernelHelpers/Test/KernelHelpersUnitTests.cxx new file mode 100644 index 000000000..165008e89 --- /dev/null +++ b/src/KernelHelpers/Test/KernelHelpersUnitTests.cxx @@ -0,0 +1,112 @@ +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 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 +// + +#include "KernelHelpersUnitTests.hxx" + +#include "SALOME_KernelServices.hxx" +#include "Basics_Utils.hxx" + +#include +#include CORBA_CLIENT_HEADER(SALOME_TestComponent) + +// ============================================================================ +/*! + * Set up the environment + */ +// ============================================================================ + +void KernelHelpersUnitTests::setUp() +{ +} + +// ============================================================================ +/*! + * - delete + */ +// ============================================================================ + +void KernelHelpersUnitTests::tearDown() +{ +} + +// ============================================================================ +/*! + * Check SalomeApp functionality + */ +// ============================================================================ +void KernelHelpersUnitTests::TEST_corba() +{ + CORBA::ORB_var orb = KERNEL::getORB(); + CPPUNIT_ASSERT(!CORBA::is_nil(orb)); + + + SALOME_NamingService * ns = KERNEL::getNamingService(); + CPPUNIT_ASSERT(ns!=NULL); + + SALOME_LifeCycleCORBA * lcc = KERNEL::getLifeCycleCORBA(); + CPPUNIT_ASSERT(lcc!=NULL); +} + +void KernelHelpersUnitTests::TEST_getLifeCycleCORBA() { + Engines::EngineComponent_var component = + KERNEL::getLifeCycleCORBA()->FindOrLoad_Component( "FactoryServer","SalomeTestComponent" ); + + Engines::TestComponent_var engine = Engines::TestComponent::_narrow(component); + char * coucou_res = engine->Coucou(123.); + const char * coucou_ref = "TestComponent_i : L = 123"; + LOG(coucou_res); + CPPUNIT_ASSERT( strcmp(coucou_res, coucou_ref) == 0 ); +} + +void KernelHelpersUnitTests::TEST_getStudyManager() { + SALOMEDS::Study_ptr myTestStudy = KERNEL::getStudyManager()->NewStudy("kerneltest"); + CPPUNIT_ASSERT(!CORBA::is_nil(myTestStudy)); + + // One can use the study to store some general properties + myTestStudy->SetString("material","wood"); + myTestStudy->SetReal("volume",3.23); + + // The study is characterized by an ID + int myTestStudyId = myTestStudy->StudyId(); + LOG("TestComponentImpl::testkernel: study id = "<getPID(); + LOG("SALOME launcher PID = " << pid); + } + catch (const SALOME::SALOME_Exception & ex) { + LOG("SALOME Exception in createJob !" < + +class KernelHelpersUnitTests : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE( KernelHelpersUnitTests ); + CPPUNIT_TEST( TEST_corba ); + CPPUNIT_TEST( TEST_getLifeCycleCORBA ); + CPPUNIT_TEST( TEST_getStudyManager ); + CPPUNIT_TEST( TEST_getSalomeLauncher ); + CPPUNIT_TEST_SUITE_END(); + +public: + + void setUp(); + void tearDown(); + + void TEST_corba(); + void TEST_getLifeCycleCORBA(); + void TEST_getStudyManager(); + void TEST_getSalomeLauncher(); +}; + +#endif diff --git a/src/KernelHelpers/Test/Makefile.am b/src/KernelHelpers/Test/Makefile.am new file mode 100644 index 000000000..20d3daa93 --- /dev/null +++ b/src/KernelHelpers/Test/Makefile.am @@ -0,0 +1,75 @@ +# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 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 +# + +# Author: Guillaume Boulant (EDF/R&D) + +include $(top_srcdir)/salome_adm/unix/make_common_starter.am + +lib_LTLIBRARIES = libSalomeKernelHelpersTest.la + +salomeinclude_HEADERS = KernelHelpersUnitTests.hxx + +dist_libSalomeKernelHelpersTest_la_SOURCES = KernelHelpersUnitTests.cxx + +OMNIORB_CXXFLAGS=@OMNIORB_CXXFLAGS@ @OMNIORB_INCLUDES@ +OMNIORB_LIBS=@OMNIORB_LIBS@ + +libSalomeKernelHelpersTest_la_CXXFLAGS = \ + @CPPUNIT_INCLUDES@ \ + $(OMNIORB_CXXFLAGS) \ + -I$(top_srcdir)/src/Basics/Test \ + -I$(srcdir)/.. \ + -I$(top_srcdir)/src/NamingService \ + -I$(top_srcdir)/src/SALOMELocalTrace \ + -I$(top_srcdir)/src/Basics \ + -I$(top_srcdir)/src/Utils \ + -I$(top_srcdir)/src/LifeCycleCORBA \ + -I$(top_srcdir)/src/Container \ + -I$(top_srcdir)/src/Notification \ + -I$(top_srcdir)/src/GenericObj \ + -I$(top_builddir)/idl + + +libSalomeKernelHelpersTest_la_LIBADD = \ + @CPPUNIT_LIBS@ \ + ../libSalomeKernelHelpers.la \ + $(OMNIORB_LIBS) \ + $(top_builddir)/src/NamingService/libSalomeNS.la \ + $(top_builddir)/src/SALOMELocalTrace/libSALOMELocalTrace.la \ + $(top_builddir)/src/Basics/libSALOMEBasics.la \ + $(top_builddir)/src/Utils/libOpUtil.la \ + $(top_builddir)/src/LifeCycleCORBA/libSalomeLifeCycleCORBA.la \ + $(top_builddir)/src/Container/libSalomeContainer.la \ + $(top_builddir)/src/Notification/libSalomeNotification.la \ + $(top_builddir)/src/GenericObj/libSalomeGenericObj.la \ + $(top_builddir)/idl/libSalomeIDLKernel.la + + +bin_PROGRAMS = TestKernelHelpers + +TestKernelHelpers_SOURCES = TestKernelHelpers.cxx + +TestKernelHelpers_CXXFLAGS = $(libSalomeKernelHelpersTest_la_CXXFLAGS) +TestKernelHelpers_LDADD = $(libSalomeKernelHelpersTest_la_LIBADD) libSalomeKernelHelpersTest.la + +dist_salomescript_PYTHON = TestKernelHelpers.py +UNIT_TEST_PROG = TestKernelHelpers diff --git a/src/KernelHelpers/Test/TestKernelHelpers.cxx b/src/KernelHelpers/Test/TestKernelHelpers.cxx new file mode 100644 index 000000000..c78729fab --- /dev/null +++ b/src/KernelHelpers/Test/TestKernelHelpers.cxx @@ -0,0 +1,31 @@ +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 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 +// + +#include "KernelHelpersUnitTests.hxx" + +// --- Registers the fixture into the 'registry' + +CPPUNIT_TEST_SUITE_REGISTRATION( KernelHelpersUnitTests ); + +// --- generic Main program from Basic/Test + +#include "BasicMainTest.hxx" diff --git a/src/KernelHelpers/Test/TestKernelHelpers.py b/src/KernelHelpers/Test/TestKernelHelpers.py new file mode 100644 index 000000000..b2f559ecf --- /dev/null +++ b/src/KernelHelpers/Test/TestKernelHelpers.py @@ -0,0 +1,51 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 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 +# + +import sys, os,signal,string,commands +import runSalome +import orbmodule +import TestKiller + +# get SALOME environment : + +args, modules_list, modules_root_dir = runSalome.get_config() +runSalome.set_env(args, modules_list, modules_root_dir) + +# launch CORBA naming server + +clt=orbmodule.client() + +# launch CORBA logger server + +myServer=runSalome.LoggerServer(args) +myServer.run() +clt.waitLogger("Logger") + +# execute Unit Test + +command = ['TestKernelHelpers'] +ret = os.spawnvp(os.P_WAIT, command[0], command) + +# kill Test process + +TestKiller.killProcess(runSalome.process_id) diff --git a/src/KernelHelpers/TestKernelHelpers.cxx b/src/KernelHelpers/TestKernelHelpers.cxx deleted file mode 100644 index 53173419e..000000000 --- a/src/KernelHelpers/TestKernelHelpers.cxx +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE -// -// 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 -// -// Author: Guillaume Boulant (EDF/R&D) - -#include "SALOME_KernelServices.hxx" -#include "Basics_Utils.hxx" - -#include -#include CORBA_CLIENT_HEADER(SALOME_TestComponent) - -void TEST_corba() { - CORBA::ORB_var orb = KERNEL::getORB(); - SALOME_NamingService * ns = KERNEL::getNamingService(); - SALOME_LifeCycleCORBA * lcc = KERNEL::getLifeCycleCORBA(); -} - -void TEST_getLifeCycleCORBA() { - Engines::EngineComponent_var component = - KERNEL::getLifeCycleCORBA()->FindOrLoad_Component( "FactoryServer","SalomeTestComponent" ); - - Engines::TestComponent_var engine = Engines::TestComponent::_narrow(component); - STDLOG(engine->Coucou(123.)); -} - -// TODO: -// - complete the coverture of the KernelService interface -// - provide use case for the StudyEditor - -int main (int argc, char * argv[]) { - TEST_getLifeCycleCORBA(); - return 0; -} diff --git a/src/Launcher/Makefile.am b/src/Launcher/Makefile.am index baaead5e3..fdf3ce7d3 100644 --- a/src/Launcher/Makefile.am +++ b/src/Launcher/Makefile.am @@ -166,6 +166,7 @@ SALOME_LauncherServer_CPPFLAGS=\ $(COMMON_CPPFLAGS) SALOME_LauncherServer_LDADD =\ + libLauncher.la \ libSalomeLauncher.la \ ../Basics/libSALOMEBasics.la \ ../SALOMELocalTrace/libSALOMELocalTrace.la \ diff --git a/src/Makefile.am b/src/Makefile.am index 931471000..f3f4bb77f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -70,7 +70,8 @@ SUBDIR_CPPUNIT_CORBA = \ LifeCycleCORBA/Test \ LifeCycleCORBA_SWIG/Test \ SALOMEDSImpl/Test \ - SALOMEDS/Test + SALOMEDS/Test \ + KernelHelpers/Test SUBDIR_CPPUNIT_GENERAL = \ UnitTests diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.cxx b/src/SALOMEDS/SALOMEDS_Driver_i.cxx index 187c526f2..b366d9f0a 100644 --- a/src/SALOMEDS/SALOMEDS_Driver_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Driver_i.cxx @@ -292,14 +292,20 @@ SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::DumpPython(SALOMEDSImpl_Study* theStudy { SALOMEDS_Study_i * st_servant = SALOMEDS_Study_i::GetStudyServant(theStudy, _orb);//new SALOMEDS_Study_i (theStudy, _orb); SALOMEDS::Study_var st = SALOMEDS::Study::_narrow(st_servant->_this()); - Engines::EngineComponent_ptr aComponent = Engines::EngineComponent::_narrow(_driver); SALOMEDS::unlock(); - CORBA::Boolean aValidScript, aPublished = isPublished; - Engines::TMPFile_var aStream = aComponent->DumpPython(st.in(), aPublished, isMultiFile, aValidScript); + + Engines::TMPFile_var aStream; + CORBA::Boolean aValidScript = true; // VSR: maybe should be false by default ??? + + Engines::EngineComponent_ptr aComponent = Engines::EngineComponent::_narrow(_driver); + if ( !CORBA::is_nil( aComponent ) ) + aStream = aComponent->DumpPython(st.in(), isPublished, isMultiFile, aValidScript); + SALOMEDSImpl_TMPFile* aTMPFile = new Engines_TMPFile_i(aStream._retn()); theStreamLength = aTMPFile->Size(); isValidScript = aValidScript; + SALOMEDS::lock(); return aTMPFile; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx index 96fb9c896..67f16053a 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx @@ -30,6 +30,11 @@ #include "HDFexplorer.hxx" #include "Basics_Utils.hxx" +//Warning undef of Ascii Winwows define +#ifdef WIN32 +# undef GetUserName +#endif + #include "SALOMEDSImpl_Attributes.hxx" #include "SALOMEDSImpl_Tool.hxx" #include "SALOMEDSImpl_SComponent.hxx" @@ -42,15 +47,6 @@ #include #include -#ifdef WIN32 -#include -#endif - -//Warning undef of Ascii Winwows define -#ifdef WIN32 -# undef GetUserName -#endif - #define USE_CASE_LABEL_ID "0:2" static void SaveAttributes(const SALOMEDSImpl_SObject& SO, HDFgroup *hdf_group_sobject);