From 0a656bba069f0dd45c0533efb31943cff0a69e24 Mon Sep 17 00:00:00 2001 From: abd Date: Fri, 3 Oct 2008 09:28:46 +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. --- .../Calcium/CalciumCxxInterface.hxx | 32 +++++++++---------- .../Calcium/calcium_port_factory.cxx | 2 ++ .../Calcium/calcium_port_factory.hxx | 6 ++-- src/GenericObj/SALOME_GenericObj_i.cc | 2 +- src/GenericObj/SALOME_GenericObj_i.hh | 18 ++++------- src/HDFPersist/HDFascii.cc | 24 ++++++++++---- src/HDFPersist/HDFascii.hxx | 2 +- src/HDFPersist/HDFattribute.hxx | 2 +- src/HDFPersist/HDFcontainerObject.hxx | 2 +- src/HDFPersist/HDFconvert.cc | 4 +-- src/HDFPersist/HDFconvert.hxx | 5 +-- src/HDFPersist/HDFdataset.hxx | 2 +- src/HDFPersist/HDFexception.hxx | 4 ++- src/HDFPersist/HDFexplorer.hxx | 2 +- src/HDFPersist/HDFexport.hxx | 14 ++++---- src/HDFPersist/HDFfile.cc | 2 +- src/HDFPersist/HDFfile.hxx | 2 +- src/HDFPersist/HDFgroup.hxx | 2 +- src/HDFPersist/HDFinternalObject.cc | 3 +- src/HDFPersist/HDFinternalObject.hxx | 2 +- src/HDFPersist/HDFobject.cc | 3 +- src/HDFPersist/HDFobject.hxx | 2 +- 22 files changed, 73 insertions(+), 64 deletions(-) diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx index 969b510e8..4f7c8259e 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx @@ -163,7 +163,7 @@ namespace CalciumInterface { double & ti, double const & tf, long & i, - const string & nomVar, + const std::string & nomVar, size_t bufferLength, size_t & nRead, T1 * &data ) @@ -321,14 +321,14 @@ namespace CalciumInterface { // T1 est le type de données template static void ecp_lecture ( Superv_Component_i & component, - int const & dependencyType, - double & ti, - double const & tf, - long & i, - const string & nomVar, - size_t bufferLength, - size_t & nRead, - T1 * &data ) + int const & dependencyType, + double & ti, + double const & tf, + long & i, + const std::string & nomVar, + size_t bufferLength, + size_t & nRead, + T1 * &data ) { ecp_lecture (component,dependencyType,ti,tf, i,nomVar,bufferLength,nRead,data); @@ -341,12 +341,12 @@ namespace CalciumInterface { // T2 : PortType template static void ecp_ecriture ( Superv_Component_i & component, - int const & dependencyType, - double const & t, - long const & i, - const string & nomVar, - size_t bufferLength, - T1 const & data ) + int const & dependencyType, + double const & t, + long const & i, + const std::string & nomVar, + size_t bufferLength, + T1 const & data ) { assert(&component); @@ -521,7 +521,7 @@ namespace CalciumInterface { int const & dependencyType, double const & t, long const & i, - const string & nomVar, + const std::string & nomVar, size_t bufferLength, T1 const & data ) { ecp_ecriture (component,dependencyType,t,i,nomVar,bufferLength,data); diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx index 504945a57..121ede25d 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx @@ -28,6 +28,8 @@ #include "calcium_port_factory.hxx" +using namespace std; + calcium_port_factory::calcium_port_factory() {} calcium_port_factory::~calcium_port_factory() {} diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx index 6cb050411..03e317a99 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx @@ -44,8 +44,6 @@ #include "calcium_logical_port_uses.hxx" #include "calcium_complex_port_uses.hxx" -using namespace std; - class calcium_port_factory : public port_factory { @@ -53,8 +51,8 @@ class calcium_port_factory : calcium_port_factory(); virtual ~calcium_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/GenericObj/SALOME_GenericObj_i.cc b/src/GenericObj/SALOME_GenericObj_i.cc index 2760b73db..9158f4ed9 100644 --- a/src/GenericObj/SALOME_GenericObj_i.cc +++ b/src/GenericObj/SALOME_GenericObj_i.cc @@ -41,7 +41,7 @@ GenericObj_i::GenericObj_i(PortableServer::POA_ptr thePOA): myRefCounter(1){ MESSAGE("GenericObj_i::GenericObj_i() - this = "< #include -#ifdef WNT +#ifdef WIN32 #include #include +#include +#define dir_separator '\\' +#else +#define dir_separator '/' #endif using namespace std; @@ -653,11 +657,12 @@ string GetTmpDir() char *Tmp_dir = getenv("SALOME_TMP_DIR"); if(Tmp_dir != NULL) { aTmpDir = string(Tmp_dir); -#ifdef WIN32 + if(aTmpDir[aTmpDir.size()-1] != dir_separator) aTmpDir+=dir_separator; +/*#ifdef WIN32 if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\'; #else if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/'; -#endif +#endif*/ } else { #ifdef WIN32 @@ -676,11 +681,14 @@ string GetTmpDir() aTmpDir += aSubDir; //Get RND sub directory + if(aTmpDir[aTmpDir.size()-1] != dir_separator) aTmpDir+=dir_separator; +/* #ifdef WIN32 if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\'; #else if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/'; #endif + */ string aDir = aTmpDir; @@ -689,13 +697,15 @@ string GetTmpDir() aDir = aTmpDir+buffer; //Build a unique directory name } -#ifdef WNT +#ifdef WIN32 + //fuction CreateDirectory create only final directory, but not intermediate + CreateDirectory(aTmpDir.c_str(), NULL); CreateDirectory(aDir.c_str(), NULL); #else mkdir(aDir.c_str(), 0x1ff); #endif - return aDir; + return aDir + dir_separator; } char* makeName(char* name) @@ -753,7 +763,7 @@ void read_float64(FILE* fp, hdf_float64* value) bool Exists(const string thePath) { -#ifdef WNT +#ifdef WIN32 if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) { if ( GetLastError () != ERROR_FILE_NOT_FOUND ) { return false; @@ -768,7 +778,7 @@ bool Exists(const string thePath) void Move(const string& fName, const string& fNameDst) { -#ifdef WNT +#ifdef WIN32 MoveFileEx (fName.c_str(), fNameDst.c_str(),MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED); #else rename(fName.c_str(), fNameDst.c_str()); diff --git a/src/HDFPersist/HDFascii.hxx b/src/HDFPersist/HDFascii.hxx index 999b17352..254fc9de5 100644 --- a/src/HDFPersist/HDFascii.hxx +++ b/src/HDFPersist/HDFascii.hxx @@ -31,7 +31,7 @@ #include "HDFexport.hxx" -class HDF_EXPORT HDFascii +class HDFPERSIST_EXPORT HDFascii { public: diff --git a/src/HDFPersist/HDFattribute.hxx b/src/HDFPersist/HDFattribute.hxx index 9ec84e75b..9ede64cec 100644 --- a/src/HDFPersist/HDFattribute.hxx +++ b/src/HDFPersist/HDFattribute.hxx @@ -34,7 +34,7 @@ extern "C" #include "HDFinternalObject.hxx" #include "HDFcontainerObject.hxx" -class HDFattribute : public HDFobject +class HDFPERSIST_EXPORT HDFattribute : public HDFobject { private : HDFinternalObject *_father; diff --git a/src/HDFPersist/HDFcontainerObject.hxx b/src/HDFPersist/HDFcontainerObject.hxx index dfc237b26..117145c94 100644 --- a/src/HDFPersist/HDFcontainerObject.hxx +++ b/src/HDFPersist/HDFcontainerObject.hxx @@ -35,7 +35,7 @@ extern "C" #include "HDFinternalObject.hxx" #include "HDFexport.hxx" -class HDF_EXPORT HDFcontainerObject : public HDFinternalObject +class HDFPERSIST_EXPORT HDFcontainerObject : public HDFinternalObject { private : HDFinternalObject *_firstson; diff --git a/src/HDFPersist/HDFconvert.cc b/src/HDFPersist/HDFconvert.cc index eaf7b21a5..6bac949e0 100644 --- a/src/HDFPersist/HDFconvert.cc +++ b/src/HDFPersist/HDFconvert.cc @@ -27,7 +27,7 @@ #include "HDFconvert.hxx" using namespace std; -#ifdef WNT +#ifdef WIN32 #include #include #endif @@ -64,7 +64,7 @@ int HDFConvert::FromAscii(const string& file, const HDFcontainerObject & hdf_con perror("HDFConvert::FromAscii"); return -1; }; -#elif defined WNT +#elif defined WIN32 #define SHMEMSIZE 4096 diff --git a/src/HDFPersist/HDFconvert.hxx b/src/HDFPersist/HDFconvert.hxx index 20b65affd..876340d44 100644 --- a/src/HDFPersist/HDFconvert.hxx +++ b/src/HDFPersist/HDFconvert.hxx @@ -30,7 +30,7 @@ extern "C" { #include "HDFtypes.h" -#ifndef WNT +#ifndef WIN32 #include #include #else @@ -41,13 +41,14 @@ extern "C" #include #include } +#include "HDFexport.hxx" #include "HDFcontainerObject.hxx" #include "HDFdataset.hxx" #include "HDFfile.hxx" #include -class HDFConvert +class HDFPERSIST_EXPORT HDFConvert { private: diff --git a/src/HDFPersist/HDFdataset.hxx b/src/HDFPersist/HDFdataset.hxx index 1e2a62401..b27f8bade 100644 --- a/src/HDFPersist/HDFdataset.hxx +++ b/src/HDFPersist/HDFdataset.hxx @@ -35,7 +35,7 @@ extern "C" #include "HDFcontainerObject.hxx" #include "HDFexport.hxx" -class HDF_EXPORT HDFdataset : public HDFinternalObject +class HDFPERSIST_EXPORT HDFdataset : public HDFinternalObject { private : HDFcontainerObject *_father; diff --git a/src/HDFPersist/HDFexception.hxx b/src/HDFPersist/HDFexception.hxx index 2ec2ce4a5..7cc9c4986 100644 --- a/src/HDFPersist/HDFexception.hxx +++ b/src/HDFPersist/HDFexception.hxx @@ -27,11 +27,13 @@ #ifndef __HDFexception_H__ #define __HDFexception_H__ +#include "HDFexport.hxx" + /* Exception */ #include -class HDFexception +class HDFPERSIST_EXPORT HDFexception { public : HDFexception(const char *message) { diff --git a/src/HDFPersist/HDFexplorer.hxx b/src/HDFPersist/HDFexplorer.hxx index e66fbe390..c2d5f3682 100644 --- a/src/HDFPersist/HDFexplorer.hxx +++ b/src/HDFPersist/HDFexplorer.hxx @@ -30,7 +30,7 @@ #include "HDFinternalObject.hxx" #include "HDFcontainerObject.hxx" -class HDFexplorer { +class HDFPERSIST_EXPORT HDFexplorer { private : int _size; HDFcontainerObject *_container; diff --git a/src/HDFPersist/HDFexport.hxx b/src/HDFPersist/HDFexport.hxx index 21b64d34e..060b1e592 100644 --- a/src/HDFPersist/HDFexport.hxx +++ b/src/HDFPersist/HDFexport.hxx @@ -26,14 +26,14 @@ #ifndef _HDF_export_HXX_ #define _HDF_export_HXX_ -#ifdef WNT - #if defined WIN32 - #define HDF_EXPORT __declspec( dllimport ) - #else - #define HDF_EXPORT - #endif +#ifdef WIN32 +# ifdef HDFPERSIST_EXPORTS +# define HDFPERSIST_EXPORT __declspec( dllexport ) +# else +# define HDFPERSIST_EXPORT __declspec( dllimport ) +# endif #else - #define HDF_EXPORT +# define HDFPERSIST_EXPORT #endif #endif diff --git a/src/HDFPersist/HDFfile.cc b/src/HDFPersist/HDFfile.cc index 96c763598..aea67a55a 100644 --- a/src/HDFPersist/HDFfile.cc +++ b/src/HDFPersist/HDFfile.cc @@ -27,7 +27,7 @@ extern "C" { #include "hdfi.h" -#ifndef WNT +#ifndef WIN32 #include #else #include diff --git a/src/HDFPersist/HDFfile.hxx b/src/HDFPersist/HDFfile.hxx index b1d32881f..2f908cf9f 100644 --- a/src/HDFPersist/HDFfile.hxx +++ b/src/HDFPersist/HDFfile.hxx @@ -34,7 +34,7 @@ extern "C" #include "HDFcontainerObject.hxx" #include "HDFexport.hxx" -class HDF_EXPORT HDFfile : public HDFcontainerObject +class HDFPERSIST_EXPORT HDFfile : public HDFcontainerObject { private : hdf_access_mode _access_mode; diff --git a/src/HDFPersist/HDFgroup.hxx b/src/HDFPersist/HDFgroup.hxx index 07e79e36e..0a1bbc407 100644 --- a/src/HDFPersist/HDFgroup.hxx +++ b/src/HDFPersist/HDFgroup.hxx @@ -34,7 +34,7 @@ extern "C" #include "HDFcontainerObject.hxx" #include "HDFexport.hxx" -class HDF_EXPORT HDFgroup : public HDFcontainerObject +class HDFPERSIST_EXPORT HDFgroup : public HDFcontainerObject { private : HDFcontainerObject *_father; diff --git a/src/HDFPersist/HDFinternalObject.cc b/src/HDFPersist/HDFinternalObject.cc index 716e6da49..3ea1f0364 100644 --- a/src/HDFPersist/HDFinternalObject.cc +++ b/src/HDFPersist/HDFinternalObject.cc @@ -29,9 +29,8 @@ extern "C" #include "hdfi.h" } #include "HDFinternalObject.hxx" -#ifndef WNT + using namespace std; -#endif HDFinternalObject::HDFinternalObject(const char *name) : HDFobject(name) diff --git a/src/HDFPersist/HDFinternalObject.hxx b/src/HDFPersist/HDFinternalObject.hxx index ee4c32e51..232305016 100644 --- a/src/HDFPersist/HDFinternalObject.hxx +++ b/src/HDFPersist/HDFinternalObject.hxx @@ -34,7 +34,7 @@ extern "C" #include "HDFobject.hxx" #include "HDFexport.hxx" -class HDF_EXPORT HDFinternalObject : public HDFobject +class HDFPERSIST_EXPORT HDFinternalObject : public HDFobject { private : HDFinternalObject *_previousbrother; diff --git a/src/HDFPersist/HDFobject.cc b/src/HDFPersist/HDFobject.cc index 5adb8aafe..e4f751a9b 100644 --- a/src/HDFPersist/HDFobject.cc +++ b/src/HDFPersist/HDFobject.cc @@ -28,8 +28,9 @@ extern "C" { #include "hdfi.h" -#include } + +#include //#include "utilities.h" using namespace std; diff --git a/src/HDFPersist/HDFobject.hxx b/src/HDFPersist/HDFobject.hxx index 9dafc4447..9862e8428 100644 --- a/src/HDFPersist/HDFobject.hxx +++ b/src/HDFPersist/HDFobject.hxx @@ -33,7 +33,7 @@ extern "C" } #include "HDFexport.hxx" -class HDF_EXPORT HDFobject { +class HDFPERSIST_EXPORT HDFobject { protected : char *_name; hdf_idt _id; -- 2.39.2