Fix bug while generating direct global array variables
authorlaurent
Wed, 14 Sep 2011 23:06:47 +0200
changeset 558 01e2c3d58a27
parent 557 0f591ac019f3
child 559 984c51d1bf6b
Fix bug while generating direct global array variables
PLCGenerator.py
--- a/PLCGenerator.py	Wed Sep 14 23:06:05 2011 +0200
+++ b/PLCGenerator.py	Wed Sep 14 23:06:47 2011 +0200
@@ -278,7 +278,7 @@
                     # Array derived directly from an elementary type 
                     else:
                         basetype_name = base_type["name"]
-                    var_type = "ARRAY [%s] OF %s" % (",".join(map(lambda x : "%s..%s" % (dimension.getlower(), dimension.getupper()), vartype_content["value"].getdimension())), basetype_name)
+                    var_type = "ARRAY [%s] OF %s" % (",".join(map(lambda x : "%s..%s" % (x.getlower(), x.getupper()), vartype_content["value"].getdimension())), basetype_name)
                 # Variable type is an elementary type
                 else:
                     var_type = vartype_content["name"]
@@ -347,7 +347,7 @@
                     # Array derived directly from an elementary type 
                     else:
                         basetype_name = base_type["name"]
-                    var_type = "ARRAY [%s] OF %s" % (",".join(map(lambda x : "%s..%s" % (dimension.getlower(), dimension.getupper()), vartype_content["value"].getdimension())), basetype_name)
+                    var_type = "ARRAY [%s] OF %s" % (",".join(map(lambda x : "%s..%s" % (x.getlower(), x.getupper()), vartype_content["value"].getdimension())), basetype_name)
                 # Variable type is an elementary type
                 else:
                     var_type = vartype_content["name"]
@@ -623,7 +623,7 @@
                             # Array derived directly from a user defined type 
                             if base_type["name"] == "derived":
                                 basetype_name = base_type["value"].getname()
-                                self.GenerateDataType(basetype_name)
+                                self.ParentGenerator.GenerateDataType(basetype_name)
                             # Array derived directly from a string type 
                             elif base_type["name"] in ["string", "wstring"]:
                                 basetype_name = base_type["name"].upper()