Commit | Line | Data |
---|---|---|
52302d4d LG |
1 | ## @file\r |
2 | # fragments of source file\r | |
3 | #\r | |
1be2ed90 | 4 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r |
52302d4d | 5 | #\r |
40d841f6 | 6 | # This program and the accompanying materials\r |
52302d4d 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 | |
19 | import re\r | |
1be2ed90 | 20 | import Common.LongFilePathOs as os\r |
52302d4d | 21 | from ParserWarning import Warning\r |
1be2ed90 | 22 | from Common.LongFilePathSupport import OpenLongFilePath as open\r |
52302d4d LG |
23 | \r |
24 | # Profile contents of a file\r | |
25 | PPDirectiveList = []\r | |
26 | AssignmentExpressionList = []\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 | ## Class FileProfile\r | |
36 | #\r | |
37 | # record file data when parsing source\r | |
38 | #\r | |
39 | # May raise Exception when opening file.\r | |
40 | #\r | |
41 | class FileProfile :\r | |
42 | \r | |
43 | ## The constructor\r | |
44 | #\r | |
45 | # @param self: The object pointer\r | |
46 | # @param FileName: The file that to be parsed\r | |
47 | #\r | |
48 | def __init__(self, FileName):\r | |
49 | self.FileLinesList = []\r | |
50 | self.FileLinesListFromFile = []\r | |
51 | try:\r | |
52 | fsock = open(FileName, "rb", 0)\r | |
53 | try:\r | |
54 | self.FileLinesListFromFile = fsock.readlines()\r | |
55 | finally:\r | |
56 | fsock.close()\r | |
57 | \r | |
58 | except IOError:\r | |
59 | raise Warning("Error when opening file %s" % FileName)\r |