- try:
- configurationInfos = {}
- for comment, define in getDefinitionBlocks(open(path, "r").read()):
- name, value = formatParamNameValue(define)
- description, informations = getDescriptionInformations(comment)
- configurationInfos[name] = {}
- configurationInfos[name]["value"] = value
- configurationInfos[name]["informations"] = informations
- if 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:
- configurationInfos[name]["informations"]["unsigned"] = True
- configurationInfos[name]["value"] = configurationInfos[name]["value"].replace("U", "")
- configurationInfos[name]["description"] = description
- return configurationInfos
- except SyntaxError:
- raise DefineException.ConfigurationDefineException(path)
-
-def loadModuleInfos(path):
- """
- Return the module infos found in the given file as a dict with the module
- name as key and a dict containig the fields above as value or an empty dict
- if the given file is not a BeRTOS module:
- "depends": a list of modules needed by this module
- "configuration": the cfg_*.h with the module configurations
- "description": a string containing the brief description of doxygen
- "enabled": contains False but the wizard will change if the user select
- the module
- """
- try:
- moduleInfos = {}
- string = open(path, "r").read()
- commentList = re.findall(r"/\*{2}\s*([^*]*\*(?:[^/*][^*]*\*+)*)/", string)
- commentList = [" ".join(re.findall(r"^\s*\*?\s*(.*?)\s*?(?:/{2}.*?)?$", comment, re.MULTILINE)).strip() for comment in commentList]
- for comment in commentList:
- index = comment.find("$WIZARD_MODULE")
- if index != -1:
- exec(comment[index + 1:])
- moduleInfos[WIZARD_MODULE["name"]] = {"depends": WIZARD_MODULE["depends"],
- "configuration": WIZARD_MODULE["configuration"],
- "description": "",
- "enabled": False}
- return moduleInfos
- return {}
- except SyntaxError:
- raise DefineException.ModuleDefineException(path)
-
-def loadModuleInfosDict(path):
- """
- Return the dict containig all the modules
- """
- moduleInfosDict = {}
- for filename, path in findDefinitions("*.h", path):
- moduleInfosDict.update(loadModuleInfos(path + "/" + filename))
- return moduleInfosDict
-
-def loadDefineLists(path):
- """
- Return a dict with the name of the list as key and a list of string as value
- """
- try:
- string = open(path, "r").read()
- commentList = re.findall(r"/\*{2}\s*([^*]*\*(?:[^/*][^*]*\*+)*)/", string)
- commentList = [" ".join(re.findall(r"^\s*\*?\s*(.*?)\s*?(?:/{2}.*?)?$", comment, re.MULTILINE)).strip() for comment in commentList]
- listDict = {}
- for comment in commentList:
- index = comment.find("$WIZARD_LIST")
- if index != -1:
- exec(comment[index + 1:])
- listDict.update(WIZARD_LIST)
- return listDict
- except SyntaxError:
- raise DefineException.EnumDefineException(path)
-
-def loadDefineListsDict(path):
- """
- Return the dict containing all the define lists
- """
- defineListsDict = {}
- for filename, path in findDefinitions("*.h", path):
- defineListsDict.update(loadDefineLists(path + "/" + filename))
- return defineListsDict
+ configurationInfos = {}
+ for comment, define in getDefinitionBlocks(open(path, "r").read()):
+ name, value = formatParamNameValue(define)
+ brief, description, informations = getDescriptionInformations(comment)
+ configurationInfos[name] = {}
+ configurationInfos[name]["value"] = value
+ configurationInfos[name]["informations"] = informations
+ 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 ("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
+ configurationInfos[name]["brief"] = brief
+ return configurationInfos