From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 057BC211BA45E for ; Fri, 25 Jan 2019 00:58:31 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jan 2019 00:58:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,520,1539673200"; d="scan'208";a="294315051" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.47]) by orsmga005.jf.intel.com with ESMTP; 25 Jan 2019 00:58:29 -0800 From: "Feng, Bob C" To: edk2-devel@lists.01.org Cc: Bob Feng , Liming Gao Date: Fri, 25 Jan 2019 16:58:27 +0800 Message-Id: <20190125085827.5052-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Subject: [Patch] BaseTools: Enable CODE format in DEC file X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2019 08:58:32 -0000 Content-Transfer-Encoding: 8bit Enable CODE format in DEC File. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng Cc: Liming Gao --- .../Source/Python/Workspace/DscBuildData.py | 38 +++---- .../Source/Python/Workspace/MetaFileParser.py | 99 ++++++++++++------- BaseTools/Source/Python/build/BuildReport.py | 2 +- 3 files changed, 86 insertions(+), 53 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 0dad04212e..4c3c9b8d34 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1786,20 +1786,21 @@ class DscBuildData(PlatformBuildClassObject): Value = ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True) except BadExpression: EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2])) Value, ValueSize = ParseFieldValue(Value) - CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]); + if not Pcd.IsArray: + CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]); else: NewFieldName = '' FieldName_ori = FieldName.strip('.') while '[' in FieldName: NewFieldName = NewFieldName + FieldName.split('[', 1)[0] + '[0]' ArrayIndex = int(FieldName.split('[', 1)[1].split(']', 1)[0]) FieldName = FieldName.split(']', 1)[1] FieldName = NewFieldName + FieldName - while '[' in FieldName: + while '[' in FieldName and not Pcd.IsArray: FieldName = FieldName.rsplit('[', 1)[0] CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ArrayIndex + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], FieldList[FieldName_ori][0]) for skuname in Pcd.SkuOverrideValues: if skuname == TAB_COMMON: continue @@ -1817,20 +1818,21 @@ class DscBuildData(PlatformBuildClassObject): Value = ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True) except BadExpression: EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2])) Value, ValueSize = ParseFieldValue(Value) - CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]); + if not Pcd.IsArray: + CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]); else: NewFieldName = '' FieldName_ori = FieldName.strip('.') while '[' in FieldName: NewFieldName = NewFieldName + FieldName.split('[', 1)[0] + '[0]' ArrayIndex = int(FieldName.split('[', 1)[1].split(']', 1)[0]) FieldName = FieldName.split(']', 1)[1] FieldName = NewFieldName + FieldName - while '[' in FieldName: + while '[' in FieldName and not Pcd.IsArray: FieldName = FieldName.rsplit('[', 1)[0] CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), ArrayIndex + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], FieldList[FieldName_ori][0]) if Pcd.PcdFieldValueFromFdf: CApp = CApp + "// From fdf \n" for FieldName in Pcd.PcdFieldValueFromFdf: @@ -1841,11 +1843,12 @@ class DscBuildData(PlatformBuildClassObject): Value = ValueExpressionEx(Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True) except BadExpression: EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][1], Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][2])) Value, ValueSize = ParseFieldValue(Value) - CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][1], Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][2], Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][0]); + if not Pcd.IsArray: + CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][1], Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][2], Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][0]); else: NewFieldName = '' FieldName_ori = FieldName.strip('.') while '[' in FieldName: NewFieldName = NewFieldName + FieldName.split('[', 1)[0] + '[0]' @@ -1865,20 +1868,21 @@ class DscBuildData(PlatformBuildClassObject): Value = ValueExpressionEx(Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True) except BadExpression: EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), Pcd.PcdFieldValueFromComm[FieldName.strip(".")][1], Pcd.PcdFieldValueFromComm[FieldName.strip(".")][2])) Value, ValueSize = ParseFieldValue(Value) - CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), Pcd.PcdFieldValueFromComm[FieldName.strip(".")][1], Pcd.PcdFieldValueFromComm[FieldName.strip(".")][2], Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0]); + if not Pcd.IsArray: + CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), Pcd.PcdFieldValueFromComm[FieldName.strip(".")][1], Pcd.PcdFieldValueFromComm[FieldName.strip(".")][2], Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0]); else: NewFieldName = '' FieldName_ori = FieldName.strip('.') while '[' in FieldName: NewFieldName = NewFieldName + FieldName.split('[', 1)[0] + '[0]' ArrayIndex = int(FieldName.split('[', 1)[1].split(']', 1)[0]) FieldName = FieldName.split(']', 1)[1] FieldName = NewFieldName + FieldName - while '[' in FieldName: + while '[' in FieldName and not Pcd.IsArray: FieldName = FieldName.rsplit('[', 1)[0] CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), ArrayIndex + 1, Pcd.PcdFieldValueFromComm[FieldName_ori][1], Pcd.PcdFieldValueFromComm[FieldName_ori][2], Pcd.PcdFieldValueFromComm[FieldName_ori][0]) if Pcd.GetPcdMaxSize(): CApp = CApp + " *Size = (%d > *Size ? %d : *Size); // The Pcd maxsize is %d \n" % (Pcd.GetPcdMaxSize(), Pcd.GetPcdMaxSize(), Pcd.GetPcdMaxSize()) CApp = CApp + "}\n" @@ -1905,14 +1909,15 @@ class DscBuildData(PlatformBuildClassObject): PcdDefValue = Pcd.SkuInfoList.get(skuname).DefaultValue else: PcdDefValue = Pcd.DefaultValue if lastoneisEmpty: if "{CODE(" not in PcdDefValue: - sizebasevalue_plus = "(%s / sizeof(%s) + 1)" % ((DscBuildData.GetStructurePcdMaxSize(Pcd), "".join(r_datatype))) - sizebasevalue = "(%s / sizeof(%s))" % ((DscBuildData.GetStructurePcdMaxSize(Pcd), "".join(r_datatype))) + sizebasevalue_plus = "(%s / sizeof(%s) + 1)" % ((DscBuildData.GetStructurePcdMaxSize(Pcd), Pcd.BaseDatumType)) + sizebasevalue = "(%s / sizeof(%s))" % ((DscBuildData.GetStructurePcdMaxSize(Pcd), Pcd.BaseDatumType)) sizeof = "sizeof(%s)" % Pcd.BaseDatumType - CApp = ' Size = %s %% %s ? %s : %s ;\n' % ( (DscBuildData.GetStructurePcdMaxSize(Pcd), sizeof, sizebasevalue_plus, sizebasevalue)) + CApp = ' int ArraySize = %s %% %s ? %s : %s ;\n' % ( (DscBuildData.GetStructurePcdMaxSize(Pcd), sizeof, sizebasevalue_plus, sizebasevalue)) + CApp += ' Size = ArraySize * sizeof(%s); \n' % Pcd.BaseDatumType else: CApp = " Size = 0;\n" else: CApp = ' Size = sizeof(%s);\n' % ("".join(r_datatype) ) else: @@ -1968,21 +1973,21 @@ class DscBuildData(PlatformBuildClassObject): except BadExpression: EdkLogger.error("Build", FORMAT_INVALID, "Invalid value format for %s.%s, from DEC: %s" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, DefaultValueFromDec)) DefaultValueFromDec = StringToArray(DefaultValueFromDec) Value, ValueSize = ParseFieldValue (DefaultValueFromDec) - if isinstance(Value, str): - CApp = CApp + ' Pcd = %s; // From DEC Default Value %s\n' % (Value, Pcd.DefaultValueFromDec) - elif IsArray: + if IsArray: # # Use memcpy() to copy value into field # if "{CODE(" in Pcd.DefaultValueFromDec: CApp = CApp + ' memcpy (Pcd, %s_%s_INIT_Value, sizeof(%s_%s_INIT_Value));\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.TokenSpaceGuidCName, Pcd.TokenCName) else: CApp = CApp + ' Value = %s; // From DEC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DefaultValueFromDec) CApp = CApp + ' memcpy (Pcd, Value, %d);\n' % (ValueSize) + elif isinstance(Value, str): + CApp = CApp + ' Pcd = %s; // From DEC Default Value %s\n' % (Value, Pcd.DefaultValueFromDec) for index in Pcd.DefaultValues: FieldList = Pcd.DefaultValues[index] if not FieldList: continue for FieldName in FieldList: @@ -1998,22 +2003,21 @@ class DscBuildData(PlatformBuildClassObject): Value, ValueSize = ParseFieldValue (FieldList[FieldName][0]) except Exception: EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2])) indicator = self.GetIndicator(index, FieldName,Pcd) - if isinstance(Value, str): - CApp = CApp + ' %s = %s; // From %s Line %d Value %s\n' % (indicator, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0]) - elif IsArray: + if IsArray: # # Use memcpy() to copy value into field # CApp = CApp + ' FieldSize = __FIELD_SIZE(%s, %s);\n' % (Pcd.DatumType, FieldName) CApp = CApp + ' Value = %s; // From %s Line %d Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0]) CApp = CApp + ' __STATIC_ASSERT((__FIELD_SIZE(%s, %s) >= %d) || (__FIELD_SIZE(%s, %s) == 0), "Input buffer exceeds the buffer array"); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName, ValueSize, Pcd.DatumType, FieldName, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0]) CApp = CApp + ' memcpy (&Pcd->%s, Value, (FieldSize > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, ValueSize, ValueSize) CApp = CApp + ' memcpy (&%s, Value, (FieldSize > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (indicator, ValueSize, ValueSize) - + elif isinstance(Value, str): + CApp = CApp + ' %s = %s; // From %s Line %d Value %s\n' % (indicator, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0]) else: if '[' in FieldName and ']' in FieldName: Index = int(FieldName.split('[')[1].split(']')[0]) CApp = CApp + ' __STATIC_ASSERT((%d < __ARRAY_SIZE(Pcd->%s)) || (__ARRAY_SIZE(Pcd->%s) == 0), "array index exceeds the array number"); // From %s Line %d Index of %s\n' % (Index, FieldName.split('[')[0], FieldName.split('[')[0], FieldList[FieldName][1], FieldList[FieldName][2], FieldName) if ValueSize > 4: diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index 6df0d3cdf8..45cdf1a238 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -190,10 +190,14 @@ class MetaFileParser(object): self._PostProcessed = False # Different version of meta-file has different way to parse. self._Version = 0 self._GuidDict = {} # for Parser PCD value {GUID(gTokeSpaceGuidName)} + self._PcdCodeValue = "" + self._PcdDataTypeCODE = False + self._CurrentPcdName = "" + ## Store the parsed data in table def _Store(self, *Args): return self._Table.Insert(*Args) ## Virtual method for starting parse @@ -481,10 +485,43 @@ class MetaFileParser(object): Macros.update(ComSpeMacroDict) Macros.update(SpeSpeMacroDict) return Macros + def ProcessMultipleLineCODEValue(self,Content): + CODEBegin = False + CODELine = "" + continuelinecount = 0 + newContent = [] + for Index in range(0, len(Content)): + Line = Content[Index] + if CODEBegin: + CODELine = CODELine + Line + continuelinecount +=1 + if ")}" in Line: + newContent.append(CODELine) + for _ in range(continuelinecount): + newContent.append("") + CODEBegin = False + CODELine = "" + continuelinecount = 0 + else: + if not Line: + newContent.append(Line) + continue + if "{CODE(" not in Line: + newContent.append(Line) + continue + elif CODEPattern.findall(Line): + newContent.append(Line) + continue + else: + CODEBegin = True + CODELine = Line + + return newContent + _SectionParser = {} ## INF file parser class # # @param FilePath The path of platform description file @@ -901,13 +938,10 @@ class DscParser(MetaFileParser): # Map the ID between the original table and new table to track # the owner item # self._IdMapping = {-1:-1} - self._PcdCodeValue = "" - self._PcdDataTypeCODE = False - self._CurrentPcdName = "" self._Content = None ## Parser starter def Start(self): Content = '' @@ -1134,42 +1168,10 @@ class DscParser(MetaFileParser): ## Parse Edk style of library modules @ParseMacro def _LibraryInstanceParser(self): self._ValueList[0] = self._CurrentLine - def ProcessMultipleLineCODEValue(self,Content): - CODEBegin = False - CODELine = "" - continuelinecount = 0 - newContent = [] - for Index in range(0, len(Content)): - Line = Content[Index] - if CODEBegin: - CODELine = CODELine + Line - continuelinecount +=1 - if ")}" in Line: - newContent.append(CODELine) - for _ in range(continuelinecount): - newContent.append("") - CODEBegin = False - CODELine = "" - continuelinecount = 0 - else: - if not Line: - newContent.append(Line) - continue - if "{CODE(" not in Line: - newContent.append(Line) - continue - elif CODEPattern.findall(Line): - newContent.append(Line) - continue - else: - CODEBegin = True - CODELine = Line - - return newContent def _DecodeCODEData(self): pass ## PCD sections parser # @@ -1772,18 +1774,22 @@ class DecParser(MetaFileParser): self._CurrentStructurePcdName = "" self._include_flag = False self._package_flag = False + self._RestofValue = "" + ## Parser starter def Start(self): Content = '' try: Content = open(str(self.MetaFile), 'r').readlines() except: EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile) + Content = self.ProcessMultipleLineCODEValue(Content) + self._DefinesCount = 0 for Index in range(0, len(Content)): Line, Comment = CleanString2(Content[Index]) self._CurrentLine = Line self._LineIndex = Index @@ -1977,10 +1983,11 @@ class DecParser(MetaFileParser): # [PcdsDynamicEx # [PcdsDynamic] # @ParseMacro def _PcdParser(self): + if self._CurrentStructurePcdName: self._ValueList[0] = self._CurrentStructurePcdName if "|" not in self._CurrentLine: if "" == self._CurrentLine: @@ -2022,11 +2029,33 @@ class DecParser(MetaFileParser): EdkLogger.error('Parser', FORMAT_INVALID, "Pcd Name does not match: %s and %s " % (self._CurrentStructurePcdName, TAB_SPLIT.join(PcdNames[:2])), File=self.MetaFile, Line=self._LineIndex + 1) self._ValueList[1] = TAB_SPLIT.join(PcdNames[2:]) self._ValueList[2] = PcdTockens[1] if not self._CurrentStructurePcdName: + if self._PcdDataTypeCODE: + if ")}" in self._CurrentLine: + ValuePart,RestofValue = self._CurrentLine.split(")}") + self._PcdCodeValue = self._PcdCodeValue + "\n " + ValuePart + self._CurrentLine = "|".join((self._CurrentPcdName, self._PcdCodeValue,RestofValue)) + self._PcdDataTypeCODE = False + self._PcdCodeValue = "" + else: + self._PcdCodeValue = self._PcdCodeValue + "\n " + self._CurrentLine + self._ValueList = None + return TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1) + self._CurrentPcdName = TokenList[0] + if len(TokenList) == 2 and TokenList[1].strip().startswith("{CODE"): + if ")}" in self._CurrentLine: + self._PcdDataTypeCODE = False + self._PcdCodeValue = "" + else: + self._PcdDataTypeCODE = True + self._PcdCodeValue = TokenList[1].strip() + self._ValueList = None + return + self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT) ValueRe = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*') # check PCD information if self._ValueList[0] == '' or self._ValueList[1] == '': EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified", diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index ae37a6ce0e..4ae98698f3 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -147,11 +147,11 @@ def FileWrite(File, String, Wrapper=False): def ByteArrayForamt(Value): IsByteArray = False SplitNum = 16 ArrayList = [] - if Value.startswith('{') and Value.endswith('}'): + if Value.startswith('{') and Value.endswith('}') and not Value.startswith("{CODE("): Value = Value[1:-1] ValueList = Value.split(',') if len(ValueList) >= SplitNum: IsByteArray = True if IsByteArray: -- 2.20.1.windows.1