|
From: <js...@us...> - 2011-11-18 07:09:36
|
Revision: 2418
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2418&view=rev
Author: jsu1
Date: 2011-11-18 07:09:30 +0000 (Fri, 18 Nov 2011)
Log Message:
-----------
Fix Trim to skip the postfix 'U' for hexadecimal and decimal numbers
Reviewed-by: gikidy
Signed-off-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Trim/Trim.py
Modified: trunk/BaseTools/Source/Python/Trim/Trim.py
===================================================================
--- trunk/BaseTools/Source/Python/Trim/Trim.py 2011-11-18 01:35:57 UTC (rev 2417)
+++ trunk/BaseTools/Source/Python/Trim/Trim.py 2011-11-18 07:09:30 UTC (rev 2418)
@@ -37,7 +37,9 @@
## Regular expression for matching "#pragma pack"
gPragmaPattern = re.compile("^\s*#pragma\s+pack", re.MULTILINE)
## Regular expression for matching HEX number
-gHexNumberPattern = re.compile("0[xX]([0-9a-fA-F]+)")
+gHexNumberPattern = re.compile("(0[xX])([0-9a-fA-F]+)U?")
+## Regular expression for matching decimal number with 'U' postfix
+gDecNumberPattern = re.compile("([0-9]+)U")
## Regular expression for matching "Include ()" in asl file
gAslIncludePattern = re.compile("^(\s*)[iI]nclude\s*\(\"?([^\"\(\)]+)\"\)", re.MULTILINE)
## Regular expression for matching C style #include "XXX.asl" in asl file
@@ -169,10 +171,15 @@
# convert HEX number format if indicated
if ConvertHex:
- Line = gHexNumberPattern.sub(r"0\1h", Line)
+ Line = gHexNumberPattern.sub(r"0\2h", Line)
+ else:
+ Line = gHexNumberPattern.sub(r"\1\2", Line)
if TrimLong:
Line = gLongNumberPattern.sub(r"\1", Line)
+ # convert Decimal number format
+ Line = gDecNumberPattern.sub(r"\1", Line)
+
if LineNumber != None:
EdkLogger.verbose("Got line directive: line=%d" % LineNumber)
# in case preprocessor removed some lines, like blank or comment lines
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|