2 # Generated python file of Graph GraphWrongPythonFunctions_1
6 # Graph creation of GraphWrongPythonFunctions_1
7 def DefGraphWrongPythonFunctions_1() :
8 GraphWrongPythonFunctions_1 = Graph( 'GraphWrongPythonFunctions_1' )
9 GraphWrongPythonFunctions_1.SetName( 'GraphWrongPythonFunctions_1' )
10 GraphWrongPythonFunctions_1.SetAuthor( 'JR' )
11 GraphWrongPythonFunctions_1.SetComment( '' )
12 GraphWrongPythonFunctions_1.Coords( 0 , 0 )
14 # Creation of Factory Nodes
16 # Creation of InLine Nodes
18 PyIsOdd.append( 'from timed import * ' )
19 PyIsOdd.append( 'def IsOdd(a) : ' )
20 PyIsOdd.append( ' print a,"IsOdd (GraphLoopSwitch1)" ' )
21 PyIsOdd.append( ' sleep( 1 ) ' )
22 PyIsOdd.append( ' return a ' )
23 IsOdd = GraphWrongPythonFunctions_1.INode( 'IsOdd' , PyIsOdd )
24 IsOdd.SetName( 'IsOdd' )
26 IsOdd.SetComment( 'Python function' )
27 IsOdd.Coords( 397 , 1 )
28 IIsOdda = IsOdd.InPort( 'a' , 'long' )
29 IIsOddGate = IsOdd.GetInPort( 'Gate' )
30 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
31 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
34 PyValEven.append( 'from timed import * ' )
35 PyValEven.append( 'def ValEven(Even) : ' )
36 PyValEven.append( ' sleep(1) ' )
37 PyValEven.append( ' return Even ' )
38 PyValEven.append( '' )
39 ValEven = GraphWrongPythonFunctions_1.INode( 'ValEven' , PyValEven )
40 ValEven.SetName( 'ValEven' )
41 ValEven.SetAuthor( '' )
42 ValEven.SetComment( 'Compute Node' )
43 ValEven.Coords( 396 , 222 )
44 IValEvenEven = ValEven.InPort( 'Even' , 'long' )
45 IValEvenGate = ValEven.GetInPort( 'Gate' )
46 OValEvenEven = ValEven.OutPort( 'Even' , 'long' )
47 OValEvenGate = ValEven.GetOutPort( 'Gate' )
49 # Creation of Loop Nodes
51 PyInitLoop.append( 'def InitLoop(Index,Min,Max) ' )
52 PyInitLoop.append( ' Index = Min ' )
53 PyInitLoop.append( ' return Index,Min,Max ' )
54 PyInitLoop.append( ' ' )
56 PyMoreInitLoop.append( 'def More() ' )
57 PyMoreInitLoop.append( ' return toto ' )
59 PyNextInitLoop.append( 'def Next(...) ' )
60 PyNextInitLoop.append( ' return Ok ' )
61 InitLoop,EndOfInitLoop = GraphWrongPythonFunctions_1.LNode( 'InitLoop' , PyInitLoop , 'More' , PyMoreInitLoop , 'Next' , PyNextInitLoop )
62 EndOfInitLoop.SetName( 'EndOfInitLoop' )
63 EndOfInitLoop.SetAuthor( '' )
64 EndOfInitLoop.SetComment( 'Compute Node' )
65 EndOfInitLoop.Coords( 767 , 102 )
67 PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) : ' )
68 PyEndOfInitLoop.append( ' Index = Index + 1 ' )
69 PyEndOfInitLoop.append( ' if Index <= Max : ' )
70 PyEndOfInitLoop.append( ' DoLoop = 1 ' )
71 PyEndOfInitLoop.append( ' else : ' )
72 PyEndOfInitLoop.append( ' DoLoop = 0 ' )
73 PyEndOfInitLoop.append( ' return DoLoop,Index,Min,Max : ' )
74 EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
75 IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
76 IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
77 IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
78 IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
79 IInitLoopGate = InitLoop.GetInPort( 'Gate' )
80 OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
81 OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
82 OInitLoopMin = InitLoop.GetOutPort( 'Min' )
83 OInitLoopMax = InitLoop.GetOutPort( 'Max' )
84 IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
85 IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
86 IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
87 IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
88 IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
89 OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
90 OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
91 OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
92 OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
93 OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
94 InitLoop.SetName( 'InitLoop' )
95 InitLoop.SetAuthor( '' )
96 InitLoop.SetComment( 'Compute Node' )
97 InitLoop.Coords( 10 , 108 )
99 # Creation of Switch Nodes
101 PySwitch.append( 'from time import * ' )
102 PySwitch.append( 'def Switch(a) ' )
103 PySwitch.append( ' if a & 1 == 0 : ' )
104 PySwitch.append( ' sleep(1) ' )
105 PySwitch.append( ' return a & 1,1-(a&1),a ' )
106 Switch,EndSwitch = GraphWrongPythonFunctions_1.SNode( 'Switch' , PySwitch )
107 EndSwitch.SetName( 'EndSwitch' )
108 EndSwitch.SetAuthor( '' )
109 EndSwitch.SetComment( 'Compute Node' )
110 EndSwitch.Coords( 587 , 103 )
112 PyEndSwitch.append( 'def EndSwitch(a,Even) ' )
113 PyEndSwitch.append( ' sleep(1) ' )
114 PyEndSwitch.append( ' return a, ' )
115 EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
116 IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
117 IEndSwitchEven = EndSwitch.InPort( 'Even' , 'long' )
118 IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
119 OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
120 OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
121 Switch.SetName( 'Switch' )
122 Switch.SetAuthor( '' )
123 Switch.SetComment( 'Compute Node' )
124 Switch.Coords( 194 , 109 )
125 ISwitcha = Switch.InPort( 'a' , 'long' )
126 ISwitchGate = Switch.GetInPort( 'Gate' )
127 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
128 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
129 OSwitcha = Switch.OutPort( 'a' , 'int' )
130 OSwitchDefault = Switch.GetOutPort( 'Default' )
133 LIsOddaEndSwitcha = GraphWrongPythonFunctions_1.Link( OIsOdda , IEndSwitcha )
135 LInitLoopIndexSwitcha = GraphWrongPythonFunctions_1.Link( OInitLoopIndex , ISwitcha )
137 LInitLoopMinEndOfInitLoopMin = GraphWrongPythonFunctions_1.Link( OInitLoopMin , IEndOfInitLoopMin )
139 LInitLoopMaxEndOfInitLoopMax = GraphWrongPythonFunctions_1.Link( OInitLoopMax , IEndOfInitLoopMax )
141 LSwitchOddIsOddGate = GraphWrongPythonFunctions_1.Link( OSwitchOdd , IIsOddGate )
143 LSwitchEvenValEvenEven = GraphWrongPythonFunctions_1.Link( OSwitchEven , IValEvenEven )
145 LSwitchaIsOdda = GraphWrongPythonFunctions_1.Link( OSwitcha , IIsOdda )
147 LSwitchDefaultEndSwitchDefault = GraphWrongPythonFunctions_1.Link( OSwitchDefault , IEndSwitchDefault )
149 LEndSwitchaEndOfInitLoopIndex = GraphWrongPythonFunctions_1.Link( OEndSwitcha , IEndOfInitLoopIndex )
151 LValEvenEvenEndSwitchEven = GraphWrongPythonFunctions_1.Link( OValEvenEven , IEndSwitchEven )
154 IInitLoopIndex.Input( 0 )
155 IInitLoopMin.Input( 5 )
156 IInitLoopMax.Input( 23 )
158 # Output Ports of the graph
159 #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
160 #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
161 #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
162 return GraphWrongPythonFunctions_1
165 GraphWrongPythonFunctions_1 = DefGraphWrongPythonFunctions_1()