# HG changeset patch
# User Laurent Bessard
# Date 1350406877 -7200
# Node ID c10f2092c43a4ab6ec57d43c358e6990c24db7ef
# Parent  0f97bddb5a301f24ed6a9cb19aad1e4c3779185b
Fixing bug in PLCGenerator with user defined functions and standard overloaded function

diff -r 0f97bddb5a30 -r c10f2092c43a PLCGenerator.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:
diff -r 0f97bddb5a30 -r c10f2092c43a plcopen/plcopen.py
--- 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():