from Common.Misc import *\r
from types import *\r
from collections import OrderedDict\r
-\r
+from CommonDataClass.DataClass import *\r
from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, PcdClassObject\r
+from Common.GlobalData import gGlobalDefines\r
+from re import compile\r
\r
## Platform build information from DEC file\r
#\r
@property\r
def _Macros(self):\r
if self._MacroDict is None:\r
- self._MacroDict = dict(GlobalData.gGlobalDefines)\r
+ self._MacroDict = dict(gGlobalDefines)\r
return self._MacroDict\r
\r
## Get architecture\r
\r
## Retrieve all information in [Defines] section\r
#\r
- # (Retriving all [Defines] information in one-shot is just to save time.)\r
+ # (Retrieving all [Defines] information in one-shot is just to save time.)\r
#\r
def _GetHeaderInfo(self):\r
RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch]\r
if self._Protocols is None:\r
#\r
# tdict is a special kind of dict, used for selecting correct\r
- # protocol defition for given ARCH\r
+ # protocol definition for given ARCH\r
#\r
ProtocolDict = tdict(True)\r
PrivateProtocolDict = tdict(True)\r
if self._Ppis is None:\r
#\r
# tdict is a special kind of dict, used for selecting correct\r
- # PPI defition for given ARCH\r
+ # PPI definition for given ARCH\r
#\r
PpiDict = tdict(True)\r
PrivatePpiDict = tdict(True)\r
if self._Guids is None:\r
#\r
# tdict is a special kind of dict, used for selecting correct\r
- # GUID defition for given ARCH\r
+ # GUID definition for given ARCH\r
#\r
GuidDict = tdict(True)\r
PrivateGuidDict = tdict(True)\r
PublicInclues = []\r
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch]\r
Macros = self._Macros\r
- Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
for Record in RecordList:\r
File = PathClass(NormPath(Record[0], Macros), self._PackageDir, Arch=self._Arch)\r
LineNo = Record[-1]\r
self._Pcds.update(self._GetPcd(MODEL_PCD_DYNAMIC_EX))\r
return self._Pcds\r
\r
+ def ParsePcdName(self,TokenCName):\r
+ TokenCName = TokenCName.strip()\r
+ if TokenCName.startswith("["):\r
+ if "." in TokenCName:\r
+ Demesionattr = TokenCName[:TokenCName.index(".")]\r
+ Fields = TokenCName[TokenCName.index(".")+1:]\r
+ else:\r
+ Demesionattr = TokenCName\r
+ Fields = ""\r
+ else:\r
+ Demesionattr = ""\r
+ Fields = TokenCName\r
+\r
+ return Demesionattr,Fields\r
+\r
def ProcessStructurePcd(self, StructurePcdRawDataSet):\r
s_pcd_set = OrderedDict()\r
for s_pcd, LineNo in StructurePcdRawDataSet:\r
dep_pkgs = []\r
struct_pcd = StructurePcd()\r
for item, LineNo in s_pcd_set[pcdname]:\r
+ if not item.TokenCName:\r
+ continue\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
+ DemesionAttr, Fields = self.ParsePcdName(item.TokenCName)\r
+ struct_pcd.AddDefaultValue(Fields, item.DefaultValue, self.MetaFile.File, LineNo,DemesionAttr)\r
\r
struct_pcd.PackageDecs = dep_pkgs\r
str_pcd_set.append(struct_pcd)\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
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
else:\r
StructurePcds = self.ProcessStructurePcd(StrPcdSet)\r
for pcd in StructurePcds:\r
Pcds[pcd.TokenCName, pcd.TokenSpaceGuidCName, self._PCD_TYPE_STRING_[Type]] = pcd\r
- StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*$')\r
+ StructPattern = compile(r'[_a-zA-Z][0-9A-Za-z_]*$')\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
- 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
-\r
+ if not pcd.IsAggregateDatumType():\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
+ elif not pcd.IsArray() and not 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" % (pcd.TokenSpaceGuidCName, pcd.TokenCName, pcd.DefinitionPosition[0], pcd.DefinitionPosition[1] ))\r
return Pcds\r
\r
@property\r