def SetSpecification(self, Specification, Comments): # # Valid the value of Specification # __ValueList = [] TokenList = GetSplitValueList(Specification, DT.TAB_EQUAL_SPLIT, 1) __ValueList[0:len(TokenList)] = TokenList if len(__ValueList) != 2: ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_NO_NAME + ' Or ' + ST.ERR_INF_PARSER_DEFINE_ITEM_NO_VALUE, LineInfo=self.CurrentLine) Name = __ValueList[0].strip() Version = __ValueList[1].strip() if IsValidIdentifier(Name): if IsValidDecVersion(Version): self.Specification.append((Name, Version, Comments)) return True else: ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID % (Version), LineInfo=self.CurrentLine) return False else: ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID % (Name), LineInfo=self.CurrentLine) return False return True
def SetVersionString(self, VersionString, Comments): # # Value has been set before. # if self.VersionString != None: ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\ %(DT.TAB_INF_DEFINES_VERSION_STRING), LineInfo=self.CurrentLine) return False if not IsValidDecVersion(VersionString): ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID\ %(VersionString), LineInfo=self.CurrentLine) self.VersionString = InfDefMember() self.VersionString.SetValue(VersionString) self.VersionString.Comments = Comments return True