]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/Python/Ecc/FileProfile.py
BaseTools: Use absolute import in Ecc
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / FileProfile.py
CommitLineData
30fdf114
LG
1## @file\r
2# fragments of source file\r
3#\r
f7496d71 4# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
30fdf114 5#\r
40d841f6 6# This program and the accompanying materials\r
30fdf114
LG
7# are licensed and made available under the terms and conditions of the BSD License\r
8# which accompanies this distribution. The full text of the license may be found at\r
9# http://opensource.org/licenses/bsd-license.php\r
10#\r
11# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13#\r
14\r
15##\r
16# Import Modules\r
17#\r
18\r
b6f6b636 19from __future__ import absolute_import\r
30fdf114 20import re\r
1be2ed90 21import Common.LongFilePathOs as os\r
b6f6b636 22from .ParserWarning import Warning\r
1be2ed90 23from Common.LongFilePathSupport import OpenLongFilePath as open\r
30fdf114
LG
24\r
25CommentList = []\r
26PPDirectiveList = []\r
27PredicateExpressionList = []\r
28FunctionDefinitionList = []\r
29VariableDeclarationList = []\r
30EnumerationDefinitionList = []\r
31StructUnionDefinitionList = []\r
32TypedefDefinitionList = []\r
33FunctionCallingList = []\r
34\r
35## record file data when parsing source\r
36#\r
37# May raise Exception when opening file.\r
38#\r
39class FileProfile :\r
f7496d71 40\r
30fdf114
LG
41 ## The constructor\r
42 #\r
43 # @param self The object pointer\r
44 # @param FileName The file that to be parsed\r
45 #\r
46 def __init__(self, FileName):\r
47 self.FileLinesList = []\r
48 self.FileLinesListFromFile = []\r
49 try:\r
50 fsock = open(FileName, "rb", 0)\r
51 try:\r
52 self.FileLinesListFromFile = fsock.readlines()\r
53 finally:\r
54 fsock.close()\r
55\r
56 except IOError:\r
57 raise Warning("Error when opening file %s" % FileName)\r