BaseTools: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects for DEC file. It will consumed by
|
||||
# This file is used to define class objects for DEC file. It will consumed by
|
||||
#DecParser
|
||||
#
|
||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -49,7 +49,7 @@ class _DecComments:
|
||||
return self._HeadComment, self._TailComment
|
||||
|
||||
## GetHeadComment
|
||||
#
|
||||
#
|
||||
def GetHeadComment(self):
|
||||
return self._HeadComment
|
||||
|
||||
@ -61,7 +61,7 @@ class _DecComments:
|
||||
self._HeadComment = Comment
|
||||
|
||||
## GetTailComment
|
||||
#
|
||||
#
|
||||
def GetTailComment(self):
|
||||
return self._TailComment
|
||||
|
||||
@ -89,22 +89,22 @@ class _DecBaseObject(_DecComments):
|
||||
self._SecName = ''
|
||||
|
||||
## GetSectionName
|
||||
#
|
||||
#
|
||||
def GetSectionName(self):
|
||||
return self._SecName
|
||||
|
||||
## GetPackagePath
|
||||
#
|
||||
#
|
||||
def GetPackagePath(self):
|
||||
return self._PackagePath
|
||||
|
||||
## GetPackageFile
|
||||
#
|
||||
#
|
||||
def GetPackageFile(self):
|
||||
return self._FileName
|
||||
|
||||
## GetPackageFullName
|
||||
#
|
||||
#
|
||||
def GetPackageFullName(self):
|
||||
return self._PkgFullName
|
||||
|
||||
@ -151,7 +151,7 @@ class _DecBaseObject(_DecComments):
|
||||
|
||||
## _DecItemBaseObject
|
||||
#
|
||||
# Module type and arch the item belongs to
|
||||
# Module type and arch the item belongs to
|
||||
#
|
||||
class _DecItemBaseObject(_DecComments):
|
||||
def __init__(self):
|
||||
@ -162,7 +162,7 @@ class _DecItemBaseObject(_DecComments):
|
||||
self.ArchAndModuleType = []
|
||||
|
||||
## GetArchList
|
||||
#
|
||||
#
|
||||
def GetArchList(self):
|
||||
ArchSet = set()
|
||||
for Arch in self.ArchAndModuleType:
|
||||
@ -184,7 +184,7 @@ class DecDefineObject(_DecBaseObject):
|
||||
self._PkgUniFile = ''
|
||||
|
||||
## GetPackageSpecification
|
||||
#
|
||||
#
|
||||
def GetPackageSpecification(self):
|
||||
return self._DecSpec
|
||||
|
||||
@ -192,7 +192,7 @@ class DecDefineObject(_DecBaseObject):
|
||||
self._DecSpec = DecSpec
|
||||
|
||||
## GetPackageName
|
||||
#
|
||||
#
|
||||
def GetPackageName(self):
|
||||
return self._PkgName
|
||||
|
||||
@ -200,7 +200,7 @@ class DecDefineObject(_DecBaseObject):
|
||||
self._PkgName = PkgName
|
||||
|
||||
## GetPackageGuid
|
||||
#
|
||||
#
|
||||
def GetPackageGuid(self):
|
||||
return self._PkgGuid
|
||||
|
||||
@ -208,7 +208,7 @@ class DecDefineObject(_DecBaseObject):
|
||||
self._PkgGuid = PkgGuid
|
||||
|
||||
## GetPackageVersion
|
||||
#
|
||||
#
|
||||
def GetPackageVersion(self):
|
||||
return self._PkgVersion
|
||||
|
||||
@ -216,7 +216,7 @@ class DecDefineObject(_DecBaseObject):
|
||||
self._PkgVersion = PkgVersion
|
||||
|
||||
## GetPackageUniFile
|
||||
#
|
||||
#
|
||||
def GetPackageUniFile(self):
|
||||
return self._PkgUniFile
|
||||
|
||||
@ -224,12 +224,12 @@ class DecDefineObject(_DecBaseObject):
|
||||
self._PkgUniFile = PkgUniFile
|
||||
|
||||
## GetDefines
|
||||
#
|
||||
#
|
||||
def GetDefines(self):
|
||||
return self._GetItemByArch(TAB_ARCH_COMMON)
|
||||
|
||||
## GetAllDefines
|
||||
#
|
||||
#
|
||||
def GetAllDefines(self):
|
||||
return self._GetAllItems()
|
||||
|
||||
@ -244,7 +244,7 @@ class DecDefineItemObject(_DecItemBaseObject):
|
||||
self.Value = ''
|
||||
|
||||
## __hash__
|
||||
#
|
||||
#
|
||||
def __hash__(self):
|
||||
return hash(self.Key + self.Value)
|
||||
|
||||
@ -254,7 +254,7 @@ class DecDefineItemObject(_DecItemBaseObject):
|
||||
return id(self) == id(Other)
|
||||
|
||||
## __str__
|
||||
#
|
||||
#
|
||||
def __str__(self):
|
||||
return str(self.ArchAndModuleType) + '\n' + self.Key + \
|
||||
' = ' + self.Value
|
||||
@ -269,12 +269,12 @@ class DecIncludeObject(_DecBaseObject):
|
||||
self._SecName = TAB_INCLUDES.upper()
|
||||
|
||||
## GetIncludes
|
||||
#
|
||||
#
|
||||
def GetIncludes(self, Arch=TAB_ARCH_COMMON):
|
||||
return self._GetItemByArch(Arch)
|
||||
|
||||
## GetAllIncludes
|
||||
#
|
||||
#
|
||||
def GetAllIncludes(self):
|
||||
return self._GetAllItems()
|
||||
|
||||
@ -289,7 +289,7 @@ class DecIncludeItemObject(_DecItemBaseObject):
|
||||
_DecItemBaseObject.__init__(self)
|
||||
|
||||
## __hash__
|
||||
#
|
||||
#
|
||||
def __hash__(self):
|
||||
return hash(self.File)
|
||||
|
||||
@ -299,7 +299,7 @@ class DecIncludeItemObject(_DecItemBaseObject):
|
||||
return id(self) == id(Other)
|
||||
|
||||
## __str__
|
||||
#
|
||||
#
|
||||
def __str__(self):
|
||||
return self.File
|
||||
|
||||
@ -314,12 +314,12 @@ class DecLibraryclassObject(_DecBaseObject):
|
||||
self._SecName = TAB_LIBRARY_CLASSES.upper()
|
||||
|
||||
## GetLibraryclasses
|
||||
#
|
||||
#
|
||||
def GetLibraryclasses(self, Arch=TAB_ARCH_COMMON):
|
||||
return self._GetItemByArch(Arch)
|
||||
|
||||
## GetAllLibraryclasses
|
||||
#
|
||||
#
|
||||
def GetAllLibraryclasses(self):
|
||||
return self._GetAllItems()
|
||||
|
||||
@ -334,7 +334,7 @@ class DecLibraryclassItemObject(_DecItemBaseObject):
|
||||
self.Libraryclass = Libraryclass
|
||||
|
||||
## __hash__
|
||||
#
|
||||
#
|
||||
def __hash__(self):
|
||||
return hash(self.Libraryclass + self.File)
|
||||
|
||||
@ -344,7 +344,7 @@ class DecLibraryclassItemObject(_DecItemBaseObject):
|
||||
return id(self) == id(Other)
|
||||
|
||||
## __str__
|
||||
#
|
||||
#
|
||||
def __str__(self):
|
||||
return self.Libraryclass + '|' + self.File
|
||||
|
||||
@ -381,7 +381,7 @@ class DecPcdObject(_DecBaseObject):
|
||||
#
|
||||
# @param PcdType: PcdType
|
||||
# @param Arch: Arch
|
||||
#
|
||||
#
|
||||
def GetPcds(self, PcdType, Arch=TAB_ARCH_COMMON):
|
||||
PcdType = PcdType.upper()
|
||||
Arch = Arch.upper()
|
||||
@ -392,7 +392,7 @@ class DecPcdObject(_DecBaseObject):
|
||||
## GetPcdsByType
|
||||
#
|
||||
# @param PcdType: PcdType
|
||||
#
|
||||
#
|
||||
def GetPcdsByType(self, PcdType):
|
||||
PcdType = PcdType.upper()
|
||||
Retlst = []
|
||||
@ -422,7 +422,7 @@ class DecPcdItemObject(_DecItemBaseObject):
|
||||
self.MaxDatumSize = MaxDatumSize
|
||||
|
||||
## __hash__
|
||||
#
|
||||
#
|
||||
def __hash__(self):
|
||||
return hash(self.TokenSpaceGuidCName + self.TokenCName)
|
||||
|
||||
@ -434,7 +434,7 @@ class DecPcdItemObject(_DecItemBaseObject):
|
||||
## GetArchListOfType
|
||||
#
|
||||
# @param PcdType: PcdType
|
||||
#
|
||||
#
|
||||
def GetArchListOfType(self, PcdType):
|
||||
ItemSet = set()
|
||||
PcdType = PcdType.upper()
|
||||
@ -458,12 +458,12 @@ class DecGuidObjectBase(_DecBaseObject):
|
||||
## GetGuidStyleItems
|
||||
#
|
||||
# @param Arch: Arch
|
||||
#
|
||||
#
|
||||
def GetGuidStyleItems(self, Arch=TAB_ARCH_COMMON):
|
||||
return self._GetItemByArch(Arch)
|
||||
|
||||
## GetGuidStyleAllItems
|
||||
#
|
||||
#
|
||||
def GetGuidStyleAllItems(self):
|
||||
return self._GetAllItems()
|
||||
|
||||
@ -481,7 +481,7 @@ class DecGuidItemObject(_DecItemBaseObject):
|
||||
self.GuidString = GuidString
|
||||
|
||||
## __hash__
|
||||
#
|
||||
#
|
||||
def __hash__(self):
|
||||
return hash(self.GuidCName)
|
||||
|
||||
@ -491,7 +491,7 @@ class DecGuidItemObject(_DecItemBaseObject):
|
||||
return id(self) == id(Other)
|
||||
|
||||
## __str__
|
||||
#
|
||||
#
|
||||
def __str__(self):
|
||||
return self.GuidCName + ' = ' + self.GuidCValue
|
||||
|
||||
@ -507,14 +507,14 @@ class DecGuidObject(DecGuidObjectBase):
|
||||
self._SecName = TAB_GUIDS.upper()
|
||||
|
||||
## GetGuids
|
||||
#
|
||||
#
|
||||
# @param Arch: Arch
|
||||
#
|
||||
def GetGuids(self, Arch=TAB_ARCH_COMMON):
|
||||
return self._GetItemByArch(Arch)
|
||||
|
||||
## GetAllGuids
|
||||
#
|
||||
#
|
||||
def GetAllGuids(self):
|
||||
return self._GetAllItems()
|
||||
|
||||
@ -530,14 +530,14 @@ class DecPpiObject(DecGuidObjectBase):
|
||||
self._SecName = TAB_PPIS.upper()
|
||||
|
||||
## GetPpis
|
||||
#
|
||||
#
|
||||
# @param Arch: Arch
|
||||
#
|
||||
#
|
||||
def GetPpis(self, Arch=TAB_ARCH_COMMON):
|
||||
return self._GetItemByArch(Arch)
|
||||
|
||||
## GetAllPpis
|
||||
#
|
||||
#
|
||||
def GetAllPpis(self):
|
||||
return self._GetAllItems()
|
||||
|
||||
@ -553,14 +553,14 @@ class DecProtocolObject(DecGuidObjectBase):
|
||||
self._SecName = TAB_PROTOCOLS.upper()
|
||||
|
||||
## GetProtocols
|
||||
#
|
||||
#
|
||||
# @param Arch: Arch
|
||||
#
|
||||
#
|
||||
def GetProtocols(self, Arch=TAB_ARCH_COMMON):
|
||||
return self._GetItemByArch(Arch)
|
||||
|
||||
## GetAllProtocols
|
||||
#
|
||||
#
|
||||
def GetAllProtocols(self):
|
||||
return self._GetAllItems()
|
||||
|
||||
@ -577,10 +577,10 @@ class DecUserExtensionObject(_DecBaseObject):
|
||||
self.ItemList = []
|
||||
|
||||
## GetProtocols
|
||||
#
|
||||
#
|
||||
# @param Item: Item
|
||||
# @param Scope: Scope
|
||||
#
|
||||
#
|
||||
def AddItem(self, Item, Scope):
|
||||
if not Scope:
|
||||
pass
|
||||
@ -589,7 +589,7 @@ class DecUserExtensionObject(_DecBaseObject):
|
||||
self.ItemList.append(Item)
|
||||
|
||||
## GetAllUserExtensions
|
||||
#
|
||||
#
|
||||
def GetAllUserExtensions(self):
|
||||
return self.ItemList
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of INF file [Binaries] section.
|
||||
# It will consumed by InfParser.
|
||||
# This file is used to define class objects of INF file [Binaries] section.
|
||||
# It will consumed by InfParser.
|
||||
#
|
||||
# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -117,7 +117,7 @@ class InfBianryCommonItem(InfBianryItem, CurrentLine):
|
||||
self.Family = Family
|
||||
def GetFamily(self):
|
||||
return self.Family
|
||||
|
||||
|
||||
def SetGuidValue(self, GuidValue):
|
||||
self.GuidValue = GuidValue
|
||||
def GetGuidValue(self):
|
||||
@ -228,7 +228,7 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
Line=VerCurrentLine.GetLineNo(),
|
||||
ExtraData=VerCurrentLine.GetLineString())
|
||||
#
|
||||
# Validate Feature Flag Express
|
||||
# Validate Feature Flag Express
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(VerContent[3].\
|
||||
strip())
|
||||
@ -246,15 +246,15 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
#
|
||||
# Determine binary file name duplicate. Follow below rule:
|
||||
#
|
||||
# A binary filename must not be duplicated within
|
||||
# a [Binaries] section. A binary filename may appear in
|
||||
# multiple architectural [Binaries] sections. A binary
|
||||
# filename listed in an architectural [Binaries] section
|
||||
# must not be listed in the common architectural
|
||||
# A binary filename must not be duplicated within
|
||||
# a [Binaries] section. A binary filename may appear in
|
||||
# multiple architectural [Binaries] sections. A binary
|
||||
# filename listed in an architectural [Binaries] section
|
||||
# must not be listed in the common architectural
|
||||
# [Binaries] section.
|
||||
#
|
||||
#
|
||||
# NOTE: This check will not report error now.
|
||||
#
|
||||
#
|
||||
for Item in self.Binaries:
|
||||
if Item.GetFileName() == InfBianryVerItemObj.GetFileName():
|
||||
ItemSupArchList = Item.GetSupArchList()
|
||||
@ -315,7 +315,7 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
Line=CurrentLineOfItem.GetLineNo(),
|
||||
ExtraData=CurrentLineOfItem.GetLineString())
|
||||
return False
|
||||
|
||||
|
||||
if len(ItemContent) > 7:
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
@ -335,7 +335,7 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
BinaryFileType = ItemContent[0].strip()
|
||||
if BinaryFileType == 'RAW' or BinaryFileType == 'ACPI' or BinaryFileType == 'ASL':
|
||||
BinaryFileType = 'BIN'
|
||||
|
||||
|
||||
if BinaryFileType not in DT.BINARY_FILE_TYPE_LIST:
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
@ -344,10 +344,10 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
File=CurrentLineOfItem.GetFileName(),
|
||||
Line=CurrentLineOfItem.GetLineNo(),
|
||||
ExtraData=CurrentLineOfItem.GetLineString())
|
||||
|
||||
|
||||
if BinaryFileType == 'SUBTYPE_GUID':
|
||||
BinaryFileType = 'FREEFORM'
|
||||
|
||||
|
||||
if BinaryFileType == 'LIB' or BinaryFileType == 'UEFI_APP':
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
@ -407,7 +407,7 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
#
|
||||
if BinaryFileType != 'FREEFORM':
|
||||
InfBianryCommonItemObj.SetTarget(ItemContent[2])
|
||||
|
||||
|
||||
if len(ItemContent) >= 4:
|
||||
#
|
||||
# Add Family information
|
||||
@ -416,13 +416,13 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
InfBianryCommonItemObj.SetFamily(ItemContent[3])
|
||||
else:
|
||||
InfBianryCommonItemObj.SetTarget(ItemContent[3])
|
||||
|
||||
|
||||
if len(ItemContent) >= 5:
|
||||
#
|
||||
# TagName entries are build system specific. If there
|
||||
# is content in the entry, the tool must exit
|
||||
# TagName entries are build system specific. If there
|
||||
# is content in the entry, the tool must exit
|
||||
# gracefully with an error message that indicates build
|
||||
# system specific content cannot be distributed using
|
||||
# system specific content cannot be distributed using
|
||||
# the UDP
|
||||
#
|
||||
if BinaryFileType != 'FREEFORM':
|
||||
@ -435,7 +435,7 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
ExtraData=CurrentLineOfItem.GetLineString())
|
||||
else:
|
||||
InfBianryCommonItemObj.SetFamily(ItemContent[4])
|
||||
|
||||
|
||||
if len(ItemContent) >= 6:
|
||||
#
|
||||
# Add FeatureFlagExp
|
||||
@ -449,7 +449,7 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
Line=CurrentLineOfItem.GetLineNo(),
|
||||
ExtraData=CurrentLineOfItem.GetLineString())
|
||||
#
|
||||
# Validate Feature Flag Express
|
||||
# Validate Feature Flag Express
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(ItemContent[5].strip())
|
||||
if not FeatureFlagRtv[0]:
|
||||
@ -468,7 +468,7 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
File=CurrentLineOfItem.GetFileName(),
|
||||
Line=CurrentLineOfItem.GetLineNo(),
|
||||
ExtraData=CurrentLineOfItem.GetLineString())
|
||||
|
||||
|
||||
if len(ItemContent) == 7:
|
||||
if ItemContent[6].strip() == '':
|
||||
Logger.Error("InfParser",
|
||||
@ -478,7 +478,7 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
Line=CurrentLineOfItem.GetLineNo(),
|
||||
ExtraData=CurrentLineOfItem.GetLineString())
|
||||
#
|
||||
# Validate Feature Flag Express
|
||||
# Validate Feature Flag Express
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(ItemContent[6].strip())
|
||||
if not FeatureFlagRtv[0]:
|
||||
@ -495,15 +495,15 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
#
|
||||
# Determine binary file name duplicate. Follow below rule:
|
||||
#
|
||||
# A binary filename must not be duplicated within
|
||||
# a [Binaries] section. A binary filename may appear in
|
||||
# multiple architectural [Binaries] sections. A binary
|
||||
# filename listed in an architectural [Binaries] section
|
||||
# must not be listed in the common architectural
|
||||
# A binary filename must not be duplicated within
|
||||
# a [Binaries] section. A binary filename may appear in
|
||||
# multiple architectural [Binaries] sections. A binary
|
||||
# filename listed in an architectural [Binaries] section
|
||||
# must not be listed in the common architectural
|
||||
# [Binaries] section.
|
||||
#
|
||||
#
|
||||
# NOTE: This check will not report error now.
|
||||
#
|
||||
#
|
||||
# for Item in self.Binaries:
|
||||
# if Item.GetFileName() == InfBianryCommonItemObj.GetFileName():
|
||||
# ItemSupArchList = Item.GetSupArchList()
|
||||
@ -537,7 +537,7 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
for ArchItem in ArchList:
|
||||
#
|
||||
# Validate Arch
|
||||
#
|
||||
#
|
||||
if (ArchItem == '' or ArchItem is None):
|
||||
ArchItem = 'COMMON'
|
||||
__SupArchList.append(ArchItem)
|
||||
@ -546,7 +546,7 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
if len(UiInf) > 0:
|
||||
#
|
||||
# Check UI
|
||||
#
|
||||
#
|
||||
for UiItem in UiInf:
|
||||
IsValidFileFlag = False
|
||||
InfBianryUiItemObj = None
|
||||
@ -630,7 +630,7 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
Line=UiCurrentLine.GetLineNo(),
|
||||
ExtraData=UiCurrentLine.GetLineString())
|
||||
#
|
||||
# Validate Feature Flag Express
|
||||
# Validate Feature Flag Express
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(UiContent[3].strip())
|
||||
if not FeatureFlagRtv[0]:
|
||||
@ -647,15 +647,15 @@ class InfBinariesObject(InfSectionCommonDef):
|
||||
#
|
||||
# Determine binary file name duplicate. Follow below rule:
|
||||
#
|
||||
# A binary filename must not be duplicated within
|
||||
# a [Binaries] section. A binary filename may appear in
|
||||
# multiple architectural [Binaries] sections. A binary
|
||||
# filename listed in an architectural [Binaries] section
|
||||
# must not be listed in the common architectural
|
||||
# A binary filename must not be duplicated within
|
||||
# a [Binaries] section. A binary filename may appear in
|
||||
# multiple architectural [Binaries] sections. A binary
|
||||
# filename listed in an architectural [Binaries] section
|
||||
# must not be listed in the common architectural
|
||||
# [Binaries] section.
|
||||
#
|
||||
#
|
||||
# NOTE: This check will not report error now.
|
||||
#
|
||||
#
|
||||
# for Item in self.Binaries:
|
||||
# if Item.GetFileName() == InfBianryUiItemObj.GetFileName():
|
||||
# ItemSupArchList = Item.GetSupArchList()
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of INF file [BuildOptions] section.
|
||||
# It will consumed by InfParser.
|
||||
# This file is used to define class objects of INF file [BuildOptions] section.
|
||||
# It will consumed by InfParser.
|
||||
#
|
||||
# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -16,7 +16,7 @@
|
||||
InfBuildOptionObject
|
||||
'''
|
||||
|
||||
from Library import GlobalData
|
||||
from Library import GlobalData
|
||||
|
||||
from Object.Parser.InfCommonObject import InfSectionCommonDef
|
||||
|
||||
@ -25,17 +25,17 @@ class InfBuildOptionItem():
|
||||
self.Content = ''
|
||||
self.SupArchList = []
|
||||
self.AsBuildList = []
|
||||
|
||||
|
||||
def SetContent(self, Content):
|
||||
self.Content = Content
|
||||
def GetContent(self):
|
||||
return self.Content
|
||||
|
||||
|
||||
def SetSupArchList(self, SupArchList):
|
||||
self.SupArchList = SupArchList
|
||||
def GetSupArchList(self):
|
||||
return self.SupArchList
|
||||
|
||||
|
||||
#
|
||||
# AsBuild Information
|
||||
#
|
||||
@ -43,12 +43,12 @@ class InfBuildOptionItem():
|
||||
self.AsBuildList = AsBuildList
|
||||
def GetAsBuildList(self):
|
||||
return self.AsBuildList
|
||||
|
||||
|
||||
|
||||
|
||||
## INF BuildOption section
|
||||
# Macro define is not permitted for this section.
|
||||
#
|
||||
#
|
||||
#
|
||||
class InfBuildOptionsObject(InfSectionCommonDef):
|
||||
def __init__(self):
|
||||
self.BuildOptions = []
|
||||
@ -56,38 +56,38 @@ class InfBuildOptionsObject(InfSectionCommonDef):
|
||||
## SetBuildOptions function
|
||||
#
|
||||
# For BuildOptionName, need to validate it's format
|
||||
# For BuildOptionValue, just ignore it.
|
||||
# For BuildOptionValue, just ignore it.
|
||||
#
|
||||
# @param Arch Indicated which arch of build options belong to.
|
||||
# @param BuildOptCont A list contain BuildOption related information.
|
||||
# The element in the list contain 3 members.
|
||||
# BuildOptionName, BuildOptionValue and IsReplace
|
||||
# flag.
|
||||
#
|
||||
#
|
||||
# @return True Build options set/validate successfully
|
||||
# @return False Build options set/validate failed
|
||||
#
|
||||
def SetBuildOptions(self, BuildOptCont, ArchList = None, SectionContent = ''):
|
||||
|
||||
if not GlobalData.gIS_BINARY_INF:
|
||||
|
||||
if not GlobalData.gIS_BINARY_INF:
|
||||
|
||||
if SectionContent.strip() != '':
|
||||
InfBuildOptionItemObj = InfBuildOptionItem()
|
||||
InfBuildOptionItemObj.SetContent(SectionContent)
|
||||
InfBuildOptionItemObj.SetSupArchList(ArchList)
|
||||
|
||||
|
||||
self.BuildOptions.append(InfBuildOptionItemObj)
|
||||
else:
|
||||
#
|
||||
# For AsBuild INF file
|
||||
# For AsBuild INF file
|
||||
#
|
||||
if len(BuildOptCont) >= 1:
|
||||
InfBuildOptionItemObj = InfBuildOptionItem()
|
||||
InfBuildOptionItemObj.SetAsBuildList(BuildOptCont)
|
||||
InfBuildOptionItemObj.SetSupArchList(ArchList)
|
||||
self.BuildOptions.append(InfBuildOptionItemObj)
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def GetBuildOptions(self):
|
||||
return self.BuildOptions
|
||||
return self.BuildOptions
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define common class objects for INF file.
|
||||
# This file is used to define common class objects for INF file.
|
||||
# It will consumed by InfParser
|
||||
#
|
||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -17,9 +17,9 @@ InfCommonObject
|
||||
'''
|
||||
|
||||
## InfLineCommentObject
|
||||
#
|
||||
# Comment Object for any line in the INF file
|
||||
#
|
||||
#
|
||||
# Comment Object for any line in the INF file
|
||||
#
|
||||
# #
|
||||
# # HeaderComment
|
||||
# #
|
||||
@ -29,21 +29,21 @@ class InfLineCommentObject():
|
||||
def __init__(self):
|
||||
self.HeaderComments = ''
|
||||
self.TailComments = ''
|
||||
|
||||
|
||||
def SetHeaderComments(self, HeaderComments):
|
||||
self.HeaderComments = HeaderComments
|
||||
|
||||
|
||||
def GetHeaderComments(self):
|
||||
return self.HeaderComments
|
||||
|
||||
|
||||
def SetTailComments(self, TailComments):
|
||||
self.TailComments = TailComments
|
||||
|
||||
def GetTailComments(self):
|
||||
return self.TailComments
|
||||
|
||||
return self.TailComments
|
||||
|
||||
## CurrentLine
|
||||
#
|
||||
#
|
||||
class CurrentLine():
|
||||
def __init__(self):
|
||||
self.LineNo = ''
|
||||
@ -51,48 +51,48 @@ class CurrentLine():
|
||||
self.FileName = ''
|
||||
|
||||
## SetLineNo
|
||||
#
|
||||
# @param LineNo: LineNo
|
||||
#
|
||||
#
|
||||
# @param LineNo: LineNo
|
||||
#
|
||||
def SetLineNo(self, LineNo):
|
||||
self.LineNo = LineNo
|
||||
|
||||
|
||||
## GetLineNo
|
||||
#
|
||||
#
|
||||
def GetLineNo(self):
|
||||
return self.LineNo
|
||||
|
||||
## SetLineString
|
||||
#
|
||||
# @param LineString: Line String content
|
||||
#
|
||||
#
|
||||
# @param LineString: Line String content
|
||||
#
|
||||
def SetLineString(self, LineString):
|
||||
self.LineString = LineString
|
||||
|
||||
|
||||
## GetLineString
|
||||
#
|
||||
#
|
||||
def GetLineString(self):
|
||||
return self.LineString
|
||||
|
||||
## SetFileName
|
||||
#
|
||||
#
|
||||
# @param FileName: File Name
|
||||
#
|
||||
#
|
||||
def SetFileName(self, FileName):
|
||||
self.FileName = FileName
|
||||
|
||||
|
||||
## GetFileName
|
||||
#
|
||||
#
|
||||
def GetFileName(self):
|
||||
return self.FileName
|
||||
|
||||
##
|
||||
|
||||
##
|
||||
# Inf Section common data
|
||||
#
|
||||
class InfSectionCommonDef():
|
||||
def __init__(self):
|
||||
#
|
||||
# #
|
||||
# #
|
||||
# # HeaderComments at here
|
||||
# #
|
||||
# [xxSection] TailComments at here
|
||||
@ -104,7 +104,7 @@ class InfSectionCommonDef():
|
||||
# The support arch list of this section
|
||||
#
|
||||
self.SupArchList = []
|
||||
|
||||
|
||||
#
|
||||
# Store all section content
|
||||
# Key is supported Arch
|
||||
@ -112,51 +112,51 @@ class InfSectionCommonDef():
|
||||
self.AllContent = {}
|
||||
|
||||
## SetHeaderComments
|
||||
#
|
||||
#
|
||||
# @param HeaderComments: HeaderComments
|
||||
#
|
||||
#
|
||||
def SetHeaderComments(self, HeaderComments):
|
||||
self.HeaderComments = HeaderComments
|
||||
|
||||
## GetHeaderComments
|
||||
#
|
||||
#
|
||||
def GetHeaderComments(self):
|
||||
return self.HeaderComments
|
||||
|
||||
## SetTailComments
|
||||
#
|
||||
#
|
||||
# @param TailComments: TailComments
|
||||
#
|
||||
#
|
||||
def SetTailComments(self, TailComments):
|
||||
self.TailComments = TailComments
|
||||
|
||||
## GetTailComments
|
||||
#
|
||||
#
|
||||
def GetTailComments(self):
|
||||
return self.TailComments
|
||||
|
||||
## SetSupArchList
|
||||
#
|
||||
#
|
||||
# @param Arch: Arch
|
||||
#
|
||||
#
|
||||
def SetSupArchList(self, Arch):
|
||||
if Arch not in self.SupArchList:
|
||||
self.SupArchList.append(Arch)
|
||||
|
||||
## GetSupArchList
|
||||
#
|
||||
#
|
||||
def GetSupArchList(self):
|
||||
return self.SupArchList
|
||||
|
||||
## SetAllContent
|
||||
#
|
||||
#
|
||||
# @param ArchList: ArchList
|
||||
# @param Content: Content
|
||||
#
|
||||
#
|
||||
def SetAllContent(self, Content):
|
||||
self.AllContent = Content
|
||||
|
||||
|
||||
## GetAllContent
|
||||
#
|
||||
#
|
||||
def GetAllContent(self):
|
||||
return self.AllContent
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define common class objects of [Defines] section for INF file.
|
||||
# This file is used to define common class objects of [Defines] section for INF file.
|
||||
# It will consumed by InfParser
|
||||
#
|
||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -19,13 +19,13 @@ InfDefineCommonObject
|
||||
from Object.Parser.InfCommonObject import InfLineCommentObject
|
||||
|
||||
## InfDefineImageExeParamItem
|
||||
#
|
||||
#
|
||||
class InfDefineImageExeParamItem():
|
||||
def __init__(self):
|
||||
self.CName = ''
|
||||
self.FeatureFlagExp = ''
|
||||
self.Comments = InfLineCommentObject()
|
||||
|
||||
|
||||
def SetCName(self, CName):
|
||||
self.CName = CName
|
||||
def GetCName(self):
|
||||
@ -36,49 +36,49 @@ class InfDefineImageExeParamItem():
|
||||
return self.FeatureFlagExp
|
||||
|
||||
## InfDefineEntryPointItem
|
||||
#
|
||||
#
|
||||
class InfDefineEntryPointItem(InfDefineImageExeParamItem):
|
||||
def __init__(self):
|
||||
InfDefineImageExeParamItem.__init__(self)
|
||||
|
||||
## InfDefineUnloadImageItem
|
||||
#
|
||||
#
|
||||
class InfDefineUnloadImageItem(InfDefineImageExeParamItem):
|
||||
def __init__(self):
|
||||
InfDefineImageExeParamItem.__init__(self)
|
||||
|
||||
## InfDefineConstructorItem
|
||||
#
|
||||
#
|
||||
class InfDefineConstructorItem(InfDefineImageExeParamItem):
|
||||
def __init__(self):
|
||||
InfDefineImageExeParamItem.__init__(self)
|
||||
self.SupModList = []
|
||||
|
||||
|
||||
def SetSupModList(self, SupModList):
|
||||
self.SupModList = SupModList
|
||||
def GetSupModList(self):
|
||||
return self.SupModList
|
||||
|
||||
## InfDefineDestructorItem
|
||||
#
|
||||
#
|
||||
class InfDefineDestructorItem(InfDefineImageExeParamItem):
|
||||
def __init__(self):
|
||||
InfDefineImageExeParamItem.__init__(self)
|
||||
self.SupModList = []
|
||||
|
||||
|
||||
def SetSupModList(self, SupModList):
|
||||
self.SupModList = SupModList
|
||||
def GetSupModList(self):
|
||||
return self.SupModList
|
||||
|
||||
|
||||
## InfDefineLibraryItem
|
||||
#
|
||||
#
|
||||
class InfDefineLibraryItem():
|
||||
def __init__(self):
|
||||
self.LibraryName = ''
|
||||
self.Types = []
|
||||
self.Comments = InfLineCommentObject()
|
||||
|
||||
|
||||
def SetLibraryName(self, Name):
|
||||
self.LibraryName = Name
|
||||
def GetLibraryName(self):
|
||||
@ -86,4 +86,4 @@ class InfDefineLibraryItem():
|
||||
def SetTypes(self, Type):
|
||||
self.Types = Type
|
||||
def GetTypes(self):
|
||||
return self.Types
|
||||
return self.Types
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of [Defines] section for INF file.
|
||||
# This file is used to define class objects of [Defines] section for INF file.
|
||||
# It will consumed by InfParser
|
||||
#
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -21,21 +21,21 @@ import re
|
||||
|
||||
from Logger import StringTable as ST
|
||||
from Logger import ToolError
|
||||
from Library import GlobalData
|
||||
from Library import GlobalData
|
||||
from Library import DataType as DT
|
||||
from Library.StringUtils import GetSplitValueList
|
||||
from Library.Misc import CheckGuidRegFormat
|
||||
from Library.Misc import Sdict
|
||||
from Library.Misc import ConvPathFromAbsToRel
|
||||
from Library.Misc import ValidateUNIFilePath
|
||||
from Library.ExpressionValidate import IsValidFeatureFlagExp
|
||||
from Library.ExpressionValidate import IsValidFeatureFlagExp
|
||||
from Library.ParserValidate import IsValidWord
|
||||
from Library.ParserValidate import IsValidInfMoudleType
|
||||
from Library.ParserValidate import IsValidHex
|
||||
from Library.ParserValidate import IsValidHexVersion
|
||||
from Library.ParserValidate import IsValidDecVersion
|
||||
from Library.ParserValidate import IsValidCVariableName
|
||||
from Library.ParserValidate import IsValidBoolType
|
||||
from Library.ParserValidate import IsValidInfMoudleType
|
||||
from Library.ParserValidate import IsValidHex
|
||||
from Library.ParserValidate import IsValidHexVersion
|
||||
from Library.ParserValidate import IsValidDecVersion
|
||||
from Library.ParserValidate import IsValidCVariableName
|
||||
from Library.ParserValidate import IsValidBoolType
|
||||
from Library.ParserValidate import IsValidPath
|
||||
from Library.ParserValidate import IsValidFamily
|
||||
from Library.ParserValidate import IsValidIdentifier
|
||||
@ -47,7 +47,7 @@ from Object.Parser.InfMisc import ErrorInInf
|
||||
from Object.Parser.InfDefineCommonObject import InfDefineLibraryItem
|
||||
from Object.Parser.InfDefineCommonObject import InfDefineEntryPointItem
|
||||
from Object.Parser.InfDefineCommonObject import InfDefineUnloadImageItem
|
||||
from Object.Parser.InfDefineCommonObject import InfDefineConstructorItem
|
||||
from Object.Parser.InfDefineCommonObject import InfDefineConstructorItem
|
||||
from Object.Parser.InfDefineCommonObject import InfDefineDestructorItem
|
||||
|
||||
class InfDefSectionOptionRomInfo():
|
||||
@ -65,9 +65,9 @@ class InfDefSectionOptionRomInfo():
|
||||
if self.PciVendorId is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_VENDOR_ID),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
#
|
||||
# The PciVendorId should be hex string.
|
||||
# The PciVendorId should be hex string.
|
||||
#
|
||||
if (IsValidHex(PciVendorId)):
|
||||
self.PciVendorId = InfDefMember()
|
||||
@ -78,10 +78,10 @@ class InfDefSectionOptionRomInfo():
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(PciVendorId),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
|
||||
|
||||
def GetPciVendorId(self):
|
||||
return self.PciVendorId
|
||||
|
||||
|
||||
def SetPciDeviceId(self, PciDeviceId, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
@ -89,23 +89,23 @@ class InfDefSectionOptionRomInfo():
|
||||
if self.PciDeviceId is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_DEVICE_ID),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
#
|
||||
# The PciDeviceId should be hex string.
|
||||
# The PciDeviceId should be hex string.
|
||||
#
|
||||
if (IsValidHex(PciDeviceId)):
|
||||
self.PciDeviceId = InfDefMember()
|
||||
self.PciDeviceId.SetValue(PciDeviceId)
|
||||
self.PciDeviceId.Comments = Comments
|
||||
self.PciDeviceId.Comments = Comments
|
||||
return True
|
||||
else:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(PciDeviceId),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
|
||||
|
||||
def GetPciDeviceId(self):
|
||||
return self.PciDeviceId
|
||||
|
||||
|
||||
def SetPciClassCode(self, PciClassCode, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
@ -113,9 +113,9 @@ class InfDefSectionOptionRomInfo():
|
||||
if self.PciClassCode is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_CLASS_CODE),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
#
|
||||
# The PciClassCode should be 4 bytes hex string.
|
||||
# The PciClassCode should be 4 bytes hex string.
|
||||
#
|
||||
if (IsValidHex(PciClassCode)):
|
||||
self.PciClassCode = InfDefMember()
|
||||
@ -127,10 +127,10 @@ class InfDefSectionOptionRomInfo():
|
||||
(PciClassCode),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
|
||||
|
||||
def GetPciClassCode(self):
|
||||
return self.PciClassCode
|
||||
|
||||
|
||||
def SetPciRevision(self, PciRevision, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
@ -138,9 +138,9 @@ class InfDefSectionOptionRomInfo():
|
||||
if self.PciRevision is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_REVISION),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
#
|
||||
# The PciRevision should be 4 bytes hex string.
|
||||
# The PciRevision should be 4 bytes hex string.
|
||||
#
|
||||
if (IsValidHex(PciRevision)):
|
||||
self.PciRevision = InfDefMember()
|
||||
@ -151,10 +151,10 @@ class InfDefSectionOptionRomInfo():
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(PciRevision),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
|
||||
|
||||
def GetPciRevision(self):
|
||||
return self.PciRevision
|
||||
|
||||
|
||||
def SetPciCompress(self, PciCompress, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
@ -163,9 +163,9 @@ class InfDefSectionOptionRomInfo():
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_COMPRESS),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
|
||||
|
||||
#
|
||||
# The PciCompress should be 'TRUE' or 'FALSE'.
|
||||
# The PciCompress should be 'TRUE' or 'FALSE'.
|
||||
#
|
||||
if (PciCompress == 'TRUE' or PciCompress == 'FALSE'):
|
||||
self.PciCompress = InfDefMember()
|
||||
@ -175,9 +175,9 @@ class InfDefSectionOptionRomInfo():
|
||||
else:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(PciCompress),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
def GetPciCompress(self):
|
||||
return self.PciCompress
|
||||
return self.PciCompress
|
||||
##
|
||||
# INF [Define] section Object
|
||||
#
|
||||
@ -210,15 +210,15 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
## SetHeadComment
|
||||
#
|
||||
# @param BaseName: BaseName
|
||||
#
|
||||
#
|
||||
def SetBaseName(self, BaseName, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
#
|
||||
if self.BaseName is not None:
|
||||
if self.BaseName is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_BASE_NAME),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
if not (BaseName == '' or BaseName is None):
|
||||
if IsValidWord(BaseName) and not BaseName.startswith("_"):
|
||||
self.BaseName = InfDefMember()
|
||||
@ -231,26 +231,26 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
return False
|
||||
|
||||
## GetBaseName
|
||||
#
|
||||
#
|
||||
def GetBaseName(self):
|
||||
return self.BaseName
|
||||
|
||||
## SetFileGuid
|
||||
#
|
||||
# @param FileGuid: FileGuid
|
||||
#
|
||||
#
|
||||
def SetFileGuid(self, FileGuid, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
#
|
||||
if self.FileGuid is not None:
|
||||
if self.FileGuid is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
|
||||
%(DT.TAB_INF_DEFINES_FILE_GUID),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
#
|
||||
# Do verification of GUID content/format
|
||||
#
|
||||
#
|
||||
if (CheckGuidRegFormat(FileGuid)):
|
||||
self.FileGuid = InfDefMember()
|
||||
self.FileGuid.SetValue(FileGuid)
|
||||
@ -262,23 +262,23 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
return False
|
||||
|
||||
## GetFileGuid
|
||||
#
|
||||
#
|
||||
def GetFileGuid(self):
|
||||
return self.FileGuid
|
||||
|
||||
## SetModuleType
|
||||
#
|
||||
# @param ModuleType: ModuleType
|
||||
#
|
||||
#
|
||||
def SetModuleType(self, ModuleType, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
#
|
||||
if self.ModuleType is not None:
|
||||
if self.ModuleType is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
|
||||
%(DT.TAB_INF_DEFINES_MODULE_TYPE),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
#
|
||||
# Valid Module Type or not
|
||||
#
|
||||
@ -289,7 +289,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
self.ModuleType.CurrentLine.SetLineNo(self.CurrentLine[1])
|
||||
self.ModuleType.CurrentLine.SetLineString(self.CurrentLine[2])
|
||||
self.ModuleType.CurrentLine.SetFileName(self.CurrentLine[0])
|
||||
self.ModuleType.Comments = Comments
|
||||
self.ModuleType.Comments = Comments
|
||||
return True
|
||||
else:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_MODULETYPE_INVALID%\
|
||||
@ -298,14 +298,14 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
return False
|
||||
|
||||
## GetModuleType
|
||||
#
|
||||
#
|
||||
def GetModuleType(self):
|
||||
return self.ModuleType
|
||||
|
||||
|
||||
## SetModuleUniFileName
|
||||
#
|
||||
# @param ModuleUniFileName: ModuleUniFileName
|
||||
#
|
||||
#
|
||||
def SetModuleUniFileName(self, ModuleUniFileName, Comments):
|
||||
if Comments:
|
||||
pass
|
||||
@ -315,25 +315,25 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
self.ModuleUniFileName = ModuleUniFileName
|
||||
|
||||
## GetModuleType
|
||||
#
|
||||
#
|
||||
def GetModuleUniFileName(self):
|
||||
return self.ModuleUniFileName
|
||||
|
||||
|
||||
## SetInfVersion
|
||||
#
|
||||
# @param InfVersion: InfVersion
|
||||
#
|
||||
#
|
||||
def SetInfVersion(self, InfVersion, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
#
|
||||
if self.InfVersion is not None:
|
||||
if self.InfVersion is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
|
||||
%(DT.TAB_INF_DEFINES_INF_VERSION),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
#
|
||||
# The InfVersion should be 4 bytes hex string.
|
||||
# The InfVersion should be 4 bytes hex string.
|
||||
#
|
||||
if (IsValidHex(InfVersion)):
|
||||
if (InfVersion < '0x00010005'):
|
||||
@ -356,25 +356,25 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
return True
|
||||
|
||||
## GetInfVersion
|
||||
#
|
||||
#
|
||||
def GetInfVersion(self):
|
||||
return self.InfVersion
|
||||
|
||||
## SetEdkReleaseVersion
|
||||
#
|
||||
# @param EdkReleaseVersion: EdkReleaseVersion
|
||||
#
|
||||
#
|
||||
def SetEdkReleaseVersion(self, EdkReleaseVersion, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
#
|
||||
if self.EdkReleaseVersion is not None:
|
||||
if self.EdkReleaseVersion is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
|
||||
%(DT.TAB_INF_DEFINES_EDK_RELEASE_VERSION),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
#
|
||||
# The EdkReleaseVersion should be 4 bytes hex string.
|
||||
# The EdkReleaseVersion should be 4 bytes hex string.
|
||||
#
|
||||
if IsValidHexVersion(EdkReleaseVersion) or \
|
||||
IsValidDecVersionVal(EdkReleaseVersion):
|
||||
@ -389,25 +389,25 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
return False
|
||||
|
||||
## GetEdkReleaseVersion
|
||||
#
|
||||
#
|
||||
def GetEdkReleaseVersion(self):
|
||||
return self.EdkReleaseVersion
|
||||
return self.EdkReleaseVersion
|
||||
|
||||
## SetUefiSpecificationVersion
|
||||
#
|
||||
# @param UefiSpecificationVersion: UefiSpecificationVersion
|
||||
#
|
||||
#
|
||||
def SetUefiSpecificationVersion(self, UefiSpecificationVersion, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
#
|
||||
if self.UefiSpecificationVersion is not None:
|
||||
if self.UefiSpecificationVersion is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
|
||||
%(DT.TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
#
|
||||
# The EdkReleaseVersion should be 4 bytes hex string.
|
||||
# The EdkReleaseVersion should be 4 bytes hex string.
|
||||
#
|
||||
if IsValidHexVersion(UefiSpecificationVersion) or \
|
||||
IsValidDecVersionVal(UefiSpecificationVersion):
|
||||
@ -422,25 +422,25 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
return False
|
||||
|
||||
## GetUefiSpecificationVersion
|
||||
#
|
||||
#
|
||||
def GetUefiSpecificationVersion(self):
|
||||
return self.UefiSpecificationVersion
|
||||
return self.UefiSpecificationVersion
|
||||
|
||||
## SetPiSpecificationVersion
|
||||
#
|
||||
# @param PiSpecificationVersion: PiSpecificationVersion
|
||||
#
|
||||
#
|
||||
def SetPiSpecificationVersion(self, PiSpecificationVersion, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
#
|
||||
if self.PiSpecificationVersion is not None:
|
||||
if self.PiSpecificationVersion is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
|
||||
%(DT.TAB_INF_DEFINES_PI_SPECIFICATION_VERSION),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
#
|
||||
# The EdkReleaseVersion should be 4 bytes hex string.
|
||||
# The EdkReleaseVersion should be 4 bytes hex string.
|
||||
#
|
||||
if IsValidHexVersion(PiSpecificationVersion) or \
|
||||
IsValidDecVersionVal(PiSpecificationVersion):
|
||||
@ -451,24 +451,24 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
else:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID\
|
||||
%(PiSpecificationVersion),
|
||||
LineInfo=self.CurrentLine)
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
|
||||
## GetPiSpecificationVersion
|
||||
#
|
||||
#
|
||||
def GetPiSpecificationVersion(self):
|
||||
return self.PiSpecificationVersion
|
||||
|
||||
## SetLibraryClass
|
||||
#
|
||||
# @param LibraryClass: LibraryClass
|
||||
#
|
||||
#
|
||||
def SetLibraryClass(self, LibraryClass, Comments):
|
||||
ValueList = GetSplitValueList(LibraryClass)
|
||||
Name = ValueList[0]
|
||||
Name = ValueList[0]
|
||||
if IsValidWord(Name):
|
||||
InfDefineLibraryItemObj = InfDefineLibraryItem()
|
||||
InfDefineLibraryItemObj.SetLibraryName(Name)
|
||||
InfDefineLibraryItemObj.SetLibraryName(Name)
|
||||
InfDefineLibraryItemObj.Comments = Comments
|
||||
if len(ValueList) == 2:
|
||||
Type = ValueList[1]
|
||||
@ -479,23 +479,23 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Item),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
InfDefineLibraryItemObj.SetTypes(TypeList)
|
||||
self.LibraryClass.append(InfDefineLibraryItemObj)
|
||||
InfDefineLibraryItemObj.SetTypes(TypeList)
|
||||
self.LibraryClass.append(InfDefineLibraryItemObj)
|
||||
else:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Name),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def GetLibraryClass(self):
|
||||
return self.LibraryClass
|
||||
|
||||
|
||||
def SetVersionString(self, VersionString, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
#
|
||||
if self.VersionString is not None:
|
||||
if self.VersionString is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
|
||||
%(DT.TAB_INF_DEFINES_VERSION_STRING),
|
||||
LineInfo=self.CurrentLine)
|
||||
@ -503,25 +503,25 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
if not IsValidDecVersion(VersionString):
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID\
|
||||
%(VersionString),
|
||||
LineInfo=self.CurrentLine)
|
||||
LineInfo=self.CurrentLine)
|
||||
self.VersionString = InfDefMember()
|
||||
self.VersionString.SetValue(VersionString)
|
||||
self.VersionString.Comments = Comments
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def GetVersionString(self):
|
||||
return self.VersionString
|
||||
|
||||
|
||||
def SetPcdIsDriver(self, PcdIsDriver, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
#
|
||||
if self.PcdIsDriver is not None:
|
||||
if self.PcdIsDriver is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
|
||||
%(DT.TAB_INF_DEFINES_PCD_IS_DRIVER),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
if PcdIsDriver == 'PEI_PCD_DRIVER' or PcdIsDriver == 'DXE_PCD_DRIVER':
|
||||
self.PcdIsDriver = InfDefMember()
|
||||
self.PcdIsDriver.SetValue(PcdIsDriver)
|
||||
@ -531,20 +531,20 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(PcdIsDriver),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
|
||||
|
||||
def GetPcdIsDriver(self):
|
||||
return self.PcdIsDriver
|
||||
|
||||
|
||||
#
|
||||
# SetEntryPoint
|
||||
#
|
||||
#
|
||||
def SetEntryPoint(self, EntryPoint, Comments):
|
||||
#
|
||||
# It can be a list
|
||||
#
|
||||
ValueList = []
|
||||
TokenList = GetSplitValueList(EntryPoint, DT.TAB_VALUE_SPLIT)
|
||||
ValueList[0:len(TokenList)] = TokenList
|
||||
ValueList[0:len(TokenList)] = TokenList
|
||||
InfDefineEntryPointItemObj = InfDefineEntryPointItem()
|
||||
if not IsValidCVariableName(ValueList[0]):
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%\
|
||||
@ -557,33 +557,33 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
(ValueList[1]),
|
||||
LineInfo=self.CurrentLine)
|
||||
#
|
||||
# Validate FFE
|
||||
# Validate FFE
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(ValueList[1].strip())
|
||||
if not FeatureFlagRtv[0]:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%\
|
||||
(FeatureFlagRtv[1]),
|
||||
LineInfo=self.CurrentLine)
|
||||
InfDefineEntryPointItemObj.SetFeatureFlagExp(ValueList[1])
|
||||
LineInfo=self.CurrentLine)
|
||||
InfDefineEntryPointItemObj.SetFeatureFlagExp(ValueList[1])
|
||||
if len(ValueList) > 2:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(EntryPoint),
|
||||
LineInfo=self.CurrentLine)
|
||||
InfDefineEntryPointItemObj.Comments = Comments
|
||||
self.EntryPoint.append(InfDefineEntryPointItemObj)
|
||||
|
||||
InfDefineEntryPointItemObj.Comments = Comments
|
||||
self.EntryPoint.append(InfDefineEntryPointItemObj)
|
||||
|
||||
def GetEntryPoint(self):
|
||||
return self.EntryPoint
|
||||
|
||||
#
|
||||
# SetUnloadImages
|
||||
#
|
||||
#
|
||||
def SetUnloadImages(self, UnloadImages, Comments):
|
||||
#
|
||||
# It can be a list
|
||||
#
|
||||
ValueList = []
|
||||
TokenList = GetSplitValueList(UnloadImages, DT.TAB_VALUE_SPLIT)
|
||||
ValueList[0:len(TokenList)] = TokenList
|
||||
ValueList[0:len(TokenList)] = TokenList
|
||||
InfDefineUnloadImageItemObj = InfDefineUnloadImageItem()
|
||||
if not IsValidCVariableName(ValueList[0]):
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[0]),
|
||||
@ -594,33 +594,33 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[1]),
|
||||
LineInfo=self.CurrentLine)
|
||||
#
|
||||
# Validate FFE
|
||||
# Validate FFE
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(ValueList[1].strip())
|
||||
if not FeatureFlagRtv[0]:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
|
||||
LineInfo=self.CurrentLine)
|
||||
InfDefineUnloadImageItemObj.SetFeatureFlagExp(ValueList[1])
|
||||
|
||||
|
||||
if len(ValueList) > 2:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(UnloadImages),
|
||||
LineInfo=self.CurrentLine)
|
||||
InfDefineUnloadImageItemObj.Comments = Comments
|
||||
self.UnloadImages.append(InfDefineUnloadImageItemObj)
|
||||
|
||||
|
||||
def GetUnloadImages(self):
|
||||
return self.UnloadImages
|
||||
|
||||
#
|
||||
# SetConstructor
|
||||
#
|
||||
#
|
||||
def SetConstructor(self, Constructor, Comments):
|
||||
#
|
||||
# It can be a list
|
||||
#
|
||||
ValueList = []
|
||||
TokenList = GetSplitValueList(Constructor, DT.TAB_VALUE_SPLIT)
|
||||
ValueList[0:len(TokenList)] = TokenList
|
||||
ValueList[0:len(TokenList)] = TokenList
|
||||
InfDefineConstructorItemObj = InfDefineConstructorItem()
|
||||
if not IsValidCVariableName(ValueList[0]):
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[0]),
|
||||
@ -635,39 +635,39 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
if ModItem not in DT.MODULE_LIST:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_MODULETYPE_INVALID%(ModItem),
|
||||
LineInfo=self.CurrentLine)
|
||||
InfDefineConstructorItemObj.SetSupModList(ModList)
|
||||
InfDefineConstructorItemObj.SetSupModList(ModList)
|
||||
if len(ValueList) == 3:
|
||||
if ValueList[2].strip() == '':
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[2]),
|
||||
LineInfo=self.CurrentLine)
|
||||
#
|
||||
# Validate FFE
|
||||
# Validate FFE
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(ValueList[2].strip())
|
||||
if not FeatureFlagRtv[0]:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[2]),
|
||||
LineInfo=self.CurrentLine)
|
||||
InfDefineConstructorItemObj.SetFeatureFlagExp(ValueList[2])
|
||||
|
||||
|
||||
if len(ValueList) > 3:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Constructor),
|
||||
LineInfo=self.CurrentLine)
|
||||
InfDefineConstructorItemObj.Comments = Comments
|
||||
self.Constructor.append(InfDefineConstructorItemObj)
|
||||
|
||||
InfDefineConstructorItemObj.Comments = Comments
|
||||
self.Constructor.append(InfDefineConstructorItemObj)
|
||||
|
||||
def GetConstructor(self):
|
||||
return self.Constructor
|
||||
|
||||
#
|
||||
# SetDestructor
|
||||
#
|
||||
#
|
||||
def SetDestructor(self, Destructor, Comments):
|
||||
#
|
||||
# It can be a list and only 1 set to TRUE
|
||||
#
|
||||
#
|
||||
ValueList = []
|
||||
TokenList = GetSplitValueList(Destructor, DT.TAB_VALUE_SPLIT)
|
||||
ValueList[0:len(TokenList)] = TokenList
|
||||
ValueList[0:len(TokenList)] = TokenList
|
||||
InfDefineDestructorItemObj = InfDefineDestructorItem()
|
||||
if not IsValidCVariableName(ValueList[0]):
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[0]),
|
||||
@ -682,30 +682,30 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
if ModItem not in DT.MODULE_LIST:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_MODULETYPE_INVALID%(ModItem),
|
||||
LineInfo=self.CurrentLine)
|
||||
InfDefineDestructorItemObj.SetSupModList(ModList)
|
||||
InfDefineDestructorItemObj.SetSupModList(ModList)
|
||||
if len(ValueList) == 3:
|
||||
if ValueList[2].strip() == '':
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[2]),
|
||||
LineInfo=self.CurrentLine)
|
||||
#
|
||||
# Validate FFE
|
||||
# Validate FFE
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(ValueList[2].strip())
|
||||
if not FeatureFlagRtv[0]:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
|
||||
LineInfo=self.CurrentLine)
|
||||
InfDefineDestructorItemObj.SetFeatureFlagExp(ValueList[2])
|
||||
|
||||
|
||||
if len(ValueList) > 3:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Destructor),
|
||||
LineInfo=self.CurrentLine)
|
||||
|
||||
InfDefineDestructorItemObj.Comments = Comments
|
||||
self.Destructor.append(InfDefineDestructorItemObj)
|
||||
|
||||
|
||||
InfDefineDestructorItemObj.Comments = Comments
|
||||
self.Destructor.append(InfDefineDestructorItemObj)
|
||||
|
||||
def GetDestructor(self):
|
||||
return self.Destructor
|
||||
|
||||
|
||||
def SetShadow(self, Shadow, Comments):
|
||||
#
|
||||
# Value has been set before.
|
||||
@ -713,7 +713,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
if self.Shadow is not None:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_SHADOW),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
if (IsValidBoolType(Shadow)):
|
||||
self.Shadow = InfDefMember()
|
||||
self.Shadow.SetValue(Shadow)
|
||||
@ -751,22 +751,22 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
IsValidFileFlag = False
|
||||
ModulePath = os.path.split(self.CurrentLine[0])[0]
|
||||
if IsValidPath(FileName, ModulePath):
|
||||
IsValidFileFlag = True
|
||||
IsValidFileFlag = True
|
||||
else:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(FileName),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
if IsValidFileFlag:
|
||||
FileName = ConvPathFromAbsToRel(FileName, GlobalData.gINF_MODULE_DIR)
|
||||
FileName = ConvPathFromAbsToRel(FileName, GlobalData.gINF_MODULE_DIR)
|
||||
self.CustomMakefile.append((Family, FileName, Comments))
|
||||
IsValidFileFlag = False
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def GetCustomMakefile(self):
|
||||
return self.CustomMakefile
|
||||
|
||||
|
||||
#
|
||||
# ["SPEC" <Spec> <EOL>]*{0,}
|
||||
# <Spec> ::= <Word> "=" <VersionVal>
|
||||
@ -785,7 +785,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_NO_NAME + ' Or ' + ST.ERR_INF_PARSER_DEFINE_ITEM_NO_VALUE,
|
||||
LineInfo=self.CurrentLine)
|
||||
Name = __ValueList[0].strip()
|
||||
Version = __ValueList[1].strip()
|
||||
Version = __ValueList[1].strip()
|
||||
if IsValidIdentifier(Name):
|
||||
if IsValidDecVersion(Version):
|
||||
self.Specification.append((Name, Version, Comments))
|
||||
@ -794,15 +794,15 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Version),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
else:
|
||||
else:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Name),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
return True
|
||||
|
||||
def GetSpecification(self):
|
||||
return self.Specification
|
||||
|
||||
|
||||
#
|
||||
# [<UefiHiiResource> <EOL>]{0,1}
|
||||
# <UefiHiiResource> ::= "UEFI_HII_RESOURCE_SECTION" "=" <BoolType>
|
||||
@ -815,12 +815,12 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND
|
||||
%(DT.TAB_INF_DEFINES_UEFI_HII_RESOURCE_SECTION),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
return False
|
||||
if not (UefiHiiResourceSection == '' or UefiHiiResourceSection is None):
|
||||
if (IsValidBoolType(UefiHiiResourceSection)):
|
||||
self.UefiHiiResourceSection = InfDefMember()
|
||||
self.UefiHiiResourceSection.SetValue(UefiHiiResourceSection)
|
||||
self.UefiHiiResourceSection.Comments = Comments
|
||||
self.UefiHiiResourceSection.Comments = Comments
|
||||
return True
|
||||
else:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(UefiHiiResourceSection),
|
||||
@ -828,28 +828,28 @@ class InfDefSection(InfDefSectionOptionRomInfo):
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def GetUefiHiiResourceSection(self):
|
||||
return self.UefiHiiResourceSection
|
||||
|
||||
def SetDpxSource(self, DpxSource, Comments):
|
||||
|
||||
def SetDpxSource(self, DpxSource, Comments):
|
||||
#
|
||||
# The MakefileName specified file should exist
|
||||
#
|
||||
IsValidFileFlag = False
|
||||
ModulePath = os.path.split(self.CurrentLine[0])[0]
|
||||
if IsValidPath(DpxSource, ModulePath):
|
||||
IsValidFileFlag = True
|
||||
IsValidFileFlag = True
|
||||
else:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(DpxSource),
|
||||
LineInfo=self.CurrentLine)
|
||||
return False
|
||||
if IsValidFileFlag:
|
||||
DpxSource = ConvPathFromAbsToRel(DpxSource,
|
||||
GlobalData.gINF_MODULE_DIR)
|
||||
DpxSource = ConvPathFromAbsToRel(DpxSource,
|
||||
GlobalData.gINF_MODULE_DIR)
|
||||
self.DpxSource.append((DpxSource, Comments))
|
||||
IsValidFileFlag = False
|
||||
return True
|
||||
return True
|
||||
|
||||
def GetDpxSource(self):
|
||||
return self.DpxSource
|
||||
@ -867,7 +867,7 @@ gFUNCTION_MAPPING_FOR_DEFINE_SECTION = {
|
||||
DT.TAB_INF_DEFINES_INF_VERSION : InfDefSection.SetInfVersion,
|
||||
#
|
||||
# Optional Fields
|
||||
#
|
||||
#
|
||||
DT.TAB_INF_DEFINES_MODULE_UNI_FILE : InfDefSection.SetModuleUniFileName,
|
||||
DT.TAB_INF_DEFINES_EDK_RELEASE_VERSION : InfDefSection.SetEdkReleaseVersion,
|
||||
DT.TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION : InfDefSection.SetUefiSpecificationVersion,
|
||||
@ -882,10 +882,10 @@ gFUNCTION_MAPPING_FOR_DEFINE_SECTION = {
|
||||
DT.TAB_INF_DEFINES_SHADOW : InfDefSection.SetShadow,
|
||||
DT.TAB_INF_DEFINES_PCI_VENDOR_ID : InfDefSection.SetPciVendorId,
|
||||
DT.TAB_INF_DEFINES_PCI_DEVICE_ID : InfDefSection.SetPciDeviceId,
|
||||
DT.TAB_INF_DEFINES_PCI_CLASS_CODE : InfDefSection.SetPciClassCode,
|
||||
DT.TAB_INF_DEFINES_PCI_CLASS_CODE : InfDefSection.SetPciClassCode,
|
||||
DT.TAB_INF_DEFINES_PCI_REVISION : InfDefSection.SetPciRevision,
|
||||
DT.TAB_INF_DEFINES_PCI_COMPRESS : InfDefSection.SetPciCompress,
|
||||
DT.TAB_INF_DEFINES_CUSTOM_MAKEFILE : InfDefSection.SetCustomMakefile,
|
||||
DT.TAB_INF_DEFINES_CUSTOM_MAKEFILE : InfDefSection.SetCustomMakefile,
|
||||
DT.TAB_INF_DEFINES_SPEC : InfDefSection.SetSpecification,
|
||||
DT.TAB_INF_DEFINES_UEFI_HII_RESOURCE_SECTION : InfDefSection.SetUefiHiiResourceSection,
|
||||
DT.TAB_INF_DEFINES_DPX_SOURCE : InfDefSection.SetDpxSource
|
||||
@ -908,7 +908,7 @@ class InfDefMember():
|
||||
return self.Value
|
||||
def SetValue(self, Value):
|
||||
self.Value = Value
|
||||
|
||||
|
||||
## InfDefObject
|
||||
#
|
||||
#
|
||||
@ -922,7 +922,7 @@ class InfDefObject(InfSectionCommonDef):
|
||||
#
|
||||
HasFoundInfVersionFalg = False
|
||||
LineInfo = ['', -1, '']
|
||||
ArchListString = ' '.join(Arch)
|
||||
ArchListString = ' '.join(Arch)
|
||||
#
|
||||
# Parse Define items.
|
||||
#
|
||||
@ -947,7 +947,7 @@ class InfDefObject(InfSectionCommonDef):
|
||||
ErrorCode=ToolError.EDK1_INF_ERROR,
|
||||
RaiseError=True)
|
||||
if Name == DT.TAB_INF_DEFINES_INF_VERSION:
|
||||
HasFoundInfVersionFalg = True
|
||||
HasFoundInfVersionFalg = True
|
||||
if not (Name == '' or Name is None):
|
||||
#
|
||||
# Process "SPEC" Keyword definition.
|
||||
@ -958,7 +958,7 @@ class InfDefObject(InfSectionCommonDef):
|
||||
Name = "SPEC"
|
||||
Value = SpecValue + " = " + Value
|
||||
if ArchListString in self.Defines:
|
||||
DefineList = self.Defines[ArchListString]
|
||||
DefineList = self.Defines[ArchListString]
|
||||
LineInfo[0] = InfDefMemberObj.CurrentLine.GetFileName()
|
||||
LineInfo[1] = InfDefMemberObj.CurrentLine.GetLineNo()
|
||||
LineInfo[2] = InfDefMemberObj.CurrentLine.GetLineString()
|
||||
@ -968,7 +968,7 @@ class InfDefObject(InfSectionCommonDef):
|
||||
#
|
||||
if Name not in gFUNCTION_MAPPING_FOR_DEFINE_SECTION.keys():
|
||||
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_SECTION_KEYWORD_INVALID%(Name),
|
||||
LineInfo=LineInfo)
|
||||
LineInfo=LineInfo)
|
||||
else:
|
||||
ProcessFunc = gFUNCTION_MAPPING_FOR_DEFINE_SECTION[Name]
|
||||
if (ProcessFunc is not None):
|
||||
@ -988,7 +988,7 @@ class InfDefObject(InfSectionCommonDef):
|
||||
LineInfo=LineInfo)
|
||||
#
|
||||
# Found the process function from mapping table.
|
||||
#
|
||||
#
|
||||
else:
|
||||
ProcessFunc = gFUNCTION_MAPPING_FOR_DEFINE_SECTION[Name]
|
||||
if (ProcessFunc is not None):
|
||||
@ -1000,9 +1000,9 @@ class InfDefObject(InfSectionCommonDef):
|
||||
if not HasFoundInfVersionFalg:
|
||||
ErrorInInf(ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF,
|
||||
ErrorCode=ToolError.EDK1_INF_ERROR,
|
||||
RaiseError=True)
|
||||
RaiseError=True)
|
||||
return True
|
||||
|
||||
|
||||
def GetDefines(self):
|
||||
return self.Defines
|
||||
|
||||
return self.Defines
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of INF file [Depex] section.
|
||||
# It will consumed by InfParser.
|
||||
# This file is used to define class objects of INF file [Depex] section.
|
||||
# It will consumed by InfParser.
|
||||
#
|
||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -99,7 +99,7 @@ class InfDepexObject(InfSectionCommonDef):
|
||||
|
||||
#
|
||||
# Validate Arch
|
||||
#
|
||||
#
|
||||
if IsValidArch(Arch.strip().upper()):
|
||||
InfDepexItemIns.SetSupArch(Arch)
|
||||
else:
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of INF file [Guids] section.
|
||||
# It will consumed by InfParser.
|
||||
# This file is used to define class objects of INF file [Guids] section.
|
||||
# It will consumed by InfParser.
|
||||
#
|
||||
# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -18,10 +18,10 @@ InfGuidObject
|
||||
|
||||
from Library.ParserValidate import IsValidCVariableName
|
||||
from Library.CommentParsing import ParseComment
|
||||
from Library.ExpressionValidate import IsValidFeatureFlagExp
|
||||
|
||||
from Library.ExpressionValidate import IsValidFeatureFlagExp
|
||||
|
||||
from Library.Misc import Sdict
|
||||
from Library import DataType as DT
|
||||
from Library import DataType as DT
|
||||
import Logger.Log as Logger
|
||||
from Logger import ToolError
|
||||
from Logger import StringTable as ST
|
||||
@ -29,7 +29,7 @@ from Logger import StringTable as ST
|
||||
class InfGuidItemCommentContent():
|
||||
def __init__(self):
|
||||
#
|
||||
# ## SOMETIMES_CONSUMES ## Variable:L"MemoryTypeInformation"
|
||||
# ## SOMETIMES_CONSUMES ## Variable:L"MemoryTypeInformation"
|
||||
# TailString.
|
||||
#
|
||||
#
|
||||
@ -48,27 +48,27 @@ class InfGuidItemCommentContent():
|
||||
# TailString
|
||||
#
|
||||
self.HelpStringItem = ''
|
||||
|
||||
|
||||
def SetUsageItem(self, UsageItem):
|
||||
self.UsageItem = UsageItem
|
||||
def GetUsageItem(self):
|
||||
return self.UsageItem
|
||||
|
||||
|
||||
def SetGuidTypeItem(self, GuidTypeItem):
|
||||
self.GuidTypeItem = GuidTypeItem
|
||||
def GetGuidTypeItem(self):
|
||||
return self.GuidTypeItem
|
||||
|
||||
|
||||
def SetVariableNameItem(self, VariableNameItem):
|
||||
self.VariableNameItem = VariableNameItem
|
||||
def GetVariableNameItem(self):
|
||||
return self.VariableNameItem
|
||||
|
||||
|
||||
def SetHelpStringItem(self, HelpStringItem):
|
||||
self.HelpStringItem = HelpStringItem
|
||||
def GetHelpStringItem(self):
|
||||
return self.HelpStringItem
|
||||
|
||||
|
||||
class InfGuidItem():
|
||||
def __init__(self):
|
||||
self.Name = ''
|
||||
@ -78,22 +78,22 @@ class InfGuidItem():
|
||||
#
|
||||
self.CommentList = []
|
||||
self.SupArchList = []
|
||||
|
||||
|
||||
def SetName(self, Name):
|
||||
self.Name = Name
|
||||
def GetName(self):
|
||||
return self.Name
|
||||
|
||||
|
||||
def SetFeatureFlagExp(self, FeatureFlagExp):
|
||||
self.FeatureFlagExp = FeatureFlagExp
|
||||
def GetFeatureFlagExp(self):
|
||||
return self.FeatureFlagExp
|
||||
|
||||
|
||||
def SetCommentList(self, CommentList):
|
||||
self.CommentList = CommentList
|
||||
def GetCommentList(self):
|
||||
return self.CommentList
|
||||
|
||||
|
||||
def SetSupArchList(self, SupArchList):
|
||||
self.SupArchList = SupArchList
|
||||
def GetSupArchList(self):
|
||||
@ -120,17 +120,17 @@ def ParseGuidComment(CommentsList, InfGuidItemObj):
|
||||
CommentItemGuidType, \
|
||||
CommentItemVarString, \
|
||||
CommentItemHelpText = \
|
||||
ParseComment(CommentItem,
|
||||
DT.ALL_USAGE_TOKENS,
|
||||
DT.GUID_TYPE_TOKENS,
|
||||
[],
|
||||
ParseComment(CommentItem,
|
||||
DT.ALL_USAGE_TOKENS,
|
||||
DT.GUID_TYPE_TOKENS,
|
||||
[],
|
||||
True)
|
||||
|
||||
|
||||
if CommentItemHelpText is None:
|
||||
CommentItemHelpText = ''
|
||||
if Count == len(CommentsList) and CommentItemUsage == CommentItemGuidType == DT.ITEM_UNDEFINED:
|
||||
CommentItemHelpText = DT.END_OF_LINE
|
||||
|
||||
|
||||
if Count == len(CommentsList):
|
||||
if BlockFlag == 1 or BlockFlag == 2:
|
||||
if CommentItemUsage == CommentItemGuidType == DT.ITEM_UNDEFINED:
|
||||
@ -138,7 +138,7 @@ def ParseGuidComment(CommentsList, InfGuidItemObj):
|
||||
else:
|
||||
BlockFlag = 3
|
||||
if BlockFlag == -1:
|
||||
BlockFlag = 4
|
||||
BlockFlag = 4
|
||||
if BlockFlag == -1 or BlockFlag == 1 or BlockFlag == 2:
|
||||
if CommentItemUsage == CommentItemGuidType == DT.ITEM_UNDEFINED:
|
||||
if BlockFlag == -1:
|
||||
@ -150,15 +150,15 @@ def ParseGuidComment(CommentsList, InfGuidItemObj):
|
||||
BlockFlag = 3
|
||||
elif BlockFlag == -1:
|
||||
BlockFlag = 4
|
||||
|
||||
|
||||
#
|
||||
# Combine two comment line if they are generic comment
|
||||
#
|
||||
#
|
||||
if CommentItemUsage == CommentItemGuidType == PreUsage == PreGuidType == DT.ITEM_UNDEFINED:
|
||||
CommentItemHelpText = PreHelpText + DT.END_OF_LINE + CommentItemHelpText
|
||||
PreHelpText = CommentItemHelpText
|
||||
|
||||
if BlockFlag == 4:
|
||||
|
||||
if BlockFlag == 4:
|
||||
CommentItemIns = InfGuidItemCommentContent()
|
||||
CommentItemIns.SetUsageItem(CommentItemUsage)
|
||||
CommentItemIns.SetGuidTypeItem(CommentItemGuidType)
|
||||
@ -167,16 +167,16 @@ def ParseGuidComment(CommentsList, InfGuidItemObj):
|
||||
CommentItemHelpText = CommentItemHelpText.strip(DT.END_OF_LINE)
|
||||
CommentItemIns.SetHelpStringItem(CommentItemHelpText)
|
||||
CommentInsList.append(CommentItemIns)
|
||||
|
||||
|
||||
BlockFlag = -1
|
||||
PreUsage = None
|
||||
PreGuidType = None
|
||||
PreHelpText = ''
|
||||
|
||||
|
||||
elif BlockFlag == 3:
|
||||
#
|
||||
# Add previous help string
|
||||
#
|
||||
#
|
||||
CommentItemIns = InfGuidItemCommentContent()
|
||||
CommentItemIns.SetUsageItem(DT.ITEM_UNDEFINED)
|
||||
CommentItemIns.SetGuidTypeItem(DT.ITEM_UNDEFINED)
|
||||
@ -195,17 +195,17 @@ def ParseGuidComment(CommentsList, InfGuidItemObj):
|
||||
CommentItemHelpText = CommentItemHelpText.strip(DT.END_OF_LINE)
|
||||
CommentItemIns.SetHelpStringItem(CommentItemHelpText)
|
||||
CommentInsList.append(CommentItemIns)
|
||||
|
||||
|
||||
BlockFlag = -1
|
||||
PreUsage = None
|
||||
PreGuidType = None
|
||||
PreHelpText = ''
|
||||
|
||||
PreHelpText = ''
|
||||
|
||||
else:
|
||||
PreUsage = CommentItemUsage
|
||||
PreGuidType = CommentItemGuidType
|
||||
PreHelpText = CommentItemHelpText
|
||||
|
||||
|
||||
InfGuidItemObj.SetCommentList(CommentInsList)
|
||||
else:
|
||||
#
|
||||
@ -215,7 +215,7 @@ def ParseGuidComment(CommentsList, InfGuidItemObj):
|
||||
CommentItemIns.SetUsageItem(DT.ITEM_UNDEFINED)
|
||||
CommentItemIns.SetGuidTypeItem(DT.ITEM_UNDEFINED)
|
||||
InfGuidItemObj.SetCommentList([CommentItemIns])
|
||||
|
||||
|
||||
return InfGuidItemObj
|
||||
|
||||
## InfGuidObject
|
||||
@ -229,18 +229,18 @@ class InfGuidObject():
|
||||
# Macro defined in this section should be only used in this section.
|
||||
#
|
||||
self.Macros = {}
|
||||
|
||||
|
||||
def SetGuid(self, GuidList, Arch = None):
|
||||
__SupportArchList = []
|
||||
for ArchItem in Arch:
|
||||
#
|
||||
# Validate Arch
|
||||
#
|
||||
#
|
||||
if (ArchItem == '' or ArchItem is None):
|
||||
ArchItem = 'COMMON'
|
||||
|
||||
ArchItem = 'COMMON'
|
||||
|
||||
__SupportArchList.append(ArchItem)
|
||||
|
||||
|
||||
for Item in GuidList:
|
||||
#
|
||||
# Get Comment content of this protocol
|
||||
@ -250,77 +250,77 @@ class InfGuidObject():
|
||||
CommentsList = Item[1]
|
||||
CurrentLineOfItem = Item[2]
|
||||
Item = Item[0]
|
||||
InfGuidItemObj = InfGuidItem()
|
||||
InfGuidItemObj = InfGuidItem()
|
||||
if len(Item) >= 1 and len(Item) <= 2:
|
||||
#
|
||||
# Only GuildName contained
|
||||
#
|
||||
if not IsValidCVariableName(Item[0]):
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_INVALID_CNAME%(Item[0]),
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
if (Item[0] != ''):
|
||||
InfGuidItemObj.SetName(Item[0])
|
||||
else:
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_CNAME_MISSING,
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
if len(Item) == 2:
|
||||
#
|
||||
# Contained CName and Feature Flag Express
|
||||
# <statements> ::= <CName> ["|" <FeatureFlagExpress>]
|
||||
# For GUID entry.
|
||||
# For GUID entry.
|
||||
#
|
||||
if Item[1].strip() == '':
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
#
|
||||
# Validate Feature Flag Express
|
||||
# Validate Feature Flag Express
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(Item[1].strip())
|
||||
if not FeatureFlagRtv[0]:
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
InfGuidItemObj.SetFeatureFlagExp(Item[1])
|
||||
if len(Item) != 1 and len(Item) != 2:
|
||||
#
|
||||
# Invalid format of GUID statement
|
||||
# Invalid format of GUID statement
|
||||
#
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_GUID_PPI_PROTOCOL_SECTION_CONTENT_ERROR,
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
|
||||
|
||||
InfGuidItemObj = ParseGuidComment(CommentsList, InfGuidItemObj)
|
||||
InfGuidItemObj.SetSupArchList(__SupportArchList)
|
||||
|
||||
|
||||
#
|
||||
# Determine GUID name duplicate. Follow below rule:
|
||||
#
|
||||
# A GUID must not be duplicated within a [Guids] section.
|
||||
# A GUID may appear in multiple architectural [Guids]
|
||||
# sections. A GUID listed in an architectural [Guids]
|
||||
# section must not be listed in the common architectural
|
||||
# A GUID must not be duplicated within a [Guids] section.
|
||||
# A GUID may appear in multiple architectural [Guids]
|
||||
# sections. A GUID listed in an architectural [Guids]
|
||||
# section must not be listed in the common architectural
|
||||
# [Guids] section.
|
||||
#
|
||||
#
|
||||
# NOTE: This check will not report error now.
|
||||
#
|
||||
#
|
||||
for Item in self.Guids:
|
||||
if Item.GetName() == InfGuidItemObj.GetName():
|
||||
ItemSupArchList = Item.GetSupArchList()
|
||||
@ -337,17 +337,17 @@ class InfGuidObject():
|
||||
# ST.ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
|
||||
#
|
||||
pass
|
||||
|
||||
|
||||
if (InfGuidItemObj) in self.Guids:
|
||||
GuidList = self.Guids[InfGuidItemObj]
|
||||
GuidList = self.Guids[InfGuidItemObj]
|
||||
GuidList.append(InfGuidItemObj)
|
||||
self.Guids[InfGuidItemObj] = GuidList
|
||||
else:
|
||||
GuidList = []
|
||||
GuidList.append(InfGuidItemObj)
|
||||
self.Guids[InfGuidItemObj] = GuidList
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def GetGuid(self):
|
||||
return self.Guids
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of INF file header.
|
||||
# It will consumed by InfParser.
|
||||
# This file is used to define class objects of INF file header.
|
||||
# It will consumed by InfParser.
|
||||
#
|
||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -17,16 +17,16 @@ InfHeaderObject
|
||||
'''
|
||||
|
||||
## INF file header object
|
||||
#
|
||||
#
|
||||
# A sample file header
|
||||
#
|
||||
# ## @file xxx.inf FileName
|
||||
# # Abstract
|
||||
# #
|
||||
# #
|
||||
# # Description
|
||||
# #
|
||||
# # Copyright
|
||||
# #
|
||||
# #
|
||||
# # License
|
||||
# #
|
||||
#
|
||||
@ -41,7 +41,7 @@ class InfHeaderObject():
|
||||
## SetFileName
|
||||
#
|
||||
# @param FileName: File Name
|
||||
#
|
||||
#
|
||||
def SetFileName(self, FileName):
|
||||
if not (FileName == '' or FileName is None):
|
||||
self.FileName = FileName
|
||||
@ -50,14 +50,14 @@ class InfHeaderObject():
|
||||
return False
|
||||
|
||||
## GetFileName
|
||||
#
|
||||
#
|
||||
def GetFileName(self):
|
||||
return self.FileName
|
||||
|
||||
## SetAbstract
|
||||
#
|
||||
#
|
||||
# @param Abstract: Abstract
|
||||
#
|
||||
#
|
||||
def SetAbstract(self, Abstract):
|
||||
if not (Abstract == '' or Abstract is None):
|
||||
self.Abstract = Abstract
|
||||
@ -66,14 +66,14 @@ class InfHeaderObject():
|
||||
return False
|
||||
|
||||
## GetAbstract
|
||||
#
|
||||
#
|
||||
def GetAbstract(self):
|
||||
return self.Abstract
|
||||
return self.Abstract
|
||||
|
||||
## SetDescription
|
||||
#
|
||||
# @param Description: Description content
|
||||
#
|
||||
#
|
||||
# @param Description: Description content
|
||||
#
|
||||
def SetDescription(self, Description):
|
||||
if not (Description == '' or Description is None):
|
||||
self.Description = Description
|
||||
@ -82,14 +82,14 @@ class InfHeaderObject():
|
||||
return False
|
||||
|
||||
## GetAbstract
|
||||
#
|
||||
#
|
||||
def GetDescription(self):
|
||||
return self.Description
|
||||
return self.Description
|
||||
|
||||
## SetCopyright
|
||||
#
|
||||
# @param Copyright: Copyright content
|
||||
#
|
||||
#
|
||||
# @param Copyright: Copyright content
|
||||
#
|
||||
def SetCopyright(self, Copyright):
|
||||
if not (Copyright == '' or Copyright is None):
|
||||
self.Copyright = Copyright
|
||||
@ -98,14 +98,14 @@ class InfHeaderObject():
|
||||
return False
|
||||
|
||||
## GetCopyright
|
||||
#
|
||||
#
|
||||
def GetCopyright(self):
|
||||
return self.Copyright
|
||||
return self.Copyright
|
||||
|
||||
## SetCopyright
|
||||
#
|
||||
# @param License: License content
|
||||
#
|
||||
#
|
||||
# @param License: License content
|
||||
#
|
||||
def SetLicense(self, License):
|
||||
if not (License == '' or License is None):
|
||||
self.License = License
|
||||
@ -114,6 +114,6 @@ class InfHeaderObject():
|
||||
return False
|
||||
|
||||
## GetLicense
|
||||
#
|
||||
#
|
||||
def GetLicense(self):
|
||||
return self.License
|
||||
return self.License
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of INF file [LibraryClasses] section.
|
||||
# It will consumed by InfParser.
|
||||
# This file is used to define class objects of INF file [LibraryClasses] section.
|
||||
# It will consumed by InfParser.
|
||||
#
|
||||
# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -37,7 +37,7 @@ def GetArchModuleType(KeyList):
|
||||
for (ArchItem, ModuleItem) in KeyList:
|
||||
#
|
||||
# Validate Arch
|
||||
#
|
||||
#
|
||||
if (ArchItem == '' or ArchItem is None):
|
||||
ArchItem = 'COMMON'
|
||||
|
||||
@ -118,7 +118,7 @@ class InfLibraryClassObject():
|
||||
|
||||
##SetLibraryClasses
|
||||
#
|
||||
#
|
||||
#
|
||||
# @param HelpString: It can be a common comment or contain a recommend
|
||||
# instance.
|
||||
#
|
||||
@ -173,7 +173,7 @@ class InfLibraryClassObject():
|
||||
Line=LibItemObj.CurrentLine.GetLineNo(),
|
||||
ExtraData=LibItemObj.CurrentLine.GetLineString())
|
||||
#
|
||||
# Validate FFE
|
||||
# Validate FFE
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(LibItem[1].strip())
|
||||
if not FeatureFlagRtv[0]:
|
||||
@ -202,15 +202,15 @@ class InfLibraryClassObject():
|
||||
#
|
||||
# Determine Library class duplicate. Follow below rule:
|
||||
#
|
||||
# A library class keyword must not be duplicated within a
|
||||
# [LibraryClasses] section. Library class keywords may appear in
|
||||
# multiple architectural and module type [LibraryClasses] sections.
|
||||
# A library class keyword listed in an architectural or module type
|
||||
# [LibraryClasses] section must not be listed in the common
|
||||
# A library class keyword must not be duplicated within a
|
||||
# [LibraryClasses] section. Library class keywords may appear in
|
||||
# multiple architectural and module type [LibraryClasses] sections.
|
||||
# A library class keyword listed in an architectural or module type
|
||||
# [LibraryClasses] section must not be listed in the common
|
||||
# architectural or module type [LibraryClasses] section.
|
||||
#
|
||||
#
|
||||
# NOTE: This check will not report error now. But keep code for future enhancement.
|
||||
#
|
||||
#
|
||||
# for Item in self.LibraryClasses:
|
||||
# if Item.GetLibName() == LibItemObj.GetLibName():
|
||||
# ItemSupArchList = Item.GetSupArchList()
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of INF file miscellaneous.
|
||||
# Include BootMode/HOB/Event and others. It will consumed by InfParser.
|
||||
# This file is used to define class objects of INF file miscellaneous.
|
||||
# Include BootMode/HOB/Event and others. It will consumed by InfParser.
|
||||
#
|
||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -23,7 +23,7 @@ from Library import DataType as DT
|
||||
from Object.Parser.InfCommonObject import InfSectionCommonDef
|
||||
from Library.Misc import Sdict
|
||||
|
||||
##
|
||||
##
|
||||
# BootModeObject
|
||||
#
|
||||
class InfBootModeObject():
|
||||
@ -31,16 +31,16 @@ class InfBootModeObject():
|
||||
self.SupportedBootModes = ''
|
||||
self.HelpString = ''
|
||||
self.Usage = ''
|
||||
|
||||
|
||||
def SetSupportedBootModes(self, SupportedBootModes):
|
||||
self.SupportedBootModes = SupportedBootModes
|
||||
self.SupportedBootModes = SupportedBootModes
|
||||
def GetSupportedBootModes(self):
|
||||
return self.SupportedBootModes
|
||||
|
||||
def SetHelpString(self, HelpString):
|
||||
self.HelpString = HelpString
|
||||
def GetHelpString(self):
|
||||
return self.HelpString
|
||||
return self.HelpString
|
||||
|
||||
def SetUsage(self, Usage):
|
||||
self.Usage = Usage
|
||||
@ -54,18 +54,18 @@ class InfEventObject():
|
||||
self.EventType = ''
|
||||
self.HelpString = ''
|
||||
self.Usage = ''
|
||||
|
||||
|
||||
def SetEventType(self, EventType):
|
||||
self.EventType = EventType
|
||||
|
||||
|
||||
def GetEventType(self):
|
||||
return self.EventType
|
||||
|
||||
|
||||
def SetHelpString(self, HelpString):
|
||||
self.HelpString = HelpString
|
||||
def GetHelpString(self):
|
||||
return self.HelpString
|
||||
|
||||
return self.HelpString
|
||||
|
||||
def SetUsage(self, Usage):
|
||||
self.Usage = Usage
|
||||
def GetUsage(self):
|
||||
@ -79,36 +79,36 @@ class InfHobObject():
|
||||
self.Usage = ''
|
||||
self.SupArchList = []
|
||||
self.HelpString = ''
|
||||
|
||||
|
||||
def SetHobType(self, HobType):
|
||||
self.HobType = HobType
|
||||
|
||||
|
||||
def GetHobType(self):
|
||||
return self.HobType
|
||||
|
||||
|
||||
def SetUsage(self, Usage):
|
||||
self.Usage = Usage
|
||||
def GetUsage(self):
|
||||
return self.Usage
|
||||
|
||||
|
||||
def SetSupArchList(self, ArchList):
|
||||
self.SupArchList = ArchList
|
||||
def GetSupArchList(self):
|
||||
return self.SupArchList
|
||||
|
||||
|
||||
def SetHelpString(self, HelpString):
|
||||
self.HelpString = HelpString
|
||||
def GetHelpString(self):
|
||||
return self.HelpString
|
||||
|
||||
|
||||
##
|
||||
# InfSpecialCommentObject
|
||||
#
|
||||
#
|
||||
class InfSpecialCommentObject(InfSectionCommonDef):
|
||||
def __init__(self):
|
||||
self.SpecialComments = Sdict()
|
||||
InfSectionCommonDef.__init__(self)
|
||||
|
||||
|
||||
def SetSpecialComments(self, SepcialSectionList = None, Type = ''):
|
||||
if Type == DT.TYPE_HOB_SECTION or \
|
||||
Type == DT.TYPE_EVENT_SECTION or \
|
||||
@ -122,27 +122,27 @@ class InfSpecialCommentObject(InfSectionCommonDef):
|
||||
ObjList = []
|
||||
ObjList.append(Item)
|
||||
self.SpecialComments[Type] = ObjList
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def GetSpecialComments(self):
|
||||
return self.SpecialComments
|
||||
|
||||
|
||||
|
||||
## ErrorInInf
|
||||
#
|
||||
#
|
||||
# An encapsulate of Error for INF parser.
|
||||
#
|
||||
#
|
||||
def ErrorInInf(Message=None, ErrorCode=None, LineInfo=None, RaiseError=True):
|
||||
if ErrorCode is None:
|
||||
ErrorCode = ToolError.FORMAT_INVALID
|
||||
if LineInfo is None:
|
||||
LineInfo = ['', -1, '']
|
||||
Logger.Error("InfParser",
|
||||
ErrorCode,
|
||||
Message=Message,
|
||||
File=LineInfo[0],
|
||||
Logger.Error("InfParser",
|
||||
ErrorCode,
|
||||
Message=Message,
|
||||
File=LineInfo[0],
|
||||
Line=LineInfo[1],
|
||||
ExtraData=LineInfo[2],
|
||||
ExtraData=LineInfo[2],
|
||||
RaiseError=RaiseError)
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of INF file [Packages] section.
|
||||
# It will consumed by InfParser.
|
||||
# This file is used to define class objects of INF file [Packages] section.
|
||||
# It will consumed by InfParser.
|
||||
#
|
||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -19,14 +19,14 @@ InfPackageObject
|
||||
from Logger import StringTable as ST
|
||||
from Logger import ToolError
|
||||
import Logger.Log as Logger
|
||||
from Library import GlobalData
|
||||
from Library import GlobalData
|
||||
|
||||
from Library.Misc import Sdict
|
||||
from Library.ParserValidate import IsValidPath
|
||||
from Library.ExpressionValidate import IsValidFeatureFlagExp
|
||||
from Library.ExpressionValidate import IsValidFeatureFlagExp
|
||||
|
||||
class InfPackageItem():
|
||||
def __init__(self,
|
||||
def __init__(self,
|
||||
PackageName = '',
|
||||
FeatureFlagExp = '',
|
||||
HelpString = ''):
|
||||
@ -34,28 +34,28 @@ class InfPackageItem():
|
||||
self.FeatureFlagExp = FeatureFlagExp
|
||||
self.HelpString = HelpString
|
||||
self.SupArchList = []
|
||||
|
||||
|
||||
def SetPackageName(self, PackageName):
|
||||
self.PackageName = PackageName
|
||||
def GetPackageName(self):
|
||||
return self.PackageName
|
||||
|
||||
|
||||
def SetFeatureFlagExp(self, FeatureFlagExp):
|
||||
self.FeatureFlagExp = FeatureFlagExp
|
||||
def GetFeatureFlagExp(self):
|
||||
return self.FeatureFlagExp
|
||||
|
||||
|
||||
def SetHelpString(self, HelpString):
|
||||
self.HelpString = HelpString
|
||||
def GetHelpString(self):
|
||||
return self.HelpString
|
||||
|
||||
|
||||
def SetSupArchList(self, SupArchList):
|
||||
self.SupArchList = SupArchList
|
||||
def GetSupArchList(self):
|
||||
return self.SupArchList
|
||||
|
||||
|
||||
|
||||
## INF package section
|
||||
#
|
||||
#
|
||||
@ -67,18 +67,18 @@ class InfPackageObject():
|
||||
# Macro defined in this section should be only used in this section.
|
||||
#
|
||||
self.Macros = {}
|
||||
|
||||
|
||||
def SetPackages(self, PackageData, Arch = None):
|
||||
IsValidFileFlag = False
|
||||
SupArchList = []
|
||||
for ArchItem in Arch:
|
||||
#
|
||||
# Validate Arch
|
||||
#
|
||||
#
|
||||
if (ArchItem == '' or ArchItem is None):
|
||||
ArchItem = 'COMMON'
|
||||
SupArchList.append(ArchItem)
|
||||
|
||||
SupArchList.append(ArchItem)
|
||||
|
||||
for PackageItem in PackageData:
|
||||
PackageItemObj = InfPackageItem()
|
||||
HelpStringObj = PackageItem[1]
|
||||
@ -86,7 +86,7 @@ class InfPackageObject():
|
||||
PackageItem = PackageItem[0]
|
||||
if HelpStringObj is not None:
|
||||
HelpString = HelpStringObj.HeaderComments + HelpStringObj.TailComments
|
||||
PackageItemObj.SetHelpString(HelpString)
|
||||
PackageItemObj.SetHelpString(HelpString)
|
||||
if len(PackageItem) >= 1:
|
||||
#
|
||||
# Validate file exist/format.
|
||||
@ -94,67 +94,67 @@ class InfPackageObject():
|
||||
if IsValidPath(PackageItem[0], ''):
|
||||
IsValidFileFlag = True
|
||||
elif IsValidPath(PackageItem[0], GlobalData.gINF_MODULE_DIR):
|
||||
IsValidFileFlag = True
|
||||
IsValidFileFlag = True
|
||||
elif IsValidPath(PackageItem[0], GlobalData.gWORKSPACE):
|
||||
IsValidFileFlag = True
|
||||
else:
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(PackageItem[0]),
|
||||
File=CurrentLineOfPackItem[2],
|
||||
Line=CurrentLineOfPackItem[1],
|
||||
File=CurrentLineOfPackItem[2],
|
||||
Line=CurrentLineOfPackItem[1],
|
||||
ExtraData=CurrentLineOfPackItem[0])
|
||||
return False
|
||||
if IsValidFileFlag:
|
||||
if IsValidFileFlag:
|
||||
PackageItemObj.SetPackageName(PackageItem[0])
|
||||
if len(PackageItem) == 2:
|
||||
#
|
||||
# Validate Feature Flag Express
|
||||
#
|
||||
if PackageItem[1].strip() == '':
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
|
||||
File=CurrentLineOfPackItem[2],
|
||||
Line=CurrentLineOfPackItem[1],
|
||||
File=CurrentLineOfPackItem[2],
|
||||
Line=CurrentLineOfPackItem[1],
|
||||
ExtraData=CurrentLineOfPackItem[0])
|
||||
#
|
||||
# Validate FFE
|
||||
# Validate FFE
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(PackageItem[1].strip())
|
||||
if not FeatureFlagRtv[0]:
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
|
||||
File=CurrentLineOfPackItem[2],
|
||||
Line=CurrentLineOfPackItem[1],
|
||||
File=CurrentLineOfPackItem[2],
|
||||
Line=CurrentLineOfPackItem[1],
|
||||
ExtraData=CurrentLineOfPackItem[0])
|
||||
|
||||
|
||||
PackageItemObj.SetFeatureFlagExp(PackageItem[1].strip())
|
||||
|
||||
|
||||
if len(PackageItem) > 2:
|
||||
#
|
||||
# Invalid format of Package statement
|
||||
# Invalid format of Package statement
|
||||
#
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_PACKAGE_SECTION_CONTENT_ERROR,
|
||||
File=CurrentLineOfPackItem[2],
|
||||
Line=CurrentLineOfPackItem[1],
|
||||
File=CurrentLineOfPackItem[2],
|
||||
Line=CurrentLineOfPackItem[1],
|
||||
ExtraData=CurrentLineOfPackItem[0])
|
||||
PackageItemObj.SetSupArchList(SupArchList)
|
||||
|
||||
|
||||
#
|
||||
# Determine package file name duplicate. Follow below rule:
|
||||
#
|
||||
# A package filename must not be duplicated within a [Packages]
|
||||
# section. Package filenames may appear in multiple architectural
|
||||
# [Packages] sections. A package filename listed in an
|
||||
# A package filename must not be duplicated within a [Packages]
|
||||
# section. Package filenames may appear in multiple architectural
|
||||
# [Packages] sections. A package filename listed in an
|
||||
# architectural [Packages] section must not be listed in the common
|
||||
# architectural [Packages] section.
|
||||
#
|
||||
#
|
||||
# NOTE: This check will not report error now.
|
||||
#
|
||||
#
|
||||
for Item in self.Packages:
|
||||
if Item.GetPackageName() == PackageItemObj.GetPackageName():
|
||||
ItemSupArchList = Item.GetSupArchList()
|
||||
@ -170,7 +170,7 @@ class InfPackageObject():
|
||||
# ST.ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
|
||||
#
|
||||
pass
|
||||
|
||||
|
||||
if (PackageItemObj) in self.Packages:
|
||||
PackageList = self.Packages[PackageItemObj]
|
||||
PackageList.append(PackageItemObj)
|
||||
@ -179,9 +179,9 @@ class InfPackageObject():
|
||||
PackageList = []
|
||||
PackageList.append(PackageItemObj)
|
||||
self.Packages[PackageItemObj] = PackageList
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def GetPackages(self, Arch = None):
|
||||
if Arch is None:
|
||||
return self.Packages
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of INF file [Pcds] section.
|
||||
# It will consumed by InfParser.
|
||||
# This file is used to define class objects of INF file [Pcds] section.
|
||||
# It will consumed by InfParser.
|
||||
#
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -42,7 +42,7 @@ from Object.Parser.InfPackagesObject import InfPackageItem
|
||||
def ValidateArch(ArchItem, PcdTypeItem1, LineNo, SupArchDict, SupArchList):
|
||||
#
|
||||
# Validate Arch
|
||||
#
|
||||
#
|
||||
if (ArchItem == '' or ArchItem is None):
|
||||
ArchItem = 'COMMON'
|
||||
|
||||
@ -122,7 +122,7 @@ def ParsePcdComment(CommentList, PcdTypeItem, PcdItemObj):
|
||||
BlockFlag = 4
|
||||
#
|
||||
# Combine two comment line if they are generic comment
|
||||
#
|
||||
#
|
||||
if CommentItemUsage == PreUsage == DT.ITEM_UNDEFINED:
|
||||
CommentItemHelpText = PreHelpText + DT.END_OF_LINE + CommentItemHelpText
|
||||
|
||||
@ -141,7 +141,7 @@ def ParsePcdComment(CommentList, PcdTypeItem, PcdItemObj):
|
||||
elif BlockFlag == 3:
|
||||
#
|
||||
# Add previous help string
|
||||
#
|
||||
#
|
||||
CommentItemIns = InfPcdItemCommentContent()
|
||||
CommentItemIns.SetUsageItem(DT.ITEM_UNDEFINED)
|
||||
if PreHelpText == '' or PreHelpText.endswith(DT.END_OF_LINE):
|
||||
@ -171,7 +171,7 @@ def ParsePcdComment(CommentList, PcdTypeItem, PcdItemObj):
|
||||
class InfPcdItemCommentContent():
|
||||
def __init__(self):
|
||||
#
|
||||
# ## SOMETIMES_CONSUMES ## HelpString
|
||||
# ## SOMETIMES_CONSUMES ## HelpString
|
||||
#
|
||||
self.UsageItem = ''
|
||||
#
|
||||
@ -195,7 +195,7 @@ class InfPcdItemCommentContent():
|
||||
#
|
||||
# @param CName: Input value for CName, default is ''
|
||||
# @param Token: Input value for Token, default is ''
|
||||
# @param TokenSpaceGuidCName: Input value for TokenSpaceGuidCName, default
|
||||
# @param TokenSpaceGuidCName: Input value for TokenSpaceGuidCName, default
|
||||
# is ''
|
||||
# @param DatumType: Input value for DatumType, default is ''
|
||||
# @param MaxDatumSize: Input value for MaxDatumSize, default is ''
|
||||
@ -385,7 +385,7 @@ class InfPcdObject():
|
||||
Line=CurrentLineOfPcdItem[1],
|
||||
ExtraData=CurrentLineOfPcdItem[0])
|
||||
#
|
||||
# Validate FFE
|
||||
# Validate FFE
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(PcdItem[2].strip())
|
||||
if not FeatureFlagRtv[0]:
|
||||
@ -478,7 +478,7 @@ def ParserPcdInfoInDec(String):
|
||||
|
||||
def SetValueDatumTypeMaxSizeToken(PcdItem, CurrentLineOfPcdItem, PcdItemObj, Arch, PackageInfo=None):
|
||||
#
|
||||
# Package information not been generated currently, we need to parser INF file to get information.
|
||||
# Package information not been generated currently, we need to parser INF file to get information.
|
||||
#
|
||||
if not PackageInfo:
|
||||
PackageInfo = []
|
||||
@ -507,7 +507,7 @@ def SetValueDatumTypeMaxSizeToken(PcdItem, CurrentLineOfPcdItem, PcdItemObj, Arc
|
||||
DecParser = GlobalData.gPackageDict[FullFileName]
|
||||
|
||||
#
|
||||
# Find PCD information.
|
||||
# Find PCD information.
|
||||
#
|
||||
DecPcdsDict = DecParser.GetPcdSectionObject().ValueDict
|
||||
for Key in DecPcdsDict.keys():
|
||||
@ -640,7 +640,7 @@ def ValidatePcdValueOnDatumType(Value, Type):
|
||||
|
||||
def SetPcdName(PcdItem, CurrentLineOfPcdItem, PcdItemObj):
|
||||
#
|
||||
# Only PCD Name specified
|
||||
# Only PCD Name specified
|
||||
# <PcdName> ::= <TokenSpaceGuidCName> "." <TokenCName>
|
||||
#
|
||||
PcdId = GetSplitValueList(PcdItem[0], DT.TAB_SPLIT)
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of INF file [Ppis] section.
|
||||
# It will consumed by InfParser.
|
||||
# This file is used to define class objects of INF file [Ppis] section.
|
||||
# It will consumed by InfParser.
|
||||
#
|
||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -18,17 +18,17 @@ InfPpiObject
|
||||
|
||||
from Library.ParserValidate import IsValidCVariableName
|
||||
from Library.CommentParsing import ParseComment
|
||||
from Library.ExpressionValidate import IsValidFeatureFlagExp
|
||||
|
||||
from Library.ExpressionValidate import IsValidFeatureFlagExp
|
||||
|
||||
from Library.Misc import Sdict
|
||||
from Library import DataType as DT
|
||||
from Library import DataType as DT
|
||||
import Logger.Log as Logger
|
||||
from Logger import ToolError
|
||||
from Logger import StringTable as ST
|
||||
|
||||
def ParsePpiComment(CommentsList, InfPpiItemObj):
|
||||
PreNotify = None
|
||||
PreUsage = None
|
||||
PreUsage = None
|
||||
PreHelpText = ''
|
||||
BlockFlag = -1
|
||||
CommentInsList = []
|
||||
@ -39,22 +39,22 @@ def ParsePpiComment(CommentsList, InfPpiItemObj):
|
||||
CommentItemNotify, \
|
||||
CommentItemString, \
|
||||
CommentItemHelpText = \
|
||||
ParseComment(CommentItem,
|
||||
DT.ALL_USAGE_TOKENS,
|
||||
DT.PPI_NOTIFY_TOKENS,
|
||||
['PPI'],
|
||||
ParseComment(CommentItem,
|
||||
DT.ALL_USAGE_TOKENS,
|
||||
DT.PPI_NOTIFY_TOKENS,
|
||||
['PPI'],
|
||||
False)
|
||||
|
||||
|
||||
#
|
||||
# To avoid PyLint error
|
||||
# To avoid PyLint error
|
||||
#
|
||||
if CommentItemString:
|
||||
pass
|
||||
|
||||
|
||||
if CommentItemHelpText is None:
|
||||
CommentItemHelpText = ''
|
||||
if Count == len(CommentsList) and CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:
|
||||
CommentItemHelpText = DT.END_OF_LINE
|
||||
CommentItemHelpText = DT.END_OF_LINE
|
||||
#
|
||||
# For the Last comment Item, set BlockFlag.
|
||||
#
|
||||
@ -65,12 +65,12 @@ def ParsePpiComment(CommentsList, InfPpiItemObj):
|
||||
else:
|
||||
BlockFlag = 3
|
||||
elif BlockFlag == -1:
|
||||
BlockFlag = 4
|
||||
|
||||
BlockFlag = 4
|
||||
|
||||
#
|
||||
# Comment USAGE and NOTIFY information are "UNDEFINED"
|
||||
#
|
||||
if BlockFlag == -1 or BlockFlag == 1 or BlockFlag == 2:
|
||||
if BlockFlag == -1 or BlockFlag == 1 or BlockFlag == 2:
|
||||
if CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:
|
||||
if BlockFlag == -1:
|
||||
BlockFlag = 1
|
||||
@ -81,41 +81,41 @@ def ParsePpiComment(CommentsList, InfPpiItemObj):
|
||||
BlockFlag = 3
|
||||
#
|
||||
# An item have Usage or Notify information and the first time get this information
|
||||
#
|
||||
#
|
||||
elif BlockFlag == -1:
|
||||
BlockFlag = 4
|
||||
|
||||
|
||||
#
|
||||
# Combine two comment line if they are generic comment
|
||||
#
|
||||
#
|
||||
if CommentItemUsage == CommentItemNotify == PreUsage == PreNotify == DT.ITEM_UNDEFINED:
|
||||
CommentItemHelpText = PreHelpText + DT.END_OF_LINE + CommentItemHelpText
|
||||
#
|
||||
# Store this information for next line may still need combine operation.
|
||||
#
|
||||
PreHelpText = CommentItemHelpText
|
||||
|
||||
if BlockFlag == 4:
|
||||
|
||||
if BlockFlag == 4:
|
||||
CommentItemIns = InfPpiItemCommentContent()
|
||||
CommentItemIns.SetUsage(CommentItemUsage)
|
||||
CommentItemIns.SetNotify(CommentItemNotify)
|
||||
CommentItemIns.SetHelpStringItem(CommentItemHelpText)
|
||||
CommentInsList.append(CommentItemIns)
|
||||
|
||||
|
||||
BlockFlag = -1
|
||||
PreUsage = None
|
||||
PreNotify = None
|
||||
PreHelpText = ''
|
||||
|
||||
|
||||
elif BlockFlag == 3:
|
||||
#
|
||||
# Add previous help string
|
||||
#
|
||||
#
|
||||
CommentItemIns = InfPpiItemCommentContent()
|
||||
CommentItemIns.SetUsage(DT.ITEM_UNDEFINED)
|
||||
CommentItemIns.SetNotify(DT.ITEM_UNDEFINED)
|
||||
if PreHelpText == '' or PreHelpText.endswith(DT.END_OF_LINE):
|
||||
PreHelpText += DT.END_OF_LINE
|
||||
PreHelpText += DT.END_OF_LINE
|
||||
CommentItemIns.SetHelpStringItem(PreHelpText)
|
||||
CommentInsList.append(CommentItemIns)
|
||||
#
|
||||
@ -126,7 +126,7 @@ def ParsePpiComment(CommentsList, InfPpiItemObj):
|
||||
CommentItemIns.SetNotify(CommentItemNotify)
|
||||
CommentItemIns.SetHelpStringItem(CommentItemHelpText)
|
||||
CommentInsList.append(CommentItemIns)
|
||||
|
||||
|
||||
BlockFlag = -1
|
||||
PreUsage = None
|
||||
PreNotify = None
|
||||
@ -135,15 +135,15 @@ def ParsePpiComment(CommentsList, InfPpiItemObj):
|
||||
PreUsage = CommentItemUsage
|
||||
PreNotify = CommentItemNotify
|
||||
PreHelpText = CommentItemHelpText
|
||||
|
||||
|
||||
InfPpiItemObj.SetCommentList(CommentInsList)
|
||||
|
||||
|
||||
return InfPpiItemObj
|
||||
|
||||
class InfPpiItemCommentContent():
|
||||
def __init__(self):
|
||||
#
|
||||
# ## SOMETIMES_CONSUMES ## HelpString
|
||||
# ## SOMETIMES_CONSUMES ## HelpString
|
||||
#
|
||||
self.UsageItem = ''
|
||||
#
|
||||
@ -152,30 +152,30 @@ class InfPpiItemCommentContent():
|
||||
self.HelpStringItem = ''
|
||||
self.Notify = ''
|
||||
self.CommentList = []
|
||||
|
||||
|
||||
def SetUsage(self, UsageItem):
|
||||
self.UsageItem = UsageItem
|
||||
def GetUsage(self):
|
||||
return self.UsageItem
|
||||
|
||||
|
||||
def SetNotify(self, Notify):
|
||||
if Notify != DT.ITEM_UNDEFINED:
|
||||
self.Notify = 'true'
|
||||
def GetNotify(self):
|
||||
return self.Notify
|
||||
|
||||
|
||||
def SetHelpStringItem(self, HelpStringItem):
|
||||
self.HelpStringItem = HelpStringItem
|
||||
def GetHelpStringItem(self):
|
||||
return self.HelpStringItem
|
||||
|
||||
|
||||
class InfPpiItem():
|
||||
def __init__(self):
|
||||
self.Name = ''
|
||||
self.FeatureFlagExp = ''
|
||||
self.FeatureFlagExp = ''
|
||||
self.SupArchList = []
|
||||
self.CommentList = []
|
||||
|
||||
|
||||
def SetName(self, Name):
|
||||
self.Name = Name
|
||||
def GetName(self):
|
||||
@ -184,7 +184,7 @@ class InfPpiItem():
|
||||
def SetSupArchList(self, SupArchList):
|
||||
self.SupArchList = SupArchList
|
||||
def GetSupArchList(self):
|
||||
return self.SupArchList
|
||||
return self.SupArchList
|
||||
|
||||
def SetCommentList(self, CommentList):
|
||||
self.CommentList = CommentList
|
||||
@ -206,17 +206,17 @@ class InfPpiObject():
|
||||
# Macro defined in this section should be only used in this section.
|
||||
#
|
||||
self.Macros = {}
|
||||
|
||||
|
||||
def SetPpi(self, PpiList, Arch = None):
|
||||
__SupArchList = []
|
||||
for ArchItem in Arch:
|
||||
#
|
||||
# Validate Arch
|
||||
#
|
||||
#
|
||||
if (ArchItem == '' or ArchItem is None):
|
||||
ArchItem = 'COMMON'
|
||||
ArchItem = 'COMMON'
|
||||
__SupArchList.append(ArchItem)
|
||||
|
||||
|
||||
for Item in PpiList:
|
||||
#
|
||||
# Get Comment content of this protocol
|
||||
@ -226,26 +226,26 @@ class InfPpiObject():
|
||||
CommentsList = Item[1]
|
||||
CurrentLineOfItem = Item[2]
|
||||
Item = Item[0]
|
||||
InfPpiItemObj = InfPpiItem()
|
||||
InfPpiItemObj = InfPpiItem()
|
||||
if len(Item) >= 1 and len(Item) <= 2:
|
||||
#
|
||||
# Only CName contained
|
||||
#
|
||||
if not IsValidCVariableName(Item[0]):
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_INVALID_CNAME%(Item[0]),
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
if (Item[0] != ''):
|
||||
InfPpiItemObj.SetName(Item[0])
|
||||
else:
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_CNAME_MISSING,
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
#
|
||||
# Have FeatureFlag information
|
||||
@ -254,14 +254,14 @@ class InfPpiObject():
|
||||
#
|
||||
# Contained CName and Feature Flag Express
|
||||
# <statements> ::= <CName> ["|" <FeatureFlagExpress>]
|
||||
# Item[1] should not be empty
|
||||
# Item[1] should not be empty
|
||||
#
|
||||
if Item[1].strip() == '':
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
#
|
||||
# Validate Feature Flag Express for PPI entry
|
||||
@ -269,24 +269,24 @@ class InfPpiObject():
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(Item[1].strip())
|
||||
if not FeatureFlagRtv[0]:
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
InfPpiItemObj.SetFeatureFlagExp(Item[1])
|
||||
if len(Item) != 1 and len(Item) != 2:
|
||||
#
|
||||
# Invalid format of Ppi statement
|
||||
# Invalid format of Ppi statement
|
||||
#
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_GUID_PPI_PROTOCOL_SECTION_CONTENT_ERROR,
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
|
||||
|
||||
#
|
||||
# Get/Set Usage and HelpString for PPI entry
|
||||
#
|
||||
@ -297,20 +297,20 @@ class InfPpiObject():
|
||||
CommentItemIns.SetUsage(DT.ITEM_UNDEFINED)
|
||||
CommentItemIns.SetNotify(DT.ITEM_UNDEFINED)
|
||||
InfPpiItemObj.SetCommentList([CommentItemIns])
|
||||
|
||||
|
||||
InfPpiItemObj.SetSupArchList(__SupArchList)
|
||||
|
||||
#
|
||||
# Determine PPI name duplicate. Follow below rule:
|
||||
#
|
||||
# A PPI must not be duplicated within a [Ppis] section.
|
||||
# A PPI may appear in multiple architectural [Ppis]
|
||||
# sections. A PPI listed in an architectural [Ppis]
|
||||
# section must not be listed in the common architectural
|
||||
# A PPI must not be duplicated within a [Ppis] section.
|
||||
# A PPI may appear in multiple architectural [Ppis]
|
||||
# sections. A PPI listed in an architectural [Ppis]
|
||||
# section must not be listed in the common architectural
|
||||
# [Ppis] section.
|
||||
#
|
||||
#
|
||||
# NOTE: This check will not report error now.
|
||||
#
|
||||
#
|
||||
for Item in self.Ppis:
|
||||
if Item.GetName() == InfPpiItemObj.GetName():
|
||||
ItemSupArchList = Item.GetSupArchList()
|
||||
@ -324,9 +324,9 @@ class InfPpiObject():
|
||||
if ItemArch.upper() == 'COMMON' or PpiItemObjArch.upper() == 'COMMON':
|
||||
#
|
||||
# ST.ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
|
||||
#
|
||||
#
|
||||
pass
|
||||
|
||||
|
||||
if (InfPpiItemObj) in self.Ppis:
|
||||
PpiList = self.Ppis[InfPpiItemObj]
|
||||
PpiList.append(InfPpiItemObj)
|
||||
@ -335,9 +335,9 @@ class InfPpiObject():
|
||||
PpiList = []
|
||||
PpiList.append(InfPpiItemObj)
|
||||
self.Ppis[InfPpiItemObj] = PpiList
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def GetPpi(self):
|
||||
return self.Ppis
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of INF file [Protocols] section.
|
||||
# It will consumed by InfParser.
|
||||
# This file is used to define class objects of INF file [Protocols] section.
|
||||
# It will consumed by InfParser.
|
||||
#
|
||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -18,8 +18,8 @@ InfProtocolObject
|
||||
|
||||
from Library.ParserValidate import IsValidCVariableName
|
||||
from Library.CommentParsing import ParseComment
|
||||
from Library.ExpressionValidate import IsValidFeatureFlagExp
|
||||
|
||||
from Library.ExpressionValidate import IsValidFeatureFlagExp
|
||||
|
||||
from Library.Misc import Sdict
|
||||
|
||||
from Object.Parser.InfMisc import ErrorInInf
|
||||
@ -40,20 +40,20 @@ def ParseProtocolComment(CommentsList, InfProtocolItemObj):
|
||||
CommentItemNotify, \
|
||||
CommentItemString, \
|
||||
CommentItemHelpText = \
|
||||
ParseComment(CommentItem,
|
||||
DT.PROTOCOL_USAGE_TOKENS,
|
||||
DT.PROTOCOL_NOTIFY_TOKENS,
|
||||
['PROTOCOL'],
|
||||
ParseComment(CommentItem,
|
||||
DT.PROTOCOL_USAGE_TOKENS,
|
||||
DT.PROTOCOL_NOTIFY_TOKENS,
|
||||
['PROTOCOL'],
|
||||
False)
|
||||
|
||||
|
||||
if CommentItemString:
|
||||
pass
|
||||
|
||||
|
||||
if CommentItemHelpText is None:
|
||||
CommentItemHelpText = ''
|
||||
if Count == len(CommentsList) and CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:
|
||||
CommentItemHelpText = DT.END_OF_LINE
|
||||
|
||||
|
||||
if Count == len(CommentsList):
|
||||
if BlockFlag == 1 or BlockFlag == 2:
|
||||
if CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:
|
||||
@ -61,9 +61,9 @@ def ParseProtocolComment(CommentsList, InfProtocolItemObj):
|
||||
else:
|
||||
BlockFlag = 3
|
||||
elif BlockFlag == -1:
|
||||
BlockFlag = 4
|
||||
|
||||
if BlockFlag == -1 or BlockFlag == 1 or BlockFlag == 2:
|
||||
BlockFlag = 4
|
||||
|
||||
if BlockFlag == -1 or BlockFlag == 1 or BlockFlag == 2:
|
||||
if CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:
|
||||
if BlockFlag == -1:
|
||||
BlockFlag = 1
|
||||
@ -74,36 +74,36 @@ def ParseProtocolComment(CommentsList, InfProtocolItemObj):
|
||||
BlockFlag = 3
|
||||
elif BlockFlag == -1:
|
||||
BlockFlag = 4
|
||||
|
||||
|
||||
#
|
||||
# Combine two comment line if they are generic comment
|
||||
#
|
||||
#
|
||||
if CommentItemUsage == CommentItemNotify == PreUsage == PreNotify == DT.ITEM_UNDEFINED:
|
||||
CommentItemHelpText = PreHelpText + DT.END_OF_LINE + CommentItemHelpText
|
||||
|
||||
|
||||
PreHelpText = CommentItemHelpText
|
||||
|
||||
if BlockFlag == 4:
|
||||
|
||||
if BlockFlag == 4:
|
||||
CommentItemIns = InfProtocolItemCommentContent()
|
||||
CommentItemIns.SetUsageItem(CommentItemUsage)
|
||||
CommentItemIns.SetNotify(CommentItemNotify)
|
||||
CommentItemIns.SetHelpStringItem(CommentItemHelpText)
|
||||
CommentInsList.append(CommentItemIns)
|
||||
|
||||
|
||||
BlockFlag = -1
|
||||
PreUsage = None
|
||||
PreNotify = None
|
||||
PreHelpText = ''
|
||||
|
||||
|
||||
elif BlockFlag == 3:
|
||||
#
|
||||
# Add previous help string
|
||||
#
|
||||
#
|
||||
CommentItemIns = InfProtocolItemCommentContent()
|
||||
CommentItemIns.SetUsageItem(DT.ITEM_UNDEFINED)
|
||||
CommentItemIns.SetNotify(DT.ITEM_UNDEFINED)
|
||||
if PreHelpText == '' or PreHelpText.endswith(DT.END_OF_LINE):
|
||||
PreHelpText += DT.END_OF_LINE
|
||||
PreHelpText += DT.END_OF_LINE
|
||||
CommentItemIns.SetHelpStringItem(PreHelpText)
|
||||
CommentInsList.append(CommentItemIns)
|
||||
#
|
||||
@ -114,25 +114,25 @@ def ParseProtocolComment(CommentsList, InfProtocolItemObj):
|
||||
CommentItemIns.SetNotify(CommentItemNotify)
|
||||
CommentItemIns.SetHelpStringItem(CommentItemHelpText)
|
||||
CommentInsList.append(CommentItemIns)
|
||||
|
||||
|
||||
BlockFlag = -1
|
||||
PreUsage = None
|
||||
PreNotify = None
|
||||
PreHelpText = ''
|
||||
|
||||
PreHelpText = ''
|
||||
|
||||
else:
|
||||
PreUsage = CommentItemUsage
|
||||
PreNotify = CommentItemNotify
|
||||
PreHelpText = CommentItemHelpText
|
||||
|
||||
|
||||
InfProtocolItemObj.SetCommentList(CommentInsList)
|
||||
|
||||
|
||||
return InfProtocolItemObj
|
||||
|
||||
class InfProtocolItemCommentContent():
|
||||
def __init__(self):
|
||||
#
|
||||
# ## SOMETIMES_CONSUMES ## HelpString
|
||||
# ## SOMETIMES_CONSUMES ## HelpString
|
||||
#
|
||||
self.UsageItem = ''
|
||||
#
|
||||
@ -141,44 +141,44 @@ class InfProtocolItemCommentContent():
|
||||
self.HelpStringItem = ''
|
||||
self.Notify = ''
|
||||
self.CommentList = []
|
||||
|
||||
|
||||
def SetUsageItem(self, UsageItem):
|
||||
self.UsageItem = UsageItem
|
||||
def GetUsageItem(self):
|
||||
return self.UsageItem
|
||||
|
||||
|
||||
def SetNotify(self, Notify):
|
||||
if Notify != DT.ITEM_UNDEFINED:
|
||||
self.Notify = 'true'
|
||||
def GetNotify(self):
|
||||
return self.Notify
|
||||
|
||||
|
||||
def SetHelpStringItem(self, HelpStringItem):
|
||||
self.HelpStringItem = HelpStringItem
|
||||
def GetHelpStringItem(self):
|
||||
return self.HelpStringItem
|
||||
|
||||
|
||||
class InfProtocolItem():
|
||||
def __init__(self):
|
||||
self.Name = ''
|
||||
self.FeatureFlagExp = ''
|
||||
self.SupArchList = []
|
||||
self.CommentList = []
|
||||
|
||||
|
||||
def SetName(self, Name):
|
||||
self.Name = Name
|
||||
def GetName(self):
|
||||
return self.Name
|
||||
|
||||
|
||||
def SetFeatureFlagExp(self, FeatureFlagExp):
|
||||
self.FeatureFlagExp = FeatureFlagExp
|
||||
def GetFeatureFlagExp(self):
|
||||
return self.FeatureFlagExp
|
||||
|
||||
|
||||
def SetSupArchList(self, SupArchList):
|
||||
self.SupArchList = SupArchList
|
||||
def GetSupArchList(self):
|
||||
return self.SupArchList
|
||||
return self.SupArchList
|
||||
|
||||
def SetCommentList(self, CommentList):
|
||||
self.CommentList = CommentList
|
||||
@ -196,13 +196,13 @@ class InfProtocolObject():
|
||||
# Macro defined in this section should be only used in this section.
|
||||
#
|
||||
self.Macros = {}
|
||||
|
||||
|
||||
def SetProtocol(self, ProtocolContent, Arch = None,):
|
||||
__SupArchList = []
|
||||
for ArchItem in Arch:
|
||||
#
|
||||
# Validate Arch
|
||||
#
|
||||
#
|
||||
if (ArchItem == '' or ArchItem is None):
|
||||
ArchItem = 'COMMON'
|
||||
__SupArchList.append(ArchItem)
|
||||
@ -233,7 +233,7 @@ class InfProtocolObject():
|
||||
if len(Item) == 2:
|
||||
#
|
||||
# Contained CName and Feature Flag Express
|
||||
# <statements> ::= <CName> ["|"
|
||||
# <statements> ::= <CName> ["|"
|
||||
# <FeatureFlagExpress>]
|
||||
# For Protocol Object
|
||||
#
|
||||
@ -248,14 +248,14 @@ class InfProtocolObject():
|
||||
ErrorInInf(ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
|
||||
LineInfo=LineInfo)
|
||||
InfProtocolItemObj.SetFeatureFlagExp(Item[1])
|
||||
|
||||
|
||||
if len(Item) < 1 or len(Item) > 2:
|
||||
#
|
||||
# Invalid format of Protocols statement
|
||||
# Invalid format of Protocols statement
|
||||
#
|
||||
ErrorInInf(ST.ERR_INF_PARSER_GUID_PPI_PROTOCOL_SECTION_CONTENT_ERROR,
|
||||
LineInfo=LineInfo)
|
||||
|
||||
|
||||
#
|
||||
# Get/Set Usage and HelpString for Protocol entry
|
||||
#
|
||||
@ -266,20 +266,20 @@ class InfProtocolObject():
|
||||
CommentItemIns.SetUsageItem(DT.ITEM_UNDEFINED)
|
||||
CommentItemIns.SetNotify(DT.ITEM_UNDEFINED)
|
||||
InfProtocolItemObj.SetCommentList([CommentItemIns])
|
||||
|
||||
|
||||
InfProtocolItemObj.SetSupArchList(__SupArchList)
|
||||
|
||||
|
||||
#
|
||||
# Determine protocol name duplicate. Follow below rule:
|
||||
#
|
||||
# A protocol must not be duplicated within a [Protocols] section.
|
||||
# A protocol may appear in multiple architectural [Protocols]
|
||||
# sections. A protocol listed in an architectural [Protocols]
|
||||
# section must not be listed in the common architectural
|
||||
# A protocol must not be duplicated within a [Protocols] section.
|
||||
# A protocol may appear in multiple architectural [Protocols]
|
||||
# sections. A protocol listed in an architectural [Protocols]
|
||||
# section must not be listed in the common architectural
|
||||
# [Protocols] section.
|
||||
#
|
||||
#
|
||||
# NOTE: This check will not report error now.
|
||||
#
|
||||
#
|
||||
for Item in self.Protocols:
|
||||
if Item.GetName() == InfProtocolItemObj.GetName():
|
||||
ItemSupArchList = Item.GetSupArchList()
|
||||
@ -294,8 +294,8 @@ class InfProtocolObject():
|
||||
#
|
||||
# ST.ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
|
||||
#
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
if (InfProtocolItemObj) in self.Protocols:
|
||||
ProcotolList = self.Protocols[InfProtocolItemObj]
|
||||
ProcotolList.append(InfProtocolItemObj)
|
||||
@ -304,8 +304,8 @@ class InfProtocolObject():
|
||||
ProcotolList = []
|
||||
ProcotolList.append(InfProtocolItemObj)
|
||||
self.Protocols[InfProtocolItemObj] = ProcotolList
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def GetProtocol(self):
|
||||
return self.Protocols
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of INF file [Sources] section.
|
||||
# It will consumed by InfParser.
|
||||
# This file is used to define class objects of INF file [Sources] section.
|
||||
# It will consumed by InfParser.
|
||||
#
|
||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -21,22 +21,22 @@ import os
|
||||
from Logger import StringTable as ST
|
||||
from Logger import ToolError
|
||||
import Logger.Log as Logger
|
||||
from Library import GlobalData
|
||||
from Library import GlobalData
|
||||
|
||||
from Library.Misc import Sdict
|
||||
from Library.ExpressionValidate import IsValidFeatureFlagExp
|
||||
from Library.ExpressionValidate import IsValidFeatureFlagExp
|
||||
from Object.Parser.InfCommonObject import InfSectionCommonDef
|
||||
from Library.Misc import ValidFile
|
||||
from Library.Misc import ValidFile
|
||||
from Library.ParserValidate import IsValidFamily
|
||||
from Library.ParserValidate import IsValidPath
|
||||
|
||||
## __GenSourceInstance
|
||||
## __GenSourceInstance
|
||||
#
|
||||
#
|
||||
#
|
||||
def GenSourceInstance(Item, CurrentLineOfItem, ItemObj):
|
||||
|
||||
|
||||
IsValidFileFlag = False
|
||||
|
||||
|
||||
if len(Item) < 6 and len(Item) >= 1:
|
||||
#
|
||||
# File | Family | TagName | ToolCode | FeatureFlagExpr
|
||||
@ -46,43 +46,43 @@ def GenSourceInstance(Item, CurrentLineOfItem, ItemObj):
|
||||
# Validate Feature Flag Express
|
||||
#
|
||||
if Item[4].strip() == '':
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
#
|
||||
# Validate FFE
|
||||
# Validate FFE
|
||||
#
|
||||
FeatureFlagRtv = IsValidFeatureFlagExp(Item[4].strip())
|
||||
if not FeatureFlagRtv[0]:
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
ItemObj.SetFeatureFlagExp(Item[4])
|
||||
if len(Item) >= 4:
|
||||
if Item[3].strip() == '':
|
||||
ItemObj.SetToolCode(Item[3])
|
||||
else:
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_TOOLCODE_NOT_PERMITTED%(Item[2]),
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
if len(Item) >= 3:
|
||||
if Item[2].strip() == '':
|
||||
ItemObj.SetTagName(Item[2])
|
||||
else:
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_TAGNAME_NOT_PERMITTED%(Item[2]),
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
if len(Item) >= 2:
|
||||
if IsValidFamily(Item[1].strip()):
|
||||
@ -93,11 +93,11 @@ def GenSourceInstance(Item, CurrentLineOfItem, ItemObj):
|
||||
Item[1] = ""
|
||||
ItemObj.SetFamily(Item[1])
|
||||
else:
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_SOURCE_SECTION_FAMILY_INVALID%(Item[1]),
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
if len(Item) >= 1:
|
||||
#
|
||||
@ -105,41 +105,41 @@ def GenSourceInstance(Item, CurrentLineOfItem, ItemObj):
|
||||
#
|
||||
FullFileName = os.path.normpath(os.path.realpath(os.path.join(GlobalData.gINF_MODULE_DIR, Item[0])))
|
||||
if not (ValidFile(FullFileName) or ValidFile(Item[0])):
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_FILELIST_EXIST%(Item[0]),
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
|
||||
|
||||
#
|
||||
# Validate file exist/format.
|
||||
#
|
||||
|
||||
|
||||
if IsValidPath(Item[0], GlobalData.gINF_MODULE_DIR):
|
||||
IsValidFileFlag = True
|
||||
else:
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(Item[0]),
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
return False
|
||||
if IsValidFileFlag:
|
||||
ItemObj.SetSourceFileName(Item[0])
|
||||
ItemObj.SetSourceFileName(Item[0])
|
||||
else:
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
Logger.Error("InfParser",
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_SOURCES_SECTION_CONTENT_ERROR,
|
||||
File=CurrentLineOfItem[2],
|
||||
File=CurrentLineOfItem[2],
|
||||
Line=CurrentLineOfItem[1],
|
||||
ExtraData=CurrentLineOfItem[0])
|
||||
|
||||
return ItemObj
|
||||
|
||||
return ItemObj
|
||||
|
||||
## InfSourcesItemObject()
|
||||
#
|
||||
#
|
||||
#
|
||||
class InfSourcesItemObject():
|
||||
def __init__(self, \
|
||||
@ -156,32 +156,32 @@ class InfSourcesItemObject():
|
||||
self.HeaderString = ''
|
||||
self.TailString = ''
|
||||
self.SupArchList = []
|
||||
|
||||
|
||||
def SetSourceFileName(self, SourceFilename):
|
||||
self.SourceFileName = SourceFilename
|
||||
def GetSourceFileName(self):
|
||||
return self.SourceFileName
|
||||
|
||||
|
||||
def SetFamily(self, Family):
|
||||
self.Family = Family
|
||||
def GetFamily(self):
|
||||
return self.Family
|
||||
|
||||
|
||||
def SetTagName(self, TagName):
|
||||
self.TagName = TagName
|
||||
def GetTagName(self):
|
||||
return self.TagName
|
||||
|
||||
|
||||
def SetToolCode(self, ToolCode):
|
||||
self.ToolCode = ToolCode
|
||||
def GetToolCode(self):
|
||||
return self.ToolCode
|
||||
|
||||
|
||||
def SetFeatureFlagExp(self, FeatureFlagExp):
|
||||
self.FeatureFlagExp = FeatureFlagExp
|
||||
def GetFeatureFlagExp(self):
|
||||
return self.FeatureFlagExp
|
||||
|
||||
|
||||
def SetHeaderString(self, HeaderString):
|
||||
self.HeaderString = HeaderString
|
||||
def GetHeaderString(self):
|
||||
@ -191,11 +191,11 @@ class InfSourcesItemObject():
|
||||
self.TailString = TailString
|
||||
def GetTailString(self):
|
||||
return self.TailString
|
||||
|
||||
|
||||
def SetSupArchList(self, SupArchList):
|
||||
self.SupArchList = SupArchList
|
||||
def GetSupArchList(self):
|
||||
return self.SupArchList
|
||||
return self.SupArchList
|
||||
##
|
||||
#
|
||||
#
|
||||
@ -204,26 +204,26 @@ class InfSourcesObject(InfSectionCommonDef):
|
||||
def __init__(self):
|
||||
self.Sources = Sdict()
|
||||
InfSectionCommonDef.__init__(self)
|
||||
|
||||
|
||||
def SetSources(self, SourceList, Arch = None):
|
||||
__SupArchList = []
|
||||
for ArchItem in Arch:
|
||||
#
|
||||
# Validate Arch
|
||||
#
|
||||
#
|
||||
if (ArchItem == '' or ArchItem is None):
|
||||
ArchItem = 'COMMON'
|
||||
__SupArchList.append(ArchItem)
|
||||
ArchItem = 'COMMON'
|
||||
__SupArchList.append(ArchItem)
|
||||
|
||||
for Item in SourceList:
|
||||
ItemObj = InfSourcesItemObject()
|
||||
CurrentLineOfItem = Item[2]
|
||||
Item = Item[0]
|
||||
|
||||
Item = Item[0]
|
||||
|
||||
ItemObj = GenSourceInstance(Item, CurrentLineOfItem, ItemObj)
|
||||
|
||||
ItemObj.SetSupArchList(__SupArchList)
|
||||
|
||||
|
||||
ItemObj.SetSupArchList(__SupArchList)
|
||||
|
||||
if (ItemObj) in self.Sources:
|
||||
SourceContent = self.Sources[ItemObj]
|
||||
SourceContent.append(ItemObj)
|
||||
@ -232,8 +232,8 @@ class InfSourcesObject(InfSectionCommonDef):
|
||||
SourceContent = []
|
||||
SourceContent.append(ItemObj)
|
||||
self.Sources[ItemObj] = SourceContent
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def GetSources(self):
|
||||
return self.Sources
|
||||
|
@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# This file is used to define class objects of INF file [UserExtension] section.
|
||||
# It will consumed by InfParser.
|
||||
# This file is used to define class objects of INF file [UserExtension] section.
|
||||
# It will consumed by InfParser.
|
||||
#
|
||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -19,7 +19,7 @@ InfUserExtensionsObject
|
||||
from Logger import StringTable as ST
|
||||
from Logger import ToolError
|
||||
import Logger.Log as Logger
|
||||
from Library import GlobalData
|
||||
from Library import GlobalData
|
||||
|
||||
from Library.Misc import Sdict
|
||||
|
||||
@ -32,27 +32,27 @@ class InfUserExtensionItem():
|
||||
self.UserId = UserId
|
||||
self.IdString = IdString
|
||||
self.SupArchList = []
|
||||
|
||||
|
||||
def SetContent(self, Content):
|
||||
self.Content = Content
|
||||
def GetContent(self):
|
||||
return self.Content
|
||||
|
||||
|
||||
def SetUserId(self, UserId):
|
||||
self.UserId = UserId
|
||||
def GetUserId(self):
|
||||
return self.UserId
|
||||
|
||||
|
||||
def SetIdString(self, IdString):
|
||||
self.IdString = IdString
|
||||
def GetIdString(self):
|
||||
return self.IdString
|
||||
|
||||
|
||||
def SetSupArchList(self, SupArchList):
|
||||
self.SupArchList = SupArchList
|
||||
def GetSupArchList(self):
|
||||
return self.SupArchList
|
||||
|
||||
|
||||
##
|
||||
#
|
||||
#
|
||||
@ -60,74 +60,74 @@ class InfUserExtensionItem():
|
||||
class InfUserExtensionObject():
|
||||
def __init__(self):
|
||||
self.UserExtension = Sdict()
|
||||
|
||||
|
||||
def SetUserExtension(self, UserExtensionCont, IdContent=None, LineNo=None):
|
||||
if not UserExtensionCont or UserExtensionCont == '':
|
||||
return True
|
||||
#
|
||||
# IdContent is a list contain UserId and IdString
|
||||
# IdContent is a list contain UserId and IdString
|
||||
# For this call the general section header parser, if no definition of
|
||||
# IdString/UserId, it will return 'COMMON'
|
||||
#
|
||||
for IdContentItem in IdContent:
|
||||
for IdContentItem in IdContent:
|
||||
InfUserExtensionItemObj = InfUserExtensionItem()
|
||||
if IdContentItem[0] == 'COMMON':
|
||||
UserId = ''
|
||||
else:
|
||||
UserId = IdContentItem[0]
|
||||
|
||||
|
||||
if IdContentItem[1] == 'COMMON':
|
||||
IdString = ''
|
||||
else:
|
||||
IdString = IdContentItem[1]
|
||||
|
||||
IdString = IdContentItem[1]
|
||||
|
||||
#
|
||||
# Fill UserExtensionObj members.
|
||||
#
|
||||
#
|
||||
InfUserExtensionItemObj.SetUserId(UserId)
|
||||
InfUserExtensionItemObj.SetIdString(IdString)
|
||||
InfUserExtensionItemObj.SetContent(UserExtensionCont)
|
||||
InfUserExtensionItemObj.SetSupArchList(IdContentItem[2])
|
||||
|
||||
InfUserExtensionItemObj.SetSupArchList(IdContentItem[2])
|
||||
|
||||
# for CheckItem in self.UserExtension:
|
||||
# if IdContentItem[0] == CheckItem[0] and IdContentItem[1] == CheckItem[1]:
|
||||
# if IdContentItem[2].upper() == 'COMMON' or CheckItem[2].upper() == 'COMMON':
|
||||
# #
|
||||
# # For COMMON ARCH type, do special check.
|
||||
# #
|
||||
# Logger.Error('InfParser',
|
||||
# Logger.Error('InfParser',
|
||||
# ToolError.FORMAT_INVALID,
|
||||
# ST.ERR_INF_PARSER_UE_SECTION_DUPLICATE_ERROR%\
|
||||
# (IdContentItem[0] + '.' + IdContentItem[1] + '.' + IdContentItem[2]),
|
||||
# File=GlobalData.gINF_MODULE_NAME,
|
||||
# File=GlobalData.gINF_MODULE_NAME,
|
||||
# Line=LineNo,
|
||||
# ExtraData=None)
|
||||
|
||||
|
||||
if IdContentItem in self.UserExtension:
|
||||
#
|
||||
# Each UserExtensions section header must have a unique set
|
||||
# Each UserExtensions section header must have a unique set
|
||||
# of UserId, IdString and Arch values.
|
||||
# This means that the same UserId can be used in more than one
|
||||
# section header, provided the IdString or Arch values are
|
||||
# different. The same IdString values can be used in more than
|
||||
# one section header if the UserId or Arch values are
|
||||
# different. The same UserId and the same IdString can be used
|
||||
# in a section header if the Arch values are different in each
|
||||
# This means that the same UserId can be used in more than one
|
||||
# section header, provided the IdString or Arch values are
|
||||
# different. The same IdString values can be used in more than
|
||||
# one section header if the UserId or Arch values are
|
||||
# different. The same UserId and the same IdString can be used
|
||||
# in a section header if the Arch values are different in each
|
||||
# of the section headers.
|
||||
#
|
||||
Logger.Error('InfParser',
|
||||
Logger.Error('InfParser',
|
||||
ToolError.FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_UE_SECTION_DUPLICATE_ERROR%\
|
||||
(IdContentItem[0] + '.' + IdContentItem[1] + '.' + IdContentItem[2]),
|
||||
File=GlobalData.gINF_MODULE_NAME,
|
||||
File=GlobalData.gINF_MODULE_NAME,
|
||||
Line=LineNo,
|
||||
ExtraData=None)
|
||||
else:
|
||||
UserExtensionList = []
|
||||
UserExtensionList.append(InfUserExtensionItemObj)
|
||||
self.UserExtension[IdContentItem] = UserExtensionList
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def GetUserExtension(self):
|
||||
return self.UserExtension
|
||||
|
@ -4,11 +4,11 @@
|
||||
# This file is required to make Python interpreter treat the directory
|
||||
# as containing package.
|
||||
#
|
||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# This program and the accompanying materials are licensed and made available
|
||||
# under the terms and conditions of the BSD License which accompanies this
|
||||
# distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -17,4 +17,4 @@
|
||||
|
||||
'''
|
||||
PARSER
|
||||
'''
|
||||
'''
|
||||
|
Reference in New Issue
Block a user