From 6780eef1f9ed0af24795708c3be7adafd7113691 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Mon, 15 Nov 2010 02:51:34 +0000 Subject: Sync EDKII BaseTools to BaseTools project r2093. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11057 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/BPDG/GenVpd.py | 38 ++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'BaseTools/Source/Python/BPDG') diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Python/BPDG/GenVpd.py index f0196e061a..bbe44eefa4 100644 --- a/BaseTools/Source/Python/BPDG/GenVpd.py +++ b/BaseTools/Source/Python/BPDG/GenVpd.py @@ -17,6 +17,7 @@ import os import StringIO import StringTable as st import array +import re from struct import * import Common.EdkLogger as EdkLogger @@ -338,8 +339,27 @@ class GenVPD : line = line.rstrip(os.linesep) # Skip the comment line - if (not line.startswith("#")) and len(line) > 1 : - self.FileLinesList[count] = line.split('|') + if (not line.startswith("#")) and len(line) > 1 : + # + # Enhanced for support "|" character in the string. + # + ValueList = ['', '', '', ''] + + ValueRe = re.compile(r'\s*L?\".*\|.*\"\s*$') + PtrValue = ValueRe.findall(line) + + ValueUpdateFlag = False + + if len(PtrValue) >= 1: + line = re.sub(ValueRe, '', line) + ValueUpdateFlag = True + + TokenList = line.split('|') + ValueList[0:len(TokenList)] = TokenList + + if ValueUpdateFlag: + ValueList[3] = PtrValue[0] + self.FileLinesList[count] = ValueList # Store the line number self.FileLinesList[count].append(str(count+1)) elif len(line) <= 1 : @@ -524,10 +544,8 @@ class GenVPD : if lenOfUnfixedList != 0 : countOfUnfixedList = 0 while(countOfUnfixedList < lenOfUnfixedList) : - #needFixPcdCName, needFixPcdOffset, needFixPcdSize, needFixPcdValue, needFixUnpackValue = self.PcdUnknownOffsetList[countOfUnfixedList][0:6] eachUnfixedPcd = self.PcdUnknownOffsetList[countOfUnfixedList] needFixPcdSize = eachUnfixedPcd.PcdBinSize - needFixPcdOffset = eachUnfixedPcd.PcdOffset # Not been fixed if eachUnfixedPcd.PcdOffset == '*' : # The offset un-fixed pcd can write into this free space @@ -546,18 +564,16 @@ class GenVPD : FixOffsetSizeListCount += 1 # Decrease the un-fixed pcd offset list's length - countOfUnfixedList += 1 lenOfUnfixedList -= 1 # Modify the last offset value - LastOffset += needFixPcdSize - continue + LastOffset += needFixPcdSize else : - # It can not insert into those two pcds, need to check stiil has other space can store it. + # It can not insert into those two pcds, need to check still has other space can store it. + LastOffset = NowOffset + self.PcdFixedOffsetSizeList[FixOffsetSizeListCount].PcdBinSize FixOffsetSizeListCount += 1 - break - else : - continue + break + # Set the FixOffsetSizeListCount = lenOfList for quit the loop else : FixOffsetSizeListCount = lenOfList -- cgit v1.2.3