BaseTools: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@ -3,9 +3,9 @@
|
||||
#
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -49,7 +49,7 @@ class PcdErrorXml(object):
|
||||
self.Expression = ''
|
||||
self.ErrorNumber = ''
|
||||
self.ErrorMessage = []
|
||||
|
||||
|
||||
def FromXml(self, Item, Key):
|
||||
self.ValidValueList = XmlElement(Item, '%s/ValidValueList' % Key)
|
||||
self.ValidValueListLang = \
|
||||
@ -62,7 +62,7 @@ class PcdErrorXml(object):
|
||||
ErrorMessageLang = \
|
||||
XmlAttribute(XmlNode(ErrMsg, 'ErrorMessage'), 'Lang')
|
||||
self.ErrorMessage.append((ErrorMessageLang, ErrorMessageString))
|
||||
|
||||
|
||||
Error = PcdErrorObject()
|
||||
Error.SetValidValue(self.ValidValueList)
|
||||
Error.SetValidValueLang(self.ValidValueListLang)
|
||||
@ -70,7 +70,7 @@ class PcdErrorXml(object):
|
||||
Error.SetExpression(self.Expression)
|
||||
Error.SetErrorNumber(self.ErrorNumber)
|
||||
Error.SetErrorMessageList(self.ErrorMessage)
|
||||
|
||||
|
||||
return Error
|
||||
|
||||
def ToXml(self, PcdError, Key):
|
||||
@ -100,9 +100,9 @@ class PcdErrorXml(object):
|
||||
CreateXmlElement('ErrorMessage', Item[1], [], [['Lang', Item[0]]])
|
||||
NodeList.append(Element)
|
||||
Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
|
||||
|
||||
|
||||
return Root
|
||||
|
||||
|
||||
def TransferValidRange2Expr(self, TokenSpaceGuidCName, CName, ValidRange):
|
||||
if self.Expression:
|
||||
pass
|
||||
@ -125,7 +125,7 @@ class PcdErrorXml(object):
|
||||
for MatchObj in HexMatch2.finditer(ValidRange):
|
||||
MatchStr = MatchObj.group()
|
||||
TransferedRangeStr = ' '.join(['', PcdName, MatchStr.strip()])
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
#
|
||||
# Convert INT2 format range
|
||||
#
|
||||
@ -133,36 +133,36 @@ class PcdErrorXml(object):
|
||||
for MatchObj in IntMatch2.finditer(ValidRange):
|
||||
MatchStr = MatchObj.group()
|
||||
TransferedRangeStr = ' '.join(['', PcdName, MatchStr.strip()])
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
#
|
||||
# Convert HEX1 format range
|
||||
#
|
||||
if HexMatch1:
|
||||
HexMatchedList += HexMatch1.findall(ValidRange)
|
||||
|
||||
|
||||
for MatchStr in HexMatchedList:
|
||||
RangeItemList = MatchStr.strip().split('-')
|
||||
TransferedRangeStr = '(%s GE %s) AND (%s LE %s)' % \
|
||||
(PcdName, RangeItemList[0].strip(), PcdName, RangeItemList[1].strip())
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
#
|
||||
# Convert INT1 format range
|
||||
#
|
||||
if IntMatch1:
|
||||
IntMatchedList += IntMatch1.findall(ValidRange)
|
||||
|
||||
|
||||
for MatchStr in IntMatchedList:
|
||||
RangeItemList = MatchStr.strip().split('-')
|
||||
TransferedRangeStr = '(%s GE %s) AND (%s LE %s)' % \
|
||||
(PcdName, RangeItemList[0].strip(), PcdName, RangeItemList[1].strip())
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
|
||||
return ValidRange
|
||||
|
||||
|
||||
def TransferValidEpxr2ValidRange(self, ValidRangeExpr):
|
||||
if self.Expression:
|
||||
pass
|
||||
|
||||
|
||||
PCD_PATTERN = \
|
||||
'[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*\.[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*'
|
||||
IntPattern1 = \
|
||||
@ -170,16 +170,16 @@ class PcdErrorXml(object):
|
||||
PCD_PATTERN+'[\t\s]+LE[\t\s]+\d+[\t\s]*\)'
|
||||
IntPattern1 = IntPattern1.replace(' ', '')
|
||||
IntPattern2 = '[\t\s]*'+PCD_PATTERN+'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+\d+[\t\s]*'
|
||||
|
||||
|
||||
HexPattern1 = \
|
||||
'[\t\s]*\([\t\s]*'+PCD_PATTERN+'[\t\s]+GE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)[\t\s]+AND[\t\s]+\([\t\s]*'+\
|
||||
PCD_PATTERN+'[\t\s]+LE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)'
|
||||
HexPattern1 = HexPattern1.replace(' ', '')
|
||||
HexPattern2 = '[\t\s]*'+PCD_PATTERN+'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+0[xX][0-9a-zA-Z]+[\t\s]*'
|
||||
|
||||
|
||||
#
|
||||
# Do the Hex1 conversion
|
||||
#
|
||||
#
|
||||
HexMatchedList = re.compile(HexPattern1).findall(ValidRangeExpr)
|
||||
HexRangeDict = {}
|
||||
for HexMatchedItem in HexMatchedList:
|
||||
@ -188,8 +188,8 @@ class PcdErrorXml(object):
|
||||
#
|
||||
RangeItemList = re.compile('[\t\s]*0[xX][0-9a-fA-F]+[\t\s]*').findall(HexMatchedItem)
|
||||
if RangeItemList and len(RangeItemList) == 2:
|
||||
HexRangeDict[HexMatchedItem] = RangeItemList
|
||||
|
||||
HexRangeDict[HexMatchedItem] = RangeItemList
|
||||
|
||||
for Key in HexRangeDict.keys():
|
||||
MaxItem = MixItem = ''
|
||||
if int(HexRangeDict[Key][0], 16) > int(HexRangeDict[Key][1], 16):
|
||||
@ -198,7 +198,7 @@ class PcdErrorXml(object):
|
||||
else:
|
||||
MaxItem = HexRangeDict[Key][1]
|
||||
MixItem = HexRangeDict[Key][0]
|
||||
|
||||
|
||||
Range = ' %s - %s' % (MixItem.strip(), MaxItem.strip())
|
||||
ValidRangeExpr = ValidRangeExpr.replace(Key, Range)
|
||||
#
|
||||
@ -211,9 +211,9 @@ class PcdErrorXml(object):
|
||||
# To match items on both sides of '-'
|
||||
#
|
||||
RangeItemList = re.compile('[\t\s]*\d+[\t\s]*').findall(MatchedItem)
|
||||
if RangeItemList and len(RangeItemList) == 2:
|
||||
if RangeItemList and len(RangeItemList) == 2:
|
||||
IntRangeDict[MatchedItem] = RangeItemList
|
||||
|
||||
|
||||
for Key in IntRangeDict.keys():
|
||||
MaxItem = MixItem = ''
|
||||
if int(IntRangeDict[Key][0]) > int(IntRangeDict[Key][1]):
|
||||
@ -222,11 +222,11 @@ class PcdErrorXml(object):
|
||||
else:
|
||||
MaxItem = IntRangeDict[Key][1]
|
||||
MixItem = IntRangeDict[Key][0]
|
||||
|
||||
|
||||
Range = ' %s - %s' % (MixItem.strip(), MaxItem.strip())
|
||||
ValidRangeExpr = ValidRangeExpr.replace(Key, Range)
|
||||
#
|
||||
# Do the HEX2 conversion
|
||||
# Do the HEX2 conversion
|
||||
#
|
||||
for MatchObj in re.compile(HexPattern2).finditer(ValidRangeExpr):
|
||||
MatchStr = MatchObj.group()
|
||||
@ -241,8 +241,8 @@ class PcdErrorXml(object):
|
||||
ValidRangeExpr = ValidRangeExpr.replace(MatchStr, Range)
|
||||
|
||||
return ValidRangeExpr
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return "ValidValueList = %s ValidValueListLang = %s ValidValueRange \
|
||||
@ -275,7 +275,7 @@ class PcdEntryXml(object):
|
||||
|
||||
##
|
||||
# AsBuilt will use FromXml
|
||||
#
|
||||
#
|
||||
def FromXml(self, Item, Key):
|
||||
self.PcdItemType = \
|
||||
XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdItemType')
|
||||
@ -297,7 +297,7 @@ class PcdEntryXml(object):
|
||||
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)
|
||||
@ -306,9 +306,9 @@ class PcdEntryXml(object):
|
||||
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)
|
||||
@ -326,11 +326,11 @@ class PcdEntryXml(object):
|
||||
|
||||
PcdEntry.SetHelpTextList(GetHelpTextList(self.HelpText))
|
||||
PcdEntry.SetPcdErrorsList(self.PcdError)
|
||||
|
||||
|
||||
return PcdEntry
|
||||
##
|
||||
# Package will use FromXml2
|
||||
#
|
||||
#
|
||||
def FromXml2(self, Item, Key):
|
||||
self.TokenSpaceGuidCName = \
|
||||
XmlElement(Item, '%s/TokenSpaceGuidCname' % Key)
|
||||
@ -353,9 +353,9 @@ class PcdEntryXml(object):
|
||||
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)
|
||||
@ -367,11 +367,11 @@ class PcdEntryXml(object):
|
||||
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
|
||||
|
||||
##
|
||||
@ -394,9 +394,9 @@ class PcdEntryXml(object):
|
||||
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)
|
||||
@ -408,15 +408,15 @@ class PcdEntryXml(object):
|
||||
|
||||
PcdEntry.SetHelpTextList(GetHelpTextList(self.HelpText))
|
||||
PcdEntry.SetPcdErrorsList(self.PcdError)
|
||||
|
||||
|
||||
return PcdEntry
|
||||
|
||||
|
||||
def ToXml(self, PcdEntry, Key):
|
||||
if self.PcdCName:
|
||||
pass
|
||||
|
||||
|
||||
DefaultValue = ConvertNEToNOTEQ(PcdEntry.GetDefaultValue())
|
||||
|
||||
|
||||
AttributeList = \
|
||||
[['SupArchList', GetStringOfList(PcdEntry.GetSupArchList())], \
|
||||
['PcdUsage', PcdEntry.GetValidUsage()], \
|
||||
@ -425,7 +425,7 @@ class PcdEntryXml(object):
|
||||
]
|
||||
NodeList = [['TokenSpaceGuidCname', PcdEntry.GetTokenSpaceGuidCName()],
|
||||
['TokenSpaceGuidValue', PcdEntry.GetTokenSpaceGuidValue()],
|
||||
['Token', PcdEntry.GetToken()],
|
||||
['Token', PcdEntry.GetToken()],
|
||||
['CName', PcdEntry.GetCName()],
|
||||
['DatumType', PcdEntry.GetDatumType()],
|
||||
['ValidUsage', GetStringOfList(PcdEntry.GetValidUsage())],
|
||||
@ -433,26 +433,26 @@ class PcdEntryXml(object):
|
||||
['MaxDatumSize', PcdEntry.GetMaxDatumSize()],
|
||||
['Offset', PcdEntry.GetOffset()],
|
||||
]
|
||||
|
||||
|
||||
for Item in PcdEntry.GetHelpTextList():
|
||||
Tmp = HelpTextXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
for Item in PcdEntry.GetPcdErrorsList():
|
||||
Tmp = PcdErrorXml()
|
||||
NodeList.append(Tmp.ToXml(Item, 'PcdError'))
|
||||
|
||||
|
||||
Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
|
||||
|
||||
|
||||
return Root
|
||||
##
|
||||
# Package will use ToXml2
|
||||
#
|
||||
#
|
||||
def ToXml2(self, PcdEntry, Key):
|
||||
if self.PcdCName:
|
||||
pass
|
||||
|
||||
|
||||
DefaultValue = ConvertNEToNOTEQ(PcdEntry.GetDefaultValue())
|
||||
|
||||
|
||||
AttributeList = \
|
||||
[['SupArchList', GetStringOfList(PcdEntry.GetSupArchList())], \
|
||||
['SupModList', GetStringOfList(PcdEntry.GetSupModuleList())]
|
||||
@ -468,7 +468,7 @@ class PcdEntryXml(object):
|
||||
for Item in PcdEntry.GetPromptList():
|
||||
Tmp = PromptXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
|
||||
|
||||
for Item in PcdEntry.GetHelpTextList():
|
||||
Tmp = HelpTextXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
@ -476,9 +476,9 @@ class PcdEntryXml(object):
|
||||
for Item in PcdEntry.GetPcdErrorsList():
|
||||
Tmp = PcdErrorXml()
|
||||
NodeList.append(Tmp.ToXml(Item, 'PcdError'))
|
||||
|
||||
|
||||
Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
|
||||
|
||||
|
||||
return Root
|
||||
##
|
||||
# Module will use ToXml3
|
||||
@ -486,9 +486,9 @@ class PcdEntryXml(object):
|
||||
def ToXml3(self, PcdEntry, Key):
|
||||
if self.PcdCName:
|
||||
pass
|
||||
|
||||
|
||||
DefaultValue = ConvertNEToNOTEQ(PcdEntry.GetDefaultValue())
|
||||
|
||||
|
||||
AttributeList = \
|
||||
[['SupArchList', GetStringOfList(PcdEntry.GetSupArchList())], \
|
||||
['PcdUsage', PcdEntry.GetValidUsage()], \
|
||||
@ -499,29 +499,29 @@ class PcdEntryXml(object):
|
||||
['TokenSpaceGuidCName', PcdEntry.GetTokenSpaceGuidCName()],
|
||||
['DefaultValue', DefaultValue],
|
||||
]
|
||||
|
||||
|
||||
for Item in PcdEntry.GetHelpTextList():
|
||||
Tmp = HelpTextXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
for Item in PcdEntry.GetPcdErrorsList():
|
||||
Tmp = PcdErrorXml()
|
||||
NodeList.append(Tmp.ToXml(Item, 'PcdError'))
|
||||
|
||||
|
||||
Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
|
||||
|
||||
|
||||
return Root
|
||||
|
||||
|
||||
##
|
||||
# AsBuild Module will use ToXml4
|
||||
#
|
||||
def ToXml4(self, PcdEntry, Key):
|
||||
if self.PcdCName:
|
||||
pass
|
||||
|
||||
|
||||
DefaultValue = ConvertNEToNOTEQ(PcdEntry.GetDefaultValue())
|
||||
|
||||
|
||||
AttributeList = []
|
||||
|
||||
|
||||
NodeList = [
|
||||
['TokenSpaceGuidValue', PcdEntry.GetTokenSpaceGuidValue()],
|
||||
['PcdCName', PcdEntry.GetCName()],
|
||||
@ -531,18 +531,18 @@ class PcdEntryXml(object):
|
||||
['Value', DefaultValue],
|
||||
['Offset', PcdEntry.GetOffset()]
|
||||
]
|
||||
|
||||
|
||||
for Item in PcdEntry.GetHelpTextList():
|
||||
Tmp = HelpTextXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
for Item in PcdEntry.GetPcdErrorsList():
|
||||
Tmp = PcdErrorXml()
|
||||
NodeList.append(Tmp.ToXml(Item, 'PcdError'))
|
||||
|
||||
|
||||
Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
|
||||
|
||||
|
||||
return Root
|
||||
|
||||
|
||||
|
||||
def __str__(self):
|
||||
Str = \
|
||||
|
Reference in New Issue
Block a user