31 using namespace YACS::ENGINE;
40 PyGILState_STATE gstate = PyGILState_Ensure();
45 msg <<
"Not possible to set builtins" << __FILE__ <<
":" << __LINE__;
46 PyGILState_Release(gstate);
49 PyGILState_Release(gstate);
57 PyGILState_STATE gstate = PyGILState_Ensure();
62 msg <<
"Not possible to set builtins" << __FILE__ <<
":" << __LINE__;
63 PyGILState_Release(gstate);
66 PyGILState_Release(gstate);
72 cerr <<
"---------------SalomePythonNode::load function---------------" << endl;
73 list<OutputPort *>::iterator iter;
75 PyObject* ob=PyString_FromString(value2Export.c_str());
80 cerr <<
"port name: " << p->
getName() << endl;
84 PyGILState_STATE gstate = PyGILState_Ensure();
89 PyGILState_Release(gstate);
90 throw Exception(
"Error during execution");
98 PyGILState_Release(gstate);
99 throw Exception(
"Error during execution");
101 cerr <<
"---------------End SalomePythonNode::load function---------------" << endl;
102 PyGILState_Release(gstate);
107 cerr <<
"++++++++++++++ SalomePythonNode::execute: " <<
getName() <<
" ++++++++++++++++++++" << endl;
111 PyGILState_STATE gstate = PyGILState_Ensure();
113 cerr <<
"---------------SalomePythonNode::inputs---------------" << endl;
115 list<InputPort *>::iterator iter2;
119 cerr <<
"port name: " << p->
getName() << endl;
122 PyObject_Print(ob,stderr,Py_PRINT_RAW);
124 cerr <<
"ob refcnt: " << ob->ob_refcnt << endl;
126 PyTuple_SetItem(args,pos,ob);
127 cerr <<
"ob refcnt: " << ob->ob_refcnt << endl;
130 cerr <<
"---------------End SalomePythonNode::inputs---------------" << endl;
132 cerr <<
"----------------SalomePythonNode::calculation---------------" << endl;
133 PyObject_Print(
_pyfunc,stderr,Py_PRINT_RAW);
135 PyObject_Print(args,stderr,Py_PRINT_RAW);
137 PyObject* result = PyObject_CallObject(
_pyfunc , args ) ;
142 PyGILState_Release(gstate);
143 throw Exception(
"Error during execution");
145 cerr <<
"----------------End SalomePythonNode::calculation---------------" << endl;
147 cerr <<
"-----------------SalomePythonNode::outputs-----------------" << endl;
149 if(result == Py_None)
151 else if(PyTuple_Check(result))
152 nres=PyTuple_Size(result);
157 PyGILState_Release(gstate);
158 throw Exception(
"Number of output arguments : Mismatch between definition and execution");
162 PyObject_Print(result,stderr,Py_PRINT_RAW);
164 list<OutputPort *>::iterator iter;
170 cerr <<
"port name: " << p->
getName() << endl;
172 cerr <<
"port pos : " << pos << endl;
173 if(PyTuple_Check(result))ob=PyTuple_GetItem(result,pos) ;
175 cerr <<
"ob refcnt: " << ob->ob_refcnt << endl;
176 PyObject_Print(ob,stderr,Py_PRINT_RAW);
185 PyGILState_Release(gstate);
188 cerr <<
"-----------------End SalomePythonNode::outputs-----------------" << endl;
191 PyGILState_Release(gstate);
192 cerr <<
"++++++++++++++ End SalomePythonNode::execute: " <<
getName() <<
" ++++++++++++++++++++" << endl;
197 static const char LOC_KIND[]=
"";
219 list<InputPort *>::iterator iter;
225 list<OutputPort *>::iterator iter2;