|
From: <lg...@us...> - 2010-01-26 08:16:21
|
Revision: 1817
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=1817&view=rev
Author: lgao4
Date: 2010-01-26 08:16:15 +0000 (Tue, 26 Jan 2010)
Log Message:
-----------
Enhance Trim tool to handle framework FV header.
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Trim/Trim.py
Modified: trunk/BaseTools/Source/Python/Trim/Trim.py
===================================================================
--- trunk/BaseTools/Source/Python/Trim/Trim.py 2010-01-26 07:18:06 UTC (rev 1816)
+++ trunk/BaseTools/Source/Python/Trim/Trim.py 2010-01-26 08:16:15 UTC (rev 1817)
@@ -82,6 +82,21 @@
],
[
+ re.compile('#include\s+EFI_GUID_DEFINITION\s*\(FirmwareFileSystem\)', re.MULTILINE),
+ '#include EFI_GUID_DEFINITION (FirmwareFileSystem)\n#include EFI_GUID_DEFINITION (FirmwareFileSystem2)'
+ ],
+
+ [
+ re.compile('gEfiFirmwareFileSystemGuid', re.MULTILINE),
+ 'gEfiFirmwareFileSystem2Guid'
+ ],
+
+ [
+ re.compile('EFI_FVH_REVISION', re.MULTILINE),
+ 'EFI_FVH_PI_REVISION'
+ ],
+
+ [
re.compile("(\s*)\S*CreateEvent\s*\([\s\n]*EFI_EVENT_SIGNAL_READY_TO_BOOT[^,]*,((?:[^;]+\n)+)(\s*\));", re.MULTILINE),
'\\1EfiCreateEventReadyToBoot (\\2\\3;'
],
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lg...@us...> - 2010-04-27 03:18:36
|
Revision: 1956
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=1956&view=rev
Author: lgao4
Date: 2010-04-27 03:18:30 +0000 (Tue, 27 Apr 2010)
Log Message:
-----------
Update Trim tool to append a blank line when expand the include source file.
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Trim/Trim.py
Modified: trunk/BaseTools/Source/Python/Trim/Trim.py
===================================================================
--- trunk/BaseTools/Source/Python/Trim/Trim.py 2010-04-20 06:48:15 UTC (rev 1955)
+++ trunk/BaseTools/Source/Python/Trim/Trim.py 2010-04-27 03:18:30 UTC (rev 1956)
@@ -294,6 +294,7 @@
CurrentIndent = Indent + Result[0][0]
IncludedFile = Result[0][1]
NewFileContent.extend(DoInclude(IncludedFile, CurrentIndent))
+ NewFileContent.append("\n")
gIncludedAslFile.pop()
F.close()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qh...@us...> - 2010-05-07 03:06:50
|
Revision: 1966
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=1966&view=rev
Author: qhuang8
Date: 2010-05-07 03:06:44 +0000 (Fri, 07 May 2010)
Log Message:
-----------
Update trim tool to support "typedef struct MyStructTag {" as it is valid C style syntax.
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Trim/Trim.py
Modified: trunk/BaseTools/Source/Python/Trim/Trim.py
===================================================================
--- trunk/BaseTools/Source/Python/Trim/Trim.py 2010-05-06 19:37:20 UTC (rev 1965)
+++ trunk/BaseTools/Source/Python/Trim/Trim.py 2010-05-07 03:06:44 UTC (rev 1966)
@@ -33,7 +33,7 @@
## Regular expression for matching Line Control directive like "#line xxx"
gLineControlDirective = re.compile('^\s*#(?:line)?\s+([0-9]+)\s+"*([^"]*)"')
## Regular expression for matching "typedef struct"
-gTypedefPattern = re.compile("^\s*typedef\s+struct\s*[{]*$", re.MULTILINE)
+gTypedefPattern = re.compile("^\s*typedef\s+struct\s*\w*\s*[{]*$", re.MULTILINE)
## Regular expression for matching "#pragma pack"
gPragmaPattern = re.compile("^\s*#pragma\s+pack", re.MULTILINE)
## Regular expression for matching HEX number
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qh...@us...> - 2010-05-10 13:44:21
|
Revision: 1968
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=1968&view=rev
Author: qhuang8
Date: 2010-05-10 13:44:10 +0000 (Mon, 10 May 2010)
Log Message:
-----------
Update the regex to be more accurate
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Trim/Trim.py
Modified: trunk/BaseTools/Source/Python/Trim/Trim.py
===================================================================
--- trunk/BaseTools/Source/Python/Trim/Trim.py 2010-05-10 00:55:24 UTC (rev 1967)
+++ trunk/BaseTools/Source/Python/Trim/Trim.py 2010-05-10 13:44:10 UTC (rev 1968)
@@ -33,7 +33,7 @@
## Regular expression for matching Line Control directive like "#line xxx"
gLineControlDirective = re.compile('^\s*#(?:line)?\s+([0-9]+)\s+"*([^"]*)"')
## Regular expression for matching "typedef struct"
-gTypedefPattern = re.compile("^\s*typedef\s+struct\s*\w*\s*[{]*$", re.MULTILINE)
+gTypedefPattern = re.compile("^\s*typedef\s+struct(\s+\w+)?\s*[{]*$", re.MULTILINE)
## Regular expression for matching "#pragma pack"
gPragmaPattern = re.compile("^\s*#pragma\s+pack", re.MULTILINE)
## Regular expression for matching HEX number
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lg...@us...> - 2010-06-12 07:08:46
|
Revision: 1981
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=1981&view=rev
Author: lgao4
Date: 2010-06-12 07:08:40 +0000 (Sat, 12 Jun 2010)
Log Message:
-----------
Remove the incorrect convert from LoadFile.h to FvLoadFile.h.
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Trim/Trim.py
Modified: trunk/BaseTools/Source/Python/Trim/Trim.py
===================================================================
--- trunk/BaseTools/Source/Python/Trim/Trim.py 2010-06-12 06:59:38 UTC (rev 1980)
+++ trunk/BaseTools/Source/Python/Trim/Trim.py 2010-06-12 07:08:40 UTC (rev 1981)
@@ -77,11 +77,6 @@
],
[
- re.compile('#include\s+["<]LoadFile\.h[">]', re.MULTILINE),
- '#include <FvLoadFile.h>'
- ],
-
- [
re.compile('#include\s+EFI_GUID_DEFINITION\s*\(FirmwareFileSystem\)', re.MULTILINE),
'#include EFI_GUID_DEFINITION (FirmwareFileSystem)\n#include EFI_GUID_DEFINITION (FirmwareFileSystem2)'
],
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qh...@us...> - 2010-09-10 07:07:59
|
Revision: 2047
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2047&view=rev
Author: qhuang8
Date: 2010-09-10 07:07:53 +0000 (Fri, 10 Sep 2010)
Log Message:
-----------
Enhance trim tool to support the removal of postfix (ULL, UL, LL, L) for long integers.
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Trim/Trim.py
Modified: trunk/BaseTools/Source/Python/Trim/Trim.py
===================================================================
--- trunk/BaseTools/Source/Python/Trim/Trim.py 2010-09-10 07:06:28 UTC (rev 2046)
+++ trunk/BaseTools/Source/Python/Trim/Trim.py 2010-09-10 07:07:53 UTC (rev 2047)
@@ -40,6 +40,8 @@
gHexNumberPattern = re.compile("0[xX]([0-9a-fA-F]+)")
## Regular expression for matching "Include ()" in asl file
gAslIncludePattern = re.compile("^(\s*)[iI]nclude\s*\(\"?([^\"\(\)]+)\"\)", re.MULTILINE)
+## Regular expression for matching constant with 'ULL' and 'UL', 'LL', 'L' postfix
+gLongNumberPattern = re.compile("(0[xX][0-9a-fA-F]+|[0-9]+)U?LL", re.MULTILINE)
## Patterns used to convert EDK conventions to EDK2 ECP conventions
gImportCodePatterns = [
[
@@ -118,7 +120,7 @@
# @param Target File to store the trimmed content
# @param Convert If True, convert standard HEX format to MASM format
#
-def TrimPreprocessedFile(Source, Target, Convert):
+def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong):
CreateDirectory(os.path.dirname(Target))
try:
f = open (Source, 'r')
@@ -164,8 +166,10 @@
% (LineIndexOfOriginalFile + 1))
# convert HEX number format if indicated
- if Convert:
+ if ConvertHex:
Line = gHexNumberPattern.sub(r"0\1h", Line)
+ if TrimLong:
+ Line = gLongNumberPattern.sub(r"\1", Line)
if LineNumber != None:
EdkLogger.verbose("Got line directive: line=%d" % LineNumber)
@@ -437,6 +441,9 @@
make_option("-c", "--convert-hex", dest="ConvertHex", action="store_true",
help="Convert standard hex format (0xabcd) to MASM format (abcdh)"),
+ make_option("-l", "--trim-long", dest="TrimLong", action="store_true",
+ help="Remove postfix of long number"),
+
make_option("-o", "--output", dest="OutputFile",
help="File to store the trimmed content"),
make_option("-v", "--verbose", dest="LogLevel", action="store_const", const=EdkLogger.VERBOSE,
@@ -501,7 +508,7 @@
else :
if CommandOptions.OutputFile == None:
CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'
- TrimPreprocessedFile(InputFile, CommandOptions.OutputFile, CommandOptions.ConvertHex)
+ TrimPreprocessedFile(InputFile, CommandOptions.OutputFile, CommandOptions.ConvertHex, CommandOptions.TrimLong)
except FatalError, X:
import platform
import traceback
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qh...@us...> - 2010-09-30 01:08:25
|
Revision: 2061
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2061&view=rev
Author: qhuang8
Date: 2010-09-30 01:08:19 +0000 (Thu, 30 Sep 2010)
Log Message:
-----------
1. Enhance Trim tool to handle #include statements in ASL file
2. Add workaround in trim tool to #undef MIN and MAX macro to avoid symbol collisions in Base.h (included by AutoGen.h)
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Trim/Trim.py
Modified: trunk/BaseTools/Source/Python/Trim/Trim.py
===================================================================
--- trunk/BaseTools/Source/Python/Trim/Trim.py 2010-09-28 22:33:07 UTC (rev 2060)
+++ trunk/BaseTools/Source/Python/Trim/Trim.py 2010-09-30 01:08:19 UTC (rev 2061)
@@ -40,6 +40,8 @@
gHexNumberPattern = re.compile("0[xX]([0-9a-fA-F]+)")
## 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
+gAslCIncludePattern = re.compile(r'^(\s*)#include\s*[<"]\s*([-\\/\w.]+)\s*[>"]', re.MULTILINE)
## Regular expression for matching constant with 'ULL' and 'UL', 'LL', 'L' postfix
gLongNumberPattern = re.compile("(0[xX][0-9a-fA-F]+|[0-9]+)U?LL", re.MULTILINE)
## Patterns used to convert EDK conventions to EDK2 ECP conventions
@@ -288,8 +290,10 @@
for Line in F:
Result = gAslIncludePattern.findall(Line)
if len(Result) == 0:
- NewFileContent.append("%s%s" % (Indent, Line))
- continue
+ Result = gAslCIncludePattern.findall(Line)
+ if len(Result) == 0 or os.path.splitext(Result[0][1])[1].lower() not in [".asl", ".asi"]:
+ NewFileContent.append("%s%s" % (Indent, Line))
+ continue
CurrentIndent = Indent + Result[0][0]
IncludedFile = Result[0][1]
NewFileContent.extend(DoInclude(IncludedFile, CurrentIndent))
@@ -319,6 +323,11 @@
Lines = DoInclude(Source)
os.chdir(Cwd)
+ #
+ # Undef MIN and MAX to avoid collision in ASL source code
+ #
+ Lines.insert(0, "#undef MIN\n#undef MAX\n")
+
# save all lines trimmed
try:
f = open (Target,'w')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qh...@us...> - 2010-10-13 01:16:15
|
Revision: 2066
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2066&view=rev
Author: qhuang8
Date: 2010-10-13 01:16:08 +0000 (Wed, 13 Oct 2010)
Log Message:
-----------
Update Trim tool to search local directory first for #include "XXX" in ASL
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Trim/Trim.py
Modified: trunk/BaseTools/Source/Python/Trim/Trim.py
===================================================================
--- trunk/BaseTools/Source/Python/Trim/Trim.py 2010-10-08 00:48:53 UTC (rev 2065)
+++ trunk/BaseTools/Source/Python/Trim/Trim.py 2010-10-13 01:16:08 UTC (rev 2066)
@@ -41,7 +41,7 @@
## 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
-gAslCIncludePattern = re.compile(r'^(\s*)#include\s*[<"]\s*([-\\/\w.]+)\s*[>"]', re.MULTILINE)
+gAslCIncludePattern = re.compile(r'^(\s*)#include\s*[<"]\s*([-\\/\w.]+)\s*([>"])', re.MULTILINE)
## Regular expression for matching constant with 'ULL' and 'UL', 'LL', 'L' postfix
gLongNumberPattern = re.compile("(0[xX][0-9a-fA-F]+|[0-9]+)U?LL", re.MULTILINE)
## Patterns used to convert EDK conventions to EDK2 ECP conventions
@@ -273,12 +273,23 @@
# @param Source File to be read
# @param Indent Spaces before the Include() statement
# @param IncludePathList The list of external include file
+# @param LocalSearchPath If LocalSearchPath is specified, this path will be searched
+# first for the included file; otherwise, only the path specified
+# in the IncludePathList will be searched.
#
-def DoInclude(Source, Indent='', IncludePathList=[]):
+def DoInclude(Source, Indent='', IncludePathList=[], LocalSearchPath=None):
NewFileContent = []
try:
- for IncludePath in IncludePathList:
+ #
+ # Search LocalSearchPath first if it is specified.
+ #
+ if LocalSearchPath:
+ SearchPathList = [LocalSearchPath] + IncludePathList
+ else:
+ SearchPathList = IncludePathList
+
+ for IncludePath in SearchPathList:
IncludeFile = os.path.join(IncludePath, Source)
if os.path.isfile(IncludeFile):
F = open(IncludeFile, "r")
@@ -298,15 +309,21 @@
gIncludedAslFile.append(IncludeFile)
for Line in F:
+ LocalSearchPath = None
Result = gAslIncludePattern.findall(Line)
if len(Result) == 0:
Result = gAslCIncludePattern.findall(Line)
if len(Result) == 0 or os.path.splitext(Result[0][1])[1].lower() not in [".asl", ".asi"]:
NewFileContent.append("%s%s" % (Indent, Line))
continue
+ #
+ # We should first search the local directory if current file are using pattern #include "XXX"
+ #
+ if Result[0][2] == '"':
+ LocalSearchPath = os.path.dirname(IncludeFile)
CurrentIndent = Indent + Result[0][0]
IncludedFile = Result[0][1]
- NewFileContent.extend(DoInclude(IncludedFile, CurrentIndent, IncludePathList))
+ NewFileContent.extend(DoInclude(IncludedFile, CurrentIndent, IncludePathList, LocalSearchPath))
NewFileContent.append("\n")
gIncludedAslFile.pop()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <js...@us...> - 2011-12-02 02:52:39
|
Revision: 2451
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2451&view=rev
Author: jsu1
Date: 2011-12-02 02:52:33 +0000 (Fri, 02 Dec 2011)
Log Message:
-----------
Fix trim issue that will excessively modify input files by converting number pattern arduously even they are within a token
Reviewed-by: gikidy
Reviewed-by: yingke
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-12-01 06:14:24 UTC (rev 2450)
+++ trunk/BaseTools/Source/Python/Trim/Trim.py 2011-12-02 02:52:33 UTC (rev 2451)
@@ -36,16 +36,23 @@
gTypedefPattern = re.compile("^\s*typedef\s+struct(\s+\w+)?\s*[{]*$", re.MULTILINE)
## Regular expression for matching "#pragma pack"
gPragmaPattern = re.compile("^\s*#pragma\s+pack", re.MULTILINE)
+
+#
+# The following number pattern match will only match if following criteria is met:
+# There is leading non-(alphanumeric or _) character, and no following alphanumeric or _
+# as the pattern is greedily match, so it is ok for the gDecNumberPattern or gHexNumberPattern to grab the maximum match
+#
## Regular expression for matching HEX number
-gHexNumberPattern = re.compile("(0[xX])([0-9a-fA-F]+)U?")
+gHexNumberPattern = re.compile("(?<=[^a-zA-Z0-9_])(0[xX])([0-9a-fA-F]+)(U(?=$|[^a-zA-Z0-9_]))?")
## Regular expression for matching decimal number with 'U' postfix
-gDecNumberPattern = re.compile("([0-9]+)U")
+gDecNumberPattern = re.compile("(?<=[^a-zA-Z0-9_])([0-9]+)U(?=$|[^a-zA-Z0-9_])")
+## Regular expression for matching constant with 'ULL' 'LL' postfix
+gLongNumberPattern = re.compile("(?<=[^a-zA-Z0-9_])(0[xX][0-9a-fA-F]+|[0-9]+)U?LL(?=$|[^a-zA-Z0-9_])")
+
## 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
gAslCIncludePattern = re.compile(r'^(\s*)#include\s*[<"]\s*([-\\/\w.]+)\s*([>"])', re.MULTILINE)
-## Regular expression for matching constant with 'ULL' and 'UL', 'LL', 'L' postfix
-gLongNumberPattern = re.compile("(0[xX][0-9a-fA-F]+|[0-9]+)U?LL", re.MULTILINE)
## Patterns used to convert EDK conventions to EDK2 ECP conventions
gImportCodePatterns = [
[
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|