X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FAutoGen%2FGenC.py;h=e224568db1ed14d76dead4be053ccc2dfdb7a3fa;hb=938cf4c33a0695ef1011b07e455a7ec2f87b5ad3;hp=a21880f31777ba5b739e0b989ea189f2ef7b33d4;hpb=2e300969aeff5a863098242ebd95b7d653893262;p=mirror_edk2.git diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py index a21880f317..e224568db1 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -13,11 +13,12 @@ ## Import Modules # +from __future__ import absolute_import import string import collections import struct from Common import EdkLogger - +from Common import GlobalData from Common.BuildToolError import * from Common.DataType import * from Common.Misc import * @@ -936,7 +937,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): if Info.IsLibrary: PcdList = Info.LibraryPcdList else: - PcdList = list(Info.ModulePcdList) + list(Info.LibraryPcdList) + PcdList = Info.ModulePcdList + Info.LibraryPcdList PcdExCNameTest = 0 for PcdModule in PcdList: if PcdModule.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenCName == PcdModule.TokenCName: @@ -970,7 +971,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): AutoGenH.Append('#define %s(Value) LibPcdSetEx%sS(&%s, %s, (Value))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) elif Pcd.Type in PCD_DYNAMIC_TYPE_SET: PcdCNameTest = 0 - for PcdModule in list(Info.LibraryPcdList) + list(Info.ModulePcdList): + for PcdModule in Info.LibraryPcdList + Info.ModulePcdList: if PcdModule.Type in PCD_DYNAMIC_TYPE_SET and Pcd.TokenCName == PcdModule.TokenCName: PcdCNameTest += 1 # get out early once we found > 1... @@ -1050,7 +1051,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): else: NewValue = NewValue + str(ord(Value[Index]) % 0x100) + ', ' if Unicode: - ArraySize = ArraySize // 2 + ArraySize = ArraySize / 2 Value = NewValue + '0 }' if ArraySize < ValueSize: if Pcd.MaxSizeUserSet: @@ -1060,7 +1061,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): else: ArraySize = Pcd.GetPcdSize() if Unicode: - ArraySize = ArraySize // 2 + ArraySize = ArraySize / 2 Array = '[%d]' % ArraySize # # skip casting for fixed at build since it breaks ARM assembly. @@ -1795,7 +1796,7 @@ def CreateIdfFileCode(Info, AutoGenC, StringH, IdfGenCFlag, IdfGenBinBuffer): TempBuffer += Buffer elif File.Ext.upper() == '.JPG': ImageType, = struct.unpack('4s', Buffer[6:10]) - if ImageType != b'JFIF': + if ImageType != 'JFIF': EdkLogger.error("build", FILE_TYPE_MISMATCH, "The file %s is not a standard JPG file." % File.Path) TempBuffer = pack('B', EFI_HII_IIBT_IMAGE_JPEG) TempBuffer += pack('I', len(Buffer)) @@ -1895,7 +1896,7 @@ def CreateIdfFileCode(Info, AutoGenC, StringH, IdfGenCFlag, IdfGenBinBuffer): def BmpImageDecoder(File, Buffer, PaletteIndex, TransParent): ImageType, = struct.unpack('2s', Buffer[0:2]) - if ImageType!= b'BM': # BMP file type is 'BM' + if ImageType!= 'BM': # BMP file type is 'BM' EdkLogger.error("build", FILE_TYPE_MISMATCH, "The file %s is not a standard BMP file." % File.Path) BMP_IMAGE_HEADER = collections.namedtuple('BMP_IMAGE_HEADER', ['bfSize', 'bfReserved1', 'bfReserved2', 'bfOffBits', 'biSize', 'biWidth', 'biHeight', 'biPlanes', 'biBitCount', 'biCompression', 'biSizeImage', 'biXPelsPerMeter', 'biYPelsPerMeter', 'biClrUsed', 'biClrImportant']) BMP_IMAGE_HEADER_STRUCT = struct.Struct('IHHIIIIHHIIIIII') @@ -1919,7 +1920,7 @@ def BmpImageDecoder(File, Buffer, PaletteIndex, TransParent): else: ImageBuffer = pack('B', EFI_HII_IIBT_IMAGE_1BIT) ImageBuffer += pack('B', PaletteIndex) - Width = (BmpHeader.biWidth + 7)//8 + Width = (BmpHeader.biWidth + 7)/8 if BmpHeader.bfOffBits > BMP_IMAGE_HEADER_STRUCT.size + 2: PaletteBuffer = Buffer[BMP_IMAGE_HEADER_STRUCT.size + 2 : BmpHeader.bfOffBits] elif BmpHeader.biBitCount == 4: @@ -1928,7 +1929,7 @@ def BmpImageDecoder(File, Buffer, PaletteIndex, TransParent): else: ImageBuffer = pack('B', EFI_HII_IIBT_IMAGE_4BIT) ImageBuffer += pack('B', PaletteIndex) - Width = (BmpHeader.biWidth + 1)//2 + Width = (BmpHeader.biWidth + 1)/2 if BmpHeader.bfOffBits > BMP_IMAGE_HEADER_STRUCT.size + 2: PaletteBuffer = Buffer[BMP_IMAGE_HEADER_STRUCT.size + 2 : BmpHeader.bfOffBits] elif BmpHeader.biBitCount == 8: @@ -1967,7 +1968,7 @@ def BmpImageDecoder(File, Buffer, PaletteIndex, TransParent): for Index in range(0, len(PaletteBuffer)): if Index % 4 == 3: continue - PaletteTemp += bytes([PaletteBuffer[Index]]) + PaletteTemp += PaletteBuffer[Index] PaletteBuffer = PaletteTemp[1:] return ImageBuffer, PaletteBuffer @@ -2065,7 +2066,7 @@ def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer, if Guid in Info.Module.GetGuidsUsedByPcd(): continue GuidMacros.append('#define %s %s' % (Guid, Info.Module.Guids[Guid])) - for Guid, Value in list(Info.Module.Protocols.items()) + list(Info.Module.Ppis.items()): + for Guid, Value in Info.Module.Protocols.items() + Info.Module.Ppis.items(): GuidMacros.append('#define %s %s' % (Guid, Value)) # supports FixedAtBuild and FeaturePcd usage in VFR file if Info.VfrFileList and Info.ModulePcdList: