From: abd Date: Fri, 3 Oct 2008 10:44:26 +0000 (+0000) Subject: Win32 Porting. X-Git-Tag: RELIQUAT_4x_25102008~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e5d103cad6e1d53bae3014b27e98802a7d27c08d;p=modules%2Fkernel.git 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. --- diff --git a/src/DSC/DSC_User/Datastream/Palm/PalmCouplingPolicy.hxx b/src/DSC/DSC_User/Datastream/Palm/PalmCouplingPolicy.hxx index c5f57fff4..ac23a59ce 100644 --- a/src/DSC/DSC_User/Datastream/Palm/PalmCouplingPolicy.hxx +++ b/src/DSC/DSC_User/Datastream/Palm/PalmCouplingPolicy.hxx @@ -87,11 +87,11 @@ public: std::cout << "----Cst ---- InternalDataIdContainer(const DataId & dataId..) " << dataId <::iterator i=_lTime.begin();i!=_lTime.end();++i) + for(std::vector::iterator i=_lTime.begin();i!=_lTime.end();++i) std::cout << "_lTime["<< c++ << "] : " << *i << std::endl; policy.filtre_convert_TAG.applique_filtre_conversion(dataId.second, _lTag); c=0; - for(vector::iterator i=_lTag.begin();i!=_lTag.end();++i) + for(std::vector::iterator i=_lTag.begin();i!=_lTag.end();++i) std::cout << "_lTag["<< c++ << "] : " << *i << std::endl; } diff --git a/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.cxx b/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.cxx index 2c194efb1..43107b133 100644 --- a/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.cxx +++ b/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.cxx @@ -29,6 +29,8 @@ #include "palm_port_factory.hxx" +using namespace std; + palm_port_factory::palm_port_factory() { } diff --git a/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.hxx b/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.hxx index 544a9c1eb..c8007374b 100644 --- a/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.hxx +++ b/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.hxx @@ -38,8 +38,6 @@ #include "palm_data_short_port_provides.hxx" #include "palm_data_seq_short_port_provides.hxx" -using namespace std; - class palm_port_factory : public port_factory { @@ -47,8 +45,8 @@ class palm_port_factory : palm_port_factory(); virtual ~palm_port_factory(); - virtual provides_port * create_data_servant(string type); - virtual uses_port * create_data_proxy(string type); + virtual provides_port * create_data_servant(std::string type); + virtual uses_port * create_data_proxy(std::string type); }; #endif diff --git a/src/Notification/SALOME_NOTIFICATION.hxx b/src/Notification/SALOME_NOTIFICATION.hxx index c187b4119..bc58c084e 100755 --- a/src/Notification/SALOME_NOTIFICATION.hxx +++ b/src/Notification/SALOME_NOTIFICATION.hxx @@ -26,22 +26,14 @@ #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 +#ifdef WIN32 +# ifdef NOTIFICATION_EXPORTS +# define NOTIFICATION_EXPORT __declspec( dllexport ) +# else +# define NOTIFICATION_EXPORT __declspec( dllimport ) +# endif #else - #define NOTIFICATION_EXPORT +# define NOTIFICATION_EXPORT #endif #endif diff --git a/src/TOOLSDS/SALOMEDS_Tool.cxx b/src/TOOLSDS/SALOMEDS_Tool.cxx index fcf2be69d..92f4ecae3 100644 --- a/src/TOOLSDS/SALOMEDS_Tool.cxx +++ b/src/TOOLSDS/SALOMEDS_Tool.cxx @@ -27,13 +27,12 @@ #include "SALOMEDS_Tool.hxx" #include "utilities.h" +#include "Basics_DirUtils.hxx" -#ifndef WNT +#ifndef WIN32 #include #include #include -#include -#include #include #include #else @@ -41,6 +40,8 @@ #include #endif +#include +#include #include #include @@ -50,9 +51,9 @@ using namespace std; bool Exists(const string thePath) { -#ifdef WNT +#ifdef WIN32 if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) { - if ( GetLastError () != ERROR_FILE_NOT_FOUND ) { + if ( GetLastError () == ERROR_FILE_NOT_FOUND ) { return false; } } @@ -70,9 +71,10 @@ bool Exists(const string thePath) //============================================================================ std::string SALOMEDS_Tool::GetTmpDir() { + return Kernel_Utils::GetTmpDirByEnv("SALOME_TMP_DIR"); //Find a temporary directory to store a file - string aTmpDir = ""; + /*string aTmpDir = ""; char *Tmp_dir = getenv("SALOME_TMP_DIR"); if(Tmp_dir != NULL) { @@ -116,13 +118,13 @@ std::string SALOMEDS_Tool::GetTmpDir() #endif -#ifdef WNT +#ifdef WIN32 CreateDirectory(aDir.c_str(), NULL); #else mkdir(aDir.c_str(), 0x1ff); #endif - return aDir; + return aDir;*/ } //============================================================================ @@ -141,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()); @@ -150,8 +152,8 @@ void SALOMEDS_Tool::RemoveTemporaryFiles(const std::string& theDirectory, if(IsDirDeleted) { if(Exists(aDirName)) { -#ifdef WNT - RemoveDirectory(aDireName.c_str()); +#ifdef WIN32 + RemoveDirectory(aDirName.c_str()); #else rmdir(aDirName.c_str()); #endif @@ -195,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()); @@ -229,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()); @@ -336,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()); @@ -407,8 +409,8 @@ std::string SALOMEDS_Tool::GetDirFromPath(const std::string& thePath) { path = thePath+"/"; } -#ifdef WNT //Check if the only disk letter is given as path - if(path.size() == 2 && path[1] == ":") path +='\\'; +#ifdef WIN32 //Check if the only disk letter is given as path + if(path.size() == 2 && path[1] == ':') path +='\\'; #endif for(int i = 0, len = path.size(); i +#include "SALOME_Utils.hxx" -#include - -UTILS_EXPORT std::string GetHostname(); UTILS_EXPORT const char *duplicate(const char * const); #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_ExceptHandlers.hxx b/src/Utils/Utils_ExceptHandlers.hxx index 8ac5aa8e5..ff40370f1 100644 --- a/src/Utils/Utils_ExceptHandlers.hxx +++ b/src/Utils/Utils_ExceptHandlers.hxx @@ -29,7 +29,7 @@ #ifndef Utils_ExceptHandlers_HeaderFile #define Utils_ExceptHandlers_HeaderFile -#include +#include "SALOME_Utils.hxx" #include @@ -38,7 +38,7 @@ typedef void (*PVF)(); class UTILS_EXPORT Unexpect { //save / retrieve unexpected exceptions treatment PVF old; public : -#ifndef WNT +#ifndef WIN32 Unexpect( PVF f ) { old = std::set_unexpected(f); } ~Unexpect() { std::set_unexpected(old); } @@ -53,7 +53,7 @@ class UTILS_EXPORT Terminate {//save / retrieve terminate function PVF old; public : -#ifndef WNT +#ifndef WIN32 Terminate( PVF f ) { old = std::set_terminate(f); } ~Terminate() { std::set_terminate(old); } 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 5e508a47f..5bce751ff 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 88a0c5747..8fa7ec33c 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..eeb9dc13c 100644 --- a/src/Utils/Utils_SALOME_Exception.hxx +++ b/src/Utils/Utils_SALOME_Exception.hxx @@ -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