summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/UPT/Library/Misc.py
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-11-25 06:21:03 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-11-25 06:21:03 +0000
commit2bcc713e74b944bb5aefb433ef33fb4002a62d76 (patch)
tree7aa002279415c1fafbedbf287d256177746e0a4a /BaseTools/Source/Python/UPT/Library/Misc.py
parentc32dcd284c19bbb0b1db3606a243d9d69d37d6ab (diff)
downloadedk2-platforms-2bcc713e74b944bb5aefb433ef33fb4002a62d76.tar.xz
Sync BaseTool trunk (version r2423) into EDKII BaseTools. The change mainly includes:
1. Fix !include issues 2. Fix Trim to skip the postfix 'U' for hexadecimal and decimal numbers 3. Fix building error C2733 when building C++ code. 4. Add GCC46 tool chain definition 5. Add new RVCT and RVCTLINUX tool chains Signed-off-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12782 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/UPT/Library/Misc.py')
-rw-r--r--BaseTools/Source/Python/UPT/Library/Misc.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/UPT/Library/Misc.py b/BaseTools/Source/Python/UPT/Library/Misc.py
index 658c4e0cfb..b67cd102d1 100644
--- a/BaseTools/Source/Python/UPT/Library/Misc.py
+++ b/BaseTools/Source/Python/UPT/Library/Misc.py
@@ -834,6 +834,59 @@ def ProcessLineExtender(LineList):
return NewList
+## ProcessEdkComment
+#
+# Process EDK style comment in LineList: c style /* */ comment or cpp style // comment
+#
+#
+# @param LineList The LineList need to be processed.
+#
+# @return LineList The LineList been processed.
+# @return FirstPos Where Edk comment is first found, -1 if not found
+#
+def ProcessEdkComment(LineList):
+ FindEdkBlockComment = False
+ Count = 0
+ StartPos = -1
+ EndPos = -1
+ FirstPos = -1
+
+ while(Count < len(LineList)):
+ Line = LineList[Count].strip()
+ if Line.startswith("/*"):
+ #
+ # handling c style comment
+ #
+ StartPos = Count
+ while Count < len(LineList):
+ Line = LineList[Count].strip()
+ if Line.endswith("*/"):
+ if (Count == StartPos) and Line.strip() == '/*/':
+ Count = Count + 1
+ continue
+ EndPos = Count
+ FindEdkBlockComment = True
+ break
+ Count = Count + 1
+
+ if FindEdkBlockComment:
+ if FirstPos == -1:
+ FirstPos = StartPos
+ for Index in xrange(StartPos, EndPos+1):
+ LineList[Index] = ''
+ FindEdkBlockComment = False
+ elif Line.find("//") != -1:
+ #
+ # handling cpp style comment
+ #
+ LineList[Count] = Line.replace("//", '#')
+ if FirstPos == -1:
+ FirstPos = Count
+
+ Count = Count + 1
+
+ return LineList, FirstPos
+
## GetLibInstanceInfo
#
# Get the information from Library Instance INF file.