]>
Commit | Line | Data |
---|---|---|
52302d4d LG |
1 | ## @file\r |
2 | # fragments of source file\r | |
3 | #\r | |
40d841f6 | 4 | # Copyright (c) 2007 - 2010, 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 | |
20 | import os\r | |
21 | from ParserWarning import Warning\r | |
22 | \r | |
23 | # Profile contents of a file\r | |
24 | PPDirectiveList = []\r | |
25 | AssignmentExpressionList = []\r | |
26 | PredicateExpressionList = []\r | |
27 | FunctionDefinitionList = []\r | |
28 | VariableDeclarationList = []\r | |
29 | EnumerationDefinitionList = []\r | |
30 | StructUnionDefinitionList = []\r | |
31 | TypedefDefinitionList = []\r | |
32 | FunctionCallingList = []\r | |
33 | \r | |
34 | ## Class FileProfile\r | |
35 | #\r | |
36 | # record file data when parsing source\r | |
37 | #\r | |
38 | # May raise Exception when opening file.\r | |
39 | #\r | |
40 | class FileProfile :\r | |
41 | \r | |
42 | ## The constructor\r | |
43 | #\r | |
44 | # @param self: The object pointer\r | |
45 | # @param FileName: The file that to be parsed\r | |
46 | #\r | |
47 | def __init__(self, FileName):\r | |
48 | self.FileLinesList = []\r | |
49 | self.FileLinesListFromFile = []\r | |
50 | try:\r | |
51 | fsock = open(FileName, "rb", 0)\r | |
52 | try:\r | |
53 | self.FileLinesListFromFile = fsock.readlines()\r | |
54 | finally:\r | |
55 | fsock.close()\r | |
56 | \r | |
57 | except IOError:\r | |
58 | raise Warning("Error when opening file %s" % FileName)\r |