Bug in return value and outputs order in functions informations generation fixed
authorlbessard
Thu, 25 Sep 2008 10:28:24 +0200
changeset 278 e3ed4747086f
parent 277 5fc11b2d4fbb
child 279 2ad276084038
Bug in return value and outputs order in functions informations generation fixed
plcopen/plcopen.py
--- a/plcopen/plcopen.py	Wed Sep 24 17:18:08 2008 +0200
+++ b/plcopen/plcopen.py	Thu Sep 25 10:28:24 2008 +0200
@@ -315,6 +315,15 @@
                            "inputs" : [], "outputs" : [], "comment" : "",
                            "generate" : generate_block, "initialise" : initialise_block}
             if pou.getinterface():
+                return_type = pou.interface.getreturnType()
+                if return_type:
+                    var_type = return_type.getcontent()
+                    if var_type["name"] == "derived":
+                        block_infos["outputs"].append(("", var_type["value"].getname(), "none"))
+                    elif var_type["name"] in ["string", "wstring"]:
+                        block_infos["outputs"].append(("", var_type["name"].upper(), "none"))
+                    else:
+                        block_infos["outputs"].append(("", var_type["name"], "none"))
                 for type, varlist in pou.getvars():
                     if type == "InOut":
                         for var in varlist.getvariable():
@@ -346,15 +355,6 @@
                                 block_infos["outputs"].append((var.getname(), var_type["name"].upper(), "none"))
                             else:
                                 block_infos["outputs"].append((var.getname(), var_type["name"], "none"))    
-                return_type = pou.interface.getreturnType()
-                if return_type:
-                    var_type = return_type.getcontent()
-                    if var_type["name"] == "derived":
-                        block_infos["outputs"].append(("", var_type["value"].getname(), "none"))
-                    elif var_type["name"] in ["string", "wstring"]:
-                        block_infos["outputs"].append(("", var_type["name"].upper(), "none"))
-                    else:
-                        block_infos["outputs"].append(("", var_type["name"], "none"))
             if pou.getbodyType() in ["FBD","LD","SFC"]:
                 for instance in pou.getinstances():
                     if isinstance(instance, PLCOpenClasses.get("commonObjects_comment", None)):