From 30fdf1140b8d1ce93f3821d986fa165552023440 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Fri, 17 Jul 2009 09:10:31 +0000 Subject: Check In tool source code based on Build tool project revision r1655. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8964 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Source/Python/CommonDataClass/CommonClass.py | 473 ++++++++++++++++++++ .../Source/Python/CommonDataClass/DataClass.py | 351 +++++++++++++++ .../CommonDataClass/DistributionPackageClass.py | 159 +++++++ .../Source/Python/CommonDataClass/FdfClass.py | 402 +++++++++++++++++ .../Source/Python/CommonDataClass/ModuleClass.py | 486 +++++++++++++++++++++ .../Source/Python/CommonDataClass/PackageClass.py | 127 ++++++ .../Source/Python/CommonDataClass/PlatformClass.py | 432 ++++++++++++++++++ .../Source/Python/CommonDataClass/__init__.py | 0 8 files changed, 2430 insertions(+) create mode 100644 BaseTools/Source/Python/CommonDataClass/CommonClass.py create mode 100644 BaseTools/Source/Python/CommonDataClass/DataClass.py create mode 100644 BaseTools/Source/Python/CommonDataClass/DistributionPackageClass.py create mode 100644 BaseTools/Source/Python/CommonDataClass/FdfClass.py create mode 100644 BaseTools/Source/Python/CommonDataClass/ModuleClass.py create mode 100644 BaseTools/Source/Python/CommonDataClass/PackageClass.py create mode 100644 BaseTools/Source/Python/CommonDataClass/PlatformClass.py create mode 100644 BaseTools/Source/Python/CommonDataClass/__init__.py (limited to 'BaseTools/Source/Python/CommonDataClass') diff --git a/BaseTools/Source/Python/CommonDataClass/CommonClass.py b/BaseTools/Source/Python/CommonDataClass/CommonClass.py new file mode 100644 index 0000000000..763550fe47 --- /dev/null +++ b/BaseTools/Source/Python/CommonDataClass/CommonClass.py @@ -0,0 +1,473 @@ +## @file +# This file is used to define common items of class object +# +# Copyright (c) 2007, Intel Corporation +# All rights reserved. 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 +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + +# +# Generate help text +# +def GenerateHelpText(Text, Lang): + if Text: + Ht = HelpTextClass() + Ht.Lang = Lang + Ht.String = Text + + return Ht + + return None + +## CommonClass +# +# This class defined common items used in Module/Platform/Package files +# +# @param object: Inherited from object class +# @param Usage: Input value for Usage, default is [] +# @param FeatureFlag: Input value for FeatureFalg, default is '' +# @param SupArchList: Input value for SupArchList, default is [] +# @param HelpText: Input value for HelpText, default is '' +# +# @var Usage: To store value for Usage, selection scope is in below list +# ALWAYS_CONSUMED | SOMETIMES_CONSUMED | ALWAYS_PRODUCED | SOMETIMES_PRODUCED | TO_START | BY_START | PRIVATE +# @var FeatureFlag: To store value for FeatureFlag +# @var SupArchList: To store value for SupArchList, selection scope is in below list +# EBC | IA32 | X64 | IPF | ARM | PPC +# @var HelpText: To store value for HelpText +# +class CommonClass(object): + def __init__(self, Usage = None, FeatureFlag = '', SupArchList = None, HelpText = ''): + self.Usage = Usage + if self.Usage == None: + self.Usage = [] + self.FeatureFlag = FeatureFlag + self.SupArchList = SupArchList + if self.SupArchList == None: + self.SupArchList = [] + self.HelpText = HelpText + self.HelpTextList = [] + +## CommonClass +# +# This class defined common items used in Module/Platform/Package files +# +# @param object: Inherited from object class +# +# @var Abstract: To store value for Abstract +# @var Description: To store value for Description +# @var Copyright: To store value for Copyright +# @var License: To store value for License +# @var Specification: To store value for Specification +# +class CommonHeaderClass(object): + def __init__(self): + self.Abstract = '' + self.Description = '' + self.Copyright = '' + self.License = '' + self.Specification = {} + +## HelpTextClass +# +# This class defined HelpText item used in PKG file +# +# @param object: Inherited from object class +# +# @var Lang: To store value for Lang +# @var String: To store value for String +# +class HelpTextClass(object): + def __init__(self): + self.Lang = '' + self.String = '' + +## DefineClass +# +# This class defined item DEFINE used in Module/Platform/Package files +# +# @param object: Inherited from object class +# +# @var Define: To store value for Define, it is a set structure as +# { (DefineName, Arch) : DefineValue, ... } +# +class DefineClass(object): + def __init__(self): + self.Define = {} + +## ClonedRecordClass +# +# This class defined ClonedRecord items used in Module/Platform/Package files +# +# @param object: Inherited from object class +# +# @var Id: To store value for Id +# @var FarGuid: To store value for FarGuid +# @var PackageGuid: To store value for PackageGuid +# @var PackageVersion: To store value for PackageVersion +# @var ModuleGuid: To store value for ModuleGuid +# @var ModuleVersion: To store value for ModuleVersion +# +class ClonedRecordClass(object): + def __init__(self): + self.Id = 0 + self.FarGuid = '' + self.PackageGuid = '' + self.PackageVersion = '' + self.ModuleGuid = '' + self.ModuleVersion = '' + +## IdentificationClass +# +# This class defined Identification items used in Module/Platform/Package files +# +# @param object: Inherited from object class +# +# @var Name: To store value for Name +# ModuleName(Inf) / PackageName(Dec) / PlatformName(Dsc) +# @var Guid: To store value for Guid +# @var Version: To store value for Version +# @var FileName: To store value for FileName +# @var FullPath: To store value for FullPath +# +class IdentificationClass(object): + def __init__(self): + self.Name = '' + self.BaseName = '' + self.Guid = '' + self.Version = '' + self.FileName = '' + self.FullPath = '' + self.RelaPath = '' + self.PackagePath = '' + self.ModulePath = '' + self.CombinePath = '' + +## IncludeStatementClass +# +# This class defined IncludeFiles item used in Module/Platform/Package files +# +# @param object: Inherited from object class +# +# @var IncludeFiles: To store value for IncludeFiles +# It is a set structure as { IncludeFile : [Arch1, Arch2, ...], ... } +# +class IncludeStatementClass(object): + def __init__(self): + self.IncludeFiles = {} + +## GuidProtocolPpiCommonClass +# +# This class defined Guid, Protocol and Ppi like items used in Module/Platform/Package files +# +# @param CommonClass: Inherited from CommonClass class +# +# @var Name: To store value for Name +# @var CName: To store value for CName +# @var Guid: To store value for Guid +# @var Notify: To store value for Notify +# @var GuidTypeList: To store value for GuidTypeList, selection scope is in below list +# DATA_HUB_RECORD | EFI_EVENT | EFI_SYSTEM_CONFIGURATION_TABLE | EFI_VARIABLE | GUID | HII_PACKAGE_LIST | HOB | TOKEN_SPACE_GUID +# @var SupModuleList: To store value for SupModuleList, selection scope is in below list +# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED +# +class GuidProtocolPpiCommonClass(CommonClass): + def __init__(self): + self.Name = '' + self.CName = '' + self.Guid = '' + self.VariableName = '' + self.Notify = False + self.GuidTypeList = [] + self.GuidTypeLists = [] + self.SupModuleList = [] + CommonClass.__init__(self) + +## LibraryClassClass +# +# This class defined Library item used in Module/Platform/Package files +# +# @param CommonClass: Inherited from CommonClass class +# @param DefineClass: Inherited from DefineClass class +# +# @var LibraryClass: To store value for LibraryClass +# @var IncludeHeader: To store value for IncludeHeader +# @var RecommendedInstanceVersion: To store value for RecommendedInstanceVersion +# @var RecommendedInstanceGuid: To store value for RecommendedInstanceGuid +# @var RecommendedInstance: To store value for RecommendedInstance, selection scope is in below list +# DATA_HUB_RECORD | EFI_EVENT | EFI_SYSTEM_CONFIGURATION_TABLE | EFI_VARIABLE | GUID | HII_PACKAGE_LIST | HOB | TOKEN_SPACE_GUID +# @var SupModuleList: To store value for SupModuleList, selection scope is in below list +# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED +# +class LibraryClassClass(CommonClass, DefineClass): + def __init__(self): + self.LibraryClass = '' + self.IncludeHeader = '' + self.RecommendedInstanceVersion = '' + self.RecommendedInstanceGuid = '' + self.RecommendedInstance = '' + self.SupModuleList = [] + CommonClass.__init__(self) + DefineClass.__init__(self) + +## GuidClass +# +# This class defined Guid item used in Module/Platform/Package files +# +# @param GuidProtocolPpiCommonClass: Inherited from GuidProtocolPpiCommonClass class +# +class GuidClass(GuidProtocolPpiCommonClass): + def __init__(self): + GuidProtocolPpiCommonClass.__init__(self) + +## ProtocolClass +# +# This class defined Protocol item used in Module/Platform/Package files +# +# @param GuidProtocolPpiCommonClass: Inherited from GuidProtocolPpiCommonClass class +# +class ProtocolClass(GuidProtocolPpiCommonClass): + def __init__(self): + GuidProtocolPpiCommonClass.__init__(self) + +## PpiClass +# +# This class defined Ppi item used in Module/Platform/Package files +# +# @param GuidProtocolPpiCommonClass: Inherited from GuidProtocolPpiCommonClass class +# +class PpiClass(GuidProtocolPpiCommonClass): + def __init__(self): + GuidProtocolPpiCommonClass.__init__(self) + +## SkuInfoClass +# +# This class defined SkuInfo item used in Module/Platform/Package files +# +# @param object: Inherited from object class +# @param SkuIdName: Input value for SkuIdName, default is '' +# @param SkuId: Input value for SkuId, default is '' +# @param VariableName: Input value for VariableName, default is '' +# @param VariableGuid: Input value for VariableGuid, default is '' +# @param VariableOffset: Input value for VariableOffset, default is '' +# @param HiiDefaultValue: Input value for HiiDefaultValue, default is '' +# @param VpdOffset: Input value for VpdOffset, default is '' +# @param DefaultValue: Input value for DefaultValue, default is '' +# +# @var SkuIdName: To store value for SkuIdName +# @var SkuId: To store value for SkuId +# @var VariableName: To store value for VariableName +# @var VariableGuid: To store value for VariableGuid +# @var VariableOffset: To store value for VariableOffset +# @var HiiDefaultValue: To store value for HiiDefaultValue +# @var VpdOffset: To store value for VpdOffset +# @var DefaultValue: To store value for DefaultValue +# +class SkuInfoClass(object): + def __init__(self, SkuIdName = '', SkuId = '', VariableName = '', VariableGuid = '', VariableOffset = '', + HiiDefaultValue = '', VpdOffset = '', DefaultValue = '', VariableGuidValue = ''): + self.SkuIdName = SkuIdName + self.SkuId = SkuId + + # + # Used by Hii + # + self.VariableName = VariableName + self.VariableGuid = VariableGuid + self.VariableGuidValue = VariableGuidValue + self.VariableOffset = VariableOffset + self.HiiDefaultValue = HiiDefaultValue + + # + # Used by Vpd + # + self.VpdOffset = VpdOffset + + # + # Used by Default + # + self.DefaultValue = DefaultValue + + ## Convert the class to a string + # + # Convert each member of the class to string + # Organize to a signle line format string + # + # @retval Rtn Formatted String + # + def __str__(self): + Rtn = Rtn = 'SkuId = ' + str(self.SkuId) + "," + \ + 'SkuIdName = ' + str(self.SkuIdName) + "," + \ + 'VariableName = ' + str(self.VariableName) + "," + \ + 'VariableGuid = ' + str(self.VariableGuid) + "," + \ + 'VariableOffset = ' + str(self.VariableOffset) + "," + \ + 'HiiDefaultValue = ' + str(self.HiiDefaultValue) + "," + \ + 'VpdOffset = ' + str(self.VpdOffset) + "," + \ + 'DefaultValue = ' + str(self.DefaultValue) + "," + return Rtn +## PcdErrorClass +# +# +# +class PcdErrorClass(object): + def __init__(self): + self.ValidValueList = '' + self.ValidValueListLang = '' + self.ValidValueRange = '' + self.Expression = '' + self.ErrorNumber = '' + self.ErrorMessage = [] + +## PcdClass +# +# This class defined Pcd item used in Module/Platform/Package files +# +# @param CommonClass: Inherited from CommonClass class +# @param CName: Input value for CName, default is '' +# @param Token: Input value for Token, default is '' +# @param TokenSpaceGuidCName: Input value for TokenSpaceGuidCName, default is '' +# @param DatumType: Input value for DatumType, default is '' +# @param MaxDatumSize: Input value for MaxDatumSize, default is '' +# @param DefaultValue: Input value for DefaultValue, default is '' +# @param ItemType: Input value for ItemType, default is '' +# @param ValidUsage: Input value for ValidUsage, default is [] +# @param SkuInfoList: Input value for SkuInfoList, default is {} +# @param SupModuleList: Input value for SupModuleList, default is [] +# +# @var CName: To store value for CName +# @var Token: To store value for Token +# @var TokenSpaceGuidCName: To store value for TokenSpaceGuidCName +# @var DatumType: To store value for DatumType, selection scope is in below list +# UINT8 | UINT16 | UINT32 | UINT64 | VOID* | BOOLEAN +# @var MaxDatumSize: To store value for MaxDatumSize +# @var DefaultValue: To store value for DefaultValue +# @var ItemType: To store value for ItemType, selection scope is in below list +# FEATURE_FLAG | FIXED_AT_BUILD | PATCHABLE_IN_MODULE | DYNAMIC | DYNAMIC_EX +# @var ValidUsage: To store value for ValidUsage, selection scope is in below list +# FEATURE_FLAG | FIXED_AT_BUILD | PATCHABLE_IN_MODULE | DYNAMIC | DYNAMIC_EX +# @var SkuInfoList: To store value for SkuInfoList +# It is a set structure as { [SkuIdName] : SkuInfoClass } +# @var SupModuleList: To store value for SupModuleList, selection scope is in below list +# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED +# +class PcdClass(CommonClass): + def __init__(self, CName = '', Token = '', TokenSpaceGuidCName = '', DatumType = '', MaxDatumSize = '', DefaultValue = '', ItemType = '', ValidUsage = None, SkuInfoList = None, SupModuleList = None): + self.CName = CName + self.Token = Token + self.TokenSpaceGuidCName = TokenSpaceGuidCName + self.DatumType = DatumType + self.MaxDatumSize = MaxDatumSize + self.DefaultValue = DefaultValue + self.ItemType = ItemType + self.ValidUsage = ValidUsage + self.PcdItemType = '' + self.TokenSpaceGuidValue = '' + self.PcdUsage = '' + self.PcdCName = '' + self.Value = '' + self.Offset = '' + if self.ValidUsage == None: + self.ValidUsage = [] + self.SkuInfoList = SkuInfoList + if self.SkuInfoList == None: + self.SkuInfoList = {} + self.SupModuleList = SupModuleList + if self.SupModuleList == None: + self.SupModuleList = [] + CommonClass.__init__(self) + self.PcdErrors = [] + +## BuildOptionClass +# +# This class defined BuildOption item used in Module/Platform/Package files +# +# @param IncludeStatementClass: Inherited from IncludeStatementClass class +# @param ToolChainFamily: Input value for ToolChainFamily, default is '' +# @param ToolChain: Input value for ToolChain, default is '' +# @param Option: Input value for Option, default is '' +# +# @var Statement: To store value for Statement +# It is a string in a special format as "Family:Target_TagName_Tarch_ToolCode_FLAGS = String" +# @var ToolChainFamily: To store value for ToolChainFamily +# @var ToolChain: To store value for ToolChain +# @var Option: To store value for Option +# @var BuildTarget: To store value for BuildTarget +# @var TagName: To store value for TagName +# @var ToolCode: To store value for ToolCode +# @var SupArchList: To store value for SupArchList, selection scope is in below list +# EBC | IA32 | X64 | IPF | ARM | PPC +# +class BuildOptionClass(IncludeStatementClass): + def __init__(self, ToolChainFamily = '', ToolChain = '', Option = ''): + IncludeStatementClass.__init__(self) + self.Statement = '' + self.ToolChainFamily = ToolChainFamily + self.ToolChain = ToolChain + self.Option = Option + self.BuildTarget = '' + self.TagName = '' + self.ToolCode = '' + self.SupArchList = [] + +## IncludeClass +# +# This class defined Include item used in Module/Platform/Package files +# +# @param CommonClass: Inherited from CommonClass class +# +# @var FilePath: To store value for FilePath +# @var ModuleType: To store value for ModuleType +# @var Comment: To store value for Comment +# +class IncludeClass(CommonClass): + def __init__(self): + self.FilePath = '' + self.ModuleType = '' + self.SupModuleList = [] + self.Comment = '' + CommonClass.__init__(self) + +## FileClass +# +# +class FileClass(CommonClass): + def __init__(self): + self.Filename = '' + self.Executable = '' + self.Family = '' + self.FileType = '' + CommonClass.__init__(self) + + +## MiscFileClass +# +# +class MiscFileClass(CommonHeaderClass): + def __init__(self): + CommonHeaderClass.__init__(self) + self.Name = '' + self.Files = [] + + +## UserExtensionsClass +# +# This class defined UserExtensions item used in Module/Platform/Package files +# +# @param object: Inherited from object class +# +# @var UserID: To store value for UserID +# @var Identifier: To store value for Identifier +# @var Content: To store value for Content +# +class UserExtensionsClass(object): + def __init__(self): + self.UserID = '' + self.Identifier = 0 + self.Content = '' + self.Defines = [] + self.BuildOptions = [] diff --git a/BaseTools/Source/Python/CommonDataClass/DataClass.py b/BaseTools/Source/Python/CommonDataClass/DataClass.py new file mode 100644 index 0000000000..00f4be8332 --- /dev/null +++ b/BaseTools/Source/Python/CommonDataClass/DataClass.py @@ -0,0 +1,351 @@ +## @file +# This file is used to define class for data sturcture used in ECC +# +# Copyright (c) 2008, Intel Corporation +# All rights reserved. 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 +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +## +# Import Modules +# +import Common.EdkLogger as EdkLogger + +## +# Static values for data models +# +MODEL_UNKNOWN = 0 + +MODEL_FILE_C = 1001 +MODEL_FILE_H = 1002 +MODEL_FILE_ASM = 1003 +MODEL_FILE_INF = 1011 +MODEL_FILE_DEC = 1012 +MODEL_FILE_DSC = 1013 +MODEL_FILE_FDF = 1014 +MODEL_FILE_INC = 1015 +MODEL_FILE_CIF = 1016 + +MODEL_IDENTIFIER_FILE_HEADER = 2001 +MODEL_IDENTIFIER_FUNCTION_HEADER = 2002 +MODEL_IDENTIFIER_COMMENT = 2003 +MODEL_IDENTIFIER_PARAMETER = 2004 +MODEL_IDENTIFIER_STRUCTURE = 2005 +MODEL_IDENTIFIER_VARIABLE = 2006 +MODEL_IDENTIFIER_INCLUDE = 2007 +MODEL_IDENTIFIER_PREDICATE_EXPRESSION = 2008 +MODEL_IDENTIFIER_ENUMERATE = 2009 +MODEL_IDENTIFIER_PCD = 2010 +MODEL_IDENTIFIER_UNION = 2011 +MODEL_IDENTIFIER_MACRO_IFDEF = 2012 +MODEL_IDENTIFIER_MACRO_IFNDEF = 2013 +MODEL_IDENTIFIER_MACRO_DEFINE = 2014 +MODEL_IDENTIFIER_MACRO_ENDIF = 2015 +MODEL_IDENTIFIER_MACRO_PROGMA = 2016 +MODEL_IDENTIFIER_FUNCTION_CALLING = 2018 +MODEL_IDENTIFIER_TYPEDEF = 2017 +MODEL_IDENTIFIER_FUNCTION_DECLARATION = 2019 +MODEL_IDENTIFIER_ASSIGNMENT_EXPRESSION = 2020 + +MODEL_EFI_PROTOCOL = 3001 +MODEL_EFI_PPI = 3002 +MODEL_EFI_GUID = 3003 +MODEL_EFI_LIBRARY_CLASS = 3004 +MODEL_EFI_LIBRARY_INSTANCE = 3005 +MODEL_EFI_PCD = 3006 +MODEL_EFI_SOURCE_FILE = 3007 +MODEL_EFI_BINARY_FILE = 3008 +MODEL_EFI_SKU_ID = 3009 +MODEL_EFI_INCLUDE = 3010 +MODEL_EFI_DEPEX = 3011 + +MODEL_PCD = 4000 +MODEL_PCD_FIXED_AT_BUILD = 4001 +MODEL_PCD_PATCHABLE_IN_MODULE = 4002 +MODEL_PCD_FEATURE_FLAG = 4003 +MODEL_PCD_DYNAMIC_EX = 4004 +MODEL_PCD_DYNAMIC_EX_DEFAULT = 4005 +MODEL_PCD_DYNAMIC_EX_VPD = 4006 +MODEL_PCD_DYNAMIC_EX_HII = 4007 +MODEL_PCD_DYNAMIC = 4008 +MODEL_PCD_DYNAMIC_DEFAULT = 4009 +MODEL_PCD_DYNAMIC_VPD = 4010 +MODEL_PCD_DYNAMIC_HII = 4011 + +MODEL_META_DATA_HEADER = 5001 +MODEL_META_DATA_INCLUDE = 5002 +MODEL_META_DATA_DEFINE = 5003 +MODEL_META_DATA_CONDITIONAL_STATEMENT_IF = 5004 +MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE = 5005 +MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF = 5006 +MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF = 5007 +MODEL_META_DATA_BUILD_OPTION = 5008 +MODEL_META_DATA_COMPONENT = 5009 +MODEL_META_DATA_USER_EXTENSION = 5010 +MODEL_META_DATA_PACKAGE = 5011 +MODEL_META_DATA_NMAKE = 5012 +MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF = 50013 +MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF = 5014 +MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH = 5015 + +MODEL_LIST = [('MODEL_UNKNOWN', MODEL_UNKNOWN), + ('MODEL_FILE_C', MODEL_FILE_C), + ('MODEL_FILE_H', MODEL_FILE_H), + ('MODEL_FILE_ASM', MODEL_FILE_ASM), + ('MODEL_FILE_INF', MODEL_FILE_INF), + ('MODEL_FILE_DEC', MODEL_FILE_DEC), + ('MODEL_FILE_DSC', MODEL_FILE_DSC), + ('MODEL_FILE_FDF', MODEL_FILE_FDF), + ('MODEL_FILE_INC', MODEL_FILE_INC), + ('MODEL_IDENTIFIER_FILE_HEADER', MODEL_IDENTIFIER_FILE_HEADER), + ('MODEL_IDENTIFIER_FUNCTION_HEADER', MODEL_IDENTIFIER_FUNCTION_HEADER), + ('MODEL_IDENTIFIER_COMMENT', MODEL_IDENTIFIER_COMMENT), + ('MODEL_IDENTIFIER_PARAMETER', MODEL_IDENTIFIER_PARAMETER), + ('MODEL_IDENTIFIER_STRUCTURE', MODEL_IDENTIFIER_STRUCTURE), + ('MODEL_IDENTIFIER_VARIABLE', MODEL_IDENTIFIER_VARIABLE), + ('MODEL_IDENTIFIER_INCLUDE', MODEL_IDENTIFIER_INCLUDE), + ('MODEL_IDENTIFIER_PREDICATE_EXPRESSION', MODEL_IDENTIFIER_PREDICATE_EXPRESSION), + ('MODEL_IDENTIFIER_ENUMERATE', MODEL_IDENTIFIER_ENUMERATE), + ('MODEL_IDENTIFIER_PCD', MODEL_IDENTIFIER_PCD), + ('MODEL_IDENTIFIER_UNION', MODEL_IDENTIFIER_UNION), + ('MODEL_IDENTIFIER_MACRO_IFDEF', MODEL_IDENTIFIER_MACRO_IFDEF), + ('MODEL_IDENTIFIER_MACRO_IFNDEF', MODEL_IDENTIFIER_MACRO_IFNDEF), + ('MODEL_IDENTIFIER_MACRO_DEFINE', MODEL_IDENTIFIER_MACRO_DEFINE), + ('MODEL_IDENTIFIER_MACRO_ENDIF', MODEL_IDENTIFIER_MACRO_ENDIF), + ('MODEL_IDENTIFIER_MACRO_PROGMA', MODEL_IDENTIFIER_MACRO_PROGMA), + ('MODEL_IDENTIFIER_FUNCTION_CALLING', MODEL_IDENTIFIER_FUNCTION_CALLING), + ('MODEL_IDENTIFIER_TYPEDEF', MODEL_IDENTIFIER_TYPEDEF), + ('MODEL_IDENTIFIER_FUNCTION_DECLARATION', MODEL_IDENTIFIER_FUNCTION_DECLARATION), + ('MODEL_IDENTIFIER_ASSIGNMENT_EXPRESSION', MODEL_IDENTIFIER_ASSIGNMENT_EXPRESSION), + ('MODEL_EFI_PROTOCOL', MODEL_EFI_PROTOCOL), + ('MODEL_EFI_PPI', MODEL_EFI_PPI), + ('MODEL_EFI_GUID', MODEL_EFI_GUID), + ('MODEL_EFI_LIBRARY_CLASS', MODEL_EFI_LIBRARY_CLASS), + ('MODEL_EFI_LIBRARY_INSTANCE', MODEL_EFI_LIBRARY_INSTANCE), + ('MODEL_EFI_PCD', MODEL_EFI_PCD), + ('MODEL_EFI_SKU_ID', MODEL_EFI_SKU_ID), + ('MODEL_EFI_INCLUDE', MODEL_EFI_INCLUDE), + ('MODEL_EFI_DEPEX', MODEL_EFI_DEPEX), + ('MODEL_IDENTIFIER_UNION', MODEL_IDENTIFIER_UNION), + ('MODEL_EFI_SOURCE_FILE', MODEL_EFI_SOURCE_FILE), + ('MODEL_EFI_BINARY_FILE', MODEL_EFI_BINARY_FILE), + ('MODEL_PCD', MODEL_PCD), + ('MODEL_PCD_FIXED_AT_BUILD', MODEL_PCD_FIXED_AT_BUILD), + ('MODEL_PCD_PATCHABLE_IN_MODULE', MODEL_PCD_PATCHABLE_IN_MODULE), + ('MODEL_PCD_FEATURE_FLAG', MODEL_PCD_FEATURE_FLAG), + ('MODEL_PCD_DYNAMIC_EX', MODEL_PCD_DYNAMIC_EX), + ('MODEL_PCD_DYNAMIC_EX_DEFAULT', MODEL_PCD_DYNAMIC_EX_DEFAULT), + ('MODEL_PCD_DYNAMIC_EX_VPD', MODEL_PCD_DYNAMIC_EX_VPD), + ('MODEL_PCD_DYNAMIC_EX_HII', MODEL_PCD_DYNAMIC_EX_HII), + ('MODEL_PCD_DYNAMIC', MODEL_PCD_DYNAMIC), + ('MODEL_PCD_DYNAMIC_DEFAULT', MODEL_PCD_DYNAMIC_DEFAULT), + ('MODEL_PCD_DYNAMIC_VPD', MODEL_PCD_DYNAMIC_VPD), + ('MODEL_PCD_DYNAMIC_HII', MODEL_PCD_DYNAMIC_HII), + ("MODEL_META_DATA_HEADER", MODEL_META_DATA_HEADER), + ("MODEL_META_DATA_INCLUDE", MODEL_META_DATA_INCLUDE), + ("MODEL_META_DATA_DEFINE", MODEL_META_DATA_DEFINE), + ("MODEL_META_DATA_CONDITIONAL_STATEMENT_IF", MODEL_META_DATA_CONDITIONAL_STATEMENT_IF), + ("MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE", MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE), + ("MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF", MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF), + ("MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF", MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF), + ("MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH", MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH), + ("MODEL_META_DATA_BUILD_OPTION", MODEL_META_DATA_BUILD_OPTION), + ("MODEL_META_DATA_COMPONENT", MODEL_META_DATA_COMPONENT), + ('MODEL_META_DATA_USER_EXTENSION', MODEL_META_DATA_USER_EXTENSION), + ('MODEL_META_DATA_PACKAGE', MODEL_META_DATA_PACKAGE), + ('MODEL_META_DATA_NMAKE', MODEL_META_DATA_NMAKE) + ] + +## FunctionClass +# +# This class defines a structure of a function +# +# @param ID: ID of a Function +# @param Header: Header of a Function +# @param Modifier: Modifier of a Function +# @param Name: Name of a Function +# @param ReturnStatement: ReturnStatement of a Funciont +# @param StartLine: StartLine of a Function +# @param StartColumn: StartColumn of a Function +# @param EndLine: EndLine of a Function +# @param EndColumn: EndColumn of a Function +# @param BodyStartLine: BodyStartLine of a Function Body +# @param BodyStartColumn: BodyStartColumn of a Function Body +# @param BelongsToFile: The Function belongs to which file +# @param IdentifierList: IdentifierList of a File +# @param PcdList: PcdList of a File +# +# @var ID: ID of a Function +# @var Header: Header of a Function +# @var Modifier: Modifier of a Function +# @var Name: Name of a Function +# @var ReturnStatement: ReturnStatement of a Funciont +# @var StartLine: StartLine of a Function +# @var StartColumn: StartColumn of a Function +# @var EndLine: EndLine of a Function +# @var EndColumn: EndColumn of a Function +# @var BodyStartLine: StartLine of a Function Body +# @var BodyStartColumn: StartColumn of a Function Body +# @var BelongsToFile: The Function belongs to which file +# @var IdentifierList: IdentifierList of a File +# @var PcdList: PcdList of a File +# +class FunctionClass(object): + def __init__(self, ID = -1, Header = '', Modifier = '', Name = '', ReturnStatement = '', \ + StartLine = -1, StartColumn = -1, EndLine = -1, EndColumn = -1, \ + BodyStartLine = -1, BodyStartColumn = -1, BelongsToFile = -1, \ + IdentifierList = [], PcdList = [], \ + FunNameStartLine = -1, FunNameStartColumn = -1): + self.ID = ID + self.Header = Header + self.Modifier = Modifier + self.Name = Name + self.ReturnStatement = ReturnStatement + self.StartLine = StartLine + self.StartColumn = StartColumn + self.EndLine = EndLine + self.EndColumn = EndColumn + self.BodyStartLine = BodyStartLine + self.BodyStartColumn = BodyStartColumn + self.BelongsToFile = BelongsToFile + self.FunNameStartLine = FunNameStartLine + self.FunNameStartColumn = FunNameStartColumn + + self.IdentifierList = IdentifierList + self.PcdList = PcdList + +## IdentifierClass +# +# This class defines a structure of a variable +# +# @param ID: ID of a Identifier +# @param Modifier: Modifier of a Identifier +# @param Type: Type of a Identifier +# @param Name: Name of a Identifier +# @param Value: Value of a Identifier +# @param Model: Model of a Identifier +# @param BelongsToFile: The Identifier belongs to which file +# @param BelongsToFunction: The Identifier belongs to which function +# @param StartLine: StartLine of a Identifier +# @param StartColumn: StartColumn of a Identifier +# @param EndLine: EndLine of a Identifier +# @param EndColumn: EndColumn of a Identifier +# +# @var ID: ID of a Identifier +# @var Modifier: Modifier of a Identifier +# @var Type: Type of a Identifier +# @var Name: Name of a Identifier +# @var Value: Value of a Identifier +# @var Model: Model of a Identifier +# @var BelongsToFile: The Identifier belongs to which file +# @var BelongsToFunction: The Identifier belongs to which function +# @var StartLine: StartLine of a Identifier +# @var StartColumn: StartColumn of a Identifier +# @var EndLine: EndLine of a Identifier +# @var EndColumn: EndColumn of a Identifier +# +class IdentifierClass(object): + def __init__(self, ID = -1, Modifier = '', Type = '', Name = '', Value = '', Model = MODEL_UNKNOWN, \ + BelongsToFile = -1, BelongsToFunction = -1, StartLine = -1, StartColumn = -1, EndLine = -1, EndColumn = -1): + self.ID = ID + self.Modifier = Modifier + self.Type = Type + self.Name = Name + self.Value = Value + self.Model = Model + self.BelongsToFile = BelongsToFile + self.BelongsToFunction = BelongsToFunction + self.StartLine = StartLine + self.StartColumn = StartColumn + self.EndLine = EndLine + self.EndColumn = EndColumn + +## PcdClass +# +# This class defines a structure of a Pcd +# +# @param ID: ID of a Pcd +# @param CName: CName of a Pcd +# @param TokenSpaceGuidCName: TokenSpaceGuidCName of a Pcd +# @param Token: Token of a Pcd +# @param DatumType: DatumType of a Pcd +# @param Model: Model of a Pcd +# @param BelongsToFile: The Pcd belongs to which file +# @param BelongsToFunction: The Pcd belongs to which function +# @param StartLine: StartLine of a Pcd +# @param StartColumn: StartColumn of a Pcd +# @param EndLine: EndLine of a Pcd +# @param EndColumn: EndColumn of a Pcd +# +# @var ID: ID of a Pcd +# @var CName: CName of a Pcd +# @var TokenSpaceGuidCName: TokenSpaceGuidCName of a Pcd +# @var Token: Token of a Pcd +# @var DatumType: DatumType of a Pcd +# @var Model: Model of a Pcd +# @var BelongsToFile: The Pcd belongs to which file +# @var BelongsToFunction: The Pcd belongs to which function +# @var StartLine: StartLine of a Pcd +# @var StartColumn: StartColumn of a Pcd +# @var EndLine: EndLine of a Pcd +# @var EndColumn: EndColumn of a Pcd +# +class PcdDataClass(object): + def __init__(self, ID = -1, CName = '', TokenSpaceGuidCName = '', Token = '', DatumType = '', Model = MODEL_UNKNOWN, \ + BelongsToFile = -1, BelongsToFunction = -1, StartLine = -1, StartColumn = -1, EndLine = -1, EndColumn = -1): + self.ID = ID + self.CName = CName + self.TokenSpaceGuidCName = TokenSpaceGuidCName + self.Token = Token + self.DatumType = DatumType + self.BelongsToFile = BelongsToFile + self.BelongsToFunction = BelongsToFunction + self.StartLine = StartLine + self.StartColumn = StartColumn + self.EndLine = EndLine + self.EndColumn = EndColumn + +## FileClass +# +# This class defines a structure of a file +# +# @param ID: ID of a File +# @param Name: Name of a File +# @param ExtName: ExtName of a File +# @param Path: Path of a File +# @param FullPath: FullPath of a File +# @param Model: Model of a File +# @param TimeStamp: TimeStamp of a File +# @param FunctionList: FunctionList of a File +# @param IdentifierList: IdentifierList of a File +# @param PcdList: PcdList of a File +# +# @var ID: ID of a File +# @var Name: Name of a File +# @var ExtName: ExtName of a File +# @var Path: Path of a File +# @var FullPath: FullPath of a File +# @var Model: Model of a File +# @var TimeStamp: TimeStamp of a File +# @var FunctionList: FunctionList of a File +# @var IdentifierList: IdentifierList of a File +# @var PcdList: PcdList of a File +# +class FileClass(object): + def __init__(self, ID = -1, Name = '', ExtName = '', Path = '', FullPath = '', Model = MODEL_UNKNOWN, TimeStamp = '', \ + FunctionList = [], IdentifierList = [], PcdList = []): + self.ID = ID + self.Name = Name + self.ExtName = ExtName + self.Path = Path + self.FullPath = FullPath + self.Model = Model + self.TimeStamp = TimeStamp + + self.FunctionList = FunctionList + self.IdentifierList = IdentifierList + self.PcdList = PcdList diff --git a/BaseTools/Source/Python/CommonDataClass/DistributionPackageClass.py b/BaseTools/Source/Python/CommonDataClass/DistributionPackageClass.py new file mode 100644 index 0000000000..cd8bd4cb7f --- /dev/null +++ b/BaseTools/Source/Python/CommonDataClass/DistributionPackageClass.py @@ -0,0 +1,159 @@ +## @file +# This file is used to define a class object to describe a distribution package +# +# Copyright (c) 2008, Intel Corporation +# All rights reserved. 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 +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +## +# Import Modules +# +import os.path +from CommonClass import * +from Common.Misc import sdict +from Common.Misc import GetFiles +from Common.DecClassObjectLight import Dec +from Common.InfClassObjectLight import Inf +from Common.XmlParser import * + +## DistributionPackageHeaderClass +# +class DistributionPackageHeaderClass(IdentificationClass, CommonHeaderClass): + def __init__(self): + IdentificationClass.__init__(self) + CommonHeaderClass.__init__(self) + self.ReadOnly = 'False' + self.RePackage = 'True' + self.Vendor = '' + self.Date = '' + self.Signature = 'Md5Sum' + self.XmlSpecification = '' + +## DistributionPackageClass +# +# +class DistributionPackageClass(object): + def __init__(self): + self.Header = DistributionPackageHeaderClass() + self.PackageSurfaceArea = sdict() # {(Guid, Version, Path) : PackageObj} + self.ModuleSurfaceArea = sdict() # {(Guid, Version, Path) : ModuleObj} + self.Tools = MiscFileClass() + self.MiscellaneousFiles = MiscFileClass() + self.UserExtensions = [] + + ## Get all included packages and modules for a distribution package + # + # @param WorkspaceDir: WorkspaceDir + # @param PackageList: A list of all packages + # @param ModuleList: A list of all modules + # + def GetDistributionPackage(self, WorkspaceDir, PackageList, ModuleList): + AllGuidVersionDict = {} + # Get Packages + if PackageList: + for PackageFile in PackageList: + PackageFileFullPath = os.path.normpath(os.path.join(WorkspaceDir, PackageFile)) + DecObj = Dec(PackageFileFullPath, True, WorkspaceDir) + PackageObj = DecObj.Package + AllGuidVersionDict[PackageFileFullPath] = [PackageObj.PackageHeader.Guid, PackageObj.PackageHeader.Version] + + # Parser inf file one bye one + for File in PackageObj.MiscFiles.Files: + Filename = os.path.normpath(os.path.join(PackageObj.PackageHeader.RelaPath, File.Filename)) + (Name, ExtName) = os.path.splitext(Filename) + if ExtName.upper() == '.INF': + InfObj = Inf(Filename, True, WorkspaceDir, DecObj.Identification.PackagePath) + ModuleObj = InfObj.Module + AllGuidVersionDict[File] = [ModuleObj.ModuleHeader.Guid, ModuleObj.ModuleHeader.Version] + # Find and update Guid/Version of LibraryClass + for Item in ModuleObj.LibraryClasses: + if Item.RecommendedInstance: + LibClassIns = os.path.normpath(os.path.join(WorkspaceDir, Item.RecommendedInstance)) + Guid, Version = '', '' + if LibClassIns in AllGuidVersionDict: + Guid = AllGuidVersionDict[LibClassIns][0] + Version = AllGuidVersionDict[LibClassIns][1] + else: + Lib = Inf(LibClassIns, True, WorkspaceDir) + Guid = Lib.Module.ModuleHeader.Guid + Version = Lib.Module.ModuleHeader.Version + AllGuidVersionDict[LibClassIns] = [Guid, Version] + Item.RecommendedInstanceGuid = Guid + Item.RecommendedInstanceVersion = Version + # Find and update Guid/Version of + for Item in ModuleObj.PackageDependencies: + if Item.FilePath: + PackageFilePath = os.path.normpath(os.path.join(WorkspaceDir, Item.FilePath)) + Guid, Version = '', '' + if PackageFilePath in AllGuidVersionDict: + Guid = AllGuidVersionDict[PackageFilePath][0] + Version = AllGuidVersionDict[PackageFilePath][1] + else: + PackageDependencies = Dec(PackageFilePath, True, WorkspaceDir) + Guid = PackageDependencies.Package.PackageHeader.Guid + Version = PackageDependencies.Package.PackageHeader.Version + AllGuidVersionDict[PackageFilePath] = [Guid, Version] + Item.PackageGuid = Guid + Item.PackageVersion = Version + + # Add module to package + PackageObj.Modules[(ModuleObj.ModuleHeader.Guid, ModuleObj.ModuleHeader.Version, ModuleObj.ModuleHeader.CombinePath)] = ModuleObj + self.PackageSurfaceArea[(PackageObj.PackageHeader.Guid, PackageObj.PackageHeader.Version, PackageObj.PackageHeader.CombinePath)] = PackageObj + + # Get Modules + if ModuleList: + for ModuleFile in ModuleList: + ModuleFileFullPath = os.path.normpath(os.path.join(WorkspaceDir, ModuleFile)) + InfObj = Inf(ModuleFileFullPath, True, WorkspaceDir) + ModuleObj = InfObj.Module + AllGuidVersionDict[ModuleFileFullPath] = [ModuleObj.ModuleHeader.Guid, ModuleObj.ModuleHeader.Version] + # Find and update Guid/Version of LibraryClass + for Item in ModuleObj.LibraryClasses: + if Item.RecommendedInstance: + LibClassIns = os.path.normpath(os.path.join(WorkspaceDir, Item.RecommendedInstance)) + Guid, Version = '', '' + if LibClassIns in AllGuidVersionDict: + Guid = AllGuidVersionDict[LibClassIns][0] + Version = AllGuidVersionDict[LibClassIns][1] + else: + Lib = Inf(LibClassIns, True, WorkspaceDir) + Guid = Lib.Module.ModuleHeader.Guid + Version = Lib.Module.ModuleHeader.Version + AllGuidVersionDict[LibClassIns] = [Guid, Version] + Item.RecommendedInstanceGuid = Guid + Item.RecommendedInstanceVersion = Version + # Find and update Guid/Version of + for Item in ModuleObj.PackageDependencies: + if Item.FilePath: + PackageFilePath = os.path.normpath(os.path.join(WorkspaceDir, Item.FilePath)) + Guid, Version = '', '' + if PackageFilePath in AllGuidVersionDict: + Guid = AllGuidVersionDict[PackageFilePath][0] + Version = AllGuidVersionDict[PackageFilePath][1] + else: + PackageDependencies = Dec(PackageFilePath, True, WorkspaceDir) + Guid = PackageDependencies.Package.PackageHeader.Guid + Version = PackageDependencies.Package.PackageHeader.Version + AllGuidVersionDict[PackageFilePath] = [Guid, Version] + Item.PackageGuid = Guid + Item.PackageVersion = Version + self.ModuleSurfaceArea[(ModuleObj.ModuleHeader.Guid, ModuleObj.ModuleHeader.Version, ModuleObj.ModuleHeader.CombinePath)] = ModuleObj + +## +# +# This acts like the main() function for the script, unless it is 'import'ed into another +# script. +# +if __name__ == '__main__': + pass + D = DistributionPackageClass() + D.GetDistributionPackage(os.getenv('WORKSPACE'), ['MdePkg/MdePkg.dec', 'TianoModulePkg/TianoModulePkg.dec'], ['MdeModulePkg/Application/HelloWorld/HelloWorld.inf']) + Xml = DistributionPackageXml() + print Xml.ToXml(D) + E = Xml.FromXml('C:\\2.xml') + #print Xml.ToXml(E) diff --git a/BaseTools/Source/Python/CommonDataClass/FdfClass.py b/BaseTools/Source/Python/CommonDataClass/FdfClass.py new file mode 100644 index 0000000000..a9e12ed46d --- /dev/null +++ b/BaseTools/Source/Python/CommonDataClass/FdfClass.py @@ -0,0 +1,402 @@ +## @file +# classes represent data in FDF +# +# Copyright (c) 2007, Intel Corporation +# +# All rights reserved. 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 +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## FD data in FDF +# +# +class FDClassObject: + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + self.FdUiName = '' + self.CreateFileName = None + self.BaseAddress = None + self.BaseAddressPcd = None + self.Size = None + self.SizePcd = None + self.ErasePolarity = '1' + # 3-tuple list (blockSize, numBlocks, pcd) + self.BlockSizeList = [] + # DefineVarDict[var] = value + self.DefineVarDict = {} + # SetVarDict[var] = value + self.SetVarDict = {} + self.RegionList = [] + self.vtfRawDict = {} + +## FV data in FDF +# +# +class FvClassObject: + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + self.UiFvName = None + self.CreateFileName = None + # 3-tuple list (blockSize, numBlocks, pcd) + self.BlockSizeList = [] + # DefineVarDict[var] = value + self.DefineVarDict = {} + # SetVarDict[var] = value + self.SetVarDict = {} + self.FvAlignment = None + # FvAttributeDict[attribute] = TRUE/FALSE (1/0) + self.FvAttributeDict = {} + self.FvNameGuid = None + self.AprioriSectionList = [] + self.FfsList = [] + self.BsBaseAddress = None + self.RtBaseAddress = None + +## Region data in FDF +# +# +class RegionClassObject: + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + self.Offset = None # The begin position of the Region + self.Size = None # The Size of the Region + self.PcdOffset = None + self.PcdSize = None + self.SetVarDict = {} + self.RegionType = None + self.RegionDataList = [] + +## FFS data in FDF +# +# +class FfsClassObject: + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + self.NameGuid = None + self.Fixed = False + self.CheckSum = False + self.Alignment = None + self.SectionList = [] + +## FILE statement data in FDF +# +# +class FileStatementClassObject (FfsClassObject) : + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + FfsClassObject.__init__(self) + self.FvFileType = None + self.FileName = None + self.KeyStringList = [] + self.FvName = None + self.FdName = None + self.DefineVarDict = {} + self.AprioriSection = None + self.KeepReloc = None + +## INF statement data in FDF +# +# +class FfsInfStatementClassObject(FfsClassObject): + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + FfsClassObject.__init__(self) + self.Rule = None + self.Version = None + self.Ui = None + self.InfFileName = None + self.BuildNum = '' + self.KeyStringList = [] + self.KeepReloc = None + self.UseArch = None + +## APRIORI section data in FDF +# +# +class AprioriSectionClassObject: + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + # DefineVarDict[var] = value + self.DefineVarDict = {} + self.FfsList = [] + +## section data in FDF +# +# +class SectionClassObject: + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + self.Alignment = None + +## Depex expression section in FDF +# +# +class DepexSectionClassObject (SectionClassObject): + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + self.DepexType = None + self.Expression = None + +## Compress section data in FDF +# +# +class CompressSectionClassObject (SectionClassObject) : + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + SectionClassObject.__init__(self) + self.CompType = None + self.SectionList = [] + +## Data section data in FDF +# +# +class DataSectionClassObject (SectionClassObject): + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + SectionClassObject.__init__(self) + self.SecType = None + self.SectFileName = None + self.SectionList = [] + self.KeepReloc = True + +## Rule section data in FDF +# +# +class EfiSectionClassObject (SectionClassObject): + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + SectionClassObject.__init__(self) + self.SectionType = None + self.Optional = False + self.FileType = None + self.StringData = None + self.FileName = None + self.FileExtension = None + self.BuildNum = None + self.KeepReloc = None + +## FV image section data in FDF +# +# +class FvImageSectionClassObject (SectionClassObject): + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + SectionClassObject.__init__(self) + self.Fv = None + self.FvName = None + self.FvFileType = None + self.FvFileName = None + self.FvFileExtension = None + +## GUIDed section data in FDF +# +# +class GuidSectionClassObject (SectionClassObject) : + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + SectionClassObject.__init__(self) + self.NameGuid = None + self.SectionList = [] + self.SectionType = None + self.ProcessRequired = False + self.AuthStatusValid = False + +## UI section data in FDF +# +# +class UiSectionClassObject (SectionClassObject): + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + SectionClassObject.__init__(self) + self.StringData = None + self.FileName = None + +## Version section data in FDF +# +# +class VerSectionClassObject (SectionClassObject): + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + SectionClassObject.__init__(self) + self.BuildNum = None + self.StringData = None + self.FileName = None + +## Rule data in FDF +# +# +class RuleClassObject : + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + self.Arch = None + self.ModuleType = None # For Module Type + self.TemplateName = None + self.NameGuid = None + self.Fixed = False + self.Alignment = None + self.CheckSum = False + self.FvFileType = None # for Ffs File Type + self.KeyStringList = [] + self.KeepReloc = None + +## Complex rule data in FDF +# +# +class RuleComplexFileClassObject(RuleClassObject) : + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + RuleClassObject.__init__(self) + self.SectionList = [] + +## Simple rule data in FDF +# +# +class RuleSimpleFileClassObject(RuleClassObject) : + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + RuleClassObject.__init__(self) + self.FileName = None + self.SectionType = '' + self.FileExtension = None + +## File extension rule data in FDF +# +# +class RuleFileExtensionClassObject(RuleClassObject): + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + RuleClassObject.__init__(self) + self.FileExtension = None + +## Capsule data in FDF +# +# +class CapsuleClassObject : + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + self.SpecName = None + self.UiCapsuleName = None + self.CreateFile = None + self.GroupIdNumber = None + # DefineVarDict[var] = value + self.DefineVarDict = {} + # SetVarDict[var] = value + self.SetVarDict = {} + # TokensDict[var] = value + self.TokensDict = {} + self.CapsuleDataList = [] + +## VTF data in FDF +# +# +class VtfClassObject : + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + self.KeyArch = None + self.ArchList = None + self.UiName = None + self.ResetBin = None + self.ComponentStatementList = [] + +## VTF component data in FDF +# +# +class ComponentStatementClassObject : + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + self.CompName = None + self.CompLoc = None + self.CompType = None + self.CompVer = None + self.CompCs = None + self.CompBin = None + self.CompSym = None + self.CompSize = None + self.FilePos = None + +## OptionROM data in FDF +# +# +class OptionRomClassObject: + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + self.DriverName = None + self.FfsList = [] + \ No newline at end of file diff --git a/BaseTools/Source/Python/CommonDataClass/ModuleClass.py b/BaseTools/Source/Python/CommonDataClass/ModuleClass.py new file mode 100644 index 0000000000..9d780725b9 --- /dev/null +++ b/BaseTools/Source/Python/CommonDataClass/ModuleClass.py @@ -0,0 +1,486 @@ +## @file +# This file is used to define a class object to describe a module +# +# Copyright (c) 2007, Intel Corporation +# All rights reserved. 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 +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +## +# Import Modules +# +from CommonClass import * + +## ModuleHeaderClass +# +# This class defined header items used in Module file +# +# @param IdentificationClass: Inherited from IdentificationClass class +# @param CommonHeaderClass: Inherited from CommonHeaderClass class +# @param DefineClass: Inherited from DefineClass class +# +# @var ModuleType: To store value for ModuleType +# @var SupArchList: To store value for SupArchList, selection scope is in below list +# EBC | IA32 | X64 | IPF | ARM | PPC +# @var BinaryModule: To store value for BinaryModule +# @var OutputFileBasename: To store value for OutputFileBasename +# @var ClonedFrom: To store value for ClonedFrom, it is a set structure as +# [ ClonedRecordClass, ... ] +# @var PcdIsDriver: To store value for PcdIsDriver, selection scope is in below list +# PEI_PCD_DRIVER | DXE_PCD_DRIVER +# @var TianoR8FlashMap_h: To store value for TianoR8FlashMap_h +# @var InfVersion: To store value for InfVersion +# @var EfiSpecificationVersion: To store value for EfiSpecificationVersion +# @var EdkReleaseVersion: To store value for EdkReleaseVersion +# @var LibraryClass: To store value for LibraryClass, it is a set structure as +# [ LibraryClassClass, ...] +# @var ComponentType: To store value for ComponentType, selection scope is in below list +# LIBRARY | SECURITY_CORE | PEI_CORE | COMBINED_PEIM_DRIVER | PIC_PEIM | RELOCATABLE_PEIM | BS_DRIVER | RT_DRIVER | SAL_RT_DRIVER | APPLICATION +# @var MakefileName: To store value for MakefileName +# @var BuildNumber: To store value for BuildNumber +# @var BuildType: To store value for BuildType +# @var FfsExt: To store value for FfsExt +# @var FvExt: To store value for FvExt +# @var SourceFv: To store value for SourceFv +# @var CustomMakefile: To store value for CustomMakefile, it is a set structure as +# { Family : Filename, ... } +# @var Shadow: To store value for Shadow +# @var MacroDefines To store the defined macros +# +class ModuleHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass): + def __init__(self): + IdentificationClass.__init__(self) + CommonHeaderClass.__init__(self) + DefineClass.__init__(self) + self.ModuleType = '' + self.SupModuleList = [] + self.SupArchList = [] + self.BinaryModule = False + self.OutputFileBasename = '' + self.ClonedFrom = [] + self.PcdIsDriver = '' + self.TianoR8FlashMap_h = False + self.InfVersion = '' + self.EfiSpecificationVersion = '' + self.PiSpecificationVersion = '' + self.UefiSpecificationVersion = '' + self.EdkReleaseVersion = '' + self.LibraryClass = [] + self.ComponentType = '' + self.MakefileName = '' + self.BuildNumber = '' + self.BuildType = '' + self.FfsExt = '' + self.FvExt = '' + self.SourceFv = '' + self.CustomMakefile = {} + self.Shadow = '' + self.MacroDefines = {} + self.SourceOverridePath = '' + self.Specification = [] + +## ModuleSourceFileClass +# +# This class defined source file item used in Module file +# +# @param CommonClass: Inherited from CommonClass class +# @param SourceFile: Input value for SourceFile, default is '' +# @param TagName: Input value for TagName, default is '' +# @param ToolCode: Input value for ToolCode, default is '' +# @param ToolChainFamily: Input value for ToolChainFamily, default is '' +# @param FeatureFlag: Input value for FeatureFlag, default is '' +# @param SupArchList: Input value for SupArchList, default is [] +# +# @var SourceFile: To store value for SourceFile +# @var TagName: To store value for TagName +# @var ToolCode: To store value for ToolCode +# @var ToolChainFamily: To store value for ToolChainFamily +# +class ModuleSourceFileClass(CommonClass): + def __init__(self, SourceFile = '', TagName = '', ToolCode = '', ToolChainFamily = '', FeatureFlag = '', SupArchList = None): + self.SourceFile = SourceFile + self.TagName = TagName + self.ToolCode = ToolCode + self.ToolChainFamily = ToolChainFamily + self.FileType = '' + CommonClass.__init__(self, FeatureFlag = FeatureFlag, SupArchList = SupArchList) + +## ModuleBinaryFileClass +# +# This class defined binary file item used in Module file +# +# @param CommonClass: Inherited from CommonClass class +# @param BinaryFile: Input value for BinaryFile, default is '' +# @param FileType: Input value for FileType, default is '' +# @param FeatureFlag: Input value for FeatureFlag, default is '' +# @param SupArchList: Input value for SupArchList, default is [] +# +# @var BinaryFile: To store value for BinaryFile +# @var FileType: To store value for FileType, selection scope is in below list +# FW | GUID | PREEFORM | UEFI_APP | UNI_UI | UNI_VER | LIB | PE32 | PIC | PEI_DEPEX | DXE_DEPEX | TE | VER | UI | BIN | FV +# @var Target: To store value for Target +# @var ToolChainFamily: To store value for ToolChainFamily +# +class ModuleBinaryFileClass(CommonClass): + def __init__(self, BinaryFile = '', FileType = '', Target = '', FeatureFlag = '', SupArchList = None): + self.BinaryFile = BinaryFile + self.FileType = FileType + self.Target = Target + CommonClass.__init__(self, FeatureFlag = FeatureFlag, SupArchList = SupArchList) + self.Filenames = [] + self.PatchPcdValues = [] + self.PcdExValues = [] + self.LibraryInstances = [] + self.BuildFlags = [] + +## ModulePackageDependencyClass +# +# This class defined package dependency item used in Module file +# +# @param CommonClass: Inherited from CommonClass class +# @param DefineClass: Input value for DefineClass class +# +# @var FilePath: To store value for FilePath +# @var PackageName: To store value for PackageName +# @var PackageVersion: To store value for PackageVersion +# @var PackageGuid: To store value for PackageGuid +# +class ModulePackageDependencyClass(CommonClass, DefineClass): + def __init__(self): + self.FilePath = '' + self.PackageName = '' + self.PackageVersion = '' + self.PackageGuid = '' + self.Description = '' + CommonClass.__init__(self) + DefineClass.__init__(self) + +## ModuleLibraryClass +# +# This class defined library item used in Module file +# +# @param CommonClass: Inherited from CommonClass class +# +# @var Library: To store value for Library +# +class ModuleLibraryClass(CommonClass): + def __init__(self): + self.Library = '' + CommonClass.__init__(self) + +## ModuleEventClass +# +# This class defined event item used in Module file +# +# @param CommonClass: Inherited from CommonClass class +# +# @var CName: To store value for CName +# @var GuidCName: To store value for GuidCName +# @var Type: To store value for Type, selection scope is in below list +# CREATE_EVENT | SIGNAL_EVENT +# +class ModuleEventClass(CommonClass): + def __init__(self): + self.CName = '' + self.GuidCName = '' + self.Type = '' + CommonClass.__init__(self) + +## ModuleHobClass +# +# This class defined hob item used in Module file +# +# @param CommonClass: Inherited from CommonClass class +# +# @var GuidCName: To store value for GuidCName +# @var Type: To store value for Type, selection scope is in below list +# PHIT | MEMORY_ALLOCATION | RESOURCE_DESCRIPTOR | GUID_EXTENSION | FIRMWARE_VOLUME | CPU | POOL | CAPSULE_VOLUME +# +class ModuleHobClass(CommonClass): + def __init__(self): + self.Type = '' + self.GuidCName = '' + CommonClass.__init__(self) + +## ModuleVariableClass +# +# This class defined variable item used in Module file +# +# @param CommonClass: Inherited from CommonClass class +# +# @var GuidCName: To store value for GuidCName +# @var Name: To store value for Name +# +class ModuleVariableClass(CommonClass): + def __init__(self): + self.Name = '' + self.GuidCName = '' + CommonClass.__init__(self) + +## ModuleBootModeClass +# +# This class defined boot mode item used in Module file +# +# @param CommonClass: Inherited from CommonClass class +# +# @var Name: To store value for Name, selection scope is in below list +# FULL | MINIMAL | NO_CHANGE | DIAGNOSTICS | DEFAULT | S2_RESUME | S3_RESUME | S4_RESUME | S5_RESUME | FLASH_UPDATE | RECOVERY_FULL | RECOVERY_MINIMAL | RECOVERY_NO_CHANGE | RECOVERY_DIAGNOSTICS | RECOVERY_DEFAULT | RECOVERY_S2_RESUME | RECOVERY_S3_RESUME | RECOVERY_S4_RESUME | RECOVERY_S5_RESUME | RECOVERY_FLASH_UPDATE +# +class ModuleBootModeClass(CommonClass): + def __init__(self): + self.Name = '' + CommonClass.__init__(self) + +## ModuleSystemTableClass +# +# This class defined system table item used in Module file +# +# @param CommonClass: Inherited from CommonClass class +# +# @var CName: To store value for CName +# +class ModuleSystemTableClass(CommonClass): + def __init__(self): + self.CName = '' + CommonClass.__init__(self) + +## ModuleDataHubClass +# +# This class defined data hub item used in Module file +# +# @param CommonClass: Inherited from CommonClass class +# +# @var CName: To store value for CName +# +class ModuleDataHubClass(CommonClass): + def __init__(self): + self.CName = '' + CommonClass.__init__(self) + +## ModuleHiiPackageClass +# +# This class defined Hii package item used in Module file +# +# @param CommonClass: Inherited from CommonClass class +# +# @var CName: To store value for CName +# +class ModuleHiiPackageClass(CommonClass): + def __init__(self): + self.CName = '' + CommonClass.__init__(self) + +## ModuleExternImageClass +# +# This class defined Extern Image item used in Module file +# +# @param object: Inherited from object class +# +# @var ModuleEntryPoint: To store value for ModuleEntryPoint +# @var ModuleUnloadImage: To store value for ModuleUnloadImage +# +class ModuleExternImageClass(object): + def __init__(self): + self.ModuleEntryPoint = '' + self.ModuleUnloadImage = '' + +## ModuleExternLibraryClass +# +# This class defined Extern Library item used in Module file +# +# @param object: Inherited from object class +# +# @var Constructor: To store value for Constructor +# @var Destructor: To store value for Destructor +# +class ModuleExternLibraryClass(object): + def __init__(self): + self.Constructor = '' + self.Destructor = '' + +## ModuleExternDriverClass +# +# This class defined Extern Driver item used in Module file +# +# @param object: Inherited from object class +# +# @var DriverBinding: To store value for DriverBinding +# @var ComponentName: To store value for ComponentName +# @var DriverConfig: To store value for DriverConfig +# @var DriverDiag: To store value for DriverDiag +# +class ModuleExternDriverClass(object): + def __init__(self): + self.DriverBinding= '' + self.ComponentName = '' + self.DriverConfig = '' + self.DriverDiag = '' + +## ModuleExternCallBackClass +# +# This class defined Extern Call Back item used in Module file +# +# @param object: Inherited from object class +# +# @var SetVirtualAddressMapCallBack: To store value for SetVirtualAddressMapCallBack +# @var ExitBootServicesCallBack: To store value for ExitBootServicesCallBack +# +class ModuleExternCallBackClass(object): + def __init__(self): + self.SetVirtualAddressMapCallBack = '' + self.ExitBootServicesCallBack = '' + +## ModuleExternClass +# +# This class defined Extern used in Module file +# +# @param object: Inherited from object class +# +# +class ModuleExternClass(CommonClass): + def __init__(self): + self.EntryPoint = '' + self.UnloadImage = '' + self.Constructor = '' + self.Destructor = '' + CommonClass.__init__(self) + +## ModuleDepexClass +# +# This class defined depex item used in Module file +# +# @param CommonClass: Inherited from CommonClass class +# @param DefineClass: Input value for DefineClass class +# +# @var Depex: To store value for Depex +# +class ModuleDepexClass(CommonClass, DefineClass): + def __init__(self): + CommonClass.__init__(self) + DefineClass.__init__(self) + self.Depex = '' + +## ModuleNmakeClass +# +# This class defined nmake item used in Module file +# +# @param CommonClass: Inherited from CommonClass class +# +# @var Name: To store value for Name +# @var Value: To store value for Value +# +class ModuleNmakeClass(CommonClass): + def __init__(self): + CommonClass.__init__(self) + self.Name = '' + self.Value = '' + +## ModuleClass +# +# This class defined a complete module item +# +# @param object: Inherited from object class +# +# @var Header: To store value for Header, it is a structure as +# {Arch : ModuleHeaderClass} +# @var LibraryClasses: To store value for LibraryClasses, it is a list structure as +# [ LibraryClassClass, ...] +# @var Libraries: To store value for Libraries, it is a list structure as +# [ ModuleLibraryClass, ...] +# @var Sources: To store value for Sources, it is a list structure as +# [ ModuleSourceFileClass, ...] +# @var Binaries: To store value for Binaries, it is a list structure as +# [ ModuleBinaryFileClass, ...] +# @var NonProcessedFiles: To store value for NonProcessedFiles, it is a list structure as +# [ '', '', ...] +# @var PackageDependencies: To store value for PackageDependencies, it is a list structure as +# [ ModulePackageDependencyClass, ... ] +# @var Nmake: To store value for Nmake, it is a list structure as +# [ ModuleNmakeClass, ... ] +# @var Depex: To store value for Depex, it is a list structure as +# [ ModuleDepexClass, ... ] +# @var Includes: To store value for Includes, it is a list structure as +# [ IncludeClass, ...] +# @var Protocols: To store value for Protocols, it is a list structure as +# [ ProtocolClass, ...] +# @var Ppis: To store value for Ppis, it is a list structure as +# [ PpiClass, ...] +# @var Events: To store value for Events, it is a list structure as +# [ ModuleEventClass, ...] +# @var Hobs: To store value for Hobs, it is a list structure as +# [ ModuleHobClass, ...] +# @var Variables: To store value for Variables, it is a list structure as +# [ ModuleVariableClass, ...] +# @var BootModes: To store value for BootModes, it is a list structure as +# [ ModuleBootModeClass, ...] +# @var SystemTables: To store value for SystemTables, it is a list structure as +# [ ModuleSystemTableClass, ...] +# @var DataHubs: To store value for DataHubs, it is a list structure as +# [ ModuleDataHubClass, ...] +# @var HiiPackages: To store value for HiiPackages, it is a list structure as +# [ ModuleHiiPackageClass, ...] +# @var Guids: To store value for Guids, it is a list structure as +# [ GuidClass, ...] +# @var PcdCodes: To store value for PcdCodes, it is a list structure as +# [ PcdClass, ...] +# @var ExternImages: To store value for ExternImages, it is a list structure as +# [ ModuleExternImageClass, ...] +# @var ExternLibraries: To store value for ExternLibraries, it is a list structure as +# [ ModuleExternLibraryClass, ...] +# @var ExternDrivers: To store value for ExternDrivers, it is a list structure as +# [ ModuleExternDriverClass, ...] +# @var ExternCallBacks: To store value for ExternCallBacks, it is a list structure as +# [ ModuleExternCallBackClass, ...] +# @var BuildOptions: To store value for BuildOptions, it is a list structure as +# [ BuildOptionClass, ...] +# @var UserExtensions: To store value for UserExtensions, it is a list structure as +# [ UserExtensionsClass, ...] +# +class ModuleClass(object): + def __init__(self): + self.Header = {} + self.ModuleHeader = ModuleHeaderClass() + self.LibraryClasses = [] + self.Libraries = [] + self.Sources = [] + self.Binaries = [] + self.NonProcessedFiles = [] + self.PackageDependencies = [] + self.Nmake = [] + self.Depex = [] + self.PeiDepex = None + self.DxeDepex = None + self.SmmDepex = None + self.Includes = [] + self.Protocols = [] + self.Ppis = [] + self.Events = [] + self.Hobs = [] + self.Variables = [] + self.BootModes = [] + self.SystemTables = [] + self.DataHubs = [] + self.HiiPackages = [] + self.Guids = [] + self.PcdCodes = [] + self.ExternImages = [] + self.ExternLibraries = [] + self.ExternDrivers = [] + self.ExternCallBacks = [] + self.Externs = [] + self.BuildOptions = [] + self.UserExtensions = None + self.MiscFiles = None + self.FileList = [] + +## +# +# This acts like the main() function for the script, unless it is 'import'ed into another +# script. +# +if __name__ == '__main__': + M = ModuleClass() diff --git a/BaseTools/Source/Python/CommonDataClass/PackageClass.py b/BaseTools/Source/Python/CommonDataClass/PackageClass.py new file mode 100644 index 0000000000..c064f25ddb --- /dev/null +++ b/BaseTools/Source/Python/CommonDataClass/PackageClass.py @@ -0,0 +1,127 @@ +## @file +# This file is used to define a class object to describe a package +# +# Copyright (c) 2007, Intel Corporation +# All rights reserved. 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 +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +## +# Import Modules +# +from CommonClass import * +from Common.Misc import sdict + +## PackageHeaderClass +# +# This class defined header items used in Package file +# +# @param IdentificationClass: Inherited from IdentificationClass class +# @param CommonHeaderClass: Inherited from CommonHeaderClass class +# +# @var DecSpecification: To store value for DecSpecification +# @var ReadOnly: To store value for ReadOnly +# @var RePackage: To store value for RePackage +# @var ClonedFrom: To store value for ClonedFrom, it is a set structure as +# [ ClonedRecordClass, ...] +# +class PackageHeaderClass(IdentificationClass, CommonHeaderClass): + def __init__(self): + IdentificationClass.__init__(self) + CommonHeaderClass.__init__(self) + self.DecSpecification = '' + self.ReadOnly = False + self.RePackage = False + self.PackagePath = '' + self.ClonedFrom = [] + +## PackageIndustryStdHeaderClass +# +# This class defined industry std header items used in Package file +# +# @param CommonHeaderClass: Inherited from CommonHeaderClass class +# +# @var Name: To store value for Name +# @var IncludeHeader: To store value for IncludeHeader +# +class PackageIndustryStdHeaderClass(CommonClass): + def __init__(self): + self.Name = '' + self.IncludeHeader = '' + CommonClass.__init__(self) + +## PackageIncludePkgHeaderClass +# +# This class defined include Pkg header items used in Package file +# +# @param object: Inherited from object class +# +# @var IncludeHeader: To store value for IncludeHeader +# @var ModuleType: To store value for ModuleType, it is a set structure as +# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | TOOL | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED +# +class PackageIncludePkgHeaderClass(object): + def __init__(self): + self.IncludeHeader = '' + self.ModuleType = [] + +## PackageClass +# +# This class defined a complete package item +# +# @param object: Inherited from object class +# +# @var Header: To store value for Header, it is a structure as +# {Arch : PackageHeaderClass} +# @var Includes: To store value for Includes, it is a list structure as +# [ IncludeClass, ...] +# @var LibraryClassDeclarations: To store value for LibraryClassDeclarations, it is a list structure as +# [ LibraryClassClass, ...] +# @var IndustryStdHeaders: To store value for IndustryStdHeaders, it is a list structure as +# [ PackageIndustryStdHeader, ...] +# @var ModuleFiles: To store value for ModuleFiles, it is a list structure as +# [ '', '', ...] +# @var PackageIncludePkgHeaders: To store value for PackageIncludePkgHeaders, it is a list structure as +# [ PackageIncludePkgHeader, ...] +# @var GuidDeclarations: To store value for GuidDeclarations, it is a list structure as +# [ GuidClass, ...] +# @var ProtocolDeclarations: To store value for ProtocolDeclarations, it is a list structure as +# [ ProtocolClass, ...] +# @var PpiDeclarations: To store value for PpiDeclarations, it is a list structure as +# [ PpiClass, ...] +# @var PcdDeclarations: To store value for PcdDeclarations, it is a list structure as +# [ PcdClass, ...] +# @var UserExtensions: To store value for UserExtensions, it is a list structure as +# [ UserExtensionsClass, ...] +# +class PackageClass(object): + def __init__(self): + self.PackageHeader = PackageHeaderClass() + self.Header = {} + self.Includes = [] + self.LibraryClassDeclarations = [] + self.IndustryStdHeaders = [] + self.ModuleFiles = [] + # {[Guid, Value, Path(relative to WORKSPACE)]: ModuleClassObj} + self.Modules = sdict() + self.PackageIncludePkgHeaders = [] + self.GuidDeclarations = [] + self.ProtocolDeclarations = [] + self.PpiDeclarations = [] + self.PcdDeclarations = [] + self.PcdChecks = [] + self.UserExtensions = UserExtensionsClass() + self.MiscFiles = MiscFileClass() + self.FileList = [] + +## +# +# This acts like the main() function for the script, unless it is 'import'ed into another +# script. +# +if __name__ == '__main__': + P = PackageClass() diff --git a/BaseTools/Source/Python/CommonDataClass/PlatformClass.py b/BaseTools/Source/Python/CommonDataClass/PlatformClass.py new file mode 100644 index 0000000000..1966fb9f8c --- /dev/null +++ b/BaseTools/Source/Python/CommonDataClass/PlatformClass.py @@ -0,0 +1,432 @@ +## @file +# This file is used to define a class object to describe a platform +# +# Copyright (c) 2007, Intel Corporation +# All rights reserved. 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 +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +## +# Import Modules +# +from CommonClass import * + +## SkuInfoListClass +# +# This class defined sku info list item used in platform file +# +# @param IncludeStatementClass: Inherited from IncludeStatementClass class +# +# @var SkuInfoList: To store value for SkuInfoList, it is a set structure as +# { SkuName : SkuId } +# +class SkuInfoListClass(IncludeStatementClass): + def __init__(self): + IncludeStatementClass.__init__(self) + self.SkuInfoList = {} + +## PlatformHeaderClass +# +# This class defined header items used in Platform file +# +# @param IdentificationClass: Inherited from IdentificationClass class +# @param CommonHeaderClass: Inherited from CommonHeaderClass class +# @param DefineClass: Inherited from DefineClass class +# +# @var DscSpecification: To store value for DscSpecification +# @var SupArchList: To store value for SupArchList, selection scope is in below list +# EBC | IA32 | X64 | IPF | ARM | PPC +# @var BuildTargets: To store value for BuildTargets, selection scope is in below list +# RELEASE | DEBUG +# @var IntermediateDirectories: To store value for IntermediateDirectories, selection scope is in below list +# MODULE | UNIFIED +# @var OutputDirectory: To store value for OutputDirectory +# @var ForceDebugTarget: To store value for ForceDebugTarget +# @var SkuIdName: To store value for SkuIdName +# @var BuildNumber: To store value for BuildNumber +# @var MakefileName: To store value for MakefileName +# @var ClonedFrom: To store value for ClonedFrom, it is a list structure as +# [ ClonedRecordClass, ... ] +# +class PlatformHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass): + def __init__(self): + IdentificationClass.__init__(self) + CommonHeaderClass.__init__(self) + DefineClass.__init__(self) + self.DscSpecification = '' + self.SupArchList = [] + self.BuildTargets = [] + self.IntermediateDirectories = '' + self.OutputDirectory = '' + self.ForceDebugTarget = '' + self.SkuIdName = [] + self.BuildNumber = '' + self.MakefileName = '' + self.ClonedFrom = [] + +## PlatformFlashDefinitionFileClass +# +# This class defined FlashDefinitionFile item used in platform file +# +# @param object: Inherited from object class +# +# @var Id: To store value for Id +# @var UiName: To store value for UiName +# @var Preferred: To store value for Preferred +# @var FilePath: To store value for FilePath +# +class PlatformFlashDefinitionFileClass(object): + def __init__(self): + self.Id = '' + self.UiName = '' + self.Preferred = False + self.FilePath = '' + +## PlatformFvImageOptionClass +# +# This class defined FvImageOption item used in platform file +# +# @param object: Inherited from object class +# +# @var FvImageOptionName: To store value for FvImageOptionName +# @var FvImageOptionValues: To store value for FvImageOptionValues +# +class PlatformFvImageOptionClass(object): + def __init__(self): + self.FvImageOptionName = '' + self.FvImageOptionValues = [] + +## PlatformFvImageClass +# +# This class defined FvImage item used in platform file +# +# @param object: Inherited from object class +# +# @var Name: To store value for Name +# @var Value: To store value for Value +# @var Type: To store value for Type, selection scope is in below list +# Attributes | Options | Components | ImageName +# @var FvImageNames: To store value for FvImageNames +# @var FvImageOptions: To store value for FvImageOptions, it is a list structure as +# [ PlatformFvImageOption, ...] +# +class PlatformFvImageClass(object): + def __init__(self): + self.Name = '' + self.Value = '' + self.Type = '' + self.FvImageNames = [] + self.FvImageOptions = [] + +## PlatformFvImageNameClass +# +# This class defined FvImageName item used in platform file +# +# @param object: Inherited from object class +# +# @var Name: To store value for Name +# @var Type: To store value for Type, selection scope is in below list +# FV_MAIN | FV_MAIN_COMPACT | NV_STORAGE | FV_RECOVERY | FV_RECOVERY_FLOPPY | FV_FILE | CAPSULE_CARGO | NULL | USER_DEFINED +# @var FvImageOptions: To store value for FvImageOptions, it is a list structure as +# [ PlatformFvImageOption, ...] +# +class PlatformFvImageNameClass(object): + def __init__(self): + self.Name = '' + self.Type = '' + self.FvImageOptions = [] + +## PlatformFvImagesClass +# +# This class defined FvImages item used in platform file +# +# @param object: Inherited from object class +# +# @var FvImages: To store value for FvImages +# +class PlatformFvImagesClass(object): + def __init__(self): + self.FvImages = [] + +## PlatformAntTaskClass +# +# This class defined AntTask item used in platform file +# +# @param object: Inherited from object class +# +# @var Id: To store value for Id +# @var AntCmdOptions: To store value for AntCmdOptions +# @var FilePath: To store value for FilePath +# +class PlatformAntTaskClass(object): + def __init__(self): + self.Id = '' + self.AntCmdOptions = '' + self.FilePath = '' + +## PlatformFfsSectionClass +# +# This class defined FfsSection item used in platform file +# +# @param CommonClass: Inherited from CommonClass class +# +# @var BindingOrder: To store value for BindingOrder +# @var Compressible: To store value for Compressible +# @var SectionType: To store value for SectionType +# @var EncapsulationType: To store value for EncapsulationType +# @var ToolName: To store value for ToolName +# @var Filenames: To store value for Filenames +# @var Args: To store value for Args +# @var OutFile: To store value for OutFile +# @var OutputFileExtension: To store value for OutputFileExtension +# @var ToolNameElement: To store value for ToolNameElement +# +class PlatformFfsSectionClass(CommonClass): + def __init__(self): + CommonClass.__init__(self) + self.BindingOrder = '' + self.Compressible = '' + self.SectionType = '' + self.EncapsulationType = '' + self.ToolName = '' + self.Filenames = [] + self.Args = '' + self.OutFile = '' + self.OutputFileExtension = '' + self.ToolNameElement = '' + +## PlatformFfsSectionsClass +# +# This class defined FfsSections item used in platform file +# +# @param CommonClass: Inherited from CommonClass class +# +# @var BindingOrder: To store value for BindingOrder +# @var Compressible: To store value for Compressible +# @var SectionType: To store value for SectionType +# @var EncapsulationType: To store value for EncapsulationType +# @var ToolName: To store value for ToolName +# @var Section: To store value for Section, it is a list structure as +# [ PlatformFfsSectionClass, ... ] +# @var Sections: To store value for Sections, it is a list structure as +# [ PlatformFfsSectionsClass, ...] +# +class PlatformFfsSectionsClass(CommonClass): + def __init__(self): + CommonClass.__init__(self) + self.BindingOrder = '' + self.Compressible = '' + self.SectionType = '' + self.EncapsulationType = '' + self.ToolName = '' + self.Section = [] + self.Sections = [] + +## PlatformFfsClass +# +# This class defined Ffs item used in platform file +# +# @param object: Inherited from object class +# +# @var Attribute: To store value for Attribute, it is a set structure as +# { [(Name, PlatformFfsSectionsClass)] : Value} +# @var Sections: To store value for Sections, it is a list structure as +# [ PlatformFfsSectionsClass] +# @var ToolName: To store value for ToolName +# +class PlatformFfsClass(object): + def __init__(self): + self.Attribute = {} + self.Sections = [] + self.Key = '' + +## PlatformBuildOptionClass +# +# This class defined BuildOption item used in platform file +# +# @param object: Inherited from object class +# +# @var UserDefinedAntTasks: To store value for UserDefinedAntTasks, it is a set structure as +# { [Id] : PlatformAntTaskClass, ...} +# @var Options: To store value for Options, it is a list structure as +# [ BuildOptionClass, ...] +# @var UserExtensions: To store value for UserExtensions, it is a set structure as +# { [(UserID, Identifier)] : UserExtensionsClass, ...} +# @var FfsKeyList: To store value for FfsKeyList, it is a set structure as +# { [FfsKey]: PlatformFfsClass, ...} +# +class PlatformBuildOptionClass(object): + def __init__(self): + self.UserDefinedAntTasks = {} + self.Options = [] + self.UserExtensions = {} + self.FfsKeyList = {} + +## PlatformBuildOptionClasses +# +# This class defined BuildOption item list used in platform file +# +# @param IncludeStatementClass: Inherited from IncludeStatementClass class +# +# @var FvBinding: To store value for FvBinding +# @var FfsFileNameGuid: To store value for FfsFileNameGuid +# @var FfsFormatKey: To store value for FfsFormatKey +# @var BuildOptionList: To store value for BuildOptionList, it is a list structure as +# [ BuildOptionClass, ... ] +# +class PlatformBuildOptionClasses(IncludeStatementClass): + def __init__(self): + IncludeStatementClass.__init__(self) + self.FvBinding = '' + self.FfsFileNameGuid = '' + self.FfsFormatKey = '' + self.BuildOptionList = [] + +## PlatformLibraryClass +# +# This class defined Library item used in platform file +# +# @param CommonClass: Inherited from CommonClass class +# @param DefineClass: Inherited from DefineClass class +# @param Name: Input value for Name, default is '' +# @param FilePath: Input value for FilePath, default is '' +# +# @var Name: To store value for Name +# @var FilePath: To store value for FilePath +# @var ModuleType: To store value for ModuleType +# @var SupModuleList: To store value for SupModuleList +# @var ModuleGuid: To store value for ModuleGuid +# @var ModuleVersion: To store value for ModuleVersion +# @var PackageGuid: To store value for PackageGuid +# @var PackageVersion: To store value for PackageVersion +# +class PlatformLibraryClass(CommonClass, DefineClass): + def __init__(self, Name = '', FilePath = ''): + CommonClass.__init__(self) + DefineClass.__init__(self) + self.Name = Name + self.FilePath = FilePath + self.ModuleType = [] + self.SupModuleList = [] + self.ModuleGuid = '' + self.ModuleVersion = '' + self.PackageGuid = '' + self.PackageVersion = '' + +## PlatformLibraryClasses +# +# This class defined Library item list used in platform file +# +# @param IncludeStatementClass: Inherited from IncludeStatementClass class +# +# @var LibraryList: To store value for LibraryList, it is a list structure as +# [ PlatformLibraryClass, ... ] +# +class PlatformLibraryClasses(IncludeStatementClass): + def __init__(self): + IncludeStatementClass.__init__(self) + self.LibraryList = [] + +## PlatformModuleClass +# +# This class defined Module item used in platform file +# +# @param CommonClass: Inherited from CommonClass class +# @param DefineClass: Inherited from DefineClass class +# @param IncludeStatementClass: Inherited from IncludeStatementClass class +# +# @var Name: To store value for Name (Library name or libraryclass name or module name) +# @var FilePath: To store value for FilePath +# @var Type: To store value for Type, selection scope is in below list +# LIBRARY | LIBRARY_CLASS | MODULE +# @var ModuleType: To store value for ModuleType +# @var ExecFilePath: To store value for ExecFilePath +# @var LibraryClasses: To store value for LibraryClasses, it is a structure as +# PlatformLibraryClasses +# @var PcdBuildDefinitions: To store value for PcdBuildDefinitions, it is a list structure as +# [ PcdClass, ...] +# @var ModuleSaBuildOption: To store value for ModuleSaBuildOption, it is a structure as +# PlatformBuildOptionClasses +# @var Specifications: To store value for Specifications, it is a list structure as +# [ '', '', ...] +# +class PlatformModuleClass(CommonClass, DefineClass, IncludeStatementClass): + def __init__(self): + CommonClass.__init__(self) + DefineClass.__init__(self) + self.Name = '' + self.FilePath = '' + self.Type = '' + self.ModuleType = '' + self.ExecFilePath = '' + self.LibraryClasses = PlatformLibraryClasses() + self.PcdBuildDefinitions = [] + self.ModuleSaBuildOption = PlatformBuildOptionClasses() + self.Specifications = [] + self.SourceOverridePath = '' + +## PlatformModuleClasses +# +# This class defined Module item list used in platform file +# +# @param IncludeStatementClass: Inherited from IncludeStatementClass class +# +# @var ModuleList: To store value for ModuleList, it is a list structure as +# [ PlatformModuleClass, ... ] +# +class PlatformModuleClasses(IncludeStatementClass): + def __init__(self): + IncludeStatementClass.__init__(self) + self.ModuleList = [] + +## PlatformClass +# +# This class defined a complete platform item +# +# @param object: Inherited from object class +# +# @var Header: To store value for Header, it is a structure as +# {Arch : PlatformHeaderClass()} +# @var SkuInfos: To store value for SkuInfos, it is a structure as +# SkuInfoListClass +# @var Libraries: To store value for Libraries, it is a structure as +# PlatformLibraryClasses +# @var LibraryClasses: To store value for LibraryClasses, it is a structure as +# PlatformLibraryClasses +# @var Modules: To store value for Modules, it is a structure as +# PlatformModuleClasses +# @var FlashDefinitionFile: To store value for FlashDefinitionFile, it is a structure as +# PlatformFlashDefinitionFileClass +# @var BuildOptions: To store value for BuildOptions, it is a structure as +# PlatformBuildOptionClasses +# @var DynamicPcdBuildDefinitions: To store value for DynamicPcdBuildDefinitions, it is a list structure as +# [ PcdClass, ...] +# @var Fdf: To store value for Fdf, it is a list structure as +# [ FdfClass, ...] +# @var UserExtensions: To store value for UserExtensions, it is a list structure as +# [ UserExtensionsClass, ...] +# +class PlatformClass(object): + def __init__(self): + self.Header = {} + self.SkuInfos = SkuInfoListClass() + self.Libraries = PlatformLibraryClasses() + self.LibraryClasses = PlatformLibraryClasses() + self.Modules = PlatformModuleClasses() + self.FlashDefinitionFile = PlatformFlashDefinitionFileClass() + self.BuildOptions = PlatformBuildOptionClasses() + self.DynamicPcdBuildDefinitions = [] + self.Fdf = [] + self.UserExtensions = [] + +## +# +# This acts like the main() function for the script, unless it is 'import'ed into another +# script. +# +if __name__ == '__main__': + P = PlatformClass() diff --git a/BaseTools/Source/Python/CommonDataClass/__init__.py b/BaseTools/Source/Python/CommonDataClass/__init__.py new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3