X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2Fbertos_utils.py;h=925774ba387fefe0761b66364763fb40c9a8bc9d;hb=822c03fa0b9d667b6abf4b04d89b7debd8bc5afb;hp=6065c677cf6241bc4e7869bbad4fbfe9697f4a8e;hpb=179b0cb7522fc025ec5c86ca228f109de6282401;p=bertos.git diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 6065c677..925774ba 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -212,10 +212,14 @@ def loadConfigurationInfos(path): configurationInfos[name] = {} configurationInfos[name]["value"] = value configurationInfos[name]["informations"] = informations - if configurationInfos[name]["informations"]["type"] == "int" and configurationInfos[name]["value"].find("L") != -1: + if ("type" in configurationInfos[name]["informations"].keys() and + configurationInfos[name]["informations"]["type"] == "int" and + configurationInfos[name]["value"].find("L") != -1): configurationInfos[name]["informations"]["long"] = True configurationInfos[name]["value"] = configurationInfos[name]["value"].replace("L", "") - if configurationInfos[name]["informations"]["type"] == "int" and configurationInfos[name]["value"].find("U") != -1: + if ("type" in configurationInfos[name]["informations"].keys() and + configurationInfos[name]["informations"]["type"] == "int" and + configurationInfos[name]["value"].find("U") != -1): configurationInfos[name]["informations"]["unsigned"] = True configurationInfos[name]["value"] = configurationInfos[name]["value"].replace("U", "") configurationInfos[name]["description"] = description @@ -299,38 +303,38 @@ def sub(string, parameter, value): """ return re.sub(r"(?P#define\s+" + parameter + r"\s+)([^\s]+)", r"\g" + value, string) -def isInt(value): +def isInt(informations): """ Return True if the value is a simple int. """ - if "long" not in value["informations"].keys() and "unsigned" not in value["informations"].keys(): + if ("long" not in informatios.keys() or not informations["long"]) and ("unsigned" not in informations.keys() or informations["unsigned"]): return True else: return False -def isLong(value): +def isLong(informations): """ Return True if the value is a long. """ - if "long" in value["informations"].keys() and value["informations"]["long"] and "unsigned" not in value["informations"].keys(): + if "long" in informations.keys() and informations["long"] and "unsigned" not in informations.keys(): return True else: return False -def isUnsigned(value): +def isUnsigned(informations): """ Return True if the value is an unsigned. """ - if "unsigned" in value["informations"].keys() and value["informations"]["unsigned"] and "long" not in value["informations"].keys(): + if "unsigned" in informations.keys() and informations["unsigned"] and "long" not in informations.keys(): return True else: return False -def isUnsignedLong(value): +def isUnsignedLong(informations): """ Return True if the value is an unsigned long. """ - if "unsigned" in value["informations"].keys() and "long" in value["informations"].keys() and value["informations"]["unsigned"] and value["informations"]["long"]: + if "unsigned" in informations.keys() and "long" in informations.keys() and informations["unsigned"] and informations["long"]: return True else: return False \ No newline at end of file