#\r
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
-# This program and the accompanying materials are licensed and made available\r
-# under the terms and conditions of the BSD License which accompanies this\r
-# distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
'''\r
DecParser\r
'''\r
if not IsValidToken(PCD_TOKEN_PATTERN, Token):\r
self._LoggerError(ST.ERR_DECPARSE_PCD_TOKEN % Token)\r
elif not Token.startswith('0x') and not Token.startswith('0X'):\r
- if long(Token) > 4294967295:\r
+ if int(Token) > 4294967295:\r
self._LoggerError(ST.ERR_DECPARSE_PCD_TOKEN_INT % Token)\r
- Token = hex(long(Token))[:-1]\r
+ Token = '0x%x' % int(Token)\r
\r
- IntToken = long(Token, 0)\r
+ IntToken = int(Token, 0)\r
if (Guid, IntToken) in self.TokenMap:\r
if self.TokenMap[Guid, IntToken] != CName:\r
self._LoggerError(ST.ERR_DECPARSE_PCD_TOKEN_UNIQUE%(Token))\r
\r
## _DecUserExtension\r
#\r
-# Parse user extention section\r
+# Parse user extension section\r
#\r
class _DecUserExtension(_DecBase):\r
def __init__(self, RawData):\r
class Dec(_DecBase, _DecComments):\r
def __init__(self, DecFile, Parse = True):\r
try:\r
- Content = ConvertSpecialChar(open(DecFile, 'rb').readlines())\r
+ Content = ConvertSpecialChar(open(DecFile, 'r').readlines())\r
except BaseException:\r
Logger.Error(TOOL_NAME, FILE_OPEN_FAILURE, File=DecFile,\r
ExtraData=ST.ERR_DECPARSE_FILEOPEN % DecFile)\r
SectionNames.append(SectionName)\r
#\r
# In DEC specification, all section headers have at most two part:\r
- # SectionName.Arch except UserExtention\r
+ # SectionName.Arch except UserExtension\r
#\r
if len(ItemList) > 2:\r
self._LoggerError(ST.ERR_DECPARSE_SECTION_SUBTOOMANY % Item)\r