ModuleSurfaceAreaXml.py revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
## @file
# This file is used to parse a Module file of .PKG file
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The full text of the license may be found at
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
'''
ModuleSurfaceAreaXml
'''
from Library import GlobalData
## BinaryFileXml
#
# represent the following XML item
#
# <BinaryFile>
# <Filename
# FileType=" FileType " {1}
# SupArchList=" ArchListType " {0,1}
# FeatureFlag=" FeatureFlagExpression " {0,1} >
# xs:anyURI
# </Filename> {1,}
# <AsBuilt> ... </AsBuilt> {0,}
# </BinaryFile> {1,}
#
class BinaryFileXml(object):
self.AsBuiltList = []
pass
FilenameList = []
Axml = FilenameXml()
AsBuiltList = []
AsBuilt = AsBuiltObject()
PatchPcdValueList = []
Axml = PcdEntryXml()
PcdExValueList = []
Axml = PcdEntryXml()
LibraryList = []
LibraryList = [None]
BuildFlagList = []
return BinaryFile
pass
NodeList = []
for Filename in FilenameList:
Tmp = FilenameXml()
AsBuiltNodeList = []
for Pcd in PatchPcdValueList:
Tmp = PcdEntryXml()
Tmp = PcdEntryXml()
GuiVerElemList = []
for LibGuidVer in LibGuidVerList:
GuiVerElem = \
for BuildFlag in BuildFlagList:
Tmp = BuildFlagXml()
return Root
Str = "BinaryFiles:"
return Str
##
# PackageXml
#
class PackageXml(object):
return PackageDependency
pass
return Root
Str = "Description = %s Guid = %s Version = %s %s" \
return Str
##
# ExternXml
#
Extern = ExternObject()
return Extern
pass
NodeList = []
if Extern.GetEntryPoint():
if Extern.GetUnloadImage():
if Extern.GetConstructor():
if Extern.GetDestructor():
return Root
Str = "EntryPoint = %s UnloadImage = %s Constructor = %s Destructor = %s %s" \
return Str
##
# DepexXml
#
self.Expression = None
if not Item:
return None
Depex = DepexObject()
return Depex
pass
if Depex.GetHelpText():
Tmp = HelpTextXml()
return Root
return Str
##
# BootModeXml
#
class BootModeXml(object):
return BootMode
pass
Tmp = HelpTextXml()
return Root
return Str
##
# EventXml
#
Event = EventObject()
return Event
pass
]
NodeList = []
Tmp = HelpTextXml()
return Root
return Str
##
# HobXml
#
return Hob
pass
NodeList = []
Tmp = HelpTextXml()
return Root
return Str
##
# SourceFileXml
#
class SourceFileXml(object):
return SourceFile
if self.SourceFile:
pass
['FeatureFlag', FeatureFlag], ]
return Root
##
# ModulePropertyXml
#
class ModulePropertyXml(object):
self.SpecificationList = []
Axml = BootModeXml()
if Header == None:
Header = ModuleObject()
if self.ModuleType:
pass
]
Tmp = BootModeXml()
return Root
Str = "ModuleType = %s Path = %s PcdIsDriver = %s UefiSpecificationVersion = %s PiSpecificationVersion = %s \
return Str
##
# ModuleXml
#
class ModuleSurfaceAreaXml(object):
#
# indicate the package that this module resides in
#
pass
#
# PeiDepex
#
PeiDepexList = []
#
# DxeDepex
#
DxeDepexList = []
#
# SmmDepex
#
SmmDepexList = []
#
# MiscellaneousFile
MiscFileList = Tmp.FromXml(XmlNode(Item, '/ModuleSurfaceArea/MiscellaneousFiles'), 'MiscellaneousFiles')
if MiscFileList:
else:
#
# UserExtensions
#
Tmp = UserExtensionsXml()
return Module
#
# Header
#
if IsBinaryModule:
#
# ModuleProperties
#
Tmp = ModulePropertyXml()
#
# ClonedFrom
#
Tmp = ClonedFromXml()
if ClonedFrom:
#
# LibraryClass
#
Tmp = LibraryClassXml()
Module.SetLibraryClassList([None])
#
# SourceFiles
#
Tmp = SourceFileXml()
Module.SetSourceFileList([None])
#
# BinaryFile
#
Tmp = BinaryFileXml()
Module.SetBinaryFileList([None])
#
# PackageDependencies
#
Tmp = PackageXml()
Module.SetPackageDependencyList([None])
#
# Guid
#
if XmlList(Item, '/ModuleSurfaceArea/Guids') and not XmlList(Item, '/ModuleSurfaceArea/Guids/GuidCName'):
Module.SetGuidList([None])
#
# Protocol
#
if XmlList(Item, '/ModuleSurfaceArea/Protocols') and not XmlList(Item, '/ModuleSurfaceArea/Protocols/Protocol'):
Module.SetProtocolList([None])
#
# Ppi
#
Module.SetPpiList([None])
#
# Extern
#
if XmlList(Item, '/ModuleSurfaceArea/Externs') and not XmlList(Item, '/ModuleSurfaceArea/Externs/Extern'):
Module.SetExternList([None])
if not Module.GetBinaryModule():
#
# PcdCoded
#
Tmp = PcdEntryXml()
Module.SetPcdList([None])
#
# return the module object
#
pass
#
# Create root node of module surface area
#
if Module.GetBinaryModule():
#
# Header
#
#
# ModuleProperties
#
Tmp = ModulePropertyXml()
DomModule.appendChild(Tmp.ToXml(Module, Module.GetBootModeList(), Module.GetEventList(), Module.GetHobList(), \
'ModuleProperties'))
#
# ClonedFrom
#
Tmp = ClonedFromXml()
if Module.GetClonedFrom():
#
# LibraryClass
#
Tmp = LibraryClassXml()
#
# SourceFile
#
Tmp = SourceFileXml()
#
# BinaryFile
#
Tmp = BinaryFileXml()
#
# PackageDependencies
#
Tmp = PackageXml()
#
# Guid
#
#
# Protocol
#
#
# Ppi
#
#
# Extern
#
#
# PcdCoded
#
Tmp = PcdEntryXml()
#
# PeiDepex
#
if Module.GetPeiDepex():
#
# DxeDepex
#
if Module.GetDxeDepex():
#
# SmmDepex
#
if Module.GetSmmDepex():
#
# MiscellaneousFile
#
if Module.GetMiscFileList():
#
# UserExtensions
#
if Module.GetUserExtensionList():
Tmp = UserExtensionsXml()
return DomModule
##
# BuildFlagXml used to generate BuildFlag for <AsBuilt>
#
class BuildFlagXml(object):
return BuildFlag
#
# For AsBuild INF usage
#
ReturnLine = ''
Count = 0
if Count == 0:
else:
Count += 1
return BuildFlag
pass
AttributeList = []
NodeList = []
return Root