PLCGenerator.py
changeset 104 a9b8916d906d
parent 93 c3c24b979a4d
child 108 9aa1fdfb7cb2
--- a/PLCGenerator.py	Fri Oct 05 17:59:34 2007 +0200
+++ b/PLCGenerator.py	Fri Oct 05 18:00:25 2007 +0200
@@ -245,6 +245,10 @@
             for instance in body.getContentInstances():
                 if isinstance(instance, plcopen.coil):
                     paths = self.GenerateLDPaths(instance.connectionPointIn.getConnections(), body)
+                    if len(paths) > 0:
+                        paths = tuple(paths)
+                    else:
+                        paths = paths[0] 
                     variable = self.ExtractModifier(instance, instance.getVariable())
                     expression = self.ComputeLDExpression(paths, True)
                     self.Program += "  %s := %s;\n"%(variable, expression)
@@ -275,8 +279,8 @@
         if isinstance(instance, (plcopen.inVariable, plcopen.inOutVariable)):
             return instance.getExpression()
         elif isinstance(instance, plcopen.block):
-            type = instance.getTypeName()
-            block_infos = GetBlockType(type)
+            block_type = instance.getTypeName()
+            block_infos = GetBlockType(block_type)
             return block_infos["generate"](self, instance, body, link)
         elif isinstance(instance, plcopen.continuation):
             name = instance.getName()
@@ -300,6 +304,10 @@
             next = body.getContentInstance(localId)
             if isinstance(next, plcopen.leftPowerRail):
                 paths.append(None)
+            elif isinstance(next, plcopen.block):
+                block_type = next.getTypeName()
+                block_infos = GetBlockType(block_type)
+                paths.append(block_infos["generate"](self, next, body, connection))
             else:
                 variable = self.ExtractModifier(next, next.getVariable())
                 result = self.GenerateLDPaths(next.connectionPointIn.getConnections(), body)