Salome HOME
Merge branch 'omu/update_doc_77'
[modules/yacs.git] / src / runtime / RuntimeSALOME.cxx
index ef02203f8c5682fdd4588bfe54590df8b643743c..0ac34e183a676cd83e037f493d6d6e1f60bf011e 100644 (file)
@@ -35,6 +35,7 @@
 #include "TypeCode.hxx"
 #include "WhileLoop.hxx"
 #include "ForLoop.hxx"
+#include "ForEachLoop.hxx"
 #include "SalomeOptimizerLoop.hxx"
 #include "Bloc.hxx"
 #include "InputPort.hxx"
@@ -42,6 +43,7 @@
 #include "PresetPorts.hxx"
 #include "InputDataStreamPort.hxx"
 #include "OutputDataStreamPort.hxx"
+#include "Switch.hxx"
 #include "SalomeProc.hxx"
 #include "PyStdout.hxx"
 //Catalog Loaders
@@ -179,6 +181,16 @@ void RuntimeSALOME::initBuiltins()
   typeMap["seqboolvec"]= createSequenceTc("seqboolvec","seqboolvec",typeMap["boolvec"]);
   std::list<TypeCodeObjref *> ltc;
   typeMap["pyobj"]= createInterfaceTc("python:obj:1.0","pyobj",ltc);
+  typeMap["seqpyobj"]= createSequenceTc("seqpyobj","seqpyobj",typeMap["pyobj"]);
+  composednodeMap["Bloc"]=createBloc("Bloc");
+  composednodeMap["Switch"]=createSwitch("Switch");
+  composednodeMap["WhileLoop"]=createWhileLoop("WhileLoop");
+  composednodeMap["ForLoop"]=createForLoop("ForLoop");
+  composednodeMap["ForEachLoop_double"]=createForEachLoop("ForEachLoop_double",Runtime::_tc_double);
+  composednodeMap["ForEachLoop_string"]=createForEachLoop("ForEachLoop_string",Runtime::_tc_string);
+  composednodeMap["ForEachLoop_int"]=createForEachLoop("ForEachLoop_int",Runtime::_tc_int);
+  composednodeMap["ForEachLoop_bool"]=createForEachLoop("ForEachLoop_bool",Runtime::_tc_bool);
+  composednodeMap["ForEachLoop_pyobj"]=createForEachLoop("ForEachLoop_pyobj",typeMap["pyobj"]);;
   ENGINE::TypeCodeStruct *t = createStructTc("","Engines/dataref");
   t->addMember("ref",_tc_string);
   typeMap["dataref"]= t;
@@ -1805,6 +1817,10 @@ std::string RuntimeSALOME::convertNeutralAsString(TypeCode * type, Any *data)
   PyObject* ob;
   if(data)
     {
+      // The call to PyGILState_Ensure was moved here because there was also
+      // a crash when calling convertNeutralPyObject with a sequence of pyobj.
+      // see also the comment below.
+      PyGILState_STATE gstate = PyGILState_Ensure();
       ob=convertNeutralPyObject(type,data);
       std::string s=convertPyObjectToString(ob);
 
@@ -1813,7 +1829,7 @@ std::string RuntimeSALOME::convertNeutralAsString(TypeCode * type, Any *data)
       // lock. I thus added the call to PyGILState_Ensure / PyGILState_Release. It worked fine in
       // Python 2.6 without this call. If anyone finds the real reason of this bug and another fix,
       // feel free to change this code.
-      PyGILState_STATE gstate = PyGILState_Ensure();
+      //PyGILState_STATE gstate = PyGILState_Ensure();
       Py_DECREF(ob);
       PyGILState_Release(gstate);
       return s;