]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/Python/Eot/FileProfile.py
There is a limitation on WINDOWS OS for the length of entire file path can’t be large...
[mirror_edk2.git] / BaseTools / Source / Python / Eot / FileProfile.py
CommitLineData
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
19import re\r
1be2ed90 20import Common.LongFilePathOs as os\r
52302d4d 21from ParserWarning import Warning\r
1be2ed90 22from Common.LongFilePathSupport import OpenLongFilePath as open\r
52302d4d
LG
23\r
24# Profile contents of a file\r
25PPDirectiveList = []\r
26AssignmentExpressionList = []\r
27PredicateExpressionList = []\r
28FunctionDefinitionList = []\r
29VariableDeclarationList = []\r
30EnumerationDefinitionList = []\r
31StructUnionDefinitionList = []\r
32TypedefDefinitionList = []\r
33FunctionCallingList = []\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
41class 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