plcopen/structures.py
changeset 151 aaa80b48bead
parent 125 394d9f168258
child 170 5068ba721506
--- a/plcopen/structures.py	Tue Jan 22 10:53:34 2008 +0100
+++ b/plcopen/structures.py	Tue Jan 22 10:57:41 2008 +0100
@@ -34,14 +34,14 @@
                      "L" : ["LINT", "ULINT", "LREAL", "LWORD"]} 
 
 def generate_block(generator, block, body, link, order=False):
-    body_type = body.getContent()["name"]
-    name = block.getInstanceName()
-    type = block.getTypeName()
-    executionOrderId = block.getExecutionOrderId()
+    body_type = body.getcontent()["name"]
+    name = block.getinstanceName()
+    type = block.gettypeName()
+    executionOrderId = block.getexecutionOrderId()
     block_infos = GetBlockType(type)
     if block_infos["type"] == "function":
-        output_variable = block.outputVariables.getVariable()[0]
-        output_name = "%s%d_OUT"%(type, block.getLocalId())
+        output_variable = block.outputVariables.getvariable()[0]
+        output_name = "%s%d_OUT"%(type, block.getlocalId())
         if not generator.ComputedBlocks.get(block, False) and not order:
             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, []))
@@ -50,8 +50,8 @@
             else:
                 generator.Interface[-1][4].append(("ANY", output_name, None, None))
             vars = []
-            for variable in block.inputVariables.getVariable():
-                connections = variable.connectionPointIn.getConnections()
+            for variable in block.inputVariables.getvariable():
+                connections = variable.connectionPointIn.getconnections()
                 if connections and len(connections) == 1:
                     if body_type == "FBD" or body_type == "SFC":
                         value = generator.ComputeFBDExpression(body, connections[0], executionOrderId > 0)
@@ -69,15 +69,15 @@
     elif block_infos["type"] == "functionBlock":
         if not generator.ComputedBlocks.get(block, False) and not order:
             vars = []
-            for variable in block.inputVariables.getVariable():
-                connections = variable.connectionPointIn.getConnections()
+            for variable in block.inputVariables.getvariable():
+                connections = variable.connectionPointIn.getconnections()
                 if connections and len(connections) == 1:
-                    parameter = variable.getFormalParameter()
+                    parameter = variable.getformalParameter()
                     if body_type == "FBD" or body_type == "SFC":
                         value = generator.ComputeFBDExpression(body, connections[0], executionOrderId > 0)
                         vars.append("%s := %s"%(parameter, generator.ExtractModifier(variable, value)))
                     elif body_type == "LD":
-                        paths = generator.GenerateLDPaths(variable.connectionPointIn.getConnections(), body)
+                        paths = generator.GenerateLDPaths(variable.connectionPointIn.getconnections(), body)
                         if len(paths) > 0:
                             paths = tuple(paths)
                         else:
@@ -87,13 +87,13 @@
             generator.Program += "  %s(%s);\n"%(name, ", ".join(vars))
             generator.ComputedBlocks[block] = True
         if link:
-            connectionPoint = link.getPosition()[-1]
+            connectionPoint = link.getposition()[-1]
         else:
             connectionPoint = None
-        for variable in block.outputVariables.getVariable():
-            blockPointx, blockPointy = variable.connectionPointOut.getRelPosition()
-            if not connectionPoint or block.getX() + blockPointx == connectionPoint.getX() and block.getY() + blockPointy == connectionPoint.getY():
-                return generator.ExtractModifier(variable, "%s.%s"%(name, variable.getFormalParameter()))
+        for variable in block.outputVariables.getvariable():
+            blockPointx, blockPointy = variable.connectionPointOut.getrelPositionXY()
+            if not connectionPoint or block.getx() + blockPointx == connectionPoint.getx() and block.gety() + blockPointy == connectionPoint.gety():
+                return generator.ExtractModifier(variable, "%s.%s"%(name, variable.getformalParameter()))
         raise ValueError, "No output variable found"
 
 def initialise_block(type, name):