plcopen/structures.py
changeset 208 c70aefcadf66
parent 194 1b3f8b4f8e04
child 210 17ce08b81775
--- a/plcopen/structures.py	Tue Apr 22 10:25:24 2008 +0200
+++ b/plcopen/structures.py	Tue Apr 22 16:16:00 2008 +0200
@@ -43,6 +43,7 @@
         output_variable = block.outputVariables.getvariable()[0]
         output_name = "%s%d_OUT"%(type, block.getlocalId())
         if not generator.ComputedBlocks.get(block, False) and not order:
+            generator.ComputedBlocks[block] = True
             if generator.Interface[-1][0] != "VAR" or generator.Interface[-1][1] or generator.Interface[-1][2] or generator.Interface[-1][3]:
                 generator.Interface.append(("VAR", False, False, False, []))
             if output_variable.connectionPointOut in generator.ConnectionTypes:
@@ -64,10 +65,10 @@
                         value = generator.ComputeLDExpression(paths, True)
                     vars.append(generator.ExtractModifier(variable, value))
             generator.Program += "  %s := %s(%s);\n"%(output_name, type, ", ".join(vars))
-            generator.ComputedBlocks[block] = True
         return generator.ExtractModifier(output_variable, output_name)
     elif block_infos["type"] == "functionBlock":
         if not generator.ComputedBlocks.get(block, False) and not order:
+            generator.ComputedBlocks[block] = True
             vars = []
             for variable in block.inputVariables.getvariable():
                 connections = variable.connectionPointIn.getconnections()
@@ -84,7 +85,6 @@
                         value = generator.ComputeLDExpression(paths, True)
                     vars.append("%s := %s"%(parameter, generator.ExtractModifier(variable, value)))
             generator.Program += "  %s(%s);\n"%(name, ", ".join(vars))
-            generator.ComputedBlocks[block] = True
         if link:
             connectionPoint = link.getposition()[-1]
         else: