From: Jaben Carsey <jaben.carsey@intel.com>
To: edk2-devel@lists.01.org
Subject: [PATCH v1 4/7] BaseTools/GenFds: remove MacroDict parameter
Date: Mon, 24 Sep 2018 07:28:15 -0700 [thread overview]
Message-ID: <2644d8d06a6a38a77014c377ab65d95436ac43ac.1537799017.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1537799017.git.jaben.carsey@intel.com>
In-Reply-To: <cover.1537799017.git.jaben.carsey@intel.com>
The MacroDict parameter goes around in circles through 4 functions without use.
1. GetSectionData calls into GetLeafSection, otherwise doesn’t use MacroDict
2. GetLeafSection calls into GetFileStatement, otherwise doesn’t use MacroDict
3. GetFileStatement calls into GetFilePart, otherwise doesn’t use MacroDict
4. GetFilePart calls into GetSectionData, otherwise doesn’t use MacroDict
Go to 1 and repeat forever.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
BaseTools/Source/Python/GenFds/FdfParser.py | 48 +++++++-------------
1 file changed, 16 insertions(+), 32 deletions(-)
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index ff2efd8d7a57..6a2f87474f60 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -2112,12 +2112,12 @@ class FdfParser:
if FvObj.FvNameString == 'TRUE' and not FvObj.FvNameGuid:
raise Warning("FvNameString found but FvNameGuid was not found", self.FileName, self.CurrentLineNumber)
- self._GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())
- self._GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())
+ self._GetAprioriSection(FvObj)
+ self._GetAprioriSection(FvObj)
while True:
isInf = self._GetInfStatement(FvObj)
- isFile = self._GetFileStatement(FvObj, MacroDict = FvObj.DefineVarDict.copy())
+ isFile = self._GetFileStatement(FvObj)
if not isInf and not isFile:
break
@@ -2352,11 +2352,10 @@ class FdfParser:
#
# @param self The object pointer
# @param FvObj for whom apriori is got
- # @param MacroDict dictionary used to replace macro
# @retval True Successfully find apriori statement
# @retval False Not able to find apriori statement
#
- def _GetAprioriSection(self, FvObj, MacroDict = {}):
+ def _GetAprioriSection(self, FvObj):
if not self._IsKeyword("APRIORI"):
return False
@@ -2371,7 +2370,6 @@ class FdfParser:
AprSectionObj.AprioriType = AprType
self._GetDefineStatements(AprSectionObj)
- MacroDict.update(AprSectionObj.DefineVarDict)
while True:
IsInf = self._GetInfStatement(AprSectionObj)
@@ -2525,11 +2523,10 @@ class FdfParser:
#
# @param self The object pointer
# @param Obj for whom FILE statement is got
- # @param MacroDict dictionary used to replace macro
# @retval True Successfully find FILE statement
# @retval False Not able to find FILE statement
#
- def _GetFileStatement(self, Obj, ForCapsule = False, MacroDict = {}):
+ def _GetFileStatement(self, Obj, ForCapsule = False):
if not self._IsKeyword("FILE"):
return False
@@ -2560,7 +2557,7 @@ class FdfParser:
FfsFileObj.NameGuid = self._Token
- self._GetFilePart(FfsFileObj, MacroDict.copy())
+ self._GetFilePart(FfsFileObj)
if ForCapsule:
capsuleFfs = CapsuleFfs()
@@ -2607,9 +2604,8 @@ class FdfParser:
#
# @param self The object pointer
# @param FfsFileObj for whom component is got
- # @param MacroDict dictionary used to replace macro
#
- def _GetFilePart(self, FfsFileObj, MacroDict = {}):
+ def _GetFilePart(self, FfsFileObj):
self._GetFileOpts(FfsFileObj)
if not self._IsToken("{"):
@@ -2644,11 +2640,11 @@ class FdfParser:
elif self._Token in {TAB_DEFINE, "APRIORI", "SECTION"}:
self._UndoToken()
- self._GetSectionData(FfsFileObj, MacroDict)
+ self._GetSectionData(FfsFileObj)
elif hasattr(FfsFileObj, 'FvFileType') and FfsFileObj.FvFileType == 'RAW':
self._UndoToken()
- self._GetRAWData(FfsFileObj, MacroDict)
+ self._GetRAWData(FfsFileObj)
else:
FfsFileObj.CurrentLineNum = self.CurrentLineNumber
@@ -2665,9 +2661,8 @@ class FdfParser:
#
# @param self The object pointer
# @param FfsFileObj for whom section is got
- # @param MacroDict dictionary used to replace macro
#
- def _GetRAWData(self, FfsFileObj, MacroDict = {}):
+ def _GetRAWData(self, FfsFileObj):
FfsFileObj.FileName = []
FfsFileObj.SubAlignment = []
while True:
@@ -2755,26 +2750,18 @@ class FdfParser:
return False
- ## _GetFilePart() method
+ ## _GetSectionData() method
#
# Get section data for FILE statement
#
# @param self The object pointer
# @param FfsFileObj for whom section is got
- # @param MacroDict dictionary used to replace macro
#
- def _GetSectionData(self, FfsFileObj, MacroDict = {}):
- Dict = {}
- Dict.update(MacroDict)
-
+ def _GetSectionData(self, FfsFileObj):
self._GetDefineStatements(FfsFileObj)
- Dict.update(FfsFileObj.DefineVarDict)
- self._GetAprioriSection(FfsFileObj, Dict.copy())
- self._GetAprioriSection(FfsFileObj, Dict.copy())
-
while True:
- IsLeafSection = self._GetLeafSection(FfsFileObj, Dict)
+ IsLeafSection = self._GetLeafSection(FfsFileObj)
IsEncapSection = self._GetEncapsulationSec(FfsFileObj)
if not IsLeafSection and not IsEncapSection:
break
@@ -2785,11 +2772,10 @@ class FdfParser:
#
# @param self The object pointer
# @param Obj for whom leaf section is got
- # @param MacroDict dictionary used to replace macro
# @retval True Successfully find section statement
# @retval False Not able to find section statement
#
- def _GetLeafSection(self, Obj, MacroDict = {}):
+ def _GetLeafSection(self, Obj):
OldPos = self.GetFileBufferPos()
if not self._IsKeyword("SECTION"):
@@ -2860,17 +2846,15 @@ class FdfParser:
FvObj = FV()
FvObj.UiFvName = FvName.upper()
self._GetDefineStatements(FvObj)
- MacroDict.update(FvObj.DefineVarDict)
+
self._GetBlockStatement(FvObj)
self._GetSetStatements(FvObj)
self._GetFvAlignment(FvObj)
self._GetFvAttributes(FvObj)
- self._GetAprioriSection(FvObj, MacroDict.copy())
- self._GetAprioriSection(FvObj, MacroDict.copy())
while True:
IsInf = self._GetInfStatement(FvObj)
- IsFile = self._GetFileStatement(FvObj, MacroDict.copy())
+ IsFile = self._GetFileStatement(FvObj)
if not IsInf and not IsFile:
break
--
2.16.2.windows.1
next prev parent reply other threads:[~2018-09-24 14:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-24 14:28 [PATCH v1 0/7] BaseTools/GenFds: cleanup GenFds Jaben Carsey
2018-09-24 14:28 ` [PATCH v1 1/7] " Jaben Carsey
2018-09-24 14:28 ` [PATCH v1 2/7] BaseTools/GenFds: change objects to sets Jaben Carsey
2018-09-24 14:28 ` [PATCH v1 3/7] Basetools/GenFds: refactor class FV Jaben Carsey
2018-09-24 14:28 ` Jaben Carsey [this message]
2018-09-24 14:28 ` [PATCH v1 5/7] BaseTools/GenFds: refactor FdfParser warnings Jaben Carsey
2018-09-24 14:28 ` [PATCH v1 6/7] BaseTools/GenFds: Remove duplicate function calls Jaben Carsey
2018-09-25 13:45 ` Feng, Bob C
2018-09-24 14:28 ` [PATCH v1 7/7] BaseTools/GenFds: create and use new variable in FdfParser Jaben Carsey
2018-09-25 13:45 ` Feng, Bob C
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2644d8d06a6a38a77014c377ab65d95436ac43ac.1537799017.git.jaben.carsey@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox