]>
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 # This program and the accompanying materials are licensed and made available
8 # under the terms and conditions of the BSD License which accompanies this
9 # distribution. The full text of the license may be found at
10 # http://opensource.org/licenses/bsd-license.php
12 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 import Logger
.Log
as Logger
20 from Logger
import ToolError
22 from Library
import DataType
as DT
23 from Object
.Parser
.InfCommonObject
import InfSectionCommonDef
24 from Library
.Misc
import Sdict
29 class InfBootModeObject():
31 self
.SupportedBootModes
= ''
35 def SetSupportedBootModes(self
, SupportedBootModes
):
36 self
.SupportedBootModes
= SupportedBootModes
37 def GetSupportedBootModes(self
):
38 return self
.SupportedBootModes
40 def SetHelpString(self
, HelpString
):
41 self
.HelpString
= HelpString
42 def GetHelpString(self
):
43 return self
.HelpString
45 def SetUsage(self
, Usage
):
52 class InfEventObject():
58 def SetEventType(self
, EventType
):
59 self
.EventType
= EventType
61 def GetEventType(self
):
64 def SetHelpString(self
, HelpString
):
65 self
.HelpString
= HelpString
66 def GetHelpString(self
):
67 return self
.HelpString
69 def SetUsage(self
, Usage
):
83 def SetHobType(self
, HobType
):
84 self
.HobType
= HobType
89 def SetUsage(self
, Usage
):
94 def SetSupArchList(self
, ArchList
):
95 self
.SupArchList
= ArchList
96 def GetSupArchList(self
):
97 return self
.SupArchList
99 def SetHelpString(self
, HelpString
):
100 self
.HelpString
= HelpString
101 def GetHelpString(self
):
102 return self
.HelpString
105 # InfSpecialCommentObject
107 class InfSpecialCommentObject(InfSectionCommonDef
):
109 self
.SpecialComments
= Sdict()
110 InfSectionCommonDef
.__init
__(self
)
112 def SetSpecialComments(self
, SepcialSectionList
= None, Type
= ''):
113 if Type
== DT
.TYPE_HOB_SECTION
or \
114 Type
== DT
.TYPE_EVENT_SECTION
or \
115 Type
== DT
.TYPE_BOOTMODE_SECTION
:
116 for Item
in SepcialSectionList
:
117 if Type
in self
.SpecialComments
:
118 ObjList
= self
.SpecialComments
[Type
]
120 self
.SpecialComments
[Type
] = ObjList
124 self
.SpecialComments
[Type
] = ObjList
128 def GetSpecialComments(self
):
129 return self
.SpecialComments
135 # An encapsulate of Error for INF parser.
137 def ErrorInInf(Message
=None, ErrorCode
=None, LineInfo
=None, RaiseError
=True):
138 if ErrorCode
is None:
139 ErrorCode
= ToolError
.FORMAT_INVALID
141 LineInfo
= ['', -1, '']
142 Logger
.Error("InfParser",
147 ExtraData
=LineInfo
[2],
148 RaiseError
=RaiseError
)