# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
#\r
-from Common.String import *\r
+from Common.StringUtils import *\r
from Common.DataType import *\r
from Common.Misc import *\r
from types import *\r
class DecBuildData(PackageBuildClassObject):\r
# dict used to convert PCD type in database to string used by build tool\r
_PCD_TYPE_STRING_ = {\r
- MODEL_PCD_FIXED_AT_BUILD : "FixedAtBuild",\r
- MODEL_PCD_PATCHABLE_IN_MODULE : "PatchableInModule",\r
- MODEL_PCD_FEATURE_FLAG : "FeatureFlag",\r
- MODEL_PCD_DYNAMIC : "Dynamic",\r
- MODEL_PCD_DYNAMIC_DEFAULT : "Dynamic",\r
- MODEL_PCD_DYNAMIC_HII : "DynamicHii",\r
- MODEL_PCD_DYNAMIC_VPD : "DynamicVpd",\r
- MODEL_PCD_DYNAMIC_EX : "DynamicEx",\r
- MODEL_PCD_DYNAMIC_EX_DEFAULT : "DynamicEx",\r
- MODEL_PCD_DYNAMIC_EX_HII : "DynamicExHii",\r
- MODEL_PCD_DYNAMIC_EX_VPD : "DynamicExVpd",\r
+ MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,\r
+ MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,\r
+ MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,\r
+ MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,\r
+ MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,\r
+ MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,\r
+ MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,\r
+ MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,\r
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,\r
+ MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,\r
+ MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,\r
}\r
\r
# dict used to convert part of [Defines] to members of DecBuildData directly\r
self._CommonIncludes = None\r
self._LibraryClasses = None\r
self._Pcds = None\r
- self.__Macros = None\r
+ self._MacroDict = None\r
self._PrivateProtocols = None\r
self._PrivatePpis = None\r
self._PrivateGuids = None\r
self._PrivateIncludes = None\r
\r
## Get current effective macros\r
- def _GetMacros(self):\r
- if self.__Macros is None:\r
- self.__Macros = {}\r
- self.__Macros.update(GlobalData.gGlobalDefines)\r
- return self.__Macros\r
+ @property\r
+ def _Macros(self):\r
+ if self._MacroDict is None:\r
+ self._MacroDict = dict(GlobalData.gGlobalDefines)\r
+ return self._MacroDict\r
\r
## Get architecture\r
- def _GetArch(self):\r
+ @property\r
+ def Arch(self):\r
return self._Arch\r
\r
- ## Set architecture\r
- #\r
- # Changing the default ARCH to another may affect all other information\r
- # because all information in a platform may be ARCH-related. That's\r
- # why we need to clear all internal used members, in order to cause all\r
- # information to be re-retrieved.\r
- #\r
- # @param Value The value of ARCH\r
- #\r
- def _SetArch(self, Value):\r
- if self._Arch == Value:\r
- return\r
- self._Arch = Value\r
- self._Clear()\r
-\r
## Retrieve all information in [Defines] section\r
#\r
# (Retriving all [Defines] information in one-shot is just to save time.)\r
self._Header = 'DUMMY'\r
\r
## Retrieve package name\r
- def _GetPackageName(self):\r
+ @property\r
+ def PackageName(self):\r
if self._PackageName is None:\r
if self._Header is None:\r
self._GetHeaderInfo()\r
return self._PackageName\r
\r
## Retrieve file guid\r
- def _GetFileGuid(self):\r
+ @property\r
+ def PackageName(self):\r
if self._Guid is None:\r
if self._Header is None:\r
self._GetHeaderInfo()\r
return self._Guid\r
\r
## Retrieve package version\r
- def _GetVersion(self):\r
+ @property\r
+ def Version(self):\r
if self._Version is None:\r
if self._Header is None:\r
self._GetHeaderInfo()\r
return self._Version\r
\r
## Retrieve protocol definitions (name/value pairs)\r
- def _GetProtocol(self):\r
+ @property\r
+ def Protocols(self):\r
if self._Protocols is None:\r
#\r
# tdict is a special kind of dict, used for selecting correct\r
return self._Protocols\r
\r
## Retrieve PPI definitions (name/value pairs)\r
- def _GetPpi(self):\r
+ @property\r
+ def Ppis(self):\r
if self._Ppis is None:\r
#\r
# tdict is a special kind of dict, used for selecting correct\r
return self._Ppis\r
\r
## Retrieve GUID definitions (name/value pairs)\r
- def _GetGuid(self):\r
+ @property\r
+ def Guids(self):\r
if self._Guids is None:\r
#\r
# tdict is a special kind of dict, used for selecting correct\r
return self._Guids\r
\r
## Retrieve public include paths declared in this package\r
- def _GetInclude(self):\r
+ @property\r
+ def Includes(self):\r
if self._Includes is None or self._CommonIncludes is None:\r
self._CommonIncludes = []\r
self._Includes = []\r
return self._Includes\r
\r
## Retrieve library class declarations (not used in build at present)\r
- def _GetLibraryClass(self):\r
+ @property\r
+ def LibraryClasses(self):\r
if self._LibraryClasses is None:\r
#\r
# tdict is a special kind of dict, used for selecting correct\r
return self._LibraryClasses\r
\r
## Retrieve PCD declarations\r
- def _GetPcds(self):\r
+ @property\r
+ def Pcds(self):\r
if self._Pcds is None:\r
self._Pcds = OrderedDict()\r
self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))\r
self._Pcds.update(self._GetPcd(MODEL_PCD_DYNAMIC_EX))\r
return self._Pcds\r
\r
-\r
def ProcessStructurePcd(self, StructurePcdRawDataSet):\r
s_pcd_set = OrderedDict()\r
- for s_pcd,LineNo in StructurePcdRawDataSet:\r
+ for s_pcd, LineNo in StructurePcdRawDataSet:\r
if s_pcd.TokenSpaceGuidCName not in s_pcd_set:\r
s_pcd_set[s_pcd.TokenSpaceGuidCName] = []\r
- s_pcd_set[s_pcd.TokenSpaceGuidCName].append((s_pcd,LineNo))\r
+ s_pcd_set[s_pcd.TokenSpaceGuidCName].append((s_pcd, LineNo))\r
\r
str_pcd_set = []\r
for pcdname in s_pcd_set:\r
dep_pkgs = []\r
struct_pcd = StructurePcd()\r
- for item,LineNo in s_pcd_set[pcdname]:\r
+ for item, LineNo in s_pcd_set[pcdname]:\r
if "<HeaderFiles>" in item.TokenCName:\r
struct_pcd.StructuredPcdIncludeFile.append(item.DefaultValue)\r
elif "<Packages>" in item.TokenCName:\r
struct_pcd.PkgPath = self.MetaFile.File\r
struct_pcd.SetDecDefaultValue(item.DefaultValue)\r
else:\r
- struct_pcd.AddDefaultValue(item.TokenCName, item.DefaultValue,self.MetaFile.File,LineNo)\r
+ struct_pcd.AddDefaultValue(item.TokenCName, item.DefaultValue, self.MetaFile.File, LineNo)\r
\r
struct_pcd.PackageDecs = dep_pkgs\r
str_pcd_set.append(struct_pcd)\r
StrPcdSet = []\r
RecordList = self._RawData[Type, self._Arch]\r
for TokenSpaceGuid, PcdCName, Setting, Arch, PrivateFlag, Dummy1, Dummy2 in RecordList:\r
- PcdDict[Arch, PcdCName, TokenSpaceGuid] = (Setting,Dummy2)\r
+ PcdDict[Arch, PcdCName, TokenSpaceGuid] = (Setting, Dummy2)\r
if not (PcdCName, TokenSpaceGuid) in PcdSet:\r
PcdSet.append((PcdCName, TokenSpaceGuid))\r
\r
+ DefinitionPosition = {}\r
for PcdCName, TokenSpaceGuid in PcdSet:\r
#\r
# limit the ARCH to self._Arch, if no self._Arch found, tdict\r
# will automatically turn to 'common' ARCH and try again\r
#\r
- Setting,LineNo = PcdDict[self._Arch, PcdCName, TokenSpaceGuid]\r
+ Setting, LineNo = PcdDict[self._Arch, PcdCName, TokenSpaceGuid]\r
if Setting is None:\r
continue\r
\r
list(validlists),\r
list(expressions)\r
)\r
- PcdObj.DefinitionPosition = (self.MetaFile.File,LineNo)\r
+ DefinitionPosition[PcdObj] = (self.MetaFile.File, LineNo)\r
if "." in TokenSpaceGuid:\r
- StrPcdSet.append((PcdObj,LineNo))\r
+ StrPcdSet.append((PcdObj, LineNo))\r
else:\r
Pcds[PcdCName, TokenSpaceGuid, self._PCD_TYPE_STRING_[Type]] = PcdObj\r
\r
for pcd in Pcds.values():\r
if pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
if StructPattern.match(pcd.DatumType) is None:\r
- EdkLogger.error('build', FORMAT_INVALID, "DatumType only support BOOLEAN, UINT8, UINT16, UINT32, UINT64, VOID* or a valid struct name.", pcd.DefinitionPosition[0],pcd.DefinitionPosition[1])\r
+ EdkLogger.error('build', FORMAT_INVALID, "DatumType only support BOOLEAN, UINT8, UINT16, UINT32, UINT64, VOID* or a valid struct name.", DefinitionPosition[pcd][0], DefinitionPosition[pcd][1])\r
for struct_pcd in Pcds.values():\r
- if isinstance(struct_pcd,StructurePcd) and not struct_pcd.StructuredPcdIncludeFile:\r
- EdkLogger.error("build", PCD_STRUCTURE_PCD_ERROR, "The structure Pcd %s.%s header file is not found in %s line %s \n" % (struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName,struct_pcd.DefinitionPosition[0],struct_pcd.DefinitionPosition[1] ))\r
+ if isinstance(struct_pcd, StructurePcd) and not struct_pcd.StructuredPcdIncludeFile:\r
+ EdkLogger.error("build", PCD_STRUCTURE_PCD_ERROR, "The structure Pcd %s.%s header file is not found in %s line %s \n" % (struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName, DefinitionPosition[struct_pcd][0], DefinitionPosition[struct_pcd][1] ))\r
\r
return Pcds\r
+\r
@property\r
def CommonIncludes(self):\r
if self._CommonIncludes is None:\r
self.Includes\r
return self._CommonIncludes\r
-\r
-\r
- _Macros = property(_GetMacros)\r
- Arch = property(_GetArch, _SetArch)\r
- PackageName = property(_GetPackageName)\r
- Guid = property(_GetFileGuid)\r
- Version = property(_GetVersion)\r
-\r
- Protocols = property(_GetProtocol)\r
- Ppis = property(_GetPpi)\r
- Guids = property(_GetGuid)\r
- Includes = property(_GetInclude)\r
- LibraryClasses = property(_GetLibraryClass)\r
- Pcds = property(_GetPcds)\r