From: asv Date: Fri, 28 Jan 2005 12:14:58 +0000 (+0000) Subject: New example graphs from Jean Rahuel. Most of them test correct exectution of Switch... X-Git-Tag: V2_2_0b2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b4a8a21df0b5f1db69977518f9e443076bee5e74;p=modules%2Fsuperv.git New example graphs from Jean Rahuel. Most of them test correct exectution of Switch nodes. --- diff --git a/examples/GraphGOTO1.py b/examples/GraphGOTO1.py new file mode 100755 index 0000000..7201a44 --- /dev/null +++ b/examples/GraphGOTO1.py @@ -0,0 +1,283 @@ + +# Generated python file of Graph GraphGOTO_2_2 + +from SuperV import * + +# Graph creation of GraphGOTO_2_2 +def DefGraphGOTO_2_2() : + GraphGOTO_2_2 = Graph( 'GraphGOTO_2_2' ) + GraphGOTO_2_2.SetName( 'GraphGOTO_2_2' ) + GraphGOTO_2_2.SetAuthor( 'JR' ) + GraphGOTO_2_2.SetComment( 'Syracuse algorithm' ) + GraphGOTO_2_2.Coords( 0 , 0 ) + + # Creation of Factory Nodes + + test_ISEVEN = GraphGOTO_2_2.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' ) + test_ISEVEN.SetName( 'test_ISEVEN' ) + test_ISEVEN.SetAuthor( '' ) + test_ISEVEN.SetContainer( 'localhost/FactoryServer' ) + test_ISEVEN.SetComment( 'C_ISEVEN from SyrComponent' ) + test_ISEVEN.Coords( 195 , 417 ) + Itest_ISEVENanInteger = test_ISEVEN.GetInPort( 'anInteger' ) + Itest_ISEVENGate = test_ISEVEN.GetInPort( 'Gate' ) + Otest_ISEVENBoolEven = test_ISEVEN.GetOutPort( 'BoolEven' ) + Otest_ISEVENGate = test_ISEVEN.GetOutPort( 'Gate' ) + + test_ISONE = GraphGOTO_2_2.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' ) + test_ISONE.SetName( 'test_ISONE' ) + test_ISONE.SetAuthor( '' ) + test_ISONE.SetContainer( 'localhost/FactoryServer' ) + test_ISONE.SetComment( 'C_ISONE from SyrComponent' ) + test_ISONE.Coords( 201 , 145 ) + Itest_ISONEanInteger = test_ISONE.GetInPort( 'anInteger' ) + Itest_ISONEGate = test_ISONE.GetInPort( 'Gate' ) + Otest_ISONEBoolOne = test_ISONE.GetOutPort( 'BoolOne' ) + Otest_ISONEGate = test_ISONE.GetOutPort( 'Gate' ) + + m3p1 = GraphGOTO_2_2.FNode( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' ) + m3p1.SetName( 'm3p1' ) + m3p1.SetAuthor( '' ) + m3p1.SetContainer( 'localhost/FactoryServer' ) + m3p1.SetComment( 'C_M3P1 from SyrComponent' ) + m3p1.Coords( 861 , 46 ) + Im3p1anOddInteger = m3p1.GetInPort( 'anOddInteger' ) + Im3p1Gate = m3p1.GetInPort( 'Gate' ) + Om3p1anEvenInteger = m3p1.GetOutPort( 'anEvenInteger' ) + Om3p1Gate = m3p1.GetOutPort( 'Gate' ) + + div2 = GraphGOTO_2_2.FNode( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' ) + div2.SetName( 'div2' ) + div2.SetAuthor( '' ) + div2.SetContainer( 'localhost/FactoryServer' ) + div2.SetComment( 'C_DIV2 from SyrComponent' ) + div2.Coords( 858 , 466 ) + Idiv2anEvenInteger = div2.GetInPort( 'anEvenInteger' ) + Idiv2Gate = div2.GetInPort( 'Gate' ) + Odiv2anInteger = div2.GetOutPort( 'anInteger' ) + Odiv2Gate = div2.GetOutPort( 'Gate' ) + + incr = GraphGOTO_2_2.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' ) + incr.SetName( 'incr' ) + incr.SetAuthor( '' ) + incr.SetContainer( 'localhost/FactoryServer' ) + incr.SetComment( 'C_INCR from SyrComponent' ) + incr.Coords( 865 , 169 ) + IincraCount = incr.GetInPort( 'aCount' ) + IincrGate = incr.GetInPort( 'Gate' ) + OincraNewCount = incr.GetOutPort( 'aNewCount' ) + OincrGate = incr.GetOutPort( 'Gate' ) + + # Creation of InLine Nodes + Pylabel_begin = [] + Pylabel_begin.append( 'def label_begin( NB , KB ):' ) + Pylabel_begin.append( ' print "label_begin",NB,KB' ) + Pylabel_begin.append( ' return NB,KB' ) + label_begin = GraphGOTO_2_2.INode( 'label_begin' , Pylabel_begin ) + label_begin.SetName( 'label_begin' ) + label_begin.SetAuthor( '' ) + label_begin.SetComment( 'Python function' ) + label_begin.Coords( 9 , 250 ) + Ilabel_beginNB = label_begin.InPort( 'NB' , 'long' ) + Ilabel_beginKB = label_begin.InPort( 'KB' , 'long' ) + Ilabel_beginGate = label_begin.GetInPort( 'Gate' ) + Olabel_beginNT = label_begin.OutPort( 'NT' , 'long' ) + Olabel_beginKT = label_begin.OutPort( 'KT' , 'long' ) + Olabel_beginGate = label_begin.GetOutPort( 'Gate' ) + + Pylabel_test = [] + Pylabel_test.append( 'def label_test( ValEven , ValOne , NB , KB ):' ) + Pylabel_test.append( ' print "label_begin",ValEven,ValOne,NB,KB' ) + Pylabel_test.append( ' return ValEven,ValOne,NB,KB' ) + label_test = GraphGOTO_2_2.INode( 'label_test' , Pylabel_test ) + label_test.SetName( 'label_test' ) + label_test.SetAuthor( '' ) + label_test.SetComment( 'Python function' ) + label_test.Coords( 396 , 193 ) + Ilabel_testValEven = label_test.InPort( 'ValEven' , 'long' ) + Ilabel_testValOne = label_test.InPort( 'ValOne' , 'long' ) + Ilabel_testNT = label_test.InPort( 'NT' , 'long' ) + Ilabel_testKT = label_test.InPort( 'KT' , 'long' ) + Ilabel_testGate = label_test.GetInPort( 'Gate' ) + Olabel_testValEven = label_test.OutPort( 'ValEven' , 'long' ) + Olabel_testValOne = label_test.OutPort( 'ValOne' , 'long' ) + Olabel_testNT = label_test.OutPort( 'NT' , 'long' ) + Olabel_testKT = label_test.OutPort( 'KT' , 'long' ) + Olabel_testGate = label_test.GetOutPort( 'Gate' ) + + # Creation of Switch Nodes + Pytest = [] + Pytest.append( 'def Switch_OneEven( ValOne , ValEven , NT , KT ) :' ) + Pytest.append( ' Finished = ValOne' ) + Pytest.append( ' if Finished == 0 :' ) + Pytest.append( ' Incr = 1' ) + Pytest.append( ' Even = ValEven' ) + Pytest.append( ' if Even == 0 :' ) + Pytest.append( ' Odd = 1' ) + Pytest.append( ' else :' ) + Pytest.append( ' Odd = 0' ) + Pytest.append( ' else :' ) + Pytest.append( ' Incr = 0' ) + Pytest.append( ' Even = 0' ) + Pytest.append( ' Odd = 0' ) + Pytest.append( ' Even = ValEven' ) + Pytest.append( ' return Finished,Incr,Even,Odd,NT,KT' ) + test,EndSwitch_OneEven = GraphGOTO_2_2.SNode( 'Switch_OneEven' , Pytest ) + EndSwitch_OneEven.SetName( 'EndSwitch_OneEven' ) + EndSwitch_OneEven.SetAuthor( '' ) + EndSwitch_OneEven.SetComment( 'Compute Node' ) + EndSwitch_OneEven.Coords( 1256 , 305 ) + PyEndSwitch_OneEven = [] + PyEndSwitch_OneEven.append( 'def EndSwitch_OneEven( Finished , K ):' ) + PyEndSwitch_OneEven.append( ' print "label_begin",Finished,K' ) + PyEndSwitch_OneEven.append( ' return Finished,K' ) + EndSwitch_OneEven.SetPyFunction( 'EndSwitch_OneEven' , PyEndSwitch_OneEven ) + IEndSwitch_OneEvenFinished = EndSwitch_OneEven.InPort( 'Finished' , 'long' ) + IEndSwitch_OneEvenK = EndSwitch_OneEven.InPort( 'K' , 'long' ) + IEndSwitch_OneEvenDefault = EndSwitch_OneEven.GetInPort( 'Default' ) + OEndSwitch_OneEvenFinished = EndSwitch_OneEven.OutPort( 'Finished' , 'long' ) + OEndSwitch_OneEvenK = EndSwitch_OneEven.OutPort( 'K' , 'long' ) + OEndSwitch_OneEvenGate = EndSwitch_OneEven.GetOutPort( 'Gate' ) + test.SetName( 'test' ) + test.SetAuthor( '' ) + test.SetComment( 'Compute Node' ) + test.Coords( 595 , 239 ) + ItestValOne = test.InPort( 'ValOne' , 'long' ) + ItestValEven = test.InPort( 'ValEven' , 'long' ) + ItestNT = test.InPort( 'NT' , 'long' ) + ItestKT = test.InPort( 'KT' , 'long' ) + ItestGate = test.GetInPort( 'Gate' ) + OtestFinished = test.OutPort( 'Finished' , 'long' ) + OtestIncr = test.OutPort( 'Incr' , 'long' ) + OtestEven = test.OutPort( 'Even' , 'long' ) + OtestOdd = test.OutPort( 'Odd' , 'long' ) + OtestN = test.OutPort( 'N' , 'long' ) + OtestK = test.OutPort( 'K' , 'long' ) + OtestDefault = test.GetOutPort( 'Default' ) + + # Creation of GOTO Nodes + Pycontrol_m3p1 = [] + Pycontrol_m3p1.append( 'def control_m3p1( N , K ):' ) + Pycontrol_m3p1.append( ' return 0,1,N,K' ) + control_m3p1 = GraphGOTO_2_2.GNode( 'control_m3p1' , Pycontrol_m3p1 , 'label_test' ) + control_m3p1.SetName( 'control_m3p1' ) + control_m3p1.SetAuthor( '' ) + control_m3p1.SetComment( 'Compute Node' ) + control_m3p1.Coords( 1073 , 87 ) + Icontrol_m3p1N = control_m3p1.InPort( 'N' , 'long' ) + Icontrol_m3p1K = control_m3p1.InPort( 'K' , 'long' ) + Icontrol_m3p1Gate = control_m3p1.GetInPort( 'Gate' ) + Ocontrol_m3p1ValOne = control_m3p1.OutPort( 'ValOne' , 'long' ) + Ocontrol_m3p1ValEven = control_m3p1.OutPort( 'ValEven' , 'long' ) + Ocontrol_m3p1NT = control_m3p1.OutPort( 'NT' , 'long' ) + Ocontrol_m3p1KT = control_m3p1.OutPort( 'KT' , 'long' ) + Ocontrol_m3p1Gate = control_m3p1.GetOutPort( 'Gate' ) + + Pycontrol_div2 = [] + Pycontrol_div2.append( 'def control_div2( N , NB ) :' ) + Pycontrol_div2.append( ' return N,NB' ) + control_div2 = GraphGOTO_2_2.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' ) + control_div2.SetName( 'control_div2' ) + control_div2.SetAuthor( '' ) + control_div2.SetComment( 'Compute Node' ) + control_div2.Coords( 1128 , 453 ) + Icontrol_div2N = control_div2.InPort( 'N' , 'long' ) + Icontrol_div2K = control_div2.InPort( 'K' , 'long' ) + Icontrol_div2Gate = control_div2.GetInPort( 'Gate' ) + Ocontrol_div2NB = control_div2.OutPort( 'NB' , 'long' ) + Ocontrol_div2KB = control_div2.OutPort( 'KB' , 'long' ) + Ocontrol_div2Gate = control_div2.GetOutPort( 'Gate' ) + + # Creation of Links + Ltest_ISEVENBoolEvenlabel_testValEven = GraphGOTO_2_2.Link( Otest_ISEVENBoolEven , Ilabel_testValEven ) + Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 1 , 369 , 273 ) + Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 2 , 370 , 498 ) + + Ltest_ISONEBoolOnelabel_testValOne = GraphGOTO_2_2.Link( Otest_ISONEBoolOne , Ilabel_testValOne ) + Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 1 , 384 , 281 ) + Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 2 , 384 , 225 ) + + Lm3p1anEvenIntegercontrol_m3p1N = GraphGOTO_2_2.Link( Om3p1anEvenInteger , Icontrol_m3p1N ) + + Ldiv2anIntegercontrol_div2N = GraphGOTO_2_2.Link( Odiv2anInteger , Icontrol_div2N ) + + LincraNewCountcontrol_m3p1K = GraphGOTO_2_2.Link( OincraNewCount , Icontrol_m3p1K ) + LincraNewCountcontrol_m3p1K.AddCoord( 1 , 1048 , 139 ) + LincraNewCountcontrol_m3p1K.AddCoord( 2 , 1048 , 241 ) + + LincraNewCountcontrol_div2K = GraphGOTO_2_2.Link( OincraNewCount , Icontrol_div2K ) + LincraNewCountcontrol_div2K.AddCoord( 1 , 1052 , 504 ) + LincraNewCountcontrol_div2K.AddCoord( 2 , 1049 , 239 ) + + Llabel_beginNTlabel_testNT = GraphGOTO_2_2.Link( Olabel_beginNT , Ilabel_testNT ) + + Llabel_beginNTtest_ISONEanInteger = GraphGOTO_2_2.Link( Olabel_beginNT , Itest_ISONEanInteger ) + Llabel_beginNTtest_ISONEanInteger.AddCoord( 1 , 192 , 226 ) + Llabel_beginNTtest_ISONEanInteger.AddCoord( 2 , 191 , 331 ) + + Llabel_beginNTtest_ISEVENanInteger = GraphGOTO_2_2.Link( Olabel_beginNT , Itest_ISEVENanInteger ) + Llabel_beginNTtest_ISEVENanInteger.AddCoord( 1 , 191 , 494 ) + Llabel_beginNTtest_ISEVENanInteger.AddCoord( 2 , 192 , 331 ) + + Llabel_beginKTlabel_testKT = GraphGOTO_2_2.Link( Olabel_beginKT , Ilabel_testKT ) + + Llabel_testValEventestValEven = GraphGOTO_2_2.Link( Olabel_testValEven , ItestValEven ) + + Llabel_testValOnetestValOne = GraphGOTO_2_2.Link( Olabel_testValOne , ItestValOne ) + + Llabel_testNTtestNT = GraphGOTO_2_2.Link( Olabel_testNT , ItestNT ) + + Llabel_testKTtestKT = GraphGOTO_2_2.Link( Olabel_testKT , ItestKT ) + + LtestFinishedEndSwitch_OneEvenFinished = GraphGOTO_2_2.Link( OtestFinished , IEndSwitch_OneEvenFinished ) + + LtestEvendiv2Gate = GraphGOTO_2_2.Link( OtestEven , Idiv2Gate ) + LtestEvendiv2Gate.AddCoord( 1 , 793 , 561 ) + LtestEvendiv2Gate.AddCoord( 2 , 794 , 310 ) + + LtestOddm3p1Gate = GraphGOTO_2_2.Link( OtestOdd , Im3p1Gate ) + LtestOddm3p1Gate.AddCoord( 1 , 778 , 138 ) + LtestOddm3p1Gate.AddCoord( 2 , 780 , 328 ) + + LtestNm3p1anOddInteger = GraphGOTO_2_2.Link( OtestN , Im3p1anOddInteger ) + LtestNm3p1anOddInteger.AddCoord( 1 , 808 , 113 ) + LtestNm3p1anOddInteger.AddCoord( 2 , 807 , 352 ) + + LtestNdiv2anEvenInteger = GraphGOTO_2_2.Link( OtestN , Idiv2anEvenInteger ) + LtestNdiv2anEvenInteger.AddCoord( 1 , 806 , 537 ) + LtestNdiv2anEvenInteger.AddCoord( 2 , 807 , 351 ) + + LtestKEndSwitch_OneEvenK = GraphGOTO_2_2.Link( OtestK , IEndSwitch_OneEvenK ) + + LtestKincraCount = GraphGOTO_2_2.Link( OtestK , IincraCount ) + LtestKincraCount.AddCoord( 1 , 773 , 236 ) + LtestKincraCount.AddCoord( 2 , 773 , 370 ) + + LtestDefaultEndSwitch_OneEvenDefault = GraphGOTO_2_2.Link( OtestDefault , IEndSwitch_OneEvenDefault ) + LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 1 , 840 , 381 ) + LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 2 , 839 , 394 ) + + Lcontrol_m3p1Gatelabel_testGate = GraphGOTO_2_2.Link( Ocontrol_m3p1Gate , Ilabel_testGate ) + Lcontrol_m3p1Gatelabel_testGate.AddCoord( 1 , 388 , 388 ) + Lcontrol_m3p1Gatelabel_testGate.AddCoord( 2 , 389 , 597 ) + Lcontrol_m3p1Gatelabel_testGate.AddCoord( 3 , 1441 , 604 ) + Lcontrol_m3p1Gatelabel_testGate.AddCoord( 4 , 1441 , 199 ) + + Lcontrol_div2Gatelabel_beginGate = GraphGOTO_2_2.Link( Ocontrol_div2Gate , Ilabel_beginGate ) + Lcontrol_div2Gatelabel_beginGate.AddCoord( 1 , 4 , 388 ) + Lcontrol_div2Gatelabel_beginGate.AddCoord( 2 , 3 , 587 ) + Lcontrol_div2Gatelabel_beginGate.AddCoord( 3 , 1307 , 586 ) + Lcontrol_div2Gatelabel_beginGate.AddCoord( 4 , 1307 , 528 ) + + # Input datas + Ilabel_beginNB.Input( 7 ) + Ilabel_beginKB.Input( 0 ) + + # Output Ports of the graph + #OtestIncr = test.GetOutPort( 'Incr' ) + #OEndSwitch_OneEvenFinished = EndSwitch_OneEven.GetOutPort( 'Finished' ) + #OEndSwitch_OneEvenK = EndSwitch_OneEven.GetOutPort( 'K' ) + return GraphGOTO_2_2 + + +GraphGOTO_2_2 = DefGraphGOTO_2_2() diff --git a/examples/GraphGOTO1.xml b/examples/GraphGOTO1.xml new file mode 100755 index 0000000..7aa0df2 --- /dev/null +++ b/examples/GraphGOTO1.xml @@ -0,0 +1,698 @@ + + + + + +? + ? + GraphGOTO_2_2 + 1 + ? + +GraphGOTO_2_2 + + +long + label_begin__NB + +long + label_begin__KB + + +long + test__Incr + +long + EndSwitch_OneEven__Finished + +long + EndSwitch_OneEven__K + + + 17/1/2005 - 13:44:46 + 18/1/2005 - 16:18:56 + 2.0 + JR + ? + Syracuse algorithm + 0 + 0 + + +SyrComponent + SyrComponent + test_ISEVEN + 0 + ? + +C_ISEVEN + + +long + anInteger + + +long + BoolEven + + + 18/1/2005 - 16:18:56 + 18/1/2005 - 16:18:56 + 2.0 + ? + localhost/FactoryServer + C_ISEVEN from SyrComponent + 195 + 417 + +SyrComponent + SyrComponent + test_ISONE + 0 + ? + +C_ISONE + + +long + anInteger + + +long + BoolOne + + + 18/1/2005 - 16:18:56 + 18/1/2005 - 16:18:56 + 2.0 + ? + localhost/FactoryServer + C_ISONE from SyrComponent + 201 + 145 + +SyrComponent + SyrComponent + m3p1 + 0 + ? + +C_M3P1 + + +long + anOddInteger + + +long + anEvenInteger + + + 18/1/2005 - 16:18:56 + 18/1/2005 - 16:18:56 + 2.0 + ? + localhost/FactoryServer + C_M3P1 from SyrComponent + 861 + 46 + +SyrComponent + SyrComponent + div2 + 0 + ? + +C_DIV2 + + +long + anEvenInteger + + +long + anInteger + + + 18/1/2005 - 16:18:56 + 18/1/2005 - 16:18:56 + 2.0 + ? + localhost/FactoryServer + C_DIV2 from SyrComponent + 858 + 466 + +SyrComponent + SyrComponent + incr + 0 + ? + +C_INCR + + +long + aCount + + +long + aNewCount + + + 18/1/2005 - 16:18:56 + 18/1/2005 - 16:18:56 + 2.0 + ? + localhost/FactoryServer + C_INCR from SyrComponent + 865 + 169 + +? + ? + label_begin + 3 + ? + +label_begin + + +long + NB + +long + KB + + +long + NT + +long + KT + + + +label_begin + + + + 18/1/2005 - 16:18:56 + 18/1/2005 - 16:18:56 + 2.0 + ? + ? + Python function + 9 + 250 + +? + ? + label_test + 3 + ? + +label_test + + +long + ValEven + +long + ValOne + +long + NT + +long + KT + + +long + ValEven + +long + ValOne + +long + NT + +long + KT + + + +label_test + + + + 18/1/2005 - 16:18:56 + 18/1/2005 - 16:18:56 + 2.0 + ? + ? + Python function + 396 + 193 + +? + ? + test + 6 + EndSwitch_OneEven + +test + + +long + ValOne + +long + ValEven + +long + NT + +long + KT + + +long + Finished + +long + Incr + +long + Even + +long + Odd + +long + N + +long + K + + + +Switch_OneEven + + + + + + + + + + + + + + + + 18/1/2005 - 16:18:56 + 18/1/2005 - 16:18:56 + 2.0 + ? + ? + Compute Node + 595 + 239 + +? + ? + EndSwitch_OneEven + 7 + test + +EndSwitch_OneEven + + +long + Finished + +long + K + + +long + Finished + +long + K + + + +EndSwitch_OneEven + + + + 18/1/2005 - 16:18:56 + 18/1/2005 - 16:18:56 + 2.0 + ? + ? + Compute Node + 1256 + 305 + +? + ? + control_m3p1 + 8 + label_test + +control_m3p1 + + +long + N + +long + K + + +long + ValOne + +long + ValEven + +long + NT + +long + KT + + + +control_m3p1 + + + 18/1/2005 - 16:18:56 + 18/1/2005 - 16:18:56 + 2.0 + ? + ? + Compute Node + 1073 + 87 + +? + ? + control_div2 + 8 + label_begin + +control_div2 + + +long + N + +long + K + + +long + NB + +long + KB + + + +control_div2 + + + 18/1/2005 - 16:18:56 + 18/1/2005 - 16:18:56 + 2.0 + ? + ? + Compute Node + 1128 + 453 + + +test_ISEVEN + BoolEven + label_test + ValEven + + +369 + 273 + +370 + 498 + +test_ISONE + BoolOne + label_test + ValOne + + +384 + 281 + +384 + 225 + +m3p1 + anEvenInteger + control_m3p1 + N + + +div2 + anInteger + control_div2 + N + + +incr + aNewCount + control_m3p1 + K + + +1048 + 139 + +1048 + 241 + +incr + aNewCount + control_div2 + K + + +1052 + 504 + +1049 + 239 + +label_begin + NT + label_test + NT + + +label_begin + NT + test_ISONE + anInteger + + +192 + 226 + +191 + 331 + +label_begin + NT + test_ISEVEN + anInteger + + +191 + 494 + +192 + 331 + +label_begin + KT + label_test + KT + + +label_test + ValEven + test + ValEven + + +label_test + ValOne + test + ValOne + + +label_test + NT + test + NT + + +label_test + KT + test + KT + + +test + Finished + EndSwitch_OneEven + Finished + + +test + Even + div2 + Gate + + +793 + 561 + +794 + 310 + +test + Odd + m3p1 + Gate + + +778 + 138 + +780 + 328 + +test + N + m3p1 + anOddInteger + + +808 + 113 + +807 + 352 + +test + N + div2 + anEvenInteger + + +806 + 537 + +807 + 351 + +test + K + EndSwitch_OneEven + K + + +test + K + incr + aCount + + +773 + 236 + +773 + 370 + +test + Default + EndSwitch_OneEven + Default + + +840 + 381 + +839 + 394 + +control_m3p1 + Gate + label_test + Gate + + +388 + 388 + +389 + 597 + +1441 + 604 + +1441 + 199 + +control_div2 + Gate + label_begin + Gate + + +4 + 388 + +3 + 587 + +1307 + 586 + +1307 + 528 + + +GraphGOTO_2_2 + label_begin__NB + label_begin + NB + +3 + 7 + + +GraphGOTO_2_2 + label_begin__KB + label_begin + KB + +3 + 0 + diff --git a/examples/GraphGOTOAborted.py b/examples/GraphGOTOAborted.py new file mode 100644 index 0000000..95519b9 --- /dev/null +++ b/examples/GraphGOTOAborted.py @@ -0,0 +1,284 @@ + +# Generated python file of Graph GraphGOTO_2_2 + +from SuperV import * + +# Graph creation of GraphGOTO_2_2 +def DefGraphGOTO_2_2() : + GraphGOTO_2_2 = Graph( 'GraphGOTO_2_2' ) + GraphGOTO_2_2.SetName( 'GraphGOTO_2_2' ) + GraphGOTO_2_2.SetAuthor( 'JR' ) + GraphGOTO_2_2.SetComment( 'Syracuse algorithm' ) + GraphGOTO_2_2.Coords( 0 , 0 ) + + # Creation of Factory Nodes + + test_ISEVEN = GraphGOTO_2_2.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' ) + test_ISEVEN.SetName( 'test_ISEVEN' ) + test_ISEVEN.SetAuthor( '' ) + test_ISEVEN.SetContainer( 'localhost/FactoryServer' ) + test_ISEVEN.SetComment( 'C_ISEVEN from SyrComponent' ) + test_ISEVEN.Coords( 195 , 417 ) + Itest_ISEVENanInteger = test_ISEVEN.GetInPort( 'anInteger' ) + Itest_ISEVENGate = test_ISEVEN.GetInPort( 'Gate' ) + Otest_ISEVENBoolEven = test_ISEVEN.GetOutPort( 'BoolEven' ) + Otest_ISEVENGate = test_ISEVEN.GetOutPort( 'Gate' ) + + test_ISONE = GraphGOTO_2_2.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' ) + test_ISONE.SetName( 'test_ISONE' ) + test_ISONE.SetAuthor( '' ) + test_ISONE.SetContainer( 'localhost/FactoryServer' ) + test_ISONE.SetComment( 'C_ISONE from SyrComponent' ) + test_ISONE.Coords( 201 , 145 ) + Itest_ISONEanInteger = test_ISONE.GetInPort( 'anInteger' ) + Itest_ISONEGate = test_ISONE.GetInPort( 'Gate' ) + Otest_ISONEBoolOne = test_ISONE.GetOutPort( 'BoolOne' ) + Otest_ISONEGate = test_ISONE.GetOutPort( 'Gate' ) + + m3p1 = GraphGOTO_2_2.FNode( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' ) + m3p1.SetName( 'm3p1' ) + m3p1.SetAuthor( '' ) + m3p1.SetContainer( 'localhost/FactoryServer' ) + m3p1.SetComment( 'C_M3P1 from SyrComponent' ) + m3p1.Coords( 861 , 46 ) + Im3p1anOddInteger = m3p1.GetInPort( 'anOddInteger' ) + Im3p1Gate = m3p1.GetInPort( 'Gate' ) + Om3p1anEvenInteger = m3p1.GetOutPort( 'anEvenInteger' ) + Om3p1Gate = m3p1.GetOutPort( 'Gate' ) + + div2 = GraphGOTO_2_2.FNode( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' ) + div2.SetName( 'div2' ) + div2.SetAuthor( '' ) + div2.SetContainer( 'localhost/FactoryServer' ) + div2.SetComment( 'C_DIV2 from SyrComponent' ) + div2.Coords( 858 , 466 ) + Idiv2anEvenInteger = div2.GetInPort( 'anEvenInteger' ) + Idiv2Gate = div2.GetInPort( 'Gate' ) + Odiv2anInteger = div2.GetOutPort( 'anInteger' ) + Odiv2Gate = div2.GetOutPort( 'Gate' ) + + incr = GraphGOTO_2_2.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' ) + incr.SetName( 'incr' ) + incr.SetAuthor( '' ) + incr.SetContainer( 'localhost/FactoryServer' ) + incr.SetComment( 'C_INCR from SyrComponent' ) + incr.Coords( 865 , 169 ) + IincraCount = incr.GetInPort( 'aCount' ) + IincrGate = incr.GetInPort( 'Gate' ) + OincraNewCount = incr.GetOutPort( 'aNewCount' ) + OincrGate = incr.GetOutPort( 'Gate' ) + + # Creation of InLine Nodes + Pylabel_begin = [] + Pylabel_begin.append( 'def label_begin( NB , KB ):' ) + Pylabel_begin.append( ' print "label_begin",NB,KB' ) + Pylabel_begin.append( ' return NB,KB' ) + label_begin = GraphGOTO_2_2.INode( 'label_begin' , Pylabel_begin ) + label_begin.SetName( 'label_begin' ) + label_begin.SetAuthor( '' ) + label_begin.SetComment( 'Python function' ) + label_begin.Coords( 9 , 250 ) + Ilabel_beginNB = label_begin.InPort( 'NB' , 'long' ) + Ilabel_beginKB = label_begin.InPort( 'KB' , 'long' ) + Ilabel_beginGate = label_begin.GetInPort( 'Gate' ) + Olabel_beginNT = label_begin.OutPort( 'NT' , 'long' ) + Olabel_beginKT = label_begin.OutPort( 'KT' , 'long' ) + Olabel_beginGate = label_begin.GetOutPort( 'Gate' ) + + Pylabel_test = [] + Pylabel_test.append( 'def label_test( ValEven , ValOne , NB , KB ):' ) + Pylabel_test.append( ' print "label_begin",ValEven,ValOne,NB,KB' ) + Pylabel_test.append( ' return ValEven,ValOne,NB,KB' ) + label_test = GraphGOTO_2_2.INode( 'label_test' , Pylabel_test ) + label_test.SetName( 'label_test' ) + label_test.SetAuthor( '' ) + label_test.SetComment( 'Python function' ) + label_test.Coords( 396 , 193 ) + Ilabel_testValEven = label_test.InPort( 'ValEven' , 'long' ) + Ilabel_testValOne = label_test.InPort( 'ValOne' , 'long' ) + Ilabel_testNT = label_test.InPort( 'NT' , 'long' ) + Ilabel_testKT = label_test.InPort( 'KT' , 'long' ) + Ilabel_testGate = label_test.GetInPort( 'Gate' ) + Olabel_testValEven = label_test.OutPort( 'ValEven' , 'long' ) + Olabel_testValOne = label_test.OutPort( 'ValOne' , 'long' ) + Olabel_testNT = label_test.OutPort( 'NT' , 'long' ) + Olabel_testKT = label_test.OutPort( 'KT' , 'long' ) + Olabel_testGate = label_test.GetOutPort( 'Gate' ) + + # Creation of Switch Nodes + Pytest = [] + Pytest.append( 'def Switch_OneEven( ValOne , ValEven , NT , KT ) :' ) + Pytest.append( ' Finished = ValOne' ) + Pytest.append( ' if Finished == 0 :' ) + Pytest.append( ' Incr = 1' ) + Pytest.append( ' Even = ValEven' ) + Pytest.append( ' if Even == 0 :' ) + Pytest.append( ' Odd = 1' ) + Pytest.append( ' else :' ) + Pytest.append( ' Odd = 0' ) + Pytest.append( ' else :' ) + Pytest.append( ' Incr = 0' ) + Pytest.append( ' Even = 0' ) + Pytest.append( ' Odd = 0' ) + Pytest.append( ' Even = ValEven' ) + Pytest.append( ' return Finished,Incr,Even,Odd,NT,KT' ) + test,EndSwitch_OneEven = GraphGOTO_2_2.SNode( 'Switch_OneEven' , Pytest ) + EndSwitch_OneEven.SetName( 'EndSwitch_OneEven' ) + EndSwitch_OneEven.SetAuthor( '' ) + EndSwitch_OneEven.SetComment( 'Compute Node' ) + EndSwitch_OneEven.Coords( 1256 , 305 ) + PyEndSwitch_OneEven = [] + PyEndSwitch_OneEven.append( 'def EndSwitch_OneEven( Finished , K ):' ) + PyEndSwitch_OneEven.append( ' print "label_begin",Finished,K' ) + PyEndSwitch_OneEven.append( ' return Finished,K' ) + EndSwitch_OneEven.SetPyFunction( 'EndSwitch_OneEven' , PyEndSwitch_OneEven ) + IEndSwitch_OneEvenFinished = EndSwitch_OneEven.InPort( 'Finished' , 'long' ) + IEndSwitch_OneEvenK = EndSwitch_OneEven.InPort( 'K' , 'long' ) + IEndSwitch_OneEvenDefault = EndSwitch_OneEven.GetInPort( 'Default' ) + OEndSwitch_OneEvenFinished = EndSwitch_OneEven.OutPort( 'Finished' , 'long' ) + OEndSwitch_OneEvenK = EndSwitch_OneEven.OutPort( 'K' , 'long' ) + OEndSwitch_OneEvenGate = EndSwitch_OneEven.GetOutPort( 'Gate' ) + test.SetName( 'test' ) + test.SetAuthor( '' ) + test.SetComment( 'Compute Node' ) + test.Coords( 595 , 239 ) + ItestValOne = test.InPort( 'ValOne' , 'long' ) + ItestValEven = test.InPort( 'ValEven' , 'long' ) + ItestNT = test.InPort( 'NT' , 'long' ) + ItestKT = test.InPort( 'KT' , 'long' ) + ItestGate = test.GetInPort( 'Gate' ) + OtestFinished = test.OutPort( 'Finished' , 'long' ) + OtestIncr = test.OutPort( 'Incr' , 'long' ) + OtestEven = test.OutPort( 'Even' , 'long' ) + OtestOdd = test.OutPort( 'Odd' , 'long' ) + OtestN = test.OutPort( 'N' , 'long' ) + OtestK = test.OutPort( 'K' , 'long' ) + OtestDefault = test.GetOutPort( 'Default' ) + + # Creation of GOTO Nodes + Pycontrol_m3p1 = [] + Pycontrol_m3p1.append( 'def control_m3p1( N , K ):' ) + Pycontrol_m3p1.append( ' return 0,1,N,K' ) + control_m3p1 = GraphGOTO_2_2.GNode( 'control_m3p1' , Pycontrol_m3p1 , 'label_test' ) + control_m3p1.SetName( 'control_m3p1' ) + control_m3p1.SetAuthor( '' ) + control_m3p1.SetComment( 'Compute Node' ) + control_m3p1.Coords( 1073 , 87 ) + Icontrol_m3p1N = control_m3p1.InPort( 'N' , 'long' ) + Icontrol_m3p1K = control_m3p1.InPort( 'K' , 'long' ) + Icontrol_m3p1Gate = control_m3p1.GetInPort( 'Gate' ) + Ocontrol_m3p1ValOne = control_m3p1.OutPort( 'ValOne' , 'long' ) + Ocontrol_m3p1ValEven = control_m3p1.OutPort( 'ValEven' , 'long' ) + Ocontrol_m3p1NT = control_m3p1.OutPort( 'NT' , 'long' ) + Ocontrol_m3p1KT = control_m3p1.OutPort( 'KT' , 'long' ) + Ocontrol_m3p1Gate = control_m3p1.GetOutPort( 'Gate' ) + + Pycontrol_div2 = [] + Pycontrol_div2.append( 'def control_div2( N , NB ) :' ) + Pycontrol_div2.append( ' return N,NB' ) + control_div2 = GraphGOTO_2_2.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' ) + control_div2.SetName( 'control_div2' ) + control_div2.SetAuthor( '' ) + control_div2.SetComment( 'Compute Node' ) + control_div2.Coords( 1128 , 453 ) + Icontrol_div2N = control_div2.InPort( 'N' , 'long' ) + Icontrol_div2K = control_div2.InPort( 'K' , 'long' ) + Icontrol_div2Gate = control_div2.GetInPort( 'Gate' ) + Ocontrol_div2NB = control_div2.OutPort( 'NB' , 'long' ) + Ocontrol_div2KB = control_div2.OutPort( 'KB' , 'long' ) + Ocontrol_div2Gate = control_div2.GetOutPort( 'Gate' ) + + # Creation of Links + Ltest_ISEVENBoolEvenlabel_testValEven = GraphGOTO_2_2.Link( Otest_ISEVENBoolEven , Ilabel_testValEven ) + Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 1 , 369 , 273 ) + Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 2 , 370 , 498 ) + + Ltest_ISONEBoolOnelabel_testValOne = GraphGOTO_2_2.Link( Otest_ISONEBoolOne , Ilabel_testValOne ) + Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 1 , 384 , 281 ) + Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 2 , 384 , 225 ) + + Lm3p1anEvenIntegercontrol_m3p1N = GraphGOTO_2_2.Link( Om3p1anEvenInteger , Icontrol_m3p1N ) + + Ldiv2anIntegercontrol_div2N = GraphGOTO_2_2.Link( Odiv2anInteger , Icontrol_div2N ) + + LincraNewCountcontrol_m3p1K = GraphGOTO_2_2.Link( OincraNewCount , Icontrol_m3p1K ) + LincraNewCountcontrol_m3p1K.AddCoord( 1 , 1048 , 139 ) + LincraNewCountcontrol_m3p1K.AddCoord( 2 , 1048 , 241 ) + + LincraNewCountcontrol_div2K = GraphGOTO_2_2.Link( OincraNewCount , Icontrol_div2K ) + LincraNewCountcontrol_div2K.AddCoord( 1 , 1052 , 504 ) + LincraNewCountcontrol_div2K.AddCoord( 2 , 1049 , 239 ) + + Llabel_beginNTlabel_testNT = GraphGOTO_2_2.Link( Olabel_beginNT , Ilabel_testNT ) + + Llabel_beginNTtest_ISONEanInteger = GraphGOTO_2_2.Link( Olabel_beginNT , Itest_ISONEanInteger ) + Llabel_beginNTtest_ISONEanInteger.AddCoord( 1 , 192 , 226 ) + Llabel_beginNTtest_ISONEanInteger.AddCoord( 2 , 191 , 331 ) + + Llabel_beginNTtest_ISEVENanInteger = GraphGOTO_2_2.Link( Olabel_beginNT , Itest_ISEVENanInteger ) + Llabel_beginNTtest_ISEVENanInteger.AddCoord( 1 , 191 , 494 ) + Llabel_beginNTtest_ISEVENanInteger.AddCoord( 2 , 192 , 331 ) + + Llabel_beginKTlabel_testKT = GraphGOTO_2_2.Link( Olabel_beginKT , Ilabel_testKT ) + + Llabel_testValEventestValEven = GraphGOTO_2_2.Link( Olabel_testValEven , ItestValEven ) + + Llabel_testValOnetestValOne = GraphGOTO_2_2.Link( Olabel_testValOne , ItestValOne ) + + Llabel_testNTtestNT = GraphGOTO_2_2.Link( Olabel_testNT , ItestNT ) + + Llabel_testKTtestKT = GraphGOTO_2_2.Link( Olabel_testKT , ItestKT ) + + LtestFinishedEndSwitch_OneEvenFinished = GraphGOTO_2_2.Link( OtestFinished , IEndSwitch_OneEvenFinished ) + + LtestIncrincrGate = GraphGOTO_2_2.Link( OtestIncr , IincrGate ) + + LtestEvendiv2Gate = GraphGOTO_2_2.Link( OtestEven , Idiv2Gate ) + LtestEvendiv2Gate.AddCoord( 1 , 793 , 561 ) + LtestEvendiv2Gate.AddCoord( 2 , 794 , 310 ) + + LtestOddm3p1Gate = GraphGOTO_2_2.Link( OtestOdd , Im3p1Gate ) + LtestOddm3p1Gate.AddCoord( 1 , 778 , 138 ) + LtestOddm3p1Gate.AddCoord( 2 , 780 , 328 ) + + LtestNm3p1anOddInteger = GraphGOTO_2_2.Link( OtestN , Im3p1anOddInteger ) + LtestNm3p1anOddInteger.AddCoord( 1 , 808 , 113 ) + LtestNm3p1anOddInteger.AddCoord( 2 , 807 , 352 ) + + LtestNdiv2anEvenInteger = GraphGOTO_2_2.Link( OtestN , Idiv2anEvenInteger ) + LtestNdiv2anEvenInteger.AddCoord( 1 , 806 , 537 ) + LtestNdiv2anEvenInteger.AddCoord( 2 , 807 , 351 ) + + LtestKEndSwitch_OneEvenK = GraphGOTO_2_2.Link( OtestK , IEndSwitch_OneEvenK ) + + LtestKincraCount = GraphGOTO_2_2.Link( OtestK , IincraCount ) + LtestKincraCount.AddCoord( 1 , 773 , 236 ) + LtestKincraCount.AddCoord( 2 , 773 , 370 ) + + LtestDefaultEndSwitch_OneEvenDefault = GraphGOTO_2_2.Link( OtestDefault , IEndSwitch_OneEvenDefault ) + LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 1 , 840 , 381 ) + LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 2 , 839 , 394 ) + + Lcontrol_m3p1Gatelabel_testGate = GraphGOTO_2_2.Link( Ocontrol_m3p1Gate , Ilabel_testGate ) + Lcontrol_m3p1Gatelabel_testGate.AddCoord( 1 , 388 , 388 ) + Lcontrol_m3p1Gatelabel_testGate.AddCoord( 2 , 389 , 597 ) + Lcontrol_m3p1Gatelabel_testGate.AddCoord( 3 , 1441 , 604 ) + Lcontrol_m3p1Gatelabel_testGate.AddCoord( 4 , 1441 , 199 ) + + Lcontrol_div2Gatelabel_beginGate = GraphGOTO_2_2.Link( Ocontrol_div2Gate , Ilabel_beginGate ) + Lcontrol_div2Gatelabel_beginGate.AddCoord( 1 , 4 , 388 ) + Lcontrol_div2Gatelabel_beginGate.AddCoord( 2 , 3 , 587 ) + Lcontrol_div2Gatelabel_beginGate.AddCoord( 3 , 1307 , 586 ) + Lcontrol_div2Gatelabel_beginGate.AddCoord( 4 , 1307 , 528 ) + + # Input datas + Ilabel_beginNB.Input( 7 ) + Ilabel_beginKB.Input( 0 ) + + # Output Ports of the graph + #OEndSwitch_OneEvenFinished = EndSwitch_OneEven.GetOutPort( 'Finished' ) + #OEndSwitch_OneEvenK = EndSwitch_OneEven.GetOutPort( 'K' ) + return GraphGOTO_2_2 + + +GraphGOTO_2_2 = DefGraphGOTO_2_2() diff --git a/examples/GraphGOTOAborted.xml b/examples/GraphGOTOAborted.xml new file mode 100644 index 0000000..2f25ecd --- /dev/null +++ b/examples/GraphGOTOAborted.xml @@ -0,0 +1,701 @@ + + + + + +? + ? + GraphGOTO_2_2 + 1 + ? + +GraphGOTO_2_2 + + +long + label_begin__NB + +long + label_begin__KB + + +long + EndSwitch_OneEven__Finished + +long + EndSwitch_OneEven__K + + + 17/1/2005 - 13:44:46 + 19/1/2005 - 18:25:16 + 2.0 + JR + ? + Syracuse algorithm + 0 + 0 + + +SyrComponent + SyrComponent + test_ISEVEN + 0 + ? + +C_ISEVEN + + +long + anInteger + + +long + BoolEven + + + 19/1/2005 - 18:24:34 + 19/1/2005 - 18:24:34 + 2.0 + ? + localhost/FactoryServer + C_ISEVEN from SyrComponent + 195 + 417 + +SyrComponent + SyrComponent + test_ISONE + 0 + ? + +C_ISONE + + +long + anInteger + + +long + BoolOne + + + 19/1/2005 - 18:24:34 + 19/1/2005 - 18:24:34 + 2.0 + ? + localhost/FactoryServer + C_ISONE from SyrComponent + 201 + 145 + +SyrComponent + SyrComponent + m3p1 + 0 + ? + +C_M3P1 + + +long + anOddInteger + + +long + anEvenInteger + + + 19/1/2005 - 18:24:34 + 19/1/2005 - 18:24:34 + 2.0 + ? + localhost/FactoryServer + C_M3P1 from SyrComponent + 861 + 46 + +SyrComponent + SyrComponent + div2 + 0 + ? + +C_DIV2 + + +long + anEvenInteger + + +long + anInteger + + + 19/1/2005 - 18:24:34 + 19/1/2005 - 18:24:34 + 2.0 + ? + localhost/FactoryServer + C_DIV2 from SyrComponent + 858 + 466 + +SyrComponent + SyrComponent + incr + 0 + ? + +C_INCR + + +long + aCount + + +long + aNewCount + + + 19/1/2005 - 18:24:34 + 19/1/2005 - 18:24:34 + 2.0 + ? + localhost/FactoryServer + C_INCR from SyrComponent + 865 + 169 + +? + ? + label_begin + 3 + ? + +label_begin + + +long + NB + +long + KB + + +long + NT + +long + KT + + + +label_begin + + + + 19/1/2005 - 18:24:34 + 19/1/2005 - 18:24:34 + 2.0 + ? + ? + Python function + 9 + 250 + +? + ? + label_test + 3 + ? + +label_test + + +long + ValEven + +long + ValOne + +long + NT + +long + KT + + +long + ValEven + +long + ValOne + +long + NT + +long + KT + + + +label_test + + + + 19/1/2005 - 18:24:34 + 19/1/2005 - 18:24:34 + 2.0 + ? + ? + Python function + 396 + 193 + +? + ? + test + 6 + EndSwitch_OneEven + +test + + +long + ValOne + +long + ValEven + +long + NT + +long + KT + + +long + Finished + +long + Incr + +long + Even + +long + Odd + +long + N + +long + K + + + +Switch_OneEven + + + + + + + + + + + + + + + + 19/1/2005 - 18:24:34 + 19/1/2005 - 18:24:34 + 2.0 + ? + ? + Compute Node + 595 + 239 + +? + ? + EndSwitch_OneEven + 7 + test + +EndSwitch_OneEven + + +long + Finished + +long + K + + +long + Finished + +long + K + + + +EndSwitch_OneEven + + + + 19/1/2005 - 18:24:34 + 19/1/2005 - 18:24:34 + 2.0 + ? + ? + Compute Node + 1256 + 305 + +? + ? + control_m3p1 + 8 + label_test + +control_m3p1 + + +long + N + +long + K + + +long + ValOne + +long + ValEven + +long + NT + +long + KT + + + +control_m3p1 + + + 19/1/2005 - 18:24:34 + 19/1/2005 - 18:24:34 + 2.0 + ? + ? + Compute Node + 1073 + 87 + +? + ? + control_div2 + 8 + label_begin + +control_div2 + + +long + N + +long + K + + +long + NB + +long + KB + + + +control_div2 + + + 19/1/2005 - 18:24:34 + 19/1/2005 - 18:24:34 + 2.0 + ? + ? + Compute Node + 1128 + 453 + + +test_ISEVEN + BoolEven + label_test + ValEven + + +369 + 273 + +370 + 498 + +test_ISONE + BoolOne + label_test + ValOne + + +384 + 281 + +384 + 225 + +m3p1 + anEvenInteger + control_m3p1 + N + + +div2 + anInteger + control_div2 + N + + +incr + aNewCount + control_m3p1 + K + + +1048 + 139 + +1048 + 241 + +incr + aNewCount + control_div2 + K + + +1052 + 504 + +1049 + 239 + +label_begin + NT + label_test + NT + + +label_begin + NT + test_ISONE + anInteger + + +192 + 226 + +191 + 331 + +label_begin + NT + test_ISEVEN + anInteger + + +191 + 494 + +192 + 331 + +label_begin + KT + label_test + KT + + +label_test + ValEven + test + ValEven + + +label_test + ValOne + test + ValOne + + +label_test + NT + test + NT + + +label_test + KT + test + KT + + +test + Finished + EndSwitch_OneEven + Finished + + +test + Incr + incr + Gate + + +test + Even + div2 + Gate + + +793 + 561 + +794 + 310 + +test + Odd + m3p1 + Gate + + +778 + 138 + +780 + 328 + +test + N + m3p1 + anOddInteger + + +808 + 113 + +807 + 352 + +test + N + div2 + anEvenInteger + + +806 + 537 + +807 + 351 + +test + K + EndSwitch_OneEven + K + + +test + K + incr + aCount + + +773 + 236 + +773 + 370 + +test + Default + EndSwitch_OneEven + Default + + +840 + 381 + +839 + 394 + +control_m3p1 + Gate + label_test + Gate + + +388 + 388 + +389 + 597 + +1441 + 604 + +1441 + 199 + +control_div2 + Gate + label_begin + Gate + + +4 + 388 + +3 + 587 + +1307 + 586 + +1307 + 528 + + +GraphGOTO_2_2 + label_begin__NB + label_begin + NB + +3 + 7 + + +GraphGOTO_2_2 + label_begin__KB + label_begin + KB + +3 + 0 + diff --git a/examples/GraphLoopSwitchOfSwitch.py b/examples/GraphLoopSwitchOfSwitch.py new file mode 100644 index 0000000..4e9975b --- /dev/null +++ b/examples/GraphLoopSwitchOfSwitch.py @@ -0,0 +1,251 @@ + +# Generated python file of Graph GraphLoopSwitchOfSwitch + +from SuperV import * + +# Graph creation of GraphLoopSwitchOfSwitch +def DefGraphLoopSwitchOfSwitch() : + GraphLoopSwitchOfSwitch = Graph( 'GraphLoopSwitchOfSwitch' ) + GraphLoopSwitchOfSwitch.SetName( 'GraphLoopSwitchOfSwitch' ) + GraphLoopSwitchOfSwitch.SetAuthor( 'JR' ) + GraphLoopSwitchOfSwitch.SetComment( '' ) + GraphLoopSwitchOfSwitch.Coords( 0 , 0 ) + + # Creation of Factory Nodes + + # Creation of InLine Nodes + PyIsEven = [] + PyIsEven.append( 'from time import * ' ) + PyIsEven.append( 'def IsEven(a) : ' ) + PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' ) + PyIsEven.append( ' sleep( 1 ) ' ) + PyIsEven.append( ' return a ' ) + IsEven = GraphLoopSwitchOfSwitch.INode( 'IsEven' , PyIsEven ) + IsEven.SetName( 'IsEven' ) + IsEven.SetAuthor( '' ) + IsEven.SetComment( 'Compute Node' ) + IsEven.Coords( 437 , 520 ) + IIsEvena = IsEven.InPort( 'a' , 'long' ) + IIsEvenGate = IsEven.GetInPort( 'Gate' ) + OIsEvena = IsEven.OutPort( 'a' , 'long' ) + OIsEvenGate = IsEven.GetOutPort( 'Gate' ) + + PyPseudoPOne = [] + PyPseudoPOne.append( 'from time import * ' ) + PyPseudoPOne.append( 'def PseudoPOne(POne) : ' ) + PyPseudoPOne.append( ' sleep(1) ' ) + PyPseudoPOne.append( ' return 6*POne+1 ' ) + PseudoPOne = GraphLoopSwitchOfSwitch.INode( 'PseudoPOne' , PyPseudoPOne ) + PseudoPOne.SetName( 'PseudoPOne' ) + PseudoPOne.SetAuthor( '' ) + PseudoPOne.SetComment( 'Compute Node' ) + PseudoPOne.Coords( 612 , 5 ) + IPseudoPOnePOne = PseudoPOne.InPort( 'POne' , 'long' ) + IPseudoPOneGate = PseudoPOne.GetInPort( 'Gate' ) + OPseudoPOnea = PseudoPOne.OutPort( 'a' , 'long' ) + OPseudoPOneGate = PseudoPOne.GetOutPort( 'Gate' ) + + PyPseudoPThree = [] + PyPseudoPThree.append( 'from time import * ' ) + PyPseudoPThree.append( 'def PseudoPThree_1(PThree) : ' ) + PyPseudoPThree.append( ' sleep(1) ' ) + PyPseudoPThree.append( ' return 6*PThree+3 ' ) + PseudoPThree = GraphLoopSwitchOfSwitch.INode( 'PseudoPThree_1' , PyPseudoPThree ) + PseudoPThree.SetName( 'PseudoPThree' ) + PseudoPThree.SetAuthor( '' ) + PseudoPThree.SetComment( 'Compute Node' ) + PseudoPThree.Coords( 620 , 149 ) + IPseudoPThreePThree = PseudoPThree.InPort( 'PThree' , 'long' ) + IPseudoPThreeGate = PseudoPThree.GetInPort( 'Gate' ) + OPseudoPThreea = PseudoPThree.OutPort( 'a' , 'long' ) + OPseudoPThreeGate = PseudoPThree.GetOutPort( 'Gate' ) + + PyPseudoPFive = [] + PyPseudoPFive.append( 'from time import * ' ) + PyPseudoPFive.append( 'def PseudoPFive(PFive) : ' ) + PyPseudoPFive.append( ' sleep(1) ' ) + PyPseudoPFive.append( ' return 6*PFive+5 ' ) + PseudoPFive = GraphLoopSwitchOfSwitch.INode( 'PseudoPFive' , PyPseudoPFive ) + PseudoPFive.SetName( 'PseudoPFive' ) + PseudoPFive.SetAuthor( '' ) + PseudoPFive.SetComment( 'Compute Node' ) + PseudoPFive.Coords( 625 , 343 ) + IPseudoPFivePFive = PseudoPFive.InPort( 'PFive' , 'long' ) + IPseudoPFiveGate = PseudoPFive.GetInPort( 'Gate' ) + OPseudoPFivea = PseudoPFive.OutPort( 'a' , 'long' ) + OPseudoPFiveGate = PseudoPFive.GetOutPort( 'Gate' ) + + # Creation of Loop Nodes + PyLoopSwitch = [] + PyLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' ) + PyLoopSwitch.append( ' Index = Max ' ) + PyLoopSwitch.append( ' return Index,Min,Max ' ) + PyMoreLoopSwitch = [] + PyMoreLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' ) + PyMoreLoopSwitch.append( ' if Index >= Min : ' ) + PyMoreLoopSwitch.append( ' DoLoop = 1 ' ) + PyMoreLoopSwitch.append( ' else : ' ) + PyMoreLoopSwitch.append( ' DoLoop = 0 ' ) + PyMoreLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + PyNextLoopSwitch = [] + PyNextLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' ) + PyNextLoopSwitch.append( ' Index = Index - 1 ' ) + PyNextLoopSwitch.append( ' return Index,Min,Max ' ) + LoopSwitch,EndOfLoopSwitch = GraphLoopSwitchOfSwitch.LNode( 'InitLoop' , PyLoopSwitch , 'MoreLoop' , PyMoreLoopSwitch , 'NextLoop' , PyNextLoopSwitch ) + EndOfLoopSwitch.SetName( 'EndOfLoopSwitch' ) + EndOfLoopSwitch.SetAuthor( '' ) + EndOfLoopSwitch.SetComment( 'Compute Node' ) + EndOfLoopSwitch.Coords( 1268 , 210 ) + PyEndOfLoopSwitch = [] + EndOfLoopSwitch.SetPyFunction( '' , PyEndOfLoopSwitch ) + ILoopSwitchDoLoop = LoopSwitch.GetInPort( 'DoLoop' ) + ILoopSwitchIndex = LoopSwitch.InPort( 'Index' , 'long' ) + ILoopSwitchMin = LoopSwitch.InPort( 'Min' , 'long' ) + ILoopSwitchMax = LoopSwitch.InPort( 'Max' , 'long' ) + ILoopSwitchGate = LoopSwitch.GetInPort( 'Gate' ) + OLoopSwitchDoLoop = LoopSwitch.GetOutPort( 'DoLoop' ) + OLoopSwitchIndex = LoopSwitch.GetOutPort( 'Index' ) + OLoopSwitchMin = LoopSwitch.GetOutPort( 'Min' ) + OLoopSwitchMax = LoopSwitch.GetOutPort( 'Max' ) + IEndOfLoopSwitchDoLoop = EndOfLoopSwitch.GetInPort( 'DoLoop' ) + IEndOfLoopSwitchIndex = EndOfLoopSwitch.GetInPort( 'Index' ) + IEndOfLoopSwitchMin = EndOfLoopSwitch.GetInPort( 'Min' ) + IEndOfLoopSwitchMax = EndOfLoopSwitch.GetInPort( 'Max' ) + IEndOfLoopSwitchGate = EndOfLoopSwitch.GetInPort( 'Gate' ) + OEndOfLoopSwitchDoLoop = EndOfLoopSwitch.GetOutPort( 'DoLoop' ) + OEndOfLoopSwitchIndex = EndOfLoopSwitch.GetOutPort( 'Index' ) + OEndOfLoopSwitchMin = EndOfLoopSwitch.GetOutPort( 'Min' ) + OEndOfLoopSwitchMax = EndOfLoopSwitch.GetOutPort( 'Max' ) + OEndOfLoopSwitchGate = EndOfLoopSwitch.GetOutPort( 'Gate' ) + LoopSwitch.SetName( 'LoopSwitch' ) + LoopSwitch.SetAuthor( '' ) + LoopSwitch.SetComment( 'Compute Node' ) + LoopSwitch.Coords( 6 , 233 ) + + # Creation of Switch Nodes + PySwitch = [] + PySwitch.append( 'from time import * ' ) + PySwitch.append( 'def Switch(a) : ' ) + PySwitch.append( ' sleep(1) ' ) + PySwitch.append( ' if a <= 0 : ' ) + PySwitch.append( ' return 0,a,0 ' ) + PySwitch.append( ' return a & 1,a,1-(a&1) ' ) + Switch,EndOfSwitch = GraphLoopSwitchOfSwitch.SNode( 'Switch' , PySwitch ) + EndOfSwitch.SetName( 'EndOfSwitch' ) + EndOfSwitch.SetAuthor( '' ) + EndOfSwitch.SetComment( 'Compute Node' ) + EndOfSwitch.Coords( 1075 , 210 ) + PyEndOfSwitch = [] + EndOfSwitch.SetPyFunction( 'EndSwitch_1' , PyEndOfSwitch ) + IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' ) + IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' ) + OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' ) + OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' ) + Switch.SetName( 'Switch' ) + Switch.SetAuthor( '' ) + Switch.SetComment( 'Compute Node' ) + Switch.Coords( 201 , 233 ) + ISwitcha = Switch.InPort( 'a' , 'long' ) + ISwitchGate = Switch.GetInPort( 'Gate' ) + OSwitchOdd = Switch.OutPort( 'Odd' , 'long' ) + OSwitcha = Switch.OutPort( 'a' , 'int' ) + OSwitchEven = Switch.OutPort( 'Even' , 'boolean' ) + OSwitchDefault = Switch.GetOutPort( 'Default' ) + + PySwitchOdd = [] + PySwitchOdd.append( 'def SwitchOdd(a) : ' ) + PySwitchOdd.append( ' n = a/6 ' ) + PySwitchOdd.append( ' r = a%6 ' ) + PySwitchOdd.append( ' POne = 0 ' ) + PySwitchOdd.append( ' PThree = 0 ' ) + PySwitchOdd.append( ' PFive = 0 ' ) + PySwitchOdd.append( ' if r == 1 : ' ) + PySwitchOdd.append( ' POne = 1 ' ) + PySwitchOdd.append( ' if r == 3 : ' ) + PySwitchOdd.append( ' PThree = 1 ' ) + PySwitchOdd.append( ' if r == 5 : ' ) + PySwitchOdd.append( ' PFive = 1 ' ) + PySwitchOdd.append( ' return POne,PThree,PFive,n ' ) + SwitchOdd,EndOfSwitchOdd = GraphLoopSwitchOfSwitch.SNode( 'SwitchOdd' , PySwitchOdd ) + EndOfSwitchOdd.SetName( 'EndOfSwitchOdd' ) + EndOfSwitchOdd.SetAuthor( '' ) + EndOfSwitchOdd.SetComment( 'Compute Node' ) + EndOfSwitchOdd.Coords( 851 , 210 ) + PyEndOfSwitchOdd = [] + EndOfSwitchOdd.SetPyFunction( 'EndSwitch' , PyEndOfSwitchOdd ) + IEndOfSwitchOddn = EndOfSwitchOdd.InPort( 'n' , 'long' ) + IEndOfSwitchOddDefault = EndOfSwitchOdd.GetInPort( 'Default' ) + OEndOfSwitchOddn = EndOfSwitchOdd.OutPort( 'n' , 'long' ) + OEndOfSwitchOddGate = EndOfSwitchOdd.GetOutPort( 'Gate' ) + SwitchOdd.SetName( 'SwitchOdd' ) + SwitchOdd.SetAuthor( '' ) + SwitchOdd.SetComment( 'Compute Node' ) + SwitchOdd.Coords( 412 , 169 ) + ISwitchOdda = SwitchOdd.InPort( 'a' , 'long' ) + ISwitchOddGate = SwitchOdd.GetInPort( 'Gate' ) + OSwitchOddPOne = SwitchOdd.OutPort( 'POne' , 'boolean' ) + OSwitchOddPThree = SwitchOdd.OutPort( 'PThree' , 'boolean' ) + OSwitchOddPFive = SwitchOdd.OutPort( 'PFive' , 'boolean' ) + OSwitchOddn = SwitchOdd.OutPort( 'n' , 'long' ) + OSwitchOddDefault = SwitchOdd.GetOutPort( 'Default' ) + + # Creation of Links + LLoopSwitchIndexSwitcha = GraphLoopSwitchOfSwitch.Link( OLoopSwitchIndex , ISwitcha ) + + LLoopSwitchMinEndOfLoopSwitchMin = GraphLoopSwitchOfSwitch.Link( OLoopSwitchMin , IEndOfLoopSwitchMin ) + + LLoopSwitchMaxEndOfLoopSwitchMax = GraphLoopSwitchOfSwitch.Link( OLoopSwitchMax , IEndOfLoopSwitchMax ) + + LIsEvenaEndOfSwitcha = GraphLoopSwitchOfSwitch.Link( OIsEvena , IEndOfSwitcha ) + LIsEvenaEndOfSwitcha.AddCoord( 1 , 719 , 591 ) + + LSwitchOddSwitchOddGate = GraphLoopSwitchOfSwitch.Link( OSwitchOdd , ISwitchOddGate ) + + LSwitchaIsEvena = GraphLoopSwitchOfSwitch.Link( OSwitcha , IIsEvena ) + + LSwitchaSwitchOdda = GraphLoopSwitchOfSwitch.Link( OSwitcha , ISwitchOdda ) + + LSwitchEvenIsEvenGate = GraphLoopSwitchOfSwitch.Link( OSwitchEven , IIsEvenGate ) + + LSwitchDefaultEndOfSwitchDefault = GraphLoopSwitchOfSwitch.Link( OSwitchDefault , IEndOfSwitchDefault ) + LSwitchDefaultEndOfSwitchDefault.AddCoord( 1 , 1057 , 267 ) + LSwitchDefaultEndOfSwitchDefault.AddCoord( 2 , 1079 , 669 ) + LSwitchDefaultEndOfSwitchDefault.AddCoord( 3 , 383 , 666 ) + + LEndOfSwitchaEndOfLoopSwitchIndex = GraphLoopSwitchOfSwitch.Link( OEndOfSwitcha , IEndOfLoopSwitchIndex ) + + LSwitchOddPOnePseudoPOneGate = GraphLoopSwitchOfSwitch.Link( OSwitchOddPOne , IPseudoPOneGate ) + + LSwitchOddPThreePseudoPThreeGate = GraphLoopSwitchOfSwitch.Link( OSwitchOddPThree , IPseudoPThreeGate ) + + LSwitchOddPFivePseudoPFiveGate = GraphLoopSwitchOfSwitch.Link( OSwitchOddPFive , IPseudoPFiveGate ) + + LSwitchOddnPseudoPOnePOne = GraphLoopSwitchOfSwitch.Link( OSwitchOddn , IPseudoPOnePOne ) + + LSwitchOddnPseudoPThreePThree = GraphLoopSwitchOfSwitch.Link( OSwitchOddn , IPseudoPThreePThree ) + + LSwitchOddnPseudoPFivePFive = GraphLoopSwitchOfSwitch.Link( OSwitchOddn , IPseudoPFivePFive ) + + LSwitchOddDefaultEndOfSwitchOddDefault = GraphLoopSwitchOfSwitch.Link( OSwitchOddDefault , IEndOfSwitchOddDefault ) + + LEndOfSwitchOddnEndOfSwitcha = GraphLoopSwitchOfSwitch.Link( OEndOfSwitchOddn , IEndOfSwitcha ) + + LPseudoPOneaEndOfSwitchOddn = GraphLoopSwitchOfSwitch.Link( OPseudoPOnea , IEndOfSwitchOddn ) + + LPseudoPThreeaEndOfSwitchOddn = GraphLoopSwitchOfSwitch.Link( OPseudoPThreea , IEndOfSwitchOddn ) + + LPseudoPFiveaEndOfSwitchOddn = GraphLoopSwitchOfSwitch.Link( OPseudoPFivea , IEndOfSwitchOddn ) + + # Input datas + ILoopSwitchIndex.Input( 0 ) + ILoopSwitchMin.Input( -5 ) + ILoopSwitchMax.Input( 65 ) + + # Output Ports of the graph + #OEndOfLoopSwitchIndex = EndOfLoopSwitch.GetOutPort( 'Index' ) + #OEndOfLoopSwitchMin = EndOfLoopSwitch.GetOutPort( 'Min' ) + #OEndOfLoopSwitchMax = EndOfLoopSwitch.GetOutPort( 'Max' ) + return GraphLoopSwitchOfSwitch + + +GraphLoopSwitchOfSwitch = DefGraphLoopSwitchOfSwitch() diff --git a/examples/GraphLoopSwitchOfSwitch.xml b/examples/GraphLoopSwitchOfSwitch.xml new file mode 100644 index 0000000..69a2420 --- /dev/null +++ b/examples/GraphLoopSwitchOfSwitch.xml @@ -0,0 +1,596 @@ + + + + + +? + ? + GraphLoopSwitchOfSwitch + 1 + ? + +GraphLoopSwitchOfSwitch + + +long + LoopSwitch__Index + +long + LoopSwitch__Min + +long + LoopSwitch__Max + + +long + EndOfLoopSwitch__Index + +long + EndOfLoopSwitch__Min + +long + EndOfLoopSwitch__Max + + + 1/10/2003 - 17:23:54 + 20/1/2005 - 17:13:50 + 1.05 + JR + ? + ? + 0 + 0 + + +? + ? + LoopSwitch + 4 + EndOfLoopSwitch + +LoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +InitLoop + + + + +MoreLoop + + = Min : ]]> + + + + + +NextLoop + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 1.05 + ? + ? + Compute Node + 6 + 233 + +? + ? + EndOfLoopSwitch + 5 + LoopSwitch + +EndOfLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +? + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 1.05 + ? + ? + Compute Node + 1268 + 210 + +? + ? + IsEven + 3 + ? + +IsEven + + +long + a + + +long + a + + + +IsEven + + + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 437 + 520 + +? + ? + Switch + 6 + EndOfSwitch + +Switch + + +long + a + + +long + Odd + +int + a + +boolean + Even + + + +Switch + + + + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 201 + 233 + +? + ? + EndOfSwitch + 7 + Switch + +EndOfSwitch + + +long + a + + +long + a + + + +EndSwitch_1 + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 1075 + 210 + +? + ? + SwitchOdd + 6 + EndOfSwitchOdd + +SwitchOdd + + +long + a + + +boolean + POne + +boolean + PThree + +boolean + PFive + +long + n + + + +SwitchOdd + + + + + + + + + + + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 412 + 169 + +? + ? + EndOfSwitchOdd + 7 + SwitchOdd + +EndOfSwitchOdd + + +long + n + + +long + n + + + +EndSwitch + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 851 + 210 + +? + ? + PseudoPOne + 3 + ? + +PseudoPOne + + +long + POne + + +long + a + + + +PseudoPOne + + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 612 + 5 + +? + ? + PseudoPThree + 3 + ? + +PseudoPThree + + +long + PThree + + +long + a + + + +PseudoPThree_1 + + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 620 + 149 + +? + ? + PseudoPFive + 3 + ? + +PseudoPFive + + +long + PFive + + +long + a + + + +PseudoPFive + + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 625 + 343 + + +LoopSwitch + DoLoop + EndOfLoopSwitch + DoLoop + + +LoopSwitch + Index + Switch + a + + +LoopSwitch + Min + EndOfLoopSwitch + Min + + +LoopSwitch + Max + EndOfLoopSwitch + Max + + +EndOfLoopSwitch + DoLoop + LoopSwitch + DoLoop + + +IsEven + a + EndOfSwitch + a + + +719 + 591 + +Switch + Odd + SwitchOdd + Gate + + +Switch + a + IsEven + a + + +Switch + a + SwitchOdd + a + + +Switch + Even + IsEven + Gate + + +Switch + Default + EndOfSwitch + Default + + +1057 + 267 + +1079 + 669 + +383 + 666 + +EndOfSwitch + a + EndOfLoopSwitch + Index + + +SwitchOdd + POne + PseudoPOne + Gate + + +SwitchOdd + PThree + PseudoPThree + Gate + + +SwitchOdd + PFive + PseudoPFive + Gate + + +SwitchOdd + n + PseudoPOne + POne + + +SwitchOdd + n + PseudoPThree + PThree + + +SwitchOdd + n + PseudoPFive + PFive + + +SwitchOdd + Default + EndOfSwitchOdd + Default + + +EndOfSwitchOdd + n + EndOfSwitch + a + + +PseudoPOne + a + EndOfSwitchOdd + n + + +PseudoPThree + a + EndOfSwitchOdd + n + + +PseudoPFive + a + EndOfSwitchOdd + n + + + +GraphLoopSwitchOfSwitch + LoopSwitch__Index + LoopSwitch + Index + +3 + 0 + + +GraphLoopSwitchOfSwitch + LoopSwitch__Min + LoopSwitch + Min + +3 + -5 + + +GraphLoopSwitchOfSwitch + LoopSwitch__Max + LoopSwitch + Max + +3 + 65 + diff --git a/examples/GraphLoopSwitchOfSwitchNOTValid.py b/examples/GraphLoopSwitchOfSwitchNOTValid.py new file mode 100644 index 0000000..afb4003 --- /dev/null +++ b/examples/GraphLoopSwitchOfSwitchNOTValid.py @@ -0,0 +1,250 @@ + +# Generated python file of Graph GraphLoopSwitchOfSwitchNOTValid + +from SuperV import * + +# Graph creation of GraphLoopSwitchOfSwitchNOTValid +def DefGraphLoopSwitchOfSwitchNOTValid() : + GraphLoopSwitchOfSwitchNOTValid = Graph( 'GraphLoopSwitchOfSwitchNOTValid' ) + GraphLoopSwitchOfSwitchNOTValid.SetName( 'GraphLoopSwitchOfSwitchNOTValid' ) + GraphLoopSwitchOfSwitchNOTValid.SetAuthor( 'JR' ) + GraphLoopSwitchOfSwitchNOTValid.SetComment( '' ) + GraphLoopSwitchOfSwitchNOTValid.Coords( 0 , 0 ) + + # Creation of Factory Nodes + + # Creation of InLine Nodes + PyIsEven = [] + PyIsEven.append( 'from time import * ' ) + PyIsEven.append( 'def IsEven(a) : ' ) + PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' ) + PyIsEven.append( ' sleep( 1 ) ' ) + PyIsEven.append( ' return a ' ) + IsEven = GraphLoopSwitchOfSwitchNOTValid.INode( 'IsEven' , PyIsEven ) + IsEven.SetName( 'IsEven' ) + IsEven.SetAuthor( '' ) + IsEven.SetComment( 'Compute Node' ) + IsEven.Coords( 437 , 520 ) + IIsEvena = IsEven.InPort( 'a' , 'long' ) + IIsEvenGate = IsEven.GetInPort( 'Gate' ) + OIsEvena = IsEven.OutPort( 'a' , 'long' ) + OIsEvenGate = IsEven.GetOutPort( 'Gate' ) + + PyPseudoPOne = [] + PyPseudoPOne.append( 'from time import * ' ) + PyPseudoPOne.append( 'def PseudoPOne(POne) : ' ) + PyPseudoPOne.append( ' sleep(1) ' ) + PyPseudoPOne.append( ' return 6*POne+1 ' ) + PseudoPOne = GraphLoopSwitchOfSwitchNOTValid.INode( 'PseudoPOne' , PyPseudoPOne ) + PseudoPOne.SetName( 'PseudoPOne' ) + PseudoPOne.SetAuthor( '' ) + PseudoPOne.SetComment( 'Compute Node' ) + PseudoPOne.Coords( 612 , 5 ) + IPseudoPOnePOne = PseudoPOne.InPort( 'POne' , 'long' ) + IPseudoPOneGate = PseudoPOne.GetInPort( 'Gate' ) + OPseudoPOnea = PseudoPOne.OutPort( 'a' , 'long' ) + OPseudoPOneGate = PseudoPOne.GetOutPort( 'Gate' ) + + PyPseudoPThree = [] + PyPseudoPThree.append( 'from time import * ' ) + PyPseudoPThree.append( 'def PseudoPThree_1(PThree) : ' ) + PyPseudoPThree.append( ' sleep(1) ' ) + PyPseudoPThree.append( ' return 6*PThree+3 ' ) + PseudoPThree = GraphLoopSwitchOfSwitchNOTValid.INode( 'PseudoPThree_1' , PyPseudoPThree ) + PseudoPThree.SetName( 'PseudoPThree' ) + PseudoPThree.SetAuthor( '' ) + PseudoPThree.SetComment( 'Compute Node' ) + PseudoPThree.Coords( 620 , 149 ) + IPseudoPThreePThree = PseudoPThree.InPort( 'PThree' , 'long' ) + IPseudoPThreeGate = PseudoPThree.GetInPort( 'Gate' ) + OPseudoPThreea = PseudoPThree.OutPort( 'a' , 'long' ) + OPseudoPThreeGate = PseudoPThree.GetOutPort( 'Gate' ) + + PyPseudoPFive = [] + PyPseudoPFive.append( 'from time import * ' ) + PyPseudoPFive.append( 'def PseudoPFive(PFive) : ' ) + PyPseudoPFive.append( ' sleep(1) ' ) + PyPseudoPFive.append( ' return 6*PFive+5 ' ) + PseudoPFive = GraphLoopSwitchOfSwitchNOTValid.INode( 'PseudoPFive' , PyPseudoPFive ) + PseudoPFive.SetName( 'PseudoPFive' ) + PseudoPFive.SetAuthor( '' ) + PseudoPFive.SetComment( 'Compute Node' ) + PseudoPFive.Coords( 625 , 343 ) + IPseudoPFivePFive = PseudoPFive.InPort( 'PFive' , 'long' ) + IPseudoPFiveGate = PseudoPFive.GetInPort( 'Gate' ) + OPseudoPFivea = PseudoPFive.OutPort( 'a' , 'long' ) + OPseudoPFiveGate = PseudoPFive.GetOutPort( 'Gate' ) + + # Creation of Loop Nodes + PyLoopSwitch = [] + PyLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' ) + PyLoopSwitch.append( ' Index = Max ' ) + PyLoopSwitch.append( ' return Index,Min,Max ' ) + PyMoreLoopSwitch = [] + PyMoreLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' ) + PyMoreLoopSwitch.append( ' if Index >= Min : ' ) + PyMoreLoopSwitch.append( ' DoLoop = 1 ' ) + PyMoreLoopSwitch.append( ' else : ' ) + PyMoreLoopSwitch.append( ' DoLoop = 0 ' ) + PyMoreLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + PyNextLoopSwitch = [] + PyNextLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' ) + PyNextLoopSwitch.append( ' Index = Index - 1 ' ) + PyNextLoopSwitch.append( ' return Index,Min,Max ' ) + LoopSwitch,EndOfLoopSwitch = GraphLoopSwitchOfSwitchNOTValid.LNode( 'InitLoop' , PyLoopSwitch , 'MoreLoop' , PyMoreLoopSwitch , 'NextLoop' , PyNextLoopSwitch ) + EndOfLoopSwitch.SetName( 'EndOfLoopSwitch' ) + EndOfLoopSwitch.SetAuthor( '' ) + EndOfLoopSwitch.SetComment( 'Compute Node' ) + EndOfLoopSwitch.Coords( 1268 , 210 ) + PyEndOfLoopSwitch = [] + EndOfLoopSwitch.SetPyFunction( '' , PyEndOfLoopSwitch ) + ILoopSwitchDoLoop = LoopSwitch.GetInPort( 'DoLoop' ) + ILoopSwitchIndex = LoopSwitch.InPort( 'Index' , 'long' ) + ILoopSwitchMin = LoopSwitch.InPort( 'Min' , 'long' ) + ILoopSwitchMax = LoopSwitch.InPort( 'Max' , 'long' ) + ILoopSwitchGate = LoopSwitch.GetInPort( 'Gate' ) + OLoopSwitchDoLoop = LoopSwitch.GetOutPort( 'DoLoop' ) + OLoopSwitchIndex = LoopSwitch.GetOutPort( 'Index' ) + OLoopSwitchMin = LoopSwitch.GetOutPort( 'Min' ) + OLoopSwitchMax = LoopSwitch.GetOutPort( 'Max' ) + IEndOfLoopSwitchDoLoop = EndOfLoopSwitch.GetInPort( 'DoLoop' ) + IEndOfLoopSwitchIndex = EndOfLoopSwitch.GetInPort( 'Index' ) + IEndOfLoopSwitchMin = EndOfLoopSwitch.GetInPort( 'Min' ) + IEndOfLoopSwitchMax = EndOfLoopSwitch.GetInPort( 'Max' ) + IEndOfLoopSwitchGate = EndOfLoopSwitch.GetInPort( 'Gate' ) + OEndOfLoopSwitchDoLoop = EndOfLoopSwitch.GetOutPort( 'DoLoop' ) + OEndOfLoopSwitchIndex = EndOfLoopSwitch.GetOutPort( 'Index' ) + OEndOfLoopSwitchMin = EndOfLoopSwitch.GetOutPort( 'Min' ) + OEndOfLoopSwitchMax = EndOfLoopSwitch.GetOutPort( 'Max' ) + OEndOfLoopSwitchGate = EndOfLoopSwitch.GetOutPort( 'Gate' ) + LoopSwitch.SetName( 'LoopSwitch' ) + LoopSwitch.SetAuthor( '' ) + LoopSwitch.SetComment( 'Compute Node' ) + LoopSwitch.Coords( 6 , 233 ) + + # Creation of Switch Nodes + PySwitch = [] + PySwitch.append( 'from time import * ' ) + PySwitch.append( 'def Switch(a) : ' ) + PySwitch.append( ' sleep(1) ' ) + PySwitch.append( ' if a <= 0 : ' ) + PySwitch.append( ' return 0,a,0 ' ) + PySwitch.append( ' return a & 1,a,1-(a&1) ' ) + Switch,EndOfSwitch = GraphLoopSwitchOfSwitchNOTValid.SNode( 'Switch' , PySwitch ) + EndOfSwitch.SetName( 'EndOfSwitch' ) + EndOfSwitch.SetAuthor( '' ) + EndOfSwitch.SetComment( 'Compute Node' ) + EndOfSwitch.Coords( 1075 , 210 ) + PyEndOfSwitch = [] + EndOfSwitch.SetPyFunction( 'EndSwitch_1' , PyEndOfSwitch ) + IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' ) + IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' ) + OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' ) + OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' ) + Switch.SetName( 'Switch' ) + Switch.SetAuthor( '' ) + Switch.SetComment( 'Compute Node' ) + Switch.Coords( 201 , 233 ) + ISwitcha = Switch.InPort( 'a' , 'long' ) + ISwitchGate = Switch.GetInPort( 'Gate' ) + OSwitchOdd = Switch.OutPort( 'Odd' , 'long' ) + OSwitcha = Switch.OutPort( 'a' , 'int' ) + OSwitchEven = Switch.OutPort( 'Even' , 'boolean' ) + OSwitchDefault = Switch.GetOutPort( 'Default' ) + + PySwitchOdd = [] + PySwitchOdd.append( 'def SwitchOdd(a) : ' ) + PySwitchOdd.append( ' n = a/6 ' ) + PySwitchOdd.append( ' r = a%6 ' ) + PySwitchOdd.append( ' POne = 0 ' ) + PySwitchOdd.append( ' PThree = 0 ' ) + PySwitchOdd.append( ' PFive = 0 ' ) + PySwitchOdd.append( ' if r == 1 : ' ) + PySwitchOdd.append( ' POne = 1 ' ) + PySwitchOdd.append( ' if r == 3 : ' ) + PySwitchOdd.append( ' PThree = 1 ' ) + PySwitchOdd.append( ' if r == 5 : ' ) + PySwitchOdd.append( ' PFive = 1 ' ) + PySwitchOdd.append( ' return POne,PThree,PFive,n ' ) + SwitchOdd,EndOfSwitchOdd = GraphLoopSwitchOfSwitchNOTValid.SNode( 'SwitchOdd' , PySwitchOdd ) + EndOfSwitchOdd.SetName( 'EndOfSwitchOdd' ) + EndOfSwitchOdd.SetAuthor( '' ) + EndOfSwitchOdd.SetComment( 'Compute Node' ) + EndOfSwitchOdd.Coords( 851 , 210 ) + PyEndOfSwitchOdd = [] + EndOfSwitchOdd.SetPyFunction( 'EndSwitch' , PyEndOfSwitchOdd ) + IEndOfSwitchOddn = EndOfSwitchOdd.InPort( 'n' , 'long' ) + IEndOfSwitchOddDefault = EndOfSwitchOdd.GetInPort( 'Default' ) + OEndOfSwitchOddn = EndOfSwitchOdd.OutPort( 'n' , 'long' ) + OEndOfSwitchOddGate = EndOfSwitchOdd.GetOutPort( 'Gate' ) + SwitchOdd.SetName( 'SwitchOdd' ) + SwitchOdd.SetAuthor( '' ) + SwitchOdd.SetComment( 'Compute Node' ) + SwitchOdd.Coords( 412 , 169 ) + ISwitchOdda = SwitchOdd.InPort( 'a' , 'long' ) + ISwitchOddGate = SwitchOdd.GetInPort( 'Gate' ) + OSwitchOddPOne = SwitchOdd.OutPort( 'POne' , 'boolean' ) + OSwitchOddPThree = SwitchOdd.OutPort( 'PThree' , 'boolean' ) + OSwitchOddPFive = SwitchOdd.OutPort( 'PFive' , 'boolean' ) + OSwitchOddn = SwitchOdd.OutPort( 'n' , 'long' ) + OSwitchOddDefault = SwitchOdd.GetOutPort( 'Default' ) + + # Creation of Links + LLoopSwitchIndexSwitcha = GraphLoopSwitchOfSwitchNOTValid.Link( OLoopSwitchIndex , ISwitcha ) + + LLoopSwitchMinEndOfLoopSwitchMin = GraphLoopSwitchOfSwitchNOTValid.Link( OLoopSwitchMin , IEndOfLoopSwitchMin ) + + LLoopSwitchMaxEndOfLoopSwitchMax = GraphLoopSwitchOfSwitchNOTValid.Link( OLoopSwitchMax , IEndOfLoopSwitchMax ) + + LIsEvenaEndOfSwitcha = GraphLoopSwitchOfSwitchNOTValid.Link( OIsEvena , IEndOfSwitcha ) + LIsEvenaEndOfSwitcha.AddCoord( 1 , 719 , 591 ) + + LSwitchOddSwitchOddGate = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOdd , ISwitchOddGate ) + + LSwitchaIsEvena = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitcha , IIsEvena ) + + LSwitchaSwitchOdda = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitcha , ISwitchOdda ) + + LSwitchEvenIsEvenGate = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchEven , IIsEvenGate ) + + LSwitchDefaultEndOfSwitchDefault = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchDefault , IEndOfSwitchDefault ) + LSwitchDefaultEndOfSwitchDefault.AddCoord( 1 , 1057 , 267 ) + LSwitchDefaultEndOfSwitchDefault.AddCoord( 2 , 1079 , 669 ) + LSwitchDefaultEndOfSwitchDefault.AddCoord( 3 , 383 , 666 ) + + LEndOfSwitchaEndOfLoopSwitchIndex = GraphLoopSwitchOfSwitchNOTValid.Link( OEndOfSwitcha , IEndOfLoopSwitchIndex ) + + LSwitchOddPOnePseudoPOneGate = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddPOne , IPseudoPOneGate ) + + LSwitchOddPThreePseudoPThreeGate = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddPThree , IPseudoPThreeGate ) + + LSwitchOddPFivePseudoPFiveGate = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddPFive , IPseudoPFiveGate ) + + LSwitchOddnPseudoPOnePOne = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddn , IPseudoPOnePOne ) + + LSwitchOddnPseudoPThreePThree = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddn , IPseudoPThreePThree ) + + LSwitchOddnPseudoPFivePFive = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddn , IPseudoPFivePFive ) + + LSwitchOddDefaultEndOfSwitchOddDefault = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddDefault , IEndOfSwitchOddDefault ) + + LPseudoPOneaEndOfSwitchOddn = GraphLoopSwitchOfSwitchNOTValid.Link( OPseudoPOnea , IEndOfSwitchOddn ) + + LPseudoPThreeaEndOfSwitchOddn = GraphLoopSwitchOfSwitchNOTValid.Link( OPseudoPThreea , IEndOfSwitchOddn ) + + LPseudoPFiveaEndOfSwitchOddn = GraphLoopSwitchOfSwitchNOTValid.Link( OPseudoPFivea , IEndOfSwitchOddn ) + + # Input datas + ILoopSwitchIndex.Input( 0 ) + ILoopSwitchMin.Input( -5 ) + ILoopSwitchMax.Input( 65 ) + + # Output Ports of the graph + #OEndOfLoopSwitchIndex = EndOfLoopSwitch.GetOutPort( 'Index' ) + #OEndOfLoopSwitchMin = EndOfLoopSwitch.GetOutPort( 'Min' ) + #OEndOfLoopSwitchMax = EndOfLoopSwitch.GetOutPort( 'Max' ) + #OEndOfSwitchOddn = EndOfSwitchOdd.GetOutPort( 'n' ) + return GraphLoopSwitchOfSwitchNOTValid + + +GraphLoopSwitchOfSwitchNOTValid = DefGraphLoopSwitchOfSwitchNOTValid() diff --git a/examples/GraphLoopSwitchOfSwitchNOTValid.xml b/examples/GraphLoopSwitchOfSwitchNOTValid.xml new file mode 100644 index 0000000..7c891f4 --- /dev/null +++ b/examples/GraphLoopSwitchOfSwitchNOTValid.xml @@ -0,0 +1,593 @@ + + + + + +? + ? + GraphLoopSwitchOfSwitchNOTValid + 1 + ? + +GraphLoopSwitchOfSwitchNOTValid + + +long + LoopSwitch__Index + +long + LoopSwitch__Min + +long + LoopSwitch__Max + + +long + EndOfLoopSwitch__Index + +long + EndOfLoopSwitch__Min + +long + EndOfLoopSwitch__Max + +long + EndOfSwitchOdd__n + + + 1/10/2003 - 17:23:54 + 20/1/2005 - 17:22:49 + 1.05 + JR + ? + ? + 0 + 0 + + +? + ? + LoopSwitch + 4 + EndOfLoopSwitch + +LoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +InitLoop + + + + +MoreLoop + + = Min : ]]> + + + + + +NextLoop + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 1.05 + ? + ? + Compute Node + 6 + 233 + +? + ? + EndOfLoopSwitch + 5 + LoopSwitch + +EndOfLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +? + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 1.05 + ? + ? + Compute Node + 1268 + 210 + +? + ? + IsEven + 3 + ? + +IsEven + + +long + a + + +long + a + + + +IsEven + + + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 437 + 520 + +? + ? + Switch + 6 + EndOfSwitch + +Switch + + +long + a + + +long + Odd + +int + a + +boolean + Even + + + +Switch + + + + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 201 + 233 + +? + ? + EndOfSwitch + 7 + Switch + +EndOfSwitch + + +long + a + + +long + a + + + +EndSwitch_1 + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 1075 + 210 + +? + ? + SwitchOdd + 6 + EndOfSwitchOdd + +SwitchOdd + + +long + a + + +boolean + POne + +boolean + PThree + +boolean + PFive + +long + n + + + +SwitchOdd + + + + + + + + + + + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 412 + 169 + +? + ? + EndOfSwitchOdd + 7 + SwitchOdd + +EndOfSwitchOdd + + +long + n + + +long + n + + + +EndSwitch + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 851 + 210 + +? + ? + PseudoPOne + 3 + ? + +PseudoPOne + + +long + POne + + +long + a + + + +PseudoPOne + + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 612 + 5 + +? + ? + PseudoPThree + 3 + ? + +PseudoPThree + + +long + PThree + + +long + a + + + +PseudoPThree_1 + + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 620 + 149 + +? + ? + PseudoPFive + 3 + ? + +PseudoPFive + + +long + PFive + + +long + a + + + +PseudoPFive + + + + + 20/1/2005 - 17:13:50 + 20/1/2005 - 17:13:50 + 2.0 + ? + ? + Compute Node + 625 + 343 + + +LoopSwitch + DoLoop + EndOfLoopSwitch + DoLoop + + +LoopSwitch + Index + Switch + a + + +LoopSwitch + Min + EndOfLoopSwitch + Min + + +LoopSwitch + Max + EndOfLoopSwitch + Max + + +EndOfLoopSwitch + DoLoop + LoopSwitch + DoLoop + + +IsEven + a + EndOfSwitch + a + + +719 + 591 + +Switch + Odd + SwitchOdd + Gate + + +Switch + a + IsEven + a + + +Switch + a + SwitchOdd + a + + +Switch + Even + IsEven + Gate + + +Switch + Default + EndOfSwitch + Default + + +1057 + 267 + +1079 + 669 + +383 + 666 + +EndOfSwitch + a + EndOfLoopSwitch + Index + + +SwitchOdd + POne + PseudoPOne + Gate + + +SwitchOdd + PThree + PseudoPThree + Gate + + +SwitchOdd + PFive + PseudoPFive + Gate + + +SwitchOdd + n + PseudoPOne + POne + + +SwitchOdd + n + PseudoPThree + PThree + + +SwitchOdd + n + PseudoPFive + PFive + + +SwitchOdd + Default + EndOfSwitchOdd + Default + + +PseudoPOne + a + EndOfSwitchOdd + n + + +PseudoPThree + a + EndOfSwitchOdd + n + + +PseudoPFive + a + EndOfSwitchOdd + n + + + +GraphLoopSwitchOfSwitchNOTValid + LoopSwitch__Index + LoopSwitch + Index + +3 + 0 + + +GraphLoopSwitchOfSwitchNOTValid + LoopSwitch__Min + LoopSwitch + Min + +3 + -5 + + +GraphLoopSwitchOfSwitchNOTValid + LoopSwitch__Max + LoopSwitch + Max + +3 + 65 + diff --git a/examples/GraphLoopSwitchs.py b/examples/GraphLoopSwitchs.py new file mode 100644 index 0000000..637832a --- /dev/null +++ b/examples/GraphLoopSwitchs.py @@ -0,0 +1,226 @@ + +# Generated python file of Graph GraphLoopSwitchs + +from SuperV import * + +# Graph creation of GraphLoopSwitchs +def DefGraphLoopSwitchs() : + GraphLoopSwitchs = Graph( 'GraphLoopSwitchs' ) + GraphLoopSwitchs.SetName( 'GraphLoopSwitchs' ) + GraphLoopSwitchs.SetAuthor( 'JR' ) + GraphLoopSwitchs.SetComment( '' ) + GraphLoopSwitchs.Coords( 0 , 0 ) + + # Creation of Factory Nodes + + # Creation of InLine Nodes + PyIsOdd = [] + PyIsOdd.append( 'from time import * ' ) + PyIsOdd.append( 'def IsOdd(a) : ' ) + PyIsOdd.append( ' print a,"IsOdd" ' ) + PyIsOdd.append( ' sleep( 1 ) ' ) + PyIsOdd.append( ' return a ' ) + IsOdd = GraphLoopSwitchs.INode( 'IsOdd' , PyIsOdd ) + IsOdd.SetName( 'IsOdd' ) + IsOdd.SetAuthor( '' ) + IsOdd.SetComment( 'Python function' ) + IsOdd.Coords( 476 , 50 ) + IIsOdda = IsOdd.InPort( 'a' , 'long' ) + IIsOddGate = IsOdd.GetInPort( 'Gate' ) + OIsOdda = IsOdd.OutPort( 'a' , 'long' ) + OIsOddGate = IsOdd.GetOutPort( 'Gate' ) + + PyIsEven = [] + PyIsEven.append( 'from time import * ' ) + PyIsEven.append( 'def IsEven(a) : ' ) + PyIsEven.append( ' print a,"IsEven" ' ) + PyIsEven.append( ' sleep( 1 ) ' ) + PyIsEven.append( ' return a ' ) + IsEven = GraphLoopSwitchs.INode( 'IsEven' , PyIsEven ) + IsEven.SetName( 'IsEven' ) + IsEven.SetAuthor( '' ) + IsEven.SetComment( 'Python function' ) + IsEven.Coords( 479 , 311 ) + IIsEvena = IsEven.InPort( 'a' , 'long' ) + IIsEvenGate = IsEven.GetInPort( 'Gate' ) + OIsEvena = IsEven.OutPort( 'a' , 'long' ) + OIsEvenGate = IsEven.GetOutPort( 'Gate' ) + + PySwitchsCompare = [] + PySwitchsCompare.append( 'def SwitchsCompare(aOdd,Odd,aEven,Even) : ' ) + PySwitchsCompare.append( ' return a ' ) + SwitchsCompare = GraphLoopSwitchs.INode( 'SwitchsCompare' , PySwitchsCompare ) + SwitchsCompare.SetName( 'SwitchsCompare' ) + SwitchsCompare.SetAuthor( '' ) + SwitchsCompare.SetComment( 'Compute Node' ) + SwitchsCompare.Coords( 919 , 242 ) + ISwitchsCompareaOdd = SwitchsCompare.InPort( 'aOdd' , 'long' ) + ISwitchsCompareOdd = SwitchsCompare.InPort( 'Odd' , 'boolean' ) + ISwitchsCompareaEven = SwitchsCompare.InPort( 'aEven' , 'long' ) + ISwitchsCompareEven = SwitchsCompare.InPort( 'Even' , 'boolean' ) + ISwitchsCompareGate = SwitchsCompare.GetInPort( 'Gate' ) + OSwitchsComparea = SwitchsCompare.OutPort( 'a' , 'long' ) + OSwitchsCompareGate = SwitchsCompare.GetOutPort( 'Gate' ) + + # Creation of Loop Nodes + PyLoop = [] + PyLoop.append( 'def InitLoop(Index,Min,Max) : ' ) + PyLoop.append( ' return Index,Min,Max ' ) + PyMoreLoop = [] + PyMoreLoop.append( 'def MoreLoop(Index,Min,Max) : ' ) + PyMoreLoop.append( ' if Index <= Max : ' ) + PyMoreLoop.append( ' DoLoop = 1 ' ) + PyMoreLoop.append( ' else : ' ) + PyMoreLoop.append( ' DoLoop = 0 ' ) + PyMoreLoop.append( ' return DoLoop,Index,Min,Max ' ) + PyNextLoop = [] + PyNextLoop.append( 'def NextLoop(Index,Min,Max) : ' ) + PyNextLoop.append( ' Index = Index + 1 ' ) + PyNextLoop.append( ' return Index,Min,Max ' ) + Loop,EndOfLoop = GraphLoopSwitchs.LNode( 'InitLoop' , PyLoop , 'MoreLoop' , PyMoreLoop , 'NextLoop' , PyNextLoop ) + EndOfLoop.SetName( 'EndOfLoop' ) + EndOfLoop.SetAuthor( '' ) + EndOfLoop.SetComment( 'Compute Node' ) + EndOfLoop.Coords( 1102 , 282 ) + PyEndOfLoop = [] + EndOfLoop.SetPyFunction( '' , PyEndOfLoop ) + ILoopDoLoop = Loop.GetInPort( 'DoLoop' ) + ILoopIndex = Loop.InPort( 'Index' , 'long' ) + ILoopMin = Loop.InPort( 'Min' , 'long' ) + ILoopMax = Loop.InPort( 'Max' , 'long' ) + ILoopGate = Loop.GetInPort( 'Gate' ) + OLoopDoLoop = Loop.GetOutPort( 'DoLoop' ) + OLoopIndex = Loop.GetOutPort( 'Index' ) + OLoopMin = Loop.GetOutPort( 'Min' ) + OLoopMax = Loop.GetOutPort( 'Max' ) + IEndOfLoopDoLoop = EndOfLoop.GetInPort( 'DoLoop' ) + IEndOfLoopIndex = EndOfLoop.GetInPort( 'Index' ) + IEndOfLoopMin = EndOfLoop.GetInPort( 'Min' ) + IEndOfLoopMax = EndOfLoop.GetInPort( 'Max' ) + IEndOfLoopGate = EndOfLoop.GetInPort( 'Gate' ) + OEndOfLoopDoLoop = EndOfLoop.GetOutPort( 'DoLoop' ) + OEndOfLoopIndex = EndOfLoop.GetOutPort( 'Index' ) + OEndOfLoopMin = EndOfLoop.GetOutPort( 'Min' ) + OEndOfLoopMax = EndOfLoop.GetOutPort( 'Max' ) + OEndOfLoopGate = EndOfLoop.GetOutPort( 'Gate' ) + Loop.SetName( 'Loop' ) + Loop.SetAuthor( '' ) + Loop.SetComment( 'Compute Node' ) + Loop.Coords( 12 , 276 ) + + # Creation of Switch Nodes + PySwitchOdd = [] + PySwitchOdd.append( 'from time import * ' ) + PySwitchOdd.append( 'def Switch(a) : ' ) + PySwitchOdd.append( ' if ( a & 1 ) == 0 : ' ) + PySwitchOdd.append( ' sleep(1) ' ) + PySwitchOdd.append( ' return a & 1,1-(a&1),a ' ) + SwitchOdd,EndOfSwitchOdd = GraphLoopSwitchs.SNode( 'Switch' , PySwitchOdd ) + EndOfSwitchOdd.SetName( 'EndOfSwitchOdd' ) + EndOfSwitchOdd.SetAuthor( '' ) + EndOfSwitchOdd.SetComment( 'Compute Node' ) + EndOfSwitchOdd.Coords( 711 , 161 ) + PyEndOfSwitchOdd = [] + EndOfSwitchOdd.SetPyFunction( '' , PyEndOfSwitchOdd ) + IEndOfSwitchOdda = EndOfSwitchOdd.InPort( 'a' , 'long' ) + IEndOfSwitchOddOdd = EndOfSwitchOdd.InPort( 'Odd' , 'boolean' ) + IEndOfSwitchOddDefault = EndOfSwitchOdd.GetInPort( 'Default' ) + OEndOfSwitchOdda = EndOfSwitchOdd.OutPort( 'a' , 'long' ) + OEndOfSwitchOddOdd = EndOfSwitchOdd.OutPort( 'Odd' , 'boolean' ) + OEndOfSwitchOddGate = EndOfSwitchOdd.GetOutPort( 'Gate' ) + SwitchOdd.SetName( 'SwitchOdd' ) + SwitchOdd.SetAuthor( '' ) + SwitchOdd.SetComment( 'Compute Node' ) + SwitchOdd.Coords( 240 , 141 ) + ISwitchOdda = SwitchOdd.InPort( 'a' , 'long' ) + ISwitchOddGate = SwitchOdd.GetInPort( 'Gate' ) + OSwitchOddOdd = SwitchOdd.OutPort( 'Odd' , 'long' ) + OSwitchOddEven = SwitchOdd.OutPort( 'Even' , 'int' ) + OSwitchOdda = SwitchOdd.OutPort( 'a' , 'int' ) + OSwitchOddDefault = SwitchOdd.GetOutPort( 'Default' ) + + PySwitchEven = [] + PySwitchEven.append( 'from time import * ' ) + PySwitchEven.append( 'def Switch(a) : ' ) + PySwitchEven.append( ' if ( a & 1 ) == 0 : ' ) + PySwitchEven.append( ' sleep(1) ' ) + PySwitchEven.append( ' return a & 1,1-(a&1),a ' ) + SwitchEven,EndOfSwitchEven = GraphLoopSwitchs.SNode( 'Switch' , PySwitchEven ) + EndOfSwitchEven.SetName( 'EndOfSwitchEven' ) + EndOfSwitchEven.SetAuthor( '' ) + EndOfSwitchEven.SetComment( 'Compute Node' ) + EndOfSwitchEven.Coords( 718 , 361 ) + PyEndOfSwitchEven = [] + EndOfSwitchEven.SetPyFunction( '' , PyEndOfSwitchEven ) + IEndOfSwitchEvena = EndOfSwitchEven.InPort( 'a' , 'long' ) + IEndOfSwitchEvenEven = EndOfSwitchEven.InPort( 'Even' , 'boolean' ) + IEndOfSwitchEvenDefault = EndOfSwitchEven.GetInPort( 'Default' ) + OEndOfSwitchEvena = EndOfSwitchEven.OutPort( 'a' , 'long' ) + OEndOfSwitchEvenEven = EndOfSwitchEven.OutPort( 'Even' , 'boolean' ) + OEndOfSwitchEvenGate = EndOfSwitchEven.GetOutPort( 'Gate' ) + SwitchEven.SetName( 'SwitchEven' ) + SwitchEven.SetAuthor( '' ) + SwitchEven.SetComment( 'Compute Node' ) + SwitchEven.Coords( 235 , 386 ) + ISwitchEvena = SwitchEven.InPort( 'a' , 'long' ) + ISwitchEvenGate = SwitchEven.GetInPort( 'Gate' ) + OSwitchEvenOdd = SwitchEven.OutPort( 'Odd' , 'long' ) + OSwitchEvenEven = SwitchEven.OutPort( 'Even' , 'int' ) + OSwitchEvena = SwitchEven.OutPort( 'a' , 'int' ) + OSwitchEvenDefault = SwitchEven.GetOutPort( 'Default' ) + + # Creation of Links + LIsOddaEndOfSwitchOdda = GraphLoopSwitchs.Link( OIsOdda , IEndOfSwitchOdda ) + + LSwitchOddOddIsOddGate = GraphLoopSwitchs.Link( OSwitchOddOdd , IIsOddGate ) + + LSwitchOddOddEndOfSwitchOddOdd = GraphLoopSwitchs.Link( OSwitchOddOdd , IEndOfSwitchOddOdd ) + + LSwitchOddaIsOdda = GraphLoopSwitchs.Link( OSwitchOdda , IIsOdda ) + LSwitchOddaIsOdda.AddCoord( 1 , 443 , 121 ) + LSwitchOddaIsOdda.AddCoord( 2 , 443 , 212 ) + + LSwitchOddDefaultEndOfSwitchOddDefault = GraphLoopSwitchs.Link( OSwitchOddDefault , IEndOfSwitchOddDefault ) + + LEndOfSwitchOddaSwitchsCompareaOdd = GraphLoopSwitchs.Link( OEndOfSwitchOdda , ISwitchsCompareaOdd ) + + LEndOfSwitchOddOddSwitchsCompareOdd = GraphLoopSwitchs.Link( OEndOfSwitchOddOdd , ISwitchsCompareOdd ) + + LIsEvenaEndOfSwitchEvena = GraphLoopSwitchs.Link( OIsEvena , IEndOfSwitchEvena ) + + LLoopIndexSwitchEvena = GraphLoopSwitchs.Link( OLoopIndex , ISwitchEvena ) + + LLoopIndexSwitchOdda = GraphLoopSwitchs.Link( OLoopIndex , ISwitchOdda ) + + LLoopMinEndOfLoopMin = GraphLoopSwitchs.Link( OLoopMin , IEndOfLoopMin ) + + LLoopMaxEndOfLoopMax = GraphLoopSwitchs.Link( OLoopMax , IEndOfLoopMax ) + + LSwitchEvenOddIsEvenGate = GraphLoopSwitchs.Link( OSwitchEvenOdd , IIsEvenGate ) + + LSwitchEvenEvenEndOfSwitchEvenDefault = GraphLoopSwitchs.Link( OSwitchEvenEven , IEndOfSwitchEvenDefault ) + + LSwitchEvenaIsEvena = GraphLoopSwitchs.Link( OSwitchEvena , IIsEvena ) + LSwitchEvenaIsEvena.AddCoord( 1 , 434 , 382 ) + LSwitchEvenaIsEvena.AddCoord( 2 , 434 , 457 ) + + LEndOfSwitchEvenaSwitchsCompareaEven = GraphLoopSwitchs.Link( OEndOfSwitchEvena , ISwitchsCompareaEven ) + + LEndOfSwitchEvenEvenSwitchsCompareEven = GraphLoopSwitchs.Link( OEndOfSwitchEvenEven , ISwitchsCompareEven ) + + LSwitchsCompareaEndOfLoopIndex = GraphLoopSwitchs.Link( OSwitchsComparea , IEndOfLoopIndex ) + + # Input datas + ILoopIndex.Input( 0 ) + ILoopMin.Input( 0 ) + ILoopMax.Input( 100 ) + + # Output Ports of the graph + #OSwitchOddEven = SwitchOdd.GetOutPort( 'Even' ) + #OEndOfLoopIndex = EndOfLoop.GetOutPort( 'Index' ) + #OEndOfLoopMin = EndOfLoop.GetOutPort( 'Min' ) + #OEndOfLoopMax = EndOfLoop.GetOutPort( 'Max' ) + return GraphLoopSwitchs + + +GraphLoopSwitchs = DefGraphLoopSwitchs() diff --git a/examples/GraphLoopSwitchs.xml b/examples/GraphLoopSwitchs.xml new file mode 100644 index 0000000..7403dd0 --- /dev/null +++ b/examples/GraphLoopSwitchs.xml @@ -0,0 +1,556 @@ + + + + + +? + ? + GraphLoopSwitchs + 1 + ? + +GraphLoopSwitchs + + +long + Loop__Index + +long + Loop__Min + +long + Loop__Max + + +int + SwitchOdd__Even + +long + EndOfLoop__Index + +long + EndOfLoop__Min + +long + EndOfLoop__Max + + + 14/10/2003 - 10:29:4 + 19/1/2005 - 18:42:37 + 1.05 + JR + ? + ? + 0 + 0 + + +? + ? + IsOdd + 3 + ? + +IsOdd + + +long + a + + +long + a + + + +IsOdd + + + + + + 19/1/2005 - 18:26:50 + 19/1/2005 - 18:26:50 + 1.05 + ? + ? + Python function + 476 + 50 + +? + ? + SwitchOdd + 6 + EndOfSwitchOdd + +Switch + + +long + a + + +long + Odd + +int + Even + +int + a + + + +Switch + + + + + + 19/1/2005 - 18:26:50 + 19/1/2005 - 18:26:50 + 1.05 + ? + ? + Compute Node + 240 + 141 + +? + ? + EndOfSwitchOdd + 7 + SwitchOdd + +EndOfSwitch + + +long + a + +boolean + Odd + + +long + a + +boolean + Odd + + + +? + + 19/1/2005 - 18:26:50 + 19/1/2005 - 18:26:50 + 1.05 + ? + ? + Compute Node + 711 + 161 + +? + ? + IsEven + 3 + ? + +IsOdd_1 + + +long + a + + +long + a + + + +IsEven + + + + + + 19/1/2005 - 18:26:50 + 19/1/2005 - 18:26:50 + 1.05 + ? + ? + Python function + 479 + 311 + +? + ? + Loop + 4 + EndOfLoop + +InitLoop + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +InitLoop + + + +MoreLoop + + + + + + + +NextLoop + + + + 19/1/2005 - 18:26:50 + 19/1/2005 - 18:26:50 + 1.05 + ? + ? + Compute Node + 12 + 276 + +? + ? + EndOfLoop + 5 + Loop + +EndOfInitLoop + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +? + + 19/1/2005 - 18:26:50 + 19/1/2005 - 18:26:50 + 1.05 + ? + ? + Compute Node + 1102 + 282 + +? + ? + SwitchEven + 6 + EndOfSwitchEven + +Switch_1 + + +long + a + + +long + Odd + +int + Even + +int + a + + + +Switch + + + + + + 19/1/2005 - 18:26:50 + 19/1/2005 - 18:26:50 + 1.05 + ? + ? + Compute Node + 235 + 386 + +? + ? + EndOfSwitchEven + 7 + SwitchEven + +EndSwitch + + +long + a + +boolean + Even + + +long + a + +boolean + Even + + + +? + + 19/1/2005 - 18:26:50 + 19/1/2005 - 18:26:50 + 1.05 + ? + ? + Compute Node + 718 + 361 + +? + ? + SwitchsCompare + 3 + ? + +SwitchsCompare + + +long + aOdd + +boolean + Odd + +long + aEven + +boolean + Even + + +long + a + + + +SwitchsCompare + + + 19/1/2005 - 18:34:18 + 19/1/2005 - 18:34:18 + 2.0 + ? + ? + Compute Node + 919 + 242 + + +IsOdd + a + EndOfSwitchOdd + a + + +SwitchOdd + Odd + IsOdd + Gate + + +SwitchOdd + Odd + EndOfSwitchOdd + Odd + + +SwitchOdd + a + IsOdd + a + + +443 + 121 + +443 + 212 + +SwitchOdd + Default + EndOfSwitchOdd + Default + + +EndOfSwitchOdd + a + SwitchsCompare + aOdd + + +EndOfSwitchOdd + Odd + SwitchsCompare + Odd + + +IsEven + a + EndOfSwitchEven + a + + +Loop + DoLoop + EndOfLoop + DoLoop + + +Loop + Index + SwitchEven + a + + +Loop + Index + SwitchOdd + a + + +Loop + Min + EndOfLoop + Min + + +Loop + Max + EndOfLoop + Max + + +EndOfLoop + DoLoop + Loop + DoLoop + + +SwitchEven + Odd + IsEven + Gate + + +SwitchEven + Even + EndOfSwitchEven + Default + + +SwitchEven + a + IsEven + a + + +434 + 382 + +434 + 457 + +EndOfSwitchEven + a + SwitchsCompare + aEven + + +EndOfSwitchEven + Even + SwitchsCompare + Even + + +SwitchsCompare + a + EndOfLoop + Index + + + +GraphLoopSwitchs + Loop__Index + Loop + Index + +3 + 0 + + +GraphLoopSwitchs + Loop__Min + Loop + Min + +3 + 0 + + +GraphLoopSwitchs + Loop__Max + Loop + Max + +3 + 100 + diff --git a/examples/GraphSwitchCheckBranch.py b/examples/GraphSwitchCheckBranch.py new file mode 100644 index 0000000..43fabc9 --- /dev/null +++ b/examples/GraphSwitchCheckBranch.py @@ -0,0 +1,208 @@ + +# Generated python file of Graph GraphSwitchCheckBranch + +from SuperV import * + +# Graph creation of GraphSwitchCheckBranch +def DefGraphSwitchCheckBranch() : + GraphSwitchCheckBranch = Graph( 'GraphSwitchCheckBranch' ) + GraphSwitchCheckBranch.SetName( 'GraphSwitchCheckBranch' ) + GraphSwitchCheckBranch.SetAuthor( 'JR' ) + GraphSwitchCheckBranch.SetComment( 'Switch with two SwitchBranches, One NotSwitchBranch and the DefaultBranch' ) + GraphSwitchCheckBranch.Coords( 0 , 0 ) + + # Creation of Factory Nodes + + # Creation of InLine Nodes + PyIsOdd = [] + PyIsOdd.append( 'from time import * ' ) + PyIsOdd.append( 'def IsOdd(a) : ' ) + PyIsOdd.append( ' print a,"IsOdd (GraphSwitch)" ' ) + PyIsOdd.append( ' sleep( 1 ) ' ) + PyIsOdd.append( ' return a ' ) + IsOdd = GraphSwitchCheckBranch.INode( 'IsOdd' , PyIsOdd ) + IsOdd.SetName( 'IsOdd' ) + IsOdd.SetAuthor( '' ) + IsOdd.SetComment( 'Python function' ) + IsOdd.Coords( 415 , 7 ) + IIsOdda = IsOdd.InPort( 'a' , 'long' ) + IIsOddGate = IsOdd.GetInPort( 'Gate' ) + OIsOdda = IsOdd.OutPort( 'a' , 'long' ) + OIsOddGate = IsOdd.GetOutPort( 'Gate' ) + + PyIsEven = [] + PyIsEven.append( 'from time import * ' ) + PyIsEven.append( 'def IsEven(a) : ' ) + PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' ) + PyIsEven.append( ' sleep( 1 ) ' ) + PyIsEven.append( ' return a ' ) + IsEven = GraphSwitchCheckBranch.INode( 'IsEven' , PyIsEven ) + IsEven.SetName( 'IsEven' ) + IsEven.SetAuthor( '' ) + IsEven.SetComment( 'Compute Node' ) + IsEven.Coords( 421 , 438 ) + IIsEvena = IsEven.InPort( 'a' , 'long' ) + IIsEvenGate = IsEven.GetInPort( 'Gate' ) + OIsEvena = IsEven.OutPort( 'a' , 'long' ) + OIsEvenGate = IsEven.GetOutPort( 'Gate' ) + + PyBranchNode = [] + PyBranchNode.append( 'from time import * ' ) + PyBranchNode.append( 'def Print_1(Branch) : ' ) + PyBranchNode.append( ' print "Print ",Branch ' ) + PyBranchNode.append( ' sleep(1) ' ) + PyBranchNode.append( ' return Branch ' ) + BranchNode = GraphSwitchCheckBranch.INode( 'Print_1' , PyBranchNode ) + BranchNode.SetName( 'BranchNode' ) + BranchNode.SetAuthor( '' ) + BranchNode.SetComment( 'Compute Node' ) + BranchNode.Coords( 604 , 149 ) + IBranchNodeBranch = BranchNode.InPort( 'Branch' , 'string' ) + IBranchNodeGate = BranchNode.GetInPort( 'Gate' ) + OBranchNodeBranch = BranchNode.OutPort( 'Branch' , 'string' ) + OBranchNodeGate = BranchNode.GetOutPort( 'Gate' ) + + # Creation of Loop Nodes + PyInitLoopSwitch = [] + PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' ) + PyInitLoopSwitch.append( ' Index = Max ' ) + PyInitLoopSwitch.append( ' return Index,Min,Max ' ) + PyMoreInitLoopSwitch = [] + PyMoreInitLoopSwitch.append( 'from time import * ' ) + PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' ) + PyMoreInitLoopSwitch.append( ' sleep(1) ' ) + PyMoreInitLoopSwitch.append( ' if Index >= Min : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' ) + PyMoreInitLoopSwitch.append( ' else : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' ) + PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + PyNextInitLoopSwitch = [] + PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' ) + PyNextInitLoopSwitch.append( ' Index = Index - 1 ' ) + PyNextInitLoopSwitch.append( ' return Index,Min,Max ' ) + InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheckBranch.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch ) + EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' ) + EndOfInitLoopSwitch.SetAuthor( '' ) + EndOfInitLoopSwitch.SetComment( 'Compute Node' ) + EndOfInitLoopSwitch.Coords( 1074 , 194 ) + PyEndOfInitLoopSwitch = [] + PyEndOfInitLoopSwitch.append( 'from time import * ' ) + PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) : ' ) + PyEndOfInitLoopSwitch.append( ' sleep(1) ' ) + PyEndOfInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch ) + IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' ) + IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' ) + IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' ) + IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' ) + IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' ) + OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' ) + OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' ) + OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' ) + OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' ) + IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' ) + IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' ) + IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' ) + IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' ) + IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' ) + OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' ) + OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' ) + InitLoopSwitch.SetName( 'InitLoopSwitch' ) + InitLoopSwitch.SetAuthor( '' ) + InitLoopSwitch.SetComment( 'Compute Node' ) + InitLoopSwitch.Coords( 10 , 129 ) + + # Creation of Switch Nodes + PySwitch = [] + PySwitch.append( 'from time import * ' ) + PySwitch.append( 'def Switch(a) : ' ) + PySwitch.append( ' sleep(1) ' ) + PySwitch.append( ' Branch = "Negative or null" ' ) + PySwitch.append( ' if a <= 0 : ' ) + PySwitch.append( ' return 0,0,a,Branch,1 ' ) + PySwitch.append( ' if ( a & 1 ) == 0 : ' ) + PySwitch.append( ' Branch = "Even" ' ) + PySwitch.append( ' else : ' ) + PySwitch.append( ' Branch = "Odd" ' ) + PySwitch.append( ' return a & 1,1-(a&1),a,Branch,0 ' ) + Switch,EndOfSwitch = GraphSwitchCheckBranch.SNode( 'Switch' , PySwitch ) + EndOfSwitch.SetName( 'EndOfSwitch' ) + EndOfSwitch.SetAuthor( '' ) + EndOfSwitch.SetComment( 'Compute Node' ) + EndOfSwitch.Coords( 882 , 194 ) + PyEndOfSwitch = [] + PyEndOfSwitch.append( 'from time import * ' ) + PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' ) + PyEndOfSwitch.append( ' sleep(1) ' ) + PyEndOfSwitch.append( ' return a ' ) + EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch ) + IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' ) + IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' ) + IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' ) + OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' ) + OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' ) + Switch.SetName( 'Switch' ) + Switch.SetAuthor( '' ) + Switch.SetComment( 'Compute Node' ) + Switch.Coords( 195 , 129 ) + ISwitcha = Switch.InPort( 'a' , 'long' ) + ISwitchGate = Switch.GetInPort( 'Gate' ) + OSwitchOdd = Switch.OutPort( 'Odd' , 'long' ) + OSwitchEven = Switch.OutPort( 'Even' , 'int' ) + OSwitcha = Switch.OutPort( 'a' , 'int' ) + OSwitchBranch = Switch.OutPort( 'Branch' , 'string' ) + OSwitchdefault = Switch.OutPort( 'default' , 'boolean' ) + OSwitchDefault = Switch.GetOutPort( 'Default' ) + + # Creation of Links + LIsOddaEndOfSwitcha = GraphSwitchCheckBranch.Link( OIsOdda , IEndOfSwitcha ) + + LIsEvenaEndOfSwitcha = GraphSwitchCheckBranch.Link( OIsEvena , IEndOfSwitcha ) + + LBranchNodeBranchEndOfSwitchBranch = GraphSwitchCheckBranch.Link( OBranchNodeBranch , IEndOfSwitchBranch ) + + LInitLoopSwitchIndexSwitcha = GraphSwitchCheckBranch.Link( OInitLoopSwitchIndex , ISwitcha ) + + LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheckBranch.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin ) + + LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheckBranch.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax ) + + LSwitchOddIsOddGate = GraphSwitchCheckBranch.Link( OSwitchOdd , IIsOddGate ) + LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 ) + LSwitchOddIsOddGate.AddCoord( 2 , 401 , 160 ) + + LSwitchEvenIsEvenGate = GraphSwitchCheckBranch.Link( OSwitchEven , IIsEvenGate ) + LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 ) + LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 182 ) + + LSwitchaIsOdda = GraphSwitchCheckBranch.Link( OSwitcha , IIsOdda ) + LSwitchaIsOdda.AddCoord( 1 , 382 , 78 ) + LSwitchaIsOdda.AddCoord( 2 , 382 , 199 ) + + LSwitchaIsEvena = GraphSwitchCheckBranch.Link( OSwitcha , IIsEvena ) + LSwitchaIsEvena.AddCoord( 1 , 381 , 509 ) + LSwitchaIsEvena.AddCoord( 2 , 382 , 200 ) + + LSwitchBranchBranchNodeBranch = GraphSwitchCheckBranch.Link( OSwitchBranch , IBranchNodeBranch ) + + LSwitchDefaultEndOfSwitchDefault = GraphSwitchCheckBranch.Link( OSwitchDefault , IEndOfSwitchDefault ) + + LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheckBranch.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex ) + + # Input datas + IInitLoopSwitchIndex.Input( 0 ) + IInitLoopSwitchMin.Input( -5 ) + IInitLoopSwitchMax.Input( 10 ) + + # Output Ports of the graph + #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + #OSwitchdefault = Switch.GetOutPort( 'default' ) + return GraphSwitchCheckBranch + + +GraphSwitchCheckBranch = DefGraphSwitchCheckBranch() diff --git a/examples/GraphSwitchCheckBranch.xml b/examples/GraphSwitchCheckBranch.xml new file mode 100644 index 0000000..0a2afea --- /dev/null +++ b/examples/GraphSwitchCheckBranch.xml @@ -0,0 +1,476 @@ + + + + + +? + ? + GraphSwitchCheckBranch + 1 + ? + +GraphSwitchCheckBranch + + +long + InitLoopSwitch__Index + +long + InitLoopSwitch__Min + +long + InitLoopSwitch__Max + + +long + EndOfInitLoopSwitch__Index + +long + EndOfInitLoopSwitch__Min + +long + EndOfInitLoopSwitch__Max + +boolean + Switch__default + + + 13/1/2005 - 11:48:50 + 19/1/2005 - 11:48:48 + 2.0 + JR + ? + Switch with two SwitchBranches, One NotSwitchBranch and the DefaultBranch + 0 + 0 + + +? + ? + IsOdd + 3 + ? + +IsOdd + + +long + a + + +long + a + + + +IsOdd + + + + + + 19/1/2005 - 11:48:48 + 19/1/2005 - 11:48:48 + 2.0 + ? + ? + Python function + 415 + 7 + +? + ? + IsEven + 3 + ? + +IsEven + + +long + a + + +long + a + + + +IsEven + + + + + + 19/1/2005 - 11:48:48 + 19/1/2005 - 11:48:48 + 2.0 + ? + ? + Compute Node + 421 + 438 + +? + ? + BranchNode + 3 + ? + +BranchNode + + +string + Branch + + +string + Branch + + + +Print_1 + + + + + + 19/1/2005 - 11:48:48 + 19/1/2005 - 11:48:48 + 2.0 + ? + ? + Compute Node + 604 + 149 + +? + ? + InitLoopSwitch + 4 + EndOfInitLoopSwitch + +InitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +InitLoop + + + + +MoreLoop + + + + = Min : ]]> + + + + + +NextLoop + + + + 19/1/2005 - 11:48:48 + 19/1/2005 - 11:48:48 + 2.0 + ? + ? + Compute Node + 10 + 129 + +? + ? + EndOfInitLoopSwitch + 5 + InitLoopSwitch + +EndOfInitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +EndOfInitLoopSwitch + + + + + 19/1/2005 - 11:48:48 + 19/1/2005 - 11:48:48 + 2.0 + ? + ? + Compute Node + 1074 + 194 + +? + ? + Switch + 6 + EndOfSwitch + +Switch + + +long + a + + +long + Odd + +int + Even + +int + a + +string + Branch + +boolean + default + + + +Switch + + + + + + + + + + + + 19/1/2005 - 11:48:48 + 19/1/2005 - 11:48:48 + 2.0 + ? + ? + Compute Node + 195 + 129 + +? + ? + EndOfSwitch + 7 + Switch + +EndOfSwitch + + +long + a + +string + Branch + + +long + a + + + +EndOfSwitch + + + + + 19/1/2005 - 11:48:48 + 19/1/2005 - 11:48:48 + 2.0 + ? + ? + Compute Node + 882 + 194 + + +IsOdd + a + EndOfSwitch + a + + +IsEven + a + EndOfSwitch + a + + +BranchNode + Branch + EndOfSwitch + Branch + + +InitLoopSwitch + DoLoop + EndOfInitLoopSwitch + DoLoop + + +InitLoopSwitch + Index + Switch + a + + +InitLoopSwitch + Min + EndOfInitLoopSwitch + Min + + +InitLoopSwitch + Max + EndOfInitLoopSwitch + Max + + +EndOfInitLoopSwitch + DoLoop + InitLoopSwitch + DoLoop + + +Switch + Odd + IsOdd + Gate + + +401 + 101 + +401 + 160 + +Switch + Even + IsEven + Gate + + +392 + 533 + +392 + 182 + +Switch + a + IsOdd + a + + +382 + 78 + +382 + 199 + +Switch + a + IsEven + a + + +381 + 509 + +382 + 200 + +Switch + Branch + BranchNode + Branch + + +Switch + Default + EndOfSwitch + Default + + +EndOfSwitch + a + EndOfInitLoopSwitch + Index + + + +GraphSwitchCheckBranch + InitLoopSwitch__Index + InitLoopSwitch + Index + +3 + 0 + + +GraphSwitchCheckBranch + InitLoopSwitch__Min + InitLoopSwitch + Min + +3 + -5 + + +GraphSwitchCheckBranch + InitLoopSwitch__Max + InitLoopSwitch + Max + +3 + 10 + diff --git a/examples/GraphSwitchCheckBranch1.py b/examples/GraphSwitchCheckBranch1.py new file mode 100644 index 0000000..9ee068c --- /dev/null +++ b/examples/GraphSwitchCheckBranch1.py @@ -0,0 +1,207 @@ + +# Generated python file of Graph GraphSwitchCheckBranch1 + +from SuperV import * + +# Graph creation of GraphSwitchCheckBranch1 +def DefGraphSwitchCheckBranch1() : + GraphSwitchCheckBranch1 = Graph( 'GraphSwitchCheckBranch1' ) + GraphSwitchCheckBranch1.SetName( 'GraphSwitchCheckBranch1' ) + GraphSwitchCheckBranch1.SetAuthor( 'JR' ) + GraphSwitchCheckBranch1.SetComment( 'Switch with two SwitchBranches, One NotSwitchBranch and the DefaultBranch' ) + GraphSwitchCheckBranch1.Coords( 0 , 0 ) + + # Creation of Factory Nodes + + # Creation of InLine Nodes + PyIsOdd = [] + PyIsOdd.append( 'from time import * ' ) + PyIsOdd.append( 'def IsOdd(a) : ' ) + PyIsOdd.append( ' print a,"IsOdd (GraphSwitch)" ' ) + PyIsOdd.append( ' sleep( 1 ) ' ) + PyIsOdd.append( ' return a ' ) + IsOdd = GraphSwitchCheckBranch1.INode( 'IsOdd' , PyIsOdd ) + IsOdd.SetName( 'IsOdd' ) + IsOdd.SetAuthor( '' ) + IsOdd.SetComment( 'Python function' ) + IsOdd.Coords( 415 , 7 ) + IIsOdda = IsOdd.InPort( 'a' , 'long' ) + IIsOddGate = IsOdd.GetInPort( 'Gate' ) + OIsOdda = IsOdd.OutPort( 'a' , 'long' ) + OIsOddGate = IsOdd.GetOutPort( 'Gate' ) + + PyIsEven = [] + PyIsEven.append( 'from time import * ' ) + PyIsEven.append( 'def IsEven(a) : ' ) + PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' ) + PyIsEven.append( ' sleep( 1 ) ' ) + PyIsEven.append( ' return a ' ) + IsEven = GraphSwitchCheckBranch1.INode( 'IsEven' , PyIsEven ) + IsEven.SetName( 'IsEven' ) + IsEven.SetAuthor( '' ) + IsEven.SetComment( 'Compute Node' ) + IsEven.Coords( 421 , 438 ) + IIsEvena = IsEven.InPort( 'a' , 'long' ) + IIsEvenGate = IsEven.GetInPort( 'Gate' ) + OIsEvena = IsEven.OutPort( 'a' , 'long' ) + OIsEvenGate = IsEven.GetOutPort( 'Gate' ) + + PyBranchNode = [] + PyBranchNode.append( 'from time import * ' ) + PyBranchNode.append( 'def Print_1(Branch) : ' ) + PyBranchNode.append( ' print "Print ",Branch ' ) + PyBranchNode.append( ' sleep(1) ' ) + PyBranchNode.append( ' return Branch ' ) + BranchNode = GraphSwitchCheckBranch1.INode( 'Print_1' , PyBranchNode ) + BranchNode.SetName( 'BranchNode' ) + BranchNode.SetAuthor( '' ) + BranchNode.SetComment( 'Compute Node' ) + BranchNode.Coords( 604 , 149 ) + IBranchNodeBranch = BranchNode.InPort( 'Branch' , 'string' ) + IBranchNodeGate = BranchNode.GetInPort( 'Gate' ) + OBranchNodeBranch = BranchNode.OutPort( 'Branch' , 'string' ) + OBranchNodeGate = BranchNode.GetOutPort( 'Gate' ) + + # Creation of Loop Nodes + PyInitLoopSwitch = [] + PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' ) + PyInitLoopSwitch.append( ' Index = Max ' ) + PyInitLoopSwitch.append( ' return Index,Min,Max ' ) + PyMoreInitLoopSwitch = [] + PyMoreInitLoopSwitch.append( 'from time import * ' ) + PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' ) + PyMoreInitLoopSwitch.append( ' sleep(1) ' ) + PyMoreInitLoopSwitch.append( ' if Index >= Min : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' ) + PyMoreInitLoopSwitch.append( ' else : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' ) + PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + PyNextInitLoopSwitch = [] + PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' ) + PyNextInitLoopSwitch.append( ' Index = Index - 1 ' ) + PyNextInitLoopSwitch.append( ' return Index,Min,Max ' ) + InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheckBranch1.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch ) + EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' ) + EndOfInitLoopSwitch.SetAuthor( '' ) + EndOfInitLoopSwitch.SetComment( 'Compute Node' ) + EndOfInitLoopSwitch.Coords( 1074 , 194 ) + PyEndOfInitLoopSwitch = [] + PyEndOfInitLoopSwitch.append( 'from time import * ' ) + PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) : ' ) + PyEndOfInitLoopSwitch.append( ' sleep(1) ' ) + PyEndOfInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch ) + IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' ) + IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' ) + IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' ) + IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' ) + IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' ) + OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' ) + OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' ) + OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' ) + OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' ) + IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' ) + IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' ) + IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' ) + IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' ) + IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' ) + OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' ) + OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' ) + InitLoopSwitch.SetName( 'InitLoopSwitch' ) + InitLoopSwitch.SetAuthor( '' ) + InitLoopSwitch.SetComment( 'Compute Node' ) + InitLoopSwitch.Coords( 10 , 157 ) + + # Creation of Switch Nodes + PySwitch = [] + PySwitch.append( 'from time import * ' ) + PySwitch.append( 'def Switch(a) : ' ) + PySwitch.append( ' sleep(1) ' ) + PySwitch.append( ' Branch = "Negative or null" ' ) + PySwitch.append( ' if a <= 0 : ' ) + PySwitch.append( ' return 0,0,a,Branch,1 ' ) + PySwitch.append( ' if ( a & 1 ) == 0 : ' ) + PySwitch.append( ' Branch = "Even" ' ) + PySwitch.append( ' else : ' ) + PySwitch.append( ' Branch = "Odd" ' ) + PySwitch.append( ' return a & 1,1-(a&1),a,Branch,0 ' ) + Switch,EndOfSwitch = GraphSwitchCheckBranch1.SNode( 'Switch' , PySwitch ) + EndOfSwitch.SetName( 'EndOfSwitch' ) + EndOfSwitch.SetAuthor( '' ) + EndOfSwitch.SetComment( 'Compute Node' ) + EndOfSwitch.Coords( 882 , 194 ) + PyEndOfSwitch = [] + PyEndOfSwitch.append( 'from time import * ' ) + PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' ) + PyEndOfSwitch.append( ' sleep(1) ' ) + PyEndOfSwitch.append( ' return a ' ) + EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch ) + IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' ) + IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' ) + IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' ) + OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' ) + OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' ) + Switch.SetName( 'Switch' ) + Switch.SetAuthor( '' ) + Switch.SetComment( 'Compute Node' ) + Switch.Coords( 194 , 157 ) + ISwitcha = Switch.InPort( 'a' , 'long' ) + ISwitchGate = Switch.GetInPort( 'Gate' ) + OSwitchOdd = Switch.OutPort( 'Odd' , 'long' ) + OSwitchEven = Switch.OutPort( 'Even' , 'int' ) + OSwitcha = Switch.OutPort( 'a' , 'int' ) + OSwitchBranch = Switch.OutPort( 'Branch' , 'string' ) + OSwitchdefault = Switch.OutPort( 'default' , 'boolean' ) + OSwitchDefault = Switch.GetOutPort( 'Default' ) + + # Creation of Links + LIsOddaEndOfSwitcha = GraphSwitchCheckBranch1.Link( OIsOdda , IEndOfSwitcha ) + + LIsEvenaEndOfSwitcha = GraphSwitchCheckBranch1.Link( OIsEvena , IEndOfSwitcha ) + + LBranchNodeBranchEndOfSwitchBranch = GraphSwitchCheckBranch1.Link( OBranchNodeBranch , IEndOfSwitchBranch ) + + LInitLoopSwitchIndexSwitcha = GraphSwitchCheckBranch1.Link( OInitLoopSwitchIndex , ISwitcha ) + + LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheckBranch1.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin ) + + LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheckBranch1.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax ) + + LSwitchOddIsOddGate = GraphSwitchCheckBranch1.Link( OSwitchOdd , IIsOddGate ) + LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 ) + LSwitchOddIsOddGate.AddCoord( 2 , 401 , 188 ) + + LSwitchEvenIsEvenGate = GraphSwitchCheckBranch1.Link( OSwitchEven , IIsEvenGate ) + LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 ) + LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 208 ) + + LSwitchaIsOdda = GraphSwitchCheckBranch1.Link( OSwitcha , IIsOdda ) + LSwitchaIsOdda.AddCoord( 1 , 382 , 78 ) + LSwitchaIsOdda.AddCoord( 2 , 382 , 229 ) + + LSwitchaIsEvena = GraphSwitchCheckBranch1.Link( OSwitcha , IIsEvena ) + LSwitchaIsEvena.AddCoord( 1 , 381 , 509 ) + LSwitchaIsEvena.AddCoord( 2 , 381 , 229 ) + + LSwitchBranchBranchNodeBranch = GraphSwitchCheckBranch1.Link( OSwitchBranch , IBranchNodeBranch ) + + LSwitchdefaultEndOfSwitchDefault = GraphSwitchCheckBranch1.Link( OSwitchdefault , IEndOfSwitchDefault ) + + LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheckBranch1.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex ) + + # Input datas + IInitLoopSwitchIndex.Input( 0 ) + IInitLoopSwitchMin.Input( -5 ) + IInitLoopSwitchMax.Input( 10 ) + + # Output Ports of the graph + #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + return GraphSwitchCheckBranch1 + + +GraphSwitchCheckBranch1 = DefGraphSwitchCheckBranch1() diff --git a/examples/GraphSwitchCheckBranch1.xml b/examples/GraphSwitchCheckBranch1.xml new file mode 100644 index 0000000..98a2977 --- /dev/null +++ b/examples/GraphSwitchCheckBranch1.xml @@ -0,0 +1,473 @@ + + + + + +? + ? + GraphSwitchCheckBranch1 + 1 + ? + +GraphSwitchCheckBranch1 + + +long + InitLoopSwitch__Index + +long + InitLoopSwitch__Min + +long + InitLoopSwitch__Max + + +long + EndOfInitLoopSwitch__Index + +long + EndOfInitLoopSwitch__Min + +long + EndOfInitLoopSwitch__Max + + + 13/1/2005 - 11:48:50 + 19/1/2005 - 17:18:17 + 2.0 + JR + ? + Switch with two SwitchBranches, One NotSwitchBranch and the DefaultBranch + 0 + 0 + + +? + ? + IsOdd + 3 + ? + +IsOdd + + +long + a + + +long + a + + + +IsOdd + + + + + + 19/1/2005 - 17:7:48 + 19/1/2005 - 17:7:48 + 2.0 + ? + ? + Python function + 415 + 7 + +? + ? + IsEven + 3 + ? + +IsEven + + +long + a + + +long + a + + + +IsEven + + + + + + 19/1/2005 - 17:7:48 + 19/1/2005 - 17:7:48 + 2.0 + ? + ? + Compute Node + 421 + 438 + +? + ? + BranchNode + 3 + ? + +BranchNode + + +string + Branch + + +string + Branch + + + +Print_1 + + + + + + 19/1/2005 - 17:7:48 + 19/1/2005 - 17:7:48 + 2.0 + ? + ? + Compute Node + 604 + 149 + +? + ? + InitLoopSwitch + 4 + EndOfInitLoopSwitch + +InitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +InitLoop + + + + +MoreLoop + + + + = Min : ]]> + + + + + +NextLoop + + + + 19/1/2005 - 17:7:48 + 19/1/2005 - 17:7:48 + 2.0 + ? + ? + Compute Node + 10 + 157 + +? + ? + EndOfInitLoopSwitch + 5 + InitLoopSwitch + +EndOfInitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +EndOfInitLoopSwitch + + + + + 19/1/2005 - 17:7:48 + 19/1/2005 - 17:7:48 + 2.0 + ? + ? + Compute Node + 1074 + 194 + +? + ? + Switch + 6 + EndOfSwitch + +Switch + + +long + a + + +long + Odd + +int + Even + +int + a + +string + Branch + +boolean + default + + + +Switch + + + + + + + + + + + + 19/1/2005 - 17:7:48 + 19/1/2005 - 17:7:48 + 2.0 + ? + ? + Compute Node + 194 + 157 + +? + ? + EndOfSwitch + 7 + Switch + +EndOfSwitch + + +long + a + +string + Branch + + +long + a + + + +EndOfSwitch + + + + + 19/1/2005 - 17:7:48 + 19/1/2005 - 17:7:48 + 2.0 + ? + ? + Compute Node + 882 + 194 + + +IsOdd + a + EndOfSwitch + a + + +IsEven + a + EndOfSwitch + a + + +BranchNode + Branch + EndOfSwitch + Branch + + +InitLoopSwitch + DoLoop + EndOfInitLoopSwitch + DoLoop + + +InitLoopSwitch + Index + Switch + a + + +InitLoopSwitch + Min + EndOfInitLoopSwitch + Min + + +InitLoopSwitch + Max + EndOfInitLoopSwitch + Max + + +EndOfInitLoopSwitch + DoLoop + InitLoopSwitch + DoLoop + + +Switch + Odd + IsOdd + Gate + + +401 + 101 + +401 + 188 + +Switch + Even + IsEven + Gate + + +392 + 533 + +392 + 208 + +Switch + a + IsOdd + a + + +382 + 78 + +382 + 229 + +Switch + a + IsEven + a + + +381 + 509 + +381 + 229 + +Switch + Branch + BranchNode + Branch + + +Switch + default + EndOfSwitch + Default + + +EndOfSwitch + a + EndOfInitLoopSwitch + Index + + + +GraphSwitchCheckBranch1 + InitLoopSwitch__Index + InitLoopSwitch + Index + +3 + 0 + + +GraphSwitchCheckBranch1 + InitLoopSwitch__Min + InitLoopSwitch + Min + +3 + -5 + + +GraphSwitchCheckBranch1 + InitLoopSwitch__Max + InitLoopSwitch + Max + +3 + 10 + diff --git a/examples/GraphSwitchCheckDefault1NOTValid.py b/examples/GraphSwitchCheckDefault1NOTValid.py new file mode 100755 index 0000000..41e308b --- /dev/null +++ b/examples/GraphSwitchCheckDefault1NOTValid.py @@ -0,0 +1,299 @@ + +# Generated python file of Graph GraphSwitchCheckDefault11NOTValid + +from SuperV import * + +# Graph creation of GraphSwitchCheckDefault11NOTValid +def DefGraphSwitchCheckDefault11NOTValid() : + GraphSwitchCheckDefault11NOTValid = Graph( 'GraphSwitchCheckDefault11NOTValid' ) + GraphSwitchCheckDefault11NOTValid.SetName( 'GraphSwitchCheckDefault11NOTValid' ) + GraphSwitchCheckDefault11NOTValid.SetAuthor( 'JR' ) + GraphSwitchCheckDefault11NOTValid.SetComment( '' ) + GraphSwitchCheckDefault11NOTValid.Coords( 0 , 0 ) + + # Creation of Factory Nodes + + # Creation of InLine Nodes + PyIsOdd = [] + PyIsOdd.append( 'from time import * ' ) + PyIsOdd.append( 'def IsOdd(a) : ' ) + PyIsOdd.append( ' print a,"IsOdd (GraphSwitch)" ' ) + PyIsOdd.append( ' sleep( 1 ) ' ) + PyIsOdd.append( ' return a ' ) + IsOdd = GraphSwitchCheckDefault11NOTValid.INode( 'IsOdd' , PyIsOdd ) + IsOdd.SetName( 'IsOdd' ) + IsOdd.SetAuthor( '' ) + IsOdd.SetComment( 'Python function' ) + IsOdd.Coords( 415 , 7 ) + IIsOdda = IsOdd.InPort( 'a' , 'long' ) + IIsOddGate = IsOdd.GetInPort( 'Gate' ) + OIsOdda = IsOdd.OutPort( 'a' , 'long' ) + OIsOddGate = IsOdd.GetOutPort( 'Gate' ) + + PyIsEven = [] + PyIsEven.append( 'from time import * ' ) + PyIsEven.append( 'def IsEven(a) : ' ) + PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' ) + PyIsEven.append( ' sleep( 1 ) ' ) + PyIsEven.append( ' return a ' ) + IsEven = GraphSwitchCheckDefault11NOTValid.INode( 'IsEven' , PyIsEven ) + IsEven.SetName( 'IsEven' ) + IsEven.SetAuthor( '' ) + IsEven.SetComment( 'Compute Node' ) + IsEven.Coords( 421 , 438 ) + IIsEvena = IsEven.InPort( 'a' , 'long' ) + IIsEvenGate = IsEven.GetInPort( 'Gate' ) + OIsEvena = IsEven.OutPort( 'a' , 'long' ) + OIsEvenGate = IsEven.GetOutPort( 'Gate' ) + + PyPrintOdd = [] + PyPrintOdd.append( 'from time import * ' ) + PyPrintOdd.append( 'def Print(a,Branch) : ' ) + PyPrintOdd.append( ' print "Print ",a,Branch ' ) + PyPrintOdd.append( ' sleep(1) ' ) + PyPrintOdd.append( ' return Branch ' ) + PrintOdd = GraphSwitchCheckDefault11NOTValid.INode( 'Print' , PyPrintOdd ) + PrintOdd.SetName( 'PrintOdd' ) + PrintOdd.SetAuthor( '' ) + PrintOdd.SetComment( 'Compute Node' ) + PrintOdd.Coords( 415 , 130 ) + IPrintOdda = PrintOdd.InPort( 'a' , 'long' ) + IPrintOddBranch = PrintOdd.InPort( 'Branch' , 'string' ) + IPrintOddGate = PrintOdd.GetInPort( 'Gate' ) + OPrintOddBranch = PrintOdd.OutPort( 'Branch' , 'string' ) + OPrintOddGate = PrintOdd.GetOutPort( 'Gate' ) + + PyPrintEven = [] + PyPrintEven.append( 'from time import * ' ) + PyPrintEven.append( 'def Print_1(a,Branch) : ' ) + PyPrintEven.append( ' print "Print ",a,Branch ' ) + PyPrintEven.append( ' sleep(1) ' ) + PyPrintEven.append( ' return Branch ' ) + PrintEven = GraphSwitchCheckDefault11NOTValid.INode( 'Print_1' , PyPrintEven ) + PrintEven.SetName( 'PrintEven' ) + PrintEven.SetAuthor( '' ) + PrintEven.SetComment( 'Compute Node' ) + PrintEven.Coords( 423 , 289 ) + IPrintEvena = PrintEven.InPort( 'a' , 'long' ) + IPrintEvenBranch = PrintEven.InPort( 'Branch' , 'string' ) + IPrintEvenGate = PrintEven.GetInPort( 'Gate' ) + OPrintEvenBranch = PrintEven.OutPort( 'Branch' , 'string' ) + OPrintEvenGate = PrintEven.GetOutPort( 'Gate' ) + + PyEmptyNode = [] + PyEmptyNode.append( 'from time import * ' ) + PyEmptyNode.append( 'def EmptyNode(a,Branch) : ' ) + PyEmptyNode.append( ' sleep(1) ' ) + PyEmptyNode.append( ' return a,Branch ' ) + EmptyNode = GraphSwitchCheckDefault11NOTValid.INode( 'EmptyNode' , PyEmptyNode ) + EmptyNode.SetName( 'EmptyNode' ) + EmptyNode.SetAuthor( '' ) + EmptyNode.SetComment( 'Compute Node' ) + EmptyNode.Coords( 652 , 110 ) + IEmptyNodea = EmptyNode.InPort( 'a' , 'long' ) + IEmptyNodeBranch = EmptyNode.InPort( 'Branch' , 'string' ) + IEmptyNodeGate = EmptyNode.GetInPort( 'Gate' ) + OEmptyNodea = EmptyNode.OutPort( 'a' , 'long' ) + OEmptyNodeBranch = EmptyNode.OutPort( 'Branch' , 'string' ) + OEmptyNodeGate = EmptyNode.GetOutPort( 'Gate' ) + + PyDefault = [] + PyDefault.append( 'from time import * ' ) + PyDefault.append( 'def Default(a,Branch) : ' ) + PyDefault.append( ' sleep(1) ' ) + PyDefault.append( ' return a,Branch ' ) + Default = GraphSwitchCheckDefault11NOTValid.INode( 'Default' , PyDefault ) + Default.SetName( 'Default' ) + Default.SetAuthor( '' ) + Default.SetComment( 'Compute Node' ) + Default.Coords( 421 , 592 ) + IDefaulta = Default.InPort( 'a' , 'long' ) + IDefaultBranch = Default.InPort( 'Branch' , 'string' ) + IDefaultGate = Default.GetInPort( 'Gate' ) + ODefaulta = Default.OutPort( 'a' , 'long' ) + ODefaultBranch = Default.OutPort( 'Branch' , 'string' ) + ODefaultGate = Default.GetOutPort( 'Gate' ) + + # Creation of Loop Nodes + PyInitLoopSwitch = [] + PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' ) + PyInitLoopSwitch.append( ' Index = Max ' ) + PyInitLoopSwitch.append( ' return Index,Min,Max ' ) + PyMoreInitLoopSwitch = [] + PyMoreInitLoopSwitch.append( 'from time import * ' ) + PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' ) + PyMoreInitLoopSwitch.append( ' sleep(1) ' ) + PyMoreInitLoopSwitch.append( ' if Index >= Min : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' ) + PyMoreInitLoopSwitch.append( ' else : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' ) + PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + PyNextInitLoopSwitch = [] + PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' ) + PyNextInitLoopSwitch.append( ' Index = Index - 1 ' ) + PyNextInitLoopSwitch.append( ' return Index,Min,Max ' ) + InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheckDefault11NOTValid.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch ) + EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' ) + EndOfInitLoopSwitch.SetAuthor( '' ) + EndOfInitLoopSwitch.SetComment( 'Compute Node' ) + EndOfInitLoopSwitch.Coords( 1074 , 194 ) + PyEndOfInitLoopSwitch = [] + PyEndOfInitLoopSwitch.append( 'from time import * ' ) + PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) : ' ) + PyEndOfInitLoopSwitch.append( ' sleep(1) ' ) + PyEndOfInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch ) + IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' ) + IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' ) + IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' ) + IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' ) + IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' ) + OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' ) + OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' ) + OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' ) + OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' ) + IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' ) + IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' ) + IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' ) + IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' ) + IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' ) + OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' ) + OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' ) + InitLoopSwitch.SetName( 'InitLoopSwitch' ) + InitLoopSwitch.SetAuthor( '' ) + InitLoopSwitch.SetComment( 'Compute Node' ) + InitLoopSwitch.Coords( 10 , 129 ) + + # Creation of Switch Nodes + PySwitch = [] + PySwitch.append( 'from time import * ' ) + PySwitch.append( 'def Switch(a) : ' ) + PySwitch.append( ' sleep(1) ' ) + PySwitch.append( ' Branch = "Negative or null" ' ) + PySwitch.append( ' if a <= 0 : ' ) + PySwitch.append( ' return 0,0,a,Branch,1 ' ) + PySwitch.append( ' if ( a & 1 ) == 0 : ' ) + PySwitch.append( ' Branch = "Even" ' ) + PySwitch.append( ' else : ' ) + PySwitch.append( ' Branch = "Odd" ' ) + PySwitch.append( ' return a & 1,1-(a&1),a,Branch,0 ' ) + Switch,EndOfSwitch = GraphSwitchCheckDefault11NOTValid.SNode( 'Switch' , PySwitch ) + EndOfSwitch.SetName( 'EndOfSwitch' ) + EndOfSwitch.SetAuthor( '' ) + EndOfSwitch.SetComment( 'Compute Node' ) + EndOfSwitch.Coords( 882 , 194 ) + PyEndOfSwitch = [] + PyEndOfSwitch.append( 'from time import * ' ) + PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' ) + PyEndOfSwitch.append( ' sleep(1) ' ) + PyEndOfSwitch.append( ' return a ' ) + EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch ) + IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' ) + IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' ) + IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' ) + OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' ) + OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' ) + Switch.SetName( 'Switch' ) + Switch.SetAuthor( '' ) + Switch.SetComment( 'Compute Node' ) + Switch.Coords( 190 , 129 ) + ISwitcha = Switch.InPort( 'a' , 'long' ) + ISwitchGate = Switch.GetInPort( 'Gate' ) + OSwitchOdd = Switch.OutPort( 'Odd' , 'long' ) + OSwitchEven = Switch.OutPort( 'Even' , 'int' ) + OSwitcha = Switch.OutPort( 'a' , 'int' ) + OSwitchBranch = Switch.OutPort( 'Branch' , 'string' ) + OSwitchdefault = Switch.OutPort( 'default' , 'boolean' ) + OSwitchDefault = Switch.GetOutPort( 'Default' ) + + # Creation of Links + LIsOddaEmptyNodea = GraphSwitchCheckDefault11NOTValid.Link( OIsOdda , IEmptyNodea ) + LIsOddaEmptyNodea.AddCoord( 1 , 646 , 78 ) + + LIsEvenaEndOfSwitcha = GraphSwitchCheckDefault11NOTValid.Link( OIsEvena , IEndOfSwitcha ) + + LPrintOddBranchEmptyNodeBranch = GraphSwitchCheckDefault11NOTValid.Link( OPrintOddBranch , IEmptyNodeBranch ) + + LPrintEvenBranchEndOfSwitchBranch = GraphSwitchCheckDefault11NOTValid.Link( OPrintEvenBranch , IEndOfSwitchBranch ) + + LEmptyNodeaEndOfSwitcha = GraphSwitchCheckDefault11NOTValid.Link( OEmptyNodea , IEndOfSwitcha ) + + LEmptyNodeBranchEndOfSwitchBranch = GraphSwitchCheckDefault11NOTValid.Link( OEmptyNodeBranch , IEndOfSwitchBranch ) + + LDefaultBranchEndOfSwitchBranch = GraphSwitchCheckDefault11NOTValid.Link( ODefaultBranch , IEndOfSwitchBranch ) + + LInitLoopSwitchIndexSwitcha = GraphSwitchCheckDefault11NOTValid.Link( OInitLoopSwitchIndex , ISwitcha ) + + LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheckDefault11NOTValid.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin ) + + LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheckDefault11NOTValid.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax ) + + LSwitchOddIsOddGate = GraphSwitchCheckDefault11NOTValid.Link( OSwitchOdd , IIsOddGate ) + LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 ) + LSwitchOddIsOddGate.AddCoord( 2 , 401 , 160 ) + + LSwitchOddPrintOddGate = GraphSwitchCheckDefault11NOTValid.Link( OSwitchOdd , IPrintOddGate ) + LSwitchOddPrintOddGate.AddCoord( 1 , 401 , 245 ) + LSwitchOddPrintOddGate.AddCoord( 2 , 401 , 159 ) + + LSwitchEvenIsEvenGate = GraphSwitchCheckDefault11NOTValid.Link( OSwitchEven , IIsEvenGate ) + LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 ) + LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 182 ) + + LSwitchEvenPrintEvenGate = GraphSwitchCheckDefault11NOTValid.Link( OSwitchEven , IPrintEvenGate ) + LSwitchEvenPrintEvenGate.AddCoord( 1 , 392 , 403 ) + LSwitchEvenPrintEvenGate.AddCoord( 2 , 392 , 181 ) + + LSwitchaIsOdda = GraphSwitchCheckDefault11NOTValid.Link( OSwitcha , IIsOdda ) + LSwitchaIsOdda.AddCoord( 1 , 382 , 78 ) + LSwitchaIsOdda.AddCoord( 2 , 382 , 199 ) + + LSwitchaIsEvena = GraphSwitchCheckDefault11NOTValid.Link( OSwitcha , IIsEvena ) + LSwitchaIsEvena.AddCoord( 1 , 381 , 509 ) + LSwitchaIsEvena.AddCoord( 2 , 382 , 200 ) + + LSwitchaPrintOdda = GraphSwitchCheckDefault11NOTValid.Link( OSwitcha , IPrintOdda ) + + LSwitchaPrintEvena = GraphSwitchCheckDefault11NOTValid.Link( OSwitcha , IPrintEvena ) + LSwitchaPrintEvena.AddCoord( 1 , 381 , 361 ) + LSwitchaPrintEvena.AddCoord( 2 , 382 , 200 ) + + LSwitchaDefaulta = GraphSwitchCheckDefault11NOTValid.Link( OSwitcha , IDefaulta ) + LSwitchaDefaulta.AddCoord( 1 , 382 , 663 ) + LSwitchaDefaulta.AddCoord( 2 , 382 , 199 ) + + LSwitchBranchPrintOddBranch = GraphSwitchCheckDefault11NOTValid.Link( OSwitchBranch , IPrintOddBranch ) + + LSwitchBranchPrintEvenBranch = GraphSwitchCheckDefault11NOTValid.Link( OSwitchBranch , IPrintEvenBranch ) + LSwitchBranchPrintEvenBranch.AddCoord( 1 , 369 , 381 ) + LSwitchBranchPrintEvenBranch.AddCoord( 2 , 369 , 219 ) + + LSwitchBranchDefaultBranch = GraphSwitchCheckDefault11NOTValid.Link( OSwitchBranch , IDefaultBranch ) + LSwitchBranchDefaultBranch.AddCoord( 1 , 370 , 683 ) + LSwitchBranchDefaultBranch.AddCoord( 2 , 370 , 220 ) + + LSwitchdefaultDefaultGate = GraphSwitchCheckDefault11NOTValid.Link( OSwitchdefault , IDefaultGate ) + LSwitchdefaultDefaultGate.AddCoord( 1 , 363 , 707 ) + LSwitchdefaultDefaultGate.AddCoord( 2 , 362 , 239 ) + + LSwitchDefaultEndOfSwitchDefault = GraphSwitchCheckDefault11NOTValid.Link( OSwitchDefault , IEndOfSwitchDefault ) + + LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheckDefault11NOTValid.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex ) + + # Input datas + IInitLoopSwitchIndex.Input( 0 ) + IInitLoopSwitchMin.Input( -5 ) + IInitLoopSwitchMax.Input( 10 ) + + # Output Ports of the graph + #ODefaulta = Default.GetOutPort( 'a' ) + #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + return GraphSwitchCheckDefault11NOTValid + + +GraphSwitchCheckDefault11NOTValid = DefGraphSwitchCheckDefault11NOTValid() diff --git a/examples/GraphSwitchCheckDefault1NOTValid.xml b/examples/GraphSwitchCheckDefault1NOTValid.xml new file mode 100755 index 0000000..4ff662e --- /dev/null +++ b/examples/GraphSwitchCheckDefault1NOTValid.xml @@ -0,0 +1,708 @@ + + + + + +? + ? + GraphSwitchCheckDefault11NOTValid + 1 + ? + +GraphSwitchCheckDefault11NOTValid + + +long + InitLoopSwitch__Index + +long + InitLoopSwitch__Min + +long + InitLoopSwitch__Max + + +long + Default__a + +long + EndOfInitLoopSwitch__Index + +long + EndOfInitLoopSwitch__Min + +long + EndOfInitLoopSwitch__Max + + + 13/1/2005 - 12:21:43 + 19/1/2005 - 12:14:37 + 2.0 + JR + ? + ? + 0 + 0 + + +? + ? + IsOdd + 3 + ? + +IsOdd + + +long + a + + +long + a + + + +IsOdd + + + + + + 19/1/2005 - 12:14:37 + 19/1/2005 - 12:14:37 + 2.0 + ? + ? + Python function + 415 + 7 + +? + ? + IsEven + 3 + ? + +IsEven + + +long + a + + +long + a + + + +IsEven + + + + + + 19/1/2005 - 12:14:37 + 19/1/2005 - 12:14:37 + 2.0 + ? + ? + Compute Node + 421 + 438 + +? + ? + PrintOdd + 3 + ? + +PrintOdd + + +long + a + +string + Branch + + +string + Branch + + + +Print + + + + + + 19/1/2005 - 12:14:37 + 19/1/2005 - 12:14:37 + 2.0 + ? + ? + Compute Node + 415 + 130 + +? + ? + PrintEven + 3 + ? + +PrintEven + + +long + a + +string + Branch + + +string + Branch + + + +Print_1 + + + + + + 19/1/2005 - 12:14:37 + 19/1/2005 - 12:14:37 + 2.0 + ? + ? + Compute Node + 423 + 289 + +? + ? + EmptyNode + 3 + ? + +EmptyNode + + +long + a + +string + Branch + + +long + a + +string + Branch + + + +EmptyNode + + + + + 19/1/2005 - 12:14:37 + 19/1/2005 - 12:14:37 + 2.0 + ? + ? + Compute Node + 652 + 110 + +? + ? + Default + 3 + ? + +Default + + +long + a + +string + Branch + + +long + a + +string + Branch + + + +Default + + + + + 19/1/2005 - 12:14:37 + 19/1/2005 - 12:14:37 + 2.0 + ? + ? + Compute Node + 421 + 592 + +? + ? + InitLoopSwitch + 4 + EndOfInitLoopSwitch + +InitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +InitLoop + + + + +MoreLoop + + + + = Min : ]]> + + + + + +NextLoop + + + + 19/1/2005 - 12:14:37 + 19/1/2005 - 12:14:37 + 2.0 + ? + ? + Compute Node + 10 + 129 + +? + ? + EndOfInitLoopSwitch + 5 + InitLoopSwitch + +EndOfInitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +EndOfInitLoopSwitch + + + + + 19/1/2005 - 12:14:37 + 19/1/2005 - 12:14:37 + 2.0 + ? + ? + Compute Node + 1074 + 194 + +? + ? + Switch + 6 + EndOfSwitch + +Switch + + +long + a + + +long + Odd + +int + Even + +int + a + +string + Branch + +boolean + default + + + +Switch + + + + + + + + + + + + 19/1/2005 - 12:14:37 + 19/1/2005 - 12:14:37 + 2.0 + ? + ? + Compute Node + 190 + 129 + +? + ? + EndOfSwitch + 7 + Switch + +EndOfSwitch + + +long + a + +string + Branch + + +long + a + + + +EndOfSwitch + + + + + 19/1/2005 - 12:14:37 + 19/1/2005 - 12:14:37 + 2.0 + ? + ? + Compute Node + 882 + 194 + + +IsOdd + a + EmptyNode + a + + +646 + 78 + +IsEven + a + EndOfSwitch + a + + +PrintOdd + Branch + EmptyNode + Branch + + +PrintEven + Branch + EndOfSwitch + Branch + + +EmptyNode + a + EndOfSwitch + a + + +EmptyNode + Branch + EndOfSwitch + Branch + + +Default + Branch + EndOfSwitch + Branch + + +InitLoopSwitch + DoLoop + EndOfInitLoopSwitch + DoLoop + + +InitLoopSwitch + Index + Switch + a + + +InitLoopSwitch + Min + EndOfInitLoopSwitch + Min + + +InitLoopSwitch + Max + EndOfInitLoopSwitch + Max + + +EndOfInitLoopSwitch + DoLoop + InitLoopSwitch + DoLoop + + +Switch + Odd + IsOdd + Gate + + +401 + 101 + +401 + 160 + +Switch + Odd + PrintOdd + Gate + + +401 + 245 + +401 + 159 + +Switch + Even + IsEven + Gate + + +392 + 533 + +392 + 182 + +Switch + Even + PrintEven + Gate + + +392 + 403 + +392 + 181 + +Switch + a + IsOdd + a + + +382 + 78 + +382 + 199 + +Switch + a + IsEven + a + + +381 + 509 + +382 + 200 + +Switch + a + PrintOdd + a + + +Switch + a + PrintEven + a + + +381 + 361 + +382 + 200 + +Switch + a + Default + a + + +382 + 663 + +382 + 199 + +Switch + Branch + PrintOdd + Branch + + +Switch + Branch + PrintEven + Branch + + +369 + 381 + +369 + 219 + +Switch + Branch + Default + Branch + + +370 + 683 + +370 + 220 + +Switch + default + Default + Gate + + +363 + 707 + +362 + 239 + +Switch + Default + EndOfSwitch + Default + + +EndOfSwitch + a + EndOfInitLoopSwitch + Index + + + +GraphSwitchCheckDefault11NOTValid + InitLoopSwitch__Index + InitLoopSwitch + Index + +3 + 0 + + +GraphSwitchCheckDefault11NOTValid + InitLoopSwitch__Min + InitLoopSwitch + Min + +3 + -5 + + +GraphSwitchCheckDefault11NOTValid + InitLoopSwitch__Max + InitLoopSwitch + Max + +3 + 10 + diff --git a/examples/GraphSwitchCheckDefault2NOTValid.py b/examples/GraphSwitchCheckDefault2NOTValid.py new file mode 100755 index 0000000..e491b92 --- /dev/null +++ b/examples/GraphSwitchCheckDefault2NOTValid.py @@ -0,0 +1,338 @@ + +# Generated python file of Graph GraphSwitchCheckDefault2NOTValid + +from SuperV import * + +# Graph creation of GraphSwitchCheckDefault2NOTValid +def DefGraphSwitchCheckDefault2NOTValid() : + GraphSwitchCheckDefault2NOTValid = Graph( 'GraphSwitchCheckDefault2NOTValid' ) + GraphSwitchCheckDefault2NOTValid.SetName( 'GraphSwitchCheckDefault2NOTValid' ) + GraphSwitchCheckDefault2NOTValid.SetAuthor( 'JR' ) + GraphSwitchCheckDefault2NOTValid.SetComment( '' ) + GraphSwitchCheckDefault2NOTValid.Coords( 0 , 0 ) + + # Creation of Factory Nodes + + # Creation of InLine Nodes + PyIsOdd = [] + PyIsOdd.append( 'from time import * ' ) + PyIsOdd.append( 'def IsOdd(a) : ' ) + PyIsOdd.append( ' print a,"IsOdd (GraphSwitch)" ' ) + PyIsOdd.append( ' sleep( 1 ) ' ) + PyIsOdd.append( ' return a ' ) + IsOdd = GraphSwitchCheckDefault2NOTValid.INode( 'IsOdd' , PyIsOdd ) + IsOdd.SetName( 'IsOdd' ) + IsOdd.SetAuthor( '' ) + IsOdd.SetComment( 'Python function' ) + IsOdd.Coords( 415 , 7 ) + IIsOdda = IsOdd.InPort( 'a' , 'long' ) + IIsOddGate = IsOdd.GetInPort( 'Gate' ) + OIsOdda = IsOdd.OutPort( 'a' , 'long' ) + OIsOddGate = IsOdd.GetOutPort( 'Gate' ) + + PyIsEven = [] + PyIsEven.append( 'from time import * ' ) + PyIsEven.append( 'def IsEven(a) : ' ) + PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' ) + PyIsEven.append( ' sleep( 1 ) ' ) + PyIsEven.append( ' return a ' ) + IsEven = GraphSwitchCheckDefault2NOTValid.INode( 'IsEven' , PyIsEven ) + IsEven.SetName( 'IsEven' ) + IsEven.SetAuthor( '' ) + IsEven.SetComment( 'Compute Node' ) + IsEven.Coords( 421 , 438 ) + IIsEvena = IsEven.InPort( 'a' , 'long' ) + IIsEvenGate = IsEven.GetInPort( 'Gate' ) + OIsEvena = IsEven.OutPort( 'a' , 'long' ) + OIsEvenGate = IsEven.GetOutPort( 'Gate' ) + + PyPrintOdd = [] + PyPrintOdd.append( 'from time import * ' ) + PyPrintOdd.append( 'def Print(a,Branch) : ' ) + PyPrintOdd.append( ' print "Print ",a,Branch ' ) + PyPrintOdd.append( ' sleep(1) ' ) + PyPrintOdd.append( ' return Branch ' ) + PrintOdd = GraphSwitchCheckDefault2NOTValid.INode( 'Print' , PyPrintOdd ) + PrintOdd.SetName( 'PrintOdd' ) + PrintOdd.SetAuthor( '' ) + PrintOdd.SetComment( 'Compute Node' ) + PrintOdd.Coords( 415 , 130 ) + IPrintOdda = PrintOdd.InPort( 'a' , 'long' ) + IPrintOddBranch = PrintOdd.InPort( 'Branch' , 'string' ) + IPrintOddGate = PrintOdd.GetInPort( 'Gate' ) + OPrintOddBranch = PrintOdd.OutPort( 'Branch' , 'string' ) + OPrintOddGate = PrintOdd.GetOutPort( 'Gate' ) + + PyPrintEven = [] + PyPrintEven.append( 'from time import * ' ) + PyPrintEven.append( 'def Print_1(a,Branch) : ' ) + PyPrintEven.append( ' print "Print ",a,Branch ' ) + PyPrintEven.append( ' sleep(1) ' ) + PyPrintEven.append( ' return Branch ' ) + PrintEven = GraphSwitchCheckDefault2NOTValid.INode( 'Print_1' , PyPrintEven ) + PrintEven.SetName( 'PrintEven' ) + PrintEven.SetAuthor( '' ) + PrintEven.SetComment( 'Compute Node' ) + PrintEven.Coords( 423 , 289 ) + IPrintEvena = PrintEven.InPort( 'a' , 'long' ) + IPrintEvenBranch = PrintEven.InPort( 'Branch' , 'string' ) + IPrintEvenGate = PrintEven.GetInPort( 'Gate' ) + OPrintEvenBranch = PrintEven.OutPort( 'Branch' , 'string' ) + OPrintEvenGate = PrintEven.GetOutPort( 'Gate' ) + + PyEmptyNode = [] + PyEmptyNode.append( 'from time import * ' ) + PyEmptyNode.append( 'def EmptyNode(a,Branch) : ' ) + PyEmptyNode.append( ' sleep(1) ' ) + PyEmptyNode.append( ' return a,Branch ' ) + EmptyNode = GraphSwitchCheckDefault2NOTValid.INode( 'EmptyNode' , PyEmptyNode ) + EmptyNode.SetName( 'EmptyNode' ) + EmptyNode.SetAuthor( '' ) + EmptyNode.SetComment( 'Compute Node' ) + EmptyNode.Coords( 652 , 110 ) + IEmptyNodea = EmptyNode.InPort( 'a' , 'long' ) + IEmptyNodeBranch = EmptyNode.InPort( 'Branch' , 'string' ) + IEmptyNodeGate = EmptyNode.GetInPort( 'Gate' ) + OEmptyNodea = EmptyNode.OutPort( 'a' , 'long' ) + OEmptyNodeBranch = EmptyNode.OutPort( 'Branch' , 'string' ) + OEmptyNodeGate = EmptyNode.GetOutPort( 'Gate' ) + + PyDefault = [] + PyDefault.append( 'from time import * ' ) + PyDefault.append( 'def Default(a,Branch) : ' ) + PyDefault.append( ' sleep(1) ' ) + PyDefault.append( ' return a,Branch ' ) + Default = GraphSwitchCheckDefault2NOTValid.INode( 'Default' , PyDefault ) + Default.SetName( 'Default' ) + Default.SetAuthor( '' ) + Default.SetComment( 'Compute Node' ) + Default.Coords( 421 , 592 ) + IDefaulta = Default.InPort( 'a' , 'long' ) + IDefaultBranch = Default.InPort( 'Branch' , 'string' ) + IDefaultGate = Default.GetInPort( 'Gate' ) + ODefaulta = Default.OutPort( 'a' , 'long' ) + ODefaultBranch = Default.OutPort( 'Branch' , 'string' ) + ODefaultGate = Default.GetOutPort( 'Gate' ) + + PyPuta = [] + PyPuta.append( 'from time import * ' ) + PyPuta.append( 'def Puta(a) : ' ) + PyPuta.append( ' sleep(1) ' ) + PyPuta.append( ' return a ' ) + Puta = GraphSwitchCheckDefault2NOTValid.INode( 'Puta' , PyPuta ) + Puta.SetName( 'Puta' ) + Puta.SetAuthor( '' ) + Puta.SetComment( 'Compute Node' ) + Puta.Coords( 665 , 486 ) + IPutaa = Puta.InPort( 'a' , 'long' ) + IPutaGate = Puta.GetInPort( 'Gate' ) + OPutaa = Puta.OutPort( 'a' , 'long' ) + OPutaGate = Puta.GetOutPort( 'Gate' ) + + PyPutBranch = [] + PyPutBranch.append( 'from time import * ' ) + PyPutBranch.append( 'def PutBranch(Branch) : ' ) + PyPutBranch.append( ' sleep(1) ' ) + PyPutBranch.append( ' return Branch ' ) + PutBranch = GraphSwitchCheckDefault2NOTValid.INode( 'PutBranch' , PyPutBranch ) + PutBranch.SetName( 'PutBranch' ) + PutBranch.SetAuthor( '' ) + PutBranch.SetComment( 'Compute Node' ) + PutBranch.Coords( 662 , 613 ) + IPutBranchBranch = PutBranch.InPort( 'Branch' , 'string' ) + IPutBranchGate = PutBranch.GetInPort( 'Gate' ) + OPutBranchBranch = PutBranch.OutPort( 'Branch' , 'string' ) + OPutBranchGate = PutBranch.GetOutPort( 'Gate' ) + + # Creation of Loop Nodes + PyInitLoopSwitch = [] + PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' ) + PyInitLoopSwitch.append( ' Index = Max ' ) + PyInitLoopSwitch.append( ' return Index,Min,Max ' ) + PyMoreInitLoopSwitch = [] + PyMoreInitLoopSwitch.append( 'from time import * ' ) + PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' ) + PyMoreInitLoopSwitch.append( ' sleep(1) ' ) + PyMoreInitLoopSwitch.append( ' if Index >= Min : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' ) + PyMoreInitLoopSwitch.append( ' else : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' ) + PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + PyNextInitLoopSwitch = [] + PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' ) + PyNextInitLoopSwitch.append( ' Index = Index - 1 ' ) + PyNextInitLoopSwitch.append( ' return Index,Min,Max ' ) + InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheckDefault2NOTValid.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch ) + EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' ) + EndOfInitLoopSwitch.SetAuthor( '' ) + EndOfInitLoopSwitch.SetComment( 'Compute Node' ) + EndOfInitLoopSwitch.Coords( 1074 , 194 ) + PyEndOfInitLoopSwitch = [] + PyEndOfInitLoopSwitch.append( 'from time import * ' ) + PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) : ' ) + PyEndOfInitLoopSwitch.append( ' sleep(1) ' ) + PyEndOfInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch ) + IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' ) + IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' ) + IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' ) + IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' ) + IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' ) + OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' ) + OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' ) + OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' ) + OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' ) + IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' ) + IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' ) + IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' ) + IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' ) + IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' ) + OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' ) + OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' ) + InitLoopSwitch.SetName( 'InitLoopSwitch' ) + InitLoopSwitch.SetAuthor( '' ) + InitLoopSwitch.SetComment( 'Compute Node' ) + InitLoopSwitch.Coords( 10 , 129 ) + + # Creation of Switch Nodes + PySwitch = [] + PySwitch.append( 'from time import * ' ) + PySwitch.append( 'def Switch(a) : ' ) + PySwitch.append( ' sleep(1) ' ) + PySwitch.append( ' Branch = "Negative or null" ' ) + PySwitch.append( ' if a <= 0 : ' ) + PySwitch.append( ' return 0,0,a,Branch,1 ' ) + PySwitch.append( ' if ( a & 1 ) == 0 : ' ) + PySwitch.append( ' Branch = "Even" ' ) + PySwitch.append( ' else : ' ) + PySwitch.append( ' Branch = "Odd" ' ) + PySwitch.append( ' return a & 1,1-(a&1),a,Branch,0 ' ) + Switch,EndOfSwitch = GraphSwitchCheckDefault2NOTValid.SNode( 'Switch' , PySwitch ) + EndOfSwitch.SetName( 'EndOfSwitch' ) + EndOfSwitch.SetAuthor( '' ) + EndOfSwitch.SetComment( 'Compute Node' ) + EndOfSwitch.Coords( 882 , 194 ) + PyEndOfSwitch = [] + PyEndOfSwitch.append( 'from time import * ' ) + PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' ) + PyEndOfSwitch.append( ' sleep(1) ' ) + PyEndOfSwitch.append( ' return a ' ) + EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch ) + IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' ) + IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' ) + IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' ) + OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' ) + OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' ) + Switch.SetName( 'Switch' ) + Switch.SetAuthor( '' ) + Switch.SetComment( 'Compute Node' ) + Switch.Coords( 190 , 129 ) + ISwitcha = Switch.InPort( 'a' , 'long' ) + ISwitchGate = Switch.GetInPort( 'Gate' ) + OSwitchOdd = Switch.OutPort( 'Odd' , 'long' ) + OSwitchEven = Switch.OutPort( 'Even' , 'int' ) + OSwitcha = Switch.OutPort( 'a' , 'int' ) + OSwitchBranch = Switch.OutPort( 'Branch' , 'string' ) + OSwitchdefault = Switch.OutPort( 'default' , 'boolean' ) + OSwitchDefault = Switch.GetOutPort( 'Default' ) + + # Creation of Links + LIsOddaEmptyNodea = GraphSwitchCheckDefault2NOTValid.Link( OIsOdda , IEmptyNodea ) + LIsOddaEmptyNodea.AddCoord( 1 , 646 , 78 ) + + LIsEvenaEndOfSwitcha = GraphSwitchCheckDefault2NOTValid.Link( OIsEvena , IEndOfSwitcha ) + + LPrintOddBranchEmptyNodeBranch = GraphSwitchCheckDefault2NOTValid.Link( OPrintOddBranch , IEmptyNodeBranch ) + + LPrintEvenBranchEndOfSwitchBranch = GraphSwitchCheckDefault2NOTValid.Link( OPrintEvenBranch , IEndOfSwitchBranch ) + + LEmptyNodeaEndOfSwitcha = GraphSwitchCheckDefault2NOTValid.Link( OEmptyNodea , IEndOfSwitcha ) + + LEmptyNodeBranchEndOfSwitchBranch = GraphSwitchCheckDefault2NOTValid.Link( OEmptyNodeBranch , IEndOfSwitchBranch ) + + LDefaultaEndOfSwitcha = GraphSwitchCheckDefault2NOTValid.Link( ODefaulta , IEndOfSwitcha ) + + LDefaultaPutaa = GraphSwitchCheckDefault2NOTValid.Link( ODefaulta , IPutaa ) + + LDefaultBranchEndOfSwitchBranch = GraphSwitchCheckDefault2NOTValid.Link( ODefaultBranch , IEndOfSwitchBranch ) + + LDefaultBranchPutBranchBranch = GraphSwitchCheckDefault2NOTValid.Link( ODefaultBranch , IPutBranchBranch ) + + LInitLoopSwitchIndexSwitcha = GraphSwitchCheckDefault2NOTValid.Link( OInitLoopSwitchIndex , ISwitcha ) + + LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheckDefault2NOTValid.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin ) + + LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheckDefault2NOTValid.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax ) + + LSwitchOddIsOddGate = GraphSwitchCheckDefault2NOTValid.Link( OSwitchOdd , IIsOddGate ) + LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 ) + LSwitchOddIsOddGate.AddCoord( 2 , 401 , 160 ) + + LSwitchOddPrintOddGate = GraphSwitchCheckDefault2NOTValid.Link( OSwitchOdd , IPrintOddGate ) + LSwitchOddPrintOddGate.AddCoord( 1 , 401 , 245 ) + LSwitchOddPrintOddGate.AddCoord( 2 , 401 , 159 ) + + LSwitchEvenIsEvenGate = GraphSwitchCheckDefault2NOTValid.Link( OSwitchEven , IIsEvenGate ) + LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 ) + LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 182 ) + + LSwitchEvenPrintEvenGate = GraphSwitchCheckDefault2NOTValid.Link( OSwitchEven , IPrintEvenGate ) + LSwitchEvenPrintEvenGate.AddCoord( 1 , 392 , 403 ) + LSwitchEvenPrintEvenGate.AddCoord( 2 , 392 , 181 ) + + LSwitchaIsOdda = GraphSwitchCheckDefault2NOTValid.Link( OSwitcha , IIsOdda ) + LSwitchaIsOdda.AddCoord( 1 , 382 , 78 ) + LSwitchaIsOdda.AddCoord( 2 , 382 , 199 ) + + LSwitchaIsEvena = GraphSwitchCheckDefault2NOTValid.Link( OSwitcha , IIsEvena ) + LSwitchaIsEvena.AddCoord( 1 , 381 , 509 ) + LSwitchaIsEvena.AddCoord( 2 , 382 , 200 ) + + LSwitchaPrintOdda = GraphSwitchCheckDefault2NOTValid.Link( OSwitcha , IPrintOdda ) + + LSwitchaPrintEvena = GraphSwitchCheckDefault2NOTValid.Link( OSwitcha , IPrintEvena ) + LSwitchaPrintEvena.AddCoord( 1 , 381 , 361 ) + LSwitchaPrintEvena.AddCoord( 2 , 382 , 200 ) + + LSwitchaDefaulta = GraphSwitchCheckDefault2NOTValid.Link( OSwitcha , IDefaulta ) + LSwitchaDefaulta.AddCoord( 1 , 382 , 663 ) + LSwitchaDefaulta.AddCoord( 2 , 382 , 199 ) + + LSwitchBranchPrintOddBranch = GraphSwitchCheckDefault2NOTValid.Link( OSwitchBranch , IPrintOddBranch ) + + LSwitchBranchPrintEvenBranch = GraphSwitchCheckDefault2NOTValid.Link( OSwitchBranch , IPrintEvenBranch ) + LSwitchBranchPrintEvenBranch.AddCoord( 1 , 369 , 381 ) + LSwitchBranchPrintEvenBranch.AddCoord( 2 , 369 , 219 ) + + LSwitchBranchDefaultBranch = GraphSwitchCheckDefault2NOTValid.Link( OSwitchBranch , IDefaultBranch ) + LSwitchBranchDefaultBranch.AddCoord( 1 , 370 , 683 ) + LSwitchBranchDefaultBranch.AddCoord( 2 , 370 , 220 ) + + LSwitchdefaultDefaultGate = GraphSwitchCheckDefault2NOTValid.Link( OSwitchdefault , IDefaultGate ) + LSwitchdefaultDefaultGate.AddCoord( 1 , 363 , 707 ) + LSwitchdefaultDefaultGate.AddCoord( 2 , 362 , 239 ) + + LSwitchDefaultEndOfSwitchDefault = GraphSwitchCheckDefault2NOTValid.Link( OSwitchDefault , IEndOfSwitchDefault ) + + LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheckDefault2NOTValid.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex ) + + LPutaaEndOfSwitcha = GraphSwitchCheckDefault2NOTValid.Link( OPutaa , IEndOfSwitcha ) + + LPutBranchBranchEndOfSwitchBranch = GraphSwitchCheckDefault2NOTValid.Link( OPutBranchBranch , IEndOfSwitchBranch ) + + # Input datas + IInitLoopSwitchIndex.Input( 0 ) + IInitLoopSwitchMin.Input( -5 ) + IInitLoopSwitchMax.Input( 10 ) + + # Output Ports of the graph + #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + return GraphSwitchCheckDefault2NOTValid + + +GraphSwitchCheckDefault2NOTValid = DefGraphSwitchCheckDefault2NOTValid() diff --git a/examples/GraphSwitchCheckDefault2NOTValid.xml b/examples/GraphSwitchCheckDefault2NOTValid.xml new file mode 100755 index 0000000..ed30a4f --- /dev/null +++ b/examples/GraphSwitchCheckDefault2NOTValid.xml @@ -0,0 +1,799 @@ + + + + + +? + ? + GraphSwitchCheckDefault2NOTValid + 1 + ? + +GraphSwitchCheckDefault2NOTValid + + +long + InitLoopSwitch__Index + +long + InitLoopSwitch__Min + +long + InitLoopSwitch__Max + + +long + EndOfInitLoopSwitch__Index + +long + EndOfInitLoopSwitch__Min + +long + EndOfInitLoopSwitch__Max + + + 13/1/2005 - 12:21:43 + 19/1/2005 - 12:15:57 + 2.0 + JR + ? + ? + 0 + 0 + + +? + ? + IsOdd + 3 + ? + +IsOdd + + +long + a + + +long + a + + + +IsOdd + + + + + + 19/1/2005 - 12:15:57 + 19/1/2005 - 12:15:57 + 2.0 + ? + ? + Python function + 415 + 7 + +? + ? + IsEven + 3 + ? + +IsEven + + +long + a + + +long + a + + + +IsEven + + + + + + 19/1/2005 - 12:15:57 + 19/1/2005 - 12:15:57 + 2.0 + ? + ? + Compute Node + 421 + 438 + +? + ? + PrintOdd + 3 + ? + +PrintOdd + + +long + a + +string + Branch + + +string + Branch + + + +Print + + + + + + 19/1/2005 - 12:15:57 + 19/1/2005 - 12:15:57 + 2.0 + ? + ? + Compute Node + 415 + 130 + +? + ? + PrintEven + 3 + ? + +PrintEven + + +long + a + +string + Branch + + +string + Branch + + + +Print_1 + + + + + + 19/1/2005 - 12:15:57 + 19/1/2005 - 12:15:57 + 2.0 + ? + ? + Compute Node + 423 + 289 + +? + ? + EmptyNode + 3 + ? + +EmptyNode + + +long + a + +string + Branch + + +long + a + +string + Branch + + + +EmptyNode + + + + + 19/1/2005 - 12:15:57 + 19/1/2005 - 12:15:57 + 2.0 + ? + ? + Compute Node + 652 + 110 + +? + ? + Default + 3 + ? + +Default + + +long + a + +string + Branch + + +long + a + +string + Branch + + + +Default + + + + + 19/1/2005 - 12:15:57 + 19/1/2005 - 12:15:57 + 2.0 + ? + ? + Compute Node + 421 + 592 + +? + ? + InitLoopSwitch + 4 + EndOfInitLoopSwitch + +InitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +InitLoop + + + + +MoreLoop + + + + = Min : ]]> + + + + + +NextLoop + + + + 19/1/2005 - 12:15:57 + 19/1/2005 - 12:15:57 + 2.0 + ? + ? + Compute Node + 10 + 129 + +? + ? + EndOfInitLoopSwitch + 5 + InitLoopSwitch + +EndOfInitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +EndOfInitLoopSwitch + + + + + 19/1/2005 - 12:15:57 + 19/1/2005 - 12:15:57 + 2.0 + ? + ? + Compute Node + 1074 + 194 + +? + ? + Switch + 6 + EndOfSwitch + +Switch + + +long + a + + +long + Odd + +int + Even + +int + a + +string + Branch + +boolean + default + + + +Switch + + + + + + + + + + + + 19/1/2005 - 12:15:57 + 19/1/2005 - 12:15:57 + 2.0 + ? + ? + Compute Node + 190 + 129 + +? + ? + EndOfSwitch + 7 + Switch + +EndOfSwitch + + +long + a + +string + Branch + + +long + a + + + +EndOfSwitch + + + + + 19/1/2005 - 12:15:57 + 19/1/2005 - 12:15:57 + 2.0 + ? + ? + Compute Node + 882 + 194 + +? + ? + Puta + 3 + ? + +Puta + + +long + a + + +long + a + + + +Puta + + + + + 19/1/2005 - 12:15:57 + 19/1/2005 - 12:15:57 + 2.0 + ? + ? + Compute Node + 665 + 486 + +? + ? + PutBranch + 3 + ? + +PutBranch + + +string + Branch + + +string + Branch + + + +PutBranch + + + + + 19/1/2005 - 12:15:57 + 19/1/2005 - 12:15:57 + 2.0 + ? + ? + Compute Node + 662 + 613 + + +IsOdd + a + EmptyNode + a + + +646 + 78 + +IsEven + a + EndOfSwitch + a + + +PrintOdd + Branch + EmptyNode + Branch + + +PrintEven + Branch + EndOfSwitch + Branch + + +EmptyNode + a + EndOfSwitch + a + + +EmptyNode + Branch + EndOfSwitch + Branch + + +Default + a + EndOfSwitch + a + + +Default + a + Puta + a + + +Default + Branch + EndOfSwitch + Branch + + +Default + Branch + PutBranch + Branch + + +InitLoopSwitch + DoLoop + EndOfInitLoopSwitch + DoLoop + + +InitLoopSwitch + Index + Switch + a + + +InitLoopSwitch + Min + EndOfInitLoopSwitch + Min + + +InitLoopSwitch + Max + EndOfInitLoopSwitch + Max + + +EndOfInitLoopSwitch + DoLoop + InitLoopSwitch + DoLoop + + +Switch + Odd + IsOdd + Gate + + +401 + 101 + +401 + 160 + +Switch + Odd + PrintOdd + Gate + + +401 + 245 + +401 + 159 + +Switch + Even + IsEven + Gate + + +392 + 533 + +392 + 182 + +Switch + Even + PrintEven + Gate + + +392 + 403 + +392 + 181 + +Switch + a + IsOdd + a + + +382 + 78 + +382 + 199 + +Switch + a + IsEven + a + + +381 + 509 + +382 + 200 + +Switch + a + PrintOdd + a + + +Switch + a + PrintEven + a + + +381 + 361 + +382 + 200 + +Switch + a + Default + a + + +382 + 663 + +382 + 199 + +Switch + Branch + PrintOdd + Branch + + +Switch + Branch + PrintEven + Branch + + +369 + 381 + +369 + 219 + +Switch + Branch + Default + Branch + + +370 + 683 + +370 + 220 + +Switch + default + Default + Gate + + +363 + 707 + +362 + 239 + +Switch + Default + EndOfSwitch + Default + + +EndOfSwitch + a + EndOfInitLoopSwitch + Index + + +Puta + a + EndOfSwitch + a + + +PutBranch + Branch + EndOfSwitch + Branch + + + +GraphSwitchCheckDefault2NOTValid + InitLoopSwitch__Index + InitLoopSwitch + Index + +3 + 0 + + +GraphSwitchCheckDefault2NOTValid + InitLoopSwitch__Min + InitLoopSwitch + Min + +3 + -5 + + +GraphSwitchCheckDefault2NOTValid + InitLoopSwitch__Max + InitLoopSwitch + Max + +3 + 10 + diff --git a/examples/GraphSwitchCheckDefault2NOTValid1.py b/examples/GraphSwitchCheckDefault2NOTValid1.py new file mode 100755 index 0000000..5e78e02 --- /dev/null +++ b/examples/GraphSwitchCheckDefault2NOTValid1.py @@ -0,0 +1,298 @@ + +# Generated python file of Graph GraphSwitchCheckDefault2NOTValid1 + +from SuperV import * + +# Graph creation of GraphSwitchCheckDefault2NOTValid1 +def DefGraphSwitchCheckDefault2NOTValid1() : + GraphSwitchCheckDefault2NOTValid1 = Graph( 'GraphSwitchCheckDefault2NOTValid1' ) + GraphSwitchCheckDefault2NOTValid1.SetName( 'GraphSwitchCheckDefault2NOTValid1' ) + GraphSwitchCheckDefault2NOTValid1.SetAuthor( 'JR' ) + GraphSwitchCheckDefault2NOTValid1.SetComment( '' ) + GraphSwitchCheckDefault2NOTValid1.Coords( 0 , 0 ) + + # Creation of Factory Nodes + + # Creation of InLine Nodes + PyIsOdd = [] + PyIsOdd.append( 'from time import * ' ) + PyIsOdd.append( 'def IsOdd(a) : ' ) + PyIsOdd.append( ' print a,"IsOdd (GraphSwitch)" ' ) + PyIsOdd.append( ' sleep( 1 ) ' ) + PyIsOdd.append( ' return a ' ) + IsOdd = GraphSwitchCheckDefault2NOTValid1.INode( 'IsOdd' , PyIsOdd ) + IsOdd.SetName( 'IsOdd' ) + IsOdd.SetAuthor( '' ) + IsOdd.SetComment( 'Python function' ) + IsOdd.Coords( 415 , 7 ) + IIsOdda = IsOdd.InPort( 'a' , 'long' ) + IIsOddGate = IsOdd.GetInPort( 'Gate' ) + OIsOdda = IsOdd.OutPort( 'a' , 'long' ) + OIsOddGate = IsOdd.GetOutPort( 'Gate' ) + + PyIsEven = [] + PyIsEven.append( 'from time import * ' ) + PyIsEven.append( 'def IsEven(a) : ' ) + PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' ) + PyIsEven.append( ' sleep( 1 ) ' ) + PyIsEven.append( ' return a ' ) + IsEven = GraphSwitchCheckDefault2NOTValid1.INode( 'IsEven' , PyIsEven ) + IsEven.SetName( 'IsEven' ) + IsEven.SetAuthor( '' ) + IsEven.SetComment( 'Compute Node' ) + IsEven.Coords( 421 , 438 ) + IIsEvena = IsEven.InPort( 'a' , 'long' ) + IIsEvenGate = IsEven.GetInPort( 'Gate' ) + OIsEvena = IsEven.OutPort( 'a' , 'long' ) + OIsEvenGate = IsEven.GetOutPort( 'Gate' ) + + PyPrintOdd = [] + PyPrintOdd.append( 'from time import * ' ) + PyPrintOdd.append( 'def Print(a,Branch) : ' ) + PyPrintOdd.append( ' print "Print ",a,Branch ' ) + PyPrintOdd.append( ' sleep(1) ' ) + PyPrintOdd.append( ' return Branch ' ) + PrintOdd = GraphSwitchCheckDefault2NOTValid1.INode( 'Print' , PyPrintOdd ) + PrintOdd.SetName( 'PrintOdd' ) + PrintOdd.SetAuthor( '' ) + PrintOdd.SetComment( 'Compute Node' ) + PrintOdd.Coords( 415 , 130 ) + IPrintOdda = PrintOdd.InPort( 'a' , 'long' ) + IPrintOddBranch = PrintOdd.InPort( 'Branch' , 'string' ) + IPrintOddGate = PrintOdd.GetInPort( 'Gate' ) + OPrintOddBranch = PrintOdd.OutPort( 'Branch' , 'string' ) + OPrintOddGate = PrintOdd.GetOutPort( 'Gate' ) + + PyPrintEven = [] + PyPrintEven.append( 'from time import * ' ) + PyPrintEven.append( 'def Print_1(a,Branch) : ' ) + PyPrintEven.append( ' print "Print ",a,Branch ' ) + PyPrintEven.append( ' sleep(1) ' ) + PyPrintEven.append( ' return Branch ' ) + PrintEven = GraphSwitchCheckDefault2NOTValid1.INode( 'Print_1' , PyPrintEven ) + PrintEven.SetName( 'PrintEven' ) + PrintEven.SetAuthor( '' ) + PrintEven.SetComment( 'Compute Node' ) + PrintEven.Coords( 423 , 289 ) + IPrintEvena = PrintEven.InPort( 'a' , 'long' ) + IPrintEvenBranch = PrintEven.InPort( 'Branch' , 'string' ) + IPrintEvenGate = PrintEven.GetInPort( 'Gate' ) + OPrintEvenBranch = PrintEven.OutPort( 'Branch' , 'string' ) + OPrintEvenGate = PrintEven.GetOutPort( 'Gate' ) + + PyEmptyNode = [] + PyEmptyNode.append( 'from time import * ' ) + PyEmptyNode.append( 'def EmptyNode(a,Branch) : ' ) + PyEmptyNode.append( ' sleep(1) ' ) + PyEmptyNode.append( ' return a,Branch ' ) + EmptyNode = GraphSwitchCheckDefault2NOTValid1.INode( 'EmptyNode' , PyEmptyNode ) + EmptyNode.SetName( 'EmptyNode' ) + EmptyNode.SetAuthor( '' ) + EmptyNode.SetComment( 'Compute Node' ) + EmptyNode.Coords( 652 , 110 ) + IEmptyNodea = EmptyNode.InPort( 'a' , 'long' ) + IEmptyNodeBranch = EmptyNode.InPort( 'Branch' , 'string' ) + IEmptyNodeGate = EmptyNode.GetInPort( 'Gate' ) + OEmptyNodea = EmptyNode.OutPort( 'a' , 'long' ) + OEmptyNodeBranch = EmptyNode.OutPort( 'Branch' , 'string' ) + OEmptyNodeGate = EmptyNode.GetOutPort( 'Gate' ) + + PyDefault = [] + PyDefault.append( 'from time import * ' ) + PyDefault.append( 'def Default(a,Branch) : ' ) + PyDefault.append( ' sleep(1) ' ) + PyDefault.append( ' return a,Branch ' ) + Default = GraphSwitchCheckDefault2NOTValid1.INode( 'Default' , PyDefault ) + Default.SetName( 'Default' ) + Default.SetAuthor( '' ) + Default.SetComment( 'Compute Node' ) + Default.Coords( 421 , 592 ) + IDefaulta = Default.InPort( 'a' , 'long' ) + IDefaultBranch = Default.InPort( 'Branch' , 'string' ) + IDefaultGate = Default.GetInPort( 'Gate' ) + ODefaulta = Default.OutPort( 'a' , 'long' ) + ODefaultBranch = Default.OutPort( 'Branch' , 'string' ) + ODefaultGate = Default.GetOutPort( 'Gate' ) + + # Creation of Loop Nodes + PyInitLoopSwitch = [] + PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' ) + PyInitLoopSwitch.append( ' Index = Max ' ) + PyInitLoopSwitch.append( ' return Index,Min,Max ' ) + PyMoreInitLoopSwitch = [] + PyMoreInitLoopSwitch.append( 'from time import * ' ) + PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' ) + PyMoreInitLoopSwitch.append( ' sleep(1) ' ) + PyMoreInitLoopSwitch.append( ' if Index >= Min : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' ) + PyMoreInitLoopSwitch.append( ' else : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' ) + PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + PyNextInitLoopSwitch = [] + PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' ) + PyNextInitLoopSwitch.append( ' Index = Index - 1 ' ) + PyNextInitLoopSwitch.append( ' return Index,Min,Max ' ) + InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheckDefault2NOTValid1.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch ) + EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' ) + EndOfInitLoopSwitch.SetAuthor( '' ) + EndOfInitLoopSwitch.SetComment( 'Compute Node' ) + EndOfInitLoopSwitch.Coords( 1074 , 194 ) + PyEndOfInitLoopSwitch = [] + PyEndOfInitLoopSwitch.append( 'from time import * ' ) + PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) : ' ) + PyEndOfInitLoopSwitch.append( ' sleep(1) ' ) + PyEndOfInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch ) + IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' ) + IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' ) + IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' ) + IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' ) + IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' ) + OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' ) + OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' ) + OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' ) + OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' ) + IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' ) + IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' ) + IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' ) + IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' ) + IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' ) + OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' ) + OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' ) + InitLoopSwitch.SetName( 'InitLoopSwitch' ) + InitLoopSwitch.SetAuthor( '' ) + InitLoopSwitch.SetComment( 'Compute Node' ) + InitLoopSwitch.Coords( 10 , 129 ) + + # Creation of Switch Nodes + PySwitch = [] + PySwitch.append( 'from time import * ' ) + PySwitch.append( 'def Switch(a) : ' ) + PySwitch.append( ' sleep(1) ' ) + PySwitch.append( ' Branch = "Negative or null" ' ) + PySwitch.append( ' if a <= 0 : ' ) + PySwitch.append( ' return 0,0,a,Branch,1 ' ) + PySwitch.append( ' if ( a & 1 ) == 0 : ' ) + PySwitch.append( ' Branch = "Even" ' ) + PySwitch.append( ' else : ' ) + PySwitch.append( ' Branch = "Odd" ' ) + PySwitch.append( ' return a & 1,1-(a&1),a,Branch,0 ' ) + Switch,EndOfSwitch = GraphSwitchCheckDefault2NOTValid1.SNode( 'Switch' , PySwitch ) + EndOfSwitch.SetName( 'EndOfSwitch' ) + EndOfSwitch.SetAuthor( '' ) + EndOfSwitch.SetComment( 'Compute Node' ) + EndOfSwitch.Coords( 882 , 194 ) + PyEndOfSwitch = [] + PyEndOfSwitch.append( 'from time import * ' ) + PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' ) + PyEndOfSwitch.append( ' sleep(1) ' ) + PyEndOfSwitch.append( ' return a ' ) + EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch ) + IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' ) + IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' ) + IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' ) + OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' ) + OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' ) + Switch.SetName( 'Switch' ) + Switch.SetAuthor( '' ) + Switch.SetComment( 'Compute Node' ) + Switch.Coords( 190 , 129 ) + ISwitcha = Switch.InPort( 'a' , 'long' ) + ISwitchGate = Switch.GetInPort( 'Gate' ) + OSwitchOdd = Switch.OutPort( 'Odd' , 'long' ) + OSwitchEven = Switch.OutPort( 'Even' , 'int' ) + OSwitcha = Switch.OutPort( 'a' , 'int' ) + OSwitchBranch = Switch.OutPort( 'Branch' , 'string' ) + OSwitchdefault = Switch.OutPort( 'default' , 'boolean' ) + OSwitchDefault = Switch.GetOutPort( 'Default' ) + + # Creation of Links + LIsOddaEmptyNodea = GraphSwitchCheckDefault2NOTValid1.Link( OIsOdda , IEmptyNodea ) + LIsOddaEmptyNodea.AddCoord( 1 , 646 , 78 ) + + LPrintOddBranchEmptyNodeBranch = GraphSwitchCheckDefault2NOTValid1.Link( OPrintOddBranch , IEmptyNodeBranch ) + + LEmptyNodeaEndOfSwitcha = GraphSwitchCheckDefault2NOTValid1.Link( OEmptyNodea , IEndOfSwitcha ) + + LEmptyNodeBranchEndOfSwitchBranch = GraphSwitchCheckDefault2NOTValid1.Link( OEmptyNodeBranch , IEndOfSwitchBranch ) + + LDefaultGateEmptyNodeGate = GraphSwitchCheckDefault2NOTValid1.Link( ODefaultGate , IEmptyNodeGate ) + + LInitLoopSwitchIndexSwitcha = GraphSwitchCheckDefault2NOTValid1.Link( OInitLoopSwitchIndex , ISwitcha ) + + LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheckDefault2NOTValid1.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin ) + + LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheckDefault2NOTValid1.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax ) + + LSwitchOddIsOddGate = GraphSwitchCheckDefault2NOTValid1.Link( OSwitchOdd , IIsOddGate ) + LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 ) + LSwitchOddIsOddGate.AddCoord( 2 , 401 , 160 ) + + LSwitchOddPrintOddGate = GraphSwitchCheckDefault2NOTValid1.Link( OSwitchOdd , IPrintOddGate ) + LSwitchOddPrintOddGate.AddCoord( 1 , 401 , 245 ) + LSwitchOddPrintOddGate.AddCoord( 2 , 401 , 159 ) + + LSwitchEvenIsEvenGate = GraphSwitchCheckDefault2NOTValid1.Link( OSwitchEven , IIsEvenGate ) + LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 ) + LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 182 ) + + LSwitchEvenPrintEvenGate = GraphSwitchCheckDefault2NOTValid1.Link( OSwitchEven , IPrintEvenGate ) + LSwitchEvenPrintEvenGate.AddCoord( 1 , 392 , 403 ) + LSwitchEvenPrintEvenGate.AddCoord( 2 , 392 , 181 ) + + LSwitchaIsOdda = GraphSwitchCheckDefault2NOTValid1.Link( OSwitcha , IIsOdda ) + LSwitchaIsOdda.AddCoord( 1 , 382 , 78 ) + LSwitchaIsOdda.AddCoord( 2 , 382 , 199 ) + + LSwitchaIsEvena = GraphSwitchCheckDefault2NOTValid1.Link( OSwitcha , IIsEvena ) + LSwitchaIsEvena.AddCoord( 1 , 381 , 509 ) + LSwitchaIsEvena.AddCoord( 2 , 382 , 200 ) + + LSwitchaPrintOdda = GraphSwitchCheckDefault2NOTValid1.Link( OSwitcha , IPrintOdda ) + + LSwitchaPrintEvena = GraphSwitchCheckDefault2NOTValid1.Link( OSwitcha , IPrintEvena ) + LSwitchaPrintEvena.AddCoord( 1 , 381 , 361 ) + LSwitchaPrintEvena.AddCoord( 2 , 382 , 200 ) + + LSwitchaDefaulta = GraphSwitchCheckDefault2NOTValid1.Link( OSwitcha , IDefaulta ) + LSwitchaDefaulta.AddCoord( 1 , 382 , 663 ) + LSwitchaDefaulta.AddCoord( 2 , 382 , 199 ) + + LSwitchBranchPrintOddBranch = GraphSwitchCheckDefault2NOTValid1.Link( OSwitchBranch , IPrintOddBranch ) + + LSwitchBranchPrintEvenBranch = GraphSwitchCheckDefault2NOTValid1.Link( OSwitchBranch , IPrintEvenBranch ) + LSwitchBranchPrintEvenBranch.AddCoord( 1 , 369 , 381 ) + LSwitchBranchPrintEvenBranch.AddCoord( 2 , 369 , 219 ) + + LSwitchBranchDefaultBranch = GraphSwitchCheckDefault2NOTValid1.Link( OSwitchBranch , IDefaultBranch ) + LSwitchBranchDefaultBranch.AddCoord( 1 , 370 , 683 ) + LSwitchBranchDefaultBranch.AddCoord( 2 , 370 , 220 ) + + LSwitchdefaultDefaultGate = GraphSwitchCheckDefault2NOTValid1.Link( OSwitchdefault , IDefaultGate ) + LSwitchdefaultDefaultGate.AddCoord( 1 , 363 , 707 ) + LSwitchdefaultDefaultGate.AddCoord( 2 , 362 , 239 ) + + LSwitchDefaultEndOfSwitchDefault = GraphSwitchCheckDefault2NOTValid1.Link( OSwitchDefault , IEndOfSwitchDefault ) + + LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheckDefault2NOTValid1.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex ) + + # Input datas + IInitLoopSwitchIndex.Input( 0 ) + IInitLoopSwitchMin.Input( -5 ) + IInitLoopSwitchMax.Input( 10 ) + + # Output Ports of the graph + #OIsEvena = IsEven.GetOutPort( 'a' ) + #OPrintEvenBranch = PrintEven.GetOutPort( 'Branch' ) + #ODefaulta = Default.GetOutPort( 'a' ) + #ODefaultBranch = Default.GetOutPort( 'Branch' ) + #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + return GraphSwitchCheckDefault2NOTValid1 + + +GraphSwitchCheckDefault2NOTValid1 = DefGraphSwitchCheckDefault2NOTValid1() diff --git a/examples/GraphSwitchCheckDefault2NOTValid1.xml b/examples/GraphSwitchCheckDefault2NOTValid1.xml new file mode 100755 index 0000000..7b91ad7 --- /dev/null +++ b/examples/GraphSwitchCheckDefault2NOTValid1.xml @@ -0,0 +1,705 @@ + + + + + +? + ? + GraphSwitchCheckDefault2NOTValid1 + 1 + ? + +GraphSwitchCheckDefault2NOTValid1 + + +long + InitLoopSwitch__Index + +long + InitLoopSwitch__Min + +long + InitLoopSwitch__Max + + +long + IsEven__a + +string + PrintEven__Branch + +long + Default__a + +string + Default__Branch + +long + EndOfInitLoopSwitch__Index + +long + EndOfInitLoopSwitch__Min + +long + EndOfInitLoopSwitch__Max + + + 13/1/2005 - 12:21:43 + 19/1/2005 - 12:16:32 + 2.0 + JR + ? + ? + 0 + 0 + + +? + ? + IsOdd + 3 + ? + +IsOdd + + +long + a + + +long + a + + + +IsOdd + + + + + + 19/1/2005 - 12:16:32 + 19/1/2005 - 12:16:32 + 2.0 + ? + ? + Python function + 415 + 7 + +? + ? + IsEven + 3 + ? + +IsEven + + +long + a + + +long + a + + + +IsEven + + + + + + 19/1/2005 - 12:16:32 + 19/1/2005 - 12:16:32 + 2.0 + ? + ? + Compute Node + 421 + 438 + +? + ? + PrintOdd + 3 + ? + +PrintOdd + + +long + a + +string + Branch + + +string + Branch + + + +Print + + + + + + 19/1/2005 - 12:16:32 + 19/1/2005 - 12:16:32 + 2.0 + ? + ? + Compute Node + 415 + 130 + +? + ? + PrintEven + 3 + ? + +PrintEven + + +long + a + +string + Branch + + +string + Branch + + + +Print_1 + + + + + + 19/1/2005 - 12:16:32 + 19/1/2005 - 12:16:32 + 2.0 + ? + ? + Compute Node + 423 + 289 + +? + ? + EmptyNode + 3 + ? + +EmptyNode + + +long + a + +string + Branch + + +long + a + +string + Branch + + + +EmptyNode + + + + + 19/1/2005 - 12:16:32 + 19/1/2005 - 12:16:32 + 2.0 + ? + ? + Compute Node + 652 + 110 + +? + ? + Default + 3 + ? + +Default + + +long + a + +string + Branch + + +long + a + +string + Branch + + + +Default + + + + + 19/1/2005 - 12:16:32 + 19/1/2005 - 12:16:32 + 2.0 + ? + ? + Compute Node + 421 + 592 + +? + ? + InitLoopSwitch + 4 + EndOfInitLoopSwitch + +InitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +InitLoop + + + + +MoreLoop + + + + = Min : ]]> + + + + + +NextLoop + + + + 19/1/2005 - 12:16:32 + 19/1/2005 - 12:16:32 + 2.0 + ? + ? + Compute Node + 10 + 129 + +? + ? + EndOfInitLoopSwitch + 5 + InitLoopSwitch + +EndOfInitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +EndOfInitLoopSwitch + + + + + 19/1/2005 - 12:16:32 + 19/1/2005 - 12:16:32 + 2.0 + ? + ? + Compute Node + 1074 + 194 + +? + ? + Switch + 6 + EndOfSwitch + +Switch + + +long + a + + +long + Odd + +int + Even + +int + a + +string + Branch + +boolean + default + + + +Switch + + + + + + + + + + + + 19/1/2005 - 12:16:32 + 19/1/2005 - 12:16:32 + 2.0 + ? + ? + Compute Node + 190 + 129 + +? + ? + EndOfSwitch + 7 + Switch + +EndOfSwitch + + +long + a + +string + Branch + + +long + a + + + +EndOfSwitch + + + + + 19/1/2005 - 12:16:32 + 19/1/2005 - 12:16:32 + 2.0 + ? + ? + Compute Node + 882 + 194 + + +IsOdd + a + EmptyNode + a + + +646 + 78 + +PrintOdd + Branch + EmptyNode + Branch + + +EmptyNode + a + EndOfSwitch + a + + +EmptyNode + Branch + EndOfSwitch + Branch + + +Default + Gate + EmptyNode + Gate + + +InitLoopSwitch + DoLoop + EndOfInitLoopSwitch + DoLoop + + +InitLoopSwitch + Index + Switch + a + + +InitLoopSwitch + Min + EndOfInitLoopSwitch + Min + + +InitLoopSwitch + Max + EndOfInitLoopSwitch + Max + + +EndOfInitLoopSwitch + DoLoop + InitLoopSwitch + DoLoop + + +Switch + Odd + IsOdd + Gate + + +401 + 101 + +401 + 160 + +Switch + Odd + PrintOdd + Gate + + +401 + 245 + +401 + 159 + +Switch + Even + IsEven + Gate + + +392 + 533 + +392 + 182 + +Switch + Even + PrintEven + Gate + + +392 + 403 + +392 + 181 + +Switch + a + IsOdd + a + + +382 + 78 + +382 + 199 + +Switch + a + IsEven + a + + +381 + 509 + +382 + 200 + +Switch + a + PrintOdd + a + + +Switch + a + PrintEven + a + + +381 + 361 + +382 + 200 + +Switch + a + Default + a + + +382 + 663 + +382 + 199 + +Switch + Branch + PrintOdd + Branch + + +Switch + Branch + PrintEven + Branch + + +369 + 381 + +369 + 219 + +Switch + Branch + Default + Branch + + +370 + 683 + +370 + 220 + +Switch + default + Default + Gate + + +363 + 707 + +362 + 239 + +Switch + Default + EndOfSwitch + Default + + +EndOfSwitch + a + EndOfInitLoopSwitch + Index + + + +GraphSwitchCheckDefault2NOTValid1 + InitLoopSwitch__Index + InitLoopSwitch + Index + +3 + 0 + + +GraphSwitchCheckDefault2NOTValid1 + InitLoopSwitch__Min + InitLoopSwitch + Min + +3 + -5 + + +GraphSwitchCheckDefault2NOTValid1 + InitLoopSwitch__Max + InitLoopSwitch + Max + +3 + 10 + diff --git a/examples/GraphSwitchCheckDefault2NOTValid2.py b/examples/GraphSwitchCheckDefault2NOTValid2.py new file mode 100644 index 0000000..a94310f --- /dev/null +++ b/examples/GraphSwitchCheckDefault2NOTValid2.py @@ -0,0 +1,332 @@ + +# Generated python file of Graph GraphSwitchCheckDefault2NOTValid2 + +from SuperV import * + +# Graph creation of GraphSwitchCheckDefault2NOTValid2 +def DefGraphSwitchCheckDefault2NOTValid2() : + GraphSwitchCheckDefault2NOTValid2 = Graph( 'GraphSwitchCheckDefault2NOTValid2' ) + GraphSwitchCheckDefault2NOTValid2.SetName( 'GraphSwitchCheckDefault2NOTValid2' ) + GraphSwitchCheckDefault2NOTValid2.SetAuthor( 'JR' ) + GraphSwitchCheckDefault2NOTValid2.SetComment( '' ) + GraphSwitchCheckDefault2NOTValid2.Coords( 0 , 0 ) + + # Creation of Factory Nodes + + # Creation of InLine Nodes + PyIsOdd = [] + PyIsOdd.append( 'from time import * ' ) + PyIsOdd.append( 'def IsOdd(a) : ' ) + PyIsOdd.append( ' print a,"IsOdd (GraphSwitch)" ' ) + PyIsOdd.append( ' sleep( 1 ) ' ) + PyIsOdd.append( ' return a ' ) + IsOdd = GraphSwitchCheckDefault2NOTValid2.INode( 'IsOdd' , PyIsOdd ) + IsOdd.SetName( 'IsOdd' ) + IsOdd.SetAuthor( '' ) + IsOdd.SetComment( 'Python function' ) + IsOdd.Coords( 415 , 7 ) + IIsOdda = IsOdd.InPort( 'a' , 'long' ) + IIsOddGate = IsOdd.GetInPort( 'Gate' ) + OIsOdda = IsOdd.OutPort( 'a' , 'long' ) + OIsOddGate = IsOdd.GetOutPort( 'Gate' ) + + PyIsEven = [] + PyIsEven.append( 'from time import * ' ) + PyIsEven.append( 'def IsEven(a) : ' ) + PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' ) + PyIsEven.append( ' sleep( 1 ) ' ) + PyIsEven.append( ' return a ' ) + IsEven = GraphSwitchCheckDefault2NOTValid2.INode( 'IsEven' , PyIsEven ) + IsEven.SetName( 'IsEven' ) + IsEven.SetAuthor( '' ) + IsEven.SetComment( 'Compute Node' ) + IsEven.Coords( 421 , 438 ) + IIsEvena = IsEven.InPort( 'a' , 'long' ) + IIsEvenGate = IsEven.GetInPort( 'Gate' ) + OIsEvena = IsEven.OutPort( 'a' , 'long' ) + OIsEvenGate = IsEven.GetOutPort( 'Gate' ) + + PyPrintOdd = [] + PyPrintOdd.append( 'from time import * ' ) + PyPrintOdd.append( 'def Print(a,Branch) : ' ) + PyPrintOdd.append( ' print "Print ",a,Branch ' ) + PyPrintOdd.append( ' sleep(1) ' ) + PyPrintOdd.append( ' return Branch ' ) + PrintOdd = GraphSwitchCheckDefault2NOTValid2.INode( 'Print' , PyPrintOdd ) + PrintOdd.SetName( 'PrintOdd' ) + PrintOdd.SetAuthor( '' ) + PrintOdd.SetComment( 'Compute Node' ) + PrintOdd.Coords( 415 , 130 ) + IPrintOdda = PrintOdd.InPort( 'a' , 'long' ) + IPrintOddBranch = PrintOdd.InPort( 'Branch' , 'string' ) + IPrintOddGate = PrintOdd.GetInPort( 'Gate' ) + OPrintOddBranch = PrintOdd.OutPort( 'Branch' , 'string' ) + OPrintOddGate = PrintOdd.GetOutPort( 'Gate' ) + + PyPrintEven = [] + PyPrintEven.append( 'from time import * ' ) + PyPrintEven.append( 'def Print_1(a,Branch) : ' ) + PyPrintEven.append( ' print "Print ",a,Branch ' ) + PyPrintEven.append( ' sleep(1) ' ) + PyPrintEven.append( ' return Branch ' ) + PrintEven = GraphSwitchCheckDefault2NOTValid2.INode( 'Print_1' , PyPrintEven ) + PrintEven.SetName( 'PrintEven' ) + PrintEven.SetAuthor( '' ) + PrintEven.SetComment( 'Compute Node' ) + PrintEven.Coords( 423 , 289 ) + IPrintEvena = PrintEven.InPort( 'a' , 'long' ) + IPrintEvenBranch = PrintEven.InPort( 'Branch' , 'string' ) + IPrintEvenGate = PrintEven.GetInPort( 'Gate' ) + OPrintEvenBranch = PrintEven.OutPort( 'Branch' , 'string' ) + OPrintEvenGate = PrintEven.GetOutPort( 'Gate' ) + + PyEmptyNode = [] + PyEmptyNode.append( 'from time import * ' ) + PyEmptyNode.append( 'def EmptyNode(a,Branch) : ' ) + PyEmptyNode.append( ' sleep(1) ' ) + PyEmptyNode.append( ' return a,Branch ' ) + EmptyNode = GraphSwitchCheckDefault2NOTValid2.INode( 'EmptyNode' , PyEmptyNode ) + EmptyNode.SetName( 'EmptyNode' ) + EmptyNode.SetAuthor( '' ) + EmptyNode.SetComment( 'Compute Node' ) + EmptyNode.Coords( 652 , 110 ) + IEmptyNodea = EmptyNode.InPort( 'a' , 'long' ) + IEmptyNodeBranch = EmptyNode.InPort( 'Branch' , 'string' ) + IEmptyNodeGate = EmptyNode.GetInPort( 'Gate' ) + OEmptyNodea = EmptyNode.OutPort( 'a' , 'long' ) + OEmptyNodeBranch = EmptyNode.OutPort( 'Branch' , 'string' ) + OEmptyNodeGate = EmptyNode.GetOutPort( 'Gate' ) + + PyDefault = [] + PyDefault.append( 'from time import * ' ) + PyDefault.append( 'def Default(a,Branch) : ' ) + PyDefault.append( ' sleep(1) ' ) + PyDefault.append( ' return a,Branch ' ) + Default = GraphSwitchCheckDefault2NOTValid2.INode( 'Default' , PyDefault ) + Default.SetName( 'Default' ) + Default.SetAuthor( '' ) + Default.SetComment( 'Compute Node' ) + Default.Coords( 421 , 592 ) + IDefaulta = Default.InPort( 'a' , 'long' ) + IDefaultBranch = Default.InPort( 'Branch' , 'string' ) + IDefaultGate = Default.GetInPort( 'Gate' ) + ODefaulta = Default.OutPort( 'a' , 'long' ) + ODefaultBranch = Default.OutPort( 'Branch' , 'string' ) + ODefaultGate = Default.GetOutPort( 'Gate' ) + + PyPuta = [] + PyPuta.append( 'from time import * ' ) + PyPuta.append( 'def Puta(a) : ' ) + PyPuta.append( ' sleep(1) ' ) + PyPuta.append( ' return a ' ) + Puta = GraphSwitchCheckDefault2NOTValid2.INode( 'Puta' , PyPuta ) + Puta.SetName( 'Puta' ) + Puta.SetAuthor( '' ) + Puta.SetComment( 'Compute Node' ) + Puta.Coords( 665 , 486 ) + IPutaa = Puta.InPort( 'a' , 'long' ) + IPutaGate = Puta.GetInPort( 'Gate' ) + OPutaa = Puta.OutPort( 'a' , 'long' ) + OPutaGate = Puta.GetOutPort( 'Gate' ) + + PyPutBranch = [] + PyPutBranch.append( 'from time import * ' ) + PyPutBranch.append( 'def PutBranch(Branch) : ' ) + PyPutBranch.append( ' sleep(1) ' ) + PyPutBranch.append( ' return Branch ' ) + PutBranch = GraphSwitchCheckDefault2NOTValid2.INode( 'PutBranch' , PyPutBranch ) + PutBranch.SetName( 'PutBranch' ) + PutBranch.SetAuthor( '' ) + PutBranch.SetComment( 'Compute Node' ) + PutBranch.Coords( 662 , 613 ) + IPutBranchBranch = PutBranch.InPort( 'Branch' , 'string' ) + IPutBranchGate = PutBranch.GetInPort( 'Gate' ) + OPutBranchBranch = PutBranch.OutPort( 'Branch' , 'string' ) + OPutBranchGate = PutBranch.GetOutPort( 'Gate' ) + + # Creation of Loop Nodes + PyInitLoopSwitch = [] + PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' ) + PyInitLoopSwitch.append( ' Index = Max ' ) + PyInitLoopSwitch.append( ' return Index,Min,Max ' ) + PyMoreInitLoopSwitch = [] + PyMoreInitLoopSwitch.append( 'from time import * ' ) + PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' ) + PyMoreInitLoopSwitch.append( ' sleep(1) ' ) + PyMoreInitLoopSwitch.append( ' if Index >= Min : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' ) + PyMoreInitLoopSwitch.append( ' else : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' ) + PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + PyNextInitLoopSwitch = [] + PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' ) + PyNextInitLoopSwitch.append( ' Index = Index - 1 ' ) + PyNextInitLoopSwitch.append( ' return Index,Min,Max ' ) + InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheckDefault2NOTValid2.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch ) + EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' ) + EndOfInitLoopSwitch.SetAuthor( '' ) + EndOfInitLoopSwitch.SetComment( 'Compute Node' ) + EndOfInitLoopSwitch.Coords( 1074 , 194 ) + PyEndOfInitLoopSwitch = [] + PyEndOfInitLoopSwitch.append( 'from time import * ' ) + PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) : ' ) + PyEndOfInitLoopSwitch.append( ' sleep(1) ' ) + PyEndOfInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch ) + IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' ) + IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' ) + IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' ) + IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' ) + IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' ) + OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' ) + OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' ) + OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' ) + OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' ) + IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' ) + IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' ) + IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' ) + IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' ) + IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' ) + OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' ) + OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' ) + InitLoopSwitch.SetName( 'InitLoopSwitch' ) + InitLoopSwitch.SetAuthor( '' ) + InitLoopSwitch.SetComment( 'Compute Node' ) + InitLoopSwitch.Coords( 10 , 129 ) + + # Creation of Switch Nodes + PySwitch = [] + PySwitch.append( 'from time import * ' ) + PySwitch.append( 'def Switch(a) : ' ) + PySwitch.append( ' sleep(1) ' ) + PySwitch.append( ' Branch = "Negative or null" ' ) + PySwitch.append( ' if a <= 0 : ' ) + PySwitch.append( ' return 0,0,a,Branch,1 ' ) + PySwitch.append( ' if ( a & 1 ) == 0 : ' ) + PySwitch.append( ' Branch = "Even" ' ) + PySwitch.append( ' else : ' ) + PySwitch.append( ' Branch = "Odd" ' ) + PySwitch.append( ' return a & 1,1-(a&1),a,Branch,0 ' ) + Switch,EndOfSwitch = GraphSwitchCheckDefault2NOTValid2.SNode( 'Switch' , PySwitch ) + EndOfSwitch.SetName( 'EndOfSwitch' ) + EndOfSwitch.SetAuthor( '' ) + EndOfSwitch.SetComment( 'Compute Node' ) + EndOfSwitch.Coords( 882 , 194 ) + PyEndOfSwitch = [] + PyEndOfSwitch.append( 'from time import * ' ) + PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' ) + PyEndOfSwitch.append( ' sleep(1) ' ) + PyEndOfSwitch.append( ' return a ' ) + EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch ) + IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' ) + IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' ) + IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' ) + OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' ) + OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' ) + Switch.SetName( 'Switch' ) + Switch.SetAuthor( '' ) + Switch.SetComment( 'Compute Node' ) + Switch.Coords( 190 , 129 ) + ISwitcha = Switch.InPort( 'a' , 'long' ) + ISwitchGate = Switch.GetInPort( 'Gate' ) + OSwitchOdd = Switch.OutPort( 'Odd' , 'long' ) + OSwitchEven = Switch.OutPort( 'Even' , 'int' ) + OSwitcha = Switch.OutPort( 'a' , 'int' ) + OSwitchBranch = Switch.OutPort( 'Branch' , 'string' ) + OSwitchdefault = Switch.OutPort( 'default' , 'boolean' ) + OSwitchDefault = Switch.GetOutPort( 'Default' ) + + # Creation of Links + LIsOddaEmptyNodea = GraphSwitchCheckDefault2NOTValid2.Link( OIsOdda , IEmptyNodea ) + LIsOddaEmptyNodea.AddCoord( 1 , 646 , 78 ) + + LIsEvenaEndOfSwitcha = GraphSwitchCheckDefault2NOTValid2.Link( OIsEvena , IEndOfSwitcha ) + + LPrintOddBranchEmptyNodeBranch = GraphSwitchCheckDefault2NOTValid2.Link( OPrintOddBranch , IEmptyNodeBranch ) + + LPrintEvenBranchEndOfSwitchBranch = GraphSwitchCheckDefault2NOTValid2.Link( OPrintEvenBranch , IEndOfSwitchBranch ) + + LEmptyNodeaEndOfSwitcha = GraphSwitchCheckDefault2NOTValid2.Link( OEmptyNodea , IEndOfSwitcha ) + + LEmptyNodeBranchEndOfSwitchBranch = GraphSwitchCheckDefault2NOTValid2.Link( OEmptyNodeBranch , IEndOfSwitchBranch ) + + LDefaultaPutaa = GraphSwitchCheckDefault2NOTValid2.Link( ODefaulta , IPutaa ) + + LDefaultBranchPutBranchBranch = GraphSwitchCheckDefault2NOTValid2.Link( ODefaultBranch , IPutBranchBranch ) + + LInitLoopSwitchIndexSwitcha = GraphSwitchCheckDefault2NOTValid2.Link( OInitLoopSwitchIndex , ISwitcha ) + + LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheckDefault2NOTValid2.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin ) + + LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheckDefault2NOTValid2.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax ) + + LSwitchOddIsOddGate = GraphSwitchCheckDefault2NOTValid2.Link( OSwitchOdd , IIsOddGate ) + LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 ) + LSwitchOddIsOddGate.AddCoord( 2 , 401 , 160 ) + + LSwitchOddPrintOddGate = GraphSwitchCheckDefault2NOTValid2.Link( OSwitchOdd , IPrintOddGate ) + LSwitchOddPrintOddGate.AddCoord( 1 , 401 , 245 ) + LSwitchOddPrintOddGate.AddCoord( 2 , 401 , 159 ) + + LSwitchEvenIsEvenGate = GraphSwitchCheckDefault2NOTValid2.Link( OSwitchEven , IIsEvenGate ) + LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 ) + LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 182 ) + + LSwitchEvenPrintEvenGate = GraphSwitchCheckDefault2NOTValid2.Link( OSwitchEven , IPrintEvenGate ) + LSwitchEvenPrintEvenGate.AddCoord( 1 , 392 , 403 ) + LSwitchEvenPrintEvenGate.AddCoord( 2 , 392 , 181 ) + + LSwitchaIsOdda = GraphSwitchCheckDefault2NOTValid2.Link( OSwitcha , IIsOdda ) + LSwitchaIsOdda.AddCoord( 1 , 382 , 78 ) + LSwitchaIsOdda.AddCoord( 2 , 382 , 199 ) + + LSwitchaIsEvena = GraphSwitchCheckDefault2NOTValid2.Link( OSwitcha , IIsEvena ) + LSwitchaIsEvena.AddCoord( 1 , 381 , 509 ) + LSwitchaIsEvena.AddCoord( 2 , 382 , 200 ) + + LSwitchaPrintOdda = GraphSwitchCheckDefault2NOTValid2.Link( OSwitcha , IPrintOdda ) + + LSwitchaPrintEvena = GraphSwitchCheckDefault2NOTValid2.Link( OSwitcha , IPrintEvena ) + LSwitchaPrintEvena.AddCoord( 1 , 381 , 361 ) + LSwitchaPrintEvena.AddCoord( 2 , 382 , 200 ) + + LSwitchaDefaulta = GraphSwitchCheckDefault2NOTValid2.Link( OSwitcha , IDefaulta ) + LSwitchaDefaulta.AddCoord( 1 , 382 , 663 ) + LSwitchaDefaulta.AddCoord( 2 , 382 , 199 ) + + LSwitchBranchPrintOddBranch = GraphSwitchCheckDefault2NOTValid2.Link( OSwitchBranch , IPrintOddBranch ) + + LSwitchBranchPrintEvenBranch = GraphSwitchCheckDefault2NOTValid2.Link( OSwitchBranch , IPrintEvenBranch ) + LSwitchBranchPrintEvenBranch.AddCoord( 1 , 369 , 381 ) + LSwitchBranchPrintEvenBranch.AddCoord( 2 , 369 , 219 ) + + LSwitchBranchDefaultBranch = GraphSwitchCheckDefault2NOTValid2.Link( OSwitchBranch , IDefaultBranch ) + LSwitchBranchDefaultBranch.AddCoord( 1 , 370 , 683 ) + LSwitchBranchDefaultBranch.AddCoord( 2 , 370 , 220 ) + + LSwitchdefaultDefaultGate = GraphSwitchCheckDefault2NOTValid2.Link( OSwitchdefault , IDefaultGate ) + LSwitchdefaultDefaultGate.AddCoord( 1 , 363 , 707 ) + LSwitchdefaultDefaultGate.AddCoord( 2 , 362 , 239 ) + + LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheckDefault2NOTValid2.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex ) + + LPutaaEndOfSwitcha = GraphSwitchCheckDefault2NOTValid2.Link( OPutaa , IEndOfSwitcha ) + + LPutBranchBranchEndOfSwitchBranch = GraphSwitchCheckDefault2NOTValid2.Link( OPutBranchBranch , IEndOfSwitchBranch ) + + # Input datas + IInitLoopSwitchIndex.Input( 0 ) + IInitLoopSwitchMin.Input( -5 ) + IInitLoopSwitchMax.Input( 10 ) + + # Output Ports of the graph + #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + return GraphSwitchCheckDefault2NOTValid2 + + +GraphSwitchCheckDefault2NOTValid2 = DefGraphSwitchCheckDefault2NOTValid2() diff --git a/examples/GraphSwitchCheckDefault2NOTValid2.xml b/examples/GraphSwitchCheckDefault2NOTValid2.xml new file mode 100644 index 0000000..f628cd0 --- /dev/null +++ b/examples/GraphSwitchCheckDefault2NOTValid2.xml @@ -0,0 +1,781 @@ + + + + + +? + ? + GraphSwitchCheckDefault2NOTValid2 + 1 + ? + +GraphSwitchCheckDefault2NOTValid2 + + +long + InitLoopSwitch__Index + +long + InitLoopSwitch__Min + +long + InitLoopSwitch__Max + + +long + EndOfInitLoopSwitch__Index + +long + EndOfInitLoopSwitch__Min + +long + EndOfInitLoopSwitch__Max + + + 13/1/2005 - 12:21:43 + 19/1/2005 - 12:17:7 + 2.0 + JR + ? + ? + 0 + 0 + + +? + ? + IsOdd + 3 + ? + +IsOdd + + +long + a + + +long + a + + + +IsOdd + + + + + + 19/1/2005 - 12:17:7 + 19/1/2005 - 12:17:7 + 2.0 + ? + ? + Python function + 415 + 7 + +? + ? + IsEven + 3 + ? + +IsEven + + +long + a + + +long + a + + + +IsEven + + + + + + 19/1/2005 - 12:17:7 + 19/1/2005 - 12:17:7 + 2.0 + ? + ? + Compute Node + 421 + 438 + +? + ? + PrintOdd + 3 + ? + +PrintOdd + + +long + a + +string + Branch + + +string + Branch + + + +Print + + + + + + 19/1/2005 - 12:17:7 + 19/1/2005 - 12:17:7 + 2.0 + ? + ? + Compute Node + 415 + 130 + +? + ? + PrintEven + 3 + ? + +PrintEven + + +long + a + +string + Branch + + +string + Branch + + + +Print_1 + + + + + + 19/1/2005 - 12:17:7 + 19/1/2005 - 12:17:7 + 2.0 + ? + ? + Compute Node + 423 + 289 + +? + ? + EmptyNode + 3 + ? + +EmptyNode + + +long + a + +string + Branch + + +long + a + +string + Branch + + + +EmptyNode + + + + + 19/1/2005 - 12:17:7 + 19/1/2005 - 12:17:7 + 2.0 + ? + ? + Compute Node + 652 + 110 + +? + ? + Default + 3 + ? + +Default + + +long + a + +string + Branch + + +long + a + +string + Branch + + + +Default + + + + + 19/1/2005 - 12:17:7 + 19/1/2005 - 12:17:7 + 2.0 + ? + ? + Compute Node + 421 + 592 + +? + ? + InitLoopSwitch + 4 + EndOfInitLoopSwitch + +InitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +InitLoop + + + + +MoreLoop + + + + = Min : ]]> + + + + + +NextLoop + + + + 19/1/2005 - 12:17:7 + 19/1/2005 - 12:17:7 + 2.0 + ? + ? + Compute Node + 10 + 129 + +? + ? + EndOfInitLoopSwitch + 5 + InitLoopSwitch + +EndOfInitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +EndOfInitLoopSwitch + + + + + 19/1/2005 - 12:17:7 + 19/1/2005 - 12:17:7 + 2.0 + ? + ? + Compute Node + 1074 + 194 + +? + ? + Switch + 6 + EndOfSwitch + +Switch + + +long + a + + +long + Odd + +int + Even + +int + a + +string + Branch + +boolean + default + + + +Switch + + + + + + + + + + + + 19/1/2005 - 12:17:7 + 19/1/2005 - 12:17:7 + 2.0 + ? + ? + Compute Node + 190 + 129 + +? + ? + EndOfSwitch + 7 + Switch + +EndOfSwitch + + +long + a + +string + Branch + + +long + a + + + +EndOfSwitch + + + + + 19/1/2005 - 12:17:7 + 19/1/2005 - 12:17:7 + 2.0 + ? + ? + Compute Node + 882 + 194 + +? + ? + Puta + 3 + ? + +Puta + + +long + a + + +long + a + + + +Puta + + + + + 19/1/2005 - 12:17:7 + 19/1/2005 - 12:17:7 + 2.0 + ? + ? + Compute Node + 665 + 486 + +? + ? + PutBranch + 3 + ? + +PutBranch + + +string + Branch + + +string + Branch + + + +PutBranch + + + + + 19/1/2005 - 12:17:7 + 19/1/2005 - 12:17:7 + 2.0 + ? + ? + Compute Node + 662 + 613 + + +IsOdd + a + EmptyNode + a + + +646 + 78 + +IsEven + a + EndOfSwitch + a + + +PrintOdd + Branch + EmptyNode + Branch + + +PrintEven + Branch + EndOfSwitch + Branch + + +EmptyNode + a + EndOfSwitch + a + + +EmptyNode + Branch + EndOfSwitch + Branch + + +Default + a + Puta + a + + +Default + Branch + PutBranch + Branch + + +InitLoopSwitch + DoLoop + EndOfInitLoopSwitch + DoLoop + + +InitLoopSwitch + Index + Switch + a + + +InitLoopSwitch + Min + EndOfInitLoopSwitch + Min + + +InitLoopSwitch + Max + EndOfInitLoopSwitch + Max + + +EndOfInitLoopSwitch + DoLoop + InitLoopSwitch + DoLoop + + +Switch + Odd + IsOdd + Gate + + +401 + 101 + +401 + 160 + +Switch + Odd + PrintOdd + Gate + + +401 + 245 + +401 + 159 + +Switch + Even + IsEven + Gate + + +392 + 533 + +392 + 182 + +Switch + Even + PrintEven + Gate + + +392 + 403 + +392 + 181 + +Switch + a + IsOdd + a + + +382 + 78 + +382 + 199 + +Switch + a + IsEven + a + + +381 + 509 + +382 + 200 + +Switch + a + PrintOdd + a + + +Switch + a + PrintEven + a + + +381 + 361 + +382 + 200 + +Switch + a + Default + a + + +382 + 663 + +382 + 199 + +Switch + Branch + PrintOdd + Branch + + +Switch + Branch + PrintEven + Branch + + +369 + 381 + +369 + 219 + +Switch + Branch + Default + Branch + + +370 + 683 + +370 + 220 + +Switch + default + Default + Gate + + +363 + 707 + +362 + 239 + +EndOfSwitch + a + EndOfInitLoopSwitch + Index + + +Puta + a + EndOfSwitch + a + + +PutBranch + Branch + EndOfSwitch + Branch + + + +GraphSwitchCheckDefault2NOTValid2 + InitLoopSwitch__Index + InitLoopSwitch + Index + +3 + 0 + + +GraphSwitchCheckDefault2NOTValid2 + InitLoopSwitch__Min + InitLoopSwitch + Min + +3 + -5 + + +GraphSwitchCheckDefault2NOTValid2 + InitLoopSwitch__Max + InitLoopSwitch + Max + +3 + 10 + diff --git a/examples/GraphSwitchOutputNOTValid.py b/examples/GraphSwitchOutputNOTValid.py new file mode 100644 index 0000000..94ae98d --- /dev/null +++ b/examples/GraphSwitchOutputNOTValid.py @@ -0,0 +1,211 @@ + +# Generated python file of Graph GraphSwitch_1_1_1 + +from SuperV import * + +# Graph creation of GraphSwitch_1_1_1 +def DefGraphSwitch_1_1_1() : + GraphSwitch_1_1_1 = Graph( 'GraphSwitch_1_1_1' ) + GraphSwitch_1_1_1.SetName( 'GraphSwitch_1_1_1' ) + GraphSwitch_1_1_1.SetAuthor( '' ) + GraphSwitch_1_1_1.SetComment( '' ) + GraphSwitch_1_1_1.Coords( 0 , 0 ) + + # Creation of Factory Nodes + + # Creation of InLine Nodes + PyIsOdd = [] + PyIsOdd.append( 'from time import * ' ) + PyIsOdd.append( 'def IsOdd(a) : ' ) + PyIsOdd.append( ' print a,"IsOdd (GraphSwitch)" ' ) + PyIsOdd.append( ' sleep( 1 ) ' ) + PyIsOdd.append( ' return a ' ) + IsOdd = GraphSwitch_1_1_1.INode( 'IsOdd' , PyIsOdd ) + IsOdd.SetName( 'IsOdd' ) + IsOdd.SetAuthor( '' ) + IsOdd.SetComment( 'Python function' ) + IsOdd.Coords( 388 , 50 ) + IIsOdda = IsOdd.InPort( 'a' , 'long' ) + IIsOddGate = IsOdd.GetInPort( 'Gate' ) + OIsOdda = IsOdd.OutPort( 'a' , 'long' ) + OIsOddGate = IsOdd.GetOutPort( 'Gate' ) + + PyIsEven = [] + PyIsEven.append( 'from time import * ' ) + PyIsEven.append( 'def IsEven(a) : ' ) + PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' ) + PyIsEven.append( ' sleep( 1 ) ' ) + PyIsEven.append( ' return a ' ) + IsEven = GraphSwitch_1_1_1.INode( 'IsEven' , PyIsEven ) + IsEven.SetName( 'IsEven' ) + IsEven.SetAuthor( '' ) + IsEven.SetComment( 'Compute Node' ) + IsEven.Coords( 395 , 334 ) + IIsEvena = IsEven.InPort( 'a' , 'long' ) + IIsEvenGate = IsEven.GetInPort( 'Gate' ) + OIsEvena = IsEven.OutPort( 'a' , 'long' ) + OIsEvenGate = IsEven.GetOutPort( 'Gate' ) + + PyPrint = [] + PyPrint.append( 'def Print(a,Branch) : ' ) + PyPrint.append( ' print "Print ",Branch ' ) + PyPrint.append( ' return a,Branch ' ) + Print = GraphSwitch_1_1_1.INode( 'Print' , PyPrint ) + Print.SetName( 'Print' ) + Print.SetAuthor( '' ) + Print.SetComment( 'Compute Node' ) + Print.Coords( 639 , 63 ) + IPrinta = Print.InPort( 'a' , 'long' ) + IPrintBranch = Print.InPort( 'Branch' , 'string' ) + IPrintGate = Print.GetInPort( 'Gate' ) + OPrinta = Print.OutPort( 'a' , 'long' ) + OPrintBranch = Print.OutPort( 'Branch' , 'string' ) + OPrintGate = Print.GetOutPort( 'Gate' ) + + PyPrint_1 = [] + PyPrint_1.append( 'def Print_1(a,Branch) : ' ) + PyPrint_1.append( ' print "Print ",Branch ' ) + PyPrint_1.append( ' return a,Branch ' ) + Print_1 = GraphSwitch_1_1_1.INode( 'Print_1' , PyPrint_1 ) + Print_1.SetName( 'Print_1' ) + Print_1.SetAuthor( '' ) + Print_1.SetComment( 'Compute Node' ) + Print_1.Coords( 639 , 263 ) + IPrint_1a = Print_1.InPort( 'a' , 'long' ) + IPrint_1Branch = Print_1.InPort( 'Branch' , 'string' ) + IPrint_1Gate = Print_1.GetInPort( 'Gate' ) + OPrint_1a = Print_1.OutPort( 'a' , 'long' ) + OPrint_1Branch = Print_1.OutPort( 'Branch' , 'string' ) + OPrint_1Gate = Print_1.GetOutPort( 'Gate' ) + + # Creation of Loop Nodes + PyInitLoopSwitch = [] + PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' ) + PyInitLoopSwitch.append( ' Index = Max ' ) + PyInitLoopSwitch.append( ' return Index,Min,Max ' ) + PyMoreInitLoopSwitch = [] + PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' ) + PyMoreInitLoopSwitch.append( ' if Index >= Min : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' ) + PyMoreInitLoopSwitch.append( ' else : ' ) + PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' ) + PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' ) + PyNextInitLoopSwitch = [] + PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' ) + PyNextInitLoopSwitch.append( ' Index = Index - 1 ' ) + PyNextInitLoopSwitch.append( ' return Index,Min,Max ' ) + InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitch_1_1_1.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch ) + EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' ) + EndOfInitLoopSwitch.SetAuthor( '' ) + EndOfInitLoopSwitch.SetComment( 'Compute Node' ) + EndOfInitLoopSwitch.Coords( 1082 , 150 ) + PyEndOfInitLoopSwitch = [] + EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch ) + IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' ) + IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' ) + IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' ) + IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' ) + IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' ) + OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' ) + OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' ) + OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' ) + OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' ) + IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' ) + IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' ) + IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' ) + IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' ) + IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' ) + OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' ) + OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' ) + InitLoopSwitch.SetName( 'InitLoopSwitch' ) + InitLoopSwitch.SetAuthor( '' ) + InitLoopSwitch.SetComment( 'Compute Node' ) + InitLoopSwitch.Coords( 10 , 129 ) + + # Creation of Switch Nodes + PySwitch = [] + PySwitch.append( 'from time import * ' ) + PySwitch.append( 'def Switch(a) : ' ) + PySwitch.append( ' Branch = 'Negative or null' ' ) + PySwitch.append( ' if a <= 0 : ' ) + PySwitch.append( ' return 0,0,a,Branch,1 ' ) + PySwitch.append( ' if ( a & 1 ) == 0 : ' ) + PySwitch.append( ' Branch = 'Even' ' ) + PySwitch.append( ' else : ' ) + PySwitch.append( ' Branch = 'Odd' ' ) + PySwitch.append( ' sleep(1) ' ) + PySwitch.append( ' return a & 1,1-(a&1),a,Branch,0 ' ) + Switch,EndOfSwitch = GraphSwitch_1_1_1.SNode( 'Switch' , PySwitch ) + EndOfSwitch.SetName( 'EndOfSwitch' ) + EndOfSwitch.SetAuthor( '' ) + EndOfSwitch.SetComment( 'Compute Node' ) + EndOfSwitch.Coords( 880 , 150 ) + PyEndOfSwitch = [] + EndOfSwitch.SetPyFunction( 'EndSwitch_1' , PyEndOfSwitch ) + IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' ) + IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' ) + OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' ) + OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' ) + Switch.SetName( 'Switch' ) + Switch.SetAuthor( '' ) + Switch.SetComment( 'Compute Node' ) + Switch.Coords( 195 , 129 ) + ISwitcha = Switch.InPort( 'a' , 'long' ) + ISwitchGate = Switch.GetInPort( 'Gate' ) + OSwitchOdd = Switch.OutPort( 'Odd' , 'long' ) + OSwitchEven = Switch.OutPort( 'Even' , 'int' ) + OSwitcha = Switch.OutPort( 'a' , 'int' ) + OSwitchBranch = Switch.OutPort( 'Branch' , 'string' ) + OSwitchdefault = Switch.OutPort( 'default' , 'boolean' ) + OSwitchDefault = Switch.GetOutPort( 'Default' ) + + # Creation of Links + LIsOddaPrinta = GraphSwitch_1_1_1.Link( OIsOdda , IPrinta ) + + LInitLoopSwitchIndexSwitcha = GraphSwitch_1_1_1.Link( OInitLoopSwitchIndex , ISwitcha ) + + LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitch_1_1_1.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin ) + + LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitch_1_1_1.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax ) + + LIsEvenaPrint_1a = GraphSwitch_1_1_1.Link( OIsEvena , IPrint_1a ) + + LSwitchOddIsOddGate = GraphSwitch_1_1_1.Link( OSwitchOdd , IIsOddGate ) + + LSwitchEvenIsEvenGate = GraphSwitch_1_1_1.Link( OSwitchEven , IIsEvenGate ) + + LSwitchaIsOdda = GraphSwitch_1_1_1.Link( OSwitcha , IIsOdda ) + + LSwitchaIsEvena = GraphSwitch_1_1_1.Link( OSwitcha , IIsEvena ) + + LSwitchBranchPrintBranch = GraphSwitch_1_1_1.Link( OSwitchBranch , IPrintBranch ) + + LSwitchBranchPrint_1Branch = GraphSwitch_1_1_1.Link( OSwitchBranch , IPrint_1Branch ) + + LSwitchDefaultEndOfSwitchDefault = GraphSwitch_1_1_1.Link( OSwitchDefault , IEndOfSwitchDefault ) + + LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitch_1_1_1.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex ) + + LPrintaEndOfSwitcha = GraphSwitch_1_1_1.Link( OPrinta , IEndOfSwitcha ) + + LPrint_1aEndOfSwitcha = GraphSwitch_1_1_1.Link( OPrint_1a , IEndOfSwitcha ) + + # Input datas + IInitLoopSwitchIndex.Input( 0 ) + IInitLoopSwitchMin.Input( -5 ) + IInitLoopSwitchMax.Input( 10 ) + + # Output Ports of the graph + #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) + #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) + #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) + #OSwitchdefault = Switch.GetOutPort( 'default' ) + #OPrintBranch = Print.GetOutPort( 'Branch' ) + #OPrint_1Branch = Print_1.GetOutPort( 'Branch' ) + return GraphSwitch_1_1_1 + + +GraphSwitch_1_1_1 = DefGraphSwitch_1_1_1() diff --git a/examples/GraphSwitchOutputNOTValid.xml b/examples/GraphSwitchOutputNOTValid.xml new file mode 100644 index 0000000..30a7c29 --- /dev/null +++ b/examples/GraphSwitchOutputNOTValid.xml @@ -0,0 +1,500 @@ + + + + + +? + ? + GraphSwitch_1_1_1 + 1 + ? + +GraphSwitch_1_1_1 + + +long + InitLoopSwitch__Index + +long + InitLoopSwitch__Min + +long + InitLoopSwitch__Max + + +long + EndOfInitLoopSwitch__Index + +long + EndOfInitLoopSwitch__Min + +long + EndOfInitLoopSwitch__Max + +boolean + Switch__default + +string + Print__Branch + +string + Print_1__Branch + + + 1/10/2003 - 17:23:54 + 20/1/2005 - 12:54:59 + 1.05 + ? + ? + ? + 0 + 0 + + +? + ? + IsOdd + 3 + ? + +IsOdd + + +long + a + + +long + a + + + +IsOdd + + + + + + 20/1/2005 - 12:54:59 + 20/1/2005 - 12:54:59 + 1.05 + ? + ? + Python function + 388 + 50 + +? + ? + InitLoopSwitch + 4 + EndOfInitLoopSwitch + +InitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +InitLoop + + + + +MoreLoop + + = Min : ]]> + + + + + +NextLoop + + + + 20/1/2005 - 12:54:59 + 20/1/2005 - 12:54:59 + 1.05 + ? + ? + Compute Node + 10 + 129 + +? + ? + EndOfInitLoopSwitch + 5 + InitLoopSwitch + +EndOfInitLoopSwitch + + +long + Index + +long + Min + +long + Max + + +long + Index + +long + Min + +long + Max + + + +? + + 20/1/2005 - 12:54:59 + 20/1/2005 - 12:54:59 + 1.05 + ? + ? + Compute Node + 1082 + 150 + +? + ? + IsEven + 3 + ? + +IsEven + + +long + a + + +long + a + + + +IsEven + + + + + + 20/1/2005 - 12:54:59 + 20/1/2005 - 12:54:59 + 2.0 + ? + ? + Compute Node + 395 + 334 + +? + ? + Switch + 6 + EndOfSwitch + +Switch + + +long + a + + +long + Odd + +int + Even + +int + a + +string + Branch + +boolean + default + + + +Switch + + + + + + + + + + + + 20/1/2005 - 12:54:59 + 20/1/2005 - 12:54:59 + 2.0 + ? + ? + Compute Node + 195 + 129 + +? + ? + EndOfSwitch + 7 + Switch + +EndOfSwitch + + +long + a + + +long + a + + + +EndSwitch_1 + + 20/1/2005 - 12:54:59 + 20/1/2005 - 12:54:59 + 2.0 + ? + ? + Compute Node + 880 + 150 + +? + ? + Print + 3 + ? + +Print + + +long + a + +string + Branch + + +long + a + +string + Branch + + + +Print + + + + 20/1/2005 - 12:54:59 + 20/1/2005 - 12:54:59 + 2.0 + ? + ? + Compute Node + 639 + 63 + +? + ? + Print_1 + 3 + ? + +Print_1 + + +long + a + +string + Branch + + +long + a + +string + Branch + + + +Print_1 + + + + 20/1/2005 - 12:54:59 + 20/1/2005 - 12:54:59 + 2.0 + ? + ? + Compute Node + 639 + 263 + + +IsOdd + a + Print + a + + +InitLoopSwitch + DoLoop + EndOfInitLoopSwitch + DoLoop + + +InitLoopSwitch + Index + Switch + a + + +InitLoopSwitch + Min + EndOfInitLoopSwitch + Min + + +InitLoopSwitch + Max + EndOfInitLoopSwitch + Max + + +EndOfInitLoopSwitch + DoLoop + InitLoopSwitch + DoLoop + + +IsEven + a + Print_1 + a + + +Switch + Odd + IsOdd + Gate + + +Switch + Even + IsEven + Gate + + +Switch + a + IsOdd + a + + +Switch + a + IsEven + a + + +Switch + Branch + Print + Branch + + +Switch + Branch + Print_1 + Branch + + +Switch + Default + EndOfSwitch + Default + + +EndOfSwitch + a + EndOfInitLoopSwitch + Index + + +Print + a + EndOfSwitch + a + + +Print_1 + a + EndOfSwitch + a + + + +GraphSwitch_1_1_1 + InitLoopSwitch__Index + InitLoopSwitch + Index + +3 + 0 + + +GraphSwitch_1_1_1 + InitLoopSwitch__Min + InitLoopSwitch + Min + +3 + -5 + + +GraphSwitch_1_1_1 + InitLoopSwitch__Max + InitLoopSwitch + Max + +3 + 10 +