]>
Commit | Line | Data |
---|---|---|
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 | 19 | from __future__ import absolute_import\r |
30fdf114 | 20 | import re\r |
1be2ed90 | 21 | import Common.LongFilePathOs as os\r |
855698fb | 22 | from Ecc.ParserWarning import Warning\r |
1be2ed90 | 23 | from Common.LongFilePathSupport import OpenLongFilePath as open\r |
30fdf114 LG |
24 | \r |
25 | CommentList = []\r | |
26 | PPDirectiveList = []\r | |
27 | PredicateExpressionList = []\r | |
28 | FunctionDefinitionList = []\r | |
29 | VariableDeclarationList = []\r | |
30 | EnumerationDefinitionList = []\r | |
31 | StructUnionDefinitionList = []\r | |
32 | TypedefDefinitionList = []\r | |
33 | FunctionCallingList = []\r | |
34 | \r | |
35 | ## record file data when parsing source\r | |
36 | #\r | |
37 | # May raise Exception when opening file.\r | |
38 | #\r | |
39 | class 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 | |
c60377d7 | 50 | fsock = open(FileName, "r")\r |
30fdf114 LG |
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 |