]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Ecc/FileProfile.py
Check In tool source code based on Build tool project revision r1655.
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / FileProfile.py
diff --git a/BaseTools/Source/Python/Ecc/FileProfile.py b/BaseTools/Source/Python/Ecc/FileProfile.py
new file mode 100644 (file)
index 0000000..810087e
--- /dev/null
@@ -0,0 +1,57 @@
+## @file\r
+# fragments of source file\r
+#\r
+#  Copyright (c) 2007, Intel Corporation\r
+#\r
+#  All rights reserved. This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution.  The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+\r
+##\r
+# Import Modules\r
+#\r
+\r
+import re\r
+import os\r
+from ParserWarning import Warning\r
+\r
+CommentList = []\r
+PPDirectiveList = []\r
+PredicateExpressionList = []\r
+FunctionDefinitionList = []\r
+VariableDeclarationList = []\r
+EnumerationDefinitionList = []\r
+StructUnionDefinitionList = []\r
+TypedefDefinitionList = []\r
+FunctionCallingList = []\r
+\r
+## record file data when parsing source\r
+#\r
+# May raise Exception when opening file.\r
+#\r
+class FileProfile :\r
+    \r
+    ## The constructor\r
+    #\r
+    #   @param  self        The object pointer\r
+    #   @param  FileName    The file that to be parsed\r
+    #\r
+    def __init__(self, FileName):\r
+        self.FileLinesList = []\r
+        self.FileLinesListFromFile = []\r
+        try:\r
+            fsock = open(FileName, "rb", 0)\r
+            try:\r
+                self.FileLinesListFromFile = fsock.readlines()\r
+            finally:\r
+                fsock.close()\r
+\r
+        except IOError:\r
+            raise Warning("Error when opening file %s" % FileName)\r
+        \r
+        
\ No newline at end of file