]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Eot/FileProfile.py
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / BaseTools / Source / Python / Eot / FileProfile.py
1 ## @file
2 # fragments of source file
3 #
4 # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
5 #
6 # SPDX-License-Identifier: BSD-2-Clause-Patent
7 #
8
9 ##
10 # Import Modules
11 #
12
13 from __future__ import absolute_import
14 import re
15 import Common.LongFilePathOs as os
16 from .ParserWarning import Warning
17 from Common.LongFilePathSupport import OpenLongFilePath as open
18
19 # Profile contents of a file
20 PPDirectiveList = []
21 AssignmentExpressionList = []
22 PredicateExpressionList = []
23 FunctionDefinitionList = []
24 VariableDeclarationList = []
25 EnumerationDefinitionList = []
26 StructUnionDefinitionList = []
27 TypedefDefinitionList = []
28 FunctionCallingList = []
29
30 ## Class FileProfile
31 #
32 # record file data when parsing source
33 #
34 # May raise Exception when opening file.
35 #
36 class FileProfile :
37
38 ## The constructor
39 #
40 # @param self: The object pointer
41 # @param FileName: The file that to be parsed
42 #
43 def __init__(self, FileName):
44 self.FileLinesList = []
45 self.FileLinesListFromFile = []
46 try:
47 fsock = open(FileName, "rb", 0)
48 try:
49 self.FileLinesListFromFile = fsock.readlines()
50 finally:
51 fsock.close()
52
53 except IOError:
54 raise Warning("Error when opening file %s" % FileName)