diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-05-11 10:26:49 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-05-11 10:26:49 +0000 |
commit | da92f27632d2c89fa8726948ac9b02461ca8b61e (patch) | |
tree | 5d81f058c42e5be0d57287a7ddd8e3e4325eda7a /BaseTools/Source/Python/AutoGen/UniClassObject.py | |
parent | e472e8d3cca67f5e058f26fb6edc214b01114a3c (diff) | |
download | edk2-da92f27632d2c89fa8726948ac9b02461ca8b61e.tar.gz edk2-da92f27632d2c89fa8726948ac9b02461ca8b61e.tar.bz2 edk2-da92f27632d2c89fa8726948ac9b02461ca8b61e.zip |
Sync BaseTools Branch (version r2149) to EDKII main trunk.
BaseTool Branch:
https://edk2-buildtools.svn.sourceforge.net/svnroot/edk2-buildtools/branches/Releases/BaseTools_r2100
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11640 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/UniClassObject.py')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/UniClassObject.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/Source/Python/AutoGen/UniClassObject.py index 1eb65c1e9a..1825c81d91 100644 --- a/BaseTools/Source/Python/AutoGen/UniClassObject.py +++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py @@ -121,7 +121,7 @@ def GetLanguageCode(LangName, IsCompatibleMode, File): if length == 3 and LangName.isalpha():
TempLangName = LangConvTable.get(LangName.lower())
if TempLangName != None:
- return TempLangName
+ return TempLangName
return LangName
else:
EdkLogger.error("Unicode File Parser", FORMAT_INVALID, "Invalid ISO 639-2 language code : %s" % LangName, File)
@@ -298,13 +298,36 @@ class UniFileClassObject(object): #
# Use unique identifier
#
+ FindFlag = -1
+ LineCount = 0
for Line in FileIn:
+ Line = FileIn[LineCount]
+ LineCount += 1
Line = Line.strip()
#
# Ignore comment line and empty line
#
if Line == u'' or Line.startswith(u'//'):
continue
+
+ #
+ # Process comment embeded in string define lines
+ #
+ FindFlag = Line.find(u'//')
+ if FindFlag != -1:
+ Line = Line.replace(Line[FindFlag:], u' ')
+ if FileIn[LineCount].strip().startswith('#language'):
+ Line = Line + FileIn[LineCount]
+ FileIn[LineCount-1] = Line
+ FileIn[LineCount] = os.linesep
+ LineCount -= 1
+ for Index in xrange (LineCount + 1, len (FileIn) - 1):
+ if (Index == len(FileIn) -1):
+ FileIn[Index] = os.linesep
+ else:
+ FileIn[Index] = FileIn[Index + 1]
+ continue
+
Line = Line.replace(u'/langdef', u'#langdef')
Line = Line.replace(u'/string', u'#string')
Line = Line.replace(u'/language', u'#language')
@@ -566,6 +589,6 @@ class UniFileClassObject(object): if __name__ == '__main__':
EdkLogger.Initialize()
EdkLogger.SetLevel(EdkLogger.DEBUG_0)
- a = UniFileClassObject(['C:\\Edk\\Strings.uni', 'C:\\Edk\\Strings2.uni'])
+ a = UniFileClassObject([PathClass("C:\\Edk\\Strings.uni"), PathClass("C:\\Edk\\Strings2.uni")])
a.ReToken()
a.ShowMe()
|