]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/Python/Workspace/DecBuildData.py
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / Python / Workspace / DecBuildData.py
CommitLineData
ae7b6df8
LG
1## @file\r
2# This file is used to create a database used by build tool\r
3#\r
e0db09cd 4# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
ae7b6df8 5# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
2e351cbe 6# SPDX-License-Identifier: BSD-2-Clause-Patent\r
ae7b6df8 7#\r
5a57246e 8from Common.StringUtils import *\r
ae7b6df8
LG
9from Common.DataType import *\r
10from Common.Misc import *\r
11from types import *\r
79820e32 12from collections import OrderedDict\r
938cf4c3 13from CommonDataClass.DataClass import *\r
ae7b6df8 14from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, PcdClassObject\r
82292501 15from Common.GlobalData import gGlobalDefines\r
938cf4c3 16from re import compile\r
ae7b6df8
LG
17\r
18## Platform build information from DEC file\r
19#\r
20# This class is used to retrieve information stored in database and convert them\r
21# into PackageBuildClassObject form for easier use for AutoGen.\r
22#\r
23class DecBuildData(PackageBuildClassObject):\r
24 # dict used to convert PCD type in database to string used by build tool\r
25 _PCD_TYPE_STRING_ = {\r
be409b67
CJ
26 MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,\r
27 MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,\r
28 MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,\r
29 MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,\r
30 MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,\r
31 MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,\r
32 MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,\r
33 MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,\r
34 MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,\r
35 MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,\r
36 MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,\r
ae7b6df8
LG
37 }\r
38\r
39 # dict used to convert part of [Defines] to members of DecBuildData directly\r
40 _PROPERTY_ = {\r
41 #\r
42 # Required Fields\r
43 #\r
44 TAB_DEC_DEFINES_PACKAGE_NAME : "_PackageName",\r
45 TAB_DEC_DEFINES_PACKAGE_GUID : "_Guid",\r
46 TAB_DEC_DEFINES_PACKAGE_VERSION : "_Version",\r
47 TAB_DEC_DEFINES_PKG_UNI_FILE : "_PkgUniFile",\r
48 }\r
49\r
50\r
51 ## Constructor of DecBuildData\r
52 #\r
53 # Initialize object of DecBuildData\r
54 #\r
55 # @param FilePath The path of package description file\r
56 # @param RawData The raw data of DEC file\r
57 # @param BuildDataBase Database used to retrieve module information\r
58 # @param Arch The target architecture\r
59 # @param Platform (not used for DecBuildData)\r
60 # @param Macros Macros used for replacement in DSC file\r
61 #\r
55c84777 62 def __init__(self, File, RawData, BuildDataBase, Arch=TAB_ARCH_COMMON, Target=None, Toolchain=None):\r
ae7b6df8
LG
63 self.MetaFile = File\r
64 self._PackageDir = File.Dir\r
65 self._RawData = RawData\r
66 self._Bdb = BuildDataBase\r
67 self._Arch = Arch\r
68 self._Target = Target\r
69 self._Toolchain = Toolchain\r
70 self._Clear()\r
71\r
72 ## XXX[key] = value\r
73 def __setitem__(self, key, value):\r
74 self.__dict__[self._PROPERTY_[key]] = value\r
75\r
76 ## value = XXX[key]\r
77 def __getitem__(self, key):\r
78 return self.__dict__[self._PROPERTY_[key]]\r
79\r
80 ## "in" test support\r
81 def __contains__(self, key):\r
82 return key in self._PROPERTY_\r
83\r
84 ## Set all internal used members of DecBuildData to None\r
85 def _Clear(self):\r
86 self._Header = None\r
87 self._PackageName = None\r
88 self._Guid = None\r
89 self._Version = None\r
90 self._PkgUniFile = None\r
91 self._Protocols = None\r
92 self._Ppis = None\r
93 self._Guids = None\r
94 self._Includes = None\r
0a57a978 95 self._CommonIncludes = None\r
ae7b6df8
LG
96 self._LibraryClasses = None\r
97 self._Pcds = None\r
71cac3f7 98 self._MacroDict = None\r
ae7b6df8
LG
99 self._PrivateProtocols = None\r
100 self._PrivatePpis = None\r
101 self._PrivateGuids = None\r
102 self._PrivateIncludes = None\r
103\r
104 ## Get current effective macros\r
71cac3f7
CJ
105 @property\r
106 def _Macros(self):\r
107 if self._MacroDict is None:\r
938cf4c3 108 self._MacroDict = dict(gGlobalDefines)\r
71cac3f7 109 return self._MacroDict\r
ae7b6df8
LG
110\r
111 ## Get architecture\r
71cac3f7
CJ
112 @property\r
113 def Arch(self):\r
ae7b6df8
LG
114 return self._Arch\r
115\r
ae7b6df8
LG
116 ## Retrieve all information in [Defines] section\r
117 #\r
fb0b35e0 118 # (Retrieving all [Defines] information in one-shot is just to save time.)\r
ae7b6df8
LG
119 #\r
120 def _GetHeaderInfo(self):\r
121 RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch]\r
122 for Record in RecordList:\r
123 Name = Record[1]\r
124 if Name in self:\r
125 self[Name] = Record[2]\r
126 self._Header = 'DUMMY'\r
127\r
128 ## Retrieve package name\r
71cac3f7
CJ
129 @property\r
130 def PackageName(self):\r
4231a819
CJ
131 if self._PackageName is None:\r
132 if self._Header is None:\r
ae7b6df8 133 self._GetHeaderInfo()\r
4231a819 134 if self._PackageName is None:\r
ae7b6df8
LG
135 EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "No PACKAGE_NAME", File=self.MetaFile)\r
136 return self._PackageName\r
137\r
138 ## Retrieve file guid\r
71cac3f7
CJ
139 @property\r
140 def PackageName(self):\r
4231a819
CJ
141 if self._Guid is None:\r
142 if self._Header is None:\r
ae7b6df8 143 self._GetHeaderInfo()\r
4231a819 144 if self._Guid is None:\r
ae7b6df8
LG
145 EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "No PACKAGE_GUID", File=self.MetaFile)\r
146 return self._Guid\r
147\r
148 ## Retrieve package version\r
71cac3f7
CJ
149 @property\r
150 def Version(self):\r
4231a819
CJ
151 if self._Version is None:\r
152 if self._Header is None:\r
ae7b6df8 153 self._GetHeaderInfo()\r
4231a819 154 if self._Version is None:\r
ae7b6df8
LG
155 self._Version = ''\r
156 return self._Version\r
157\r
158 ## Retrieve protocol definitions (name/value pairs)\r
71cac3f7
CJ
159 @property\r
160 def Protocols(self):\r
4231a819 161 if self._Protocols is None:\r
ae7b6df8
LG
162 #\r
163 # tdict is a special kind of dict, used for selecting correct\r
fb0b35e0 164 # protocol definition for given ARCH\r
ae7b6df8
LG
165 #\r
166 ProtocolDict = tdict(True)\r
167 PrivateProtocolDict = tdict(True)\r
168 NameList = []\r
169 PrivateNameList = []\r
170 PublicNameList = []\r
171 # find out all protocol definitions for specific and 'common' arch\r
172 RecordList = self._RawData[MODEL_EFI_PROTOCOL, self._Arch]\r
173 for Name, Guid, Dummy, Arch, PrivateFlag, ID, LineNo in RecordList:\r
174 if PrivateFlag == 'PRIVATE':\r
175 if Name not in PrivateNameList:\r
176 PrivateNameList.append(Name)\r
177 PrivateProtocolDict[Arch, Name] = Guid\r
178 if Name in PublicNameList:\r
179 EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)\r
180 else:\r
181 if Name not in PublicNameList:\r
182 PublicNameList.append(Name)\r
183 if Name in PrivateNameList:\r
184 EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)\r
185 if Name not in NameList:\r
186 NameList.append(Name)\r
187 ProtocolDict[Arch, Name] = Guid\r
6e6d767e
CJ
188 # use OrderedDict to keep the order\r
189 self._Protocols = OrderedDict()\r
190 self._PrivateProtocols = OrderedDict()\r
ae7b6df8
LG
191 for Name in NameList:\r
192 #\r
193 # limit the ARCH to self._Arch, if no self._Arch found, tdict\r
194 # will automatically turn to 'common' ARCH for trying\r
195 #\r
196 self._Protocols[Name] = ProtocolDict[self._Arch, Name]\r
197 for Name in PrivateNameList:\r
198 self._PrivateProtocols[Name] = PrivateProtocolDict[self._Arch, Name]\r
199 return self._Protocols\r
200\r
201 ## Retrieve PPI definitions (name/value pairs)\r
71cac3f7
CJ
202 @property\r
203 def Ppis(self):\r
4231a819 204 if self._Ppis is None:\r
ae7b6df8
LG
205 #\r
206 # tdict is a special kind of dict, used for selecting correct\r
fb0b35e0 207 # PPI definition for given ARCH\r
ae7b6df8
LG
208 #\r
209 PpiDict = tdict(True)\r
210 PrivatePpiDict = tdict(True)\r
211 NameList = []\r
212 PrivateNameList = []\r
213 PublicNameList = []\r
214 # find out all PPI definitions for specific arch and 'common' arch\r
215 RecordList = self._RawData[MODEL_EFI_PPI, self._Arch]\r
216 for Name, Guid, Dummy, Arch, PrivateFlag, ID, LineNo in RecordList:\r
217 if PrivateFlag == 'PRIVATE':\r
218 if Name not in PrivateNameList:\r
219 PrivateNameList.append(Name)\r
220 PrivatePpiDict[Arch, Name] = Guid\r
221 if Name in PublicNameList:\r
222 EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)\r
223 else:\r
224 if Name not in PublicNameList:\r
225 PublicNameList.append(Name)\r
226 if Name in PrivateNameList:\r
227 EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)\r
228 if Name not in NameList:\r
229 NameList.append(Name)\r
230 PpiDict[Arch, Name] = Guid\r
6e6d767e
CJ
231 # use OrderedDict to keep the order\r
232 self._Ppis = OrderedDict()\r
233 self._PrivatePpis = OrderedDict()\r
ae7b6df8
LG
234 for Name in NameList:\r
235 #\r
236 # limit the ARCH to self._Arch, if no self._Arch found, tdict\r
237 # will automatically turn to 'common' ARCH for trying\r
238 #\r
239 self._Ppis[Name] = PpiDict[self._Arch, Name]\r
240 for Name in PrivateNameList:\r
241 self._PrivatePpis[Name] = PrivatePpiDict[self._Arch, Name]\r
242 return self._Ppis\r
243\r
244 ## Retrieve GUID definitions (name/value pairs)\r
71cac3f7
CJ
245 @property\r
246 def Guids(self):\r
4231a819 247 if self._Guids is None:\r
ae7b6df8
LG
248 #\r
249 # tdict is a special kind of dict, used for selecting correct\r
fb0b35e0 250 # GUID definition for given ARCH\r
ae7b6df8
LG
251 #\r
252 GuidDict = tdict(True)\r
253 PrivateGuidDict = tdict(True)\r
254 NameList = []\r
255 PrivateNameList = []\r
256 PublicNameList = []\r
257 # find out all protocol definitions for specific and 'common' arch\r
258 RecordList = self._RawData[MODEL_EFI_GUID, self._Arch]\r
259 for Name, Guid, Dummy, Arch, PrivateFlag, ID, LineNo in RecordList:\r
260 if PrivateFlag == 'PRIVATE':\r
261 if Name not in PrivateNameList:\r
262 PrivateNameList.append(Name)\r
263 PrivateGuidDict[Arch, Name] = Guid\r
264 if Name in PublicNameList:\r
265 EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)\r
266 else:\r
267 if Name not in PublicNameList:\r
268 PublicNameList.append(Name)\r
269 if Name in PrivateNameList:\r
270 EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)\r
271 if Name not in NameList:\r
272 NameList.append(Name)\r
273 GuidDict[Arch, Name] = Guid\r
6e6d767e
CJ
274 # use OrderedDict to keep the order\r
275 self._Guids = OrderedDict()\r
276 self._PrivateGuids = OrderedDict()\r
ae7b6df8
LG
277 for Name in NameList:\r
278 #\r
279 # limit the ARCH to self._Arch, if no self._Arch found, tdict\r
280 # will automatically turn to 'common' ARCH for trying\r
281 #\r
282 self._Guids[Name] = GuidDict[self._Arch, Name]\r
283 for Name in PrivateNameList:\r
284 self._PrivateGuids[Name] = PrivateGuidDict[self._Arch, Name]\r
285 return self._Guids\r
286\r
287 ## Retrieve public include paths declared in this package\r
71cac3f7
CJ
288 @property\r
289 def Includes(self):\r
4231a819 290 if self._Includes is None or self._CommonIncludes is None:\r
0a57a978 291 self._CommonIncludes = []\r
ae7b6df8
LG
292 self._Includes = []\r
293 self._PrivateIncludes = []\r
294 PublicInclues = []\r
295 RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch]\r
296 Macros = self._Macros\r
ae7b6df8
LG
297 for Record in RecordList:\r
298 File = PathClass(NormPath(Record[0], Macros), self._PackageDir, Arch=self._Arch)\r
299 LineNo = Record[-1]\r
300 # validate the path\r
301 ErrorCode, ErrorInfo = File.Validate()\r
302 if ErrorCode != 0:\r
303 EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)\r
304\r
305 # avoid duplicate include path\r
306 if File not in self._Includes:\r
307 self._Includes.append(File)\r
308 if Record[4] == 'PRIVATE':\r
309 if File not in self._PrivateIncludes:\r
310 self._PrivateIncludes.append(File)\r
311 if File in PublicInclues:\r
312 EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % File, File=self.MetaFile, Line=LineNo)\r
313 else:\r
314 if File not in PublicInclues:\r
315 PublicInclues.append(File)\r
316 if File in self._PrivateIncludes:\r
317 EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % File, File=self.MetaFile, Line=LineNo)\r
55c84777 318 if Record[3] == TAB_COMMON:\r
0a57a978 319 self._CommonIncludes.append(File)\r
ae7b6df8
LG
320 return self._Includes\r
321\r
322 ## Retrieve library class declarations (not used in build at present)\r
71cac3f7
CJ
323 @property\r
324 def LibraryClasses(self):\r
4231a819 325 if self._LibraryClasses is None:\r
ae7b6df8
LG
326 #\r
327 # tdict is a special kind of dict, used for selecting correct\r
328 # library class declaration for given ARCH\r
329 #\r
330 LibraryClassDict = tdict(True)\r
331 LibraryClassSet = set()\r
332 RecordList = self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Arch]\r
333 Macros = self._Macros\r
334 for LibraryClass, File, Dummy, Arch, PrivateFlag, ID, LineNo in RecordList:\r
335 File = PathClass(NormPath(File, Macros), self._PackageDir, Arch=self._Arch)\r
336 # check the file validation\r
337 ErrorCode, ErrorInfo = File.Validate()\r
338 if ErrorCode != 0:\r
339 EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)\r
340 LibraryClassSet.add(LibraryClass)\r
341 LibraryClassDict[Arch, LibraryClass] = File\r
6e6d767e 342 self._LibraryClasses = OrderedDict()\r
ae7b6df8
LG
343 for LibraryClass in LibraryClassSet:\r
344 self._LibraryClasses[LibraryClass] = LibraryClassDict[self._Arch, LibraryClass]\r
345 return self._LibraryClasses\r
346\r
347 ## Retrieve PCD declarations\r
71cac3f7
CJ
348 @property\r
349 def Pcds(self):\r
4231a819 350 if self._Pcds is None:\r
6e6d767e 351 self._Pcds = OrderedDict()\r
ae7b6df8
LG
352 self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))\r
353 self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE))\r
354 self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG))\r
355 self._Pcds.update(self._GetPcd(MODEL_PCD_DYNAMIC))\r
356 self._Pcds.update(self._GetPcd(MODEL_PCD_DYNAMIC_EX))\r
357 return self._Pcds\r
358\r
72a1d776 359 def ParsePcdName(self,TokenCName):\r
360 TokenCName = TokenCName.strip()\r
361 if TokenCName.startswith("["):\r
362 if "." in TokenCName:\r
363 Demesionattr = TokenCName[:TokenCName.index(".")]\r
364 Fields = TokenCName[TokenCName.index(".")+1:]\r
365 else:\r
366 Demesionattr = TokenCName\r
367 Fields = ""\r
368 else:\r
369 Demesionattr = ""\r
370 Fields = TokenCName\r
371\r
372 return Demesionattr,Fields\r
373\r
ae7b6df8 374 def ProcessStructurePcd(self, StructurePcdRawDataSet):\r
79820e32 375 s_pcd_set = OrderedDict()\r
ccaa7754 376 for s_pcd, LineNo in StructurePcdRawDataSet:\r
ae7b6df8
LG
377 if s_pcd.TokenSpaceGuidCName not in s_pcd_set:\r
378 s_pcd_set[s_pcd.TokenSpaceGuidCName] = []\r
ccaa7754 379 s_pcd_set[s_pcd.TokenSpaceGuidCName].append((s_pcd, LineNo))\r
ae7b6df8
LG
380\r
381 str_pcd_set = []\r
382 for pcdname in s_pcd_set:\r
383 dep_pkgs = []\r
384 struct_pcd = StructurePcd()\r
ccaa7754 385 for item, LineNo in s_pcd_set[pcdname]:\r
72a1d776 386 if not item.TokenCName:\r
387 continue\r
ae7b6df8 388 if "<HeaderFiles>" in item.TokenCName:\r
81add864 389 struct_pcd.StructuredPcdIncludeFile.append(item.DefaultValue)\r
ae7b6df8
LG
390 elif "<Packages>" in item.TokenCName:\r
391 dep_pkgs.append(item.DefaultValue)\r
392 elif item.DatumType == item.TokenCName:\r
393 struct_pcd.copy(item)\r
394 struct_pcd.TokenValue = struct_pcd.TokenValue.strip("{").strip()\r
395 struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName = pcdname.split(".")\r
6a103440
FB
396 struct_pcd.PcdDefineLineNo = LineNo\r
397 struct_pcd.PkgPath = self.MetaFile.File\r
06140766 398 struct_pcd.SetDecDefaultValue(item.DefaultValue)\r
ae7b6df8 399 else:\r
72a1d776 400 DemesionAttr, Fields = self.ParsePcdName(item.TokenCName)\r
401 struct_pcd.AddDefaultValue(Fields, item.DefaultValue, self.MetaFile.File, LineNo,DemesionAttr)\r
ae7b6df8
LG
402\r
403 struct_pcd.PackageDecs = dep_pkgs\r
ae7b6df8 404 str_pcd_set.append(struct_pcd)\r
ae7b6df8
LG
405 return str_pcd_set\r
406\r
407 ## Retrieve PCD declarations for given type\r
408 def _GetPcd(self, Type):\r
6e6d767e 409 Pcds = OrderedDict()\r
ae7b6df8
LG
410 #\r
411 # tdict is a special kind of dict, used for selecting correct\r
412 # PCD declaration for given ARCH\r
413 #\r
414 PcdDict = tdict(True, 3)\r
415 # for summarizing PCD\r
e651d06c 416 PcdSet = []\r
ae7b6df8
LG
417 # find out all PCDs of the 'type'\r
418\r
419 StrPcdSet = []\r
420 RecordList = self._RawData[Type, self._Arch]\r
421 for TokenSpaceGuid, PcdCName, Setting, Arch, PrivateFlag, Dummy1, Dummy2 in RecordList:\r
ccaa7754 422 PcdDict[Arch, PcdCName, TokenSpaceGuid] = (Setting, Dummy2)\r
e651d06c
LG
423 if not (PcdCName, TokenSpaceGuid) in PcdSet:\r
424 PcdSet.append((PcdCName, TokenSpaceGuid))\r
ae7b6df8 425\r
6f73a036 426 DefinitionPosition = {}\r
ae7b6df8
LG
427 for PcdCName, TokenSpaceGuid in PcdSet:\r
428 #\r
429 # limit the ARCH to self._Arch, if no self._Arch found, tdict\r
430 # will automatically turn to 'common' ARCH and try again\r
431 #\r
ccaa7754 432 Setting, LineNo = PcdDict[self._Arch, PcdCName, TokenSpaceGuid]\r
4231a819 433 if Setting is None:\r
ae7b6df8
LG
434 continue\r
435\r
436 DefaultValue, DatumType, TokenNumber = AnalyzePcdData(Setting)\r
437 validateranges, validlists, expressions = self._RawData.GetValidExpression(TokenSpaceGuid, PcdCName)\r
438 PcdObj = PcdClassObject(\r
439 PcdCName,\r
440 TokenSpaceGuid,\r
441 self._PCD_TYPE_STRING_[Type],\r
442 DatumType,\r
443 DefaultValue,\r
444 TokenNumber,\r
445 '',\r
446 {},\r
447 False,\r
448 None,\r
449 list(validateranges),\r
450 list(validlists),\r
451 list(expressions)\r
452 )\r
6f73a036 453 DefinitionPosition[PcdObj] = (self.MetaFile.File, LineNo)\r
ae7b6df8 454 if "." in TokenSpaceGuid:\r
ccaa7754 455 StrPcdSet.append((PcdObj, LineNo))\r
ae7b6df8
LG
456 else:\r
457 Pcds[PcdCName, TokenSpaceGuid, self._PCD_TYPE_STRING_[Type]] = PcdObj\r
458\r
459 StructurePcds = self.ProcessStructurePcd(StrPcdSet)\r
460 for pcd in StructurePcds:\r
461 Pcds[pcd.TokenCName, pcd.TokenSpaceGuidCName, self._PCD_TYPE_STRING_[Type]] = pcd\r
938cf4c3 462 StructPattern = compile(r'[_a-zA-Z][0-9A-Za-z_]*$')\r
065a7d40
FB
463 for pcd in Pcds.values():\r
464 if pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
72a1d776 465 if not pcd.IsAggregateDatumType():\r
6f73a036 466 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
72a1d776 467 elif not pcd.IsArray() and not pcd.StructuredPcdIncludeFile:\r
468 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
ae7b6df8 469 return Pcds\r
71cac3f7 470\r
0a57a978
FB
471 @property\r
472 def CommonIncludes(self):\r
473 if self._CommonIncludes is None:\r
474 self.Includes\r
475 return self._CommonIncludes\r