Ejemplo n.º 1
0
 def SetConstructor(self, Constructor, Comments):
     #
     # It can be a list
     #
     ValueList = []
     
     TokenList = GetSplitValueList(Constructor, DT.TAB_VALUE_SPLIT)
     ValueList[0:len(TokenList)] = TokenList        
     
     InfDefineConstructorItemObj = InfDefineConstructorItem()
     if not IsValidCVariableName(ValueList[0]):
         ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[0]),
                    LineInfo=self.CurrentLine)
     InfDefineConstructorItemObj.SetCName(ValueList[0])
     if len(ValueList) >= 2:
         ModList = GetSplitValueList(ValueList[1], ' ')
         if ValueList[1].strip() == '':
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[1]),
                        LineInfo=self.CurrentLine)
         for ModItem in ModList:
             if ModItem not in DT.MODULE_LIST:
                 ErrorInInf(ST.ERR_INF_PARSER_DEFINE_MODULETYPE_INVALID%(ModItem),
                            LineInfo=self.CurrentLine)
         InfDefineConstructorItemObj.SetSupModList(ModList)             
     if len(ValueList) == 3:
         if ValueList[2].strip() == '':
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[2]),
                        LineInfo=self.CurrentLine)
         #
         # Validate FFE    
         #
         FeatureFlagRtv = IsValidFeatureFlagExp(ValueList[2].strip())
         if not FeatureFlagRtv[0]:
             ErrorInInf(ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[2]),
                        LineInfo=self.CurrentLine)
         InfDefineConstructorItemObj.SetFeatureFlagExp(ValueList[2])
                 
     if len(ValueList) > 3:
         ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Constructor),
                    LineInfo=self.CurrentLine)
         
     InfDefineConstructorItemObj.Comments = Comments    
     self.Constructor.append(InfDefineConstructorItemObj)     
Ejemplo n.º 2
0
    def SetConstructor(self, Constructor, Comments):
        #
        # It can be a list
        #
        ValueList = []

        TokenList = GetSplitValueList(Constructor, DT.TAB_VALUE_SPLIT)
        ValueList[0:len(TokenList)] = TokenList

        InfDefineConstructorItemObj = InfDefineConstructorItem()
        if not IsValidCVariableName(ValueList[0]):
            ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID %
                       (ValueList[0]),
                       LineInfo=self.CurrentLine)
        InfDefineConstructorItemObj.SetCName(ValueList[0])
        if len(ValueList) >= 2:
            ModList = GetSplitValueList(ValueList[1], ' ')
            if ValueList[1].strip() == '':
                ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID %
                           (ValueList[1]),
                           LineInfo=self.CurrentLine)
            for ModItem in ModList:
                if ModItem not in DT.MODULE_LIST:
                    ErrorInInf(ST.ERR_INF_PARSER_DEFINE_MODULETYPE_INVALID %
                               (ModItem),
                               LineInfo=self.CurrentLine)
            InfDefineConstructorItemObj.SetSupModList(ModList)
        if len(ValueList) == 3:
            if ValueList[2].strip() == '':
                ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID %
                           (ValueList[2]),
                           LineInfo=self.CurrentLine)
            #
            # Validate FFE
            #
            FeatureFlagRtv = IsValidFeatureFlagExp(ValueList[2].strip())
            if not FeatureFlagRtv[0]:
                ErrorInInf(ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID %
                           (FeatureFlagRtv[2]),
                           LineInfo=self.CurrentLine)
            InfDefineConstructorItemObj.SetFeatureFlagExp(ValueList[2])

        if len(ValueList) > 3:
            ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID % (Constructor),
                       LineInfo=self.CurrentLine)

        InfDefineConstructorItemObj.Comments = Comments
        self.Constructor.append(InfDefineConstructorItemObj)