def GetFeatureFlagPcd(Item, Type, ContainerFile, LineNo=-1): TokenGuid, TokenName, Value = '', '', '' List = GetSplitValueList(Item) if len(List) != 2: RaiseParserError(Item, 'Pcds' + Type, ContainerFile, \ '<PcdTokenSpaceGuidCName>.<TokenCName>|TRUE/FALSE', \ LineNo) else: Value = List[1] if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo): (TokenGuid, TokenName) = GetSplitValueList(List[0], DataType.TAB_SPLIT) return (TokenName, TokenGuid, Value, Type)
def GetDynamicVpdPcd(Item, Type, ContainerFile, LineNo=-1): TokenGuid, TokenName, List1, List2 = '', '', '', '' List = GetSplitValueList(Item + DataType.TAB_VALUE_SPLIT) if len(List) < 3 or len(List) > 4: RaiseParserError(Item, 'Pcds' + Type, ContainerFile, \ '<PcdTokenSpaceGuidCName>.<TokenCName>|<VpdOffset>\ [|<MaximumDatumSize>]' , LineNo) else: List1, List2 = List[1], List[2] if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo): (TokenGuid, TokenName) = GetSplitValueList(List[0], DataType.TAB_SPLIT) return (TokenName, TokenGuid, List1, List2, Type)
def GetBinary(Item, ContainerFile, LineNo=-1): ItemNew = Item + DataType.TAB_VALUE_SPLIT List = GetSplitValueList(ItemNew) if len(List) < 3 or len(List) > 5: RaiseParserError(Item, 'Binaries', ContainerFile, \ "<FileType>|<Filename>[|<Target>\ [|<TokenSpaceGuidCName>.<PcdCName>]]" , LineNo) if len(List) >= 4: if List[3] != '': CheckPcdTokenInfo(List[3], 'Binaries', ContainerFile, LineNo) return (List[0], List[1], List[2], List[3]) elif len(List) == 3: return (List[0], List[1], List[2], '')
def GetBuildOption(String, File, LineNo=-1): (Family, ToolChain, Flag) = ('', '', '') if String.find(DataType.TAB_EQUAL_SPLIT) < 0: RaiseParserError(String, 'BuildOptions', File, \ '[<Family>:]<ToolFlag>=Flag', LineNo) else: List = GetSplitValueList(String, DataType.TAB_EQUAL_SPLIT, MaxSplit=1) if List[0].find(':') > -1: Family = List[0][:List[0].find(':')].strip() ToolChain = List[0][List[0].find(':') + 1:].strip() else: ToolChain = List[0].strip() Flag = List[1].strip() return (Family, ToolChain, Flag)
def GetSource(Item, ContainerFile, FileRelativePath, LineNo=-1): ItemNew = Item + DataType.TAB_VALUE_SPLIT * 4 List = GetSplitValueList(ItemNew) if len(List) < 5 or len(List) > 9: RaiseParserError(Item, 'Sources', ContainerFile, \ '<Filename>[|<Family>[|<TagName>[|<ToolCode>\ [|<PcdFeatureFlag>]]]]' , LineNo) List[0] = NormPath(List[0]) CheckFileExist(FileRelativePath, List[0], ContainerFile, 'Sources', \ Item, LineNo) if List[4] != '': CheckPcdTokenInfo(List[4], 'Sources', ContainerFile, LineNo) return (List[0], List[1], List[2], List[3], List[4])
def GetLibraryClass(Item, ContainerFile, WorkspaceDir, LineNo=-1): List = GetSplitValueList(Item[0]) SupMod = DataType.SUP_MODULE_LIST_STRING if len(List) != 2: RaiseParserError(Item[0], 'LibraryClasses', ContainerFile, \ '<LibraryClassKeyWord>|<LibraryInstance>') else: CheckFileType(List[1], '.Inf', ContainerFile, \ 'library class instance', Item[0], LineNo) CheckFileExist(WorkspaceDir, List[1], ContainerFile, \ 'LibraryClasses', Item[0], LineNo) if Item[1] != '': SupMod = Item[1] return (List[0], List[1], SupMod)
def GetDynamicDefaultPcd(Item, Type, ContainerFile, LineNo=-1): TokenGuid, TokenName, Value, DatumTyp, MaxDatumSize = '', '', '', '', '' List = GetSplitValueList(Item + DataType.TAB_VALUE_SPLIT * 2) if len(List) < 4 or len(List) > 8: RaiseParserError(Item, 'Pcds' + Type, ContainerFile, \ '<PcdTokenSpaceGuidCName>.<TokenCName>|<Value>\ [|<DatumTyp>[|<MaxDatumSize>]]' , LineNo) else: Value = List[1] DatumTyp = List[2] MaxDatumSize = List[3] if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo): (TokenGuid, TokenName) = GetSplitValueList(List[0], DataType.TAB_SPLIT) return (TokenName, TokenGuid, Value, DatumTyp, MaxDatumSize, Type)
def GetDynamicHiiPcd(Item, Type, ContainerFile, LineNo=-1): TokenGuid, TokenName, List1, List2, List3, List4, List5 = \ '', '', '', '', '', '', '' List = GetSplitValueList(Item + DataType.TAB_VALUE_SPLIT * 2) if len(List) < 6 or len(List) > 8: RaiseParserError(Item, 'Pcds' + Type, ContainerFile, \ '<PcdTokenSpaceGuidCName>.<TokenCName>|<String>|\ <VariableGuidCName>|<VariableOffset>[|<DefaultValue>\ [|<MaximumDatumSize>]]' , LineNo) else: List1, List2, List3, List4, List5 = \ List[1], List[2], List[3], List[4], List[5] if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo): (TokenGuid, TokenName) = GetSplitValueList(List[0], DataType.TAB_SPLIT) return (TokenName, TokenGuid, List1, List2, List3, List4, List5, Type)