]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Common/InfClassObject.py
e774d80d697b0489f3ce54fda35e0d7487e2003e
[mirror_edk2.git] / BaseTools / Source / Python / Common / InfClassObject.py
1 ## @file
2 # This file is used to define each component of INF file
3 #
4 # Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
5 # This program and the accompanying materials
6 # are licensed and made available under the terms and conditions of the BSD License
7 # which accompanies this distribution. The full text of the license may be found at
8 # http://opensource.org/licenses/bsd-license.php
9 #
10 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 #
13
14 ##
15 # Import Modules
16 #
17 import os
18 import re
19 import EdkLogger
20 from CommonDataClass.CommonClass import LibraryClassClass
21 from CommonDataClass.ModuleClass import *
22 from String import *
23 from DataType import *
24 from Identification import *
25 from Dictionary import *
26 from BuildToolError import *
27 from Misc import sdict
28 import GlobalData
29 from Table.TableInf import TableInf
30 import Database
31 from Parsing import *
32
33 #
34 # Global variable
35 #
36 Section = {TAB_UNKNOWN.upper() : MODEL_UNKNOWN,
37 TAB_INF_DEFINES.upper() : MODEL_META_DATA_HEADER,
38 TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION,
39 TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE,
40 TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE,
41 TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS,
42 TAB_PACKAGES.upper() : MODEL_META_DATA_PACKAGE,
43 TAB_NMAKE.upper() : MODEL_META_DATA_NMAKE,
44 TAB_INF_FIXED_PCD.upper() : MODEL_PCD_FIXED_AT_BUILD,
45 TAB_INF_PATCH_PCD.upper() : MODEL_PCD_PATCHABLE_IN_MODULE,
46 TAB_INF_FEATURE_PCD.upper() : MODEL_PCD_FEATURE_FLAG,
47 TAB_INF_PCD_EX.upper() : MODEL_PCD_DYNAMIC_EX,
48 TAB_INF_PCD.upper() : MODEL_PCD_DYNAMIC,
49 TAB_SOURCES.upper() : MODEL_EFI_SOURCE_FILE,
50 TAB_GUIDS.upper() : MODEL_EFI_GUID,
51 TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL,
52 TAB_PPIS.upper() : MODEL_EFI_PPI,
53 TAB_DEPEX.upper() : MODEL_EFI_DEPEX,
54 TAB_BINARIES.upper() : MODEL_EFI_BINARY_FILE,
55 TAB_USER_EXTENSIONS.upper() : MODEL_META_DATA_USER_EXTENSION
56 }
57
58 gComponentType2ModuleType = {
59 "LIBRARY" : "BASE",
60 "SECURITY_CORE" : "SEC",
61 "PEI_CORE" : "PEI_CORE",
62 "COMBINED_PEIM_DRIVER" : "PEIM",
63 "PIC_PEIM" : "PEIM",
64 "RELOCATABLE_PEIM" : "PEIM",
65 "PE32_PEIM" : "PEIM",
66 "BS_DRIVER" : "DXE_DRIVER",
67 "RT_DRIVER" : "DXE_RUNTIME_DRIVER",
68 "SAL_RT_DRIVER" : "DXE_SAL_DRIVER",
69 "APPLICATION" : "UEFI_APPLICATION",
70 "LOGO" : "BASE",
71 }
72
73 gNmakeFlagPattern = re.compile("(?:EBC_)?([A-Z]+)_(?:STD_|PROJ_|ARCH_)?FLAGS(?:_DLL|_ASL|_EXE)?", re.UNICODE)
74 gNmakeFlagName2ToolCode = {
75 "C" : "CC",
76 "LIB" : "SLINK",
77 "LINK" : "DLINK",
78 }
79
80 class InfHeader(ModuleHeaderClass):
81 _Mapping_ = {
82 #
83 # Required Fields
84 #
85 TAB_INF_DEFINES_BASE_NAME : "Name",
86 TAB_INF_DEFINES_FILE_GUID : "Guid",
87 TAB_INF_DEFINES_MODULE_TYPE : "ModuleType",
88 TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION : "UefiSpecificationVersion",
89 TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION : "UefiSpecificationVersion",
90 TAB_INF_DEFINES_EDK_RELEASE_VERSION : "EdkReleaseVersion",
91 #
92 # Optional Fields
93 #
94 TAB_INF_DEFINES_INF_VERSION : "InfVersion",
95 TAB_INF_DEFINES_BINARY_MODULE : "BinaryModule",
96 TAB_INF_DEFINES_COMPONENT_TYPE : "ComponentType",
97 TAB_INF_DEFINES_MAKEFILE_NAME : "MakefileName",
98 TAB_INF_DEFINES_BUILD_NUMBER : "BuildNumber",
99 TAB_INF_DEFINES_BUILD_TYPE : "BuildType",
100 TAB_INF_DEFINES_FFS_EXT : "FfsExt",
101 TAB_INF_DEFINES_FV_EXT : "FvExt",
102 TAB_INF_DEFINES_SOURCE_FV : "SourceFv",
103 TAB_INF_DEFINES_VERSION_NUMBER : "VersionNumber",
104 TAB_INF_DEFINES_VERSION_STRING : "VersionString",
105 TAB_INF_DEFINES_VERSION : "Version",
106 TAB_INF_DEFINES_PCD_IS_DRIVER : "PcdIsDriver",
107 TAB_INF_DEFINES_TIANO_R8_FLASHMAP_H : "TianoR8FlashMap_h",
108 TAB_INF_DEFINES_SHADOW : "Shadow",
109 # TAB_INF_DEFINES_LIBRARY_CLASS : "LibraryClass",
110 # TAB_INF_DEFINES_ENTRY_POINT : "ExternImages",
111 # TAB_INF_DEFINES_UNLOAD_IMAGE : "ExternImages",
112 # TAB_INF_DEFINES_CONSTRUCTOR : ,
113 # TAB_INF_DEFINES_DESTRUCTOR : ,
114 # TAB_INF_DEFINES_DEFINE : "Define",
115 # TAB_INF_DEFINES_SPEC : "Specification",
116 # TAB_INF_DEFINES_CUSTOM_MAKEFILE : "CustomMakefile",
117 # TAB_INF_DEFINES_MACRO :
118 }
119
120 def __init__(self):
121 ModuleHeaderClass.__init__(self)
122 self.VersionNumber = ''
123 self.VersionString = ''
124 #print self.__dict__
125 def __setitem__(self, key, value):
126 self.__dict__[self._Mapping_[key]] = value
127 def __getitem__(self, key):
128 return self.__dict__[self._Mapping_[key]]
129 ## "in" test support
130 def __contains__(self, key):
131 return key in self._Mapping_
132
133 ## InfObject
134 #
135 # This class defined basic Inf object which is used by inheriting
136 #
137 # @param object: Inherited from object class
138 #
139 class InfObject(object):
140 def __init__(self):
141 object.__init__()
142
143 ## Inf
144 #
145 # This class defined the structure used in Inf object
146 #
147 # @param InfObject: Inherited from InfObject class
148 # @param Ffilename: Input value for Ffilename of Inf file, default is None
149 # @param IsMergeAllArches: Input value for IsMergeAllArches
150 # True is to merge all arches
151 # Fales is not to merge all arches
152 # default is False
153 # @param IsToModule: Input value for IsToModule
154 # True is to transfer to ModuleObject automatically
155 # False is not to transfer to ModuleObject automatically
156 # default is False
157 # @param WorkspaceDir: Input value for current workspace directory, default is None
158 #
159 # @var Identification: To store value for Identification, it is a structure as Identification
160 # @var UserExtensions: To store value for UserExtensions
161 # @var Module: To store value for Module, it is a structure as ModuleClass
162 # @var WorkspaceDir: To store value for WorkspaceDir
163 # @var KeyList: To store value for KeyList, a list for all Keys used in Inf
164 #
165 class Inf(InfObject):
166 def __init__(self, Filename = None, IsToDatabase = False, IsToModule = False, WorkspaceDir = None, Database = None, SupArchList = DataType.ARCH_LIST):
167 self.Identification = Identification()
168 self.Module = ModuleClass()
169 self.UserExtensions = ''
170 self.WorkspaceDir = WorkspaceDir
171 self.SupArchList = SupArchList
172 self.IsToDatabase = IsToDatabase
173
174 self.Cur = Database.Cur
175 self.TblFile = Database.TblFile
176 self.TblInf = Database.TblInf
177 self.FileID = -1
178 #self.TblInf = TableInf(Database.Cur)
179
180 self.KeyList = [
181 TAB_SOURCES, TAB_BUILD_OPTIONS, TAB_BINARIES, TAB_INCLUDES, TAB_GUIDS,
182 TAB_PROTOCOLS, TAB_PPIS, TAB_LIBRARY_CLASSES, TAB_PACKAGES, TAB_LIBRARIES,
183 TAB_INF_FIXED_PCD, TAB_INF_PATCH_PCD, TAB_INF_FEATURE_PCD, TAB_INF_PCD,
184 TAB_INF_PCD_EX, TAB_DEPEX, TAB_NMAKE, TAB_INF_DEFINES
185 ]
186 #
187 # Upper all KEYs to ignore case sensitive when parsing
188 #
189 self.KeyList = map(lambda c: c.upper(), self.KeyList)
190
191 #
192 # Init RecordSet
193 #
194 self.RecordSet = {}
195 for Key in self.KeyList:
196 self.RecordSet[Section[Key]] = []
197
198 #
199 # Load Inf file if filename is not None
200 #
201 if Filename != None:
202 self.LoadInfFile(Filename)
203
204 #
205 # Transfer to Module Object if IsToModule is True
206 #
207 if IsToModule:
208 self.InfToModule()
209
210 ## Transfer to Module Object
211 #
212 # Transfer all contents of an Inf file to a standard Module Object
213 #
214 def InfToModule(self):
215 #
216 # Init global information for the file
217 #
218 ContainerFile = self.Identification.FileFullPath
219
220 #
221 # Generate Package Header
222 #
223 self.GenModuleHeader(ContainerFile)
224
225 #
226 # Generate BuildOptions
227 #
228 self.GenBuildOptions(ContainerFile)
229
230 #
231 # Generate Includes
232 #
233 self.GenIncludes(ContainerFile)
234
235 #
236 # Generate Libraries
237 #
238 self.GenLibraries(ContainerFile)
239
240 #
241 # Generate LibraryClasses
242 #
243 self.GenLibraryClasses(ContainerFile)
244
245 #
246 # Generate Packages
247 #
248 self.GenPackages(ContainerFile)
249
250 #
251 # Generate Nmakes
252 #
253 self.GenNmakes(ContainerFile)
254
255 #
256 # Generate Pcds
257 #
258 self.GenPcds(ContainerFile)
259
260 #
261 # Generate Sources
262 #
263 self.GenSources(ContainerFile)
264
265 #
266 # Generate UserExtensions
267 #
268 self.GenUserExtensions(ContainerFile)
269
270 #
271 # Generate Guids
272 #
273 self.GenGuidProtocolPpis(DataType.TAB_GUIDS, ContainerFile)
274
275 #
276 # Generate Protocols
277 #
278 self.GenGuidProtocolPpis(DataType.TAB_PROTOCOLS, ContainerFile)
279
280 #
281 # Generate Ppis
282 #
283 self.GenGuidProtocolPpis(DataType.TAB_PPIS, ContainerFile)
284
285 #
286 # Generate Depexes
287 #
288 self.GenDepexes(ContainerFile)
289
290 #
291 # Generate Binaries
292 #
293 self.GenBinaries(ContainerFile)
294
295 ## Parse [Defines] section
296 #
297 # Parse [Defines] section into InfDefines object
298 #
299 # @param InfFile The path of the INF file
300 # @param Section The title of "Defines" section
301 # @param Lines The content of "Defines" section
302 #
303 def ParseDefines(self, InfFile, Section, Lines):
304 TokenList = Section.split(TAB_SPLIT)
305 if len(TokenList) == 3:
306 RaiseParserError(Section, "Defines", InfFile, "[xx.yy.%s] format (with platform) is not supported")
307 if len(TokenList) == 2:
308 Arch = TokenList[1].upper()
309 else:
310 Arch = TAB_ARCH_COMMON
311
312 if Arch not in self.Defines:
313 self.Defines[Arch] = InfDefines()
314 GetSingleValueOfKeyFromLines(Lines, self.Defines[Arch].DefinesDictionary,
315 TAB_COMMENT_SPLIT, TAB_EQUAL_SPLIT, False, None)
316
317 ## Load Inf file
318 #
319 # Load the file if it exists
320 #
321 # @param Filename: Input value for filename of Inf file
322 #
323 def LoadInfFile(self, Filename):
324 #
325 # Insert a record for file
326 #
327 Filename = NormPath(Filename)
328 self.Identification.FileFullPath = Filename
329 (self.Identification.FileRelativePath, self.Identification.FileName) = os.path.split(Filename)
330 self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_INF)
331
332 #
333 # Init InfTable
334 #
335 #self.TblInf.Table = "Inf%s" % self.FileID
336 #self.TblInf.Create()
337
338 #
339 # Init common datas
340 #
341 IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \
342 [], [], TAB_UNKNOWN, [], [], []
343 LineNo = 0
344
345 #
346 # Parse file content
347 #
348 IsFindBlockComment = False
349 ReservedLine = ''
350 for Line in open(Filename, 'r'):
351 LineNo = LineNo + 1
352 #
353 # Remove comment block
354 #
355 if Line.find(TAB_COMMENT_R8_START) > -1:
356 ReservedLine = GetSplitValueList(Line, TAB_COMMENT_R8_START, 1)[0]
357 IsFindBlockComment = True
358 if Line.find(TAB_COMMENT_R8_END) > -1:
359 Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_R8_END, 1)[1]
360 ReservedLine = ''
361 IsFindBlockComment = False
362 if IsFindBlockComment:
363 continue
364
365 #
366 # Remove comments at tail and remove spaces again
367 #
368 Line = CleanString(Line)
369 if Line == '':
370 continue
371
372 #
373 # Find a new section tab
374 # First insert previous section items
375 # And then parse the content of the new section
376 #
377 if Line.startswith(TAB_SECTION_START) and Line.endswith(TAB_SECTION_END):
378 if Line[1:3] == "--":
379 continue
380 Model = Section[CurrentSection.upper()]
381 #
382 # Insert items data of previous section
383 #
384 InsertSectionItemsIntoDatabase(self.TblInf, self.FileID, Filename, Model, CurrentSection, SectionItemList, ArchList, ThirdList, IfDefList, self.RecordSet)
385 #
386 # Parse the new section
387 #
388 SectionItemList = []
389 ArchList = []
390 ThirdList = []
391
392 CurrentSection = ''
393 LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT)
394 for Item in LineList:
395 ItemList = GetSplitValueList(Item, TAB_SPLIT)
396 if CurrentSection == '':
397 CurrentSection = ItemList[0]
398 else:
399 if CurrentSection != ItemList[0]:
400 EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)
401 if CurrentSection.upper() not in self.KeyList:
402 RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
403 CurrentSection = TAB_UNKNOWN
404 continue
405 ItemList.append('')
406 ItemList.append('')
407 if len(ItemList) > 5:
408 RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
409 else:
410 if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
411 EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)
412 ArchList.append(ItemList[1].upper())
413 ThirdList.append(ItemList[2])
414
415 continue
416
417 #
418 # Not in any defined section
419 #
420 if CurrentSection == TAB_UNKNOWN:
421 ErrorMsg = "%s is not in any defined section" % Line
422 EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)
423
424 #
425 # Add a section item
426 #
427 SectionItemList.append([Line, LineNo])
428 # End of parse
429 #End of For
430
431 #
432 # Insert items data of last section
433 #
434 Model = Section[CurrentSection.upper()]
435 InsertSectionItemsIntoDatabase(self.TblInf, self.FileID, Filename, Model, CurrentSection, SectionItemList, ArchList, ThirdList, IfDefList, self.RecordSet)
436
437 #
438 # Replace all DEFINE macros with its actual values
439 #
440 ParseDefineMacro2(self.TblInf, self.RecordSet, GlobalData.gGlobalDefines)
441
442 ## Show detailed information of Module
443 #
444 # Print all members and their values of Module class
445 #
446 def ShowModule(self):
447 M = self.Module
448 for Arch in M.Header.keys():
449 print '\nArch =', Arch
450 print 'Filename =', M.Header[Arch].FileName
451 print 'FullPath =', M.Header[Arch].FullPath
452 print 'BaseName =', M.Header[Arch].Name
453 print 'Guid =', M.Header[Arch].Guid
454 print 'Version =', M.Header[Arch].Version
455 print 'InfVersion =', M.Header[Arch].InfVersion
456 print 'UefiSpecificationVersion =', M.Header[Arch].UefiSpecificationVersion
457 print 'EdkReleaseVersion =', M.Header[Arch].EdkReleaseVersion
458 print 'ModuleType =', M.Header[Arch].ModuleType
459 print 'BinaryModule =', M.Header[Arch].BinaryModule
460 print 'ComponentType =', M.Header[Arch].ComponentType
461 print 'MakefileName =', M.Header[Arch].MakefileName
462 print 'BuildNumber =', M.Header[Arch].BuildNumber
463 print 'BuildType =', M.Header[Arch].BuildType
464 print 'FfsExt =', M.Header[Arch].FfsExt
465 print 'FvExt =', M.Header[Arch].FvExt
466 print 'SourceFv =', M.Header[Arch].SourceFv
467 print 'PcdIsDriver =', M.Header[Arch].PcdIsDriver
468 print 'TianoR8FlashMap_h =', M.Header[Arch].TianoR8FlashMap_h
469 print 'Shadow =', M.Header[Arch].Shadow
470 print 'LibraryClass =', M.Header[Arch].LibraryClass
471 for Item in M.Header[Arch].LibraryClass:
472 print Item.LibraryClass, DataType.TAB_VALUE_SPLIT.join(Item.SupModuleList)
473 print 'CustomMakefile =', M.Header[Arch].CustomMakefile
474 print 'Define =', M.Header[Arch].Define
475 print 'Specification =', M.Header[Arch].Specification
476 for Item in self.Module.ExternImages:
477 print '\nEntry_Point = %s, UnloadImage = %s' % (Item.ModuleEntryPoint, Item.ModuleUnloadImage)
478 for Item in self.Module.ExternLibraries:
479 print 'Constructor = %s, Destructor = %s' % (Item.Constructor, Item.Destructor)
480 print '\nBuildOptions =', M.BuildOptions
481 for Item in M.BuildOptions:
482 print Item.ToolChainFamily, Item.ToolChain, Item.Option, Item.SupArchList
483 print '\nIncludes =', M.Includes
484 for Item in M.Includes:
485 print Item.FilePath, Item.SupArchList
486 print '\nLibraries =', M.Libraries
487 for Item in M.Libraries:
488 print Item.Library, Item.SupArchList
489 print '\nLibraryClasses =', M.LibraryClasses
490 for Item in M.LibraryClasses:
491 print Item.LibraryClass, Item.RecommendedInstance, Item.FeatureFlag, Item.SupModuleList, Item.SupArchList, Item.Define
492 print '\nPackageDependencies =', M.PackageDependencies
493 for Item in M.PackageDependencies:
494 print Item.FilePath, Item.SupArchList, Item.FeatureFlag
495 print '\nNmake =', M.Nmake
496 for Item in M.Nmake:
497 print Item.Name, Item.Value, Item.SupArchList
498 print '\nPcds =', M.PcdCodes
499 for Item in M.PcdCodes:
500 print '\tCName=',Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList
501 print '\nSources =', M.Sources
502 for Source in M.Sources:
503 print Source.SourceFile, 'Fam=', Source.ToolChainFamily, 'Pcd=', Source.FeatureFlag, 'Tag=', Source.TagName, 'ToolCode=', Source.ToolCode, Source.SupArchList
504 print '\nUserExtensions =', M.UserExtensions
505 for UserExtension in M.UserExtensions:
506 print UserExtension.UserID, UserExtension.Identifier,UserExtension.Content
507 print '\nGuids =', M.Guids
508 for Item in M.Guids:
509 print Item.CName, Item.SupArchList, Item.FeatureFlag
510 print '\nProtocols =', M.Protocols
511 for Item in M.Protocols:
512 print Item.CName, Item.SupArchList, Item.FeatureFlag
513 print '\nPpis =', M.Ppis
514 for Item in M.Ppis:
515 print Item.CName, Item.SupArchList, Item.FeatureFlag
516 print '\nDepex =', M.Depex
517 for Item in M.Depex:
518 print Item.Depex, Item.SupArchList, Item.Define
519 print '\nBinaries =', M.Binaries
520 for Binary in M.Binaries:
521 print 'Type=', Binary.FileType, 'Target=', Binary.Target, 'Name=', Binary.BinaryFile, 'FeatureFlag=', Binary.FeatureFlag, 'SupArchList=', Binary.SupArchList
522
523 ## Convert [Defines] section content to ModuleHeaderClass
524 #
525 # Convert [Defines] section content to ModuleHeaderClass
526 #
527 # @param Defines The content under [Defines] section
528 # @param ModuleHeader An object of ModuleHeaderClass
529 # @param Arch The supported ARCH
530 #
531 def GenModuleHeader(self, ContainerFile):
532 EdkLogger.debug(2, "Generate ModuleHeader ...")
533 File = self.Identification.FileFullPath
534 #
535 # Update all defines item in database
536 #
537 RecordSet = self.RecordSet[MODEL_META_DATA_HEADER]
538 for Record in RecordSet:
539 ValueList = GetSplitValueList(Record[0], TAB_EQUAL_SPLIT)
540 if len(ValueList) != 2:
541 RaiseParserError(Record[0], 'Defines', ContainerFile, '<Key> = <Value>', Record[2])
542 ID, Value1, Value2, Arch, LineNo = Record[3], ValueList[0], ValueList[1], Record[1], Record[2]
543 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s'
544 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(Value1), ConvertToSqlString2(Value2), ID)
545 self.TblInf.Exec(SqlCommand)
546
547 for Arch in DataType.ARCH_LIST:
548 ModuleHeader = InfHeader()
549 ModuleHeader.FileName = self.Identification.FileName
550 ModuleHeader.FullPath = self.Identification.FileFullPath
551 DefineList = QueryDefinesItem2(self.TblInf, Arch, self.FileID)
552
553 NotProcessedDefineList = []
554 for D in DefineList:
555 if D[0] in ModuleHeader:
556 ModuleHeader[D[0]] = GetSplitValueList(D[1])[0]
557 else:
558 NotProcessedDefineList.append(D)
559
560 if ModuleHeader.ComponentType == "LIBRARY":
561 Lib = LibraryClassClass()
562 Lib.LibraryClass = ModuleHeader.Name
563 Lib.SupModuleList = DataType.SUP_MODULE_LIST
564 ModuleHeader.LibraryClass.append(Lib)
565
566 # we need to make some key defines resolved first
567 for D in NotProcessedDefineList:
568 if D[0] == TAB_INF_DEFINES_LIBRARY_CLASS:
569 List = GetSplitValueList(D[1], DataType.TAB_VALUE_SPLIT, 1)
570 Lib = LibraryClassClass()
571 Lib.LibraryClass = CleanString(List[0])
572 if len(List) == 1:
573 Lib.SupModuleList = DataType.SUP_MODULE_LIST
574 elif len(List) == 2:
575 Lib.SupModuleList = GetSplitValueList(CleanString(List[1]), ' ')
576 ModuleHeader.LibraryClass.append(Lib)
577 elif D[0] == TAB_INF_DEFINES_CUSTOM_MAKEFILE:
578 List = D[1].split(DataType.TAB_VALUE_SPLIT)
579 if len(List) == 2:
580 ModuleHeader.CustomMakefile[CleanString(List[0])] = CleanString(List[1])
581 else:
582 RaiseParserError(D[1], 'CUSTOM_MAKEFILE of Defines', File, 'CUSTOM_MAKEFILE=<Family>|<Filename>', D[2])
583 elif D[0] == TAB_INF_DEFINES_ENTRY_POINT:
584 Image = ModuleExternImageClass()
585 Image.ModuleEntryPoint = CleanString(D[1])
586 self.Module.ExternImages.append(Image)
587 elif D[0] == TAB_INF_DEFINES_UNLOAD_IMAGE:
588 Image = ModuleExternImageClass()
589 Image.ModuleUnloadImage = CleanString(D[1])
590 self.Module.ExternImages.append(Image)
591 elif D[0] == TAB_INF_DEFINES_CONSTRUCTOR:
592 LibraryClass = ModuleExternLibraryClass()
593 LibraryClass.Constructor = CleanString(D[1])
594 self.Module.ExternLibraries.append(LibraryClass)
595 elif D[0] == TAB_INF_DEFINES_DESTRUCTOR:
596 LibraryClass = ModuleExternLibraryClass()
597 LibraryClass.Destructor = CleanString(D[1])
598 self.Module.ExternLibraries.append(LibraryClass)
599 elif D[0] == TAB_INF_DEFINES_DEFINE:
600 List = D[1].split(DataType.TAB_EQUAL_SPLIT)
601 if len(List) != 2:
602 RaiseParserError(Item, 'DEFINE of Defines', File, 'DEFINE <Word> = <Word>', D[2])
603 else:
604 ModuleHeader.Define[CleanString(List[0])] = CleanString(List[1])
605 elif D[0] == TAB_INF_DEFINES_SPEC:
606 List = D[1].split(DataType.TAB_EQUAL_SPLIT)
607 if len(List) != 2:
608 RaiseParserError(Item, 'SPEC of Defines', File, 'SPEC <Word> = <Version>', D[2])
609 else:
610 ModuleHeader.Specification[CleanString(List[0])] = CleanString(List[1])
611
612 #
613 # Get version of INF
614 #
615 if ModuleHeader.InfVersion != "":
616 # R9 inf
617 VersionNumber = ModuleHeader.VersionNumber
618 VersionString = ModuleHeader.VersionString
619 if len(VersionNumber) > 0 and len(VersionString) == 0:
620 EdkLogger.warn(2000, 'VERSION_NUMBER depricated; INF file %s should be modified to use VERSION_STRING instead.' % self.Identification.FileFullPath)
621 ModuleHeader.Version = VersionNumber
622 if len(VersionString) > 0:
623 if len(VersionNumber) > 0:
624 EdkLogger.warn(2001, 'INF file %s defines both VERSION_NUMBER and VERSION_STRING, using VERSION_STRING' % self.Identification.FileFullPath)
625 ModuleHeader.Version = VersionString
626 else:
627 # R8 inf
628 ModuleHeader.InfVersion = "0x00010000"
629 if ModuleHeader.ComponentType in gComponentType2ModuleType:
630 ModuleHeader.ModuleType = gComponentType2ModuleType[ModuleHeader.ComponentType]
631 elif ModuleHeader.ComponentType != '':
632 EdkLogger.error("Parser", PARSER_ERROR, "Unsupported R8 component type [%s]" % ModuleHeader.ComponentType, ExtraData=File, RaiseError = EdkLogger.IsRaiseError)
633
634 self.Module.Header[Arch] = ModuleHeader
635
636
637 ## GenBuildOptions
638 #
639 # Gen BuildOptions of Inf
640 # [<Family>:]<ToolFlag>=Flag
641 #
642 # @param ContainerFile: The Inf file full path
643 #
644 def GenBuildOptions(self, ContainerFile):
645 EdkLogger.debug(2, "Generate %s ..." % TAB_BUILD_OPTIONS)
646 BuildOptions = {}
647 #
648 # Get all BuildOptions
649 #
650 RecordSet = self.RecordSet[MODEL_META_DATA_BUILD_OPTION]
651
652 #
653 # Go through each arch
654 #
655 for Arch in self.SupArchList:
656 for Record in RecordSet:
657 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
658 (Family, ToolChain, Flag) = GetBuildOption(Record[0], ContainerFile, Record[2])
659 MergeArches(BuildOptions, (Family, ToolChain, Flag), Arch)
660 #
661 # Update to Database
662 #
663 if self.IsToDatabase:
664 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s', Value3 = '%s'
665 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(Family), ConvertToSqlString2(ToolChain), ConvertToSqlString2(Flag), Record[3])
666 self.TblInf.Exec(SqlCommand)
667
668 for Key in BuildOptions.keys():
669 BuildOption = BuildOptionClass(Key[0], Key[1], Key[2])
670 BuildOption.SupArchList = BuildOptions[Key]
671 self.Module.BuildOptions.append(BuildOption)
672
673 ## GenIncludes
674 #
675 # Gen Includes of Inf
676 #
677 #
678 # @param ContainerFile: The Inf file full path
679 #
680 def GenIncludes(self, ContainerFile):
681 EdkLogger.debug(2, "Generate %s ..." % TAB_INCLUDES)
682 Includes = sdict()
683 #
684 # Get all Includes
685 #
686 RecordSet = self.RecordSet[MODEL_EFI_INCLUDE]
687
688 #
689 # Go through each arch
690 #
691 for Arch in self.SupArchList:
692 for Record in RecordSet:
693 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
694 MergeArches(Includes, Record[0], Arch)
695
696 for Key in Includes.keys():
697 Include = IncludeClass()
698 Include.FilePath = NormPath(Key)
699 Include.SupArchList = Includes[Key]
700 self.Module.Includes.append(Include)
701
702 ## GenLibraries
703 #
704 # Gen Libraries of Inf
705 #
706 #
707 # @param ContainerFile: The Inf file full path
708 #
709 def GenLibraries(self, ContainerFile):
710 EdkLogger.debug(2, "Generate %s ..." % TAB_LIBRARIES)
711 Libraries = sdict()
712 #
713 # Get all Includes
714 #
715 RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_INSTANCE]
716
717 #
718 # Go through each arch
719 #
720 for Arch in self.SupArchList:
721 for Record in RecordSet:
722 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
723 MergeArches(Libraries, Record[0], Arch)
724
725 for Key in Libraries.keys():
726 Library = ModuleLibraryClass()
727 # replace macro and remove file extension
728 Library.Library = Key.rsplit('.', 1)[0]
729 Library.SupArchList = Libraries[Key]
730 self.Module.Libraries.append(Library)
731
732 ## GenLibraryClasses
733 #
734 # Get LibraryClass of Inf
735 # <LibraryClassKeyWord>|<LibraryInstance>
736 #
737 # @param ContainerFile: The Inf file full path
738 #
739 def GenLibraryClasses(self, ContainerFile):
740 EdkLogger.debug(2, "Generate %s ..." % TAB_LIBRARY_CLASSES)
741 LibraryClasses = {}
742 #
743 # Get all LibraryClasses
744 #
745 RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_CLASS]
746
747 #
748 # Go through each arch
749 #
750 for Arch in self.SupArchList:
751 for Record in RecordSet:
752 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
753 (LibClassName, LibClassIns, Pcd, SupModelList) = GetLibraryClassOfInf([Record[0], Record[4]], ContainerFile, self.WorkspaceDir, Record[2])
754 MergeArches(LibraryClasses, (LibClassName, LibClassIns, Pcd, SupModelList), Arch)
755 #
756 # Update to Database
757 #
758 if self.IsToDatabase:
759 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s', Value3 = '%s'
760 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(LibClassName), ConvertToSqlString2(LibClassIns), ConvertToSqlString2(SupModelList), Record[3])
761 self.TblInf.Exec(SqlCommand)
762
763 for Key in LibraryClasses.keys():
764 KeyList = Key[0].split(DataType.TAB_VALUE_SPLIT)
765 LibraryClass = LibraryClassClass()
766 LibraryClass.LibraryClass = Key[0]
767 LibraryClass.RecommendedInstance = NormPath(Key[1])
768 LibraryClass.FeatureFlag = Key[2]
769 LibraryClass.SupArchList = LibraryClasses[Key]
770 LibraryClass.SupModuleList = GetSplitValueList(Key[3])
771 self.Module.LibraryClasses.append(LibraryClass)
772
773 ## GenPackages
774 #
775 # Gen Packages of Inf
776 #
777 #
778 # @param ContainerFile: The Inf file full path
779 #
780 def GenPackages(self, ContainerFile):
781 EdkLogger.debug(2, "Generate %s ..." % TAB_PACKAGES)
782 Packages = {}
783 #
784 # Get all Packages
785 #
786 RecordSet = self.RecordSet[MODEL_META_DATA_PACKAGE]
787
788 #
789 # Go through each arch
790 #
791 for Arch in self.SupArchList:
792 for Record in RecordSet:
793 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
794 (Package, Pcd) = GetPackage(Record[0], ContainerFile, self.WorkspaceDir, Record[2])
795 MergeArches(Packages, (Package, Pcd), Arch)
796 if self.IsToDatabase:
797 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s'
798 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(Package), ConvertToSqlString2(Pcd), Record[3])
799 self.TblInf.Exec(SqlCommand)
800
801
802 for Key in Packages.keys():
803 Package = ModulePackageDependencyClass()
804 Package.FilePath = NormPath(Key[0])
805 Package.SupArchList = Packages[Key]
806 Package.FeatureFlag = Key[1]
807 self.Module.PackageDependencies.append(Package)
808
809 ## GenNmakes
810 #
811 # Gen Nmakes of Inf
812 #
813 #
814 # @param ContainerFile: The Inf file full path
815 #
816 def GenNmakes(self, ContainerFile):
817 EdkLogger.debug(2, "Generate %s ..." % TAB_NMAKE)
818 Nmakes = sdict()
819 #
820 # Get all Nmakes
821 #
822 RecordSet = self.RecordSet[MODEL_META_DATA_NMAKE]
823
824
825 #
826 # Go through each arch
827 #
828 for Arch in self.SupArchList:
829 for Record in RecordSet:
830 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
831 MergeArches(Nmakes, Record[0], Arch)
832
833 for Key in Nmakes.keys():
834 List = GetSplitValueList(Key, DataType.TAB_EQUAL_SPLIT, MaxSplit=1)
835 if len(List) != 2:
836 RaiseParserError(Key, 'Nmake', ContainerFile, '<MacroName> = <Value>')
837 continue
838 Nmake = ModuleNmakeClass()
839 Nmake.Name = List[0]
840 Nmake.Value = List[1]
841 Nmake.SupArchList = Nmakes[Key]
842 self.Module.Nmake.append(Nmake)
843
844 # convert R8 format to R9 format
845 if Nmake.Name == "IMAGE_ENTRY_POINT":
846 Image = ModuleExternImageClass()
847 Image.ModuleEntryPoint = Nmake.Value
848 self.Module.ExternImages.append(Image)
849 elif Nmake.Name == "DPX_SOURCE":
850 Source = ModuleSourceFileClass(NormPath(Nmake.Value), "", "", "", "", Nmake.SupArchList)
851 self.Module.Sources.append(Source)
852 else:
853 ToolList = gNmakeFlagPattern.findall(Nmake.Name)
854 if len(ToolList) == 0 or len(ToolList) != 1:
855 EdkLogger.warn("\nParser", "Don't know how to do with MACRO: %s" % Nmake.Name,
856 ExtraData=ContainerFile)
857 else:
858 if ToolList[0] in gNmakeFlagName2ToolCode:
859 Tool = gNmakeFlagName2ToolCode[ToolList[0]]
860 else:
861 Tool = ToolList[0]
862 BuildOption = BuildOptionClass("MSFT", "*_*_*_%s_FLAGS" % Tool, Nmake.Value)
863 BuildOption.SupArchList = Nmake.SupArchList
864 self.Module.BuildOptions.append(BuildOption)
865
866 ## GenPcds
867 #
868 # Gen Pcds of Inf
869 # <TokenSpaceGuidCName>.<PcdCName>[|<Value>]
870 #
871 # @param ContainerFile: The Dec file full path
872 #
873 def GenPcds(self, ContainerFile):
874 EdkLogger.debug(2, "Generate %s ..." % TAB_PCDS)
875 Pcds = {}
876 PcdToken = {}
877
878 #
879 # Get all Guids
880 #
881 RecordSet1 = self.RecordSet[MODEL_PCD_FIXED_AT_BUILD]
882 RecordSet2 = self.RecordSet[MODEL_PCD_PATCHABLE_IN_MODULE]
883 RecordSet3 = self.RecordSet[MODEL_PCD_FEATURE_FLAG]
884 RecordSet4 = self.RecordSet[MODEL_PCD_DYNAMIC_EX]
885 RecordSet5 = self.RecordSet[MODEL_PCD_DYNAMIC]
886
887 #
888 # Go through each arch
889 #
890 for Arch in self.SupArchList:
891 for Record in RecordSet1:
892 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
893 if self.Module.Header[Arch].LibraryClass != {}:
894 pass
895 (TokenGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], TAB_PCDS_FIXED_AT_BUILD, ContainerFile, Record[2])
896 MergeArches(Pcds, (TokenGuidCName, TokenName, Value, Type), Arch)
897 PcdToken[Record[3]] = (TokenGuidCName, TokenName)
898 for Record in RecordSet2:
899 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
900 (TokenGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], TAB_PCDS_PATCHABLE_IN_MODULE, ContainerFile, Record[2])
901 MergeArches(Pcds, (TokenGuidCName, TokenName, Value, Type), Arch)
902 PcdToken[Record[3]] = (TokenGuidCName, TokenName)
903 for Record in RecordSet3:
904 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
905 (TokenGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], TAB_PCDS_FEATURE_FLAG, ContainerFile, Record[2])
906 MergeArches(Pcds, (TokenGuidCName, TokenName, Value, Type), Arch)
907 PcdToken[Record[3]] = (TokenGuidCName, TokenName)
908 for Record in RecordSet4:
909 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
910 (TokenGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], TAB_PCDS_DYNAMIC_EX, ContainerFile, Record[2])
911 MergeArches(Pcds, (TokenGuidCName, TokenName, Value, Type), Arch)
912 PcdToken[Record[3]] = (TokenGuidCName, TokenName)
913 for Record in RecordSet5:
914 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
915 (TokenGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], "", ContainerFile, Record[2])
916 MergeArches(Pcds, (TokenGuidCName, TokenName, Value, Type), Arch)
917 PcdToken[Record[3]] = (TokenGuidCName, TokenName)
918 #
919 # Update to database
920 #
921 if self.IsToDatabase:
922 for Key in PcdToken.keys():
923 SqlCommand = """update %s set Value2 = '%s' where ID = %s""" % (self.TblInf.Table, ".".join((PcdToken[Key][0], PcdToken[Key][1])), Key)
924 self.TblInf.Exec(SqlCommand)
925
926 for Key in Pcds.keys():
927 Pcd = PcdClass()
928 Pcd.CName = Key[1]
929 Pcd.TokenSpaceGuidCName = Key[0]
930 Pcd.DefaultValue = Key[2]
931 Pcd.ItemType = Key[3]
932 Pcd.SupArchList = Pcds[Key]
933 self.Module.PcdCodes.append(Pcd)
934
935 ## GenSources
936 #
937 # Gen Sources of Inf
938 # <Filename>[|<Family>[|<TagName>[|<ToolCode>[|<PcdFeatureFlag>]]]]
939 #
940 # @param ContainerFile: The Dec file full path
941 #
942 def GenSources(self, ContainerFile):
943 EdkLogger.debug(2, "Generate %s ..." % TAB_SOURCES)
944 Sources = {}
945
946 #
947 # Get all Nmakes
948 #
949 RecordSet = self.RecordSet[MODEL_EFI_SOURCE_FILE]
950
951 #
952 # Go through each arch
953 #
954 for Arch in self.SupArchList:
955 for Record in RecordSet:
956 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
957 (Filename, Family, TagName, ToolCode, Pcd) = GetSource(Record[0], ContainerFile, self.Identification.FileRelativePath, Record[2])
958 MergeArches(Sources, (Filename, Family, TagName, ToolCode, Pcd), Arch)
959 if self.IsToDatabase:
960 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s', Value3 = '%s', Value4 = '%s', Value5 = '%s'
961 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(Filename), ConvertToSqlString2(Family), ConvertToSqlString2(TagName), ConvertToSqlString2(ToolCode), ConvertToSqlString2(Pcd), Record[3])
962 self.TblInf.Exec(SqlCommand)
963
964 for Key in Sources.keys():
965 Source = ModuleSourceFileClass(Key[0], Key[2], Key[3], Key[1], Key[4], Sources[Key])
966 self.Module.Sources.append(Source)
967
968 ## GenUserExtensions
969 #
970 # Gen UserExtensions of Inf
971 #
972 def GenUserExtensions(self, ContainerFile):
973 # #
974 # # UserExtensions
975 # #
976 # if self.UserExtensions != '':
977 # UserExtension = UserExtensionsClass()
978 # Lines = self.UserExtensions.splitlines()
979 # List = GetSplitValueList(Lines[0], DataType.TAB_SPLIT, 2)
980 # if len(List) != 3:
981 # RaiseParserError(Lines[0], 'UserExtensions', File, "UserExtensions.UserId.'Identifier'")
982 # else:
983 # UserExtension.UserID = List[1]
984 # UserExtension.Identifier = List[2][0:-1].replace("'", '').replace('\"', '')
985 # for Line in Lines[1:]:
986 # UserExtension.Content = UserExtension.Content + CleanString(Line) + '\n'
987 # self.Module.UserExtensions.append(UserExtension)
988 pass
989
990 ## GenDepexes
991 #
992 # Gen Depex of Inf
993 #
994 # @param ContainerFile: The Inf file full path
995 #
996 def GenDepexes(self, ContainerFile):
997 EdkLogger.debug(2, "Generate %s ..." % TAB_DEPEX)
998 Depex = {}
999 #
1000 # Get all Depexes
1001 #
1002 RecordSet = self.RecordSet[MODEL_EFI_DEPEX]
1003
1004 #
1005 # Go through each arch
1006 #
1007 for Arch in self.SupArchList:
1008 Line = ''
1009 for Record in RecordSet:
1010 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
1011 Line = Line + Record[0] + ' '
1012 if Line != '':
1013 MergeArches(Depex, Line, Arch)
1014
1015 for Key in Depex.keys():
1016 Dep = ModuleDepexClass()
1017 Dep.Depex = Key
1018 Dep.SupArchList = Depex[Key]
1019 self.Module.Depex.append(Dep)
1020
1021 ## GenBinaries
1022 #
1023 # Gen Binary of Inf
1024 # <FileType>|<Filename>|<Target>[|<TokenSpaceGuidCName>.<PcdCName>]
1025 #
1026 # @param ContainerFile: The Dec file full path
1027 #
1028 def GenBinaries(self, ContainerFile):
1029 EdkLogger.debug(2, "Generate %s ..." % TAB_BINARIES)
1030 Binaries = {}
1031
1032 #
1033 # Get all Guids
1034 #
1035 RecordSet = self.RecordSet[MODEL_EFI_BINARY_FILE]
1036
1037 #
1038 # Go through each arch
1039 #
1040 for Arch in self.SupArchList:
1041 for Record in RecordSet:
1042 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
1043 (FileType, Filename, Target, Pcd) = GetBinary(Record[0], ContainerFile, self.Identification.FileRelativePath, Record[2])
1044 MergeArches(Binaries, (FileType, Filename, Target, Pcd), Arch)
1045 if self.IsToDatabase:
1046 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s', Value3 = '%s', Value4 = '%s'
1047 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(FileType), ConvertToSqlString2(Filename), ConvertToSqlString2(Target), ConvertToSqlString2(Pcd), Record[3])
1048 self.TblInf.Exec(SqlCommand)
1049
1050 for Key in Binaries.keys():
1051 Binary = ModuleBinaryFileClass(NormPath(Key[1]), Key[0], Key[2], Key[3], Binaries[Key])
1052 self.Module.Binaries.append(Binary)
1053
1054 ## GenGuids
1055 #
1056 # Gen Guids of Inf
1057 # <CName>=<GuidValue>
1058 #
1059 # @param ContainerFile: The Inf file full path
1060 #
1061 def GenGuidProtocolPpis(self, Type, ContainerFile):
1062 EdkLogger.debug(2, "Generate %s ..." % Type)
1063 Lists = {}
1064 #
1065 # Get all Items
1066 #
1067 RecordSet = self.RecordSet[Section[Type.upper()]]
1068
1069 #
1070 # Go through each arch
1071 #
1072 for Arch in self.SupArchList:
1073 for Record in RecordSet:
1074 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON:
1075 (Name, Value) = GetGuidsProtocolsPpisOfInf(Record[0], Type, ContainerFile, Record[2])
1076 MergeArches(Lists, (Name, Value), Arch)
1077 if self.IsToDatabase:
1078 SqlCommand = """update %s set Value1 = '%s', Value2 = '%s'
1079 where ID = %s""" % (self.TblInf.Table, ConvertToSqlString2(Name), ConvertToSqlString2(Value), Record[3])
1080 self.TblInf.Exec(SqlCommand)
1081
1082 ListMember = None
1083 if Type == TAB_GUIDS:
1084 ListMember = self.Module.Guids
1085 elif Type == TAB_PROTOCOLS:
1086 ListMember = self.Module.Protocols
1087 elif Type == TAB_PPIS:
1088 ListMember = self.Module.Ppis
1089
1090 for Key in Lists.keys():
1091 ListClass = GuidProtocolPpiCommonClass()
1092 ListClass.CName = Key[0]
1093 ListClass.SupArchList = Lists[Key]
1094 ListClass.FeatureFlag = Key[1]
1095 ListMember.append(ListClass)
1096
1097 ##
1098 #
1099 # This acts like the main() function for the script, unless it is 'import'ed into another
1100 # script.
1101 #
1102 if __name__ == '__main__':
1103 EdkLogger.Initialize()
1104 EdkLogger.SetLevel(EdkLogger.DEBUG_0)
1105
1106 W = os.getenv('WORKSPACE')
1107 F = os.path.join(W, 'MdeModulePkg/Application/HelloWorld/HelloWorld.inf')
1108
1109 Db = Database.Database('Inf.db')
1110 Db.InitDatabase()
1111
1112 P = Inf(os.path.normpath(F), True, True, W, Db)
1113 P.ShowModule()
1114
1115 Db.Close()