]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py
2 # This file is used to define class objects of INF file miscellaneous.
3 # Include BootMode/HOB/Event and others. It will consumed by InfParser.
5 # Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
7 # SPDX-License-Identifier: BSD-2-Clause-Patent
13 import Logger
.Log
as Logger
14 from Logger
import ToolError
16 from Library
import DataType
as DT
17 from Object
.Parser
.InfCommonObject
import InfSectionCommonDef
18 from Library
.Misc
import Sdict
23 class InfBootModeObject():
25 self
.SupportedBootModes
= ''
29 def SetSupportedBootModes(self
, SupportedBootModes
):
30 self
.SupportedBootModes
= SupportedBootModes
31 def GetSupportedBootModes(self
):
32 return self
.SupportedBootModes
34 def SetHelpString(self
, HelpString
):
35 self
.HelpString
= HelpString
36 def GetHelpString(self
):
37 return self
.HelpString
39 def SetUsage(self
, Usage
):
46 class InfEventObject():
52 def SetEventType(self
, EventType
):
53 self
.EventType
= EventType
55 def GetEventType(self
):
58 def SetHelpString(self
, HelpString
):
59 self
.HelpString
= HelpString
60 def GetHelpString(self
):
61 return self
.HelpString
63 def SetUsage(self
, Usage
):
77 def SetHobType(self
, HobType
):
78 self
.HobType
= HobType
83 def SetUsage(self
, Usage
):
88 def SetSupArchList(self
, ArchList
):
89 self
.SupArchList
= ArchList
90 def GetSupArchList(self
):
91 return self
.SupArchList
93 def SetHelpString(self
, HelpString
):
94 self
.HelpString
= HelpString
95 def GetHelpString(self
):
96 return self
.HelpString
99 # InfSpecialCommentObject
101 class InfSpecialCommentObject(InfSectionCommonDef
):
103 self
.SpecialComments
= Sdict()
104 InfSectionCommonDef
.__init
__(self
)
106 def SetSpecialComments(self
, SepcialSectionList
= None, Type
= ''):
107 if Type
== DT
.TYPE_HOB_SECTION
or \
108 Type
== DT
.TYPE_EVENT_SECTION
or \
109 Type
== DT
.TYPE_BOOTMODE_SECTION
:
110 for Item
in SepcialSectionList
:
111 if Type
in self
.SpecialComments
:
112 ObjList
= self
.SpecialComments
[Type
]
114 self
.SpecialComments
[Type
] = ObjList
118 self
.SpecialComments
[Type
] = ObjList
122 def GetSpecialComments(self
):
123 return self
.SpecialComments
129 # An encapsulate of Error for INF parser.
131 def ErrorInInf(Message
=None, ErrorCode
=None, LineInfo
=None, RaiseError
=True):
132 if ErrorCode
is None:
133 ErrorCode
= ToolError
.FORMAT_INVALID
135 LineInfo
= ['', -1, '']
136 Logger
.Error("InfParser",
141 ExtraData
=LineInfo
[2],
142 RaiseError
=RaiseError
)