Added POU interface description in library help text for standard function blocks too, not only in standard functions
authorEdouard Tisserant
Fri, 01 Apr 2011 15:25:43 +0200
changeset 517 026ef159e8a2
parent 516 40290ddff19c
child 518 343fa6867322
Added POU interface description in library help text for standard function blocks too, not only in standard functions
plcopen/structures.py
--- a/plcopen/structures.py	Thu Mar 31 19:10:47 2011 +0200
+++ b/plcopen/structures.py	Fri Apr 01 15:25:43 2011 +0200
@@ -569,18 +569,7 @@
                         if res != None :
                             # create the copy of decl dict to be appended to section
                             Function_decl_copy = Function_decl.copy()
-                            # Have to generate type description in comment with freshly redefined types
-                            words = Function_decl_copy["comment"].split('"')
-                            if len(words) > 1:
-                                Function_decl_copy["comment"] = words[1]
-                            Function_decl_copy["usage"] = (
-                                "\n (" +
-                                str([ " " + fctdecl[1]+":"+fctdecl[0] for fctdecl in Function_decl["inputs"]]).strip("[]").replace("'",'') +
-                                " ) => (" +
-                                str([ " " + fctdecl[1]+":"+fctdecl[0] for fctdecl in Function_decl["outputs"]]).strip("[]").replace("'",'') +
-                                " )")
                             Current_section["list"].append(Function_decl_copy)
-                            #pp.pprint(Function_decl_copy)
             else:
                 raise "First function must be in a category"
     
@@ -590,6 +579,18 @@
 
 BlockTypes.extend(std_decl)
 
+for section in BlockTypes: 
+    for desc in section["list"]:
+        words = desc["comment"].split('"')
+        if len(words) > 1:
+            desc["comment"] = words[1]
+        desc["usage"] = (
+            "\n (" +
+            str([ " " + fctdecl[1]+":"+fctdecl[0] for fctdecl in desc["inputs"]]).strip("[]").replace("'",'') +
+            " ) => (" +
+            str([ " " + fctdecl[1]+":"+fctdecl[0] for fctdecl in desc["outputs"]]).strip("[]").replace("'",'') +
+            " )")
+
 
 #-------------------------------------------------------------------------------
 #                            Languages Keywords