diff -r cbdfef9b2020 -r de7ddb376150 PLCControler.py --- a/PLCControler.py Tue Aug 19 18:04:56 2008 +0200 +++ b/PLCControler.py Tue Aug 19 18:06:41 2008 +0200 @@ -643,8 +643,16 @@ current_varlist = None current_type = None for var in vars: - if current_type != (var["Class"], var["Retain"], var["Constant"], var["Location"] in ["", None]): - current_type = (var["Class"], var["Retain"], var["Constant"], var["Location"] in ["", None]) + next_type = (var["Class"], + var["Retain"], + var["Constant"], + var["Location"] in ["", None] or + # When declaring globals, located + # and not located variables are + # in the same declaration block + var["Class"] == "Global") + if current_type != next_type: + current_type = next_type if var["Class"] == "Local": current_varlist = plcopen.interface_localVars() elif var["Class"] == "Global": @@ -1685,12 +1693,12 @@ new_type = infos.get("type", old_type) old_typeinfos = self.GetBlockType(old_type) new_typeinfos = self.GetBlockType(new_type) - if new_typeinfos["type"] != old_typeinfos["type"]: + if new_type != old_type and new_typeinfos["type"] != old_typeinfos["type"]: if new_typeinfos["type"] == "function": self.RemoveEditedElementPouVar(tagname, old_type, old_name) else: self.AddEditedElementPouVar(tagname, new_type, new_name) - elif new_typeinfos["type"] != "function" and old_name != new_name: + elif old_name != new_name and new_typeinfos["type"] != "function": self.ChangeEditedElementPouVar(tagname, old_type, old_name, new_type, new_name) for param, value in infos.items(): if param == "name":