Fix bug in using STRING and WSTRING in user defined types
authorlaurent
Tue, 28 Jun 2011 11:28:28 +0200
changeset 547 2faf0964feb2
parent 546 f28df922efbe
child 548 0b6ab74f4b89
Fix bug in using STRING and WSTRING in user defined types
PLCControler.py
--- a/PLCControler.py	Tue Jun 14 17:40:02 2011 +0200
+++ b/PLCControler.py	Tue Jun 28 11:28:28 2011 +0200
@@ -1406,9 +1406,9 @@
                 infos = {}
                 datatype = project.getdataType(words[1])
                 basetype_content = datatype.baseType.getcontent()
-                if basetype_content["value"] is None:
+                if basetype_content["value"] is None or basetype_content["name"] in ["string", "wstring"]:
                     infos["type"] = "Directly"
-                    infos["base_type"] = basetype_content["name"]
+                    infos["base_type"] = basetype_content["name"].upper()
                 elif basetype_content["name"] == "derived":
                     infos["type"] = "Directly"
                     infos["base_type"] = basetype_content["value"].getname()
@@ -1432,8 +1432,8 @@
                     for dimension in basetype_content["value"].getdimension():
                         infos["dimensions"].append((dimension.getlower(), dimension.getupper()))
                     base_type = basetype_content["value"].baseType.getcontent()
-                    if base_type["value"] is None:
-                        infos["base_type"] = base_type["name"]
+                    if base_type["value"] is None or element_type["name"] in ["string", "wstring"]:
+                        infos["base_type"] = base_type["name"].upper()
                     else:
                         infos["base_type"] = base_type["value"].getname()
                 elif basetype_content["name"] == "struct":
@@ -1443,8 +1443,8 @@
                         element_infos = {}
                         element_infos["Name"] = element.getname()
                         element_type = element.type.getcontent()
-                        if element_type["value"] is None:
-                            element_infos["Type"] = element_type["name"]
+                        if element_type["value"] is None or element_type["name"] in ["string", "wstring"]:
+                            element_infos["Type"] = element_type["name"].upper()
                         else:
                             element_infos["Type"] = element_type["value"].getname()
                         if element.initialValue is not None: