Fixing bug in PLCGenerator with user defined functions and standard overloaded function
authorLaurent Bessard
Tue, 16 Oct 2012 19:01:17 +0200
changeset 854 c10f2092c43a
parent 853 0f97bddb5a30
child 855 b30421d07e8c
Fixing bug in PLCGenerator with user defined functions and standard overloaded function
PLCGenerator.py
plcopen/plcopen.py
--- a/PLCGenerator.py	Tue Oct 16 18:58:45 2012 +0200
+++ b/PLCGenerator.py	Tue Oct 16 19:01:17 2012 +0200
@@ -795,8 +795,9 @@
         for var_type, connections in undefined.items():
             related = []
             for connection in connections:
-                if self.ConnectionTypes.has_key(connection):
-                    var_type = self.ConnectionTypes[connection]
+                connection_type = self.ConnectionTypes.get(connection)
+                if connection_type and not connection_type.startswith("ANY"):
+                    var_type = connection_type
                 else:
                     related.extend(self.ExtractRelatedConnections(connection))
             if var_type.startswith("ANY") and len(related) > 0:
--- a/plcopen/plcopen.py	Tue Oct 16 18:58:45 2012 +0200
+++ b/plcopen/plcopen.py	Tue Oct 16 19:01:17 2012 +0200
@@ -448,11 +448,11 @@
             if return_type:
                 var_type = return_type.getcontent()
                 if var_type["name"] == "derived":
-                    block_infos["outputs"].append(("", var_type["value"].getname(), "none"))
+                    block_infos["outputs"].append(("OUT", var_type["value"].getname(), "none"))
                 elif var_type["name"] in ["string", "wstring"]:
-                    block_infos["outputs"].append(("", var_type["name"].upper(), "none"))
+                    block_infos["outputs"].append(("OUT", var_type["name"].upper(), "none"))
                 else:
-                    block_infos["outputs"].append(("", var_type["name"], "none"))
+                    block_infos["outputs"].append(("OUT", var_type["name"], "none"))
             for type, varlist in pou.getvars():
                 if type == "InOut":
                     for var in varlist.getvariable():