From a680aaf4abcf66743379af668d0e8f318b2aa759 Mon Sep 17 00:00:00 2001 From: abd Date: Fri, 10 Oct 2008 10:15:47 +0000 Subject: [PATCH] Merging from V4_1_0_maintainance for porting on Win32 Platform --- src/Registry/RegistryConnexion.cxx | 2 +- src/Registry/RegistryService.cxx | 10 +- src/Registry/RegistryService.hxx | 2 +- src/Registry/SALOME_Registry.hxx | 22 +- src/Registry/SALOME_Registry_Server.cxx | 4 +- src/ResourcesManager/Makefile.am | 7 +- src/ResourcesManager/ResourcesManager.cxx | 10 +- .../SALOME_ResourcesManager.cxx | 2 +- src/SALOMEDS/Makefile.am | 8 +- src/SALOMEDS/SALOMEDS.cxx | 13 -- .../SALOMEDS_AttributeStudyProperties.cxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx | 8 +- src/SALOMEDS/SALOMEDS_Defines.hxx | 22 +- src/SALOMEDS/SALOMEDS_GenericAttribute.cxx | 6 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx | 5 +- src/SALOMEDS/SALOMEDS_SObject.cxx | 9 +- src/SALOMEDS/SALOMEDS_SObject_i.cxx | 5 +- src/SALOMEDS/SALOMEDS_Server.cxx | 4 +- src/SALOMEDS/SALOMEDS_Study.cxx | 6 +- src/SALOMEDS/SALOMEDS_StudyManager.cxx | 8 +- src/SALOMEDS/SALOMEDS_StudyManager_i.cxx | 14 +- src/SALOMEDS/SALOMEDS_StudyManager_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_Study_i.cxx | 10 +- src/SALOMEDS/SALOMEDS_Study_i.hxx | 2 +- src/SALOMEDS/Test/Makefile.am | 1 + src/SALOMEDS/Test/TestSALOMEDS.cxx | 8 +- .../SALOMEDSImpl_AttributeDrawable.cxx | 2 - .../SALOMEDSImpl_AttributeExpandable.cxx | 2 - .../SALOMEDSImpl_AttributeIOR.cxx | 2 - .../SALOMEDSImpl_AttributeString.cxx | 2 - .../SALOMEDSImpl_StudyManager.cxx | 24 +-- src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx | 18 +- src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx | 2 +- src/SALOMELocalTrace/BaseTraceCollector.cxx | 2 +- src/SALOMELocalTrace/FileTraceCollector.cxx | 8 +- src/SALOMELocalTrace/LocalTraceBufferPool.cxx | 12 +- src/SALOMELocalTrace/LocalTraceCollector.cxx | 4 +- src/SALOMELocalTrace/SALOME_LocalTrace.hxx | 22 +- .../SALOMETraceCollector.cxx | 4 +- .../SALOMETraceCollector.hxx | 4 +- .../TraceCollector_WaitForServerReadiness.cxx | 4 +- src/TOOLSDS/SALOMEDS_Tool.cxx | 22 +- src/TOOLSDS/SALOMEDS_Tool.hxx | 24 +-- src/TestContainer/Makefile.am | 2 + src/TestContainer/SALOME_TestComponent_i.cxx | 2 +- src/TestContainer/TestContainer.cxx | 4 +- src/TestMPIContainer/TestMPIContainer.cxx | 4 +- src/Utils/Makefile.am | 3 +- src/Utils/OpUtil.cxx | 194 ------------------ src/Utils/OpUtil.hxx | 27 --- src/Utils/SALOME_Utils.hxx | 2 +- src/Utils/Utils_Identity.cxx | 16 +- src/Utils/Utils_Identity.hxx | 6 +- src/Utils/Utils_Mutex.cxx | 4 +- src/Utils/Utils_SALOME_Exception.cxx | 4 +- src/Utils/Utils_SALOME_Exception.hxx | 6 +- src/Utils/Utils_Timer.cxx | 10 +- src/Utils/Utils_Timer.hxx | 4 +- 58 files changed, 185 insertions(+), 453 deletions(-) delete mode 100644 src/Utils/OpUtil.cxx diff --git a/src/Registry/RegistryConnexion.cxx b/src/Registry/RegistryConnexion.cxx index 62f017e15..657bbc159 100644 --- a/src/Registry/RegistryConnexion.cxx +++ b/src/Registry/RegistryConnexion.cxx @@ -98,7 +98,7 @@ RegistryConnexion::~RegistryConnexion() _VarComponents->remove( _Id ) ; } _Id = 0 ; -#ifndef WNT +#ifndef WIN32 delete [] _Ior; #else delete [] (char*) _Ior; diff --git a/src/Registry/RegistryService.cxx b/src/Registry/RegistryService.cxx index 939c1adc6..5b4e333a1 100644 --- a/src/Registry/RegistryService.cxx +++ b/src/Registry/RegistryService.cxx @@ -35,7 +35,7 @@ extern "C" # include } -#ifndef WNT +#ifndef WIN32 #include #else #include @@ -78,7 +78,7 @@ RegistryService::~RegistryService() _Compteur = -1 ; if ( _SessionName ) { -#ifndef WNT +#ifndef WIN32 delete [] _SessionName ; #else delete [] (char*)_SessionName ; @@ -116,7 +116,7 @@ CORBA::ULong RegistryService::add( const Registry::Infos & infos ) return (CORBA::ULong)_Compteur ; } -#ifndef WNT +#ifndef WIN32 void RegistryService::remove( const CORBA::ULong id) #else void RegistryService::remove( CORBA::ULong id) @@ -144,7 +144,7 @@ void RegistryService::remove( CORBA::ULong id) } -#ifndef WNT +#ifndef WIN32 void RegistryService::hello( const CORBA::ULong id ) #else void RegistryService::hello( CORBA::ULong id ) @@ -263,7 +263,7 @@ void RegistryService::SessionName( const char *sessionName ) } void RegistryService::ping() { -#ifndef WNT +#ifndef WIN32 MESSAGE(" RegistryService::ping() pid "<< getpid()); #else MESSAGE(" RegistryService::ping() pid "<< _getpid()); diff --git a/src/Registry/RegistryService.hxx b/src/Registry/RegistryService.hxx index d1b3a81c2..9a32e2de6 100644 --- a/src/Registry/RegistryService.hxx +++ b/src/Registry/RegistryService.hxx @@ -75,7 +75,7 @@ public : CORBA::Long getPID(); virtual CORBA::ULong add (const Registry::Infos & infos); virtual CORBA::ULong size ( void ); -#ifndef WNT +#ifndef WIN32 virtual void remove( const CORBA::ULong id ); virtual void hello( const CORBA::ULong id ); #else diff --git a/src/Registry/SALOME_Registry.hxx b/src/Registry/SALOME_Registry.hxx index 4ca01a2c7..d798156c1 100755 --- a/src/Registry/SALOME_Registry.hxx +++ b/src/Registry/SALOME_Registry.hxx @@ -26,22 +26,14 @@ #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 +#ifdef WIN32 +# ifdef REGISTRY_EXPORTS +# define REGISTRY_EXPORT __declspec( dllexport ) +# else +# define REGISTRY_EXPORT __declspec( dllimport ) +# endif #else - #define REGISTRY_EXPORT +# define REGISTRY_EXPORT #endif #endif diff --git a/src/Registry/SALOME_Registry_Server.cxx b/src/Registry/SALOME_Registry_Server.cxx index 8183340c2..718552c8d 100644 --- a/src/Registry/SALOME_Registry_Server.cxx +++ b/src/Registry/SALOME_Registry_Server.cxx @@ -104,7 +104,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); @@ -133,7 +133,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/ResourcesManager/Makefile.am b/src/ResourcesManager/Makefile.am index 61eb8e186..63493867e 100755 --- a/src/ResourcesManager/Makefile.am +++ b/src/ResourcesManager/Makefile.am @@ -64,6 +64,7 @@ COMMON_CPPFLAGS=\ COMMON_LIBS =\ ../NamingService/libSalomeNS.la \ ../Utils/libOpUtil.la \ + ../Basics/libSALOMEBasics.la \ $(top_builddir)/idl/libSalomeIDLKernel.la \ @LIBXML_LIBS@ @@ -90,8 +91,12 @@ libResourcesManager_la_SOURCES =\ ResourcesManager.cxx libResourcesManager_la_CPPFLAGS =\ - $(COMMON_CPPFLAGS) + -I$(srcdir)/../Basics \ + -I$(srcdir)/../SALOMELocalTrace \ + -I$(srcdir)/../Utils \ + @LIBXML_INCLUDES@ libResourcesManager_la_LDFLAGS = -no-undefined -version-info=0:0:0 libResourcesManager_la_LIBADD =\ + ../Basics/libSALOMEBasics.la \ @LIBXML_LIBS@ diff --git a/src/ResourcesManager/ResourcesManager.cxx b/src/ResourcesManager/ResourcesManager.cxx index 95c070c3c..5ac93142d 100644 --- a/src/ResourcesManager/ResourcesManager.cxx +++ b/src/ResourcesManager/ResourcesManager.cxx @@ -18,7 +18,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "ResourcesManager.hxx" -#include +#include #include #include #include @@ -32,6 +32,8 @@ #ifndef WIN32 # include +#else +# include #endif #define MAX_SIZE_FOR_HOSTNAME 256; @@ -131,7 +133,7 @@ ResourcesManager_cpp::GetFittingResources(const machineParams& params, const char *hostname = params.hostname.c_str(); #if defined(_DEBUG_) || defined(_DEBUG) - cerr << "GetFittingResources " << hostname << " " << GetHostname().c_str() << endl; + cerr << "GetFittingResources " << hostname << " " << Kernel_Utils::GetHostname().c_str() << endl; #endif if (hostname[0] != '\0'){ @@ -140,12 +142,12 @@ ResourcesManager_cpp::GetFittingResources(const machineParams& params, //#endif if ( strcmp(hostname, "localhost") == 0 || - strcmp(hostname, GetHostname().c_str()) == 0 ) + strcmp(hostname, Kernel_Utils::GetHostname().c_str()) == 0 ) { //#if defined(_DEBUG_) || defined(_DEBUG) // cerr << "ResourcesManager_cpp::GetFittingResources : localhost" << endl; //#endif - vec.push_back(GetHostname().c_str()); + vec.push_back(Kernel_Utils::GetHostname().c_str()); //#if defined(_DEBUG_) || defined(_DEBUG) // cerr << "ResourcesManager_cpp::GetFittingResources : " << vec.size() << endl; //#endif diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index 52276bd87..8189bc06d 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -23,7 +23,7 @@ #include "OpUtil.hxx" #include -#ifndef WNT +#ifndef WIN32 #include #else #include diff --git a/src/SALOMEDS/Makefile.am b/src/SALOMEDS/Makefile.am index d8a55d88f..3beb4b303 100644 --- a/src/SALOMEDS/Makefile.am +++ b/src/SALOMEDS/Makefile.am @@ -281,9 +281,13 @@ bin_PROGRAMS = SALOMEDS_Server SALOMEDS_Client SALOMEDS_Server_SOURCES = SALOMEDS_Server.cxx SALOMEDS_Server_CPPFLAGS = $(COMMON_CPPFLAGS) SALOMEDS_Server_LDADD = libSalomeDS.la \ - $(HDF5_LIBS) $(CORBA_LIBS) + ../Basics/libSALOMEBasics.la \ + $(HDF5_LIBS) \ + $(CORBA_LIBS) SALOMEDS_Client_SOURCES = SALOMEDS_Client.cxx SALOMEDS_Client_CPPFLAGS = $(COMMON_CPPFLAGS) SALOMEDS_Client_LDADD = libSalomeDS.la \ - $(HDF5_LIBS) $(CORBA_LIBS) + ../Basics/libSALOMEBasics.la \ + $(HDF5_LIBS) \ + $(CORBA_LIBS) diff --git a/src/SALOMEDS/SALOMEDS.cxx b/src/SALOMEDS/SALOMEDS.cxx index 8ee2138d2..87085d3c0 100644 --- a/src/SALOMEDS/SALOMEDS.cxx +++ b/src/SALOMEDS/SALOMEDS.cxx @@ -26,18 +26,6 @@ // Module : SALOME // $Header$ -#ifdef WNT -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#else #include "SALOMEDS.hxx" #include "SALOMEDS_StudyManager.hxx" #include "SALOMEDS_Study.hxx" @@ -48,7 +36,6 @@ #include "SALOMEDSClient_IParameters.hxx" #include "SALOMEDS_IParameters.hxx" #include "SALOMEDS_StudyManager_i.hxx" -#endif #include "SALOMEDS_Defines.hxx" diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx index d3ca2e668..4cd5f3faa 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx @@ -59,7 +59,7 @@ std::string SALOMEDS_AttributeStudyProperties::GetUserName() SALOMEDS::Locker lock; aName = dynamic_cast(_local_impl)->GetCreatorName(); } -#ifndef WNT +#ifndef WIN32 else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName(); #else else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserNameA(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx index 41e69b8a7..c8b9aa565 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx @@ -64,7 +64,7 @@ SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFather() SALOMEDS::Locker lock; SALOMEDS_AttributeTreeNode_i* aFather; aFather = new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetFather(), _orb); -#ifndef WNT +#ifndef WIN32 return aFather->POA_SALOMEDS::AttributeTreeNode::_this(); #else return aFather->AttributeTreeNode::_this(); @@ -90,7 +90,7 @@ SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetPrevious() SALOMEDS::Locker lock; SALOMEDS_AttributeTreeNode_i* aPrevious; aPrevious=new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetPrevious(), _orb); -#ifndef WNT +#ifndef WIN32 return aPrevious->POA_SALOMEDS::AttributeTreeNode::_this(); #else return aPrevious->AttributeTreeNode::_this(); @@ -116,7 +116,7 @@ SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetNext() SALOMEDS::Locker lock; SALOMEDS_AttributeTreeNode_i* aNext; aNext = new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetNext(), _orb); -#ifndef WNT +#ifndef WIN32 return aNext->POA_SALOMEDS::AttributeTreeNode::_this(); #else return aNext->AttributeTreeNode::_this(); @@ -142,7 +142,7 @@ SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFirst() SALOMEDS::Locker lock; SALOMEDS_AttributeTreeNode_i* aFirst; aFirst = new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetFirst(), _orb); -#ifndef WNT +#ifndef WIN32 return aFirst->POA_SALOMEDS::AttributeTreeNode::_this(); #else return aFirst->AttributeTreeNode::_this(); diff --git a/src/SALOMEDS/SALOMEDS_Defines.hxx b/src/SALOMEDS/SALOMEDS_Defines.hxx index 33c4bde26..c18d742ab 100755 --- a/src/SALOMEDS/SALOMEDS_Defines.hxx +++ b/src/SALOMEDS/SALOMEDS_Defines.hxx @@ -26,22 +26,14 @@ #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 +#ifdef WIN32 +# ifdef SALOMEDS_EXPORTS +# define SALOMEDS_EXPORT __declspec( dllexport ) +# else +# define SALOMEDS_EXPORT __declspec( dllimport ) +# endif #else - #define SALOMEDS_EXPORT +# define SALOMEDS_EXPORT #endif #endif diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx index 56657e5b3..5fd785cf9 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx @@ -31,6 +31,8 @@ #include "SALOMEDS_ClientAttributes.hxx" #include "SALOMEDS.hxx" +#include "Basics_Utils.hxx" + #ifdef WIN32 #include #else @@ -38,8 +40,6 @@ #include #endif -#include "OpUtil.hxx" - using namespace std; SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDSImpl_GenericAttribute* theGA) @@ -57,7 +57,7 @@ SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ long pid = (long)getpid(); #endif - CORBA::LongLong addr = theGA->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = theGA->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = reinterpret_cast(addr); _corba_impl = SALOMEDS::GenericAttribute::_nil(); diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx index 245338e56..9390c7f67 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx @@ -29,6 +29,7 @@ #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_Study.hxx" #include "Utils_ExceptHandlers.hxx" +#include "Basics_Utils.hxx" #include #ifdef WIN32 @@ -38,8 +39,6 @@ #include #endif -#include "OpUtil.hxx" - using namespace std; UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection); @@ -123,6 +122,6 @@ CORBA::LongLong SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostnam #else long pid = (long)getpid(); #endif - isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; + isLocal = (strcmp(theHostname, Kernel_Utils::GetHostname().c_str()) == 0 && pid == thePID)?1:0; return reinterpret_cast(_impl); } diff --git a/src/SALOMEDS/SALOMEDS_SObject.cxx b/src/SALOMEDS/SALOMEDS_SObject.cxx index 2110c24dc..2aeb5400e 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject.cxx @@ -38,6 +38,10 @@ #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" +#include "Basics_Utils.hxx" + +#include "utilities.h" + #ifdef WIN32 #include #include @@ -46,8 +50,7 @@ #include #endif -#include "OpUtil.hxx" -#include "utilities.h" + using namespace std; @@ -60,7 +63,7 @@ SALOMEDS_SObject::SALOMEDS_SObject(SALOMEDS::SObject_ptr theSObject) #endif 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); + theSObject->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = reinterpret_cast(addr); diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index 08eddaa70..cb70d26c6 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -33,6 +33,7 @@ #include "SALOMEDSImpl_SComponent.hxx" #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDSImpl_AttributeIOR.hxx" +#include "Basics_Utils.hxx" #include @@ -43,8 +44,6 @@ #include #endif -#include "OpUtil.hxx" - using namespace std; SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const SALOMEDSImpl_SObject& theImpl, CORBA::ORB_ptr theORB) @@ -331,6 +330,6 @@ CORBA::LongLong SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA: #else long pid = (long)getpid(); #endif - isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; + isLocal = (strcmp(theHostname, Kernel_Utils::GetHostname().c_str()) == 0 && pid == thePID)?1:0; return reinterpret_cast(_impl); } diff --git a/src/SALOMEDS/SALOMEDS_Server.cxx b/src/SALOMEDS/SALOMEDS_Server.cxx index 8ecce2d4b..c62134252 100644 --- a/src/SALOMEDS/SALOMEDS_Server.cxx +++ b/src/SALOMEDS/SALOMEDS_Server.cxx @@ -87,7 +87,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); @@ -114,7 +114,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/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx index 3bfebc5b0..e3d3218c6 100644 --- a/src/SALOMEDS/SALOMEDS_Study.cxx +++ b/src/SALOMEDS/SALOMEDS_Study.cxx @@ -52,6 +52,8 @@ #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" +#include "Basics_Utils.hxx" + #ifdef WIN32 #include #else @@ -59,8 +61,6 @@ #include #endif -#include "OpUtil.hxx" - using namespace std; SALOMEDS_Study::SALOMEDS_Study(SALOMEDSImpl_Study* theStudy) @@ -79,7 +79,7 @@ SALOMEDS_Study::SALOMEDS_Study(SALOMEDS::Study_ptr theStudy) long pid = (long)getpid(); #endif - long addr = theStudy->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + long addr = theStudy->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = reinterpret_cast(addr); _corba_impl = SALOMEDS::Study::_duplicate(theStudy); diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.cxx b/src/SALOMEDS/SALOMEDS_StudyManager.cxx index edff1f88f..5740720c9 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager.cxx @@ -35,6 +35,8 @@ #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" +#include "Basics_Utils.hxx" + #ifdef WIN32 #include #else @@ -42,8 +44,6 @@ #include #endif -#include "OpUtil.hxx" - using namespace std; SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb); @@ -57,7 +57,7 @@ SALOMEDS_StudyManager::SALOMEDS_StudyManager(SALOMEDS::StudyManager_ptr theManag long pid = (long)getpid(); #endif - CORBA::LongLong addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = theManager->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = reinterpret_cast(addr); _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager); @@ -85,7 +85,7 @@ SALOMEDS_StudyManager::SALOMEDS_StudyManager() long pid = (long)getpid(); #endif - CORBA::LongLong addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = theManager->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = reinterpret_cast(addr); _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager); diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index a0cab563e..f2e291cec 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -35,11 +35,13 @@ #include "SALOMEDSImpl_AttributeIOR.hxx" #include "Utils_CorbaException.hxx" +#include "Utils_ExceptHandlers.hxx" +#include "Basics_Utils.hxx" +#include "SALOME_GenericObj_i.hh" #include #include #include -using namespace std; #ifdef WIN32 #include @@ -48,11 +50,7 @@ using namespace std; #include #endif -#include "OpUtil.hxx" - -#include "SALOME_GenericObj_i.hh" - -#include "Utils_ExceptHandlers.hxx" +using namespace std; UNEXPECT_CATCH(SalomeException,SALOME::SALOME_Exception); UNEXPECT_CATCH(LockProtection, SALOMEDS::StudyBuilder::LockProtection); @@ -478,8 +476,8 @@ CORBA::LongLong SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, C #else long pid = (long)getpid(); #endif - isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; - return ((CORBA::LongLong)(void*)_impl); + isLocal = (strcmp(theHostname, Kernel_Utils::GetHostname().c_str()) == 0 && pid == thePID)?1:0; + return reinterpret_cast(_impl); } //=========================================================================== diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx index d837acba1..d155f3101 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx @@ -27,7 +27,7 @@ // std C++ headers #include -#ifndef WNT +#ifndef WIN32 #include #endif diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index 1f5f2a127..c3a86cf7a 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -43,6 +43,8 @@ #include "DF_Label.hxx" #include "DF_Attribute.hxx" +#include "Basics_Utils.hxx" + #ifdef WIN32 #include #else @@ -50,8 +52,6 @@ #include #endif -#include "OpUtil.hxx" - using namespace std; //============================================================================ @@ -704,7 +704,7 @@ void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR) * Purpose : */ //============================================================================ -#ifndef WNT +#ifndef WIN32 void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long /*theUndoLimit*/) #else void SALOMEDS_Study_i::RemovePostponed(CORBA::Long /*theUndoLimit*/) @@ -731,7 +731,7 @@ void SALOMEDS_Study_i::RemovePostponed(CORBA::Long /*theUndoLimit*/) * Purpose : */ //============================================================================ -#ifndef WNT +#ifndef WIN32 void SALOMEDS_Study_i::UndoPostponed(const CORBA::Long theWay) #else void SALOMEDS_Study_i::UndoPostponed(CORBA::Long theWay) @@ -888,6 +888,6 @@ CORBA::LongLong SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::L #else long pid = (long)getpid(); #endif - isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; + isLocal = (strcmp(theHostname, Kernel_Utils::GetHostname().c_str()) == 0 && pid == thePID)?1:0; return reinterpret_cast(_impl); } diff --git a/src/SALOMEDS/SALOMEDS_Study_i.hxx b/src/SALOMEDS/SALOMEDS_Study_i.hxx index efb31e66e..c0965f183 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.hxx @@ -269,7 +269,7 @@ public: virtual void AddCreatedPostponed(const char* theIOR); -#ifndef WNT +#ifndef WIN32 virtual void RemovePostponed(const CORBA::Long theUndoLimit); // removes postponed IORs of old transaction // if theUndoLimit==0, removes all virtual void UndoPostponed(const CORBA::Long theWay); // theWay = 1: resurrect objects, diff --git a/src/SALOMEDS/Test/Makefile.am b/src/SALOMEDS/Test/Makefile.am index 7c765fa9f..bd6bda7d6 100644 --- a/src/SALOMEDS/Test/Makefile.am +++ b/src/SALOMEDS/Test/Makefile.am @@ -145,4 +145,5 @@ bin_PROGRAMS = TestSALOMEDS dist_TestSALOMEDS_SOURCES = TestSALOMEDS.cxx TestSALOMEDS_CPPFLAGS = $(COMMON_CPPFLAGS) TestSALOMEDS_LDADD = libSALOMEDSTest.la \ + $(RPATH)/Basics/libSALOMEBasics.la \ $(CORBA_LIBS) diff --git a/src/SALOMEDS/Test/TestSALOMEDS.cxx b/src/SALOMEDS/Test/TestSALOMEDS.cxx index 2d02b2829..0f6a00e1e 100644 --- a/src/SALOMEDS/Test/TestSALOMEDS.cxx +++ b/src/SALOMEDS/Test/TestSALOMEDS.cxx @@ -46,11 +46,13 @@ CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest_Embedded ); #include "utilities.h" #include "Utils_SINGLETON.hxx" #include "Utils_ORB_INIT.hxx" -#include "OpUtil.hxx" +#include "Basics_Utils.hxx" #include "SALOME_NamingService.hxx" #include "NamingService_WaitForServerReadiness.hxx" #include "SALOMEDS_StudyManager_i.hxx" +using namespace std; + // ============================================================================ /*! * Main program source for Unit Tests with cppunit package does not depend @@ -84,9 +86,9 @@ int main(int argc, char* argv[]) sleep(15); - string host; // = GetHostname(); + string host; // = Kernel_Utils::GetHostname(); char* wait_Superv = getenv("SALOMEDS_UNITTESTS_WAIT_SUPERVISOR"); - if(wait_Superv) host = GetHostname(); + if(wait_Superv) host = Kernel_Utils::GetHostname(); SALOME_NamingService NS(orb); if(host.empty()) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.cxx index 70a954f43..25f8f3c9d 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.cxx @@ -23,9 +23,7 @@ #include "SALOMEDSImpl_AttributeDrawable.hxx" -#ifndef WNT using namespace std; -#endif //======================================================================= //function : GetID diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx index a77d1e8c4..774abcfd2 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx @@ -23,9 +23,7 @@ #include "SALOMEDSImpl_AttributeExpandable.hxx" -#ifndef WNT using namespace std; -#endif //======================================================================= //function : GetID diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx index 866265851..ea88de4fc 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx @@ -24,9 +24,7 @@ #include "SALOMEDSImpl_AttributeIOR.hxx" #include "SALOMEDSImpl_Study.hxx" -#ifndef WNT using namespace std; -#endif //======================================================================= //function : GetID diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx index 9bdc26b23..2ac9acf90 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx @@ -23,9 +23,7 @@ #include "SALOMEDSImpl_AttributeString.hxx" -#ifndef WNT using namespace std; -#endif //======================================================================= //function : GetID diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx index bd904c91b..50099bcc9 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx @@ -134,18 +134,12 @@ SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::Open(const string& aUrl) } catch (HDFexception) { -//#ifndef WNT -// char eStr[strlen(aUrl.ToCString())+17]; -//#else - char *eStr; - eStr = new char[strlen(aUrl.c_str())+17]; -//#endif - sprintf(eStr,"Can't open file %s",aUrl.c_str()); -//#ifdef WNT - delete [] eStr; -//#endif - _errorCode = string(eStr); - return NULL; + char *eStr; + eStr = new char[strlen(aUrl.c_str())+17]; + sprintf(eStr,"Can't open file %s",aUrl.c_str()); + delete [] eStr; + _errorCode = string(eStr); + return NULL; } // Temporary aStudyUrl in place of study name @@ -174,11 +168,7 @@ SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::Open(const string& aUrl) } catch (HDFexception) { -//#ifndef WNT -// char eStr[strlen(aUrl.ToCString())+17]; -//#else - char *eStr = new char [strlen(aUrl.c_str())+17]; -//#endif + char *eStr = new char [strlen(aUrl.c_str())+17]; sprintf(eStr,"Can't open file %s", aUrl.c_str()); _errorCode = string(eStr); return NULL; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx index fcc1745e8..b65ad7bd5 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx @@ -31,7 +31,7 @@ #include "SALOMEDSImpl_Tool.hxx" -#ifndef WNT +#ifndef WIN32 #include #include #include @@ -50,7 +50,7 @@ using namespace std; bool Exists(const string thePath) { -#ifdef WNT +#ifdef WIN32 if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) { if ( GetLastError () != ERROR_FILE_NOT_FOUND ) { return false; @@ -118,7 +118,7 @@ string SALOMEDSImpl_Tool::GetTmpDir() #endif -#ifdef WNT +#ifdef WIN32 CreateDirectory(aDir.c_str(), NULL); #else mkdir(aDir.c_str(), 0x1ff); @@ -143,7 +143,7 @@ void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const string& theDirectory, aFile += theFiles[i-1]; if(!Exists(aFile)) continue; -#ifdef WNT +#ifdef WIN32 DeleteFile(aFile.c_str()); #else unlink(aFile.c_str()); @@ -152,7 +152,7 @@ void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const string& theDirectory, if(IsDirDeleted) { if(Exists(aDirName)) { -#ifdef WNT +#ifdef WIN32 RemoveDirectory(aDirName.c_str()); #else rmdir(aDirName.c_str()); @@ -201,7 +201,7 @@ string SALOMEDSImpl_Tool::GetDirFromPath(const string& thePath) { path = thePath+"/"; } -#ifdef WNT //Check if the only disk letter is given as path +#ifdef WIN32 //Check if the only disk letter is given as path if(path.size() == 2 && path[1] == ':') path +='\\'; #endif @@ -239,7 +239,7 @@ vector SALOMEDSImpl_Tool::splitString(const string& theValue, char separ void SALOMEDSImpl_Tool::GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds) { -#ifdef WNT +#ifdef WIN32 SYSTEMTIME st; GetLocalTime ( &st ); @@ -269,12 +269,12 @@ void SALOMEDSImpl_Tool::GetSystemDate(int& year, int& month, int& day, int& hour } //Warning undef of Ascii Winwows define -#ifdef WNT +#ifdef WIN32 # undef GetUserName #endif string SALOMEDSImpl_Tool::GetUserName() { -#ifdef WNT +#ifdef WIN32 char* pBuff = new char[UNLEN + 1]; DWORD dwSize = UNLEN + 1; string retVal; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx index 6019376fb..8fb8899b5 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx @@ -40,7 +40,7 @@ class SALOMEDSIMPL_EXPORT SALOMEDSImpl_Tool public: // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set - // otherwise return /tmp/something/ for Unix or c:\something\ for WNT + // otherwise return /tmp/something/ for Unix or c:\something\ for WIN32 static std::string GetTmpDir(); diff --git a/src/SALOMELocalTrace/BaseTraceCollector.cxx b/src/SALOMELocalTrace/BaseTraceCollector.cxx index 5980a4075..9c3b222cb 100644 --- a/src/SALOMELocalTrace/BaseTraceCollector.cxx +++ b/src/SALOMELocalTrace/BaseTraceCollector.cxx @@ -37,7 +37,7 @@ using namespace std; // Class attributes initialisation, for class method BaseTraceCollector::run BaseTraceCollector* BaseTraceCollector::_singleton = 0; -#ifndef WNT +#ifndef WIN32 pthread_mutex_t BaseTraceCollector::_singletonMutex; #else pthread_mutex_t BaseTraceCollector::_singletonMutex = diff --git a/src/SALOMELocalTrace/FileTraceCollector.cxx b/src/SALOMELocalTrace/FileTraceCollector.cxx index 62792f453..42879e82f 100644 --- a/src/SALOMELocalTrace/FileTraceCollector.cxx +++ b/src/SALOMELocalTrace/FileTraceCollector.cxx @@ -126,7 +126,7 @@ void* FileTraceCollector::run(void *bid) myTraceBuffer->retrieve(myTrace); if (myTrace.traceType == ABORT_MESS) { -#ifndef WNT +#ifndef WIN32 traceFile << "INTERRUPTION from thread " << myTrace.threadId << " : " << myTrace.trace; #else @@ -136,9 +136,9 @@ void* FileTraceCollector::run(void *bid) #endif traceFile.close(); cout << flush ; -#ifndef WNT +#ifndef WIN32 MESSAGE ( "INTERRUPTION from thread " << myTrace.threadId - << " : " << myTrace.trace ); + << " : " << myTrace.trace ); #else MESSAGE ( "INTERRUPTION from thread " << (void*)(&myTrace.threadId) << " : " << myTrace.trace ); @@ -148,7 +148,7 @@ void* FileTraceCollector::run(void *bid) } else { -#ifndef WNT +#ifndef WIN32 traceFile << "th. " << myTrace.threadId << " " << myTrace.trace; #else diff --git a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx index 686f712c5..5e4bfba02 100644 --- a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx +++ b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx @@ -28,7 +28,7 @@ #include #include -#ifndef WNT +#ifndef WIN32 #include #else #include @@ -52,7 +52,7 @@ using namespace std; // Class static attributes initialisation LocalTraceBufferPool* LocalTraceBufferPool::_singleton = 0; -//#ifndef WNT +//#ifndef WIN32 //pthread_mutex_t LocalTraceBufferPool::_singletonMutex; //#else pthread_mutex_t LocalTraceBufferPool::_singletonMutex = @@ -110,7 +110,7 @@ LocalTraceBufferPool* LocalTraceBufferPool::instance() } else // --- try a dynamic library { -#ifndef WNT +#ifndef WIN32 void* handle; string impl_name = string ("lib") + traceKind + string("TraceCollector.so"); @@ -123,7 +123,7 @@ LocalTraceBufferPool* LocalTraceBufferPool::instance() if ( handle ) { typedef BaseTraceCollector * (*FACTORY_FUNCTION) (void); -#ifndef WNT +#ifndef WIN32 FACTORY_FUNCTION TraceCollectorFactory = (FACTORY_FUNCTION) dlsym(handle, "SingletonInstance"); #else @@ -133,7 +133,7 @@ LocalTraceBufferPool* LocalTraceBufferPool::instance() if ( !TraceCollectorFactory ) { MESSAGE ( "Can't resolve symbol: SingletonInstance" ); -#ifndef WNT +#ifndef WIN32 MESSAGE ( "dlerror: " << dlerror() ); #endif exit( 1 ); @@ -222,7 +222,7 @@ int LocalTraceBufferPool::retrieve(LocalTrace_TraceInfo& aTrace) while (ret) { ret = sem_wait(&_fullBufferSemaphore); - if (ret) MESSAGE(" LocalTraceBufferPool::retrieve, sem_wait"); + if (ret) MESSAGE (" LocalTraceBufferPool::retrieve, sem_wait"); } // get the next buffer to print diff --git a/src/SALOMELocalTrace/LocalTraceCollector.cxx b/src/SALOMELocalTrace/LocalTraceCollector.cxx index 7a77dfb7f..74e5ef94b 100644 --- a/src/SALOMELocalTrace/LocalTraceCollector.cxx +++ b/src/SALOMELocalTrace/LocalTraceCollector.cxx @@ -102,7 +102,7 @@ void* LocalTraceCollector::run(void *bid) if (myTrace.traceType == ABORT_MESS) { cout << flush ; -#ifndef WNT +#ifndef WIN32 cerr << "INTERRUPTION from thread " << myTrace.threadId << " : " << myTrace.trace; #else @@ -115,7 +115,7 @@ void* LocalTraceCollector::run(void *bid) else { cout << flush ; -#ifndef WNT +#ifndef WIN32 cerr << "th. " << myTrace.threadId << " " << myTrace.trace; #else cerr << "th. " << (void*)(&myTrace.threadId) << " " << myTrace.trace; diff --git a/src/SALOMELocalTrace/SALOME_LocalTrace.hxx b/src/SALOMELocalTrace/SALOME_LocalTrace.hxx index 743fc22c6..bbebb51e7 100755 --- a/src/SALOMELocalTrace/SALOME_LocalTrace.hxx +++ b/src/SALOMELocalTrace/SALOME_LocalTrace.hxx @@ -26,22 +26,14 @@ #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 +#ifdef WIN32 +# ifdef SALOMELOCALTRACE_EXPORTS +# define SALOMELOCALTRACE_EXPORT __declspec( dllexport ) +# else +# define SALOMELOCALTRACE_EXPORT __declspec( dllimport ) +# endif #else - #define SALOMELOCALTRACE_EXPORT +# define SALOMELOCALTRACE_EXPORT #endif #endif diff --git a/src/SALOMETraceCollector/SALOMETraceCollector.cxx b/src/SALOMETraceCollector/SALOMETraceCollector.cxx index aee066270..4388b22a0 100644 --- a/src/SALOMETraceCollector/SALOMETraceCollector.cxx +++ b/src/SALOMETraceCollector/SALOMETraceCollector.cxx @@ -137,7 +137,7 @@ void* SALOMETraceCollector::run(void *bid) if (myTrace.traceType == ABORT_MESS) { stringstream abortMessage(""); -#ifndef WNT +#ifndef WIN32 abortMessage << "INTERRUPTION from thread " << myTrace.threadId << " : " << myTrace.trace; #else @@ -153,7 +153,7 @@ void* SALOMETraceCollector::run(void *bid) else { stringstream aMessage(""); -#ifndef WNT +#ifndef WIN32 aMessage << "th. " << myTrace.threadId #else aMessage << "th. " << (void*)&myTrace.threadId diff --git a/src/SALOMETraceCollector/SALOMETraceCollector.hxx b/src/SALOMETraceCollector/SALOMETraceCollector.hxx index 58e069efd..eee6c9348 100644 --- a/src/SALOMETraceCollector/SALOMETraceCollector.hxx +++ b/src/SALOMETraceCollector/SALOMETraceCollector.hxx @@ -35,8 +35,8 @@ //! See LocalTraceCollector instead of SALOMETraceCollector, //! for usage without CORBA -#if defined WNT -# if defined SALOMETRACECOLLECTOR_EXPORTS +#ifdef WIN32 +# ifdef SALOMETRACECOLLECTOR_EXPORTS # define SALOMETRACECOLLECTOR_EXPORT __declspec( dllexport ) # else # define SALOMETRACECOLLECTOR_EXPORT diff --git a/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.cxx b/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.cxx index deb12a879..b05a63a37 100644 --- a/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.cxx +++ b/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.cxx @@ -28,7 +28,7 @@ #include #include -#ifdef WNT +#ifdef WIN32 #include #endif @@ -113,7 +113,7 @@ CORBA::Object_ptr TraceCollector_WaitForServerReadiness(CORBA::ORB_ptr orb, cout << "Caught exception: Naming Service can't found Logger"; } } -#ifndef WNT +#ifndef WIN32 nanosleep(&ts_req,&ts_rem); #else Sleep(TIMESleep / 1000000); diff --git a/src/TOOLSDS/SALOMEDS_Tool.cxx b/src/TOOLSDS/SALOMEDS_Tool.cxx index 290206e08..92f4ecae3 100644 --- a/src/TOOLSDS/SALOMEDS_Tool.cxx +++ b/src/TOOLSDS/SALOMEDS_Tool.cxx @@ -27,9 +27,9 @@ #include "SALOMEDS_Tool.hxx" #include "utilities.h" -#include "OpUtil.hxx" +#include "Basics_DirUtils.hxx" -#ifndef WNT +#ifndef WIN32 #include #include #include @@ -51,7 +51,7 @@ using namespace std; bool Exists(const string thePath) { -#ifdef WNT +#ifdef WIN32 if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) { if ( GetLastError () == ERROR_FILE_NOT_FOUND ) { return false; @@ -71,7 +71,7 @@ bool Exists(const string thePath) //============================================================================ std::string SALOMEDS_Tool::GetTmpDir() { - return OpUtil_Dir::GetTmpDirByEnv("SALOME_TMP_DIR"); + return Kernel_Utils::GetTmpDirByEnv("SALOME_TMP_DIR"); //Find a temporary directory to store a file /*string aTmpDir = ""; @@ -118,7 +118,7 @@ std::string SALOMEDS_Tool::GetTmpDir() #endif -#ifdef WNT +#ifdef WIN32 CreateDirectory(aDir.c_str(), NULL); #else mkdir(aDir.c_str(), 0x1ff); @@ -143,7 +143,7 @@ void SALOMEDS_Tool::RemoveTemporaryFiles(const std::string& theDirectory, aFile += theFiles[i-1]; if(!Exists(aFile)) continue; -#ifdef WNT +#ifdef WIN32 DeleteFile(aFile.c_str()); #else unlink(aFile.c_str()); @@ -152,7 +152,7 @@ void SALOMEDS_Tool::RemoveTemporaryFiles(const std::string& theDirectory, if(IsDirDeleted) { if(Exists(aDirName)) { -#ifdef WNT +#ifdef WIN32 RemoveDirectory(aDirName.c_str()); #else rmdir(aDirName.c_str()); @@ -197,7 +197,7 @@ namespace if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero string aFullPath = aTmpDir + const_cast(theFiles[i].in()); if(!Exists(aFullPath)) continue; -#ifdef WNT +#ifdef WIN32 ifstream aFile(aFullPath.c_str(), ios::binary); #else ifstream aFile(aFullPath.c_str()); @@ -231,7 +231,7 @@ namespace if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true string aFullPath = aTmpDir + const_cast(theFiles[i].in()); if(!Exists(aFullPath)) continue; -#ifdef WNT +#ifdef WIN32 aFile = new ifstream(aFullPath.c_str(), ios::binary); #else aFile = new ifstream(aFullPath.c_str()); @@ -338,7 +338,7 @@ SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream, aCurrentPos += 8; string aFullPath = aTmpDir + aFileName; -#ifdef WNT +#ifdef WIN32 ofstream aFile(aFullPath.c_str(), ios::binary); #else ofstream aFile(aFullPath.c_str()); @@ -409,7 +409,7 @@ std::string SALOMEDS_Tool::GetDirFromPath(const std::string& thePath) { path = thePath+"/"; } -#ifdef WNT //Check if the only disk letter is given as path +#ifdef WIN32 //Check if the only disk letter is given as path if(path.size() == 2 && path[1] == ':') path +='\\'; #endif diff --git a/src/TOOLSDS/SALOMEDS_Tool.hxx b/src/TOOLSDS/SALOMEDS_Tool.hxx index 0c57ace2e..ccddbec67 100644 --- a/src/TOOLSDS/SALOMEDS_Tool.hxx +++ b/src/TOOLSDS/SALOMEDS_Tool.hxx @@ -35,22 +35,14 @@ #include "SALOMEconfig.h" #include CORBA_SERVER_HEADER(SALOMEDS) -#ifdef WNT - #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 +#ifdef WIN32 +# ifdef TOOLSDS_EXPORTS +# define TOOLSDS_EXPORT __declspec( dllexport ) +# else +# define TOOLSDS_EXPORT __declspec( dllimport ) +# endif #else - #define TOOLSDS_EXPORT +# define TOOLSDS_EXPORT #endif class TOOLSDS_EXPORT SALOMEDS_Tool @@ -58,7 +50,7 @@ class TOOLSDS_EXPORT SALOMEDS_Tool public: // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set - // otherwise return /tmp/something/ for Unix or c:\something\ for WNT + // otherwise return /tmp/something/ for Unix or c:\something\ for WIN32 static std::string GetTmpDir(); diff --git a/src/TestContainer/Makefile.am b/src/TestContainer/Makefile.am index 8101d8b2a..f158d2a62 100644 --- a/src/TestContainer/Makefile.am +++ b/src/TestContainer/Makefile.am @@ -98,9 +98,11 @@ bin_PROGRAMS = TestContainer TestLogger TestContainer_SOURCES = TestContainer.cxx TestContainer_CPPFLAGS = $(COMMON_CPPFLAGS) TestContainer_LDADD = libSalomeTestComponentEngine.la \ + ../Basics/libSALOMEBasics.la \ $(CORBA_LIBS) TestLogger_SOURCES = TestLogger.cxx TestLogger_CPPFLAGS = $(COMMON_CPPFLAGS) TestLogger_LDADD = libSalomeTestComponentEngine.la \ + ../Basics/libSALOMEBasics.la \ $(CORBA_LIBS) diff --git a/src/TestContainer/SALOME_TestComponent_i.cxx b/src/TestContainer/SALOME_TestComponent_i.cxx index a3a81c616..2c598ae70 100644 --- a/src/TestContainer/SALOME_TestComponent_i.cxx +++ b/src/TestContainer/SALOME_TestComponent_i.cxx @@ -26,7 +26,7 @@ // Module : SALOME // $Header$ -#ifndef WNT +#ifndef WIN32 # define private protected #endif #include "utilities.h" diff --git a/src/TestContainer/TestContainer.cxx b/src/TestContainer/TestContainer.cxx index 2a2f834ea..b8f4dfd57 100644 --- a/src/TestContainer/TestContainer.cxx +++ b/src/TestContainer/TestContainer.cxx @@ -35,7 +35,7 @@ #include "SALOME_NamingService.hxx" #include "NamingService_WaitForServerReadiness.hxx" -#include "OpUtil.hxx" +#include "Basics_Utils.hxx" #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" #include "Utils_SALOME_Exception.hxx" @@ -91,7 +91,7 @@ int main (int argc, char * argv[]) { SALOME_NamingService _NS(orb) ; string containerName = "/Containers/" ; - string hostName = GetHostname(); + string hostName = Kernel_Utils::GetHostname(); containerName += hostName + "/FactoryServer"; NamingService_WaitForServerReadiness(&_NS,containerName); diff --git a/src/TestMPIContainer/TestMPIContainer.cxx b/src/TestMPIContainer/TestMPIContainer.cxx index fdc9f0e6b..3ca07f0d9 100644 --- a/src/TestMPIContainer/TestMPIContainer.cxx +++ b/src/TestMPIContainer/TestMPIContainer.cxx @@ -37,7 +37,7 @@ # include "Utils_ORB_INIT.hxx" # include "Utils_SINGLETON.hxx" #include "SALOME_NamingService.hxx" -#include "OpUtil.hxx" +#include "Basics_Utils.hxx" using namespace std; int main (int argc, char * argv[]) @@ -65,7 +65,7 @@ int main (int argc, char * argv[]) // Use Name Service to find container SALOME_NamingService NS(orb) ; string containerName = "/Containers/" ; - string hostName = GetHostname(); + string hostName = Kernel_Utils::GetHostname(); containerName += hostName + "/MPIFactoryServer_" + argv[2]; string dirn(getenv("KERNEL_ROOT_DIR")); diff --git a/src/Utils/Makefile.am b/src/Utils/Makefile.am index 5b3c3a37a..8c78e48a5 100644 --- a/src/Utils/Makefile.am +++ b/src/Utils/Makefile.am @@ -52,7 +52,8 @@ dist_salomescript_DATA =\ # Libraries targets lib_LTLIBRARIES = libOpUtil.la libOpUtil_la_SOURCES =\ - OpUtil.cxx Utils_Timer.cxx duplicate.cxx \ + Utils_Timer.cxx \ + duplicate.cxx \ Utils_CommException.cxx \ Utils_SALOME_Exception.cxx \ Utils_Identity.cxx Utils_ORB_INIT.cxx \ diff --git a/src/Utils/OpUtil.cxx b/src/Utils/OpUtil.cxx deleted file mode 100644 index 34efa8f77..000000000 --- a/src/Utils/OpUtil.cxx +++ /dev/null @@ -1,194 +0,0 @@ -// SALOME Utils : general SALOME's definitions and tools -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : OpUtil.cxx -// Module : SALOME - -#include "utilities.h" -#include "OpUtil.hxx" -#include -#include - -#ifndef WNT -#include -#include -#else -#include -#endif -using namespace std; - -#ifdef WIN32 -# define separator '\\' -#else -# define separator '/' -#endif - -//int gethostname(char *name, size_t len); - -std::string GetHostname() -{ - int ls = 100, r = 1; - char *s; - - while (ls < 10000 && r) { - ls *= 2; - s = new char[ls]; - r = gethostname(s, ls-1); - switch (r) - { - case 0: - break; - default: -#ifdef EINVAL - case EINVAL: -#endif -#ifdef ENAMETOOLONG - case ENAMETOOLONG: -#endif - delete [] s; - continue; - } - } - - if (r != 0) { - s = new char[50]; - strcpy(s, "localhost"); - } - - // remove all after '.' - char *aDot = (strchr(s,'.')); - if (aDot) aDot[0] = '\0'; - - string p = s; - delete [] s; - return p; -} - - -std::string OpUtil_Dir::GetTmpDirByEnv( const std::string& tmp_path_env ) -{ - string dir; - char* val = getenv( tmp_path_env.c_str() ); - val ? dir = string( val ) : ""; - return GetTmpDirByPath( dir ); -} - -std::string OpUtil_Dir::GetTmpDirByPath( const std::string& tmp_path ) -{ - string aTmpDir = tmp_path; - if ( aTmpDir == "" ) - { -#ifdef WNT - char *Tmp_dir = getenv("TEMP"); - if( Tmp_dir == NULL ) - { - Tmp_dir = getenv("TMP"); - if (Tmp_dir == NULL) - aTmpDir = string("C:\\"); - else - aTmpDir = string(Tmp_dir); - } - else - aTmpDir = string(Tmp_dir); -#else - aTmpDir = string("/tmp/"); -#endif - } - - if(aTmpDir[aTmpDir.size()-1] != separator) - aTmpDir+=separator; - - srand((unsigned int)time(NULL)); - int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory - char buffer[127]; - sprintf(buffer, "%d", aRND); - string aSubDir(buffer); - if(aSubDir.size() <= 1) aSubDir = string("123409876"); - - aTmpDir += aSubDir; //Get RND sub directory - - string aDir = aTmpDir; - - if(IsExists(aDir)) { - for(aRND = 0; IsExists(aDir); aRND++) { - sprintf(buffer, "%d", aRND); - aDir = aTmpDir+buffer; //Build a unique directory name - } - } - - if(aDir[aDir.size()-1] != separator) aDir+=separator; - -#ifdef WNT - CreateDirectory(aDir.c_str(), NULL); -#else - mkdir(aDir.c_str(), 0x1ff); -#endif - - return aDir; -} - -//============================================================================ -// function : GetTempDir -// purpose : Return a temp directory to store created files like "/tmp/sub_dir/" -//============================================================================ -std::string OpUtil_Dir::GetTmpDir() -{ - return GetTmpDirByPath( "" ); -} - -string OpUtil_Dir::GetTmpFileName() -{ - string tmpDir = GetTmpDir(); - string aFilePath = ""; - if(IsExists(tmpDir)) { - srand((unsigned int)time(NULL)); - int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory - char buffer[127]; - sprintf(buffer, "%d", aRND); - string aSubDir(buffer); - if(aSubDir.size() <= 1) aSubDir = string("123409876"); - - string aFilePath = tmpDir; - for(aRND = 0; IsExists(aFilePath); aRND++) { - sprintf(buffer, "%d", aRND); - aFilePath = tmpDir+buffer; //Build a unique file name - } - } - return aFilePath; -} - - -bool OpUtil_Dir::IsExists(const string& thePath) -{ -#ifdef WNT - if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) { - if ( GetLastError () == ERROR_FILE_NOT_FOUND ) { - return false; - } - } -#else - int status = access ( thePath.c_str() , F_OK ); - if (status != 0) return false; -#endif - return true; -} \ No newline at end of file diff --git a/src/Utils/OpUtil.hxx b/src/Utils/OpUtil.hxx index d3aafddc1..4e9cf4de1 100644 --- a/src/Utils/OpUtil.hxx +++ b/src/Utils/OpUtil.hxx @@ -29,33 +29,6 @@ #include "SALOME_Utils.hxx" -#include - -UTILS_EXPORT std::string GetHostname(); UTILS_EXPORT const char *duplicate(const char * const); -class UTILS_EXPORT OpUtil_Dir -{ -public: - // Returns the unique temporary directory, that is defined in tmp_path_env if this variable is set - // otherwise return /tmp/something/ for Unix or c:\something\ for WNT - static std::string GetTmpDirByEnv( const std::string& tmp_path_env ); - - // Returns the unique temporary directory, that is defined in tmp_path if this variable is set - // otherwise return /tmp/something/ for Unix or c:\something\ for WNT - static std::string GetTmpDirByPath( const std::string& tmp_path ); - - // Returns the unique temporary directory in - // /tmp/something/ for Unix or c:\something\ for WNT - static std::string GetTmpDir(); - - // Returns the unique temporary file name without any extension - // /tmp/something/file for Unix or c:\something\file for WNT - static std::string GetTmpFileName(); - - // Returns True(False) if the path (not)exists - static bool IsExists( const std::string& path ); - -}; - #endif diff --git a/src/Utils/SALOME_Utils.hxx b/src/Utils/SALOME_Utils.hxx index d6c28d278..3ae0e6f02 100755 --- a/src/Utils/SALOME_Utils.hxx +++ b/src/Utils/SALOME_Utils.hxx @@ -26,7 +26,7 @@ #ifndef _SALOME_UTILS_HXX_ #define _SALOME_UTILS_HXX_ -#ifdef WNT +#ifdef WIN32 # if defined UTILS_EXPORTS # define UTILS_EXPORT __declspec( dllexport ) # else diff --git a/src/Utils/Utils_Identity.cxx b/src/Utils/Utils_Identity.cxx index d95ea641c..1c26a600a 100644 --- a/src/Utils/Utils_Identity.cxx +++ b/src/Utils/Utils_Identity.cxx @@ -34,12 +34,12 @@ extern "C" { # include -#ifndef WNT /* unix functionality */ +#ifndef WIN32 /* unix functionality */ # include #endif } -#ifndef WNT /* unix functionality */ +#ifndef WIN32 /* unix functionality */ # include # include @@ -153,7 +153,7 @@ PSID getuid() { #define getcwd _getcwd #define getpid _getpid -#endif /* WNT */ +#endif /* WIN32 */ Identity::Identity( const char *name ): _name(duplicate(name)),\ @@ -197,7 +197,7 @@ const char* const Identity::name (void) const { return _name ; } -#ifndef WNT +#ifndef WIN32 const pid_t& Identity::pid(void) const #else const DWORD& Identity::pid(void) const @@ -206,7 +206,7 @@ const char* const Identity::name (void) const return _pid ; } -#ifndef WNT +#ifndef WIN32 const struct utsname &Identity::hostid(void) const #else const char* const Identity::hostid(void) const @@ -215,7 +215,7 @@ const char* const Identity::name (void) const return _hostid ; } -#ifndef WNT +#ifndef WIN32 const uid_t& Identity::uid(void) const #else const PSID& Identity::uid(void) const @@ -246,7 +246,7 @@ const char* const Identity::adip (void) const const char* Identity::host_char( void ) const { -#ifndef WNT +#ifndef WIN32 return _hostid.nodename; #else return _hostid; @@ -266,7 +266,7 @@ std::ostream & operator<< ( std::ostream& os , const Identity& monid ) os << '\t' << "Numero de PID : " << monid._pid << std::endl; os << '\t' << "Uid utilisateur : " << monid._uid << std::endl; os << '\t' << "nom utilisateur : " << monid._pwname << std::endl; -#ifndef WNT +#ifndef WIN32 os << '\t' << "Nom de machine : " << monid._hostid.nodename << std::endl; #else os << '\t' << "Nom de machine : " << monid._hostid << std::endl; diff --git a/src/Utils/Utils_Identity.hxx b/src/Utils/Utils_Identity.hxx index 43c3d0428..0634586e9 100644 --- a/src/Utils/Utils_Identity.hxx +++ b/src/Utils/Utils_Identity.hxx @@ -35,7 +35,7 @@ extern "C" { # include # include -#ifndef WNT +#ifndef WIN32 # include # include #else @@ -50,7 +50,7 @@ protected : const char* const _name ; const char* const _adip; // Internet address -#ifndef WNT +#ifndef WIN32 const struct utsname _hostid; const pid_t _pid ; const uid_t _uid ; @@ -73,7 +73,7 @@ public : ~Identity(); friend std::ostream & operator<< ( std::ostream& os , const Identity& monid ); -#ifndef WNT +#ifndef WIN32 const pid_t& pid(void) const; const struct utsname& hostid(void) const; const uid_t& uid(void) const; diff --git a/src/Utils/Utils_Mutex.cxx b/src/Utils/Utils_Mutex.cxx index ff2dcc936..a1dbbb6e4 100644 --- a/src/Utils/Utils_Mutex.cxx +++ b/src/Utils/Utils_Mutex.cxx @@ -45,7 +45,7 @@ void Utils_Mutex::lock() { pthread_mutex_lock( &myHelperMutex ); -#ifndef WNT +#ifndef WIN32 if ( myCount > 0 && myThread == pthread_self() ) { #else if ( myCount > 0 && myThread.p == pthread_self().p ) { @@ -67,7 +67,7 @@ void Utils_Mutex::unlock() { pthread_mutex_lock( &myHelperMutex ); -#ifndef WNT +#ifndef WIN32 if ( myThread == pthread_self() ) { #else if ( myThread.p == pthread_self().p ) { diff --git a/src/Utils/Utils_SALOME_Exception.cxx b/src/Utils/Utils_SALOME_Exception.cxx index aacd15166..8f6faf2a5 100644 --- a/src/Utils/Utils_SALOME_Exception.cxx +++ b/src/Utils/Utils_SALOME_Exception.cxx @@ -30,14 +30,14 @@ #include "Utils_SALOME_Exception.hxx" #include "utilities.h" -#ifndef WNT +#ifndef WIN32 extern "C" { #endif #include #include #include -#ifndef WNT +#ifndef WIN32 } #endif diff --git a/src/Utils/Utils_SALOME_Exception.hxx b/src/Utils/Utils_SALOME_Exception.hxx index 979b3e137..3cfc71370 100644 --- a/src/Utils/Utils_SALOME_Exception.hxx +++ b/src/Utils/Utils_SALOME_Exception.hxx @@ -37,7 +37,7 @@ #ifdef LOCALIZED #undef LOCALIZED #endif -#ifdef _DEBUG_ +#if defined(_DEBUG_) || defined(_DEBUG) # define LOCALIZED(message) #message , __FILE__ , __LINE__ #else # define LOCALIZED(message) #message @@ -46,8 +46,8 @@ //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 +#ifdef WIN32 +# ifdef UTILS_EXPORTS # define UTILS_EXPORT __declspec( dllexport ) # else # define UTILS_EXPORT __declspec( dllimport ) diff --git a/src/Utils/Utils_Timer.cxx b/src/Utils/Utils_Timer.cxx index e15c89a55..41b90d24e 100644 --- a/src/Utils/Utils_Timer.cxx +++ b/src/Utils/Utils_Timer.cxx @@ -30,7 +30,7 @@ #include "utilities.h" -#ifndef WNT +#ifndef WIN32 static struct timezone *tz=(struct timezone*) malloc(sizeof(struct timezone)); #else //timezone *tz=_timezone; @@ -41,7 +41,7 @@ static struct timezone *tz=(struct timezone*) malloc(sizeof(struct timezone)); #endif Utils_Timer::Utils_Timer() { -#ifndef WNT +#ifndef WIN32 RefToInitialTMS = new tms; RefToCurrentTMS = new tms; @@ -70,7 +70,7 @@ Utils_Timer::~Utils_Timer() { void Utils_Timer::Start() { if (Stopped) { Stopped = 0; -#ifndef WNT +#ifndef WIN32 times(RefToInitialTMS); gettimeofday(RefToInitialTimeB,tz); #else @@ -84,7 +84,7 @@ void Utils_Timer::Start() { void Utils_Timer::Stop() { if (!Stopped) { -#ifndef WNT +#ifndef WIN32 times(RefToCurrentTMS); int diffr_user = RefToCurrentTMS->tms_utime - RefToInitialTMS->tms_utime; int diffr_sys = RefToCurrentTMS->tms_stime - RefToInitialTMS->tms_stime; @@ -119,7 +119,7 @@ void Utils_Timer::Reset() { void Utils_Timer::ShowAbsolute(){ #if defined(_DEBUG_) || defined(_DEBUG) -#ifndef WNT +#ifndef WIN32 unsigned long Absolute_user = (unsigned long) ((timeval*)RefToCurrentTimeB)->tv_sec ; #else unsigned long Absolute_user = *RefToCurrentTimeB; diff --git a/src/Utils/Utils_Timer.hxx b/src/Utils/Utils_Timer.hxx index a8363e030..84edf590d 100644 --- a/src/Utils/Utils_Timer.hxx +++ b/src/Utils/Utils_Timer.hxx @@ -29,7 +29,7 @@ #include #include -#ifndef WNT +#ifndef WIN32 # include # include # include @@ -53,7 +53,7 @@ class UTILS_EXPORT Utils_Timer { double Cumul_user; double Cumul_sys; bool Stopped; -#ifndef WNT +#ifndef WIN32 tms *RefToCurrentTMS, *RefToInitialTMS; timeval *RefToCurrentTimeB, *RefToInitialTimeB; #else -- 2.39.2