def ObjectFactory(self, ItemType, TSCName, CName, DValue, FFE, Usage, Str): Object = PcdObject() HelpStr = Str Object.SetItemType(ItemType) Object.SetTokenSpaceGuidCName(TSCName) Object.SetCName(CName) Object.SetDefaultValue(DValue) Object.SetFeatureFlag(FFE) Object.SetValidUsage(Usage) HelpTextObj = TextObject() HelpTextObj.SetLang('') HelpTextObj.SetString(HelpStr) Object.SetHelpTextList([HelpTextObj]) return Object
def GenPcdDeclaration(ContainerFile, PcdInfo, Language, MacroReplaceDict): HelpStr = '' PromptStr = '' TailHelpStr = '' TokenGuidCName, TokenName, Value, DatumType, Token, Type, \ GenericComment, TailComment, Arch = PcdInfo Pcd = PcdObject() Pcd.SetCName(TokenName) Pcd.SetToken(Token) Pcd.SetTokenSpaceGuidCName(TokenGuidCName) Pcd.SetDatumType(DatumType) Pcd.SetDefaultValue(Value) Pcd.SetValidUsage(Type) # # MaxDatumSize is required field for 'VOID*' PCD # if DatumType == TAB_PTR_TYPE_PCD: Pcd.SetMaxDatumSize(ITEM_UNDEFINED) SupArchList = [Arch] Pcd.SetSupArchList(SupArchList) if GenericComment: HelpStr, PcdErrList, PromptStr = ParseDecPcdGenericComment(GenericComment, ContainerFile, TokenGuidCName, TokenName, MacroReplaceDict) if PcdErrList: Pcd.SetPcdErrorsList(PcdErrList) if TailComment: SupModuleList, TailHelpStr = ParseDecPcdTailComment(TailComment, ContainerFile) if SupModuleList: Pcd.SetSupModuleList(SupModuleList) if HelpStr and (not HelpStr.endswith('\n')) and TailHelpStr: HelpStr += '\n' HelpStr += TailHelpStr if HelpStr: HelpTxtObj = TextObject() HelpTxtObj.SetLang(Language) HelpTxtObj.SetString(HelpStr) Pcd.SetHelpTextList([HelpTxtObj]) if PromptStr: TxtObj = TextObject() TxtObj.SetLang(Language) TxtObj.SetString(PromptStr) Pcd.SetPromptList([TxtObj]) return Pcd
def FromXml2(self, Item, Key): self.TokenSpaceGuidCName = \ XmlElement(Item, '%s/TokenSpaceGuidCname' % Key) self.Token = XmlElement(Item, '%s/Token' % Key) self.CName = XmlElement(Item, '%s/CName' % Key) self.DatumType = XmlElement(Item, '%s/DatumType' % Key) self.ValidUsage = XmlElement(Item, '%s/ValidUsage' % Key) self.DefaultValue = XmlElement(Item, '%s/DefaultValue' % Key) self.MaxDatumSize = XmlElement(Item, '%s/MaxDatumSize' % Key) self.CommonDefines.FromXml(XmlNode(Item, '%s' % Key), Key) for PromptItem in XmlList(Item, '%s/Prompt' % Key): PromptObj = PromptXml() PromptObj.FromXml(PromptItem, '%s/Prompt' % Key) self.Prompt.append(PromptObj) for HelpTextItem in XmlList(Item, '%s/HelpText' % Key): HelpTextObj = HelpTextXml() HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key) self.HelpText.append(HelpTextObj) for PcdErrorItem in XmlList(Item, '%s/PcdError' % Key): PcdErrorObjXml = PcdErrorXml() PcdErrorObj = PcdErrorObjXml.FromXml(PcdErrorItem, 'PcdError') self.PcdError.append(PcdErrorObj) self.DefaultValue = ConvertNOTEQToNE(self.DefaultValue) PcdEntry = PcdObject() PcdEntry.SetSupArchList(self.CommonDefines.SupArchList) PcdEntry.SetSupModuleList(self.CommonDefines.SupModList) PcdEntry.SetTokenSpaceGuidCName(self.TokenSpaceGuidCName) PcdEntry.SetToken(self.Token) PcdEntry.SetCName(self.CName) PcdEntry.SetDatumType(self.DatumType) PcdEntry.SetValidUsage(self.ValidUsage) PcdEntry.SetDefaultValue(self.DefaultValue) PcdEntry.SetMaxDatumSize(self.MaxDatumSize) PcdEntry.SetFeatureFlag( ConvertNOTEQToNE(self.CommonDefines.FeatureFlag)) PcdEntry.SetPromptList(GetPromptList(self.Prompt)) PcdEntry.SetHelpTextList(GetHelpTextList(self.HelpText)) PcdEntry.SetPcdErrorsList(self.PcdError) return PcdEntry
def FromXml3(self, Item, Key): self.PcdItemType = \ XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdItemType') self.PcdUsage = XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdUsage') self.TokenSpaceGuidCName = \ XmlElement(Item, '%s/TokenSpaceGuidCName' % Key) self.CName = XmlElement(Item, '%s/CName' % Key) self.DefaultValue = XmlElement(Item, '%s/DefaultValue' % Key) self.CommonDefines.FromXml(XmlNode(Item, '%s' % Key), Key) for HelpTextItem in XmlList(Item, '%s/HelpText' % Key): HelpTextObj = HelpTextXml() HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key) self.HelpText.append(HelpTextObj) for PcdErrorItem in XmlList(Item, '%s/PcdError' % Key): PcdErrorObj = PcdErrorXml() PcdErrorObj.FromXml(PcdErrorItem, 'PcdError') self.PcdError.append(PcdErrorObj) self.DefaultValue = ConvertNOTEQToNE(self.DefaultValue) PcdEntry = PcdObject() PcdEntry.SetSupArchList(self.CommonDefines.SupArchList) PcdEntry.SetTokenSpaceGuidCName(self.TokenSpaceGuidCName) PcdEntry.SetCName(self.CName) PcdEntry.SetValidUsage(self.PcdUsage) PcdEntry.SetDefaultValue(self.DefaultValue) PcdEntry.SetFeatureFlag( ConvertNOTEQToNE(self.CommonDefines.FeatureFlag)) PcdEntry.SetItemType(self.PcdItemType) PcdEntry.SetHelpTextList(GetHelpTextList(self.HelpText)) PcdEntry.SetPcdErrorsList(self.PcdError) return PcdEntry
def FromXml(self, Item, Key): self.PcdItemType = \ XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdItemType') self.PcdUsage = XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdUsage') self.TokenSpaceGuidCName = \ XmlElement(Item, '%s/TokenSpaceGuidCname' % Key) self.TokenSpaceGuidValue = \ XmlElement(Item, '%s/TokenSpaceGuidValue' % Key) self.Token = XmlElement(Item, '%s/Token' % Key) self.CName = XmlElement(Item, '%s/CName' % Key) self.PcdCName = XmlElement(Item, '%s/PcdCName' % Key) self.DatumType = XmlElement(Item, '%s/DatumType' % Key) self.ValidUsage = XmlElement(Item, '%s/ValidUsage' % Key) if not GlobalData.gIS_BINARY_INF: self.DefaultValue = XmlElement(Item, '%s/DefaultValue' % Key) else: self.DefaultValue = XmlElement(Item, '%s/Value' % Key) self.MaxDatumSize = XmlElement(Item, '%s/MaxDatumSize' % Key) self.Value = XmlElement(Item, '%s/Value' % Key) self.Offset = XmlElement(Item, '%s/Offset' % Key) self.CommonDefines.FromXml(XmlNode(Item, '%s' % Key), Key) for HelpTextItem in XmlList(Item, '%s/HelpText' % Key): HelpTextObj = HelpTextXml() HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key) self.HelpText.append(HelpTextObj) for PcdErrorItem in XmlList(Item, '%s/PcdError' % Key): PcdErrorObjXml = PcdErrorXml() PcdErrorObj = PcdErrorObjXml.FromXml(PcdErrorItem, 'PcdError') self.PcdError.append(PcdErrorObj) self.DefaultValue = ConvertNOTEQToNE(self.DefaultValue) PcdEntry = PcdObject() PcdEntry.SetSupArchList(self.CommonDefines.SupArchList) PcdEntry.SetTokenSpaceGuidCName(self.TokenSpaceGuidCName) PcdEntry.SetTokenSpaceGuidValue(self.TokenSpaceGuidValue) PcdEntry.SetToken(self.Token) PcdEntry.SetOffset(self.Offset) PcdEntry.SetCName(self.CName) PcdEntry.SetPcdCName(self.PcdCName) PcdEntry.SetDatumType(self.DatumType) PcdEntry.SetValidUsage(self.ValidUsage) PcdEntry.SetDefaultValue(self.DefaultValue) PcdEntry.SetMaxDatumSize(self.MaxDatumSize) PcdEntry.SetFeatureFlag( ConvertNOTEQToNE(self.CommonDefines.FeatureFlag)) PcdEntry.SetItemType(self.PcdItemType) PcdEntry.SetHelpTextList(GetHelpTextList(self.HelpText)) PcdEntry.SetPcdErrorsList(self.PcdError) return PcdEntry