From aaa62022606aeb7cb193e4db22b34855838e5e5c Mon Sep 17 00:00:00 2001 From: env Date: Fri, 29 Jul 2005 04:52:39 +0000 Subject: [PATCH] ENV: Windows porting --- src/Container/Container_init_python.hxx | 17 ++++++++++++++++- src/Container/SALOME_Container.cxx | 4 ++++ .../SALOME_DataTypeCatalog_Handler.hxx | 16 +++++++++++++++- .../SALOME_DataTypeCatalog_Server.cxx | 8 ++++++++ .../SALOME_DataTypeCatalog_impl.hxx | 16 +++++++++++++++- src/LifeCycleCORBA/TestLifeCycleCORBA.cxx | 9 +++++++++ .../SALOME_ModuleCatalog_Acomponent_impl.hxx | 16 +++++++++++++++- .../SALOME_ModuleCatalog_Client.cxx | 10 +++++++++- .../SALOME_ModuleCatalog_Handler.hxx | 16 +++++++++++++++- .../SALOME_ModuleCatalog_Server.cxx | 8 ++++++++ src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx | 17 ++++++++++++++++- src/NamingService/ServiceUnreachable.hxx | 16 +++++++++++++++- .../SALOME_RessourcesCatalog_Client.cxx | 12 ++++++++++++ .../SALOME_RessourcesCatalog_Handler.hxx | 16 +++++++++++++++- .../SALOME_RessourcesCatalog_Server.cxx | 8 ++++++++ .../SALOME_RessourcesCatalog_impl.hxx | 16 +++++++++++++++- src/SALOMEDS/SALOMEDS_Server.cxx | 8 ++++++++ src/SALOMEDS/SALOMEDS_StudyManager_i.hxx | 2 +- src/SALOMEDSImpl/testDS.cxx | 2 +- .../SALOMETraceCollector.cxx | 4 ++++ .../SALOMETraceCollector.hxx | 16 +++++++++++++++- 21 files changed, 224 insertions(+), 13 deletions(-) diff --git a/src/Container/Container_init_python.hxx b/src/Container/Container_init_python.hxx index acaef6307..43b785451 100644 --- a/src/Container/Container_init_python.hxx +++ b/src/Container/Container_init_python.hxx @@ -44,6 +44,21 @@ // thread state. // - 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); \ @@ -53,7 +68,7 @@ PyEval_ReleaseThread(myTstate); \ PyThreadState_Delete(myTstate); -struct KERNEL_PYTHON +struct CONTAINER_EXPORT KERNEL_PYTHON { static PyThreadState *_gtstate; static PyObject *salome_shared_modules_module; diff --git a/src/Container/SALOME_Container.cxx b/src/Container/SALOME_Container.cxx index ecc8a77ac..451523f29 100644 --- a/src/Container/SALOME_Container.cxx +++ b/src/Container/SALOME_Container.cxx @@ -30,7 +30,11 @@ #include #include +#ifndef WNT #include +#else +#include +#endif #include "SALOME_Container_i.hxx" #include "utilities.h" #include "Utils_ORB_INIT.hxx" diff --git a/src/DataTypeCatalog/SALOME_DataTypeCatalog_Handler.hxx b/src/DataTypeCatalog/SALOME_DataTypeCatalog_Handler.hxx index 78d08de30..77b06a5b8 100644 --- a/src/DataTypeCatalog/SALOME_DataTypeCatalog_Handler.hxx +++ b/src/DataTypeCatalog/SALOME_DataTypeCatalog_Handler.hxx @@ -34,7 +34,21 @@ #include #include -class SALOME_DataTypeCatalog_Handler : public QXmlDefaultHandler +#if defined DATATYPECATALOG_EXPORTS +#if defined WIN32 +#define DATATYPECATALOG_EXPORT __declspec( dllexport ) +#else +#define DATATYPECATALOG_EXPORT +#endif +#else +#if defined WNT +#define DATATYPECATALOG_EXPORT __declspec( dllimport ) +#else +#define DATATYPECATALOG_EXPORT +#endif +#endif + +class DATATYPECATALOG_EXPORT SALOME_DataTypeCatalog_Handler : public QXmlDefaultHandler { public: //! standard constructor diff --git a/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx b/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx index ff2151361..fad902b73 100644 --- a/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx +++ b/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx @@ -71,7 +71,11 @@ int main(int argc,char **argv) for (int i = 1; i<=NumberOfTries; i++) { if (i!=1) +#ifndef WNT a=nanosleep(&ts_req,&ts_rem); +#else + Sleep(TIMESleep/1000000); +#endif try { obj = orb->resolve_initial_references("RootPOA"); @@ -98,7 +102,11 @@ int main(int argc,char **argv) for(int j=1; j<=NumberOfTries; j++) { if (j!=1) +#ifndef WNT a=nanosleep(&ts_req, &ts_rem); +#else + Sleep(TIMESleep/1000000); +#endif try { object = inc->resolve(name); diff --git a/src/DataTypeCatalog/SALOME_DataTypeCatalog_impl.hxx b/src/DataTypeCatalog/SALOME_DataTypeCatalog_impl.hxx index 97c67ba40..6b662f6b2 100644 --- a/src/DataTypeCatalog/SALOME_DataTypeCatalog_impl.hxx +++ b/src/DataTypeCatalog/SALOME_DataTypeCatalog_impl.hxx @@ -34,7 +34,21 @@ #include #include CORBA_SERVER_HEADER(SALOME_DataTypeCatalog) -class SALOME_DataTypeCatalogImpl: public POA_SALOME_DataTypeCatalog::DataCatalog, +#if defined DATATYPECATALOG_EXPORTS +#if defined WIN32 +#define DATATYPECATALOG_EXPORT __declspec( dllexport ) +#else +#define DATATYPECATALOG_EXPORT +#endif +#else +#if defined WNT +#define DATATYPECATALOG_EXPORT __declspec( dllimport ) +#else +#define DATATYPECATALOG_EXPORT +#endif +#endif + +class DATATYPECATALOG_EXPORT SALOME_DataTypeCatalogImpl: public POA_SALOME_DataTypeCatalog::DataCatalog, public PortableServer::RefCountServantBase { public: diff --git a/src/LifeCycleCORBA/TestLifeCycleCORBA.cxx b/src/LifeCycleCORBA/TestLifeCycleCORBA.cxx index 312cbd211..78716e123 100644 --- a/src/LifeCycleCORBA/TestLifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/TestLifeCycleCORBA.cxx @@ -27,10 +27,17 @@ // $Header$ #include +#ifndef WNT #include +#endif #include +#ifndef WNT #include CORBA_CLIENT_HEADER(SALOME_Component) #include CORBA_CLIENT_HEADER(SALOME_TestComponent) +#else +#include +#include +#endif #include "SALOME_NamingService.hxx" #include "SALOME_LifeCycleCORBA.hxx" #include "utilities.h" @@ -115,10 +122,12 @@ int main (int argc, char * argv[]) { INFOS("Caught system exception COMM_FAILURE -- unable to contact the object."); } +#ifndef WNT catch(CORBA::SystemException&) { INFOS("Caught a CORBA::SystemException."); } +#endif catch(CORBA::Exception&) { INFOS("Caught CORBA::Exception."); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx index 4580350ae..e56d8a3fb 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx @@ -34,7 +34,21 @@ #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) -class SALOME_ModuleCatalog_AcomponentImpl: public POA_SALOME_ModuleCatalog::Acomponent, +#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 { public: diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx index ee3da570e..70b1c695e 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx @@ -26,7 +26,7 @@ /* $Header$ */ -#include +#include #include "SALOME_NamingService.hxx" #include "SALOME_ModuleCatalog.hh" #include @@ -78,13 +78,21 @@ int main(int argc,char **argv) MESSAGE("Get Typed Component list (SUPERV Type)"); list_typed_composants = Catalogue->GetTypedComponentList(SALOME_ModuleCatalog::SUPERV); +#ifndef WNT for (unsigned int ind = 0; ind < list_typed_composants->length();ind++) +#else + for (ind = 0; ind < list_typed_composants->length();ind++) +#endif MESSAGE("Component SUPERV list : " << list_typed_composants[ind]); // Get list of couple (component name, component icone) SALOME_ModuleCatalog::ListOfIAPP_Affich_var list_composants_icone = Catalogue->GetComponentIconeList(); +#ifndef WNT for (unsigned int ind = 0; ind < list_composants_icone->length();ind++) +#else + for (ind = 0; ind < list_composants_icone->length();ind++) +#endif { MESSAGE("Component name: " << list_composants_icone[ind].modulename); MESSAGE("Component icone: " << list_composants_icone[ind].moduleicone); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx index 43701c983..add44e498 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx @@ -35,7 +35,21 @@ #include #include -class SALOME_ModuleCatalog_Handler : public QXmlDefaultHandler +#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: //! standard constructor diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx index f2176aa12..4f8425f91 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx @@ -74,7 +74,11 @@ int main(int argc,char **argv) for (int i = 1; i<=NumberOfTries; i++) { if (i!=1) +#ifndef WNT a=nanosleep(&ts_req,&ts_rem); +#else + Sleep(TIMESleep/1000000); +#endif try { obj = orb->resolve_initial_references("RootPOA"); @@ -103,7 +107,11 @@ int main(int argc,char **argv) for(int j=1; j<=NumberOfTries; j++) { if (j!=1) +#ifndef WNT a=nanosleep(&ts_req, &ts_rem); +#else + Sleep(TIMESleep/1000000); +#endif try{ object = inc->resolve(name);} catch(CosNaming::NamingContext::NotFound) diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx index 712091151..b6c026901 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx @@ -39,7 +39,22 @@ #include #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) -class SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::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 { public: diff --git a/src/NamingService/ServiceUnreachable.hxx b/src/NamingService/ServiceUnreachable.hxx index 2124c76fe..9134e3244 100644 --- a/src/NamingService/ServiceUnreachable.hxx +++ b/src/NamingService/ServiceUnreachable.hxx @@ -31,9 +31,23 @@ #include "Utils_SALOME_Exception.hxx" +#if defined NAMINGSERVICE_EXPORTS +#if defined WIN32 +#define NAMINGSERVICE_EXPORT __declspec( dllexport ) +#else +#define NAMINGSERVICE_EXPORT +#endif +#else +#if defined WNT +#define NAMINGSERVICE_EXPORT __declspec( dllimport ) +#else +#define NAMINGSERVICE_EXPORT +#endif +#endif + //! exception class for NamingService : ServiceUnreachable -class ServiceUnreachable : public SALOME_Exception +class NAMINGSERVICE_EXPORT ServiceUnreachable : public SALOME_Exception { public : ServiceUnreachable( void ); diff --git a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Client.cxx b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Client.cxx index d368d878f..e6704afc4 100644 --- a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Client.cxx +++ b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Client.cxx @@ -29,7 +29,11 @@ #include #include "SALOME_NamingService.hxx" #include +#ifndef WNT #include CORBA_SERVER_HEADER(SALOME_RessourcesCatalog) +#else +#include +#endif #include #include "utilities.h" using namespace std; @@ -62,7 +66,11 @@ int main(int argc,char **argv) //Get container type list of computer eri SALOME_RessourcesCatalog::ListOfContainerType_var list = Catalogue->GetContainerTypeList("eri"); +#ifndef WNT for (unsigned int ind = 0; ind < list->length();ind++) +#else + for (ind = 0; ind < list->length();ind++) +#endif { MESSAGE("Container type list of eri : " << list[ind]); } @@ -72,7 +80,11 @@ int main(int argc,char **argv) MESSAGE("Ressource name : " << computer->name); MESSAGE("Ressource OS : " << computer->OS); MESSAGE("Ressource OS version : " << computer->OS_version); +#ifndef WNT for (unsigned int ind = 0; ind < computer->procs.length();ind++) +#else + for (ind = 0; ind < computer->procs.length();ind++) +#endif { MESSAGE("Processor number : " << computer->procs[ind].number); MESSAGE("Processor model name : " << computer->procs[ind].model_name); diff --git a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Handler.hxx b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Handler.hxx index 9e1b8e2f8..79e785560 100755 --- a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Handler.hxx +++ b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Handler.hxx @@ -35,7 +35,21 @@ #include #include -class SALOME_RessourcesCatalog_Handler : public QXmlDefaultHandler +#if defined RESSOURCESCatalog_EXPORTS +#if defined WIN32 +#define RESSOURCESCatalog_EXPORT __declspec( dllexport ) +#else +#define RESSOURCESCatalog_EXPORT +#endif +#else +#if defined WNT +#define RESSOURCESCatalog_EXPORT __declspec( dllimport ) +#else +#define RESSOURCESCatalog_EXPORT +#endif +#endif + +class RESSOURCESCatalog_EXPORT SALOME_RessourcesCatalog_Handler : public QXmlDefaultHandler { public : //! standard constructor diff --git a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx index fdb7de8d6..f6f930a79 100644 --- a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx +++ b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx @@ -72,7 +72,11 @@ int main(int argc,char **argv) for (int i = 1; i<=NumberOfTries; i++) { if (i!=1) +#ifndef WNT a=nanosleep(&ts_req,&ts_rem); +#else + Sleep(TIMESleep/1000000); +#endif try { obj = orb->resolve_initial_references("RootPOA"); @@ -97,7 +101,11 @@ int main(int argc,char **argv) for(int j=1; j<=NumberOfTries; j++) { if (j!=1) +#ifndef WNT a=nanosleep(&ts_req, &ts_rem); +#else + Sleep(TIMESleep/1000000); +#endif try{ object = inc->resolve(name); } diff --git a/src/RessourcesCatalog/SALOME_RessourcesCatalog_impl.hxx b/src/RessourcesCatalog/SALOME_RessourcesCatalog_impl.hxx index 4b8c5228a..42237b98b 100644 --- a/src/RessourcesCatalog/SALOME_RessourcesCatalog_impl.hxx +++ b/src/RessourcesCatalog/SALOME_RessourcesCatalog_impl.hxx @@ -34,7 +34,21 @@ #include #include CORBA_SERVER_HEADER(SALOME_RessourcesCatalog) -class SALOME_RessourcesCatalogImpl: public POA_SALOME_RessourcesCatalog::RessourcesCatalog, +#if defined RESSOURCESCatalog_EXPORTS +#if defined WIN32 +#define RESSOURCESCatalog_EXPORT __declspec( dllexport ) +#else +#define RESSOURCESCatalog_EXPORT +#endif +#else +#if defined WNT +#define RESSOURCESCatalog_EXPORT __declspec( dllimport ) +#else +#define RESSOURCESCatalog_EXPORT +#endif +#endif + +class RESSOURCESCatalog_EXPORT SALOME_RessourcesCatalogImpl: public POA_SALOME_RessourcesCatalog::RessourcesCatalog, public PortableServer::RefCountServantBase { public: diff --git a/src/SALOMEDS/SALOMEDS_Server.cxx b/src/SALOMEDS/SALOMEDS_Server.cxx index 57e8e2bee..d39465cbe 100644 --- a/src/SALOMEDS/SALOMEDS_Server.cxx +++ b/src/SALOMEDS/SALOMEDS_Server.cxx @@ -87,7 +87,11 @@ int main(int argc, char** argv) for (int i = 1; i<=NumberOfTries; i++) { if (i!=1) +#ifndef WNT a=nanosleep(&ts_req,&ts_rem); +#else + Sleep(TIMESleep/1000000); +#endif try { obj = orb->resolve_initial_references("RootPOA"); @@ -110,7 +114,11 @@ int main(int argc, char** argv) for(int j=1; j<=NumberOfTries; j++) { if (j!=1) +#ifndef WNT a=nanosleep(&ts_req, &ts_rem); +#else + Sleep(TIMESleep/1000000); +#endif try { object = inc->resolve(name); diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx index aae2ebfd4..beb62ba7b 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx @@ -32,7 +32,7 @@ namespace SALOMEDS{ } -class SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager, +class Standard_EXPORT SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager, public PortableServer::RefCountServantBase { private: diff --git a/src/SALOMEDSImpl/testDS.cxx b/src/SALOMEDSImpl/testDS.cxx index eaf801d98..ddc1bfd1e 100644 --- a/src/SALOMEDSImpl/testDS.cxx +++ b/src/SALOMEDSImpl/testDS.cxx @@ -2,7 +2,7 @@ //Author: Sergey RUIN #include -#include +#include #include #include diff --git a/src/SALOMETraceCollector/SALOMETraceCollector.cxx b/src/SALOMETraceCollector/SALOMETraceCollector.cxx index b2f1c1a28..b9c2914b6 100644 --- a/src/SALOMETraceCollector/SALOMETraceCollector.cxx +++ b/src/SALOMETraceCollector/SALOMETraceCollector.cxx @@ -41,7 +41,11 @@ using namespace std; // Class attributes initialisation, for class method SALOMETraceCollector::run SALOMETraceCollector* SALOMETraceCollector::_singleton = 0; +#ifndef WNT pthread_mutex_t SALOMETraceCollector::_singletonMutex; +#else +pthread_mutex_t SALOMETraceCollector::_singletonMutex = PTHREAD_MUTEX_INITIALIZER; +#endif int SALOMETraceCollector::_threadToClose = 0; pthread_t* SALOMETraceCollector::_threadId = 0; // used to control single run int SALOMETraceCollector::_toFile = 0; diff --git a/src/SALOMETraceCollector/SALOMETraceCollector.hxx b/src/SALOMETraceCollector/SALOMETraceCollector.hxx index d75806da1..a726be3e1 100644 --- a/src/SALOMETraceCollector/SALOMETraceCollector.hxx +++ b/src/SALOMETraceCollector/SALOMETraceCollector.hxx @@ -33,7 +33,21 @@ //! See LocalTraceCollector instead of SALOMETraceCollector for usage without CORBA -class SALOMETraceCollector +#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 ) +#else +#define SALOMETRACECOLLECTOR_EXPORT +#endif +#endif + +class SALOMETRACECOLLECTOR_EXPORT SALOMETraceCollector { public: static SALOMETraceCollector* instance(CORBA::ORB_ptr theOrb, int typeTrace=0); -- 2.39.2