From: rnv Date: Fri, 31 Mar 2017 07:15:27 +0000 (+0300) Subject: Windows compatibility. X-Git-Tag: V8_3_0rc1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c8c74ab2688762707f53bba27c3a1883ef766441;hp=28e60ce8c9ce4d1ced9a5b61ef58dc4919864d99;p=modules%2Fyacs.git Windows compatibility. --- diff --git a/src/py2yacs/CMakeLists.txt b/src/py2yacs/CMakeLists.txt index d5c4ce3ba..8e32b7c4e 100644 --- a/src/py2yacs/CMakeLists.txt +++ b/src/py2yacs/CMakeLists.txt @@ -28,6 +28,7 @@ INCLUDE_DIRECTORIES( ADD_DEFINITIONS( ${PYTHON_DEFINITIONS} + ${OMNIORB_DEFINITIONS} ) IF(SALOME_BUILD_TESTS) diff --git a/src/py2yacs/Test/Py2yacsTest.cxx b/src/py2yacs/Test/Py2yacsTest.cxx index 8572bd3ff..1ba389d23 100644 --- a/src/py2yacs/Test/Py2yacsTest.cxx +++ b/src/py2yacs/Test/Py2yacsTest.cxx @@ -156,7 +156,7 @@ void Py2yacsTest::t3() " print b\n" " print c\n"; const char* input_ports[] = {"a", "b", "c"}; - const char* output_ports[] = {}; + const char** output_ports; verifyCorrectPycode(code_py, "f1", 3, input_ports, 0, output_ports); } @@ -166,7 +166,7 @@ void Py2yacsTest::t4() " print 'toto'\n" " return\n"; const char* input_ports[] = {"a", "b", "c"}; - const char* output_ports[] = {}; + const char** output_ports; verifyCorrectPycode(code_py, "f1", 0, input_ports, 0, output_ports); } diff --git a/src/py2yacs/py2yacs.cxx b/src/py2yacs/py2yacs.cxx index 9e3644006..2ad047d4e 100644 --- a/src/py2yacs/py2yacs.cxx +++ b/src/py2yacs/py2yacs.cxx @@ -75,7 +75,7 @@ static std::string copyList(PyObject *pyList, std::list& cppList) { std::string error; - if(not PyList_Check(pyList)) + if(!PyList_Check(pyList)) { error = "Not a python list.\n"; //throw Py2yacsException("Not a python list."); @@ -86,7 +86,7 @@ std::string copyList(PyObject *pyList, std::list& cppList) for(int i=0; i::const_iterator it; @@ -308,7 +308,7 @@ YACS::ENGINE::Proc* Py2yacs::createProc(const std::string& python_function)const // find function properties std::list::const_iterator fn_prop = _functions.begin(); - while(fn_prop != _functions.end() and fn_prop->_name != python_function) + while(fn_prop != _functions.end() && fn_prop->_name != python_function) fn_prop++; if(fn_prop == _functions.end()) @@ -316,7 +316,7 @@ YACS::ENGINE::Proc* Py2yacs::createProc(const std::string& python_function)const throw Py2yacsException(std::string("Function not found: ")+python_function); } - if(not fn_prop->_errors.empty()) + if(!fn_prop->_errors.empty()) { std::string error_message = "Function contains errors.\n"; std::list::const_iterator it; @@ -334,7 +334,7 @@ YACS::ENGINE::Proc* Py2yacs::createProc(const std::string& python_function)const it!=fn_prop->_output_ports.end(); it++) { - if (not first) + if (!first) fn_call << ","; first = false; fn_call << *it; @@ -345,7 +345,7 @@ YACS::ENGINE::Proc* Py2yacs::createProc(const std::string& python_function)const it != fn_prop->_input_ports.end(); it++) { - if (not first) + if (!first) fn_call << ","; first = false; fn_call << *it; diff --git a/src/py2yacs/py2yacs.hxx b/src/py2yacs/py2yacs.hxx index b0ca9c409..ee052cdf3 100644 --- a/src/py2yacs/py2yacs.hxx +++ b/src/py2yacs/py2yacs.hxx @@ -19,11 +19,22 @@ #ifndef _PY2YACS_H_ #define _PY2YACS_H_ +#ifdef WIN32 +# if defined py2yacslib_EXPORTS +# define PY2YACSLIB_EXPORT __declspec( dllexport ) +# else +# define PY2YACSLIB_EXPORT __declspec( dllimport ) +# endif +#else +# define PY2YACSLIB_EXPORT +#endif + + #include #include #include -class Py2yacsException: std::exception +class PY2YACSLIB_EXPORT Py2yacsException: std::exception { public: Py2yacsException(const std::string& what); @@ -41,7 +52,7 @@ namespace YACS }; }; -struct FunctionProperties +struct PY2YACSLIB_EXPORT FunctionProperties { public: std::string _name; @@ -55,7 +66,7 @@ struct FunctionProperties * This class converts a string containing a python script to a yacs schema * containing a python script node. */ -class Py2yacs +class PY2YACSLIB_EXPORT Py2yacs { public: Py2yacs(); diff --git a/src/runtime/TypeConversions.hxx b/src/runtime/TypeConversions.hxx index cd3a330a1..fe030312d 100644 --- a/src/runtime/TypeConversions.hxx +++ b/src/runtime/TypeConversions.hxx @@ -44,45 +44,47 @@ namespace YACS class TypeCode; class Any; - CORBA::TypeCode_ptr getCorbaTC(const TypeCode *t); + YACSRUNTIMESALOME_EXPORT CORBA::TypeCode_ptr getCorbaTC(const TypeCode *t); - int isAdaptableCorbaPyObject(const TypeCode * t1, const TypeCode * t2); - int isAdaptableCorbaNeutral(const TypeCode * t1, const TypeCode * t2); - int isAdaptableCorbaCorba(const TypeCode * t1, const TypeCode * t2); + YACSRUNTIMESALOME_EXPORT int isAdaptableCorbaPyObject(const TypeCode * t1, const TypeCode * t2); + YACSRUNTIMESALOME_EXPORT int isAdaptableCorbaNeutral(const TypeCode * t1, const TypeCode * t2); + YACSRUNTIMESALOME_EXPORT int isAdaptableCorbaCorba(const TypeCode * t1, const TypeCode * t2); - int isAdaptableNeutralCorba(const TypeCode * t1, const TypeCode * t2); - int isAdaptableNeutralNeutral(const TypeCode * t1, const TypeCode * t2); - int isAdaptableNeutralXml(const TypeCode * t1, const TypeCode * t2); - int isAdaptableNeutralPyObject(const TypeCode * t1, const TypeCode * t2); + YACSRUNTIMESALOME_EXPORT int isAdaptableNeutralCorba(const TypeCode * t1, const TypeCode * t2); + YACSRUNTIMESALOME_EXPORT int isAdaptableNeutralNeutral(const TypeCode * t1, const TypeCode * t2); + YACSRUNTIMESALOME_EXPORT int isAdaptableNeutralXml(const TypeCode * t1, const TypeCode * t2); + YACSRUNTIMESALOME_EXPORT int isAdaptableNeutralPyObject(const TypeCode * t1, const TypeCode * t2); - int isAdaptablePyObjectPyObject(const TypeCode * t1, const TypeCode * t2); - int isAdaptablePyObjectCorba(const TypeCode * t1, const TypeCode * t2); - int isAdaptablePyObjectNeutral(const TypeCode * t1, const TypeCode * t2); + YACSRUNTIMESALOME_EXPORT int isAdaptablePyObjectPyObject(const TypeCode * t1, const TypeCode * t2); + YACSRUNTIMESALOME_EXPORT int isAdaptablePyObjectCorba(const TypeCode * t1, const TypeCode * t2); + YACSRUNTIMESALOME_EXPORT int isAdaptablePyObjectNeutral(const TypeCode * t1, const TypeCode * t2); - int isAdaptableXmlNeutral(const TypeCode *t1,const TypeCode *t2); - int isAdaptableXmlCorba(const TypeCode *t1, const TypeCode *t2); + YACSRUNTIMESALOME_EXPORT int isAdaptableXmlNeutral(const TypeCode *t1,const TypeCode *t2); + YACSRUNTIMESALOME_EXPORT int isAdaptableXmlCorba(const TypeCode *t1, const TypeCode *t2); - PyObject *convertCorbaPyObject(const TypeCode * t,CORBA::Any* ob); - CORBA::Any *convertCorbaCorba(const TypeCode * t,CORBA::Any* ob); - YACS::ENGINE::Any *convertCorbaNeutral(const TypeCode *t,CORBA::Any* ob); - std::string convertCorbaXml(const TypeCode * t,CORBA::Any* ob); + YACSRUNTIMESALOME_EXPORT PyObject *convertCorbaPyObject(const TypeCode * t,CORBA::Any* ob); + YACSRUNTIMESALOME_EXPORT PyObject *convertCorbaPyObject(const TypeCode * t,CORBA::Any* ob); + YACSRUNTIMESALOME_EXPORT PyObject *convertCorbaPyObject(const TypeCode * t,CORBA::Any* ob); + YACSRUNTIMESALOME_EXPORT CORBA::Any *convertCorbaCorba(const TypeCode * t,CORBA::Any* ob); + YACSRUNTIMESALOME_EXPORT YACS::ENGINE::Any *convertCorbaNeutral(const TypeCode *t,CORBA::Any* ob); + YACSRUNTIMESALOME_EXPORT std::string convertCorbaXml(const TypeCode * t,CORBA::Any* ob); - CORBA::Any *convertPyObjectCorba(const TypeCode *t,PyObject *ob); + YACSRUNTIMESALOME_EXPORT CORBA::Any *convertPyObjectCorba(const TypeCode *t,PyObject *ob); YACSRUNTIMESALOME_EXPORT std::string convertPyObjectXml(const TypeCode * t,PyObject* ob); - YACS::ENGINE::Any *convertPyObjectNeutral(const TypeCode *t,PyObject* ob); - PyObject* convertPyObjectPyObject(const TypeCode *t,PyObject *ob); - std::string convertPyObjectToString(PyObject* ob); - bool checkPyObject(const TypeCode *t,PyObject* ob); - - PyObject *convertXmlPyObject(const TypeCode * t,xmlDocPtr doc,xmlNodePtr cur ); - PyObject *convertXmlStrPyObject(const TypeCode * t,std::string data ); - CORBA::Any *convertXmlCorba(const TypeCode * t,xmlDocPtr doc,xmlNodePtr cur ); - YACS::ENGINE::Any *convertXmlNeutral(const TypeCode * t,xmlDocPtr doc,xmlNodePtr cur ); - - PyObject *convertNeutralPyObject(const TypeCode * t,YACS::ENGINE::Any* ob); - std::string convertNeutralXml(const TypeCode * t,YACS::ENGINE::Any* ob); - CORBA::Any *convertNeutralCorba(const TypeCode *t,YACS::ENGINE::Any *ob); - YACS::ENGINE::Any *convertNeutralNeutral(const TypeCode *t, YACS::ENGINE::Any* ob); + YACSRUNTIMESALOME_EXPORT YACS::ENGINE::Any *convertPyObjectNeutral(const TypeCode *t,PyObject* ob); + YACSRUNTIMESALOME_EXPORT PyObject* convertPyObjectPyObject(const TypeCode *t,PyObject *ob); + YACSRUNTIMESALOME_EXPORT std::string convertPyObjectToString(PyObject* ob); + YACSRUNTIMESALOME_EXPORT bool checkPyObject(const TypeCode *t,PyObject* ob); + + YACSRUNTIMESALOME_EXPORT PyObject *convertXmlPyObject(const TypeCode * t,xmlDocPtr doc,xmlNodePtr cur ); + YACSRUNTIMESALOME_EXPORT PyObject *convertXmlStrPyObject(const TypeCode * t,std::string data ); + YACSRUNTIMESALOME_EXPORT CORBA::Any *convertXmlCorba(const TypeCode * t,xmlDocPtr doc,xmlNodePtr cur ); + YACSRUNTIMESALOME_EXPORT YACS::ENGINE::Any *convertXmlNeutral(const TypeCode * t,xmlDocPtr doc,xmlNodePtr cur ); + + YACSRUNTIMESALOME_EXPORT PyObject *convertNeutralPyObject(const TypeCode * t,YACS::ENGINE::Any* ob); + YACSRUNTIMESALOME_EXPORT std::string convertNeutralXml(const TypeCode * t,YACS::ENGINE::Any* ob); + YACSRUNTIMESALOME_EXPORT CORBA::Any *convertNeutralCorba(const TypeCode *t,YACS::ENGINE::Any *ob); + YACSRUNTIMESALOME_EXPORT YACS::ENGINE::Any *convertNeutralNeutral(const TypeCode *t, YACS::ENGINE::Any* ob); } } diff --git a/src/runtime/VisitorSalomeSaveState.cxx b/src/runtime/VisitorSalomeSaveState.cxx index b0957cf93..e6b3d7e2f 100644 --- a/src/runtime/VisitorSalomeSaveState.cxx +++ b/src/runtime/VisitorSalomeSaveState.cxx @@ -68,14 +68,14 @@ void VisitorSalomeSaveState::visitForEachLoop(ForEachLoop *node) } StatesForNode state = node->getState(); - if(YACS::LOADED == state or - YACS::ACTIVATED == state or - YACS::SUSPENDED == state or - YACS::EXECFAILED == state or - YACS::PAUSE == state or - YACS::TORECONNECT == state or - YACS::INTERNALERR == state or - YACS::FAILED == state or + if(YACS::LOADED == state || + YACS::ACTIVATED == state || + YACS::SUSPENDED == state || + YACS::EXECFAILED == state || + YACS::PAUSE == state || + YACS::TORECONNECT == state || + YACS::INTERNALERR == state || + YACS::FAILED == state || YACS::ERROR == state) { ForEachLoopPassedData* processedData = node->getProcessedData();