From 015e6c34d8af7645e371e7d34c5b97184822bfd1 Mon Sep 17 00:00:00 2001 From: prascle Date: Wed, 28 Mar 2007 14:16:26 +0000 Subject: [PATCH] merge from tag V4_0a2 --- bin/Makefile.am | 7 +- bin/appliskel/killCurrentPort | 5 +- bin/appliskel/runAppli | 9 +- bin/appliskel/runSession | 5 +- bin/appliskel/searchFreePort.sh | 2 +- bin/envSalome.py | 8 +- bin/killSalomeWithPort.py | 29 +- bin/launchConfigureParser.py | 528 +- bin/launchSalome.py | 92 + bin/nameserver.py | 117 + bin/orbmodule.py | 41 +- bin/runNS.py | 99 + bin/runSalome | 44 +- bin/runSalome.py | 473 +- bin/salomeConsole.py | 2 +- bin/salome_session.py | 2 +- bin/server.py | 46 + bin/setenv.py | 264 + bin/virtual_salome.py | 5 +- configure.ac | 2 +- doc/INSTALL.txt | 6 - doc/KERNEL_Services.txt | 4 +- .../sources/static/examples_Life_cycle.html | 232 +- .../KERNEL/sources/static/examples_Study.html | 1580 ++-- .../tui/KERNEL/sources/static/mapping.html | 658 +- .../sources/static/overview_Kernel.html | 382 +- .../sources/static/overview_Life_Cycle.html | 180 +- .../sources/static/overview_Naming.html | 394 +- .../KERNEL/sources/static/overview_Study.html | 522 +- doc/salome/tui/Makefile.am | 2 +- doc/salome/version.texi | 8 +- idl/Makefile.am | 3 + idl/SALOMEDS.idl | 8 +- idl/SALOMEDS_Attributes.idl | 18 + idl/SALOME_Session.idl | 2 +- salome_adm/unix/Doxyfile | 829 ++ salome_adm/unix/F77config.h.in | 29 + .../unix/config_files/ac_cc_warnings.m4 | 119 + .../unix/config_files/ac_cxx_depend_flag.m4 | 83 +- salome_adm/unix/config_files/check_Salome.m4 | 78 + salome_adm/unix/config_files/check_boost.m4 | 9 + salome_adm/unix/config_files/check_cppunit.m4 | 9 +- salome_adm/unix/config_files/check_java.m4 | 111 + salome_adm/unix/config_files/check_qt.m4 | 28 +- salome_adm/unix/config_files/config.guess | 1497 ++++ salome_adm/unix/config_files/config.sub | 1608 ++++ salome_adm/unix/config_files/install-sh | 323 + salome_adm/unix/config_files/ltmain.sh | 6871 +++++++++++++++++ salome_adm/unix/config_files/missing | 190 + salome_adm/unix/config_files/production.m4 | 2 +- salome_adm/unix/sstream.in | 225 + src/Basics/BasicsGenericDestructor.cxx | 9 +- src/Basics/BasicsGenericDestructor.hxx | 43 +- src/Batch/Batch_Parametre.hxx | 2 +- src/Communication/Makefile.am | 3 +- src/Communication/MatrixClient.hxx | 4 +- src/Communication/MultiCommException.hxx | 5 +- src/Communication/ReceiverFactory.hxx | 4 +- src/Communication/Receivers.cxx | 2 +- src/Communication/SALOMEMultiComm.hxx | 4 +- src/Communication/SALOME_Comm_i.cxx | 2 +- src/Communication/SALOME_Comm_i.hxx | 28 +- src/Communication/SALOME_Communication.hxx | 47 + src/Communication/SenderFactory.hxx | 4 +- src/Container/Container_i.cxx | 87 +- src/Container/Container_init_python.cxx | 4 +- src/Container/Container_init_python.hxx | 16 +- src/Container/Makefile.am | 3 +- src/Container/SALOME_Component_i.hxx | 16 +- src/Container/SALOME_Container.cxx | 9 +- src/Container/SALOME_Container.hxx | 47 + src/Container/SALOME_ContainerManager.cxx | 16 + src/Container/SALOME_ContainerManager.hxx | 16 +- src/Container/SALOME_ContainerPy.py | 6 + .../SALOME_Container_SignalsHandler.cxx | 2 +- src/Container/SALOME_Container_i.hxx | 17 +- src/Container/SALOME_FileRef_i.hxx | 4 +- src/Container/SALOME_FileTransfer_i.hxx | 4 +- .../Calcium/CalciumCouplingPolicy.hxx | 11 +- .../Calcium/CalciumGenericUsesPort.hxx | 6 +- .../DSC_User/Datastream/CouplingPolicy.hxx | 1 + src/DSC/DSC_User/Datastream/GenericPort.hxx | 14 +- .../Datastream/Palm/PalmCouplingPolicy.hxx | 19 +- src/GenericObj/SALOME_GenericObj_i.cc | 4 +- src/GenericObj/SALOME_GenericObj_i.hh | 2 +- src/HDFPersist/HDFascii.cc | 7 +- src/HDFPersist/HDFattrGetSize.c | 7 +- src/HDFPersist/HDFdatasetGetOrder.c | 2 +- src/HDFPersist/HDFobjectIdentify.c | 4 +- src/HDFPersist/HDFobjectType.c | 1 - src/KERNEL_PY/import_hook.py | 26 +- src/KERNEL_PY/salome.py | 1 - src/KERNEL_PY/salome_shared_modules.py | 8 +- src/KERNEL_PY/salome_test.py | 427 +- .../SALOME_FileTransferCORBA.cxx | 4 +- .../SALOME_FileTransferCORBA.hxx | 12 +- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx | 7 +- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx | 18 +- src/Logger/SALOME_Logger_Server.hxx | 13 +- src/Logger/SALOME_Logger_Server_main.cxx | 2 + src/ModuleCatalog/Makefile.am | 3 +- src/ModuleCatalog/SALOME_ModuleCatalog.hxx | 47 + .../SALOME_ModuleCatalog_Acomponent_impl.hxx | 16 +- .../SALOME_ModuleCatalog_Handler.hxx | 16 +- .../SALOME_ModuleCatalog_impl.cxx | 26 +- .../SALOME_ModuleCatalog_impl.hxx | 17 +- src/NOTIFICATION_SWIG/Makefile.am | 2 +- src/NOTIFICATION_SWIG/NOTIFICATION.i | 4 + src/NOTIFICATION_SWIG/NOTIFICATION_Swig.hxx | 10 +- .../SALOME_NOTIFICATION_SWIG.hxx | 47 + .../NamingService_WaitForServerReadiness.cxx | 2 +- .../NamingService_WaitForServerReadiness.hxx | 10 +- src/NamingService/SALOME_NamingService.cxx | 12 +- src/NamingService/ServiceUnreachable.hxx | 6 +- src/Notification/Makefile.am | 3 +- src/Notification/NOTIFICATION.hxx | 17 +- src/Notification/NOTIFICATION_Consumer.cxx | 17 +- src/Notification/NOTIFICATION_Consumer.hxx | 14 +- src/Notification/NOTIFICATION_Supplier.hxx | 14 +- src/Notification/SALOME_NOTIFICATION.hxx | 47 + src/Registry/Makefile.am | 3 +- src/Registry/RegistryConnexion.hxx | 16 +- src/Registry/RegistryService.hxx | 16 +- src/Registry/SALOME_Registry.hxx | 47 + .../SALOME_ResourcesCatalog_Handler.cxx | 22 +- .../SALOME_ResourcesManager.cxx | 54 +- .../SALOME_ResourcesManager.hxx | 16 - src/SALOMEDS/Makefile.am | 7 +- src/SALOMEDS/SALOMEDS.cxx | 35 +- src/SALOMEDS/SALOMEDS.hxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx | 3 +- src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx | 2 +- .../SALOMEDS_AttributeParameter_i.cxx | 2 +- .../SALOMEDS_AttributeParameter_i.hxx | 2 +- .../SALOMEDS_AttributePythonObject.hxx | 5 - .../SALOMEDS_AttributePythonObject_i.cxx | 5 +- src/SALOMEDS/SALOMEDS_AttributeString.cxx | 62 + src/SALOMEDS/SALOMEDS_AttributeString.hxx | 47 + src/SALOMEDS/SALOMEDS_AttributeString_i.cxx | 49 + src/SALOMEDS/SALOMEDS_AttributeString_i.hxx | 47 + .../SALOMEDS_AttributeTableOfInteger.cxx | 7 +- .../SALOMEDS_AttributeTableOfReal.cxx | 7 +- .../SALOMEDS_AttributeTableOfString.cxx | 7 +- src/SALOMEDS/SALOMEDS_AttributeTarget.cxx | 6 +- src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx | 3 + src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeUserID.cxx | 4 + src/SALOMEDS/SALOMEDS_Attributes.hxx | 5 +- src/SALOMEDS/SALOMEDS_Client.cxx | 3 +- src/SALOMEDS/SALOMEDS_ClientAttributes.hxx | 8 +- src/SALOMEDS/SALOMEDS_Defines.hxx | 47 + src/SALOMEDS/SALOMEDS_Driver_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_GenericAttribute.cxx | 2 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx | 9 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_SObject.cxx | 7 +- src/SALOMEDS/SALOMEDS_SObject_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_SObject_i.hxx | 6 +- src/SALOMEDS/SALOMEDS_Server.cxx | 8 +- src/SALOMEDS/SALOMEDS_Study.cxx | 11 +- src/SALOMEDS/SALOMEDS_StudyBuilder.cxx | 34 +- src/SALOMEDS/SALOMEDS_StudyBuilder.hxx | 5 +- src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx | 2 +- src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx | 3 + src/SALOMEDS/SALOMEDS_StudyManager.cxx | 4 +- src/SALOMEDS/SALOMEDS_StudyManager_i.cxx | 13 +- src/SALOMEDS/SALOMEDS_StudyManager_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_Study_i.cxx | 31 +- src/SALOMEDS/SALOMEDS_Study_i.hxx | 6 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx | 14 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx | 6 +- src/SALOMEDS/Test/Makefile.am | 2 +- src/SALOMEDS/Test/SALOMEDSTest.cxx | 210 +- src/SALOMEDS/Test/SALOMEDSTest.hxx | 149 +- .../Test/SALOMEDSTest_AttributeComment.cxx | 75 + .../Test/SALOMEDSTest_AttributeDrawable.cxx | 73 + .../Test/SALOMEDSTest_AttributeExpandable.cxx | 71 + .../SALOMEDSTest_AttributeExternalFileDef.cxx | 74 + .../Test/SALOMEDSTest_AttributeFileType.cxx | 74 + .../Test/SALOMEDSTest_AttributeFlags.cxx | 76 + .../Test/SALOMEDSTest_AttributeGraphic.cxx | 73 + .../Test/SALOMEDSTest_AttributeIOR.cxx | 69 + .../Test/SALOMEDSTest_AttributeInteger.cxx | 66 + .../Test/SALOMEDSTest_AttributeLocalID.cxx | 65 + .../Test/SALOMEDSTest_AttributeName.cxx | 73 + .../Test/SALOMEDSTest_AttributeOpened.cxx | 71 + .../Test/SALOMEDSTest_AttributeParameter.cxx | 146 + .../SALOMEDSTest_AttributePersistentRef.cxx | 73 + .../Test/SALOMEDSTest_AttributePixMap.cxx | 74 + .../SALOMEDSTest_AttributePythonObject.cxx | 74 + .../Test/SALOMEDSTest_AttributeReal.cxx | 65 + .../Test/SALOMEDSTest_AttributeSelectable.cxx | 71 + ...ALOMEDSTest_AttributeSequenceOfInteger.cxx | 126 + .../SALOMEDSTest_AttributeSequenceOfReal.cxx | 121 + .../SALOMEDSTest_AttributeStudyProperties.cxx | 113 + .../SALOMEDSTest_AttributeTableOfInteger.cxx | 193 + .../SALOMEDSTest_AttributeTableOfReal.cxx | 190 + .../SALOMEDSTest_AttributeTableOfString.cxx | 190 + .../Test/SALOMEDSTest_AttributeTarget.cxx | 89 + .../Test/SALOMEDSTest_AttributeTextColor.cxx | 74 + ...LOMEDSTest_AttributeTextHighlightColor.cxx | 74 + .../Test/SALOMEDSTest_AttributeTreeNode.cxx | 204 + .../Test/SALOMEDSTest_AttributeUserID.cxx | 81 + .../Test/SALOMEDSTest_ChildIterator.cxx | 79 + src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx | 70 + .../Test/SALOMEDSTest_SComponentIterator.cxx | 65 + src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx | 124 + src/SALOMEDS/Test/SALOMEDSTest_Study.cxx | 349 + .../Test/SALOMEDSTest_StudyBuilder.cxx | 285 + .../Test/SALOMEDSTest_StudyManager.cxx | 164 + src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx | 149 + src/SALOMEDS/Test/TestSALOMEDS.cxx | 149 +- src/SALOMEDSClient/Makefile.am | 1 + src/SALOMEDSClient/SALOMEDSClient.hxx | 1 + .../SALOMEDSClient_AttributeString.hxx | 38 + .../SALOMEDSClient_AttributeTreeNode.hxx | 2 +- .../SALOMEDSClient_ClientFactory.hxx | 2 +- .../SALOMEDSClient_definitions.hxx | 12 +- src/SALOMEDSImpl/Makefile.am | 4 + .../SALOMEDSImpl_AttributeExpandable.cxx | 2 +- .../SALOMEDSImpl_AttributeParameter.cxx | 31 +- .../SALOMEDSImpl_AttributePythonObject.cxx | 13 +- .../SALOMEDSImpl_AttributeSelectable.cxx | 2 +- ...ALOMEDSImpl_AttributeSequenceOfInteger.cxx | 8 + .../SALOMEDSImpl_AttributeSequenceOfReal.cxx | 7 + .../SALOMEDSImpl_AttributeString.cxx | 108 + .../SALOMEDSImpl_AttributeString.hxx | 70 + .../SALOMEDSImpl_AttributeTarget.hxx | 6 +- .../SALOMEDSImpl_AttributeTextColor.cxx | 2 +- ...LOMEDSImpl_AttributeTextHighlightColor.cxx | 2 +- .../SALOMEDSImpl_AttributeTreeNode.cxx | 12 + src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx | 17 +- src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx | 6 +- src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 24 +- src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx | 17 +- .../SALOMEDSImpl_StudyBuilder.cxx | 25 +- .../SALOMEDSImpl_StudyManager.cxx | 48 +- src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx | 6 +- src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx | 7 +- .../SALOMEDSImpl_UseCaseBuilder.cxx | 6 +- src/SALOMELocalTrace/BaseTraceCollector.cxx | 7 +- src/SALOMELocalTrace/BaseTraceCollector.hxx | 17 +- src/SALOMELocalTrace/FileTraceCollector.cxx | 2 +- src/SALOMELocalTrace/FileTraceCollector.hxx | 2 + src/SALOMELocalTrace/LocalTraceBufferPool.cxx | 33 +- src/SALOMELocalTrace/LocalTraceBufferPool.hxx | 2 + src/SALOMELocalTrace/LocalTraceCollector.cxx | 3 +- src/SALOMELocalTrace/LocalTraceCollector.hxx | 2 + src/SALOMELocalTrace/Makefile.am | 6 +- src/SALOMELocalTrace/SALOME_LocalTrace.hxx | 47 + .../SALOMETraceCollector.cxx | 5 +- .../SALOMETraceCollector.hxx | 18 +- .../TraceCollector_WaitForServerReadiness.hxx | 2 +- src/TOOLSDS/SALOMEDS_Tool.cxx | 19 +- src/TOOLSDS/SALOMEDS_Tool.hxx | 19 +- src/TestContainer/SALOME_TestComponent_i.cxx | 8 +- src/TestContainer/SALOME_TestComponent_i.hxx | 4 +- src/TestContainer/TestComponentPy.py | 4 +- src/Utils/Makefile.am | 3 +- src/Utils/OpUtil.hxx | 14 +- src/Utils/SALOME_Utils.hxx | 39 + src/Utils/SalomeString.hxx | 4 +- src/Utils/Utils_CommException.hxx | 4 +- src/Utils/Utils_CorbaException.hxx | 2 + src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx | 30 +- src/Utils/Utils_ExceptHandlers.hxx | 16 +- src/Utils/Utils_Identity.cxx | 47 +- src/Utils/Utils_Identity.hxx | 15 +- src/Utils/Utils_Identity.py | 18 +- src/Utils/Utils_Mutex.hxx | 16 +- src/Utils/Utils_ORB_INIT.hxx | 19 +- src/Utils/Utils_SALOME_Exception.hxx | 24 +- src/Utils/Utils_SINGLETON.hxx | 2 + src/Utils/Utils_SignalsHandler.h | 50 + src/Utils/Utils_Timer.hxx | 4 +- 275 files changed, 21730 insertions(+), 3703 deletions(-) create mode 100755 bin/launchSalome.py create mode 100755 bin/nameserver.py create mode 100755 bin/runNS.py create mode 100755 bin/server.py create mode 100755 bin/setenv.py create mode 100644 salome_adm/unix/Doxyfile create mode 100644 salome_adm/unix/F77config.h.in create mode 100644 salome_adm/unix/config_files/ac_cc_warnings.m4 create mode 100644 salome_adm/unix/config_files/check_Salome.m4 create mode 100644 salome_adm/unix/config_files/check_java.m4 create mode 100755 salome_adm/unix/config_files/config.guess create mode 100755 salome_adm/unix/config_files/config.sub create mode 100755 salome_adm/unix/config_files/install-sh create mode 100644 salome_adm/unix/config_files/ltmain.sh create mode 100644 salome_adm/unix/config_files/missing create mode 100644 salome_adm/unix/sstream.in create mode 100755 src/Communication/SALOME_Communication.hxx create mode 100755 src/Container/SALOME_Container.hxx create mode 100755 src/ModuleCatalog/SALOME_ModuleCatalog.hxx create mode 100755 src/NOTIFICATION_SWIG/SALOME_NOTIFICATION_SWIG.hxx create mode 100755 src/Notification/SALOME_NOTIFICATION.hxx create mode 100755 src/Registry/SALOME_Registry.hxx create mode 100644 src/SALOMEDS/SALOMEDS_AttributeString.cxx create mode 100644 src/SALOMEDS/SALOMEDS_AttributeString.hxx create mode 100644 src/SALOMEDS/SALOMEDS_AttributeString_i.cxx create mode 100644 src/SALOMEDS/SALOMEDS_AttributeString_i.hxx create mode 100755 src/SALOMEDS/SALOMEDS_Defines.hxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeComment.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeDrawable.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeExternalFileDef.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeFileType.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeFlags.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeGraphic.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeIOR.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeInteger.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeLocalID.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeName.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeOpened.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeParameter.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributePersistentRef.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributePixMap.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributePythonObject.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeReal.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfReal.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeStudyProperties.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfInteger.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfString.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTarget.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTextHighlightColor.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_SComponentIterator.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_Study.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx create mode 100644 src/SALOMEDSClient/SALOMEDSClient_AttributeString.hxx create mode 100644 src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx create mode 100644 src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx create mode 100755 src/SALOMELocalTrace/SALOME_LocalTrace.hxx create mode 100755 src/Utils/SALOME_Utils.hxx create mode 100644 src/Utils/Utils_SignalsHandler.h diff --git a/bin/Makefile.am b/bin/Makefile.am index f50343d19..827b9ec38 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -57,7 +57,12 @@ dist_salomescript_SCRIPTS=\ launchConfigureParser.py \ showNS.py \ addToKillList.py \ - NSparam.py + NSparam.py \ + setenv.py \ + launchSalome.py \ + nameserver.py \ + server.py + EXTRA_DIST = appliskel diff --git a/bin/appliskel/killCurrentPort b/bin/appliskel/killCurrentPort index 5d0a547cc..e1eb19268 100755 --- a/bin/appliskel/killCurrentPort +++ b/bin/appliskel/killCurrentPort @@ -10,11 +10,10 @@ # --- find omniORB configuration relative to current session if any -myhost=`hostname` -fileOmniConfig=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg +fileOmniConfig=${HOME}/${APPLI}/.omniORB_last.cfg if [ -f $fileOmniConfig ]; then - OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg + OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_last.cfg export OMNIORB_CONFIG fi diff --git a/bin/appliskel/runAppli b/bin/appliskel/runAppli index e28e9c9d4..7693557c1 100755 --- a/bin/appliskel/runAppli +++ b/bin/appliskel/runAppli @@ -10,20 +10,15 @@ APPLI_HOME=`dirname $0` . ${HOME}/${APPLI}/envd ${HOME}/${APPLI} -# --- define port for CORBA naming service - -. ${HOME}/${APPLI}/searchFreePort.sh -searchFreePort - # --- if mpi lam, start lam (seems safe to be done several times) -# arret manuel avec lamhalt +# (manual stop with lamhalt) if [ "$LAMBHOST" ]; then lamboot fi # --- run SALOME -# (default arguments defined in local salome.launch could be completed +# (default arguments defined in local SalomeApp.xml could be completed # by arguments to this command) if [ $# -ne 0 ] ; then diff --git a/bin/appliskel/runSession b/bin/appliskel/runSession index 69573bf10..9f3b0e4f9 100755 --- a/bin/appliskel/runSession +++ b/bin/appliskel/runSession @@ -17,11 +17,10 @@ APPLI_HOME=`dirname $0` # --- set omniORB configuration to current session if any -myhost=`hostname` -fileOmniConfig=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg +fileOmniConfig=${HOME}/${APPLI}/.omniORB_last.cfg if [ -f $fileOmniConfig ]; then - OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg + OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_last.cfg export OMNIORB_CONFIG # --- set environment variables for port and hostname of NamingService diff --git a/bin/appliskel/searchFreePort.sh b/bin/appliskel/searchFreePort.sh index d63804500..a45eb4dea 100755 --- a/bin/appliskel/searchFreePort.sh +++ b/bin/appliskel/searchFreePort.sh @@ -41,7 +41,7 @@ searchFreePort() { local initref="NameService=corbaname::"`hostname`":$NSPORT" #echo "ORBInitRef $initref" > $OMNIORB_CONFIG echo "InitRef = $initref" > $OMNIORB_CONFIG - LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg + LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_last.cfg export LAST_RUNNING_CONFIG rm ${LAST_RUNNING_CONFIG} ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG} diff --git a/bin/envSalome.py b/bin/envSalome.py index 744ba08cb..f0dcd7b3a 100755 --- a/bin/envSalome.py +++ b/bin/envSalome.py @@ -21,16 +21,18 @@ import os import sys +import setenv kernel_root=os.getenv("KERNEL_ROOT_DIR") sys.path[:0]=[kernel_root+"/bin/salome"] -import runSalome +#import runSalome argv=sys.argv[1:] sys.argv=[] -args, modules_list, modules_root_dir = runSalome.get_config() -runSalome.set_env(args, modules_list, modules_root_dir) +args, modules_list, modules_root_dir = setenv.get_config() +#runSalome.set_env(args, modules_list, modules_root_dir) +setenv.main(); os.execvp(argv[0],argv) diff --git a/bin/killSalomeWithPort.py b/bin/killSalomeWithPort.py index 2bfec7561..45ffd89c7 100755 --- a/bin/killSalomeWithPort.py +++ b/bin/killSalomeWithPort.py @@ -24,11 +24,13 @@ import os, sys, pickle, signal, commands def getPiDict(port,appname='salome',full=True): from Utils_Identity import getShortHostName - host = os.getenv("HOSTNAME") + # get hostname by special function in all cases to + # have always same result in lower case at win32 + host = getShortHostName() if not host: - host = os.getenv("HOST") + host = os.getenv("HOSTNAME") if not host: - host = getShortHostName() + host = os.getenv("HOST") filedict = [] filedict.append( os.getenv('USER') ) # user name @@ -46,7 +48,7 @@ def appliCleanOmniOrbConfig(port): """ remove omniorb config files related to the port in SALOME application: - ${HOME}/${APPLI}/.omniORB_${HOSTNAME}_${NSPORT}.cfg - - ${HOME}/${APPLI}/.omniORB_${HOSTNAME}_last.cfg + - ${HOME}/${APPLI}/.omniORB_last.cfg the last is removed only if the link points to the first file. """ from Utils_Identity import getShortHostName @@ -59,7 +61,7 @@ def appliCleanOmniOrbConfig(port): home='%s/%s'%(home,appli) hostname=getShortHostName() omniorb_config = '%s/.omniORB_%s_%s.cfg'%(home,hostname, str(port)) - last_running_config = '%s/.omniORB_%s_last.cfg'%(home, hostname) + last_running_config = '%s/.omniORB_last.cfg'%(home) if os.access(last_running_config,os.F_OK): pointedPath = os.readlink(last_running_config) if pointedPath[0] != '/': @@ -86,8 +88,9 @@ def killMyPort(port): pass if found: - cmd = 'pid=`ps -eo pid,command | egrep "[0-9] omniNames -start '+str(port)+'"` ; echo $pid > /tmp/logs/'+os.getenv('USER')+"/_"+port+'_Pid_omniNames.log' - a = os.system(cmd) + if not sys.platform == 'win32': + cmd = 'pid=`ps -eo pid,command | egrep "[0-9] omniNames -start '+str(port)+'"` ; echo $pid > /tmp/logs/'+os.getenv('USER')+"/_"+port+'_Pid_omniNames.log' + a = os.system(cmd) try: fpidomniNames=open('/tmp/logs/'+os.getenv('USER')+"/_"+port+'_Pid_omniNames.log') prc = fpidomniNames.read() @@ -97,7 +100,11 @@ def killMyPort(port): if field == "omniNames" : if pidfield != "egrep" : print 'stop process '+pidfield+' : omniNames' - os.system('kill -9 '+pidfield) + if sys.platform == "win32": + import win32pm + win32pm.killpid(int(pidfield),0) + else: + os.system('kill -9 '+pidfield) pidfield = field except: pass @@ -110,7 +117,11 @@ def killMyPort(port): for pid, cmd in process_id.items(): print "stop process %s : %s"% (pid, cmd[0]) try: - os.kill(int(pid),signal.SIGKILL) + if sys.platform == "win32": + import win32pm + win32pm.killpid(int(pid),0) + else: + os.kill(int(pid),signal.SIGKILL) except: print " ------------------ process %s : %s not found"% (pid, cmd[0]) pass diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index f1ae79eaa..a91e3033d 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -16,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + import os, glob, string, sys, re import xml.sax @@ -30,6 +31,7 @@ val_att = "value" # certain values in XML configuration file ("launch" section) lanch_nam = "launch" +help_nam = "help" gui_nam = "gui" splash_nam = "splash" logger_nam = "logger" @@ -42,8 +44,11 @@ embedded_nam = "embedded" standalone_nam = "standalone" containers_nam = "containers" key_nam = "key" +terminal_nam = "terminal" interp_nam = "interp" except_nam = "noexcepthandler" +terminal_nam = "terminal" +case_nam = "test" # values in XML configuration file giving specific module parameters ( section) # which are stored in opts with key _ (eg SMESH_plugins) @@ -62,19 +67,32 @@ boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, # values of list type listKeys = ( containers_nam, embedded_nam, key_nam, modules_nam, standalone_nam, plugins_nam ) -# return application version (uses GUI_ROOT_DIR (or KERNEL_ROOT_DIR in batch mode) +/bin/salome/VERSION) +### +# Get the application version +# Uses GUI_ROOT_DIR (or KERNEL_ROOT_DIR in batch mode) +/bin/salome/VERSION file +### def version(): - root_dir = os.environ.get( 'KERNEL_ROOT_DIR', '' ) # KERNEL_ROOT_DIR or "" if not found - root_dir = os.environ.get( 'GUI_ROOT_DIR', root_dir ) # GUI_ROOT_DIR or KERNEL_ROOT_DIR or "" if both not found - filename = root_dir+'/bin/salome/VERSION' - str = open( filename, "r" ).readline() # str = "THIS IS SALOME - SALOMEGUI VERSION: 3.0.0" - match = re.search( r':\s+([a-zA-Z0-9.]+)\s*$', str ) - if match : - return match.group( 1 ) + try: + filename = None + root_dir = os.environ.get( 'KERNEL_ROOT_DIR', '' ) # KERNEL_ROOT_DIR or "" if not found + if root_dir and os.path.exists( root_dir + "/bin/salome/VERSION" ): + filename = root_dir + "/bin/salome/VERSION" + root_dir = os.environ.get( 'GUI_ROOT_DIR', '' ) # GUI_ROOT_DIR "" if not found + if root_dir and os.path.exists( root_dir + "/bin/salome/VERSION" ): + filename = root_dir + "/bin/salome/VERSION" + if filename: + str = open( filename, "r" ).readline() # str = "THIS IS SALOME - SALOMEGUI VERSION: 3.0.0" + match = re.search( r':\s+([a-zA-Z0-9.]+)\s*$', str ) + if match : + return match.group( 1 ) + except: + pass return '' -# calculate and return configuration file id in order to unically identify it -# for example: for 3.1.0a1 the id is 301000101 +### +# Calculate and return configuration file unique ID +# For example: for SALOME version 3.1.0a1 the id is 300999701 +### def version_id( fname ): vers = fname.split(".") major = int(vers[0]) @@ -96,18 +114,26 @@ def version_id( fname ): if dev > 0: ver = ver - 10000 + dev return ver -# get user configuration file name +### +# Get user configuration file name +### def userFile(): v = version() if not v: return "" # not unknown version - filename = "%s/.%src.%s" % (os.environ['HOME'], appname, v) + if sys.platform == "win32": + filename = "%s\%s.xml.%s" % (os.environ['HOME'], 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 - files = glob.glob( os.environ['HOME'] + "/." + appname + "rc.*" ) + if sys.platform == "win32": + files = glob.glob( os.environ['HOME'] + "\." + appname + ".xml.*" ) + 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 ) @@ -123,7 +149,9 @@ def userFile(): # ----------------------------------------------------------------------------- -### xml reader for launch configuration file usage +### +# XML reader for launch configuration file usage +### section_to_skip = "" @@ -212,96 +240,9 @@ class xml_parser: # ----------------------------------------------------------------------------- -### searching for launch configuration files -# the rule: -# - environment variable {'appname'+'Config'} (SalomeAppConfig) contains list of directories (';' as devider) -# - these directories contain 'appname'+'.xml' (SalomeApp.xml) configuration files -# - these files are analyzed beginning with the last one (last directory in the list) -# - if a key is found in next analyzed cofiguration file - it will be replaced -# - the last configuration file to be analyzed - ~/.'appname'+'rc' (~/SalomeApprc) (if it exists) -# - but anyway, if user specifies a certain option in a command line - it will replace the values -# - specified in configuration file(s) -# - once again the order of settings (next setting replaces the previous ones): -# - SalomeApp.xml files in directories specified by SalomeAppConfig env variable -# - .SalomeApprc file in user's catalogue -# - command line - -config_var = appname+'Config' -# set resources variables if not yet set -dirs = [] -if os.getenv(config_var): - dirs += re.split('[;|:]', os.getenv(config_var)) -if os.getenv("GUI_ROOT_DIR"): - dirs += [os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui"] -os.environ[config_var] = ":".join(dirs) - -dirs.reverse() # reverse order, like in "path" variable - FILO-style processing - -_opts = {} # assiciative array of options to be filled - -# SalomeApp.xml files in directories specified by SalomeAppConfig env variable -for dir in dirs: - filename = dir+'/'+appname+'.xml' - if not os.path.exists(filename): - print "Configure parser: Warning : could 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 - pass - -# SalomeApprc file in user's catalogue -filename = userFile() -if not filename or not os.path.exists(filename): - print "Configure parser: Warning : could not find user configuration file" -else: - try: - p = xml_parser(filename, _opts) - _opts = p.opts - except: - print 'Configure parser: Error : can not read user configuration file' - -args = _opts - -# --- setting default values of keys if they were NOT set in config files --- -for aKey in listKeys: - if not args.has_key( aKey ): - args[aKey]=[] - -for aKey in boolKeys: - if not args.has_key( aKey ): - args[aKey]=0 - -if args[file_nam]: - afile=args[file_nam] - args[file_nam]=[afile] - -args[appname_nam] = appname - -### searching for my port - -my_port = 2809 -try: - file = open(os.environ["OMNIORB_CONFIG"], "r") - s = file.read() - while len(s): - l = string.split(s, ":") - if string.split(l[0], " ")[0] == "ORBInitRef" or string.split(l[0], " ")[0] == "InitRef" : - my_port = int(l[len(l)-1]) - pass - s = file.read() - pass -except: - pass - -args[port_nam] = my_port - -# ----------------------------------------------------------------------------- - -### command line options reader - +### +# Command line options parser +### def options_parser(line): source = line list = [] @@ -319,11 +260,13 @@ def options_parser(line): if source[i][0] != '-': key = None elif source[i][1] == '-': - key = source[i][2] + key = source[i][2:] else: - key = source[i][1] + key = source[i][1:] pass + if key is None and not result: + raise Exception() result[key] = [] if key: i += 1 @@ -337,118 +280,275 @@ def options_parser(line): # ----------------------------------------------------------------------------- -### read command-line options : each arg given in command line supersedes arg from xml config file -cmd_opts = {} -try: - cmd_opts = options_parser(sys.argv[1:]) - kernel_root_dir=os.environ["KERNEL_ROOT_DIR"] -except: - cmd_opts["h"] = 1 - pass +### +# Get the environment +### + +# this attribute is obsolete +args = {} +def get_env(): + ### + # Collect launch configuration files: + # - The environment variable "Config" (SalomeAppConfig) which can + # define a list of directories (separated by ':' or ';' symbol) is checked + # - If the environment variable "Config" is not set, only + # ${GUI_ROOT_DIR}/share/salome/resources/gui is inspected + # - ${GUI_ROOT_DIR}/share/salome/resources/gui directory is always inspected + # so it is not necessary to put it in the "Config" variable + # - The directories which are inspected are checked for files ".xml" + # (SalomeApp.xml) which define SALOME configuration + # - These directories are analyzed beginning from the last one in the list, + # so the first directory listed in "Config" environment variable + # 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) + # - Command line options have the highest priority and replace options + # specified in configuration file(s) + ### + + global args + config_var = appname+'Config' + + separator = ":" + if os.sys.platform == 'win32': + separator = ";" + + + # set resources variable SaloemAppConfig if it is not set yet + dirs = [] + if os.getenv(config_var): + if sys.platform == 'win32': + dirs += re.split(';', os.getenv(config_var)) + else: + dirs += re.split('[;|:]', os.getenv(config_var)) + + if os.getenv("GUI_ROOT_DIR") and os.path.isdir( os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui" ): + dirs += [os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui"] + os.environ[config_var] = separator.join(dirs) -### check all options are right - -opterror=0 -for opt in cmd_opts: - if not opt in ("h","g","l","f","x","m","e","s","c","p","k","t","i","r"): - print "Configure parser: Error : command line error : -%s" % opt - opterror=1 - -if opterror == 1: - cmd_opts["h"] = 1 - -if cmd_opts.has_key("h"): - print """USAGE: runSalome.py [options] - [command line options] : - --help or -h : print this help - --gui or -g : launching with GUI - --terminal -t : launching without gui (to deny --gui) - or -t=PythonScript[,...] - : import of PythonScript(s) - --logger or -l : redirect messages in a CORBA collector - --file=filename or -f=filename: redirect messages in a log file - --xterm or -x : execute servers in xterm console (messages appear in xterm windows) - --modules=module1,module2,... : salome module list (modulen is the name of Salome module to load) - or -m=module1,module2,... - --embedded=registry,study,moduleCatalog,cppContainer - or -e=registry,study,moduleCatalog,cppContainer - : embedded CORBA servers (default: registry,study,moduleCatalog,cppContainer) - : (logger,pyContainer,supervContainer can't be embedded - --standalone=registry,study,moduleCatalog,cppContainer,pyContainer,supervContainer - or -s=registry,study,moduleCatalog,cppContainer,pyContainer,supervContainer - : standalone CORBA servers (default: pyContainer,supervContainer) - --containers=cpp,python,superv: (obsolete) launching of containers cpp, python and supervision - or -c=cpp,python,superv : = get default from -e and -s - --portkill or -p : kill the salome with current port - --killall or -k : kill all salome sessions - --interp=n or -i=n : number of additional xterm to open, with session environment - -z : display splash screen - -r : disable centralized exception handling mechanism - - For each Salome module, the environment variable _ROOT_DIR must be set. - The module name () must be uppercase. - KERNEL_ROOT_DIR is mandatory. - """ - sys.exit(1) - pass + dirs.reverse() # reverse order, like in "path" variable - FILO-style processing + + _opts = {} # associative array of options to be filled -### apply command-line options to the arguments -for opt in cmd_opts: - if opt == 'g': - args[gui_nam] = 1 - elif opt == 'z': - args[splash_nam] = 1 - elif opt == 'r': - args[except_nam] = 1 - elif opt == 'l': - args[logger_nam] = 1 - elif opt == 'f': - args[file_nam] = cmd_opts['f'] - elif opt == 'x': - args[xterm_nam] = 1 - elif opt == 'i': - args[interp_nam] = cmd_opts['i'] - elif opt == 'm': - args[modules_nam] = cmd_opts['m'] - elif opt == 'e': - args[embedded_nam] = cmd_opts['e'] - elif opt == 's': - args[standalone_nam] = cmd_opts['s'] - elif opt == 'c': - args[containers_nam] = cmd_opts['c'] - elif opt == 'p': - args[portkill_nam] = 1 - elif opt == 'k': - args[killall_nam] = 1 + # parse SalomeApp.xml files in directories specified by SalomeAppConfig env variable + for dir in dirs: + filename = dir+'/'+appname+'.xml' + if not os.path.exists(filename): + print "Configure parser: Warning : could 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 + pass + + # parse .SalomeApprc. file in user's home directory if it exists + # if user file for the current version is not found the nearest to it is used + filename = userFile() + if not filename or not os.path.exists(filename): + print "Configure parser: Warning : could not find user configuration file" + else: + try: + p = xml_parser(filename, _opts) + _opts = p.opts + except: + print 'Configure parser: Error : can not read user configuration file' + + args = _opts + + # set default values for options which are NOT set in config files + for aKey in listKeys: + if not args.has_key( aKey ): + args[aKey]=[] + + for aKey in boolKeys: + if not args.has_key( aKey ): + args[aKey]=0 + + if args[file_nam]: + afile=args[file_nam] + args[file_nam]=[afile] + + args[appname_nam] = appname + + # get the port number + my_port = 2809 + try: + file = open(os.environ["OMNIORB_CONFIG"], "r") + s = file.read() + while len(s): + l = string.split(s, ":") + if string.split(l[0], " ")[0] == "ORBInitRef" or string.split(l[0], " ")[0] == "InitRef" : + my_port = int(l[len(l)-1]) + pass + s = file.read() pass - pass + except: + pass -# if --modules (-m) command line option is not given -# try SALOME_MODULES environment variable -if not cmd_opts.has_key( "m" ) and os.getenv( "SALOME_MODULES" ): - args[modules_nam] = re.split( "[:;,]", os.getenv( "SALOME_MODULES" ) ) - pass + args[port_nam] = my_port -# 'terminal' must be processed in the end: to deny any 'gui' options -args[script_nam] = [] -if 't' in cmd_opts: - args[gui_nam] = 0 - args[script_nam] = cmd_opts['t'] - pass + # read command-line options + # each option given in command line overrides the option from xml config file + cmd_opts = {} + try: + cmd_opts = options_parser(sys.argv[1:]) + kernel_root_dir=os.environ["KERNEL_ROOT_DIR"] + except: + cmd_opts["h"] = 1 + pass -if args[except_nam] == 1: - os.environ["DISABLE_FPE"] = "1" - pass + # check if all command line options are correct + short_opts = ("h","g","l","f","x","m","e","s","c","p","k","t","i","r","z") + long_opts = (help_nam,gui_nam,logger_nam,file_nam,xterm_nam,modules_nam, + embedded_nam,standalone_nam,containers_nam,portkill_nam, + killall_nam,terminal_nam,interp_nam,except_nam,splash_nam, + case_nam) + opterror=0 + for opt in cmd_opts: + if opt not in short_opts and opt not in long_opts: + print "Configure parser: Error : command line error : -%s" % opt + opterror=1 + + if opterror == 1: + cmd_opts["h"] = 1 + + if cmd_opts.has_key("h") or cmd_opts.has_key(help_nam): + print """ + USAGE: runSalome.py [options] + + Command line options: + + --gui (-g) Launch in GUI mode [default]. + --terminal (-t) Launching without GUI (in the terminal mode). + --terminal=[,...] Launching without GUI (in the terminal mode) and + (-t=[,...]) additionally import python script(s). + --logger (-l) Redirect messages to the CORBA collector. + --file= (-f=) Redirect messages to the log file. + --xterm (-x) Launch each SALOME server in own xterm console. + --modules=,,... SALOME module list (where , + (-m=,,...) are the names of SALOME modules which should be + available in the SALOME session). + --embedded=,,... CORBA servers to be launched in the Session + (-e=,,...) embedded mode. + Valid values for : registry, study, + moduleCatalog, cppContainer + [default: all mentioned]. + --standalone=,,... CORBA servers to be launched in the standalone + (-s=,,...) mode (as separate processes). + Valid values for : registry, study, + moduleCatalog, cppContainer, pyContainer, + supervContainer + [default: pyContainer,supervContainer]. + --containers=,... [obsolete] SALOME containers to be launched. + (-c=,...) Valid values: cpp, python, superv + [default: use --embedded and --standalone + parameters]. + --portkill (-p) Kill SALOME with the current port. + --killall (-k) Kill all running SALOME sessions. + --interp= (-i=) The number of additional xterm sessions to open. + In each xterm session SALOME environment is set + properly. + --splash (-z) Display splash screen. + --noexcepthandler (-r) Disable centralized exception handling + mechanism. + --test= HDF file to be opened on GUI starting and/or + Python script(s) to be imported in the GUI + study. The files can appear in arbitrary order. + If the HDF file is given it is opened, otherwise + the new empty study is created. + Python scripts are imported in the order of + their appearance. + This option is avaiable only in GUI mode, + for batch mode use --terminal(-t) option. + --help (-h) Print this help info + + For each SALOME module, the environment variable _ROOT_DIR must be set. + KERNEL_ROOT_DIR is mandatory. + """ + sys.exit(1) + pass -# now modify SalomeAppConfig environment variable -dirs = re.split('[;|:]', os.environ[config_var] ) - -for m in args[modules_nam]: - if m not in ["KERNEL", "GUI", ""] and os.getenv("%s_ROOT_DIR"%m): - d1 = os.getenv("%s_ROOT_DIR"%m) + "/share/salome/resources/" + m.lower() - d2 = os.getenv("%s_ROOT_DIR"%m) + "/share/salome/resources" - if os.path.exists( "%s/%s.xml"%(d1, appname) ): - dirs.append( d1 ) - elif os.path.exists( "%s/%s.xml"%(d2, appname) ): - dirs.append( d2 ) -os.environ[config_var] = ":".join(dirs) + # apply command-line options to the arguments + BATCHMODE_FORCED = False + NO_SPLASH_FORCED = False + args[script_nam] = [] + for opt in cmd_opts: + if opt in [ 'g', gui_nam ] : + if not BATCHMODE_FORCED: args[gui_nam] = 1 + if cmd_opts[opt] == ['0']: + args["session_gui"] = 0 + NO_SPLASH_FORCED = True + pass + elif opt in [ 't', terminal_nam ] : + args[gui_nam] = 0 + args[script_nam] = cmd_opts[opt] + BATCHMODE_FORCED = True + elif opt in [ 'z', splash_nam ] : + if not NO_SPLASH_FORCED: + args[splash_nam] = 1 + if cmd_opts[opt] == ['0']: + args[splash_nam] = 0 + pass + pass + pass + elif opt in [ 'r', except_nam ] : + args[except_nam] = 1 + elif opt in [ 'l', logger_nam ] : + args[logger_nam] = 1 + elif opt in [ 'f', file_nam ] : + args[file_nam] = cmd_opts[opt] + elif opt in [ 'x', xterm_nam ] : + args[xterm_nam] = 1 + elif opt in [ 'i', interp_nam ] : + args[interp_nam] = cmd_opts[opt] + elif opt in [ 'm', modules_nam ] : + args[modules_nam] = cmd_opts[opt] + elif opt in [ 'e', embedded_nam ] : + args[embedded_nam] = cmd_opts[opt] + elif opt in [ 's', standalone_nam ] : + args[standalone_nam] = cmd_opts[opt] + elif opt in [ 'c', containers_nam ] : + args[containers_nam] = cmd_opts[opt] + elif opt in [ 'p', portkill_nam ] : + args[portkill_nam] = 1 + elif opt in [ 'k', killall_nam ] : + args[killall_nam] = 1 + elif opt in [ case_nam ] : + args[case_nam] = cmd_opts[opt] + pass + + # if --modules (-m) command line option is not given + # try SALOME_MODULES environment variable + if not cmd_opts.has_key( "m" ) and \ + not cmd_opts.has_key( modules_nam ) and \ + os.getenv( "SALOME_MODULES" ): + args[modules_nam] = re.split( "[:;,]", os.getenv( "SALOME_MODULES" ) ) + pass + + # disable signals handling + if args[except_nam] == 1: + os.environ["NOT_INTERCEPT_SIGNALS"] = "1" + pass + + # now modify SalomeAppConfig environment variable + # to take into account the SALOME modules + if os.sys.platform == 'win32': + dirs = re.split('[;]', os.environ[config_var] ) + else: + dirs = re.split('[;|:]', os.environ[config_var] ) + for m in args[modules_nam]: + if m not in ["KERNEL", "GUI", ""] and os.getenv("%s_ROOT_DIR"%m): + d1 = os.getenv("%s_ROOT_DIR"%m) + "/share/salome/resources/" + m.lower() + d2 = os.getenv("%s_ROOT_DIR"%m) + "/share/salome/resources" + if os.path.exists( "%s/%s.xml"%(d1, appname) ): + dirs.append( d1 ) + elif os.path.exists( "%s/%s.xml"%(d2, appname) ): + dirs.append( d2 ) + + # return arguments + os.environ[config_var] = separator.join(dirs) + return args diff --git a/bin/launchSalome.py b/bin/launchSalome.py new file mode 100755 index 000000000..08aea588a --- /dev/null +++ b/bin/launchSalome.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python + +import socket +import os +import sys +import shutil + +##################################################################### +def findFreePort(startPort, step) : + + currentPort = startPort; + if step < 1: + step = 1; + + serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM); + + portFound = 0; + while (portFound != 1 and currentPort < 65536): + try : + serversocket.bind((socket.gethostname(), currentPort)); + portFound = 1; + print str(currentPort) + ": " + "OK"; +# serversocket.shutdown(0); +# serversocket.close(); + except Exception, inst: + print str(currentPort) + ": " + str(inst.args); + currentPort = currentPort+step; + + + + + if (portFound != 1) : + currentPort = -1; + return currentPort; +##################################################################### + + + +## 1. Generate config file for omniORB: +# content: +# InitRef = NameService=corbaname::[HOST_NAME]:[PORT_NUMBER] + +freePort = findFreePort(2810, 1); +hostName = socket.gethostname(); + +if (len(sys.argv) > 1) and sys.argv[1] == "-nothing" : + print "port:" + str(freePort); + sys.exit(0) + + + + +if freePort < 0 : + print + print "Can't find a free port to launch omniNames" + print "Try to kill the running servers and then launch SALOME again." + print + sys.exit(0) + +else : + omniCfgFileContent = "InitRef = NameService=corbaname::" + str(hostName) + ":" + str(freePort); + omniCfgFilePath = os.environ.get('HOME') + "/" + ".omniORB_" + str(hostName) + "_" + str(freePort) + ".cfg"; + + omni_file = file(omniCfgFilePath,'w+'); + omni_file.write(omniCfgFileContent); + omni_file.write("\n"); + omni_file.close(); + + if (len(sys.argv) > 1) and sys.argv[1] == "--save-config" : + omniCfgCurrent = os.environ.get('HOME') + "/.omniORB_current.cfg"; + if os.name == "posix" : + #make a symbolic link + symlink(omniCfgFilePath, omniCfgCurrent); + else : + #copy the file + shutil.copy(omniCfgFilePath, omniCfgCurrent); + + omniCfgFilePath = omniCfgCurrent; + + + + + ## 2. Set the OMNIORB_CONFIG environment variable + os.environ['OMNIORB_CONFIG']=omniCfgFilePath; + + + ## 3. execute the file runSalome.py + runSalomePyFilePath = os.environ.get('KERNEL_ROOT_DIR') + "/bin/salome/runSalome.py"; + + if os.path.isfile(runSalomePyFilePath) : + execfile(runSalomePyFilePath); + diff --git a/bin/nameserver.py b/bin/nameserver.py new file mode 100755 index 000000000..aacb59ed9 --- /dev/null +++ b/bin/nameserver.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python + +import sys, os, re, socket +#import commands +from server import * +from Utils_Identity import getShortHostName + +# ----------------------------------------------------------------------------- + +class NamingServer(Server): + XTERM="" + USER=os.getenv('USER') + if USER is None: + USER='anonymous' + #os.system("mkdir -m 777 -p /tmp/logs") + LOGDIR="/tmp/logs/" + USER + + def initNSArgs(self): + if sys.platform == "win32": + # temporarily using home directory for Namning Service logs + # to be replaced with TEMP later... + os.environ["BaseDir"]=os.environ["HOME"] + else: + os.environ["BaseDir"]="/tmp" + + try: + os.mkdir(os.environ["BaseDir"] + "/logs") + os.chmod(os.environ["BaseDir"] + "/logs", 0777) + except: + #print "Can't create " + os.environ["BaseDir"] + "/logs" + pass + + upath = os.environ["BaseDir"] + "/logs/"; + if sys.platform == "win32": + upath += os.environ["Username"]; + else: + upath += os.environ["USER"]; + + try: + os.mkdir(upath) + except: + #print "Can't create " + upath + pass + + #os.system("touch " + upath + "/dummy") + for fname in os.listdir(upath): + try: + os.remove(upath + "/" + fname) + except: + pass + #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log") + + print "Name Service... " + #hname=os.environ["HOST"] #commands.getoutput("hostname") + if sys.platform == "win32": + hname=getShortHostName(); + else: + hname = socket.gethostname(); + + print "hname=",hname + + f=open(os.environ["OMNIORB_CONFIG"]) + ss=re.findall("NameService=corbaname::" + hname + ":\d+", f.read()) + print "ss = ", ss + f.close() + sl=ss[0] + ll = sl.split(':') + aPort = ll[-1] + #aPort=(ss.join().split(':'))[2]; + #aPort=re.findall("\d+", ss[0])[0] + + #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/" + #print "sed command = ", aSedCommand + #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"]) + print "port=", aPort + if sys.platform == "win32": + #print "start omniNames -start " + aPort + " -logdir " + upath + self.CMD=['omniNames -start ' , aPort , ' -logdir ' , '\"' + upath + '\"'] + #os.system("start omniNames -start " + aPort + " -logdir " + upath) + else: + #self.CMD=['omniNames -start ' , aPort , ' -logdir ' , upath , ' &'] + self.CMD=['omniNames','-start' , aPort, '-logdir' , upath ] + #os.system("omniNames -start " + aPort + " -logdir " + upath + " &") + + print "ok" + print "to list contexts and objects bound int the context with the specified name : showNS " + + + def initArgs(self): + Server.initArgs(self) + if sys.platform == "win32": + env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + os.getenv("PATH")] + else: + env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + os.getenv("LD_LIBRARY_PATH")] + self.CMD=['xterm', '-e']+ env_ld_library_path + ['python'] + self.initNSArgs() + + +# In LifeCycleCORBA, FactoryServer is started with rsh on the requested +# computer if this Container does not exist. Default is localhost. +# Others Containers are started with start_impl method of FactoryServer Container. +# For using rsh it is necessary to have in the ${HOME} directory a .rhosts file +# Warning : on RedHat the file /etc/hosts contains by default a line like : +# 127.0.0.1 bordolex bordolex.paris1.matra-dtv.fr localhost.localdomain localhost +# (bordolex is the station name). omniNames on bordolex will be accessible from other +# computers only if the computer name is removed on that line like : +# 127.0.0.1 bordolex.paris1.matra-dtv.fr localhost.localdomain localhost + +# To start dynamically Containers on several computers you need to +# put in the ${OMNIORB_CONFIG} file a computer name instead of "localhost" +# example : ORBInitRef NameService=corbaname::dm2s0017 + +# If you need to use several omniNames running on the same computer, you have to : +#1. put in your ${OMNIORB_CONFIG} file a computer name and port number +# example : ORBInitRef NameService=corbaname::dm2s0017:1515 +#2. start omninames with this port number like in orbmodile.py +# example : omniNames -start 1515 -logdir ${BaseDir}/logs/${Username} & diff --git a/bin/orbmodule.py b/bin/orbmodule.py index 86e67d6bf..86c89201e 100755 --- a/bin/orbmodule.py +++ b/bin/orbmodule.py @@ -18,50 +18,31 @@ # import sys,os,time import string +from nameserver import * from omniORB import CORBA # Import the stubs for the Naming service import CosNaming - -# ----------------------------------------------------------------------------- - -class Server: - XTERM="/usr/bin/X11/xterm -iconic -e " - CMD="" - - def run(self): - commande=self.XTERM+self.CMD - print commande - ier=os.system(commande) - if ier:print "Commande failed" - -# ----------------------------------------------------------------------------- - -class NamingServer(Server): - XTERM="" - USER=os.getenv('USER') - if USER is None: - USER='anonymous' - os.system("mkdir -m 777 -p /tmp/logs") - LOGDIR="/tmp/logs/" + USER - os.system("mkdir -m 777 -p " + LOGDIR) - CMD="runNS.sh > " + LOGDIR + "/salomeNS.log 2>&1" +#from runNS import * # ----------------------------------------------------------------------------- class client: - def __init__(self): + def __init__(self,args=None): #set GIOP message size for bug 10560: impossible to get field values in TUI mode sys.argv.extend(["-ORBgiopMaxMsgSize", "104857600"]) ## = 100 * 1024 * 1024 # Initialise the ORB self.orb=CORBA.ORB_init(sys.argv, CORBA.ORB_ID) # Initialise the Naming Service - self.initNS() + print "Obtain a reference to the root naming context" + print args + self.initNS(args) # -------------------------------------------------------------------------- - def initNS(self): + def initNS(self,args): + print "Obtain a reference to the root naming context" # Obtain a reference to the root naming context obj = self.orb.resolve_initial_references("NameService") try: @@ -72,7 +53,7 @@ class client: print "Lancement du Naming Service", # On lance le Naming Server (doit etre dans le PATH) - NamingServer().run() + NamingServer(args).run() print "Searching Naming Service ", ncount=0 delta=0.1 @@ -161,7 +142,9 @@ class client: if nobj is None: print "%s exists but is not a %s" % (name,typobj) return nobj - def waitNSPID(self, theName, thePID, theTypObj = None): + + if sys.platform != "win32": + def waitNSPID(self, theName, thePID, theTypObj = None): aCount = 0 aDelta = 0.5 anObj = None diff --git a/bin/runNS.py b/bin/runNS.py new file mode 100755 index 000000000..5af2c5af5 --- /dev/null +++ b/bin/runNS.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python + +#log files localization + +import os, commands, sys, re, string, socket +from Utils_Identity import getShortHostName + +if sys.platform == "win32": + # temporarily using home directory for Namning Service logs + # to be replaced with TEMP later... + os.environ["BaseDir"]=os.environ["HOME"] +else: + os.environ["BaseDir"]="/tmp" + +os.environ["Username"]=os.environ["USER"] + +# kill OmniNames if exists + +#killall -q -9 omniNames + +# clear log files + +def startOmni(): + try: + os.mkdir(os.environ["BaseDir"] + "/logs") + os.chmod(os.environ["BaseDir"] + "/logs", 0777) + except: + #print "Can't create " + os.environ["BaseDir"] + "/logs" + pass + + upath = os.environ["BaseDir"] + "/logs/" + os.environ["Username"] + + try: + os.mkdir(upath) + except: + #print "Can't create " + upath + pass + + #os.system("touch " + upath + "/dummy") + for fname in os.listdir(upath): + try: + os.remove(upath + "/" + fname) + except: + pass + #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log") + + print "Name Service... " + #hname=os.environ["HOST"] #commands.getoutput("hostname") + if sys.platform == "win32": + hname=getShortHostName() + else: + hname=socket.gethostname() + + print "hname=",hname + + f=open(os.environ["OMNIORB_CONFIG"]) + ss=re.findall("NameService=corbaname::" + hname + ":\d+", f.read()) + print "ss = ", ss + f.close() + aPort=re.findall("\d+", ss[0])[0] + + #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/" + #print "sed command = ", aSedCommand + #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"]) + global process_id + print "port=", aPort + if sys.platform == "win32": + #import win32pm + #command = ['omniNames -start ' , aPort , ' -logdir ' , '\"' + upath + '\"'] + #os.system("start omniNames -start " + aPort + " -logdir " + "\"" + upath + "\"" ) + command = "start omniNames -start " + aPort + " -logdir " + "\"" + upath + "\"" + #print command + pid = win32pm.spawnpid( string.join(command, " "), -nc ) + process_id[pid]=command + else: + os.system("omniNames -start " + aPort + " -logdir " + upath + " &") + + print "ok" + print "to list contexts and objects bound int the context with the specified name : showNS " + +# In LifeCycleCORBA, FactoryServer is started with rsh on the requested +# computer if this Container does not exist. Default is localhost. +# Others Containers are started with start_impl method of FactoryServer Container. +# For using rsh it is necessary to have in the ${HOME} directory a .rhosts file +# Warning : on RedHat the file /etc/hosts contains by default a line like : +# 127.0.0.1 bordolex bordolex.paris1.matra-dtv.fr localhost.localdomain localhost +# (bordolex is the station name). omniNames on bordolex will be accessible from other +# computers only if the computer name is removed on that line like : +# 127.0.0.1 bordolex.paris1.matra-dtv.fr localhost.localdomain localhost + +# To start dynamically Containers on several computers you need to +# put in the ${OMNIORB_CONFIG} file a computer name instead of "localhost" +# example : ORBInitRef NameService=corbaname::dm2s0017 + +# If you need to use several omniNames running on the same computer, you have to : +#1. put in your ${OMNIORB_CONFIG} file a computer name and port number +# example : ORBInitRef NameService=corbaname::dm2s0017:1515 +#2. start omninames with this port number in runNS.sh +# example : omniNames -start 1515 -logdir ${BaseDir}/logs/${Username} & diff --git a/bin/runSalome b/bin/runSalome index cf715b617..a898c8df3 100755 --- a/bin/runSalome +++ b/bin/runSalome @@ -1,48 +1,6 @@ #!/bin/bash -save_config=$1 - -searchFreePort() { - echo -n "Searching for a free port for naming service: " - export NSPORT=2810 - local limit=$NSPORT - let limit=limit+100 - while [ 1 ] - do - aRes=`netstat -ltn | grep -E :${NSPORT}` - if [ -z "$aRes" ]; then - echo ${NSPORT} - Ok - local myhost=`hostname` - export OMNIORB_CONFIG=${HOME}/.omniORB_${myhost}_${NSPORT}.cfg - local initref="NameService=corbaname::"`hostname`":$NSPORT" - export NSPORT - if [[ `python -c "import CORBA; print CORBA.ORB_ID"` == "omniORB4" ]]; then - echo "InitRef = $initref" > $OMNIORB_CONFIG - else - echo "ORBInitRef $initref" > $OMNIORB_CONFIG - fi - if [[ "$save_config" == "--save-config" ]] ; then - ln -sf $OMNIORB_CONFIG ${HOME}/.omniORB_current.cfg - export OMNIORB_CONFIG=${HOME}/.omniORB_current.cfg - fi - break - fi - echo -n "${NSPORT} " - if [[ $NSPORT -eq $limit ]] ; then - echo - echo "Can't find a free port to launch omniNames" - echo "Try to kill the running servers and then launch SALOME again." - exit - fi - let NSPORT=NSPORT+1 - done -} - -searchFreePort - -if [[ "$*" == "-nothing" ]]; then - echo "port:$NSPORT" -elif [ $# -ne 0 ] ; then +if [ $# -ne 0 ] ; then python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* else python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py diff --git a/bin/runSalome.py b/bin/runSalome.py index c19f4d045..00278fe96 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -21,229 +21,9 @@ import sys, os, string, glob, time, pickle import orbmodule - -process_id = {} - -# salome_subdir variable is used for composing paths like $KERNEL_ROOT_DIR/share/salome/resources/kernel, etc. -# before moving to SUIT-based gui, instead of salome_subdir there was args['appname'] used. -# but after - 'appname' = "SalomeApp", so using it in making the subdirectory is an error. -salome_subdir = "salome" - -# ----------------------------------------------------------------------------- - -def add_path(directory, variable_name): - """Function helper to add environment variables""" - if not os.environ.has_key(variable_name): - os.environ[variable_name] = "" - pass - if os.path.exists(directory): - newpath=[] - for _dir in os.environ[variable_name].split(":"): - if os.path.exists(_dir): - if not os.path.samefile(_dir, directory): - newpath.append(_dir) - else: - if os.path.abspath(_dir) != os.path.abspath(directory): - newpath.append(_dir) - pass - import string - newpath[:0] = [ directory ] - newpath = string.join(newpath,":") - os.environ[variable_name] = newpath - if variable_name == "PYTHONPATH": - sys.path[:0] = [directory] - -# ----------------------------------------------------------------------------- - -__lib__dir__ = None -def get_lib_dir(): - global __lib__dir__ - if __lib__dir__: return __lib__dir__ - import platform - if platform.architecture()[0] == "64bit": - __lib__dir__ = "lib64" - else: - __lib__dir__ = "lib" - return get_lib_dir() - -# ----------------------------------------------------------------------------- - -def get_config(): - """ - Get list of modules, paths. - - Read args from launch configure xml file and command line options. - Check variables _ROOT_DIR and set list of used modules. - Return args, modules_list, modules_root_dir - """ - - # read args from launch configure xml file and command line options - - import launchConfigureParser - args = launchConfigureParser.args - - # Check variables _ROOT_DIR - # and set list of used modules (without KERNEL) - - modules_list = [] - if args.has_key("modules"): - modules_list += args["modules"] - # KERNEL must be last in the list to locate it at the first place in PATH - if args["gui"] : - modules_list[:0] = ["GUI"] - modules_list[:0] = ["KERNEL"] - modules_list.reverse() - - modules_root_dir = {} - - to_remove_list=[] - for module in modules_list : - module_variable=module+"_ROOT_DIR" - if not os.environ.has_key(module_variable): - print "*******************************************************" - print "*" - print "* Environment variable",module_variable,"must be set" - print "* Module", module, "will be not available" - print "*" - print "********************************************************" - to_remove_list.append(module) - continue - pass - module_root_dir = os.environ[module_variable] - modules_root_dir[module]=module_root_dir - - for to_remove in to_remove_list: - modules_list.remove(to_remove) - - while "KERNEL" in modules_list: - modules_list.remove("KERNEL") - pass - - while "GUI" in modules_list: - modules_list.remove("GUI") - pass - - if "SUPERV" in modules_list and not 'superv' in args['standalone']: - args['standalone'].append("superv") - pass - - return args, modules_list, modules_root_dir - -# ----------------------------------------------------------------------------- - -def set_env(args, modules_list, modules_root_dir): - """Add to the PATH-variables modules specific paths""" - - python_version="python%d.%d" % sys.version_info[0:2] - modules_root_dir_list = [] - if args["gui"] : - modules_list = modules_list[:] + ["GUI"] - modules_list = modules_list[:] + ["KERNEL"] - for module in modules_list : - if modules_root_dir.has_key(module): - module_root_dir = modules_root_dir[module] - modules_root_dir_list[:0] = [module_root_dir] - add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir), - "LD_LIBRARY_PATH") - add_path(os.path.join(module_root_dir,"bin",salome_subdir), - "PATH") - if os.path.exists(module_root_dir + "/examples") : - add_path(os.path.join(module_root_dir,"examples"), - "PYTHONPATH") - pass - add_path(os.path.join(module_root_dir,"bin",salome_subdir), - "PYTHONPATH") - add_path(os.path.join(module_root_dir,get_lib_dir(), - python_version,"site-packages", - salome_subdir), - "PYTHONPATH") - add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir), - "PYTHONPATH") - add_path(os.path.join(module_root_dir,get_lib_dir(), - python_version,"site-packages", - salome_subdir, - "shared_modules"), - "PYTHONPATH") - pass - pass - - - os.environ["SALOMEPATH"]=":".join(modules_root_dir_list) - - # set trace environment variable - - if not os.environ.has_key("SALOME_trace"): - os.environ["SALOME_trace"]="local" - if args['file']: - os.environ["SALOME_trace"]="file:"+args['file'][0] - if args['logger']: - os.environ["SALOME_trace"]="with_logger" - - # set environment for SMESH plugins - - if "SMESH" in modules_list: - os.environ["SMESH_MeshersList"]="StdMeshers" - if not os.environ.has_key("SALOME_StdMeshersResources"): - os.environ["SALOME_StdMeshersResources"] \ - = modules_root_dir["SMESH"]+"/share/"+args["appname"]+"/resources/smesh" - pass - if args.has_key("SMESH_plugins"): - for plugin in args["SMESH_plugins"]: - plugin_root = "" - if os.environ.has_key(plugin+"_ROOT_DIR"): - plugin_root = os.environ[plugin+"_ROOT_DIR"] - else: - # workaround to avoid modifications of existing environment - if os.environ.has_key(plugin.upper()+"_ROOT_DIR"): - plugin_root = os.environ[plugin.upper()+"_ROOT_DIR"] - pass - pass - if plugin_root != "": - os.environ["SMESH_MeshersList"] \ - = os.environ["SMESH_MeshersList"]+":"+plugin - if not os.environ.has_key("SALOME_"+plugin+"Resources"): - os.environ["SALOME_"+plugin+"Resources"] \ - = plugin_root+"/share/"+args["appname"]+"/resources/"+plugin.lower() - add_path(os.path.join(plugin_root,get_lib_dir(),python_version, - "site-packages",salome_subdir), - "PYTHONPATH") - add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), - "PYTHONPATH") - add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), - "LD_LIBRARY_PATH") - add_path(os.path.join(plugin_root,"bin",salome_subdir), - "PYTHONPATH") - add_path(os.path.join(plugin_root,"bin",salome_subdir), - "PATH") - pass - pass - - # set environment for SUPERV module - os.environ["ENABLE_MACRO_NODE"]="1" - # set resources variables if not yet set - # Done now by launchConfigureParser.py - #if os.getenv("GUI_ROOT_DIR"): - #if not os.getenv("SalomeAppConfig"): os.environ["SalomeAppConfig"] = os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui" - - # set CSF_PluginDefaults variable only if it is not customized - # by the user - if not os.getenv("CSF_PluginDefaults"): - os.environ["CSF_PluginDefaults"] \ - = os.path.join(modules_root_dir["KERNEL"],"share", - salome_subdir,"resources","kernel") - os.environ["CSF_SALOMEDS_ResourcesDefaults"] \ - = os.path.join(modules_root_dir["KERNEL"],"share", - salome_subdir,"resources","kernel") - - if "GEOM" in modules_list: - print "GEOM OCAF Resources" - os.environ["CSF_GEOMDS_ResourcesDefaults"] \ - = os.path.join(modules_root_dir["GEOM"],"share", - salome_subdir,"resources","geom") - print "GEOM Shape Healing Resources" - os.environ["CSF_ShHealingDefaults"] \ - = os.path.join(modules_root_dir["GEOM"],"share", - salome_subdir,"resources","geom") +import setenv +from server import * +#process_id = {} move to server.py # ----------------------------------------------------------------------------- @@ -290,42 +70,12 @@ def kill_salome(args): killAllPorts() elif args['portkill']: givenPortKill(str(args['port'])) - + # ----------------------------------------------------------------------------- # # Definition des classes d'objets pour le lancement des Server CORBA # -class Server: - """Generic class for CORBA server launch""" - - def initArgs(self): - self.PID=None - self.CMD=[] - self.ARGS=[] - if self.args['xterm']: - self.ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-hold'] - - def __init__(self,args): - self.args=args - self.initArgs() - - - def run(self): - global process_id - myargs=self.ARGS - if self.args['xterm']: - # (Debian) send LD_LIBRARY_PATH to children shells (xterm) - env_ld_library_path=['env', 'LD_LIBRARY_PATH=' - + os.getenv("LD_LIBRARY_PATH")] - myargs = myargs +['-T']+self.CMD[:1]+['-e'] + env_ld_library_path - command = myargs + self.CMD - print "command = ", command - pid = os.spawnvp(os.P_NOWAIT, command[0], command) - process_id[pid]=self.CMD - self.PID = pid - - class InterpServer(Server): def __init__(self,args): self.args=args @@ -336,8 +86,12 @@ class InterpServer(Server): def run(self): global process_id command = self.CMD - #print "command = ", command - pid = os.spawnvp(os.P_NOWAIT, command[0], command) + print "INTERPSERVER::command = ", command + if sys.platform == "win32": + import win32pm + pid = win32pm.spawnpid( string.join(command, " "),'-nc' ) + else: + pid = os.spawnvp(os.P_NOWAIT, command[0], command) process_id[pid]=self.CMD self.PID = pid @@ -347,6 +101,9 @@ class CatalogServer(Server): def __init__(self,args): self.args=args self.initArgs() + #if sys.platform == "win32": + # self.SCMD1=[os.environ["KERNEL_ROOT_DIR"] + "/win32/" + os.environ["BIN_ENV"] + "/" + 'SALOME_ModuleCatalog_Server' + ".exe",'-common'] + #else: self.SCMD1=['SALOME_ModuleCatalog_Server','-common'] self.SCMD2=[] home_dir=os.getenv('HOME') @@ -367,23 +124,24 @@ class CatalogServer(Server): module_cata=module+"Catalog.xml" #print " ", module_cata if os.path.exists(os.path.join(module_root_dir, - "share",salome_subdir, + "share",setenv.salome_subdir, "resources",module.lower(), module_cata)): cata_path.extend( glob.glob(os.path.join(module_root_dir, - "share",salome_subdir, + "share",setenv.salome_subdir, "resources",module.lower(), module_cata))) else: cata_path.extend( glob.glob(os.path.join(module_root_dir, - "share",salome_subdir, + "share",setenv.salome_subdir, "resources", module_cata))) pass pass - self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2 + #self.CMD=self.SCMD1 + ['\"']+[string.join(cata_path,'\"::\"')] + ['\"'] + self.SCMD2 + self.CMD=self.SCMD1 + ['\"' + string.join(cata_path,'\"::\"') + '\"'] + self.SCMD2 # --- @@ -423,7 +181,10 @@ class ContainerPYServer(Server): def __init__(self,args): self.args=args self.initArgs() - self.CMD=['SALOME_ContainerPy.py','FactoryServerPy'] + if sys.platform == "win32": + self.CMD=[os.environ["PYTHONBIN"], '\"'+os.environ["KERNEL_ROOT_DIR"] + '/bin/salome/SALOME_ContainerPy.py'+'\"','FactoryServerPy'] + else: + self.CMD=['SALOME_ContainerPy.py','FactoryServerPy'] # --- @@ -431,6 +192,9 @@ class ContainerSUPERVServer(Server): def __init__(self,args): self.args=args self.initArgs() +# if sys.platform == "win32": +# self.CMD=[os.environ["KERNEL_ROOT_DIR"] + "/win32/" + os.environ["BIN_ENV"] + "/" + 'SALOME_Container' + ".exe",'SuperVisionContainer'] +# else: self.CMD=['SALOME_Container','SuperVisionContainer'] # --- @@ -439,7 +203,10 @@ class LoggerServer(Server): def __init__(self,args): self.args=args self.initArgs() - self.CMD=['SALOME_Logger_Server', 'logger.log'] + if sys.platform == "win32": + self.CMD=['SALOME_Logger_Server', os.environ["HOME"] + "/logger.log"]; + else: + self.CMD=['SALOME_Logger_Server', 'logger.log'] # --- @@ -451,6 +218,7 @@ class SessionServer(Server): # self.initArgs() self.SCMD1=['SALOME_Session_Server'] + self.SCMD2=[] if 'registry' in self.args['embedded']: self.SCMD1+=['--with','Registry', @@ -475,16 +243,23 @@ class SessionServer(Server): if 'supervContainer' in self.args['containers'] or 'supervContainer' in self.args['standalone']: self.SCMD2+=['SUPERV'] if self.args['gui']: - self.SCMD2+=['GUI'] + try: + session_gui = self.args['session_gui'] + except KeyError: + session_gui = 1 + pass + if session_gui: + self.SCMD2+=['GUI'] + pass + pass if self.args['splash'] and self.args['gui']: self.SCMD2+=['SPLASH'] if self.args['noexcepthandler']: self.SCMD2+=['noexcepthandler'] if self.args.has_key('modules'): - self.SCMD2+=['--modules ('] - for mod in self.args['modules']: - self.SCMD2+=[mod + ':'] - self.SCMD2+=[')'] + self.SCMD2+=['--modules (%s)'%":".join(self.args['modules'])] + if self.args.has_key('test') and len(args['test']) > 0: + self.SCMD2+=['--test=%s'%(",".join(args['test']))] def setpath(self,modules_list,modules_root_dir): cata_path=[] @@ -499,21 +274,23 @@ class SessionServer(Server): module_cata=module+"Catalog.xml" #print " ", module_cata if os.path.exists(os.path.join(module_root_dir, - "share",salome_subdir, + "share",setenv.salome_subdir, "resources",module.lower(), module_cata)): cata_path.extend( glob.glob(os.path.join(module_root_dir,"share", - salome_subdir,"resources", + setenv.salome_subdir,"resources", module.lower(),module_cata))) else: cata_path.extend( glob.glob(os.path.join(module_root_dir,"share", - salome_subdir,"resources", + setenv.salome_subdir,"resources", module_cata))) pass if (self.args["gui"]) & ('moduleCatalog' in self.args['embedded']): - self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2 + #Use '::' instead ":" because drive path with "D:\" is invalid on windows platform + #self.CMD=self.SCMD1 + ['\"']+[string.join(cata_path,'\"::\"')] + ['\"'] + self.SCMD2 + self.CMD=self.SCMD1 + ['\"' + string.join(cata_path,'\"::\"') + '\"'] + self.SCMD2 else: self.CMD=self.SCMD1 + self.SCMD2 @@ -550,7 +327,7 @@ class ContainerManagerServer(Server): module_cata=module+"Catalog.xml" #print " ", module_cata if os.path.exists(os.path.join(module_root_dir, - "share",salome_subdir, + "share",setenv.salome_subdir, "resources",module.lower(), module_cata)): cata_path.extend( @@ -611,7 +388,7 @@ def startSalome(args, modules_list, modules_root_dir): # Initialisation ORB et Naming Service # - clt=orbmodule.client() + clt=orbmodule.client(args) # (non obligatoire) Lancement Logger Server # et attente de sa disponibilite dans le naming service @@ -625,10 +402,12 @@ def startSalome(args, modules_list, modules_root_dir): # Notify Server launch # - print "Notify Server to launch" - myServer=NotifyServer(args,modules_root_dir) - myServer.run() + if sys.platform != "win32": + print "Notify Server to launch" + + myServer=NotifyServer(args,modules_root_dir) + myServer.run() # Lancement Session Server (to show splash ASAP) # @@ -646,7 +425,10 @@ def startSalome(args, modules_list, modules_root_dir): if ('registry' not in args['embedded']) | (args["gui"] == 0) : myServer=RegistryServer(args) myServer.run() - clt.waitNSPID("/Registry",myServer.PID) + if sys.platform == "win32": + clt.waitNS("/Registry") + else: + clt.waitNSPID("/Registry",myServer.PID) # # Lancement Catalog Server, @@ -659,7 +441,10 @@ def startSalome(args, modules_list, modules_root_dir): cataServer.setpath(modules_list,modules_root_dir) cataServer.run() import SALOME_ModuleCatalog - clt.waitNSPID("/Kernel/ModulCatalog",cataServer.PID,SALOME_ModuleCatalog.ModuleCatalog) + if sys.platform == "win32": + clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog) + else: + clt.waitNSPID("/Kernel/ModulCatalog",cataServer.PID,SALOME_ModuleCatalog.ModuleCatalog) # # Lancement SalomeDS Server, @@ -671,7 +456,10 @@ def startSalome(args, modules_list, modules_root_dir): print "RunStudy" myServer=SalomeDSServer(args) myServer.run() - clt.waitNSPID("/myStudyManager",myServer.PID) + if sys.platform == "win32": + clt.waitNS("/myStudyManager") + else: + clt.waitNSPID("/myStudyManager",myServer.PID) # # Lancement ContainerManagerServer @@ -707,7 +495,10 @@ def startSalome(args, modules_list, modules_root_dir): if 'cppContainer' in args['standalone']: myServer=ContainerCPPServer(args) myServer.run() - clt.waitNSPID("/Containers/" + theComputer + "/FactoryServer",myServer.PID) + if sys.platform == "win32": + clt.waitNS("/Containers/" + theComputer + "/FactoryServer") + else: + clt.waitNSPID("/Containers/" + theComputer + "/FactoryServer",myServer.PID) # # Lancement Container Python local, @@ -718,7 +509,10 @@ def startSalome(args, modules_list, modules_root_dir): if 'pyContainer' in args['standalone']: myServer=ContainerPYServer(args) myServer.run() - clt.waitNSPID("/Containers/" + theComputer + "/FactoryServerPy",myServer.PID) + if sys.platform == "win32": + clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy") + else: + clt.waitNSPID("/Containers/" + theComputer + "/FactoryServerPy",myServer.PID) # # Lancement Container Supervision local, @@ -729,8 +523,11 @@ def startSalome(args, modules_list, modules_root_dir): if 'supervContainer' in args['standalone']: myServer=ContainerSUPERVServer(args) myServer.run() - clt.waitNSPID("/Containers/" + theComputer + "/SuperVisionContainer",myServer.PID) - + if sys.platform == "win32": + clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer") + else: + clt.waitNSPID("/Containers/" + theComputer + "/SuperVisionContainer",myServer.PID) + # # Attente de la disponibilite du Session Server dans le Naming Service # @@ -745,8 +542,10 @@ def startSalome(args, modules_list, modules_root_dir): reload(SALOME) reload(SALOMEDS) import SALOME_Session_idl - session=clt.waitNSPID("/Kernel/Session",mySessionServ.PID,SALOME.Session) - + if sys.platform == "win32": + session=clt.waitNS("/Kernel/Session",SALOME.Session) + else: + session=clt.waitNSPID("/Kernel/Session",mySessionServ.PID,SALOME.Session) end_time = os.times() print print "Start SALOME, elapsed time : %5.1f seconds"% (end_time[4] @@ -789,6 +588,7 @@ def useSalome(args, modules_list, modules_root_dir): save list of process, give info to user, show registered objects in Naming Service. """ + global process_id clt=None try: @@ -846,13 +646,14 @@ def useSalome(args, modules_list, modules_root_dir): i = 0 while i < len( toimport ) : if toimport[ i ] == 'killall': - print "killall : option disabled" - #killAllPorts() + killAllPorts() + import sys + sys.exit(0) else: print 'importing',toimport[ i ] doimport = 'import ' + toimport[ i ] exec doimport - i = i + 1 + i = i + 1 return clt @@ -863,7 +664,12 @@ def registerEnv(args, modules_list, modules_root_dir): Register args, modules_list, modules_root_dir in a file for further use, when SALOME is launched embedded in an other application. """ - fileEnv = '/tmp/' + os.getenv('USER') + "_" + str(args['port']) \ + if sys.platform == "win32": + fileEnv = os.getenv('TEMP') + else: + fileEnv = '/tmp/' + + fileEnv += os.getenv('USER') + "_" + str(args['port']) \ + '_' + args['appname'].upper() + '_env' fenv=open(fileEnv,'w') pickle.dump((args, modules_list, modules_root_dir),fenv) @@ -872,6 +678,70 @@ def registerEnv(args, modules_list, modules_root_dir): # ----------------------------------------------------------------------------- +def searchFreePort(args, save_config=1): + print "Searching for a free port for naming service:", + NSPORT=2810 + limit=NSPORT + limit=limit+10 + while 1: + import os + status = os.system("netstat -ltn | grep -E :%s > /dev/null 2>&1"%(NSPORT)) + if status: + print "%s - OK"%(NSPORT) + # + from os import getpid + if sys.platform == "win32": + tmp_file = os.getenv('TEMP'); + else: + tmp_file = '/tmp/' + tmp_file += 'hostname_%s'%(getpid()) + #tmp_file = '/tmp/hostname_%s'%(getpid()) + from os import system + system('hostname > %s'%(tmp_file)) + f = open(tmp_file) + myhost = f.read() + myhost = myhost[:-1] + f.close() + system('rm -f %s'%(tmp_file)) + # + home = os.environ['HOME'] + appli=os.environ.get("APPLI") + if appli is not None: + home='%s/%s'%(home,appli) + pass + # + os.environ['OMNIORB_CONFIG'] = '%s/.omniORB_%s_%s.cfg'%(home, myhost, NSPORT) + initref = "NameService=corbaname::%s:%s"%(myhost, NSPORT) + os.environ['NSPORT'] = "%s"%(NSPORT) + os.environ['NSHOST'] = "%s"%(myhost) + f = open(os.environ['OMNIORB_CONFIG'], "w") + import CORBA + if CORBA.ORB_ID == "omniORB4": + f.write("InitRef = %s\n"%(initref)) + else: + f.write("ORBInitRef %s\n"%(initref)) + pass + f.close() + args['port'] = os.environ['NSPORT'] + # + if save_config: + from os import system + system('ln -sf %s %s/.omniORB_last.cfg'%(os.environ['OMNIORB_CONFIG'], home)) + pass + # + break + print "%s"%(NSPORT), + if NSPORT == limit: + msg = "\n" + msg += "Can't find a free port to launch omniNames\n" + msg += "Try to kill the running servers and then launch SALOME again.\n" + raise msg + NSPORT=NSPORT+1 + pass + return + +# ----------------------------------------------------------------------------- + def no_main(): """Salome Launch, when embedded in other application""" fileEnv = os.environ["SALOME_LAUNCH_CONFIG"] @@ -879,6 +749,7 @@ def no_main(): args, modules_list, modules_root_dir = pickle.load(fenv) fenv.close() kill_salome(args) + searchFreePort(args, 0) clt = useSalome(args, modules_list, modules_root_dir) return clt @@ -886,9 +757,29 @@ def no_main(): def main(): """Salome launch as a main application""" - args, modules_list, modules_root_dir = get_config() + import sys + if len(sys.argv) == 2: + if sys.argv[1] == "-nothing": + searchFreePort({}) + import os + print "port:%s"%(os.environ['NSPORT']) + import sys + sys.exit(0) + pass + pass + save_config = 1 + import sys + if len(sys.argv) > 1: + if sys.argv[1] == "--nosave-config": + save_config = 0 + sys.argv[1:2] = [] + pass + pass + # + args, modules_list, modules_root_dir = setenv.get_config() kill_salome(args) - set_env(args, modules_list, modules_root_dir) + searchFreePort(args, save_config) + setenv.main() clt = useSalome(args, modules_list, modules_root_dir) return clt,args diff --git a/bin/salomeConsole.py b/bin/salomeConsole.py index c7875d06c..8a429ddf5 100755 --- a/bin/salomeConsole.py +++ b/bin/salomeConsole.py @@ -79,7 +79,7 @@ print sys.argv #sys.argv=sys.argv+['-ORBInitRef','NameService=IOR:010000000100000000000000010000000000000023000000010100000a0000006c6f63616c686f737400fa0a0b0000004e616d6553657276696365'] class client(orbmodule.client): - def initNS(self): + def initNS(self,args): # Obtain a reference to the root naming context obj = self.orb.resolve_initial_references("NameService") try: diff --git a/bin/salome_session.py b/bin/salome_session.py index d43e144a7..870b53bc4 100644 --- a/bin/salome_session.py +++ b/bin/salome_session.py @@ -63,7 +63,7 @@ def searchFreePort(): f = open(omniorb_config, "w") f.write("ORBInitRef NameService=corbaname::%s:%s\n"%(hostname, NSPORT)) f.close() - last_running_config = '%s/.omniORB_%s_last.cfg'%(home, hostname) + last_running_config = '%s/.omniORB_last.cfg'%(home, hostname) os.environ['LAST_RUNNING_CONFIG'] = last_running_config if os.access(last_running_config,os.F_OK): os.unlink(last_running_config) diff --git a/bin/server.py b/bin/server.py new file mode 100755 index 000000000..88e74720e --- /dev/null +++ b/bin/server.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +import os, sys, string +process_id = {} + +# ----------------------------------------------------------------------------- +# +# Definition des classes d'objets pour le lancement des Server CORBA +# + +class Server: + """Generic class for CORBA server launch""" + + def initArgs(self): + self.PID=None + self.CMD=[] + self.ARGS=[] + if self.args['xterm']: + self.ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-hold'] + + def __init__(self,args): + self.args=args + self.initArgs() + + + def run(self): + global process_id + myargs=self.ARGS + if self.args['xterm']: + # (Debian) send LD_LIBRARY_PATH to children shells (xterm) + env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + + os.getenv("LD_LIBRARY_PATH")] + myargs = myargs +['-T']+self.CMD[:1]+['-e'] + env_ld_library_path + command = myargs + self.CMD + print "command = ", command + if sys.platform == "win32": + import win32pm + #cmd_str = "\"" + string.join(command, " ") + "\"" + #print cmd_str + #pid = win32pm.spawnpid( cmd_str ) + pid = win32pm.spawnpid( string.join(command, " "), '-nc' ) + #pid = win32pm.spawnpid( string.join(command, " ") ) + else: + pid = os.spawnvp(os.P_NOWAIT, command[0], command) + process_id[pid]=self.CMD + self.PID = pid diff --git a/bin/setenv.py b/bin/setenv.py new file mode 100755 index 000000000..4edecbfbf --- /dev/null +++ b/bin/setenv.py @@ -0,0 +1,264 @@ +#!/usr/bin/env python + +import sys, os, string, glob, time, pickle + +# this file is extraction of set_env from runSalome.py +# for reusage in automated tests + +# salome_subdir variable is used for composing paths like $KERNEL_ROOT_DIR/share/salome/resources, etc. +# before moving to SUIT-based gui, instead of salome_subdir there was args['appname'] used. +# but after - 'appname' = "SalomeApp", so using it in making the subdirectory is an error. +salome_subdir = "salome" + + +# ----------------------------------------------------------------------------- + +def add_path(directory, variable_name): + """Function helper to add environment variables""" + if sys.platform == "win32": + splitsym = ";" + else: + splitsym = ":" + if not os.environ.has_key(variable_name): + os.environ[variable_name] = "" + pass + if os.path.exists(directory): + newpath=[] + for _dir in os.environ[variable_name].split(splitsym): + if os.path.exists(_dir): + try: + if not os.path.samefile(_dir, directory): + newpath.append(_dir) + except: + if _dir != directory: + newpath.append(_dir) + + else: + if os.path.abspath(_dir) != os.path.abspath(directory): + newpath.append(_dir) + + pass + import string + newpath[:0] = [ directory ] + newpath = string.join(newpath, splitsym) + os.environ[variable_name] = newpath + if variable_name == "PYTHONPATH": + sys.path[:0] = [directory] + +# ----------------------------------------------------------------------------- +__lib__dir__ = None +def get_lib_dir(): + global __lib__dir__ + if __lib__dir__: return __lib__dir__ + import platform + if platform.architecture()[0] == "64bit": + __lib__dir__ = "lib64" + else: + __lib__dir__ = "lib" + return get_lib_dir() + +# ----------------------------------------------------------------------------- + +def get_config(): + """ + Get list of modules, paths. + + Read args from launch configure xml file and command line options. + Check variables _ROOT_DIR and set list of used modules. + Return args, modules_list, modules_root_dir + """ + + # read args from launch configure xml file and command line options + + import launchConfigureParser + args = launchConfigureParser.get_env() + + # Check variables _ROOT_DIR + # and set list of used modules (without KERNEL) + + modules_list = [] + if args.has_key("modules"): + modules_list += args["modules"] + # KERNEL must be last in the list to locate it at the first place in PATH + if args["gui"] : + modules_list[:0] = ["GUI"] + modules_list[:0] = ["KERNEL"] + modules_list.reverse() + + modules_root_dir = {} + + to_remove_list=[] + for module in modules_list : + module_variable=module.upper()+"_ROOT_DIR" + if not os.environ.has_key(module_variable): + print "*******************************************************" + print "*" + print "* Environment variable",module_variable,"must be set" + print "* Module", module, "will be not available" + print "*" + print "********************************************************" + to_remove_list.append(module) + continue + pass + module_root_dir = os.environ[module_variable] + modules_root_dir[module]=module_root_dir + + for to_remove in to_remove_list: + modules_list.remove(to_remove) + + while "KERNEL" in modules_list: + modules_list.remove("KERNEL") + pass + + while "GUI" in modules_list: + modules_list.remove("GUI") + pass + + if "SUPERV" in modules_list and not 'superv' in args['standalone']: + args['standalone'].append("superv") + pass + + return args, modules_list, modules_root_dir + +# ----------------------------------------------------------------------------- + +def set_env(args, modules_list, modules_root_dir): + """Add to the PATH-variables modules specific paths""" + + python_version="python%d.%d" % sys.version_info[0:2] + modules_root_dir_list = [] + if args["gui"] : + modules_list = modules_list[:] + ["GUI"] + modules_list = modules_list[:] + ["KERNEL"] + for module in modules_list : + if modules_root_dir.has_key(module): + module_root_dir = modules_root_dir[module] + modules_root_dir_list[:0] = [module_root_dir] + if sys.platform == "win32": + add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir), + "PATH") + else: + add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir), + "LD_LIBRARY_PATH") + add_path(os.path.join(module_root_dir,"bin",salome_subdir), + "PATH") + if os.path.exists(module_root_dir + "/examples") : + add_path(os.path.join(module_root_dir,"examples"), + "PYTHONPATH") + pass + add_path(os.path.join(module_root_dir,"bin",salome_subdir), + "PYTHONPATH") + # add lib before site-packages to load script instead of dll if any (win32 platform) + add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir), + "PYTHONPATH") + add_path(os.path.join(module_root_dir,get_lib_dir(), + python_version,"site-packages", + salome_subdir), + "PYTHONPATH") + add_path(os.path.join(module_root_dir,get_lib_dir(), + python_version,"site-packages", + salome_subdir, + "shared_modules"), + "PYTHONPATH") + pass + pass + + if sys.platform == 'win32': + os.environ["SALOMEPATH"]=";".join(modules_root_dir_list) + else: + os.environ["SALOMEPATH"]=":".join(modules_root_dir_list) + + # set trace environment variable + + if not os.environ.has_key("SALOME_trace"): + os.environ["SALOME_trace"]="local" + if args['file']: + os.environ["SALOME_trace"]="file:"+args['file'][0] + if args['logger']: + os.environ["SALOME_trace"]="with_logger" + + # set environment for SMESH plugins + + if "SMESH" in modules_list: + os.environ["SMESH_MeshersList"]="StdMeshers" + if not os.environ.has_key("SALOME_StdMeshersResources"): + os.environ["SALOME_StdMeshersResources"] \ + = modules_root_dir["SMESH"]+"/share/"+args["appname"]+"/resources/smesh" + pass + if args.has_key("SMESH_plugins"): + for plugin in args["SMESH_plugins"]: + plugin_root = "" + if os.environ.has_key(plugin+"_ROOT_DIR"): + plugin_root = os.environ[plugin+"_ROOT_DIR"] + else: + # workaround to avoid modifications of existing environment + if os.environ.has_key(plugin.upper()+"_ROOT_DIR"): + plugin_root = os.environ[plugin.upper()+"_ROOT_DIR"] + pass + pass + if plugin_root != "": + os.environ["SMESH_MeshersList"] \ + = os.environ["SMESH_MeshersList"]+":"+plugin + if not os.environ.has_key("SALOME_"+plugin+"Resources"): + os.environ["SALOME_"+plugin+"Resources"] \ + = plugin_root+"/share/"+args["appname"]+"/resources/"+plugin.lower() + add_path(os.path.join(plugin_root,get_lib_dir(),python_version, + "site-packages",salome_subdir), + "PYTHONPATH") + add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), + "PYTHONPATH") + + + if sys.platform == "win32": + add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), + "PATH") + else: + add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), + "LD_LIBRARY_PATH") + add_path(os.path.join(plugin_root,"bin",salome_subdir), + "PYTHONPATH") + add_path(os.path.join(plugin_root,"bin",salome_subdir), + "PATH") + pass + pass + + # set environment for SUPERV module + os.environ["ENABLE_MACRO_NODE"]="1" + # set resources variables if not yet set + # Done now by launchConfigureParser.py + #if os.getenv("GUI_ROOT_DIR"): + #if not os.getenv("SUITRoot"): os.environ["SUITRoot"] = os.getenv("GUI_ROOT_DIR") + "/share/salome" + #if not os.getenv("SalomeAppConfig"): os.environ["SalomeAppConfig"] = os.getenv("GUI_ROOT_DIR") + "/share/salome/resources" + + # set CSF_PluginDefaults variable only if it is not customized + # by the user + if not os.getenv("CSF_PluginDefaults"): + os.environ["CSF_PluginDefaults"] \ + = os.path.join(modules_root_dir["KERNEL"],"share", + salome_subdir,"resources","kernel") + os.environ["CSF_SALOMEDS_ResourcesDefaults"] \ + = os.path.join(modules_root_dir["KERNEL"],"share", + salome_subdir,"resources","kernel") + + if "GEOM" in modules_list: + print "GEOM OCAF Resources" + os.environ["CSF_GEOMDS_ResourcesDefaults"] \ + = os.path.join(modules_root_dir["GEOM"],"share", + salome_subdir,"resources","geom") + print "GEOM Shape Healing Resources" + os.environ["CSF_ShHealingDefaults"] \ + = os.path.join(modules_root_dir["GEOM"],"share", + salome_subdir,"resources","geom") + +# ----------------------------------------------------------------------------- + +def main(): + args, modules_list, modules_root_dir = get_config() + set_env(args, modules_list, modules_root_dir) + return args + +# ----------------------------------------------------------------------------- + +if __name__ == "__main__": + import user + args = main() diff --git a/bin/virtual_salome.py b/bin/virtual_salome.py index a8692b710..f77e6bfc3 100644 --- a/bin/virtual_salome.py +++ b/bin/virtual_salome.py @@ -30,6 +30,8 @@ install module KERNEL in the current directory import sys, os, optparse, shutil,glob,fnmatch py_version = 'python%s.%s' % (sys.version_info[0], sys.version_info[1]) +verbose=0 + # ----------------------------------------------------------------------------- def mkdir(path): @@ -87,13 +89,12 @@ def get_lib_dir(): # ----------------------------------------------------------------------------- def link_module(options): - global verbose if not options.module: print "Option module is mandatory" return - module_dir=options.module + module_dir=os.path.abspath(options.module) if not os.path.exists(module_dir): print "Module %s does not exist" % module_dir return diff --git a/configure.ac b/configure.ac index 7a62ca323..082ca0554 100644 --- a/configure.ac +++ b/configure.ac @@ -494,7 +494,7 @@ AC_OUTPUT([ \ ./salome_adm/Makefile \ ./salome_adm/unix/Makefile \ ./salome_adm/unix/config_files/Makefile \ - ./Makefile \ + Makefile \ ./bin/Makefile \ ./bin/VERSION \ ./bin/runIDLparser \ diff --git a/doc/INSTALL.txt b/doc/INSTALL.txt index b02493eab..7c01e348c 100644 --- a/doc/INSTALL.txt +++ b/doc/INSTALL.txt @@ -109,7 +109,6 @@ current version depends on the following list (versions given here are from Debian Sarge, except OpenCascade, VTK and MED, which are not Debian packages): -=================== =================================================== CAS-5.2.4 OpenCascade (try binaries,a source patch is needed) VTK-4.2.6 VTK 3D-viewer PyQt-3.13 Python-Qt Wrapper @@ -122,24 +121,19 @@ omniORB-4.0.5 ORB used in SALOME qt-x11-free-3.3.3 Qt library qwt-4.2 Graph components for Qt sip4-4.1.1 langage binding software -=================== =================================================== And, in order to build the documentation: -=================== =================================================== doxygen-1.4.2 graphviz-2.2.1 -=================== =================================================== Additionnal software may be installed for optional features: -=================== =================================================== netgen4.3 + patch tix8.1.4 openpbs-2.3.16 lsf-??? -=================== =================================================== diff --git a/doc/KERNEL_Services.txt b/doc/KERNEL_Services.txt index b348fcad3..c848838ee 100644 --- a/doc/KERNEL_Services.txt +++ b/doc/KERNEL_Services.txt @@ -36,7 +36,7 @@ SALOME services access from a Python shell See SALOME_Application_ for detailed instructions to launch a Python interpreter with full acces to the SALOME environment and services. -.. _SALOME_Application: ./SALOME_Application.html +.. _SALOME_Application: ./SALOME_Application.txt You can use the embedded Python interpreter in Grahic User Interface, or an external interpreter, with:: @@ -160,7 +160,7 @@ SWIG is very similar). .. _FileTransferCORBA: ./tui/KERNEL/classSALOME__FileTransferCORBA.html -The following example shows how to transfer a file from a remote host to the +The following example shows how to tranfer a file from a remote host to the client computer. Remote hostname is 'cli76cc', we would like to copy 'tkcvs_8_0_3.tar.gz' from remote to local computer. A full pathname is required. A container is created on remote computer if it does not exist, diff --git a/doc/salome/tui/KERNEL/sources/static/examples_Life_cycle.html b/doc/salome/tui/KERNEL/sources/static/examples_Life_cycle.html index 8d36282f6..080112eb4 100755 --- a/doc/salome/tui/KERNEL/sources/static/examples_Life_cycle.html +++ b/doc/salome/tui/KERNEL/sources/static/examples_Life_cycle.html @@ -1,116 +1,116 @@ - - - - - - - - Main Page - - - - -   -
- - - - - - - - -
- - -
-
- -

Examples

- //There is a CXX example of LifeCycleCORBA using
-

-#include CORBA_CLIENT_HEADER(TestComponent)
-#include "SALOME_NamingService.hxx"
-#include "SALOME_LifeCycleCORBA.hxx"
-
-int main (int argc, char * argv[]){
-  try {
-      // Initializing omniORB
-
      CORBA::ORB_var orb = CORBA::ORB_init(argc, -argv);
-   
-      // Obtain a reference -to the root POA
-
      CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") -;
-      PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) -;
-   
-      SALOME_NamingService _NS(orb) ;
-
-      SALOME_LifeCycleCORBA _LCC(&_NS) ;
-
-      Engines::Component_var myComponent = _LCC.FindOrLoad_Component("FactoryServerPy","TestComponentPy");
-       if(!CORBA::is_nil(myComponent)){
-          Engines::TestComponent_var -myConcreateComponent = TestComponent::_narrow(myComponent);
-          //do something -what you like with the interface
-          ...
-
          return 0;
-       }
-    }
-  catch(CORBA::COMM_FAILURE& ex){
-      cout<<"Caught system exception COMM_FAILURE --- unable to contact the object.\n";
-  }catch(CORBA::SystemException&){
-      cout<<"Caught a CORBA::SystemException.\n";
-  }catch(CORBA::Exception&){
-      cout<<"Caught CORBA::Exception.\n";
-  }catch(...){
-      cout<<"Caught unknown exception.\n";
-  }
-  return 1;
-}
-
-#The example may be rewritten on Python like this:
-

-from omniORB import CORBA
-from SALOME_TestComponent import *
-from SALOME_NamingServicePy import *
-from LifeCycleCORBA import *
-
-try:
-    orb = CORBA.ORB_init(sys.argv,CORBA.ORB_ID)
-    _NS = SALOME_NamingService(orb)
-    _LCC = SALOME_LifeCycleCORBA(orb)
-
-     myComponent = _LCC.FindOrLoadComponent("FactoryServerPy","TestComponentPy");
-     myConcreatComponent = myComponent._narrow(TestComponent)
-    if myConcreatComponent is not None :
-        //do something what you like with the -interface
-         ...
-
        return 0
-    }
-except CosNaming.NamingContext.NotFound, e :
-    print "Caught exception: Naming Service can't found Logger"
-except CORBA.COMM_FAILURE, e:
-    print "Caught CORBA::SystemException CommFailure"
-except CORBA.SystemException, e:
-    print "Caught CORBA::SystemException."
-except CORBA.Exception, e:
-    print "Caught CORBA::Exception."
-except Exception, e:
-    print "Caught unknown exception."
-  
-
-
- - + + + + + + + + Main Page + + + + +   +
+ + + + + + + + +
+ + +
+
+ +

Examples

+ //There is a CXX example of LifeCycleCORBA using
+

+#include CORBA_CLIENT_HEADER(TestComponent)
+#include "SALOME_NamingService.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
+
+int main (int argc, char * argv[]){
+  try {
+      // Initializing omniORB
+
      CORBA::ORB_var orb = CORBA::ORB_init(argc, +argv);
+   
+      // Obtain a reference +to the root POA
+
      CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") +;
+      PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) +;
+   
+      SALOME_NamingService _NS(orb) ;
+
+      SALOME_LifeCycleCORBA _LCC(&_NS) ;
+
+      Engines::Component_var myComponent = _LCC.FindOrLoad_Component("FactoryServerPy","TestComponentPy");
+       if(!CORBA::is_nil(myComponent)){
+          Engines::TestComponent_var +myConcreateComponent = TestComponent::_narrow(myComponent);
+          //do something +what you like with the interface
+          ...
+
          return 0;
+       }
+    }
+  catch(CORBA::COMM_FAILURE& ex){
+      cout<<"Caught system exception COMM_FAILURE +-- unable to contact the object.\n";
+  }catch(CORBA::SystemException&){
+      cout<<"Caught a CORBA::SystemException.\n";
+  }catch(CORBA::Exception&){
+      cout<<"Caught CORBA::Exception.\n";
+  }catch(...){
+      cout<<"Caught unknown exception.\n";
+  }
+  return 1;
+}
+
+#The example may be rewritten on Python like this:
+

+from omniORB import CORBA
+from SALOME_TestComponent import *
+from SALOME_NamingServicePy import *
+from LifeCycleCORBA import *
+
+try:
+    orb = CORBA.ORB_init(sys.argv,CORBA.ORB_ID)
+    _NS = SALOME_NamingService(orb)
+    _LCC = SALOME_LifeCycleCORBA(orb)
+
+     myComponent = _LCC.FindOrLoadComponent("FactoryServerPy","TestComponentPy");
+     myConcreatComponent = myComponent._narrow(TestComponent)
+    if myConcreatComponent is not None :
+        //do something what you like with the +interface
+         ...
+
        return 0
+    }
+except CosNaming.NamingContext.NotFound, e :
+    print "Caught exception: Naming Service can't found Logger"
+except CORBA.COMM_FAILURE, e:
+    print "Caught CORBA::SystemException CommFailure"
+except CORBA.SystemException, e:
+    print "Caught CORBA::SystemException."
+except CORBA.Exception, e:
+    print "Caught CORBA::Exception."
+except Exception, e:
+    print "Caught unknown exception."
+  
+
+
+ + diff --git a/doc/salome/tui/KERNEL/sources/static/examples_Study.html b/doc/salome/tui/KERNEL/sources/static/examples_Study.html index 31ccaffa5..859f6297f 100755 --- a/doc/salome/tui/KERNEL/sources/static/examples_Study.html +++ b/doc/salome/tui/KERNEL/sources/static/examples_Study.html @@ -1,790 +1,790 @@ - - - - - - - - Main Page - - - - -   -
- - - - - - - - -
- - -
-
- -

Examples

-
-
- -
      Interfaces:
-
-       SALOMEDS::Study
-       SALOMEDS::StudyBuilder
-       SALOMEDS::StudyManager
-       SALOMEDS::SObject
-      SALOMEDS::SComponent
-       SALOMEDS::SComponentIterator
-       SALOMEDS::ChildIterator
-
      SALOMEDS::AttributeComment
-      
-
-
-
-
- -
      SALOMEDS::Study interface
-
- -

-
-
-
-
SComponent FindComponent( -in string aComponentName )
-
- Find GEOMETRY component in the opened study by its name:

-
-     str= os.getenv("TmpDir")
-     if str == None:
-         str = "/tmp"
-     file = str+"/test.hdf"
-
-     openedStudy=batchmode_geompy.myStudyManager.Open(file)
-
-     father = openedStudy.FindComponent("GEOM")
-     if father is None:
-          raise  RuntimeError, "Geom - component is not found!  Wrong study is opened."
-
-
-
- -
SObject FindObject ( in string -anObjectName )
-
- Find the SObject of the box by its NameAttribute "box":
-
- -

-
- -
box = openedStudy.FindObject("box")
- if box is None :
-     raise  RuntimeError, "box was not found! Wrong -study is opened."
-
-
- SObject FindObjectID - ( in ID aObjectID -)
- #result: "/User data/Case1".
-
Find - the SObject of the box by its ID "0:1:1:2":
-
-
- -
box =openedStudy.FindObjectID("0:1:1:2")
-
- -
if box is None :
-     raise  RuntimeError, "box was not found! Wrong -ID is used."
-
-
- SObject FindObjectIOR - ( in ID  aObjectIOR -)
-
- Find the SObject of the result on imported MED file -by it's IOR:
-
- theResult = myVisu.ImportFile(medFile)
- aSObj = myStudy.FindObjectIOR(theResult.GetID())
-
-
- SObject - FindObjectByPath ( in string thePath )
-
- Find SObject by path to it:
-
- # create new auxiliary componen
t
- aComponent = myStudyBuilder.NewComponent("Virtual Component")
-
- # create auxiliary subtree
- aPath = "/Virtual Component/Case1"
- myStudyBuilder.AddDirectory(aPath)
-
- aSObj = myStudy.FindObjectByPath(aPath)
-
-
- void SetContext ( in string thePath) / - string GetContext ()
-
- Set context of the study to the created case and get it for printing:
-
- aComponent = myStudyBuilder.NewComponent("User data")
- anAttr = aBuilder.FindOrCreateAttribute(aComponent, "AttributeName")
- anAttrName = anAttr._narrow(SALOMEDS.AttributeName)
- anAttrName.SetValue("User data")
-
- #Add a new case 'Case1' to the component 'User data'
- aBuilder.AddDirectory("/User data/Case1")
-
- #Set a study context to '/User data/Case1'
- aStudy.SetContext("/User data/Case1")
-
- #Print the current study context
- print aStudy.GetContext()
-
-
#result: "/User data/Case1".

-
-
- ChildIterator - NewChildIterator ( in SObject aSO )
-
- Import med file and print all mesh names that this file includes -(mesh is a child of the result of imported file):
-
- # define file name
- aFileName = datadir + "fra.med"
-
- # import file in visu module and get result
- theVisu = batchmode_visu.myVisu
- aResult = theVisu.ImportFile(aFileName)
- if aResult is None : raise RuntimeError, "Error"
- else : print "OK"
-  
- # get current study and its' SObject        -
- myLocalStudy = theVisu.GetCurrentStudy()
- aSObj = myLocalStudy.FindObjectIOR(aResult.GetID())
- if aSObj is None : raise RuntimeError, "Error"
- else : print "OK"
-
- # create iterator by SObject of the current study
- aMeshIter = myLocalStudy.NewChildIterator(aSObj);
-
- # iterating in the current study (with the help of created iterator) -to find all mesh names  
- while aMeshIter.More() :
-         aMeshSObj = aMeshIter.Value()
-         aMeshIter.Next()
-         anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
-         if anAttr is None :
-             aMeshSObj - = aMeshIter.Value()
-             aMeshIter.Next()
-             anAttr - = aMeshSObj.FindAttribute("AttributeName")[1]
-         anAttr = anAttr._narrow(SALOMEDS.AttributeName);
-         aMeshName = anAttr.Value()
-         print "  ", aMeshName
-
-
- SComponentIterator -NewComponentIterator ()
-
- Find the number an names of all components in the study:
-
- aCompItr = myStudy.NewComponentIterator()
-
- compNb = 0
- while aCompItr.More():
-     aComp = aCompItr.Value()
-     aName = aComp.ComponentDataType()
-     print "Component name = ", aName
-     compNb += 1
-     aCompItr.Next()
-
-
- StudyBuilder -NewBuilder ()
-
-
-
- Create a new StudyBuilder (uses to add or modify an object in the -study ):
-
- myBuilder = myStudy.NewBuilder()
-
-
- AttributeStudyProperties -GetProperties ()
-
- Get the attribute, which contains the properties of the study, and -change properties of the study by changing it:
-
- aProperties = myStudy.GetProperties()
- if aProperties == None :
-     raise  RuntimeError, "Can't create AttributeStudyProperties -attribute"
- aProperties = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
-
- A = aProperties
-
- # print stydy properties
- print "A.GetUserName()= ", A.GetUserName()
- res,mm,hh,dd,mnth,yy=A.GetCreationDate()
- print "A.GetCreationDate() = ", mm,hh,dd,mnth,yy
- print "A.GetCreationMode() = ", A.GetCreationMode()
- print "A.IsModified() = ", A.IsModified()
- print "A.IsLocked() = ", A.IsLocked()
-
- # change the properties of the study
- if A.IsLocked() == 0 :
-     A.SetUserName("tester"); print 'A.SetUserName("tester"), -A.GetUserName() = ', A.GetUserName()
-     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), -A.GetCreationDate() =', A.GetCreationDate()
-     print "A.IsModified() = ", A.IsModified()
- A.SetLocked(1)
-
-
- boolean IsModified ()
-
- Find if study is modified:
-
- IsModified = myStudy.IsModified()
-
- if IsModified == 1:
-     print "The study is modified and not saved"
-
-
- boolean IsEmpty ()
-
- Find if study is empty:
-
- IsEmpty = myStudy.IsEmpty()
-
- if IsEmpty == 1:
-     print "The study is empty"
-
-
-
-
- -
SALOMEDS::StudyBuilder -interface
-
-
-
-
- SComponent -NewComponent ( in string ComponentDataType )
-
- Create Geometry SComponent:
-
- myBuilder = myStudy.NewBuilder()
- father = myBuilder.NewComponent("GEOM")
-
-
- void DefineComponentInstance ( in SComponent aComponent, -in Object ComponentIOR )

-
- Define the instance to the created geometry component:
-
- # find geom component
- myLCC = batchmode_salome.lcc
- geom = myLCC.FindOrLoadComponent("FactoryServer", "Geometry")
- geom = geom._narrow(GEOM.GEOM_Gen)
- geom.GetCurrentStudy(myStudyId)
-
- myBuilder = myStudy.NewBuilder()
-
- father = myBuilder.NewComponent("GEOM")
- myBuilder.DefineComponentInstance(father,geom)
-
-
- SObject -NewObject ( in SObject theFatherObject -)
-
- Create box and add it to study:
-
- from batchmode_geompy import *
-
- # create a box
- box = geom.MakeBox(0,0,0,100,100,150)
-
- ior = orb.object_to_string(box)
- box._set_Name(ior)     
-
- # create Geometry SComponent
- father = myBuilder.NewComponent("GEOM")
- A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName");
- FName = A1._narrow(SALOMEDS.AttributeName)
- FName.SetValue("Geometry")
- myBuilder.DefineComponentInstance(father,geom)
-
- # add box to Study
- myBuilder.NewCommand()
- newObj = myBuilder.NewObject(father)
- A1 = myBuilder.FindOrCreateAttribute(newObj, "AttributeIOR");
- ObjIOR = A1._narrow(SALOMEDS.AttributeIOR)
- ObjIOR.SetValue(ior)
- A2 = myBuilder.FindOrCreateAttribute(newObj, "AttributeName");
- ObjName = A2._narrow(SALOMEDS.AttributeName)
- ObjName.SetValue("Common_operation")
- id = newObj.GetID()
- box._set_StudyShapeId(id)
- myBuilder.CommitCommand()
-
-
- void RemoveObject ( in SObject anObject )
-
- # Remove CutPlanes SObject from the StudyBuilder (delete cutplanes):
-
- SObj=myStudy.FindObjectIOR(cutplanes.GetID())
- myBuilder = newStudy.NewBuilder()
- myBuilder.RemoveObject(SObj)
-
-
- void LoadWith ( in SComponent sco, in -Driver Engine -) raises (SALOME::SALOME_Exception)

-
- # Load Visu component:
-
- myBuilder = openedStudy.NewBuilder()
- SCom=openedStudy.FindComponent("VISU")
- myBuilder.LoadWith(SCom ,myVisu)
-
-
- GenericAttribute -FindOrCreateAttribute ( in SObject anObject,  -in string aTypeOfAttribute)
-
- Create AttributeName attribute for created component an set value -to it:
-
- myBuilder = myStudy.NewBuilder()
- aComponent = myBuilder.NewComponent("User data")
-
- anAttr = myBuilder.FindOrCreateAttribute(aComponent, "AttributeName")
-
- anAttrName = anAttr._narrow(SALOMEDS.AttributeName)
- anAttrName.SetValue("User data")
-
-
- boolean FindAttribute ( in SObject anObject, out GenericAttribute -anAttribute, in string aTypeOfAttribute )
-
-
Find AttributeName attribute of the field and print the -field name:
-
- aFieldSObj  = myStudy.FindObject("Head, -")
-
- myStudyBuilder.FindAttribute( aFieldSObj, anAttr, "AttributeName")
- if res == 0:
-     raise  RuntimeError, "Error:  Attribute not -found"
-
- anAttr = anAttr._narrow(SALOMEDS.AttributeName);
- aFieldName = anAttr.Value()
- print "      ", aFieldName
-
-
- void RemoveAttribute ( in SObject anObject, in -string aTypeOfAttribute )
-
-
Remove AttributeSelectable attribute of the field SObject:
-
-
aFieldSObj  = myStudy.FindObject("Head, -")
-
- myStudyBuilder.RemoveAttribute( aFieldSObj, "AttributeSelectable")
-
-
-
void Addreference ( in  SObject -anObject, in  SObject theReferencedObject -)

-
- Create a reference between created SObject and the existing field:
-
- aFieldSObj  = myStudy.FindObject("Head, -")
- aNewSObj = myBuilder.NewObject(myVisu)
-
- myBuilder.Addreference(aFieldSObj, aNewSObj)
-
-
-
void -NewCommand ()
-
-
Create new command wich containes actions for changing the -properties of the study:
-
-
A = myStudy.GetProperties()
- A = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
-
- myBuilder = myStudy.NewBuilder()
-
- myBuilder.NewCommand() # creates a new command
-
- # change the properties of the study
- if A.IsLocked() == 0 :
-     A.SetUserName("tester"); print 'A.SetUserName("tester"), -A.GetUserName() = ', A.GetUserName()
-     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), -A.GetCreationDate() =', A.GetCreationDate()
-     print "A.IsModified() = ", A.IsModified()
- A.SetLocked(1)
-
-
myBuilder.CommitCommand() # commits all actions declared -within the created command
-
-
- void CommitCommand()
-

-
See the end of the previous example
-
-
- void AbortCommand ()

-
- Create new command wich containes actions for changing -the properties of the study, cancel all declared actions:
-
- A = myStudy.GetProperties()
- A = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
-
- myBuilder = myStudy.NewBuilder()
-
- myBuilder.NewCommand() # creates a new command
-
- # change the properties of the study
- if A.IsLocked() == 0 :
-     A.SetUserName("tester"); print 'A.SetUserName("tester"), -A.GetUserName() = ', A.GetUserName()
-     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), -A.GetCreationDate() =', A.GetCreationDate()
-     print "A.IsModified() = ", A.IsModified()
- A.SetLocked(1)
-
-
myBuilder.AbortCommand() # abort all actions declared -within the created command
-
-
- void Undo () raises (LockProtection) -,
- void Redo () raises (LockProtection)
-
- Create new command wich containes actions for changing -the properties of the study,
- cancel all declared actions and then redo it with the help of undo/redo -mechanism:

-
- A = myStudy.GetProperties()
- A = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
-
- myBuilder = myStudy.NewBuilder()
-
- myBuilder.NewCommand() # creates a new command
-
- # change the properties of the study
- if A.IsLocked() == 0 :
-     A.SetUserName("tester"); print 'A.SetUserName("tester"), -A.GetUserName() = ', A.GetUserName()
-     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), -A.GetCreationDate() =', A.GetCreationDate()
-     print "A.IsModified() = ", A.IsModified()
- A.SetLocked(1)
-
-
myBuilder.CommitCommand() # commits all actions declared -within the created command
-
-
myBuilder.Undo() # cancels all actions of the command
-
-
myBuilder.Redo() # redoes all actions of the command
-
-
-
-
-
SALOMEDS::StudyManager -interface
-
-
-
-
-
Study -NewStudy ( in string study_name )
-
- Create the study with the name "Test_Study":

-
- myNewStudy = myStudyManager.NewStudy("Test_Study")
-
-
- Study Open -( in URL -aStudyUrl ) raises (SALOME::SALOME_Exception)
-
- Open the study saved in the HDF file:
-
- file = 'saved_study.hdf'
-
- openedStudy=myStudyManager.Open(file)
-
- if openedStudy == None:
-     raise  RuntimeError, "Can't open saved study!"
-
-
- void Save (in Study aStudy, in boolean -theMultifile )
-
-
Open study, import med file into it and save with the old -path and filename:
-
-
file = "saved_study.hdf"
- myMedFile ="medfile.med"
-
- openedStudy=myStudyManager.Open(file)
-
- myVisu.SetCurrentStudy(openedStudy)
- myResult = myVisu.ImportFile(myMedFile)
-
- myStudyManager.Save(openedStudy, 0)
-
-
- void SaveAs ( in URL -aUrl, in  Study aStudy, - 
in boolean theMultifile -)
-
- Open study from the file and resave it in several files (using -Multifile option while saving)
-
-
file = "saved_study.hdf"
- newfile = "resaved_study.hdf"
-
- openedStudy=myStudyManager.Open(file)
- myStudyManager.SaveAs(newfile, openedStudy, 1)
-
-
- void Close ( in  Study aStudy )

-
- Close just opened study:
-
- file = "saved_study.hdf"
-
- openedStudy=myStudyManager.Open(file)
- myStudyManager.Close(openedStudy)
-
-
-
- -
SALOMEDS::SObject interface
-
-
-
-
- ID GetID ()
-
- Create new SObject and get its ID:
-
- mySObj = myBuilder.NewObject(myFather)
-
- myID =  mySObj.GetID()
-
-
- SComponent -GetFatherComponent ()
-
- Get father component of the SObject:
-
- myFather = mySObj.GetFatherComponent();
-
-
- boolean FindAttribute ( out GenericAttribute anAttribute, -in string aTypeOfAttribute )
-
- Find the AttributeName attribute of the field:
-
- aFieldSObj  = myStudy.FindObject("Head, -")
-
- res = aFieldSObj.FindAttribute( anAttr, "AttributeName")
- if res == 0:
-     raise  RuntimeError, "Error:  Attribute not -found"
-
-
- ListOfAttributes -GetAllAttributes ()
-
- Get list of all attributes of the SObject, find the number of attributes:
-
- attrs = mySObj.GetAllAttributes()
- aLen = len(attrs) # number of attributes
-
-
-
-
- -
SALOMEDS::SComponent interface
-
-
-
-
- string ComponentDataType ()
-
- Print names of all components wich -the study contains:
-
- aCompItr = myStudy.NewComponentIterator()
-
- while aCompItr.More():
-     aComp = aCompItr.Value()
-     aName = aComp.ComponentDataType()
-     print "Component name = ", aName
-     aCompItr.Next()
-
-
- Other methods are inherited.
-
-
-
-
- -
SALOMEDS::SComponentIterator - interface
-
-
-
-
- boolean More (), void Next (), SComponent Value -()
-
- See another -example
-
-   
-
- -
SALOMEDS::ChildIterator - interface
-
-
-
-
- boolean More () , void Next (), SObject Value ()
-
- Print all mesh names of imported MED file with the help of ChildIterator:
-
- aResult = myVisu.ImportFile("MedFile.med")
-        
- myStudy = theVisu.GetCurrentStudy()
- aSObj = myLocalStudy.FindObjectIOR(aResult.GetID())
-
- aMeshIter = myLocalStudy.NewChildIterator(aSObj);  # creating new -child iterator
-
- while aMeshIter.More() :               -                      -           # check if one more -child level exists.
-         aMeshSObj = aMeshIter.Value() -                  -         # returns the SObject corresponding -to the current object found by the iterator.  
-         aMeshIter.Next()     -                      -                      -   # passes the iterator to the next level.
-         anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
-         if anAttr is None :
-                 -aMeshSObj = aMeshIter.Value()
-               -  aMeshIter.Next()
-                 -anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
-         anAttr = anAttr._narrow(SALOMEDS.AttributeName);
-         aMeshName = anAttr.Value()
-         print "  ", aMeshName
-
-
-
- -
SALOMEDS::AttributeComment - interface
-
-
-
- string Value (),  void SetValue ( in string value )
-
- Find the AttributeComment attribute of the "Head" field in the study, -print it, then change it to "My Comment" string:
-
- aFieldSObj  = myStudy.FindObject("Head, -")
- anAttr = aFieldSObj.FindAttribute("AttributeComment")[1]
-                     -anAttr = anAttr._narrow(SALOMEDS.AttributeComment);
-                     -aFieldComment = anAttr.Value()
-
- print "AttributeComment", anAttr
-
- anAttr.SetValue ("My Comment")
- -

- 
- - + + + + + + + + Main Page + + + + +   +
+ + + + + + + + +
+ + +
+
+ +

Examples

+
+
+ +
      Interfaces:
+
+       SALOMEDS::Study
+       SALOMEDS::StudyBuilder
+       SALOMEDS::StudyManager
+       SALOMEDS::SObject
+      SALOMEDS::SComponent
+       SALOMEDS::SComponentIterator
+       SALOMEDS::ChildIterator
+
      SALOMEDS::AttributeComment
+      
+
+
+
+
+ +
      SALOMEDS::Study interface
+
+ +

+
+
+
+
SComponent FindComponent( +in string aComponentName )
+
+ Find GEOMETRY component in the opened study by its name:

+
+     str= os.getenv("TmpDir")
+     if str == None:
+         str = "/tmp"
+     file = str+"/test.hdf"
+
+     openedStudy=batchmode_geompy.myStudyManager.Open(file)
+
+     father = openedStudy.FindComponent("GEOM")
+     if father is None:
+          raise  RuntimeError, "Geom + component is not found!  Wrong study is opened."
+
+
+
+ +
SObject FindObject ( in string +anObjectName )
+
+ Find the SObject of the box by its NameAttribute "box":
+
+ +

+
+ +
box = openedStudy.FindObject("box")
+ if box is None :
+     raise  RuntimeError, "box was not found! Wrong +study is opened."
+
+
+ SObject FindObjectID + ( in ID aObjectID +)
+ #result: "/User data/Case1".
+
Find + the SObject of the box by its ID "0:1:1:2":
+
+
+ +
box =openedStudy.FindObjectID("0:1:1:2")
+
+ +
if box is None :
+     raise  RuntimeError, "box was not found! Wrong +ID is used."
+
+
+ SObject FindObjectIOR + ( in ID  aObjectIOR +)
+
+ Find the SObject of the result on imported MED file +by it's IOR:
+
+ theResult = myVisu.ImportFile(medFile)
+ aSObj = myStudy.FindObjectIOR(theResult.GetID())
+
+
+ SObject + FindObjectByPath ( in string thePath )
+
+ Find SObject by path to it:
+
+ # create new auxiliary componen
t
+ aComponent = myStudyBuilder.NewComponent("Virtual Component")
+
+ # create auxiliary subtree
+ aPath = "/Virtual Component/Case1"
+ myStudyBuilder.AddDirectory(aPath)
+
+ aSObj = myStudy.FindObjectByPath(aPath)
+
+
+ void SetContext ( in string thePath) / + string GetContext ()
+
+ Set context of the study to the created case and get it for printing:
+
+ aComponent = myStudyBuilder.NewComponent("User data")
+ anAttr = aBuilder.FindOrCreateAttribute(aComponent, "AttributeName")
+ anAttrName = anAttr._narrow(SALOMEDS.AttributeName)
+ anAttrName.SetValue("User data")
+
+ #Add a new case 'Case1' to the component 'User data'
+ aBuilder.AddDirectory("/User data/Case1")
+
+ #Set a study context to '/User data/Case1'
+ aStudy.SetContext("/User data/Case1")
+
+ #Print the current study context
+ print aStudy.GetContext()
+
+
#result: "/User data/Case1".

+
+
+ ChildIterator + NewChildIterator ( in SObject aSO )
+
+ Import med file and print all mesh names that this file includes +(mesh is a child of the result of imported file):
+
+ # define file name
+ aFileName = datadir + "fra.med"
+
+ # import file in visu module and get result
+ theVisu = batchmode_visu.myVisu
+ aResult = theVisu.ImportFile(aFileName)
+ if aResult is None : raise RuntimeError, "Error"
+ else : print "OK"
+  
+ # get current study and its' SObject        +
+ myLocalStudy = theVisu.GetCurrentStudy()
+ aSObj = myLocalStudy.FindObjectIOR(aResult.GetID())
+ if aSObj is None : raise RuntimeError, "Error"
+ else : print "OK"
+
+ # create iterator by SObject of the current study
+ aMeshIter = myLocalStudy.NewChildIterator(aSObj);
+
+ # iterating in the current study (with the help of created iterator) +to find all mesh names  
+ while aMeshIter.More() :
+         aMeshSObj = aMeshIter.Value()
+         aMeshIter.Next()
+         anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
+         if anAttr is None :
+             aMeshSObj + = aMeshIter.Value()
+             aMeshIter.Next()
+             anAttr + = aMeshSObj.FindAttribute("AttributeName")[1]
+         anAttr = anAttr._narrow(SALOMEDS.AttributeName);
+         aMeshName = anAttr.Value()
+         print "  ", aMeshName
+
+
+ SComponentIterator +NewComponentIterator ()
+
+ Find the number an names of all components in the study:
+
+ aCompItr = myStudy.NewComponentIterator()
+
+ compNb = 0
+ while aCompItr.More():
+     aComp = aCompItr.Value()
+     aName = aComp.ComponentDataType()
+     print "Component name = ", aName
+     compNb += 1
+     aCompItr.Next()
+
+
+ StudyBuilder +NewBuilder ()
+
+
+
+ Create a new StudyBuilder (uses to add or modify an object in the +study ):
+
+ myBuilder = myStudy.NewBuilder()
+
+
+ AttributeStudyProperties +GetProperties ()
+
+ Get the attribute, which contains the properties of the study, and +change properties of the study by changing it:
+
+ aProperties = myStudy.GetProperties()
+ if aProperties == None :
+     raise  RuntimeError, "Can't create AttributeStudyProperties +attribute"
+ aProperties = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
+
+ A = aProperties
+
+ # print stydy properties
+ print "A.GetUserName()= ", A.GetUserName()
+ res,mm,hh,dd,mnth,yy=A.GetCreationDate()
+ print "A.GetCreationDate() = ", mm,hh,dd,mnth,yy
+ print "A.GetCreationMode() = ", A.GetCreationMode()
+ print "A.IsModified() = ", A.IsModified()
+ print "A.IsLocked() = ", A.IsLocked()
+
+ # change the properties of the study
+ if A.IsLocked() == 0 :
+     A.SetUserName("tester"); print 'A.SetUserName("tester"), +A.GetUserName() = ', A.GetUserName()
+     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), +A.GetCreationDate() =', A.GetCreationDate()
+     print "A.IsModified() = ", A.IsModified()
+ A.SetLocked(1)
+
+
+ boolean IsModified ()
+
+ Find if study is modified:
+
+ IsModified = myStudy.IsModified()
+
+ if IsModified == 1:
+     print "The study is modified and not saved"
+
+
+ boolean IsEmpty ()
+
+ Find if study is empty:
+
+ IsEmpty = myStudy.IsEmpty()
+
+ if IsEmpty == 1:
+     print "The study is empty"
+
+
+
+
+ +
SALOMEDS::StudyBuilder +interface
+
+
+
+
+ SComponent +NewComponent ( in string ComponentDataType )
+
+ Create Geometry SComponent:
+
+ myBuilder = myStudy.NewBuilder()
+ father = myBuilder.NewComponent("GEOM")
+
+
+ void DefineComponentInstance ( in SComponent aComponent, +in Object ComponentIOR )

+
+ Define the instance to the created geometry component:
+
+ # find geom component
+ myLCC = batchmode_salome.lcc
+ geom = myLCC.FindOrLoadComponent("FactoryServer", "Geometry")
+ geom = geom._narrow(GEOM.GEOM_Gen)
+ geom.GetCurrentStudy(myStudyId)
+
+ myBuilder = myStudy.NewBuilder()
+
+ father = myBuilder.NewComponent("GEOM")
+ myBuilder.DefineComponentInstance(father,geom)
+
+
+ SObject +NewObject ( in SObject theFatherObject +)
+
+ Create box and add it to study:
+
+ from batchmode_geompy import *
+
+ # create a box
+ box = geom.MakeBox(0,0,0,100,100,150)
+
+ ior = orb.object_to_string(box)
+ box._set_Name(ior)     
+
+ # create Geometry SComponent
+ father = myBuilder.NewComponent("GEOM")
+ A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName");
+ FName = A1._narrow(SALOMEDS.AttributeName)
+ FName.SetValue("Geometry")
+ myBuilder.DefineComponentInstance(father,geom)
+
+ # add box to Study
+ myBuilder.NewCommand()
+ newObj = myBuilder.NewObject(father)
+ A1 = myBuilder.FindOrCreateAttribute(newObj, "AttributeIOR");
+ ObjIOR = A1._narrow(SALOMEDS.AttributeIOR)
+ ObjIOR.SetValue(ior)
+ A2 = myBuilder.FindOrCreateAttribute(newObj, "AttributeName");
+ ObjName = A2._narrow(SALOMEDS.AttributeName)
+ ObjName.SetValue("Common_operation")
+ id = newObj.GetID()
+ box._set_StudyShapeId(id)
+ myBuilder.CommitCommand()
+
+
+ void RemoveObject ( in SObject anObject )
+
+ # Remove CutPlanes SObject from the StudyBuilder (delete cutplanes):
+
+ SObj=myStudy.FindObjectIOR(cutplanes.GetID())
+ myBuilder = newStudy.NewBuilder()
+ myBuilder.RemoveObject(SObj)
+
+
+ void LoadWith ( in SComponent sco, in +Driver Engine +) raises (SALOME::SALOME_Exception)

+
+ # Load Visu component:
+
+ myBuilder = openedStudy.NewBuilder()
+ SCom=openedStudy.FindComponent("VISU")
+ myBuilder.LoadWith(SCom ,myVisu)
+
+
+ GenericAttribute +FindOrCreateAttribute ( in SObject anObject,  +in string aTypeOfAttribute)
+
+ Create AttributeName attribute for created component an set value +to it:
+
+ myBuilder = myStudy.NewBuilder()
+ aComponent = myBuilder.NewComponent("User data")
+
+ anAttr = myBuilder.FindOrCreateAttribute(aComponent, "AttributeName")
+
+ anAttrName = anAttr._narrow(SALOMEDS.AttributeName)
+ anAttrName.SetValue("User data")
+
+
+ boolean FindAttribute ( in SObject anObject, out GenericAttribute +anAttribute, in string aTypeOfAttribute )
+
+
Find AttributeName attribute of the field and print the +field name:
+
+ aFieldSObj  = myStudy.FindObject("Head, -")
+
+ myStudyBuilder.FindAttribute( aFieldSObj, anAttr, "AttributeName")
+ if res == 0:
+     raise  RuntimeError, "Error:  Attribute not +found"
+
+ anAttr = anAttr._narrow(SALOMEDS.AttributeName);
+ aFieldName = anAttr.Value()
+ print "      ", aFieldName
+
+
+ void RemoveAttribute ( in SObject anObject, in +string aTypeOfAttribute )
+
+
Remove AttributeSelectable attribute of the field SObject:
+
+
aFieldSObj  = myStudy.FindObject("Head, -")
+
+ myStudyBuilder.RemoveAttribute( aFieldSObj, "AttributeSelectable")
+
+
+
void Addreference ( in  SObject +anObject, in  SObject theReferencedObject +)

+
+ Create a reference between created SObject and the existing field:
+
+ aFieldSObj  = myStudy.FindObject("Head, -")
+ aNewSObj = myBuilder.NewObject(myVisu)
+
+ myBuilder.Addreference(aFieldSObj, aNewSObj)
+
+
+
void +NewCommand ()
+
+
Create new command wich containes actions for changing the +properties of the study:
+
+
A = myStudy.GetProperties()
+ A = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
+
+ myBuilder = myStudy.NewBuilder()
+
+ myBuilder.NewCommand() # creates a new command
+
+ # change the properties of the study
+ if A.IsLocked() == 0 :
+     A.SetUserName("tester"); print 'A.SetUserName("tester"), +A.GetUserName() = ', A.GetUserName()
+     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), +A.GetCreationDate() =', A.GetCreationDate()
+     print "A.IsModified() = ", A.IsModified()
+ A.SetLocked(1)
+
+
myBuilder.CommitCommand() # commits all actions declared +within the created command
+
+
+ void CommitCommand()
+

+
See the end of the previous example
+
+
+ void AbortCommand ()

+
+ Create new command wich containes actions for changing +the properties of the study, cancel all declared actions:
+
+ A = myStudy.GetProperties()
+ A = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
+
+ myBuilder = myStudy.NewBuilder()
+
+ myBuilder.NewCommand() # creates a new command
+
+ # change the properties of the study
+ if A.IsLocked() == 0 :
+     A.SetUserName("tester"); print 'A.SetUserName("tester"), +A.GetUserName() = ', A.GetUserName()
+     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), +A.GetCreationDate() =', A.GetCreationDate()
+     print "A.IsModified() = ", A.IsModified()
+ A.SetLocked(1)
+
+
myBuilder.AbortCommand() # abort all actions declared +within the created command
+
+
+ void Undo () raises (LockProtection) +,
+ void Redo () raises (LockProtection)
+
+ Create new command wich containes actions for changing +the properties of the study,
+ cancel all declared actions and then redo it with the help of undo/redo +mechanism:

+
+ A = myStudy.GetProperties()
+ A = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
+
+ myBuilder = myStudy.NewBuilder()
+
+ myBuilder.NewCommand() # creates a new command
+
+ # change the properties of the study
+ if A.IsLocked() == 0 :
+     A.SetUserName("tester"); print 'A.SetUserName("tester"), +A.GetUserName() = ', A.GetUserName()
+     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), +A.GetCreationDate() =', A.GetCreationDate()
+     print "A.IsModified() = ", A.IsModified()
+ A.SetLocked(1)
+
+
myBuilder.CommitCommand() # commits all actions declared +within the created command
+
+
myBuilder.Undo() # cancels all actions of the command
+
+
myBuilder.Redo() # redoes all actions of the command
+
+
+
+
+
SALOMEDS::StudyManager +interface
+
+
+
+
+
Study +NewStudy ( in string study_name )
+
+ Create the study with the name "Test_Study":

+
+ myNewStudy = myStudyManager.NewStudy("Test_Study")
+
+
+ Study Open +( in URL +aStudyUrl ) raises (SALOME::SALOME_Exception)
+
+ Open the study saved in the HDF file:
+
+ file = 'saved_study.hdf'
+
+ openedStudy=myStudyManager.Open(file)
+
+ if openedStudy == None:
+     raise  RuntimeError, "Can't open saved study!"
+
+
+ void Save (in Study aStudy, in boolean +theMultifile )
+
+
Open study, import med file into it and save with the old +path and filename:
+
+
file = "saved_study.hdf"
+ myMedFile ="medfile.med"
+
+ openedStudy=myStudyManager.Open(file)
+
+ myVisu.SetCurrentStudy(openedStudy)
+ myResult = myVisu.ImportFile(myMedFile)
+
+ myStudyManager.Save(openedStudy, 0)
+
+
+ void SaveAs ( in URL +aUrl, in  Study aStudy, + 
in boolean theMultifile +)
+
+ Open study from the file and resave it in several files (using +Multifile option while saving)
+
+
file = "saved_study.hdf"
+ newfile = "resaved_study.hdf"
+
+ openedStudy=myStudyManager.Open(file)
+ myStudyManager.SaveAs(newfile, openedStudy, 1)
+
+
+ void Close ( in  Study aStudy )

+
+ Close just opened study:
+
+ file = "saved_study.hdf"
+
+ openedStudy=myStudyManager.Open(file)
+ myStudyManager.Close(openedStudy)
+
+
+
+ +
SALOMEDS::SObject interface
+
+
+
+
+ ID GetID ()
+
+ Create new SObject and get its ID:
+
+ mySObj = myBuilder.NewObject(myFather)
+
+ myID =  mySObj.GetID()
+
+
+ SComponent +GetFatherComponent ()
+
+ Get father component of the SObject:
+
+ myFather = mySObj.GetFatherComponent();
+
+
+ boolean FindAttribute ( out GenericAttribute anAttribute, +in string aTypeOfAttribute )
+
+ Find the AttributeName attribute of the field:
+
+ aFieldSObj  = myStudy.FindObject("Head, -")
+
+ res = aFieldSObj.FindAttribute( anAttr, "AttributeName")
+ if res == 0:
+     raise  RuntimeError, "Error:  Attribute not +found"
+
+
+ ListOfAttributes +GetAllAttributes ()
+
+ Get list of all attributes of the SObject, find the number of attributes:
+
+ attrs = mySObj.GetAllAttributes()
+ aLen = len(attrs) # number of attributes
+
+
+
+
+ +
SALOMEDS::SComponent interface
+
+
+
+
+ string ComponentDataType ()
+
+ Print names of all components wich +the study contains:
+
+ aCompItr = myStudy.NewComponentIterator()
+
+ while aCompItr.More():
+     aComp = aCompItr.Value()
+     aName = aComp.ComponentDataType()
+     print "Component name = ", aName
+     aCompItr.Next()
+
+
+ Other methods are inherited.
+
+
+
+
+ +
SALOMEDS::SComponentIterator + interface
+
+
+
+
+ boolean More (), void Next (), SComponent Value +()
+
+ See another +example
+
+   
+
+ +
SALOMEDS::ChildIterator + interface
+
+
+
+
+ boolean More () , void Next (), SObject Value ()
+
+ Print all mesh names of imported MED file with the help of ChildIterator:
+
+ aResult = myVisu.ImportFile("MedFile.med")
+        
+ myStudy = theVisu.GetCurrentStudy()
+ aSObj = myLocalStudy.FindObjectIOR(aResult.GetID())
+
+ aMeshIter = myLocalStudy.NewChildIterator(aSObj);  # creating new +child iterator
+
+ while aMeshIter.More() :               +                      +           # check if one more +child level exists.
+         aMeshSObj = aMeshIter.Value() +                  +         # returns the SObject corresponding +to the current object found by the iterator.  
+         aMeshIter.Next()     +                      +                      +   # passes the iterator to the next level.
+         anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
+         if anAttr is None :
+                 +aMeshSObj = aMeshIter.Value()
+               +  aMeshIter.Next()
+                 +anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
+         anAttr = anAttr._narrow(SALOMEDS.AttributeName);
+         aMeshName = anAttr.Value()
+         print "  ", aMeshName
+
+
+
+ +
SALOMEDS::AttributeComment + interface
+
+
+
+ string Value (),  void SetValue ( in string value )
+
+ Find the AttributeComment attribute of the "Head" field in the study, +print it, then change it to "My Comment" string:
+
+ aFieldSObj  = myStudy.FindObject("Head, -")
+ anAttr = aFieldSObj.FindAttribute("AttributeComment")[1]
+                     +anAttr = anAttr._narrow(SALOMEDS.AttributeComment);
+                     +aFieldComment = anAttr.Value()
+
+ print "AttributeComment", anAttr
+
+ anAttr.SetValue ("My Comment")
+ +

+ 
+ + diff --git a/doc/salome/tui/KERNEL/sources/static/mapping.html b/doc/salome/tui/KERNEL/sources/static/mapping.html index 21ead079f..f3f0a3f53 100755 --- a/doc/salome/tui/KERNEL/sources/static/mapping.html +++ b/doc/salome/tui/KERNEL/sources/static/mapping.html @@ -1,329 +1,329 @@ - - - - - - Main Page - - - -  -
- - - - - -
-
-
- -

-Mapping of IDL definitions to Python language.

- -

-Introduction

-SALOME is a distributed client/server application using the Common -Object Request Broker Architecture (CORBA). CORBA architecture uses the -Interface Definition Language (IDL), which specifies interfaces between -CORBA objects. So with help of IDL CORBA's language independence is ensured -. Because interfaces described in IDL can be mapped to the most of currently -used programming languages, CORBA applications and components are thus -independent of the language(s) used to implement them. In other words, -a client written in C++ can communicate with a server written in Java, -which in turn can communicate with another server written in COBOL, and -so forth. -

One important thing to remember about IDL is that it is not an implementation -language. That is, applications can't be written in IDL. The sole purpose -of IDL is to define interfaces; providing implementations for these interfaces -is performed using some other language. -

This page contains an abridged reference manual for mapping of IDL definitions -to Python language. It will be useful for Python programmers who are not -familiar with IDL language. All examples are taken from SALOME source -files. The complete version of Python Language Mapping Specification can -be found here. -
  -

CONTENTS: -

-
- -

-Using Scoped Names

-Python implements a module concept that is similar to the IDL scoping mechanisms, -except that it does not allow for nested modules. In addition, Python requires -each object to be implemented in a module; globally visible objects are -not supported. -

Because of these constraints, scoped names are translated into Python -using the following rules: -

• An IDL module mapped into a Python module. Modules containing modules -are mapped to packages (i.e., directories with an __init__ module -containing all definitions excluding the nested modules). An implementation -can chose to map toplevel definitions (including the module CORBA) to modules -in an implementationdefined package, to allow concurrent installations -of different CORBA runtime libraries. In that case, the implementation -must provide additional modules so that toplevel modules can be used without -importing them from a package. -

• For all other scopes, a Python class is introduced that contains all -the definitions inside this scope. -

• Other global definitions (except modules) appear in a module whose -name is implementation dependent. Implementations are encouraged to use -the name of the IDL file when defining the name of that module. -

For instance, -

-
module SALOMEDS {
- interface StudyManager {
-  void  Close(in Study aStudy);
- };
-};
-
-would introduce a module SALOMEDS.py, which contains the following definitions: -
-
# module SALOMEDS.py
-class StudyManager:
-  def _Close(self,aStudy):
-   pass #interfaces are discussed later
-
-To avoid conflicts, IDL names that are also Python identifiers are prefixed -with an underscore (‘_’). -

Back to the contents -

-

-Mapping for Template and Array Types

-Both the bounded and the unbounded string type of IDL are mapped to the -Python string type. Wide strings are represented by an implementation-defined -type with the following properties: -

• For the wide string X and the integer n, X[n] returns the nth character, -which is a wide string of length 1. -

• len(X) returns the number of characters of wide string X. -

• CORBA.wstr(c) returns a wide character with the code point c in an -implementation-defined encoding. -

• X+Y returns the concatenation of wide strings X and Y. -

• CORBA.word(CORBA.wstr(c)) == c -

The sequence template is mapped to sequence objects (e.g., tuples or -lists). Applications should not assume that values of a sequence type are -mutable. Sequences and arrays of octets and characters are mapped to the -string type for efficiency reasons. -

For example, given the IDL definitions -

-
module SALOMEDS {
-  typedef sequence <string> StringSeq;
-   
-   interface AttributeTableOfInteger : GenericAttribute {
-
-    void SetRowTitles(in StringSeq theTitles) raises(IncorrectArgumentLength);
- };
-};
-
-a client could invoke the operation -
-
print My_AttributeTableOfInteger.SetRowTitles(["X","F"])
-
-Array types are mapped like sequence templates. The application in this -example also expects an IncorrectArgumentLength exception if it passes -sequences that violate the bounds constraint or arrays of wrong size. -

Another example with arrays. The following IDL definition -

-
module SALOMEDS {
- typedef sequence<GenericAttribute> ListOfAttributes;
- interface SObject {
-  ListOfAttributes     GetAllAttributes();
- };
-};
-
-is equal to -
-
import SALOMEDS
-
-attributes=[]
- 
-attributes = My_SObject.GetAllAttributes()
-
-length = len(attributes)
-
-print "Attributes number = ", length
-print attributes
-
-Back to the contents -

-

-Mapping for Objects and Operations

-A CORBA object reference is represented as a Python object at run-time. -This object provides all the operations that are available on the interface -of the object. Although this specification does not mandate the use of -classes for stub objects, the following discussion uses classes to indicate -the interface. -

The nil object is represented by None. -

If an operation expects parameters of the IDL Object type, any Python -object representing an object reference might be passed as actual argument. -

If an operation expects a parameter of an abstract interface, either -an object implementing that interface, or a value supporting this interface -may be passed as actual argument. The semantics of abstract values then -define whether the argument is passed by value or by reference. -

Operations of an interface map to methods available on the object references. -Parameters with a parameter attribute of in or inout are -passed from left to right tothe method, skipping out parameters. -The return value of a method depends on the number of out parameters -and the return type. If the operation returns a value, this value forms -the first result value. All inout or out parameters -form consecutive result values. The method result depends then on -the number of result values: -

• If there is no result value, the method returns None. -

• If there is exactly one result value, it is returned as a single -value. -

• If there is more than one result value, all of them are packed -into a tuple, and this tuple is returned. -

Assuming the IDL definition -

-
module SALOMEDS{
- interface StudyBuilder{
-  boolean FindAttribute  ( in SObject anObject, 
-                           out GenericAttribute anAttribute, 
-                           in string aTypeOfAttribute );
- };
-};
-
-a client could write -
-
from SALOMEDS import StudyBuilder;
-my_StudyBuilder=...
-  
-  res,A=my_StudyBuilder.FindAttribute(Sobj, "AttributeSequenceOfReal")
-
-In this example A corresponds to the return value anAttribute -and res to the boolean return value. -

If an interface defines an attribute name, for example, the attribute -is mapped into an operation _get_name. If the attribute is not readonly, -there is an additional operation _set_name. -

The IDL definition -

-
module SALOMEDS{
- interface Study{
-  attribute string Name;
- };
-};
-
-is equal to the following -
-
from SALOMEDS import Study
-My_Study=...
-  Name=My_Study._get_name();
-  Name=My_Study._set_name();
-
-Back to the contents -

-

-Narrowing Object References

-Python objects returned from CORBA operations or pseudo-operations (such -as string_to_object) might have a dynamic type, which is more specific -than the static type as defined in the operation signature. -

Since there is no efficient and reliable way of automatically creating -the most specific type, explicit narrowing is necessary. To narrow an object -reference A to an interface class AttributeSequenceOfReal, -the client can use the following operation -

-
A = A._narrow(SALOMEDS.AttributeSequenceOfReal)
-
-Back to the contents -

-

-Mapping for Exceptions

-An IDL exception is translated into a Python class derived from CORBA.UserException. -System exceptions are derived from CORBA.SystemException. Both base classes -are derived from CORBA.Exception. The parameters of the exception are mapped -in the same way as the fields of a struct definition. When raising an exception, -a new instance of the class is created; the constructor expects the exception -parameters. For example, the definition -
-
module SALOMEDS{
- interface StudyBuilder{
-  exception LockProtection {};
-  void CommitCommand() raises(LockProtection);
- };
-};
-
-could be used caught as -
-
from SALOMEDS import StudyBuilder;
-my_StudyBuilder=...
-try:
-  my_StudyBuilder.CommitCommand();
-except StudyBuilder.LockProtection,value:
-  print "Error! Study is locked for modifications"
-
- -


Back to the contents -

-

-Mapping for Enumeration Types

-An enumeration is mapped into a number of constant objects in the name -space where the enumeration is defined. An application may only test for -equivalence of two enumeration values, and not assume that they behave -like numbers. For example, the definition -
-
module VISU {
- interface PrsObject{
- 
-  enum PrsObjType{ TCURVE, TTABLE, TMESH, TCONTAINER,
-                   TSCALARMAP, TISOSURFACE, TDEFORMEDSHAPE,
-                   TCUTPLANES, TVECTORS };
- };
-};
-
-introduces the objects -
-
from VISU import PrsObject
-VISU.PrsObjType.TCURVE,VISU.PrsObjType.TTABLE,VISU.PrsObjType.TMESH,VISU.PrsObjType.TCONTAINER,
-VISU.PrsObjType.TSCALARMAP,VISU.PrsObjType.TISOSURFACE,VISU.PrsObjType.TDEFORMEDSHAPE,VISU.PrsObjType.TCUTPLANES,
-VISU.PrsObjType.TVECTORS
-
-Back to the contents -

-

-Mapping for Structured Types

-An IDL struct definition is mapped into a Python class or type. For each -field in the struct, there is a corresponding attribute in the class with -the same name as the field. The constructor of the class expects the field -values, from left to right. For example, the IDL definition -
-
struct SDate {
-               short Second;
-               short Minute;
-               short Hour;
-               short Day;
-               short Month;
-               short Year;
-             };
-
-could be used in the Python statements -
-
Date=SDate(30, 12, 15, 26, 1, 79)
-print Date.Second,Date.Minute,Date.Hour,Date.Day,Date.Month,Date.Year
-
- -
-Back to the contents
- - - - + + + + + + Main Page + + + +  +
+ + + + + +
+
+
+ +

+Mapping of IDL definitions to Python language.

+ +

+Introduction

+SALOME is a distributed client/server application using the Common +Object Request Broker Architecture (CORBA). CORBA architecture uses the +Interface Definition Language (IDL), which specifies interfaces between +CORBA objects. So with help of IDL CORBA's language independence is ensured +. Because interfaces described in IDL can be mapped to the most of currently +used programming languages, CORBA applications and components are thus +independent of the language(s) used to implement them. In other words, +a client written in C++ can communicate with a server written in Java, +which in turn can communicate with another server written in COBOL, and +so forth. +

One important thing to remember about IDL is that it is not an implementation +language. That is, applications can't be written in IDL. The sole purpose +of IDL is to define interfaces; providing implementations for these interfaces +is performed using some other language. +

This page contains an abridged reference manual for mapping of IDL definitions +to Python language. It will be useful for Python programmers who are not +familiar with IDL language. All examples are taken from SALOME source +files. The complete version of Python Language Mapping Specification can +be found here. +
  +

CONTENTS: +

+
+ +

+Using Scoped Names

+Python implements a module concept that is similar to the IDL scoping mechanisms, +except that it does not allow for nested modules. In addition, Python requires +each object to be implemented in a module; globally visible objects are +not supported. +

Because of these constraints, scoped names are translated into Python +using the following rules: +

• An IDL module mapped into a Python module. Modules containing modules +are mapped to packages (i.e., directories with an __init__ module +containing all definitions excluding the nested modules). An implementation +can chose to map toplevel definitions (including the module CORBA) to modules +in an implementationdefined package, to allow concurrent installations +of different CORBA runtime libraries. In that case, the implementation +must provide additional modules so that toplevel modules can be used without +importing them from a package. +

• For all other scopes, a Python class is introduced that contains all +the definitions inside this scope. +

• Other global definitions (except modules) appear in a module whose +name is implementation dependent. Implementations are encouraged to use +the name of the IDL file when defining the name of that module. +

For instance, +

+
module SALOMEDS {
+ interface StudyManager {
+  void  Close(in Study aStudy);
+ };
+};
+
+would introduce a module SALOMEDS.py, which contains the following definitions: +
+
# module SALOMEDS.py
+class StudyManager:
+  def _Close(self,aStudy):
+   pass #interfaces are discussed later
+
+To avoid conflicts, IDL names that are also Python identifiers are prefixed +with an underscore (‘_’). +

Back to the contents +

+

+Mapping for Template and Array Types

+Both the bounded and the unbounded string type of IDL are mapped to the +Python string type. Wide strings are represented by an implementation-defined +type with the following properties: +

• For the wide string X and the integer n, X[n] returns the nth character, +which is a wide string of length 1. +

• len(X) returns the number of characters of wide string X. +

• CORBA.wstr(c) returns a wide character with the code point c in an +implementation-defined encoding. +

• X+Y returns the concatenation of wide strings X and Y. +

• CORBA.word(CORBA.wstr(c)) == c +

The sequence template is mapped to sequence objects (e.g., tuples or +lists). Applications should not assume that values of a sequence type are +mutable. Sequences and arrays of octets and characters are mapped to the +string type for efficiency reasons. +

For example, given the IDL definitions +

+
module SALOMEDS {
+  typedef sequence <string> StringSeq;
+   
+   interface AttributeTableOfInteger : GenericAttribute {
+
+    void SetRowTitles(in StringSeq theTitles) raises(IncorrectArgumentLength);
+ };
+};
+
+a client could invoke the operation +
+
print My_AttributeTableOfInteger.SetRowTitles(["X","F"])
+
+Array types are mapped like sequence templates. The application in this +example also expects an IncorrectArgumentLength exception if it passes +sequences that violate the bounds constraint or arrays of wrong size. +

Another example with arrays. The following IDL definition +

+
module SALOMEDS {
+ typedef sequence<GenericAttribute> ListOfAttributes;
+ interface SObject {
+  ListOfAttributes     GetAllAttributes();
+ };
+};
+
+is equal to +
+
import SALOMEDS
+
+attributes=[]
+ 
+attributes = My_SObject.GetAllAttributes()
+
+length = len(attributes)
+
+print "Attributes number = ", length
+print attributes
+
+Back to the contents +

+

+Mapping for Objects and Operations

+A CORBA object reference is represented as a Python object at run-time. +This object provides all the operations that are available on the interface +of the object. Although this specification does not mandate the use of +classes for stub objects, the following discussion uses classes to indicate +the interface. +

The nil object is represented by None. +

If an operation expects parameters of the IDL Object type, any Python +object representing an object reference might be passed as actual argument. +

If an operation expects a parameter of an abstract interface, either +an object implementing that interface, or a value supporting this interface +may be passed as actual argument. The semantics of abstract values then +define whether the argument is passed by value or by reference. +

Operations of an interface map to methods available on the object references. +Parameters with a parameter attribute of in or inout are +passed from left to right tothe method, skipping out parameters. +The return value of a method depends on the number of out parameters +and the return type. If the operation returns a value, this value forms +the first result value. All inout or out parameters +form consecutive result values. The method result depends then on +the number of result values: +

• If there is no result value, the method returns None. +

• If there is exactly one result value, it is returned as a single +value. +

• If there is more than one result value, all of them are packed +into a tuple, and this tuple is returned. +

Assuming the IDL definition +

+
module SALOMEDS{
+ interface StudyBuilder{
+  boolean FindAttribute  ( in SObject anObject, 
+                           out GenericAttribute anAttribute, 
+                           in string aTypeOfAttribute );
+ };
+};
+
+a client could write +
+
from SALOMEDS import StudyBuilder;
+my_StudyBuilder=...
+  
+  res,A=my_StudyBuilder.FindAttribute(Sobj, "AttributeSequenceOfReal")
+
+In this example A corresponds to the return value anAttribute +and res to the boolean return value. +

If an interface defines an attribute name, for example, the attribute +is mapped into an operation _get_name. If the attribute is not readonly, +there is an additional operation _set_name. +

The IDL definition +

+
module SALOMEDS{
+ interface Study{
+  attribute string Name;
+ };
+};
+
+is equal to the following +
+
from SALOMEDS import Study
+My_Study=...
+  Name=My_Study._get_name();
+  Name=My_Study._set_name();
+
+Back to the contents +

+

+Narrowing Object References

+Python objects returned from CORBA operations or pseudo-operations (such +as string_to_object) might have a dynamic type, which is more specific +than the static type as defined in the operation signature. +

Since there is no efficient and reliable way of automatically creating +the most specific type, explicit narrowing is necessary. To narrow an object +reference A to an interface class AttributeSequenceOfReal, +the client can use the following operation +

+
A = A._narrow(SALOMEDS.AttributeSequenceOfReal)
+
+Back to the contents +

+

+Mapping for Exceptions

+An IDL exception is translated into a Python class derived from CORBA.UserException. +System exceptions are derived from CORBA.SystemException. Both base classes +are derived from CORBA.Exception. The parameters of the exception are mapped +in the same way as the fields of a struct definition. When raising an exception, +a new instance of the class is created; the constructor expects the exception +parameters. For example, the definition +
+
module SALOMEDS{
+ interface StudyBuilder{
+  exception LockProtection {};
+  void CommitCommand() raises(LockProtection);
+ };
+};
+
+could be used caught as +
+
from SALOMEDS import StudyBuilder;
+my_StudyBuilder=...
+try:
+  my_StudyBuilder.CommitCommand();
+except StudyBuilder.LockProtection,value:
+  print "Error! Study is locked for modifications"
+
+ +


Back to the contents +

+

+Mapping for Enumeration Types

+An enumeration is mapped into a number of constant objects in the name +space where the enumeration is defined. An application may only test for +equivalence of two enumeration values, and not assume that they behave +like numbers. For example, the definition +
+
module VISU {
+ interface PrsObject{
+ 
+  enum PrsObjType{ TCURVE, TTABLE, TMESH, TCONTAINER,
+                   TSCALARMAP, TISOSURFACE, TDEFORMEDSHAPE,
+                   TCUTPLANES, TVECTORS };
+ };
+};
+
+introduces the objects +
+
from VISU import PrsObject
+VISU.PrsObjType.TCURVE,VISU.PrsObjType.TTABLE,VISU.PrsObjType.TMESH,VISU.PrsObjType.TCONTAINER,
+VISU.PrsObjType.TSCALARMAP,VISU.PrsObjType.TISOSURFACE,VISU.PrsObjType.TDEFORMEDSHAPE,VISU.PrsObjType.TCUTPLANES,
+VISU.PrsObjType.TVECTORS
+
+Back to the contents +

+

+Mapping for Structured Types

+An IDL struct definition is mapped into a Python class or type. For each +field in the struct, there is a corresponding attribute in the class with +the same name as the field. The constructor of the class expects the field +values, from left to right. For example, the IDL definition +
+
struct SDate {
+               short Second;
+               short Minute;
+               short Hour;
+               short Day;
+               short Month;
+               short Year;
+             };
+
+could be used in the Python statements +
+
Date=SDate(30, 12, 15, 26, 1, 79)
+print Date.Second,Date.Minute,Date.Hour,Date.Day,Date.Month,Date.Year
+
+ +
+Back to the contents
+ + + + diff --git a/doc/salome/tui/KERNEL/sources/static/overview_Kernel.html b/doc/salome/tui/KERNEL/sources/static/overview_Kernel.html index 144d3c341..7f64f4369 100755 --- a/doc/salome/tui/KERNEL/sources/static/overview_Kernel.html +++ b/doc/salome/tui/KERNEL/sources/static/overview_Kernel.html @@ -1,191 +1,191 @@ - - - - - - Main Page - - - -  -
- - - - - - -
-
-
- - -

General overview -

-

Table of contents

- - -
-

1. Introduction

-

The kernel corresponds to the minimal set of services required for the use of SALOME components (Supervisor, IAPP). -The kernel is also used by application software components (solver) and their container. -The kernel is associated to a unique user who can launch only one kernel at once. -The kernel is launched and destroyed by voluntary actions of the user. These functions are realized via the -use of scripts.

-

The list of the kernel services related to communication issues is:

-
    -
  • The Naming service
  • -
  • The Session service
  • -
  • The Life Cycle service
  • -
  • The Registry service
  • -
  • The Notification service
  • -
-

This list is enlarged with CORBA independent services :

- -
    -
  • The module catalog service
  • -
  • The Data Type Catalog service
  • -
  • The resource catalog service
  • -
-

SALOME kernel module also encapsulates the Engine -Back to the contents -

2. Basic principles

-

The SALOME user's desktop is a process on a machine. This process includes:

-
    -
  • A graphic interface (based on Qt),
  • -
  • A text interface (Python interpreter),
  • -
  • A 3D visualization window shared by components.
  • -
-

SALOME Modules decompose into an interface (widgets GUI, text mode TUI, 3D visualization V3D) and -an engine.

-

The description of a module and its components is obtained by consulting the module catalog.

-

The interface is dynamically loaded in the process of the SALOME user's desktop. The engine is a CORBA -server launched either on the local machine or on the distant machine.

-

The engine (CORBA server) is created by a factory (or container). -This factory is also a CORBA server. Several containers can be present on a machine. -Some containers are specialized for types of components requiring a specific management. -For example, a specific container is required for components performing parallel calculations. -The engine includes at least a dynamically linked library in the container process. -This library is the implementation of the CORBA server associated to the engine. -If the engine is built from a pre-existent executable code, the library is simply a wrapper of the encapsulated code. -It launches the code in a separate process. Wherever possible, the code is included into the dynamic library. -

The container is one of the kernel services. If one needs to create a container on a distant machine, one creates a process resuming a part of the kernel services. The kernel can create other containers on distant machines via the trader (rsh). All the containers and the kernel share the same CORBA naming service with which they register.

-

The user reaches the functions of various SALOME'S components, either in graphic interactive mode (GUI) or in command mode ( TUI), via a Python interpreter.

-Back to the contents - -

3. Services and features of the SALOME kernel module

-

This section gives a brief overview of the services composing the kernel module. - The Life Cycle and Naming - services are described in separate chapters of this reference manual.

- -

3.1 Session service

-

SALOME session describes the period starting from the kernel creation and - ending with its destruction. During this period the user can connect the session - and disconnect from it without ending this session. One connection log could - be written. A priori, no information resulting from another (past) session can - be used by the current session.

-

Implementation of this service in SALOME application is provided by the class -Session encapsulated in the package -SALOME.

- -

3.2 Registry service

-

The active component registry should contain:

- -
    -
  • The list of the active components
  • -
  • The list of the active containers during a SALOME session.
  • -
-

It should allow the state of a session. It also should allow to know if session can be stopped.

-

The API reference for this service is not included in the current version of the reference manual.

- -

3.3 Notification service

-

The notification service is a kernel function which allows exchanging of events between CORBA objects.

-

In comparison with traditional CORBA event service, SALOME notification service allows to:

-
    -
  • Filter the events,
  • -
  • Structure the events,
  • -
  • Establish quality policies of services,
  • -
  • Subscribe to various event channels.
  • -
-

The API reference for this service is not included in the current version of the reference - manual.

- -

3.4 Module catalog service

-

There are two module catalogs in SALOME application:

-
    -
  • General module catalog : This first catalog is common to all SALOME users once the the platform is installed (for example for a particular company or a service). This catalog will be managed by the integrator or the administrator of the platform, -
  • Personal module catalog : A specific catalog for every user (possibly empty). This catalog should notably allow the developers to test a new component before integrating it into the general catalog. -
-

The objective of these two module catalogs is to:

-
    -
  • List the available modules; -
  • Allow the addition, the modification and the deletion of a module in catalogs; -
  • Look for a module and\or a service fulfilling some given criteria (in catalogs); -
-

Implementation of this service in SALOME application is provided by two classes -ModuleCatalogand AComponent encapsulated in the package -SALOME_ModuleCatalog.

- -

3.5 Data type catalog

- -

The data exchanged between components services have definite types. During description of input, output, and -configuration parameters of components in the module catalog, the -definition of the parameters types is taken from data type catalog. During the editing of execution of -graphs, it is necessary to check that the connections output-input parameters are of compatible -types.

-

The data types correspond to CORBA object classes, including attributes and access methods (defined by their IDL). -These types can be created by specialization of generic data types.

-

The purpose of the data type catalog is to:

-
    -
  • List the available data types in the catalog; -
  • Browse the type hierarchy to check the compatibility of types (specialized output toward generic input); -
  • Allow the addition, the modification and the deletion of a data type in the catalog; -
-

The API reference for this service is not included in the current version of the reference - manual.

-

3.6 Resource catalog

- -

This catalog describes machines, possible types of container on a machine, resources of machines... This catalog is used by the SALOME LifeCycle service.

-

The API reference for this service is not included in the current version of the reference - manual.

- -

3.7 Engine

-

The engine represents a shared library which can be dynamically loaded by a container. The container can load this library, -given an interface name and an implementation -name. The container dynamically resolves an extern_C function in the library, -which constructs the CORBA Engine servant object.

-

The SALOME engine in - the current version of the application is implemented - as Engines package of interfaces. It encapsulates two classes: Component, Container.

-

The API refernce for Engines package can be found here. -

-

3.7.1 Component class

-

This class is used for interaction between the container and the component and between the components inside the container. -

-

The API reference for this class can be found here.

- -

3.7.2 Container class

-

This class provides a set of methods which are necessary for definition of the process of loading and registration of new components in SALOME application.

-

The API reference for this class can be found here.

- -Back to the contents - - + + + + + + Main Page + + + +  +
+ + + + + + +
+
+
+ + +

General overview +

+

Table of contents

+ + +
+

1. Introduction

+

The kernel corresponds to the minimal set of services required for the use of SALOME components (Supervisor, IAPP). +The kernel is also used by application software components (solver) and their container. +The kernel is associated to a unique user who can launch only one kernel at once. +The kernel is launched and destroyed by voluntary actions of the user. These functions are realized via the +use of scripts.

+

The list of the kernel services related to communication issues is:

+
    +
  • The Naming service
  • +
  • The Session service
  • +
  • The Life Cycle service
  • +
  • The Registry service
  • +
  • The Notification service
  • +
+

This list is enlarged with CORBA independent services :

+ +
    +
  • The module catalog service
  • +
  • The Data Type Catalog service
  • +
  • The resource catalog service
  • +
+

SALOME kernel module also encapsulates the Engine +Back to the contents +

2. Basic principles

+

The SALOME user's desktop is a process on a machine. This process includes:

+
    +
  • A graphic interface (based on Qt),
  • +
  • A text interface (Python interpreter),
  • +
  • A 3D visualization window shared by components.
  • +
+

SALOME Modules decompose into an interface (widgets GUI, text mode TUI, 3D visualization V3D) and +an engine.

+

The description of a module and its components is obtained by consulting the module catalog.

+

The interface is dynamically loaded in the process of the SALOME user's desktop. The engine is a CORBA +server launched either on the local machine or on the distant machine.

+

The engine (CORBA server) is created by a factory (or container). +This factory is also a CORBA server. Several containers can be present on a machine. +Some containers are specialized for types of components requiring a specific management. +For example, a specific container is required for components performing parallel calculations. +The engine includes at least a dynamically linked library in the container process. +This library is the implementation of the CORBA server associated to the engine. +If the engine is built from a pre-existent executable code, the library is simply a wrapper of the encapsulated code. +It launches the code in a separate process. Wherever possible, the code is included into the dynamic library. +

The container is one of the kernel services. If one needs to create a container on a distant machine, one creates a process resuming a part of the kernel services. The kernel can create other containers on distant machines via the trader (rsh). All the containers and the kernel share the same CORBA naming service with which they register.

+

The user reaches the functions of various SALOME'S components, either in graphic interactive mode (GUI) or in command mode ( TUI), via a Python interpreter.

+Back to the contents + +

3. Services and features of the SALOME kernel module

+

This section gives a brief overview of the services composing the kernel module. + The Life Cycle and Naming + services are described in separate chapters of this reference manual.

+ +

3.1 Session service

+

SALOME session describes the period starting from the kernel creation and + ending with its destruction. During this period the user can connect the session + and disconnect from it without ending this session. One connection log could + be written. A priori, no information resulting from another (past) session can + be used by the current session.

+

Implementation of this service in SALOME application is provided by the class +Session encapsulated in the package +SALOME.

+ +

3.2 Registry service

+

The active component registry should contain:

+ +
    +
  • The list of the active components
  • +
  • The list of the active containers during a SALOME session.
  • +
+

It should allow the state of a session. It also should allow to know if session can be stopped.

+

The API reference for this service is not included in the current version of the reference manual.

+ +

3.3 Notification service

+

The notification service is a kernel function which allows exchanging of events between CORBA objects.

+

In comparison with traditional CORBA event service, SALOME notification service allows to:

+
    +
  • Filter the events,
  • +
  • Structure the events,
  • +
  • Establish quality policies of services,
  • +
  • Subscribe to various event channels.
  • +
+

The API reference for this service is not included in the current version of the reference + manual.

+ +

3.4 Module catalog service

+

There are two module catalogs in SALOME application:

+
    +
  • General module catalog : This first catalog is common to all SALOME users once the the platform is installed (for example for a particular company or a service). This catalog will be managed by the integrator or the administrator of the platform, +
  • Personal module catalog : A specific catalog for every user (possibly empty). This catalog should notably allow the developers to test a new component before integrating it into the general catalog. +
+

The objective of these two module catalogs is to:

+
    +
  • List the available modules; +
  • Allow the addition, the modification and the deletion of a module in catalogs; +
  • Look for a module and\or a service fulfilling some given criteria (in catalogs); +
+

Implementation of this service in SALOME application is provided by two classes +ModuleCatalogand AComponent encapsulated in the package +SALOME_ModuleCatalog.

+ +

3.5 Data type catalog

+ +

The data exchanged between components services have definite types. During description of input, output, and +configuration parameters of components in the module catalog, the +definition of the parameters types is taken from data type catalog. During the editing of execution of +graphs, it is necessary to check that the connections output-input parameters are of compatible +types.

+

The data types correspond to CORBA object classes, including attributes and access methods (defined by their IDL). +These types can be created by specialization of generic data types.

+

The purpose of the data type catalog is to:

+
    +
  • List the available data types in the catalog; +
  • Browse the type hierarchy to check the compatibility of types (specialized output toward generic input); +
  • Allow the addition, the modification and the deletion of a data type in the catalog; +
+

The API reference for this service is not included in the current version of the reference + manual.

+

3.6 Resource catalog

+ +

This catalog describes machines, possible types of container on a machine, resources of machines... This catalog is used by the SALOME LifeCycle service.

+

The API reference for this service is not included in the current version of the reference + manual.

+ +

3.7 Engine

+

The engine represents a shared library which can be dynamically loaded by a container. The container can load this library, +given an interface name and an implementation +name. The container dynamically resolves an extern_C function in the library, +which constructs the CORBA Engine servant object.

+

The SALOME engine in + the current version of the application is implemented + as Engines package of interfaces. It encapsulates two classes: Component, Container.

+

The API refernce for Engines package can be found here. +

+

3.7.1 Component class

+

This class is used for interaction between the container and the component and between the components inside the container. +

+

The API reference for this class can be found here.

+ +

3.7.2 Container class

+

This class provides a set of methods which are necessary for definition of the process of loading and registration of new components in SALOME application.

+

The API reference for this class can be found here.

+ +Back to the contents + + diff --git a/doc/salome/tui/KERNEL/sources/static/overview_Life_Cycle.html b/doc/salome/tui/KERNEL/sources/static/overview_Life_Cycle.html index 659c2ab24..f1a1fb8af 100755 --- a/doc/salome/tui/KERNEL/sources/static/overview_Life_Cycle.html +++ b/doc/salome/tui/KERNEL/sources/static/overview_Life_Cycle.html @@ -1,90 +1,90 @@ - - - - - - Life Cycle service Description - - - - - - -  -
- - - - - - -
-
-
- - -

Life Cycle service Description

-

Introduction

-

The objective of this document is to give the users of SALOME - application a brief overview of the Life Cycle service implemented in SALOME. - A complete version of the LifeCycle service specification edited by the Object Management Group, Inc.(OMG) can be found here. -

-

Table of contents

- -
- -

1. Overview

- -

Life Cycle service defines services and conventions for creating, deleting, copying and moving objects. -Because CORBA-based environments support distributed objects, the Life Cycle service defines conventions that allow clients to perform -life cycle operations on objects in different locations. This overview describes the life cycle problem for distributed object systems.

-
- - -

2. SALOME Life Cycle service description

-

The SALOME Life Cycle service represents a partial implementation of the CORBA LifeCycle service.

-

From general point of view, the SALOME Life Cycle service allows to find or load with the help of a given container a definte SALOME component with its further -initialization and registration in the Naming service.

-

Container - it's a certain engine realizing the mechanism of loading a SALOME module.

-

Component - it's a certain abstract shell wrapping SALOME modules, performing all operations concerned with their initialization and registration.

-

From the point of view of the service user, the Life Cycle provides a set of functions allowing to :

-
    -
  • Locate a machine (more generally a container) by a logical set of required features (of both container and - machine);
  • -
  • Load components on the obtained containers;
  • -
  • Create a container;
  • -
  • Obtain the container containing a given component;
  • -
  • Treat the list of the active components;
  • -
  • Treat the list of the available containers.
  • -
- - - -

The SALOME Life Cycle is a CORBA server. This server at its initialization is registered with the naming service.

-

The Life Cycle service is invoked to find a container and use it to load a -component. It supplies, as parameters, the type of container and the machine features required for loading -a given component. -

-

The Life Cycle service then returns a CORBA reference of a launched container.

-

Containers are launched on demand depending on components to be loaded. The Life Cycle service manages loading of containers.

-

When there is no launched container matching the request the Life Cycle service invokes loading of the correct type of container on a correct machine via a rsh type command.

-

The Life Cycle service interrogates containers to have information about the dynamic state of the machine (load). It contains (and update) the state of the active containers.

-

The Life Cycle service can implement a loading strategy for new containers on new machines, depending on the state of the already launched containers.

-

The Life Cycle service can stop containers at the end of session on -demand.

- -

In SALOME platform the Life Cycle service is implemented in SALOME_Life CycleCORBA class. The API refernce for the methods of this class -can be found here.

-Back to the contents -
- - -
- - - + + + + + + Life Cycle service Description + + + + + + +  +
+ + + + + + +
+
+
+ + +

Life Cycle service Description

+

Introduction

+

The objective of this document is to give the users of SALOME + application a brief overview of the Life Cycle service implemented in SALOME. + A complete version of the LifeCycle service specification edited by the Object Management Group, Inc.(OMG) can be found here. +

+

Table of contents

+ +
+ +

1. Overview

+ +

Life Cycle service defines services and conventions for creating, deleting, copying and moving objects. +Because CORBA-based environments support distributed objects, the Life Cycle service defines conventions that allow clients to perform +life cycle operations on objects in different locations. This overview describes the life cycle problem for distributed object systems.

+
+ + +

2. SALOME Life Cycle service description

+

The SALOME Life Cycle service represents a partial implementation of the CORBA LifeCycle service.

+

From general point of view, the SALOME Life Cycle service allows to find or load with the help of a given container a definte SALOME component with its further +initialization and registration in the Naming service.

+

Container - it's a certain engine realizing the mechanism of loading a SALOME module.

+

Component - it's a certain abstract shell wrapping SALOME modules, performing all operations concerned with their initialization and registration.

+

From the point of view of the service user, the Life Cycle provides a set of functions allowing to :

+
    +
  • Locate a machine (more generally a container) by a logical set of required features (of both container and + machine);
  • +
  • Load components on the obtained containers;
  • +
  • Create a container;
  • +
  • Obtain the container containing a given component;
  • +
  • Treat the list of the active components;
  • +
  • Treat the list of the available containers.
  • +
+ + + +

The SALOME Life Cycle is a CORBA server. This server at its initialization is registered with the naming service.

+

The Life Cycle service is invoked to find a container and use it to load a +component. It supplies, as parameters, the type of container and the machine features required for loading +a given component. +

+

The Life Cycle service then returns a CORBA reference of a launched container.

+

Containers are launched on demand depending on components to be loaded. The Life Cycle service manages loading of containers.

+

When there is no launched container matching the request the Life Cycle service invokes loading of the correct type of container on a correct machine via a rsh type command.

+

The Life Cycle service interrogates containers to have information about the dynamic state of the machine (load). It contains (and update) the state of the active containers.

+

The Life Cycle service can implement a loading strategy for new containers on new machines, depending on the state of the already launched containers.

+

The Life Cycle service can stop containers at the end of session on +demand.

+ +

In SALOME platform the Life Cycle service is implemented in SALOME_Life CycleCORBA class. The API refernce for the methods of this class +can be found here.

+Back to the contents +
+ + +
+ + + diff --git a/doc/salome/tui/KERNEL/sources/static/overview_Naming.html b/doc/salome/tui/KERNEL/sources/static/overview_Naming.html index ae24ab54d..8af6b10ec 100755 --- a/doc/salome/tui/KERNEL/sources/static/overview_Naming.html +++ b/doc/salome/tui/KERNEL/sources/static/overview_Naming.html @@ -1,197 +1,197 @@ - - - - - - Naming Service Description - - - -  -
- - - - - - -
-
-
- - -

Naming Service Description

-
-

Introduction

-

This page contains an abridged version of the Naming Service specification - edited by the Object Management Group, Inc.(OMG). The objective of this document is to give the users of SALOME - application a brief overview of the Naming Service implemented in SALOME. - A complete version of this document can be found here. -

-
-

Table of contents

- - -
- -

1. Overview

-

This chapter presents the OMG Naming Service and explains how the Naming Service can be used to decouple clients and servers by -providing an external reference exchange mechanism. The chapter also covers how to solve the bootstrapping problem for clients and -servers by controlling their configuration. -

- -

In practice, copying stringified references from a server to all its clients is clumsy and does not scale. The Naming Service provides a way -for servers to advertise references under a name, and for clients to retrieve them. The advantages are: -

-
    -
  • Clients and servers can use meaningful names instead of having to deal with stringified references.
  • -
  • By changing a reference in the service without changing its name, you can transparently direct clients to a different object.
  • -
  • The Naming Service solves the bootstrapping problem because it provides a fixed point for clients and servers to rendezvous.
  • -
-

The Naming Service is much like a white pages phone book. Given a name, it - returns an object reference.

- -

The terminology used in description of NamigService is the following:

- -
    -
  • A name-to-IOR association is called by a name binding.
  • -
  • Each binding identifies exactly one object reference, but an object reference - may be bound more than once (have more than one name).
  • -
  • A naming context is an object that contains name bindings. - The names within a context must be unique. Naming contexts can contain bindings - to other naming contexts, so naming contexts can form graphs. Binding contexts - in other contexts creates a naming graph — a directed graph with nodes - and labeled edges where the nodes are contexts. A naming graph allows more - complex names to reference an object. Given a context in a naming graph, a - sequence of names can reference an object. This sequence of names (called - a compound name) defines a path in the naming graph to navigate the - resolution process. Figure 1-1 shows an example of a naming graph.
  • -
  • Binding a name to a context means to add a name–IOR pair to a context.
  • -
  • Resolving a name means to look for a name in a context and to obtain the - IOR bound under that name.
  • -
- - -
-

Figure 1-1 A Naming Graph

- Back to the contents -
- -

2. SALOME Naming Service

- -

2.1 Introduction

-

The SALOME Naming Service is a kernel function which supplies a name directory - hierarchy for pointing out CORBA objects. This name directory hierarchy allows, - from symbolic names, to dynamically find the references of distributed SALOME - objects, without information about their location. SALOME objects which can - be reached via the naming service are:

- -
    -
  • The kernel services
  • -
  • Containers -
  • SALOME components instances -
-

The name directory hierarchy in SALOME represents a graph of directories containing - symbolic associations name-reference on objects. (It has been described in the - previous section)

- -

2.2 Definitions

-
-
Directory
-
Context of names containing symbolic associations name-reference on objects.


-
"/"
-
Character used in SALOME to separate two names of a directory


-
Access path
-
List of names (separated by "/" character representing the path to be followed - in the graph to reach an association name-reference (the last name in the sequence).
-
-
Note:An object can be referenced by several symbolic names - in one or several directories.
- -

2.3 Partition of SALOME name directory hierarchy

-

The hierarchical organization of the SALOME name directory is not completely frozen . -Because the framework allows the simultaneous opening of several studies, the following levels are determined:

-
 
- /Kernel
- /Container/
-	       /Component	
-
- -

2.4 SALOME name directory persistence

-

During a SALOME session, stopping a server in charge of the Naming Service - doesn't imply the loss of the contents of the SALOME name directory hierarchy. - A backup file is produced and can be used to restart the Naming Service. So, - one can recover the state of the SALOME name directory hierarchy at restart - time. During such breakdown, every call to any function of the Naming Service - invokes an exception of type Unreachable service.

- -

2.5 SALOME Naming Service features

-

Usage and administration of the name directory hierarchy is realized by means of the following functions:

-
    -
  • Recording and recovering of the reference of an object
  • -
  • Searching for a symbolic name
  • -
  • Creating of a directory, reading and modifying of the current directory
  • -
  • Destructing of a symbolic name and a diredtory
  • -
-

The access path used in these functions can be defined, either from the root, or from any -directory of SALOME name directory hierarchy.

- -

In SALOME there is s standard interface of Naming Service, and any user can - use it for binding and finding objects. How to use it, it's possible to find - in any CORBA documentation. However in SALOME there is an additional layer which - hides calls to standard interface.

-

The precise API reference for these functions you can find here.

-

Here is a short list of public methods which are used for working with the SALOME Naming Service:

-
-

Register

-
Method which register object reference in the naming service with given name. It makes assignment between IOR and stringified name. -Then it's possible to get object reference from name using "Resolve" method.
-

-

Resolve

-
Try to obtain object reference from name. It's necessary before publishing - IOR in the Naming Service by Register method.
-

-

Find

-
The purpose of this method is to research a name from the current directory - of the naming service. Then if there is occurrence the naming service changes - directory to go to the directory where last occurrence is found.
-

-

CreateDirectory

-
This method allows to create one or several directories in the current directory
-

-

ChangeDirectory

-
Moves the current directory. The current directory is moved to the root directory if the input parameter Name is "/".
-

-

CurrentDirectory

-
Method allowing to get the current directory.
-

-

list

-
Method allowing to list and print the whole context beginning from the current context.
-

-

list_directory

-
Method to get all contexts contained in the current directory.
-

-

DestroyName

-
Destroys a symbolic name-object reference association.
-

-

DestroyDirectory

-
Destroys an empty directory.
-
- -Back to the contents -
- - + + + + + + Naming Service Description + + + +  +
+ + + + + + +
+
+
+ + +

Naming Service Description

+
+

Introduction

+

This page contains an abridged version of the Naming Service specification + edited by the Object Management Group, Inc.(OMG). The objective of this document is to give the users of SALOME + application a brief overview of the Naming Service implemented in SALOME. + A complete version of this document can be found here. +

+
+

Table of contents

+ + +
+ +

1. Overview

+

This chapter presents the OMG Naming Service and explains how the Naming Service can be used to decouple clients and servers by +providing an external reference exchange mechanism. The chapter also covers how to solve the bootstrapping problem for clients and +servers by controlling their configuration. +

+ +

In practice, copying stringified references from a server to all its clients is clumsy and does not scale. The Naming Service provides a way +for servers to advertise references under a name, and for clients to retrieve them. The advantages are: +

+
    +
  • Clients and servers can use meaningful names instead of having to deal with stringified references.
  • +
  • By changing a reference in the service without changing its name, you can transparently direct clients to a different object.
  • +
  • The Naming Service solves the bootstrapping problem because it provides a fixed point for clients and servers to rendezvous.
  • +
+

The Naming Service is much like a white pages phone book. Given a name, it + returns an object reference.

+ +

The terminology used in description of NamigService is the following:

+ +
    +
  • A name-to-IOR association is called by a name binding.
  • +
  • Each binding identifies exactly one object reference, but an object reference + may be bound more than once (have more than one name).
  • +
  • A naming context is an object that contains name bindings. + The names within a context must be unique. Naming contexts can contain bindings + to other naming contexts, so naming contexts can form graphs. Binding contexts + in other contexts creates a naming graph — a directed graph with nodes + and labeled edges where the nodes are contexts. A naming graph allows more + complex names to reference an object. Given a context in a naming graph, a + sequence of names can reference an object. This sequence of names (called + a compound name) defines a path in the naming graph to navigate the + resolution process. Figure 1-1 shows an example of a naming graph.
  • +
  • Binding a name to a context means to add a name–IOR pair to a context.
  • +
  • Resolving a name means to look for a name in a context and to obtain the + IOR bound under that name.
  • +
+ + +
+

Figure 1-1 A Naming Graph

+ Back to the contents +
+ +

2. SALOME Naming Service

+ +

2.1 Introduction

+

The SALOME Naming Service is a kernel function which supplies a name directory + hierarchy for pointing out CORBA objects. This name directory hierarchy allows, + from symbolic names, to dynamically find the references of distributed SALOME + objects, without information about their location. SALOME objects which can + be reached via the naming service are:

+ +
    +
  • The kernel services
  • +
  • Containers +
  • SALOME components instances +
+

The name directory hierarchy in SALOME represents a graph of directories containing + symbolic associations name-reference on objects. (It has been described in the + previous section)

+ +

2.2 Definitions

+
+
Directory
+
Context of names containing symbolic associations name-reference on objects.


+
"/"
+
Character used in SALOME to separate two names of a directory


+
Access path
+
List of names (separated by "/" character representing the path to be followed + in the graph to reach an association name-reference (the last name in the sequence).
+
+
Note:An object can be referenced by several symbolic names + in one or several directories.
+ +

2.3 Partition of SALOME name directory hierarchy

+

The hierarchical organization of the SALOME name directory is not completely frozen . +Because the framework allows the simultaneous opening of several studies, the following levels are determined:

+
 
+ /Kernel
+ /Container/
+	       /Component	
+
+ +

2.4 SALOME name directory persistence

+

During a SALOME session, stopping a server in charge of the Naming Service + doesn't imply the loss of the contents of the SALOME name directory hierarchy. + A backup file is produced and can be used to restart the Naming Service. So, + one can recover the state of the SALOME name directory hierarchy at restart + time. During such breakdown, every call to any function of the Naming Service + invokes an exception of type Unreachable service.

+ +

2.5 SALOME Naming Service features

+

Usage and administration of the name directory hierarchy is realized by means of the following functions:

+
    +
  • Recording and recovering of the reference of an object
  • +
  • Searching for a symbolic name
  • +
  • Creating of a directory, reading and modifying of the current directory
  • +
  • Destructing of a symbolic name and a diredtory
  • +
+

The access path used in these functions can be defined, either from the root, or from any +directory of SALOME name directory hierarchy.

+ +

In SALOME there is s standard interface of Naming Service, and any user can + use it for binding and finding objects. How to use it, it's possible to find + in any CORBA documentation. However in SALOME there is an additional layer which + hides calls to standard interface.

+

The precise API reference for these functions you can find here.

+

Here is a short list of public methods which are used for working with the SALOME Naming Service:

+
+

Register

+
Method which register object reference in the naming service with given name. It makes assignment between IOR and stringified name. +Then it's possible to get object reference from name using "Resolve" method.
+

+

Resolve

+
Try to obtain object reference from name. It's necessary before publishing + IOR in the Naming Service by Register method.
+

+

Find

+
The purpose of this method is to research a name from the current directory + of the naming service. Then if there is occurrence the naming service changes + directory to go to the directory where last occurrence is found.
+

+

CreateDirectory

+
This method allows to create one or several directories in the current directory
+

+

ChangeDirectory

+
Moves the current directory. The current directory is moved to the root directory if the input parameter Name is "/".
+

+

CurrentDirectory

+
Method allowing to get the current directory.
+

+

list

+
Method allowing to list and print the whole context beginning from the current context.
+

+

list_directory

+
Method to get all contexts contained in the current directory.
+

+

DestroyName

+
Destroys a symbolic name-object reference association.
+

+

DestroyDirectory

+
Destroys an empty directory.
+
+ +Back to the contents +
+ + diff --git a/doc/salome/tui/KERNEL/sources/static/overview_Study.html b/doc/salome/tui/KERNEL/sources/static/overview_Study.html index f4c278363..0526536e9 100755 --- a/doc/salome/tui/KERNEL/sources/static/overview_Study.html +++ b/doc/salome/tui/KERNEL/sources/static/overview_Study.html @@ -1,261 +1,261 @@ - - - - - - Main Page - - - -  -
- - - - - - -
-
-
- - -

General overview -

-
-

Table of contents

- -

1. Introduction

-

In SALOME application the Study module is used for management (creation, saving - etc.) of studies. In the framework of the platform, a study represents a working - document allowing to manage the data produced by various components which are - integarted into SALOME.
-

-

2. Representation of the study

-

The study represents a set of objects that we will call Study Objects or SObjects. - The study can be represented as a tree, every node of that tree containing a - SObject. SObjects in the study can be values or references towards data of calculation, - graphs of calculation, trees of construction of detail(room), results. Every - SOject of the study is characterised by a unique identifier in the study.

-

The study allows to describe the following relations:

-
    -
  • The link between the transient and persistent values of an SObject.
  • -
  • The relations between the SObjects produced by different components.
  • -
  • The relations between the SObjects produced by the same component.
  • -
  • The link between an object and its user name.
  • -
  • The access to the definition of the component which produce an object of - the study.
  • -
  • The access to instance of the component (if this one exists) which has produced - this SObject of the study.
  • -
- -

Every SObject in the study contains a set of attributes. These attributes represent - a set of definitions associated to that object, they can contain values or corba - references towards the data contained in the internal data structure of a component.

-

As the structure of the study is tree-like it is possible to associate sub-objects - to objects.

-

As particular object, the study contains Component Data which are labels associated to the component -which produce data in the study. It is to this object that we can associate attributes containing ID which -we shall allow to identify the type of the component and also its instance. Objects produced by a -component will be sub-objects of the coresponding Data Component.

-

For example Component Data GEOM will contain the data produced by the component - Geom.

- - - - - -
GEOM contains the data produced by the component GEOM. The component MESH - contains a SObject Mesh_1 wich refers to the SObject identified - by ID4 corresponding to Geometrie_1.
-

We distinguish two forms of the study, the study opened in a session SALOME and the study in the -persistent format. These two formats are described in the following sections

-

2.1 Study in transient format

-

The representation of the study in memory will be based on the document OCAF (supplied by OCC). -The document OCAF can be seen as a tree, every node of that tree is identified by a tag representing an integer value.

-

The exploration of the tree from the root to a node supplies a sequence of tags which establishes a -unique identifier ID. ID represents a character string containing the sequence of tags separated by -one ':'.

-

For example 0:1:12:4

-

To every node we can associate a set of attributes.

-

The attributes which the study can contain can be of the following types:

-
    -
  • All standard attributes supplied by OCC (package TdataStd) which allow to define (integers, -real, strings, identifiers, references etc.)
  • -
  • Attributes which contain CORBA references.
  • -
  • Attributes which contain the path HDF to reach the persistent datum. (Cf. the following chapter)
  • -
-

Remark: it is the study which takes care to build the attributes from the values which are passed to it, so -an attribute is always in a study, and it knows the study object to which it is attached.

-

Example of a Study Object as a set of various attributes.

- -

2.2 Study in persistent format

-

To store a study HDF format is used, this tool allows to represent persistent data in the form of a tree.

-

Under the root of the persistent document, you can find a set of nodes:

-
    -
  • The first node contains the skeleton of the study. The skeleton consists of the identifiers of the -objects, as well as the references among them.
  • -
  • There is also one node for every component which has produced data during this SALOME session. Under each of these -node there are values of the data produced by this component.
  • -
-

2.3 Link between transient and persistent formats

-

It will be possible to complete the definition of one object in the study by associating to it an attribute -HDFPath which will contain the path to the persistent data.

- -

Back to the contents

-

3. Services and features of the study

-

The Study in SALOME application possess a wide functionality. This functionality is provided by a set of classes which are described -below. -

3.1 Study class

-

The purpose of the Study class is to manage the data produced by various components - of SALOME platform. Most of the Study operations are handled by the StudyManager - and the StudyBuilder. What - is left in the Study class are elementary inquiries. A Study is explored by - a set of tools, mainly iterators , which are described further.

-

Nevertheless, the Study class contains a set of methods providing:

- -
    -
  • management of study properties -
  • search for SObjects. -
  • search for SComponents -
  • creation of a new StudyBuilder, ComponentIterator, ChildIterator etc. -
-

The API reference for this class can be found here.

-

3.2 StudyBuilder class

-

StudyBuilder supplies basic services to edit the study. The edition of the study is made by the -component. Every component will use the basic services of the StudyBuilder allowing to write and publish objects.

-

StudyBulder provides the following functionality:

-
    -
  • creation, modification or deletetion of SObjects in the study
  • -
  • creation or removal of SComponents
  • -
  • undo/redo functionality. For that purpose it supplies the methods NewCommand, - CommitCommand, AbortCommand.
  • -
-

The API reference for this class can be found here.

-

3.3 StudyManager class

-

The purpose of the Manager is to manipulate Studies. Since SALOME is a multi-document - application during a working session you can operate as many stadies as you - wishes to create.

-

For that purpose StudyManager provides the following functionality:

-
    -
  • creation, opening, closing and saving studies
  • -
  • navigation through a set of studies present in the current working session
  • -
  • copy/paste of the objects in the study functionality.
  • -
-

The API reference for this class can be found here.

-

3.4 SObject class

-

The objects in the study are built by the StudyBuilder. -The SObject class provides methods for elementary inquiries, like getting an object ID or its attribuites.

-

The API reference for this class can be found here.

-

3.5 SComponent class

-

The SComponent class establishes in the study a permanent assocition to the components -integrated into SALOME platform. The SComponent interface is a specialization of the SObject - class. It inherits the most of its methods from the SObject class which are used for management of the SComponents.

-

The API reference for this class can be found here.

-

3.6 ChildIterator class

-

It is one of the tools destined for exploration of the study. This class contains a set of methods allowing to get -the access to all identified objects which are sons of another identifiedobject.

-

The API reference for this class can be found here.

-

3.7 SComponentIterator

-

This is the second tool destined for exploration of the study. This interface contains the methods allowing to iterate over all SComponents in the list. - The search is started from the first SComponent in the list.

-

The API reference for this class can be found here.

- -

3.8 GenericAttribute class

-

GenericAttribute represents a base class for all attributes which can be assigned to the SObjects created in the study. All attribute classes - derive from this classe and inherit its methods.

-

The API reference for this class can be found here.

- -

In SALOME application a SObject can possess the following attributes:

- - - - - -
- -
-

3.9 UseCaseBuilder class

-

UseCase in the study represents a user-defined subtree, containing all or some of the objects which currently exist -in the study. The UseCaseBuilder class contains a set of methods used for management (creation, deletion etc) of this sub-tree in the study.

-

The API reference for this class can be found here.

- -

3.10 UseCaseIterator

-

This class represents an exploration tool for the UseCase. It contains a set of methods used for iteration over the objects in the UseCase.

-

The API reference for this class can be found here.

- -

3.11 Callback class

-

The StudyBuilder can be created with the method NewBuilder. While invocation of this method a new object of the class - Callback is created and this object is assigned to the newly created Builder as callback which should be called - when adding and removing the objects.

-

The API reference for this class can be found here.

- -

3.12 Driver class

- -

This class represents a common tool for all components integrated into SALOME - application, that allows them to communicate with the study. It contains a set - of methods which can be called by any component and which provide the following - functionality: -

    -
  • publishing in the study of the objects created by a definite component
  • -
  • saving/loading of the data created by a definite component. These methods - are called by the StudyManager when loading/saving a study containing the - data created by a definite component.
  • -
  • transforming of the transient references into persistant references (or - vice versa) of the SObjects when saving (or loading) a study
  • -
  • copy/paste common functionality. These methods can be called by any component - in order to copy/paste its object created in the study
  • -
-

The API reference for this class can be found here.

-

Back to the contents

- - + + + + + + Main Page + + + +  +
+ + + + + + +
+
+
+ + +

General overview +

+
+

Table of contents

+ +

1. Introduction

+

In SALOME application the Study module is used for management (creation, saving + etc.) of studies. In the framework of the platform, a study represents a working + document allowing to manage the data produced by various components which are + integarted into SALOME.
+

+

2. Representation of the study

+

The study represents a set of objects that we will call Study Objects or SObjects. + The study can be represented as a tree, every node of that tree containing a + SObject. SObjects in the study can be values or references towards data of calculation, + graphs of calculation, trees of construction of detail(room), results. Every + SOject of the study is characterised by a unique identifier in the study.

+

The study allows to describe the following relations:

+
    +
  • The link between the transient and persistent values of an SObject.
  • +
  • The relations between the SObjects produced by different components.
  • +
  • The relations between the SObjects produced by the same component.
  • +
  • The link between an object and its user name.
  • +
  • The access to the definition of the component which produce an object of + the study.
  • +
  • The access to instance of the component (if this one exists) which has produced + this SObject of the study.
  • +
+ +

Every SObject in the study contains a set of attributes. These attributes represent + a set of definitions associated to that object, they can contain values or corba + references towards the data contained in the internal data structure of a component.

+

As the structure of the study is tree-like it is possible to associate sub-objects + to objects.

+

As particular object, the study contains Component Data which are labels associated to the component +which produce data in the study. It is to this object that we can associate attributes containing ID which +we shall allow to identify the type of the component and also its instance. Objects produced by a +component will be sub-objects of the coresponding Data Component.

+

For example Component Data GEOM will contain the data produced by the component + Geom.

+ + + + + +
GEOM contains the data produced by the component GEOM. The component MESH + contains a SObject Mesh_1 wich refers to the SObject identified + by ID4 corresponding to Geometrie_1.
+

We distinguish two forms of the study, the study opened in a session SALOME and the study in the +persistent format. These two formats are described in the following sections

+

2.1 Study in transient format

+

The representation of the study in memory will be based on the document OCAF (supplied by OCC). +The document OCAF can be seen as a tree, every node of that tree is identified by a tag representing an integer value.

+

The exploration of the tree from the root to a node supplies a sequence of tags which establishes a +unique identifier ID. ID represents a character string containing the sequence of tags separated by +one ':'.

+

For example 0:1:12:4

+

To every node we can associate a set of attributes.

+

The attributes which the study can contain can be of the following types:

+
    +
  • All standard attributes supplied by OCC (package TdataStd) which allow to define (integers, +real, strings, identifiers, references etc.)
  • +
  • Attributes which contain CORBA references.
  • +
  • Attributes which contain the path HDF to reach the persistent datum. (Cf. the following chapter)
  • +
+

Remark: it is the study which takes care to build the attributes from the values which are passed to it, so +an attribute is always in a study, and it knows the study object to which it is attached.

+

Example of a Study Object as a set of various attributes.

+ +

2.2 Study in persistent format

+

To store a study HDF format is used, this tool allows to represent persistent data in the form of a tree.

+

Under the root of the persistent document, you can find a set of nodes:

+
    +
  • The first node contains the skeleton of the study. The skeleton consists of the identifiers of the +objects, as well as the references among them.
  • +
  • There is also one node for every component which has produced data during this SALOME session. Under each of these +node there are values of the data produced by this component.
  • +
+

2.3 Link between transient and persistent formats

+

It will be possible to complete the definition of one object in the study by associating to it an attribute +HDFPath which will contain the path to the persistent data.

+ +

Back to the contents

+

3. Services and features of the study

+

The Study in SALOME application possess a wide functionality. This functionality is provided by a set of classes which are described +below. +

3.1 Study class

+

The purpose of the Study class is to manage the data produced by various components + of SALOME platform. Most of the Study operations are handled by the StudyManager + and the StudyBuilder. What + is left in the Study class are elementary inquiries. A Study is explored by + a set of tools, mainly iterators , which are described further.

+

Nevertheless, the Study class contains a set of methods providing:

+ +
    +
  • management of study properties +
  • search for SObjects. +
  • search for SComponents +
  • creation of a new StudyBuilder, ComponentIterator, ChildIterator etc. +
+

The API reference for this class can be found here.

+

3.2 StudyBuilder class

+

StudyBuilder supplies basic services to edit the study. The edition of the study is made by the +component. Every component will use the basic services of the StudyBuilder allowing to write and publish objects.

+

StudyBulder provides the following functionality:

+
    +
  • creation, modification or deletetion of SObjects in the study
  • +
  • creation or removal of SComponents
  • +
  • undo/redo functionality. For that purpose it supplies the methods NewCommand, + CommitCommand, AbortCommand.
  • +
+

The API reference for this class can be found here.

+

3.3 StudyManager class

+

The purpose of the Manager is to manipulate Studies. Since SALOME is a multi-document + application during a working session you can operate as many stadies as you + wishes to create.

+

For that purpose StudyManager provides the following functionality:

+
    +
  • creation, opening, closing and saving studies
  • +
  • navigation through a set of studies present in the current working session
  • +
  • copy/paste of the objects in the study functionality.
  • +
+

The API reference for this class can be found here.

+

3.4 SObject class

+

The objects in the study are built by the StudyBuilder. +The SObject class provides methods for elementary inquiries, like getting an object ID or its attribuites.

+

The API reference for this class can be found here.

+

3.5 SComponent class

+

The SComponent class establishes in the study a permanent assocition to the components +integrated into SALOME platform. The SComponent interface is a specialization of the SObject + class. It inherits the most of its methods from the SObject class which are used for management of the SComponents.

+

The API reference for this class can be found here.

+

3.6 ChildIterator class

+

It is one of the tools destined for exploration of the study. This class contains a set of methods allowing to get +the access to all identified objects which are sons of another identifiedobject.

+

The API reference for this class can be found here.

+

3.7 SComponentIterator

+

This is the second tool destined for exploration of the study. This interface contains the methods allowing to iterate over all SComponents in the list. + The search is started from the first SComponent in the list.

+

The API reference for this class can be found here.

+ +

3.8 GenericAttribute class

+

GenericAttribute represents a base class for all attributes which can be assigned to the SObjects created in the study. All attribute classes + derive from this classe and inherit its methods.

+

The API reference for this class can be found here.

+ +

In SALOME application a SObject can possess the following attributes:

+ + + + + +
+ +
+

3.9 UseCaseBuilder class

+

UseCase in the study represents a user-defined subtree, containing all or some of the objects which currently exist +in the study. The UseCaseBuilder class contains a set of methods used for management (creation, deletion etc) of this sub-tree in the study.

+

The API reference for this class can be found here.

+ +

3.10 UseCaseIterator

+

This class represents an exploration tool for the UseCase. It contains a set of methods used for iteration over the objects in the UseCase.

+

The API reference for this class can be found here.

+ +

3.11 Callback class

+

The StudyBuilder can be created with the method NewBuilder. While invocation of this method a new object of the class + Callback is created and this object is assigned to the newly created Builder as callback which should be called + when adding and removing the objects.

+

The API reference for this class can be found here.

+ +

3.12 Driver class

+ +

This class represents a common tool for all components integrated into SALOME + application, that allows them to communicate with the study. It contains a set + of methods which can be called by any component and which provide the following + functionality: +

    +
  • publishing in the study of the objects created by a definite component
  • +
  • saving/loading of the data created by a definite component. These methods + are called by the StudyManager when loading/saving a study containing the + data created by a definite component.
  • +
  • transforming of the transient references into persistant references (or + vice versa) of the SObjects when saving (or loading) a study
  • +
  • copy/paste common functionality. These methods can be called by any component + in order to copy/paste its object created in the study
  • +
+

The API reference for this class can be found here.

+

Back to the contents

+ + diff --git a/doc/salome/tui/Makefile.am b/doc/salome/tui/Makefile.am index a78249a5c..993af3090 100644 --- a/doc/salome/tui/Makefile.am +++ b/doc/salome/tui/Makefile.am @@ -25,7 +25,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am -EXTRA_DIST = $(srcdir)/KERNEL $(srcdir)/pythfilter.py +EXTRA_DIST = KERNEL pythfilter.py dist-hook: rm -rf `find $(distdir) -name CVS` diff --git a/doc/salome/version.texi b/doc/salome/version.texi index f9a81011e..7256abc85 100644 --- a/doc/salome/version.texi +++ b/doc/salome/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 31 May 2006 -@set UPDATED-MONTH May 2006 -@set EDITION 3.2.0 -@set VERSION 3.2.0 +@set UPDATED 2 June 2006 +@set UPDATED-MONTH June 2006 +@set EDITION 3.2.2 +@set VERSION 3.2.2 diff --git a/idl/Makefile.am b/idl/Makefile.am index 1c43ccb6c..d2364a53b 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -99,6 +99,9 @@ if MPI_IS_OK IDL_SOURCES += $(MPIIDL_SOURCES) endif +# also install all generated headers to use result library from another modules +#salomeinclude_DATA= $(IDL_SOURCES:%SK.cc=%.hh) + BUILT_SOURCES = $(IDL_SOURCES) lib_LTLIBRARIES = libSalomeIDLKernel.la diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index ea9c11942..73dd4b1e8 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -400,7 +400,7 @@ during each working session. \param thePID is a process ID of the caller \param isLocal is set True if the Study is launched locally with the caller */ - long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); + long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); /*! @@ -842,7 +842,7 @@ Gets the list of open studies \param thePID is a process ID of the caller \param isLocal is set True if the StudyManager is launched locally with the caller */ - long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); + long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); }; @@ -959,7 +959,7 @@ Gets the list of open studies \param thePID is a process ID of the caller \param isLocal is set True if the SObject is launched locally with the caller */ - long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); + long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); }; @@ -996,7 +996,7 @@ Gets the list of open studies \param thePID is a process ID of the caller \param isLocal is set True if the GenericAttribute is launched locally with the caller */ - long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); + long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); }; diff --git a/idl/SALOMEDS_Attributes.idl b/idl/SALOMEDS_Attributes.idl index d992ece00..6e50fb52f 100644 --- a/idl/SALOMEDS_Attributes.idl +++ b/idl/SALOMEDS_Attributes.idl @@ -262,6 +262,24 @@ module SALOMEDS \param value This string parameter defines the value of this attribute - a description of a %SObject.
See also an example of this method usage in batchmode of %SALOME application. +*/ + void SetValue(in string value); + }; + //========================================================================== +/*! \brief String attribute + + This attribute stores a string value containing arbitrary information. +*/ + //========================================================================== + interface AttributeString : GenericAttribute + { +/*! + Returns the value of this attribute +*/ + string Value(); +/*! + Sets the value of this attribute + \param value This string parameter defines the value of this attribute. */ void SetValue(in string value); }; diff --git a/idl/SALOME_Session.idl b/idl/SALOME_Session.idl index 9a96d8b5f..f067b753a 100644 --- a/idl/SALOME_Session.idl +++ b/idl/SALOME_Session.idl @@ -15,7 +15,7 @@ // 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 +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // // // diff --git a/salome_adm/unix/Doxyfile b/salome_adm/unix/Doxyfile new file mode 100644 index 000000000..df82af032 --- /dev/null +++ b/salome_adm/unix/Doxyfile @@ -0,0 +1,829 @@ +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# + +# Doxyfile 1.2.8.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, +# German, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, +# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish. + +OUTPUT_LANGUAGE = English + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these class will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. It is allowed to use relative paths in the argument list. + +STRIP_FROM_PATH = + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a class diagram (in Html and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. + +CLASS_DIAGRAMS = YES + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = YES + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower case letters. If set to YES upper case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# users are adviced to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explict @brief command for a brief description. + +JAVADOC_AUTOBRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# reimplements. + +INHERIT_DOCS = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consist of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. +# For instance some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. + +WARN_FORMAT = + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = /home01/prascle/devSalome/rootsrc + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +FILE_PATTERNS = *idl *.cxx *.hxx *.hh *.h *.c *.cc *.py + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. + +INPUT_FILTER = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse. + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = /home01/prascle/devSalome/doc/html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the Html help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript and frames is required (for instance Netscape 4.0+ +# or Internet explorer 4.0+). + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = /home01/prascle/devSalome/doc/latex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimised for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assigments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES tag can be used to specify one or more tagfiles. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. + +DOT_PATH = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermedate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO + +# The CGI_NAME tag should be the name of the CGI script that +# starts the search engine (doxysearch) with the correct parameters. +# A script with this name will be generated by doxygen. + +CGI_NAME = + +# The CGI_URL tag should be the absolute URL to the directory where the +# cgi binaries are located. See the documentation of your http daemon for +# details. + +CGI_URL = + +# The DOC_URL tag should be the absolute URL to the directory where the +# documentation is located. If left blank the absolute path to the +# documentation, with file:// prepended to it, will be used. + +DOC_URL = + +# The DOC_ABSPATH tag should be the absolute path to the directory where the +# documentation is located. If left blank the directory on the local machine +# will be used. + +DOC_ABSPATH = + +# The BIN_ABSPATH tag must point to the directory where the doxysearch binary +# is installed. + +BIN_ABSPATH = + +# The EXT_DOC_PATHS tag can be used to specify one or more paths to +# documentation generated for other projects. This allows doxysearch to search +# the documentation for these projects as well. + +EXT_DOC_PATHS = diff --git a/salome_adm/unix/F77config.h.in b/salome_adm/unix/F77config.h.in new file mode 100644 index 000000000..670ac5756 --- /dev/null +++ b/salome_adm/unix/F77config.h.in @@ -0,0 +1,29 @@ +/*---------------------------------------------------------------------------------- + Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, + CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +------------------------------------------------------------------------------------*/ + + +#ifndef F77_FUNC + +#define F77_FUNC(name,NAME) @F77_FUNC_NAME@ +#define F77_FUNC_(name,NAME) @F77_FUNC_NAME_@ + +#endif + diff --git a/salome_adm/unix/config_files/ac_cc_warnings.m4 b/salome_adm/unix/config_files/ac_cc_warnings.m4 new file mode 100644 index 000000000..9f3aa1a7f --- /dev/null +++ b/salome_adm/unix/config_files/ac_cc_warnings.m4 @@ -0,0 +1,119 @@ +dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +dnl +dnl +dnl +dnl Synopsis : AC_CC_WARNINGS([ANSI]) +dnl +dnl Version : 1.1 (2000/12/31) +dnl +dnl Author : Ville Laurikari +dnl +dnl Description : +dnl +dnl Enables a reasonable set of warnings for the C compiler. +dnl Optionally, if the first argument is nonempty, turns on +dnl flags which enforce and/or enable proper ANSI C if such +dnl flags are known to the compiler used. +dnl +dnl Currently this macro knows about GCC, Solaris C compiler, +dnl Digital Unix C compiler, C for AIX Compiler, HP-UX C +dnl compiler, and IRIX C compiler. + +AC_DEFUN([AC_CC_WARNINGS], [ + ansi=$1 + if test -z "$ansi"; then + msg="for C compiler warning flags" + else + msg="for C compiler warning and ANSI conformance flags" + fi + AC_CACHE_CHECK($msg, ac_cv_prog_cc_warnings, [ + if test -n "$CC"; then + cat > conftest.c <&1 | grep "Xc.*strict ANSI C" > /dev/null 2>&1 && + $CC -c -v -Xc conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="-v" + else + ac_cv_prog_cc_warnings="-v -Xc" + fi + + dnl HP-UX C compiler + elif $CC > /dev/null 2>&1 && + $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="+w1" + else + ac_cv_prog_cc_warnings="+w1 -Aa" + fi + + dnl Digital Unix C compiler + elif ! $CC > /dev/null 2>&1 && + $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos" + else + ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1" + fi + + dnl C for AIX Compiler + elif $CC > /dev/null 2>&1 | grep AIX > /dev/null 2>&1 && + $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" + else + ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi" + fi + + dnl IRIX C compiler + elif $CC -fullwarn -ansi -ansiE > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="-fullwarn" + else + ac_cv_prog_cc_warnings="-fullwarn -ansi -ansiE" + fi + + fi + rm -f conftest.* + fi + if test -n "$ac_cv_prog_cc_warnings"; then + CFLAGS="$CFLAGS $ac_cv_prog_cc_warnings" + CXXFLAGS="$CXXFLAGS $ac_cv_prog_cc_warnings" + else + ac_cv_prog_cc_warnings="unknown" + fi + ]) +]) diff --git a/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 b/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 index 9dc8b0fd3..9849f3653 100644 --- a/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 +++ b/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 @@ -35,6 +35,85 @@ ac_cv_depend_flag, echo "conftest.o: conftest.c" > conftest.verif echo "int main() { return 0; }" > conftest.c +f77int="F77INT32" +case $host_os in + irix5.* | irix6.* | osf4.* | osf5.* | linux* ) + + linux64="true" + expr "$host_os" : 'linux' >/dev/null && test ! x"$host_cpu" = x"x86_64" && linux64="false" + if test ! x"$linux64" = "xfalse" ; then + echo "$as_me:$LINENO: checking for 64bits integers size in F77/F90" >&5 +echo $ECHO_N "checking for 64bits integers size in F77/F90... $ECHO_C" >&6 + # Check whether --enable-int64 or --disable-int64 was given. +if test "${enable_int64+set}" = set; then + enableval="$enable_int64" + +fi; + case "X-$enable_int64" in + X-no) + echo "$as_me:$LINENO: result: \"disabled\"" >&5 +echo "${ECHO_T}\"disabled\"" >&6 + SUFFIXES="_32" + ;; + *) + echo "$as_me:$LINENO: result: \"enabled\"" >&5 +echo "${ECHO_T}\"enabled\"" >&6 + SUFFIXES="" + f77int="F77INT64" + ;; + esac + fi + ;; + *) + ;; +esac + +case $host_os in + linux*) + if test x"$linux64" = x"true"; then \ + MACHINE="PCLINUX64${SUFFIXES}"; + CFLAGS=" -m64 ${CXXFLAGS}"; + CXXFLAGS=" -m64 ${CXXFLAGS}";\ + else \ + MACHINE=PCLINUX; \ + fi + ;; + hpux*) + MACHINE=HP9000 + ;; + aix4.*) + MACHINE=RS6000 + host_os_novers=aix4.x + ;; + irix5.*) + MACHINE="IRIX64${SUFFIXES}" + host_os_novers=irix5.x + ;; + irix6.*) + MACHINE="IRIX64${SUFFIXES}" + host_os_novers=irix6.x + ;; + osf4.*) + MACHINE="OSF1${SUFFIXES}" + host_os_novers=osf4.x + ;; + osf5.*) + MACHINE="OSF1${SUFFIXES}" + host_os_novers=osf5.x + ;; + solaris2.*) + MACHINE=SUN4SOL2 + host_os_novers=solaris2.x + ;; + uxpv*) + MACHINE=VPP5000 + ;; + *) + MACHINE= + host_os_novers=$host_os + ;; +esac + dnl Evolution portage sur CCRT/osf system case $host_os in osf*) @@ -44,14 +123,14 @@ dnl on utilise donc gnu pour generer les dependances. DEPCXX=g++ DEPCXXFLAGS="-Wno-deprecated" DIFFFLAGS="-w" - MACHINE="OSF1" +dnl MACHINE="OSF1" ;; *) DEPCC=${CC-cc} DEPCXX=${CXX-c++} DEPCXXFLAGS="\${CXXFLAGS}" DIFFFLAGS="-b -B" - MACHINE="PCLINUX" +dnl MACHINE="PCLINUX" ;; esac C_DEPEND_FLAG= diff --git a/salome_adm/unix/config_files/check_Salome.m4 b/salome_adm/unix/config_files/check_Salome.m4 new file mode 100644 index 000000000..ff12fd6c3 --- /dev/null +++ b/salome_adm/unix/config_files/check_Salome.m4 @@ -0,0 +1,78 @@ +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +#------------------------------------------------------------ +# Check availability of Salome binary distribution +# +# Author : Marc Tajchman (CEA, 2002) +#------------------------------------------------------------ + +AC_DEFUN([CHECK_SALOME],[ + +AC_CHECKING(for Salome) + +Salome_ok=no + +AC_ARG_WITH(salome, + --with-salome=DIR root directory path of SALOME installation, + SALOME_DIR="$withval",SALOME_DIR="") + +if test "x$SALOME_DIR" == "x" ; then + +# no --with-salome-dir option used + + if test "x$SALOME_ROOT_DIR" != "x" ; then + + # SALOME_ROOT_DIR environment variable defined + SALOME_DIR=$SALOME_ROOT_DIR + + else + + # search Salome binaries in PATH variable + AC_PATH_PROG(TEMP, libMEDMEM_Swig.py) + if test "x$TEMP" != "x" ; then + SALOME_BIN_DIR=`dirname $TEMP` + SALOME_DIR=`dirname $SALOME_BIN_DIR` + fi + + fi +# +fi + +if test -f ${SALOME_DIR}/bin/libMEDMEM_Swig.py ; then + Salome_ok=yes + AC_MSG_RESULT(Using Salome distribution in ${SALOME_DIR}) + + if test "x$SALOME_ROOT_DIR" == "x" ; then + SALOME_ROOT_DIR=${SALOME_DIR} + fi + if test "x$SALOME_SITE_DIR" == "x" ; then + SALOME_SITE_DIR=${SALOME_ROOT_DIR} + fi + AC_SUBST(SALOME_ROOT_DIR) + AC_SUBST(SALOME_SITE_DIR) + +else + AC_MSG_WARN("Cannot find compiled Salome distribution") +fi + +AC_MSG_RESULT(for Salome: $Salome_ok) + +])dnl + diff --git a/salome_adm/unix/config_files/check_boost.m4 b/salome_adm/unix/config_files/check_boost.m4 index 0298be6ee..d1b673c81 100644 --- a/salome_adm/unix/config_files/check_boost.m4 +++ b/salome_adm/unix/config_files/check_boost.m4 @@ -68,6 +68,14 @@ if test "x${BOOSTDIR}" != "x" ; then boost_include_dir_ok=no) fi +BOOST_PROGRAM_OPTIONS_LIB=no +if test "x${boost_include_dir_ok}" = "xyes" ; then + AC_CHECK_FILE(${BOOSTDIR}/include/boost/program_options.hpp, + BOOST_PROGRAM_OPTIONS_LIB=yes, + BOOST_PROGRAM_OPTIONS_LIB=no) +fi +AC_MSG_RESULT(for boost program_options tool: $BOOST_PROGRAM_OPTIONS_LIB) + if test "x${boost_include_dir_ok}" = "xyes" ; then AC_TRY_COMPILE([#include ], [boost::shared_ptr(new int)], @@ -137,6 +145,7 @@ AC_MSG_RESULT(for boost: $boost_ok) AC_SUBST(BOOST_CPPFLAGS) AC_SUBST(BOOST_LIBSUFFIX) AC_SUBST(BOOST_LIBS) +AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) AC_LANG_RESTORE diff --git a/salome_adm/unix/config_files/check_cppunit.m4 b/salome_adm/unix/config_files/check_cppunit.m4 index 9de130c26..4029ea190 100644 --- a/salome_adm/unix/config_files/check_cppunit.m4 +++ b/salome_adm/unix/config_files/check_cppunit.m4 @@ -24,10 +24,17 @@ if test -z "$CPPUNITHOME"; then exits_ok=no if test "x$exits_ok" = "xno"; then for d in /usr/local /usr ; do - AC_CHECK_FILE(${d}/lib/libcppunit.so,exits_ok=yes,exits_ok=no) + AC_CHECK_FILE(${d}/lib64/libcppunit.so,exits_ok=yes,exits_ok=no) + if test "x$exits_ok" = "xyes"; then + CPPUNITHOME=$d + AC_MSG_RESULT(libcppunit.so detected in $d/lib64) + break + fi + AC_CHECK_FILE(${d}/lib/libcppunit.so,exits_ok=yes,exits_ok=no) if test "x$exits_ok" = "xyes"; then CPPUNITHOME=$d AC_MSG_RESULT(libcppunit.so detected in $d/lib) + break fi done fi diff --git a/salome_adm/unix/config_files/check_java.m4 b/salome_adm/unix/config_files/check_java.m4 new file mode 100644 index 000000000..c03e9f7ff --- /dev/null +++ b/salome_adm/unix/config_files/check_java.m4 @@ -0,0 +1,111 @@ +dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +dnl +dnl +dnl +AC_DEFUN([CHECK_JAVA],[ +dnl AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl +dnl AC_REQUIRE([AC_PROG_CPP])dnl + +AC_CHECKING(for JAVA) + +JAVA_INCLUDES="" +JAVA_LIBS="" +JAVA_LDPATH="" + +java_ok=no + +if test -z $JAVAHOME +then + AC_MSG_WARN(define JAVAHOME variable to use Java) +else + java_ok=yes +fi + +if test "x$java_ok" = "xyes" +then + AC_EXEEXT + AC_CHECK_PROG(JAVA, java$EXEEXT,found) + if test "x$JAVA" = "x" + then + java_ok=no + fi + + AC_CHECK_PROG(JAVAC, javac$EXEEXT,found) + if test "x$JAVAC" = "x" + then + java_ok=no + fi +fi + +if test "x$java_ok" = "xyes" +then + version=`$JAVA -version 2>&1 | grep "java version"` + case "$version" in + *1.1.*) + AC_MSG_RESULT(using jdk1.1 version - jdk1.4 required) + java_ok=no;; + *1.2*) + AC_MSG_RESULT(using jdk1.2 version - jdk1.4 required) + java_ok=no;; + *1.3*) + AC_MSG_RESULT(using jdk1.3 version - jdk1.4 required) + java_ok=no;; + *1.4*) + AC_MSG_RESULT(using jdk1.4 version) ;; + esac +fi + +if test "x$java_ok" = "xyes" +then +dnl java headers + LOCAL_INCLUDES=" -I${JAVAHOME}/include -I${JAVAHOME}/include/linux" + CPPFLAGS_old="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES" + AC_CHECK_HEADER(jni.h,java_ok=yes ,java_ok=no) + + CPPFLAGS="$CPPFLAGS_old" +fi + +if test "x$java_ok" = "xyes" +then +dnl libjava library + LOCAL_LIBS="-L${JAVAHOME}/jre/lib/i386 -ljava -L${JAVAHOME}/jre/lib/i386/client -ljvm -lverify" + LIBS_old="$LIBS" + LIBS="$LIBS $LOCAL_LIBS" + + AC_CHECK_LIB(jvm,JNI_CreateJavaVM,java_ok=yes,java_ok=no) + + LIBS="$LIBS_old" +fi + +if test "x$java_ok" = "xyes" +then + JAVA_INCLUDES="$LOCAL_INCLUDES" + JAVA_LIBS="$LOCAL_LIBS" +fi + +AC_SUBST(JAVA_INCLUDES) +AC_SUBST(JAVA_LIBS) +AC_SUBST(JAVA_LDPATH) + +AC_MSG_RESULT(for java: $java_ok) + +])dnl +dnl diff --git a/salome_adm/unix/config_files/check_qt.m4 b/salome_adm/unix/config_files/check_qt.m4 index ab5348319..0472d93dd 100644 --- a/salome_adm/unix/config_files/check_qt.m4 +++ b/salome_adm/unix/config_files/check_qt.m4 @@ -142,8 +142,32 @@ then if test "x$qt_ok" = "xno" then - AC_MSG_RESULT(unable to link with qt library) - AC_MSG_RESULT(QTDIR environment variable may be wrong) + #AC_MSG_RESULT(unable to link with qt library) + #AC_MSG_RESULT(QTDIR environment variable may be wrong) + # BEGIN: for CCRT (installation of qt have only a "lib" directory) + LIBS="$LIBS_old -L$QTDIR/lib -lqt-mt $OGL_LIBS" + + AC_CACHE_VAL(salome_cv_lib_qt,[ + AC_TRY_LINK( +#include +, int n; + char **s; + QApplication a(n, s); + a.exec();, + eval "salome_cv_lib_qt=yes",eval "salome_cv_lib_qt=no") + ]) + qt_ok="$salome_cv_lib_qt" + + if test "x$qt_ok" = "xno" + then + AC_MSG_RESULT(unable to link with qt library) + AC_MSG_RESULT(QTDIR environment variable may be wrong) + else + AC_MSG_RESULT(yes) + QT_LIBS="-L$QTDIR/lib -lqt-mt" + QT_MT_LIBS="-L$QTDIR/lib -lqt-mt" + fi + # END: for CCRT else AC_MSG_RESULT(yes) if test "x$QTDIR" = "x/usr" diff --git a/salome_adm/unix/config_files/config.guess b/salome_adm/unix/config_files/config.guess new file mode 100755 index 000000000..c38553dc7 --- /dev/null +++ b/salome_adm/unix/config_files/config.guess @@ -0,0 +1,1497 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +timestamp='2006-02-23' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:MSYS_NT-*:*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + x86:Interix*:[345]*) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T:Interix*:[345]*) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/salome_adm/unix/config_files/config.sub b/salome_adm/unix/config_files/config.sub new file mode 100755 index 000000000..ad9f39571 --- /dev/null +++ b/salome_adm/unix/config_files/config.sub @@ -0,0 +1,1608 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +timestamp='2006-02-23' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m32c) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + m32c-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/salome_adm/unix/config_files/install-sh b/salome_adm/unix/config_files/install-sh new file mode 100755 index 000000000..6ebe46de6 --- /dev/null +++ b/salome_adm/unix/config_files/install-sh @@ -0,0 +1,323 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2004-12-17.09 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit 0;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit 0;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit 1; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit 0 +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/salome_adm/unix/config_files/ltmain.sh b/salome_adm/unix/config_files/ltmain.sh new file mode 100644 index 000000000..c715b5941 --- /dev/null +++ b/salome_adm/unix/config_files/ltmain.sh @@ -0,0 +1,6871 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION="1.5.22 Debian 1.5.22-4" +TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +duplicate_deps=no +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $mkdir "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || { + $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 + exit $EXIT_FAILURE + } + fi + + $echo "X$my_tmpdir" | $Xsed +} + + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then + exit $exit_status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} +# End of Shell function definitions +##################################### + +# Darwin sucks +eval std_shrext=\"$shrext_cmds\" + +disable_libs=no + +# Parse our command line options once, thoroughly. +while test "$#" -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2005 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $? + ;; + + --config) + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" + done + exit $? + ;; + + --debug) + $echo "$progname: enabling shell trace mode" + set -x + preserve_args="$preserve_args $arg" + ;; + + --dry-run | -n) + run=: + ;; + + --features) + $echo "host: $host" + if test "$build_libtool_libs" = yes; then + $echo "enable shared libraries" + else + $echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + $echo "enable static libraries" + else + $echo "disable static libraries" + fi + exit $? + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) + prevopt="--tag" + prev=tag + preserve_args="$preserve_args --tag" + ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE +fi + +case $disable_libs in +no) + ;; +shared) + build_libtool_libs=no + build_old_libs=yes + ;; +static) + build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` + ;; +esac + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 + case $nonopt in + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit $EXIT_FAILURE + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + base_compile="$base_compile $lastarg" + done # for arg + + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $EXIT_FAILURE + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit $EXIT_FAILURE + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qlibobj="\"$qlibobj\"" ;; + esac + test "X$libobj" != "X$qlibobj" \ + && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$progpath" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + $echo "$srcfile" > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qsrcfile="\"$qsrcfile\"" ;; + esac + + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + fi + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit $EXIT_FAILURE + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit $EXIT_FAILURE + fi + arg=$save_arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + darwin_framework|darwin_framework_skip) + test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit $EXIT_FAILURE + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework|-arch|-isysroot) + case " $CC " in + *" ${arg} ${1} "* | *" ${arg} ${1} "*) + prev=darwin_framework_skip ;; + *) compiler_flags="$compiler_flags $arg" + prev=darwin_framework ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + notinst_path="$notinst_path $dir" + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -pg pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ + -t[45]*|-txscale*|@*) + + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then + exit $exit_status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." + else + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 + exit $EXIT_FAILURE + fi + + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit $EXIT_FAILURE + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $absdir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes ; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$extract_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$old_archive_from_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | + $EGREP ": [^:]* bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit $EXIT_FAILURE + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="$absdir/$objdir" + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="$absdir" + fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, + # but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit $EXIT_FAILURE + else + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + major=`expr $current - $age + 1` + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` + deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for file magic test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name=`expr $a_deplib : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo + if test "X$deplibs_check_method" = "Xnone"; then + $echo "*** Warning: inter-library dependencies are not supported in this platform." + else + $echo "*** Warning: inter-library dependencies are not known to be supported." + fi + $echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$output_la-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadable object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit $EXIT_FAILURE + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $run $rm $export_symbols + $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + else + $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + $echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ +const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + case $host in + *cygwin* | *mingw* ) + if test -f "$output_objdir/${outputname}.def" ; then + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + else + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + fi + ;; + * ) + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + esac + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + exit_status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $exit_status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + output_name=`basename $output` + output_path=`dirname $output` + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +/* -DDEBUG is fairly common in CFLAGS. */ +#undef DEBUG +#if defined DEBUGWRAPPER +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) +#else +# define DEBUG(format, ...) +#endif + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +const char * base_name (const char *name); +char * find_executable(const char *wrapper); +int check_executable(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup (base_name (argv[0])); + DEBUG("(main) argv[0] : %s\n",argv[0]); + DEBUG("(main) program_name : %s\n",program_name); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = find_executable(argv[0]); + if (newargz[1] == NULL) + lt_fatal("Couldn't find %s", argv[0]); + DEBUG("(main) found exe at : %s\n",newargz[1]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; + + for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" + return 127; +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char)name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable(const char * path) +{ + struct stat st; + + DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) && + ( + /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ +#if defined (S_IXOTH) + ((st.st_mode & S_IXOTH) == S_IXOTH) || +#endif +#if defined (S_IXGRP) + ((st.st_mode & S_IXGRP) == S_IXGRP) || +#endif + ((st.st_mode & S_IXUSR) == S_IXUSR)) + ) + return 1; + else + return 0; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise */ +char * +find_executable (const char* wrapper) +{ + int has_slash = 0; + const char* p; + const char* p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char* concat_name; + + DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char* path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char* q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR(*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + return NULL; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + $echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit $EXIT_FAILURE + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + $echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit $EXIT_FAILURE + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit $EXIT_FAILURE + fi +fi\ +" + chmod +x $output + fi + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$gentop"; then + exit $exit_status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + + eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + eval cmd=\"$cmd\" + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit $EXIT_SUCCESS + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) prev=$arg ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit $EXIT_FAILURE + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + cmds=$postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit $EXIT_FAILURE + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir=`func_mktempdir` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$old_striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + cmds=$old_postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + cmds=$finish_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit $EXIT_SUCCESS + + $echo "X----------------------------------------------------------------------" | $Xsed + $echo "Libraries have been installed in:" + for libdir in $libdirs; do + $echo " $libdir" + done + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" + fi + if test -n "$runpath_var"; then + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit $EXIT_FAILURE + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit $EXIT_FAILURE + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit $EXIT_SUCCESS + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + cmds=$postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + cmds=$old_postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit $EXIT_FAILURE +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE. + +Report bugs to ." + exit $EXIT_SUCCESS + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; +esac + +$echo +$echo "Try \`$modename --help' for more information about other modes." + +exit $? + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +disable_libs=shared +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +disable_libs=static +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/salome_adm/unix/config_files/missing b/salome_adm/unix/config_files/missing new file mode 100644 index 000000000..7789652e8 --- /dev/null +++ b/salome_adm/unix/config_files/missing @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/salome_adm/unix/config_files/production.m4 b/salome_adm/unix/config_files/production.m4 index 8157d677d..e4a61870b 100644 --- a/salome_adm/unix/config_files/production.m4 +++ b/salome_adm/unix/config_files/production.m4 @@ -103,4 +103,4 @@ fi ]) # AC_DISABLE_DEBUG - set the default flag to --disable-debug -AC_DEFUN([AC_DISABLE_DEBUG], [AC_ENABLE_DEBUG(no)]) \ No newline at end of file +AC_DEFUN([AC_DISABLE_DEBUG], [AC_ENABLE_DEBUG(no)]) diff --git a/salome_adm/unix/sstream.in b/salome_adm/unix/sstream.in new file mode 100644 index 000000000..323bbed45 --- /dev/null +++ b/salome_adm/unix/sstream.in @@ -0,0 +1,225 @@ +/* This is part of libio/iostream, providing -*- C++ -*- input/output. +Copyright (C) 2000 Free Software Foundation + +This file is part of the GNU IO Library. This library is free +software; you can redistribute it and/or modify it under the +terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) +any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this library; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +As a special exception, if you link this library with files +compiled with a GNU compiler to produce an executable, this does not cause +the resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why +the executable file might be covered by the GNU General Public License. */ + +/* Written by Magnus Fromreide (magfr@lysator.liu.se). */ + +#ifndef __SSTREAM__ +#define __SSTREAM__ + +#include +#include +#include + +namespace std +{ + class stringbuf : public streambuf + { + public: + typedef char char_type; + typedef int int_type; + typedef streampos pos_type; + typedef streamoff off_type; + + explicit stringbuf(int which=ios::in|ios::out) : + streambuf(which), buf(), mode(static_cast(which)), + rpos(0), bufsize(1) + { } + + explicit stringbuf(const std::string &s, int which=ios::in|ios::out) : + streambuf(which), buf(s), mode(static_cast(which)), + bufsize(1) + { + if(mode & ios::in) + { + setg(&defbuf, &defbuf + bufsize, &defbuf + bufsize); + } + if(mode & ios::out) + { + setp(&defbuf, &defbuf + bufsize); + } + rpos = (mode & ios::ate ? s.size() : 0); + } + + std::string str() const + { + const_cast(this)->sync(); // Sigh, really ugly hack + return buf; + }; + + void str(const std::string& s) + { + buf = s; + if(mode & ios::in) + { + gbump(egptr() - gptr()); + } + if(mode & ios::out) + { + pbump(pbase() - pptr()); + } + rpos = (mode & ios::ate ? s.size() : 0); + } + + protected: + inline virtual int sync(); + inline virtual int overflow(int = EOF); + inline virtual int underflow(); + private: + std::string buf; + ios::open_mode mode; + std::string::size_type rpos; + streamsize bufsize; + char defbuf; + }; + + class stringstreambase : virtual public ios { + protected: + stringbuf __my_sb; + public: + std::string str() const + { + return dynamic_cast(_strbuf)->str(); + } + void str(const std::string& s) + { + clear(); + dynamic_cast(_strbuf)->str(s); + } + + stringbuf* rdbuf() + { + return &__my_sb; + } + protected: + stringstreambase(int which) : + __my_sb(which) + { + init (&__my_sb); + } + + stringstreambase(const std::string& s, int which) : + __my_sb(s, which) + { + init (&__my_sb); + } + }; + + class istringstream : public stringstreambase, public istream { + public: + istringstream(int which=ios::in) : + stringstreambase(which) + { } + + istringstream(const std::string& s, int which=ios::in) : + stringstreambase(s, which) + { } + }; + + class ostringstream : public stringstreambase, public ostream { + public: + ostringstream(int which=ios::out) : + stringstreambase(which) + { } + + ostringstream(const std::string& s, int which=ios::out) : + stringstreambase(s, which) + { } + }; + + class stringstream : public stringstreambase, public iostream { + public: + stringstream(int which=ios::in|ios::out) : + stringstreambase(which) + { } + + stringstream(const std::string &s, int which=ios::in|ios::out) : + stringstreambase(s, which) + { } + }; +} + +inline int std::stringbuf::sync() +{ + if((mode & ios::out) == 0) + return EOF; + + streamsize n = pptr() - pbase(); + if(n) + { + buf.replace(rpos, std::string::npos, pbase(), n); + if(buf.size() - rpos != n) + return EOF; + rpos += n; + pbump(-n); + gbump(egptr() - gptr()); + } + return 0; +} + +inline int std::stringbuf::overflow(int ch) +{ + if((mode & ios::out) == 0) + return EOF; + + streamsize n = pptr() - pbase(); + + if(n && sync()) + return EOF; + + if(ch != EOF) + { + std::string::size_type oldSize = buf.size(); + + buf.replace(rpos, std::string::npos, ch); + if(buf.size() - oldSize != 1) + return EOF; + ++rpos; + } + return 0; +} + +inline int std::stringbuf::underflow() +{ + sync(); + if((mode & ios::in) == 0) + { + return EOF; + } + if(rpos >= buf.size()) + { + return EOF; + } + + std::string::size_type n = egptr() - eback(); + std::string::size_type s; + + s = buf.copy(eback(), n, rpos); + pbump(pbase() - pptr()); + gbump(eback() - gptr()); + int res = (0377 & buf[rpos]); + rpos += s; + return res; +} + +#endif /* not __STRSTREAM__ */ diff --git a/src/Basics/BasicsGenericDestructor.cxx b/src/Basics/BasicsGenericDestructor.cxx index 04469b9c0..9c1e21300 100644 --- a/src/Basics/BasicsGenericDestructor.cxx +++ b/src/Basics/BasicsGenericDestructor.cxx @@ -37,9 +37,12 @@ using namespace std; void HouseKeeping(); std::list PROTECTED_DELETE::_objList; -//CCRT -pthread_mutex_t PROTECTED_DELETE::_listMutex = PTHREAD_MUTEX_INITIALIZER ; -//pthread_mutex_t PROTECTED_DELETE::_listMutex ; +#ifndef WNT +pthread_mutex_t PROTECTED_DELETE::_listMutex; +#else +pthread_mutex_t PROTECTED_DELETE::_listMutex = + PTHREAD_MUTEX_INITIALIZER; +#endif std::list *GENERIC_DESTRUCTOR::Destructors = 0; static bool atExitSingletonDone = false ; diff --git a/src/Basics/BasicsGenericDestructor.hxx b/src/Basics/BasicsGenericDestructor.hxx index 3435c7e4b..9ccbb1749 100644 --- a/src/Basics/BasicsGenericDestructor.hxx +++ b/src/Basics/BasicsGenericDestructor.hxx @@ -29,6 +29,24 @@ #ifndef _BASICGENERICDESTRUCTOR_HXX_ #define _BASICGENERICDESTRUCTOR_HXX_ +#ifdef WNT + #if defined BASICS_EXPORTS + #if defined WIN32 + #define BASICS_EXPORT __declspec( dllexport ) + #else + #define BASICS_EXPORT + #endif + #else + #if defined WIN32 + #define BASICS_EXPORT __declspec( dllimport ) + #else + #define BASICS_EXPORT + #endif + #endif +#else + #define BASICS_EXPORT +#endif + #include #include #include @@ -37,20 +55,6 @@ #include #include -#if defined BASICS_EXPORTS -#if defined WIN32 -#define BASICS_EXPORT __declspec( dllexport ) -#else -#define BASICS_EXPORT -#endif -#else -#if defined WNT -#define BASICS_EXPORT __declspec( dllimport ) -#else -#define BASICS_EXPORT -#endif -#endif - //#define _DEVDEBUG_ #ifdef _DEVDEBUG_ @@ -79,7 +83,7 @@ */ // ============================================================================ -class PROTECTED_DELETE +class BASICS_EXPORT PROTECTED_DELETE { public: static void deleteInstance(PROTECTED_DELETE *anObject); @@ -111,14 +115,14 @@ private: */ // ============================================================================ -class GENERIC_DESTRUCTOR +class BASICS_EXPORT GENERIC_DESTRUCTOR { public : - BASICS_EXPORT static std::list *Destructors; + static std::list *Destructors; virtual ~GENERIC_DESTRUCTOR() {}; - BASICS_EXPORT static const int Add(GENERIC_DESTRUCTOR &anObject); - BASICS_EXPORT virtual void operator()(void) = 0; + static const int Add(GENERIC_DESTRUCTOR &anObject); + virtual void operator()(void) = 0; }; // ============================================================================ @@ -142,7 +146,6 @@ public : template class DESTRUCTOR_OF : public GENERIC_DESTRUCTOR { - public: /*! Programs the destruction at the end of the process, of the object anObject. diff --git a/src/Batch/Batch_Parametre.hxx b/src/Batch/Batch_Parametre.hxx index 125611351..bd9a9f294 100644 --- a/src/Batch/Batch_Parametre.hxx +++ b/src/Batch/Batch_Parametre.hxx @@ -54,7 +54,7 @@ namespace Batch { Parametre(); // Constructeur par recopie - Parametre::Parametre(const Parametre & PM); + Parametre(const Parametre & PM); // Operateur de recherche dans la map Versatile & operator [] (const string &); diff --git a/src/Communication/Makefile.am b/src/Communication/Makefile.am index 61024dcba..b33cdbb0a 100644 --- a/src/Communication/Makefile.am +++ b/src/Communication/Makefile.am @@ -31,7 +31,8 @@ salomeinclude_HEADERS = \ MultiCommException.hxx \ SALOME_Comm_i.hxx \ MatrixClient.hxx \ - SALOME_Matrix_i.hxx + SALOME_Matrix_i.hxx \ + SALOME_Communication.hxx # Scripts to be installed diff --git a/src/Communication/MatrixClient.hxx b/src/Communication/MatrixClient.hxx index 2d4a7427b..c26d6a751 100644 --- a/src/Communication/MatrixClient.hxx +++ b/src/Communication/MatrixClient.hxx @@ -19,10 +19,12 @@ #ifndef __MATRIXCLIENT_HXX__ #define __MATRIXCLIENT_HXX__ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Comm) -class MatrixClient +class COMMUNICATION_EXPORT MatrixClient { public: static double *getValue(SALOME::Matrix_ptr distMat, int& columnSize, int& rowSize); diff --git a/src/Communication/MultiCommException.hxx b/src/Communication/MultiCommException.hxx index 38054547c..a6d4277bb 100644 --- a/src/Communication/MultiCommException.hxx +++ b/src/Communication/MultiCommException.hxx @@ -20,10 +20,11 @@ #ifndef _MULTICOMMEXCEPTION_HXX_ #define _MULTICOMMEXCEPTION_HXX_ -#include +#include +#include -class MultiCommException { +class COMMUNICATION_EXPORT MultiCommException { private: std::string _message; public: diff --git a/src/Communication/ReceiverFactory.hxx b/src/Communication/ReceiverFactory.hxx index 2bf964845..453430e66 100644 --- a/src/Communication/ReceiverFactory.hxx +++ b/src/Communication/ReceiverFactory.hxx @@ -20,6 +20,8 @@ #ifndef _RECEIVERFACTORY_HXX_ #define _RECEIVERFACTORY_HXX_ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Comm) #include "MultiCommException.hxx" @@ -28,7 +30,7 @@ This class internally builds a receiver associated with the sender given. It also performs transfert completely and clean up the objects. This is the only class used client side of an array. */ -class ReceiverFactory +class COMMUNICATION_EXPORT ReceiverFactory { public: static double *getValue(SALOME::SenderDouble_ptr sender,long &size)throw(MultiCommException); diff --git a/src/Communication/Receivers.cxx b/src/Communication/Receivers.cxx index f785ffaf3..0117680f4 100644 --- a/src/Communication/Receivers.cxx +++ b/src/Communication/Receivers.cxx @@ -17,7 +17,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "poa.h" +#include "omniORB4/poa.h" #include "utilities.h" using namespace std; diff --git a/src/Communication/SALOMEMultiComm.hxx b/src/Communication/SALOMEMultiComm.hxx index 208dbbd8e..52b43168c 100644 --- a/src/Communication/SALOMEMultiComm.hxx +++ b/src/Communication/SALOMEMultiComm.hxx @@ -20,6 +20,8 @@ #ifndef _SALOMEMULTICOMM_HXX_ #define _SALOMEMULTICOMM_HXX_ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Comm) @@ -27,7 +29,7 @@ Class is designed to ease the use of multi communication.\n Simply inherite from it your servant class you want to emit data with senders. */ -class SALOMEMultiComm : public virtual POA_SALOME::MultiCommClass { +class COMMUNICATION_EXPORT SALOMEMultiComm : public virtual POA_SALOME::MultiCommClass { protected: SALOME::TypeOfCommunication _type; public: diff --git a/src/Communication/SALOME_Comm_i.cxx b/src/Communication/SALOME_Comm_i.cxx index c22771c90..02f7e68fd 100644 --- a/src/Communication/SALOME_Comm_i.cxx +++ b/src/Communication/SALOME_Comm_i.cxx @@ -21,7 +21,7 @@ #ifndef WNT #include #endif -#include "poa.h" +#include "omniORB4/poa.h" #include "omnithread.h" #include "Utils_SINGLETON.hxx" #include "Utils_ORB_INIT.hxx" diff --git a/src/Communication/SALOME_Comm_i.hxx b/src/Communication/SALOME_Comm_i.hxx index 8274cefd7..4bcde2ef4 100644 --- a/src/Communication/SALOME_Comm_i.hxx +++ b/src/Communication/SALOME_Comm_i.hxx @@ -20,6 +20,8 @@ #ifndef _SALOME_COMM_I_HXX_ #define _SALOME_COMM_I_HXX_ +#include + #ifdef HAVE_MPI2 #include "mpi.h" #endif @@ -34,7 +36,7 @@ Generic servant class for senders that factorizes all the common methods and attributes necessary to senders. All servant classes for senders have to inheritate from it. */ -class SALOME_Sender_i : public virtual POA_SALOME::Sender, +class COMMUNICATION_EXPORT SALOME_Sender_i : public virtual POA_SALOME::Sender, public PortableServer::RefCountServantBase { protected: /*! Pointer to the generic array to transmit*/ @@ -58,7 +60,7 @@ public: virtual ~SALOME_Sender_i() {} }; -class SALOME_SenderDouble_i : public virtual POA_SALOME::SenderDouble, +class COMMUNICATION_EXPORT SALOME_SenderDouble_i : public virtual POA_SALOME::SenderDouble, public virtual SALOME_Sender_i { public: @@ -69,7 +71,7 @@ public: static SALOME_SenderDouble_i *find(SALOME::SenderDouble_ptr pCorba); }; -class SALOME_SenderInt_i : public virtual POA_SALOME::SenderInt, +class COMMUNICATION_EXPORT SALOME_SenderInt_i : public virtual POA_SALOME::SenderInt, public virtual SALOME_Sender_i { public: @@ -82,7 +84,7 @@ public: /*! Servant class for CORBA sender for double* when no copy of array _tabToSend is required, that is to say double and CORBA::Double are binary equal. */ -class SALOME_CorbaDoubleNCSender_i : public POA_SALOME::CorbaDoubleNCSender, +class COMMUNICATION_EXPORT SALOME_CorbaDoubleNCSender_i : public POA_SALOME::CorbaDoubleNCSender, public SALOME_SenderDouble_i { public: @@ -95,7 +97,7 @@ public: /*! Servant class for CORBA sender for double* when copy of array _tabToSend is required, that is to say double and CORBA::Double are NOT binary equal. */ -class SALOME_CorbaDoubleCSender_i : public POA_SALOME::CorbaDoubleCSender, +class COMMUNICATION_EXPORT SALOME_CorbaDoubleCSender_i : public POA_SALOME::CorbaDoubleCSender, public SALOME_SenderDouble_i { public: @@ -107,7 +109,7 @@ public: /*! Servant class for CORBA sender for int* when no copy of array _tabToSend is required, that is to say int and CORBA::Long are binary equal. */ -class SALOME_CorbaLongNCSender_i : public POA_SALOME::CorbaLongNCSender, +class COMMUNICATION_EXPORT SALOME_CorbaLongNCSender_i : public POA_SALOME::CorbaLongNCSender, public SALOME_SenderInt_i { public: @@ -120,7 +122,7 @@ public: /*! Servant class for CORBA sender for int* when copy of array _tabToSend is required, that is to say int and CORBA::Long are NOT binary equal. */ -class SALOME_CorbaLongCSender_i : public POA_SALOME::CorbaLongCSender, +class COMMUNICATION_EXPORT SALOME_CorbaLongCSender_i : public POA_SALOME::CorbaLongCSender, public SALOME_SenderInt_i { public: @@ -137,7 +139,7 @@ public: /*! Servant class of sender using MPI2. */ -class SALOME_MPISender_i : public virtual POA_SALOME::MPISender, +class COMMUNICATION_EXPORT SALOME_MPISender_i : public virtual POA_SALOME::MPISender, public virtual SALOME_Sender_i { private: @@ -168,7 +170,7 @@ private: static void* myThread(void *args); }; -class SALOME_MPISenderDouble_i : public POA_SALOME::MPISenderDouble, +class COMMUNICATION_EXPORT SALOME_MPISenderDouble_i : public POA_SALOME::MPISenderDouble, public SALOME_SenderDouble_i, public SALOME_MPISender_i { @@ -176,7 +178,7 @@ public: SALOME_MPISenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false); }; -class SALOME_MPISenderInt_i : public POA_SALOME::MPISenderInt, +class COMMUNICATION_EXPORT SALOME_MPISenderInt_i : public POA_SALOME::MPISenderInt, public SALOME_SenderInt_i, public SALOME_MPISender_i { @@ -190,7 +192,7 @@ public: /*! Servant class of sender using Sockets. */ -class SALOME_SocketSender_i : public virtual POA_SALOME::SocketSender, +class COMMUNICATION_EXPORT SALOME_SocketSender_i : public virtual POA_SALOME::SocketSender, public virtual SALOME_Sender_i { private: @@ -217,7 +219,7 @@ private: std::string inetAddress(); }; -class SALOME_SocketSenderDouble_i : public POA_SALOME::SocketSenderDouble, +class COMMUNICATION_EXPORT SALOME_SocketSenderDouble_i : public POA_SALOME::SocketSenderDouble, public SALOME_SenderDouble_i, public SALOME_SocketSender_i { @@ -225,7 +227,7 @@ public: SALOME_SocketSenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false); }; -class SALOME_SocketSenderInt_i : public POA_SALOME::SocketSenderInt, +class COMMUNICATION_EXPORT SALOME_SocketSenderInt_i : public POA_SALOME::SocketSenderInt, public SALOME_SenderInt_i, public SALOME_SocketSender_i { diff --git a/src/Communication/SALOME_Communication.hxx b/src/Communication/SALOME_Communication.hxx new file mode 100755 index 000000000..c3593fbc5 --- /dev/null +++ b/src/Communication/SALOME_Communication.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_Communication.hxx +// Author : Alexander A. BORODIN +// Module : SALOME + +#ifndef _SALOME_COMMIUNICATION_HXX_ +#define _SALOME_COMMIUNICATION_HXX_ + +#ifdef WNT + #if defined COMMUNICATION_EXPORTS + #if defined WIN32 + #define COMMUNICATION_EXPORT __declspec( dllexport ) + #else + #define COMMUNICATION_EXPORT + #endif + #else + #if defined WIN32 + #define COMMUNICATION_EXPORT __declspec( dllimport ) + #else + #define COMMUNICATION_EXPORT + #endif + #endif +#else + #define COMMUNICATION_EXPORT +#endif + +#endif \ No newline at end of file diff --git a/src/Communication/SenderFactory.hxx b/src/Communication/SenderFactory.hxx index d8d61f28e..86aa74875 100644 --- a/src/Communication/SenderFactory.hxx +++ b/src/Communication/SenderFactory.hxx @@ -20,6 +20,8 @@ #ifndef _SENDERFACTORY_HXX_ #define _SENDERFACTORY_HXX_ +#include + #include "MultiCommException.hxx" #include #include CORBA_SERVER_HEADER(SALOME_Comm) @@ -32,7 +34,7 @@ class SALOME_SenderInt_i; /*! This class implements the factory pattern of GoF by making a sender by giving an array and a communicator.It completely hides the type of sender from the user. */ -class SenderFactory +class COMMUNICATION_EXPORT SenderFactory { public: static SALOME::SenderDouble_ptr buildSender(SALOMEMultiComm &multiCommunicator,const double *tab,long lgr,bool ownTab=false) throw(MultiCommException); diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index 9b2174d46..6e58840bc 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -30,12 +30,11 @@ #include #include #include -#include #ifndef WNT +#include #include #include #else -#include "../../adm/win32/SALOME_WNT.hxx" #include #include int SIGUSR1 = 1000; @@ -43,11 +42,11 @@ int SIGUSR1 = 1000; #include "utilities.h" #include -#ifndef WNT +//#ifndef WNT #include CORBA_SERVER_HEADER(SALOME_Component) -#else -#include -#endif +//#else +//#include +//#endif #include // must be before Python.h ! #include "SALOME_Container_i.hxx" #include "SALOME_Component_i.hxx" @@ -73,7 +72,7 @@ char ** _ArgV ; extern "C" {void ActSigIntHandler() ; } #ifndef WNT -extern "C" {void SigIntHandler(int, siginfo_t *, void *) ; } + extern "C" {void SigIntHandler(int, siginfo_t *, void *) ; } #else extern "C" {void SigIntHandler( int ) ; } #endif @@ -179,12 +178,26 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, if (!_isSupervContainer) { +#ifdef WNT + //Py_ACQUIRE_NEW_THREAD; + PyEval_AcquireLock(); + /* It should not be possible for more than one thread state + to be used for a thread.*/ + PyThreadState *myTstate = PyGILState_GetThisThreadState(); + // if no thread state defined + if ( !myTstate ) + myTstate = PyThreadState_New(KERNEL_PYTHON::_interp); + PyThreadState *myoldTstate = PyThreadState_Swap(myTstate); +#else Py_ACQUIRE_NEW_THREAD; +#endif + #ifdef WNT // mpv: this is temporary solution: there is a unregular crash if not - Sleep(2000); + //Sleep(2000); + // + // first element is the path to Registry.dll, but it's wrong PyRun_SimpleString("import sys\n"); - // first element is the path to Registry.dll, but it's wrong PyRun_SimpleString("sys.path = sys.path[1:]\n"); #endif PyRun_SimpleString("import SALOME_Container\n"); @@ -267,7 +280,16 @@ void Engines_Container_i::ping() void Engines_Container_i::Shutdown() { MESSAGE("Engines_Container_i::Shutdown()"); + + /* For each component contained in this container + * tell it to self-destroy + */ + std::map::iterator itm; + for (itm = _listInstances_map.begin(); itm != _listInstances_map.end(); itm++) + itm->second->destroy(); + _NS->Destroy_FullDirectory(_containerName.c_str()); + _NS->Destroy_Name(_containerName.c_str()); //_remove_ref(); //_poa->deactivate_object(*_id); if(_isServantAloneInProcess) @@ -315,25 +337,27 @@ Engines_Container_i::load_component_Library(const char* componentName) return true; } +#ifndef WNT void* handle; -#if defined( WNT ) - handle = dlopen( impl_name.c_str() , 0 ) ; -//#elif defined( __osf1__ ) -// handle = dlopen( impl_name.c_str() , RTLD_NOW ) ; -#else handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ; +#else + HINSTANCE handle; + handle = LoadLibrary( impl_name.c_str() ); #endif + if ( handle ) - { + { _library_map[impl_name] = handle; _numInstanceMutex.unlock(); return true; - } + } else - { - INFOS("Can't load shared library : " << impl_name); + { + INFOS( "Can't load shared library: " << impl_name ); +#ifndef WNT INFOS("error dlopen: " << dlerror()); - } +#endif + } _numInstanceMutex.unlock(); // --- try import Python component @@ -764,16 +788,20 @@ Engines_Container_i::createInstance(string genericRegisterName, const char *, const char *) ; - FACTORY_FUNCTION Component_factory - = (FACTORY_FUNCTION) dlsym(handle, factory_name.c_str()); +#ifndef WNT + FACTORY_FUNCTION Component_factory = (FACTORY_FUNCTION)dlsym( handle, factory_name.c_str() ); +#else + FACTORY_FUNCTION Component_factory = (FACTORY_FUNCTION)GetProcAddress( (HINSTANCE)handle, factory_name.c_str() ); +#endif - char *error ; - if ( (error = dlerror() ) != NULL) - { - INFOS("Can't resolve symbol: " + factory_name); - SCRUTE(error); + if ( !Component_factory ) + { + INFOS( "Can't resolve symbol: " + factory_name ); +#ifndef WNT + SCRUTE( dlerror() ); +#endif return Engines::Component::_nil() ; - } + } // --- create instance @@ -797,7 +825,9 @@ Engines_Container_i::createInstance(string genericRegisterName, PortableServer::ObjectId *id ; //not owner, do not delete (nore use var) id = (Component_factory) ( _orb, _poa, _id, instanceName.c_str(), aGenRegisterName.c_str() ) ; - + if (id == NULL) + return iobject._retn(); + // --- get reference & servant from id CORBA::Object_var obj = _poa->id_to_reference(*id); @@ -1010,4 +1040,3 @@ void SigIntHandler( int what ) } } #endif - diff --git a/src/Container/Container_init_python.cxx b/src/Container/Container_init_python.cxx index d3d511712..bea28a668 100644 --- a/src/Container/Container_init_python.cxx +++ b/src/Container/Container_init_python.cxx @@ -27,7 +27,9 @@ // $Header$ #include -#include +#ifndef WNT + #include +#endif #include "utilities.h" diff --git a/src/Container/Container_init_python.hxx b/src/Container/Container_init_python.hxx index 156adb1e5..dcdaed6e1 100644 --- a/src/Container/Container_init_python.hxx +++ b/src/Container/Container_init_python.hxx @@ -29,6 +29,8 @@ #ifndef _CONTAINER_INIT_PYTHON_HXX_ #define _CONTAINER_INIT_PYTHON_HXX_ +#include + #include // must be before Python.h ! #include @@ -45,20 +47,6 @@ // - There is no need of C Lock protection of the sequence. -#if defined CONTAINER_EXPORTS -#if defined WIN32 -#define CONTAINER_EXPORT __declspec( dllexport ) -#else -#define CONTAINER_EXPORT -#endif -#else -#if defined WNT -#define CONTAINER_EXPORT __declspec( dllimport ) -#else -#define CONTAINER_EXPORT -#endif -#endif - #define Py_ACQUIRE_NEW_THREAD \ PyEval_AcquireLock(); \ PyThreadState *myTstate = PyThreadState_New(KERNEL_PYTHON::_interp); \ diff --git a/src/Container/Makefile.am b/src/Container/Makefile.am index 1241d4a4f..4b633933a 100644 --- a/src/Container/Makefile.am +++ b/src/Container/Makefile.am @@ -41,7 +41,8 @@ salomeinclude_HEADERS = \ SALOME_FileTransfer_i.hxx \ SALOME_FileRef_i.hxx \ SALOME_ContainerManager.hxx \ - Container_init_python.hxx + Container_init_python.hxx \ + SALOME_Container.hxx # Scripts to be installed dist_salomescript_DATA =\ diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index 6b4261d78..5107cb59e 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -29,6 +29,8 @@ #ifndef _SALOME_COMPONENT_I_HXX_ #define _SALOME_COMPONENT_I_HXX_ +#include + #include #include #include @@ -45,20 +47,6 @@ class RegistryConnexion; class Engines_Container_i; -#if defined CONTAINER_EXPORTS -#if defined WIN32 -#define CONTAINER_EXPORT __declspec( dllexport ) -#else -#define CONTAINER_EXPORT -#endif -#else -#if defined WNT -#define CONTAINER_EXPORT __declspec( dllimport ) -#else -#define CONTAINER_EXPORT -#endif -#endif - class CONTAINER_EXPORT Engines_Component_i: public virtual POA_Engines::Component, public virtual PortableServer::RefCountServantBase diff --git a/src/Container/SALOME_Container.cxx b/src/Container/SALOME_Container.cxx index 0415c2141..ab3e599a7 100644 --- a/src/Container/SALOME_Container.cxx +++ b/src/Container/SALOME_Container.cxx @@ -35,8 +35,11 @@ #include #include #include -#include -#include +#ifndef WNT +# include +# include +#endif + #ifndef WNT #include @@ -70,7 +73,7 @@ int main(int argc, char* argv[]) //CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ; ORB_INIT &init = *SINGLETON_::Instance() ; ASSERT(SINGLETON_::IsAlreadyExisting()); - CORBA::ORB_ptr orb = init(0 , 0 ) ; + CORBA::ORB_ptr orb = init(argc , argv ) ; // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); INFOS_COMPILATION; diff --git a/src/Container/SALOME_Container.hxx b/src/Container/SALOME_Container.hxx new file mode 100755 index 000000000..9cd47d400 --- /dev/null +++ b/src/Container/SALOME_Container.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_Container.hxx +// Author : Alexander A. BORODIN +// Module : SALOME + +#ifndef _SALOME_Container_HXX_ +#define _SALOME_Container_HXX_ + +#ifdef WNT + #if defined CONTAINER_EXPORTS + #if defined WIN32 + #define CONTAINER_EXPORT __declspec( dllexport ) + #else + #define CONTAINER_EXPORT + #endif + #else + #if defined WIN32 + #define CONTAINER_EXPORT __declspec( dllimport ) + #else + #define CONTAINER_EXPORT + #endif + #endif +#else + #define CONTAINER_EXPORT +#endif + +#endif \ No newline at end of file diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 61aa660fc..8998aa2e3 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -111,7 +111,23 @@ void SALOME_ContainerManager::ShutdownContainers() MESSAGE("ShutdownContainers"); _NS->Change_Directory("/Containers"); vector vec = _NS->list_directory_recurs(); + list lstCont; for(vector::iterator iter = vec.begin();iter!=vec.end();iter++) + { + SCRUTE((*iter)); + CORBA::Object_var obj=_NS->Resolve((*iter).c_str()); + Engines::Container_var cont=Engines::Container::_narrow(obj); + if(!CORBA::is_nil(cont)) + { + lstCont.push_back((*iter)); + } + } + MESSAGE("Container list: "); + for(list::iterator iter=lstCont.begin();iter!=lstCont.end();iter++) + { + SCRUTE((*iter)); + } + for(list::iterator iter=lstCont.begin();iter!=lstCont.end();iter++) { SCRUTE((*iter)); CORBA::Object_var obj=_NS->Resolve((*iter).c_str()); diff --git a/src/Container/SALOME_ContainerManager.hxx b/src/Container/SALOME_ContainerManager.hxx index 82492f71e..d74988084 100644 --- a/src/Container/SALOME_ContainerManager.hxx +++ b/src/Container/SALOME_ContainerManager.hxx @@ -20,6 +20,8 @@ #ifndef __SALOME_CONTAINERMANAGER_HXX__ #define __SALOME_CONTAINERMANAGER_HXX__ +#include + #include #include CORBA_CLIENT_HEADER(SALOME_Component) #include CORBA_CLIENT_HEADER(SALOME_ContainerManager) @@ -30,20 +32,6 @@ class SALOME_NamingService; -#if defined CONTAINER_EXPORTS -#if defined WIN32 -#define CONTAINER_EXPORT __declspec( dllexport ) -#else -#define CONTAINER_EXPORT -#endif -#else -#if defined WNT -#define CONTAINER_EXPORT __declspec( dllimport ) -#else -#define CONTAINER_EXPORT -#endif -#endif - class CONTAINER_EXPORT SALOME_ContainerManager: public POA_Engines::ContainerManager, public PortableServer::RefCountServantBase diff --git a/src/Container/SALOME_ContainerPy.py b/src/Container/SALOME_ContainerPy.py index 6eb0110bc..0de0f3454 100755 --- a/src/Container/SALOME_ContainerPy.py +++ b/src/Container/SALOME_ContainerPy.py @@ -31,7 +31,9 @@ import os import sys import string + import omnipatch # PAL10310 + from omniORB import CORBA, PortableServer import SALOMEDS import Engines, Engines__POA @@ -309,15 +311,19 @@ class SALOME_ContainerPy_i (Engines__POA.Container): #============================================================================= #initialise the ORB and find the root POA +print "Starting ",sys.argv[1] orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) poa = orb.resolve_initial_references("RootPOA") +print "ORB and POA initialized" #create an instance of SALOME_ContainerPy_i and a Container reference #containerName = "FactoryServerPy" MESSAGE( str(sys.argv) ) containerName = sys.argv[1] cpy_i = SALOME_ContainerPy_i(orb, poa, containerName) +print "SALOME_ContainerPy_i instance created ",cpy_i cpy_o = cpy_i._this() +print "SALOME_ContainerPy_i instance activated ",cpy_o #activate the POA poaManager = poa._get_the_POAManager() diff --git a/src/Container/SALOME_Container_SignalsHandler.cxx b/src/Container/SALOME_Container_SignalsHandler.cxx index bc233e4ab..cb1117ed7 100644 --- a/src/Container/SALOME_Container_SignalsHandler.cxx +++ b/src/Container/SALOME_Container_SignalsHandler.cxx @@ -19,7 +19,7 @@ #include -#include +#include #include "utilities.h" // CCRT porting diff --git a/src/Container/SALOME_Container_i.hxx b/src/Container/SALOME_Container_i.hxx index 14d51c5df..181c4f84e 100644 --- a/src/Container/SALOME_Container_i.hxx +++ b/src/Container/SALOME_Container_i.hxx @@ -29,6 +29,8 @@ #ifndef _SALOME_CONTAINER_I_HXX_ #define _SALOME_CONTAINER_I_HXX_ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Component) @@ -45,21 +47,6 @@ class SALOME_NamingService; - -#if defined CONTAINER_EXPORTS -#if defined WIN32 -#define CONTAINER_EXPORT __declspec( dllexport ) -#else -#define CONTAINER_EXPORT -#endif -#else -#if defined WNT -#define CONTAINER_EXPORT __declspec( dllimport ) -#else -#define CONTAINER_EXPORT -#endif -#endif - class CONTAINER_EXPORT Engines_Container_i: public virtual POA_Engines::Container, public virtual PortableServer::RefCountServantBase diff --git a/src/Container/SALOME_FileRef_i.hxx b/src/Container/SALOME_FileRef_i.hxx index 0856bb1c1..61b3f52f2 100644 --- a/src/Container/SALOME_FileRef_i.hxx +++ b/src/Container/SALOME_FileRef_i.hxx @@ -26,13 +26,15 @@ #ifndef _SALOME_FILEREF_I_HXX_ #define _SALOME_FILEREF_I_HXX_ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Component) #include #include -class fileRef_i: +class CONTAINER_EXPORT fileRef_i: public virtual POA_Engines::fileRef, public virtual PortableServer::RefCountServantBase { diff --git a/src/Container/SALOME_FileTransfer_i.hxx b/src/Container/SALOME_FileTransfer_i.hxx index 8141bbc8a..c0ecb18e6 100644 --- a/src/Container/SALOME_FileTransfer_i.hxx +++ b/src/Container/SALOME_FileTransfer_i.hxx @@ -27,12 +27,14 @@ #ifndef _SALOME_FILETRANSFER_I_HXX_ #define _SALOME_FILETRANSFER_I_HXX_ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Component) #include #include -class fileTransfer_i: +class CONTAINER_EXPORT fileTransfer_i: public virtual POA_Engines::fileTransfer, public virtual PortableServer::RefCountServantBase { diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx index f1f15d118..5e2f20bfc 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx @@ -38,15 +38,16 @@ typedef DSC_Exception DATASTREAM_EXCEPTION; class CalciumCouplingPolicy : public CouplingPolicy { + + +public: + template class InternalDataIdContainer; template friend class InternalDataIdContainer; template friend class BoundedDataIdProcessor; template friend class EraseDataIdProcessor; template friend class DisconnectProcessor; - -public: - typedef CalciumTypes::DependencyType DependencyType; typedef CalciumTypes::DateCalSchem DateCalSchem; typedef CalciumTypes::InterpolationSchem InterpolationSchem; @@ -144,10 +145,10 @@ struct CalciumCouplingPolicy::InternalDataIdContainer : public std::vector< std: // Ignore les paramètres qui ne sont pas en rapport avec le type de dépendance switch (policy._dependencyType) { case CalciumTypes::TIME_DEPENDENCY: - push_back(DataId(dataId.first,0)); + this->push_back(DataId(dataId.first,0)); break; case CalciumTypes::ITERATION_DEPENDENCY: - push_back(DataId(0,dataId.second)); + this->push_back(DataId(0,dataId.second)); break; default: throw(DATASTREAM_EXCEPTION(LOC("The dependency type must be set by setDependencyType before calling DataIdContainer contructor"))); diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericUsesPort.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericUsesPort.hxx index e6654c1fb..9e461c14a 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericUsesPort.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericUsesPort.hxx @@ -47,11 +47,11 @@ CalciumGenericUsesPort< DataManipulator,CorbaPortType, repositoryName >::disconn typedef typename CorbaPortType::_ptr_type CorbaPortTypePtr; - if (!_my_ports) + if (!this->_my_ports) throw DSC_Exception(LOC("There is no connected provides port to communicate with.")); - for(int i = 0; i < _my_ports->length(); i++) { - CorbaPortTypePtr port = CorbaPortType::_narrow((*_my_ports)[i]); + for(int i = 0; i < this->_my_ports->length(); i++) { + CorbaPortTypePtr port = CorbaPortType::_narrow((*this->_my_ports)[i]); try { std::cerr << "-------- CalciumGenericUsesPort<>::disconnect"<< std::endl; diff --git a/src/DSC/DSC_User/Datastream/CouplingPolicy.hxx b/src/DSC/DSC_User/Datastream/CouplingPolicy.hxx index dcd24b221..016cceab3 100644 --- a/src/DSC/DSC_User/Datastream/CouplingPolicy.hxx +++ b/src/DSC/DSC_User/Datastream/CouplingPolicy.hxx @@ -146,6 +146,7 @@ public: typedef typename Container::iterator iterator; std::cout << "-------- Generic DisconnectProcessor called " << std::endl; + return true; } }; diff --git a/src/DSC/DSC_User/Datastream/GenericPort.hxx b/src/DSC/DSC_User/Datastream/GenericPort.hxx index bab981f03..bed1d8c53 100644 --- a/src/DSC/DSC_User/Datastream/GenericPort.hxx +++ b/src/DSC/DSC_User/Datastream/GenericPort.hxx @@ -341,7 +341,7 @@ GenericPort::get(TimeType time, // Décide de la suppression de certaines instances de données // La donnée contenu dans la structure CORBA et son dataId sont désallouées // Méthode provenant de la COUPLING_POLICY - typename COUPLING_POLICY::EraseDataIdProcessor processEraseDataId(*this); + typename COUPLING_POLICY::template EraseDataIdProcessor processEraseDataId(*this); processEraseDataId.apply(storedDatas,wDataIt1); std::cout << "-------- Get : MARK 6 ------------------" << std::endl; break; @@ -349,7 +349,7 @@ GenericPort::get(TimeType time, } std::cout << "-------- Get : MARK 7 ------------------" << std::endl; - //if ( isBounded() && COUPLING_POLICY::needToProcessBoundedDataId() ) { + //if ( isBounded() && COUPLING_POLICY::template needToProcessBoundedDataId() ) { // Le DataId demandé n'est pas trouvé mais est encadré ET la politique de couplage // implémente une méthode processBoundedDataId capable de générer les données à retourner if ( isBounded ) { @@ -363,7 +363,7 @@ GenericPort::get(TimeType time, // La propriété des données N'EST PAS transférée à l'utilisateur en mode CALCIUM. std::cout << "-------- Get : MARK 8 ------------------" << std::endl; - typename COUPLING_POLICY::BoundedDataIdProcessor processBoundedDataId(*this); + typename COUPLING_POLICY::template BoundedDataIdProcessor processBoundedDataId(*this); //si static BDIP::apply(dataToTransmit,expectedDataId,wDataIt1); //ancienne version template processBoundedDataId(dataToTransmit,expectedDataId,wDataIt1); //BDIP processBoundedDataId; @@ -383,7 +383,7 @@ GenericPort::get(TimeType time, std::cout << std::endl; std::cout << "-------- Get : MARK 9 ------------------" << std::endl; - typename COUPLING_POLICY::EraseDataIdProcessor processEraseDataId(*this); + typename COUPLING_POLICY::template EraseDataIdProcessor processEraseDataId(*this); processEraseDataId.apply(storedDatas,wDataIt1); break; @@ -391,7 +391,7 @@ GenericPort::get(TimeType time, // Délègue au mode de couplage la gestion d'une demande de donnée non disponible // si le port est deconnecté - typename COUPLING_POLICY::DisconnectProcessor processDisconnect(*this); + typename COUPLING_POLICY::template DisconnectProcessor processDisconnect(*this); if ( processDisconnect.apply(storedDatas, expectedDataId, wDataIt1) ) continue; // Réception bloquante sur le dataId demandé @@ -468,7 +468,7 @@ GenericPort::next(TimeType &t, // Délègue au mode de couplage la gestion d'une demande de donnée non disponible // si le port est deconnecté - typename COUPLING_POLICY::DisconnectProcessor processDisconnect(*this); + typename COUPLING_POLICY::template DisconnectProcessor processDisconnect(*this); if ( processDisconnect.apply(storedDatas, lastDataId, wDataIt1) ) break; std::cout << "-------- Next : MARK 2 ------------------" << std::endl; @@ -497,7 +497,7 @@ GenericPort::next(TimeType &t, std::cout << "-------- Next : MARK 7 ------------------" << std::endl; lastDataId = (*wDataIt1).first; - typename COUPLING_POLICY::EraseDataIdProcessor processEraseDataId(*this); + typename COUPLING_POLICY::template EraseDataIdProcessor processEraseDataId(*this); processEraseDataId.apply(storedDatas, wDataIt1); std::cout << "-------- Next : MARK 8 ------------------" << std::endl; diff --git a/src/DSC/DSC_User/Datastream/Palm/PalmCouplingPolicy.hxx b/src/DSC/DSC_User/Datastream/Palm/PalmCouplingPolicy.hxx index c8dd62c7d..30cdf27d7 100644 --- a/src/DSC/DSC_User/Datastream/Palm/PalmCouplingPolicy.hxx +++ b/src/DSC/DSC_User/Datastream/Palm/PalmCouplingPolicy.hxx @@ -37,16 +37,16 @@ class PalmCouplingPolicy: public CouplingPolicy { - template class InternalDataIdContainer; - template friend class InternalDataIdContainer; // Objet de filtrage et conversion d'un TIME filtre_conversion filtre_convert_TIME ; // Objet de filtrage et conversion d'un TAG filtre_conversion filtre_convert_TAG ; - public: - + + template class InternalDataIdContainer; + template friend class InternalDataIdContainer; + filtre_conversion * get_filtre_convert_TIME() { return &filtre_convert_TIME; } filtre_conversion * get_filtre_convert_TAG() { return &filtre_convert_TAG; } @@ -104,7 +104,7 @@ public: // Pas encore testé - InternalDataIdContainer & operator=(const InternalDataIdContainer & p) { + InternalDataIdContainer & operator=(const InternalDataIdContainer & pc) { if (this != &pc) { _lTime=pc._lTime; _lTag=pc._lTag; } return *this; } @@ -117,20 +117,23 @@ public: // exister (un seul paramètre n'est pas recevable) bool empty() const { return _lTime.empty() || _lTag.empty(); } - private: // Définition de l'itérateur du container template class DataIdIterator { - private: + public: + typedef typename std::vector::const_iterator ItTime; typedef typename std::vector::const_iterator ItTag; + + private: ItTime _itTime; ItTag _itTag; const InternalDataIdContainer & _pc; DataIdIterator() {} public: - + + // Pas encore testé DataIdIterator(const InternalDataIdContainer & pc): _pc(pc),_itTime(pc._lTime.begin()),_itTag(pc._lTag.begin()) {} diff --git a/src/GenericObj/SALOME_GenericObj_i.cc b/src/GenericObj/SALOME_GenericObj_i.cc index fe837e3fd..2760b73db 100644 --- a/src/GenericObj/SALOME_GenericObj_i.cc +++ b/src/GenericObj/SALOME_GenericObj_i.cc @@ -42,9 +42,9 @@ GenericObj_i::GenericObj_i(PortableServer::POA_ptr thePOA): myRefCounter(1){ "; CORBA::is_nil(thePOA) = "<GetAttributeName(j); HDFattribute *hdf_attribute = new HDFattribute(name, hdf_dataset); delete name; diff --git a/src/HDFPersist/HDFattrGetSize.c b/src/HDFPersist/HDFattrGetSize.c index 6319792f9..51f36c9b5 100644 --- a/src/HDFPersist/HDFattrGetSize.c +++ b/src/HDFPersist/HDFattrGetSize.c @@ -25,16 +25,15 @@ #include "hdfi.h" #include -hdf_type -HDFattrGetSize(hdf_idt id) +hdf_type HDFattrGetSize( hdf_idt id ) { + hdf_type ret; hdf_idt type_id; - int ret; if ((type_id = H5Aget_type(id)) < 0) return HDF_NONE; - ret = H5Tget_size(type_id); + ret = (hdf_type)H5Tget_size(type_id); H5Tclose(type_id); diff --git a/src/HDFPersist/HDFdatasetGetOrder.c b/src/HDFPersist/HDFdatasetGetOrder.c index 3af8c4271..a60256845 100644 --- a/src/HDFPersist/HDFdatasetGetOrder.c +++ b/src/HDFPersist/HDFdatasetGetOrder.c @@ -32,7 +32,7 @@ HDFdatasetGetOrder(hdf_idt dataset_id) hdf_byte_order order; if ((type_id = H5Dget_type(dataset_id)) < 0) - return -1; + return H5T_ORDER_ERROR; order = H5Tget_order(type_id); diff --git a/src/HDFPersist/HDFobjectIdentify.c b/src/HDFPersist/HDFobjectIdentify.c index dc7ed608c..e5919d9e8 100644 --- a/src/HDFPersist/HDFobjectIdentify.c +++ b/src/HDFPersist/HDFobjectIdentify.c @@ -54,8 +54,8 @@ hdf_err HDFobjectIdentify(hdf_idt fid,char *path,int i,char *name) hdf_err RankInfo(hdf_idt id, const char *name, void *data) { - if (data != NULL) - strcpy(data,name); + if ( data ) + strcpy( (char*)data, name ); else return -1; diff --git a/src/HDFPersist/HDFobjectType.c b/src/HDFPersist/HDFobjectType.c index ff25c2a5d..40f6e3320 100644 --- a/src/HDFPersist/HDFobjectType.c +++ b/src/HDFPersist/HDFobjectType.c @@ -27,7 +27,6 @@ SALOME HDFPersist : implementation of HDF persitent ( save/ restore ) hdf_err HDFobjectType(hdf_idt id, char *name, hdf_object_type *type) { - hdf_object_type rep; hdf_bool follow = 1; H5G_stat_t buf; hdf_err ret; diff --git a/src/KERNEL_PY/import_hook.py b/src/KERNEL_PY/import_hook.py index 904e3d441..b8687498c 100755 --- a/src/KERNEL_PY/import_hook.py +++ b/src/KERNEL_PY/import_hook.py @@ -110,6 +110,17 @@ def set_shared_imported(name,module): shared_imported[name]=module #print "Module %s shared registered" % name,module +def import_module(partname, fqname, parent): + """ Try to import module fqname + It's parent is module parent and has name partname + """ + try: + m = sys.modules[fqname] + except KeyError: + pass + else: + return m + def ensure_fromlist(m, fromlist, recursive=0): """ Return the real modules list to be imported """ @@ -123,10 +134,16 @@ def ensure_fromlist(m, fromlist, recursive=0): pass else: l.extend(ensure_fromlist(m, all, 1)) - else: + elif hasattr(m,sub): submod=getattr(m,sub) if type(submod) == type(sys): l.append(("%s.%s" % (m.__name__, sub),submod)) + else: + subname="%s.%s" % (m.__name__, sub) + submod = import_module(sub, subname, m) + if not submod: + raise ImportError, "No module named " + subname + l.append((subname,submod)) return l def import_hook(name, globals=None, locals=None, fromlist=None): @@ -149,7 +166,12 @@ def import_hook(name, globals=None, locals=None, fromlist=None): #when fromlist is not specified and name is a dotted name, # module is the root package not the real module #so we need to retrieve it - m=get_real_module(module,name) + # note: some modules like xml.dom do not play the rule + # (import xml: no attribute dom, but import xml.dom OK) + try: + m=get_real_module(module,name) + except AttributeError: + m=None if type(m) == type(sys) and is_shared(m.__name__): set_shared_imported(m.__name__,m) diff --git a/src/KERNEL_PY/salome.py b/src/KERNEL_PY/salome.py index 2539dd37d..956a767bd 100755 --- a/src/KERNEL_PY/salome.py +++ b/src/KERNEL_PY/salome.py @@ -24,7 +24,6 @@ # Module : SALOME # $Header$ -import omnipatch from salome_kernel import * from salome_study import * from salome_iapp import * diff --git a/src/KERNEL_PY/salome_shared_modules.py b/src/KERNEL_PY/salome_shared_modules.py index 2222a4d9e..a10ea5233 100755 --- a/src/KERNEL_PY/salome_shared_modules.py +++ b/src/KERNEL_PY/salome_shared_modules.py @@ -74,7 +74,10 @@ salome_path=os.environ.get("SALOMEPATH",os.getenv("KERNEL_ROOT_DIR")) list_modules=[] # Import all *_shared_modules in the path and store them in list_modules -path=salome_path.split(":") +splitter = ":" +if sys.platform == "win32": + splitter = ";" +path=salome_path.split(splitter) import platform if platform.architecture()[0] == "64bit": libdir = "lib64" @@ -86,9 +89,12 @@ for rep in path: try: name=os.path.splitext(os.path.basename(f))[0] register_name(name) + #print name + " REGISTERED" m=__import__(name) + #print name + " IMPORTED" list_modules.append(m) except: + print "Exception during register and import shared module" pass # diff --git a/src/KERNEL_PY/salome_test.py b/src/KERNEL_PY/salome_test.py index fac61b837..d18c706e2 100755 --- a/src/KERNEL_PY/salome_test.py +++ b/src/KERNEL_PY/salome_test.py @@ -14,6 +14,7 @@ import salome from salome import sg import SALOMEDS import os +import sys import SALOME_ModuleCatalog @@ -133,9 +134,14 @@ idedge=geompy.addToStudyInFather(face,edge,name) # ---- create Hypothesis +if sys.platform == "win32": + stdMeshersEngine = "StdMeshersEngine" +else: + stdMeshersEngine = "libStdMeshersEngine.so" + print "-------------------------- create Hypothesis" print "-------------------------- LocalLength" -hypLen1 = smesh.CreateHypothesis( "LocalLength", "libStdMeshersEngine.so" ) +hypLen1 = smesh.CreateHypothesis( "LocalLength", stdMeshersEngine ) hypLen1.SetLength(100) print hypLen1.GetName() print hypLen1.GetId() @@ -144,7 +150,7 @@ print hypLen1.GetLength() smeshgui.SetName(salome.ObjectToID(hypLen1), "Local_Length_100") print "-------------------------- NumberOfSegments" -hypNbSeg1= smesh.CreateHypothesis( "NumberOfSegments", "libStdMeshersEngine.so" ) +hypNbSeg1= smesh.CreateHypothesis( "NumberOfSegments", stdMeshersEngine ) hypNbSeg1.SetNumberOfSegments(7) print hypNbSeg1.GetName() print hypNbSeg1.GetId() @@ -153,7 +159,7 @@ print hypNbSeg1.GetNumberOfSegments() smeshgui.SetName(salome.ObjectToID(hypNbSeg1), "NumberOfSegments_7") print "-------------------------- MaxElementArea" -hypArea1 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" ) +hypArea1 = smesh.CreateHypothesis( "MaxElementArea", stdMeshersEngine ) hypArea1.SetMaxElementArea(2500) print hypArea1.GetName() print hypArea1.GetId() @@ -162,7 +168,7 @@ print hypArea1.GetMaxElementArea() smeshgui.SetName(salome.ObjectToID(hypArea1), "MaxElementArea_2500") print "-------------------------- MaxElementArea" -hypArea2 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" ) +hypArea2 = smesh.CreateHypothesis( "MaxElementArea", stdMeshersEngine ) hypArea2.SetMaxElementArea(500) print hypArea2.GetName() print hypArea2.GetId() @@ -171,7 +177,7 @@ print hypArea2.GetMaxElementArea() smeshgui.SetName(salome.ObjectToID(hypArea2), "MaxElementArea_500") print "-------------------------- Regular_1D" -algoReg = smesh.CreateHypothesis( "Regular_1D", "libStdMeshersEngine.so" ) +algoReg = smesh.CreateHypothesis( "Regular_1D", stdMeshersEngine ) listHyp=algoReg.GetCompatibleHypothesis() for hyp in listHyp: print hyp @@ -181,7 +187,7 @@ print algoReg.GetId() smeshgui.SetName(salome.ObjectToID(algoReg), "Regular_1D" ) print "-------------------------- MEFISTO_2D" -algoMef = smesh.CreateHypothesis( "MEFISTO_2D", "libStdMeshersEngine.so" ) +algoMef = smesh.CreateHypothesis( "MEFISTO_2D", stdMeshersEngine ) listHyp=algoMef.GetCompatibleHypothesis() for hyp in listHyp: print hyp @@ -231,202 +237,205 @@ print ret smesh.Compute(mesh, box) sg.updateObjBrowser(1); -print -print "============= Test Supervisor =============================" -print - -comp = catalog.GetComponent("SUPERV") -if comp is None: - raise RuntimeError,"Component SUPERV not found in Module Catalog." - -from SuperV import * -import SALOMEDS -myStudy = salome.myStudy -myBuilder = myStudy.NewBuilder() - -SuperVision = lcc.FindOrLoadComponent("SuperVisionContainer","SUPERV") -father = myStudy.FindComponent("SUPERV") -if father is None: - father = myBuilder.NewComponent("SUPERV") - A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName"); - FName = A1._narrow(SALOMEDS.AttributeName) - FName.SetValue( salome.sg.getComponentUserName("SUPERV") ) - A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap"); - aPixmap = A2._narrow(SALOMEDS.AttributePixMap); - aPixmap.SetPixMap( "ICON_OBJBROWSER_Supervision" ); - myBuilder.DefineComponentInstance(father,SuperVision) - -def addStudy(ior): - dataflow = SuperVision.getStreamGraph(ior) - name=dataflow.Name() - itr = myStudy.NewChildIterator(father) - while itr.More(): - item=itr.Value() - res,A=item.FindAttribute("AttributeName") - if res: - aName = A._narrow(SALOMEDS.AttributeName) - if aName.Value() == name : - print myBuilder.FindOrCreateAttribute(item, "AttributeIOR") - A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR") - print "A = ", A - if A is not None : - #res,A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR") - anIOR = A._narrow(SALOMEDS.AttributeIOR); - print "anIOR.SetValue(dataflow.getIOR())" - anIOR.SetValue(dataflow.getIOR()) - return - itr.Next() - obj = myBuilder.NewObject(father) - A=myBuilder.FindOrCreateAttribute(obj, "AttributeName") - aName=A._narrow(SALOMEDS.AttributeName) - aName.SetValue(name) - A=myBuilder.FindOrCreateAttribute(obj, "AttributeIOR") - anIOR = A._narrow(SALOMEDS.AttributeIOR) - anIOR.SetValue(dataflow.getIOR()) - -import os -dir= os.getenv("DATA_DIR") -if dir == None: - raise RuntimeError, "DATA_DIR is not defined" -xmlfile = dir + "/Superv/Graphs/GraphGeomEssaiGates.xml" -print "Load dataflow from the file : " -print xmlfile -print - -myGraph = StreamGraph ( xmlfile ) - -# This DataFlow is "valid" : no loop, correct links between Nodes etc... -print "myGraph.IsValid() = ", myGraph.IsValid() - -# Get Nodes -myGraph.PrintNodes() - -# This DataFlow is "executable" : all pending Ports are defined with Datas -print myGraph.IsExecutable() - -# Starts only execution of that DataFlow and gets control immediatly -print myGraph.Run() - -# That DataFlow is running ==> 0 (false) -print myGraph.IsDone() - -# Events of execution : -aStatus,aNode,anEvent,aState = myGraph.Event() -while aStatus : - print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState - aStatus,aNode,anEvent,aState = myGraph.Event() -print "myGraph.IsDone() = ",myGraph.IsDone() - -# Wait for Completion (but it is already done after event loop ...) -print "Done : ",myGraph.DoneW() - -print " " -#print "Type : print myGraph.IsDone()" -#print " If execution is finished ==> 1 (true)" -res=myGraph.IsDone() -if res != 1: - raise RuntimeError, "myGraph.Run() is not done" - -print " " -print "Type : myGraph.PrintPorts()" -print " to see input and output values of the graph" -myGraph.PrintPorts() - -# Export will create newsupervisionexample.xml and the corresponding .py file -tmpdir=os.getenv("TmpDir") -if tmpdir is None: - tmpdir="/tmp" -file = tmpdir + "/newsupervisionexample" -print "--------------\n"+file+"\n--------------\n" -myGraph.Export(file) - -ior = salome.orb.object_to_string(myGraph.G) -addStudy(ior) - -GraphName = myGraph.Name() -print "Befor save ", -#nodes = myGraph.Nodes() -nodes = myGraph.G.Nodes().FNodes -length_bs = len(nodes) -print "ListOfNodes length = ", length_bs -names=[] -for node in nodes: - names.append(node.Name()) -print names - -# Graph creation -GraphInLines = StreamGraph( 'GraphInLines' ) -GraphInLines.SetName( 'GraphInLines' ) -GraphInLines.SetAuthor( '' ) -GraphInLines.SetComment( '' ) -GraphInLines.Coords( 0 , 0 ) - -# Creation of InLine Nodes -PyAdd = [] -PyAdd.append( 'def Add(a,b) : ' ) -PyAdd.append( ' return a+b ' ) -PyAdd.append( '' ) -Add = GraphInLines.INode( 'Add' , PyAdd ) -Add.InPort( 'a' , 'long' ) -Add.InPort( 'b' , 'long' ) -Add.OutPort( 'f' , 'long' ) -Add.SetName( 'Add' ) -Add.SetAuthor( '' ) -Add.SetComment( 'Python function' ) -Add.Coords( 351 , 77 ) -PySub = [] -PySub.append( 'def Sub(a,b) : ' ) -PySub.append( ' return a-b ' ) -PySub.append( '' ) -Sub = GraphInLines.INode( 'Sub' , PySub ) -Sub.InPort( 'a' , 'long' ) -Sub.InPort( 'b' , 'long' ) -Sub.OutPort( 'f' , 'long' ) -Sub.SetName( 'Sub' ) -Sub.SetAuthor( '' ) -Sub.SetComment( 'Python function' ) -Sub.Coords( 86 , 333 ) -PyMul = [] -PyMul.append( 'def Mul(a,b) : ' ) -PyMul.append( ' return a*b ' ) -Mul = GraphInLines.INode( 'Mul' , PyMul ) -Mul.InPort( 'a' , 'long' ) -Mul.InPort( 'b' , 'long' ) -Mul.OutPort( 'Result' , 'long' ) -Mul.SetName( 'Mul' ) -Mul.SetAuthor( '' ) -Mul.SetComment( 'Python function' ) -Mul.Coords( 616 , 247 ) - -# Creation of intermediate Output variables and of Control Links -Addf = Add.Port( 'f' ) -Mula = GraphInLines.Link( Addf , Mul.Port( 'a' ) ) -Mula.AddCoord( 1 , 570 , 356 ) -Mula.AddCoord( 2 , 570 , 186 ) -Subf = Sub.Port( 'f' ) -Mulb = GraphInLines.Link( Subf , Mul.Port( 'b' ) ) -Mulb.AddCoord( 1 , 282 , 376 ) -Mulb.AddCoord( 2 , 282 , 442 ) -Addb = GraphInLines.Link( Subf , Add.Port( 'b' ) ) -Addb.AddCoord( 1 , 283 , 209 ) -Addb.AddCoord( 2 , 283 , 374 ) -Addb.AddCoord( 3 , 283 , 442 ) - -# Creation of Input datas -Adda = Add.Input( 'a' , 1) -Suba = Sub.Input( 'a' , 3) -Subb = Sub.Input( 'b' , 4) - -# Creation of Output variables -MulResult = Mul.Port( 'Result' ) - -GraphInLines.Run() - -GraphInLines.DoneW() - -GraphInLines.PrintPorts() - -sg.updateObjBrowser(1); +if sys.platform != "win32": + print + print "============= Test Supervisor =============================" + print + + comp = catalog.GetComponent("SUPERV") + if comp is None: + raise RuntimeError,"Component SUPERV not found in Module Catalog." + + from SuperV import * + import SALOMEDS + myStudy = salome.myStudy + myBuilder = myStudy.NewBuilder() + + SuperVision = lcc.FindOrLoadComponent("SuperVisionContainer","SUPERV") + father = myStudy.FindComponent("SUPERV") + if father is None: + father = myBuilder.NewComponent("SUPERV") + A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName"); + FName = A1._narrow(SALOMEDS.AttributeName) + FName.SetValue( salome.sg.getComponentUserName("SUPERV") ) + A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap"); + aPixmap = A2._narrow(SALOMEDS.AttributePixMap); + aPixmap.SetPixMap( "ICON_OBJBROWSER_Supervision" ); + myBuilder.DefineComponentInstance(father,SuperVision) + + def addStudy(ior): + dataflow = SuperVision.getStreamGraph(ior) + name=dataflow.Name() + itr = myStudy.NewChildIterator(father) + while itr.More(): + item=itr.Value() + res,A=item.FindAttribute("AttributeName") + if res: + aName = A._narrow(SALOMEDS.AttributeName) + if aName.Value() == name : + print myBuilder.FindOrCreateAttribute(item, "AttributeIOR") + A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR") + print "A = ", A + if A is not None : + #res,A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR") + anIOR = A._narrow(SALOMEDS.AttributeIOR); + print "anIOR.SetValue(dataflow.getIOR())" + anIOR.SetValue(dataflow.getIOR()) + return + itr.Next() + obj = myBuilder.NewObject(father) + A=myBuilder.FindOrCreateAttribute(obj, "AttributeName") + aName=A._narrow(SALOMEDS.AttributeName) + aName.SetValue(name) + A=myBuilder.FindOrCreateAttribute(obj, "AttributeIOR") + anIOR = A._narrow(SALOMEDS.AttributeIOR) + anIOR.SetValue(dataflow.getIOR()) + + import os + dir= os.getenv("DATA_DIR") + if dir == None: + raise RuntimeError, "DATA_DIR is not defined" + xmlfile = dir + "/Superv/Graphs/GraphGeomEssaiGates.xml" + print "Load dataflow from the file : " + print xmlfile + print + + myGraph = StreamGraph ( xmlfile ) + + # This DataFlow is "valid" : no loop, correct links between Nodes etc... + print "myGraph.IsValid() = ", myGraph.IsValid() + + # Get Nodes + myGraph.PrintNodes() + + # This DataFlow is "executable" : all pending Ports are defined with Datas + print myGraph.IsExecutable() + + # Starts only execution of that DataFlow and gets control immediatly + print myGraph.Run() + + # That DataFlow is running ==> 0 (false) + print myGraph.IsDone() + + # Events of execution : + aStatus,aNode,anEvent,aState = myGraph.Event() + while aStatus : + print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState + aStatus,aNode,anEvent,aState = myGraph.Event() + print "myGraph.IsDone() = ",myGraph.IsDone() + + # Wait for Completion (but it is already done after event loop ...) + print "Done : ",myGraph.DoneW() + + print " " + #print "Type : print myGraph.IsDone()" + #print " If execution is finished ==> 1 (true)" + res=myGraph.IsDone() + if res != 1: + raise RuntimeError, "myGraph.Run() is not done" + + print " " + print "Type : myGraph.PrintPorts()" + print " to see input and output values of the graph" + myGraph.PrintPorts() + + # Export will create newsupervisionexample.xml and the corresponding .py file + tmpdir=os.getenv("TmpDir") + if tmpdir is None: + tmpdir="/tmp" + file = tmpdir + "/newsupervisionexample" + print "--------------\n"+file+"\n--------------\n" + myGraph.Export(file) + + ior = salome.orb.object_to_string(myGraph.G) + addStudy(ior) + + GraphName = myGraph.Name() + print "Befor save ", + #nodes = myGraph.Nodes() + nodes = myGraph.G.Nodes().FNodes + length_bs = len(nodes) + print "ListOfNodes length = ", length_bs + names=[] + for node in nodes: + names.append(node.Name()) + print names + + # Graph creation + GraphInLines = StreamGraph( 'GraphInLines' ) + GraphInLines.SetName( 'GraphInLines' ) + GraphInLines.SetAuthor( '' ) + GraphInLines.SetComment( '' ) + GraphInLines.Coords( 0 , 0 ) + + # Creation of InLine Nodes + PyAdd = [] + PyAdd.append( 'def Add(a,b) : ' ) + PyAdd.append( ' return a+b ' ) + PyAdd.append( '' ) + Add = GraphInLines.INode( 'Add' , PyAdd ) + Add.InPort( 'a' , 'long' ) + Add.InPort( 'b' , 'long' ) + Add.OutPort( 'f' , 'long' ) + Add.SetName( 'Add' ) + Add.SetAuthor( '' ) + Add.SetComment( 'Python function' ) + Add.Coords( 351 , 77 ) + PySub = [] + PySub.append( 'def Sub(a,b) : ' ) + PySub.append( ' return a-b ' ) + PySub.append( '' ) + Sub = GraphInLines.INode( 'Sub' , PySub ) + Sub.InPort( 'a' , 'long' ) + Sub.InPort( 'b' , 'long' ) + Sub.OutPort( 'f' , 'long' ) + Sub.SetName( 'Sub' ) + Sub.SetAuthor( '' ) + Sub.SetComment( 'Python function' ) + Sub.Coords( 86 , 333 ) + PyMul = [] + PyMul.append( 'def Mul(a,b) : ' ) + PyMul.append( ' return a*b ' ) + Mul = GraphInLines.INode( 'Mul' , PyMul ) + Mul.InPort( 'a' , 'long' ) + Mul.InPort( 'b' , 'long' ) + Mul.OutPort( 'Result' , 'long' ) + Mul.SetName( 'Mul' ) + Mul.SetAuthor( '' ) + Mul.SetComment( 'Python function' ) + Mul.Coords( 616 , 247 ) + + # Creation of intermediate Output variables and of Control Links + Addf = Add.Port( 'f' ) + Mula = GraphInLines.Link( Addf , Mul.Port( 'a' ) ) + Mula.AddCoord( 1 , 570 , 356 ) + Mula.AddCoord( 2 , 570 , 186 ) + Subf = Sub.Port( 'f' ) + Mulb = GraphInLines.Link( Subf , Mul.Port( 'b' ) ) + Mulb.AddCoord( 1 , 282 , 376 ) + Mulb.AddCoord( 2 , 282 , 442 ) + Addb = GraphInLines.Link( Subf , Add.Port( 'b' ) ) + Addb.AddCoord( 1 , 283 , 209 ) + Addb.AddCoord( 2 , 283 , 374 ) + Addb.AddCoord( 3 , 283 , 442 ) + + # Creation of Input datas + Adda = Add.Input( 'a' , 1) + Suba = Sub.Input( 'a' , 3) + Subb = Sub.Input( 'b' , 4) + + # Creation of Output variables + MulResult = Mul.Port( 'Result' ) + + GraphInLines.Run() + + GraphInLines.DoneW() + + GraphInLines.PrintPorts() + + sg.updateObjBrowser(1); + + pass print print "============= Test VISU and MED =============================" @@ -457,9 +466,19 @@ try: if os.access(medFile, os.R_OK) : if not os.access(medFile, os.W_OK) : import random - medFileNew = "/tmp/" + str(random.randint(0,1000000)) + "_" + medFileName + if sys.platform != "win32": + tmpDir = "/tmp/" + else: + tmpDir = os.getenv('TEMP') + '/' + medFileNew = tmpDir + str(random.randint(0,1000000)) + "_" + medFileName print " -- Copy " + medFile + " to " + medFileNew - os.system("cp "+ medFile + " " + medFileNew) + + if sys.platform != "win32": + copyCommand = "cp" + else: + copyCommand = "copy /Y" + os.system(copyCommand + " " + medFile + " " + medFileNew) + medFile = medFileNew os.system("chmod 755 " + medFile) diff --git a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx index 8f7aa6ca7..ef4ff83dc 100644 --- a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx @@ -74,7 +74,7 @@ SALOME_FileTransferCORBA::SALOME_FileTransferCORBA(string refMachine, _refMachine = refMachine; _origFileName = origFileName; _containerName = containerName; - if (_refMachine.empty() or _origFileName.empty()) + if (_refMachine.empty() || _origFileName.empty()) { INFOS("bad parameters: machine and file name must be given"); } @@ -108,7 +108,7 @@ string SALOME_FileTransferCORBA::getLocalFile(string localFile) if (CORBA::is_nil(_theFileRef)) { - if (_refMachine.empty() or _origFileName.empty()) + if (_refMachine.empty() || _origFileName.empty()) { INFOS("not enough parameters: machine and file name must be given"); return ""; diff --git a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.hxx b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.hxx index 871e0aa14..c0927d92c 100644 --- a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.hxx +++ b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.hxx @@ -34,7 +34,17 @@ #include -class SALOME_FileTransferCORBA +#ifdef WNT +# if defined LIFECYCLECORBA_EXPORTS +# define LIFECYCLECORBA_EXPORT __declspec( dllexport ) +# else +# define LIFECYCLECORBA_EXPORT __declspec( dllimport ) +# endif +#else +# define LIFECYCLECORBA_EXPORT +#endif + +class LIFECYCLECORBA_EXPORT SALOME_FileTransferCORBA { public: SALOME_FileTransferCORBA(); diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index 07250628a..bdeddc58e 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -32,7 +32,9 @@ #include #include -#include +#ifndef WNT + #include +#endif #include "OpUtil.hxx" #include "utilities.h" @@ -279,7 +281,8 @@ bool SALOME_LifeCycleCORBA::isKnownComponentClass(const char *componentName) Catalog->GetComponent(componentName); if (CORBA::is_nil (compoInfo)) { - INFOS("Catalog Error : Component not found in the catalog"); + INFOS("Catalog Error: Component not found in the catalog" ); + INFOS( componentName ); return false; } else return true; diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx index 0ff890dda..5072ee4df 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx @@ -40,18 +40,14 @@ #include CORBA_CLIENT_HEADER(SALOME_ContainerManager) #include CORBA_CLIENT_HEADER(SALOME_Component) -#if defined LIFECYCLECORBA_EXPORTS -#if defined WIN32 -#define LIFECYCLECORBA_EXPORT __declspec( dllexport ) +#ifdef WNT +# if defined LIFECYCLECORBA_EXPORTS +# define LIFECYCLECORBA_EXPORT __declspec( dllexport ) +# else +# define LIFECYCLECORBA_EXPORT __declspec( dllimport ) +# endif #else -#define LIFECYCLECORBA_EXPORT -#endif -#else -#if defined WNT -#define LIFECYCLECORBA_EXPORT __declspec( dllimport ) -#else -#define LIFECYCLECORBA_EXPORT -#endif +# define LIFECYCLECORBA_EXPORT #endif diff --git a/src/Logger/SALOME_Logger_Server.hxx b/src/Logger/SALOME_Logger_Server.hxx index 74ef8e4d0..9f7a16a83 100644 --- a/src/Logger/SALOME_Logger_Server.hxx +++ b/src/Logger/SALOME_Logger_Server.hxx @@ -20,7 +20,18 @@ #include #include "Logger.hh" -class Logger : +#ifdef WNT +# if defined LOGGER_EXPORTS +# define LOGGER_EXPORT __declspec( dllexport ) +# else +# define LOGGER_EXPORT __declspec( dllimport ) +# endif +#else +# define LOGGER_EXPORT +#endif + + +class LOGGER_EXPORT Logger : public POA_SALOME_Logger::Logger, public PortableServer::RefCountServantBase { diff --git a/src/Logger/SALOME_Logger_Server_main.cxx b/src/Logger/SALOME_Logger_Server_main.cxx index a15d85405..c9551d567 100644 --- a/src/Logger/SALOME_Logger_Server_main.cxx +++ b/src/Logger/SALOME_Logger_Server_main.cxx @@ -14,6 +14,8 @@ #include #ifndef __WIN32__ # include +#else +# include "utilities.h" // for compilation type "timespec" #endif int main(int argc, char **argv) diff --git a/src/ModuleCatalog/Makefile.am b/src/ModuleCatalog/Makefile.am index b524f58ac..a29139fd2 100644 --- a/src/ModuleCatalog/Makefile.am +++ b/src/ModuleCatalog/Makefile.am @@ -40,7 +40,8 @@ salomeinclude_HEADERS = \ PathPrefix.hxx \ SALOME_ModuleCatalog_Parser.hxx \ SALOME_ModuleCatalog_Parser_IO.hxx \ - SALOME_ModuleCatalog_Handler.hxx + SALOME_ModuleCatalog_Handler.hxx \ + SALOME_ModuleCatalog.hxx # Scripts to be installed dist_salomescript_DATA = TestModuleCatalog.py diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog.hxx new file mode 100755 index 000000000..5bfef04fe --- /dev/null +++ b/src/ModuleCatalog/SALOME_ModuleCatalog.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_ModuleCatalog.hxx +// Author : Alexander A. BORODIN +// Module : SALOME + +#ifndef _SALOME_ModuleCatalog_HXX_ +#define _SALOME_ModuleCatalog_HXX_ + +#ifdef WNT + #if defined MODULECATALOG_EXPORTS + #if defined WIN32 + #define MODULECATALOG_EXPORT __declspec( dllexport ) + #else + #define MODULECATALOG_EXPORT + #endif + #else + #if defined WIN32 + #define MODULECATALOG_EXPORT __declspec( dllimport ) + #else + #define MODULECATALOG_EXPORT + #endif + #endif +#else + #define MODULECATALOG_EXPORT +#endif + +#endif \ No newline at end of file diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx index 879ea5df5..c6ce34ea5 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx @@ -29,25 +29,13 @@ #ifndef ACOMPONENT_IMPL_H #define ACOMPONENT_IMPL_H +#include + #include "SALOME_ModuleCatalog_Parser.hxx" #include #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) -#if defined MODULECATALOG_EXPORTS -#if defined WIN32 -#define MODULECATALOG_EXPORT __declspec( dllexport ) -#else -#define MODULECATALOG_EXPORT -#endif -#else -#if defined WNT -#define MODULECATALOG_EXPORT __declspec( dllimport ) -#else -#define MODULECATALOG_EXPORT -#endif -#endif - class MODULECATALOG_EXPORT SALOME_ModuleCatalog_AcomponentImpl: public POA_SALOME_ModuleCatalog::Acomponent, public PortableServer::RefCountServantBase { diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx index 62610ee44..01870cf85 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx @@ -29,26 +29,14 @@ #ifndef SALOME_CATALOG_HANDLER_H #define SALOME_CATALOG_HANDLER_H +#include + #include "SALOME_ModuleCatalog_Parser.hxx" #include #include #include #include -#if defined MODULECATALOG_EXPORTS -#if defined WIN32 -#define MODULECATALOG_EXPORT __declspec( dllexport ) -#else -#define MODULECATALOG_EXPORT -#endif -#else -#if defined WNT -#define MODULECATALOG_EXPORT __declspec( dllimport ) -#else -#define MODULECATALOG_EXPORT -#endif -#endif - class MODULECATALOG_EXPORT SALOME_ModuleCatalog_Handler : public QXmlDefaultHandler { public: diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx index ea84cc81e..55dd3cede 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx @@ -43,7 +43,8 @@ static int MYDEBUG = 1; static int MYDEBUG = 1; #endif -static const char* SEPARATOR = ":"; +static const char* SEPARATOR = "::"; +static const char* OLD_SEPARATOR = ":"; //---------------------------------------------------------------------- // Function : SALOME_ModuleCatalogImpl @@ -110,12 +111,27 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: // Affect the _general_module_list and _general_path_list members // with the common catalog - QStringList dirList - = QStringList::split( SEPARATOR, _general_path, - false ); // skip empty entries + QStringList dirList; +#ifdef WNT + dirList = QStringList::split( SEPARATOR, _general_path, + false ); // skip empty entries +#else + //check for new format + int isNew = QString( _general_path ).contains(SEPARATOR); + if ( isNew > 0 ) { + //using new format + dirList = QStringList::split( SEPARATOR, _general_path, + false ); // skip empty entries + } else { + //support old format + dirList = QStringList::split( OLD_SEPARATOR, _general_path, + false ); // skip empty entries + } +#endif for ( int i = 0; i < dirList.count(); i++ ) { - QFileInfo fileInfo( dirList[ i ] ); + //QFileInfo fileInfo( dirList[ i ] ); + QFileInfo fileInfo( dirList[ i ].replace( '\"', "" ) ); //remove inverted commas from filename if ( fileInfo.isFile() && fileInfo.exists() ) { _parse_xml_file(fileInfo.filePath(), _general_module_list, diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx index d09e02da6..92976b7e3 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx @@ -30,6 +30,8 @@ #ifndef MODULECATALOG_IMPL_H #define MODULECATALOG_IMPL_H +#include + #include #include @@ -38,21 +40,6 @@ #include #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) - -#if defined MODULECATALOG_EXPORTS -#if defined WIN32 -#define MODULECATALOG_EXPORT __declspec( dllexport ) -#else -#define MODULECATALOG_EXPORT -#endif -#else -#if defined WNT -#define MODULECATALOG_EXPORT __declspec( dllimport ) -#else -#define MODULECATALOG_EXPORT -#endif -#endif - class MODULECATALOG_EXPORT SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::ModuleCatalog, public PortableServer::RefCountServantBase { diff --git a/src/NOTIFICATION_SWIG/Makefile.am b/src/NOTIFICATION_SWIG/Makefile.am index beb83ffe4..521f13d6d 100644 --- a/src/NOTIFICATION_SWIG/Makefile.am +++ b/src/NOTIFICATION_SWIG/Makefile.am @@ -43,7 +43,7 @@ SWIG_SOURCES = NOTIFICATION.i pkgpython_PYTHON = libNOTIFICATION.py pkgpyexec_LTLIBRARIES = _libNOTIFICATION.la _libNOTIFICATION_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES) \ - NOTIFICATION_Swig.cxx NOTIFICATION_Swig.hxx + NOTIFICATION_Swig.cxx NOTIFICATION_Swig.hxx SALOME_NOTIFICATION_SWIG.hxx _libNOTIFICATION_la_CPPFLAGS =\ @PYTHON_INCLUDES@ -DHAVE_CONFIG_H \ -I$(srcdir)/../Notification \ diff --git a/src/NOTIFICATION_SWIG/NOTIFICATION.i b/src/NOTIFICATION_SWIG/NOTIFICATION.i index 2bf44afec..af90cd8ee 100644 --- a/src/NOTIFICATION_SWIG/NOTIFICATION.i +++ b/src/NOTIFICATION_SWIG/NOTIFICATION.i @@ -27,9 +27,13 @@ %module libNOTIFICATION + %{ +#define __declspec(a) #include "NOTIFICATION_Swig.hxx" %} +%include SALOME_NOTIFICATION.hxx +%include SALOME_NOTIFICATION_SWIG.hxx %include NOTIFICATION.hxx %include NOTIFICATION_Swig.hxx diff --git a/src/NOTIFICATION_SWIG/NOTIFICATION_Swig.hxx b/src/NOTIFICATION_SWIG/NOTIFICATION_Swig.hxx index 0665096bb..d04db4f06 100644 --- a/src/NOTIFICATION_SWIG/NOTIFICATION_Swig.hxx +++ b/src/NOTIFICATION_SWIG/NOTIFICATION_Swig.hxx @@ -25,9 +25,13 @@ // Author : Francis KLOSS // Module : SALOME +#ifndef _NOTIFICATION_SWIG_HXX_ +#define _NOTIFICATION_SWIG_HXX_ + #include "NOTIFICATION.hxx" +#include "SALOME_NOTIFICATION_SWIG.hxx" -class NOTIFICATION_Supplier_Swig { +class NOTIFICATION_SWIG_EXPORT NOTIFICATION_Supplier_Swig { public: NOTIFICATION_Supplier_Swig(const char* instanceName, bool notif); ~NOTIFICATION_Supplier_Swig(); @@ -37,7 +41,7 @@ class NOTIFICATION_Supplier_Swig { NOTIFICATION_Supplier* _supplier; }; -class NOTIFICATION_Consumer_Swig { +class NOTIFICATION_SWIG_EXPORT NOTIFICATION_Consumer_Swig { public: NOTIFICATION_Consumer_Swig(); ~NOTIFICATION_Consumer_Swig(); @@ -46,3 +50,5 @@ class NOTIFICATION_Consumer_Swig { private: NOTIFICATION_Consumer* _consumer; }; + +#endif diff --git a/src/NOTIFICATION_SWIG/SALOME_NOTIFICATION_SWIG.hxx b/src/NOTIFICATION_SWIG/SALOME_NOTIFICATION_SWIG.hxx new file mode 100755 index 000000000..33d751c91 --- /dev/null +++ b/src/NOTIFICATION_SWIG/SALOME_NOTIFICATION_SWIG.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_NOTIFICATION_SWIG.hxx +// Author : Oleg UVAROV +// Module : SALOME + +#ifndef _SALOME_NOTIFICATION_SWIG_HXX_ +#define _SALOME_NOTIFICATION_SWIG_HXX_ + +#ifdef WNT + #if defined NOTIFICATION_SWIG_EXPORTS + #if defined WIN32 + #define NOTIFICATION_SWIG_EXPORT __declspec( dllexport ) + #else + #define NOTIFICATION_SWIG_EXPORT + #endif + #else + #if defined WIN32 + #define NOTIFICATION_SWIG_EXPORT __declspec( dllimport ) + #else + #define NOTIFICATION_SWIG_EXPORT + #endif + #endif +#else + #define NOTIFICATION_SWIG_EXPORT +#endif + +#endif diff --git a/src/NamingService/NamingService_WaitForServerReadiness.cxx b/src/NamingService/NamingService_WaitForServerReadiness.cxx index 308e104b0..6d9d1f962 100644 --- a/src/NamingService/NamingService_WaitForServerReadiness.cxx +++ b/src/NamingService/NamingService_WaitForServerReadiness.cxx @@ -72,7 +72,7 @@ void NamingService_WaitForServerReadiness(SALOME_NamingService* NS, } else { - CORBA::Object_ptr obj = NS->Resolve(serverName.c_str()); + CORBA::Object_var obj = NS->Resolve(serverName.c_str()); if (! CORBA::is_nil(obj)) { found =1; diff --git a/src/NamingService/NamingService_WaitForServerReadiness.hxx b/src/NamingService/NamingService_WaitForServerReadiness.hxx index a4156b7ce..a941fd245 100644 --- a/src/NamingService/NamingService_WaitForServerReadiness.hxx +++ b/src/NamingService/NamingService_WaitForServerReadiness.hxx @@ -27,15 +27,11 @@ #ifndef _NAMINGSERVICE_WAITFORSERVERREADINESS_HXX_ #define _NAMINGSERVICE_WAITFORSERVERREADINESS_HXX_ -#include #include "SALOME_NamingService.hxx" -#ifdef WNT -#include -#else -#define SALOME_WNT_EXPORT -#endif -void SALOME_WNT_EXPORT NamingService_WaitForServerReadiness(SALOME_NamingService* NS, +#include + +void NAMINGSERVICE_EXPORT NamingService_WaitForServerReadiness(SALOME_NamingService* NS, std::string serverName); #endif diff --git a/src/NamingService/SALOME_NamingService.cxx b/src/NamingService/SALOME_NamingService.cxx index a7768ec2a..61351cfec 100644 --- a/src/NamingService/SALOME_NamingService.cxx +++ b/src/NamingService/SALOME_NamingService.cxx @@ -368,7 +368,7 @@ CORBA::Object_ptr SALOME_NamingService::Resolve(const char* Path) ASSERT(!CORBA::is_nil(_current_context)); - CORBA::Object_ptr obj = CORBA::Object::_nil(); + CORBA::Object_var obj = CORBA::Object::_nil(); try { @@ -411,7 +411,7 @@ CORBA::Object_ptr SALOME_NamingService::Resolve(const char* Path) throw ServiceUnreachable(); } - return obj; + return obj._retn(); } // ============================================================================ @@ -449,7 +449,7 @@ CORBA::Object_ptr SALOME_NamingService::ResolveFirst(const char* Path) } // SCRUTE(name); - CORBA::Object_ptr obj = CORBA::Object::_nil(); + CORBA::Object_var obj = CORBA::Object::_nil(); bool isOk = false; if (basePath.empty()) @@ -475,7 +475,7 @@ CORBA::Object_ptr SALOME_NamingService::ResolveFirst(const char* Path) } } - return obj; + return obj._retn(); } // ============================================================================ @@ -1034,7 +1034,9 @@ throw(ServiceUnreachable) if (binding->binding_type == CosNaming::nobject) { - dirList.push_back(CORBA::string_dup(bindingName[0].id)); + // remove memory leak + // dirList.push_back(CORBA::string_dup(bindingName[0].id)); + dirList.push_back(string(bindingName[0].id)); } } diff --git a/src/NamingService/ServiceUnreachable.hxx b/src/NamingService/ServiceUnreachable.hxx index 3e55e2aa4..496f376fe 100644 --- a/src/NamingService/ServiceUnreachable.hxx +++ b/src/NamingService/ServiceUnreachable.hxx @@ -29,10 +29,8 @@ #if !defined ( SERVICEUNREACHABLE_H ) #define SERVICEUNREACHABLE_H -#include "Utils_SALOME_Exception.hxx" - #if defined NAMINGSERVICE_EXPORTS -#if defined WIN32 +#if defined WNT #define NAMINGSERVICE_EXPORT __declspec( dllexport ) #else #define NAMINGSERVICE_EXPORT @@ -45,6 +43,8 @@ #endif #endif +#include "Utils_SALOME_Exception.hxx" + //! exception class for NamingService : ServiceUnreachable class NAMINGSERVICE_EXPORT ServiceUnreachable : public SALOME_Exception diff --git a/src/Notification/Makefile.am b/src/Notification/Makefile.am index b5b5bbb52..74fb69e07 100644 --- a/src/Notification/Makefile.am +++ b/src/Notification/Makefile.am @@ -38,7 +38,8 @@ salomeinclude_HEADERS = \ NOTIFICATION.hxx \ NOTIFICATION_Supplier.hxx \ NOTIFICATION_Consumer.hxx \ - CosNotifyShorthands.h + CosNotifyShorthands.h \ + SALOME_NOTIFICATION.hxx # # =============================================================== diff --git a/src/Notification/NOTIFICATION.hxx b/src/Notification/NOTIFICATION.hxx index d381a4263..04da6bfdf 100644 --- a/src/Notification/NOTIFICATION.hxx +++ b/src/Notification/NOTIFICATION.hxx @@ -28,6 +28,8 @@ #ifndef NOTIFICATION_HXX #define NOTIFICATION_HXX +#include + #define NOTIF_WARNING "Warning" #define NOTIF_STEP "Step" #define NOTIF_TRACE "Trace" @@ -43,21 +45,6 @@ #include "NOTIFICATION_Supplier.hxx" #include "NOTIFICATION_Consumer.hxx" - -#if defined NOTIFICATION_EXPORTS -#if defined WIN32 -#define NOTIFICATION_EXPORT __declspec( dllexport ) -#else -#define NOTIFICATION_EXPORT -#endif -#else -#if defined WNT -#define NOTIFICATION_EXPORT __declspec( dllimport ) -#else -#define NOTIFICATION_EXPORT -#endif -#endif - NOTIFICATION_EXPORT char* NOTIFICATION_date(); NOTIFICATION_EXPORT CosNA_EventChannel_ptr NOTIFICATION_channel(); diff --git a/src/Notification/NOTIFICATION_Consumer.cxx b/src/Notification/NOTIFICATION_Consumer.cxx index c088ee9be..879f69558 100644 --- a/src/Notification/NOTIFICATION_Consumer.cxx +++ b/src/Notification/NOTIFICATION_Consumer.cxx @@ -93,14 +93,15 @@ bool NOTIFICATION_Consumer::Receive(char** graph, char** node, char** type, char }; if (status) { - char* Asender; - char* Agraph; - char* Atype; - CORBA::ULong Acounter; - CORBA::ULong Astamp; - char* Adate; - char* Anode; - char* Amessage; + //omniORB 4.1.x requiries using only CORBA types instead C types + const char* Asender; + const char* Agraph; + const char* Atype; + CORBA::ULong Acounter; + CORBA::ULong Astamp; + const char* Adate; + const char* Anode; + const char* Amessage; event->filterable_data[0].value >>= Asender; event->filterable_data[1].value >>= Agraph; event->filterable_data[2].value >>= Atype; diff --git a/src/Notification/NOTIFICATION_Consumer.hxx b/src/Notification/NOTIFICATION_Consumer.hxx index 41ac4f496..db5e04ccf 100644 --- a/src/Notification/NOTIFICATION_Consumer.hxx +++ b/src/Notification/NOTIFICATION_Consumer.hxx @@ -28,19 +28,7 @@ #ifndef NOTIFICATION_Consumer_HXX #define NOTIFICATION_Consumer_HXX -#if defined NOTIFICATION_EXPORTS -#if defined WIN32 -#define NOTIFICATION_EXPORT __declspec( dllexport ) -#else -#define NOTIFICATION_EXPORT -#endif -#else -#if defined WNT -#define NOTIFICATION_EXPORT __declspec( dllimport ) -#else -#define NOTIFICATION_EXPORT -#endif -#endif +#include class NOTIFICATION_EXPORT NOTIFICATION_Consumer: public POA_CosNotifyComm::StructuredPullConsumer { public: diff --git a/src/Notification/NOTIFICATION_Supplier.hxx b/src/Notification/NOTIFICATION_Supplier.hxx index 301d807b3..058a70cde 100644 --- a/src/Notification/NOTIFICATION_Supplier.hxx +++ b/src/Notification/NOTIFICATION_Supplier.hxx @@ -28,19 +28,7 @@ #ifndef NOTIFICATION_Supplier_HXX #define NOTIFICATION_Supplier_HXX -#if defined NOTIFICATION_EXPORTS -#if defined WIN32 -#define NOTIFICATION_EXPORT __declspec( dllexport ) -#else -#define NOTIFICATION_EXPORT -#endif -#else -#if defined WNT -#define NOTIFICATION_EXPORT __declspec( dllimport ) -#else -#define NOTIFICATION_EXPORT -#endif -#endif +#include class NOTIFICATION_EXPORT NOTIFICATION_Supplier: public POA_CosNotifyComm::StructuredPushSupplier { public: diff --git a/src/Notification/SALOME_NOTIFICATION.hxx b/src/Notification/SALOME_NOTIFICATION.hxx new file mode 100755 index 000000000..c187b4119 --- /dev/null +++ b/src/Notification/SALOME_NOTIFICATION.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_NOTIFICATION.hxx +// Author : Alexander A. BORODIN +// Module : SALOME + +#ifndef _SALOME_NOTIFICATION_HXX_ +#define _SALOME_NOTIFICATION_HXX_ + +#ifdef WNT + #if defined NOTIFICATION_EXPORTS + #if defined WIN32 + #define NOTIFICATION_EXPORT __declspec( dllexport ) + #else + #define NOTIFICATION_EXPORT + #endif + #else + #if defined WIN32 + #define NOTIFICATION_EXPORT __declspec( dllimport ) + #else + #define NOTIFICATION_EXPORT + #endif + #endif +#else + #define NOTIFICATION_EXPORT +#endif + +#endif diff --git a/src/Registry/Makefile.am b/src/Registry/Makefile.am index 6258de831..136b5df88 100644 --- a/src/Registry/Makefile.am +++ b/src/Registry/Makefile.am @@ -31,7 +31,8 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # header files salomeinclude_HEADERS =\ RegistryConnexion.hxx \ - RegistryService.hxx + RegistryService.hxx \ + SALOME_Registry.hxx # Libraries targets lib_LTLIBRARIES = libRegistry.la diff --git a/src/Registry/RegistryConnexion.hxx b/src/Registry/RegistryConnexion.hxx index 9dc8ac287..510196d3f 100644 --- a/src/Registry/RegistryConnexion.hxx +++ b/src/Registry/RegistryConnexion.hxx @@ -33,24 +33,12 @@ # if !defined( __RegistryConnexion_HXX__ ) # define __RegistryConnexion_HXX__ +#include + #include #include CORBA_CLIENT_HEADER(SALOME_Registry) #include -#if defined REGISTRY_EXPORTS -#if defined WIN32 -#define REGISTRY_EXPORT __declspec( dllexport ) -#else -#define REGISTRY_EXPORT -#endif -#else -#if defined WNT -#define REGISTRY_EXPORT __declspec( dllimport ) -#else -#define REGISTRY_EXPORT -#endif -#endif - class REGISTRY_EXPORT RegistryConnexion { protected : diff --git a/src/Registry/RegistryService.hxx b/src/Registry/RegistryService.hxx index b52fa758d..21b31b6f5 100644 --- a/src/Registry/RegistryService.hxx +++ b/src/Registry/RegistryService.hxx @@ -29,25 +29,13 @@ # ifndef __RegistryService_h__ # define __RegistryService_h__ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Registry) # include -#if defined REGISTRY_EXPORTS -#if defined WIN32 -#define REGISTRY_EXPORT __declspec( dllexport ) -#else -#define REGISTRY_EXPORT -#endif -#else -#if defined WNT -#define REGISTRY_EXPORT __declspec( dllimport ) -#else -#define REGISTRY_EXPORT -#endif -#endif - class REGISTRY_EXPORT RegistryService : public POA_Registry::Components //, public PortableServer::RefCountServantBase { diff --git a/src/Registry/SALOME_Registry.hxx b/src/Registry/SALOME_Registry.hxx new file mode 100755 index 000000000..899bc5586 --- /dev/null +++ b/src/Registry/SALOME_Registry.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_Registry.hxx +// Author : Alexander A. BORODIN +// Module : SALOME + +#ifndef _SALOME_Registry_HXX_ +#define _SALOME_Registry_HXX_ + +#ifdef WNT + #if defined REGISTRY_EXPORTS + #if defined WIN32 + #define REGISTRY_EXPORT __declspec( dllexport ) + #else + #define REGISTRY_EXPORT + #endif + #else + #if defined WIN32 + #define REGISTRY_EXPORT __declspec( dllimport ) + #else + #define REGISTRY_EXPORT + #endif + #endif +#else + #define REGISTRY_EXPORT +#endif + +#endif \ No newline at end of file diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index 8575f1b1c..53162f87c 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx @@ -230,8 +230,26 @@ endElement(const QString&, if ((qName.compare(QString(test_modules)) == 0)) _resource.ModulesPath[previous_module_name] = previous_module_path; - if ((qName.compare(QString(test_machine)) == 0)) - _resources_list[_resource.DataForSort._hostName] = _resource; + if ((qName.compare(QString(test_machine)) == 0)){ + int nbnodes = _resource.DataForSort._nbOfNodes; + if( nbnodes > 1 ){ + string clusterNode = _resource.DataForSort._hostName ; + for(int i=0;i 1 + int cpt=0; + for (map::const_iterator iter = _resourcesList.begin(); iter != _resourcesList.end(); iter++){ + if( (*iter).second.DataForSort._nbOfNodes > 1 ){ + if( strncmp(hostname,(*iter).first.c_str(),strlen(hostname)) == 0 ){ + ret.push_back((*iter).first.c_str()); + //cout << "SALOME_ResourcesManager::GetFittingResources vector[" + // << cpt << "] = " << (*iter).first.c_str() << endl ; + cpt++; + } + } + } + if(cpt==0){ // --- user specified an unknown hostame so notify him. - MESSAGE("ResourcesManager::GetFittingResources : SALOME_Exception"); - throw SALOME_Exception("unknown host"); + MESSAGE("ResourcesManager::GetFittingResources : SALOME_Exception"); + throw SALOME_Exception("unknown host"); + } } } @@ -551,7 +565,11 @@ void SALOME_ResourcesManager::RmTmpFile() { if (_TmpFileName != "") { +#ifndef WNT string command = "rm "; +#else + string command = "del /F "; +#endif command += _TmpFileName; char *temp = strdup(command.c_str()); int lgthTemp = strlen(temp); @@ -707,24 +725,8 @@ void SALOME_ResourcesManager::AddOmninamesParams(string& command) const void SALOME_ResourcesManager::AddOmninamesParams(ofstream& fileStream) const { - string omniORBcfg( getenv( "OMNIORB_CONFIG" ) ) ; - ifstream omniORBfile( omniORBcfg.c_str() ) ; - char ORBInitRef[11] ; - char egal[3] ; - char nameservice[132] ; - omniORBfile >> ORBInitRef ; - fileStream << "ORBInitRef "; - omniORBfile >> egal ; - omniORBfile >> nameservice ; - omniORBfile.close() ; - char * bsn = strchr( nameservice , '\n' ) ; - - if ( bsn ) - { - bsn[ 0 ] = '\0' ; - } - - fileStream << nameservice; + fileStream << "ORBInitRef NameService="; + fileStream << _NS->getIORaddr(); } @@ -801,6 +803,7 @@ SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer tempOutputFile << "export LD_LIBRARY_PATH" << endl; tempOutputFile << "export PYTHONPATH" << endl; + tempOutputFile << "export SALOME_trace=local" << endl; // mkr : 27.11.2006 : PAL13967 - Distributed supervision graphs - Problem with "SALOME_trace" //tempOutputFile << "source " << resInfo.PreReqFilePath << endl; // ! env vars @@ -870,7 +873,16 @@ SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer } else if (resInfo.Protocol == ssh) - command = "ssh "; + { + command = "ssh "; + string commandRcp = "scp "; + commandRcp += _TmpFileName; + commandRcp += " "; + commandRcp += machine; + commandRcp += ":"; + commandRcp += _TmpFileName; + system(commandRcp.c_str()); + } else throw SALOME_Exception("Unknown protocol"); diff --git a/src/ResourcesManager/SALOME_ResourcesManager.hxx b/src/ResourcesManager/SALOME_ResourcesManager.hxx index 34a8a93d4..9d17619a3 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.hxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.hxx @@ -31,22 +31,6 @@ #include #include - - -#if defined RESOURCESMANAGER_EXPORTS -#if defined WIN32 -#define RESOURCESMANAGER_EXPORT __declspec( dllexport ) -#else -#define RESOURCESMANAGER_EXPORT -#endif -#else -#if defined WNT -#define RESOURCESMANAGER_EXPORT __declspec( dllimport ) -#else -#define RESOURCESMANAGER_EXPORT -#endif -#endif - // --- WARNING --- // The call of BuildTempFileToLaunchRemoteContainer and RmTmpFile must be done // in a critical section to be sure to be clean. diff --git a/src/SALOMEDS/Makefile.am b/src/SALOMEDS/Makefile.am index 00ead570a..f844f79c6 100644 --- a/src/SALOMEDS/Makefile.am +++ b/src/SALOMEDS/Makefile.am @@ -41,7 +41,8 @@ salomeinclude_HEADERS= \ SALOMEDS_SComponent.hxx \ SALOMEDS_GenericAttribute_i.hxx \ SALOMEDS_GenericAttribute.hxx \ - SALOMEDS_IParameters.hxx + SALOMEDS_IParameters.hxx \ + SALOMEDS_Defines.hxx # Scripts to be installed dist_salomescript_DATA = SALOME_DriverPy.py @@ -140,6 +141,7 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_AttributeStudyProperties_i.cxx \ SALOMEDS_AttributePythonObject_i.cxx \ SALOMEDS_AttributeParameter_i.cxx \ + SALOMEDS_AttributeString_i.cxx \ SALOMEDS_SObject.cxx \ SALOMEDS_SComponent.cxx \ SALOMEDS_GenericAttribute.cxx \ @@ -180,6 +182,7 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_AttributeUserID.cxx \ SALOMEDS_TMPFile_i.cxx \ SALOMEDS_AttributeParameter.cxx \ + SALOMEDS_AttributeString.cxx \ SALOMEDS_IParameters.cxx \ \ Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx \ @@ -322,6 +325,8 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_UseCaseIterator_i.hxx \ SALOMEDS_AttributeParameter.hxx \ SALOMEDS_AttributeParameter_i.hxx \ + SALOMEDS_AttributeString.hxx \ + SALOMEDS_AttributeString_i.hxx \ SALOMEDS_TMPFile_i.hxx libSalomeDS_la_CPPFLAGS = $(COMMON_CPPFLAGS) diff --git a/src/SALOMEDS/SALOMEDS.cxx b/src/SALOMEDS/SALOMEDS.cxx index aaa0fa97b..e2646765c 100644 --- a/src/SALOMEDS/SALOMEDS.cxx +++ b/src/SALOMEDS/SALOMEDS.cxx @@ -50,6 +50,8 @@ #include "SALOMEDS_StudyManager_i.hxx" #endif +#include "SALOMEDS_Defines.hxx" + // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) @@ -91,37 +93,41 @@ void SALOMEDS::unlock() extern "C" { - -SALOMEDSClient_StudyManager* StudyManagerFactory() +SALOMEDS_EXPORT + SALOMEDSClient_StudyManager* StudyManagerFactory() { return new SALOMEDS_StudyManager(); } - -SALOMEDSClient_Study* StudyFactory(SALOMEDS::Study_ptr theStudy) +SALOMEDS_EXPORT + SALOMEDSClient_Study* StudyFactory(SALOMEDS::Study_ptr theStudy) { if(CORBA::is_nil(theStudy)) return NULL; return new SALOMEDS_Study(theStudy); } -SALOMEDSClient_SObject* SObjectFactory(SALOMEDS::SObject_ptr theSObject) +SALOMEDS_EXPORT + SALOMEDSClient_SObject* SObjectFactory(SALOMEDS::SObject_ptr theSObject) { if(CORBA::is_nil(theSObject)) return NULL; return new SALOMEDS_SObject(theSObject); } -SALOMEDSClient_SComponent* SComponentFactory(SALOMEDS::SComponent_ptr theSComponent) +SALOMEDS_EXPORT + SALOMEDSClient_SComponent* SComponentFactory(SALOMEDS::SComponent_ptr theSComponent) { if(CORBA::is_nil(theSComponent)) return NULL; return new SALOMEDS_SComponent(theSComponent); } -SALOMEDSClient_StudyBuilder* BuilderFactory(SALOMEDS::StudyBuilder_ptr theBuilder) +SALOMEDS_EXPORT + SALOMEDSClient_StudyBuilder* BuilderFactory(SALOMEDS::StudyBuilder_ptr theBuilder) { if(CORBA::is_nil(theBuilder)) return NULL; return new SALOMEDS_StudyBuilder(theBuilder); } -SALOMEDSClient_StudyManager* CreateStudyManager(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa) +SALOMEDS_EXPORT + SALOMEDSClient_StudyManager* CreateStudyManager(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa) { SALOME_NamingService namingService(orb); CORBA::Object_var obj = namingService.Resolve( "/myStudyManager" ); @@ -135,13 +141,14 @@ SALOMEDSClient_StudyManager* CreateStudyManager(CORBA::ORB_ptr orb, PortableServ return new SALOMEDS_StudyManager(); } -SALOMEDSClient_IParameters* GetIParameters(const _PTR(AttributeParameter)& ap) +SALOMEDS_EXPORT + SALOMEDSClient_IParameters* GetIParameters(const _PTR(AttributeParameter)& ap) { return new SALOMEDS_IParameters(ap); } - -SALOMEDS::SObject_ptr ConvertSObject(const _PTR(SObject)& theSObject) +SALOMEDS_EXPORT + SALOMEDS::SObject_ptr ConvertSObject(const _PTR(SObject)& theSObject) { SALOMEDS_SObject* so = _CAST(SObject, theSObject); @@ -149,14 +156,16 @@ SALOMEDS::SObject_ptr ConvertSObject(const _PTR(SObject)& theSObject) return so->GetSObject(); } -SALOMEDS::Study_ptr ConvertStudy(const _PTR(Study)& theStudy) +SALOMEDS_EXPORT + SALOMEDS::Study_ptr ConvertStudy(const _PTR(Study)& theStudy) { SALOMEDS_Study* study = _CAST(Study, theStudy); if(!theStudy || !study) return SALOMEDS::Study::_nil(); return study->GetStudy(); } -SALOMEDS::StudyBuilder_ptr ConvertBuilder(const _PTR(StudyBuilder)& theBuilder) +SALOMEDS_EXPORT + SALOMEDS::StudyBuilder_ptr ConvertBuilder(const _PTR(StudyBuilder)& theBuilder) { SALOMEDS_StudyBuilder* builder = _CAST(StudyBuilder, theBuilder); if(!theBuilder || !builder) return SALOMEDS::StudyBuilder::_nil(); diff --git a/src/SALOMEDS/SALOMEDS.hxx b/src/SALOMEDS/SALOMEDS.hxx index 2cebbf404..ca022bf4b 100644 --- a/src/SALOMEDS/SALOMEDS.hxx +++ b/src/SALOMEDS/SALOMEDS.hxx @@ -30,6 +30,8 @@ #ifndef SALOMEDS_HeaderFile #define SALOMEDS_HeaderFile +#include + #include namespace SALOMEDS @@ -43,7 +45,7 @@ namespace SALOMEDS // // Locker lock; // - class Locker : public Utils_Locker + class SALOMEDS_EXPORT Locker : public Utils_Locker { public: Locker(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx index 362308d7a..e1d058fc0 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx @@ -41,5 +41,6 @@ void SALOMEDS_AttributeIOR_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str)); + TCollection_ExtendedString anExtStr((char *)Str.in()); + Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_impl)->SetValue(anExtStr); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx b/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx index 0be09d990..9fd941897 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx @@ -43,7 +43,7 @@ int SALOMEDS_AttributeLocalID::Value() int aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = (bool)Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->Value(); + aValue = Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeLocalID::_narrow(_corba_impl)->Value(); return aValue; diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx index e1f976734..e126d44a4 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx @@ -61,7 +61,7 @@ CORBA::Long SALOMEDS_AttributeParameter_i::GetInt(const char* theID) * Purpose : Associates a double value with the ID */ //======================================================================= -void SALOMEDS_AttributeParameter_i::SetReal(const char* theID, const CORBA::Double theValue) +void SALOMEDS_AttributeParameter_i::SetReal(const char* theID, CORBA::Double theValue) { SALOMEDS::Locker lock; CheckLocked(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx index df1ba297a..9cff082f2 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx @@ -51,7 +51,7 @@ public: virtual void SetInt(const char* theID, CORBA::Long theValue); virtual CORBA::Long GetInt(const char* theID); - virtual void SetReal(const char* theID, const CORBA::Double theValue); + virtual void SetReal(const char* theID, CORBA::Double theValue); virtual CORBA::Double GetReal(const char* theID); virtual void SetString(const char* theID, const char* theValue); diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx index 35e65d4a6..e26235ca7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx @@ -33,11 +33,6 @@ #include CORBA_SERVER_HEADER(SALOMEDS) #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -#ifdef GetObject -#undef GetObject -#endif - class SALOMEDS_AttributePythonObject: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePythonObject { public: diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx index 83d7ecd01..316eb9142 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx @@ -40,8 +40,9 @@ void SALOMEDS_AttributePythonObject_i::SetObject(const char* theSequence, CORBA: char* SALOMEDS_AttributePythonObject_i::GetObject() { SALOMEDS::Locker lock; - char* aSeq = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->GetObject().ToCString(); - CORBA::String_var aStr = CORBA::string_dup(aSeq); + TCollection_AsciiString aSeq(Handle(SALOMEDSImpl_AttributePythonObject):: + DownCast(_impl)->GetObject().ToCString()); + CORBA::String_var aStr = CORBA::string_dup(aSeq.ToCString()); return aStr._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeString.cxx b/src/SALOMEDS/SALOMEDS_AttributeString.cxx new file mode 100644 index 000000000..dcf1f06fd --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeString.cxx @@ -0,0 +1,62 @@ +// Copyright (C) 2005 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 : SALOMEDS_AttributeString.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeString.hxx" +#include "SALOMEDS.hxx" + +#include +#include +#include + +SALOMEDS_AttributeString::SALOMEDS_AttributeString(const Handle(SALOMEDSImpl_AttributeString)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeString::SALOMEDS_AttributeString(SALOMEDS::AttributeString_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeString::~SALOMEDS_AttributeString() +{} + +std::string SALOMEDS_AttributeString::Value() +{ + std::string aValue; + if (_isLocal) { + SALOMEDS::Locker lock; + aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeString):: + DownCast(_local_impl)->Value()).ToCString(); + } + else aValue = SALOMEDS::AttributeString::_narrow(_corba_impl)->Value(); + return aValue; +} + +void SALOMEDS_AttributeString::SetValue(const std::string& value) +{ + if (_isLocal) { + CheckLocked(); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeString)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + } + else SALOMEDS::AttributeString::_narrow(_corba_impl)->SetValue(value.c_str()); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeString.hxx b/src/SALOMEDS/SALOMEDS_AttributeString.hxx new file mode 100644 index 000000000..025ae7836 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeString.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2005 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 : SALOMEDS_AttributeString.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeString_HeaderFile +#define SALOMEDS_AttributeString_HeaderFile + +#include "SALOMEDSClient_AttributeString.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeString: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeString +{ +public: + SALOMEDS_AttributeString(const Handle(SALOMEDSImpl_AttributeString)& theAttr); + SALOMEDS_AttributeString(SALOMEDS::AttributeString_ptr theAttr); + ~SALOMEDS_AttributeString(); + + virtual std::string Value(); + virtual void SetValue(const std::string& value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx new file mode 100644 index 000000000..62f9de652 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx @@ -0,0 +1,49 @@ +// Copyright (C) 2005 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 : SALOMEDS_AttributeString_i.cxx +// Author : Sergey RUIN +// Module : SALOME + + +#include "SALOMEDS_AttributeString_i.hxx" + +#include +#include "SALOMEDS_SObject_i.hxx" +#include "SALOMEDS.hxx" + +using namespace std; + +char* SALOMEDS_AttributeString_i::Value() +{ + SALOMEDS::Locker lock; + + CORBA::String_var c_s = + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeString)::DownCast(_impl)->Value()).ToCString()); + return c_s._retn(); +} + +void SALOMEDS_AttributeString_i::SetValue(const char* value) +{ + SALOMEDS::Locker lock; + + CheckLocked(); + TCollection_AsciiString aStr((char*)value); + Handle(SALOMEDSImpl_AttributeString)::DownCast(_impl)->SetValue(TCollection_ExtendedString(aStr)); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx new file mode 100644 index 000000000..1fa8e024f --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2005 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 : SALOMEDS_AttributeString_i.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeString_i_HeaderFile +#define SALOMEDS_AttributeString_i_HeaderFile + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" + +class SALOMEDS_AttributeString_i: public virtual POA_SALOMEDS::AttributeString, + public virtual SALOMEDS_GenericAttribute_i +{ +public: + SALOMEDS_AttributeString_i(const Handle(SALOMEDSImpl_AttributeString)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + virtual ~SALOMEDS_AttributeString_i() {}; + + char* Value(); + void SetValue(const char* value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx index a7bbc0451..829dd0205 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx @@ -297,6 +297,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetRow(int theRow) } else { SALOMEDS::LongSeq_var aRow = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRow(theRow); + aLength = aRow->length(); for (i = 0; i < aLength; i++) aVector.push_back(aRow[i]); } @@ -339,7 +340,7 @@ void SALOMEDS_AttributeTableOfInteger::SetColumn(int theColumn, const std::vecto Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger; for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]); try { - aTable->SetRowData(theColumn, aColumn); + aTable->SetColumnData(theColumn, aColumn); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); @@ -349,7 +350,7 @@ void SALOMEDS_AttributeTableOfInteger::SetColumn(int theColumn, const std::vecto SALOMEDS::LongSeq_var aColumn = new SALOMEDS::LongSeq(); aColumn->length(aLength); for (i = 0; i < aLength; i++) aColumn[i] = theData[i]; - SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRow(theColumn, aColumn); + SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetColumn(theColumn, aColumn); } } @@ -366,6 +367,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetColumn(int theColumn) } else { SALOMEDS::LongSeq_var aColumn = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumn(theColumn); + aLength = aColumn->length(); for (i = 0; i < aLength; i++) aVector.push_back(aColumn[i]); } return aVector; @@ -433,6 +435,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetRowSetIndices(int theRow) else { SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowSetIndices(theRow); + aLength = aSet->length(); for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]); } return aVector; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx index ce2afc9f7..f695ed2ad 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx @@ -296,6 +296,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetRow(int theRow) } else { SALOMEDS::DoubleSeq_var aRow = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRow(theRow); + aLength = aRow->length(); for (i = 0; i < aLength; i++) aVector.push_back(aRow[i]); } @@ -338,7 +339,7 @@ void SALOMEDS_AttributeTableOfReal::SetColumn(int theColumn, const std::vectorAppend(theData[i]); try { - aTable->SetRowData(theColumn, aColumn); + aTable->SetColumnData(theColumn, aColumn); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); @@ -348,7 +349,7 @@ void SALOMEDS_AttributeTableOfReal::SetColumn(int theColumn, const std::vectorlength(aLength); for (i = 0; i < aLength; i++) aColumn[i] = theData[i]; - SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRow(theColumn, aColumn); + SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetColumn(theColumn, aColumn); } } @@ -365,6 +366,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetColumn(int theColumn) } else { SALOMEDS::DoubleSeq_var aColumn = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumn(theColumn); + aLength = aColumn->length(); for (i = 0; i < aLength; i++) aVector.push_back(aColumn[i]); } return aVector; @@ -430,6 +432,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetRowSetIndices(int theRow) } else { SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowSetIndices(theRow); + aLength = aSet->length(); for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]); } return aVector; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx index de544941a..b416e0691 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx @@ -296,6 +296,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetRow(int theRow) } else { SALOMEDS::StringSeq_var aRow = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRow(theRow); + aLength = aRow->length(); for (i = 0; i < aLength; i++) aVector.push_back((char*)aRow[i].in()); } @@ -338,7 +339,7 @@ void SALOMEDS_AttributeTableOfString::SetColumn(int theColumn, const std::vector Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString; for (int i = 0; i < aLength; i++) aColumn->Append((char*)theData[i].c_str()); try { - aTable->SetRowData(theColumn, aColumn); + aTable->SetColumnData(theColumn, aColumn); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); @@ -348,7 +349,7 @@ void SALOMEDS_AttributeTableOfString::SetColumn(int theColumn, const std::vector SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq(); aColumn->length(aLength); for (i = 0; i < aLength; i++) aColumn[i] = (char*)theData[i].c_str(); - SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRow(theColumn, aColumn); + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumn(theColumn, aColumn); } } @@ -368,6 +369,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetColumn(int theColum else { SALOMEDS::StringSeq_var aColumn = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumn(theColumn); + aLength = aColumn->length(); for (i = 0; i < aLength; i++) aVector.push_back(aColumn[i].in()); } return aVector; @@ -435,6 +437,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetRowSetIndices(int theRow) else { SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowSetIndices(theRow); + aLength = aSet->length(); for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]); } return aVector; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx b/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx index df3d011d4..fff0cb6f0 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx @@ -71,8 +71,10 @@ std::vector<_PTR(SObject)> SALOMEDS_AttributeTarget::Get() else { SALOMEDS::Study::ListOfSObject_var aSeq = SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Get(); aLength = aSeq->length(); - aSO = new SALOMEDS_SObject(aSeq[i].in()); - for (i = 0; i < aLength; i++) aVector.push_back(_PTR(SObject)(aSO)); + for (i = 0; i < aLength; i++) { + aSO = new SALOMEDS_SObject(aSeq[i].in()); + aVector.push_back(_PTR(SObject)(aSO)); + } } return aVector; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx index 59703419d..8cac2063e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx @@ -25,6 +25,7 @@ #include "SALOMEDS.hxx" #include +#include #include #include @@ -248,6 +249,8 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFirst() void SALOMEDS_AttributeTreeNode::SetTreeID(const std::string& value) { + if(!Standard_GUID::CheckGUIDFormat((char*)value.c_str())) throw invalid_argument("Invalid GUID"); + if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx index b4ae565ce..3574d218b 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx @@ -160,7 +160,7 @@ void SALOMEDS_AttributeTreeNode_i::SetTreeID(const char* value) SALOMEDS::Locker lock; CheckLocked(); Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); - aNode->SetTreeID(Standard_GUID(aNode->ID())); + aNode->SetTreeID(Standard_GUID((char*)value)); } char* SALOMEDS_AttributeTreeNode_i::GetTreeID() diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx b/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx index 1b73e3c5c..c20087a47 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx @@ -25,6 +25,8 @@ #include "SALOMEDS.hxx" #include +#include + #include #include #include @@ -55,6 +57,8 @@ std::string SALOMEDS_AttributeUserID::Value() void SALOMEDS_AttributeUserID::SetValue(const std::string& value) { + if(!Standard_GUID::CheckGUIDFormat((char*)value.c_str())) throw invalid_argument("Invalid GUID"); + if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; diff --git a/src/SALOMEDS/SALOMEDS_Attributes.hxx b/src/SALOMEDS/SALOMEDS_Attributes.hxx index c27e95d2d..4c9901729 100644 --- a/src/SALOMEDS/SALOMEDS_Attributes.hxx +++ b/src/SALOMEDS/SALOMEDS_Attributes.hxx @@ -55,6 +55,7 @@ #include "SALOMEDSImpl_AttributeFlags.hxx" #include "SALOMEDSImpl_AttributeGraphic.hxx" #include "SALOMEDSImpl_AttributeParameter.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" #include "SALOMEDS_AttributeName_i.hxx" @@ -86,6 +87,7 @@ #include "SALOMEDS_AttributeFlags_i.hxx" #include "SALOMEDS_AttributeGraphic_i.hxx" #include "SALOMEDS_AttributeParameter_i.hxx" +#include "SALOMEDS_AttributeString_i.hxx" #define __CreateCORBAAttribute(CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \ Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theAttr); \ @@ -124,6 +126,7 @@ __CreateCORBAAttribute(AttributeFlags) \ __CreateCORBAAttribute(AttributeGraphic) \ __CreateCORBAAttribute(AttributeTreeNode) \ __CreateCORBAAttribute(AttributeUserID) \ -__CreateCORBAAttribute(AttributeParameter) +__CreateCORBAAttribute(AttributeParameter) \ +__CreateCORBAAttribute(AttributeString) #endif diff --git a/src/SALOMEDS/SALOMEDS_Client.cxx b/src/SALOMEDS/SALOMEDS_Client.cxx index 59343ac77..c100e8975 100644 --- a/src/SALOMEDS/SALOMEDS_Client.cxx +++ b/src/SALOMEDS/SALOMEDS_Client.cxx @@ -29,9 +29,10 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS) #include "SALOMEDS_StudyManager_i.hxx" -#include "utilities.h" #include "SALOMEDS_AttributeName_i.hxx" +#include "utilities.h" #include "HDFOI.hxx" + using namespace std; //============================================================================ diff --git a/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx b/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx index 69ae2d131..cb6786209 100644 --- a/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx +++ b/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx @@ -56,6 +56,7 @@ #include "SALOMEDSImpl_AttributeFlags.hxx" #include "SALOMEDSImpl_AttributeGraphic.hxx" #include "SALOMEDSImpl_AttributeParameter.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" #include "SALOMEDS_GenericAttribute.hxx" #include "SALOMEDS_AttributeName.hxx" @@ -87,6 +88,7 @@ #include "SALOMEDS_AttributeFlags.hxx" #include "SALOMEDS_AttributeGraphic.hxx" #include "SALOMEDS_AttributeParameter.hxx" +#include "SALOMEDS_AttributeString.hxx" #define __CreateClientAttributeLocal(CORBA_Name) if (strcmp(aTypeOfAttribute.c_str(), #CORBA_Name) == 0) { \ Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theGA); \ @@ -127,7 +129,8 @@ __CreateClientAttributeLocal(AttributeFlags) \ __CreateClientAttributeLocal(AttributeGraphic) \ __CreateClientAttributeLocal(AttributeTreeNode) \ __CreateClientAttributeLocal(AttributeUserID) \ -__CreateClientAttributeLocal(AttributeParameter) +__CreateClientAttributeLocal(AttributeParameter) \ +__CreateClientAttributeLocal(AttributeString) #define __CreateGenericClientAttributeCORBA \ __CreateClientAttributeCORBA(AttributeReal) \ @@ -158,6 +161,7 @@ __CreateClientAttributeCORBA(AttributeFlags) \ __CreateClientAttributeCORBA(AttributeGraphic) \ __CreateClientAttributeCORBA(AttributeTreeNode) \ __CreateClientAttributeCORBA(AttributeUserID) \ -__CreateClientAttributeCORBA(AttributeParameter) +__CreateClientAttributeCORBA(AttributeParameter) \ +__CreateClientAttributeCORBA(AttributeString) #endif diff --git a/src/SALOMEDS/SALOMEDS_Defines.hxx b/src/SALOMEDS/SALOMEDS_Defines.hxx new file mode 100755 index 000000000..33c4bde26 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_Defines.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOMEDS_Defines.hxx +// Author : Alexander A. BORODIN +// Module : SALOME + +#ifndef _SALOMEDS_Defines_HXX_ +#define _SALOMEDS_Defines_HXX_ + +#ifdef WNT + #if defined SALOMEDS_EXPORTS + #if defined WIN32 + #define SALOMEDS_EXPORT __declspec( dllexport ) + #else + #define SALOMEDS_EXPORT + #endif + #else + #if defined WIN32 + #define SALOMEDS_EXPORT __declspec( dllimport ) + #else + #define SALOMEDS_EXPORT + #endif + #endif +#else + #define SALOMEDS_EXPORT +#endif + +#endif diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.hxx b/src/SALOMEDS/SALOMEDS_Driver_i.hxx index 64f337da3..308206323 100644 --- a/src/SALOMEDS/SALOMEDS_Driver_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Driver_i.hxx @@ -20,7 +20,7 @@ #ifndef __SALOMEDS_DRIVER_I_H__ #define __SALOMEDS_DRIVER_I_H__ -#include +#include #include #include "SALOMEDSImpl_Driver.hxx" #include "SALOMEDSImpl_SComponent.hxx" diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx index f7d837568..dbbe153e0 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx @@ -58,7 +58,7 @@ SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ long pid = (long)getpid(); #endif - long addr = theGA->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = theGA->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = ((SALOMEDSImpl_GenericAttribute*)(addr)); _corba_impl = SALOMEDS::GenericAttribute::_nil(); diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx index 8ab64d6ab..d5ce15664 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx @@ -119,8 +119,9 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute } */ // mpv: now servants Destroyed by common algos of CORBA - char* aTypeOfAttribute = Handle(SALOMEDSImpl_GenericAttribute):: - DownCast(theAttr)->GetClassType().ToCString(); + TCollection_AsciiString aClassType = Handle(SALOMEDSImpl_GenericAttribute):: + DownCast(theAttr)->GetClassType(); + char* aTypeOfAttribute = aClassType.ToCString(); SALOMEDS::GenericAttribute_var anAttribute; SALOMEDS_GenericAttribute_i* attr_servant = NULL; __CreateGenericCORBAAttribute @@ -131,7 +132,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== -CORBA::Long SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +CORBA::LongLong SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) { #ifdef WIN32 long pid = (long)_getpid(); @@ -140,5 +141,5 @@ CORBA::Long SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostname, C #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; TDF_Attribute* local_impl = _impl.operator->(); - return ((long)local_impl); + return ((CORBA::LongLong)local_impl); } diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx index 6835caa3a..32176a41a 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx @@ -57,7 +57,7 @@ public: static SALOMEDS::GenericAttribute_ptr CreateAttribute(const Handle(TDF_Attribute)& theAttr, CORBA::ORB_ptr theOrb); - virtual CORBA::Long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); + virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; #endif diff --git a/src/SALOMEDS/SALOMEDS_SObject.cxx b/src/SALOMEDS/SALOMEDS_SObject.cxx index 9affb5f38..3888f4002 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject.cxx @@ -21,8 +21,6 @@ // Author : Sergey RUIN // Module : SALOME - - #include #include #include @@ -43,6 +41,7 @@ #include "Utils_SINGLETON.hxx" #ifdef WIN32 +#include #include #else #include @@ -62,7 +61,9 @@ SALOMEDS_SObject::SALOMEDS_SObject(SALOMEDS::SObject_ptr theSObject) long pid = (long)getpid(); #endif - long addr = theSObject->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = // mpv: fix for IPAL13534: for 64-bit platforms use 8-bytes long for pointer storage + theSObject->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + if(_isLocal) { _local_impl = ((SALOMEDSImpl_SObject*)(addr)); _corba_impl = SALOMEDS::SObject::_duplicate(theSObject); diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index f3d1602ed..59b0e30a0 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -318,7 +318,7 @@ char* SALOMEDS_SObject_i::GetIOR() //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== -CORBA::Long SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +CORBA::LongLong SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) { #ifdef WIN32 long pid = (long)_getpid(); @@ -327,5 +327,5 @@ CORBA::Long SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA::Lon #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; SALOMEDSImpl_SObject* local_impl = _impl.operator->(); - return ((long)local_impl); + return ((CORBA::LongLong)local_impl); } diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.hxx b/src/SALOMEDS/SALOMEDS_SObject_i.hxx index 29e434bf6..2a492fc22 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.hxx @@ -35,10 +35,6 @@ // Cascade headers #include "SALOMEDSImpl_SObject.hxx" -#ifdef GetObject -#undef GetObject -#endif - class Standard_EXPORT SALOMEDS_SObject_i: public virtual POA_SALOMEDS::SObject, public virtual PortableServer::RefCountServantBase, public virtual SALOME::GenericObj_i @@ -76,7 +72,7 @@ public: virtual CORBA::Short Tag(); virtual CORBA::Short Depth(); - virtual CORBA::Long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); + virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; #endif diff --git a/src/SALOMEDS/SALOMEDS_Server.cxx b/src/SALOMEDS/SALOMEDS_Server.cxx index b58231aae..397f39772 100644 --- a/src/SALOMEDS/SALOMEDS_Server.cxx +++ b/src/SALOMEDS/SALOMEDS_Server.cxx @@ -26,12 +26,14 @@ // Module : SALOME // $Header$ -#include -#include CORBA_SERVER_HEADER(SALOMEDS) -#include "SALOMEDS_StudyManager_i.hxx" #include "utilities.h" #include "Utils_SINGLETON.hxx" + #include "SALOME_NamingService.hxx" +#include "SALOMEDS_StudyManager_i.hxx" + +#include +#include CORBA_SERVER_HEADER(SALOMEDS) #ifdef CHECKTIME #include diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx index 210b52833..207684032 100644 --- a/src/SALOMEDS/SALOMEDS_Study.cxx +++ b/src/SALOMEDS/SALOMEDS_Study.cxx @@ -244,9 +244,15 @@ _PTR(SObject) SALOMEDS_Study::CreateObjectID(const std::string& anObjectID) SALOMEDSClient_SObject* aSO = NULL; if (_isLocal) { SALOMEDS::Locker lock; - aSO = new SALOMEDS_SObject(_local_impl->CreateObjectID((char*)anObjectID.c_str())); + Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->CreateObjectID((char*)anObjectID.c_str()); + if(aSO_impl.IsNull()) return _PTR(SObject)(aSO); + aSO = new SALOMEDS_SObject(aSO_impl); + } + else { + SALOMEDS::SObject_var aSO_impl = _corba_impl->CreateObjectID((char*)anObjectID.c_str()); + if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO); + aSO = new SALOMEDS_SObject(aSO_impl); } - else aSO = new SALOMEDS_SObject(_corba_impl->CreateObjectID((char*)anObjectID.c_str())); return _PTR(SObject)(aSO); } @@ -288,6 +294,7 @@ _PTR(SObject) SALOMEDS_Study::FindObjectByPath(const std::string& thePath) std::string SALOMEDS_Study::GetObjectPath(const _PTR(SObject)& theSO) { + if(!theSO) return ""; SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); std::string aPath; if (_isLocal) { diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx index 97fa1f884..277ceebb9 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx @@ -41,6 +41,7 @@ #include "SALOMEDSImpl_GenericAttribute.hxx" #include +#include #include #include @@ -97,6 +98,8 @@ _PTR(SComponent) SALOMEDS_StudyBuilder::NewComponent(const std::string& Componen void SALOMEDS_StudyBuilder::DefineComponentInstance (const _PTR(SComponent)& theSCO, const std::string& ComponentIOR) { + if(theSCO) return; + SALOMEDS_SComponent* aSCO = dynamic_cast(theSCO.get()); if (_isLocal) { CheckLocked(); @@ -113,6 +116,7 @@ void SALOMEDS_StudyBuilder::DefineComponentInstance (const _PTR(SComponent)& the void SALOMEDS_StudyBuilder::RemoveComponent(const _PTR(SComponent)& theSCO) { + if(!theSCO) return; SALOMEDS_SComponent* aSCO = dynamic_cast(theSCO.get()); if (_isLocal) { CheckLocked(); @@ -188,6 +192,8 @@ void SALOMEDS_StudyBuilder::AddDirectory(const std::string& thePath) void SALOMEDS_StudyBuilder::LoadWith(const _PTR(SComponent)& theSCO, const std::string& theIOR) { + if(!theSCO) return; + SALOMEDS_SComponent* aSCO = dynamic_cast(theSCO.get()); CORBA::Object_var obj = _orb->string_to_object(theIOR.c_str()); SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj); @@ -217,6 +223,8 @@ void SALOMEDS_StudyBuilder::Load(const _PTR(SObject)& theSCO) void SALOMEDS_StudyBuilder::RemoveObject(const _PTR(SObject)& theSO) { + if(!theSO) return; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { CheckLocked(); @@ -229,6 +237,8 @@ void SALOMEDS_StudyBuilder::RemoveObject(const _PTR(SObject)& theSO) void SALOMEDS_StudyBuilder::RemoveObjectWithChildren(const _PTR(SObject)& theSO) { + if(!theSO) return; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { CheckLocked(); @@ -241,9 +251,10 @@ void SALOMEDS_StudyBuilder::RemoveObjectWithChildren(const _PTR(SObject)& theSO) _PTR(GenericAttribute) SALOMEDS_StudyBuilder::FindOrCreateAttribute(const _PTR(SObject)& theSO, const std::string& aTypeOfAttribute) -{ - SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); +{ SALOMEDSClient_GenericAttribute* anAttr = NULL; + if(!theSO) return _PTR(GenericAttribute)(anAttr); + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { SALOMEDS::Locker lock; @@ -271,6 +282,9 @@ bool SALOMEDS_StudyBuilder::FindAttribute(const _PTR(SObject)& theSO, const std::string& aTypeOfAttribute) { bool ret; + + if(!theSO) return false; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { SALOMEDS::Locker lock; @@ -290,6 +304,8 @@ bool SALOMEDS_StudyBuilder::FindAttribute(const _PTR(SObject)& theSO, void SALOMEDS_StudyBuilder::RemoveAttribute(const _PTR(SObject)& theSO, const std::string& aTypeOfAttribute) { + if(!theSO) return; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { CheckLocked(); @@ -302,6 +318,8 @@ void SALOMEDS_StudyBuilder::RemoveAttribute(const _PTR(SObject)& theSO, const st void SALOMEDS_StudyBuilder::Addreference(const _PTR(SObject)& me, const _PTR(SObject)& thereferencedObject) { + if(!me || !thereferencedObject) return; + SALOMEDS_SObject* aSO = dynamic_cast(me.get()); SALOMEDS_SObject* aRefSO = dynamic_cast(thereferencedObject.get()); if (_isLocal) { @@ -315,6 +333,7 @@ void SALOMEDS_StudyBuilder::Addreference(const _PTR(SObject)& me, const _PTR(SOb void SALOMEDS_StudyBuilder::RemoveReference(const _PTR(SObject)& me) { + if(!me) return; SALOMEDS_SObject* aSO = dynamic_cast(me.get()); if (_isLocal) { CheckLocked(); @@ -327,6 +346,9 @@ void SALOMEDS_StudyBuilder::RemoveReference(const _PTR(SObject)& me) void SALOMEDS_StudyBuilder::SetGUID(const _PTR(SObject)& theSO, const std::string& theGUID) { + if(!theSO) return; + if(!Standard_GUID::CheckGUIDFormat((char*)theGUID.c_str())) throw invalid_argument("Invalid GUID"); + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { CheckLocked(); @@ -339,6 +361,8 @@ void SALOMEDS_StudyBuilder::SetGUID(const _PTR(SObject)& theSO, const std::strin bool SALOMEDS_StudyBuilder::IsGUID(const _PTR(SObject)& theSO, const std::string& theGUID) { + if(!theSO || !Standard_GUID::CheckGUIDFormat((char*)theGUID.c_str())) return false; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); bool ret; if (_isLocal) { @@ -482,6 +506,8 @@ void SALOMEDS_StudyBuilder::CheckLocked() void SALOMEDS_StudyBuilder::SetName(const _PTR(SObject)& theSO, const std::string& theValue) { + if(!theSO) return; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { CheckLocked(); @@ -494,6 +520,8 @@ void SALOMEDS_StudyBuilder::SetName(const _PTR(SObject)& theSO, const std::strin void SALOMEDS_StudyBuilder::SetComment(const _PTR(SObject)& theSO, const std::string& theValue) { + if(!theSO) return; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { CheckLocked(); @@ -506,6 +534,8 @@ void SALOMEDS_StudyBuilder::SetComment(const _PTR(SObject)& theSO, const std::st void SALOMEDS_StudyBuilder::SetIOR(const _PTR(SObject)& theSO, const std::string& theValue) { + if(!theSO) return; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { CheckLocked(); diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx index 39807b2bd..9ad50d1bf 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx @@ -24,6 +24,8 @@ #ifndef __SALOMEDS_STUDYBUILDER_H__ #define __SALOMEDS_STUDYBUILDER_H__ +#include "SALOMEDS_Defines.hxx" + #include "SALOMEDSClient.hxx" #include "SALOMEDSImpl_StudyBuilder.hxx" @@ -31,8 +33,7 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS) - -class SALOMEDS_StudyBuilder: public SALOMEDSClient_StudyBuilder +class SALOMEDS_EXPORT SALOMEDS_StudyBuilder: public SALOMEDSClient_StudyBuilder { private: bool _isLocal; diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx index 87adc2db8..6306b9858 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx @@ -98,7 +98,7 @@ void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr a aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)aComponent->GetID()); CORBA::String_var iorstr = _orb->object_to_string(IOR); - _impl->DefineComponentInstance(aSCO, (char*)iorstr); + _impl->DefineComponentInstance(aSCO, (char*)iorstr.in()); } //============================================================================ diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx index 7912fa834..ae6d0e5c5 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx @@ -130,5 +130,8 @@ public: virtual void SetName(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection); virtual void SetComment(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection); virtual void SetIOR(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection); + + Handle(SALOMEDSImpl_StudyBuilder) GetImpl() { return _impl; } + }; #endif diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.cxx b/src/SALOMEDS/SALOMEDS_StudyManager.cxx index cae5cfba5..335123165 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager.cxx @@ -61,7 +61,7 @@ SALOMEDS_StudyManager::SALOMEDS_StudyManager(SALOMEDS::StudyManager_ptr theManag long pid = (long)getpid(); #endif - long addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = ((SALOMEDSImpl_StudyManager*)(addr)); _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager); @@ -89,7 +89,7 @@ SALOMEDS_StudyManager::SALOMEDS_StudyManager() long pid = (long)getpid(); #endif - long addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = ((SALOMEDSImpl_StudyManager*)(addr)); _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager); diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index 617f7c194..4d612ccfd 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -134,9 +134,9 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name) _name_service->Register(Study, study_name); // Assign the value of the IOR in the study->root - const char* IORStudy = _orb->object_to_string(Study); + CORBA::String_var IORStudy = _orb->object_to_string(Study); - aStudyImpl->SetTransientReference((char*)IORStudy); + aStudyImpl->SetTransientReference((char*)IORStudy.in()); _mapOfPOA[Study->StudyId()] = _poa; @@ -166,7 +166,7 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) // Assign the value of the IOR in the study->root CORBA::String_var IORStudy = _orb->object_to_string(Study); - aStudyImpl->SetTransientReference((char*)IORStudy); + aStudyImpl->SetTransientReference((char*)IORStudy.in()); // Register study in the naming service // Path to acces the study @@ -337,7 +337,8 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByID(CORBA::Short aStudyID) } SALOMEDS_Study_i* aStudy_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); - SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(aStudy_servant->_this()); + CORBA::Object_var obj = aStudy_servant->_this(); + SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(obj); return aStudy._retn(); } @@ -456,7 +457,7 @@ PortableServer::POA_ptr SALOMEDS_StudyManager_i::GetPOA(const SALOMEDS::Study_pt //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== -CORBA::Long SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +CORBA::LongLong SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) { #ifdef WIN32 long pid = (long)_getpid(); @@ -465,7 +466,7 @@ CORBA::Long SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, CORBA #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; SALOMEDSImpl_StudyManager* aManager = _impl.operator->(); - return ((long)aManager); + return ((CORBA::LongLong)aManager); } //=========================================================================== diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx index 3f3c3d831..31c486f7b 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx @@ -142,7 +142,7 @@ public: void ping(){}; - virtual CORBA::Long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); + virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); static PortableServer::POA_ptr GetPOA(const SALOMEDS::Study_ptr theStudy); }; diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index dcf58e808..1bac30de6 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -194,6 +194,8 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::CreateObjectID(const char* anObjectID) { SALOMEDS::Locker lock; + if(!anObjectID || strlen(anObjectID) == 0) return SALOMEDS::SObject::_nil(); + Handle(SALOMEDSImpl_SObject) aSO = _impl->CreateObjectID((char*)anObjectID); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); @@ -399,6 +401,7 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetFileNames(const char* theContext) //============================================================================ /*! Function : GetComponentNames * Purpose : method to get all components names + * SRN: Note, theContext can be any, it doesn't matter */ //============================================================================ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theContext) @@ -407,9 +410,6 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theCont SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; - if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) - throw SALOMEDS::Study::StudyInvalidContext(); - Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetComponentNames(TCollection_AsciiString((char*)theContext)); @@ -880,10 +880,31 @@ char* SALOMEDS_Study_i::GetDefaultScript(const char* theModuleName, const char* return CORBA::string_dup(script.c_str()); } +//============================================================================ +/*! Function : EnableUseCaseAutoFilling + * Purpose : + */ +//============================================================================ +void SALOMEDS_Study_i::EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) +{ + _impl->EnableUseCaseAutoFilling(isEnabled); + Handle(SALOMEDSImpl_StudyBuilder) builder = _builder->GetImpl(); + if(!builder.IsNull()) { + if(isEnabled) { + builder->SetOnAddSObject(_impl->GetCallback()); + builder->SetOnRemoveSObject(_impl->GetCallback()); + } + else { + builder->SetOnAddSObject(NULL); + builder->SetOnRemoveSObject(NULL); + } + } +} + //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== -CORBA::Long SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +CORBA::LongLong SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) { #ifdef WIN32 long pid = (long)_getpid(); @@ -892,5 +913,5 @@ CORBA::Long SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::Long #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; SALOMEDSImpl_Study* local_impl = _impl.operator->(); - return ((long)local_impl); + return ((CORBA::LongLong)local_impl); } diff --git a/src/SALOMEDS/SALOMEDS_Study_i.hxx b/src/SALOMEDS/SALOMEDS_Study_i.hxx index e1fdc8656..6d44afc95 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.hxx @@ -247,7 +247,7 @@ public: virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject); - virtual SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties(); + virtual SALOMEDS::AttributeStudyProperties_ptr GetProperties(); virtual char* GetLastModificationDate(); @@ -260,7 +260,7 @@ public: virtual void Close(); - void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _impl->EnableUseCaseAutoFilling(isEnabled); } + void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled); // postponed destroying of CORBA object functionality virtual void AddPostponed(const char* theIOR); @@ -298,6 +298,6 @@ public: virtual Handle(SALOMEDSImpl_Study) GetImpl() { return _impl; } - virtual CORBA::Long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); + virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; #endif diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx index d429516f3..c89cb6ff3 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx @@ -200,11 +200,19 @@ _PTR(SObject) SALOMEDS_UseCaseBuilder::AddUseCase(const std::string& theName) _PTR(UseCaseIterator) SALOMEDS_UseCaseBuilder::GetUseCaseIterator(const _PTR(SObject)& theObject) { SALOMEDS_UseCaseIterator* it = NULL; - SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); + SALOMEDS_SObject* obj = (theObject)?dynamic_cast(theObject.get()):NULL; if (_isLocal) { SALOMEDS::Locker lock; - it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(obj->GetLocalImpl())); + if(obj) + it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(obj->GetLocalImpl())); + else + it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(NULL)); + } + else { + if(obj) + it = new SALOMEDS_UseCaseIterator(_corba_impl->GetUseCaseIterator(obj->GetCORBAImpl())); + else + it = new SALOMEDS_UseCaseIterator(_corba_impl->GetUseCaseIterator(SALOMEDS::SObject::_nil())); } - else it = new SALOMEDS_UseCaseIterator(_corba_impl->GetUseCaseIterator(obj->GetCORBAImpl())); return _PTR(UseCaseIterator)(it); } diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx index a0da803d2..6997908eb 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx @@ -101,7 +101,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::InsertBefore(SALOMEDS::SObject_ptr the { SALOMEDS::Locker lock; if(_impl.IsNull() || theFirst->_is_nil() || theNext->_is_nil()) return 0; - return _impl->AppendTo(_impl->GetSObject(theFirst->GetID()), _impl->GetSObject(theNext->GetID())); + return _impl->InsertBefore(_impl->GetSObject(theFirst->GetID()), _impl->GetSObject(theNext->GetID())); } @@ -218,7 +218,9 @@ SALOMEDS::UseCaseIterator_ptr SALOMEDS_UseCaseBuilder_i::GetUseCaseIterator(SALO SALOMEDS::Locker lock; if(_impl.IsNull()) return SALOMEDS::UseCaseIterator::_nil(); - Handle(SALOMEDSImpl_UseCaseIterator) anItr = _impl->GetUseCaseIterator(_impl->GetSObject(theObject->GetID())); + Handle(SALOMEDSImpl_UseCaseIterator) anItr; + if(!CORBA::is_nil(theObject)) anItr = _impl->GetUseCaseIterator(_impl->GetSObject(theObject->GetID())); + else anItr = _impl->GetUseCaseIterator(NULL); SALOMEDS_UseCaseIterator_i* aServant = new SALOMEDS_UseCaseIterator_i(anItr, _orb); SALOMEDS::UseCaseIterator_var anIterator = SALOMEDS::UseCaseIterator::_narrow(aServant->_this()); return anIterator._retn(); diff --git a/src/SALOMEDS/Test/Makefile.am b/src/SALOMEDS/Test/Makefile.am index 6b1bc5f50..be6a60647 100644 --- a/src/SALOMEDS/Test/Makefile.am +++ b/src/SALOMEDS/Test/Makefile.am @@ -57,6 +57,7 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \ -I$(srcdir)/$(RPATH)/ResourcesManager \ -I$(srcdir)/$(RPATH)/LifeCycleCORBA \ + -I$(srcdir)/$(RPATH)/SALOMEDS \ -I$(srcdir)/$(RPATH)/SALOMEDSClient \ -I$(srcdir)/$(RPATH)/SALOMEDSImpl -I$(srcdir)/$(RPATH)/SALOMEDSImpl/Test \ -I$(top_builddir)/salome_adm/unix \ @@ -107,4 +108,3 @@ TestSALOMEDS_LDADD = \ libSALOMEDSTest.la ../libSalomeDS.la \ $(RPATH)/NamingService/Test/libNamingServiceTest.la \ $(COMMON_LIBS) - diff --git a/src/SALOMEDS/Test/SALOMEDSTest.cxx b/src/SALOMEDS/Test/SALOMEDSTest.cxx index 88443291b..0b728667b 100644 --- a/src/SALOMEDS/Test/SALOMEDSTest.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest.cxx @@ -20,81 +20,50 @@ #include "SALOMEDSTest.hxx" + +#include "SALOMEDS_StudyManager_i.hxx" +#include "utilities.h" +#include "Utils_SINGLETON.hxx" +#include "Utils_ORB_INIT.hxx" +#include "SALOME_NamingService.hxx" +#include "SALOME_LifeCycleCORBA.hxx" + #include #include #include #include #include -#include "utilities.h" -#include "Utils_SALOME_Exception.hxx" -#include "Utils_ORB_INIT.hxx" -#include "Utils_SINGLETON.hxx" -#include "OpUtil.hxx" #include "SALOMEDSClient.hxx" -#include "SALOMEDSClient_ClientFactory.hxx" +#include "SALOMEDS_StudyManager_i.hxx" +#include "SALOMEDS_StudyManager.hxx" +#include "SALOMEDS_SObject.hxx" + #include +#include using namespace std; -#define PT_INTEGER 0 -#define PT_REAL 1 -#define PT_BOOLEAN 2 -#define PT_STRING 3 -#define PT_REALARRAY 4 -#define PT_INTARRAY 5 -#define PT_STRARRAY 6 - - -#define TRACEFILE "/tmp/traceUnitTest.log" - // ============================================================================ /*! * Set up the environment */ // ============================================================================ - + void SALOMEDSTest::setUp() -{ - TCollection_AsciiString kernel(getenv("KERNEL_ROOT_DIR")); - TCollection_AsciiString subPath("/share/salome/resources/kernel"); - TCollection_AsciiString csf_var = (kernel+subPath); - setenv("CSF_PluginDefaults", csf_var.ToCString(), 0); - setenv("CSF_SALOMEDS_ResourcesDefaults", csf_var.ToCString(), 0); - - // --- trace on file - char *theFileName = TRACEFILE; - - string s = "file:"; - s += theFileName; - CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite - - ofstream traceFile; - traceFile.open(theFileName, ios::out | ios::app); - CPPUNIT_ASSERT(traceFile); // file created empty, then closed - traceFile.close(); - - LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance(); - CPPUNIT_ASSERT(bp1); +{ + int argc = 1; + char* argv[] = {""}; - // --- Get or initialize the orb - - int _argc = 1; - char* _argv[] = {""}; ORB_INIT &init = *SINGLETON_::Instance() ; ASSERT(SINGLETON_::IsAlreadyExisting()); - _orb = init(_argc , _argv ) ; - - sleep(2); - - // --- Create a SALOME_NamingService instance + _orb = init(argc , argv ) ; + SALOME_NamingService NS(_orb); + CORBA::Object_var obj = NS.Resolve( "/myStudyManager" ); + _sm = SALOMEDS::StudyManager::_narrow( obj ); - _NS = new SALOME_NamingService; - - sleep(2); - - _NS->init_orb(_orb) ; + CPPUNIT_ASSERT( !CORBA::is_nil(_sm) ); } // ============================================================================ @@ -103,88 +72,73 @@ void SALOMEDSTest::setUp() */ // ============================================================================ -void -SALOMEDSTest::tearDown() +void SALOMEDSTest::tearDown() { - LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance(); - CPPUNIT_ASSERT(bp1); - bp1->deleteInstance(bp1); - - delete _NS; + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + vector v = sm->GetOpenStudies(); + for(int i = 0; iGetStudyByName(v[i]); + if(study) + sm->Close(study); + } } +#include "SALOMEDSTest_AttributeComment.cxx" +#include "SALOMEDSTest_AttributeDrawable.cxx" +#include "SALOMEDSTest_AttributeExpandable.cxx" +#include "SALOMEDSTest_AttributeExternalFileDef.cxx" +#include "SALOMEDSTest_AttributeFileType.cxx" +#include "SALOMEDSTest_AttributeFlags.cxx" +#include "SALOMEDSTest_AttributeGraphic.cxx" +#include "SALOMEDSTest_AttributeIOR.cxx" +#include "SALOMEDSTest_AttributeInteger.cxx" +#include "SALOMEDSTest_AttributeLocalID.cxx" +#include "SALOMEDSTest_AttributeName.cxx" +#include "SALOMEDSTest_AttributeOpened.cxx" +#include "SALOMEDSTest_AttributeParameter.cxx" +#include "SALOMEDSTest_AttributePersistentRef.cxx" +#include "SALOMEDSTest_AttributePixMap.cxx" +#include "SALOMEDSTest_AttributePythonObject.cxx" +#include "SALOMEDSTest_AttributeReal.cxx" +#include "SALOMEDSTest_AttributeSelectable.cxx" +#include "SALOMEDSTest_AttributeSequenceOfInteger.cxx" +#include "SALOMEDSTest_AttributeSequenceOfReal.cxx" +#include "SALOMEDSTest_AttributeStudyProperties.cxx" +#include "SALOMEDSTest_AttributeTableOfInteger.cxx" +#include "SALOMEDSTest_AttributeTableOfReal.cxx" +#include "SALOMEDSTest_AttributeTableOfString.cxx" +#include "SALOMEDSTest_AttributeTarget.cxx" +#include "SALOMEDSTest_AttributeTextColor.cxx" +#include "SALOMEDSTest_AttributeTextHighlightColor.cxx" +#include "SALOMEDSTest_AttributeTreeNode.cxx" +#include "SALOMEDSTest_AttributeUserID.cxx" +#include "SALOMEDSTest_ChildIterator.cxx" +#include "SALOMEDSTest_SComponent.cxx" +#include "SALOMEDSTest_SComponentIterator.cxx" +#include "SALOMEDSTest_SObject.cxx" +#include "SALOMEDSTest_Study.cxx" +#include "SALOMEDSTest_StudyBuilder.cxx" +#include "SALOMEDSTest_StudyManager.cxx" +#include "SALOMEDSTest_UseCase.cxx" + + // ============================================================================ /*! - * Check AttributeParameter + * Set up the environment */ // ============================================================================ -void SALOMEDSTest::testAttributeParameter() -{ - CORBA::Object_var obj = _orb->resolve_initial_references( "RootPOA" ); - PortableServer::POA_var poa = PortableServer::POA::_narrow( obj ); - - PortableServer::POAManager_var pman = poa->the_POAManager(); - pman->activate() ; - - _PTR(StudyManager) sm = ClientFactory::createStudyManager(_orb, poa); - - CPPUNIT_ASSERT(sm); - - _PTR(Study) study = sm->NewStudy("Test"); - - CPPUNIT_ASSERT(study); - - _PTR(AttributeParameter) _ap = study->GetCommonParameters("TestComp", 0); - - CPPUNIT_ASSERT(_ap); - - _ap->SetInt("IntValue", 1); - CPPUNIT_ASSERT(_ap->IsSet("IntValue", PT_INTEGER)); - CPPUNIT_ASSERT(_ap->GetInt("IntValue") == 1); + +void SALOMEDSTest_Embedded::setUp() +{ + int argc = 1; + char* argv[] = {""}; - _ap->SetReal("RealValue", 1.2); - CPPUNIT_ASSERT(_ap->IsSet("RealValue", PT_REAL)); - CPPUNIT_ASSERT(_ap->GetReal("RealValue") == 1.2); - - _ap->SetString("StringValue", "hello"); - CPPUNIT_ASSERT(_ap->IsSet("StringValue", PT_STRING)); - CPPUNIT_ASSERT(_ap->GetString("StringValue") == "hello"); - - _ap->SetBool("BoolValue", 0); - CPPUNIT_ASSERT(_ap->IsSet("BoolValue", PT_BOOLEAN)); - CPPUNIT_ASSERT(!_ap->GetBool("BoolValue")); - - _ap->SetBool("BoolValue", 0); - CPPUNIT_ASSERT(_ap->IsSet("BoolValue", PT_BOOLEAN)); - CPPUNIT_ASSERT(!_ap->GetBool("BoolValue")); - - vector intArray; - intArray.push_back(0); - intArray.push_back(1); - - _ap->SetIntArray("IntArray", intArray); - CPPUNIT_ASSERT(_ap->IsSet("IntArray", PT_INTARRAY)); - CPPUNIT_ASSERT(_ap->GetIntArray("IntArray")[0] == 0); - CPPUNIT_ASSERT(_ap->GetIntArray("IntArray")[1] == 1); - - vector realArray; - realArray.push_back(0.0); - realArray.push_back(1.1); - - _ap->SetRealArray("RealArray", realArray); - CPPUNIT_ASSERT(_ap->IsSet("RealArray", PT_REALARRAY)); - CPPUNIT_ASSERT(_ap->GetRealArray("RealArray")[0] == 0.0); - CPPUNIT_ASSERT(_ap->GetRealArray("RealArray")[1] == 1.1); + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()); + _orb = init(argc , argv ) ; + SALOME_NamingService NS(_orb); + CORBA::Object_var obj = NS.Resolve( "/myStudyManager_embedded" ); + _sm = SALOMEDS::StudyManager::_narrow( obj ); - vector strArray; - strArray.push_back("hello"); - strArray.push_back("world"); - - _ap->SetStrArray("StrArray", strArray); - CPPUNIT_ASSERT(_ap->IsSet("StrArray", PT_STRARRAY)); - CPPUNIT_ASSERT(_ap->GetStrArray("StrArray")[0] == "hello"); - CPPUNIT_ASSERT(_ap->GetStrArray("StrArray")[1] == "world"); + CPPUNIT_ASSERT( !CORBA::is_nil(_sm) ); } - - - diff --git a/src/SALOMEDS/Test/SALOMEDSTest.hxx b/src/SALOMEDS/Test/SALOMEDSTest.hxx index 83c4debb6..6dcaed5e5 100644 --- a/src/SALOMEDS/Test/SALOMEDSTest.hxx +++ b/src/SALOMEDS/Test/SALOMEDSTest.hxx @@ -23,26 +23,161 @@ #include -#include - #include -#include "SALOME_NamingService.hxx" +#include CORBA_SERVER_HEADER(SALOMEDS) class SALOMEDSTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( SALOMEDSTest ); + + //Attributes' tests + + CPPUNIT_TEST( testAttributeComment ); + CPPUNIT_TEST( testAttributeDrawable ); + CPPUNIT_TEST( testAttributeExpandable ); + CPPUNIT_TEST( testAttributeExternalFileDef ); + CPPUNIT_TEST( testAttributeFileType ); + CPPUNIT_TEST( testAttributeFlags ); + CPPUNIT_TEST( testAttributeGraphic ); + CPPUNIT_TEST( testAttributeIOR ); + CPPUNIT_TEST( testAttributeInteger ); + CPPUNIT_TEST( testAttributeLocalID ); + CPPUNIT_TEST( testAttributeName ); + CPPUNIT_TEST( testAttributeOpened ); CPPUNIT_TEST( testAttributeParameter ); + CPPUNIT_TEST( testAttributePersistentRef ); + CPPUNIT_TEST( testAttributePixMap ); + CPPUNIT_TEST( testAttributePythonObject ); + CPPUNIT_TEST( testAttributeReal ); + CPPUNIT_TEST( testAttributeSelectable ); + CPPUNIT_TEST( testAttributeSequenceOfInteger ); + CPPUNIT_TEST( testAttributeSequenceOfReal ); + CPPUNIT_TEST( testAttributeStudyProperties ); + CPPUNIT_TEST( testAttributeTableOfInteger ); + CPPUNIT_TEST( testAttributeTableOfReal ); + CPPUNIT_TEST( testAttributeTableOfString ); + CPPUNIT_TEST( testAttributeTarget ); + CPPUNIT_TEST( testAttributeTextColor ); + CPPUNIT_TEST( testAttributeTextHighlightColor ); + CPPUNIT_TEST( testAttributeTreeNode ); + CPPUNIT_TEST( testAttributeUserID ); + CPPUNIT_TEST( testChildIterator ); + CPPUNIT_TEST( testSComponent ); + CPPUNIT_TEST( testSComponentIterator ); + CPPUNIT_TEST( testSObject ); + CPPUNIT_TEST( testStudy ); + CPPUNIT_TEST( testStudyBuilder ); + CPPUNIT_TEST( testStudyManager ); + CPPUNIT_TEST( testUseCase ); + + CPPUNIT_TEST_SUITE_END(); public: - void setUp(); - void tearDown(); + virtual void setUp(); + virtual void tearDown(); + + //Attributes + void testAttributeComment(); + void testAttributeDrawable(); + void testAttributeExpandable(); + void testAttributeExternalFileDef(); + void testAttributeFileType(); + void testAttributeFlags(); + void testAttributeGraphic(); + void testAttributeIOR(); + void testAttributeInteger(); + void testAttributeLocalID(); + void testAttributeName(); + void testAttributeOpened(); void testAttributeParameter(); + void testAttributePersistentRef(); + void testAttributePixMap(); + void testAttributePythonObject(); + void testAttributeReal(); + void testAttributeSelectable(); + void testAttributeSequenceOfInteger(); + void testAttributeSequenceOfReal(); + void testAttributeStudyProperties(); + void testAttributeTableOfInteger(); + void testAttributeTableOfReal(); + void testAttributeTableOfString(); + void testAttributeTarget(); + void testAttributeTextColor(); + void testAttributeTextHighlightColor(); + void testAttributeTreeNode(); + void testAttributeUserID(); + + //Objects + void testChildIterator(); + void testSComponent(); + void testSComponentIterator(); + void testSObject(); + void testStudy(); + void testStudyBuilder(); + void testStudyManager(); + void testUseCase(); protected: - CORBA::ORB_var _orb; - SALOME_NamingService* _NS; + +SALOMEDS::StudyManager_var _sm; +CORBA::ORB_var _orb; + +}; + + + +class SALOMEDSTest_Embedded : public SALOMEDSTest +{ + CPPUNIT_TEST_SUITE( SALOMEDSTest_Embedded ); + + //Attributes' tests + + CPPUNIT_TEST( testAttributeComment ); + CPPUNIT_TEST( testAttributeDrawable ); + CPPUNIT_TEST( testAttributeExpandable ); + CPPUNIT_TEST( testAttributeExternalFileDef ); + CPPUNIT_TEST( testAttributeFileType ); + CPPUNIT_TEST( testAttributeFlags ); + CPPUNIT_TEST( testAttributeGraphic ); + CPPUNIT_TEST( testAttributeIOR ); + CPPUNIT_TEST( testAttributeInteger ); + CPPUNIT_TEST( testAttributeLocalID ); + CPPUNIT_TEST( testAttributeName ); + CPPUNIT_TEST( testAttributeOpened ); + CPPUNIT_TEST( testAttributeParameter ); + CPPUNIT_TEST( testAttributePersistentRef ); + CPPUNIT_TEST( testAttributePixMap ); + CPPUNIT_TEST( testAttributePythonObject ); + CPPUNIT_TEST( testAttributeReal ); + CPPUNIT_TEST( testAttributeSelectable ); + CPPUNIT_TEST( testAttributeSequenceOfInteger ); + CPPUNIT_TEST( testAttributeSequenceOfReal ); + CPPUNIT_TEST( testAttributeStudyProperties ); + CPPUNIT_TEST( testAttributeTableOfInteger ); + CPPUNIT_TEST( testAttributeTableOfReal ); + CPPUNIT_TEST( testAttributeTableOfString ); + CPPUNIT_TEST( testAttributeTarget ); + CPPUNIT_TEST( testAttributeTextColor ); + CPPUNIT_TEST( testAttributeTextHighlightColor ); + CPPUNIT_TEST( testAttributeTreeNode ); + CPPUNIT_TEST( testAttributeUserID ); + CPPUNIT_TEST( testChildIterator ); + CPPUNIT_TEST( testSComponent ); + CPPUNIT_TEST( testSComponentIterator ); + CPPUNIT_TEST( testSObject ); + CPPUNIT_TEST( testStudy ); + CPPUNIT_TEST( testStudyBuilder ); + CPPUNIT_TEST( testStudyManager ); + CPPUNIT_TEST( testUseCase ); + + + CPPUNIT_TEST_SUITE_END(); + +public: + + virtual void setUp(); }; #endif diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeComment.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeComment.cxx new file mode 100755 index 000000000..ce401624f --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeComment.cxx @@ -0,0 +1,75 @@ +// Copyright (C) 2006 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 +// + + +/*! + * Check all methods of SALOMEDS_AttributeComment + * Use code of SALOMEDS_AttributeComment.cxx + */ + +void SALOMEDSTest::testAttributeComment() +{ + //Create or find the Study manager + _PTR(StudyManager) sm(new SALOMEDS_StudyManager(_sm)); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeComment + _PTR(AttributeComment) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeComment"); + + CPPUNIT_ASSERT(_attr); + + //Check method Value + string value = _attr->Value(); + + CPPUNIT_ASSERT(value.empty()); + + value = "Test string!"; + + //Check method SetValue + _attr->SetValue(value); + + CPPUNIT_ASSERT(value == _attr->Value()); + + //Try to set empty string + _attr->SetValue(""); + CPPUNIT_ASSERT(_attr->Value() == ""); + + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeDrawable.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeDrawable.cxx new file mode 100755 index 000000000..b1e72cf76 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeDrawable.cxx @@ -0,0 +1,73 @@ +// Copyright (C) 2006 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 +// + + +/*! + * Check all methods of SALOMEDS_AttributeDrawable + * Use code of SALOMEDS_AttributeDrawable.cxx + */ + +void SALOMEDSTest::testAttributeDrawable() +{ + //Create or find the Study manager + _PTR(StudyManager) sm(new SALOMEDS_StudyManager(_sm)); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeDrawable + _PTR(AttributeDrawable) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeDrawable"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method IsDrawable + bool isDrawable = _attr->IsDrawable(); + + CPPUNIT_ASSERT(!isDrawable); + + //Check method SetDrawable + _attr->SetDrawable(true); + + CPPUNIT_ASSERT(_attr->IsDrawable()); + + _attr->SetDrawable(false); + + CPPUNIT_ASSERT(!_attr->IsDrawable()); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx new file mode 100755 index 000000000..7d799d957 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx @@ -0,0 +1,71 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeExpandable + * Use code of SALOMEDS_AttributeExpandable.cxx + */ +void SALOMEDSTest::testAttributeExpandable() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeExpandable + _PTR(AttributeExpandable) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeExpandable"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method IsExpandable + bool isExpandable = _attr->IsExpandable(); + + CPPUNIT_ASSERT(!isExpandable); + + //Check method SetExpandable + _attr->SetExpandable(true); + + CPPUNIT_ASSERT(_attr->IsExpandable()); + + _attr->SetExpandable(false); + + CPPUNIT_ASSERT(!_attr->IsExpandable()); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeExternalFileDef.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExternalFileDef.cxx new file mode 100755 index 000000000..db6ca94a9 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExternalFileDef.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeExternalFileDef + * Use code of SALOMEDS_AttributeExternalFileDef.cxx + */ +void SALOMEDSTest::testAttributeExternalFileDef() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeExternalFileDef + _PTR(AttributeExternalFileDef) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeExternalFileDef"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Value + string value = _attr->Value(); + + CPPUNIT_ASSERT(value.empty()); + + value = "Test string!"; + + //Check method SetValue + _attr->SetValue(value); + + CPPUNIT_ASSERT(value == _attr->Value()); + + //Try to set empty string + _attr->SetValue(""); + CPPUNIT_ASSERT(_attr->Value() == ""); + + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeFileType.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeFileType.cxx new file mode 100755 index 000000000..1db238278 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeFileType.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeFileType + * Use code of SALOMEDS_AttributeFileType.cxx + */ +void SALOMEDSTest::testAttributeFileType() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeFileType + _PTR(AttributeFileType) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeFileType"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Value + string value = _attr->Value(); + + CPPUNIT_ASSERT(value.empty()); + + value = "Test string!"; + + //Check method SetValue + _attr->SetValue(value); + + CPPUNIT_ASSERT(value == _attr->Value()); + + //Try to set empty string + _attr->SetValue(""); + CPPUNIT_ASSERT(_attr->Value() == ""); + + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeFlags.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeFlags.cxx new file mode 100755 index 000000000..d171576c7 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeFlags.cxx @@ -0,0 +1,76 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeFlags + * Use code of SALOMEDS_AttributeFlags.cxx + */ +void SALOMEDSTest::testAttributeFlags() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeFlags + _PTR(AttributeFlags) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeFlags"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Set + _attr->Set(2, true); + + CPPUNIT_ASSERT(_attr->Get(2)); + + _attr->Set(4, false); + + //Check method Get + CPPUNIT_ASSERT(!_attr->Get(4)); + + //Check method GetFlags + int flags = _attr->GetFlags(); + + _attr->SetFlags(flags); + + CPPUNIT_ASSERT(_attr->Get(2)); + + CPPUNIT_ASSERT(!_attr->Get(4)); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeGraphic.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeGraphic.cxx new file mode 100755 index 000000000..b7f6152a8 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeGraphic.cxx @@ -0,0 +1,73 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeGraphic + * Use code of SALOMEDS_AttributeGraphic.cxx + */ +void SALOMEDSTest::testAttributeGraphic() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeGraphic + _PTR(AttributeGraphic) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeGraphic"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method SetVisibility + _attr->SetVisibility(1, true); + + //Check method GetVisibility + CPPUNIT_ASSERT(_attr->GetVisibility(1)); + + _attr->SetVisibility(2, false); + + CPPUNIT_ASSERT(!_attr->GetVisibility(2) && _attr->GetVisibility(1)); + + //Check visibility for 0 and -1 + _attr->SetVisibility(0, false); + CPPUNIT_ASSERT(!_attr->GetVisibility(0)); + _attr->SetVisibility(-1, true); + CPPUNIT_ASSERT(_attr->GetVisibility(-1)); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeIOR.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeIOR.cxx new file mode 100755 index 000000000..5a30c88b1 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeIOR.cxx @@ -0,0 +1,69 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeIOR + * Use code of SALOMEDS_AttributeIOR.cxx + */ +void SALOMEDSTest::testAttributeIOR() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeIOR + _PTR(AttributeIOR) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeIOR"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Value + string value = _attr->Value(); + + CPPUNIT_ASSERT(value.empty()); + + string ior = _orb->object_to_string(_sm); + + //Check method SetValue + _attr->SetValue(ior); + + CPPUNIT_ASSERT(ior == _attr->Value()); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeInteger.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeInteger.cxx new file mode 100755 index 000000000..1476a85be --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeInteger.cxx @@ -0,0 +1,66 @@ +// Copyright (C) 2006 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 +// + + +/*! + * Check all methods of SALOMEDS_AttributeInteger + * Use code of SALOMEDS_AttributeInteger.cxx + */ +void SALOMEDSTest::testAttributeInteger() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeInteger + _PTR(AttributeInteger) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeInteger"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + int value = 10; + + //Check method SetValue + _attr->SetValue(value); + + //Check method Value + CPPUNIT_ASSERT(_attr->Value() == value); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeLocalID.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeLocalID.cxx new file mode 100755 index 000000000..d8fce6079 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeLocalID.cxx @@ -0,0 +1,65 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeLocalID + * Use code of SALOMEDS_AttributeLocalID.cxx + */ +void SALOMEDSTest::testAttributeLocalID() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeLocalID + _PTR(AttributeLocalID) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeLocalID"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + int value = 10; + + //Check method SetValue + _attr->SetValue(value); + + //Check method Value + CPPUNIT_ASSERT(_attr->Value() == value); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeName.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeName.cxx new file mode 100755 index 000000000..2c5d28525 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeName.cxx @@ -0,0 +1,73 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeName + * Use code of SALOMEDS_AttributeName.cxx + */ +void SALOMEDSTest::testAttributeName() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeName + _PTR(AttributeName) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeName"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Value + string value = _attr->Value(); + + CPPUNIT_ASSERT(value.empty()); + + value = "Test string!"; + + //Check method SetValue + _attr->SetValue(value); + + CPPUNIT_ASSERT(value == _attr->Value()); + + //Try to set empty string + _attr->SetValue(""); + CPPUNIT_ASSERT(_attr->Value() == ""); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeOpened.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeOpened.cxx new file mode 100755 index 000000000..9e41cd5bc --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeOpened.cxx @@ -0,0 +1,71 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeOpened + * Use code of SALOMEDS_AttributeOpened.cxx + */ +void SALOMEDSTest::testAttributeOpened() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeOpened + _PTR(AttributeOpened) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeOpened"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method IsOpened + bool isOpened = _attr->IsOpened(); + + CPPUNIT_ASSERT(!isOpened); + + //Check method SetOpened + _attr->SetOpened(true); + + CPPUNIT_ASSERT(_attr->IsOpened()); + + _attr->SetOpened(false); + + CPPUNIT_ASSERT(!_attr->IsOpened()); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeParameter.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeParameter.cxx new file mode 100755 index 000000000..5eb3ba31c --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeParameter.cxx @@ -0,0 +1,146 @@ +// Copyright (C) 2006 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#define PT_INTEGER 0 +#define PT_REAL 1 +#define PT_BOOLEAN 2 +#define PT_STRING 3 +#define PT_REALARRAY 4 +#define PT_INTARRAY 5 +#define PT_STRARRAY 6 + +/*! + * Check all methods of SALOMEDS_AttributeParameter + * Use code of SALOMEDS_AttributeParameter.cxx + */ +void SALOMEDSTest::testAttributeParameter() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeParameter + _PTR(AttributeParameter) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeParameter"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Try to retreive a value with invalid ID + bool isRaised = false; + CPPUNIT_ASSERT(!_attr->IsSet("invalid ID", PT_INTEGER)); + try { + _attr->GetInt("invalid ID"); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + //Check method SetInt and GetInt + _attr->SetInt("IntValue", 1); + CPPUNIT_ASSERT(_attr->IsSet("IntValue", PT_INTEGER)); + CPPUNIT_ASSERT(_attr->GetInt("IntValue") == 1); + + //Check method SetReal an GetReal + _attr->SetReal("RealValue", 1.2); + CPPUNIT_ASSERT(_attr->IsSet("RealValue", PT_REAL)); + CPPUNIT_ASSERT(_attr->GetReal("RealValue") == 1.2); + + //Check method SetString and GetString + _attr->SetString("StringValue", "hello"); + CPPUNIT_ASSERT(_attr->IsSet("StringValue", PT_STRING)); + CPPUNIT_ASSERT(_attr->GetString("StringValue") == "hello"); + + //Check method SetBool and GetBool + _attr->SetBool("BoolValue", 0); + CPPUNIT_ASSERT(_attr->IsSet("BoolValue", PT_BOOLEAN)); + CPPUNIT_ASSERT(!_attr->GetBool("BoolValue")); + + _attr->SetBool("BoolValue", 0); + CPPUNIT_ASSERT(_attr->IsSet("BoolValue", PT_BOOLEAN)); + CPPUNIT_ASSERT(!_attr->GetBool("BoolValue")); + + vector intArray; + intArray.push_back(0); + intArray.push_back(1); + + //Check method SetIntArray and GetIntArray + _attr->SetIntArray("IntArray", intArray); + CPPUNIT_ASSERT(_attr->IsSet("IntArray", PT_INTARRAY)); + CPPUNIT_ASSERT(_attr->GetIntArray("IntArray")[0] == 0); + CPPUNIT_ASSERT(_attr->GetIntArray("IntArray")[1] == 1); + + vector realArray; + realArray.push_back(0.0); + realArray.push_back(1.1); + + //Check method SetRealArray and GetRealArray + _attr->SetRealArray("RealArray", realArray); + CPPUNIT_ASSERT(_attr->IsSet("RealArray", PT_REALARRAY)); + CPPUNIT_ASSERT(_attr->GetRealArray("RealArray")[0] == 0.0); + CPPUNIT_ASSERT(_attr->GetRealArray("RealArray")[1] == 1.1); + + vector strArray; + strArray.push_back("hello"); + strArray.push_back("world"); + + //Check method SetStrArray and GetStrArray + _attr->SetStrArray("StrArray", strArray); + CPPUNIT_ASSERT(_attr->IsSet("StrArray", PT_STRARRAY)); + CPPUNIT_ASSERT(_attr->GetStrArray("StrArray")[0] == "hello"); + CPPUNIT_ASSERT(_attr->GetStrArray("StrArray")[1] == "world"); + + /* + string saved = _attr->Save(); + _attr->Load(saved); + + CPPUNIT_ASSERT(_attr->IsSet("IntValue", PT_INTEGER) && _attr->GetInt("IntValue") == 1); + CPPUNIT_ASSERT(_attr->IsSet("RealValue", PT_REAL) && _attr->GetReal("IntValue") == 1.2); + CPPUNIT_ASSERT(_attr->IsSet("StringValue", PT_STRING) && _attr->GetString("StringValue") == "hello"); + CPPUNIT_ASSERT(_attr->IsSet("BoolValue", PT_BOOLEAN) && _attr->GetBool("BoolValue") == 0); + CPPUNIT_ASSERT(_attr->IsSet("IntArray", PT_INTARRAY) && _attr->GetIntArray("IntArray")[0] == 0); + CPPUNIT_ASSERT(_attr->IsSet("IntArray", PT_INTARRAY) && _attr->GetIntArray("IntArray")[1] == 1); + CPPUNIT_ASSERT(_attr->IsSet("RealArray", PT_REALARRAY) && _attr->GetRealArray("RealArray")[0] == 0.0); + CPPUNIT_ASSERT(_attr->IsSet("RealArray", PT_REALARRAY) && _attr->GetRealArray("RealArray")[1] == 1.1); + CPPUNIT_ASSERT(_attr->IsSet("StrArray", PT_STRARRAY) && _attr->GetStrArray("StrArray")[0] == "hello"); + CPPUNIT_ASSERT(_attr->IsSet("StrArray", PT_STRARRAY) && _attr->GetStrArray("StrArray")[1] == "world"); + */ + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributePersistentRef.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributePersistentRef.cxx new file mode 100755 index 000000000..acd864710 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributePersistentRef.cxx @@ -0,0 +1,73 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributePersistentRef + * Use code of SALOMEDS_AttributePersistentRef.cxx + */ +void SALOMEDSTest::testAttributePersistentRef() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + //Check the attribute creation + CPPUNIT_ASSERT(so); + + //Create an attribute AttributePersistentRef + _PTR(AttributePersistentRef) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributePersistentRef"); + + CPPUNIT_ASSERT(_attr); + + //Check method Value + string value = _attr->Value(); + + CPPUNIT_ASSERT(value.empty()); + + value = "Test string!"; + + //Check method SetValue + _attr->SetValue(value); + + CPPUNIT_ASSERT(value == _attr->Value()); + + //Try to set empty string + _attr->SetValue(""); + CPPUNIT_ASSERT(_attr->Value() == ""); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributePixMap.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributePixMap.cxx new file mode 100755 index 000000000..87828f007 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributePixMap.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributePixMap + * Use code of SALOMEDS_AttributePixMap.cxx + */ +void SALOMEDSTest::testAttributePixMap() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributePixMap + _PTR(AttributePixMap) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributePixMap"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method HasPixMap + CPPUNIT_ASSERT(!_attr->HasPixMap()); + + //Check method SetPixMap + string pixmap = "something"; + _attr->SetPixMap(pixmap); + + CPPUNIT_ASSERT(_attr->HasPixMap()); + + //Check method GetPixMap + CPPUNIT_ASSERT(_attr->GetPixMap() == pixmap); + + //Check empty PixMap assigning and retreival + _attr->SetPixMap(""); + CPPUNIT_ASSERT(_attr->GetPixMap() == ""); + + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributePythonObject.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributePythonObject.cxx new file mode 100755 index 000000000..8db63c023 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributePythonObject.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributePythonObject + * Use code of SALOMEDS_AttributePythonObject.cxx + */ +void SALOMEDSTest::testAttributePythonObject() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributePythonObject + _PTR(AttributePythonObject) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributePythonObject"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method IsScript + CPPUNIT_ASSERT(!_attr->IsScript()); + + string pyobj = "some object!"; + + //Check method SetObject + _attr->SetObject(pyobj, true); + + CPPUNIT_ASSERT(_attr->IsScript()); + + //Check method GetObject + CPPUNIT_ASSERT(_attr->GetObject() == pyobj); + + //Check setting and retreival of empty object + _attr->SetObject("", true); + CPPUNIT_ASSERT(_attr->GetObject() == "" && _attr->IsScript()); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeReal.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeReal.cxx new file mode 100755 index 000000000..c04e3e70f --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeReal.cxx @@ -0,0 +1,65 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeReal + * Use code of SALOMEDS_AttributeReal.cxx + */ +void SALOMEDSTest::testAttributeReal() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeReal + _PTR(AttributeReal) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeReal"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + double value = 10.12; + + //Check method SetValue + _attr->SetValue(value); + + //Check method Value + CPPUNIT_ASSERT(_attr->Value() == value); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx new file mode 100755 index 000000000..67aaea942 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx @@ -0,0 +1,71 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeSelectable + * Use code of SALOMEDS_AttributeSelectable.cxx + */ +void SALOMEDSTest::testAttributeSelectable() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeSelectable + _PTR(AttributeSelectable) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeSelectable"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method IsSelectable + bool isSelectable = _attr->IsSelectable(); + + CPPUNIT_ASSERT(!isSelectable); + + //Check method SetSelectable + _attr->SetSelectable(true); + + CPPUNIT_ASSERT(_attr->IsSelectable()); + + _attr->SetSelectable(false); + + CPPUNIT_ASSERT(!_attr->IsSelectable()); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx new file mode 100755 index 000000000..27371c474 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx @@ -0,0 +1,126 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeSequenceOfInteger + * Use code of SALOMEDS_AttributeSequenceOfInteger.cxx + */ +void SALOMEDSTest::testAttributeSequenceOfInteger() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeSequenceOfInteger + _PTR(AttributeSequenceOfInteger) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeSequenceOfInteger"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Length + CPPUNIT_ASSERT(_attr->Length() == 0); + + //Check method Add + _attr->Add(1); + + _attr->Add(2); + + _attr->Add(3); + + _attr->Add(4); + + CPPUNIT_ASSERT(_attr->Length() == 4); + + CPPUNIT_ASSERT(_attr->Value(2) == 2); + + //Check method Remove + _attr->Remove(3); + + //Check method Value + CPPUNIT_ASSERT(_attr->Value(3) == 4); + + //Check method ChangeValue + _attr->ChangeValue(3, 3); + + CPPUNIT_ASSERT(_attr->Value(3) == 3); + + //Check method CorbaSequence + vector v = _attr->CorbaSequence(); + CPPUNIT_ASSERT(v.size() == 3); + + for(int i = 0; iAssign(v); + + CPPUNIT_ASSERT(_attr->Length() == 4); + + CPPUNIT_ASSERT(_attr->Value(4) == 5); + + //Check processing of invalid indicies + bool isRaised = false; + try { + _attr->Value(-1); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + isRaised = false; + try { + _attr->ChangeValue(12, 1); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + isRaised = false; + try { + _attr->Remove(10); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfReal.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfReal.cxx new file mode 100755 index 000000000..ed4747576 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfReal.cxx @@ -0,0 +1,121 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeSequenceOfReal + * Use code of SALOMEDS_AttributeSequenceOfReal.cxx + */ +void SALOMEDSTest::testAttributeSequenceOfReal() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeSequenceOfReal + _PTR(AttributeSequenceOfReal) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeSequenceOfReal"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Length + CPPUNIT_ASSERT(_attr->Length() == 0); + + //Check method Add + _attr->Add(1.1); + + _attr->Add(2.2); + + _attr->Add(3.3); + + _attr->Add(4.4); + + CPPUNIT_ASSERT(_attr->Length() == 4); + + CPPUNIT_ASSERT(_attr->Value(2) == 2.2); + + //Check method Remove + _attr->Remove(3); + + CPPUNIT_ASSERT(_attr->Value(3) == 4.4); + + //Check method ChangeValue + _attr->ChangeValue(3, 3.3); + + CPPUNIT_ASSERT(_attr->Value(3) == 3.3); + + //Check method CorbaSequence + vector v = _attr->CorbaSequence(); + CPPUNIT_ASSERT(v.size() == 3); + + v.push_back(5.5); + + _attr->Assign(v); + + CPPUNIT_ASSERT(_attr->Length() == 4); + + CPPUNIT_ASSERT(_attr->Value(4) == 5.5); + + //Check processing of invalid indicies + bool isRaised = false; + try { + _attr->Value(-1); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + isRaised = false; + try { + _attr->ChangeValue(12, 1); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + isRaised = false; + try { + _attr->Remove(10); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeStudyProperties.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeStudyProperties.cxx new file mode 100755 index 000000000..965773d4d --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeStudyProperties.cxx @@ -0,0 +1,113 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeStudyProperties + * Use code of SALOMEDS_AttributeStudyProperties.cxx + */ +void SALOMEDSTest::testAttributeStudyProperties() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeStudyProperties + _PTR(AttributeStudyProperties) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeStudyProperties"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method SetCreationDate + _attr->SetCreationDate(1, 2, 3, 4, 5); + + //Check method GetCreationDate + int MN, H, D, MH, Y; + _attr->GetCreationDate(MN, H, D, MH, Y); + + CPPUNIT_ASSERT(MN == 1 && H == 2 && D == 3 && MH == 4 && Y == 5); + + //Check method SetUserName + _attr->SetUserName("srn"); + + //Check method GetUserName + CPPUNIT_ASSERT(_attr->GetUserName() == "srn"); + + //Check method SetCreationMode + string value = "from scratch"; + _attr->SetCreationMode(value); + + //Check method GetCreationMode + CPPUNIT_ASSERT(_attr->GetCreationMode() == value); + + //Check method SetModified + _attr->SetModified(2); + + //Check method IsModified + CPPUNIT_ASSERT(_attr->IsModified()); + + //Check method GetModified + CPPUNIT_ASSERT(_attr->GetModified() == 2); + + //Check method SetLocked + _attr->SetLocked(true); + + //Check method IsLocked + CPPUNIT_ASSERT(_attr->IsLocked()); + + _attr->SetLocked(false); + + CPPUNIT_ASSERT(!_attr->IsLocked()); + + //Check method SetModification + _attr->SetModification("srn2", 6, 7, 8, 9, 10); + + //Check method GetModificationsList + vector vs; + vector vi[5]; + _attr->GetModificationsList(vs, vi[0], vi[1], vi[2], vi[3], vi[4], false); + CPPUNIT_ASSERT(vs[0] == "srn2" && vi[0][0] == 6 && vi[1][0] == 7 && vi[2][0] == 8 && vi[3][0] == 9 && vi[4][0] == 10); + + vs.clear(); + for(int i=0; i<5; i++) vi[i].clear(); + + _attr->GetModificationsList(vs, vi[0], vi[1], vi[2], vi[3], vi[4], true); + CPPUNIT_ASSERT(vs[0] == "srn" && vi[0][0] == 1 && vi[1][0] == 2 && vi[2][0] == 3 && vi[3][0] == 4 && vi[4][0] == 5); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfInteger.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfInteger.cxx new file mode 100755 index 000000000..e633bc5b3 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfInteger.cxx @@ -0,0 +1,193 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTableOfInteger + * Use code of SALOMEDS_AttributeTableOfInteger.cxx + */ +void SALOMEDSTest::testAttributeTableOfInteger() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTableOfInteger + _PTR(AttributeTableOfInteger) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTableOfInteger"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); +/* + //Check method SetTitle + _attr->SetTitle("Table_1"); + + //Check method GetTitle + CPPUNIT_ASSERT(_attr->GetTitle() == "Table_1"); + + //Check method SetNbColumns + _attr->SetNbColumns(2); + + //Check method GetNbColumns + CPPUNIT_ASSERT(_attr->GetNbColumns() == 2); + + //Check method HasValue + CPPUNIT_ASSERT(!_attr->HasValue(1, 1)); + + bool isCaught = false; + try { + _attr->GetValue(1, 1); + } + catch(...) { + isCaught = true; + } + CPPUNIT_ASSERT(isCaught); + + //Check method PutValue + _attr->PutValue(23, 1,1); + + CPPUNIT_ASSERT(_attr->HasValue(1, 1)); + + //Check method GetValue + CPPUNIT_ASSERT(_attr->GetValue(1, 1) == 23); + + //Check method GetRowSetIndices + vector rs = _attr->GetRowSetIndices(1); + + CPPUNIT_ASSERT(rs.size() == 1 && rs[0] == 1); +*/ + _attr->PutValue(32, 2,2); + CPPUNIT_ASSERT(_attr->HasValue(2, 2)); +/* + vector rowTitles; + rowTitles.push_back("title1"); + rowTitles.push_back("title2"); + + //Check method SetRowTitles + _attr->SetRowTitles(rowTitles); + + //Check method SetRowTitle + _attr->SetRowTitle(1, "new_title"); + + //Check method GetRowTitles + vector rt = _attr->GetRowTitles(); + + CPPUNIT_ASSERT(rt.size() == 2 && rt[0] == "new_title" && rt[1] == "title2"); + + vector colTitles; + colTitles.push_back("title1"); + colTitles.push_back("title2"); + + //Check method SetColumnTitles + _attr->SetColumnTitles(colTitles); + + //Check method SetColumnTitle + _attr->SetColumnTitle(1, "new_title"); + + //Check method GetColumnTitles + vector ct = _attr->GetColumnTitles(); + + + CPPUNIT_ASSERT(ct.size() == 2 && ct[0] == "new_title" && ct[1] == "title2"); +*/ + + vector rowUnits; + rowUnits.push_back("unit1"); + rowUnits.push_back("unit2"); + + //Check method SetRowUnits + _attr->SetRowUnits(rowUnits); + +/* + + //Check method SetRowUnit + _attr->SetRowUnit(1, "new_unit"); + + //Check method GetRowUnits + vector ru = _attr->GetRowUnits(); + + CPPUNIT_ASSERT(ru.size() == 2 && ru[0] == "new_unit" && ru[1] == "unit2"); + + //Check method GetNbColumns + CPPUNIT_ASSERT(_attr->GetNbColumns() == 2); + + //Check method AddRow + vector data; + data.push_back(11); + data.push_back(22); + + _attr->AddRow(data); + + CPPUNIT_ASSERT(_attr->GetNbRows() == 3); + + //Check method GetRow + vector data2 = _attr->GetRow(3); + + CPPUNIT_ASSERT(data2.size() == 2 && data2[0] == 11 && data2[1] == 22); + + //Check method SetRow + data[0] = 33; + _attr->SetRow(3, data); + + data2 = _attr->GetRow(3); + + CPPUNIT_ASSERT(data2.size() == 2 && data2[0] == 33 && data2[1] == 22); + + //Check method AddColumn + data[0] = -11; + data[1] = -22; + data.push_back(-33); + + _attr->AddColumn(data); + + CPPUNIT_ASSERT(_attr->GetNbColumns() == 3); + + //Check method GetColumn + data2 = _attr->GetColumn(3); + + CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == -11 && data2[1] == -22 && data2[2] == -33); + + //Check method SetColumn + data[0] = 11; + _attr->SetColumn(3, data); + + data2 = _attr->GetColumn(3); + + CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == 11 && data2[1] == -22 && data2[2] == -33); +*/ + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx new file mode 100755 index 000000000..75d1b2e40 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx @@ -0,0 +1,190 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTableOfReal + * Use code of SALOMEDS_AttributeTableOfReal.cxx + */ +void SALOMEDSTest::testAttributeTableOfReal() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTableOfReal + _PTR(AttributeTableOfReal) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTableOfReal"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method SetTitle + _attr->SetTitle("Table_1"); + + //Check method GetTitle + CPPUNIT_ASSERT(_attr->GetTitle() == "Table_1"); + + //Check method SetNbColumns + _attr->SetNbColumns(2); + + //Check method GetNbColumns + CPPUNIT_ASSERT(_attr->GetNbColumns() == 2); + + //Check method HasValue + CPPUNIT_ASSERT(!_attr->HasValue(1, 1)); + + bool isCaught = false; + try { + _attr->GetValue(1, 1); + } + catch(...) { + isCaught = true; + } + CPPUNIT_ASSERT(isCaught); + + //Check method PutValue + _attr->PutValue(23.23, 1,1); + + CPPUNIT_ASSERT(_attr->HasValue(1, 1)); + + //Check method GetValue + CPPUNIT_ASSERT(_attr->GetValue(1, 1) == 23.23); + + //Check method GetRowSetIndices + vector rs = _attr->GetRowSetIndices(1); + + CPPUNIT_ASSERT(rs.size() == 1 && rs[0] == 1); + + _attr->PutValue(32.32, 2,2); + CPPUNIT_ASSERT(_attr->HasValue(2, 2)); + + vector rowTitles; + rowTitles.push_back("title1"); + rowTitles.push_back("title2"); + + //Check method SetRowTitles + _attr->SetRowTitles(rowTitles); + + //Check method SetRowTitle + _attr->SetRowTitle(1, "new_title"); + + //Check method GetRowTitles + vector rt = _attr->GetRowTitles(); + + CPPUNIT_ASSERT(rt.size() == 2 && rt[0] == "new_title" && rt[1] == "title2"); + + + vector colTitles; + colTitles.push_back("title1"); + colTitles.push_back("title2"); + + //Check method SetColumnTitles + _attr->SetColumnTitles(colTitles); + + //Check method SetColumnTitle + _attr->SetColumnTitle(1, "new_title"); + + //Check method GetColumnTitles + vector ct = _attr->GetColumnTitles(); + + CPPUNIT_ASSERT(ct.size() == 2 && ct[0] == "new_title" && ct[1] == "title2"); + + vector rowUnits; + rowUnits.push_back("unit1"); + rowUnits.push_back("unit2"); + + //Check method SetRowUnits + _attr->SetRowUnits(rowUnits); + + //Check method SetRowUnit + _attr->SetRowUnit(1, "new_unit"); + + //Check method GetRowUnits + vector ru = _attr->GetRowUnits(); + + CPPUNIT_ASSERT(ru.size() == 2 && ru[0] == "new_unit" && ru[1] == "unit2"); + + //Check method GetNbColumns + CPPUNIT_ASSERT(_attr->GetNbColumns() == 2); + + //Check method AddRow + vector data; + data.push_back(11.11); + data.push_back(22.22); + + _attr->AddRow(data); + + CPPUNIT_ASSERT(_attr->GetNbRows() == 3); + + //Check method GetRow + vector data2 = _attr->GetRow(3); + + CPPUNIT_ASSERT(data2.size() == 2 && data2[0] == 11.11 && data2[1] == 22.22); + + //Check method SetRow + data[0] = 33.33; + _attr->SetRow(3, data); + + data2 = _attr->GetRow(3); + + CPPUNIT_ASSERT(data2.size() == 2 && data2[0] == 33.33 && data2[1] == 22.22); + + //Check method AddColumn + data[0] = -11.11; + data[1] = -22.22; + data.push_back(-33.33); + + _attr->AddColumn(data); + + CPPUNIT_ASSERT(_attr->GetNbColumns() == 3); + + //Check method GetColumn + data2 = _attr->GetColumn(3); + + CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == -11.11 && data2[1] == -22.22 && data2[2] == -33.33); + + //Check method SetColumn + data[0] = 11.11; + _attr->SetColumn(3, data); + + data2 = _attr->GetColumn(3); + + CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == 11.11 && data2[1] == -22.22 && data2[2] == -33.33); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfString.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfString.cxx new file mode 100755 index 000000000..f9de75405 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfString.cxx @@ -0,0 +1,190 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTableOfString + * Use code of SALOMEDS_AttributeTableOfString.cxx + */ +void SALOMEDSTest::testAttributeTableOfString() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTableOfString + _PTR(AttributeTableOfString) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTableOfString"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + //Check method SetTitle + _attr->SetTitle("Table_1"); + + //Check method GetTitle + CPPUNIT_ASSERT(_attr->GetTitle() == "Table_1"); + + //Check method SetNbColumns + _attr->SetNbColumns(2); + + //Check method GetNbColumns + CPPUNIT_ASSERT(_attr->GetNbColumns() == 2); + + //Check method HasValue + CPPUNIT_ASSERT(!_attr->HasValue(1, 1)); + + bool isCaught = false; + try { + _attr->GetValue(1, 1); + } + catch(...) { + isCaught = true; + } + CPPUNIT_ASSERT(isCaught); + + + //Check method PutValue + _attr->PutValue("23", 1,1); + + CPPUNIT_ASSERT(_attr->HasValue(1, 1)); + + //Check method GetValue + CPPUNIT_ASSERT(_attr->GetValue(1, 1) == "23"); + + //Check method GetRowSetIndices + vector rs = _attr->GetRowSetIndices(1); + + CPPUNIT_ASSERT(rs.size() == 1 && rs[0] == 1); + + _attr->PutValue("32", 2,2); + CPPUNIT_ASSERT(_attr->HasValue(2, 2)); + + vector rowTitles; + rowTitles.push_back("title1"); + rowTitles.push_back("title2"); + + //Check method SetRowTitles + _attr->SetRowTitles(rowTitles); + + //Check method SetRowTitle + _attr->SetRowTitle(1, "new_title"); + + //Check method GetRowTitles + vector rt = _attr->GetRowTitles(); + + CPPUNIT_ASSERT(rt.size() == 2 && rt[0] == "new_title" && rt[1] == "title2"); + + + vector colTitles; + colTitles.push_back("title1"); + colTitles.push_back("title2"); + + //Check method SetColumnTitles + _attr->SetColumnTitles(colTitles); + + //Check method SetColumnTitle + _attr->SetColumnTitle(1, "new_title"); + + //Check method GetColumnTitles + vector ct = _attr->GetColumnTitles(); + + CPPUNIT_ASSERT(ct.size() == 2 && ct[0] == "new_title" && ct[1] == "title2"); + + vector rowUnits; + rowUnits.push_back("unit1"); + rowUnits.push_back("unit2"); + + //Check method SetRowUnits + _attr->SetRowUnits(rowUnits); + + //Check method SetRowUnit + _attr->SetRowUnit(1, "new_unit"); + + //Check method GetRowUnits + vector ru = _attr->GetRowUnits(); + + CPPUNIT_ASSERT(ru.size() == 2 && ru[0] == "new_unit" && ru[1] == "unit2"); + + //Check method GetNbColumns + CPPUNIT_ASSERT(_attr->GetNbColumns() == 2); + + //Check method AddRow + vector data; + data.push_back("11"); + data.push_back("22"); + + _attr->AddRow(data); + + CPPUNIT_ASSERT(_attr->GetNbRows() == 3); + + //Check method GetRow + vector data2 = _attr->GetRow(3); + + CPPUNIT_ASSERT(data2.size() == 2 && data2[0] == "11" && data2[1] == "22"); + + //Check method SetRow + data[0] = "33"; + _attr->SetRow(3, data); + + data2 = _attr->GetRow(3); + + CPPUNIT_ASSERT(data2.size() == 2 && data2[0] == "33" && data2[1] == "22"); + + //Check method AddColumn + data[0] = "-11"; + data[1] = "-22"; + data.push_back("-33"); + + _attr->AddColumn(data); + + CPPUNIT_ASSERT(_attr->GetNbColumns() == 3); + + //Check method GetColumn + data2 = _attr->GetColumn(3); + + CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == "-11" && data2[1] == "-22" && data2[2] == "-33"); + + //Check method SetColumn + data[0] = "11"; + _attr->SetColumn(3, data); + + data2 = _attr->GetColumn(3); + + CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == "11" && data2[1] == "-22" && data2[2] == "-33"); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTarget.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTarget.cxx new file mode 100755 index 000000000..4f2785f0d --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTarget.cxx @@ -0,0 +1,89 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTarget + * Use code of SALOMEDS_AttributeTarget.cxx + */ +void SALOMEDSTest::testAttributeTarget() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTarget + _PTR(AttributeTarget) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTarget"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Get + CPPUNIT_ASSERT(_attr->Get().size() == 0); + + _PTR(SObject) so1 = study->CreateObjectID("0:1:2"); + studyBuilder->Addreference(so1, so); + + _PTR(SObject) so2 = study->CreateObjectID("0:1:3"); + studyBuilder->Addreference(so2, so1); + + //Check method Add + _attr->Add(so1); + + _attr->Add(so2); + + //Check method Get + vector< _PTR(SObject) > v = _attr->Get(); + + CPPUNIT_ASSERT(v.size() == 2); + + CPPUNIT_ASSERT(v[0]->GetID() == "0:1:2"); + + CPPUNIT_ASSERT(v[1]->GetID() == "0:1:3"); + + //Check method Remove + _attr->Remove(so1); + + v = _attr->Get(); + + CPPUNIT_ASSERT(v.size() == 1); + + CPPUNIT_ASSERT(v[0]->GetID() == "0:1:3"); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx new file mode 100755 index 000000000..c99bf75c6 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTextColor + * Use code of SALOMEDS_AttributeTextColor.cxx + */ +void SALOMEDSTest::testAttributeTextColor() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTextColor + _PTR(AttributeTextColor) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTextColor"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + STextColor color; + color.R = 0; + color.G = 1; + color.B = 2; + + //Check method SetTextColor + _attr->SetTextColor(color); + + //Check method TextColor + STextColor color2 = _attr->TextColor(); + + CPPUNIT_ASSERT(color.R == color2.R); + + CPPUNIT_ASSERT(color.G == color2.G); + + CPPUNIT_ASSERT(color.B == color2.B); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextHighlightColor.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextHighlightColor.cxx new file mode 100755 index 000000000..40ec96098 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextHighlightColor.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTextHighlightColor + * Use code of SALOMEDS_AttributeTextHighlightColor.cxx + */ +void SALOMEDSTest::testAttributeTextHighlightColor() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTextHighlightColor + _PTR(AttributeTextHighlightColor) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTextHighlightColor"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + STextColor color; + color.R = 0; + color.G = 1; + color.B = 2; + + //Check method SetTextHighlightColor + _attr->SetTextHighlightColor(color); + + //Check method TextHighlightColor + STextColor color2 = _attr->TextHighlightColor(); + + CPPUNIT_ASSERT(color.R == color2.R); + + CPPUNIT_ASSERT(color.G == color2.G); + + CPPUNIT_ASSERT(color.B == color2.B); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx new file mode 100755 index 000000000..23a7b9471 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx @@ -0,0 +1,204 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTreeNode + * Use code of SALOMEDS_AttributeTreeNode.cxx + */ +#define SALOMEDS_ALL_TESTS +void SALOMEDSTest::testAttributeTreeNode() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTreeNode + _PTR(AttributeTreeNode) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTreeNode"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + string TreeNodeID = "0e1c36e6-379b-4d90-ab3b-17a14310e648"; + + _PTR(SObject) so1 = study->CreateObjectID("0:1:2"); + + _PTR(AttributeTreeNode) _attr1 = studyBuilder->FindOrCreateAttribute(so1, "AttributeTreeNode"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr1); + + //Check method Label + CPPUNIT_ASSERT(_attr1->Label() == "0:1:2"); + + _PTR(SObject) so2 = study->CreateObjectID("0:1:3"); + + _PTR(AttributeTreeNode) _attr2 = studyBuilder->FindOrCreateAttribute(so2, "AttributeTreeNode"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr2); + + //Check method SetFather + _attr1->SetFather(_attr); + + //Check method HasFather + CPPUNIT_ASSERT(_attr1->HasFather()); + +#ifdef SALOMEDS_ALL_TESTS + //Check method GetFather + CPPUNIT_ASSERT(_attr1->GetFather()->Label() == _attr->Label()); + + //Check method Append + _attr->Append(_attr1); + + //Check possibility to Append to itself + bool isRaised = false; + try { + _attr->Append(_attr); + }catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + _attr->Append(_attr2); + + //Check method HasNext + CPPUNIT_ASSERT(_attr1->HasNext()); + + //Check method GetNext + CPPUNIT_ASSERT(_attr1->GetNext()->Label() == _attr2->Label()); + + //Check method HasPrevious + CPPUNIT_ASSERT(_attr2->HasPrevious()); + + //Check method GetPrevious + CPPUNIT_ASSERT(_attr2->GetPrevious()->Label() == _attr1->Label()); + + //Check method Depth + CPPUNIT_ASSERT(_attr->Depth() == 0 && _attr1->Depth() == 1); + + //Check method IsRoot + CPPUNIT_ASSERT(_attr->IsRoot()); + + //Check method IsFather + CPPUNIT_ASSERT(_attr->IsFather(_attr1)); + + //Check method IsDescendant + CPPUNIT_ASSERT(_attr2->IsDescendant(_attr)); + + //Check method GetFirst + CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr1->Label()); + + _attr2->Remove(); + + //Check method Prepend + _attr->Prepend(_attr2); + CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr2->Label()); + + //Check possibility to Prepend to itself + isRaised = false; + try { + _attr->Prepend(_attr); + }catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + _attr1->Remove(); + + //Check method InsertBefore + _attr2->InsertBefore(_attr1); + + CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr1->Label()); + + //Check possibility to InsertBefore to itself + isRaised = false; + try { + _attr->InsertBefore(_attr); + }catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + _attr1->Remove(); + + //Check method InsertAfter + _attr2->InsertAfter(_attr1); + + CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr2->Label()); + + //Check possibility to InsertAfter to itself + isRaised = false; + try { + _attr->InsertAfter(_attr); + }catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + //Check method Remove + _attr2->Remove(); + + CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr1->Label()); + + //Check method SetTreeID and GetTreeID + _attr2->SetTreeID(TreeNodeID); + + CPPUNIT_ASSERT(_attr2->GetTreeID() == TreeNodeID); +#else + cout << endl << "THE TEST IS NOT COMPLETE !!!" << endl; +#endif + + + //Try to create the attribute with given TreeID + string value = "0e1c36e6-1111-4d90-ab3b-18a14310e648"; + _PTR(AttributeTreeNode) _attr_guid = studyBuilder->FindOrCreateAttribute(so, "AttributeTreeNode"+value); + CPPUNIT_ASSERT(_attr_guid && _attr_guid->GetTreeID() == value); + + //Try to set invalid GUID + isRaised = false; + try { + _attr->SetTreeID("invalid guid"); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + sm->Close(study); +} +#undef SALOMEDS_ALL_TESTS + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx new file mode 100755 index 000000000..064b77de5 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx @@ -0,0 +1,81 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeUserID + * Use code of SALOMEDS_AttributeUserID.cxx + */ +void SALOMEDSTest::testAttributeUserID() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeUserID + _PTR(AttributeUserID) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeUserID"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + string value = "0e1c36e6-379b-4d90-ab3b-17a14310e648"; + + //Check method SetValue + _attr->SetValue(value); + + //Check method Value + CPPUNIT_ASSERT(value == _attr->Value()); + + //Try to create the attribute with given UserID + value = "0e1c36e6-379b-4d90-ab3b-18a14310e648"; + _PTR(AttributeUserID) _attr2 = studyBuilder->FindOrCreateAttribute(so, "AttributeUserID"+value); + CPPUNIT_ASSERT(_attr2 && _attr2->Value() == value); + + //Try to set invalid GUID + bool isRaised = false; + try { + _attr->SetValue("invalid guid"); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx b/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx new file mode 100755 index 000000000..bed9e9276 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx @@ -0,0 +1,79 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_ChildIterator + * Use code of SALOMEDS_ChildIterator.cxx + */ +void SALOMEDSTest::testChildIterator() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + _PTR(SObject) so1 = studyBuilder->NewObjectToTag(so, 1); + studyBuilder->NewObjectToTag(so1, 2); + + _PTR(ChildIterator) ci = study->NewChildIterator(so); + + //Check the creation of the ChildIterator + CPPUNIT_ASSERT(ci); + + int count = 0; + for(; ci->More(); ci->Next()) { + //Check method Value + CPPUNIT_ASSERT(ci->Value()->Tag() == 1); + count++; + } + + //Check that there is only one SObject on the first level of so + CPPUNIT_ASSERT(count == 1); + + count = 0; + int i = 1; + for(ci->InitEx(true); ci->More(); ci->Next(), i++) { + CPPUNIT_ASSERT(ci->Value()->Tag() == i); + count++; + } + + //Check that there are two SObject under so + CPPUNIT_ASSERT(count == 2); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx b/src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx new file mode 100755 index 000000000..1ca79b8c4 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx @@ -0,0 +1,70 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_SComponent + * Use code of SALOMEDS_SComponent.cxx + */ +void SALOMEDSTest::testSComponent() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + _PTR(SComponent) sco = studyBuilder->NewComponent("Test"); + + //Check the creation of the SComponent + CPPUNIT_ASSERT(sco); + + //Create an attribute AttributeIOR + _PTR(AttributeIOR) _attr = studyBuilder->FindOrCreateAttribute(sco, "AttributeIOR"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method ComponentIOR + + string ior = _orb->object_to_string(_sm); + + _attr->SetValue(ior); + string new_ior; + CPPUNIT_ASSERT(sco->ComponentIOR(new_ior)); + + CPPUNIT_ASSERT(new_ior == ior); + + //Check method ComponentDataType + CPPUNIT_ASSERT(sco->ComponentDataType() == "Test"); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_SComponentIterator.cxx b/src/SALOMEDS/Test/SALOMEDSTest_SComponentIterator.cxx new file mode 100755 index 000000000..7ca4ca72c --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_SComponentIterator.cxx @@ -0,0 +1,65 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_SComponentIterator + * Use code of SALOMEDS_SComponentIterator.cxx + */ +void SALOMEDSTest::testSComponentIterator() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create two SComponents + studyBuilder->NewComponent("Test1"); + studyBuilder->NewComponent("Test2"); + + vector v; + v.push_back("Test1"); + v.push_back("Test2"); + + _PTR(SComponentIterator) ci = study->NewComponentIterator(); + + //Check the creation of the SComponentIterator + CPPUNIT_ASSERT(ci); + + for(int i = 0; ci->More(); ci->Next(), i++) { + //Check method Value + CPPUNIT_ASSERT(i<2); + CPPUNIT_ASSERT(ci->Value()->ComponentDataType() == v[i]); + } + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx b/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx new file mode 100755 index 000000000..5b4d221fe --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx @@ -0,0 +1,124 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_SObject + * Use code of SALOMEDS_SObject.cxx + */ + +void SALOMEDSTest::testSObject() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("TestSObject"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a new SComponent + _PTR(SComponent) sco = studyBuilder->NewComponent("Test"); + + //Create new SObject + _PTR(SObject) so = studyBuilder->NewObjectToTag(sco, 2); + + //Check the creation of the SObject + CPPUNIT_ASSERT(so); + + //Check method GetID + CPPUNIT_ASSERT(so->GetID() == "0:1:1:2"); + + //Check method Tag + CPPUNIT_ASSERT(so->Tag() == 2); + + //Check method GetFatherComponent + _PTR(SComponent) father = so->GetFatherComponent(); + CPPUNIT_ASSERT(father->GetID() == sco->GetID()); + + //Check method GetFather + _PTR(SObject) so1 = studyBuilder->NewObject(so); + CPPUNIT_ASSERT(so1->GetFather()->GetID() == so->GetID()); + + //Check method FindAttribute + + _PTR(AttributeIOR) _attrIOR = studyBuilder->FindOrCreateAttribute(so, "AttributeIOR"); + _PTR(AttributeName) _attrName = studyBuilder->FindOrCreateAttribute(so, "AttributeName"); + _PTR(AttributeComment) _attrComment = studyBuilder->FindOrCreateAttribute(so, "AttributeComment"); + + string ior = _orb->object_to_string(_sm); + _attrIOR->SetValue(ior); + _attrName->SetValue("SO name"); + _attrComment->SetValue("SO comment"); + + _PTR(GenericAttribute) ga; + CPPUNIT_ASSERT(so->FindAttribute(ga, "AttributeIOR")); + + //Try to find attribute with empty type + CPPUNIT_ASSERT(!so->FindAttribute(ga, "")); + + //Check method ReferencedObject + studyBuilder->Addreference(so1, so); + _PTR(SObject) so2; + CPPUNIT_ASSERT(so1->ReferencedObject(so2)); + CPPUNIT_ASSERT(so2->GetID() == so->GetID()); + + //Check method FindSubObject + CPPUNIT_ASSERT(so->FindSubObject(1, so2)); + CPPUNIT_ASSERT(so2->GetID() == so1->GetID()); + + //Check method GetStudy + CPPUNIT_ASSERT(so->GetStudy()->StudyId() == study->StudyId()); + + //Check methods Name + so->Name("test"); + CPPUNIT_ASSERT(so->Name() == "test"); + + //Check method GetAllAttributes + vector< _PTR(GenericAttribute) > v = so->GetAllAttributes(); + CPPUNIT_ASSERT(v.size() == 5); //+AttributeTarget +AttributeTreeNode + + //Check method GetName + CPPUNIT_ASSERT(so->GetName() == "SO name"); + + //Check method GetComment + CPPUNIT_ASSERT(so->GetComment() == "SO comment"); + + //Check method GetIOR + CPPUNIT_ASSERT(so->GetIOR() == ior); + + //Check method Depth + CPPUNIT_ASSERT(so->Depth() == 3); + + //Check method GetObject + CORBA::Object_var obj = dynamic_cast(so.get())->GetObject(); + CPPUNIT_ASSERT(!CORBA::is_nil(obj)); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx b/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx new file mode 100755 index 000000000..aef1f9c2a --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx @@ -0,0 +1,349 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_Study + * Use code of SALOMEDS_Study.cxx + */ + +void SALOMEDSTest::testStudy() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + //Check the creation of the study + CPPUNIT_ASSERT(study); + + //Check method NewBuilder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + CPPUNIT_ASSERT(studyBuilder); + + //Check method NewComponentIterator + _PTR(SComponentIterator) componentIterator = study->NewComponentIterator(); + CPPUNIT_ASSERT(componentIterator); + + //Check method GetTransientReference + CPPUNIT_ASSERT(!study->GetTransientReference().empty()); + + //Check method StudyId + CPPUNIT_ASSERT(study->StudyId() > 0); + + //Check method Name (get/set) + CPPUNIT_ASSERT(study->Name() == "Test"); + study->Name("New name"); + CPPUNIT_ASSERT(study->Name() == "New name"); + study->Name("Test"); + + //Check method URL (get/set) + study->URL(""); + CPPUNIT_ASSERT(study->URL() == ""); + study->URL("some url"); + CPPUNIT_ASSERT(study->URL() == "some url"); + + //Check method GetPersistentReference == URL + CPPUNIT_ASSERT(study->GetPersistentReference() == "some url"); + + //Check method IsSaved (get/set) + study->IsSaved(true); + CPPUNIT_ASSERT(study->IsSaved()); + study->IsSaved(false); + CPPUNIT_ASSERT(!study->IsSaved()); + + //Check method CreateObjectID + _PTR(SObject) so = study->CreateObjectID("0:2:1:3"); + CPPUNIT_ASSERT(so); + + //Try to create SObject with empty and invalid entries + CPPUNIT_ASSERT(!study->CreateObjectID("")); + CPPUNIT_ASSERT(!study->CreateObjectID("entry")); + + //Check method NewChildIterator + _PTR(ChildIterator) childIterator = study->NewChildIterator(so); + CPPUNIT_ASSERT(childIterator); + + //Check method IsEmpty + CPPUNIT_ASSERT(!study->IsEmpty()); + + //Check method FindComponent + _PTR(SComponent) sco1 = studyBuilder->NewComponent("test1"); + _PTR(SComponent) sco2 = study->FindComponent("test1"); + CPPUNIT_ASSERT(sco1 && sco2); + CPPUNIT_ASSERT(sco1->GetID() == sco2->GetID()); + _PTR(AttributeName) name_attr_sco1 = studyBuilder->FindOrCreateAttribute(sco1, "AttributeName"); + CPPUNIT_ASSERT(name_attr_sco1); + name_attr_sco1->SetValue("sco1"); + + //Try to find component with empty type + CPPUNIT_ASSERT(!study->FindComponent("")); + + //Check method GetComponentNames + vector components = study->GetComponentNames(""); //The context doesn't matter + CPPUNIT_ASSERT(components.size() == 1 && components[0] == "sco1"); + + //Check method FindComponentID + _PTR(SComponent) sco3 = study->FindComponentID(sco1->GetID()); + CPPUNIT_ASSERT(sco3 && sco3->GetID() == sco1->GetID()); + + //Try to find component with empty id + CPPUNIT_ASSERT(!study->FindComponentID("")); + + _PTR(SObject) so1 = studyBuilder->NewObject(sco1); + CPPUNIT_ASSERT(so1); + _PTR(AttributeName) name_attr_so1 = studyBuilder->FindOrCreateAttribute(so1, "AttributeName"); + CPPUNIT_ASSERT(name_attr_so1); + name_attr_so1->SetValue("so1"); + + //Create an attribute AttributeIOR + _PTR(AttributeIOR) ior_attr_so1 = studyBuilder->FindOrCreateAttribute(so1, "AttributeIOR"); + CPPUNIT_ASSERT(ior_attr_so1); + + string ior = _orb->object_to_string(_sm); + ior_attr_so1->SetValue(ior); + + _PTR(SObject) so2 = studyBuilder->NewObject(so1); + CPPUNIT_ASSERT(so2); + _PTR(AttributeName) name_attr_so2 = studyBuilder->FindOrCreateAttribute(so2, "AttributeName"); + CPPUNIT_ASSERT(name_attr_so2); + name_attr_so2->SetValue("so2"); + + //Check method FindObject + _PTR(SObject) so3 = study->FindObject("so1"); + CPPUNIT_ASSERT(so3 && so3->GetID() == so1->GetID()); + + //Try to find SObject with empty name + CPPUNIT_ASSERT(!study->FindObject("")); + + //Check method FindObjectID + _PTR(SObject) so4 = study->FindObjectID(so1->GetID()); + CPPUNIT_ASSERT(so4 && so4->GetID() == so1->GetID()); + + //Try to find SObject with empty ID + CPPUNIT_ASSERT(!study->FindObjectID("")); + + //Check method FindObjectByName + vector< _PTR(SObject) > v = study->FindObjectByName("so1", sco1->ComponentDataType()); + CPPUNIT_ASSERT(v.size()==1 && v[0]->GetID() == so1->GetID()); + + //Try to find SObject with empty name and empty component type + CPPUNIT_ASSERT((study->FindObjectByName("", "")).size() == 0); + + //Check method FindObjectByPath + _PTR(SObject) path_so = study->FindObjectByPath("/"+sco1->GetName()+"/"+so1->GetName()); + CPPUNIT_ASSERT(path_so && path_so->GetID() == so1->GetID()); + + //Check method FindObjectIOR + _PTR(SObject) so5 = study->FindObjectIOR(ior); + CPPUNIT_ASSERT(so5 && so5->GetID() == so1->GetID()); + + //Try to find SObject with empty IOR + CPPUNIT_ASSERT(!study->FindObjectIOR("")); + + //Check method GetObjectPath + string path = study->GetObjectPath(so2); + + //Try to get path of NULL SObject + _PTR(SObject) emptySO; + path = study->GetObjectPath(emptySO); + CPPUNIT_ASSERT(path.empty()); + + //Check method SetContext + study->SetContext("/sco1"); + CPPUNIT_ASSERT(study->GetContext() == "/sco1"); + + //Check method FindObjectByPath + _PTR(SObject) so6 = study->FindObjectByPath("so1"); + CPPUNIT_ASSERT(so6 && so6->GetID() == so1->GetID()); + + + //Try to find SObject with empty path + _PTR(SObject) tmp = study->FindObjectByPath(""); //Must return the Context SObject + CPPUNIT_ASSERT(tmp && tmp->GetID() == sco1->GetID()); + + study->SetContext("/"); //Root + + //Check method GetObjectNames + vector vs = study->GetObjectNames("/sco1"); + CPPUNIT_ASSERT(vs.size() == 2); + + //Check method GetDirectoryNames + _PTR(AttributeLocalID) locid_attr_sco1 = studyBuilder->FindOrCreateAttribute(sco1, "AttributeLocalID"); + CPPUNIT_ASSERT(locid_attr_sco1); + locid_attr_sco1->SetValue(16661); //DIRECTORYID + _PTR(AttributeLocalID) locid_attr_so1 = studyBuilder->FindOrCreateAttribute(so1, "AttributeLocalID"); + CPPUNIT_ASSERT(locid_attr_so1); + locid_attr_so1->SetValue(16661); //DIRECTORYID + vs = study->GetDirectoryNames(""); //Empty context (the current is taken) + CPPUNIT_ASSERT(vs.size() == 2); + + //Check method GetFileNames + locid_attr_sco1->SetValue(26662); //FILELOCALID + _PTR(AttributePersistentRef) persref_attr_sco1 = studyBuilder->FindOrCreateAttribute(sco1, "AttributePersistentRef"); + CPPUNIT_ASSERT(persref_attr_sco1); + persref_attr_sco1->SetValue("FILE: filename1"); + locid_attr_so1->SetValue(26662); //FILELOCALID + _PTR(AttributePersistentRef) persref_attr_so1 = studyBuilder->FindOrCreateAttribute(so1, "AttributePersistentRef"); + CPPUNIT_ASSERT(persref_attr_so1); + persref_attr_so1->SetValue("FILE: filename2"); + vs = study->GetFileNames(""); + CPPUNIT_ASSERT(vs.size() == 2 && vs[0] == "filename1" && vs[1] == "filename2"); + + //Check method StudyId (get/set) + int id = study->StudyId(); + study->StudyId(-1); + CPPUNIT_ASSERT(study->StudyId() == -1); + study->StudyId(id); + + //Check method FindDependances + studyBuilder->Addreference(so2, so1); + studyBuilder->Addreference(sco1, so1); + vector< _PTR(SObject) > vso = study->FindDependances(so1); + CPPUNIT_ASSERT(vso.size() == 2 && vso[0]->GetID() == so2->GetID() && vso[1]->GetID() == sco1->GetID()); + + //Check method GetProperties + _PTR(AttributeStudyProperties) sp = study->GetProperties(); + CPPUNIT_ASSERT(sp); + + //Check Lock functionality + sp->SetLocked(true); + bool isLockRaised = false; + try { + name_attr_so1->SetValue("test"); + } + catch(...) { + isLockRaised = true; + } + CPPUNIT_ASSERT(isLockRaised); + + sp->SetLocked(false); + isLockRaised = false; + try { + name_attr_so1->SetValue("test"); + } + catch(...) { + isLockRaised = true; + } + CPPUNIT_ASSERT(!isLockRaised); + + //Check method GetLastModificationDate + sp->SetModification("srn", 1, 2, 3, 4, 5); + sp->SetModification("srn", 6, 7, 8, 9, 10); + string date = study->GetLastModificationDate(); + + CPPUNIT_ASSERT(date == "08/09/0010 07:06"); + + //Check method GetModificationsDate + vs = study->GetModificationsDate(); + CPPUNIT_ASSERT(vs.size() == 2 && vs[0] == "03/04/0005 02:01" && vs[1] == "08/09/0010 07:06"); + + //Check method GetCommonParameters + _PTR(AttributeParameter) cp = study->GetCommonParameters("id", 1); //Save point = 1 + CPPUNIT_ASSERT(cp); + cp->SetBool("test_true", true); + cp->SetBool("test_false", false); + _PTR(AttributeParameter) cp2 = study->GetCommonParameters("id", 1); //Save point = 1 + CPPUNIT_ASSERT(cp2); + CPPUNIT_ASSERT(cp2->GetBool("test_true") && !cp2->GetBool("test_false")); + _PTR(AttributeParameter) cp21 = study->GetCommonParameters("id", 2); //Save point = 2 + CPPUNIT_ASSERT(cp21); + CPPUNIT_ASSERT(!cp21->IsSet("test_true", PT_BOOLEAN) && !cp21->IsSet("test_false", PT_BOOLEAN)); + + //Check method GetModuleParameters + _PTR(AttributeParameter) cp3 = study->GetModuleParameters("id", "module name", 1); //Save point = 1, name = "module name" + CPPUNIT_ASSERT(cp3); + cp3->SetBool("test_true", true); + cp3->SetBool("test_false", false); + _PTR(AttributeParameter) cp4 = study->GetModuleParameters("id", "module name", 1); //Save point = 1, name = "module name" + CPPUNIT_ASSERT(cp4); + CPPUNIT_ASSERT(cp4->GetBool("test_true") && !cp4->GetBool("test_false")); + _PTR(AttributeParameter) cp5 = study->GetModuleParameters("id", "module name 2", 1); //Save point = 1, name = "module name 2" + CPPUNIT_ASSERT(cp5); + CPPUNIT_ASSERT(!cp5->IsSet("test_true", PT_BOOLEAN) && !cp5->IsSet("test_false", PT_BOOLEAN)); + _PTR(AttributeParameter) cp6 = study->GetModuleParameters("id", "module name", 2); //Save point = 2, name = "module name" + CPPUNIT_ASSERT(cp6); + CPPUNIT_ASSERT(!cp6->IsSet("test_true", PT_BOOLEAN) && !cp6->IsSet("test_false", PT_BOOLEAN)); + + //Check method GetUseCaseBuilder + _PTR(UseCaseBuilder) ub = study->GetUseCaseBuilder(); + CPPUNIT_ASSERT(ub); + + //Check method SetStudyLock + study->SetStudyLock("locker1"); + + //Check method IsStudyLocked + CPPUNIT_ASSERT(study->IsStudyLocked()); + + //Check method GetLockerID + study->SetStudyLock("locker2"); + vs = study->GetLockerID(); + CPPUNIT_ASSERT(vs.size() == 2 && vs[0] == "locker1" && vs[1] == "locker2"); + + //Check method UnLockStudy + study->UnLockStudy("locker1"); + CPPUNIT_ASSERT(study->IsStudyLocked()); + vs = study->GetLockerID(); + CPPUNIT_ASSERT(vs.size() == 1 && vs[0] == "locker2"); + study->UnLockStudy("locker2"); + CPPUNIT_ASSERT(!study->IsStudyLocked()); + vs = study->GetLockerID(); + CPPUNIT_ASSERT(vs.size() == 0); + + //Check method EnableUseCaseAutoFilling + study->EnableUseCaseAutoFilling(false); + _PTR(SObject) uso1 = study->NewBuilder()->NewObject(sco1); + vector< _PTR(GenericAttribute) > va1 = uso1->GetAllAttributes(); + CPPUNIT_ASSERT(va1.size() == 0); + + study->EnableUseCaseAutoFilling(true); + _PTR(SObject) uso2 = study->NewBuilder()->NewObject(sco1); + vector< _PTR(GenericAttribute) > va2 = uso2->GetAllAttributes(); + CPPUNIT_ASSERT(va2.size() == 1); // +AttributeTreeNode + + //Check method DumpStudy + study->DumpStudy(".", "SRN", false); + + fstream f("SRN.py"); + char buffer[128]; + buffer[81] = (char)0; + f.getline(buffer, 80); + string line(buffer); + + f.close(); + system("rm -f SRN.py"); + CPPUNIT_ASSERT(line == "### This file is generated by SALOME automatically by dump python functionality"); + + //Check method Close + bool isException = false; + try { + sm->Close(study); //Close is called inside StudyManager::Close + } + catch(...) { + isException = true; + } + CPPUNIT_ASSERT(!isException); + +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx b/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx new file mode 100755 index 000000000..4ce06a578 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx @@ -0,0 +1,285 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_StudyBuilder + * Use code of SALOMEDS_StudyBuilder.cxx + */ + +void SALOMEDSTest::testStudyBuilder() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("TestStudyBuilder"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + //Check the StudyBuilder creation + CPPUNIT_ASSERT(studyBuilder); + + //Check method NewComponent + _PTR(SComponent) sco1 = studyBuilder->NewComponent("Test"); + CPPUNIT_ASSERT(sco1 && sco1->ComponentDataType() == "Test"); + + //Check method DefineComponentInstance + string ior = _orb->object_to_string(_sm); + studyBuilder->DefineComponentInstance(sco1, ior); + string newior; + sco1->ComponentIOR(newior); + CPPUNIT_ASSERT(newior == ior); + + //Check method RemoveComponent + studyBuilder->RemoveComponent(sco1); + _PTR(SComponent) sco2 = study->FindComponent("Test"); + CPPUNIT_ASSERT(!sco2); + + //Try to create and find the component with empty type + _PTR(SComponent) sco_empty = studyBuilder->NewComponent(""); + CPPUNIT_ASSERT(!sco_empty); + + _PTR(SComponent) sco3 = studyBuilder->NewComponent("NewComp"); + CPPUNIT_ASSERT(sco3); + + //Check method NewObject + _PTR(SObject) so1 = studyBuilder->NewObject(sco3); + CPPUNIT_ASSERT(so1); + string id1 = so1->GetID(); + + //Check method NewObjectToTag + _PTR(SObject) so2 = studyBuilder->NewObjectToTag(so1, 2); + CPPUNIT_ASSERT(so2 && so2->Tag() == 2); + string id2 = so2->GetID(); + + //Check method FindOrCreateAttribute + _PTR(SObject) so3 = studyBuilder->NewObject(sco3); + CPPUNIT_ASSERT(so3); + _PTR(AttributeName) an3 = studyBuilder->FindOrCreateAttribute(so3, "AttributeName"); + CPPUNIT_ASSERT(an3); + + cout << endl << "########## 1" << endl; + + //Try to create attribute with invalid type + CPPUNIT_ASSERT(!studyBuilder->FindOrCreateAttribute(so3, "invalid type")); + + cout << endl << "########## 2" << endl; + + //Check method FindAttribute + _PTR(GenericAttribute) ga; + CPPUNIT_ASSERT(studyBuilder->FindAttribute(so3, ga, "AttributeName")); + + cout << endl << "########## 3" << endl; + + //Try to find attribute with invalid type + CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so3, ga, "invalid type")); + + cout << endl << "########## 4" << endl; + + //Check method RemoveObject + studyBuilder->RemoveObject(so3); + CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so3, ga, "AttributeName")); + + //Check method RemoveObjectWithChildren + _PTR(AttributeName) an2 = studyBuilder->FindOrCreateAttribute(so2, "AttributeName"); + CPPUNIT_ASSERT(an2); + studyBuilder->RemoveObjectWithChildren(so1); + CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so2, ga, "AttributeName")); + + //Check method RemoveAttribute + _PTR(AttributeName) an1 = studyBuilder->FindOrCreateAttribute(so1, "AttributeName"); + CPPUNIT_ASSERT(an1); + CPPUNIT_ASSERT(studyBuilder->FindAttribute(so1, ga, "AttributeName")); + studyBuilder->RemoveAttribute(so1, "AttributeName"); + CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so1, ga, "AttributeName")); + + //Check method Addreference + studyBuilder->Addreference(so2, so1); + _PTR(SObject) refSO; + CPPUNIT_ASSERT(so2->ReferencedObject(refSO) && refSO->GetID() == so1->GetID()); + + //Try to set reference to NULL SObject + bool isRaised = false; + _PTR(SObject) empty_so; + try { + studyBuilder->Addreference(so2, empty_so); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + //Check method RemoveReference + studyBuilder->RemoveReference(so2); + CPPUNIT_ASSERT(!so2->ReferencedObject(refSO)); + + //Check method SetGUID and IsGUID + string value = "0e1c36e6-379b-4d90-ab3b-17a14310e648"; + studyBuilder->SetGUID(so1, value); + CPPUNIT_ASSERT(studyBuilder->IsGUID(so1, value)); + + //Try to set invalid GUID + isRaised = false; + try { + studyBuilder->SetGUID(so1, "invalid GUID"); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + //Check method UndoLimit (set/get) + studyBuilder->UndoLimit(10); + CPPUNIT_ASSERT(studyBuilder->UndoLimit() == 10); + + //Check transactions methods: NewCommand, CommitCommand, AbortCommand, + //HasOpenedCommand, Undo, Redo, GetAvailableUndos, GetAvailableRedos + _PTR(SObject) so4 = studyBuilder->NewObject(sco3); + CPPUNIT_ASSERT(so4); + studyBuilder->NewCommand(); + CPPUNIT_ASSERT(studyBuilder->HasOpenCommand()); + _PTR(AttributeName) an4 = studyBuilder->FindOrCreateAttribute(so4, "AttributeName"); + CPPUNIT_ASSERT(an4); + an4->SetValue("command1"); + studyBuilder->CommitCommand(); + CPPUNIT_ASSERT(!studyBuilder->HasOpenCommand()); + studyBuilder->NewCommand(); + an4->SetValue("command2"); + studyBuilder->AbortCommand(); + CPPUNIT_ASSERT(an4->Value() == "command1"); + studyBuilder->NewCommand(); + an4->SetValue("command2"); + studyBuilder->CommitCommand(); + studyBuilder->Undo(); + CPPUNIT_ASSERT(an4->Value() == "command1"); + CPPUNIT_ASSERT(studyBuilder->GetAvailableRedos()); + studyBuilder->Redo(); + CPPUNIT_ASSERT(an4->Value() == "command2"); + CPPUNIT_ASSERT(studyBuilder->GetAvailableUndos()); + + //Check method SetName + studyBuilder->SetName(so1, "new name"); + CPPUNIT_ASSERT(so1->GetName() == "new name"); + + //Try to set empty Name + studyBuilder->SetName(so1, ""); + CPPUNIT_ASSERT(so1->GetName() == ""); + + //Check method SetComment + studyBuilder->SetComment(so1, "new comment"); + CPPUNIT_ASSERT(so1->GetComment() == "new comment"); + + //Check method empty Comment + studyBuilder->SetComment(so1, ""); + CPPUNIT_ASSERT(so1->GetComment() == ""); + + //Try to set empty IOR + studyBuilder->SetIOR(so1, ""); + CPPUNIT_ASSERT(so1->GetIOR() == ""); + + //Check method SetIOR + studyBuilder->SetIOR(so1, ior); + CPPUNIT_ASSERT(so1->GetIOR() == ior); + + sm->Close(study); + + //Check method LoadWith + _PTR(Study) study2 = sm->NewStudy("Study2"); + + SALOME_NamingService NS(_orb); + CORBA::Object_var obj = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("SuperVisionContainer", "SUPERV"); + CPPUNIT_ASSERT(!CORBA::is_nil(obj)); + + MESSAGE("Created a new GEOM component"); + + SALOMEDS::Driver_var drv = SALOMEDS::Driver::_narrow(obj); + CPPUNIT_ASSERT(!CORBA::is_nil(drv)); + _PTR(StudyBuilder) sb2 = study2->NewBuilder(); + _PTR(SComponent) sco = sb2->NewComponent("SUPERV"); + ior = _orb->object_to_string(drv); + sb2->DefineComponentInstance(sco, ior); + + sm->SaveAs("srn_SALOMEDS_UnitTests.hdf", study2, false); + sm->Close(study2); + + _PTR(Study) study3 = sm->Open("srn_SALOMEDS_UnitTests.hdf"); + _PTR(StudyBuilder) sb3 = study3->NewBuilder(); + _PTR(SComponent) aComp = study3->FindComponent("SUPERV"); + CPPUNIT_ASSERT(aComp); + + CORBA::Object_var obj2 = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("SuperVisionContainer", "SUPERV"); + CPPUNIT_ASSERT(!CORBA::is_nil(obj2)); + SALOMEDS::Driver_var drv2 = SALOMEDS::Driver::_narrow(obj2); + ior = _orb->object_to_string(drv2); + + isRaised = false; + try { + sb3->LoadWith(aComp, ior); + } + catch(...) { + isRaised = true; + } + + CPPUNIT_ASSERT(!isRaised); + + ior = ""; + aComp->ComponentIOR(ior); + CPPUNIT_ASSERT(!ior.empty()); + + system("rm -f srn_SALOMEDS_UnitTests.hdf"); + + //Check method AddDirectory + _PTR(AttributeName) na1 = sb3->FindOrCreateAttribute(aComp, "AttributeName"); + na1->SetValue("Component"); + + isRaised = false; + try { + sb3->AddDirectory("/Component/Dir1"); + } catch(...) { + isRaised = true; + } + + CPPUNIT_ASSERT(!isRaised); + _PTR(SObject) so5 = study3->FindObjectByPath("/Component/Dir1"); + CPPUNIT_ASSERT(so5); + + isRaised = false; + try { + sb3->AddDirectory("/Component/Dir1"); //Attempt to create the same directory + } catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + isRaised = false; + try { + sb3->AddDirectory("/MyComponent/Dir1"); //Attempt to create the invalid directory + } catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + sm->Close(study3); +} diff --git a/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx b/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx new file mode 100755 index 000000000..f20d68208 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx @@ -0,0 +1,164 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_StudyManager + * Use code of SALOMEDS_StudyManager.cxx + */ +void SALOMEDSTest::testStudyManager() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Check method NewStudy + _PTR(Study) study1 = sm->NewStudy("Study1"); + CPPUNIT_ASSERT(study1); + + _PTR(Study) study2 = sm->NewStudy("Study2"); + CPPUNIT_ASSERT(study2); + + //Check method GetStudyByName + _PTR(Study) study3 = sm->GetStudyByName("Study1"); + CPPUNIT_ASSERT(study3->StudyId() == study1->StudyId()); + CPPUNIT_ASSERT(study3->Name() == study1->Name()); + + //Check method GetStudyByName with empty name + CPPUNIT_ASSERT(!sm->GetStudyByName("")); + + //Try to create Study with empty name + _PTR(Study) study_empty = sm->NewStudy(""); + CPPUNIT_ASSERT(study_empty); + CPPUNIT_ASSERT(sm->GetStudyByName("")); + sm->Close(study_empty); + + //Check method FindStudyByID + _PTR(Study) study4 = sm->GetStudyByID(study2->StudyId()); + CPPUNIT_ASSERT(study4->StudyId() == study2->StudyId()); + CPPUNIT_ASSERT(study4->Name() == study2->Name()); + + //Check method GetOpenStudies + vector v = sm->GetOpenStudies(); + CPPUNIT_ASSERT(v.size() == 2); + + //Check method Close + int id = study2->StudyId(); + sm->Close(study2); + CPPUNIT_ASSERT(!sm->GetStudyByID(id)); + + //Check method GetStudyByID for invalid ID + CPPUNIT_ASSERT(!sm->GetStudyByID(-1)); + + //Check methods CanPaste, CanCopy, Copy, Paste + _PTR(StudyBuilder) sb1 = study1->NewBuilder(); + _PTR(SComponent) sco1 = sb1->NewComponent("Test"); + _PTR(SObject) so1 = sb1->NewObject(sco1); + _PTR(AttributeName) na1 = sb1->FindOrCreateAttribute(so1, "AttributeName"); + CPPUNIT_ASSERT(na1); + na1->SetValue("Some name"); + + CPPUNIT_ASSERT(!sm->CanCopy(so1)); //The father component has no IOR + + CPPUNIT_ASSERT(sm->Copy(so1)); + + + CPPUNIT_ASSERT(!sm->CanPaste(so1)); //The father component has no IOR + + _PTR(SObject) so1_2 = sb1->NewObject(sco1); + _PTR(SObject) pasted_so = sm->Paste(so1_2); + CPPUNIT_ASSERT(pasted_so); + + _PTR(AttributeName) na2 = sb1->FindOrCreateAttribute(pasted_so, "AttributeName"); + CPPUNIT_ASSERT(na2 && na2->Value() == "Some name"); + + + + //Check method SaveAs + sm->SaveAs("srn_UnitTest_Save.hdf", study1, false); + string url = study1->URL(); + sm->Close(study1); + + //Check method Open + _PTR(Study) study1_opened = sm->Open("srn_UnitTest_Save.hdf"); //Contains Test component + system("rm -f srn_UnitTest_Save.hdf"); + url = study1->URL(); + CPPUNIT_ASSERT(study1_opened); + CPPUNIT_ASSERT(url == "srn_UnitTest_Save.hdf"); + + //Check method Save + _PTR(StudyBuilder) sb3 = study1_opened->NewBuilder(); + _PTR(SComponent) sco3 = study1_opened->FindComponent("Test"); + CPPUNIT_ASSERT(sco3); + // Add a new SObject with AttributeName that contains "Saved study" string + _PTR(SObject) so3 = sb3->NewObject(sco3); + string soID = so3->GetID(); + _PTR(AttributeName) na3 = sb3->FindOrCreateAttribute(so3, "AttributeName"); + CPPUNIT_ASSERT(na3); + na3->SetValue("Saved study"); + // Save and close the study + sm->Save(study1_opened, false); + sm->Close(study1_opened); + + // Open saved study and find the created SObject with AttributeName, then compare the stored string + _PTR(Study) study2_opened = sm->Open("srn_UnitTest_Save.hdf"); + system("rm -f srn_UnitTest_Save.hdf"); + CPPUNIT_ASSERT(study2_opened); + _PTR(SObject) so4 = study2_opened->CreateObjectID(soID); + _PTR(StudyBuilder) sb4 = study2_opened->NewBuilder(); + _PTR(AttributeName) na4 = sb4->FindOrCreateAttribute(so4, "AttributeName"); + CPPUNIT_ASSERT(na4 && na4->Value() == "Saved study"); //Compare the value of restored attribute with string that has to be saved. + + + //Check method SaveAsASCII + sm->SaveAsASCII("srn_UnitTest_SaveASCII.hdf", study2_opened, false); + url = study2_opened->URL(); + sm->Close(study2_opened); + _PTR(Study) study3_opened = sm->Open("srn_UnitTest_SaveASCII.hdf"); //Contains Test component + system("rm -f srn_UnitTest_SaveASCII.hdf"); + CPPUNIT_ASSERT(study3_opened); + CPPUNIT_ASSERT(url == "srn_UnitTest_SaveASCII.hdf"); + + //Check method SaveASCII + _PTR(StudyBuilder) sb5 = study3_opened->NewBuilder(); + _PTR(SComponent) sco5 = study3_opened->FindComponent("Test"); + CPPUNIT_ASSERT(sco5); + // Add a new SObject with AttributeName that contains "Saved study" string + _PTR(SObject) so5 = sb5->NewObject(sco5); + soID = so5->GetID(); + _PTR(AttributeName) na5 = sb5->FindOrCreateAttribute(so5, "AttributeName"); + CPPUNIT_ASSERT(na5); + na5->SetValue("Saved study ASCII"); + // Save and close the study + sm->Save(study3_opened, false); + sm->Close(study3_opened); + + // Open saved study and find the created SObject with AttributeName, then compare the stored string + _PTR(Study) study4_opened = sm->Open("srn_UnitTest_SaveASCII.hdf"); + system("rm -f srn_UnitTest_SaveASCII.hdf"); + CPPUNIT_ASSERT(study4_opened); + _PTR(SObject) so6 = study4_opened->CreateObjectID(soID); + _PTR(StudyBuilder) sb6 = study4_opened->NewBuilder(); + _PTR(AttributeName) na6 = sb6->FindOrCreateAttribute(so6, "AttributeName"); + CPPUNIT_ASSERT(na6 && na6->Value() == "Saved study ASCII"); //Compare the value of restored attribute with string that has to be saved. +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx b/src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx new file mode 100755 index 000000000..27c2246ce --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx @@ -0,0 +1,149 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_UseCaseBuilder and UseCaseIterator + * Use code of SALOMEDS_UseCaseBuilder.cxx and SALOMEDS_UseCaseIterator.cxx + */ + +#define SALOMEDS_ALL_TESTS + +void SALOMEDSTest::testUseCase() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("TestSObject"); + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + CPPUNIT_ASSERT(studyBuilder); + + //Create a new UseCaseBuilder + _PTR(UseCaseBuilder) builder = study->GetUseCaseBuilder(); + CPPUNIT_ASSERT(builder); + + //Check method AddUseCase + _PTR(SObject) root1 = builder->AddUseCase("UseCase_1"); + _PTR(SObject) root2 = builder->AddUseCase("UseCase_2"); + CPPUNIT_ASSERT(root1 && root2); + + //Check method SetCurrentObject + builder->SetCurrentObject(root1); + + //Check method GetCurrentObject + CPPUNIT_ASSERT(builder->GetCurrentObject() && builder->GetCurrentObject()->GetID() == root1->GetID()); + + //Check method SetRootCurrent + CPPUNIT_ASSERT(builder->SetRootCurrent()); + CPPUNIT_ASSERT(builder->GetCurrentObject()->GetID() == "0:2"); //Root in UseCases is always placed at label 0:2 + + //Check method IsUseCase + CPPUNIT_ASSERT(builder->IsUseCase(root1) && builder->IsUseCase(root2)); + + //Check method SetName + builder->SetName("A root use case"); + + //Check method GetName + CPPUNIT_ASSERT(builder->GetName() == "A root use case"); + +#ifdef SALOMEDS_ALL_TESTS + //Check method GetUseCaseIterator + builder->SetRootCurrent(); + _PTR(SObject) nullObject; + _PTR(UseCaseIterator) root_it = builder->GetUseCaseIterator(nullObject); //The iterator on all UseCases + root_it->Init(false); //Only the first level + CPPUNIT_ASSERT(root_it->More()); + CPPUNIT_ASSERT(root_it->Value()->GetID() == root1->GetID()); + root_it->Next(); + CPPUNIT_ASSERT(root_it->More()); + CPPUNIT_ASSERT(root_it->Value()->GetID() == root2->GetID()); + root_it->Next(); + CPPUNIT_ASSERT(!root_it->More()); +#else + cout << endl << "THE TEST IS NOT COMPLETE !!!" << endl; +#endif + + builder->SetCurrentObject(root1); + _PTR(UseCaseIterator) it = builder->GetUseCaseIterator(root1); //The iterator on the given UseCase + + //Check method Append + _PTR(SObject) so1 = study->CreateObjectID("0:1:1"); + _PTR(SObject) so2 = study->CreateObjectID("0:1:2"); + CPPUNIT_ASSERT(builder->Append(so1)); + + //Check methods Init, More, Next and Value of UseCaseIterator + it->Init(false); + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so1->GetID()); + it->Next(); + CPPUNIT_ASSERT(!it->More()); + + //Check method AppendTo + CPPUNIT_ASSERT(builder->AppendTo(so1, so2)); + + //Check method HasChildren + CPPUNIT_ASSERT(builder->HasChildren(so1)); + CPPUNIT_ASSERT(!builder->HasChildren(so2)); + + //Check method Init of UseCaseIterator + it->Init(false); //Only the first level + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so1->GetID()); + it->Next(); + CPPUNIT_ASSERT(!it->More()); + + it->Init(true); //All levels + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so1->GetID()); + it->Next(); + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so2->GetID()); + it->Next(); + CPPUNIT_ASSERT(!it->More()); + + //Check method Remove + CPPUNIT_ASSERT(builder->Remove(so2)); + it->Init(true); + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so1->GetID()); + it->Next(); + CPPUNIT_ASSERT(!it->More()); + + CPPUNIT_ASSERT(builder->Append(so2)); + + //Check method InsertBefore + CPPUNIT_ASSERT(builder->InsertBefore(so2, so1)); + + it->Init(false); + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so2->GetID()); + it->Next(); + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so1->GetID()); + + sm->Close(study); +} +#undef SALOMEDS_ALL_TESTS + + diff --git a/src/SALOMEDS/Test/TestSALOMEDS.cxx b/src/SALOMEDS/Test/TestSALOMEDS.cxx index 68c94b243..59f32e47d 100644 --- a/src/SALOMEDS/Test/TestSALOMEDS.cxx +++ b/src/SALOMEDS/Test/TestSALOMEDS.cxx @@ -24,12 +24,153 @@ #include "SALOMEDSImplTest.hxx" #include "SALOMEDSTest.hxx" +#include + // --- Registers the fixture into the 'registry' -CPPUNIT_TEST_SUITE_REGISTRATION( SALOMELocalTraceTest ); -CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSImplTest ); CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest ); +CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest_Embedded ); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include "utilities.h" +#include "Utils_SINGLETON.hxx" +#include "Utils_ORB_INIT.hxx" +#include "OpUtil.hxx" +#include "SALOME_NamingService.hxx" +#include "NamingService_WaitForServerReadiness.hxx" +#include "SALOMEDS_StudyManager_i.hxx" + +// ============================================================================ +/*! + * Main program source for Unit Tests with cppunit package does not depend + * on actual tests, so we use the same for all partial unit tests. + */ +// ============================================================================ + +int main(int argc, char* argv[]) +{ + // --- Run Salome without GUI + + setenv("SALOME_trace", "file:./traceUnitTest.log", 1); // 1: overwrite + + system("runSalome -t &"); + + // --- Wait till SALOMEDS server is launched + + char hostname[511]; + int size; + gethostname(hostname, size); + char* chr_port = getenv("SALOMEDS_UNITTESTS_PORT"); + string port; + if(chr_port) port = chr_port; + if(port.empty()) port = "2810"; + string cfg_file = string(getenv("HOME"))+"/.omniORB_"+string(hostname)+"_"+port+".cfg"; + setenv("OMNIORB_CONFIG", cfg_file.c_str(), 1); + + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()); + CORBA::ORB_var orb = init(argc , argv ) ; + + sleep(15); + + string host; // = GetHostname(); + char* wait_Superv = getenv("SALOMEDS_UNITTESTS_WAIT_SUPERVISOR"); + if(wait_Superv) host = GetHostname(); + + SALOME_NamingService NS(orb); + if(host.empty()) + NamingService_WaitForServerReadiness(&NS, "/myStudyManager"); + else { + string serverName = "/Containers/"+host+"/SuperVisionContainer"; + NamingService_WaitForServerReadiness(&NS, serverName); + } + + CORBA::Object_var obj = NS.Resolve( "/myStudyManager" ); + if(CORBA::is_nil(obj)) { + system("killSalome.py"); + return 1; + } + + //Set up the environement for Embedded case + string kernel_root = getenv("KERNEL_ROOT_DIR"); + CPPUNIT_ASSERT(!kernel_root.empty()); + kernel_root+="/share/salome/resources/kernel"; + setenv("CSF_PluginDefaults", kernel_root.c_str(), 1); + setenv("CSF_SALOMEDS_ResourcesDefaults", kernel_root.c_str(), 1); + + CORBA::Object_var poaObj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(poaObj)) { + PortableServer::POA_var poa = PortableServer::POA::_narrow(poaObj); + + SALOMEDS_StudyManager_i * aStudyManager_i = new SALOMEDS_StudyManager_i(orb, poa); + // Activate the objects. This tells the POA that the objects are ready to accept requests. + PortableServer::ObjectId_var aStudyManager_iid = poa->activate_object(aStudyManager_i); + aStudyManager_i->register_name("/myStudyManager_embedded"); + + // Obtain a POAManager, and tell the POA to start accepting + // requests on its objects. + PortableServer::POAManager_var pman = poa->the_POAManager(); + pman->activate(); + } + + + // --- Create the event manager and test controller + CPPUNIT_NS::TestResult controller; + + // --- Add a listener that colllects test result + CPPUNIT_NS::TestResultCollector result; + controller.addListener( &result ); + + // --- Add a listener that print dots as test run. +#ifdef WIN32 + CPPUNIT_NS::TextTestProgressListener progress; +#else + CPPUNIT_NS::BriefTestProgressListener progress; +#endif + controller.addListener( &progress ); + + // --- Get the top level suite from the registry + + CPPUNIT_NS::Test *suite = + CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest(); + + // --- Adds the test to the list of test to run + + CPPUNIT_NS::TestRunner runner; + runner.addTest( suite ); + runner.run( controller); + + // --- Print test in a compiler compatible format. + + std::ofstream testFile; + testFile.open("UnitTestsResult", std::ios::out | std::ios::trunc); + //CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr ); + CPPUNIT_NS::CompilerOutputter outputter( &result, testFile ); + outputter.write(); + + // --- Run the tests. + + bool wasSucessful = result.wasSuccessful(); + testFile.close(); + + // --- Kill all created Salome process + + system("killSalome.py"); -// --- generic Main program from Basic/Test + // --- Return error code 1 if the one of test failed. -#include "BasicMainTest.hxx" + return wasSucessful ? 0 : 1; +} diff --git a/src/SALOMEDSClient/Makefile.am b/src/SALOMEDSClient/Makefile.am index 489548895..4615a1a86 100644 --- a/src/SALOMEDSClient/Makefile.am +++ b/src/SALOMEDSClient/Makefile.am @@ -55,6 +55,7 @@ salomeinclude_HEADERS=\ SALOMEDSClient_AttributeTreeNode.hxx \ SALOMEDSClient_AttributeUserID.hxx \ SALOMEDSClient_AttributeParameter.hxx \ + SALOMEDSClient_AttributeString.hxx \ SALOMEDSClient_ChildIterator.hxx \ SALOMEDSClient_GenericAttribute.hxx \ SALOMEDSClient_SComponent.hxx \ diff --git a/src/SALOMEDSClient/SALOMEDSClient.hxx b/src/SALOMEDSClient/SALOMEDSClient.hxx index a03c019e0..6551f3cbb 100644 --- a/src/SALOMEDSClient/SALOMEDSClient.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient.hxx @@ -50,6 +50,7 @@ #include "SALOMEDSClient_AttributeTreeNode.hxx" #include "SALOMEDSClient_AttributeUserID.hxx" #include "SALOMEDSClient_AttributeParameter.hxx" +#include "SALOMEDSClient_AttributeString.hxx" #include "SALOMEDSClient_ChildIterator.hxx" #include "SALOMEDSClient_GenericAttribute.hxx" #include "SALOMEDSClient_SComponent.hxx" diff --git a/src/SALOMEDSClient/SALOMEDSClient_AttributeString.hxx b/src/SALOMEDSClient/SALOMEDSClient_AttributeString.hxx new file mode 100644 index 000000000..442a94952 --- /dev/null +++ b/src/SALOMEDSClient/SALOMEDSClient_AttributeString.hxx @@ -0,0 +1,38 @@ +// Copyright (C) 2005 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 : SALOMEDSClient_AttributeString.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDSClient_AttributeString_HeaderFile +#define SALOMEDSClient_AttributeString_HeaderFile + +#include "SALOMEDSClient_definitions.hxx" +#include "SALOMEDSClient_GenericAttribute.hxx" +#include + +class SALOMEDSClient_AttributeString: public virtual SALOMEDSClient_GenericAttribute +{ +public: + virtual std::string Value() = 0; + virtual void SetValue(const std::string& value) = 0; +}; + +#endif diff --git a/src/SALOMEDSClient/SALOMEDSClient_AttributeTreeNode.hxx b/src/SALOMEDSClient/SALOMEDSClient_AttributeTreeNode.hxx index b3b31b94d..47383e748 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_AttributeTreeNode.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_AttributeTreeNode.hxx @@ -27,7 +27,7 @@ #include "SALOMEDSClient_definitions.hxx" #include "SALOMEDSClient_GenericAttribute.hxx" -class SALOMEDSClient_AttributeTreeNode +class SALOMEDSClient_AttributeTreeNode: public virtual SALOMEDSClient_GenericAttribute { public: diff --git a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx index 6c226d402..703b65f5c 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx @@ -38,7 +38,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS) -class ClientFactory { +class SALOMEDSCLIENT_EXPORT ClientFactory { public: /*! diff --git a/src/SALOMEDSClient/SALOMEDSClient_definitions.hxx b/src/SALOMEDSClient/SALOMEDSClient_definitions.hxx index 8b1137e37..752c9849d 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_definitions.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_definitions.hxx @@ -20,6 +20,16 @@ #ifndef SALOMEDSCLIENT_DEF_HXX #define SALOMEDSCLIENT_DEF_HXX +#ifdef WIN32 +# ifdef SALOMEDSCLIENT_EXPORTS +# define SALOMEDSCLIENT_EXPORT __declspec( dllexport ) +# else +# define SALOMEDSCLIENT_EXPORT __declspec( dllimport ) +# endif +#else +# define SALOMEDSCLIENT_EXPORT +#endif + #include template class clt_shared_ptr: public boost::shared_ptr @@ -30,7 +40,7 @@ public: template explicit clt_shared_ptr(Y * p) { - reset(p); + boost::shared_ptr::reset(p); } template diff --git a/src/SALOMEDSImpl/Makefile.am b/src/SALOMEDSImpl/Makefile.am index ca9352aab..a228cac57 100644 --- a/src/SALOMEDSImpl/Makefile.am +++ b/src/SALOMEDSImpl/Makefile.am @@ -66,6 +66,7 @@ salomeinclude_HEADERS= \ SALOMEDSImpl_AttributeComment.hxx \ SALOMEDSImpl_AttributeReference.hxx \ SALOMEDSImpl_AttributeParameter.hxx \ + SALOMEDSImpl_AttributeString.hxx \ SALOMEDSImpl_UseCaseBuilder.hxx \ SALOMEDSImpl_UseCaseIterator.hxx \ SALOMEDSImpl_SComponentIterator.hxx \ @@ -147,6 +148,7 @@ libSalomeDSImpl_la_SOURCES =\ SALOMEDSImpl_AttributeComment.cxx \ SALOMEDSImpl_AttributeReference.cxx \ SALOMEDSImpl_AttributeParameter.cxx \ + SALOMEDSImpl_AttributeString.cxx \ SALOMEDSImpl_ChildNodeIterator.cxx \ SALOMEDSImpl_UseCaseBuilder.cxx \ SALOMEDSImpl_UseCaseIterator.cxx \ @@ -187,6 +189,8 @@ libSalomeDSImpl_la_SOURCES =\ SALOMEDSImpl_AttributeTextHighlightColor.hxx \ SALOMEDSImpl_AttributeTreeNode.hxx \ SALOMEDSImpl_AttributeUserID.hxx \ + SALOMEDSImpl_AttributeParameter.hxx \ + SALOMEDSImpl_AttributeString.hxx \ SALOMEDSImpl_Callback.hxx \ SALOMEDSImpl_ChildIterator.hxx \ SALOMEDSImpl_ChildNodeIterator.hxx \ diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx index 69451c0a0..d0a2df1b2 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx @@ -67,7 +67,7 @@ Handle(SALOMEDSImpl_AttributeExpandable) SALOMEDSImpl_AttributeExpandable::Set ( SALOMEDSImpl_AttributeExpandable::SALOMEDSImpl_AttributeExpandable() :SALOMEDSImpl_GenericAttribute("AttributeExpandable") { - myValue = 0; + myValue = 1; } //======================================================================= diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx index 1eea12dbd..820643d35 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx @@ -119,6 +119,8 @@ void SALOMEDSImpl_AttributeParameter::SetInt(const string& theID, const int& the { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _ints[theID] = theValue; @@ -148,6 +150,8 @@ void SALOMEDSImpl_AttributeParameter::SetReal(const string& theID, const double& { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _reals[theID] = theValue; @@ -177,6 +181,8 @@ void SALOMEDSImpl_AttributeParameter::SetString(const string& theID, const strin { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _strings[theID] = theValue; @@ -206,6 +212,8 @@ void SALOMEDSImpl_AttributeParameter::SetBool(const string& theID, const bool& t { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _bools[theID] = theValue; @@ -235,6 +243,8 @@ void SALOMEDSImpl_AttributeParameter::SetRealArray(const string& theID, const ve { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _realarrays[theID] = theArray; @@ -265,6 +275,8 @@ void SALOMEDSImpl_AttributeParameter::SetIntArray(const string& theID, const vec { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _intarrays[theID] = theArray; @@ -295,6 +307,8 @@ void SALOMEDSImpl_AttributeParameter::SetStrArray(const string& theID, const vec { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _strarrays[theID] = theArray; @@ -583,17 +597,20 @@ void SALOMEDSImpl_AttributeParameter::Restore(const Handle(TDF_Attribute)& with) _intarrays.clear(); _strarrays.clear(); - for(map::const_iterator p = A->_ints.begin(); p!= A->_ints.end(); p++) _ints[p->first] = p->second; - for(map::const_iterator p = A->_reals.begin(); p!= A->_reals.end(); p++) _reals[p->first] = p->second; - for(map::const_iterator p = A->_bools.begin(); p!= A->_bools.end(); p++) _bools[p->first] = p->second; + for(map::const_iterator p = A->_ints.begin(); p!= A->_ints.end(); p++) + if(p->first.size()) _ints[p->first] = p->second; + for(map::const_iterator p = A->_reals.begin(); p!= A->_reals.end(); p++) + if(p->first.size()) _reals[p->first] = p->second; + for(map::const_iterator p = A->_bools.begin(); p!= A->_bools.end(); p++) + if(p->first.size()) _bools[p->first] = p->second; for(map::const_iterator p = A->_strings.begin(); p!= A->_strings.end(); p++) - _strings[p->first] = p->second; + if(p->first.size()) _strings[p->first] = p->second; for(map< string,vector >::const_iterator p = A->_realarrays.begin(); p!= A->_realarrays.end(); p++) - _realarrays[p->first] = p->second; + if(p->first.size()) _realarrays[p->first] = p->second; for(map< string,vector >::const_iterator p = A->_intarrays.begin(); p!= A->_intarrays.end(); p++) - _intarrays[p->first] = p->second; + if(p->first.size()) _intarrays[p->first] = p->second; for(map< string,vector >::const_iterator p = A->_strarrays.begin(); p!= A->_strarrays.end(); p++) - _strarrays[p->first] = p->second; + if(p->first.size()) _strarrays[p->first] = p->second; } //======================================================================= diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx index db54d1e1a..7267b3dfa 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx @@ -54,7 +54,7 @@ SALOMEDSImpl_AttributePythonObject::SALOMEDSImpl_AttributePythonObject() void SALOMEDSImpl_AttributePythonObject::SetObject(const TCollection_AsciiString& theSequence, const bool theScript) { - CheckLocked(); + CheckLocked(); Backup(); mySequence = theSequence; myIsScript = theScript; @@ -103,14 +103,11 @@ void SALOMEDSImpl_AttributePythonObject::Paste(const Handle(TDF_Attribute)& into TCollection_AsciiString SALOMEDSImpl_AttributePythonObject::Save() { - char* aString = (char*)GetObject().ToCString(); - char* aResult = new char[strlen(aString) + 2]; - aResult[0] = IsScript()?'s':'n'; - strcpy(aResult+1, aString); - TCollection_AsciiString ret(aResult); + TCollection_AsciiString aString = GetObject(); + TCollection_AsciiString aResult = IsScript()?'s':'n'; + aResult += aString; - delete aResult; - return ret; + return aResult; } void SALOMEDSImpl_AttributePythonObject::Load(const TCollection_AsciiString& value) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.cxx index 85cadc8ff..4e1bbc768 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.cxx @@ -68,7 +68,7 @@ Handle(SALOMEDSImpl_AttributeSelectable) SALOMEDSImpl_AttributeSelectable::Set ( SALOMEDSImpl_AttributeSelectable::SALOMEDSImpl_AttributeSelectable() :SALOMEDSImpl_GenericAttribute("AttributeSelectable") { - myValue = 0; + myValue = 1; } //======================================================================= diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx index 459b8b26e..8519394a9 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx @@ -133,6 +133,9 @@ void SALOMEDSImpl_AttributeSequenceOfInteger::ChangeValue(const Standard_Integer { CheckLocked(); Backup(); + + if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + myValue->SetValue(Index, Value); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -151,6 +154,9 @@ void SALOMEDSImpl_AttributeSequenceOfInteger::Remove(const Standard_Integer Inde { CheckLocked(); Backup(); + + if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + myValue->Remove(Index); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -162,6 +168,8 @@ Standard_Integer SALOMEDSImpl_AttributeSequenceOfInteger::Length() } Standard_Integer SALOMEDSImpl_AttributeSequenceOfInteger::Value(const Standard_Integer Index) { + if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + return myValue->Value(Index); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx index 1cad917f6..3d78ec633 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx @@ -132,6 +132,9 @@ void SALOMEDSImpl_AttributeSequenceOfReal::ChangeValue(const Standard_Integer In { CheckLocked(); Backup(); + + if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + myValue->SetValue(Index, Value); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -150,6 +153,9 @@ void SALOMEDSImpl_AttributeSequenceOfReal::Remove(const Standard_Integer Index) { CheckLocked(); Backup(); + + if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + myValue->Remove(Index); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -162,6 +168,7 @@ Standard_Integer SALOMEDSImpl_AttributeSequenceOfReal::Length() Standard_Real SALOMEDSImpl_AttributeSequenceOfReal::Value(const Standard_Integer Index) { + if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); return myValue->Value(Index); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx new file mode 100644 index 000000000..7a7ee76a9 --- /dev/null +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx @@ -0,0 +1,108 @@ +// Copyright (C) 2005 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 : SALOMEDSImpl_AttributeString.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDSImpl_AttributeString.hxx" + +#ifndef WNT +using namespace std; +#endif + +IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute ) +IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute ) + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& SALOMEDSImpl_AttributeString::GetID () +{ + static Standard_GUID CommentID ("1808A12F-AD0E-4a6a-B58A-395DCF469FE9"); + return CommentID; +} + +Handle(SALOMEDSImpl_AttributeString) SALOMEDSImpl_AttributeString::Set (const TDF_Label& L, + const TCollection_ExtendedString& Val) +{ + Handle(SALOMEDSImpl_AttributeString) A; + if (!L.FindAttribute(SALOMEDSImpl_AttributeString::GetID(), A)) { + A = new SALOMEDSImpl_AttributeString(); + L.AddAttribute(A); + } + + A->SetValue(Val); + + return A; +} + +//======================================================================= +//function : SetValue +//purpose : +//======================================================================= +void SALOMEDSImpl_AttributeString::SetValue (const TCollection_ExtendedString& S) +{ + CheckLocked(); + + if(myString == S) return; + + Backup(); + + myString = S; + + SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved +} + + +//======================================================================= +//function : ID +//purpose : +//======================================================================= +const Standard_GUID& SALOMEDSImpl_AttributeString::ID () const { return GetID(); } + +//======================================================================= +//function : NewEmpty +//purpose : +//======================================================================= +Handle(TDF_Attribute) SALOMEDSImpl_AttributeString::NewEmpty () const +{ + return new SALOMEDSImpl_AttributeString(); +} + +//======================================================================= +//function : Restore +//purpose : +//======================================================================= +void SALOMEDSImpl_AttributeString::Restore(const Handle(TDF_Attribute)& with) +{ + myString = Handle(SALOMEDSImpl_AttributeString)::DownCast (with)->Value (); +} + +//======================================================================= +//function : Paste +//purpose : +//======================================================================= + +void SALOMEDSImpl_AttributeString::Paste (const Handle(TDF_Attribute)& into, + const Handle(TDF_RelocationTable)& RT) const +{ + Handle(SALOMEDSImpl_AttributeString)::DownCast (into)->SetValue(myString); +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx new file mode 100644 index 000000000..ec0711106 --- /dev/null +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx @@ -0,0 +1,70 @@ +// Copyright (C) 2005 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 : SALOMEDSImpl_AttributeIOR.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef _SALOMEDSImpl_AttributeString_HeaderFile +#define _SALOMEDSImpl_AttributeString_HeaderFile + +#include +#include +#include +#include +#include +#include +#include "SALOMEDSImpl_GenericAttribute.hxx" + +class Handle(TDF_Attribute); +class Handle(TDF_RelocationTable); + +DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute ) + +class SALOMEDSImpl_AttributeString : public SALOMEDSImpl_GenericAttribute +{ +private: + + TCollection_ExtendedString myString; + +public: + +Standard_EXPORT static const Standard_GUID& GetID() ; + +Standard_EXPORT SALOMEDSImpl_AttributeString() :SALOMEDSImpl_GenericAttribute("AttributeString") {} + +Standard_EXPORT static Handle(SALOMEDSImpl_AttributeString) Set(const TDF_Label& L, const TCollection_ExtendedString& Val); +Standard_EXPORT void SetValue (const TCollection_ExtendedString& S); +Standard_EXPORT TCollection_ExtendedString Value() const { return myString; } + +Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; } +Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; } + +Standard_EXPORT const Standard_GUID& ID() const; +Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; +Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; +Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; + +Standard_EXPORT ~SALOMEDSImpl_AttributeString() {} + +public: + DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeString ) +}; + +#endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.hxx index 0cfa7fda5..1ae8c0b0d 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.hxx @@ -52,9 +52,9 @@ public: Standard_EXPORT static const Standard_GUID& GetID() ; Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTarget Set(const TDF_Label& label) ; Standard_EXPORT SALOMEDSImpl_AttributeTarget(); -Standard_EXPORT void SALOMEDSImpl_AttributeTarget::Add(const Handle(SALOMEDSImpl_SObject)& theSO); -Standard_EXPORT Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_AttributeTarget::Get(); -Standard_EXPORT void SALOMEDSImpl_AttributeTarget::Remove(const Handle(SALOMEDSImpl_SObject)& theSO); +Standard_EXPORT void Add(const Handle(SALOMEDSImpl_SObject)& theSO); +Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Get(); +Standard_EXPORT void Remove(const Handle(SALOMEDSImpl_SObject)& theSO); Standard_EXPORT TCollection_ExtendedString GetRelation() { return myRelation; } Standard_EXPORT void SetRelation(const TCollection_ExtendedString& theRelation); Standard_EXPORT TDF_AttributeList& GetVariables() { return myVariables; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.cxx index e62e998df..8250ff194 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.cxx @@ -49,7 +49,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeTextColor::GetID () SALOMEDSImpl_AttributeTextColor::SALOMEDSImpl_AttributeTextColor() :SALOMEDSImpl_GenericAttribute("AttributeTextColor") { - myValue = new TColStd_HArray1OfReal(1, 3, RealFirst()); + myValue = new TColStd_HArray1OfReal(1, 3, 0.); } //======================================================================= diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.cxx index 53428e371..cf9449d09 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.cxx @@ -50,7 +50,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeTextHighlightColor::GetID () SALOMEDSImpl_AttributeTextHighlightColor::SALOMEDSImpl_AttributeTextHighlightColor() :SALOMEDSImpl_GenericAttribute("AttributeTextHighlightColor") { - myValue = new TColStd_HArray1OfReal(1, 3, RealFirst()); + myValue = new TColStd_HArray1OfReal(1, 3, 0.); } //======================================================================= diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.cxx index 9a9776d30..8bc31e415 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.cxx @@ -87,6 +87,9 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Append (const Handle(SALOMEDSIm if (!(TN->ID() == myTreeID) ) Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Append : uncompatible GUID"); + if(TN->Label() == Label()) + Standard_Failure::Raise("Attempt of self linking"); + Handle(SALOMEDSImpl_AttributeTreeNode) bid; TN->SetNext(bid); // Deconnects from next. @@ -122,6 +125,9 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Prepend (const Handle(SALOMEDSI if (!(TN->ID() == myTreeID) ) Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Prepend : uncompatible GUID"); + if(TN->Label() == Label()) + Standard_Failure::Raise("Attempt of self linking"); + Handle(SALOMEDSImpl_AttributeTreeNode) bid; TN->SetPrevious(bid); if (HasFirst()) { @@ -151,6 +157,9 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertBefore (const Handle(SALO if (!(TN->ID() == myTreeID) ) Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertBefore : uncompatible GUID"); + if(TN->Label() == Label()) + Standard_Failure::Raise("Attempt of self linking"); + TN->SetFather(GetFather()); TN->SetPrevious(GetPrevious()); TN->SetNext(this); @@ -175,6 +184,9 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertAfter (const Handle(SALOM { CheckLocked(); + if(TN->Label() == Label()) + Standard_Failure::Raise("Attempt of self linking"); + if (!(TN->ID() == myTreeID) ) Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertAfter : uncompatible GUID"); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx index 118cdf3d8..1488961bf 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx @@ -24,8 +24,18 @@ #ifndef __SALOMEDSIMPL_ATTRIBUTES__H__ #define __SALOMEDSIMPL_ATTRIBUTES__H__ +#ifdef WNT +# ifdef SALOMEDSIMPL_EXPORTS +# define SALOMEDSIMPL_EXPORT __declspec( dllexport ) +# else +# define SALOMEDSIMPL_EXPORT __declspec( dllimport ) +# endif +#else +# define SALOMEDSIMPL_EXPORT +#endif + #include -class LockProtection +class SALOMEDSIMPL_EXPORT LockProtection { public : LockProtection(const char *message) { @@ -64,6 +74,7 @@ public : #include "SALOMEDSImpl_AttributeFlags.hxx" #include "SALOMEDSImpl_AttributeGraphic.hxx" #include "SALOMEDSImpl_AttributeParameter.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" #define __AttributeTypeToGUIDForSObject \ @@ -95,7 +106,8 @@ public : if(theType == "AttributeFlags") return SALOMEDSImpl_AttributeFlags::GetID(); \ if(theType == "AttributeGraphic") return SALOMEDSImpl_AttributeGraphic::GetID(); \ if(theType == "AttributeReference") return SALOMEDSImpl_AttributeReference::GetID(); \ - if(theType == "AttributeParameter") return SALOMEDSImpl_AttributeParameter::GetID(); + if(theType == "AttributeParameter") return SALOMEDSImpl_AttributeParameter::GetID(); \ + if(theType == "AttributeString") return SALOMEDSImpl_AttributeString::GetID(); #define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \ @@ -132,6 +144,7 @@ __FindOrCreateAttributeLocked(AttributeTableOfReal) \ __FindOrCreateAttributeLocked(AttributeTableOfString) \ __FindOrCreateAttributeLocked(AttributePythonObject) \ __FindOrCreateAttributeLocked(AttributeParameter) \ +__FindOrCreateAttributeLocked(AttributeString) \ __FindOrCreateAttribute(AttributePersistentRef) \ __FindOrCreateAttribute(AttributeDrawable) \ __FindOrCreateAttribute(AttributeSelectable) \ diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx index 8965e8f91..756df15c8 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx @@ -29,7 +29,7 @@ /*! Class which an interface to store the parameters of the objects */ -class SALOMEDSImpl_IParameters +class Standard_EXPORT SALOMEDSImpl_IParameters { public: SALOMEDSImpl_IParameters(const Handle(SALOMEDSImpl_AttributeParameter)& ap); @@ -76,12 +76,12 @@ public: /*! Returns all parameter names of the given entry */ - virtual std::vector SALOMEDSImpl_IParameters::getAllParameterNames(const std::string& entry); + virtual std::vector getAllParameterNames(const std::string& entry); /*! Returns all parameter values of the given entry */ - virtual std::vector SALOMEDSImpl_IParameters::getAllParameterValues(const std::string& entry); + virtual std::vector getAllParameterValues(const std::string& entry); /*! Returns a number of parameters of the given entry diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index 63b5c2c3a..28f8a0ff2 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -590,7 +590,7 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const return aResultSeq; } - TDF_ChildIterator anIter (aLabel, Standard_False); // iterate all subchildren at all sublevels + TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels for (; anIter.More(); anIter.Next()) { TDF_Label aLabel = anIter.Value(); Handle(SALOMEDSImpl_AttributeName) aName; @@ -624,7 +624,7 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(con return aResultSeq; } - TDF_ChildIterator anIter (aLabel, Standard_False); // iterate first-level children at all sublevels + TDF_ChildIterator anIter (aLabel, Standard_True); // iterate first-level children at all sublevels for (; anIter.More(); anIter.Next()) { TDF_Label aLabel = anIter.Value(); Handle(SALOMEDSImpl_AttributeLocalID) anID; @@ -665,7 +665,7 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TC return aResultSeq; } - TDF_ChildIterator anIter (aLabel, Standard_False); // iterate all subchildren at all sublevels + TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels for (; anIter.More(); anIter.Next()) { TDF_Label aLabel = anIter.Value(); Handle(SALOMEDSImpl_AttributeLocalID) anID; @@ -1635,3 +1635,21 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetLockerID() { return _lockers; } + +//============================================================================ +/*! Function : EnableUseCaseAutoFilling + * Purpose : + */ +//============================================================================ +void SALOMEDSImpl_Study::EnableUseCaseAutoFilling(bool isEnabled) +{ + _errorCode = ""; _autoFill = isEnabled; + if(isEnabled) { + _builder->SetOnAddSObject(_cb); + _builder->SetOnRemoveSObject(_cb); + } + else { + _builder->SetOnAddSObject(NULL); + _builder->SetOnRemoveSObject(NULL); + } +} \ No newline at end of file diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx index 3aac4acb4..449bd5a12 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx @@ -43,11 +43,7 @@ DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared ) #include #include #include -#ifndef WNT #include -#else -#include -#endif //SALOMEDSImpl headers #include "SALOMEDSImpl_SComponentIterator.hxx" @@ -64,13 +60,8 @@ DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared ) class SALOMEDSImpl_StudyManager; class SALOMEDSImpl_GenericAttribute; -#ifndef WNT typedef NCollection_DataMap DataMapOfAsciiStringTransient; typedef NCollection_DataMap DataMapAsciiStringLabel; -#else -typedef NCollection_DataMap1 DataMapOfAsciiStringTransient; -typedef NCollection_DataMap1 DataMapAsciiStringLabel; -#endif class SALOMEDSImpl_Study : public MMgt_TShared { @@ -219,7 +210,7 @@ public: Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject); - Standard_EXPORT virtual Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_Study::GetProperties(); + Standard_EXPORT virtual Handle(SALOMEDSImpl_AttributeStudyProperties) GetProperties(); Standard_EXPORT virtual TCollection_AsciiString GetLastModificationDate(); @@ -229,7 +220,7 @@ public: Standard_EXPORT virtual void Close(); - Standard_EXPORT void EnableUseCaseAutoFilling(bool isEnabled) { _errorCode = ""; _autoFill = isEnabled; } + Standard_EXPORT void EnableUseCaseAutoFilling(bool isEnabled); // postponed destroying of object functionality Standard_EXPORT virtual void AddPostponed(const TCollection_AsciiString& theIOR); @@ -288,6 +279,10 @@ public: //Returns an ID of the study locker Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetLockerID(); + //Returns a callback + Standard_EXPORT Handle(SALOMEDSImpl_Callback) GetCallback() { return _cb; } + + public: DEFINE_STANDARD_RTTI( SALOMEDSImpl_Study ) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index 05d9dec5e..f963a80c4 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -81,6 +81,9 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_StudyBuilder::NewComponent(const TC { _errorCode = ""; CheckLocked(); + + if(DataType.Length() == 0) return 0; + //Always create component under main label. TDF_Label L = _doc->Main(); @@ -482,7 +485,11 @@ Handle(TDF_Attribute) SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const Han } else { char* aGUIDString = new char[40]; char* aType = (char*)aTypeOfAttribute.ToCString(); - sprintf(aGUIDString, &(aType[21])); + sprintf(aGUIDString, &(aType[17])); + if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) { + delete(aGUIDString); + return NULL; + } aTreeNodeGUID = Standard_GUID(aGUIDString); // create tree node GUID by name delete(aGUIDString); } @@ -495,10 +502,24 @@ Handle(TDF_Attribute) SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const Han } if (strncmp(aTypeOfAttribute.ToCString(), "AttributeUserID",15) == 0 ) { + Standard_GUID aUserGUID; + if (strcmp(aTypeOfAttribute.ToCString(), "AttributeUserID") == 0) { + aUserGUID = SALOMEDSImpl_AttributeUserID::DefaultID(); + } else { + char* aGUIDString = new char[40]; + char* aType = (char*)aTypeOfAttribute.ToCString(); + sprintf(aGUIDString, &(aType[15])); + if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) { + delete(aGUIDString); + return NULL; + } + aUserGUID = Standard_GUID(aGUIDString); // create tree node GUID by name + delete(aGUIDString); + } Handle(SALOMEDSImpl_AttributeUserID) anAttr; if (!Lab.FindAttribute(SALOMEDSImpl_AttributeUserID::DefaultID(), anAttr)) { CheckLocked(); - anAttr = SALOMEDSImpl_AttributeUserID::Set(Lab, SALOMEDSImpl_AttributeUserID::DefaultID()); + anAttr = SALOMEDSImpl_AttributeUserID::Set(Lab, aUserGUID); } return anAttr; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx index 0cde58ca0..dd91556cd 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx @@ -56,9 +56,6 @@ IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared ) IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyManager, MMgt_TShared ) #define USE_CASE_LABEL_ID "0:2" -#define AUTO_SAVE_GUID "128268A3-71C9-4036-89B1-F81BD6A4FCF2" -#define AUTO_SAVE_TAG "0:8" -#define AUTO_SAVE_TIME_OUT_IN_SECONDS 1200 static void SaveAttributes(Handle(SALOMEDSImpl_SObject) SO, HDFgroup *hdf_group_sobject); static void ReadAttributes(const Handle(SALOMEDSImpl_Study)&, const Handle(SALOMEDSImpl_SObject)&, HDFdataset* ); @@ -558,11 +555,8 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, SALOMEDSImpl_SComponentIterator itcomponent = aStudy->NewComponentIterator(); - //SRN: Added 17 Nov, 2003 - Handle(SALOMEDSImpl_SObject) anAutoSaveSO = aStudy->FindObjectID(AUTO_SAVE_TAG); - //SRN: End for (; itcomponent.More(); itcomponent.Next()) - { + { Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value(); TCollection_AsciiString scoid = sco->GetID(); @@ -570,46 +564,6 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, hdf_sco_group->CreateOnDisk(); TCollection_AsciiString componentDataType = sco->ComponentDataType(); - - //SRN: Added 17 Nov 2003: If there is a specified attribute, the component peforms a special save - if(!anAutoSaveSO.IsNull() && SB->IsGUID(sco, AUTO_SAVE_GUID)) { - - Handle(SALOMEDSImpl_AttributeTableOfString) aTable; - if(anAutoSaveSO->GetLabel().FindAttribute(SALOMEDSImpl_AttributeTableOfString::GetID(), aTable)) { - Standard_Integer nbRows = aTable->GetNbRows(), k, aTimeOut = 0; - if(nbRows > 0 && aTable->GetNbColumns() > 1) { - - Handle(TColStd_HSequenceOfExtendedString) aRow; - for(k=1; k<=nbRows; k++) { - aRow = aTable->GetRowData(k); - if (aRow->Value(1) == componentDataType) { - TCollection_AsciiString anEntry = TCollection_AsciiString(aRow->Value(2)); - Handle(SALOMEDSImpl_SObject) aCompSpecificSO = aStudy->FindObjectID(anEntry); - if(!aCompSpecificSO.IsNull()) { - Handle(SALOMEDSImpl_AttributeInteger) anInteger; - if(aCompSpecificSO->GetLabel().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anInteger)) { - anInteger->SetValue(-1); - while(anInteger->Value() < 0) { -#ifndef WNT - sleep(2); -#else - Sleep(2); -#endif - if(++aTimeOut > AUTO_SAVE_TIME_OUT_IN_SECONDS) - break; - } - } // if(aCompSpecificSO->FindAttribute(anInteger, "AttributeInteger")) - } // if(!CORBA::is_nil(aCompSpecificSO)) - } // if (strcmp(aRow[0], componentDataType) == 0) - } // for - - } // if(nbRows > 0 && aTable->GetNbColumns() > 1) - - } // if(anAutoSaveSO->FindAttribute(aTable, "AttributeTableOfString") - - } // if(SB->IsGUID(AUTO_SAVE_GUID) - - //SRN: End TCollection_AsciiString IOREngine; if (sco->ComponentIOR(IOREngine)) { diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx index b59e16837..651673e9c 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx @@ -34,11 +34,11 @@ struct SALOMEDSImpl_TMPFile : public MMgt_TShared { typedef unsigned char TOctet; - virtual size_t Size() = 0; + Standard_EXPORT virtual size_t Size() = 0; - virtual TOctet* Data(); + Standard_EXPORT virtual TOctet* Data(); - virtual TOctet& Get(size_t) = 0; + Standard_EXPORT virtual TOctet& Get(size_t) = 0; DEFINE_STANDARD_RTTI( SALOMEDSImpl_TMPFile ); }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx index 46529552b..4755e3c07 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx @@ -156,7 +156,12 @@ TCollection_AsciiString SALOMEDSImpl_Tool::GetNameFromPath(const TCollection_Asc TCollection_AsciiString SALOMEDSImpl_Tool::GetDirFromPath(const TCollection_AsciiString& thePath) { if (thePath.IsEmpty()) return ""; OSD_Path aPath = OSD_Path(thePath); - TCollection_AsciiString aDirString(aPath.Trek()); + TCollection_AsciiString aDirString; + /*Unix platform don't use assignment in string + but we must to add it for WNT case*/ + TCollection_AsciiString disk = aPath.Disk(); + if(disk.Length()) aDirString.AssignCat(disk); + aDirString.AssignCat(aPath.Trek()); aDirString.ChangeAll('|','/'); return aDirString; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx index 6a20fec57..3f6f339ce 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx @@ -165,6 +165,8 @@ bool SALOMEDSImpl_UseCaseBuilder::AppendTo(const Handle(SALOMEDSImpl_SObject)& t if(_root.IsNull() || theFather.IsNull() || theObject.IsNull()) return false; TDF_Label aFatherLabel = theFather->GetLabel(), aLabel = theObject->GetLabel(); + if(aFatherLabel == aLabel) return false; + Handle(SALOMEDSImpl_AttributeTreeNode) aFather, aNode; if(aFatherLabel.IsNull()) return false; @@ -191,6 +193,8 @@ bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const Handle(SALOMEDSImpl_SObject if(_root.IsNull() || theFirst.IsNull() || theNext.IsNull()) return false; TDF_Label aFirstLabel = theFirst->GetLabel(), aLabel= theNext->GetLabel(); + if(aFirstLabel == aLabel) return false; + Handle(SALOMEDSImpl_AttributeTreeNode) aFirstNode, aNode; if(aFirstLabel.IsNull()) return false; @@ -320,7 +324,7 @@ TCollection_AsciiString SALOMEDSImpl_UseCaseBuilder::GetName() { TCollection_AsciiString aString; if(_root.IsNull()) return aString; - + Handle(SALOMEDSImpl_AttributeName) aName; if (!_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) return aString; aString = TCollection_AsciiString(aName->Value()); diff --git a/src/SALOMELocalTrace/BaseTraceCollector.cxx b/src/SALOMELocalTrace/BaseTraceCollector.cxx index 1c34fbd4e..5980a4075 100644 --- a/src/SALOMELocalTrace/BaseTraceCollector.cxx +++ b/src/SALOMELocalTrace/BaseTraceCollector.cxx @@ -37,7 +37,12 @@ using namespace std; // Class attributes initialisation, for class method BaseTraceCollector::run BaseTraceCollector* BaseTraceCollector::_singleton = 0; -pthread_mutex_t BaseTraceCollector::_singletonMutex = PTHREAD_MUTEX_INITIALIZER ; +#ifndef WNT +pthread_mutex_t BaseTraceCollector::_singletonMutex; +#else +pthread_mutex_t BaseTraceCollector::_singletonMutex = + PTHREAD_MUTEX_INITIALIZER; +#endif sem_t BaseTraceCollector::_sem; int BaseTraceCollector::_threadToClose = 0; pthread_t* BaseTraceCollector::_threadId = 0; // used to control single run diff --git a/src/SALOMELocalTrace/BaseTraceCollector.hxx b/src/SALOMELocalTrace/BaseTraceCollector.hxx index c9303ed28..af3fbc06d 100644 --- a/src/SALOMELocalTrace/BaseTraceCollector.hxx +++ b/src/SALOMELocalTrace/BaseTraceCollector.hxx @@ -27,24 +27,11 @@ #ifndef _BASETRACECOLLECTOR_HXX_ #define _BASETRACECOLLECTOR_HXX_ +#include "SALOME_LocalTrace.hxx" + #include #include - -#if defined SALOMELOCALTRACE_EXPORTS -#if defined WIN32 -#define SALOMELOCALTRACE_EXPORT __declspec( dllexport ) -#else -#define SALOMELOCALTRACE_EXPORT -#endif -#else -#if defined WNT -#define SALOMELOCALTRACE_EXPORT __declspec( dllimport ) -#else -#define SALOMELOCALTRACE_EXPORT -#endif -#endif - //! See derived Classes in SALOMELocalTrace for usage without CORBA, //! see derived Classes in SALOMETraceCollector for usage with CORBA. diff --git a/src/SALOMELocalTrace/FileTraceCollector.cxx b/src/SALOMELocalTrace/FileTraceCollector.cxx index f648dbead..f76e18ef6 100644 --- a/src/SALOMELocalTrace/FileTraceCollector.cxx +++ b/src/SALOMELocalTrace/FileTraceCollector.cxx @@ -64,7 +64,7 @@ BaseTraceCollector* FileTraceCollector::instance(const char *fileName) sem_init(&_sem,0,0); // to wait until run thread is initialized pthread_t traceThread; - int bid; + int bid = 0; int re2 = pthread_create(&traceThread, NULL, FileTraceCollector::run, (void *)bid); sem_wait(&_sem); diff --git a/src/SALOMELocalTrace/FileTraceCollector.hxx b/src/SALOMELocalTrace/FileTraceCollector.hxx index 13356627f..96a503d7b 100644 --- a/src/SALOMELocalTrace/FileTraceCollector.hxx +++ b/src/SALOMELocalTrace/FileTraceCollector.hxx @@ -27,6 +27,8 @@ #ifndef _FILETRACECOLLECTOR_HXX_ #define _FILETRACECOLLECTOR_HXX_ +#include "SALOME_LocalTrace.hxx" + #include #include "LocalTraceBufferPool.hxx" #include "BaseTraceCollector.hxx" diff --git a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx index 14f07cf6a..06726877c 100644 --- a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx +++ b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx @@ -31,6 +31,7 @@ #ifndef WNT #include #else +#include #endif //#define _DEVDEBUG_ @@ -92,11 +93,17 @@ LocalTraceBufferPool* LocalTraceBufferPool::instance() // --- start a trace Collector - char* traceKind = getenv("SALOME_trace"); + char* traceKind; + bool isNotDefined = false; + if ( getenv("SALOME_trace") ) + traceKind = getenv("SALOME_trace"); + else + isNotDefined = true; // mkr : 27.11.2006 : PAL13967 - Distributed supervision graphs - Problem with "SALOME_trace" + assert(traceKind); //cerr<<"SALOME_trace="< #include "LocalTraceBufferPool.hxx" #include "BaseTraceCollector.hxx" diff --git a/src/SALOMELocalTrace/Makefile.am b/src/SALOMELocalTrace/Makefile.am index 658fa2274..f49994211 100644 --- a/src/SALOMELocalTrace/Makefile.am +++ b/src/SALOMELocalTrace/Makefile.am @@ -31,7 +31,8 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am salomeinclude_HEADERS = \ utilities.h \ LocalTraceBufferPool.hxx \ - BaseTraceCollector.hxx + BaseTraceCollector.hxx \ + SALOME_LocalTrace.hxx lib_LTLIBRARIES = libSALOMELocalTrace.la @@ -43,7 +44,8 @@ libSALOMELocalTrace_la_SOURCES = \ FileTraceCollector.cxx \ FileTraceCollector.hxx \ LocalTraceBufferPool.cxx \ - LocalTraceBufferPool.hxx + LocalTraceBufferPool.hxx \ + SALOME_LocalTrace.hxx libSALOMELocalTrace_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSALOMELocalTrace_la_CPPFLAGS = -I$(srcdir)/../Basics diff --git a/src/SALOMELocalTrace/SALOME_LocalTrace.hxx b/src/SALOMELocalTrace/SALOME_LocalTrace.hxx new file mode 100755 index 000000000..7ce182f86 --- /dev/null +++ b/src/SALOMELocalTrace/SALOME_LocalTrace.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_LocalTrace.hxx +// Author : Alexander A. BORODIN +// Module : SALOME + +#ifndef _SALOME_LOCALTRACE_HXX_ +#define _SALOME_LOCALTRACE_HXX_ + +#ifdef WNT + #if defined SALOMELOCALTRACE_EXPORTS + #if defined WIN32 + #define SALOMELOCALTRACE_EXPORT __declspec( dllexport ) + #else + #define SALOMELOCALTRACE_EXPORT + #endif + #else + #if defined WIN32 + #define SALOMELOCALTRACE_EXPORT __declspec( dllimport ) + #else + #define SALOMELOCALTRACE_EXPORT + #endif + #endif +#else + #define SALOMELOCALTRACE_EXPORT +#endif + +#endif \ No newline at end of file diff --git a/src/SALOMETraceCollector/SALOMETraceCollector.cxx b/src/SALOMETraceCollector/SALOMETraceCollector.cxx index 7cf404c26..408c56d87 100644 --- a/src/SALOMETraceCollector/SALOMETraceCollector.cxx +++ b/src/SALOMETraceCollector/SALOMETraceCollector.cxx @@ -28,7 +28,7 @@ #include #include #include -#include +#include using namespace std; @@ -67,7 +67,7 @@ BaseTraceCollector* SALOMETraceCollector::instance() sem_init(&_sem,0,0); // to wait until run thread is initialized pthread_t traceThread; - int bid; + int bid = 0; int re2 = pthread_create(&traceThread, NULL, SALOMETraceCollector::run, (void *)bid); sem_wait(&_sem); @@ -217,6 +217,7 @@ SALOMETraceCollector::SALOMETraceCollector() extern "C" { + SALOMETRACECOLLECTOR_EXPORT BaseTraceCollector *SingletonInstance(void) { BaseTraceCollector *instance = SALOMETraceCollector::instance(); diff --git a/src/SALOMETraceCollector/SALOMETraceCollector.hxx b/src/SALOMETraceCollector/SALOMETraceCollector.hxx index 442143bfd..58e069efd 100644 --- a/src/SALOMETraceCollector/SALOMETraceCollector.hxx +++ b/src/SALOMETraceCollector/SALOMETraceCollector.hxx @@ -28,25 +28,21 @@ #define _SALOMETRACECOLLECTOR_HXX_ #include -#include +#include #include "BaseTraceCollector.hxx" #include "LocalTraceBufferPool.hxx" //! See LocalTraceCollector instead of SALOMETraceCollector, //! for usage without CORBA -#if defined SALOMETRACECOLLECTOR_EXPORTS -#if defined WIN32 -#define SALOMETRACECOLLECTOR_EXPORT __declspec( dllexport ) -#else -#define SALOMETRACECOLLECTOR_EXPORT -#endif -#else #if defined WNT -#define SALOMETRACECOLLECTOR_EXPORT __declspec( dllimport ) +# if defined SALOMETRACECOLLECTOR_EXPORTS +# define SALOMETRACECOLLECTOR_EXPORT __declspec( dllexport ) +# else +# define SALOMETRACECOLLECTOR_EXPORT +# endif #else -#define SALOMETRACECOLLECTOR_EXPORT -#endif +# define SALOMETRACECOLLECTOR_EXPORT #endif class SALOMETRACECOLLECTOR_EXPORT SALOMETraceCollector: diff --git a/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.hxx b/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.hxx index 0bcea5ec2..e7a59bdc3 100644 --- a/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.hxx +++ b/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.hxx @@ -27,7 +27,7 @@ #ifndef _TRACECOLLECTOR_WAITFORSERVERREADINESS_HXX_ #define _TRACECOLLECTOR_WAITFORSERVERREADINESS_HXX_ -#include +#include #include CORBA::Object_ptr TraceCollector_WaitForServerReadiness(CORBA::ORB_ptr theOrb, diff --git a/src/TOOLSDS/SALOMEDS_Tool.cxx b/src/TOOLSDS/SALOMEDS_Tool.cxx index d0c40386c..e67c96a5e 100644 --- a/src/TOOLSDS/SALOMEDS_Tool.cxx +++ b/src/TOOLSDS/SALOMEDS_Tool.cxx @@ -48,6 +48,7 @@ #endif #include +#include #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) using namespace std; @@ -103,7 +104,8 @@ std::string SALOMEDS_Tool::GetTmpDir() MESSAGE("#### TMP" << aTmpDir.ToCString()); - OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX); + //OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX); + OSD_Protection aProtection(OSD_RWXD, OSD_RWX, OSD_RX, OSD_RX ); aDir.Build(aProtection); return aTmpDir.ToCString(); @@ -129,7 +131,8 @@ void SALOMEDS_Tool::RemoveTemporaryFiles(const std::string& theDirectory, if(!anOSDFile.Exists()) continue; OSD_Protection aProtection = anOSDFile.Protection(); - aProtection.SetUser(OSD_RW); + aProtection.SetUser(OSD_RWD); + //aProtection.SetSystem(OSD_RW); anOSDFile.SetProtection(aProtection); anOSDFile.Remove(); @@ -138,9 +141,13 @@ void SALOMEDS_Tool::RemoveTemporaryFiles(const std::string& theDirectory, if(IsDirDeleted) { OSD_Path aPath(aDirName); OSD_Directory aDir(aPath); - OSD_FileIterator anIterator(aPath, '*'); + OSD_FileIterator* anIterator = new OSD_FileIterator(aPath, '*'); - if(aDir.Exists() && !anIterator.More()) aDir.Remove(); + if(aDir.Exists() && !anIterator->More()) + { + delete anIterator; + aDir.Remove(); + } } } @@ -325,7 +332,11 @@ SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream, aCurrentPos += 8; TCollection_AsciiString aFullPath = aTmpDir + aFileName; +#ifdef WNT + ofstream aFile(aFullPath.ToCString(), ios::binary); +#else ofstream aFile(aFullPath.ToCString()); +#endif aFile.write((char *)(aBuffer+aCurrentPos), aFileSize); aFile.close(); aCurrentPos += aFileSize; diff --git a/src/TOOLSDS/SALOMEDS_Tool.hxx b/src/TOOLSDS/SALOMEDS_Tool.hxx index cbae543c0..0c57ace2e 100644 --- a/src/TOOLSDS/SALOMEDS_Tool.hxx +++ b/src/TOOLSDS/SALOMEDS_Tool.hxx @@ -36,14 +36,25 @@ #include CORBA_SERVER_HEADER(SALOMEDS) #ifdef WNT -#include + #if defined TOOLSDS_EXPORTS + #if defined WIN32 + #define TOOLSDS_EXPORT __declspec( dllexport ) + #else + #define TOOLSDS_EXPORT + #endif + #else + #if defined WIN32 + #define TOOLSDS_EXPORT __declspec( dllimport ) + #else + #define TOOLSDS_EXPORT + #endif + #endif #else -#define SALOME_WNT_EXPORT + #define TOOLSDS_EXPORT #endif -class SALOME_WNT_EXPORT SALOMEDS_Tool +class TOOLSDS_EXPORT SALOMEDS_Tool { - public: // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set diff --git a/src/TestContainer/SALOME_TestComponent_i.cxx b/src/TestContainer/SALOME_TestComponent_i.cxx index 2a6ebf223..cb37b7828 100644 --- a/src/TestContainer/SALOME_TestComponent_i.cxx +++ b/src/TestContainer/SALOME_TestComponent_i.cxx @@ -26,7 +26,9 @@ // Module : SALOME // $Header$ -#define private protected +#ifndef WNT +# define private protected +#endif #include "utilities.h" #include "SALOME_TestComponent_i.hxx" #include @@ -44,7 +46,7 @@ Engines_TestComponent_i::Engines_TestComponent_i(CORBA::ORB_ptr orb, MESSAGE("activate object"); _thisObj = this ; _id = _poa->activate_object(_thisObj); - SCRUTE(pd_refCount); + SCRUTE(_pd_refCount); } Engines_TestComponent_i::Engines_TestComponent_i() @@ -60,7 +62,7 @@ char* Engines_TestComponent_i::Coucou(CORBA::Long L) { char s[100]; sprintf(s, "TestComponent_i : L = %ld", (long) L); - SCRUTE(pd_refCount); + SCRUTE(_pd_refCount); return CORBA::string_dup(s); } diff --git a/src/TestContainer/SALOME_TestComponent_i.hxx b/src/TestContainer/SALOME_TestComponent_i.hxx index 303a6a3f7..8bac7eecb 100644 --- a/src/TestContainer/SALOME_TestComponent_i.hxx +++ b/src/TestContainer/SALOME_TestComponent_i.hxx @@ -30,9 +30,11 @@ #define _SALOME_TESTCOMPONENT_I_HXX_ #include + +#include "SALOME_Component_i.hxx" + #include #include CORBA_SERVER_HEADER(SALOME_TestComponent) -#include "SALOME_Component_i.hxx" class Engines_TestComponent_i: public POA_Engines::TestComponent, diff --git a/src/TestContainer/TestComponentPy.py b/src/TestContainer/TestComponentPy.py index 4cfa5b896..d48e43853 100755 --- a/src/TestContainer/TestComponentPy.py +++ b/src/TestContainer/TestComponentPy.py @@ -34,6 +34,7 @@ import string from omniORB import CORBA import CosNaming import Engines +from Utils_Identity import getShortHostName #initialise the ORB @@ -48,8 +49,7 @@ if rootContext is None: sys.exit(1) #resolve the name /Containers.dir/FactoryServerPy.object -myMachine=string.split(os.getenv( "HOSTNAME" ),'.') -machineName= myMachine[0] +machineName=getShortHostName() containerName = "FactoryServerPy" name = [CosNaming.NameComponent("Containers","dir"), CosNaming.NameComponent(machineName,"dir"), diff --git a/src/Utils/Makefile.am b/src/Utils/Makefile.am index aac6dea13..f0c0dd785 100644 --- a/src/Utils/Makefile.am +++ b/src/Utils/Makefile.am @@ -41,7 +41,8 @@ salomeinclude_HEADERS =\ Utils_SINGLETON.hxx \ Utils_DESTRUCTEUR_GENERIQUE.hxx \ Utils_ExceptHandlers.hxx \ - Utils_Mutex.hxx + Utils_Mutex.hxx \ + SALOME_Utils.hxx # Scripts to be exported dist_salomescript_DATA =\ diff --git a/src/Utils/OpUtil.hxx b/src/Utils/OpUtil.hxx index 9673925cd..ba5d5eb42 100644 --- a/src/Utils/OpUtil.hxx +++ b/src/Utils/OpUtil.hxx @@ -27,19 +27,7 @@ #ifndef _OPUTIL_HXX #define _OPUTIL_HXX -#if defined UTILS_EXPORTS -#if defined WIN32 -#define UTILS_EXPORT __declspec( dllexport ) -#else -#define UTILS_EXPORT -#endif -#else -#if defined WNT -#define UTILS_EXPORT __declspec( dllimport ) -#else -#define UTILS_EXPORT -#endif -#endif +#include #include diff --git a/src/Utils/SALOME_Utils.hxx b/src/Utils/SALOME_Utils.hxx new file mode 100755 index 000000000..d6c28d278 --- /dev/null +++ b/src/Utils/SALOME_Utils.hxx @@ -0,0 +1,39 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_Utils.hxx +// Author : Alexander A. BORODIN +// Module : SALOME + +#ifndef _SALOME_UTILS_HXX_ +#define _SALOME_UTILS_HXX_ + +#ifdef WNT +# if defined UTILS_EXPORTS +# define UTILS_EXPORT __declspec( dllexport ) +# else +# define UTILS_EXPORT __declspec( dllimport ) +# endif +#else +# define UTILS_EXPORT +#endif + +#endif diff --git a/src/Utils/SalomeString.hxx b/src/Utils/SalomeString.hxx index b751edb9b..eaee786cd 100644 --- a/src/Utils/SalomeString.hxx +++ b/src/Utils/SalomeString.hxx @@ -27,10 +27,12 @@ # ifndef SALOME_STRING # define SALOME_STRING +#include "SALOME_Utils.hxx" + # include # include -class SALOME_STRING : public string +class UTILS_EXPORT SALOME_STRING : public string { private : ostringstream _s ; diff --git a/src/Utils/Utils_CommException.hxx b/src/Utils/Utils_CommException.hxx index 38d753679..4a07615d9 100644 --- a/src/Utils/Utils_CommException.hxx +++ b/src/Utils/Utils_CommException.hxx @@ -29,7 +29,9 @@ # if !defined ( __Utils_CommException_H__ ) # define __Utils_CommException_H__ ) -# include "Utils_SALOME_Exception.hxx" +#include "SALOME_Utils.hxx" + +#include "Utils_SALOME_Exception.hxx" class UTILS_EXPORT CommException : public SALOME_Exception { diff --git a/src/Utils/Utils_CorbaException.hxx b/src/Utils/Utils_CorbaException.hxx index 2142c8bed..c5c8f033e 100644 --- a/src/Utils/Utils_CorbaException.hxx +++ b/src/Utils/Utils_CorbaException.hxx @@ -29,6 +29,8 @@ #ifndef _UTILS_CORBAEXCEPTION_HXX_ #define _UTILS_CORBAEXCEPTION_HXX_ +#include "SALOME_Utils.hxx" + #include #include CORBA_SERVER_HEADER(SALOME_Exception) diff --git a/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx b/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx index 58f168b9d..a2544b6ce 100644 --- a/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx +++ b/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx @@ -29,9 +29,11 @@ # if !defined( __DESTRUCTEUR_GENERIQUE__H__ ) # define __DESTRUCTEUR_GENERIQUE__H__ -# include +#include "SALOME_Utils.hxx" + +#include #include -# include +#include //# include "utilities.h" /*!\class DESTRUCTEUR_GENERIQUE_ @@ -55,29 +57,15 @@ * -# an object method to execute the destruction : operator()(). */ -#if defined UTILS_EXPORTS -#if defined WIN32 -#define UTILS_EXPORT __declspec( dllexport ) -#else -#define UTILS_EXPORT -#endif -#else -#if defined WNT -#define UTILS_EXPORT __declspec( dllimport ) -#else -#define UTILS_EXPORT -#endif -#endif - -class DESTRUCTEUR_GENERIQUE_ +class UTILS_EXPORT DESTRUCTEUR_GENERIQUE_ { public : - UTILS_EXPORT static std::list *Destructeurs; + static std::list *Destructeurs; virtual ~DESTRUCTEUR_GENERIQUE_() {}//!< virtual destructor - UTILS_EXPORT static const int Ajout( DESTRUCTEUR_GENERIQUE_ &objet );//!< adds a destruction object to the list of destructions - UTILS_EXPORT virtual void operator()( void )=0 ;//!< performs the destruction -} ; + static const int Ajout( DESTRUCTEUR_GENERIQUE_ &objet );//!< adds a destruction object to the list of destructions + virtual void operator()( void )=0 ;//!< performs the destruction +}; /*!\class DESTRUCTEUR_DE_ diff --git a/src/Utils/Utils_ExceptHandlers.hxx b/src/Utils/Utils_ExceptHandlers.hxx index 45f4a5754..8ac5aa8e5 100644 --- a/src/Utils/Utils_ExceptHandlers.hxx +++ b/src/Utils/Utils_ExceptHandlers.hxx @@ -29,21 +29,9 @@ #ifndef Utils_ExceptHandlers_HeaderFile #define Utils_ExceptHandlers_HeaderFile -#include +#include -#if defined UTILS_EXPORTS -#if defined WIN32 -#define UTILS_EXPORT __declspec( dllexport ) -#else -#define UTILS_EXPORT -#endif -#else -#if defined WNT -#define UTILS_EXPORT __declspec( dllimport ) -#else -#define UTILS_EXPORT -#endif -#endif +#include typedef void (*PVF)(); diff --git a/src/Utils/Utils_Identity.cxx b/src/Utils/Utils_Identity.cxx index 661cebbcc..41e24858d 100644 --- a/src/Utils/Utils_Identity.cxx +++ b/src/Utils/Utils_Identity.cxx @@ -83,23 +83,45 @@ const char* duplicate( const char *const str ) ; const char* get_uname( void ) { - char* hostName = new char[256]; - DWORD nSize = 256; - ASSERT(GetComputerName(hostName, &nSize)); - return hostName; + static std::string hostName(256, 0); + static DWORD nSize = hostName.length(); + static int res = ::GetComputerNameEx(ComputerNameDnsFullyQualified, &hostName[0], &nSize); + ASSERT( res ); + return hostName.c_str(); } const char* get_adip( void ) { - return get_uname(); + //#include + //#include + //static GUID sType = SVCID_HOSTNAME; + //static CSADDR_INFO* ips = new CSADDR_INFO[8]; // in case multiple IP addresses are returned + //static DWORD nSize = 1024; + //static std::string uname = get_uname(); + //static int res = ::GetAddressByName( NS_DEFAULT, &sType, &uname[0], 0, 0, 0, ips, &nSize, 0, 0 ); + //if ( res ) + // return ips[0].LocalAddr.lpSockaddr->sa_data; + + static hostent* he = ::gethostbyname( get_uname() ); + if ( he && he->h_addr_list && he->h_length >0 ) { + static char str[16]; + unsigned i1 = (unsigned char)he->h_addr_list[0][0]; + unsigned i2 = (unsigned char)he->h_addr_list[0][1]; + unsigned i3 = (unsigned char)he->h_addr_list[0][2]; + unsigned i4 = (unsigned char)he->h_addr_list[0][3]; + sprintf ( str, "%03u.%03u.%03u.%03u", i1, i2, i3, i4 ); + return str; + } + return ""; } const char* const get_pwname( void ) { - DWORD dwSize = 256 + 1; - char* retVal = new char[256]; - ASSERT(GetUserName ( retVal, &dwSize )); - return retVal; + static std::string retVal(256, 0); + static DWORD dwSize = retVal.length() + 1; + static int res = GetUserName( &retVal[0], &dwSize ); + ASSERT( res ); + return retVal.c_str(); } PSID getuid() { @@ -149,9 +171,14 @@ Identity::~Identity(void) //delete [] (char*)_dir ; //(char*&)_dir = NULL ; free((char*)_dir); - +#ifndef WIN32 + // free the memory only on Unix + // becasue at Windows it is the same static variable + // (function get_adip() returns the same char* as get_uname() ) delete [] (char*)_adip ; +#endif (char*&)_adip = NULL ; + } /*------------*/ diff --git a/src/Utils/Utils_Identity.hxx b/src/Utils/Utils_Identity.hxx index c6fd7e40c..5e508a47f 100644 --- a/src/Utils/Utils_Identity.hxx +++ b/src/Utils/Utils_Identity.hxx @@ -29,6 +29,8 @@ # if !defined( __IDENTITE_H__ ) # define __IDENTITE_H__ +#include + extern "C" { # include @@ -41,19 +43,6 @@ extern "C" #endif } -#if defined UTILS_EXPORTS -#if defined WIN32 -#define UTILS_EXPORT __declspec( dllexport ) -#else -#define UTILS_EXPORT -#endif -#else -#if defined WNT -#define UTILS_EXPORT __declspec( dllimport ) -#else -#define UTILS_EXPORT -#endif -#endif class UTILS_EXPORT Identity { diff --git a/src/Utils/Utils_Identity.py b/src/Utils/Utils_Identity.py index 8be6e2c00..d826b06b9 100644 --- a/src/Utils/Utils_Identity.py +++ b/src/Utils/Utils_Identity.py @@ -31,7 +31,10 @@ import sys import os import socket -import pwd + +if not sys.platform == "win32": + import pwd + import time import string @@ -50,10 +53,15 @@ class Identity: self._name = name self._pid = os.getpid() self._machine = socket.gethostname() - self._adip = socket.gethostbyname(self._machine) # IP adress - self._uid = os.getuid() - list = pwd.getpwuid(self._uid) - self._pwname = list[0] # user name + self._adip = socket.gethostbyname(self._machine) # IP adress + if sys.platform == "win32": + self._uid = os.getpid() + self._pwname = os.environ["USER"] + else: + self._uid = os.getuid() + list = pwd.getpwuid(self._uid) + self._pwname = list[0] # user name + self._tc_start = time.time() self._cstart = time.ctime(self._tc_start) self._cdir = os.getcwd() diff --git a/src/Utils/Utils_Mutex.hxx b/src/Utils/Utils_Mutex.hxx index c6d274180..a9e78653f 100644 --- a/src/Utils/Utils_Mutex.hxx +++ b/src/Utils/Utils_Mutex.hxx @@ -28,21 +28,9 @@ #ifndef Utils_Mutex_HeaderFile #define Utils_Mutex_HeaderFile -#include +#include "SALOME_Utils.hxx" -#if defined UTILS_EXPORTS -#if defined WIN32 -#define UTILS_EXPORT __declspec( dllexport ) -#else -#define UTILS_EXPORT -#endif -#else -#if defined WNT -#define UTILS_EXPORT __declspec( dllimport ) -#else -#define UTILS_EXPORT -#endif -#endif +#include class UTILS_EXPORT Utils_Mutex { diff --git a/src/Utils/Utils_ORB_INIT.hxx b/src/Utils/Utils_ORB_INIT.hxx index 8ec2770f1..672d630c3 100644 --- a/src/Utils/Utils_ORB_INIT.hxx +++ b/src/Utils/Utils_ORB_INIT.hxx @@ -29,24 +29,11 @@ # if ! defined( __ORB_INIT_HXX__ ) # define __ORB_INIT_HXX__ -# include "CORBA.h" - -#include "Utils_CommException.hxx" +#include "SALOME_Utils.hxx" +#include "omniORB4/CORBA.h" -#if defined UTILS_EXPORTS -#if defined WIN32 -#define UTILS_EXPORT __declspec( dllexport ) -#else -#define UTILS_EXPORT -#endif -#else -#if defined WNT -#define UTILS_EXPORT __declspec( dllimport ) -#else -#define UTILS_EXPORT -#endif -#endif +#include "Utils_CommException.hxx" /*! * Ce composant prend en charge la connexion et la deconnexion a l'orb diff --git a/src/Utils/Utils_SALOME_Exception.hxx b/src/Utils/Utils_SALOME_Exception.hxx index d0f465b4d..5c9207dbc 100644 --- a/src/Utils/Utils_SALOME_Exception.hxx +++ b/src/Utils/Utils_SALOME_Exception.hxx @@ -29,6 +29,8 @@ #if !defined( __Utils_SALOME_Exception_hxx__ ) #define __Utils_SALOME_Exception_hxx__ +//#include "SALOME_Utils.hxx" + # include # include @@ -38,18 +40,18 @@ # define LOCALIZED(message) #message #endif -#if defined UTILS_EXPORTS -#if defined WIN32 -#define UTILS_EXPORT __declspec( dllexport ) -#else -#define UTILS_EXPORT -#endif -#else -#if defined WNT -#define UTILS_EXPORT __declspec( dllimport ) +//swig tool on Linux doesn't pass defines from header SALOME_Utils.hxx +//therefore (temporary solution) defines are placed below + +#ifdef WNT +# if defined UTILS_EXPORTS +# define UTILS_EXPORT __declspec( dllexport ) +# else +# define UTILS_EXPORT __declspec( dllimport ) +# define LOCALIZED(message) #message +# endif #else -#define UTILS_EXPORT -#endif +# define UTILS_EXPORT #endif class UTILS_EXPORT SALOME_Exception : public std::exception diff --git a/src/Utils/Utils_SINGLETON.hxx b/src/Utils/Utils_SINGLETON.hxx index 9d78f9a18..8873946bb 100644 --- a/src/Utils/Utils_SINGLETON.hxx +++ b/src/Utils/Utils_SINGLETON.hxx @@ -29,6 +29,8 @@ # if !defined( __SINGLETON__H__ ) # define __SINGLETON__H__ +#include "SALOME_Utils.hxx" + # include "Utils_DESTRUCTEUR_GENERIQUE.hxx" # include diff --git a/src/Utils/Utils_SignalsHandler.h b/src/Utils/Utils_SignalsHandler.h new file mode 100644 index 000000000..a76ce46d8 --- /dev/null +++ b/src/Utils/Utils_SignalsHandler.h @@ -0,0 +1,50 @@ +// KERNEL Utils : common utils for KERNEL +// Copyright (C) 2003 CEA +// +// 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.org + +#ifndef _UTILS_SIGNALSHANDLER_H_ +#define _UTILS_SIGNALSHANDLER_H_ + +#include "SALOME_Utils.hxx" + +#include +typedef void (*TSigHandler)(int); + + +class UTILS_EXPORT Utils_SignalsHandler{ + public: + Utils_SignalsHandler(); + ~Utils_SignalsHandler(); + + TSigHandler GetSigHandler(int theSigId); + TSigHandler SetSigHandler(int theSigId, TSigHandler theSigHandler); + typedef std::map TSigHandlerCont; + + private: + TSigHandlerCont mySigHandlerCont; +}; + + +class UTILS_EXPORT Utils_CASSignalsHandler: private Utils_SignalsHandler{ + public: + Utils_CASSignalsHandler(); +}; + + +#endif diff --git a/src/Utils/Utils_Timer.hxx b/src/Utils/Utils_Timer.hxx index 27655f2af..a8363e030 100644 --- a/src/Utils/Utils_Timer.hxx +++ b/src/Utils/Utils_Timer.hxx @@ -24,6 +24,8 @@ // File : Utils_Timer.hxx // Module : SALOME +#include "SALOME_Utils.hxx" + #include #include @@ -38,7 +40,7 @@ #define _POSIX_ #endif -class Utils_Timer { +class UTILS_EXPORT Utils_Timer { public: Utils_Timer(); virtual ~Utils_Timer(); -- 2.39.2