From 75a35c0e584502e0e684db7de40a3f6118f72d87 Mon Sep 17 00:00:00 2001 From: mkr Date: Mon, 10 Jul 2006 08:57:32 +0000 Subject: [PATCH] Fix for PAL12895 : EDF218 SUPERV Problem with "Embedded Python-2.3.4" ??? V3.2.0. --- src/GraphExecutor/DataFlowExecutor_InNode.cxx | 51 +++++++++++++++---- .../DataFlowExecutor_OutNode.cxx | 24 ++++++++- 2 files changed, 64 insertions(+), 11 deletions(-) diff --git a/src/GraphExecutor/DataFlowExecutor_InNode.cxx b/src/GraphExecutor/DataFlowExecutor_InNode.cxx index fde0428..e914e9c 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNode.cxx +++ b/src/GraphExecutor/DataFlowExecutor_InNode.cxx @@ -1521,6 +1521,7 @@ void GraphExecutor::InNode::InitialState() } bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { + //JR Look at DataFlowExecutor for the meaning of WithErr cdebug_in << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " WithErr " << WithErr << " PyFuncRunned() " << PyFuncRunned() << endl; bool Err = false ; @@ -1537,7 +1538,13 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() , InLineNode()->PythonFunction() , OneErr ) ; - InLineNode()->PyRunMethod( PyRunMethod ) ; + // JR Debug : if we must have a python function and if we have not : error + if ( PyRunMethod ) { + InLineNode()->PyRunMethod( PyRunMethod ) ; + } + else if ( WithErr && strlen( InLineNode()->PyFuncName() ) ) { + OneErr = true ; + } } Err = Err || OneErr ; if ( OneErr && WithErr ) { @@ -1554,7 +1561,13 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { PyMoreMethod = InitPyDynInvoke( LoopNode()->PyMoreName() , LoopNode()->MorePythonFunction() , OneErr ) ; - LoopNode()->PyMoreMethod( PyMoreMethod ) ; + // JR Debug : if we must have a python function and if we have not : error + if ( PyMoreMethod ) { + LoopNode()->PyMoreMethod( PyMoreMethod ) ; + } + else if ( WithErr && strlen( LoopNode()->PyMoreName() ) ) { + OneErr = true ; + } } Err = Err || OneErr ; if ( OneErr && WithErr ) { @@ -1571,7 +1584,13 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { PyNextMethod = InitPyDynInvoke( LoopNode()->PyNextName() , LoopNode()->NextPythonFunction() , OneErr ) ; - LoopNode()->PyNextMethod( PyNextMethod ) ; + // JR Debug : if we must have a python function and if we have not : error + if ( PyNextMethod ) { + LoopNode()->PyNextMethod( PyNextMethod ) ; + } + else if ( WithErr && strlen( LoopNode()->PyNextName() ) ) { + OneErr = true ; + } } Err = Err || OneErr ; if ( OneErr && WithErr ) { @@ -1580,11 +1599,10 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { string( Name() ) ; _OutNode->Graph()->SetMessages( anErrorMessage ) ; } - // PAL12854 --> + //JR Debug 12854 if ( Err ) { PyFuncRunned( false ) ; } - // PAL12854 <-- cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod(Init) " << PyRunMethod << " PyMoreMethod " << PyMoreMethod << " PyNextMethod " << PyNextMethod << endl; @@ -1598,7 +1616,13 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() , InLineNode()->PythonFunction() , OneErr ) ; - InLineNode()->PyRunMethod( PyRunMethod ) ; + // JR Debug : if we must have a python function and if we have not : error + if ( PyRunMethod != NULL ) { + InLineNode()->PyRunMethod( PyRunMethod ) ; + } + else if ( WithErr && strlen( InLineNode()->PyFuncName() ) ) { + OneErr = true ; + } } Err = Err || OneErr ; if ( OneErr && WithErr ) { @@ -1619,7 +1643,13 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() , InLineNode()->PythonFunction() , OneErr ) ; - InLineNode()->PyRunMethod( PyRunMethod ) ; + // JR Debug : if we must have a python function and if we have not : error + if ( PyRunMethod != NULL ) { + InLineNode()->PyRunMethod( PyRunMethod ) ; + } + else if ( WithErr && strlen( InLineNode()->PyFuncName() ) ) { + OneErr = true ; + } } Err = Err || OneErr ; if ( OneErr && WithErr ) { @@ -1631,10 +1661,11 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod " << PyRunMethod << endl; } } - Err = WithErr && Err ; + //JR Look at DataFlowExecutor : + // Err = WithErr && Err ; cdebug_out << "GraphExecutor::InNode::InitPythonFunctions " << Name() ; - if ( Err ) { - cdebug << " Error " << Err ; + if ( WithErr && Err ) { + cdebug << " Error " << WithErr && Err ; } cdebug << endl; return !Err ; diff --git a/src/GraphExecutor/DataFlowExecutor_OutNode.cxx b/src/GraphExecutor/DataFlowExecutor_OutNode.cxx index fd8c1a1..ef342d0 100644 --- a/src/GraphExecutor/DataFlowExecutor_OutNode.cxx +++ b/src/GraphExecutor/DataFlowExecutor_OutNode.cxx @@ -519,6 +519,7 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { _JustStarted = true ; RetVal = true ; int i ; + bool again = true ; for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) Graph()->GraphNodes( i )->GetInNode() ; anInNode->OutNode( this ) ; @@ -536,7 +537,12 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { } anInNode->InitialState() ; if ( anInNode->IsOneOfInLineNodes() ) { - anInNode->InitPythonFunctions( false ) ; + //JR with Python2.3.4, we may get an error because of a normal previous error + bool sts = anInNode->InitPythonFunctions( false ) ; + if ( again && !sts ) { + sts = anInNode->InitPythonFunctions( false ) ; + again = false ; + } } } // One more time because inline nodes may share one definition of the same function @@ -573,6 +579,9 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { } } */ + //JR Debug : if there was an error in initialisation of python functions, + // we must not try to execute the graph. + if ( RetVal ) { if ( Graph()->GraphMacroLevel() != 0 ) { cdebug << "GraphExecutor::OutNode::Run Execution starting GraphExecutor::Action_DataOk_RunService Node " << Name() << " GraphMacroLevel " << Graph()->GraphMacroLevel() << endl ; @@ -700,6 +709,19 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { // Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; RetVal = true ; } + //JR Debug + } + else { + State( GraphExecutor::ErroredState ) ; + Done( true ) ; + if ( IsDone() ) { + cdebug << " ==> theAutomaton->Executed() " << endl ; + theAutomaton->Executed() ; + } + else { + cdebug << " NO theAutomaton->Executed() " << endl ; + } + } } else { // PAL 8515 -- 2.39.2