diff options
author | Yunhua Feng <yunhuax.feng@intel.com> | 2018-05-24 10:25:21 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-06-06 14:20:41 +0800 |
commit | 179c2f97f949509ec55f0ec7cb84480fb0c015a7 (patch) | |
tree | bccb73e7001eb7ddcf63f60a9982036ca5004401 /BaseTools | |
parent | 238d9b5c64520acdd784667a29326804dde7ea31 (diff) | |
download | edk2-179c2f97f949509ec55f0ec7cb84480fb0c015a7.tar.gz edk2-179c2f97f949509ec55f0ec7cb84480fb0c015a7.tar.bz2 edk2-179c2f97f949509ec55f0ec7cb84480fb0c015a7.zip |
BaseTools: Display both Hex and integer value format of PCD value
If the PCD's datum type is UINT8, UINT16, UINT32 or UINT64, then in
the report will display both hexadecimal format and integer format
of PCD value.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Source/Python/build/BuildReport.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index ad05c4a3ad..61ea645f5c 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1140,6 +1140,11 @@ class PcdReport(object): for Array in ArrayList:
FileWrite(File, '%s' % (Array))
else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', Value))
if not InfMatch and InfDefaultValue is not None:
Value = InfDefaultValue.strip()
@@ -1149,6 +1154,11 @@ class PcdReport(object): for Array in ArrayList:
FileWrite(File, '%s' % (Array))
else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', Value))
if not DecMatch and DecDefaultValue is not None:
@@ -1159,6 +1169,11 @@ class PcdReport(object): for Array in ArrayList:
FileWrite(File, '%s' % (Array))
else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DEC DEFAULT', Value))
if IsStructure:
self.PrintStructureInfo(File, Pcd.DefaultValues)
@@ -1174,6 +1189,11 @@ class PcdReport(object): for Array in ArrayList:
FileWrite(File, '%s' % (Array))
else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x','0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value))
if IsStructure:
OverrideValues = Pcd.SkuOverrideValues
@@ -1210,6 +1230,11 @@ class PcdReport(object): for Array in ArrayList:
FileWrite(File, '%s' % (Array))
else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
if self.DefaultStoreSingle and self.SkuSingle:
FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value))
elif self.DefaultStoreSingle and not self.SkuSingle:
@@ -1231,6 +1256,11 @@ class PcdReport(object): for Array in ArrayList:
FileWrite(File, '%s' % (Array))
else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
if self.DefaultStoreSingle and self.SkuSingle:
FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', Value))
elif self.DefaultStoreSingle and not self.SkuSingle:
@@ -1258,6 +1288,11 @@ class PcdReport(object): for Array in ArrayList:
FileWrite(File, '%s' % (Array))
else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
if self.SkuSingle:
FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value))
else:
@@ -1271,6 +1306,11 @@ class PcdReport(object): for Array in ArrayList:
FileWrite(File, '%s' % (Array))
else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
if self.SkuSingle:
FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, ' ' , TypeName, '(' + Pcd.DatumType + ')', Value))
else:
|