public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*'
       [not found] <cover.1542382796.git.jaben.carsey@intel.com>
@ 2018-11-16 15:40 ` Jaben Carsey
  2018-11-27 18:02   ` Carsey, Jaben
                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jaben Carsey @ 2018-11-16 15:40 UTC (permalink / raw)
  To: edk2-devel; +Cc: Yonghong Zhu, Liming Gao

add a variable for the string '*' and then use it instead of lots of '*'

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
 BaseTools/Source/Python/AutoGen/AutoGen.py             | 54 ++++++++++----------
 BaseTools/Source/Python/AutoGen/BuildEngine.py         | 10 ++--
 BaseTools/Source/Python/BPDG/GenVpd.py                 | 14 ++---
 BaseTools/Source/Python/Common/DataType.py             |  1 +
 BaseTools/Source/Python/Common/Expression.py           |  4 +-
 BaseTools/Source/Python/Common/Misc.py                 |  2 +-
 BaseTools/Source/Python/Common/ToolDefClassObject.py   | 23 +++++----
 BaseTools/Source/Python/Common/VpdInfoFile.py          |  8 +--
 BaseTools/Source/Python/GenFds/FdfParser.py            |  5 +-
 BaseTools/Source/Python/GenFds/GenFds.py               |  2 +-
 BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py |  8 +--
 BaseTools/Source/Python/GenFds/Section.py              |  2 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py      |  6 +--
 13 files changed, 70 insertions(+), 69 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index f3560bfc787d..25417c447061 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1438,7 +1438,7 @@ class PlatformAutoGen(AutoGen):
                         PcdValue = Sku.DefaultValue
                         if PcdValue == "":
                             PcdValue  = Pcd.DefaultValue
-                        if Sku.VpdOffset != '*':
+                        if Sku.VpdOffset != TAB_STAR:
                             if PcdValue.startswith("{"):
                                 Alignment = 8
                             elif PcdValue.startswith("L"):
@@ -1462,7 +1462,7 @@ class PlatformAutoGen(AutoGen):
                             VpdFile.Add(Pcd, SkuName, Sku.VpdOffset)
                         SkuValueMap[PcdValue].append(Sku)
                         # if the offset of a VPD is *, then it need to be fixed up by third party tool.
-                        if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
+                        if not NeedProcessVpdMapFile and Sku.VpdOffset == TAB_STAR:
                             NeedProcessVpdMapFile = True
                             if self.Platform.VpdToolGuid is None or self.Platform.VpdToolGuid == '':
                                 EdkLogger.error("Build", FILE_NOT_FOUND, \
@@ -1522,7 +1522,7 @@ class PlatformAutoGen(AutoGen):
                                 PcdValue = Sku.DefaultValue
                                 if PcdValue == "":
                                     PcdValue  = DscPcdEntry.DefaultValue
-                                if Sku.VpdOffset != '*':
+                                if Sku.VpdOffset != TAB_STAR:
                                     if PcdValue.startswith("{"):
                                         Alignment = 8
                                     elif PcdValue.startswith("L"):
@@ -1545,7 +1545,7 @@ class PlatformAutoGen(AutoGen):
                                     SkuValueMap[PcdValue] = []
                                     VpdFile.Add(DscPcdEntry, SkuName, Sku.VpdOffset)
                                 SkuValueMap[PcdValue].append(Sku)
-                                if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
+                                if not NeedProcessVpdMapFile and Sku.VpdOffset == TAB_STAR:
                                     NeedProcessVpdMapFile = True
                             if DscPcdEntry.DatumType == TAB_VOID and PcdValue.startswith("L"):
                                 UnicodePcdArray.add(DscPcdEntry)
@@ -1573,7 +1573,7 @@ class PlatformAutoGen(AutoGen):
                     if os.path.exists(VpdMapFilePath):
                         VpdFile.Read(VpdMapFilePath)
 
-                        # Fixup "*" offset
+                        # Fixup TAB_STAR offset
                         for pcd in VpdSkuMap:
                             vpdinfo = VpdFile.GetVpdInfo(pcd)
                             if vpdinfo is None:
@@ -2210,15 +2210,15 @@ class PlatformAutoGen(AutoGen):
     def CalculatePriorityValue(self, Key):
         Target, ToolChain, Arch, CommandType, Attr = Key.split('_')
         PriorityValue = 0x11111
-        if Target == "*":
+        if Target == TAB_STAR:
             PriorityValue &= 0x01111
-        if ToolChain == "*":
+        if ToolChain == TAB_STAR:
             PriorityValue &= 0x10111
-        if Arch == "*":
+        if Arch == TAB_STAR:
             PriorityValue &= 0x11011
-        if CommandType == "*":
+        if CommandType == TAB_STAR:
             PriorityValue &= 0x11101
-        if Attr == "*":
+        if Attr == TAB_STAR:
             PriorityValue &= 0x11110
 
         return self.PrioList["0x%0.5x" % PriorityValue]
@@ -2253,9 +2253,9 @@ class PlatformAutoGen(AutoGen):
             if (Key[0] == self.BuildRuleFamily and
                 (ModuleStyle is None or len(Key) < 3 or (len(Key) > 2 and Key[2] == ModuleStyle))):
                 Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_')
-                if (Target == self.BuildTarget or Target == "*") and\
-                    (ToolChain == self.ToolChain or ToolChain == "*") and\
-                    (Arch == self.Arch or Arch == "*") and\
+                if (Target == self.BuildTarget or Target == TAB_STAR) and\
+                    (ToolChain == self.ToolChain or ToolChain == TAB_STAR) and\
+                    (Arch == self.Arch or Arch == TAB_STAR) and\
                     Options[Key].startswith("="):
 
                     if OverrideList.get(Key[1]) is not None:
@@ -2276,11 +2276,11 @@ class PlatformAutoGen(AutoGen):
                     # Compare two Key, if one is included by another, choose the higher priority one
                     #
                     Target2, ToolChain2, Arch2, CommandType2, Attr2 = NextKey.split("_")
-                    if (Target1 == Target2 or Target1 == "*" or Target2 == "*") and\
-                        (ToolChain1 == ToolChain2 or ToolChain1 == "*" or ToolChain2 == "*") and\
-                        (Arch1 == Arch2 or Arch1 == "*" or Arch2 == "*") and\
-                        (CommandType1 == CommandType2 or CommandType1 == "*" or CommandType2 == "*") and\
-                        (Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*"):
+                    if (Target1 == Target2 or Target1 == TAB_STAR or Target2 == TAB_STAR) and\
+                        (ToolChain1 == ToolChain2 or ToolChain1 == TAB_STAR or ToolChain2 == TAB_STAR) and\
+                        (Arch1 == Arch2 or Arch1 == TAB_STAR or Arch2 == TAB_STAR) and\
+                        (CommandType1 == CommandType2 or CommandType1 == TAB_STAR or CommandType2 == TAB_STAR) and\
+                        (Attr1 == Attr2 or Attr1 == TAB_STAR or Attr2 == TAB_STAR):
 
                         if self.CalculatePriorityValue(NowKey) > self.CalculatePriorityValue(NextKey):
                             if Options.get((self.BuildRuleFamily, NextKey)) is not None:
@@ -2309,9 +2309,9 @@ class PlatformAutoGen(AutoGen):
                     continue
                 FamilyMatch = True
             # expand any wildcard
-            if Target == "*" or Target == self.BuildTarget:
-                if Tag == "*" or Tag == self.ToolChain:
-                    if Arch == "*" or Arch == self.Arch:
+            if Target == TAB_STAR or Target == self.BuildTarget:
+                if Tag == TAB_STAR or Tag == self.ToolChain:
+                    if Arch == TAB_STAR or Arch == self.Arch:
                         if Tool not in BuildOptions:
                             BuildOptions[Tool] = {}
                         if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
@@ -2344,9 +2344,9 @@ class PlatformAutoGen(AutoGen):
                 continue
 
             # expand any wildcard
-            if Target == "*" or Target == self.BuildTarget:
-                if Tag == "*" or Tag == self.ToolChain:
-                    if Arch == "*" or Arch == self.Arch:
+            if Target == TAB_STAR or Target == self.BuildTarget:
+                if Tag == TAB_STAR or Tag == self.ToolChain:
+                    if Arch == TAB_STAR or Arch == self.Arch:
                         if Tool not in BuildOptions:
                             BuildOptions[Tool] = {}
                         if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
@@ -2971,8 +2971,8 @@ class ModuleAutoGen(AutoGen):
     @cached_property
     def SourceFileList(self):
         RetVal = []
-        ToolChainTagSet = {"", "*", self.ToolChain}
-        ToolChainFamilySet = {"", "*", self.ToolChainFamily, self.BuildRuleFamily}
+        ToolChainTagSet = {"", TAB_STAR, self.ToolChain}
+        ToolChainFamilySet = {"", TAB_STAR, self.ToolChainFamily, self.BuildRuleFamily}
         for F in self.Module.Sources:
             # match tool chain
             if F.TagName not in ToolChainTagSet:
@@ -3047,7 +3047,7 @@ class ModuleAutoGen(AutoGen):
     def BinaryFileList(self):
         RetVal = []
         for F in self.Module.Binaries:
-            if F.Target not in [TAB_ARCH_COMMON, '*'] and F.Target != self.BuildTarget:
+            if F.Target not in [TAB_ARCH_COMMON, TAB_STAR] and F.Target != self.BuildTarget:
                 continue
             RetVal.append(F)
             self._ApplyBuildRule(F, F.Type, BinaryFileList=RetVal)
diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py
index ac7a6687552c..f9e3ac3a1daf 100644
--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
+++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
@@ -110,7 +110,7 @@ class FileBuildRule:
         self.IncListFileMacro = self.INC_LIST_MACRO
 
         self.SourceFileType = Type
-        # source files listed not in "*" or "?" pattern format
+        # source files listed not in TAB_STAR or "?" pattern format
         if not ExtraDependency:
             self.ExtraSourceFileList = []
         else:
@@ -150,12 +150,12 @@ class FileBuildRule:
         self.SourceFileExtList = set()
         for File in Input:
             Base, Ext = os.path.splitext(File)
-            if Base.find("*") >= 0:
-                # There's "*" in the file name
+            if Base.find(TAB_STAR) >= 0:
+                # There's TAB_STAR in the file name
                 self.IsMultipleInput = True
                 self.GenFileListMacro = True
             elif Base.find("?") < 0:
-                # There's no "*" and "?" in file name
+                # There's no TAB_STAR and "?" in file name
                 self.ExtraSourceFileList.append(File)
                 continue
             self.SourceFileExtList.add(Ext)
@@ -553,7 +553,7 @@ class BuildRule:
     #
     #   @param  FileExt             The extension of a file
     #   @param  ToolChainFamily     The tool chain family name
-    #   @param  BuildVersion        The build version number. "*" means any rule
+    #   @param  BuildVersion        The build version number. TAB_STAR means any rule
     #                               is applicalbe.
     #
     #   @retval FileType        The file type string
diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Python/BPDG/GenVpd.py
index d7852d29eed0..e5da47f95e63 100644
--- a/BaseTools/Source/Python/BPDG/GenVpd.py
+++ b/BaseTools/Source/Python/BPDG/GenVpd.py
@@ -21,7 +21,7 @@ import array
 import re
 from Common.LongFilePathSupport import OpenLongFilePath as open
 from struct import *
-from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE
+from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE, TAB_STAR
 import Common.EdkLogger as EdkLogger
 import Common.BuildToolError as BuildToolError
 
@@ -87,7 +87,7 @@ class PcdEntry:
     #  for both hexadecimal and decimal.
     #
     def _GenOffsetValue(self):
-        if self.PcdOffset != "*" :
+        if self.PcdOffset != TAB_STAR:
             try:
                 self.PcdBinOffset = int (self.PcdOffset)
             except:
@@ -423,7 +423,7 @@ class GenVPD :
                     Alignment = 1
 
                 PCD.Alignment = Alignment
-                if PCD.PcdOffset != '*':
+                if PCD.PcdOffset != TAB_STAR:
                     if PCD.PcdOccupySize % Alignment != 0:
                         if PCD.PcdUnpackValue.startswith("{"):
                             EdkLogger.warn("BPDG", "The offset value of PCD %s is not 8-byte aligned!" %(PCD.PcdCName), File=self.InputFileName)
@@ -469,7 +469,7 @@ class GenVPD :
     def FormatFileLine (self) :
 
         for eachPcd in self.FileLinesList :
-            if eachPcd.PcdOffset != '*' :
+            if eachPcd.PcdOffset != TAB_STAR :
                 # Use pcd's Offset value as key, and pcd's Value as value
                 self.PcdFixedOffsetSizeList.append(eachPcd)
             else :
@@ -484,7 +484,7 @@ class GenVPD :
     def FixVpdOffset (self):
         # At first, the offset should start at 0
         # Sort fixed offset list in order to find out where has free spaces for the pcd's offset
-        # value is "*" to insert into.
+        # value is TAB_STAR to insert into.
 
         self.PcdFixedOffsetSizeList.sort(key=lambda x: x.PcdBinOffset)
 
@@ -502,7 +502,7 @@ class GenVPD :
                         self.PcdUnknownOffsetList[index+i -1 ], self.PcdUnknownOffsetList[index+i] = self.PcdUnknownOffsetList[index+i], self.PcdUnknownOffsetList[index+i -1]
 
         #
-        # Process all Offset value are "*"
+        # Process all Offset value are TAB_STAR
         #
         if (len(self.PcdFixedOffsetSizeList) == 0) and (len(self.PcdUnknownOffsetList) != 0) :
             # The offset start from 0
@@ -571,7 +571,7 @@ class GenVPD :
                         eachUnfixedPcd      = self.PcdUnknownOffsetList[countOfUnfixedList]
                         needFixPcdSize      = eachUnfixedPcd.PcdOccupySize
                         # Not been fixed
-                        if eachUnfixedPcd.PcdOffset == '*' :
+                        if eachUnfixedPcd.PcdOffset == TAB_STAR :
                             if LastOffset % eachUnfixedPcd.Alignment != 0:
                                 LastOffset = (LastOffset / eachUnfixedPcd.Alignment + 1) * eachUnfixedPcd.Alignment
                             # The offset un-fixed pcd can write into this free space
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index 1d1d22faa40b..6b375712b65e 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -31,6 +31,7 @@ TAB_OPTION_START = '<'
 TAB_OPTION_END = '>'
 TAB_SLASH = '\\'
 TAB_BACK_SLASH = '/'
+TAB_STAR = '*'
 TAB_LINE_BREAK = '\n'
 TAB_PRINTCHAR_VT = '\x0b'
 TAB_PRINTCHAR_BS = '\b'
diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py
index a21ab5daa73e..db1310d534fb 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -244,7 +244,7 @@ class ValueExpression(BaseExpression):
         'IN' : 'in'
     }
 
-    NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<', '?', ':']
+    NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<', '?', ':']
 
 
     SymbolPattern = re.compile("("
@@ -498,7 +498,7 @@ class ValueExpression(BaseExpression):
 
     # A [ * B]*
     def _MulExpr(self):
-        return self._ExprFuncTemplate(self._UnaryExpr, {"*", "/", "%"})
+        return self._ExprFuncTemplate(self._UnaryExpr, {TAB_STAR, "/", "%"})
 
     # [!]*A
     def _UnaryExpr(self):
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 3b8efb2e7179..61ba79241fb6 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -1088,7 +1088,7 @@ class tdict:
     _ListType = type([])
     _TupleType = type(())
     _Wildcard = 'COMMON'
-    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', '*', 'PLATFORM']
+    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', TAB_STAR, 'PLATFORM']
 
     def __init__(self, _Single_=False, _Level_=2):
         self._Level_ = _Level_
diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py b/BaseTools/Source/Python/Common/ToolDefClassObject.py
index 05a1ddfbcc89..186d279840c1 100644
--- a/BaseTools/Source/Python/Common/ToolDefClassObject.py
+++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py
@@ -29,7 +29,8 @@ from Common import GlobalData
 from Common.MultipleWorkspace import MultipleWorkspace as mws
 from .DataType import TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\
                      TAB_TOD_DEFINES_TARGET_ARCH, TAB_TOD_DEFINES_COMMAND_TYPE\
-                     , TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFAMILY
+                     , TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFAMILY,\
+                     TAB_STAR, TAB_TAT_DEFINES_TOOL_CHAIN_CONF
 
 
 ##
@@ -97,7 +98,7 @@ class ToolDefClassObject(object):
             # adding/removing items from the original dict.
             for Key in list(self.ToolsDefTxtDictionary.keys()):
                 List = Key.split('_')
-                if List[Index] == '*':
+                if List[Index] == TAB_STAR:
                     for String in self.ToolsDefTxtDatabase[KeyList[Index]]:
                         List[Index] = String
                         NewKey = '%s_%s_%s_%s_%s' % tuple(List)
@@ -202,20 +203,20 @@ class ToolDefClassObject(object):
             if len(List) != 5:
                 EdkLogger.verbose("Line %d: Not a valid name of definition: %s" % ((Index + 1), Name))
                 continue
-            elif List[4] == '*':
+            elif List[4] == TAB_STAR:
                 EdkLogger.verbose("Line %d: '*' is not allowed in last field: %s" % ((Index + 1), Name))
                 continue
             else:
                 self.ToolsDefTxtDictionary[Name] = Value
-                if List[0] != '*':
+                if List[0] != TAB_STAR:
                     self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] += [List[0]]
-                if List[1] != '*':
+                if List[1] != TAB_STAR:
                     self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] += [List[1]]
-                if List[2] != '*':
+                if List[2] != TAB_STAR:
                     self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] += [List[2]]
-                if List[3] != '*':
+                if List[3] != TAB_STAR:
                     self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE] += [List[3]]
-                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == '*' and List[3] == '*':
+                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == TAB_STAR and List[3] == TAB_STAR:
                     if TAB_TOD_DEFINES_FAMILY not in self.ToolsDefTxtDatabase:
                         self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = {}
                         self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] = Value
@@ -226,7 +227,7 @@ class ToolDefClassObject(object):
                         self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] = Value
                     elif self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] != Value:
                         EdkLogger.verbose("Line %d: No override allowed for the family of a tool chain: %s" % ((Index + 1), Name))
-                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == '*' and List[3] == '*':
+                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == TAB_STAR and List[3] == TAB_STAR:
                     if TAB_TOD_DEFINES_BUILDRULEFAMILY not in self.ToolsDefTxtDatabase \
                        or List[1] not in self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:
                         EdkLogger.verbose("Line %d: The family is not specified, but BuildRuleFamily is specified for the tool chain: %s" % ((Index + 1), Name))
@@ -270,8 +271,8 @@ class ToolDefClassObject(object):
 def ToolDefDict(ConfDir):
     Target = TargetTxtDict(ConfDir)
     ToolDef = ToolDefClassObject()
-    if DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
-        ToolsDefFile = Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
+    if TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
+        ToolsDefFile = Target.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
         if ToolsDefFile:
             ToolDef.LoadToolDefFile(os.path.normpath(ToolsDefFile))
         else:
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py
index 2fb8e66fe99c..3be0670e36fb 100644
--- a/BaseTools/Source/Python/Common/VpdInfoFile.py
+++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
@@ -57,7 +57,7 @@ FILE_COMMENT_TEMPLATE = \
 #  <PcdName>         ::=  <TokenSpaceCName> "." <PcdCName>
 #  <TokenSpaceCName> ::=  C Variable Name of the Token Space GUID
 #  <PcdCName>        ::=  C Variable Name of the PCD
-#  <Offset>          ::=  {"*"} {<HexNumber>}
+#  <Offset>          ::=  {TAB_STAR} {<HexNumber>}
 #  <HexNumber>       ::=  "0x" (a-fA-F0-9){1,8}
 #  <Size>            ::=  <HexNumber>
 #  <Value>           ::=  {<HexNumber>} {<NonNegativeInt>} {<QString>} {<Array>}
@@ -92,7 +92,7 @@ class VpdInfoFile:
         if (Vpd is None):
             EdkLogger.error("VpdInfoFile", BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
 
-        if not (Offset >= 0 or Offset == "*"):
+        if not (Offset >= 0 or Offset == TAB_STAR):
             EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID, "Invalid offset parameter: %s." % Offset)
 
         if Vpd.DatumType == TAB_VOID:
@@ -186,8 +186,8 @@ class VpdInfoFile:
                         VpdObjectTokenCName = PcdItem[0]
                 for sku in VpdObject.SkuInfoList:
                     if VpdObject.TokenSpaceGuidCName == TokenSpaceName and VpdObjectTokenCName == PcdTokenName.strip() and sku == SkuId:
-                        if self._VpdArray[VpdObject][sku] == "*":
-                            if Offset == "*":
+                        if self._VpdArray[VpdObject][sku] == TAB_STAR:
+                            if Offset == TAB_STAR:
                                 EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed up by third-party BPDG tool." % PcdName)
                             self._VpdArray[VpdObject][sku] = Offset
                         Found = True
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 44cc8f63d07b..cedc4ea0c122 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -64,7 +64,6 @@ T_CHAR_CR = '\r'
 T_CHAR_TAB = '\t'
 T_CHAR_DOUBLE_QUOTE = '\"'
 T_CHAR_SINGLE_QUOTE = '\''
-T_CHAR_STAR = '*'
 T_CHAR_BRACE_R = '}'
 
 SEPARATORS = {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT, TAB_COMMA_SPLIT, '{', T_CHAR_BRACE_R}
@@ -533,7 +532,7 @@ class FdfParser:
                     InComment = False
                     HashComment = False
             # check for */ comment end
-            elif InComment and not DoubleSlashComment and not HashComment and self._CurrentChar() == T_CHAR_STAR and self._NextChar() == TAB_BACK_SLASH:
+            elif InComment and not DoubleSlashComment and not HashComment and self._CurrentChar() == TAB_STAR and self._NextChar() == TAB_BACK_SLASH:
                 self._SetCurrentCharValue(TAB_SPACE_SPLIT)
                 self._GetOneChar()
                 self._SetCurrentCharValue(TAB_SPACE_SPLIT)
@@ -552,7 +551,7 @@ class FdfParser:
                 InComment = True
                 HashComment = True
             # check for /* comment start
-            elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() == T_CHAR_STAR:
+            elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() == TAB_STAR:
                 self._SetCurrentCharValue(TAB_SPACE_SPLIT)
                 self._GetOneChar()
                 self._SetCurrentCharValue(TAB_SPACE_SPLIT)
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index 0c8091b79841..0513f488fca3 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -653,7 +653,7 @@ class GenFds(object):
                             FileGuidList.append(FileStatementGuid)
                         Name = []
                         FfsPath = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
-                        FfsPath = glob(os.path.join(FfsPath, FileStatementGuid) + '*')
+                        FfsPath = glob(os.path.join(FfsPath, FileStatementGuid) + TAB_STAR)
                         if not FfsPath:
                             continue
                         if not os.path.exists(FfsPath[0]):
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index ea61f723a73c..0812c56bdae8 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -217,12 +217,12 @@ class GenFdsGlobalVariable:
 
         if not Inf.IsBinaryModule:
             for File in Inf.Sources:
-                if File.TagName in {"", "*", GenFdsGlobalVariable.ToolChainTag} and \
-                    File.ToolChainFamily in {"", "*", GenFdsGlobalVariable.ToolChainFamily}:
+                if File.TagName in {"", DataType.TAB_STAR, GenFdsGlobalVariable.ToolChainTag} and \
+                    File.ToolChainFamily in {"", DataType.TAB_STAR, GenFdsGlobalVariable.ToolChainFamily}:
                     FileList.append((File, DataType.TAB_UNKNOWN_FILE))
 
         for File in Inf.Binaries:
-            if File.Target in {DataType.TAB_COMMON, '*', GenFdsGlobalVariable.TargetName}:
+            if File.Target in {DataType.TAB_COMMON, DataType.TAB_STAR, GenFdsGlobalVariable.TargetName}:
                 FileList.append((File, File.Type))
 
         for File, FileType in FileList:
@@ -893,7 +893,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
             for Index in range(2, -1, -1):
                 for Key in list(BuildOption.keys()):
                     List = Key.split('_')
-                    if List[Index] == '*':
+                    if List[Index] == DataType.TAB_STAR:
                         for String in ToolDb[ToolList[Index]]:
                             if String in [Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]:
                                 List[Index] = String
diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Section.py
index 19a70009dcce..bab74aedf0b9 100644
--- a/BaseTools/Source/Python/GenFds/Section.py
+++ b/BaseTools/Source/Python/GenFds/Section.py
@@ -131,7 +131,7 @@ class Section (SectionClassObject):
                     if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \
                                                  and FileType == 'DXE_DPEX' and File.Type == BINARY_FILE_TYPE_SMM_DEPEX) \
                                                  or (FileType == BINARY_FILE_TYPE_TE and File.Type == BINARY_FILE_TYPE_PE32):
-                        if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
+                        if TAB_STAR in FfsInf.TargetOverrideList or File.Target == TAB_STAR or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
                             FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type))
                         else:
                             GenFdsGlobalVariable.InfLogger ("\nBuild Target \'%s\' of File %s is not in the Scope of %s specified by INF %s in FDF" %(File.Target, File.File, FfsInf.TargetOverrideList, FfsInf.InfFileName))
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 11aa63fb263c..22cbbb119a5a 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -2315,11 +2315,11 @@ class DscBuildData(PlatformBuildClassObject):
                 continue
             if Attr != "FLAGS":
                 continue
-            if Target == "*" or Target == self._Target:
-                if Tag == "*" or Tag == self._Toolchain:
+            if Target == TAB_STAR or Target == self._Target:
+                if Tag == TAB_STAR or Tag == self._Toolchain:
                     if 'COMMON' not in BuildOptions:
                         BuildOptions['COMMON'] = set()
-                    if Arch == "*":
+                    if Arch == TAB_STAR:
                         BuildOptions['COMMON'].add(self.BuildOptions[Options])
                     if Arch in self.SupArchList:
                         if Arch not in BuildOptions:
-- 
2.16.2.windows.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*'
  2018-11-16 15:40 ` [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*' Jaben Carsey
@ 2018-11-27 18:02   ` Carsey, Jaben
  2018-11-28  7:37   ` Feng, Bob C
  2018-12-03  2:30   ` Zhu, Yonghong
  2 siblings, 0 replies; 8+ messages in thread
From: Carsey, Jaben @ 2018-11-27 18:02 UTC (permalink / raw)
  To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong

Poke.  Any comments on this one?

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Jaben Carsey
> Sent: Friday, November 16, 2018 7:40 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: [edk2] [Patch v1 1/1] BaseTools: create and use a standard shared
> variable for '*'
> Importance: High
> 
> add a variable for the string '*' and then use it instead of lots of '*'
> 
> Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
> ---
>  BaseTools/Source/Python/AutoGen/AutoGen.py             | 54 ++++++++++---
> -------
>  BaseTools/Source/Python/AutoGen/BuildEngine.py         | 10 ++--
>  BaseTools/Source/Python/BPDG/GenVpd.py                 | 14 ++---
>  BaseTools/Source/Python/Common/DataType.py             |  1 +
>  BaseTools/Source/Python/Common/Expression.py           |  4 +-
>  BaseTools/Source/Python/Common/Misc.py                 |  2 +-
>  BaseTools/Source/Python/Common/ToolDefClassObject.py   | 23 +++++----
>  BaseTools/Source/Python/Common/VpdInfoFile.py          |  8 +--
>  BaseTools/Source/Python/GenFds/FdfParser.py            |  5 +-
>  BaseTools/Source/Python/GenFds/GenFds.py               |  2 +-
>  BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py |  8 +--
>  BaseTools/Source/Python/GenFds/Section.py              |  2 +-
>  BaseTools/Source/Python/Workspace/DscBuildData.py      |  6 +--
>  13 files changed, 70 insertions(+), 69 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> b/BaseTools/Source/Python/AutoGen/AutoGen.py
> index f3560bfc787d..25417c447061 100644
> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> @@ -1438,7 +1438,7 @@ class PlatformAutoGen(AutoGen):
>                          PcdValue = Sku.DefaultValue
>                          if PcdValue == "":
>                              PcdValue  = Pcd.DefaultValue
> -                        if Sku.VpdOffset != '*':
> +                        if Sku.VpdOffset != TAB_STAR:
>                              if PcdValue.startswith("{"):
>                                  Alignment = 8
>                              elif PcdValue.startswith("L"):
> @@ -1462,7 +1462,7 @@ class PlatformAutoGen(AutoGen):
>                              VpdFile.Add(Pcd, SkuName, Sku.VpdOffset)
>                          SkuValueMap[PcdValue].append(Sku)
>                          # if the offset of a VPD is *, then it need to be fixed up by third
> party tool.
> -                        if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
> +                        if not NeedProcessVpdMapFile and Sku.VpdOffset ==
> TAB_STAR:
>                              NeedProcessVpdMapFile = True
>                              if self.Platform.VpdToolGuid is None or
> self.Platform.VpdToolGuid == '':
>                                  EdkLogger.error("Build", FILE_NOT_FOUND, \
> @@ -1522,7 +1522,7 @@ class PlatformAutoGen(AutoGen):
>                                  PcdValue = Sku.DefaultValue
>                                  if PcdValue == "":
>                                      PcdValue  = DscPcdEntry.DefaultValue
> -                                if Sku.VpdOffset != '*':
> +                                if Sku.VpdOffset != TAB_STAR:
>                                      if PcdValue.startswith("{"):
>                                          Alignment = 8
>                                      elif PcdValue.startswith("L"):
> @@ -1545,7 +1545,7 @@ class PlatformAutoGen(AutoGen):
>                                      SkuValueMap[PcdValue] = []
>                                      VpdFile.Add(DscPcdEntry, SkuName, Sku.VpdOffset)
>                                  SkuValueMap[PcdValue].append(Sku)
> -                                if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
> +                                if not NeedProcessVpdMapFile and Sku.VpdOffset ==
> TAB_STAR:
>                                      NeedProcessVpdMapFile = True
>                              if DscPcdEntry.DatumType == TAB_VOID and
> PcdValue.startswith("L"):
>                                  UnicodePcdArray.add(DscPcdEntry)
> @@ -1573,7 +1573,7 @@ class PlatformAutoGen(AutoGen):
>                      if os.path.exists(VpdMapFilePath):
>                          VpdFile.Read(VpdMapFilePath)
> 
> -                        # Fixup "*" offset
> +                        # Fixup TAB_STAR offset
>                          for pcd in VpdSkuMap:
>                              vpdinfo = VpdFile.GetVpdInfo(pcd)
>                              if vpdinfo is None:
> @@ -2210,15 +2210,15 @@ class PlatformAutoGen(AutoGen):
>      def CalculatePriorityValue(self, Key):
>          Target, ToolChain, Arch, CommandType, Attr = Key.split('_')
>          PriorityValue = 0x11111
> -        if Target == "*":
> +        if Target == TAB_STAR:
>              PriorityValue &= 0x01111
> -        if ToolChain == "*":
> +        if ToolChain == TAB_STAR:
>              PriorityValue &= 0x10111
> -        if Arch == "*":
> +        if Arch == TAB_STAR:
>              PriorityValue &= 0x11011
> -        if CommandType == "*":
> +        if CommandType == TAB_STAR:
>              PriorityValue &= 0x11101
> -        if Attr == "*":
> +        if Attr == TAB_STAR:
>              PriorityValue &= 0x11110
> 
>          return self.PrioList["0x%0.5x" % PriorityValue]
> @@ -2253,9 +2253,9 @@ class PlatformAutoGen(AutoGen):
>              if (Key[0] == self.BuildRuleFamily and
>                  (ModuleStyle is None or len(Key) < 3 or (len(Key) > 2 and Key[2] ==
> ModuleStyle))):
>                  Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_')
> -                if (Target == self.BuildTarget or Target == "*") and\
> -                    (ToolChain == self.ToolChain or ToolChain == "*") and\
> -                    (Arch == self.Arch or Arch == "*") and\
> +                if (Target == self.BuildTarget or Target == TAB_STAR) and\
> +                    (ToolChain == self.ToolChain or ToolChain == TAB_STAR) and\
> +                    (Arch == self.Arch or Arch == TAB_STAR) and\
>                      Options[Key].startswith("="):
> 
>                      if OverrideList.get(Key[1]) is not None:
> @@ -2276,11 +2276,11 @@ class PlatformAutoGen(AutoGen):
>                      # Compare two Key, if one is included by another, choose the
> higher priority one
>                      #
>                      Target2, ToolChain2, Arch2, CommandType2, Attr2 =
> NextKey.split("_")
> -                    if (Target1 == Target2 or Target1 == "*" or Target2 == "*") and\
> -                        (ToolChain1 == ToolChain2 or ToolChain1 == "*" or ToolChain2
> == "*") and\
> -                        (Arch1 == Arch2 or Arch1 == "*" or Arch2 == "*") and\
> -                        (CommandType1 == CommandType2 or CommandType1 == "*"
> or CommandType2 == "*") and\
> -                        (Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*"):
> +                    if (Target1 == Target2 or Target1 == TAB_STAR or Target2 ==
> TAB_STAR) and\
> +                        (ToolChain1 == ToolChain2 or ToolChain1 == TAB_STAR or
> ToolChain2 == TAB_STAR) and\
> +                        (Arch1 == Arch2 or Arch1 == TAB_STAR or Arch2 == TAB_STAR)
> and\
> +                        (CommandType1 == CommandType2 or CommandType1 ==
> TAB_STAR or CommandType2 == TAB_STAR) and\
> +                        (Attr1 == Attr2 or Attr1 == TAB_STAR or Attr2 == TAB_STAR):
> 
>                          if self.CalculatePriorityValue(NowKey) >
> self.CalculatePriorityValue(NextKey):
>                              if Options.get((self.BuildRuleFamily, NextKey)) is not None:
> @@ -2309,9 +2309,9 @@ class PlatformAutoGen(AutoGen):
>                      continue
>                  FamilyMatch = True
>              # expand any wildcard
> -            if Target == "*" or Target == self.BuildTarget:
> -                if Tag == "*" or Tag == self.ToolChain:
> -                    if Arch == "*" or Arch == self.Arch:
> +            if Target == TAB_STAR or Target == self.BuildTarget:
> +                if Tag == TAB_STAR or Tag == self.ToolChain:
> +                    if Arch == TAB_STAR or Arch == self.Arch:
>                          if Tool not in BuildOptions:
>                              BuildOptions[Tool] = {}
>                          if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or
> Options[Key].startswith('='):
> @@ -2344,9 +2344,9 @@ class PlatformAutoGen(AutoGen):
>                  continue
> 
>              # expand any wildcard
> -            if Target == "*" or Target == self.BuildTarget:
> -                if Tag == "*" or Tag == self.ToolChain:
> -                    if Arch == "*" or Arch == self.Arch:
> +            if Target == TAB_STAR or Target == self.BuildTarget:
> +                if Tag == TAB_STAR or Tag == self.ToolChain:
> +                    if Arch == TAB_STAR or Arch == self.Arch:
>                          if Tool not in BuildOptions:
>                              BuildOptions[Tool] = {}
>                          if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or
> Options[Key].startswith('='):
> @@ -2971,8 +2971,8 @@ class ModuleAutoGen(AutoGen):
>      @cached_property
>      def SourceFileList(self):
>          RetVal = []
> -        ToolChainTagSet = {"", "*", self.ToolChain}
> -        ToolChainFamilySet = {"", "*", self.ToolChainFamily,
> self.BuildRuleFamily}
> +        ToolChainTagSet = {"", TAB_STAR, self.ToolChain}
> +        ToolChainFamilySet = {"", TAB_STAR, self.ToolChainFamily,
> self.BuildRuleFamily}
>          for F in self.Module.Sources:
>              # match tool chain
>              if F.TagName not in ToolChainTagSet:
> @@ -3047,7 +3047,7 @@ class ModuleAutoGen(AutoGen):
>      def BinaryFileList(self):
>          RetVal = []
>          for F in self.Module.Binaries:
> -            if F.Target not in [TAB_ARCH_COMMON, '*'] and F.Target !=
> self.BuildTarget:
> +            if F.Target not in [TAB_ARCH_COMMON, TAB_STAR] and F.Target !=
> self.BuildTarget:
>                  continue
>              RetVal.append(F)
>              self._ApplyBuildRule(F, F.Type, BinaryFileList=RetVal)
> diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py
> b/BaseTools/Source/Python/AutoGen/BuildEngine.py
> index ac7a6687552c..f9e3ac3a1daf 100644
> --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
> +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
> @@ -110,7 +110,7 @@ class FileBuildRule:
>          self.IncListFileMacro = self.INC_LIST_MACRO
> 
>          self.SourceFileType = Type
> -        # source files listed not in "*" or "?" pattern format
> +        # source files listed not in TAB_STAR or "?" pattern format
>          if not ExtraDependency:
>              self.ExtraSourceFileList = []
>          else:
> @@ -150,12 +150,12 @@ class FileBuildRule:
>          self.SourceFileExtList = set()
>          for File in Input:
>              Base, Ext = os.path.splitext(File)
> -            if Base.find("*") >= 0:
> -                # There's "*" in the file name
> +            if Base.find(TAB_STAR) >= 0:
> +                # There's TAB_STAR in the file name
>                  self.IsMultipleInput = True
>                  self.GenFileListMacro = True
>              elif Base.find("?") < 0:
> -                # There's no "*" and "?" in file name
> +                # There's no TAB_STAR and "?" in file name
>                  self.ExtraSourceFileList.append(File)
>                  continue
>              self.SourceFileExtList.add(Ext)
> @@ -553,7 +553,7 @@ class BuildRule:
>      #
>      #   @param  FileExt             The extension of a file
>      #   @param  ToolChainFamily     The tool chain family name
> -    #   @param  BuildVersion        The build version number. "*" means any
> rule
> +    #   @param  BuildVersion        The build version number. TAB_STAR means
> any rule
>      #                               is applicalbe.
>      #
>      #   @retval FileType        The file type string
> diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py
> b/BaseTools/Source/Python/BPDG/GenVpd.py
> index d7852d29eed0..e5da47f95e63 100644
> --- a/BaseTools/Source/Python/BPDG/GenVpd.py
> +++ b/BaseTools/Source/Python/BPDG/GenVpd.py
> @@ -21,7 +21,7 @@ import array
>  import re
>  from Common.LongFilePathSupport import OpenLongFilePath as open
>  from struct import *
> -from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE
> +from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE,
> TAB_STAR
>  import Common.EdkLogger as EdkLogger
>  import Common.BuildToolError as BuildToolError
> 
> @@ -87,7 +87,7 @@ class PcdEntry:
>      #  for both hexadecimal and decimal.
>      #
>      def _GenOffsetValue(self):
> -        if self.PcdOffset != "*" :
> +        if self.PcdOffset != TAB_STAR:
>              try:
>                  self.PcdBinOffset = int (self.PcdOffset)
>              except:
> @@ -423,7 +423,7 @@ class GenVPD :
>                      Alignment = 1
> 
>                  PCD.Alignment = Alignment
> -                if PCD.PcdOffset != '*':
> +                if PCD.PcdOffset != TAB_STAR:
>                      if PCD.PcdOccupySize % Alignment != 0:
>                          if PCD.PcdUnpackValue.startswith("{"):
>                              EdkLogger.warn("BPDG", "The offset value of PCD %s is not 8-
> byte aligned!" %(PCD.PcdCName), File=self.InputFileName)
> @@ -469,7 +469,7 @@ class GenVPD :
>      def FormatFileLine (self) :
> 
>          for eachPcd in self.FileLinesList :
> -            if eachPcd.PcdOffset != '*' :
> +            if eachPcd.PcdOffset != TAB_STAR :
>                  # Use pcd's Offset value as key, and pcd's Value as value
>                  self.PcdFixedOffsetSizeList.append(eachPcd)
>              else :
> @@ -484,7 +484,7 @@ class GenVPD :
>      def FixVpdOffset (self):
>          # At first, the offset should start at 0
>          # Sort fixed offset list in order to find out where has free spaces for the
> pcd's offset
> -        # value is "*" to insert into.
> +        # value is TAB_STAR to insert into.
> 
>          self.PcdFixedOffsetSizeList.sort(key=lambda x: x.PcdBinOffset)
> 
> @@ -502,7 +502,7 @@ class GenVPD :
>                          self.PcdUnknownOffsetList[index+i -1 ],
> self.PcdUnknownOffsetList[index+i] = self.PcdUnknownOffsetList[index+i],
> self.PcdUnknownOffsetList[index+i -1]
> 
>          #
> -        # Process all Offset value are "*"
> +        # Process all Offset value are TAB_STAR
>          #
>          if (len(self.PcdFixedOffsetSizeList) == 0) and
> (len(self.PcdUnknownOffsetList) != 0) :
>              # The offset start from 0
> @@ -571,7 +571,7 @@ class GenVPD :
>                          eachUnfixedPcd      =
> self.PcdUnknownOffsetList[countOfUnfixedList]
>                          needFixPcdSize      = eachUnfixedPcd.PcdOccupySize
>                          # Not been fixed
> -                        if eachUnfixedPcd.PcdOffset == '*' :
> +                        if eachUnfixedPcd.PcdOffset == TAB_STAR :
>                              if LastOffset % eachUnfixedPcd.Alignment != 0:
>                                  LastOffset = (LastOffset / eachUnfixedPcd.Alignment + 1) *
> eachUnfixedPcd.Alignment
>                              # The offset un-fixed pcd can write into this free space
> diff --git a/BaseTools/Source/Python/Common/DataType.py
> b/BaseTools/Source/Python/Common/DataType.py
> index 1d1d22faa40b..6b375712b65e 100644
> --- a/BaseTools/Source/Python/Common/DataType.py
> +++ b/BaseTools/Source/Python/Common/DataType.py
> @@ -31,6 +31,7 @@ TAB_OPTION_START = '<'
>  TAB_OPTION_END = '>'
>  TAB_SLASH = '\\'
>  TAB_BACK_SLASH = '/'
> +TAB_STAR = '*'
>  TAB_LINE_BREAK = '\n'
>  TAB_PRINTCHAR_VT = '\x0b'
>  TAB_PRINTCHAR_BS = '\b'
> diff --git a/BaseTools/Source/Python/Common/Expression.py
> b/BaseTools/Source/Python/Common/Expression.py
> index a21ab5daa73e..db1310d534fb 100644
> --- a/BaseTools/Source/Python/Common/Expression.py
> +++ b/BaseTools/Source/Python/Common/Expression.py
> @@ -244,7 +244,7 @@ class ValueExpression(BaseExpression):
>          'IN' : 'in'
>      }
> 
> -    NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<',
> '?', ':']
> +    NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=',
> '>', '<', '?', ':']
> 
> 
>      SymbolPattern = re.compile("("
> @@ -498,7 +498,7 @@ class ValueExpression(BaseExpression):
> 
>      # A [ * B]*
>      def _MulExpr(self):
> -        return self._ExprFuncTemplate(self._UnaryExpr, {"*", "/", "%"})
> +        return self._ExprFuncTemplate(self._UnaryExpr, {TAB_STAR, "/", "%"})
> 
>      # [!]*A
>      def _UnaryExpr(self):
> diff --git a/BaseTools/Source/Python/Common/Misc.py
> b/BaseTools/Source/Python/Common/Misc.py
> index 3b8efb2e7179..61ba79241fb6 100644
> --- a/BaseTools/Source/Python/Common/Misc.py
> +++ b/BaseTools/Source/Python/Common/Misc.py
> @@ -1088,7 +1088,7 @@ class tdict:
>      _ListType = type([])
>      _TupleType = type(())
>      _Wildcard = 'COMMON'
> -    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', '*', 'PLATFORM']
> +    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', TAB_STAR,
> 'PLATFORM']
> 
>      def __init__(self, _Single_=False, _Level_=2):
>          self._Level_ = _Level_
> diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py
> b/BaseTools/Source/Python/Common/ToolDefClassObject.py
> index 05a1ddfbcc89..186d279840c1 100644
> --- a/BaseTools/Source/Python/Common/ToolDefClassObject.py
> +++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py
> @@ -29,7 +29,8 @@ from Common import GlobalData
>  from Common.MultipleWorkspace import MultipleWorkspace as mws
>  from .DataType import TAB_TOD_DEFINES_TARGET,
> TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\
>                       TAB_TOD_DEFINES_TARGET_ARCH,
> TAB_TOD_DEFINES_COMMAND_TYPE\
> -                     , TAB_TOD_DEFINES_FAMILY,
> TAB_TOD_DEFINES_BUILDRULEFAMILY
> +                     , TAB_TOD_DEFINES_FAMILY,
> TAB_TOD_DEFINES_BUILDRULEFAMILY,\
> +                     TAB_STAR, TAB_TAT_DEFINES_TOOL_CHAIN_CONF
> 
> 
>  ##
> @@ -97,7 +98,7 @@ class ToolDefClassObject(object):
>              # adding/removing items from the original dict.
>              for Key in list(self.ToolsDefTxtDictionary.keys()):
>                  List = Key.split('_')
> -                if List[Index] == '*':
> +                if List[Index] == TAB_STAR:
>                      for String in self.ToolsDefTxtDatabase[KeyList[Index]]:
>                          List[Index] = String
>                          NewKey = '%s_%s_%s_%s_%s' % tuple(List)
> @@ -202,20 +203,20 @@ class ToolDefClassObject(object):
>              if len(List) != 5:
>                  EdkLogger.verbose("Line %d: Not a valid name of definition: %s" %
> ((Index + 1), Name))
>                  continue
> -            elif List[4] == '*':
> +            elif List[4] == TAB_STAR:
>                  EdkLogger.verbose("Line %d: '*' is not allowed in last field: %s" %
> ((Index + 1), Name))
>                  continue
>              else:
>                  self.ToolsDefTxtDictionary[Name] = Value
> -                if List[0] != '*':
> +                if List[0] != TAB_STAR:
>                      self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] +=
> [List[0]]
> -                if List[1] != '*':
> +                if List[1] != TAB_STAR:
>                      self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG]
> += [List[1]]
> -                if List[2] != '*':
> +                if List[2] != TAB_STAR:
>                      self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] +=
> [List[2]]
> -                if List[3] != '*':
> +                if List[3] != TAB_STAR:
>                      self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE]
> += [List[3]]
> -                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == '*' and List[3]
> == '*':
> +                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == TAB_STAR
> and List[3] == TAB_STAR:
>                      if TAB_TOD_DEFINES_FAMILY not in self.ToolsDefTxtDatabase:
>                          self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = {}
>                          self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] =
> Value
> @@ -226,7 +227,7 @@ class ToolDefClassObject(object):
> 
> self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] =
> Value
>                      elif self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]]
> != Value:
>                          EdkLogger.verbose("Line %d: No override allowed for the family
> of a tool chain: %s" % ((Index + 1), Name))
> -                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == '*'
> and List[3] == '*':
> +                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] ==
> TAB_STAR and List[3] == TAB_STAR:
>                      if TAB_TOD_DEFINES_BUILDRULEFAMILY not in
> self.ToolsDefTxtDatabase \
>                         or List[1] not in
> self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:
>                          EdkLogger.verbose("Line %d: The family is not specified, but
> BuildRuleFamily is specified for the tool chain: %s" % ((Index + 1), Name))
> @@ -270,8 +271,8 @@ class ToolDefClassObject(object):
>  def ToolDefDict(ConfDir):
>      Target = TargetTxtDict(ConfDir)
>      ToolDef = ToolDefClassObject()
> -    if DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF in
> Target.TargetTxtDictionary:
> -        ToolsDefFile =
> Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CON
> F]
> +    if TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
> +        ToolsDefFile =
> Target.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
>          if ToolsDefFile:
>              ToolDef.LoadToolDefFile(os.path.normpath(ToolsDefFile))
>          else:
> diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py
> b/BaseTools/Source/Python/Common/VpdInfoFile.py
> index 2fb8e66fe99c..3be0670e36fb 100644
> --- a/BaseTools/Source/Python/Common/VpdInfoFile.py
> +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
> @@ -57,7 +57,7 @@ FILE_COMMENT_TEMPLATE = \
>  #  <PcdName>         ::=  <TokenSpaceCName> "." <PcdCName>
>  #  <TokenSpaceCName> ::=  C Variable Name of the Token Space GUID
>  #  <PcdCName>        ::=  C Variable Name of the PCD
> -#  <Offset>          ::=  {"*"} {<HexNumber>}
> +#  <Offset>          ::=  {TAB_STAR} {<HexNumber>}
>  #  <HexNumber>       ::=  "0x" (a-fA-F0-9){1,8}
>  #  <Size>            ::=  <HexNumber>
>  #  <Value>           ::=  {<HexNumber>} {<NonNegativeInt>} {<QString>}
> {<Array>}
> @@ -92,7 +92,7 @@ class VpdInfoFile:
>          if (Vpd is None):
>              EdkLogger.error("VpdInfoFile",
> BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
> 
> -        if not (Offset >= 0 or Offset == "*"):
> +        if not (Offset >= 0 or Offset == TAB_STAR):
>              EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID,
> "Invalid offset parameter: %s." % Offset)
> 
>          if Vpd.DatumType == TAB_VOID:
> @@ -186,8 +186,8 @@ class VpdInfoFile:
>                          VpdObjectTokenCName = PcdItem[0]
>                  for sku in VpdObject.SkuInfoList:
>                      if VpdObject.TokenSpaceGuidCName == TokenSpaceName and
> VpdObjectTokenCName == PcdTokenName.strip() and sku == SkuId:
> -                        if self._VpdArray[VpdObject][sku] == "*":
> -                            if Offset == "*":
> +                        if self._VpdArray[VpdObject][sku] == TAB_STAR:
> +                            if Offset == TAB_STAR:
>                                  EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
> "The offset of %s has not been fixed up by third-party BPDG tool." %
> PcdName)
>                              self._VpdArray[VpdObject][sku] = Offset
>                          Found = True
> diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
> b/BaseTools/Source/Python/GenFds/FdfParser.py
> index 44cc8f63d07b..cedc4ea0c122 100644
> --- a/BaseTools/Source/Python/GenFds/FdfParser.py
> +++ b/BaseTools/Source/Python/GenFds/FdfParser.py
> @@ -64,7 +64,6 @@ T_CHAR_CR = '\r'
>  T_CHAR_TAB = '\t'
>  T_CHAR_DOUBLE_QUOTE = '\"'
>  T_CHAR_SINGLE_QUOTE = '\''
> -T_CHAR_STAR = '*'
>  T_CHAR_BRACE_R = '}'
> 
>  SEPARATORS = {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT,
> TAB_COMMA_SPLIT, '{', T_CHAR_BRACE_R}
> @@ -533,7 +532,7 @@ class FdfParser:
>                      InComment = False
>                      HashComment = False
>              # check for */ comment end
> -            elif InComment and not DoubleSlashComment and not HashComment
> and self._CurrentChar() == T_CHAR_STAR and self._NextChar() ==
> TAB_BACK_SLASH:
> +            elif InComment and not DoubleSlashComment and not
> HashComment and self._CurrentChar() == TAB_STAR and self._NextChar()
> == TAB_BACK_SLASH:
>                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
>                  self._GetOneChar()
>                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> @@ -552,7 +551,7 @@ class FdfParser:
>                  InComment = True
>                  HashComment = True
>              # check for /* comment start
> -            elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() ==
> T_CHAR_STAR:
> +            elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() ==
> TAB_STAR:
>                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
>                  self._GetOneChar()
>                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> diff --git a/BaseTools/Source/Python/GenFds/GenFds.py
> b/BaseTools/Source/Python/GenFds/GenFds.py
> index 0c8091b79841..0513f488fca3 100644
> --- a/BaseTools/Source/Python/GenFds/GenFds.py
> +++ b/BaseTools/Source/Python/GenFds/GenFds.py
> @@ -653,7 +653,7 @@ class GenFds(object):
>                              FileGuidList.append(FileStatementGuid)
>                          Name = []
>                          FfsPath = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
> -                        FfsPath = glob(os.path.join(FfsPath, FileStatementGuid) + '*')
> +                        FfsPath = glob(os.path.join(FfsPath, FileStatementGuid) +
> TAB_STAR)
>                          if not FfsPath:
>                              continue
>                          if not os.path.exists(FfsPath[0]):
> diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> index ea61f723a73c..0812c56bdae8 100644
> --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> @@ -217,12 +217,12 @@ class GenFdsGlobalVariable:
> 
>          if not Inf.IsBinaryModule:
>              for File in Inf.Sources:
> -                if File.TagName in {"", "*", GenFdsGlobalVariable.ToolChainTag} and
> \
> -                    File.ToolChainFamily in {"", "*",
> GenFdsGlobalVariable.ToolChainFamily}:
> +                if File.TagName in {"", DataType.TAB_STAR,
> GenFdsGlobalVariable.ToolChainTag} and \
> +                    File.ToolChainFamily in {"", DataType.TAB_STAR,
> GenFdsGlobalVariable.ToolChainFamily}:
>                      FileList.append((File, DataType.TAB_UNKNOWN_FILE))
> 
>          for File in Inf.Binaries:
> -            if File.Target in {DataType.TAB_COMMON, '*',
> GenFdsGlobalVariable.TargetName}:
> +            if File.Target in {DataType.TAB_COMMON, DataType.TAB_STAR,
> GenFdsGlobalVariable.TargetName}:
>                  FileList.append((File, File.Type))
> 
>          for File, FileType in FileList:
> @@ -893,7 +893,7 @@ def FindExtendTool(KeyStringList, CurrentArchList,
> NameGuid):
>              for Index in range(2, -1, -1):
>                  for Key in list(BuildOption.keys()):
>                      List = Key.split('_')
> -                    if List[Index] == '*':
> +                    if List[Index] == DataType.TAB_STAR:
>                          for String in ToolDb[ToolList[Index]]:
>                              if String in [Arch, GenFdsGlobalVariable.TargetName,
> GenFdsGlobalVariable.ToolChainTag]:
>                                  List[Index] = String
> diff --git a/BaseTools/Source/Python/GenFds/Section.py
> b/BaseTools/Source/Python/GenFds/Section.py
> index 19a70009dcce..bab74aedf0b9 100644
> --- a/BaseTools/Source/Python/GenFds/Section.py
> +++ b/BaseTools/Source/Python/GenFds/Section.py
> @@ -131,7 +131,7 @@ class Section (SectionClassObject):
>                      if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >=
> 0x0001000A \
>                                                   and FileType == 'DXE_DPEX' and File.Type ==
> BINARY_FILE_TYPE_SMM_DEPEX) \
>                                                   or (FileType == BINARY_FILE_TYPE_TE and File.Type
> == BINARY_FILE_TYPE_PE32):
> -                        if '*' in FfsInf.TargetOverrideList or File.Target == '*' or
> File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
> +                        if TAB_STAR in FfsInf.TargetOverrideList or File.Target ==
> TAB_STAR or File.Target in FfsInf.TargetOverrideList or
> FfsInf.TargetOverrideList == []:
>                              FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type))
>                          else:
>                              GenFdsGlobalVariable.InfLogger ("\nBuild Target \'%s\' of File
> %s is not in the Scope of %s specified by INF %s in FDF" %(File.Target,
> File.File, FfsInf.TargetOverrideList, FfsInf.InfFileName))
> diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index 11aa63fb263c..22cbbb119a5a 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -2315,11 +2315,11 @@ class DscBuildData(PlatformBuildClassObject):
>                  continue
>              if Attr != "FLAGS":
>                  continue
> -            if Target == "*" or Target == self._Target:
> -                if Tag == "*" or Tag == self._Toolchain:
> +            if Target == TAB_STAR or Target == self._Target:
> +                if Tag == TAB_STAR or Tag == self._Toolchain:
>                      if 'COMMON' not in BuildOptions:
>                          BuildOptions['COMMON'] = set()
> -                    if Arch == "*":
> +                    if Arch == TAB_STAR:
>                          BuildOptions['COMMON'].add(self.BuildOptions[Options])
>                      if Arch in self.SupArchList:
>                          if Arch not in BuildOptions:
> --
> 2.16.2.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*'
  2018-11-16 15:40 ` [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*' Jaben Carsey
  2018-11-27 18:02   ` Carsey, Jaben
@ 2018-11-28  7:37   ` Feng, Bob C
  2018-12-03  2:30   ` Zhu, Yonghong
  2 siblings, 0 replies; 8+ messages in thread
From: Feng, Bob C @ 2018-11-28  7:37 UTC (permalink / raw)
  To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming

Reviewed-by : Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jaben Carsey
Sent: Friday, November 16, 2018 11:40 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>
Subject: [edk2] [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*'

add a variable for the string '*' and then use it instead of lots of '*'

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
 BaseTools/Source/Python/AutoGen/AutoGen.py             | 54 ++++++++++----------
 BaseTools/Source/Python/AutoGen/BuildEngine.py         | 10 ++--
 BaseTools/Source/Python/BPDG/GenVpd.py                 | 14 ++---
 BaseTools/Source/Python/Common/DataType.py             |  1 +
 BaseTools/Source/Python/Common/Expression.py           |  4 +-
 BaseTools/Source/Python/Common/Misc.py                 |  2 +-
 BaseTools/Source/Python/Common/ToolDefClassObject.py   | 23 +++++----
 BaseTools/Source/Python/Common/VpdInfoFile.py          |  8 +--
 BaseTools/Source/Python/GenFds/FdfParser.py            |  5 +-
 BaseTools/Source/Python/GenFds/GenFds.py               |  2 +-
 BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py |  8 +--
 BaseTools/Source/Python/GenFds/Section.py              |  2 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py      |  6 +--
 13 files changed, 70 insertions(+), 69 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index f3560bfc787d..25417c447061 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1438,7 +1438,7 @@ class PlatformAutoGen(AutoGen):
                         PcdValue = Sku.DefaultValue
                         if PcdValue == "":
                             PcdValue  = Pcd.DefaultValue
-                        if Sku.VpdOffset != '*':
+                        if Sku.VpdOffset != TAB_STAR:
                             if PcdValue.startswith("{"):
                                 Alignment = 8
                             elif PcdValue.startswith("L"):
@@ -1462,7 +1462,7 @@ class PlatformAutoGen(AutoGen):
                             VpdFile.Add(Pcd, SkuName, Sku.VpdOffset)
                         SkuValueMap[PcdValue].append(Sku)
                         # if the offset of a VPD is *, then it need to be fixed up by third party tool.
-                        if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
+                        if not NeedProcessVpdMapFile and Sku.VpdOffset == TAB_STAR:
                             NeedProcessVpdMapFile = True
                             if self.Platform.VpdToolGuid is None or self.Platform.VpdToolGuid == '':
                                 EdkLogger.error("Build", FILE_NOT_FOUND, \ @@ -1522,7 +1522,7 @@ class PlatformAutoGen(AutoGen):
                                 PcdValue = Sku.DefaultValue
                                 if PcdValue == "":
                                     PcdValue  = DscPcdEntry.DefaultValue
-                                if Sku.VpdOffset != '*':
+                                if Sku.VpdOffset != TAB_STAR:
                                     if PcdValue.startswith("{"):
                                         Alignment = 8
                                     elif PcdValue.startswith("L"):
@@ -1545,7 +1545,7 @@ class PlatformAutoGen(AutoGen):
                                     SkuValueMap[PcdValue] = []
                                     VpdFile.Add(DscPcdEntry, SkuName, Sku.VpdOffset)
                                 SkuValueMap[PcdValue].append(Sku)
-                                if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
+                                if not NeedProcessVpdMapFile and Sku.VpdOffset == TAB_STAR:
                                     NeedProcessVpdMapFile = True
                             if DscPcdEntry.DatumType == TAB_VOID and PcdValue.startswith("L"):
                                 UnicodePcdArray.add(DscPcdEntry) @@ -1573,7 +1573,7 @@ class PlatformAutoGen(AutoGen):
                     if os.path.exists(VpdMapFilePath):
                         VpdFile.Read(VpdMapFilePath)
 
-                        # Fixup "*" offset
+                        # Fixup TAB_STAR offset
                         for pcd in VpdSkuMap:
                             vpdinfo = VpdFile.GetVpdInfo(pcd)
                             if vpdinfo is None:
@@ -2210,15 +2210,15 @@ class PlatformAutoGen(AutoGen):
     def CalculatePriorityValue(self, Key):
         Target, ToolChain, Arch, CommandType, Attr = Key.split('_')
         PriorityValue = 0x11111
-        if Target == "*":
+        if Target == TAB_STAR:
             PriorityValue &= 0x01111
-        if ToolChain == "*":
+        if ToolChain == TAB_STAR:
             PriorityValue &= 0x10111
-        if Arch == "*":
+        if Arch == TAB_STAR:
             PriorityValue &= 0x11011
-        if CommandType == "*":
+        if CommandType == TAB_STAR:
             PriorityValue &= 0x11101
-        if Attr == "*":
+        if Attr == TAB_STAR:
             PriorityValue &= 0x11110
 
         return self.PrioList["0x%0.5x" % PriorityValue] @@ -2253,9 +2253,9 @@ class PlatformAutoGen(AutoGen):
             if (Key[0] == self.BuildRuleFamily and
                 (ModuleStyle is None or len(Key) < 3 or (len(Key) > 2 and Key[2] == ModuleStyle))):
                 Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_')
-                if (Target == self.BuildTarget or Target == "*") and\
-                    (ToolChain == self.ToolChain or ToolChain == "*") and\
-                    (Arch == self.Arch or Arch == "*") and\
+                if (Target == self.BuildTarget or Target == TAB_STAR) and\
+                    (ToolChain == self.ToolChain or ToolChain == TAB_STAR) and\
+                    (Arch == self.Arch or Arch == TAB_STAR) and\
                     Options[Key].startswith("="):
 
                     if OverrideList.get(Key[1]) is not None:
@@ -2276,11 +2276,11 @@ class PlatformAutoGen(AutoGen):
                     # Compare two Key, if one is included by another, choose the higher priority one
                     #
                     Target2, ToolChain2, Arch2, CommandType2, Attr2 = NextKey.split("_")
-                    if (Target1 == Target2 or Target1 == "*" or Target2 == "*") and\
-                        (ToolChain1 == ToolChain2 or ToolChain1 == "*" or ToolChain2 == "*") and\
-                        (Arch1 == Arch2 or Arch1 == "*" or Arch2 == "*") and\
-                        (CommandType1 == CommandType2 or CommandType1 == "*" or CommandType2 == "*") and\
-                        (Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*"):
+                    if (Target1 == Target2 or Target1 == TAB_STAR or Target2 == TAB_STAR) and\
+                        (ToolChain1 == ToolChain2 or ToolChain1 == TAB_STAR or ToolChain2 == TAB_STAR) and\
+                        (Arch1 == Arch2 or Arch1 == TAB_STAR or Arch2 == TAB_STAR) and\
+                        (CommandType1 == CommandType2 or CommandType1 == TAB_STAR or CommandType2 == TAB_STAR) and\
+                        (Attr1 == Attr2 or Attr1 == TAB_STAR or Attr2 == TAB_STAR):
 
                         if self.CalculatePriorityValue(NowKey) > self.CalculatePriorityValue(NextKey):
                             if Options.get((self.BuildRuleFamily, NextKey)) is not None:
@@ -2309,9 +2309,9 @@ class PlatformAutoGen(AutoGen):
                     continue
                 FamilyMatch = True
             # expand any wildcard
-            if Target == "*" or Target == self.BuildTarget:
-                if Tag == "*" or Tag == self.ToolChain:
-                    if Arch == "*" or Arch == self.Arch:
+            if Target == TAB_STAR or Target == self.BuildTarget:
+                if Tag == TAB_STAR or Tag == self.ToolChain:
+                    if Arch == TAB_STAR or Arch == self.Arch:
                         if Tool not in BuildOptions:
                             BuildOptions[Tool] = {}
                         if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
@@ -2344,9 +2344,9 @@ class PlatformAutoGen(AutoGen):
                 continue
 
             # expand any wildcard
-            if Target == "*" or Target == self.BuildTarget:
-                if Tag == "*" or Tag == self.ToolChain:
-                    if Arch == "*" or Arch == self.Arch:
+            if Target == TAB_STAR or Target == self.BuildTarget:
+                if Tag == TAB_STAR or Tag == self.ToolChain:
+                    if Arch == TAB_STAR or Arch == self.Arch:
                         if Tool not in BuildOptions:
                             BuildOptions[Tool] = {}
                         if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
@@ -2971,8 +2971,8 @@ class ModuleAutoGen(AutoGen):
     @cached_property
     def SourceFileList(self):
         RetVal = []
-        ToolChainTagSet = {"", "*", self.ToolChain}
-        ToolChainFamilySet = {"", "*", self.ToolChainFamily, self.BuildRuleFamily}
+        ToolChainTagSet = {"", TAB_STAR, self.ToolChain}
+        ToolChainFamilySet = {"", TAB_STAR, self.ToolChainFamily, 
+ self.BuildRuleFamily}
         for F in self.Module.Sources:
             # match tool chain
             if F.TagName not in ToolChainTagSet:
@@ -3047,7 +3047,7 @@ class ModuleAutoGen(AutoGen):
     def BinaryFileList(self):
         RetVal = []
         for F in self.Module.Binaries:
-            if F.Target not in [TAB_ARCH_COMMON, '*'] and F.Target != self.BuildTarget:
+            if F.Target not in [TAB_ARCH_COMMON, TAB_STAR] and F.Target != self.BuildTarget:
                 continue
             RetVal.append(F)
             self._ApplyBuildRule(F, F.Type, BinaryFileList=RetVal) diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py
index ac7a6687552c..f9e3ac3a1daf 100644
--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
+++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
@@ -110,7 +110,7 @@ class FileBuildRule:
         self.IncListFileMacro = self.INC_LIST_MACRO
 
         self.SourceFileType = Type
-        # source files listed not in "*" or "?" pattern format
+        # source files listed not in TAB_STAR or "?" pattern format
         if not ExtraDependency:
             self.ExtraSourceFileList = []
         else:
@@ -150,12 +150,12 @@ class FileBuildRule:
         self.SourceFileExtList = set()
         for File in Input:
             Base, Ext = os.path.splitext(File)
-            if Base.find("*") >= 0:
-                # There's "*" in the file name
+            if Base.find(TAB_STAR) >= 0:
+                # There's TAB_STAR in the file name
                 self.IsMultipleInput = True
                 self.GenFileListMacro = True
             elif Base.find("?") < 0:
-                # There's no "*" and "?" in file name
+                # There's no TAB_STAR and "?" in file name
                 self.ExtraSourceFileList.append(File)
                 continue
             self.SourceFileExtList.add(Ext) @@ -553,7 +553,7 @@ class BuildRule:
     #
     #   @param  FileExt             The extension of a file
     #   @param  ToolChainFamily     The tool chain family name
-    #   @param  BuildVersion        The build version number. "*" means any rule
+    #   @param  BuildVersion        The build version number. TAB_STAR means any rule
     #                               is applicalbe.
     #
     #   @retval FileType        The file type string
diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Python/BPDG/GenVpd.py
index d7852d29eed0..e5da47f95e63 100644
--- a/BaseTools/Source/Python/BPDG/GenVpd.py
+++ b/BaseTools/Source/Python/BPDG/GenVpd.py
@@ -21,7 +21,7 @@ import array
 import re
 from Common.LongFilePathSupport import OpenLongFilePath as open  from struct import * -from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE
+from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE, TAB_STAR
 import Common.EdkLogger as EdkLogger
 import Common.BuildToolError as BuildToolError
 
@@ -87,7 +87,7 @@ class PcdEntry:
     #  for both hexadecimal and decimal.
     #
     def _GenOffsetValue(self):
-        if self.PcdOffset != "*" :
+        if self.PcdOffset != TAB_STAR:
             try:
                 self.PcdBinOffset = int (self.PcdOffset)
             except:
@@ -423,7 +423,7 @@ class GenVPD :
                     Alignment = 1
 
                 PCD.Alignment = Alignment
-                if PCD.PcdOffset != '*':
+                if PCD.PcdOffset != TAB_STAR:
                     if PCD.PcdOccupySize % Alignment != 0:
                         if PCD.PcdUnpackValue.startswith("{"):
                             EdkLogger.warn("BPDG", "The offset value of PCD %s is not 8-byte aligned!" %(PCD.PcdCName), File=self.InputFileName) @@ -469,7 +469,7 @@ class GenVPD :
     def FormatFileLine (self) :
 
         for eachPcd in self.FileLinesList :
-            if eachPcd.PcdOffset != '*' :
+            if eachPcd.PcdOffset != TAB_STAR :
                 # Use pcd's Offset value as key, and pcd's Value as value
                 self.PcdFixedOffsetSizeList.append(eachPcd)
             else :
@@ -484,7 +484,7 @@ class GenVPD :
     def FixVpdOffset (self):
         # At first, the offset should start at 0
         # Sort fixed offset list in order to find out where has free spaces for the pcd's offset
-        # value is "*" to insert into.
+        # value is TAB_STAR to insert into.
 
         self.PcdFixedOffsetSizeList.sort(key=lambda x: x.PcdBinOffset)
 
@@ -502,7 +502,7 @@ class GenVPD :
                         self.PcdUnknownOffsetList[index+i -1 ], self.PcdUnknownOffsetList[index+i] = self.PcdUnknownOffsetList[index+i], self.PcdUnknownOffsetList[index+i -1]
 
         #
-        # Process all Offset value are "*"
+        # Process all Offset value are TAB_STAR
         #
         if (len(self.PcdFixedOffsetSizeList) == 0) and (len(self.PcdUnknownOffsetList) != 0) :
             # The offset start from 0
@@ -571,7 +571,7 @@ class GenVPD :
                         eachUnfixedPcd      = self.PcdUnknownOffsetList[countOfUnfixedList]
                         needFixPcdSize      = eachUnfixedPcd.PcdOccupySize
                         # Not been fixed
-                        if eachUnfixedPcd.PcdOffset == '*' :
+                        if eachUnfixedPcd.PcdOffset == TAB_STAR :
                             if LastOffset % eachUnfixedPcd.Alignment != 0:
                                 LastOffset = (LastOffset / eachUnfixedPcd.Alignment + 1) * eachUnfixedPcd.Alignment
                             # The offset un-fixed pcd can write into this free space diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index 1d1d22faa40b..6b375712b65e 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -31,6 +31,7 @@ TAB_OPTION_START = '<'
 TAB_OPTION_END = '>'
 TAB_SLASH = '\\'
 TAB_BACK_SLASH = '/'
+TAB_STAR = '*'
 TAB_LINE_BREAK = '\n'
 TAB_PRINTCHAR_VT = '\x0b'
 TAB_PRINTCHAR_BS = '\b'
diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py
index a21ab5daa73e..db1310d534fb 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -244,7 +244,7 @@ class ValueExpression(BaseExpression):
         'IN' : 'in'
     }
 
-    NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<', '?', ':']
+    NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', '~', 
+ '<<', '>>', '!', '=', '>', '<', '?', ':']
 
 
     SymbolPattern = re.compile("("
@@ -498,7 +498,7 @@ class ValueExpression(BaseExpression):
 
     # A [ * B]*
     def _MulExpr(self):
-        return self._ExprFuncTemplate(self._UnaryExpr, {"*", "/", "%"})
+        return self._ExprFuncTemplate(self._UnaryExpr, {TAB_STAR, "/", 
+ "%"})
 
     # [!]*A
     def _UnaryExpr(self):
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 3b8efb2e7179..61ba79241fb6 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -1088,7 +1088,7 @@ class tdict:
     _ListType = type([])
     _TupleType = type(())
     _Wildcard = 'COMMON'
-    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', '*', 'PLATFORM']
+    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', TAB_STAR, 
+ 'PLATFORM']
 
     def __init__(self, _Single_=False, _Level_=2):
         self._Level_ = _Level_
diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py b/BaseTools/Source/Python/Common/ToolDefClassObject.py
index 05a1ddfbcc89..186d279840c1 100644
--- a/BaseTools/Source/Python/Common/ToolDefClassObject.py
+++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py
@@ -29,7 +29,8 @@ from Common import GlobalData  from Common.MultipleWorkspace import MultipleWorkspace as mws  from .DataType import TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\
                      TAB_TOD_DEFINES_TARGET_ARCH, TAB_TOD_DEFINES_COMMAND_TYPE\
-                     , TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFAMILY
+                     , TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFAMILY,\
+                     TAB_STAR, TAB_TAT_DEFINES_TOOL_CHAIN_CONF
 
 
 ##
@@ -97,7 +98,7 @@ class ToolDefClassObject(object):
             # adding/removing items from the original dict.
             for Key in list(self.ToolsDefTxtDictionary.keys()):
                 List = Key.split('_')
-                if List[Index] == '*':
+                if List[Index] == TAB_STAR:
                     for String in self.ToolsDefTxtDatabase[KeyList[Index]]:
                         List[Index] = String
                         NewKey = '%s_%s_%s_%s_%s' % tuple(List) @@ -202,20 +203,20 @@ class ToolDefClassObject(object):
             if len(List) != 5:
                 EdkLogger.verbose("Line %d: Not a valid name of definition: %s" % ((Index + 1), Name))
                 continue
-            elif List[4] == '*':
+            elif List[4] == TAB_STAR:
                 EdkLogger.verbose("Line %d: '*' is not allowed in last field: %s" % ((Index + 1), Name))
                 continue
             else:
                 self.ToolsDefTxtDictionary[Name] = Value
-                if List[0] != '*':
+                if List[0] != TAB_STAR:
                     self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] += [List[0]]
-                if List[1] != '*':
+                if List[1] != TAB_STAR:
                     self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] += [List[1]]
-                if List[2] != '*':
+                if List[2] != TAB_STAR:
                     self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] += [List[2]]
-                if List[3] != '*':
+                if List[3] != TAB_STAR:
                     self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE] += [List[3]]
-                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == '*' and List[3] == '*':
+                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == TAB_STAR and List[3] == TAB_STAR:
                     if TAB_TOD_DEFINES_FAMILY not in self.ToolsDefTxtDatabase:
                         self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = {}
                         self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] = Value @@ -226,7 +227,7 @@ class ToolDefClassObject(object):
                         self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] = Value
                     elif self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] != Value:
                         EdkLogger.verbose("Line %d: No override allowed for the family of a tool chain: %s" % ((Index + 1), Name))
-                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == '*' and List[3] == '*':
+                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == TAB_STAR and List[3] == TAB_STAR:
                     if TAB_TOD_DEFINES_BUILDRULEFAMILY not in self.ToolsDefTxtDatabase \
                        or List[1] not in self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:
                         EdkLogger.verbose("Line %d: The family is not specified, but BuildRuleFamily is specified for the tool chain: %s" % ((Index + 1), Name)) @@ -270,8 +271,8 @@ class ToolDefClassObject(object):
 def ToolDefDict(ConfDir):
     Target = TargetTxtDict(ConfDir)
     ToolDef = ToolDefClassObject()
-    if DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
-        ToolsDefFile = Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
+    if TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
+        ToolsDefFile = 
+ Target.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
         if ToolsDefFile:
             ToolDef.LoadToolDefFile(os.path.normpath(ToolsDefFile))
         else:
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py
index 2fb8e66fe99c..3be0670e36fb 100644
--- a/BaseTools/Source/Python/Common/VpdInfoFile.py
+++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
@@ -57,7 +57,7 @@ FILE_COMMENT_TEMPLATE = \
 #  <PcdName>         ::=  <TokenSpaceCName> "." <PcdCName>
 #  <TokenSpaceCName> ::=  C Variable Name of the Token Space GUID
 #  <PcdCName>        ::=  C Variable Name of the PCD
-#  <Offset>          ::=  {"*"} {<HexNumber>}
+#  <Offset>          ::=  {TAB_STAR} {<HexNumber>}
 #  <HexNumber>       ::=  "0x" (a-fA-F0-9){1,8}
 #  <Size>            ::=  <HexNumber>
 #  <Value>           ::=  {<HexNumber>} {<NonNegativeInt>} {<QString>} {<Array>}
@@ -92,7 +92,7 @@ class VpdInfoFile:
         if (Vpd is None):
             EdkLogger.error("VpdInfoFile", BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
 
-        if not (Offset >= 0 or Offset == "*"):
+        if not (Offset >= 0 or Offset == TAB_STAR):
             EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID, "Invalid offset parameter: %s." % Offset)
 
         if Vpd.DatumType == TAB_VOID:
@@ -186,8 +186,8 @@ class VpdInfoFile:
                         VpdObjectTokenCName = PcdItem[0]
                 for sku in VpdObject.SkuInfoList:
                     if VpdObject.TokenSpaceGuidCName == TokenSpaceName and VpdObjectTokenCName == PcdTokenName.strip() and sku == SkuId:
-                        if self._VpdArray[VpdObject][sku] == "*":
-                            if Offset == "*":
+                        if self._VpdArray[VpdObject][sku] == TAB_STAR:
+                            if Offset == TAB_STAR:
                                 EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed up by third-party BPDG tool." % PcdName)
                             self._VpdArray[VpdObject][sku] = Offset
                         Found = True
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 44cc8f63d07b..cedc4ea0c122 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -64,7 +64,6 @@ T_CHAR_CR = '\r'
 T_CHAR_TAB = '\t'
 T_CHAR_DOUBLE_QUOTE = '\"'
 T_CHAR_SINGLE_QUOTE = '\''
-T_CHAR_STAR = '*'
 T_CHAR_BRACE_R = '}'
 
 SEPARATORS = {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT, TAB_COMMA_SPLIT, '{', T_CHAR_BRACE_R} @@ -533,7 +532,7 @@ class FdfParser:
                     InComment = False
                     HashComment = False
             # check for */ comment end
-            elif InComment and not DoubleSlashComment and not HashComment and self._CurrentChar() == T_CHAR_STAR and self._NextChar() == TAB_BACK_SLASH:
+            elif InComment and not DoubleSlashComment and not HashComment and self._CurrentChar() == TAB_STAR and self._NextChar() == TAB_BACK_SLASH:
                 self._SetCurrentCharValue(TAB_SPACE_SPLIT)
                 self._GetOneChar()
                 self._SetCurrentCharValue(TAB_SPACE_SPLIT)
@@ -552,7 +551,7 @@ class FdfParser:
                 InComment = True
                 HashComment = True
             # check for /* comment start
-            elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() == T_CHAR_STAR:
+            elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() == TAB_STAR:
                 self._SetCurrentCharValue(TAB_SPACE_SPLIT)
                 self._GetOneChar()
                 self._SetCurrentCharValue(TAB_SPACE_SPLIT)
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index 0c8091b79841..0513f488fca3 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -653,7 +653,7 @@ class GenFds(object):
                             FileGuidList.append(FileStatementGuid)
                         Name = []
                         FfsPath = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
-                        FfsPath = glob(os.path.join(FfsPath, FileStatementGuid) + '*')
+                        FfsPath = glob(os.path.join(FfsPath, 
+ FileStatementGuid) + TAB_STAR)
                         if not FfsPath:
                             continue
                         if not os.path.exists(FfsPath[0]):
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index ea61f723a73c..0812c56bdae8 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -217,12 +217,12 @@ class GenFdsGlobalVariable:
 
         if not Inf.IsBinaryModule:
             for File in Inf.Sources:
-                if File.TagName in {"", "*", GenFdsGlobalVariable.ToolChainTag} and \
-                    File.ToolChainFamily in {"", "*", GenFdsGlobalVariable.ToolChainFamily}:
+                if File.TagName in {"", DataType.TAB_STAR, GenFdsGlobalVariable.ToolChainTag} and \
+                    File.ToolChainFamily in {"", DataType.TAB_STAR, GenFdsGlobalVariable.ToolChainFamily}:
                     FileList.append((File, DataType.TAB_UNKNOWN_FILE))
 
         for File in Inf.Binaries:
-            if File.Target in {DataType.TAB_COMMON, '*', GenFdsGlobalVariable.TargetName}:
+            if File.Target in {DataType.TAB_COMMON, DataType.TAB_STAR, GenFdsGlobalVariable.TargetName}:
                 FileList.append((File, File.Type))
 
         for File, FileType in FileList:
@@ -893,7 +893,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
             for Index in range(2, -1, -1):
                 for Key in list(BuildOption.keys()):
                     List = Key.split('_')
-                    if List[Index] == '*':
+                    if List[Index] == DataType.TAB_STAR:
                         for String in ToolDb[ToolList[Index]]:
                             if String in [Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]:
                                 List[Index] = String diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Section.py
index 19a70009dcce..bab74aedf0b9 100644
--- a/BaseTools/Source/Python/GenFds/Section.py
+++ b/BaseTools/Source/Python/GenFds/Section.py
@@ -131,7 +131,7 @@ class Section (SectionClassObject):
                     if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \
                                                  and FileType == 'DXE_DPEX' and File.Type == BINARY_FILE_TYPE_SMM_DEPEX) \
                                                  or (FileType == BINARY_FILE_TYPE_TE and File.Type == BINARY_FILE_TYPE_PE32):
-                        if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
+                        if TAB_STAR in FfsInf.TargetOverrideList or File.Target == TAB_STAR or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
                             FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type))
                         else:
                             GenFdsGlobalVariable.InfLogger ("\nBuild Target \'%s\' of File %s is not in the Scope of %s specified by INF %s in FDF" %(File.Target, File.File, FfsInf.TargetOverrideList, FfsInf.InfFileName)) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 11aa63fb263c..22cbbb119a5a 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -2315,11 +2315,11 @@ class DscBuildData(PlatformBuildClassObject):
                 continue
             if Attr != "FLAGS":
                 continue
-            if Target == "*" or Target == self._Target:
-                if Tag == "*" or Tag == self._Toolchain:
+            if Target == TAB_STAR or Target == self._Target:
+                if Tag == TAB_STAR or Tag == self._Toolchain:
                     if 'COMMON' not in BuildOptions:
                         BuildOptions['COMMON'] = set()
-                    if Arch == "*":
+                    if Arch == TAB_STAR:
                         BuildOptions['COMMON'].add(self.BuildOptions[Options])
                     if Arch in self.SupArchList:
                         if Arch not in BuildOptions:
--
2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*'
  2018-11-16 15:40 ` [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*' Jaben Carsey
  2018-11-27 18:02   ` Carsey, Jaben
  2018-11-28  7:37   ` Feng, Bob C
@ 2018-12-03  2:30   ` Zhu, Yonghong
  2018-12-03 15:19     ` Carsey, Jaben
  2 siblings, 1 reply; 8+ messages in thread
From: Zhu, Yonghong @ 2018-12-03  2:30 UTC (permalink / raw)
  To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong

Hi Jaben,

In this patch, it also changed the mathematics multiplicative '*' (used in expression) to  TAB_STAR, is it by on purpose? 
Eg:
-    NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<', '?', ':']
+    NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<', '?', ':']

Best Regards,
Zhu Yonghong

-----Original Message-----
From: Carsey, Jaben 
Sent: Friday, November 16, 2018 11:40 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*'

add a variable for the string '*' and then use it instead of lots of '*'

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
 BaseTools/Source/Python/AutoGen/AutoGen.py             | 54 ++++++++++----------
 BaseTools/Source/Python/AutoGen/BuildEngine.py         | 10 ++--
 BaseTools/Source/Python/BPDG/GenVpd.py                 | 14 ++---
 BaseTools/Source/Python/Common/DataType.py             |  1 +
 BaseTools/Source/Python/Common/Expression.py           |  4 +-
 BaseTools/Source/Python/Common/Misc.py                 |  2 +-
 BaseTools/Source/Python/Common/ToolDefClassObject.py   | 23 +++++----
 BaseTools/Source/Python/Common/VpdInfoFile.py          |  8 +--
 BaseTools/Source/Python/GenFds/FdfParser.py            |  5 +-
 BaseTools/Source/Python/GenFds/GenFds.py               |  2 +-
 BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py |  8 +--
 BaseTools/Source/Python/GenFds/Section.py              |  2 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py      |  6 +--
 13 files changed, 70 insertions(+), 69 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index f3560bfc787d..25417c447061 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1438,7 +1438,7 @@ class PlatformAutoGen(AutoGen):
                         PcdValue = Sku.DefaultValue
                         if PcdValue == "":
                             PcdValue  = Pcd.DefaultValue
-                        if Sku.VpdOffset != '*':
+                        if Sku.VpdOffset != TAB_STAR:
                             if PcdValue.startswith("{"):
                                 Alignment = 8
                             elif PcdValue.startswith("L"):
@@ -1462,7 +1462,7 @@ class PlatformAutoGen(AutoGen):
                             VpdFile.Add(Pcd, SkuName, Sku.VpdOffset)
                         SkuValueMap[PcdValue].append(Sku)
                         # if the offset of a VPD is *, then it need to be fixed up by third party tool.
-                        if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
+                        if not NeedProcessVpdMapFile and Sku.VpdOffset == TAB_STAR:
                             NeedProcessVpdMapFile = True
                             if self.Platform.VpdToolGuid is None or self.Platform.VpdToolGuid == '':
                                 EdkLogger.error("Build", FILE_NOT_FOUND, \ @@ -1522,7 +1522,7 @@ class PlatformAutoGen(AutoGen):
                                 PcdValue = Sku.DefaultValue
                                 if PcdValue == "":
                                     PcdValue  = DscPcdEntry.DefaultValue
-                                if Sku.VpdOffset != '*':
+                                if Sku.VpdOffset != TAB_STAR:
                                     if PcdValue.startswith("{"):
                                         Alignment = 8
                                     elif PcdValue.startswith("L"):
@@ -1545,7 +1545,7 @@ class PlatformAutoGen(AutoGen):
                                     SkuValueMap[PcdValue] = []
                                     VpdFile.Add(DscPcdEntry, SkuName, Sku.VpdOffset)
                                 SkuValueMap[PcdValue].append(Sku)
-                                if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
+                                if not NeedProcessVpdMapFile and Sku.VpdOffset == TAB_STAR:
                                     NeedProcessVpdMapFile = True
                             if DscPcdEntry.DatumType == TAB_VOID and PcdValue.startswith("L"):
                                 UnicodePcdArray.add(DscPcdEntry) @@ -1573,7 +1573,7 @@ class PlatformAutoGen(AutoGen):
                     if os.path.exists(VpdMapFilePath):
                         VpdFile.Read(VpdMapFilePath)
 
-                        # Fixup "*" offset
+                        # Fixup TAB_STAR offset
                         for pcd in VpdSkuMap:
                             vpdinfo = VpdFile.GetVpdInfo(pcd)
                             if vpdinfo is None:
@@ -2210,15 +2210,15 @@ class PlatformAutoGen(AutoGen):
     def CalculatePriorityValue(self, Key):
         Target, ToolChain, Arch, CommandType, Attr = Key.split('_')
         PriorityValue = 0x11111
-        if Target == "*":
+        if Target == TAB_STAR:
             PriorityValue &= 0x01111
-        if ToolChain == "*":
+        if ToolChain == TAB_STAR:
             PriorityValue &= 0x10111
-        if Arch == "*":
+        if Arch == TAB_STAR:
             PriorityValue &= 0x11011
-        if CommandType == "*":
+        if CommandType == TAB_STAR:
             PriorityValue &= 0x11101
-        if Attr == "*":
+        if Attr == TAB_STAR:
             PriorityValue &= 0x11110
 
         return self.PrioList["0x%0.5x" % PriorityValue] @@ -2253,9 +2253,9 @@ class PlatformAutoGen(AutoGen):
             if (Key[0] == self.BuildRuleFamily and
                 (ModuleStyle is None or len(Key) < 3 or (len(Key) > 2 and Key[2] == ModuleStyle))):
                 Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_')
-                if (Target == self.BuildTarget or Target == "*") and\
-                    (ToolChain == self.ToolChain or ToolChain == "*") and\
-                    (Arch == self.Arch or Arch == "*") and\
+                if (Target == self.BuildTarget or Target == TAB_STAR) and\
+                    (ToolChain == self.ToolChain or ToolChain == TAB_STAR) and\
+                    (Arch == self.Arch or Arch == TAB_STAR) and\
                     Options[Key].startswith("="):
 
                     if OverrideList.get(Key[1]) is not None:
@@ -2276,11 +2276,11 @@ class PlatformAutoGen(AutoGen):
                     # Compare two Key, if one is included by another, choose the higher priority one
                     #
                     Target2, ToolChain2, Arch2, CommandType2, Attr2 = NextKey.split("_")
-                    if (Target1 == Target2 or Target1 == "*" or Target2 == "*") and\
-                        (ToolChain1 == ToolChain2 or ToolChain1 == "*" or ToolChain2 == "*") and\
-                        (Arch1 == Arch2 or Arch1 == "*" or Arch2 == "*") and\
-                        (CommandType1 == CommandType2 or CommandType1 == "*" or CommandType2 == "*") and\
-                        (Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*"):
+                    if (Target1 == Target2 or Target1 == TAB_STAR or Target2 == TAB_STAR) and\
+                        (ToolChain1 == ToolChain2 or ToolChain1 == TAB_STAR or ToolChain2 == TAB_STAR) and\
+                        (Arch1 == Arch2 or Arch1 == TAB_STAR or Arch2 == TAB_STAR) and\
+                        (CommandType1 == CommandType2 or CommandType1 == TAB_STAR or CommandType2 == TAB_STAR) and\
+                        (Attr1 == Attr2 or Attr1 == TAB_STAR or Attr2 == TAB_STAR):
 
                         if self.CalculatePriorityValue(NowKey) > self.CalculatePriorityValue(NextKey):
                             if Options.get((self.BuildRuleFamily, NextKey)) is not None:
@@ -2309,9 +2309,9 @@ class PlatformAutoGen(AutoGen):
                     continue
                 FamilyMatch = True
             # expand any wildcard
-            if Target == "*" or Target == self.BuildTarget:
-                if Tag == "*" or Tag == self.ToolChain:
-                    if Arch == "*" or Arch == self.Arch:
+            if Target == TAB_STAR or Target == self.BuildTarget:
+                if Tag == TAB_STAR or Tag == self.ToolChain:
+                    if Arch == TAB_STAR or Arch == self.Arch:
                         if Tool not in BuildOptions:
                             BuildOptions[Tool] = {}
                         if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
@@ -2344,9 +2344,9 @@ class PlatformAutoGen(AutoGen):
                 continue
 
             # expand any wildcard
-            if Target == "*" or Target == self.BuildTarget:
-                if Tag == "*" or Tag == self.ToolChain:
-                    if Arch == "*" or Arch == self.Arch:
+            if Target == TAB_STAR or Target == self.BuildTarget:
+                if Tag == TAB_STAR or Tag == self.ToolChain:
+                    if Arch == TAB_STAR or Arch == self.Arch:
                         if Tool not in BuildOptions:
                             BuildOptions[Tool] = {}
                         if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
@@ -2971,8 +2971,8 @@ class ModuleAutoGen(AutoGen):
     @cached_property
     def SourceFileList(self):
         RetVal = []
-        ToolChainTagSet = {"", "*", self.ToolChain}
-        ToolChainFamilySet = {"", "*", self.ToolChainFamily, self.BuildRuleFamily}
+        ToolChainTagSet = {"", TAB_STAR, self.ToolChain}
+        ToolChainFamilySet = {"", TAB_STAR, self.ToolChainFamily, 
+ self.BuildRuleFamily}
         for F in self.Module.Sources:
             # match tool chain
             if F.TagName not in ToolChainTagSet:
@@ -3047,7 +3047,7 @@ class ModuleAutoGen(AutoGen):
     def BinaryFileList(self):
         RetVal = []
         for F in self.Module.Binaries:
-            if F.Target not in [TAB_ARCH_COMMON, '*'] and F.Target != self.BuildTarget:
+            if F.Target not in [TAB_ARCH_COMMON, TAB_STAR] and F.Target != self.BuildTarget:
                 continue
             RetVal.append(F)
             self._ApplyBuildRule(F, F.Type, BinaryFileList=RetVal) diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py
index ac7a6687552c..f9e3ac3a1daf 100644
--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
+++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
@@ -110,7 +110,7 @@ class FileBuildRule:
         self.IncListFileMacro = self.INC_LIST_MACRO
 
         self.SourceFileType = Type
-        # source files listed not in "*" or "?" pattern format
+        # source files listed not in TAB_STAR or "?" pattern format
         if not ExtraDependency:
             self.ExtraSourceFileList = []
         else:
@@ -150,12 +150,12 @@ class FileBuildRule:
         self.SourceFileExtList = set()
         for File in Input:
             Base, Ext = os.path.splitext(File)
-            if Base.find("*") >= 0:
-                # There's "*" in the file name
+            if Base.find(TAB_STAR) >= 0:
+                # There's TAB_STAR in the file name
                 self.IsMultipleInput = True
                 self.GenFileListMacro = True
             elif Base.find("?") < 0:
-                # There's no "*" and "?" in file name
+                # There's no TAB_STAR and "?" in file name
                 self.ExtraSourceFileList.append(File)
                 continue
             self.SourceFileExtList.add(Ext) @@ -553,7 +553,7 @@ class BuildRule:
     #
     #   @param  FileExt             The extension of a file
     #   @param  ToolChainFamily     The tool chain family name
-    #   @param  BuildVersion        The build version number. "*" means any rule
+    #   @param  BuildVersion        The build version number. TAB_STAR means any rule
     #                               is applicalbe.
     #
     #   @retval FileType        The file type string
diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Python/BPDG/GenVpd.py
index d7852d29eed0..e5da47f95e63 100644
--- a/BaseTools/Source/Python/BPDG/GenVpd.py
+++ b/BaseTools/Source/Python/BPDG/GenVpd.py
@@ -21,7 +21,7 @@ import array
 import re
 from Common.LongFilePathSupport import OpenLongFilePath as open  from struct import * -from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE
+from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE, TAB_STAR
 import Common.EdkLogger as EdkLogger
 import Common.BuildToolError as BuildToolError
 
@@ -87,7 +87,7 @@ class PcdEntry:
     #  for both hexadecimal and decimal.
     #
     def _GenOffsetValue(self):
-        if self.PcdOffset != "*" :
+        if self.PcdOffset != TAB_STAR:
             try:
                 self.PcdBinOffset = int (self.PcdOffset)
             except:
@@ -423,7 +423,7 @@ class GenVPD :
                     Alignment = 1
 
                 PCD.Alignment = Alignment
-                if PCD.PcdOffset != '*':
+                if PCD.PcdOffset != TAB_STAR:
                     if PCD.PcdOccupySize % Alignment != 0:
                         if PCD.PcdUnpackValue.startswith("{"):
                             EdkLogger.warn("BPDG", "The offset value of PCD %s is not 8-byte aligned!" %(PCD.PcdCName), File=self.InputFileName) @@ -469,7 +469,7 @@ class GenVPD :
     def FormatFileLine (self) :
 
         for eachPcd in self.FileLinesList :
-            if eachPcd.PcdOffset != '*' :
+            if eachPcd.PcdOffset != TAB_STAR :
                 # Use pcd's Offset value as key, and pcd's Value as value
                 self.PcdFixedOffsetSizeList.append(eachPcd)
             else :
@@ -484,7 +484,7 @@ class GenVPD :
     def FixVpdOffset (self):
         # At first, the offset should start at 0
         # Sort fixed offset list in order to find out where has free spaces for the pcd's offset
-        # value is "*" to insert into.
+        # value is TAB_STAR to insert into.
 
         self.PcdFixedOffsetSizeList.sort(key=lambda x: x.PcdBinOffset)
 
@@ -502,7 +502,7 @@ class GenVPD :
                         self.PcdUnknownOffsetList[index+i -1 ], self.PcdUnknownOffsetList[index+i] = self.PcdUnknownOffsetList[index+i], self.PcdUnknownOffsetList[index+i -1]
 
         #
-        # Process all Offset value are "*"
+        # Process all Offset value are TAB_STAR
         #
         if (len(self.PcdFixedOffsetSizeList) == 0) and (len(self.PcdUnknownOffsetList) != 0) :
             # The offset start from 0
@@ -571,7 +571,7 @@ class GenVPD :
                         eachUnfixedPcd      = self.PcdUnknownOffsetList[countOfUnfixedList]
                         needFixPcdSize      = eachUnfixedPcd.PcdOccupySize
                         # Not been fixed
-                        if eachUnfixedPcd.PcdOffset == '*' :
+                        if eachUnfixedPcd.PcdOffset == TAB_STAR :
                             if LastOffset % eachUnfixedPcd.Alignment != 0:
                                 LastOffset = (LastOffset / eachUnfixedPcd.Alignment + 1) * eachUnfixedPcd.Alignment
                             # The offset un-fixed pcd can write into this free space diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index 1d1d22faa40b..6b375712b65e 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -31,6 +31,7 @@ TAB_OPTION_START = '<'
 TAB_OPTION_END = '>'
 TAB_SLASH = '\\'
 TAB_BACK_SLASH = '/'
+TAB_STAR = '*'
 TAB_LINE_BREAK = '\n'
 TAB_PRINTCHAR_VT = '\x0b'
 TAB_PRINTCHAR_BS = '\b'
diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py
index a21ab5daa73e..db1310d534fb 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -244,7 +244,7 @@ class ValueExpression(BaseExpression):
         'IN' : 'in'
     }
 
-    NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<', '?', ':']
+    NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', '~', 
+ '<<', '>>', '!', '=', '>', '<', '?', ':']
 
 
     SymbolPattern = re.compile("("
@@ -498,7 +498,7 @@ class ValueExpression(BaseExpression):
 
     # A [ * B]*
     def _MulExpr(self):
-        return self._ExprFuncTemplate(self._UnaryExpr, {"*", "/", "%"})
+        return self._ExprFuncTemplate(self._UnaryExpr, {TAB_STAR, "/", 
+ "%"})
 
     # [!]*A
     def _UnaryExpr(self):
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 3b8efb2e7179..61ba79241fb6 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -1088,7 +1088,7 @@ class tdict:
     _ListType = type([])
     _TupleType = type(())
     _Wildcard = 'COMMON'
-    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', '*', 'PLATFORM']
+    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', TAB_STAR, 
+ 'PLATFORM']
 
     def __init__(self, _Single_=False, _Level_=2):
         self._Level_ = _Level_
diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py b/BaseTools/Source/Python/Common/ToolDefClassObject.py
index 05a1ddfbcc89..186d279840c1 100644
--- a/BaseTools/Source/Python/Common/ToolDefClassObject.py
+++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py
@@ -29,7 +29,8 @@ from Common import GlobalData  from Common.MultipleWorkspace import MultipleWorkspace as mws  from .DataType import TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\
                      TAB_TOD_DEFINES_TARGET_ARCH, TAB_TOD_DEFINES_COMMAND_TYPE\
-                     , TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFAMILY
+                     , TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFAMILY,\
+                     TAB_STAR, TAB_TAT_DEFINES_TOOL_CHAIN_CONF
 
 
 ##
@@ -97,7 +98,7 @@ class ToolDefClassObject(object):
             # adding/removing items from the original dict.
             for Key in list(self.ToolsDefTxtDictionary.keys()):
                 List = Key.split('_')
-                if List[Index] == '*':
+                if List[Index] == TAB_STAR:
                     for String in self.ToolsDefTxtDatabase[KeyList[Index]]:
                         List[Index] = String
                         NewKey = '%s_%s_%s_%s_%s' % tuple(List) @@ -202,20 +203,20 @@ class ToolDefClassObject(object):
             if len(List) != 5:
                 EdkLogger.verbose("Line %d: Not a valid name of definition: %s" % ((Index + 1), Name))
                 continue
-            elif List[4] == '*':
+            elif List[4] == TAB_STAR:
                 EdkLogger.verbose("Line %d: '*' is not allowed in last field: %s" % ((Index + 1), Name))
                 continue
             else:
                 self.ToolsDefTxtDictionary[Name] = Value
-                if List[0] != '*':
+                if List[0] != TAB_STAR:
                     self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] += [List[0]]
-                if List[1] != '*':
+                if List[1] != TAB_STAR:
                     self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] += [List[1]]
-                if List[2] != '*':
+                if List[2] != TAB_STAR:
                     self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] += [List[2]]
-                if List[3] != '*':
+                if List[3] != TAB_STAR:
                     self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE] += [List[3]]
-                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == '*' and List[3] == '*':
+                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == TAB_STAR and List[3] == TAB_STAR:
                     if TAB_TOD_DEFINES_FAMILY not in self.ToolsDefTxtDatabase:
                         self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = {}
                         self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] = Value @@ -226,7 +227,7 @@ class ToolDefClassObject(object):
                         self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] = Value
                     elif self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] != Value:
                         EdkLogger.verbose("Line %d: No override allowed for the family of a tool chain: %s" % ((Index + 1), Name))
-                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == '*' and List[3] == '*':
+                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == TAB_STAR and List[3] == TAB_STAR:
                     if TAB_TOD_DEFINES_BUILDRULEFAMILY not in self.ToolsDefTxtDatabase \
                        or List[1] not in self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:
                         EdkLogger.verbose("Line %d: The family is not specified, but BuildRuleFamily is specified for the tool chain: %s" % ((Index + 1), Name)) @@ -270,8 +271,8 @@ class ToolDefClassObject(object):
 def ToolDefDict(ConfDir):
     Target = TargetTxtDict(ConfDir)
     ToolDef = ToolDefClassObject()
-    if DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
-        ToolsDefFile = Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
+    if TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
+        ToolsDefFile = 
+ Target.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
         if ToolsDefFile:
             ToolDef.LoadToolDefFile(os.path.normpath(ToolsDefFile))
         else:
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py
index 2fb8e66fe99c..3be0670e36fb 100644
--- a/BaseTools/Source/Python/Common/VpdInfoFile.py
+++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
@@ -57,7 +57,7 @@ FILE_COMMENT_TEMPLATE = \
 #  <PcdName>         ::=  <TokenSpaceCName> "." <PcdCName>
 #  <TokenSpaceCName> ::=  C Variable Name of the Token Space GUID
 #  <PcdCName>        ::=  C Variable Name of the PCD
-#  <Offset>          ::=  {"*"} {<HexNumber>}
+#  <Offset>          ::=  {TAB_STAR} {<HexNumber>}
 #  <HexNumber>       ::=  "0x" (a-fA-F0-9){1,8}
 #  <Size>            ::=  <HexNumber>
 #  <Value>           ::=  {<HexNumber>} {<NonNegativeInt>} {<QString>} {<Array>}
@@ -92,7 +92,7 @@ class VpdInfoFile:
         if (Vpd is None):
             EdkLogger.error("VpdInfoFile", BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
 
-        if not (Offset >= 0 or Offset == "*"):
+        if not (Offset >= 0 or Offset == TAB_STAR):
             EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID, "Invalid offset parameter: %s." % Offset)
 
         if Vpd.DatumType == TAB_VOID:
@@ -186,8 +186,8 @@ class VpdInfoFile:
                         VpdObjectTokenCName = PcdItem[0]
                 for sku in VpdObject.SkuInfoList:
                     if VpdObject.TokenSpaceGuidCName == TokenSpaceName and VpdObjectTokenCName == PcdTokenName.strip() and sku == SkuId:
-                        if self._VpdArray[VpdObject][sku] == "*":
-                            if Offset == "*":
+                        if self._VpdArray[VpdObject][sku] == TAB_STAR:
+                            if Offset == TAB_STAR:
                                 EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed up by third-party BPDG tool." % PcdName)
                             self._VpdArray[VpdObject][sku] = Offset
                         Found = True
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 44cc8f63d07b..cedc4ea0c122 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -64,7 +64,6 @@ T_CHAR_CR = '\r'
 T_CHAR_TAB = '\t'
 T_CHAR_DOUBLE_QUOTE = '\"'
 T_CHAR_SINGLE_QUOTE = '\''
-T_CHAR_STAR = '*'
 T_CHAR_BRACE_R = '}'
 
 SEPARATORS = {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT, TAB_COMMA_SPLIT, '{', T_CHAR_BRACE_R} @@ -533,7 +532,7 @@ class FdfParser:
                     InComment = False
                     HashComment = False
             # check for */ comment end
-            elif InComment and not DoubleSlashComment and not HashComment and self._CurrentChar() == T_CHAR_STAR and self._NextChar() == TAB_BACK_SLASH:
+            elif InComment and not DoubleSlashComment and not HashComment and self._CurrentChar() == TAB_STAR and self._NextChar() == TAB_BACK_SLASH:
                 self._SetCurrentCharValue(TAB_SPACE_SPLIT)
                 self._GetOneChar()
                 self._SetCurrentCharValue(TAB_SPACE_SPLIT)
@@ -552,7 +551,7 @@ class FdfParser:
                 InComment = True
                 HashComment = True
             # check for /* comment start
-            elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() == T_CHAR_STAR:
+            elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() == TAB_STAR:
                 self._SetCurrentCharValue(TAB_SPACE_SPLIT)
                 self._GetOneChar()
                 self._SetCurrentCharValue(TAB_SPACE_SPLIT)
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index 0c8091b79841..0513f488fca3 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -653,7 +653,7 @@ class GenFds(object):
                             FileGuidList.append(FileStatementGuid)
                         Name = []
                         FfsPath = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
-                        FfsPath = glob(os.path.join(FfsPath, FileStatementGuid) + '*')
+                        FfsPath = glob(os.path.join(FfsPath, 
+ FileStatementGuid) + TAB_STAR)
                         if not FfsPath:
                             continue
                         if not os.path.exists(FfsPath[0]):
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index ea61f723a73c..0812c56bdae8 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -217,12 +217,12 @@ class GenFdsGlobalVariable:
 
         if not Inf.IsBinaryModule:
             for File in Inf.Sources:
-                if File.TagName in {"", "*", GenFdsGlobalVariable.ToolChainTag} and \
-                    File.ToolChainFamily in {"", "*", GenFdsGlobalVariable.ToolChainFamily}:
+                if File.TagName in {"", DataType.TAB_STAR, GenFdsGlobalVariable.ToolChainTag} and \
+                    File.ToolChainFamily in {"", DataType.TAB_STAR, GenFdsGlobalVariable.ToolChainFamily}:
                     FileList.append((File, DataType.TAB_UNKNOWN_FILE))
 
         for File in Inf.Binaries:
-            if File.Target in {DataType.TAB_COMMON, '*', GenFdsGlobalVariable.TargetName}:
+            if File.Target in {DataType.TAB_COMMON, DataType.TAB_STAR, GenFdsGlobalVariable.TargetName}:
                 FileList.append((File, File.Type))
 
         for File, FileType in FileList:
@@ -893,7 +893,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
             for Index in range(2, -1, -1):
                 for Key in list(BuildOption.keys()):
                     List = Key.split('_')
-                    if List[Index] == '*':
+                    if List[Index] == DataType.TAB_STAR:
                         for String in ToolDb[ToolList[Index]]:
                             if String in [Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]:
                                 List[Index] = String diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Section.py
index 19a70009dcce..bab74aedf0b9 100644
--- a/BaseTools/Source/Python/GenFds/Section.py
+++ b/BaseTools/Source/Python/GenFds/Section.py
@@ -131,7 +131,7 @@ class Section (SectionClassObject):
                     if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \
                                                  and FileType == 'DXE_DPEX' and File.Type == BINARY_FILE_TYPE_SMM_DEPEX) \
                                                  or (FileType == BINARY_FILE_TYPE_TE and File.Type == BINARY_FILE_TYPE_PE32):
-                        if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
+                        if TAB_STAR in FfsInf.TargetOverrideList or File.Target == TAB_STAR or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
                             FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type))
                         else:
                             GenFdsGlobalVariable.InfLogger ("\nBuild Target \'%s\' of File %s is not in the Scope of %s specified by INF %s in FDF" %(File.Target, File.File, FfsInf.TargetOverrideList, FfsInf.InfFileName)) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 11aa63fb263c..22cbbb119a5a 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -2315,11 +2315,11 @@ class DscBuildData(PlatformBuildClassObject):
                 continue
             if Attr != "FLAGS":
                 continue
-            if Target == "*" or Target == self._Target:
-                if Tag == "*" or Tag == self._Toolchain:
+            if Target == TAB_STAR or Target == self._Target:
+                if Tag == TAB_STAR or Tag == self._Toolchain:
                     if 'COMMON' not in BuildOptions:
                         BuildOptions['COMMON'] = set()
-                    if Arch == "*":
+                    if Arch == TAB_STAR:
                         BuildOptions['COMMON'].add(self.BuildOptions[Options])
                     if Arch in self.SupArchList:
                         if Arch not in BuildOptions:
--
2.16.2.windows.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*'
  2018-12-03  2:30   ` Zhu, Yonghong
@ 2018-12-03 15:19     ` Carsey, Jaben
  2018-12-04  1:52       ` Zhu, Yonghong
  0 siblings, 1 reply; 8+ messages in thread
From: Carsey, Jaben @ 2018-12-03 15:19 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org; +Cc: Gao, Liming

I was trying to change all use of *, without regard to the usage of it.

Do you think that mathematical * should not be changed?

-Jaben

> -----Original Message-----
> From: Zhu, Yonghong
> Sent: Sunday, December 02, 2018 6:31 PM
> To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong
> <yonghong.zhu@intel.com>
> Subject: RE: [Patch v1 1/1] BaseTools: create and use a standard shared
> variable for '*'
> Importance: High
> 
> Hi Jaben,
> 
> In this patch, it also changed the mathematics multiplicative '*' (used in
> expression) to  TAB_STAR, is it by on purpose?
> Eg:
> -    NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<',
> '?', ':']
> +    NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=',
> '>', '<', '?', ':']
> 
> Best Regards,
> Zhu Yonghong
> 
> -----Original Message-----
> From: Carsey, Jaben
> Sent: Friday, November 16, 2018 11:40 PM
> To: edk2-devel@lists.01.org
> Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming
> <liming.gao@intel.com>
> Subject: [Patch v1 1/1] BaseTools: create and use a standard shared variable
> for '*'
> 
> add a variable for the string '*' and then use it instead of lots of '*'
> 
> Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
> ---
>  BaseTools/Source/Python/AutoGen/AutoGen.py             | 54 ++++++++++---
> -------
>  BaseTools/Source/Python/AutoGen/BuildEngine.py         | 10 ++--
>  BaseTools/Source/Python/BPDG/GenVpd.py                 | 14 ++---
>  BaseTools/Source/Python/Common/DataType.py             |  1 +
>  BaseTools/Source/Python/Common/Expression.py           |  4 +-
>  BaseTools/Source/Python/Common/Misc.py                 |  2 +-
>  BaseTools/Source/Python/Common/ToolDefClassObject.py   | 23 +++++----
>  BaseTools/Source/Python/Common/VpdInfoFile.py          |  8 +--
>  BaseTools/Source/Python/GenFds/FdfParser.py            |  5 +-
>  BaseTools/Source/Python/GenFds/GenFds.py               |  2 +-
>  BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py |  8 +--
>  BaseTools/Source/Python/GenFds/Section.py              |  2 +-
>  BaseTools/Source/Python/Workspace/DscBuildData.py      |  6 +--
>  13 files changed, 70 insertions(+), 69 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> b/BaseTools/Source/Python/AutoGen/AutoGen.py
> index f3560bfc787d..25417c447061 100644
> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> @@ -1438,7 +1438,7 @@ class PlatformAutoGen(AutoGen):
>                          PcdValue = Sku.DefaultValue
>                          if PcdValue == "":
>                              PcdValue  = Pcd.DefaultValue
> -                        if Sku.VpdOffset != '*':
> +                        if Sku.VpdOffset != TAB_STAR:
>                              if PcdValue.startswith("{"):
>                                  Alignment = 8
>                              elif PcdValue.startswith("L"):
> @@ -1462,7 +1462,7 @@ class PlatformAutoGen(AutoGen):
>                              VpdFile.Add(Pcd, SkuName, Sku.VpdOffset)
>                          SkuValueMap[PcdValue].append(Sku)
>                          # if the offset of a VPD is *, then it need to be fixed up by third
> party tool.
> -                        if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
> +                        if not NeedProcessVpdMapFile and Sku.VpdOffset ==
> TAB_STAR:
>                              NeedProcessVpdMapFile = True
>                              if self.Platform.VpdToolGuid is None or
> self.Platform.VpdToolGuid == '':
>                                  EdkLogger.error("Build", FILE_NOT_FOUND, \ @@ -1522,7
> +1522,7 @@ class PlatformAutoGen(AutoGen):
>                                  PcdValue = Sku.DefaultValue
>                                  if PcdValue == "":
>                                      PcdValue  = DscPcdEntry.DefaultValue
> -                                if Sku.VpdOffset != '*':
> +                                if Sku.VpdOffset != TAB_STAR:
>                                      if PcdValue.startswith("{"):
>                                          Alignment = 8
>                                      elif PcdValue.startswith("L"):
> @@ -1545,7 +1545,7 @@ class PlatformAutoGen(AutoGen):
>                                      SkuValueMap[PcdValue] = []
>                                      VpdFile.Add(DscPcdEntry, SkuName, Sku.VpdOffset)
>                                  SkuValueMap[PcdValue].append(Sku)
> -                                if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
> +                                if not NeedProcessVpdMapFile and Sku.VpdOffset ==
> TAB_STAR:
>                                      NeedProcessVpdMapFile = True
>                              if DscPcdEntry.DatumType == TAB_VOID and
> PcdValue.startswith("L"):
>                                  UnicodePcdArray.add(DscPcdEntry) @@ -1573,7 +1573,7
> @@ class PlatformAutoGen(AutoGen):
>                      if os.path.exists(VpdMapFilePath):
>                          VpdFile.Read(VpdMapFilePath)
> 
> -                        # Fixup "*" offset
> +                        # Fixup TAB_STAR offset
>                          for pcd in VpdSkuMap:
>                              vpdinfo = VpdFile.GetVpdInfo(pcd)
>                              if vpdinfo is None:
> @@ -2210,15 +2210,15 @@ class PlatformAutoGen(AutoGen):
>      def CalculatePriorityValue(self, Key):
>          Target, ToolChain, Arch, CommandType, Attr = Key.split('_')
>          PriorityValue = 0x11111
> -        if Target == "*":
> +        if Target == TAB_STAR:
>              PriorityValue &= 0x01111
> -        if ToolChain == "*":
> +        if ToolChain == TAB_STAR:
>              PriorityValue &= 0x10111
> -        if Arch == "*":
> +        if Arch == TAB_STAR:
>              PriorityValue &= 0x11011
> -        if CommandType == "*":
> +        if CommandType == TAB_STAR:
>              PriorityValue &= 0x11101
> -        if Attr == "*":
> +        if Attr == TAB_STAR:
>              PriorityValue &= 0x11110
> 
>          return self.PrioList["0x%0.5x" % PriorityValue] @@ -2253,9 +2253,9 @@
> class PlatformAutoGen(AutoGen):
>              if (Key[0] == self.BuildRuleFamily and
>                  (ModuleStyle is None or len(Key) < 3 or (len(Key) > 2 and Key[2] ==
> ModuleStyle))):
>                  Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_')
> -                if (Target == self.BuildTarget or Target == "*") and\
> -                    (ToolChain == self.ToolChain or ToolChain == "*") and\
> -                    (Arch == self.Arch or Arch == "*") and\
> +                if (Target == self.BuildTarget or Target == TAB_STAR) and\
> +                    (ToolChain == self.ToolChain or ToolChain == TAB_STAR) and\
> +                    (Arch == self.Arch or Arch == TAB_STAR) and\
>                      Options[Key].startswith("="):
> 
>                      if OverrideList.get(Key[1]) is not None:
> @@ -2276,11 +2276,11 @@ class PlatformAutoGen(AutoGen):
>                      # Compare two Key, if one is included by another, choose the
> higher priority one
>                      #
>                      Target2, ToolChain2, Arch2, CommandType2, Attr2 =
> NextKey.split("_")
> -                    if (Target1 == Target2 or Target1 == "*" or Target2 == "*") and\
> -                        (ToolChain1 == ToolChain2 or ToolChain1 == "*" or ToolChain2
> == "*") and\
> -                        (Arch1 == Arch2 or Arch1 == "*" or Arch2 == "*") and\
> -                        (CommandType1 == CommandType2 or CommandType1 == "*"
> or CommandType2 == "*") and\
> -                        (Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*"):
> +                    if (Target1 == Target2 or Target1 == TAB_STAR or Target2 ==
> TAB_STAR) and\
> +                        (ToolChain1 == ToolChain2 or ToolChain1 == TAB_STAR or
> ToolChain2 == TAB_STAR) and\
> +                        (Arch1 == Arch2 or Arch1 == TAB_STAR or Arch2 == TAB_STAR)
> and\
> +                        (CommandType1 == CommandType2 or CommandType1 ==
> TAB_STAR or CommandType2 == TAB_STAR) and\
> +                        (Attr1 == Attr2 or Attr1 == TAB_STAR or Attr2 == TAB_STAR):
> 
>                          if self.CalculatePriorityValue(NowKey) >
> self.CalculatePriorityValue(NextKey):
>                              if Options.get((self.BuildRuleFamily, NextKey)) is not None:
> @@ -2309,9 +2309,9 @@ class PlatformAutoGen(AutoGen):
>                      continue
>                  FamilyMatch = True
>              # expand any wildcard
> -            if Target == "*" or Target == self.BuildTarget:
> -                if Tag == "*" or Tag == self.ToolChain:
> -                    if Arch == "*" or Arch == self.Arch:
> +            if Target == TAB_STAR or Target == self.BuildTarget:
> +                if Tag == TAB_STAR or Tag == self.ToolChain:
> +                    if Arch == TAB_STAR or Arch == self.Arch:
>                          if Tool not in BuildOptions:
>                              BuildOptions[Tool] = {}
>                          if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or
> Options[Key].startswith('='):
> @@ -2344,9 +2344,9 @@ class PlatformAutoGen(AutoGen):
>                  continue
> 
>              # expand any wildcard
> -            if Target == "*" or Target == self.BuildTarget:
> -                if Tag == "*" or Tag == self.ToolChain:
> -                    if Arch == "*" or Arch == self.Arch:
> +            if Target == TAB_STAR or Target == self.BuildTarget:
> +                if Tag == TAB_STAR or Tag == self.ToolChain:
> +                    if Arch == TAB_STAR or Arch == self.Arch:
>                          if Tool not in BuildOptions:
>                              BuildOptions[Tool] = {}
>                          if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or
> Options[Key].startswith('='):
> @@ -2971,8 +2971,8 @@ class ModuleAutoGen(AutoGen):
>      @cached_property
>      def SourceFileList(self):
>          RetVal = []
> -        ToolChainTagSet = {"", "*", self.ToolChain}
> -        ToolChainFamilySet = {"", "*", self.ToolChainFamily,
> self.BuildRuleFamily}
> +        ToolChainTagSet = {"", TAB_STAR, self.ToolChain}
> +        ToolChainFamilySet = {"", TAB_STAR, self.ToolChainFamily,
> + self.BuildRuleFamily}
>          for F in self.Module.Sources:
>              # match tool chain
>              if F.TagName not in ToolChainTagSet:
> @@ -3047,7 +3047,7 @@ class ModuleAutoGen(AutoGen):
>      def BinaryFileList(self):
>          RetVal = []
>          for F in self.Module.Binaries:
> -            if F.Target not in [TAB_ARCH_COMMON, '*'] and F.Target !=
> self.BuildTarget:
> +            if F.Target not in [TAB_ARCH_COMMON, TAB_STAR] and F.Target !=
> self.BuildTarget:
>                  continue
>              RetVal.append(F)
>              self._ApplyBuildRule(F, F.Type, BinaryFileList=RetVal) diff --git
> a/BaseTools/Source/Python/AutoGen/BuildEngine.py
> b/BaseTools/Source/Python/AutoGen/BuildEngine.py
> index ac7a6687552c..f9e3ac3a1daf 100644
> --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
> +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
> @@ -110,7 +110,7 @@ class FileBuildRule:
>          self.IncListFileMacro = self.INC_LIST_MACRO
> 
>          self.SourceFileType = Type
> -        # source files listed not in "*" or "?" pattern format
> +        # source files listed not in TAB_STAR or "?" pattern format
>          if not ExtraDependency:
>              self.ExtraSourceFileList = []
>          else:
> @@ -150,12 +150,12 @@ class FileBuildRule:
>          self.SourceFileExtList = set()
>          for File in Input:
>              Base, Ext = os.path.splitext(File)
> -            if Base.find("*") >= 0:
> -                # There's "*" in the file name
> +            if Base.find(TAB_STAR) >= 0:
> +                # There's TAB_STAR in the file name
>                  self.IsMultipleInput = True
>                  self.GenFileListMacro = True
>              elif Base.find("?") < 0:
> -                # There's no "*" and "?" in file name
> +                # There's no TAB_STAR and "?" in file name
>                  self.ExtraSourceFileList.append(File)
>                  continue
>              self.SourceFileExtList.add(Ext) @@ -553,7 +553,7 @@ class BuildRule:
>      #
>      #   @param  FileExt             The extension of a file
>      #   @param  ToolChainFamily     The tool chain family name
> -    #   @param  BuildVersion        The build version number. "*" means any
> rule
> +    #   @param  BuildVersion        The build version number. TAB_STAR means
> any rule
>      #                               is applicalbe.
>      #
>      #   @retval FileType        The file type string
> diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py
> b/BaseTools/Source/Python/BPDG/GenVpd.py
> index d7852d29eed0..e5da47f95e63 100644
> --- a/BaseTools/Source/Python/BPDG/GenVpd.py
> +++ b/BaseTools/Source/Python/BPDG/GenVpd.py
> @@ -21,7 +21,7 @@ import array
>  import re
>  from Common.LongFilePathSupport import OpenLongFilePath as open  from
> struct import * -from Common.DataType import MAX_SIZE_TYPE,
> MAX_VAL_TYPE
> +from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE,
> TAB_STAR
>  import Common.EdkLogger as EdkLogger
>  import Common.BuildToolError as BuildToolError
> 
> @@ -87,7 +87,7 @@ class PcdEntry:
>      #  for both hexadecimal and decimal.
>      #
>      def _GenOffsetValue(self):
> -        if self.PcdOffset != "*" :
> +        if self.PcdOffset != TAB_STAR:
>              try:
>                  self.PcdBinOffset = int (self.PcdOffset)
>              except:
> @@ -423,7 +423,7 @@ class GenVPD :
>                      Alignment = 1
> 
>                  PCD.Alignment = Alignment
> -                if PCD.PcdOffset != '*':
> +                if PCD.PcdOffset != TAB_STAR:
>                      if PCD.PcdOccupySize % Alignment != 0:
>                          if PCD.PcdUnpackValue.startswith("{"):
>                              EdkLogger.warn("BPDG", "The offset value of PCD %s is not 8-
> byte aligned!" %(PCD.PcdCName), File=self.InputFileName) @@ -469,7
> +469,7 @@ class GenVPD :
>      def FormatFileLine (self) :
> 
>          for eachPcd in self.FileLinesList :
> -            if eachPcd.PcdOffset != '*' :
> +            if eachPcd.PcdOffset != TAB_STAR :
>                  # Use pcd's Offset value as key, and pcd's Value as value
>                  self.PcdFixedOffsetSizeList.append(eachPcd)
>              else :
> @@ -484,7 +484,7 @@ class GenVPD :
>      def FixVpdOffset (self):
>          # At first, the offset should start at 0
>          # Sort fixed offset list in order to find out where has free spaces for the
> pcd's offset
> -        # value is "*" to insert into.
> +        # value is TAB_STAR to insert into.
> 
>          self.PcdFixedOffsetSizeList.sort(key=lambda x: x.PcdBinOffset)
> 
> @@ -502,7 +502,7 @@ class GenVPD :
>                          self.PcdUnknownOffsetList[index+i -1 ],
> self.PcdUnknownOffsetList[index+i] = self.PcdUnknownOffsetList[index+i],
> self.PcdUnknownOffsetList[index+i -1]
> 
>          #
> -        # Process all Offset value are "*"
> +        # Process all Offset value are TAB_STAR
>          #
>          if (len(self.PcdFixedOffsetSizeList) == 0) and
> (len(self.PcdUnknownOffsetList) != 0) :
>              # The offset start from 0
> @@ -571,7 +571,7 @@ class GenVPD :
>                          eachUnfixedPcd      =
> self.PcdUnknownOffsetList[countOfUnfixedList]
>                          needFixPcdSize      = eachUnfixedPcd.PcdOccupySize
>                          # Not been fixed
> -                        if eachUnfixedPcd.PcdOffset == '*' :
> +                        if eachUnfixedPcd.PcdOffset == TAB_STAR :
>                              if LastOffset % eachUnfixedPcd.Alignment != 0:
>                                  LastOffset = (LastOffset / eachUnfixedPcd.Alignment + 1) *
> eachUnfixedPcd.Alignment
>                              # The offset un-fixed pcd can write into this free space diff --
> git a/BaseTools/Source/Python/Common/DataType.py
> b/BaseTools/Source/Python/Common/DataType.py
> index 1d1d22faa40b..6b375712b65e 100644
> --- a/BaseTools/Source/Python/Common/DataType.py
> +++ b/BaseTools/Source/Python/Common/DataType.py
> @@ -31,6 +31,7 @@ TAB_OPTION_START = '<'
>  TAB_OPTION_END = '>'
>  TAB_SLASH = '\\'
>  TAB_BACK_SLASH = '/'
> +TAB_STAR = '*'
>  TAB_LINE_BREAK = '\n'
>  TAB_PRINTCHAR_VT = '\x0b'
>  TAB_PRINTCHAR_BS = '\b'
> diff --git a/BaseTools/Source/Python/Common/Expression.py
> b/BaseTools/Source/Python/Common/Expression.py
> index a21ab5daa73e..db1310d534fb 100644
> --- a/BaseTools/Source/Python/Common/Expression.py
> +++ b/BaseTools/Source/Python/Common/Expression.py
> @@ -244,7 +244,7 @@ class ValueExpression(BaseExpression):
>          'IN' : 'in'
>      }
> 
> -    NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<',
> '?', ':']
> +    NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', '~',
> + '<<', '>>', '!', '=', '>', '<', '?', ':']
> 
> 
>      SymbolPattern = re.compile("("
> @@ -498,7 +498,7 @@ class ValueExpression(BaseExpression):
> 
>      # A [ * B]*
>      def _MulExpr(self):
> -        return self._ExprFuncTemplate(self._UnaryExpr, {"*", "/", "%"})
> +        return self._ExprFuncTemplate(self._UnaryExpr, {TAB_STAR, "/",
> + "%"})
> 
>      # [!]*A
>      def _UnaryExpr(self):
> diff --git a/BaseTools/Source/Python/Common/Misc.py
> b/BaseTools/Source/Python/Common/Misc.py
> index 3b8efb2e7179..61ba79241fb6 100644
> --- a/BaseTools/Source/Python/Common/Misc.py
> +++ b/BaseTools/Source/Python/Common/Misc.py
> @@ -1088,7 +1088,7 @@ class tdict:
>      _ListType = type([])
>      _TupleType = type(())
>      _Wildcard = 'COMMON'
> -    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', '*', 'PLATFORM']
> +    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', TAB_STAR,
> + 'PLATFORM']
> 
>      def __init__(self, _Single_=False, _Level_=2):
>          self._Level_ = _Level_
> diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py
> b/BaseTools/Source/Python/Common/ToolDefClassObject.py
> index 05a1ddfbcc89..186d279840c1 100644
> --- a/BaseTools/Source/Python/Common/ToolDefClassObject.py
> +++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py
> @@ -29,7 +29,8 @@ from Common import GlobalData  from
> Common.MultipleWorkspace import MultipleWorkspace as mws  from
> .DataType import TAB_TOD_DEFINES_TARGET,
> TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\
>                       TAB_TOD_DEFINES_TARGET_ARCH,
> TAB_TOD_DEFINES_COMMAND_TYPE\
> -                     , TAB_TOD_DEFINES_FAMILY,
> TAB_TOD_DEFINES_BUILDRULEFAMILY
> +                     , TAB_TOD_DEFINES_FAMILY,
> TAB_TOD_DEFINES_BUILDRULEFAMILY,\
> +                     TAB_STAR, TAB_TAT_DEFINES_TOOL_CHAIN_CONF
> 
> 
>  ##
> @@ -97,7 +98,7 @@ class ToolDefClassObject(object):
>              # adding/removing items from the original dict.
>              for Key in list(self.ToolsDefTxtDictionary.keys()):
>                  List = Key.split('_')
> -                if List[Index] == '*':
> +                if List[Index] == TAB_STAR:
>                      for String in self.ToolsDefTxtDatabase[KeyList[Index]]:
>                          List[Index] = String
>                          NewKey = '%s_%s_%s_%s_%s' % tuple(List) @@ -202,20 +203,20
> @@ class ToolDefClassObject(object):
>              if len(List) != 5:
>                  EdkLogger.verbose("Line %d: Not a valid name of definition: %s" %
> ((Index + 1), Name))
>                  continue
> -            elif List[4] == '*':
> +            elif List[4] == TAB_STAR:
>                  EdkLogger.verbose("Line %d: '*' is not allowed in last field: %s" %
> ((Index + 1), Name))
>                  continue
>              else:
>                  self.ToolsDefTxtDictionary[Name] = Value
> -                if List[0] != '*':
> +                if List[0] != TAB_STAR:
>                      self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] +=
> [List[0]]
> -                if List[1] != '*':
> +                if List[1] != TAB_STAR:
>                      self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG]
> += [List[1]]
> -                if List[2] != '*':
> +                if List[2] != TAB_STAR:
>                      self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] +=
> [List[2]]
> -                if List[3] != '*':
> +                if List[3] != TAB_STAR:
>                      self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE]
> += [List[3]]
> -                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == '*' and List[3]
> == '*':
> +                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == TAB_STAR
> and List[3] == TAB_STAR:
>                      if TAB_TOD_DEFINES_FAMILY not in self.ToolsDefTxtDatabase:
>                          self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = {}
>                          self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] =
> Value @@ -226,7 +227,7 @@ class ToolDefClassObject(object):
> 
> self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] =
> Value
>                      elif self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]]
> != Value:
>                          EdkLogger.verbose("Line %d: No override allowed for the family
> of a tool chain: %s" % ((Index + 1), Name))
> -                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == '*'
> and List[3] == '*':
> +                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] ==
> TAB_STAR and List[3] == TAB_STAR:
>                      if TAB_TOD_DEFINES_BUILDRULEFAMILY not in
> self.ToolsDefTxtDatabase \
>                         or List[1] not in
> self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:
>                          EdkLogger.verbose("Line %d: The family is not specified, but
> BuildRuleFamily is specified for the tool chain: %s" % ((Index + 1), Name))
> @@ -270,8 +271,8 @@ class ToolDefClassObject(object):
>  def ToolDefDict(ConfDir):
>      Target = TargetTxtDict(ConfDir)
>      ToolDef = ToolDefClassObject()
> -    if DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF in
> Target.TargetTxtDictionary:
> -        ToolsDefFile =
> Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CON
> F]
> +    if TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
> +        ToolsDefFile =
> + Target.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
>          if ToolsDefFile:
>              ToolDef.LoadToolDefFile(os.path.normpath(ToolsDefFile))
>          else:
> diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py
> b/BaseTools/Source/Python/Common/VpdInfoFile.py
> index 2fb8e66fe99c..3be0670e36fb 100644
> --- a/BaseTools/Source/Python/Common/VpdInfoFile.py
> +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
> @@ -57,7 +57,7 @@ FILE_COMMENT_TEMPLATE = \
>  #  <PcdName>         ::=  <TokenSpaceCName> "." <PcdCName>
>  #  <TokenSpaceCName> ::=  C Variable Name of the Token Space GUID
>  #  <PcdCName>        ::=  C Variable Name of the PCD
> -#  <Offset>          ::=  {"*"} {<HexNumber>}
> +#  <Offset>          ::=  {TAB_STAR} {<HexNumber>}
>  #  <HexNumber>       ::=  "0x" (a-fA-F0-9){1,8}
>  #  <Size>            ::=  <HexNumber>
>  #  <Value>           ::=  {<HexNumber>} {<NonNegativeInt>} {<QString>}
> {<Array>}
> @@ -92,7 +92,7 @@ class VpdInfoFile:
>          if (Vpd is None):
>              EdkLogger.error("VpdInfoFile",
> BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
> 
> -        if not (Offset >= 0 or Offset == "*"):
> +        if not (Offset >= 0 or Offset == TAB_STAR):
>              EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID,
> "Invalid offset parameter: %s." % Offset)
> 
>          if Vpd.DatumType == TAB_VOID:
> @@ -186,8 +186,8 @@ class VpdInfoFile:
>                          VpdObjectTokenCName = PcdItem[0]
>                  for sku in VpdObject.SkuInfoList:
>                      if VpdObject.TokenSpaceGuidCName == TokenSpaceName and
> VpdObjectTokenCName == PcdTokenName.strip() and sku == SkuId:
> -                        if self._VpdArray[VpdObject][sku] == "*":
> -                            if Offset == "*":
> +                        if self._VpdArray[VpdObject][sku] == TAB_STAR:
> +                            if Offset == TAB_STAR:
>                                  EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
> "The offset of %s has not been fixed up by third-party BPDG tool." %
> PcdName)
>                              self._VpdArray[VpdObject][sku] = Offset
>                          Found = True
> diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
> b/BaseTools/Source/Python/GenFds/FdfParser.py
> index 44cc8f63d07b..cedc4ea0c122 100644
> --- a/BaseTools/Source/Python/GenFds/FdfParser.py
> +++ b/BaseTools/Source/Python/GenFds/FdfParser.py
> @@ -64,7 +64,6 @@ T_CHAR_CR = '\r'
>  T_CHAR_TAB = '\t'
>  T_CHAR_DOUBLE_QUOTE = '\"'
>  T_CHAR_SINGLE_QUOTE = '\''
> -T_CHAR_STAR = '*'
>  T_CHAR_BRACE_R = '}'
> 
>  SEPARATORS = {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT,
> TAB_COMMA_SPLIT, '{', T_CHAR_BRACE_R} @@ -533,7 +532,7 @@ class
> FdfParser:
>                      InComment = False
>                      HashComment = False
>              # check for */ comment end
> -            elif InComment and not DoubleSlashComment and not HashComment
> and self._CurrentChar() == T_CHAR_STAR and self._NextChar() ==
> TAB_BACK_SLASH:
> +            elif InComment and not DoubleSlashComment and not
> HashComment and self._CurrentChar() == TAB_STAR and self._NextChar()
> == TAB_BACK_SLASH:
>                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
>                  self._GetOneChar()
>                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> @@ -552,7 +551,7 @@ class FdfParser:
>                  InComment = True
>                  HashComment = True
>              # check for /* comment start
> -            elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() ==
> T_CHAR_STAR:
> +            elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() ==
> TAB_STAR:
>                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
>                  self._GetOneChar()
>                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> diff --git a/BaseTools/Source/Python/GenFds/GenFds.py
> b/BaseTools/Source/Python/GenFds/GenFds.py
> index 0c8091b79841..0513f488fca3 100644
> --- a/BaseTools/Source/Python/GenFds/GenFds.py
> +++ b/BaseTools/Source/Python/GenFds/GenFds.py
> @@ -653,7 +653,7 @@ class GenFds(object):
>                              FileGuidList.append(FileStatementGuid)
>                          Name = []
>                          FfsPath = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
> -                        FfsPath = glob(os.path.join(FfsPath, FileStatementGuid) + '*')
> +                        FfsPath = glob(os.path.join(FfsPath,
> + FileStatementGuid) + TAB_STAR)
>                          if not FfsPath:
>                              continue
>                          if not os.path.exists(FfsPath[0]):
> diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> index ea61f723a73c..0812c56bdae8 100644
> --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> @@ -217,12 +217,12 @@ class GenFdsGlobalVariable:
> 
>          if not Inf.IsBinaryModule:
>              for File in Inf.Sources:
> -                if File.TagName in {"", "*", GenFdsGlobalVariable.ToolChainTag} and
> \
> -                    File.ToolChainFamily in {"", "*",
> GenFdsGlobalVariable.ToolChainFamily}:
> +                if File.TagName in {"", DataType.TAB_STAR,
> GenFdsGlobalVariable.ToolChainTag} and \
> +                    File.ToolChainFamily in {"", DataType.TAB_STAR,
> GenFdsGlobalVariable.ToolChainFamily}:
>                      FileList.append((File, DataType.TAB_UNKNOWN_FILE))
> 
>          for File in Inf.Binaries:
> -            if File.Target in {DataType.TAB_COMMON, '*',
> GenFdsGlobalVariable.TargetName}:
> +            if File.Target in {DataType.TAB_COMMON, DataType.TAB_STAR,
> GenFdsGlobalVariable.TargetName}:
>                  FileList.append((File, File.Type))
> 
>          for File, FileType in FileList:
> @@ -893,7 +893,7 @@ def FindExtendTool(KeyStringList, CurrentArchList,
> NameGuid):
>              for Index in range(2, -1, -1):
>                  for Key in list(BuildOption.keys()):
>                      List = Key.split('_')
> -                    if List[Index] == '*':
> +                    if List[Index] == DataType.TAB_STAR:
>                          for String in ToolDb[ToolList[Index]]:
>                              if String in [Arch, GenFdsGlobalVariable.TargetName,
> GenFdsGlobalVariable.ToolChainTag]:
>                                  List[Index] = String diff --git
> a/BaseTools/Source/Python/GenFds/Section.py
> b/BaseTools/Source/Python/GenFds/Section.py
> index 19a70009dcce..bab74aedf0b9 100644
> --- a/BaseTools/Source/Python/GenFds/Section.py
> +++ b/BaseTools/Source/Python/GenFds/Section.py
> @@ -131,7 +131,7 @@ class Section (SectionClassObject):
>                      if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >=
> 0x0001000A \
>                                                   and FileType == 'DXE_DPEX' and File.Type ==
> BINARY_FILE_TYPE_SMM_DEPEX) \
>                                                   or (FileType == BINARY_FILE_TYPE_TE and File.Type
> == BINARY_FILE_TYPE_PE32):
> -                        if '*' in FfsInf.TargetOverrideList or File.Target == '*' or
> File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
> +                        if TAB_STAR in FfsInf.TargetOverrideList or File.Target ==
> TAB_STAR or File.Target in FfsInf.TargetOverrideList or
> FfsInf.TargetOverrideList == []:
>                              FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type))
>                          else:
>                              GenFdsGlobalVariable.InfLogger ("\nBuild Target \'%s\' of File
> %s is not in the Scope of %s specified by INF %s in FDF" %(File.Target,
> File.File, FfsInf.TargetOverrideList, FfsInf.InfFileName)) diff --git
> a/BaseTools/Source/Python/Workspace/DscBuildData.py
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index 11aa63fb263c..22cbbb119a5a 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -2315,11 +2315,11 @@ class DscBuildData(PlatformBuildClassObject):
>                  continue
>              if Attr != "FLAGS":
>                  continue
> -            if Target == "*" or Target == self._Target:
> -                if Tag == "*" or Tag == self._Toolchain:
> +            if Target == TAB_STAR or Target == self._Target:
> +                if Tag == TAB_STAR or Tag == self._Toolchain:
>                      if 'COMMON' not in BuildOptions:
>                          BuildOptions['COMMON'] = set()
> -                    if Arch == "*":
> +                    if Arch == TAB_STAR:
>                          BuildOptions['COMMON'].add(self.BuildOptions[Options])
>                      if Arch in self.SupArchList:
>                          if Arch not in BuildOptions:
> --
> 2.16.2.windows.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*'
  2018-12-03 15:19     ` Carsey, Jaben
@ 2018-12-04  1:52       ` Zhu, Yonghong
  2018-12-07  0:50         ` Carsey, Jaben
  0 siblings, 1 reply; 8+ messages in thread
From: Zhu, Yonghong @ 2018-12-04  1:52 UTC (permalink / raw)
  To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong

Yes.  I prefer not to change it.

Best Regards,
Zhu Yonghong


-----Original Message-----
From: Carsey, Jaben 
Sent: Monday, December 03, 2018 11:19 PM
To: Zhu, Yonghong <yonghong.zhu@intel.com>; edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>
Subject: RE: [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*'

I was trying to change all use of *, without regard to the usage of it.

Do you think that mathematical * should not be changed?

-Jaben

> -----Original Message-----
> From: Zhu, Yonghong
> Sent: Sunday, December 02, 2018 6:31 PM
> To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong 
> <yonghong.zhu@intel.com>
> Subject: RE: [Patch v1 1/1] BaseTools: create and use a standard 
> shared variable for '*'
> Importance: High
> 
> Hi Jaben,
> 
> In this patch, it also changed the mathematics multiplicative '*' 
> (used in
> expression) to  TAB_STAR, is it by on purpose?
> Eg:
> -    NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<',
> '?', ':']
> +    NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', 
> + '~', '<<', '>>', '!', '=',
> '>', '<', '?', ':']
> 
> Best Regards,
> Zhu Yonghong
> 
> -----Original Message-----
> From: Carsey, Jaben
> Sent: Friday, November 16, 2018 11:40 PM
> To: edk2-devel@lists.01.org
> Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming 
> <liming.gao@intel.com>
> Subject: [Patch v1 1/1] BaseTools: create and use a standard shared 
> variable for '*'
> 
> add a variable for the string '*' and then use it instead of lots of '*'
> 
> Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
> ---
>  BaseTools/Source/Python/AutoGen/AutoGen.py             | 54 ++++++++++---
> -------
>  BaseTools/Source/Python/AutoGen/BuildEngine.py         | 10 ++--
>  BaseTools/Source/Python/BPDG/GenVpd.py                 | 14 ++---
>  BaseTools/Source/Python/Common/DataType.py             |  1 +
>  BaseTools/Source/Python/Common/Expression.py           |  4 +-
>  BaseTools/Source/Python/Common/Misc.py                 |  2 +-
>  BaseTools/Source/Python/Common/ToolDefClassObject.py   | 23 +++++----
>  BaseTools/Source/Python/Common/VpdInfoFile.py          |  8 +--
>  BaseTools/Source/Python/GenFds/FdfParser.py            |  5 +-
>  BaseTools/Source/Python/GenFds/GenFds.py               |  2 +-
>  BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py |  8 +--
>  BaseTools/Source/Python/GenFds/Section.py              |  2 +-
>  BaseTools/Source/Python/Workspace/DscBuildData.py      |  6 +--
>  13 files changed, 70 insertions(+), 69 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> b/BaseTools/Source/Python/AutoGen/AutoGen.py
> index f3560bfc787d..25417c447061 100644
> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> @@ -1438,7 +1438,7 @@ class PlatformAutoGen(AutoGen):
>                          PcdValue = Sku.DefaultValue
>                          if PcdValue == "":
>                              PcdValue  = Pcd.DefaultValue
> -                        if Sku.VpdOffset != '*':
> +                        if Sku.VpdOffset != TAB_STAR:
>                              if PcdValue.startswith("{"):
>                                  Alignment = 8
>                              elif PcdValue.startswith("L"):
> @@ -1462,7 +1462,7 @@ class PlatformAutoGen(AutoGen):
>                              VpdFile.Add(Pcd, SkuName, Sku.VpdOffset)
>                          SkuValueMap[PcdValue].append(Sku)
>                          # if the offset of a VPD is *, then it need 
> to be fixed up by third party tool.
> -                        if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
> +                        if not NeedProcessVpdMapFile and 
> + Sku.VpdOffset ==
> TAB_STAR:
>                              NeedProcessVpdMapFile = True
>                              if self.Platform.VpdToolGuid is None or 
> self.Platform.VpdToolGuid == '':
>                                  EdkLogger.error("Build", 
> FILE_NOT_FOUND, \ @@ -1522,7
> +1522,7 @@ class PlatformAutoGen(AutoGen):
>                                  PcdValue = Sku.DefaultValue
>                                  if PcdValue == "":
>                                      PcdValue  = DscPcdEntry.DefaultValue
> -                                if Sku.VpdOffset != '*':
> +                                if Sku.VpdOffset != TAB_STAR:
>                                      if PcdValue.startswith("{"):
>                                          Alignment = 8
>                                      elif PcdValue.startswith("L"):
> @@ -1545,7 +1545,7 @@ class PlatformAutoGen(AutoGen):
>                                      SkuValueMap[PcdValue] = []
>                                      VpdFile.Add(DscPcdEntry, SkuName, Sku.VpdOffset)
>                                  SkuValueMap[PcdValue].append(Sku)
> -                                if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
> +                                if not NeedProcessVpdMapFile and 
> + Sku.VpdOffset ==
> TAB_STAR:
>                                      NeedProcessVpdMapFile = True
>                              if DscPcdEntry.DatumType == TAB_VOID and
> PcdValue.startswith("L"):
>                                  UnicodePcdArray.add(DscPcdEntry) @@ 
> -1573,7 +1573,7 @@ class PlatformAutoGen(AutoGen):
>                      if os.path.exists(VpdMapFilePath):
>                          VpdFile.Read(VpdMapFilePath)
> 
> -                        # Fixup "*" offset
> +                        # Fixup TAB_STAR offset
>                          for pcd in VpdSkuMap:
>                              vpdinfo = VpdFile.GetVpdInfo(pcd)
>                              if vpdinfo is None:
> @@ -2210,15 +2210,15 @@ class PlatformAutoGen(AutoGen):
>      def CalculatePriorityValue(self, Key):
>          Target, ToolChain, Arch, CommandType, Attr = Key.split('_')
>          PriorityValue = 0x11111
> -        if Target == "*":
> +        if Target == TAB_STAR:
>              PriorityValue &= 0x01111
> -        if ToolChain == "*":
> +        if ToolChain == TAB_STAR:
>              PriorityValue &= 0x10111
> -        if Arch == "*":
> +        if Arch == TAB_STAR:
>              PriorityValue &= 0x11011
> -        if CommandType == "*":
> +        if CommandType == TAB_STAR:
>              PriorityValue &= 0x11101
> -        if Attr == "*":
> +        if Attr == TAB_STAR:
>              PriorityValue &= 0x11110
> 
>          return self.PrioList["0x%0.5x" % PriorityValue] @@ -2253,9 
> +2253,9 @@ class PlatformAutoGen(AutoGen):
>              if (Key[0] == self.BuildRuleFamily and
>                  (ModuleStyle is None or len(Key) < 3 or (len(Key) > 2 
> and Key[2] ==
> ModuleStyle))):
>                  Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_')
> -                if (Target == self.BuildTarget or Target == "*") and\
> -                    (ToolChain == self.ToolChain or ToolChain == "*") and\
> -                    (Arch == self.Arch or Arch == "*") and\
> +                if (Target == self.BuildTarget or Target == TAB_STAR) and\
> +                    (ToolChain == self.ToolChain or ToolChain == TAB_STAR) and\
> +                    (Arch == self.Arch or Arch == TAB_STAR) and\
>                      Options[Key].startswith("="):
> 
>                      if OverrideList.get(Key[1]) is not None:
> @@ -2276,11 +2276,11 @@ class PlatformAutoGen(AutoGen):
>                      # Compare two Key, if one is included by another, 
> choose the higher priority one
>                      #
>                      Target2, ToolChain2, Arch2, CommandType2, Attr2 =
> NextKey.split("_")
> -                    if (Target1 == Target2 or Target1 == "*" or Target2 == "*") and\
> -                        (ToolChain1 == ToolChain2 or ToolChain1 == "*" or ToolChain2
> == "*") and\
> -                        (Arch1 == Arch2 or Arch1 == "*" or Arch2 == "*") and\
> -                        (CommandType1 == CommandType2 or CommandType1 == "*"
> or CommandType2 == "*") and\
> -                        (Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*"):
> +                    if (Target1 == Target2 or Target1 == TAB_STAR or 
> + Target2 ==
> TAB_STAR) and\
> +                        (ToolChain1 == ToolChain2 or ToolChain1 == 
> + TAB_STAR or
> ToolChain2 == TAB_STAR) and\
> +                        (Arch1 == Arch2 or Arch1 == TAB_STAR or Arch2 
> + == TAB_STAR)
> and\
> +                        (CommandType1 == CommandType2 or CommandType1 
> + ==
> TAB_STAR or CommandType2 == TAB_STAR) and\
> +                        (Attr1 == Attr2 or Attr1 == TAB_STAR or Attr2 == TAB_STAR):
> 
>                          if self.CalculatePriorityValue(NowKey) >
> self.CalculatePriorityValue(NextKey):
>                              if Options.get((self.BuildRuleFamily, NextKey)) is not None:
> @@ -2309,9 +2309,9 @@ class PlatformAutoGen(AutoGen):
>                      continue
>                  FamilyMatch = True
>              # expand any wildcard
> -            if Target == "*" or Target == self.BuildTarget:
> -                if Tag == "*" or Tag == self.ToolChain:
> -                    if Arch == "*" or Arch == self.Arch:
> +            if Target == TAB_STAR or Target == self.BuildTarget:
> +                if Tag == TAB_STAR or Tag == self.ToolChain:
> +                    if Arch == TAB_STAR or Arch == self.Arch:
>                          if Tool not in BuildOptions:
>                              BuildOptions[Tool] = {}
>                          if Attr != "FLAGS" or Attr not in 
> BuildOptions[Tool] or
> Options[Key].startswith('='):
> @@ -2344,9 +2344,9 @@ class PlatformAutoGen(AutoGen):
>                  continue
> 
>              # expand any wildcard
> -            if Target == "*" or Target == self.BuildTarget:
> -                if Tag == "*" or Tag == self.ToolChain:
> -                    if Arch == "*" or Arch == self.Arch:
> +            if Target == TAB_STAR or Target == self.BuildTarget:
> +                if Tag == TAB_STAR or Tag == self.ToolChain:
> +                    if Arch == TAB_STAR or Arch == self.Arch:
>                          if Tool not in BuildOptions:
>                              BuildOptions[Tool] = {}
>                          if Attr != "FLAGS" or Attr not in 
> BuildOptions[Tool] or
> Options[Key].startswith('='):
> @@ -2971,8 +2971,8 @@ class ModuleAutoGen(AutoGen):
>      @cached_property
>      def SourceFileList(self):
>          RetVal = []
> -        ToolChainTagSet = {"", "*", self.ToolChain}
> -        ToolChainFamilySet = {"", "*", self.ToolChainFamily,
> self.BuildRuleFamily}
> +        ToolChainTagSet = {"", TAB_STAR, self.ToolChain}
> +        ToolChainFamilySet = {"", TAB_STAR, self.ToolChainFamily, 
> + self.BuildRuleFamily}
>          for F in self.Module.Sources:
>              # match tool chain
>              if F.TagName not in ToolChainTagSet:
> @@ -3047,7 +3047,7 @@ class ModuleAutoGen(AutoGen):
>      def BinaryFileList(self):
>          RetVal = []
>          for F in self.Module.Binaries:
> -            if F.Target not in [TAB_ARCH_COMMON, '*'] and F.Target !=
> self.BuildTarget:
> +            if F.Target not in [TAB_ARCH_COMMON, TAB_STAR] and 
> + F.Target !=
> self.BuildTarget:
>                  continue
>              RetVal.append(F)
>              self._ApplyBuildRule(F, F.Type, BinaryFileList=RetVal) 
> diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py
> b/BaseTools/Source/Python/AutoGen/BuildEngine.py
> index ac7a6687552c..f9e3ac3a1daf 100644
> --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
> +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
> @@ -110,7 +110,7 @@ class FileBuildRule:
>          self.IncListFileMacro = self.INC_LIST_MACRO
> 
>          self.SourceFileType = Type
> -        # source files listed not in "*" or "?" pattern format
> +        # source files listed not in TAB_STAR or "?" pattern format
>          if not ExtraDependency:
>              self.ExtraSourceFileList = []
>          else:
> @@ -150,12 +150,12 @@ class FileBuildRule:
>          self.SourceFileExtList = set()
>          for File in Input:
>              Base, Ext = os.path.splitext(File)
> -            if Base.find("*") >= 0:
> -                # There's "*" in the file name
> +            if Base.find(TAB_STAR) >= 0:
> +                # There's TAB_STAR in the file name
>                  self.IsMultipleInput = True
>                  self.GenFileListMacro = True
>              elif Base.find("?") < 0:
> -                # There's no "*" and "?" in file name
> +                # There's no TAB_STAR and "?" in file name
>                  self.ExtraSourceFileList.append(File)
>                  continue
>              self.SourceFileExtList.add(Ext) @@ -553,7 +553,7 @@ class BuildRule:
>      #
>      #   @param  FileExt             The extension of a file
>      #   @param  ToolChainFamily     The tool chain family name
> -    #   @param  BuildVersion        The build version number. "*" means any
> rule
> +    #   @param  BuildVersion        The build version number. TAB_STAR means
> any rule
>      #                               is applicalbe.
>      #
>      #   @retval FileType        The file type string
> diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py
> b/BaseTools/Source/Python/BPDG/GenVpd.py
> index d7852d29eed0..e5da47f95e63 100644
> --- a/BaseTools/Source/Python/BPDG/GenVpd.py
> +++ b/BaseTools/Source/Python/BPDG/GenVpd.py
> @@ -21,7 +21,7 @@ import array
>  import re
>  from Common.LongFilePathSupport import OpenLongFilePath as open  from 
> struct import * -from Common.DataType import MAX_SIZE_TYPE, 
> MAX_VAL_TYPE
> +from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE,
> TAB_STAR
>  import Common.EdkLogger as EdkLogger
>  import Common.BuildToolError as BuildToolError
> 
> @@ -87,7 +87,7 @@ class PcdEntry:
>      #  for both hexadecimal and decimal.
>      #
>      def _GenOffsetValue(self):
> -        if self.PcdOffset != "*" :
> +        if self.PcdOffset != TAB_STAR:
>              try:
>                  self.PcdBinOffset = int (self.PcdOffset)
>              except:
> @@ -423,7 +423,7 @@ class GenVPD :
>                      Alignment = 1
> 
>                  PCD.Alignment = Alignment
> -                if PCD.PcdOffset != '*':
> +                if PCD.PcdOffset != TAB_STAR:
>                      if PCD.PcdOccupySize % Alignment != 0:
>                          if PCD.PcdUnpackValue.startswith("{"):
>                              EdkLogger.warn("BPDG", "The offset value 
> of PCD %s is not 8- byte aligned!" %(PCD.PcdCName), 
> File=self.InputFileName) @@ -469,7
> +469,7 @@ class GenVPD :
>      def FormatFileLine (self) :
> 
>          for eachPcd in self.FileLinesList :
> -            if eachPcd.PcdOffset != '*' :
> +            if eachPcd.PcdOffset != TAB_STAR :
>                  # Use pcd's Offset value as key, and pcd's Value as value
>                  self.PcdFixedOffsetSizeList.append(eachPcd)
>              else :
> @@ -484,7 +484,7 @@ class GenVPD :
>      def FixVpdOffset (self):
>          # At first, the offset should start at 0
>          # Sort fixed offset list in order to find out where has free 
> spaces for the pcd's offset
> -        # value is "*" to insert into.
> +        # value is TAB_STAR to insert into.
> 
>          self.PcdFixedOffsetSizeList.sort(key=lambda x: 
> x.PcdBinOffset)
> 
> @@ -502,7 +502,7 @@ class GenVPD :
>                          self.PcdUnknownOffsetList[index+i -1 ], 
> self.PcdUnknownOffsetList[index+i] = 
> self.PcdUnknownOffsetList[index+i],
> self.PcdUnknownOffsetList[index+i -1]
> 
>          #
> -        # Process all Offset value are "*"
> +        # Process all Offset value are TAB_STAR
>          #
>          if (len(self.PcdFixedOffsetSizeList) == 0) and
> (len(self.PcdUnknownOffsetList) != 0) :
>              # The offset start from 0 @@ -571,7 +571,7 @@ class 
> GenVPD :
>                          eachUnfixedPcd      =
> self.PcdUnknownOffsetList[countOfUnfixedList]
>                          needFixPcdSize      = eachUnfixedPcd.PcdOccupySize
>                          # Not been fixed
> -                        if eachUnfixedPcd.PcdOffset == '*' :
> +                        if eachUnfixedPcd.PcdOffset == TAB_STAR :
>                              if LastOffset % eachUnfixedPcd.Alignment != 0:
>                                  LastOffset = (LastOffset / 
> eachUnfixedPcd.Alignment + 1) * eachUnfixedPcd.Alignment
>                              # The offset un-fixed pcd can write into 
> this free space diff -- git 
> a/BaseTools/Source/Python/Common/DataType.py
> b/BaseTools/Source/Python/Common/DataType.py
> index 1d1d22faa40b..6b375712b65e 100644
> --- a/BaseTools/Source/Python/Common/DataType.py
> +++ b/BaseTools/Source/Python/Common/DataType.py
> @@ -31,6 +31,7 @@ TAB_OPTION_START = '<'
>  TAB_OPTION_END = '>'
>  TAB_SLASH = '\\'
>  TAB_BACK_SLASH = '/'
> +TAB_STAR = '*'
>  TAB_LINE_BREAK = '\n'
>  TAB_PRINTCHAR_VT = '\x0b'
>  TAB_PRINTCHAR_BS = '\b'
> diff --git a/BaseTools/Source/Python/Common/Expression.py
> b/BaseTools/Source/Python/Common/Expression.py
> index a21ab5daa73e..db1310d534fb 100644
> --- a/BaseTools/Source/Python/Common/Expression.py
> +++ b/BaseTools/Source/Python/Common/Expression.py
> @@ -244,7 +244,7 @@ class ValueExpression(BaseExpression):
>          'IN' : 'in'
>      }
> 
> -    NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<',
> '?', ':']
> +    NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', 
> + '~', '<<', '>>', '!', '=', '>', '<', '?', ':']
> 
> 
>      SymbolPattern = re.compile("("
> @@ -498,7 +498,7 @@ class ValueExpression(BaseExpression):
> 
>      # A [ * B]*
>      def _MulExpr(self):
> -        return self._ExprFuncTemplate(self._UnaryExpr, {"*", "/", "%"})
> +        return self._ExprFuncTemplate(self._UnaryExpr, {TAB_STAR, 
> + "/",
> + "%"})
> 
>      # [!]*A
>      def _UnaryExpr(self):
> diff --git a/BaseTools/Source/Python/Common/Misc.py
> b/BaseTools/Source/Python/Common/Misc.py
> index 3b8efb2e7179..61ba79241fb6 100644
> --- a/BaseTools/Source/Python/Common/Misc.py
> +++ b/BaseTools/Source/Python/Common/Misc.py
> @@ -1088,7 +1088,7 @@ class tdict:
>      _ListType = type([])
>      _TupleType = type(())
>      _Wildcard = 'COMMON'
> -    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', '*', 'PLATFORM']
> +    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', TAB_STAR, 
> + 'PLATFORM']
> 
>      def __init__(self, _Single_=False, _Level_=2):
>          self._Level_ = _Level_
> diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py
> b/BaseTools/Source/Python/Common/ToolDefClassObject.py
> index 05a1ddfbcc89..186d279840c1 100644
> --- a/BaseTools/Source/Python/Common/ToolDefClassObject.py
> +++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py
> @@ -29,7 +29,8 @@ from Common import GlobalData  from 
> Common.MultipleWorkspace import MultipleWorkspace as mws  from 
> .DataType import TAB_TOD_DEFINES_TARGET, 
> TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\
>                       TAB_TOD_DEFINES_TARGET_ARCH, 
> TAB_TOD_DEFINES_COMMAND_TYPE\
> -                     , TAB_TOD_DEFINES_FAMILY,
> TAB_TOD_DEFINES_BUILDRULEFAMILY
> +                     , TAB_TOD_DEFINES_FAMILY,
> TAB_TOD_DEFINES_BUILDRULEFAMILY,\
> +                     TAB_STAR, TAB_TAT_DEFINES_TOOL_CHAIN_CONF
> 
> 
>  ##
> @@ -97,7 +98,7 @@ class ToolDefClassObject(object):
>              # adding/removing items from the original dict.
>              for Key in list(self.ToolsDefTxtDictionary.keys()):
>                  List = Key.split('_')
> -                if List[Index] == '*':
> +                if List[Index] == TAB_STAR:
>                      for String in self.ToolsDefTxtDatabase[KeyList[Index]]:
>                          List[Index] = String
>                          NewKey = '%s_%s_%s_%s_%s' % tuple(List) @@ 
> -202,20 +203,20 @@ class ToolDefClassObject(object):
>              if len(List) != 5:
>                  EdkLogger.verbose("Line %d: Not a valid name of 
> definition: %s" % ((Index + 1), Name))
>                  continue
> -            elif List[4] == '*':
> +            elif List[4] == TAB_STAR:
>                  EdkLogger.verbose("Line %d: '*' is not allowed in 
> last field: %s" % ((Index + 1), Name))
>                  continue
>              else:
>                  self.ToolsDefTxtDictionary[Name] = Value
> -                if List[0] != '*':
> +                if List[0] != TAB_STAR:
>                      self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] 
> += [List[0]]
> -                if List[1] != '*':
> +                if List[1] != TAB_STAR:
>                      
> self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG]
> += [List[1]]
> -                if List[2] != '*':
> +                if List[2] != TAB_STAR:
>                      
> self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] += [List[2]]
> -                if List[3] != '*':
> +                if List[3] != TAB_STAR:
>                      
> self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE]
> += [List[3]]
> -                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == '*' and List[3]
> == '*':
> +                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == 
> + TAB_STAR
> and List[3] == TAB_STAR:
>                      if TAB_TOD_DEFINES_FAMILY not in self.ToolsDefTxtDatabase:
>                          self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = {}
>                          
> self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] = Value @@ -226,7 +227,7 @@ class ToolDefClassObject(object):
> 
> self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] = 
> Value
>                      elif 
> self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]]
> != Value:
>                          EdkLogger.verbose("Line %d: No override 
> allowed for the family of a tool chain: %s" % ((Index + 1), Name))
> -                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == '*'
> and List[3] == '*':
> +                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and 
> + List[2] ==
> TAB_STAR and List[3] == TAB_STAR:
>                      if TAB_TOD_DEFINES_BUILDRULEFAMILY not in 
> self.ToolsDefTxtDatabase \
>                         or List[1] not in
> self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:
>                          EdkLogger.verbose("Line %d: The family is not 
> specified, but BuildRuleFamily is specified for the tool chain: %s" % 
> ((Index + 1), Name)) @@ -270,8 +271,8 @@ class ToolDefClassObject(object):
>  def ToolDefDict(ConfDir):
>      Target = TargetTxtDict(ConfDir)
>      ToolDef = ToolDefClassObject()
> -    if DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF in
> Target.TargetTxtDictionary:
> -        ToolsDefFile =
> Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CON
> F]
> +    if TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
> +        ToolsDefFile =
> + Target.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
>          if ToolsDefFile:
>              ToolDef.LoadToolDefFile(os.path.normpath(ToolsDefFile))
>          else:
> diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py
> b/BaseTools/Source/Python/Common/VpdInfoFile.py
> index 2fb8e66fe99c..3be0670e36fb 100644
> --- a/BaseTools/Source/Python/Common/VpdInfoFile.py
> +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
> @@ -57,7 +57,7 @@ FILE_COMMENT_TEMPLATE = \
>  #  <PcdName>         ::=  <TokenSpaceCName> "." <PcdCName>
>  #  <TokenSpaceCName> ::=  C Variable Name of the Token Space GUID
>  #  <PcdCName>        ::=  C Variable Name of the PCD
> -#  <Offset>          ::=  {"*"} {<HexNumber>}
> +#  <Offset>          ::=  {TAB_STAR} {<HexNumber>}
>  #  <HexNumber>       ::=  "0x" (a-fA-F0-9){1,8}
>  #  <Size>            ::=  <HexNumber>
>  #  <Value>           ::=  {<HexNumber>} {<NonNegativeInt>} {<QString>}
> {<Array>}
> @@ -92,7 +92,7 @@ class VpdInfoFile:
>          if (Vpd is None):
>              EdkLogger.error("VpdInfoFile", 
> BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
> 
> -        if not (Offset >= 0 or Offset == "*"):
> +        if not (Offset >= 0 or Offset == TAB_STAR):
>              EdkLogger.error("VpdInfoFile", 
> BuildToolError.PARAMETER_INVALID, "Invalid offset parameter: %s." % 
> Offset)
> 
>          if Vpd.DatumType == TAB_VOID:
> @@ -186,8 +186,8 @@ class VpdInfoFile:
>                          VpdObjectTokenCName = PcdItem[0]
>                  for sku in VpdObject.SkuInfoList:
>                      if VpdObject.TokenSpaceGuidCName == 
> TokenSpaceName and VpdObjectTokenCName == PcdTokenName.strip() and sku == SkuId:
> -                        if self._VpdArray[VpdObject][sku] == "*":
> -                            if Offset == "*":
> +                        if self._VpdArray[VpdObject][sku] == TAB_STAR:
> +                            if Offset == TAB_STAR:
>                                  EdkLogger.error("BPDG", 
> BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed up 
> by third-party BPDG tool." %
> PcdName)
>                              self._VpdArray[VpdObject][sku] = Offset
>                          Found = True
> diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
> b/BaseTools/Source/Python/GenFds/FdfParser.py
> index 44cc8f63d07b..cedc4ea0c122 100644
> --- a/BaseTools/Source/Python/GenFds/FdfParser.py
> +++ b/BaseTools/Source/Python/GenFds/FdfParser.py
> @@ -64,7 +64,6 @@ T_CHAR_CR = '\r'
>  T_CHAR_TAB = '\t'
>  T_CHAR_DOUBLE_QUOTE = '\"'
>  T_CHAR_SINGLE_QUOTE = '\''
> -T_CHAR_STAR = '*'
>  T_CHAR_BRACE_R = '}'
> 
>  SEPARATORS = {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT, TAB_COMMA_SPLIT, '{', 
> T_CHAR_BRACE_R} @@ -533,7 +532,7 @@ class
> FdfParser:
>                      InComment = False
>                      HashComment = False
>              # check for */ comment end
> -            elif InComment and not DoubleSlashComment and not HashComment
> and self._CurrentChar() == T_CHAR_STAR and self._NextChar() ==
> TAB_BACK_SLASH:
> +            elif InComment and not DoubleSlashComment and not
> HashComment and self._CurrentChar() == TAB_STAR and self._NextChar() 
> == TAB_BACK_SLASH:
>                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
>                  self._GetOneChar()
>                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> @@ -552,7 +551,7 @@ class FdfParser:
>                  InComment = True
>                  HashComment = True
>              # check for /* comment start
> -            elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() ==
> T_CHAR_STAR:
> +            elif self._CurrentChar() == TAB_BACK_SLASH and 
> + self._NextChar() ==
> TAB_STAR:
>                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
>                  self._GetOneChar()
>                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> diff --git a/BaseTools/Source/Python/GenFds/GenFds.py
> b/BaseTools/Source/Python/GenFds/GenFds.py
> index 0c8091b79841..0513f488fca3 100644
> --- a/BaseTools/Source/Python/GenFds/GenFds.py
> +++ b/BaseTools/Source/Python/GenFds/GenFds.py
> @@ -653,7 +653,7 @@ class GenFds(object):
>                              FileGuidList.append(FileStatementGuid)
>                          Name = []
>                          FfsPath = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
> -                        FfsPath = glob(os.path.join(FfsPath, FileStatementGuid) + '*')
> +                        FfsPath = glob(os.path.join(FfsPath,
> + FileStatementGuid) + TAB_STAR)
>                          if not FfsPath:
>                              continue
>                          if not os.path.exists(FfsPath[0]):
> diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> index ea61f723a73c..0812c56bdae8 100644
> --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> @@ -217,12 +217,12 @@ class GenFdsGlobalVariable:
> 
>          if not Inf.IsBinaryModule:
>              for File in Inf.Sources:
> -                if File.TagName in {"", "*", GenFdsGlobalVariable.ToolChainTag} and
> \
> -                    File.ToolChainFamily in {"", "*",
> GenFdsGlobalVariable.ToolChainFamily}:
> +                if File.TagName in {"", DataType.TAB_STAR,
> GenFdsGlobalVariable.ToolChainTag} and \
> +                    File.ToolChainFamily in {"", DataType.TAB_STAR,
> GenFdsGlobalVariable.ToolChainFamily}:
>                      FileList.append((File, 
> DataType.TAB_UNKNOWN_FILE))
> 
>          for File in Inf.Binaries:
> -            if File.Target in {DataType.TAB_COMMON, '*',
> GenFdsGlobalVariable.TargetName}:
> +            if File.Target in {DataType.TAB_COMMON, 
> + DataType.TAB_STAR,
> GenFdsGlobalVariable.TargetName}:
>                  FileList.append((File, File.Type))
> 
>          for File, FileType in FileList:
> @@ -893,7 +893,7 @@ def FindExtendTool(KeyStringList, CurrentArchList,
> NameGuid):
>              for Index in range(2, -1, -1):
>                  for Key in list(BuildOption.keys()):
>                      List = Key.split('_')
> -                    if List[Index] == '*':
> +                    if List[Index] == DataType.TAB_STAR:
>                          for String in ToolDb[ToolList[Index]]:
>                              if String in [Arch, 
> GenFdsGlobalVariable.TargetName,
> GenFdsGlobalVariable.ToolChainTag]:
>                                  List[Index] = String diff --git 
> a/BaseTools/Source/Python/GenFds/Section.py
> b/BaseTools/Source/Python/GenFds/Section.py
> index 19a70009dcce..bab74aedf0b9 100644
> --- a/BaseTools/Source/Python/GenFds/Section.py
> +++ b/BaseTools/Source/Python/GenFds/Section.py
> @@ -131,7 +131,7 @@ class Section (SectionClassObject):
>                      if File.Type == FileType or 
> (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \
>                                                   and FileType == 
> 'DXE_DPEX' and File.Type ==
> BINARY_FILE_TYPE_SMM_DEPEX) \
>                                                   or (FileType == 
> BINARY_FILE_TYPE_TE and File.Type == BINARY_FILE_TYPE_PE32):
> -                        if '*' in FfsInf.TargetOverrideList or File.Target == '*' or
> File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
> +                        if TAB_STAR in FfsInf.TargetOverrideList or 
> + File.Target ==
> TAB_STAR or File.Target in FfsInf.TargetOverrideList or 
> FfsInf.TargetOverrideList == []:
>                              FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type))
>                          else:
>                              GenFdsGlobalVariable.InfLogger ("\nBuild 
> Target \'%s\' of File %s is not in the Scope of %s specified by INF %s 
> in FDF" %(File.Target, File.File, FfsInf.TargetOverrideList, 
> FfsInf.InfFileName)) diff --git 
> a/BaseTools/Source/Python/Workspace/DscBuildData.py
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index 11aa63fb263c..22cbbb119a5a 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -2315,11 +2315,11 @@ class DscBuildData(PlatformBuildClassObject):
>                  continue
>              if Attr != "FLAGS":
>                  continue
> -            if Target == "*" or Target == self._Target:
> -                if Tag == "*" or Tag == self._Toolchain:
> +            if Target == TAB_STAR or Target == self._Target:
> +                if Tag == TAB_STAR or Tag == self._Toolchain:
>                      if 'COMMON' not in BuildOptions:
>                          BuildOptions['COMMON'] = set()
> -                    if Arch == "*":
> +                    if Arch == TAB_STAR:
>                          BuildOptions['COMMON'].add(self.BuildOptions[Options])
>                      if Arch in self.SupArchList:
>                          if Arch not in BuildOptions:
> --
> 2.16.2.windows.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*'
  2018-12-04  1:52       ` Zhu, Yonghong
@ 2018-12-07  0:50         ` Carsey, Jaben
  2018-12-07  0:53           ` Carsey, Jaben
  0 siblings, 1 reply; 8+ messages in thread
From: Carsey, Jaben @ 2018-12-07  0:50 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org; +Cc: Gao, Liming

How about undo those and push the remaining?  Since that's a very small change.

-Jaben

> -----Original Message-----
> From: Zhu, Yonghong
> Sent: Monday, December 3, 2018 5:53 PM
> To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong
> <yonghong.zhu@intel.com>
> Subject: RE: [Patch v1 1/1] BaseTools: create and use a standard shared
> variable for '*'
> Importance: High
> 
> Yes.  I prefer not to change it.
> 
> Best Regards,
> Zhu Yonghong
> 
> 
> -----Original Message-----
> From: Carsey, Jaben
> Sent: Monday, December 03, 2018 11:19 PM
> To: Zhu, Yonghong <yonghong.zhu@intel.com>; edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: RE: [Patch v1 1/1] BaseTools: create and use a standard shared
> variable for '*'
> 
> I was trying to change all use of *, without regard to the usage of it.
> 
> Do you think that mathematical * should not be changed?
> 
> -Jaben
> 
> > -----Original Message-----
> > From: Zhu, Yonghong
> > Sent: Sunday, December 02, 2018 6:31 PM
> > To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org
> > Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong
> > <yonghong.zhu@intel.com>
> > Subject: RE: [Patch v1 1/1] BaseTools: create and use a standard
> > shared variable for '*'
> > Importance: High
> >
> > Hi Jaben,
> >
> > In this patch, it also changed the mathematics multiplicative '*'
> > (used in
> > expression) to  TAB_STAR, is it by on purpose?
> > Eg:
> > -    NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>',
> '<',
> > '?', ':']
> > +    NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^',
> > + '~', '<<', '>>', '!', '=',
> > '>', '<', '?', ':']
> >
> > Best Regards,
> > Zhu Yonghong
> >
> > -----Original Message-----
> > From: Carsey, Jaben
> > Sent: Friday, November 16, 2018 11:40 PM
> > To: edk2-devel@lists.01.org
> > Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming
> > <liming.gao@intel.com>
> > Subject: [Patch v1 1/1] BaseTools: create and use a standard shared
> > variable for '*'
> >
> > add a variable for the string '*' and then use it instead of lots of '*'
> >
> > Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
> > ---
> >  BaseTools/Source/Python/AutoGen/AutoGen.py             | 54 ++++++++++---
> > -------
> >  BaseTools/Source/Python/AutoGen/BuildEngine.py         | 10 ++--
> >  BaseTools/Source/Python/BPDG/GenVpd.py                 | 14 ++---
> >  BaseTools/Source/Python/Common/DataType.py             |  1 +
> >  BaseTools/Source/Python/Common/Expression.py           |  4 +-
> >  BaseTools/Source/Python/Common/Misc.py                 |  2 +-
> >  BaseTools/Source/Python/Common/ToolDefClassObject.py   | 23 +++++----
> >  BaseTools/Source/Python/Common/VpdInfoFile.py          |  8 +--
> >  BaseTools/Source/Python/GenFds/FdfParser.py            |  5 +-
> >  BaseTools/Source/Python/GenFds/GenFds.py               |  2 +-
> >  BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py |  8 +--
> >  BaseTools/Source/Python/GenFds/Section.py              |  2 +-
> >  BaseTools/Source/Python/Workspace/DscBuildData.py      |  6 +--
> >  13 files changed, 70 insertions(+), 69 deletions(-)
> >
> > diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> > b/BaseTools/Source/Python/AutoGen/AutoGen.py
> > index f3560bfc787d..25417c447061 100644
> > --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> > +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> > @@ -1438,7 +1438,7 @@ class PlatformAutoGen(AutoGen):
> >                          PcdValue = Sku.DefaultValue
> >                          if PcdValue == "":
> >                              PcdValue  = Pcd.DefaultValue
> > -                        if Sku.VpdOffset != '*':
> > +                        if Sku.VpdOffset != TAB_STAR:
> >                              if PcdValue.startswith("{"):
> >                                  Alignment = 8
> >                              elif PcdValue.startswith("L"):
> > @@ -1462,7 +1462,7 @@ class PlatformAutoGen(AutoGen):
> >                              VpdFile.Add(Pcd, SkuName, Sku.VpdOffset)
> >                          SkuValueMap[PcdValue].append(Sku)
> >                          # if the offset of a VPD is *, then it need
> > to be fixed up by third party tool.
> > -                        if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
> > +                        if not NeedProcessVpdMapFile and
> > + Sku.VpdOffset ==
> > TAB_STAR:
> >                              NeedProcessVpdMapFile = True
> >                              if self.Platform.VpdToolGuid is None or
> > self.Platform.VpdToolGuid == '':
> >                                  EdkLogger.error("Build",
> > FILE_NOT_FOUND, \ @@ -1522,7
> > +1522,7 @@ class PlatformAutoGen(AutoGen):
> >                                  PcdValue = Sku.DefaultValue
> >                                  if PcdValue == "":
> >                                      PcdValue  = DscPcdEntry.DefaultValue
> > -                                if Sku.VpdOffset != '*':
> > +                                if Sku.VpdOffset != TAB_STAR:
> >                                      if PcdValue.startswith("{"):
> >                                          Alignment = 8
> >                                      elif PcdValue.startswith("L"):
> > @@ -1545,7 +1545,7 @@ class PlatformAutoGen(AutoGen):
> >                                      SkuValueMap[PcdValue] = []
> >                                      VpdFile.Add(DscPcdEntry, SkuName, Sku.VpdOffset)
> >                                  SkuValueMap[PcdValue].append(Sku)
> > -                                if not NeedProcessVpdMapFile and Sku.VpdOffset ==
> "*":
> > +                                if not NeedProcessVpdMapFile and
> > + Sku.VpdOffset ==
> > TAB_STAR:
> >                                      NeedProcessVpdMapFile = True
> >                              if DscPcdEntry.DatumType == TAB_VOID and
> > PcdValue.startswith("L"):
> >                                  UnicodePcdArray.add(DscPcdEntry) @@
> > -1573,7 +1573,7 @@ class PlatformAutoGen(AutoGen):
> >                      if os.path.exists(VpdMapFilePath):
> >                          VpdFile.Read(VpdMapFilePath)
> >
> > -                        # Fixup "*" offset
> > +                        # Fixup TAB_STAR offset
> >                          for pcd in VpdSkuMap:
> >                              vpdinfo = VpdFile.GetVpdInfo(pcd)
> >                              if vpdinfo is None:
> > @@ -2210,15 +2210,15 @@ class PlatformAutoGen(AutoGen):
> >      def CalculatePriorityValue(self, Key):
> >          Target, ToolChain, Arch, CommandType, Attr = Key.split('_')
> >          PriorityValue = 0x11111
> > -        if Target == "*":
> > +        if Target == TAB_STAR:
> >              PriorityValue &= 0x01111
> > -        if ToolChain == "*":
> > +        if ToolChain == TAB_STAR:
> >              PriorityValue &= 0x10111
> > -        if Arch == "*":
> > +        if Arch == TAB_STAR:
> >              PriorityValue &= 0x11011
> > -        if CommandType == "*":
> > +        if CommandType == TAB_STAR:
> >              PriorityValue &= 0x11101
> > -        if Attr == "*":
> > +        if Attr == TAB_STAR:
> >              PriorityValue &= 0x11110
> >
> >          return self.PrioList["0x%0.5x" % PriorityValue] @@ -2253,9
> > +2253,9 @@ class PlatformAutoGen(AutoGen):
> >              if (Key[0] == self.BuildRuleFamily and
> >                  (ModuleStyle is None or len(Key) < 3 or (len(Key) > 2
> > and Key[2] ==
> > ModuleStyle))):
> >                  Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_')
> > -                if (Target == self.BuildTarget or Target == "*") and\
> > -                    (ToolChain == self.ToolChain or ToolChain == "*") and\
> > -                    (Arch == self.Arch or Arch == "*") and\
> > +                if (Target == self.BuildTarget or Target == TAB_STAR) and\
> > +                    (ToolChain == self.ToolChain or ToolChain == TAB_STAR) and\
> > +                    (Arch == self.Arch or Arch == TAB_STAR) and\
> >                      Options[Key].startswith("="):
> >
> >                      if OverrideList.get(Key[1]) is not None:
> > @@ -2276,11 +2276,11 @@ class PlatformAutoGen(AutoGen):
> >                      # Compare two Key, if one is included by another,
> > choose the higher priority one
> >                      #
> >                      Target2, ToolChain2, Arch2, CommandType2, Attr2 =
> > NextKey.split("_")
> > -                    if (Target1 == Target2 or Target1 == "*" or Target2 == "*") and\
> > -                        (ToolChain1 == ToolChain2 or ToolChain1 == "*" or
> ToolChain2
> > == "*") and\
> > -                        (Arch1 == Arch2 or Arch1 == "*" or Arch2 == "*") and\
> > -                        (CommandType1 == CommandType2 or CommandType1 ==
> "*"
> > or CommandType2 == "*") and\
> > -                        (Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*"):
> > +                    if (Target1 == Target2 or Target1 == TAB_STAR or
> > + Target2 ==
> > TAB_STAR) and\
> > +                        (ToolChain1 == ToolChain2 or ToolChain1 ==
> > + TAB_STAR or
> > ToolChain2 == TAB_STAR) and\
> > +                        (Arch1 == Arch2 or Arch1 == TAB_STAR or Arch2
> > + == TAB_STAR)
> > and\
> > +                        (CommandType1 == CommandType2 or CommandType1
> > + ==
> > TAB_STAR or CommandType2 == TAB_STAR) and\
> > +                        (Attr1 == Attr2 or Attr1 == TAB_STAR or Attr2 == TAB_STAR):
> >
> >                          if self.CalculatePriorityValue(NowKey) >
> > self.CalculatePriorityValue(NextKey):
> >                              if Options.get((self.BuildRuleFamily, NextKey)) is not None:
> > @@ -2309,9 +2309,9 @@ class PlatformAutoGen(AutoGen):
> >                      continue
> >                  FamilyMatch = True
> >              # expand any wildcard
> > -            if Target == "*" or Target == self.BuildTarget:
> > -                if Tag == "*" or Tag == self.ToolChain:
> > -                    if Arch == "*" or Arch == self.Arch:
> > +            if Target == TAB_STAR or Target == self.BuildTarget:
> > +                if Tag == TAB_STAR or Tag == self.ToolChain:
> > +                    if Arch == TAB_STAR or Arch == self.Arch:
> >                          if Tool not in BuildOptions:
> >                              BuildOptions[Tool] = {}
> >                          if Attr != "FLAGS" or Attr not in
> > BuildOptions[Tool] or
> > Options[Key].startswith('='):
> > @@ -2344,9 +2344,9 @@ class PlatformAutoGen(AutoGen):
> >                  continue
> >
> >              # expand any wildcard
> > -            if Target == "*" or Target == self.BuildTarget:
> > -                if Tag == "*" or Tag == self.ToolChain:
> > -                    if Arch == "*" or Arch == self.Arch:
> > +            if Target == TAB_STAR or Target == self.BuildTarget:
> > +                if Tag == TAB_STAR or Tag == self.ToolChain:
> > +                    if Arch == TAB_STAR or Arch == self.Arch:
> >                          if Tool not in BuildOptions:
> >                              BuildOptions[Tool] = {}
> >                          if Attr != "FLAGS" or Attr not in
> > BuildOptions[Tool] or
> > Options[Key].startswith('='):
> > @@ -2971,8 +2971,8 @@ class ModuleAutoGen(AutoGen):
> >      @cached_property
> >      def SourceFileList(self):
> >          RetVal = []
> > -        ToolChainTagSet = {"", "*", self.ToolChain}
> > -        ToolChainFamilySet = {"", "*", self.ToolChainFamily,
> > self.BuildRuleFamily}
> > +        ToolChainTagSet = {"", TAB_STAR, self.ToolChain}
> > +        ToolChainFamilySet = {"", TAB_STAR, self.ToolChainFamily,
> > + self.BuildRuleFamily}
> >          for F in self.Module.Sources:
> >              # match tool chain
> >              if F.TagName not in ToolChainTagSet:
> > @@ -3047,7 +3047,7 @@ class ModuleAutoGen(AutoGen):
> >      def BinaryFileList(self):
> >          RetVal = []
> >          for F in self.Module.Binaries:
> > -            if F.Target not in [TAB_ARCH_COMMON, '*'] and F.Target !=
> > self.BuildTarget:
> > +            if F.Target not in [TAB_ARCH_COMMON, TAB_STAR] and
> > + F.Target !=
> > self.BuildTarget:
> >                  continue
> >              RetVal.append(F)
> >              self._ApplyBuildRule(F, F.Type, BinaryFileList=RetVal)
> > diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py
> > b/BaseTools/Source/Python/AutoGen/BuildEngine.py
> > index ac7a6687552c..f9e3ac3a1daf 100644
> > --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
> > +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
> > @@ -110,7 +110,7 @@ class FileBuildRule:
> >          self.IncListFileMacro = self.INC_LIST_MACRO
> >
> >          self.SourceFileType = Type
> > -        # source files listed not in "*" or "?" pattern format
> > +        # source files listed not in TAB_STAR or "?" pattern format
> >          if not ExtraDependency:
> >              self.ExtraSourceFileList = []
> >          else:
> > @@ -150,12 +150,12 @@ class FileBuildRule:
> >          self.SourceFileExtList = set()
> >          for File in Input:
> >              Base, Ext = os.path.splitext(File)
> > -            if Base.find("*") >= 0:
> > -                # There's "*" in the file name
> > +            if Base.find(TAB_STAR) >= 0:
> > +                # There's TAB_STAR in the file name
> >                  self.IsMultipleInput = True
> >                  self.GenFileListMacro = True
> >              elif Base.find("?") < 0:
> > -                # There's no "*" and "?" in file name
> > +                # There's no TAB_STAR and "?" in file name
> >                  self.ExtraSourceFileList.append(File)
> >                  continue
> >              self.SourceFileExtList.add(Ext) @@ -553,7 +553,7 @@ class
> BuildRule:
> >      #
> >      #   @param  FileExt             The extension of a file
> >      #   @param  ToolChainFamily     The tool chain family name
> > -    #   @param  BuildVersion        The build version number. "*" means any
> > rule
> > +    #   @param  BuildVersion        The build version number. TAB_STAR
> means
> > any rule
> >      #                               is applicalbe.
> >      #
> >      #   @retval FileType        The file type string
> > diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py
> > b/BaseTools/Source/Python/BPDG/GenVpd.py
> > index d7852d29eed0..e5da47f95e63 100644
> > --- a/BaseTools/Source/Python/BPDG/GenVpd.py
> > +++ b/BaseTools/Source/Python/BPDG/GenVpd.py
> > @@ -21,7 +21,7 @@ import array
> >  import re
> >  from Common.LongFilePathSupport import OpenLongFilePath as open
> from
> > struct import * -from Common.DataType import MAX_SIZE_TYPE,
> > MAX_VAL_TYPE
> > +from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE,
> > TAB_STAR
> >  import Common.EdkLogger as EdkLogger
> >  import Common.BuildToolError as BuildToolError
> >
> > @@ -87,7 +87,7 @@ class PcdEntry:
> >      #  for both hexadecimal and decimal.
> >      #
> >      def _GenOffsetValue(self):
> > -        if self.PcdOffset != "*" :
> > +        if self.PcdOffset != TAB_STAR:
> >              try:
> >                  self.PcdBinOffset = int (self.PcdOffset)
> >              except:
> > @@ -423,7 +423,7 @@ class GenVPD :
> >                      Alignment = 1
> >
> >                  PCD.Alignment = Alignment
> > -                if PCD.PcdOffset != '*':
> > +                if PCD.PcdOffset != TAB_STAR:
> >                      if PCD.PcdOccupySize % Alignment != 0:
> >                          if PCD.PcdUnpackValue.startswith("{"):
> >                              EdkLogger.warn("BPDG", "The offset value
> > of PCD %s is not 8- byte aligned!" %(PCD.PcdCName),
> > File=self.InputFileName) @@ -469,7
> > +469,7 @@ class GenVPD :
> >      def FormatFileLine (self) :
> >
> >          for eachPcd in self.FileLinesList :
> > -            if eachPcd.PcdOffset != '*' :
> > +            if eachPcd.PcdOffset != TAB_STAR :
> >                  # Use pcd's Offset value as key, and pcd's Value as value
> >                  self.PcdFixedOffsetSizeList.append(eachPcd)
> >              else :
> > @@ -484,7 +484,7 @@ class GenVPD :
> >      def FixVpdOffset (self):
> >          # At first, the offset should start at 0
> >          # Sort fixed offset list in order to find out where has free
> > spaces for the pcd's offset
> > -        # value is "*" to insert into.
> > +        # value is TAB_STAR to insert into.
> >
> >          self.PcdFixedOffsetSizeList.sort(key=lambda x:
> > x.PcdBinOffset)
> >
> > @@ -502,7 +502,7 @@ class GenVPD :
> >                          self.PcdUnknownOffsetList[index+i -1 ],
> > self.PcdUnknownOffsetList[index+i] =
> > self.PcdUnknownOffsetList[index+i],
> > self.PcdUnknownOffsetList[index+i -1]
> >
> >          #
> > -        # Process all Offset value are "*"
> > +        # Process all Offset value are TAB_STAR
> >          #
> >          if (len(self.PcdFixedOffsetSizeList) == 0) and
> > (len(self.PcdUnknownOffsetList) != 0) :
> >              # The offset start from 0 @@ -571,7 +571,7 @@ class
> > GenVPD :
> >                          eachUnfixedPcd      =
> > self.PcdUnknownOffsetList[countOfUnfixedList]
> >                          needFixPcdSize      = eachUnfixedPcd.PcdOccupySize
> >                          # Not been fixed
> > -                        if eachUnfixedPcd.PcdOffset == '*' :
> > +                        if eachUnfixedPcd.PcdOffset == TAB_STAR :
> >                              if LastOffset % eachUnfixedPcd.Alignment != 0:
> >                                  LastOffset = (LastOffset /
> > eachUnfixedPcd.Alignment + 1) * eachUnfixedPcd.Alignment
> >                              # The offset un-fixed pcd can write into
> > this free space diff -- git
> > a/BaseTools/Source/Python/Common/DataType.py
> > b/BaseTools/Source/Python/Common/DataType.py
> > index 1d1d22faa40b..6b375712b65e 100644
> > --- a/BaseTools/Source/Python/Common/DataType.py
> > +++ b/BaseTools/Source/Python/Common/DataType.py
> > @@ -31,6 +31,7 @@ TAB_OPTION_START = '<'
> >  TAB_OPTION_END = '>'
> >  TAB_SLASH = '\\'
> >  TAB_BACK_SLASH = '/'
> > +TAB_STAR = '*'
> >  TAB_LINE_BREAK = '\n'
> >  TAB_PRINTCHAR_VT = '\x0b'
> >  TAB_PRINTCHAR_BS = '\b'
> > diff --git a/BaseTools/Source/Python/Common/Expression.py
> > b/BaseTools/Source/Python/Common/Expression.py
> > index a21ab5daa73e..db1310d534fb 100644
> > --- a/BaseTools/Source/Python/Common/Expression.py
> > +++ b/BaseTools/Source/Python/Common/Expression.py
> > @@ -244,7 +244,7 @@ class ValueExpression(BaseExpression):
> >          'IN' : 'in'
> >      }
> >
> > -    NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>',
> '<',
> > '?', ':']
> > +    NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^',
> > + '~', '<<', '>>', '!', '=', '>', '<', '?', ':']
> >
> >
> >      SymbolPattern = re.compile("("
> > @@ -498,7 +498,7 @@ class ValueExpression(BaseExpression):
> >
> >      # A [ * B]*
> >      def _MulExpr(self):
> > -        return self._ExprFuncTemplate(self._UnaryExpr, {"*", "/", "%"})
> > +        return self._ExprFuncTemplate(self._UnaryExpr, {TAB_STAR,
> > + "/",
> > + "%"})
> >
> >      # [!]*A
> >      def _UnaryExpr(self):
> > diff --git a/BaseTools/Source/Python/Common/Misc.py
> > b/BaseTools/Source/Python/Common/Misc.py
> > index 3b8efb2e7179..61ba79241fb6 100644
> > --- a/BaseTools/Source/Python/Common/Misc.py
> > +++ b/BaseTools/Source/Python/Common/Misc.py
> > @@ -1088,7 +1088,7 @@ class tdict:
> >      _ListType = type([])
> >      _TupleType = type(())
> >      _Wildcard = 'COMMON'
> > -    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', '*', 'PLATFORM']
> > +    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', TAB_STAR,
> > + 'PLATFORM']
> >
> >      def __init__(self, _Single_=False, _Level_=2):
> >          self._Level_ = _Level_
> > diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py
> > b/BaseTools/Source/Python/Common/ToolDefClassObject.py
> > index 05a1ddfbcc89..186d279840c1 100644
> > --- a/BaseTools/Source/Python/Common/ToolDefClassObject.py
> > +++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py
> > @@ -29,7 +29,8 @@ from Common import GlobalData  from
> > Common.MultipleWorkspace import MultipleWorkspace as mws  from
> > .DataType import TAB_TOD_DEFINES_TARGET,
> > TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\
> >                       TAB_TOD_DEFINES_TARGET_ARCH,
> > TAB_TOD_DEFINES_COMMAND_TYPE\
> > -                     , TAB_TOD_DEFINES_FAMILY,
> > TAB_TOD_DEFINES_BUILDRULEFAMILY
> > +                     , TAB_TOD_DEFINES_FAMILY,
> > TAB_TOD_DEFINES_BUILDRULEFAMILY,\
> > +                     TAB_STAR, TAB_TAT_DEFINES_TOOL_CHAIN_CONF
> >
> >
> >  ##
> > @@ -97,7 +98,7 @@ class ToolDefClassObject(object):
> >              # adding/removing items from the original dict.
> >              for Key in list(self.ToolsDefTxtDictionary.keys()):
> >                  List = Key.split('_')
> > -                if List[Index] == '*':
> > +                if List[Index] == TAB_STAR:
> >                      for String in self.ToolsDefTxtDatabase[KeyList[Index]]:
> >                          List[Index] = String
> >                          NewKey = '%s_%s_%s_%s_%s' % tuple(List) @@
> > -202,20 +203,20 @@ class ToolDefClassObject(object):
> >              if len(List) != 5:
> >                  EdkLogger.verbose("Line %d: Not a valid name of
> > definition: %s" % ((Index + 1), Name))
> >                  continue
> > -            elif List[4] == '*':
> > +            elif List[4] == TAB_STAR:
> >                  EdkLogger.verbose("Line %d: '*' is not allowed in
> > last field: %s" % ((Index + 1), Name))
> >                  continue
> >              else:
> >                  self.ToolsDefTxtDictionary[Name] = Value
> > -                if List[0] != '*':
> > +                if List[0] != TAB_STAR:
> >                      self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET]
> > += [List[0]]
> > -                if List[1] != '*':
> > +                if List[1] != TAB_STAR:
> >
> > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG]
> > += [List[1]]
> > -                if List[2] != '*':
> > +                if List[2] != TAB_STAR:
> >
> > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] += [List[2]]
> > -                if List[3] != '*':
> > +                if List[3] != TAB_STAR:
> >
> > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE]
> > += [List[3]]
> > -                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == '*' and
> List[3]
> > == '*':
> > +                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] ==
> > + TAB_STAR
> > and List[3] == TAB_STAR:
> >                      if TAB_TOD_DEFINES_FAMILY not in self.ToolsDefTxtDatabase:
> >
> > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = {}
> >
> > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] = Value @@
> -226,7 +227,7 @@ class ToolDefClassObject(object):
> >
> > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] =
> > Value
> >                      elif
> > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]]
> > != Value:
> >                          EdkLogger.verbose("Line %d: No override
> > allowed for the family of a tool chain: %s" % ((Index + 1), Name))
> > -                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] ==
> '*'
> > and List[3] == '*':
> > +                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and
> > + List[2] ==
> > TAB_STAR and List[3] == TAB_STAR:
> >                      if TAB_TOD_DEFINES_BUILDRULEFAMILY not in
> > self.ToolsDefTxtDatabase \
> >                         or List[1] not in
> > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:
> >                          EdkLogger.verbose("Line %d: The family is not
> > specified, but BuildRuleFamily is specified for the tool chain: %s" %
> > ((Index + 1), Name)) @@ -270,8 +271,8 @@ class
> ToolDefClassObject(object):
> >  def ToolDefDict(ConfDir):
> >      Target = TargetTxtDict(ConfDir)
> >      ToolDef = ToolDefClassObject()
> > -    if DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF in
> > Target.TargetTxtDictionary:
> > -        ToolsDefFile =
> >
> Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CON
> > F]
> > +    if TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
> > +        ToolsDefFile =
> > + Target.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
> >          if ToolsDefFile:
> >              ToolDef.LoadToolDefFile(os.path.normpath(ToolsDefFile))
> >          else:
> > diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py
> > b/BaseTools/Source/Python/Common/VpdInfoFile.py
> > index 2fb8e66fe99c..3be0670e36fb 100644
> > --- a/BaseTools/Source/Python/Common/VpdInfoFile.py
> > +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
> > @@ -57,7 +57,7 @@ FILE_COMMENT_TEMPLATE = \
> >  #  <PcdName>         ::=  <TokenSpaceCName> "." <PcdCName>
> >  #  <TokenSpaceCName> ::=  C Variable Name of the Token Space GUID
> >  #  <PcdCName>        ::=  C Variable Name of the PCD
> > -#  <Offset>          ::=  {"*"} {<HexNumber>}
> > +#  <Offset>          ::=  {TAB_STAR} {<HexNumber>}
> >  #  <HexNumber>       ::=  "0x" (a-fA-F0-9){1,8}
> >  #  <Size>            ::=  <HexNumber>
> >  #  <Value>           ::=  {<HexNumber>} {<NonNegativeInt>} {<QString>}
> > {<Array>}
> > @@ -92,7 +92,7 @@ class VpdInfoFile:
> >          if (Vpd is None):
> >              EdkLogger.error("VpdInfoFile",
> > BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
> >
> > -        if not (Offset >= 0 or Offset == "*"):
> > +        if not (Offset >= 0 or Offset == TAB_STAR):
> >              EdkLogger.error("VpdInfoFile",
> > BuildToolError.PARAMETER_INVALID, "Invalid offset parameter: %s." %
> > Offset)
> >
> >          if Vpd.DatumType == TAB_VOID:
> > @@ -186,8 +186,8 @@ class VpdInfoFile:
> >                          VpdObjectTokenCName = PcdItem[0]
> >                  for sku in VpdObject.SkuInfoList:
> >                      if VpdObject.TokenSpaceGuidCName ==
> > TokenSpaceName and VpdObjectTokenCName == PcdTokenName.strip()
> and sku == SkuId:
> > -                        if self._VpdArray[VpdObject][sku] == "*":
> > -                            if Offset == "*":
> > +                        if self._VpdArray[VpdObject][sku] == TAB_STAR:
> > +                            if Offset == TAB_STAR:
> >                                  EdkLogger.error("BPDG",
> > BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed up
> > by third-party BPDG tool." %
> > PcdName)
> >                              self._VpdArray[VpdObject][sku] = Offset
> >                          Found = True
> > diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
> > b/BaseTools/Source/Python/GenFds/FdfParser.py
> > index 44cc8f63d07b..cedc4ea0c122 100644
> > --- a/BaseTools/Source/Python/GenFds/FdfParser.py
> > +++ b/BaseTools/Source/Python/GenFds/FdfParser.py
> > @@ -64,7 +64,6 @@ T_CHAR_CR = '\r'
> >  T_CHAR_TAB = '\t'
> >  T_CHAR_DOUBLE_QUOTE = '\"'
> >  T_CHAR_SINGLE_QUOTE = '\''
> > -T_CHAR_STAR = '*'
> >  T_CHAR_BRACE_R = '}'
> >
> >  SEPARATORS = {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT,
> TAB_COMMA_SPLIT, '{',
> > T_CHAR_BRACE_R} @@ -533,7 +532,7 @@ class
> > FdfParser:
> >                      InComment = False
> >                      HashComment = False
> >              # check for */ comment end
> > -            elif InComment and not DoubleSlashComment and not
> HashComment
> > and self._CurrentChar() == T_CHAR_STAR and self._NextChar() ==
> > TAB_BACK_SLASH:
> > +            elif InComment and not DoubleSlashComment and not
> > HashComment and self._CurrentChar() == TAB_STAR and self._NextChar()
> > == TAB_BACK_SLASH:
> >                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> >                  self._GetOneChar()
> >                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> > @@ -552,7 +551,7 @@ class FdfParser:
> >                  InComment = True
> >                  HashComment = True
> >              # check for /* comment start
> > -            elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar()
> ==
> > T_CHAR_STAR:
> > +            elif self._CurrentChar() == TAB_BACK_SLASH and
> > + self._NextChar() ==
> > TAB_STAR:
> >                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> >                  self._GetOneChar()
> >                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> > diff --git a/BaseTools/Source/Python/GenFds/GenFds.py
> > b/BaseTools/Source/Python/GenFds/GenFds.py
> > index 0c8091b79841..0513f488fca3 100644
> > --- a/BaseTools/Source/Python/GenFds/GenFds.py
> > +++ b/BaseTools/Source/Python/GenFds/GenFds.py
> > @@ -653,7 +653,7 @@ class GenFds(object):
> >                              FileGuidList.append(FileStatementGuid)
> >                          Name = []
> >                          FfsPath = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
> > -                        FfsPath = glob(os.path.join(FfsPath, FileStatementGuid) + '*')
> > +                        FfsPath = glob(os.path.join(FfsPath,
> > + FileStatementGuid) + TAB_STAR)
> >                          if not FfsPath:
> >                              continue
> >                          if not os.path.exists(FfsPath[0]):
> > diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> > b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> > index ea61f723a73c..0812c56bdae8 100644
> > --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> > +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> > @@ -217,12 +217,12 @@ class GenFdsGlobalVariable:
> >
> >          if not Inf.IsBinaryModule:
> >              for File in Inf.Sources:
> > -                if File.TagName in {"", "*", GenFdsGlobalVariable.ToolChainTag}
> and
> > \
> > -                    File.ToolChainFamily in {"", "*",
> > GenFdsGlobalVariable.ToolChainFamily}:
> > +                if File.TagName in {"", DataType.TAB_STAR,
> > GenFdsGlobalVariable.ToolChainTag} and \
> > +                    File.ToolChainFamily in {"", DataType.TAB_STAR,
> > GenFdsGlobalVariable.ToolChainFamily}:
> >                      FileList.append((File,
> > DataType.TAB_UNKNOWN_FILE))
> >
> >          for File in Inf.Binaries:
> > -            if File.Target in {DataType.TAB_COMMON, '*',
> > GenFdsGlobalVariable.TargetName}:
> > +            if File.Target in {DataType.TAB_COMMON,
> > + DataType.TAB_STAR,
> > GenFdsGlobalVariable.TargetName}:
> >                  FileList.append((File, File.Type))
> >
> >          for File, FileType in FileList:
> > @@ -893,7 +893,7 @@ def FindExtendTool(KeyStringList, CurrentArchList,
> > NameGuid):
> >              for Index in range(2, -1, -1):
> >                  for Key in list(BuildOption.keys()):
> >                      List = Key.split('_')
> > -                    if List[Index] == '*':
> > +                    if List[Index] == DataType.TAB_STAR:
> >                          for String in ToolDb[ToolList[Index]]:
> >                              if String in [Arch,
> > GenFdsGlobalVariable.TargetName,
> > GenFdsGlobalVariable.ToolChainTag]:
> >                                  List[Index] = String diff --git
> > a/BaseTools/Source/Python/GenFds/Section.py
> > b/BaseTools/Source/Python/GenFds/Section.py
> > index 19a70009dcce..bab74aedf0b9 100644
> > --- a/BaseTools/Source/Python/GenFds/Section.py
> > +++ b/BaseTools/Source/Python/GenFds/Section.py
> > @@ -131,7 +131,7 @@ class Section (SectionClassObject):
> >                      if File.Type == FileType or
> > (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \
> >                                                   and FileType ==
> > 'DXE_DPEX' and File.Type ==
> > BINARY_FILE_TYPE_SMM_DEPEX) \
> >                                                   or (FileType ==
> > BINARY_FILE_TYPE_TE and File.Type == BINARY_FILE_TYPE_PE32):
> > -                        if '*' in FfsInf.TargetOverrideList or File.Target == '*' or
> > File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
> > +                        if TAB_STAR in FfsInf.TargetOverrideList or
> > + File.Target ==
> > TAB_STAR or File.Target in FfsInf.TargetOverrideList or
> > FfsInf.TargetOverrideList == []:
> >                              FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type))
> >                          else:
> >                              GenFdsGlobalVariable.InfLogger ("\nBuild
> > Target \'%s\' of File %s is not in the Scope of %s specified by INF %s
> > in FDF" %(File.Target, File.File, FfsInf.TargetOverrideList,
> > FfsInf.InfFileName)) diff --git
> > a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > index 11aa63fb263c..22cbbb119a5a 100644
> > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > @@ -2315,11 +2315,11 @@ class DscBuildData(PlatformBuildClassObject):
> >                  continue
> >              if Attr != "FLAGS":
> >                  continue
> > -            if Target == "*" or Target == self._Target:
> > -                if Tag == "*" or Tag == self._Toolchain:
> > +            if Target == TAB_STAR or Target == self._Target:
> > +                if Tag == TAB_STAR or Tag == self._Toolchain:
> >                      if 'COMMON' not in BuildOptions:
> >                          BuildOptions['COMMON'] = set()
> > -                    if Arch == "*":
> > +                    if Arch == TAB_STAR:
> >                          BuildOptions['COMMON'].add(self.BuildOptions[Options])
> >                      if Arch in self.SupArchList:
> >                          if Arch not in BuildOptions:
> > --
> > 2.16.2.windows.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*'
  2018-12-07  0:50         ` Carsey, Jaben
@ 2018-12-07  0:53           ` Carsey, Jaben
  0 siblings, 0 replies; 8+ messages in thread
From: Carsey, Jaben @ 2018-12-07  0:53 UTC (permalink / raw)
  To: Carsey, Jaben, Zhu, Yonghong, edk2-devel@lists.01.org
  Cc: Gao, Liming, Feng, Bob C

I will submit a new change with those changed back.

-Jaben

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Carsey, Jaben
> Sent: Thursday, December 6, 2018 4:50 PM
> To: Zhu, Yonghong <yonghong.zhu@intel.com>; edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: Re: [edk2] [Patch v1 1/1] BaseTools: create and use a standard
> shared variable for '*'
> Importance: High
> 
> How about undo those and push the remaining?  Since that's a very small
> change.
> 
> -Jaben
> 
> > -----Original Message-----
> > From: Zhu, Yonghong
> > Sent: Monday, December 3, 2018 5:53 PM
> > To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org
> > Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong
> > <yonghong.zhu@intel.com>
> > Subject: RE: [Patch v1 1/1] BaseTools: create and use a standard
> > shared variable for '*'
> > Importance: High
> >
> > Yes.  I prefer not to change it.
> >
> > Best Regards,
> > Zhu Yonghong
> >
> >
> > -----Original Message-----
> > From: Carsey, Jaben
> > Sent: Monday, December 03, 2018 11:19 PM
> > To: Zhu, Yonghong <yonghong.zhu@intel.com>; edk2-devel@lists.01.org
> > Cc: Gao, Liming <liming.gao@intel.com>
> > Subject: RE: [Patch v1 1/1] BaseTools: create and use a standard
> > shared variable for '*'
> >
> > I was trying to change all use of *, without regard to the usage of it.
> >
> > Do you think that mathematical * should not be changed?
> >
> > -Jaben
> >
> > > -----Original Message-----
> > > From: Zhu, Yonghong
> > > Sent: Sunday, December 02, 2018 6:31 PM
> > > To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org
> > > Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong
> > > <yonghong.zhu@intel.com>
> > > Subject: RE: [Patch v1 1/1] BaseTools: create and use a standard
> > > shared variable for '*'
> > > Importance: High
> > >
> > > Hi Jaben,
> > >
> > > In this patch, it also changed the mathematics multiplicative '*'
> > > (used in
> > > expression) to  TAB_STAR, is it by on purpose?
> > > Eg:
> > > -    NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>',
> > '<',
> > > '?', ':']
> > > +    NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^',
> > > + '~', '<<', '>>', '!', '=',
> > > '>', '<', '?', ':']
> > >
> > > Best Regards,
> > > Zhu Yonghong
> > >
> > > -----Original Message-----
> > > From: Carsey, Jaben
> > > Sent: Friday, November 16, 2018 11:40 PM
> > > To: edk2-devel@lists.01.org
> > > Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming
> > > <liming.gao@intel.com>
> > > Subject: [Patch v1 1/1] BaseTools: create and use a standard shared
> > > variable for '*'
> > >
> > > add a variable for the string '*' and then use it instead of lots of '*'
> > >
> > > Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> > > Cc: Liming Gao <liming.gao@intel.com>
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
> > > ---
> > >  BaseTools/Source/Python/AutoGen/AutoGen.py             | 54 ++++++++++-
> --
> > > -------
> > >  BaseTools/Source/Python/AutoGen/BuildEngine.py         | 10 ++--
> > >  BaseTools/Source/Python/BPDG/GenVpd.py                 | 14 ++---
> > >  BaseTools/Source/Python/Common/DataType.py             |  1 +
> > >  BaseTools/Source/Python/Common/Expression.py           |  4 +-
> > >  BaseTools/Source/Python/Common/Misc.py                 |  2 +-
> > >  BaseTools/Source/Python/Common/ToolDefClassObject.py   | 23 +++++-
> ---
> > >  BaseTools/Source/Python/Common/VpdInfoFile.py          |  8 +--
> > >  BaseTools/Source/Python/GenFds/FdfParser.py            |  5 +-
> > >  BaseTools/Source/Python/GenFds/GenFds.py               |  2 +-
> > >  BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py |  8 +--
> > >  BaseTools/Source/Python/GenFds/Section.py              |  2 +-
> > >  BaseTools/Source/Python/Workspace/DscBuildData.py      |  6 +--
> > >  13 files changed, 70 insertions(+), 69 deletions(-)
> > >
> > > diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> > > b/BaseTools/Source/Python/AutoGen/AutoGen.py
> > > index f3560bfc787d..25417c447061 100644
> > > --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> > > +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> > > @@ -1438,7 +1438,7 @@ class PlatformAutoGen(AutoGen):
> > >                          PcdValue = Sku.DefaultValue
> > >                          if PcdValue == "":
> > >                              PcdValue  = Pcd.DefaultValue
> > > -                        if Sku.VpdOffset != '*':
> > > +                        if Sku.VpdOffset != TAB_STAR:
> > >                              if PcdValue.startswith("{"):
> > >                                  Alignment = 8
> > >                              elif PcdValue.startswith("L"):
> > > @@ -1462,7 +1462,7 @@ class PlatformAutoGen(AutoGen):
> > >                              VpdFile.Add(Pcd, SkuName, Sku.VpdOffset)
> > >                          SkuValueMap[PcdValue].append(Sku)
> > >                          # if the offset of a VPD is *, then it need
> > > to be fixed up by third party tool.
> > > -                        if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
> > > +                        if not NeedProcessVpdMapFile and
> > > + Sku.VpdOffset ==
> > > TAB_STAR:
> > >                              NeedProcessVpdMapFile = True
> > >                              if self.Platform.VpdToolGuid is None or
> > > self.Platform.VpdToolGuid == '':
> > >                                  EdkLogger.error("Build",
> > > FILE_NOT_FOUND, \ @@ -1522,7
> > > +1522,7 @@ class PlatformAutoGen(AutoGen):
> > >                                  PcdValue = Sku.DefaultValue
> > >                                  if PcdValue == "":
> > >                                      PcdValue  = DscPcdEntry.DefaultValue
> > > -                                if Sku.VpdOffset != '*':
> > > +                                if Sku.VpdOffset != TAB_STAR:
> > >                                      if PcdValue.startswith("{"):
> > >                                          Alignment = 8
> > >                                      elif PcdValue.startswith("L"):
> > > @@ -1545,7 +1545,7 @@ class PlatformAutoGen(AutoGen):
> > >                                      SkuValueMap[PcdValue] = []
> > >                                      VpdFile.Add(DscPcdEntry, SkuName, Sku.VpdOffset)
> > >                                  SkuValueMap[PcdValue].append(Sku)
> > > -                                if not NeedProcessVpdMapFile and Sku.VpdOffset ==
> > "*":
> > > +                                if not NeedProcessVpdMapFile and
> > > + Sku.VpdOffset ==
> > > TAB_STAR:
> > >                                      NeedProcessVpdMapFile = True
> > >                              if DscPcdEntry.DatumType == TAB_VOID
> > > and
> > > PcdValue.startswith("L"):
> > >                                  UnicodePcdArray.add(DscPcdEntry) @@
> > > -1573,7 +1573,7 @@ class PlatformAutoGen(AutoGen):
> > >                      if os.path.exists(VpdMapFilePath):
> > >                          VpdFile.Read(VpdMapFilePath)
> > >
> > > -                        # Fixup "*" offset
> > > +                        # Fixup TAB_STAR offset
> > >                          for pcd in VpdSkuMap:
> > >                              vpdinfo = VpdFile.GetVpdInfo(pcd)
> > >                              if vpdinfo is None:
> > > @@ -2210,15 +2210,15 @@ class PlatformAutoGen(AutoGen):
> > >      def CalculatePriorityValue(self, Key):
> > >          Target, ToolChain, Arch, CommandType, Attr = Key.split('_')
> > >          PriorityValue = 0x11111
> > > -        if Target == "*":
> > > +        if Target == TAB_STAR:
> > >              PriorityValue &= 0x01111
> > > -        if ToolChain == "*":
> > > +        if ToolChain == TAB_STAR:
> > >              PriorityValue &= 0x10111
> > > -        if Arch == "*":
> > > +        if Arch == TAB_STAR:
> > >              PriorityValue &= 0x11011
> > > -        if CommandType == "*":
> > > +        if CommandType == TAB_STAR:
> > >              PriorityValue &= 0x11101
> > > -        if Attr == "*":
> > > +        if Attr == TAB_STAR:
> > >              PriorityValue &= 0x11110
> > >
> > >          return self.PrioList["0x%0.5x" % PriorityValue] @@ -2253,9
> > > +2253,9 @@ class PlatformAutoGen(AutoGen):
> > >              if (Key[0] == self.BuildRuleFamily and
> > >                  (ModuleStyle is None or len(Key) < 3 or (len(Key) >
> > > 2 and Key[2] ==
> > > ModuleStyle))):
> > >                  Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_')
> > > -                if (Target == self.BuildTarget or Target == "*") and\
> > > -                    (ToolChain == self.ToolChain or ToolChain == "*") and\
> > > -                    (Arch == self.Arch or Arch == "*") and\
> > > +                if (Target == self.BuildTarget or Target == TAB_STAR) and\
> > > +                    (ToolChain == self.ToolChain or ToolChain == TAB_STAR)
> and\
> > > +                    (Arch == self.Arch or Arch == TAB_STAR) and\
> > >                      Options[Key].startswith("="):
> > >
> > >                      if OverrideList.get(Key[1]) is not None:
> > > @@ -2276,11 +2276,11 @@ class PlatformAutoGen(AutoGen):
> > >                      # Compare two Key, if one is included by
> > > another, choose the higher priority one
> > >                      #
> > >                      Target2, ToolChain2, Arch2, CommandType2, Attr2
> > > =
> > > NextKey.split("_")
> > > -                    if (Target1 == Target2 or Target1 == "*" or Target2 == "*")
> and\
> > > -                        (ToolChain1 == ToolChain2 or ToolChain1 == "*" or
> > ToolChain2
> > > == "*") and\
> > > -                        (Arch1 == Arch2 or Arch1 == "*" or Arch2 == "*") and\
> > > -                        (CommandType1 == CommandType2 or CommandType1 ==
> > "*"
> > > or CommandType2 == "*") and\
> > > -                        (Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*"):
> > > +                    if (Target1 == Target2 or Target1 == TAB_STAR
> > > + or
> > > + Target2 ==
> > > TAB_STAR) and\
> > > +                        (ToolChain1 == ToolChain2 or ToolChain1 ==
> > > + TAB_STAR or
> > > ToolChain2 == TAB_STAR) and\
> > > +                        (Arch1 == Arch2 or Arch1 == TAB_STAR or
> > > + Arch2 == TAB_STAR)
> > > and\
> > > +                        (CommandType1 == CommandType2 or
> > > + CommandType1 ==
> > > TAB_STAR or CommandType2 == TAB_STAR) and\
> > > +                        (Attr1 == Attr2 or Attr1 == TAB_STAR or Attr2 ==
> TAB_STAR):
> > >
> > >                          if self.CalculatePriorityValue(NowKey) >
> > > self.CalculatePriorityValue(NextKey):
> > >                              if Options.get((self.BuildRuleFamily, NextKey)) is not
> None:
> > > @@ -2309,9 +2309,9 @@ class PlatformAutoGen(AutoGen):
> > >                      continue
> > >                  FamilyMatch = True
> > >              # expand any wildcard
> > > -            if Target == "*" or Target == self.BuildTarget:
> > > -                if Tag == "*" or Tag == self.ToolChain:
> > > -                    if Arch == "*" or Arch == self.Arch:
> > > +            if Target == TAB_STAR or Target == self.BuildTarget:
> > > +                if Tag == TAB_STAR or Tag == self.ToolChain:
> > > +                    if Arch == TAB_STAR or Arch == self.Arch:
> > >                          if Tool not in BuildOptions:
> > >                              BuildOptions[Tool] = {}
> > >                          if Attr != "FLAGS" or Attr not in
> > > BuildOptions[Tool] or
> > > Options[Key].startswith('='):
> > > @@ -2344,9 +2344,9 @@ class PlatformAutoGen(AutoGen):
> > >                  continue
> > >
> > >              # expand any wildcard
> > > -            if Target == "*" or Target == self.BuildTarget:
> > > -                if Tag == "*" or Tag == self.ToolChain:
> > > -                    if Arch == "*" or Arch == self.Arch:
> > > +            if Target == TAB_STAR or Target == self.BuildTarget:
> > > +                if Tag == TAB_STAR or Tag == self.ToolChain:
> > > +                    if Arch == TAB_STAR or Arch == self.Arch:
> > >                          if Tool not in BuildOptions:
> > >                              BuildOptions[Tool] = {}
> > >                          if Attr != "FLAGS" or Attr not in
> > > BuildOptions[Tool] or
> > > Options[Key].startswith('='):
> > > @@ -2971,8 +2971,8 @@ class ModuleAutoGen(AutoGen):
> > >      @cached_property
> > >      def SourceFileList(self):
> > >          RetVal = []
> > > -        ToolChainTagSet = {"", "*", self.ToolChain}
> > > -        ToolChainFamilySet = {"", "*", self.ToolChainFamily,
> > > self.BuildRuleFamily}
> > > +        ToolChainTagSet = {"", TAB_STAR, self.ToolChain}
> > > +        ToolChainFamilySet = {"", TAB_STAR, self.ToolChainFamily,
> > > + self.BuildRuleFamily}
> > >          for F in self.Module.Sources:
> > >              # match tool chain
> > >              if F.TagName not in ToolChainTagSet:
> > > @@ -3047,7 +3047,7 @@ class ModuleAutoGen(AutoGen):
> > >      def BinaryFileList(self):
> > >          RetVal = []
> > >          for F in self.Module.Binaries:
> > > -            if F.Target not in [TAB_ARCH_COMMON, '*'] and F.Target !=
> > > self.BuildTarget:
> > > +            if F.Target not in [TAB_ARCH_COMMON, TAB_STAR] and
> > > + F.Target !=
> > > self.BuildTarget:
> > >                  continue
> > >              RetVal.append(F)
> > >              self._ApplyBuildRule(F, F.Type, BinaryFileList=RetVal)
> > > diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py
> > > b/BaseTools/Source/Python/AutoGen/BuildEngine.py
> > > index ac7a6687552c..f9e3ac3a1daf 100644
> > > --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
> > > +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
> > > @@ -110,7 +110,7 @@ class FileBuildRule:
> > >          self.IncListFileMacro = self.INC_LIST_MACRO
> > >
> > >          self.SourceFileType = Type
> > > -        # source files listed not in "*" or "?" pattern format
> > > +        # source files listed not in TAB_STAR or "?" pattern format
> > >          if not ExtraDependency:
> > >              self.ExtraSourceFileList = []
> > >          else:
> > > @@ -150,12 +150,12 @@ class FileBuildRule:
> > >          self.SourceFileExtList = set()
> > >          for File in Input:
> > >              Base, Ext = os.path.splitext(File)
> > > -            if Base.find("*") >= 0:
> > > -                # There's "*" in the file name
> > > +            if Base.find(TAB_STAR) >= 0:
> > > +                # There's TAB_STAR in the file name
> > >                  self.IsMultipleInput = True
> > >                  self.GenFileListMacro = True
> > >              elif Base.find("?") < 0:
> > > -                # There's no "*" and "?" in file name
> > > +                # There's no TAB_STAR and "?" in file name
> > >                  self.ExtraSourceFileList.append(File)
> > >                  continue
> > >              self.SourceFileExtList.add(Ext) @@ -553,7 +553,7 @@
> > > class
> > BuildRule:
> > >      #
> > >      #   @param  FileExt             The extension of a file
> > >      #   @param  ToolChainFamily     The tool chain family name
> > > -    #   @param  BuildVersion        The build version number. "*" means
> any
> > > rule
> > > +    #   @param  BuildVersion        The build version number. TAB_STAR
> > means
> > > any rule
> > >      #                               is applicalbe.
> > >      #
> > >      #   @retval FileType        The file type string
> > > diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py
> > > b/BaseTools/Source/Python/BPDG/GenVpd.py
> > > index d7852d29eed0..e5da47f95e63 100644
> > > --- a/BaseTools/Source/Python/BPDG/GenVpd.py
> > > +++ b/BaseTools/Source/Python/BPDG/GenVpd.py
> > > @@ -21,7 +21,7 @@ import array
> > >  import re
> > >  from Common.LongFilePathSupport import OpenLongFilePath as open
> > from
> > > struct import * -from Common.DataType import MAX_SIZE_TYPE,
> > > MAX_VAL_TYPE
> > > +from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE,
> > > TAB_STAR
> > >  import Common.EdkLogger as EdkLogger  import
> Common.BuildToolError
> > > as BuildToolError
> > >
> > > @@ -87,7 +87,7 @@ class PcdEntry:
> > >      #  for both hexadecimal and decimal.
> > >      #
> > >      def _GenOffsetValue(self):
> > > -        if self.PcdOffset != "*" :
> > > +        if self.PcdOffset != TAB_STAR:
> > >              try:
> > >                  self.PcdBinOffset = int (self.PcdOffset)
> > >              except:
> > > @@ -423,7 +423,7 @@ class GenVPD :
> > >                      Alignment = 1
> > >
> > >                  PCD.Alignment = Alignment
> > > -                if PCD.PcdOffset != '*':
> > > +                if PCD.PcdOffset != TAB_STAR:
> > >                      if PCD.PcdOccupySize % Alignment != 0:
> > >                          if PCD.PcdUnpackValue.startswith("{"):
> > >                              EdkLogger.warn("BPDG", "The offset
> > > value of PCD %s is not 8- byte aligned!" %(PCD.PcdCName),
> > > File=self.InputFileName) @@ -469,7
> > > +469,7 @@ class GenVPD :
> > >      def FormatFileLine (self) :
> > >
> > >          for eachPcd in self.FileLinesList :
> > > -            if eachPcd.PcdOffset != '*' :
> > > +            if eachPcd.PcdOffset != TAB_STAR :
> > >                  # Use pcd's Offset value as key, and pcd's Value as value
> > >                  self.PcdFixedOffsetSizeList.append(eachPcd)
> > >              else :
> > > @@ -484,7 +484,7 @@ class GenVPD :
> > >      def FixVpdOffset (self):
> > >          # At first, the offset should start at 0
> > >          # Sort fixed offset list in order to find out where has
> > > free spaces for the pcd's offset
> > > -        # value is "*" to insert into.
> > > +        # value is TAB_STAR to insert into.
> > >
> > >          self.PcdFixedOffsetSizeList.sort(key=lambda x:
> > > x.PcdBinOffset)
> > >
> > > @@ -502,7 +502,7 @@ class GenVPD :
> > >                          self.PcdUnknownOffsetList[index+i -1 ],
> > > self.PcdUnknownOffsetList[index+i] =
> > > self.PcdUnknownOffsetList[index+i],
> > > self.PcdUnknownOffsetList[index+i -1]
> > >
> > >          #
> > > -        # Process all Offset value are "*"
> > > +        # Process all Offset value are TAB_STAR
> > >          #
> > >          if (len(self.PcdFixedOffsetSizeList) == 0) and
> > > (len(self.PcdUnknownOffsetList) != 0) :
> > >              # The offset start from 0 @@ -571,7 +571,7 @@ class
> > > GenVPD :
> > >                          eachUnfixedPcd      =
> > > self.PcdUnknownOffsetList[countOfUnfixedList]
> > >                          needFixPcdSize      = eachUnfixedPcd.PcdOccupySize
> > >                          # Not been fixed
> > > -                        if eachUnfixedPcd.PcdOffset == '*' :
> > > +                        if eachUnfixedPcd.PcdOffset == TAB_STAR :
> > >                              if LastOffset % eachUnfixedPcd.Alignment != 0:
> > >                                  LastOffset = (LastOffset /
> > > eachUnfixedPcd.Alignment + 1) * eachUnfixedPcd.Alignment
> > >                              # The offset un-fixed pcd can write
> > > into this free space diff -- git
> > > a/BaseTools/Source/Python/Common/DataType.py
> > > b/BaseTools/Source/Python/Common/DataType.py
> > > index 1d1d22faa40b..6b375712b65e 100644
> > > --- a/BaseTools/Source/Python/Common/DataType.py
> > > +++ b/BaseTools/Source/Python/Common/DataType.py
> > > @@ -31,6 +31,7 @@ TAB_OPTION_START = '<'
> > >  TAB_OPTION_END = '>'
> > >  TAB_SLASH = '\\'
> > >  TAB_BACK_SLASH = '/'
> > > +TAB_STAR = '*'
> > >  TAB_LINE_BREAK = '\n'
> > >  TAB_PRINTCHAR_VT = '\x0b'
> > >  TAB_PRINTCHAR_BS = '\b'
> > > diff --git a/BaseTools/Source/Python/Common/Expression.py
> > > b/BaseTools/Source/Python/Common/Expression.py
> > > index a21ab5daa73e..db1310d534fb 100644
> > > --- a/BaseTools/Source/Python/Common/Expression.py
> > > +++ b/BaseTools/Source/Python/Common/Expression.py
> > > @@ -244,7 +244,7 @@ class ValueExpression(BaseExpression):
> > >          'IN' : 'in'
> > >      }
> > >
> > > -    NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>',
> > '<',
> > > '?', ':']
> > > +    NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^',
> > > + '~', '<<', '>>', '!', '=', '>', '<', '?', ':']
> > >
> > >
> > >      SymbolPattern = re.compile("("
> > > @@ -498,7 +498,7 @@ class ValueExpression(BaseExpression):
> > >
> > >      # A [ * B]*
> > >      def _MulExpr(self):
> > > -        return self._ExprFuncTemplate(self._UnaryExpr, {"*", "/", "%"})
> > > +        return self._ExprFuncTemplate(self._UnaryExpr, {TAB_STAR,
> > > + "/",
> > > + "%"})
> > >
> > >      # [!]*A
> > >      def _UnaryExpr(self):
> > > diff --git a/BaseTools/Source/Python/Common/Misc.py
> > > b/BaseTools/Source/Python/Common/Misc.py
> > > index 3b8efb2e7179..61ba79241fb6 100644
> > > --- a/BaseTools/Source/Python/Common/Misc.py
> > > +++ b/BaseTools/Source/Python/Common/Misc.py
> > > @@ -1088,7 +1088,7 @@ class tdict:
> > >      _ListType = type([])
> > >      _TupleType = type(())
> > >      _Wildcard = 'COMMON'
> > > -    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', '*', 'PLATFORM']
> > > +    _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', TAB_STAR,
> > > + 'PLATFORM']
> > >
> > >      def __init__(self, _Single_=False, _Level_=2):
> > >          self._Level_ = _Level_
> > > diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py
> > > b/BaseTools/Source/Python/Common/ToolDefClassObject.py
> > > index 05a1ddfbcc89..186d279840c1 100644
> > > --- a/BaseTools/Source/Python/Common/ToolDefClassObject.py
> > > +++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py
> > > @@ -29,7 +29,8 @@ from Common import GlobalData  from
> > > Common.MultipleWorkspace import MultipleWorkspace as mws  from
> > > .DataType import TAB_TOD_DEFINES_TARGET,
> > > TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\
> > >                       TAB_TOD_DEFINES_TARGET_ARCH,
> > > TAB_TOD_DEFINES_COMMAND_TYPE\
> > > -                     , TAB_TOD_DEFINES_FAMILY,
> > > TAB_TOD_DEFINES_BUILDRULEFAMILY
> > > +                     , TAB_TOD_DEFINES_FAMILY,
> > > TAB_TOD_DEFINES_BUILDRULEFAMILY,\
> > > +                     TAB_STAR, TAB_TAT_DEFINES_TOOL_CHAIN_CONF
> > >
> > >
> > >  ##
> > > @@ -97,7 +98,7 @@ class ToolDefClassObject(object):
> > >              # adding/removing items from the original dict.
> > >              for Key in list(self.ToolsDefTxtDictionary.keys()):
> > >                  List = Key.split('_')
> > > -                if List[Index] == '*':
> > > +                if List[Index] == TAB_STAR:
> > >                      for String in self.ToolsDefTxtDatabase[KeyList[Index]]:
> > >                          List[Index] = String
> > >                          NewKey = '%s_%s_%s_%s_%s' % tuple(List) @@
> > > -202,20 +203,20 @@ class ToolDefClassObject(object):
> > >              if len(List) != 5:
> > >                  EdkLogger.verbose("Line %d: Not a valid name of
> > > definition: %s" % ((Index + 1), Name))
> > >                  continue
> > > -            elif List[4] == '*':
> > > +            elif List[4] == TAB_STAR:
> > >                  EdkLogger.verbose("Line %d: '*' is not allowed in
> > > last field: %s" % ((Index + 1), Name))
> > >                  continue
> > >              else:
> > >                  self.ToolsDefTxtDictionary[Name] = Value
> > > -                if List[0] != '*':
> > > +                if List[0] != TAB_STAR:
> > >
> > > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET]
> > > += [List[0]]
> > > -                if List[1] != '*':
> > > +                if List[1] != TAB_STAR:
> > >
> > > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG]
> > > += [List[1]]
> > > -                if List[2] != '*':
> > > +                if List[2] != TAB_STAR:
> > >
> > > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] += [List[2]]
> > > -                if List[3] != '*':
> > > +                if List[3] != TAB_STAR:
> > >
> > > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE]
> > > += [List[3]]
> > > -                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == '*' and
> > List[3]
> > > == '*':
> > > +                if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] ==
> > > + TAB_STAR
> > > and List[3] == TAB_STAR:
> > >                      if TAB_TOD_DEFINES_FAMILY not in
> self.ToolsDefTxtDatabase:
> > >
> > > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = {}
> > >
> > > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] = Value
> @@
> > -226,7 +227,7 @@ class ToolDefClassObject(object):
> > >
> > > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]]
> =
> > > Value
> > >                      elif
> > > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]]
> > > != Value:
> > >                          EdkLogger.verbose("Line %d: No override
> > > allowed for the family of a tool chain: %s" % ((Index + 1), Name))
> > > -                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] ==
> > '*'
> > > and List[3] == '*':
> > > +                if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and
> > > + List[2] ==
> > > TAB_STAR and List[3] == TAB_STAR:
> > >                      if TAB_TOD_DEFINES_BUILDRULEFAMILY not in
> > > self.ToolsDefTxtDatabase \
> > >                         or List[1] not in
> > > self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:
> > >                          EdkLogger.verbose("Line %d: The family is
> > > not specified, but BuildRuleFamily is specified for the tool chain:
> > > %s" % ((Index + 1), Name)) @@ -270,8 +271,8 @@ class
> > ToolDefClassObject(object):
> > >  def ToolDefDict(ConfDir):
> > >      Target = TargetTxtDict(ConfDir)
> > >      ToolDef = ToolDefClassObject()
> > > -    if DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF in
> > > Target.TargetTxtDictionary:
> > > -        ToolsDefFile =
> > >
> >
> Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CON
> > > F]
> > > +    if TAB_TAT_DEFINES_TOOL_CHAIN_CONF in
> Target.TargetTxtDictionary:
> > > +        ToolsDefFile =
> > > + Target.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
> > >          if ToolsDefFile:
> > >              ToolDef.LoadToolDefFile(os.path.normpath(ToolsDefFile))
> > >          else:
> > > diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py
> > > b/BaseTools/Source/Python/Common/VpdInfoFile.py
> > > index 2fb8e66fe99c..3be0670e36fb 100644
> > > --- a/BaseTools/Source/Python/Common/VpdInfoFile.py
> > > +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
> > > @@ -57,7 +57,7 @@ FILE_COMMENT_TEMPLATE = \
> > >  #  <PcdName>         ::=  <TokenSpaceCName> "." <PcdCName>
> > >  #  <TokenSpaceCName> ::=  C Variable Name of the Token Space GUID
> > >  #  <PcdCName>        ::=  C Variable Name of the PCD
> > > -#  <Offset>          ::=  {"*"} {<HexNumber>}
> > > +#  <Offset>          ::=  {TAB_STAR} {<HexNumber>}
> > >  #  <HexNumber>       ::=  "0x" (a-fA-F0-9){1,8}
> > >  #  <Size>            ::=  <HexNumber>
> > >  #  <Value>           ::=  {<HexNumber>} {<NonNegativeInt>} {<QString>}
> > > {<Array>}
> > > @@ -92,7 +92,7 @@ class VpdInfoFile:
> > >          if (Vpd is None):
> > >              EdkLogger.error("VpdInfoFile",
> > > BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
> > >
> > > -        if not (Offset >= 0 or Offset == "*"):
> > > +        if not (Offset >= 0 or Offset == TAB_STAR):
> > >              EdkLogger.error("VpdInfoFile",
> > > BuildToolError.PARAMETER_INVALID, "Invalid offset parameter: %s." %
> > > Offset)
> > >
> > >          if Vpd.DatumType == TAB_VOID:
> > > @@ -186,8 +186,8 @@ class VpdInfoFile:
> > >                          VpdObjectTokenCName = PcdItem[0]
> > >                  for sku in VpdObject.SkuInfoList:
> > >                      if VpdObject.TokenSpaceGuidCName ==
> > > TokenSpaceName and VpdObjectTokenCName == PcdTokenName.strip()
> > and sku == SkuId:
> > > -                        if self._VpdArray[VpdObject][sku] == "*":
> > > -                            if Offset == "*":
> > > +                        if self._VpdArray[VpdObject][sku] == TAB_STAR:
> > > +                            if Offset == TAB_STAR:
> > >                                  EdkLogger.error("BPDG",
> > > BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed
> > > up by third-party BPDG tool." %
> > > PcdName)
> > >                              self._VpdArray[VpdObject][sku] = Offset
> > >                          Found = True diff --git
> > > a/BaseTools/Source/Python/GenFds/FdfParser.py
> > > b/BaseTools/Source/Python/GenFds/FdfParser.py
> > > index 44cc8f63d07b..cedc4ea0c122 100644
> > > --- a/BaseTools/Source/Python/GenFds/FdfParser.py
> > > +++ b/BaseTools/Source/Python/GenFds/FdfParser.py
> > > @@ -64,7 +64,6 @@ T_CHAR_CR = '\r'
> > >  T_CHAR_TAB = '\t'
> > >  T_CHAR_DOUBLE_QUOTE = '\"'
> > >  T_CHAR_SINGLE_QUOTE = '\''
> > > -T_CHAR_STAR = '*'
> > >  T_CHAR_BRACE_R = '}'
> > >
> > >  SEPARATORS = {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT,
> > TAB_COMMA_SPLIT, '{',
> > > T_CHAR_BRACE_R} @@ -533,7 +532,7 @@ class
> > > FdfParser:
> > >                      InComment = False
> > >                      HashComment = False
> > >              # check for */ comment end
> > > -            elif InComment and not DoubleSlashComment and not
> > HashComment
> > > and self._CurrentChar() == T_CHAR_STAR and self._NextChar() ==
> > > TAB_BACK_SLASH:
> > > +            elif InComment and not DoubleSlashComment and not
> > > HashComment and self._CurrentChar() == TAB_STAR and
> self._NextChar()
> > > == TAB_BACK_SLASH:
> > >                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> > >                  self._GetOneChar()
> > >                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> > > @@ -552,7 +551,7 @@ class FdfParser:
> > >                  InComment = True
> > >                  HashComment = True
> > >              # check for /* comment start
> > > -            elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar()
> > ==
> > > T_CHAR_STAR:
> > > +            elif self._CurrentChar() == TAB_BACK_SLASH and
> > > + self._NextChar() ==
> > > TAB_STAR:
> > >                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> > >                  self._GetOneChar()
> > >                  self._SetCurrentCharValue(TAB_SPACE_SPLIT)
> > > diff --git a/BaseTools/Source/Python/GenFds/GenFds.py
> > > b/BaseTools/Source/Python/GenFds/GenFds.py
> > > index 0c8091b79841..0513f488fca3 100644
> > > --- a/BaseTools/Source/Python/GenFds/GenFds.py
> > > +++ b/BaseTools/Source/Python/GenFds/GenFds.py
> > > @@ -653,7 +653,7 @@ class GenFds(object):
> > >                              FileGuidList.append(FileStatementGuid)
> > >                          Name = []
> > >                          FfsPath = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
> > > -                        FfsPath = glob(os.path.join(FfsPath, FileStatementGuid) +
> '*')
> > > +                        FfsPath = glob(os.path.join(FfsPath,
> > > + FileStatementGuid) + TAB_STAR)
> > >                          if not FfsPath:
> > >                              continue
> > >                          if not os.path.exists(FfsPath[0]):
> > > diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> > > b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> > > index ea61f723a73c..0812c56bdae8 100644
> > > --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> > > +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
> > > @@ -217,12 +217,12 @@ class GenFdsGlobalVariable:
> > >
> > >          if not Inf.IsBinaryModule:
> > >              for File in Inf.Sources:
> > > -                if File.TagName in {"", "*", GenFdsGlobalVariable.ToolChainTag}
> > and
> > > \
> > > -                    File.ToolChainFamily in {"", "*",
> > > GenFdsGlobalVariable.ToolChainFamily}:
> > > +                if File.TagName in {"", DataType.TAB_STAR,
> > > GenFdsGlobalVariable.ToolChainTag} and \
> > > +                    File.ToolChainFamily in {"", DataType.TAB_STAR,
> > > GenFdsGlobalVariable.ToolChainFamily}:
> > >                      FileList.append((File,
> > > DataType.TAB_UNKNOWN_FILE))
> > >
> > >          for File in Inf.Binaries:
> > > -            if File.Target in {DataType.TAB_COMMON, '*',
> > > GenFdsGlobalVariable.TargetName}:
> > > +            if File.Target in {DataType.TAB_COMMON,
> > > + DataType.TAB_STAR,
> > > GenFdsGlobalVariable.TargetName}:
> > >                  FileList.append((File, File.Type))
> > >
> > >          for File, FileType in FileList:
> > > @@ -893,7 +893,7 @@ def FindExtendTool(KeyStringList,
> > > CurrentArchList,
> > > NameGuid):
> > >              for Index in range(2, -1, -1):
> > >                  for Key in list(BuildOption.keys()):
> > >                      List = Key.split('_')
> > > -                    if List[Index] == '*':
> > > +                    if List[Index] == DataType.TAB_STAR:
> > >                          for String in ToolDb[ToolList[Index]]:
> > >                              if String in [Arch,
> > > GenFdsGlobalVariable.TargetName,
> > > GenFdsGlobalVariable.ToolChainTag]:
> > >                                  List[Index] = String diff --git
> > > a/BaseTools/Source/Python/GenFds/Section.py
> > > b/BaseTools/Source/Python/GenFds/Section.py
> > > index 19a70009dcce..bab74aedf0b9 100644
> > > --- a/BaseTools/Source/Python/GenFds/Section.py
> > > +++ b/BaseTools/Source/Python/GenFds/Section.py
> > > @@ -131,7 +131,7 @@ class Section (SectionClassObject):
> > >                      if File.Type == FileType or
> > > (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \
> > >                                                   and FileType ==
> > > 'DXE_DPEX' and File.Type ==
> > > BINARY_FILE_TYPE_SMM_DEPEX) \
> > >                                                   or (FileType ==
> > > BINARY_FILE_TYPE_TE and File.Type == BINARY_FILE_TYPE_PE32):
> > > -                        if '*' in FfsInf.TargetOverrideList or File.Target == '*' or
> > > File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
> > > +                        if TAB_STAR in FfsInf.TargetOverrideList or
> > > + File.Target ==
> > > TAB_STAR or File.Target in FfsInf.TargetOverrideList or
> > > FfsInf.TargetOverrideList == []:
> > >                              FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type))
> > >                          else:
> > >                              GenFdsGlobalVariable.InfLogger
> > > ("\nBuild Target \'%s\' of File %s is not in the Scope of %s
> > > specified by INF %s in FDF" %(File.Target, File.File,
> > > FfsInf.TargetOverrideList,
> > > FfsInf.InfFileName)) diff --git
> > > a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > index 11aa63fb263c..22cbbb119a5a 100644
> > > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > @@ -2315,11 +2315,11 @@ class
> DscBuildData(PlatformBuildClassObject):
> > >                  continue
> > >              if Attr != "FLAGS":
> > >                  continue
> > > -            if Target == "*" or Target == self._Target:
> > > -                if Tag == "*" or Tag == self._Toolchain:
> > > +            if Target == TAB_STAR or Target == self._Target:
> > > +                if Tag == TAB_STAR or Tag == self._Toolchain:
> > >                      if 'COMMON' not in BuildOptions:
> > >                          BuildOptions['COMMON'] = set()
> > > -                    if Arch == "*":
> > > +                    if Arch == TAB_STAR:
> > >                          BuildOptions['COMMON'].add(self.BuildOptions[Options])
> > >                      if Arch in self.SupArchList:
> > >                          if Arch not in BuildOptions:
> > > --
> > > 2.16.2.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-12-07  0:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1542382796.git.jaben.carsey@intel.com>
2018-11-16 15:40 ` [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*' Jaben Carsey
2018-11-27 18:02   ` Carsey, Jaben
2018-11-28  7:37   ` Feng, Bob C
2018-12-03  2:30   ` Zhu, Yonghong
2018-12-03 15:19     ` Carsey, Jaben
2018-12-04  1:52       ` Zhu, Yonghong
2018-12-07  0:50         ` Carsey, Jaben
2018-12-07  0:53           ` Carsey, Jaben

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox