From 6756e4982adb9a85ca73a9aa6bb75d5816726971 Mon Sep 17 00:00:00 2001 From: abd Date: Fri, 3 Oct 2008 09:47:03 +0000 Subject: [PATCH] Win32 Porting. Correction of Export/Import defines for Win32 platform. Using WIN32 standard define instead WNT define of OpenCascade library. Using Basics instead Utils library. Removed "using namespace std" from header files. --- src/ModuleCatalog/SALOME_ModuleCatalog.hxx | 20 ++++-------- .../SALOME_ModuleCatalog_Acomponent_impl.cxx | 12 ------- .../SALOME_ModuleCatalog_Client.cxx | 8 ----- .../SALOME_ModuleCatalog_Server.cxx | 4 +-- .../SALOME_ModuleCatalog_impl.cxx | 32 +++++++++++-------- .../SALOME_NOTIFICATION_SWIG.hxx | 22 ++++--------- 6 files changed, 33 insertions(+), 65 deletions(-) diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog.hxx index 75d05ccb8..7f2fcf44c 100755 --- a/src/ModuleCatalog/SALOME_ModuleCatalog.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog.hxx @@ -26,20 +26,12 @@ #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 +#ifdef WIN32 +# ifdef MODULECATALOG_EXPORTS +# define MODULECATALOG_EXPORT __declspec( dllexport ) +# else +# define MODULECATALOG_EXPORT __declspec( dllimport ) +# endif #else #define MODULECATALOG_EXPORT #endif diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx index 3208d6e89..1bc6a2075 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx @@ -503,11 +503,7 @@ void SALOME_ModuleCatalog_AcomponentImpl::duplicate _length = S_in.ServiceoutParameter.length(); S_out.ServiceoutParameter.length(_length); -#ifndef WNT for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) -#else - for (ind2 = 0; ind2 < _length ; ind2 ++) -#endif duplicate(S_out.ServiceoutParameter[ind2], S_in.ServiceoutParameter[ind2]); @@ -515,11 +511,7 @@ void SALOME_ModuleCatalog_AcomponentImpl::duplicate _length = S_in.ServiceinDataStreamParameter.length(); S_out.ServiceinDataStreamParameter.length(_length); -#ifndef WNT for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) -#else - for (ind2 = 0; ind2 < _length ; ind2 ++) -#endif duplicate(S_out.ServiceinDataStreamParameter[ind2], S_in.ServiceinDataStreamParameter[ind2]); @@ -528,11 +520,7 @@ void SALOME_ModuleCatalog_AcomponentImpl::duplicate if(MYDEBUG) SCRUTE(_length); S_out.ServiceoutDataStreamParameter.length(_length); -#ifndef WNT for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) -#else - for (ind2 = 0; ind2 < _length ; ind2 ++) -#endif duplicate(S_out.ServiceoutDataStreamParameter[ind2], S_in.ServiceoutDataStreamParameter[ind2]); } diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx index 02384368c..108eca1af 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx @@ -78,21 +78,13 @@ 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_Server.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx index 892b2fbb8..2271273bd 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx @@ -73,7 +73,7 @@ int main(int argc,char **argv) for (int i = 1; i<=NumberOfTries; i++) { if (i!=1) -#ifndef WNT +#ifndef WIN32 a=nanosleep(&ts_req,&ts_rem); #else Sleep(TIMESleep/1000000); @@ -106,7 +106,7 @@ int main(int argc,char **argv) for(int j=1; j<=NumberOfTries; j++) { if (j!=1) -#ifndef WNT +#ifndef WIN32 a=nanosleep(&ts_req, &ts_rem); #else Sleep(TIMESleep/1000000); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx index 435951b23..8c81c0290 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx @@ -30,10 +30,13 @@ #include "SALOME_ModuleCatalog_Acomponent_impl.hxx" #include #include +#include "utilities.h" -using namespace std; +#ifdef WIN32 +# include +#endif -#include "utilities.h" +using namespace std; #ifdef _DEBUG_ static int MYDEBUG = 0; @@ -127,7 +130,7 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: list dirList; -#ifdef WNT +#ifdef WIN32 dirList = splitStringToList(_general_path, SEPARATOR); #else //check for new format @@ -356,7 +359,7 @@ SALOME_ModuleCatalogImpl::GetComponentList() // The components in the general catalog are taken only if they're // not defined in the personal catalog -#ifndef WNT +#ifndef WIN32 for(unsigned int ind=0; ind < _general_module_list.size();ind++){ #else for(ind=0; ind < _general_module_list.size();ind++){ @@ -421,7 +424,7 @@ SALOME_ModuleCatalogImpl::GetComponentIconeList() // The components in the general catalog are taken only if they're // not defined in the personal catalog -#ifndef WNT +#ifndef WIN32 for(unsigned int ind=0; ind < _general_module_list.size();ind++){ #else for(ind=0; ind < _general_module_list.size();ind++){ @@ -516,7 +519,7 @@ SALOME_ModuleCatalogImpl::GetTypedComponentList(SALOME_ModuleCatalog::ComponentT // The components in the general catalog are taken only if they're // not defined in the personal catalog -#ifndef WNT +#ifndef WIN32 for (unsigned int ind=0; ind < _general_module_list.size();ind++) #else for (ind=0; ind < _general_module_list.size();ind++) @@ -619,7 +622,12 @@ SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name) CORBA::Long SALOME_ModuleCatalogImpl::getPID() { - return (CORBA::Long)getpid(); + return +#ifndef WIN32 + (CORBA::Long)getpid(); +#else + (CORBA::Long)_getpid(); +#endif } void SALOME_ModuleCatalogImpl::ShutdownWithExit() @@ -816,7 +824,7 @@ void SALOME_ModuleCatalogImpl::duplicate _length = S_parser.outParameters.size(); S_corba.ServiceoutParameter.length(_length); -#ifndef WNT +#ifndef WIN32 for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) #else for (ind2 = 0; ind2 < _length ; ind2 ++) @@ -828,7 +836,7 @@ void SALOME_ModuleCatalogImpl::duplicate _length = S_parser.inDataStreamParameters.size(); S_corba.ServiceinDataStreamParameter.length(_length); -#ifndef WNT +#ifndef WIN32 for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) #else for (ind2 = 0; ind2 < _length ; ind2 ++) @@ -841,7 +849,7 @@ void SALOME_ModuleCatalogImpl::duplicate // if(MYDEBUG) SCRUTE(_length); S_corba.ServiceoutDataStreamParameter.length(_length); -#ifndef WNT +#ifndef WIN32 for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) #else for (ind2 = 0; ind2 < _length ; ind2 ++) @@ -939,11 +947,7 @@ SALOME_ModuleCatalogImpl::_verify_path_prefix(ParserPathPrefixes & pathList) } // Parse if a computer name is twice in the list of computers -#ifndef WNT for (unsigned int ind = 0; ind < _machine_list.size(); ind++) -#else - for (ind = 0; ind < _machine_list.size(); ind++) -#endif { for (unsigned int ind1 = ind+1 ; ind1 < _machine_list.size(); ind1++) { diff --git a/src/NOTIFICATION_SWIG/SALOME_NOTIFICATION_SWIG.hxx b/src/NOTIFICATION_SWIG/SALOME_NOTIFICATION_SWIG.hxx index 33d751c91..23f3c05bc 100755 --- a/src/NOTIFICATION_SWIG/SALOME_NOTIFICATION_SWIG.hxx +++ b/src/NOTIFICATION_SWIG/SALOME_NOTIFICATION_SWIG.hxx @@ -26,22 +26,14 @@ #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 +#ifdef WIN32 +# ifdef NOTIFICATION_SWIG_EXPORTS +# define NOTIFICATION_SWIG_EXPORT __declspec( dllexport ) +# else +# define NOTIFICATION_SWIG_EXPORT __declspec( dllimport ) +# endif #else - #define NOTIFICATION_SWIG_EXPORT +# define NOTIFICATION_SWIG_EXPORT #endif #endif -- 2.39.2