## @file\r
-# This file contained the parser for [Binaries] sections in INF file \r
+# This file contained the parser for [Binaries] sections in INF file\r
#\r
-# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
-# This program and the accompanying materials are licensed and made available \r
-# under the terms and conditions of the BSD License which accompanies this \r
-# distribution. The full text of the license may be found at \r
+# This program and the accompanying materials are licensed and made available\r
+# under the terms and conditions of the BSD License which accompanies this\r
+# distribution. The full text of the license may be found at\r
# http://opensource.org/licenses/bsd-license.php\r
#\r
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
#\r
def InfBinaryParser(self, SectionString, InfSectionObject, FileName):\r
#\r
- # Macro defined in this section \r
+ # Macro defined in this section\r
#\r
SectionMacros = {}\r
ValueList = []\r
\r
StillCommentFalg = False\r
HeaderComments = []\r
- LineComment = None \r
- \r
+ LineComment = None\r
+\r
AllSectionContent = ''\r
#\r
# Parse section content\r
for Line in SectionString:\r
BinLineContent = Line[0]\r
BinLineNo = Line[1]\r
- \r
+\r
if BinLineContent.strip() == '':\r
continue\r
- \r
+\r
CurrentLineObj = CurrentLine()\r
CurrentLineObj.FileName = FileName\r
CurrentLineObj.LineString = BinLineContent\r
CurrentLineObj.LineNo = BinLineNo\r
#\r
- # Found Header Comments \r
+ # Found Header Comments\r
#\r
if BinLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):\r
#\r
AllSectionContent += BinLineContent + DT.END_OF_LINE\r
continue\r
#\r
- # First time encounter comment \r
+ # First time encounter comment\r
#\r
else:\r
#\r
continue\r
else:\r
StillCommentFalg = False\r
- \r
+\r
if len(HeaderComments) >= 1:\r
LineComment = InfLineCommentObject()\r
LineCommentContent = ''\r
for Item in HeaderComments:\r
LineCommentContent += Item[0] + DT.END_OF_LINE\r
LineComment.SetHeaderComments(LineCommentContent)\r
- \r
+\r
#\r
# Find Tail comment.\r
#\r
BinLineContent = BinLineContent[:BinLineContent.find(DT.TAB_COMMENT_SPLIT)]\r
if LineComment is None:\r
LineComment = InfLineCommentObject()\r
- LineComment.SetTailComments(TailComments) \r
- \r
+ LineComment.SetTailComments(TailComments)\r
+\r
#\r
# Find Macro\r
#\r
if MacroDef[0] is not None:\r
SectionMacros[MacroDef[0]] = MacroDef[1]\r
LineComment = None\r
- HeaderComments = [] \r
+ HeaderComments = []\r
continue\r
- \r
+\r
#\r
# Replace with Local section Macro and [Defines] section Macro.\r
- # \r
- LineContent = InfExpandMacro(BinLineContent, \r
- (FileName, BinLineContent, BinLineNo), \r
- self.FileLocalMacros, \r
+ #\r
+ LineContent = InfExpandMacro(BinLineContent,\r
+ (FileName, BinLineContent, BinLineNo),\r
+ self.FileLocalMacros,\r
SectionMacros, True)\r
- \r
- AllSectionContent += LineContent + DT.END_OF_LINE \r
+\r
+ AllSectionContent += LineContent + DT.END_OF_LINE\r
TokenList = GetSplitValueList(LineContent, DT.TAB_VALUE_SPLIT, 1)\r
ValueList[0:len(TokenList)] = TokenList\r
- \r
- # \r
+\r
+ #\r
# Should equal to UI/SEC_UI/UNI_UI\r
#\r
ValueList[0] = ValueList[0].strip()\r
ValueList[0] == DT.BINARY_FILE_TYPE_SEC_UI or \\r
ValueList[0] == DT.BINARY_FILE_TYPE_UI:\r
if len(ValueList) == 2:\r
- TokenList = GetSplitValueList(ValueList[1], \r
- DT.TAB_VALUE_SPLIT, \r
+ TokenList = GetSplitValueList(ValueList[1],\r
+ DT.TAB_VALUE_SPLIT,\r
2)\r
NewValueList = []\r
NewValueList.append(ValueList[0])\r
for Item in TokenList:\r
NewValueList.append(Item)\r
- UiBinaryList.append((NewValueList, \r
- LineComment, \r
- CurrentLineObj)) \r
- # \r
+ UiBinaryList.append((NewValueList,\r
+ LineComment,\r
+ CurrentLineObj))\r
+ #\r
# Should equal to VER/SEC_VER/UNI_VER\r
#\r
elif ValueList[0] == DT.BINARY_FILE_TYPE_UNI_VER or \\r
ValueList[0] == DT.BINARY_FILE_TYPE_SEC_VER or \\r
ValueList[0] == DT.BINARY_FILE_TYPE_VER:\r
if len(ValueList) == 2:\r
- TokenList = GetSplitValueList(ValueList[1], \r
- DT.TAB_VALUE_SPLIT, \r
+ TokenList = GetSplitValueList(ValueList[1],\r
+ DT.TAB_VALUE_SPLIT,\r
2)\r
NewValueList = []\r
NewValueList.append(ValueList[0])\r
for Item in TokenList:\r
- NewValueList.append(Item) \r
- VerBinaryList.append((NewValueList, \r
- LineComment, \r
+ NewValueList.append(Item)\r
+ VerBinaryList.append((NewValueList,\r
+ LineComment,\r
CurrentLineObj))\r
else:\r
if len(ValueList) == 2:\r
if ValueList[0].strip() == 'SUBTYPE_GUID':\r
- TokenList = GetSplitValueList(ValueList[1], \r
- DT.TAB_VALUE_SPLIT, \r
+ TokenList = GetSplitValueList(ValueList[1],\r
+ DT.TAB_VALUE_SPLIT,\r
5)\r
else:\r
- TokenList = GetSplitValueList(ValueList[1], \r
- DT.TAB_VALUE_SPLIT, \r
+ TokenList = GetSplitValueList(ValueList[1],\r
+ DT.TAB_VALUE_SPLIT,\r
4)\r
- \r
+\r
NewValueList = []\r
NewValueList.append(ValueList[0])\r
for Item in TokenList:\r
- NewValueList.append(Item) \r
- ComBinaryList.append((NewValueList, \r
- LineComment, \r
+ NewValueList.append(Item)\r
+ ComBinaryList.append((NewValueList,\r
+ LineComment,\r
CurrentLineObj))\r
elif len(ValueList) == 1:\r
NewValueList = []\r
NewValueList.append(ValueList[0])\r
- ComBinaryList.append((NewValueList, \r
- LineComment, \r
+ ComBinaryList.append((NewValueList,\r
+ LineComment,\r
CurrentLineObj))\r
- \r
- \r
- \r
- \r
+\r
+\r
+\r
+\r
ValueList = []\r
LineComment = None\r
TailComments = ''\r
- HeaderComments = [] \r
+ HeaderComments = []\r
continue\r
\r
#\r
# Current section archs\r
- # \r
+ #\r
ArchList = []\r
for Item in self.LastSectionHeaderContent:\r
if Item[1] not in ArchList:\r
- ArchList.append(Item[1]) \r
+ ArchList.append(Item[1])\r
InfSectionObject.SetSupArchList(Item[1])\r
- \r
- InfSectionObject.SetAllContent(AllSectionContent) \r
- if not InfSectionObject.SetBinary(UiBinaryList, \r
- VerBinaryList, \r
- ComBinaryList, \r
+\r
+ InfSectionObject.SetAllContent(AllSectionContent)\r
+ if not InfSectionObject.SetBinary(UiBinaryList,\r
+ VerBinaryList,\r
+ ComBinaryList,\r
ArchList):\r
- Logger.Error('InfParser', \r
+ Logger.Error('InfParser',\r
FORMAT_INVALID,\r
ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR%("[Binaries]"),\r
File=FileName,\r
- Line=Item[3]) \r
-
\ No newline at end of file
+ Line=Item[3])\r
+\r