plcopen/structures.py
changeset 517 026ef159e8a2
parent 483 779a519f78f2
child 526 79900abdfa3c
--- 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