Fixed bug in ST code generator with extensible standard functions
authorLaurent Bessard
Wed, 15 May 2013 23:27:19 +0200
changeset 1149 67df52302ea6
parent 1148 d0e40e99f422
child 1150 b1c84771e1cf
Fixed bug in ST code generator with extensible standard functions
plcopen/structures.py
--- a/plcopen/structures.py	Wed May 15 23:11:49 2013 +0200
+++ b/plcopen/structures.py	Wed May 15 23:27:19 2013 +0200
@@ -59,17 +59,23 @@
         if not generator.ComputedBlocks.get(block, False) and not order:
             generator.ComputedBlocks[block] = True
             connected_vars = []
-            input_connected = dict([("EN", None)] + 
-                                   [(input_name, None) for input_name in input_names])
-            for variable in input_variables:
-                parameter = variable.getformalParameter()
-                if input_connected.has_key(parameter):
-                    input_connected[parameter] = variable
-            if input_connected["EN"] is None:
-                input_connected.pop("EN")
-                input_parameters = input_names
+            if not block_infos["extensible"]:
+                input_connected = dict([("EN", None)] + 
+                                       [(input_name, None) for input_name in input_names])
+                for variable in input_variables:
+                    parameter = variable.getformalParameter()
+                    if input_connected.has_key(parameter):
+                        input_connected[parameter] = variable
+                if input_connected["EN"] is None:
+                    input_connected.pop("EN")
+                    input_parameters = input_names
+                else:
+                    input_parameters = ["EN"] + input_names
             else:
-                input_parameters = ["EN"] + input_names
+                input_connected = dict([(variable.getformalParameter(), variable)
+                                        for variable in input_variables])
+                input_parameters = [variable.getformalParameter()
+                                    for variable in input_variables]
             one_input_connected = False
             all_input_connected = True
             for i, parameter in enumerate(input_parameters):