From 390b74ef98da456d154f8fd7e7d65492abe803f2 Mon Sep 17 00:00:00 2001 From: mkr Date: Mon, 15 Jan 2007 12:28:52 +0000 Subject: [PATCH] Fix for bug PAL12575 : Superv: GNode - unexpected abort. --- src/GraphBase/DataFlowBase_Graph.cxx | 53 +++++++++++++++++++ src/GraphBase/DataFlowBase_Graph.hxx | 1 + src/GraphEditor/DataFlowEditor_OutNode.cxx | 7 ++- .../DataFlowExecutor_InNodeThreads.cxx | 20 ------- 4 files changed, 60 insertions(+), 21 deletions(-) diff --git a/src/GraphBase/DataFlowBase_Graph.cxx b/src/GraphBase/DataFlowBase_Graph.cxx index 016498d..909577b 100644 --- a/src/GraphBase/DataFlowBase_Graph.cxx +++ b/src/GraphBase/DataFlowBase_Graph.cxx @@ -2792,6 +2792,59 @@ bool GraphBase::Graph::Sort( int & SubStreamGraphsNumber ) { return true ; } +// mkr : PAL12575 +bool GraphBase::Graph::ValidGOTO() { + cdebug_in << "GraphBase::Graph::ValidGOTO" << endl; + bool RetVal = true ; + int i, j ; + GraphBase::ComputingNode * aNode ; + for ( i = 0 ; i < GraphNodesSize() ; i++ ) { + aNode = GraphNodes( i ) ; + if ( aNode->IsGOTONode() ) { + GraphBase::GOTONode * aGoToNode = (GraphBase::GOTONode * ) aNode ; + GraphBase::InLineNode * aCoupledNode ; + aCoupledNode = (GraphBase::InLineNode * ) aGoToNode->CoupledNode() ; + if ( aCoupledNode ) { + ostringstream ErrorMessage ; + // 1. Check the number of ports (the number of OutPorts of a GOTONode and of InPorts of its linked + // InLine node must be the same) + if ( aNode->GetNodeOutPortsSize() != aCoupledNode->GetNodeInPortsSize() ) { + cdebug << "GraphBase::Graph::ValidGOTO : Different ports number!" << endl ; + ReSetMessages() ; + ErrorMessage << "Different ports number : the number of OutPorts of a " << aNode->Name() + << " node (GoTo node) and of InPorts of its linked " << aCoupledNode->Name() + << " node (InLine node) must be the same!\n" ; + SetMessages( ErrorMessage.str() ) ; + RetVal = false ; + } + // 2. Check ports names (the names of OutPorts of a GOTONode and of InPorts of its linked + // InLine node must be the same) + else { + for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) { + GraphBase::OutPort * aBusParamOutPort = aNode->GetChangeNodeOutPort( j ) ; + if ( !aBusParamOutPort->IsGate() ) { + GraphBase::InPort * aBusParamChangeInPort = NULL ; + aBusParamChangeInPort = aCoupledNode->GetChangeInPort( aBusParamOutPort->PortName() ) ; + if ( !aBusParamChangeInPort ) { + cdebug << "GraphBase::Graph::ValidGOTO : Different names of ports!" << endl ; + ReSetMessages() ; + ErrorMessage << "Different names of ports : there is no input port of " << aCoupledNode->Name() + << " node (InLine node) coupled to " << aBusParamOutPort->PortName() + << " output port of a " << aNode->Name() + << " node (GoTo node)\n" ; + SetMessages( ErrorMessage.str() ) ; + RetVal = false ; + } + } + } + } + } + } + } + cdebug_out << "GraphBase::Graph::ValidGOTO RetVal " << RetVal << endl; + return RetVal ; +} + bool GraphBase::Graph::ValidLoops() const { cdebug_in << "GraphBase::Graph::ValidLoops" << endl; bool RetVal = true ; diff --git a/src/GraphBase/DataFlowBase_Graph.hxx b/src/GraphBase/DataFlowBase_Graph.hxx index 47e53ac..a5a026c 100644 --- a/src/GraphBase/DataFlowBase_Graph.hxx +++ b/src/GraphBase/DataFlowBase_Graph.hxx @@ -342,6 +342,7 @@ namespace GraphBase { bool InLineServices() ; bool Sort( int & SubStreamGraphsNumber ) ; + bool ValidGOTO() ; // mkr : PAL12575 bool ValidLoops() const ; bool ValidSwitchs() const ; bool ComputingNodes() const ; diff --git a/src/GraphEditor/DataFlowEditor_OutNode.cxx b/src/GraphEditor/DataFlowEditor_OutNode.cxx index cb6736d..babb50e 100644 --- a/src/GraphEditor/DataFlowEditor_OutNode.cxx +++ b/src/GraphEditor/DataFlowEditor_OutNode.cxx @@ -1019,6 +1019,11 @@ bool GraphEditor::OutNode::Valid() { Graph()->ComputingNodes() ; #endif + if ( !Graph()->ValidGOTO() ) { // mkr : PAL12575 + cdebug << "Editor::OutNode::Valid This DataFlow have not valid GOTO(ValidGOTO)." << endl ; + RetVal = false ; + } + if ( RetVal ) { _Valid = true ; } @@ -1063,7 +1068,7 @@ bool GraphEditor::OutNode::Executable() { StreamGraph()->SubStreamGraphsNumber( SubStreamGraphsNumber ) ; Graph()->InLineServices() ; - + // if ( kLoopSwitch ) { if ( !Graph()->ValidLoops() ) { cdebug << "Editor::OutNode::Executable This DataFlow have not valid Loops(ValidLoops)." << endl ; diff --git a/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx b/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx index 9ae6293..1789aa7 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx +++ b/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx @@ -2543,7 +2543,6 @@ int GraphExecutor::InNode::Successed_SuccessAction() { << " Successed_SuccessAction # number of ports " << GetNodeOutPortsSize() << " != " << aLabelNode-> GetNodeInPortsSize() << endl ; SendEvent( GraphExecutor::ErrorEvent ) ; - aLabelNode->State( GraphExecutor::ErroredState ) ; // PAL12575 return 0 ; } else { @@ -2574,7 +2573,6 @@ int GraphExecutor::InNode::Successed_SuccessAction() { << " Successed_SuccessAction # names of ports " << aBusParamOutPort->PortName() << endl ; SendEvent( GraphExecutor::ErrorEvent ) ; - aLabelNode->State( GraphExecutor::ErroredState ) ; // PAL12575 return 0 ; } } @@ -2651,24 +2649,6 @@ int GraphExecutor::InNode::Successed_SuccessAction() { IgnoreForDefaultSwitch = true ; } } - -// PAL12575 --> - if ( IsInLineNode() && !IsEndSwitchNode() ) { - GraphBase::InPort *toInGatePort = GetChangeNodeInGate() ; - GraphBase::OutPort *fromOutPort = toInGatePort->GetOutPort() ; - if ( fromOutPort && fromOutPort->IsGate() ) { - GraphExecutor::InNode * fromNode = (GraphExecutor::InNode *) _OutNode->Graph()->GetChangeGraphNode( fromOutPort->NodeName() )->GetInNode() ; - if ( fromNode && fromNode->IsGOTONode() && fromOutPort->PortState() != SUPERV::ReadyState ) { - cdebug << pthread_self() << "/" << ThreadNo() - << " Successed_SuccessAction # problem with connection of GoTo node with its coupled node!" << endl ; - State( GraphExecutor::ErroredState ) ; - SendEvent( GraphExecutor::ErrorEvent ) ; - return 0 ; - } - } - } -// PAL12575 <-- - //Loop of LinkedNodes for SendSomeDataReady : for ( i = 0 ; i < LinkedNodesSize() ; i++ ) { GraphBase::ComputingNode * aComputingNode ; -- 2.39.2