|
From: <qh...@us...> - 2010-08-19 23:55:45
|
Revision: 2022
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2022&view=rev
Author: qhuang8
Date: 2010-08-19 23:55:38 +0000 (Thu, 19 Aug 2010)
Log Message:
-----------
1. Enhance the parser to support 'PKG_UNI_FILE' in DEC [Defines] section.
2. Update GenFds parser and build parser to expand $(WORKSPACE) macro in DSC and FDF file recursively so that $(WORKSPACE) macro can be used to define other macro.
3. Treat all elements and DEFINE statement in DSC [Defines] section as global macro so that they are also valid for FDF file.
4. Enhance the error handling to throw syntax error for PCD sections.
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/DataType.py
trunk/BaseTools/Source/Python/GenFds/GenFds.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
Modified: trunk/BaseTools/Source/Python/Common/DataType.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DataType.py 2010-08-19 12:55:45 UTC (rev 2021)
+++ trunk/BaseTools/Source/Python/Common/DataType.py 2010-08-19 23:55:38 UTC (rev 2022)
@@ -334,6 +334,7 @@
TAB_DEC_DEFINES_PACKAGE_NAME = 'PACKAGE_NAME'
TAB_DEC_DEFINES_PACKAGE_GUID = 'PACKAGE_GUID'
TAB_DEC_DEFINES_PACKAGE_VERSION = 'PACKAGE_VERSION'
+TAB_DEC_DEFINES_PKG_UNI_FILE = 'PKG_UNI_FILE'
#
# Dsc Definitions
Modified: trunk/BaseTools/Source/Python/GenFds/GenFds.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/GenFds.py 2010-08-19 12:55:45 UTC (rev 2021)
+++ trunk/BaseTools/Source/Python/GenFds/GenFds.py 2010-08-19 23:55:38 UTC (rev 2022)
@@ -172,6 +172,7 @@
"""call Workspace build create database"""
os.environ["WORKSPACE"] = Workspace
+ FdfParser.InputMacroDict["WORKSPACE"] = Workspace
BuildWorkSpace = WorkspaceDatabase(':memory:', FdfParser.InputMacroDict)
BuildWorkSpace.InitDatabase()
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2010-08-19 12:55:45 UTC (rev 2021)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2010-08-19 23:55:38 UTC (rev 2022)
@@ -19,6 +19,7 @@
import copy
import Common.EdkLogger as EdkLogger
+import Common.GlobalData as GlobalData
from CommonDataClass.DataClass import *
from Common.DataType import *
from Common.String import *
@@ -82,6 +83,7 @@
self.MetaFile = FilePath
self._FileDir = os.path.dirname(self.MetaFile)
self._Macros = copy.copy(Macros)
+ self._Macros["WORKSPACE"] = os.environ["WORKSPACE"]
# for recursive parsing
self._Owner = Owner
@@ -490,7 +492,12 @@
## [FixedPcd], [FeaturePcd], [PatchPcd], [Pcd] and [PcdEx] sections parser
def _PcdParser(self):
TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
- self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT)
+ ValueList = GetSplitValueList(TokenList[0], TAB_SPLIT)
+ if len(ValueList) != 2:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Illegal token space GUID and PCD name format",
+ ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<PcdCName>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ self._ValueList[0:1] = ValueList
if len(TokenList) > 1:
self._ValueList[2] = TokenList[1]
if self._ValueList[0] == '' or self._ValueList[1] == '':
@@ -649,7 +656,11 @@
continue
# file private macros
elif Line.upper().startswith('DEFINE '):
- self._MacroParser()
+ (Name, Value) = self._MacroParser()
+ # Make the defined macro in DSC [Defines] section also
+ # available for FDF file.
+ if self._SectionName == TAB_COMMON_DEFINES.upper():
+ GlobalData.gGlobalDefines.setdefault(Name, Value)
continue
elif Line.upper().startswith('EDK_GLOBAL '):
(Name, Value) = self._MacroParser()
@@ -716,6 +727,8 @@
if TokenList[0] in ['FLASH_DEFINITION', 'OUTPUT_DIRECTORY']:
TokenList[1] = NormPath(TokenList[1], self._Macros)
self._ValueList[0:len(TokenList)] = TokenList
+ # Treat elements in the [defines] section as global macros for FDF file.
+ GlobalData.gGlobalDefines.setdefault(TokenList[0], TokenList[1])
## <subsection_header> parser
def _SubsectionHeaderParser(self):
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-08-19 12:55:45 UTC (rev 2021)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-08-19 23:55:38 UTC (rev 2022)
@@ -830,6 +830,7 @@
TAB_DEC_DEFINES_PACKAGE_NAME : "_PackageName",
TAB_DEC_DEFINES_PACKAGE_GUID : "_Guid",
TAB_DEC_DEFINES_PACKAGE_VERSION : "_Version",
+ TAB_DEC_DEFINES_PKG_UNI_FILE : "_PkgUniFile",
}
@@ -871,6 +872,7 @@
self._PackageName = None
self._Guid = None
self._Version = None
+ self._PkgUniFile = None
self._Protocols = None
self._Ppis = None
self._Guids = None
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|