+\r
+ def __SetMacroValue(self, Macro, Value):\r
+ if not self.__CurSection:\r
+ return\r
+\r
+ MacroDict = {}\r
+ if not self.__MacroDict[self.__CurSection[0], self.__CurSection[1], self.__CurSection[2]]:\r
+ self.__MacroDict[self.__CurSection[0], self.__CurSection[1], self.__CurSection[2]] = MacroDict\r
+ else:\r
+ MacroDict = self.__MacroDict[self.__CurSection[0], self.__CurSection[1], self.__CurSection[2]]\r
+ MacroDict[Macro] = Value\r
+\r
+ def __GetMacroValue(self, Macro):\r
+ # Highest priority\r
+ if Macro in GlobalData.gCommandLineDefines:\r
+ return GlobalData.gCommandLineDefines[Macro]\r
+ if Macro in GlobalData.gGlobalDefines:\r
+ return GlobalData.gGlobalDefines[Macro]\r
+\r
+ if self.__CurSection:\r
+ MacroDict = self.__MacroDict[\r
+ self.__CurSection[0],\r
+ self.__CurSection[1],\r
+ self.__CurSection[2]\r
+ ]\r
+ if MacroDict and Macro in MacroDict:\r
+ return MacroDict[Macro]\r
+\r
+ # Lowest priority\r
+ if Macro in GlobalData.gPlatformDefines:\r
+ return GlobalData.gPlatformDefines[Macro]\r
+ return None\r
+\r
+ def __SectionHeaderParser(self, Section):\r
+ # [Defines]\r
+ # [FD.UiName]: use dummy instead if UI name is optional\r
+ # [FV.UiName]\r
+ # [Capsule.UiName]\r
+ # [Rule]: don't take rule section into account, macro is not allowed in this section\r
+ # [VTF.arch.UiName, arch]\r
+ # [OptionRom.DriverName]\r
+ self.__CurSection = []\r
+ Section = Section.strip()[1:-1].upper().replace(' ', '').strip('.')\r
+ ItemList = Section.split('.')\r
+ Item = ItemList[0]\r
+ if Item == '' or Item == 'RULE':\r
+ return\r
+\r
+ if Item == 'DEFINES':\r
+ self.__CurSection = ['COMMON', 'COMMON', 'COMMON']\r
+ elif Item == 'VTF' and len(ItemList) == 3:\r
+ UiName = ItemList[2]\r
+ Pos = UiName.find(',')\r
+ if Pos != -1:\r
+ UiName = UiName[:Pos]\r
+ self.__CurSection = ['VTF', UiName, ItemList[1]]\r
+ elif len(ItemList) > 1:\r
+ self.__CurSection = [ItemList[0], ItemList[1], 'COMMON']\r
+ elif len(ItemList) > 0:\r
+ self.__CurSection = [ItemList[0], 'DUMMY', 'COMMON']\r
+\r