}
else if ( !strcmp( Type , "float" ) ) {
cdebug << "float" << endl ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ InitialValue <<= (double ) 0. ;
+#else
double d = 0.;
InitialValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
- //InitialValue <<= (double ) 0. ;
+#endif
+
}
else if ( !strcmp( Type , "double" ) ) {
cdebug << "double" << endl ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ InitialValue <<= (double ) 0. ;
+#else
double d = 0.;
InitialValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
- //InitialValue <<= (double ) 0. ;
+#endif
}
else { // Default
cdebug << "objref" << endl ;
else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
double d ;
sscanf( t , "%lf" , &d ) ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ *theValue <<= d ;
+#else
theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
- //*theValue <<= d ;
+#endif
*theValue >>= d ;
#if ValueTrace
cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
}
else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
double d = l ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ *theValue <<= d ;
+#else
theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
- //*theValue <<= d ;
+#endif
*theValue >>= d ;
#if ValueTrace
#endif
}
else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
- double d = (double ) 0. ;
+ double d = (double ) 0. ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ *theValue <<= d ;
+#else
theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
- //*theValue <<= d ;
+#endif
*theValue >>= d;
#if ValueTrace
cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
double d ;
sscanf( t , "%lf" , &d ) ;
float f = d ;
- D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
-// D.Value <<= f ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ D.Value <<= f ;
+#else
+ D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+#endif
#if InParametersSetTrace
cdebug << "string '" << t << "' --> " << setw(25) << setprecision(18) << d << " --> float " << " = "
<< setw(25) << setprecision(18) << f ;
else if ( !strcmp( Type , "double" ) ) {
double d ;
sscanf( t , "%lf" , &d ) ;
- D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
-// D.Value <<= d ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ D.Value <<= d ;
+#else
+ D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+#endif
#if InParametersSetTrace
cdebug << "string '" << t << " --> double " << setw(25) << setprecision(18) << d ;
#endif
else if ( !strcmp( Type , "float" ) ) {
float f ;
f = (float ) l ;
- D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
-// D.Value <<= f ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ D.Value <<= f ;
+#else
+ D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+#endif
// theOutPort->Value( D.Value ) ;
}
else if ( !strcmp( Type , "double" ) ) {
double d ;
d = (double ) l ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ D.Value <<= d ;
+#else
D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
-// D.Value <<= d ;
+#endif
// theOutPort->Value( D.Value ) ;
}
// else if ( !strcmp( Type , "objref" ) ) {
else if ( !strcmp( Type , "float" ) ) {
float f ;
f = (float ) d ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ D.Value <<= f ;
+#else
D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
-// D.Value <<= f ;
+#endif
// theOutPort->Value( D.Value ) ;
}
else if ( !strcmp( Type , "double" ) ) {
}
else if ( !strcmp( Type , "float" ) ) {
float f = 0 ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ D.Value <<= f ;
+#else
D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
-// D.Value <<= f ;
+#endif
// theOutPort->Value( D.Value ) ;
}
else if ( !strcmp( Type , "double" ) ) {
double d = 0 ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ D.Value <<= d ;
+#else
D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
-// D.Value <<= d ;
+#endif
// theOutPort->Value( D.Value ) ;
}
// else if ( !strcmp( Type , "objref" ) ) {
}
else if ( !strcmp( Type , "float" ) ) {
float f = 0 ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ D.Value <<= f ;
+#else
D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
-// D.Value <<= f ;
+#endif
}
else if ( !strcmp( Type , "double" ) ) {
double d = 0 ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ D.Value <<= d ;
+#else
D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
-// D.Value <<= d ;
+#endif
}
else {
D.Value <<= CORBA::Object::_nil() ;
float f;
D.Value >>= f;
double d = (double ) f ;
+#ifdef REDHAT // mkr : debug for PAL12255
+ D.Value <<= d ;
+#else
D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
-// D.Value <<= d ;
+#endif
#if OutParametersSetTrace
cdebug << ThreadNo() << " " << f << "(float)" << endl ;
#endif
Py_InitModule( "InitPyRunMethod" , MethodPyRunMethod ) ;
// asv : 20.01.05 : changes involved with switching to old (HEAD) KERNEL
//_OutNode->SuperVisionContainer()->ActivatePythonExecution( "InitPyRunMethod" , MethodPyRunMethod ) ;
-
- // PAL10310: patch on omniORB
- string aPyFunc;
- aPyFunc = "import omnipatch\n" ;
- if ( PyRun_SimpleString( (char *) aPyFunc.c_str() ) ) {
- cdebug << ThreadNo() << " " << Name() << " PyRun_SimpleString ERROR " << endl << aPyFunc << endl ;
- Automaton()->PyUnLock() ;
- return false ;
- }
}
// PyObject * Dictionnary = PyModule_GetDict( Module ) ;
// InitPyDynInvokeError = PyErr_NewException( "InitPyDynInvokeError" , NULL , NULL ) ;
aPyFunc += "import sys\n" ;
aPyFunc += "import CORBA\n" ;
aPyFunc += "import omniORB\n" ;
- aPyFunc += "orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
aPyFunc += "def PyObjRef( IORObjStr ) :\n" ;
- // aPyFunc += " orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
+ aPyFunc += " orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
aPyFunc += " objref = orb.string_to_object( IORObjStr )\n" ;
aPyFunc += " return objref\n" ;
aPyFunc += "InitPyRunMethod.RunMethod( PyObjRef )\n" ;
aPyFunc += "import sys\n" ;
aPyFunc += "import CORBA\n" ;
aPyFunc += "import omniORB\n" ;
- aPyFunc += "orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
aPyFunc += "def PyObjIor( ObjRef ) :\n" ;
- // aPyFunc += " orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
+ aPyFunc += " orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
aPyFunc += " objIor = orb.object_to_string( ObjRef )\n" ;
aPyFunc += " return objIor\n" ;
aPyFunc += "InitPyRunMethod.RunMethod( PyObjIor )\n" ;
if ( strlen( PyFuncName ) ) {
Automaton()->PyLock() ;
-
thePyRunMethod = Automaton()->PyFunction( PyFuncName ) ;
-
- //thePyRunMethod = NULL;
- // asv 28.02.05 : VERY BAD fix of the following problem: after change of a function,
- // the changes are NOT taken into account by Automation - it returns PyObject of the OLD function.
- // so here we force re-automating the PyObject EVERY TIME, regardless if the function has changed or not.
- // Once again - it is a very bad solution, it fully discards the whole idea of automation,
- // here is it done as a quick fix for a bug.
- // A better solution (to be implemented): store the PyObject NOT in Automation map, but in
- // InLine node itself! And if the method is changed - remove the PyObject and force to regenerate it.
- // But this means that PyObject must be stored in Editor's data model.
- // asv 01.03.05 : the fix is not needed, the described bug is not reproduced. To investigate:
- // WHERE PyObject is removed from Automation map on function change.
-
if ( (*aPythonFunction).length() ) {
if ( thePyRunMethod == NULL ) {
unsigned int i ;
PyObject * ArgsList = NULL ;
PyObject * ArgValue = NULL ;
PyObject * Result = NULL ;
- //PyObject * MyPyObjRefList = NULL ;
+ PyObject * MyPyObjRefList = NULL ;
PyObject * ResultObj = NULL ;
- //PyObject * MyPyObjIorList = NULL ;
+ PyObject * MyPyObjIorList = NULL ;
PyObject * ResultIor = NULL ;
CORBA::Object_ptr ObjRef ;
break ;
}
case CORBA::tk_objref : {
- //MyPyObjRefList = PyTuple_New( 1 ) ;
- //PyObject * ObjValue ;
+ MyPyObjRefList = PyTuple_New( 1 ) ;
+ PyObject * ObjValue ;
#if OMNIORB_VERSION >= 4
data >>= (CORBA::Any::to_object ) ObjRef ;
#else
data >>= ObjRef ;
#endif
IORObjRef = ObjectToString( ObjRef ) ;
- //ObjValue = Py_BuildValue( "s" , IORObjRef ) ;
- //PyTuple_SetItem( MyPyObjRefList , 0 , ObjValue ) ;
+ ObjValue = Py_BuildValue( "s" , IORObjRef ) ;
+ PyTuple_SetItem( MyPyObjRefList , 0 , ObjValue ) ;
#if PyDynInvokeTrace
- cdebug << "ArgIn" << i << " : " << sname << " " << method << " " << " Value " << IORObjRef << " (objref) "<< endl ;
- // << MyPyObjRef->ob_refcnt << "/" << MyPyObjRefList->ob_refcnt << endl ;
+ cdebug << "ArgIn" << i << " : " << sname << " " << method << " " << " Value " << IORObjRef << " (objref) "
+ << MyPyObjRef->ob_refcnt << "/" << MyPyObjRefList->ob_refcnt << endl ;
#endif
// ResultObj = PyEval_CallObject( MyPyObjRef , MyPyObjRefList ) ;
- //ResultObj = PyEvalCallObject( "PyObjRef" , MyPyObjRef , MyPyObjRefList ) ;
+ ResultObj = PyEvalCallObject( "PyObjRef" , MyPyObjRef , MyPyObjRefList ) ;
#if PyDynInvokeTrace
- //cdebug << "ObjValue->ob_refcnt" << ObjValue->ob_refcnt << endl ;
+ cdebug << "ObjValue->ob_refcnt" << ObjValue->ob_refcnt << endl ;
#endif
- //ArgValue = Py_BuildValue( "O" , ResultObj ) ;
- //PyTuple_SetItem( ArgsList , i , ArgValue ) ;
+ ArgValue = Py_BuildValue( "O" , ResultObj ) ;
+ PyTuple_SetItem( ArgsList , i , ArgValue ) ;
#if PyDynInvokeTrace
if ( ArgValue )
cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value (objref) ArgsList->ob_refcnt"
else
cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value (objref) ArgsList->ob_refcnt"
<< ArgsList->ob_refcnt << " ArgValue is NULL" << endl ;
- //cdebug << "MyPyObjRefList->ob_refcnt " << MyPyObjRefList->ob_refcnt-1 << endl ;
-#endif
- ResultObj = PyObject_CallFunction( MyPyObjRef , "s",IORObjRef ) ;
- if(ResultObj == NULL){
- PyErr_Print();
- ResultObj=Py_None;
- Py_INCREF(ResultObj) ;
- }
- PyTuple_SetItem( ArgsList , i , ResultObj ) ;
- cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value (objref) ArgsList->ob_refcnt"
- << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ResultObj->ob_refcnt << endl ;
-// << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ;
- //cdebug << "MyPyObjRefList->ob_refcnt " << MyPyObjRefList->ob_refcnt-1 << endl ;
- //Py_DECREF( MyPyObjRefList ) ;
- //if ( CORBA::is_nil( ObjRef ) ) {
- // ResultObj = NULL ;
- //}
- //else {
- //#if PyDynInvokeTrace
- //if ( ResultObj )
- //cdebug << "ResultObj->ob_refcnt " << ResultObj->ob_refcnt-1 << endl ;
- //else
- //cdebug << "ResultObj is NULL" << endl ;
- //#endif
- //if ( ResultObj )
- //Py_DECREF( ResultObj ) ;
- //}
+ cdebug << "MyPyObjRefList->ob_refcnt " << MyPyObjRefList->ob_refcnt-1 << endl ;
+#endif
+ Py_DECREF( MyPyObjRefList ) ;
+ if ( CORBA::is_nil( ObjRef ) ) {
+ ResultObj = NULL ;
+ }
+ else {
+#if PyDynInvokeTrace
+ if ( ResultObj )
+ cdebug << "ResultObj->ob_refcnt " << ResultObj->ob_refcnt-1 << endl ;
+ else
+ cdebug << "ResultObj is NULL" << endl ;
+#endif
+ if ( ResultObj )
+ Py_DECREF( ResultObj ) ;
+ }
break ;
}
default : {
if ( Result == NULL ) {
cdebug_out << "GraphExecutor::InNode::PyDynInvoke Node " << Name() << " " << method << " Error Result == NULL"
<< endl ;
- PyErr_Print();
RetVal = false ;
}
else {
else {
f = PyFloat_AsDouble( ArgValue ) ;
}
+#ifdef REDHAT // mkr : debug for PAL12255
+ data <<= f ;
+#else
data.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
- //data <<= f ;
+#endif
#if PyDynInvokeTrace
cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << f << " (float)"
<< " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
else {
d = PyFloat_AsDouble( ArgValue ) ;
}
+#ifdef REDHAT // mkr : debug for PAL12255
+ data <<= d ;
+#else
data.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
- //data <<= d ;
+#endif
#if PyDynInvokeTrace
cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << d << " (double)"
<< " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
}
case CORBA::tk_objref : {
PyObject * ObjIor ;
- //MyPyObjIorList = PyTuple_New( 1 ) ;
+ MyPyObjIorList = PyTuple_New( 1 ) ;
if ( PyTuple_Check( Result ) ) {
ObjIor = PyTuple_GetItem( Result , i ) ;
}
<< " Result->ob_refcnt" << Result->ob_refcnt << " ObjIor->ob_refcnt"
<< ObjIor->ob_refcnt << endl ;
#endif
- //Py_INCREF( ObjIor ) ;
+ Py_INCREF( ObjIor ) ;
// PyObject_Print( ObjIor , stdout , 0 ) ;
- //PyTuple_SetItem( MyPyObjIorList , 0 , ObjIor ) ;
+ PyTuple_SetItem( MyPyObjIorList , 0 , ObjIor ) ;
// ResultIor = PyEval_CallObject( MyPyObjIor , MyPyObjIorList ) ;
- //ResultIor = PyEvalCallObject( "PyObjIor" , MyPyObjIor , MyPyObjIorList ) ;
- ResultIor = PyObject_CallFunction( MyPyObjIor , "O",ObjIor ) ;
+ ResultIor = PyEvalCallObject( "PyObjIor" , MyPyObjIor , MyPyObjIorList ) ;
#if PyDynInvokeTrace
cdebug << "ObjIor->ob_refcnt " << ObjIor->ob_refcnt-1 << endl ;
#endif
- //Py_DECREF( ObjIor ) ;
+ Py_DECREF( ObjIor ) ;
#if PyDynInvokeTrace
- //cdebug << "MyPyObjIorList->ob_refcnt " << MyPyObjIorList->ob_refcnt-1 << endl ;
+ cdebug << "MyPyObjIorList->ob_refcnt " << MyPyObjIorList->ob_refcnt-1 << endl ;
#endif
- //Py_DECREF( MyPyObjIorList ) ;
+ Py_DECREF( MyPyObjIorList ) ;
#if PyDynInvokeTrace
- //cdebug << "MyPyObjIor->ob_refcnt " << MyPyObjIor->ob_refcnt << endl ;
+ cdebug << "MyPyObjIor->ob_refcnt " << MyPyObjIor->ob_refcnt << endl ;
#endif
if ( ResultIor ) {
char * IOR = NULL ;
}
}
else {
- PyErr_Print();
- cdebug_out << "GraphExecutor::InNode::PyDynInvoke Error ResultIor == NULL Node "
+ cdebug_out << "GraphExecutor::InNode::PyDynInvoke Error ResultIor == NULL Node "
<< Name() << " method " << method << " " << endl ;
RetVal = false ;
}
Py_DECREF( ArgsList ) ;
}
- fflush(stdout);
- fflush(stderr);
-
#if 0
{
int i ;