- TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)\r
- self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT)\r
- ValueRe = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*')\r
- # check PCD information\r
- if self._ValueList[0] == '' or self._ValueList[1] == '':\r
- EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",\r
- ExtraData=self._CurrentLine + \\r
- " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
- File=self.MetaFile, Line=self._LineIndex + 1)\r
- # check format of token space GUID CName\r
- if not ValueRe.match(self._ValueList[0]):\r
- EdkLogger.error('Parser', FORMAT_INVALID, "The format of the token space GUID CName is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'",\r
- ExtraData=self._CurrentLine + \\r
- " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
- File=self.MetaFile, Line=self._LineIndex + 1)\r
- # check format of PCD CName\r
- if not ValueRe.match(self._ValueList[1]):\r
- EdkLogger.error('Parser', FORMAT_INVALID, "The format of the PCD CName is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'",\r
- ExtraData=self._CurrentLine + \\r
- " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
- File=self.MetaFile, Line=self._LineIndex + 1)\r
- # check PCD datum information\r
- if len(TokenList) < 2 or TokenList[1] == '':\r
- EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Datum information given",\r
- ExtraData=self._CurrentLine + \\r
- " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
- File=self.MetaFile, Line=self._LineIndex + 1)\r
-\r
-\r
- ValueRe = re.compile(r'^\s*L?\".*\|.*\"')\r
- PtrValue = ValueRe.findall(TokenList[1])\r
-\r
- # Has VOID* type string, may contain "|" character in the string. \r
- if len(PtrValue) != 0:\r
- ptrValueList = re.sub(ValueRe, '', TokenList[1])\r
- ValueList = GetSplitValueList(ptrValueList)\r
- ValueList[0] = PtrValue[0]\r
- else:\r
- ValueList = GetSplitValueList(TokenList[1])\r
-\r
-\r
- # check if there's enough datum information given\r
- if len(ValueList) != 3:\r
- EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum information given",\r
- ExtraData=self._CurrentLine + \\r
- " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
- File=self.MetaFile, Line=self._LineIndex + 1)\r
- # check default value\r
- if ValueList[0] == '':\r
- EdkLogger.error('Parser', FORMAT_INVALID, "Missing DefaultValue in PCD Datum information",\r
- ExtraData=self._CurrentLine + \\r
- " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
- File=self.MetaFile, Line=self._LineIndex + 1)\r
- # check datum type\r
- if ValueList[1] == '':\r
- EdkLogger.error('Parser', FORMAT_INVALID, "Missing DatumType in PCD Datum information",\r
- ExtraData=self._CurrentLine + \\r
- " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
- File=self.MetaFile, Line=self._LineIndex + 1)\r
- # check token of the PCD\r
- if ValueList[2] == '':\r
- EdkLogger.error('Parser', FORMAT_INVALID, "Missing Token in PCD Datum information",\r
- ExtraData=self._CurrentLine + \\r
- " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
- File=self.MetaFile, Line=self._LineIndex + 1)\r
- # check format of default value against the datum type\r
- IsValid, Cause = CheckPcdDatum(ValueList[1], ValueList[0])\r
- if not IsValid:\r
- EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=self._CurrentLine,\r
- File=self.MetaFile, Line=self._LineIndex + 1)\r
-\r
- if ValueList[0] in ['True', 'true', 'TRUE']:\r
- ValueList[0] = '1'\r
- elif ValueList[0] in ['False', 'false', 'FALSE']:\r
- ValueList[0] = '0'\r
-\r
- # check for duplicate PCD definition\r
- if (self._Scope[0], self._ValueList[0], self._ValueList[1]) in self._AllPCDs:\r
- EdkLogger.error('Parser', FORMAT_INVALID,\r
- "The same PCD name and GUID have been already defined",\r
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r
- else:\r
- self._AllPCDs.append((self._Scope[0], self._ValueList[0], self._ValueList[1]))\r
+ if self._CurrentStructurePcdName:\r
+ self._ValueList[0] = self._CurrentStructurePcdName\r
+\r
+ if "|" not in self._CurrentLine:\r
+ if "<HeaderFiles>" == self._CurrentLine:\r
+ self._include_flag = True\r
+ self._package_flag = False\r
+ self._ValueList = None\r
+ return\r
+ if "<Packages>" == self._CurrentLine:\r
+ self._package_flag = True\r
+ self._ValueList = None\r
+ self._include_flag = False\r
+ return\r
+\r
+ if self._include_flag:\r
+ self._ValueList[1] = "<HeaderFiles>_" + md5.new(self._CurrentLine).hexdigest()\r
+ self._ValueList[2] = self._CurrentLine\r
+ if self._package_flag and "}" != self._CurrentLine:\r
+ self._ValueList[1] = "<Packages>_" + md5.new(self._CurrentLine).hexdigest()\r
+ self._ValueList[2] = self._CurrentLine\r
+ if self._CurrentLine == "}":\r
+ self._package_flag = False\r
+ self._include_flag = False\r
+ self._ValueList = None\r
+ return\r
+ else:\r
+ PcdTockens = self._CurrentLine.split(TAB_VALUE_SPLIT)\r
+ PcdNames = PcdTockens[0].split(TAB_SPLIT)\r
+ if len(PcdNames) == 2:\r
+ self._CurrentStructurePcdName = ""\r
+ else:\r
+ if self._CurrentStructurePcdName != TAB_SPLIT.join(PcdNames[:2]):\r
+ EdkLogger.error('Parser', FORMAT_INVALID, "Pcd Name does not match: %s and %s " % (self._CurrentStructurePcdName, TAB_SPLIT.join(PcdNames[:2])),\r
+ File=self.MetaFile, Line=self._LineIndex + 1)\r
+ self._ValueList[1] = TAB_SPLIT.join(PcdNames[2:])\r
+ self._ValueList[2] = PcdTockens[1]\r
+ if not self._CurrentStructurePcdName:\r
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)\r
+ self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT)\r
+ ValueRe = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*')\r
+ # check PCD information\r
+ if self._ValueList[0] == '' or self._ValueList[1] == '':\r
+ EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",\r
+ ExtraData=self._CurrentLine + \\r
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
+ File=self.MetaFile, Line=self._LineIndex + 1)\r
+ # check format of token space GUID CName\r
+ if not ValueRe.match(self._ValueList[0]):\r
+ EdkLogger.error('Parser', FORMAT_INVALID, "The format of the token space GUID CName is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'",\r
+ ExtraData=self._CurrentLine + \\r
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
+ File=self.MetaFile, Line=self._LineIndex + 1)\r
+ # check format of PCD CName\r
+ if not ValueRe.match(self._ValueList[1]):\r
+ EdkLogger.error('Parser', FORMAT_INVALID, "The format of the PCD CName is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'",\r
+ ExtraData=self._CurrentLine + \\r
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
+ File=self.MetaFile, Line=self._LineIndex + 1)\r
+ # check PCD datum information\r
+ if len(TokenList) < 2 or TokenList[1] == '':\r
+ EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Datum information given",\r
+ ExtraData=self._CurrentLine + \\r
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
+ File=self.MetaFile, Line=self._LineIndex + 1)\r
+\r
+\r
+ ValueRe = re.compile(r'^\s*L?\".*\|.*\"')\r
+ PtrValue = ValueRe.findall(TokenList[1])\r
+\r
+ # Has VOID* type string, may contain "|" character in the string.\r
+ if len(PtrValue) != 0:\r
+ ptrValueList = re.sub(ValueRe, '', TokenList[1])\r
+ ValueList = AnalyzePcdExpression(ptrValueList)\r
+ ValueList[0] = PtrValue[0]\r
+ else:\r
+ ValueList = AnalyzePcdExpression(TokenList[1])\r
+\r
+\r
+ # check if there's enough datum information given\r
+ if len(ValueList) != 3:\r
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum information given",\r
+ ExtraData=self._CurrentLine + \\r
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
+ File=self.MetaFile, Line=self._LineIndex + 1)\r
+ # check default value\r
+ if ValueList[0] == '':\r
+ EdkLogger.error('Parser', FORMAT_INVALID, "Missing DefaultValue in PCD Datum information",\r
+ ExtraData=self._CurrentLine + \\r
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
+ File=self.MetaFile, Line=self._LineIndex + 1)\r
+ # check datum type\r
+ if ValueList[1] == '':\r
+ EdkLogger.error('Parser', FORMAT_INVALID, "Missing DatumType in PCD Datum information",\r
+ ExtraData=self._CurrentLine + \\r
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
+ File=self.MetaFile, Line=self._LineIndex + 1)\r
+ # check token of the PCD\r
+ if ValueList[2] == '':\r
+ EdkLogger.error('Parser', FORMAT_INVALID, "Missing Token in PCD Datum information",\r
+ ExtraData=self._CurrentLine + \\r
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",\r
+ File=self.MetaFile, Line=self._LineIndex + 1)\r
+\r
+ PcdValue = ValueList[0]\r
+ if PcdValue:\r
+ try:\r
+ self._GuidDict.update(self._AllPcdDict)\r
+ ValueList[0] = ValueExpressionEx(ValueList[0], ValueList[1], self._GuidDict)(True)\r
+ except BadExpression as Value:\r
+ EdkLogger.error('Parser', FORMAT_INVALID, Value, ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r
+ # check format of default value against the datum type\r
+ IsValid, Cause = CheckPcdDatum(ValueList[1], ValueList[0])\r
+ if not IsValid:\r
+ EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=self._CurrentLine,\r
+ File=self.MetaFile, Line=self._LineIndex + 1)\r
+\r
+ if Cause == "StructurePcd":\r
+ self._CurrentStructurePcdName = TAB_SPLIT.join(self._ValueList[0:2])\r
+ self._ValueList[0] = self._CurrentStructurePcdName\r
+ self._ValueList[1] = ValueList[1].strip()\r
+\r
+ if ValueList[0] in ['True', 'true', 'TRUE']:\r
+ ValueList[0] = '1'\r
+ elif ValueList[0] in ['False', 'false', 'FALSE']:\r
+ ValueList[0] = '0'\r
+\r
+ # check for duplicate PCD definition\r
+ if (self._Scope[0], self._ValueList[0], self._ValueList[1]) in self._AllPCDs:\r
+ EdkLogger.error('Parser', FORMAT_INVALID,\r
+ "The same PCD name and GUID have been already defined",\r
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r
+ else:\r
+ self._AllPCDs.append((self._Scope[0], self._ValueList[0], self._ValueList[1]))\r
+ self._AllPcdDict[TAB_SPLIT.join(self._ValueList[0:2])] = ValueList[0]\r