mirror of https://github.com/acidanthera/audk.git
BaseTools: FdfParser - refactor functions to make static
make functions that doesn't use self into @staticmethod Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
parent
cdc9b0c296
commit
227dbb1190
|
@ -1131,7 +1131,8 @@ class FdfParser:
|
||||||
self.__UndoToken()
|
self.__UndoToken()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __Verify(self, Name, Value, Scope):
|
@staticmethod
|
||||||
|
def __Verify(Name, Value, Scope):
|
||||||
if Scope in ['UINT64', 'UINT8']:
|
if Scope in ['UINT64', 'UINT8']:
|
||||||
ValueNumber = 0
|
ValueNumber = 0
|
||||||
try:
|
try:
|
||||||
|
@ -3200,16 +3201,16 @@ class FdfParser:
|
||||||
raise Warning("expected value of %s" % Name, self.FileName, self.CurrentLineNumber)
|
raise Warning("expected value of %s" % Name, self.FileName, self.CurrentLineNumber)
|
||||||
Value = self.__Token
|
Value = self.__Token
|
||||||
if Name == 'IMAGE_HEADER_INIT_VERSION':
|
if Name == 'IMAGE_HEADER_INIT_VERSION':
|
||||||
if self.__Verify(Name, Value, 'UINT8'):
|
if FdfParser.__Verify(Name, Value, 'UINT8'):
|
||||||
FmpData.Version = Value
|
FmpData.Version = Value
|
||||||
elif Name == 'IMAGE_INDEX':
|
elif Name == 'IMAGE_INDEX':
|
||||||
if self.__Verify(Name, Value, 'UINT8'):
|
if FdfParser.__Verify(Name, Value, 'UINT8'):
|
||||||
FmpData.ImageIndex = Value
|
FmpData.ImageIndex = Value
|
||||||
elif Name == 'HARDWARE_INSTANCE':
|
elif Name == 'HARDWARE_INSTANCE':
|
||||||
if self.__Verify(Name, Value, 'UINT8'):
|
if FdfParser.__Verify(Name, Value, 'UINT8'):
|
||||||
FmpData.HardwareInstance = Value
|
FmpData.HardwareInstance = Value
|
||||||
elif Name == 'MONOTONIC_COUNT':
|
elif Name == 'MONOTONIC_COUNT':
|
||||||
if self.__Verify(Name, Value, 'UINT64'):
|
if FdfParser.__Verify(Name, Value, 'UINT64'):
|
||||||
FmpData.MonotonicCount = Value
|
FmpData.MonotonicCount = Value
|
||||||
if FmpData.MonotonicCount.upper().startswith('0X'):
|
if FmpData.MonotonicCount.upper().startswith('0X'):
|
||||||
FmpData.MonotonicCount = (long)(FmpData.MonotonicCount, 16)
|
FmpData.MonotonicCount = (long)(FmpData.MonotonicCount, 16)
|
||||||
|
|
|
@ -1011,7 +1011,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
if VfrUniOffsetList:
|
if VfrUniOffsetList:
|
||||||
UniVfrOffsetFileName = os.path.join(self.OutputPath, self.BaseName + '.offset')
|
UniVfrOffsetFileName = os.path.join(self.OutputPath, self.BaseName + '.offset')
|
||||||
UniVfrOffsetFileSection = os.path.join(self.OutputPath, self.BaseName + 'Offset' + '.raw')
|
UniVfrOffsetFileSection = os.path.join(self.OutputPath, self.BaseName + 'Offset' + '.raw')
|
||||||
self.__GenUniVfrOffsetFile (VfrUniOffsetList, UniVfrOffsetFileName)
|
FfsInfStatement.__GenUniVfrOffsetFile (VfrUniOffsetList, UniVfrOffsetFileName)
|
||||||
UniVfrOffsetFileNameList = []
|
UniVfrOffsetFileNameList = []
|
||||||
UniVfrOffsetFileNameList.append(UniVfrOffsetFileName)
|
UniVfrOffsetFileNameList.append(UniVfrOffsetFileName)
|
||||||
"""Call GenSection"""
|
"""Call GenSection"""
|
||||||
|
@ -1069,11 +1069,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
#
|
#
|
||||||
# Create parameter string for GenFfs
|
# Create parameter string for GenFfs
|
||||||
#
|
#
|
||||||
# @param self The object pointer
|
|
||||||
# @param Rule The rule object used to generate section
|
# @param Rule The rule object used to generate section
|
||||||
# @retval tuple (FileType, Fixed, CheckSum, Alignment)
|
# @retval tuple (FileType, Fixed, CheckSum, Alignment)
|
||||||
#
|
#
|
||||||
def __GetGenFfsCmdParameter__(self, Rule):
|
@staticmethod
|
||||||
|
def __GetGenFfsCmdParameter__(Rule):
|
||||||
result = tuple()
|
result = tuple()
|
||||||
result += ('-t', Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType])
|
result += ('-t', Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType])
|
||||||
if Rule.Fixed != False:
|
if Rule.Fixed != False:
|
||||||
|
@ -1103,11 +1103,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
#
|
#
|
||||||
# Generate the offset file for the module which contain VFR or UNI file.
|
# Generate the offset file for the module which contain VFR or UNI file.
|
||||||
#
|
#
|
||||||
# @param self The object pointer
|
|
||||||
# @param VfrUniOffsetList A list contain the VFR/UNI offsets in the EFI image file.
|
# @param VfrUniOffsetList A list contain the VFR/UNI offsets in the EFI image file.
|
||||||
# @param UniVfrOffsetFileName The output offset file name.
|
# @param UniVfrOffsetFileName The output offset file name.
|
||||||
#
|
#
|
||||||
def __GenUniVfrOffsetFile(self, VfrUniOffsetList, UniVfrOffsetFileName):
|
@staticmethod
|
||||||
|
def __GenUniVfrOffsetFile(VfrUniOffsetList, UniVfrOffsetFileName):
|
||||||
|
|
||||||
# Use a instance of StringIO to cache data
|
# Use a instance of StringIO to cache data
|
||||||
fStringIO = StringIO.StringIO('')
|
fStringIO = StringIO.StringIO('')
|
||||||
|
|
Loading…
Reference in New Issue