summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r--BaseTools/Source/Python/Ecc/CodeFragmentCollector.py62
-rw-r--r--BaseTools/Source/Python/Ecc/Database.py54
-rw-r--r--BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py22
-rw-r--r--BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py47
-rw-r--r--BaseTools/Source/Python/Ecc/c.py15
5 files changed, 0 insertions, 200 deletions
diff --git a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
index d8d6aff..5bd3eec 100644
--- a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
+++ b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
@@ -74,8 +74,6 @@ class CodeFragmentCollector:
self.CurrentLineNumber = 1
self.CurrentOffsetWithinLine = 0
self.TokenReleaceList = []
- self.__Token = ""
- self.__SkippedChars = ""
## __EndOfFile() method
#
@@ -98,21 +96,6 @@ class CodeFragmentCollector:
else:
return False
- ## __EndOfLine() method
- #
- # Judge current buffer pos is at line end
- #
- # @param self The object pointer
- # @retval True Current File buffer position is at line end
- # @retval False Current File buffer position is NOT at line end
- #
- def __EndOfLine(self):
- SizeOfCurrentLine = len(self.Profile.FileLinesList[self.CurrentLineNumber - 1])
- if self.CurrentOffsetWithinLine >= SizeOfCurrentLine - 1:
- return True
- else:
- return False
-
## Rewind() method
#
# Reset file data buffer to the initial state
@@ -123,25 +106,6 @@ class CodeFragmentCollector:
self.CurrentLineNumber = 1
self.CurrentOffsetWithinLine = 0
- ## __UndoOneChar() method
- #
- # Go back one char in the file buffer
- #
- # @param self The object pointer
- # @retval True Successfully go back one char
- # @retval False Not able to go back one char as file beginning reached
- #
- def __UndoOneChar(self):
-
- if self.CurrentLineNumber == 1 and self.CurrentOffsetWithinLine == 0:
- return False
- elif self.CurrentOffsetWithinLine == 0:
- self.CurrentLineNumber -= 1
- self.CurrentOffsetWithinLine = len(self.__CurrentLine()) - 1
- else:
- self.CurrentOffsetWithinLine -= 1
- return True
-
## __GetOneChar() method
#
# Move forward one char in the file buffer
@@ -211,32 +175,6 @@ class CodeFragmentCollector:
def __CurrentLine(self):
return self.Profile.FileLinesList[self.CurrentLineNumber - 1]
- ## __InsertComma() method
- #
- # Insert ',' to replace PP
- #
- # @param self The object pointer
- # @retval List current line contents
- #
- def __InsertComma(self, Line):
-
-
- if self.Profile.FileLinesList[Line - 1][0] != T_CHAR_HASH:
- BeforeHashPart = str(self.Profile.FileLinesList[Line - 1]).split(T_CHAR_HASH)[0]
- if BeforeHashPart.rstrip().endswith(T_CHAR_COMMA) or BeforeHashPart.rstrip().endswith(';'):
- return
-
- if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(','):
- return
-
- if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(';'):
- return
-
- if str(self.Profile.FileLinesList[Line]).lstrip().startswith(',') or str(self.Profile.FileLinesList[Line]).lstrip().startswith(';'):
- return
-
- self.Profile.FileLinesList[Line - 1].insert(self.CurrentOffsetWithinLine, ',')
-
## PreprocessFile() method
#
# Preprocess file contents, replace comments with spaces.
diff --git a/BaseTools/Source/Python/Ecc/Database.py b/BaseTools/Source/Python/Ecc/Database.py
index a5b70c5..f31dd93 100644
--- a/BaseTools/Source/Python/Ecc/Database.py
+++ b/BaseTools/Source/Python/Ecc/Database.py
@@ -78,7 +78,6 @@ class Database(object):
self.Conn.execute("PRAGMA page_size=4096")
self.Conn.execute("PRAGMA synchronous=OFF")
# to avoid non-ascii character conversion error
- self.Conn.text_factory = str
self.Cur = self.Conn.cursor()
self.TblDataModel = TableDataModel(self.Cur)
@@ -211,59 +210,6 @@ class Database(object):
# Update the field "BelongsToFunction" for each Identifier
#
#
- def UpdateIdentifierBelongsToFunction_disabled(self):
- EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers started ...")
-
- SqlCommand = """select ID, BelongsToFile, StartLine, EndLine, Model from Identifier"""
- EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
- self.Cur.execute(SqlCommand)
- Records = self.Cur.fetchall()
- for Record in Records:
- IdentifierID = Record[0]
- BelongsToFile = Record[1]
- StartLine = Record[2]
- EndLine = Record[3]
- Model = Record[4]
-
- #
- # Check whether an identifier belongs to a function
- #
- EdkLogger.debug(4, "For common identifiers ... ")
- SqlCommand = """select ID from Function
- where StartLine < %s and EndLine > %s
- and BelongsToFile = %s""" % (StartLine, EndLine, BelongsToFile)
- EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
- self.Cur.execute(SqlCommand)
- IDs = self.Cur.fetchall()
- for ID in IDs:
- SqlCommand = """Update Identifier set BelongsToFunction = %s where ID = %s""" % (ID[0], IdentifierID)
- EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
- self.Cur.execute(SqlCommand)
-
- #
- # Check whether the identifier is a function header
- #
- EdkLogger.debug(4, "For function headers ... ")
- if Model == DataClass.MODEL_IDENTIFIER_COMMENT:
- SqlCommand = """select ID from Function
- where StartLine = %s + 1
- and BelongsToFile = %s""" % (EndLine, BelongsToFile)
- EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
- self.Cur.execute(SqlCommand)
- IDs = self.Cur.fetchall()
- for ID in IDs:
- SqlCommand = """Update Identifier set BelongsToFunction = %s, Model = %s where ID = %s""" % (ID[0], DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER, IdentifierID)
- EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
- self.Cur.execute(SqlCommand)
-
- EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers ... DONE")
-
-
- ## UpdateIdentifierBelongsToFunction
- #
- # Update the field "BelongsToFunction" for each Identifier
- #
- #
def UpdateIdentifierBelongsToFunction(self):
EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers started ...")
diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
index 1d7f6eb..552344e 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
@@ -139,12 +139,6 @@ class Table(object):
def SetEndFlag(self):
pass
- def IsIntegral(self):
- Result = self.Exec("select min(ID) from %s" % (self.Table))
- if Result[0][0] != -1:
- return False
- return True
-
def GetAll(self):
return self.Exec("select * from %s where ID > 0 order by ID" % (self.Table))
@@ -195,19 +189,3 @@ class TableDataModel(Table):
self.Insert(CrossIndex, Name, Description)
EdkLogger.verbose("Initialize table DataModel ... DONE!")
- ## Get CrossIndex
- #
- # Get a model's cross index from its name
- #
- # @param ModelName: Name of the model
- # @retval CrossIndex: CrossIndex of the model
- #
- def GetCrossIndex(self, ModelName):
- CrossIndex = -1
- SqlCommand = """select CrossIndex from DataModel where name = '""" + ModelName + """'"""
- self.Cur.execute(SqlCommand)
- for Item in self.Cur:
- CrossIndex = Item[0]
-
- return CrossIndex
-
diff --git a/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py b/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py
index b02f663..1428afe 100644
--- a/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py
+++ b/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py
@@ -132,37 +132,6 @@ def XmlElement(Dom, String):
except:
return ""
-
-## Get a single XML element of the current node.
-#
-# Return a single XML element specified by the current root Dom.
-# If the input Dom is not valid, then an empty string is returned.
-#
-# @param Dom The root XML DOM object.
-#
-# @revel Element An XML element in current root Dom.
-#
-def XmlElementData(Dom):
- try:
- return Dom.firstChild.data.strip()
- except:
- return ""
-
-
-## Get a list of XML elements using XPath style syntax.
-#
-# Return a list of XML elements from the root Dom specified by XPath String.
-# If the input Dom or String is not valid, then an empty list is returned.
-#
-# @param Dom The root XML DOM object.
-# @param String A XPath style path.
-#
-# @revel Elements A list of XML elements matching XPath style Sting.
-#
-def XmlElementList(Dom, String):
- return map(XmlElementData, XmlList(Dom, String))
-
-
## Get the XML attribute of the current node.
#
# Return a single XML attribute named Attribute from the current root Dom.
@@ -179,22 +148,6 @@ def XmlAttribute(Dom, Attribute):
except:
return ''
-
-## Get the XML node name of the current node.
-#
-# Return a single XML node name from the current root Dom.
-# If the input Dom is not valid, then an empty string is returned.
-#
-# @param Dom The root XML DOM object.
-#
-# @revel Element A single XML element matching XPath style Sting.
-#
-def XmlNodeName(Dom):
- try:
- return Dom.nodeName.strip()
- except:
- return ''
-
## Parse an XML file.
#
# Parse the input XML file named FileName and return a XML DOM it stands for.
diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index 8e45c07..a6b9076 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -49,9 +49,6 @@ def GetTypedefFuncPointerPattern():
def GetDB():
return EccGlobalData.gDb
-def GetConfig():
- return EccGlobalData.gConfig
-
def PrintErrorMsg(ErrorType, Msg, TableName, ItemId):
Msg = Msg.replace('\n', '').replace('\r', '')
MsgPartList = Msg.split()
@@ -481,18 +478,6 @@ def GetFunctionList():
return FuncObjList
-def GetFileModificationTimeFromDB(FullFileName):
- TimeValue = 0.0
- Db = GetDB()
- SqlStatement = """ select TimeStamp
- from File
- where FullPath = \'%s\'
- """ % (FullFileName)
- ResultSet = Db.TblFile.Exec(SqlStatement)
- for Result in ResultSet:
- TimeValue = Result[0]
- return TimeValue
-
def CollectSourceCodeDataIntoDB(RootDir):
FileObjList = []
tuple = os.walk(RootDir)