X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FAutoGen%2FUniClassObject.py;h=58f865ed8bd4ce99e8e049e5789bcf3018741343;hp=ea27607fce6dbb668a37881748b972b13fec4351;hb=97fa0ee9b1cffbb4b97ee35365afa7afcf50e174;hpb=2bcc713e74b944bb5aefb433ef33fb4002a62d76
diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/Source/Python/AutoGen/UniClassObject.py
index ea27607fce..58f865ed8b 100644
--- a/BaseTools/Source/Python/AutoGen/UniClassObject.py
+++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py
@@ -1,4 +1,7 @@
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+## @file
+# This file is used to collect all defined strings in multiple uni files
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -7,20 +10,16 @@
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#This file is used to collect all defined strings in multiple uni files
-#
-
##
# Import Modules
#
-import os, codecs, re
+import Common.LongFilePathOs as os, codecs, re
import distutils.util
import Common.EdkLogger as EdkLogger
from Common.BuildToolError import *
from Common.String import GetLineNo
from Common.Misc import PathClass
-
+from Common.LongFilePathSupport import LongFilePath
##
# Static definitions
#
@@ -38,6 +37,9 @@ LF = u'\u000A'
NULL = u'\u0000'
TAB = u'\t'
BACK_SPLASH = u'\\'
+DOBULE_QUOTED_SPLASH = u'\\"'
+SIGLE_QUOTED_SPLASH = u"\\'"
+TAB_BACK_SLASH = u"\\/"
gIncludePattern = re.compile("^#include +[\"<]+([^\"< >]+)[>\"]+$", re.MULTILINE | re.UNICODE)
@@ -207,7 +209,7 @@ class UniFileClassObject(object):
Lang = distutils.util.split_quoted((Line.split(u"//")[0]))
if len(Lang) != 3:
try:
- FileIn = codecs.open(File.Path, mode='rb', encoding='utf-16').read()
+ FileIn = codecs.open(LongFilePath(File.Path), mode='rb', encoding='utf-16').read()
except UnicodeError, X:
EdkLogger.error("build", FILE_READ_FAILURE, "File read failure: %s" % str(X), ExtraData=File);
except:
@@ -289,7 +291,7 @@ class UniFileClassObject(object):
EdkLogger.error("Unicode File Parser", FILE_NOT_FOUND, ExtraData=File.Path)
try:
- FileIn = codecs.open(File.Path, mode='rb', encoding='utf-16').readlines()
+ FileIn = codecs.open(LongFilePath(File.Path), mode='rb', encoding='utf-16').readlines()
except UnicodeError, X:
EdkLogger.error("build", FILE_READ_FAILURE, "File read failure: %s" % str(X), ExtraData=File.Path);
except:
@@ -334,11 +336,11 @@ class UniFileClassObject(object):
Line = Line.replace(u'/language', u'#language')
Line = Line.replace(u'/include', u'#include')
+ Line = Line.replace(u'\\\\', u'\u0006')
Line = Line.replace(UNICODE_WIDE_CHAR, WIDE_CHAR)
Line = Line.replace(UNICODE_NARROW_CHAR, NARROW_CHAR)
Line = Line.replace(UNICODE_NON_BREAKING_CHAR, NON_BREAKING_CHAR)
- Line = Line.replace(u'\\\\', u'\u0006')
Line = Line.replace(u'\\r\\n', CR + LF)
Line = Line.replace(u'\\n', CR + LF)
Line = Line.replace(u'\\r', CR)
@@ -346,7 +348,10 @@ class UniFileClassObject(object):
Line = Line.replace(u'''\"''', u'''"''')
Line = Line.replace(u'\t', u' ')
Line = Line.replace(u'\u0006', u'\\')
-
+ Line = Line.replace(DOBULE_QUOTED_SPLASH, u'"')
+ Line = Line.replace(SIGLE_QUOTED_SPLASH, u"'")
+ Line = Line.replace(TAB_BACK_SLASH, u"/")
+
# if Line.find(u'\\x'):
# hex = Line[Line.find(u'\\x') + 2 : Line.find(u'\\x') + 6]
# hex = "u'\\u" + hex + "'"