Sync BaseTool trunk (version r2397) into EDKII BaseTools. The change mainly includes

1. Fix the issue that root directory of disk can’t be used as WORKSPACE.
2. Update AutoGen code style to pass C++ compiler.

Signed-off-by: lgao4
Reviewed-by: jsu1

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12676 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4
2011-11-09 04:32:08 +00:00
parent 0806815921
commit d40b2ee60e
45 changed files with 386 additions and 342 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -482,7 +482,7 @@ DEFINE CLANG_BIN = /usr/bin/
# *_*_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC # *_*_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
# *_*_EBC_PP_FLAGS = /nologo /E /TC /FI$(DEST_DIR_DEBUG)/AutoGen.h # *_*_EBC_PP_FLAGS = /nologo /E /TC /FI$(DEST_DIR_DEBUG)/AutoGen.h
# *_*_EBC_CC_FLAGS = /nologo /FAcs /c /W3 /WX /FI$(DEST_DIR_DEBUG)/AutoGen.h # *_*_EBC_CC_FLAGS = /nologo /FAcs /c /W3 /WX /FI$(DEST_DIR_DEBUG)/AutoGen.h
# *_*_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /MACHINE:EBC /OPT:REF /NODEFAULTLIB /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER # *_*_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /MACHINE:EBC /OPT:REF /NODEFAULTLIB /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /ALIGN:32 /DRIVER
# #
#################################################################################### ####################################################################################
# #
@ -578,7 +578,7 @@ NOOPT_VS2003_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:RE
*_VS2003_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2003_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2003_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2003_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2003_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2003_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2003_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2003_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -652,7 +652,7 @@ NOOPT_VS2003xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OP
*_VS2003xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2003xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2003xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2003xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2003xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2003xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2003xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2003xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -789,7 +789,7 @@ NOOPT_VS2005_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF
*_VS2005_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2005_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2005_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2005_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2005_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2005_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2005_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2005_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -926,7 +926,7 @@ NOOPT_VS2005xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,
*_VS2005xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2005xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2005xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2005xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2005xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2005xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2005xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2005xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -1063,7 +1063,7 @@ NOOPT_VS2005x86_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,I
*_VS2005x86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2005x86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2005x86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2005x86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2005x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2005x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2005x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2005x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -1200,7 +1200,7 @@ NOOPT_VS2005x86xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:R
*_VS2005x86xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2005x86xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2005x86xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2005x86xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2005x86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2005x86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2005x86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2005x86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
@ -1339,7 +1339,7 @@ NOOPT_VS2008_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF
*_VS2008_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2008_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2008_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2008_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2008_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2008_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2008_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2008_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -1476,7 +1476,7 @@ NOOPT_VS2008xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,
*_VS2008xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2008xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2008xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2008xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2008xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2008xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2008xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2008xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -1833,7 +1833,7 @@ NOOPT_DDK3790_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF
*_DDK3790_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_DDK3790_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_DDK3790_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_DDK3790_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_DDK3790_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER *_DDK3790_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -1958,7 +1958,7 @@ NOOPT_DDK3790xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF
*_DDK3790xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_DDK3790xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_DDK3790xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_DDK3790xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_DDK3790xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER *_DDK3790xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -2330,7 +2330,7 @@ DEFINE GCC45_ASM_FLAGS = DEF(GCC44_ASM_FLAGS)
*_CYGGCC_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_CYGGCC_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_CYGGCC_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_CYGGCC_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_CYGGCC_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER *_CYGGCC_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -2433,7 +2433,7 @@ DEFINE GCC45_ASM_FLAGS = DEF(GCC44_ASM_FLAGS)
*_CYGGCCxASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_CYGGCCxASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_CYGGCCxASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_CYGGCCxASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_CYGGCCxASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER *_CYGGCCxASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -2669,7 +2669,7 @@ NOOPT_ICC_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT
*_ICC_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICC_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICC_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICC_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICC_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICC_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICC_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICC_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -2813,7 +2813,7 @@ NOOPT_ICCxASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL
*_ICCxASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICCxASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICCxASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICCxASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICCxASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICCxASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICCxASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICCxASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -2958,7 +2958,7 @@ NOOPT_ICCx86_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /
*_ICCx86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICCx86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICCx86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICCx86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICCx86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICCx86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICCx86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICCx86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -3103,7 +3103,7 @@ NOOPT_ICCx86xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /D
*_ICCx86xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICCx86xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICCx86xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICCx86xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICCx86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICCx86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICCx86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICCx86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -3246,7 +3246,7 @@ NOOPT_ICC11_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /O
*_ICC11_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICC11_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICC11_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICC11_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICC11_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICC11_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICC11_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICC11_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -3390,7 +3390,7 @@ NOOPT_ICC11xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DL
*_ICC11xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICC11xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICC11xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICC11xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICC11xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICC11xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICC11xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICC11xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -3532,7 +3532,7 @@ NOOPT_ICC11x86_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL
*_ICC11x86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICC11x86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICC11x86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICC11x86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICC11x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICC11x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICC11x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICC11x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -3674,7 +3674,7 @@ NOOPT_ICC11x86xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG
*_ICC11x86xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICC11x86xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICC11x86xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICC11x86xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICC11x86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICC11x86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICC11x86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICC11x86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -3810,7 +3810,7 @@ NOOPT_MYTOOLS_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT
*_MYTOOLS_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_MYTOOLS_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_MYTOOLS_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_MYTOOLS_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_MYTOOLS_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_MYTOOLS_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_MYTOOLS_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_MYTOOLS_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################

View File

@ -1,3 +1,3 @@
//This file is for build version number auto generation //This file is for build version number auto generation
// //
#define __BUILD_VERSION "Build 2386" #define __BUILD_VERSION "Build 2396"

View File

@ -2184,13 +2184,19 @@ class ModuleAutoGen(AutoGen):
def _GetBuildOptionIncPathList(self): def _GetBuildOptionIncPathList(self):
if self._BuildOptionIncPathList == None: if self._BuildOptionIncPathList == None:
# #
# Regular expression for finding Include Directories, the difference between MSFT and INTEL/GCC # Regular expression for finding Include Directories, the difference between MSFT and INTEL/GCC/RVCT
# is the former use /I , the Latter used -I to specify include directories # is the former use /I , the Latter used -I to specify include directories
# #
if self.PlatformInfo.ToolChainFamily in ('MSFT'): if self.PlatformInfo.ToolChainFamily in ('MSFT'):
gBuildOptIncludePattern = re.compile(r"(?:.*?)/I[ \t]*([^ ]*)", re.MULTILINE|re.DOTALL) gBuildOptIncludePattern = re.compile(r"(?:.*?)/I[ \t]*([^ ]*)", re.MULTILINE|re.DOTALL)
elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC'): elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC', 'RVCT'):
gBuildOptIncludePattern = re.compile(r"(?:.*?)-I[ \t]*([^ ]*)", re.MULTILINE|re.DOTALL) gBuildOptIncludePattern = re.compile(r"(?:.*?)-I[ \t]*([^ ]*)", re.MULTILINE|re.DOTALL)
else:
#
# New ToolChainFamily, don't known whether there is option to specify include directories
#
self._BuildOptionIncPathList = []
return self._BuildOptionIncPathList
BuildOptionIncPathList = [] BuildOptionIncPathList = []
for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'ASM'): for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'ASM'):
@ -2200,7 +2206,17 @@ class ModuleAutoGen(AutoGen):
except KeyError: except KeyError:
FlagOption = '' FlagOption = ''
IncPathList = [NormPath(Path, self.Macros) for Path in gBuildOptIncludePattern.findall(FlagOption)] if self.PlatformInfo.ToolChainFamily != 'RVCT':
IncPathList = [NormPath(Path, self.Macros) for Path in gBuildOptIncludePattern.findall(FlagOption)]
else:
#
# RVCT may specify a list of directory seperated by commas
#
IncPathList = []
for Path in gBuildOptIncludePattern.findall(FlagOption):
PathList = GetSplitList(Path, TAB_COMMA_SPLIT)
IncPathList += [NormPath(PathEntry, self.Macros) for PathEntry in PathList]
# #
# EDK II modules must not reference header files outside of the packages they depend on or # EDK II modules must not reference header files outside of the packages they depend on or
# within the module's directory tree. Report error if violation. # within the module's directory tree. Report error if violation.

View File

@ -310,9 +310,18 @@ gAutoGenHPrologueString = TemplateString("""
#ifndef _${File}_${Guid} #ifndef _${File}_${Guid}
#define _${File}_${Guid} #define _${File}_${Guid}
#ifdef __cplusplus
extern "C" {
#endif
""") """)
gAutoGenHEpilogueString = """ gAutoGenHEpilogueString = """
#ifdef __cplusplus
}
#endif
#endif #endif
""" """
@ -917,7 +926,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
"No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName), "No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info)) ExtraData="[%s]" % str(Info))
TokenNumber = PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] TokenNumber = PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName]
AutoGenH.Append('\n#define %s %d\n' % (PcdTokenName, TokenNumber)) AutoGenH.Append('\n#define %s %dU\n' % (PcdTokenName, TokenNumber))
EdkLogger.debug(EdkLogger.DEBUG_3, "Creating code for " + Pcd.TokenCName + "." + Pcd.TokenSpaceGuidCName) EdkLogger.debug(EdkLogger.DEBUG_3, "Creating code for " + Pcd.TokenCName + "." + Pcd.TokenSpaceGuidCName)
if Pcd.Type not in gItemTypeStringDatabase: if Pcd.Type not in gItemTypeStringDatabase:
@ -960,9 +969,9 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
if Pcd.DatumType == 'BOOLEAN': if Pcd.DatumType == 'BOOLEAN':
BoolValue = Value.upper() BoolValue = Value.upper()
if BoolValue == 'TRUE': if BoolValue == 'TRUE':
Value = 1 Value = '1U'
elif BoolValue == 'FALSE': elif BoolValue == 'FALSE':
Value = 0 Value = '0U'
if Pcd.DatumType in ['UINT64', 'UINT32', 'UINT16', 'UINT8']: if Pcd.DatumType in ['UINT64', 'UINT32', 'UINT16', 'UINT8']:
try: try:
@ -994,6 +1003,8 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
EdkLogger.error("build", AUTOGEN_ERROR, EdkLogger.error("build", AUTOGEN_ERROR,
"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info)) ExtraData="[%s]" % str(Info))
if not Value.endswith('U'):
Value += 'U'
elif Pcd.DatumType == 'UINT16': elif Pcd.DatumType == 'UINT16':
if ValueNumber < 0: if ValueNumber < 0:
EdkLogger.error("build", AUTOGEN_ERROR, EdkLogger.error("build", AUTOGEN_ERROR,
@ -1003,6 +1014,8 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
EdkLogger.error("build", AUTOGEN_ERROR, EdkLogger.error("build", AUTOGEN_ERROR,
"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info)) ExtraData="[%s]" % str(Info))
if not Value.endswith('U'):
Value += 'U'
elif Pcd.DatumType == 'UINT8': elif Pcd.DatumType == 'UINT8':
if ValueNumber < 0: if ValueNumber < 0:
EdkLogger.error("build", AUTOGEN_ERROR, EdkLogger.error("build", AUTOGEN_ERROR,
@ -1012,6 +1025,8 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
EdkLogger.error("build", AUTOGEN_ERROR, EdkLogger.error("build", AUTOGEN_ERROR,
"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info)) ExtraData="[%s]" % str(Info))
if not Value.endswith('U'):
Value += 'U'
if Pcd.DatumType == 'VOID*': if Pcd.DatumType == 'VOID*':
if Pcd.MaxDatumSize == None or Pcd.MaxDatumSize == '': if Pcd.MaxDatumSize == None or Pcd.MaxDatumSize == '':
EdkLogger.error("build", AUTOGEN_ERROR, EdkLogger.error("build", AUTOGEN_ERROR,
@ -1131,7 +1146,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
Type = '(VOID *)' Type = '(VOID *)'
Array = '[]' Array = '[]'
AutoGenH.Append('#define _PCD_TOKEN_%s %d\n' % (TokenCName, TokenNumber)) AutoGenH.Append('#define _PCD_TOKEN_%s %dU\n' % (TokenCName, TokenNumber))
PcdItemType = Pcd.Type PcdItemType = Pcd.Type
#if PcdItemType in gDynamicPcd: #if PcdItemType in gDynamicPcd:
@ -1405,6 +1420,8 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
# #
if Pcd.DatumType == "UINT64": if Pcd.DatumType == "UINT64":
ValueList.append(Sku.DefaultValue + "ULL") ValueList.append(Sku.DefaultValue + "ULL")
elif Pcd.DatumType in ("UINT32", "UINT16", "UINT8"):
ValueList.append(Sku.DefaultValue + "U")
else: else:
ValueList.append(Sku.DefaultValue) ValueList.append(Sku.DefaultValue)

View File

@ -1312,17 +1312,16 @@ ${END}\t@cd $(BUILD_DIR)\n
if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "": if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "":
FdfFileList = [PlatformInfo.FdfFile] FdfFileList = [PlatformInfo.FdfFile]
# macros passed to GenFds # macros passed to GenFds
# MacroList.append('"%s=%s"' % ("WORKSPACE", GlobalData.gWorkspace)) MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource.replace('\\', '\\\\')))
MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource)) MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource.replace('\\', '\\\\')))
MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource))
for MacroName in GlobalData.gGlobalDefines: for MacroName in GlobalData.gGlobalDefines:
if GlobalData.gGlobalDefines[MacroName] != "": if GlobalData.gGlobalDefines[MacroName] != "":
MacroList.append('"%s=%s"' % (MacroName, GlobalData.gGlobalDefines[MacroName])) MacroList.append('"%s=%s"' % (MacroName, GlobalData.gGlobalDefines[MacroName].replace('\\', '\\\\')))
else: else:
MacroList.append('"%s"' % MacroName) MacroList.append('"%s"' % MacroName)
for MacroName in GlobalData.gCommandLineDefines: for MacroName in GlobalData.gCommandLineDefines:
if GlobalData.gCommandLineDefines[MacroName] != "": if GlobalData.gCommandLineDefines[MacroName] != "":
MacroList.append('"%s=%s"' % (MacroName, GlobalData.gCommandLineDefines[MacroName])) MacroList.append('"%s=%s"' % (MacroName, GlobalData.gCommandLineDefines[MacroName].replace('\\', '\\\\')))
else: else:
MacroList.append('"%s"' % MacroName) MacroList.append('"%s"' % MacroName)
else: else:

View File

@ -1,3 +1,3 @@
#This file is for build version number auto generation #This file is for build version number auto generation
# #
gBUILD_VERSION = "Build 2386" gBUILD_VERSION = "Build 2396"

View File

@ -82,14 +82,14 @@ class DecObject(object):
# @var KeyList: To store value for KeyList, a list for all Keys used in Dec # @var KeyList: To store value for KeyList, a list for all Keys used in Dec
# #
class Dec(DecObject): class Dec(DecObject):
def __init__(self, Filename = None, IsToDatabase = False, IsToPackage = False, WorkspaceDir = None, Database = None, SupArchList = DataType.ARCH_LIST): def __init__(self, Filename=None, IsToDatabase=False, IsToPackage=False, WorkspaceDir=None, Database=None, SupArchList=DataType.ARCH_LIST):
self.Identification = Identification() self.Identification = Identification()
self.Package = PackageClass() self.Package = PackageClass()
self.UserExtensions = '' self.UserExtensions = ''
self.WorkspaceDir = WorkspaceDir self.WorkspaceDir = WorkspaceDir
self.SupArchList = SupArchList self.SupArchList = SupArchList
self.IsToDatabase = IsToDatabase self.IsToDatabase = IsToDatabase
self.Cur = Database.Cur self.Cur = Database.Cur
self.TblFile = Database.TblFile self.TblFile = Database.TblFile
self.TblDec = Database.TblDec self.TblDec = Database.TblDec
@ -104,26 +104,26 @@ class Dec(DecObject):
# Upper all KEYs to ignore case sensitive when parsing # Upper all KEYs to ignore case sensitive when parsing
# #
self.KeyList = map(lambda c: c.upper(), self.KeyList) self.KeyList = map(lambda c: c.upper(), self.KeyList)
# #
# Init RecordSet # Init RecordSet
# #
self.RecordSet = {} self.RecordSet = {}
for Key in self.KeyList: for Key in self.KeyList:
self.RecordSet[Section[Key]] = [] self.RecordSet[Section[Key]] = []
# #
# Load Dec file if filename is not None # Load Dec file if filename is not None
# #
if Filename != None: if Filename != None:
self.LoadDecFile(Filename) self.LoadDecFile(Filename)
# #
# Transfer to Package Object if IsToPackage is True # Transfer to Package Object if IsToPackage is True
# #
if IsToPackage: if IsToPackage:
self.DecToPackage() self.DecToPackage()
## Load Dec file ## Load Dec file
# #
# Load the file if it exists # Load the file if it exists
@ -138,20 +138,20 @@ class Dec(DecObject):
self.Identification.FileFullPath = Filename self.Identification.FileFullPath = Filename
(self.Identification.FileRelativePath, self.Identification.FileName) = os.path.split(Filename) (self.Identification.FileRelativePath, self.Identification.FileName) = os.path.split(Filename)
self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_DEC) self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_DEC)
# #
# Init DecTable # Init DecTable
# #
#self.TblDec.Table = "Dec%s" % self.FileID #self.TblDec.Table = "Dec%s" % self.FileID
#self.TblDec.Create() #self.TblDec.Create()
# #
# Init common datas # Init common datas
# #
IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \ IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \
[], [], TAB_UNKNOWN, [], [], [] [], [], TAB_UNKNOWN, [], [], []
LineNo = 0 LineNo = 0
# #
# Parse file content # Parse file content
# #
@ -163,10 +163,10 @@ class Dec(DecObject):
# Remove comment block # Remove comment block
# #
if Line.find(TAB_COMMENT_EDK_START) > -1: if Line.find(TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
IsFindBlockComment = True IsFindBlockComment = True
if Line.find(TAB_COMMENT_EDK_END) > -1: if Line.find(TAB_COMMENT_EDK_END) > -1:
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:
@ -178,7 +178,7 @@ class Dec(DecObject):
Line = CleanString(Line) Line = CleanString(Line)
if Line == '': if Line == '':
continue continue
# #
# Find a new section tab # Find a new section tab
# First insert previous section items # First insert previous section items
@ -197,7 +197,7 @@ class Dec(DecObject):
SectionItemList = [] SectionItemList = []
ArchList = [] ArchList = []
ThirdList = [] ThirdList = []
CurrentSection = '' CurrentSection = ''
LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT) LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT)
for Item in LineList: for Item in LineList:
@ -206,7 +206,7 @@ class Dec(DecObject):
CurrentSection = ItemList[0] CurrentSection = ItemList[0]
else: else:
if CurrentSection != ItemList[0]: if CurrentSection != ItemList[0]:
EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
if CurrentSection.upper() not in self.KeyList: if CurrentSection.upper() not in self.KeyList:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
ItemList.append('') ItemList.append('')
@ -215,18 +215,18 @@ class Dec(DecObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else: else:
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL: if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper()) ArchList.append(ItemList[1].upper())
ThirdList.append(ItemList[2]) ThirdList.append(ItemList[2])
continue continue
# #
# Not in any defined section # Not in any defined section
# #
if CurrentSection == TAB_UNKNOWN: if CurrentSection == TAB_UNKNOWN:
ErrorMsg = "%s is not in any defined section" % Line ErrorMsg = "%s is not in any defined section" % Line
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
# #
# Add a section item # Add a section item
@ -234,13 +234,13 @@ class Dec(DecObject):
SectionItemList.append([Line, LineNo]) SectionItemList.append([Line, LineNo])
# End of parse # End of parse
#End of For #End of For
# #
# Insert items data of last section # Insert items data of last section
# #
Model = Section[CurrentSection.upper()] Model = Section[CurrentSection.upper()]
InsertSectionItemsIntoDatabase(self.TblDec, self.FileID, Filename, Model, CurrentSection, SectionItemList, ArchList, ThirdList, IfDefList, self.RecordSet) InsertSectionItemsIntoDatabase(self.TblDec, self.FileID, Filename, Model, CurrentSection, SectionItemList, ArchList, ThirdList, IfDefList, self.RecordSet)
# #
# Replace all DEFINE macros with its actual values # Replace all DEFINE macros with its actual values
# #
@ -255,12 +255,12 @@ class Dec(DecObject):
# Init global information for the file # Init global information for the file
# #
ContainerFile = self.Identification.FileFullPath ContainerFile = self.Identification.FileFullPath
# #
# Generate Package Header # Generate Package Header
# #
self.GenPackageHeader(ContainerFile) self.GenPackageHeader(ContainerFile)
# #
# Generate Includes # Generate Includes
# #
@ -280,17 +280,17 @@ class Dec(DecObject):
# Generate Ppis # Generate Ppis
# #
self.GenGuidProtocolPpis(DataType.TAB_PPIS, ContainerFile) self.GenGuidProtocolPpis(DataType.TAB_PPIS, ContainerFile)
# #
# Generate LibraryClasses # Generate LibraryClasses
# #
self.GenLibraryClasses(ContainerFile) self.GenLibraryClasses(ContainerFile)
# #
# Generate Pcds # Generate Pcds
# #
self.GenPcds(ContainerFile) self.GenPcds(ContainerFile)
## Get Package Header ## Get Package Header
# #
# Gen Package Header of Dec as <Key> = <Value> # Gen Package Header of Dec as <Key> = <Value>
@ -311,22 +311,22 @@ class Dec(DecObject):
SqlCommand = """update %s set Value1 = '%s', Value2 = '%s' SqlCommand = """update %s set Value1 = '%s', Value2 = '%s'
where ID = %s""" % (self.TblDec.Table, ConvertToSqlString2(Value1), ConvertToSqlString2(Value2), ID) where ID = %s""" % (self.TblDec.Table, ConvertToSqlString2(Value1), ConvertToSqlString2(Value2), ID)
self.TblDec.Exec(SqlCommand) self.TblDec.Exec(SqlCommand)
# #
# Get detailed information # Get detailed information
# #
for Arch in self.SupArchList: for Arch in self.SupArchList:
PackageHeader = PackageHeaderClass() PackageHeader = PackageHeaderClass()
PackageHeader.Name = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_PACKAGE_NAME, Arch, self.FileID)[0] PackageHeader.Name = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_PACKAGE_NAME, Arch, self.FileID)[0]
PackageHeader.Guid = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_PACKAGE_GUID, Arch, self.FileID)[0] PackageHeader.Guid = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_PACKAGE_GUID, Arch, self.FileID)[0]
PackageHeader.Version = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_PACKAGE_VERSION, Arch, self.FileID)[0] PackageHeader.Version = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_PACKAGE_VERSION, Arch, self.FileID)[0]
PackageHeader.FileName = self.Identification.FileName PackageHeader.FileName = self.Identification.FileName
PackageHeader.FullPath = self.Identification.FileFullPath PackageHeader.FullPath = self.Identification.FileFullPath
PackageHeader.DecSpecification = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_DEC_SPECIFICATION, Arch, self.FileID)[0] PackageHeader.DecSpecification = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_DEC_SPECIFICATION, Arch, self.FileID)[0]
self.Package.Header[Arch] = PackageHeader self.Package.Header[Arch] = PackageHeader
## GenIncludes ## GenIncludes
# #
# Gen Includes of Dec # Gen Includes of Dec
@ -341,7 +341,7 @@ class Dec(DecObject):
# Get all Includes # Get all Includes
# #
RecordSet = self.RecordSet[MODEL_EFI_INCLUDE] RecordSet = self.RecordSet[MODEL_EFI_INCLUDE]
# #
# Go through each arch # Go through each arch
# #
@ -355,7 +355,7 @@ class Dec(DecObject):
Include.FilePath = NormPath(Key) Include.FilePath = NormPath(Key)
Include.SupArchList = Includes[Key] Include.SupArchList = Includes[Key]
self.Package.Includes.append(Include) self.Package.Includes.append(Include)
## GenPpis ## GenPpis
# #
# Gen Ppis of Dec # Gen Ppis of Dec
@ -370,7 +370,7 @@ class Dec(DecObject):
# Get all Items # Get all Items
# #
RecordSet = self.RecordSet[Section[Type.upper()]] RecordSet = self.RecordSet[Section[Type.upper()]]
# #
# Go through each arch # Go through each arch
# #
@ -383,7 +383,7 @@ class Dec(DecObject):
SqlCommand = """update %s set Value1 = '%s', Value2 = '%s' SqlCommand = """update %s set Value1 = '%s', Value2 = '%s'
where ID = %s""" % (self.TblDec.Table, ConvertToSqlString2(Name), ConvertToSqlString2(Value), Record[3]) where ID = %s""" % (self.TblDec.Table, ConvertToSqlString2(Name), ConvertToSqlString2(Value), Record[3])
self.TblDec.Exec(SqlCommand) self.TblDec.Exec(SqlCommand)
ListMember = None ListMember = None
if Type == TAB_GUIDS: if Type == TAB_GUIDS:
ListMember = self.Package.GuidDeclarations ListMember = self.Package.GuidDeclarations
@ -391,15 +391,15 @@ class Dec(DecObject):
ListMember = self.Package.ProtocolDeclarations ListMember = self.Package.ProtocolDeclarations
elif Type == TAB_PPIS: elif Type == TAB_PPIS:
ListMember = self.Package.PpiDeclarations ListMember = self.Package.PpiDeclarations
for Key in Lists.keys(): for Key in Lists.keys():
ListClass = GuidProtocolPpiCommonClass() ListClass = GuidProtocolPpiCommonClass()
ListClass.CName = Key[0] ListClass.CName = Key[0]
ListClass.Guid = Key[1] ListClass.Guid = Key[1]
ListClass.SupArchList = Lists[Key] ListClass.SupArchList = Lists[Key]
ListMember.append(ListClass) ListMember.append(ListClass)
## GenLibraryClasses ## GenLibraryClasses
# #
# Gen LibraryClasses of Dec # Gen LibraryClasses of Dec
@ -414,7 +414,7 @@ class Dec(DecObject):
# Get all Guids # Get all Guids
# #
RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_CLASS] RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_CLASS]
# #
# Go through each arch # Go through each arch
# #
@ -432,7 +432,7 @@ class Dec(DecObject):
where ID = %s""" % (self.TblDec.Table, ConvertToSqlString2(List[0]), ConvertToSqlString2(List[1]), SUP_MODULE_LIST_STRING, Record[3]) where ID = %s""" % (self.TblDec.Table, ConvertToSqlString2(List[0]), ConvertToSqlString2(List[1]), SUP_MODULE_LIST_STRING, Record[3])
self.TblDec.Exec(SqlCommand) self.TblDec.Exec(SqlCommand)
for Key in LibraryClasses.keys(): for Key in LibraryClasses.keys():
LibraryClass = LibraryClassClass() LibraryClass = LibraryClassClass()
LibraryClass.LibraryClass = Key[0] LibraryClass.LibraryClass = Key[0]
@ -440,7 +440,7 @@ class Dec(DecObject):
LibraryClass.SupModuleList = SUP_MODULE_LIST LibraryClass.SupModuleList = SUP_MODULE_LIST
LibraryClass.SupArchList = LibraryClasses[Key] LibraryClass.SupArchList = LibraryClasses[Key]
self.Package.LibraryClassDeclarations.append(LibraryClass) self.Package.LibraryClassDeclarations.append(LibraryClass)
## GenPcds ## GenPcds
# #
# Gen Pcds of Dec # Gen Pcds of Dec
@ -460,7 +460,7 @@ class Dec(DecObject):
RecordSet3 = self.RecordSet[MODEL_PCD_FEATURE_FLAG] RecordSet3 = self.RecordSet[MODEL_PCD_FEATURE_FLAG]
RecordSet4 = self.RecordSet[MODEL_PCD_DYNAMIC_EX] RecordSet4 = self.RecordSet[MODEL_PCD_DYNAMIC_EX]
RecordSet5 = self.RecordSet[MODEL_PCD_DYNAMIC] RecordSet5 = self.RecordSet[MODEL_PCD_DYNAMIC]
# #
# Go through each arch # Go through each arch
# #
@ -508,7 +508,7 @@ class Dec(DecObject):
Pcd.ItemType = Key[5] Pcd.ItemType = Key[5]
Pcd.SupArchList = Pcds[Key] Pcd.SupArchList = Pcds[Key]
self.Package.PcdDeclarations.append(Pcd) self.Package.PcdDeclarations.append(Pcd)
## Show detailed information of Package ## Show detailed information of Package
# #
# Print all members and their values of Package class # Print all members and their values of Package class
@ -550,14 +550,14 @@ class Dec(DecObject):
if __name__ == '__main__': if __name__ == '__main__':
EdkLogger.Initialize() EdkLogger.Initialize()
EdkLogger.SetLevel(EdkLogger.DEBUG_0) EdkLogger.SetLevel(EdkLogger.DEBUG_0)
W = os.getenv('WORKSPACE') W = os.getenv('WORKSPACE')
F = os.path.join(W, 'Nt32Pkg/Nt32Pkg.dec') F = os.path.join(W, 'Nt32Pkg/Nt32Pkg.dec')
Db = Database.Database('Dec.db') Db = Database.Database('Dec.db')
Db.InitDatabase() Db.InitDatabase()
P = Dec(os.path.normpath(F), True, True, W, Db) P = Dec(os.path.normpath(F), True, True, W, Db)
P.ShowPackage() P.ShowPackage()
Db.Close() Db.Close()

View File

@ -75,7 +75,7 @@ class DecObject(object):
# @var KeyList: To store value for KeyList, a list for all Keys used in Dec # @var KeyList: To store value for KeyList, a list for all Keys used in Dec
# #
class Dec(DecObject): class Dec(DecObject):
def __init__(self, Filename = None, IsToPackage = False, WorkspaceDir = None, AllGuidVersionDict = None, SupArchList = DataType.ARCH_LIST): def __init__(self, Filename=None, IsToPackage=False, WorkspaceDir=None, AllGuidVersionDict=None, SupArchList=DataType.ARCH_LIST):
self.Identification = IdentificationClass() self.Identification = IdentificationClass()
self.Package = PackageClass() self.Package = PackageClass()
self.UserExtensions = '' self.UserExtensions = ''
@ -92,23 +92,23 @@ class Dec(DecObject):
] ]
# Upper all KEYs to ignore case sensitive when parsing # Upper all KEYs to ignore case sensitive when parsing
self.KeyList = map(lambda c: c.upper(), self.KeyList) self.KeyList = map(lambda c: c.upper(), self.KeyList)
# Init RecordSet # Init RecordSet
self.RecordSet = {} self.RecordSet = {}
for Key in self.KeyList: for Key in self.KeyList:
self.RecordSet[Section[Key]] = [] self.RecordSet[Section[Key]] = []
# Init Comment # Init Comment
self.SectionHeaderCommentDict = {} self.SectionHeaderCommentDict = {}
# Load Dec file if filename is not None # Load Dec file if filename is not None
if Filename != None: if Filename != None:
self.LoadDecFile(Filename) self.LoadDecFile(Filename)
# Transfer to Package Object if IsToPackage is True # Transfer to Package Object if IsToPackage is True
if IsToPackage: if IsToPackage:
self.DecToPackage() self.DecToPackage()
## Load Dec file ## Load Dec file
# #
# Load the file if it exists # Load the file if it exists
@ -121,13 +121,13 @@ class Dec(DecObject):
self.Identification.FullPath = Filename self.Identification.FullPath = Filename
(self.Identification.RelaPath, self.Identification.FileName) = os.path.split(Filename) (self.Identification.RelaPath, self.Identification.FileName) = os.path.split(Filename)
if self.Identification.FullPath.find(self.WorkspaceDir) > -1: if self.Identification.FullPath.find(self.WorkspaceDir) > -1:
self.Identification.PackagePath = os.path.dirname(self.Identification.FullPath[len(self.WorkspaceDir) + 1:]) self.Identification.PackagePath = os.path.dirname(self.Identification.FullPath[len(self.WorkspaceDir) + 1:])
# Init common datas # Init common datas
IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \ IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \
[], [], TAB_UNKNOWN, [], [], [] [], [], TAB_UNKNOWN, [], [], []
LineNo = 0 LineNo = 0
# Parse file content # Parse file content
IsFindBlockComment = False IsFindBlockComment = False
ReservedLine = '' ReservedLine = ''
@ -136,7 +136,7 @@ class Dec(DecObject):
LineNo = LineNo + 1 LineNo = LineNo + 1
# Remove comment block # Remove comment block
if Line.find(TAB_COMMENT_EDK_START) > -1: if Line.find(TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
if ReservedLine.strip().startswith(TAB_COMMENT_SPLIT): if ReservedLine.strip().startswith(TAB_COMMENT_SPLIT):
Comment = Comment + Line.strip() + '\n' Comment = Comment + Line.strip() + '\n'
ReservedLine = '' ReservedLine = ''
@ -147,7 +147,7 @@ class Dec(DecObject):
continue continue
if Line.find(TAB_COMMENT_EDK_END) > -1: if Line.find(TAB_COMMENT_EDK_END) > -1:
Comment = Comment + Line[:Line.find(TAB_COMMENT_EDK_END) + len(TAB_COMMENT_EDK_END)] + '\n' Comment = Comment + Line[:Line.find(TAB_COMMENT_EDK_END) + len(TAB_COMMENT_EDK_END)] + '\n'
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:
@ -160,7 +160,7 @@ class Dec(DecObject):
Line = CleanString(Line) Line = CleanString(Line)
if Line == '': if Line == '':
continue continue
## Find a new section tab ## Find a new section tab
# First insert previous section items # First insert previous section items
# And then parse the content of the new section # And then parse the content of the new section
@ -173,7 +173,7 @@ class Dec(DecObject):
SectionItemList = [] SectionItemList = []
ArchList = [] ArchList = []
ThirdList = [] ThirdList = []
CurrentSection = '' CurrentSection = ''
LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT) LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT)
for Item in LineList: for Item in LineList:
@ -182,7 +182,7 @@ class Dec(DecObject):
CurrentSection = ItemList[0] CurrentSection = ItemList[0]
else: else:
if CurrentSection != ItemList[0]: if CurrentSection != ItemList[0]:
EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
if CurrentSection.upper() not in self.KeyList: if CurrentSection.upper() not in self.KeyList:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
ItemList.append('') ItemList.append('')
@ -191,28 +191,28 @@ class Dec(DecObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else: else:
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL: if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper()) ArchList.append(ItemList[1].upper())
ThirdList.append(ItemList[2]) ThirdList.append(ItemList[2])
if Comment: if Comment:
if Comment.endswith('\n'): if Comment.endswith('\n'):
Comment = Comment[:len(Comment) - len('\n')] Comment = Comment[:len(Comment) - len('\n')]
self.SectionHeaderCommentDict[Section[CurrentSection.upper()]] = Comment self.SectionHeaderCommentDict[Section[CurrentSection.upper()]] = Comment
Comment = '' Comment = ''
continue continue
# Not in any defined section # Not in any defined section
if CurrentSection == TAB_UNKNOWN: if CurrentSection == TAB_UNKNOWN:
ErrorMsg = "%s is not in any defined section" % Line ErrorMsg = "%s is not in any defined section" % Line
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
# Add a section item # Add a section item
SectionItemList.append([Line, LineNo, Comment]) SectionItemList.append([Line, LineNo, Comment])
Comment = '' Comment = ''
# End of parse # End of parse
#End of For #End of For
# #
# Insert items data of last section # Insert items data of last section
# #
@ -229,7 +229,7 @@ class Dec(DecObject):
SectionHeaderCommentDict = {} SectionHeaderCommentDict = {}
if Package == None: if Package == None:
return Dec return Dec
PackageHeader = Package.PackageHeader PackageHeader = Package.PackageHeader
TmpList = [] TmpList = []
if PackageHeader.Name: if PackageHeader.Name:
@ -243,30 +243,30 @@ class Dec(DecObject):
if Package.UserExtensions != None: if Package.UserExtensions != None:
for Item in Package.UserExtensions.Defines: for Item in Package.UserExtensions.Defines:
TmpList.append(Item) TmpList.append(Item)
DecList['Defines'] =TmpList DecList['Defines'] = TmpList
if PackageHeader.Description != '': if PackageHeader.Description != '':
SectionHeaderCommentDict['Defines'] = PackageHeader.Description SectionHeaderCommentDict['Defines'] = PackageHeader.Description
for Item in Package.Includes: for Item in Package.Includes:
Key = 'Includes.' + Item.SupArchList Key = 'Includes.' + Item.SupArchList
Value = Item.FilePath Value = Item.FilePath
GenMetaDatSectionItem(Key, Value, DecList) GenMetaDatSectionItem(Key, Value, DecList)
for Item in Package.GuidDeclarations: for Item in Package.GuidDeclarations:
Key = 'Guids.' + Item.SupArchList Key = 'Guids.' + Item.SupArchList
Value = Item.CName + '=' + Item.Guid Value = Item.CName + '=' + Item.Guid
GenMetaDatSectionItem(Key, Value, DecList) GenMetaDatSectionItem(Key, Value, DecList)
for Item in Package.ProtocolDeclarations: for Item in Package.ProtocolDeclarations:
Key = 'Protocols.' + Item.SupArchList Key = 'Protocols.' + Item.SupArchList
Value = Item.CName + '=' + Item.Guid Value = Item.CName + '=' + Item.Guid
GenMetaDatSectionItem(Key, Value, DecList) GenMetaDatSectionItem(Key, Value, DecList)
for Item in Package.PpiDeclarations: for Item in Package.PpiDeclarations:
Key = 'Ppis.' + Item.SupArchList Key = 'Ppis.' + Item.SupArchList
Value = Item.CName + '=' + Item.Guid Value = Item.CName + '=' + Item.Guid
GenMetaDatSectionItem(Key, Value, DecList) GenMetaDatSectionItem(Key, Value, DecList)
for Item in Package.LibraryClassDeclarations: for Item in Package.LibraryClassDeclarations:
Key = 'LibraryClasses.' + Item.SupArchList Key = 'LibraryClasses.' + Item.SupArchList
Value = Item.LibraryClass + '|' + Item.RecommendedInstance Value = Item.LibraryClass + '|' + Item.RecommendedInstance
@ -297,7 +297,7 @@ class Dec(DecObject):
else: else:
Dec = Dec + ' ' + Value + '\n' Dec = Dec + ' ' + Value + '\n'
Dec = Dec + '\n' Dec = Dec + '\n'
return Dec return Dec
## Transfer to Package Object ## Transfer to Package Object
@ -307,10 +307,10 @@ class Dec(DecObject):
def DecToPackage(self): def DecToPackage(self):
# Init global information for the file # Init global information for the file
ContainerFile = self.Identification.FullPath ContainerFile = self.Identification.FullPath
# Generate Package Header # Generate Package Header
self.GenPackageHeader(ContainerFile) self.GenPackageHeader(ContainerFile)
# Generate Includes # Generate Includes
# Only for Edk # Only for Edk
self.GenIncludes(ContainerFile) self.GenIncludes(ContainerFile)
@ -323,16 +323,16 @@ class Dec(DecObject):
# Generate Ppis # Generate Ppis
self.GenGuidProtocolPpis(DataType.TAB_PPIS, ContainerFile) self.GenGuidProtocolPpis(DataType.TAB_PPIS, ContainerFile)
# Generate LibraryClasses # Generate LibraryClasses
self.GenLibraryClasses(ContainerFile) self.GenLibraryClasses(ContainerFile)
# Generate Pcds # Generate Pcds
self.GenPcds(ContainerFile) self.GenPcds(ContainerFile)
# Init MiscFiles # Init MiscFiles
self.GenMiscFiles(ContainerFile) self.GenMiscFiles(ContainerFile)
## GenMiscFiles ## GenMiscFiles
# #
def GenMiscFiles(self, ContainerFile): def GenMiscFiles(self, ContainerFile):
@ -343,7 +343,7 @@ class Dec(DecObject):
File.Filename = Item File.Filename = Item
MiscFiles.Files.append(File) MiscFiles.Files.append(File)
self.Package.MiscFiles = MiscFiles self.Package.MiscFiles = MiscFiles
## Get Package Header ## Get Package Header
# #
# Gen Package Header of Dec as <Key> = <Value> # Gen Package Header of Dec as <Key> = <Value>
@ -375,23 +375,23 @@ class Dec(DecObject):
PackageHeader.DecSpecification = Value PackageHeader.DecSpecification = Value
else: else:
OtherDefines.append(Record[0]) OtherDefines.append(Record[0])
PackageHeader.FileName = self.Identification.FileName PackageHeader.FileName = self.Identification.FileName
PackageHeader.FullPath = self.Identification.FullPath PackageHeader.FullPath = self.Identification.FullPath
PackageHeader.RelaPath = self.Identification.RelaPath PackageHeader.RelaPath = self.Identification.RelaPath
PackageHeader.PackagePath = self.Identification.PackagePath PackageHeader.PackagePath = self.Identification.PackagePath
PackageHeader.ModulePath = self.Identification.ModulePath PackageHeader.ModulePath = self.Identification.ModulePath
PackageHeader.CombinePath = os.path.normpath(os.path.join(PackageHeader.PackagePath, PackageHeader.ModulePath, PackageHeader.FileName)) PackageHeader.CombinePath = os.path.normpath(os.path.join(PackageHeader.PackagePath, PackageHeader.ModulePath, PackageHeader.FileName))
if MODEL_META_DATA_HEADER in self.SectionHeaderCommentDict: if MODEL_META_DATA_HEADER in self.SectionHeaderCommentDict:
PackageHeader.Description = self.SectionHeaderCommentDict[MODEL_META_DATA_HEADER] PackageHeader.Description = self.SectionHeaderCommentDict[MODEL_META_DATA_HEADER]
self.Package.PackageHeader = PackageHeader self.Package.PackageHeader = PackageHeader
UE = UserExtensionsClass() UE = UserExtensionsClass()
UE.Defines = OtherDefines UE.Defines = OtherDefines
self.Package.UserExtensions = UE self.Package.UserExtensions = UE
## GenIncludes ## GenIncludes
# #
# Gen Includes of Dec # Gen Includes of Dec
@ -403,7 +403,7 @@ class Dec(DecObject):
Includes = {} Includes = {}
# Get all Includes # Get all Includes
RecordSet = self.RecordSet[MODEL_EFI_INCLUDE] RecordSet = self.RecordSet[MODEL_EFI_INCLUDE]
# Go through each arch # Go through each arch
for Record in RecordSet: for Record in RecordSet:
Arch = Record[1] Arch = Record[1]
@ -412,7 +412,7 @@ class Dec(DecObject):
Include.FilePath = NormPath(Key) Include.FilePath = NormPath(Key)
Include.SupArchList = Arch Include.SupArchList = Arch
self.Package.Includes.append(Include) self.Package.Includes.append(Include)
## GenPpis ## GenPpis
# #
# Gen Ppis of Dec # Gen Ppis of Dec
@ -425,12 +425,12 @@ class Dec(DecObject):
Lists = {} Lists = {}
# Get all Items # Get all Items
RecordSet = self.RecordSet[Section[Type.upper()]] RecordSet = self.RecordSet[Section[Type.upper()]]
# Go through each arch # Go through each arch
for Record in RecordSet: for Record in RecordSet:
Arch = Record[1] Arch = Record[1]
(Name, Value) = GetGuidsProtocolsPpisOfDec(Record[0], Type, ContainerFile, Record[2]) (Name, Value) = GetGuidsProtocolsPpisOfDec(Record[0], Type, ContainerFile, Record[2])
ListMember = None ListMember = None
if Type == TAB_GUIDS: if Type == TAB_GUIDS:
ListMember = self.Package.GuidDeclarations ListMember = self.Package.GuidDeclarations
@ -438,13 +438,13 @@ class Dec(DecObject):
ListMember = self.Package.ProtocolDeclarations ListMember = self.Package.ProtocolDeclarations
elif Type == TAB_PPIS: elif Type == TAB_PPIS:
ListMember = self.Package.PpiDeclarations ListMember = self.Package.PpiDeclarations
ListClass = GuidProtocolPpiCommonClass() ListClass = GuidProtocolPpiCommonClass()
ListClass.CName = Name ListClass.CName = Name
ListClass.Guid = Value ListClass.Guid = Value
ListClass.SupArchList = Arch ListClass.SupArchList = Arch
ListMember.append(ListClass) ListMember.append(ListClass)
## GenLibraryClasses ## GenLibraryClasses
# #
# Gen LibraryClasses of Dec # Gen LibraryClasses of Dec
@ -457,7 +457,7 @@ class Dec(DecObject):
LibraryClasses = {} LibraryClasses = {}
# Get all Guids # Get all Guids
RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_CLASS] RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_CLASS]
# Go through each arch # Go through each arch
for Record in RecordSet: for Record in RecordSet:
Arch = Record[1] Arch = Record[1]
@ -469,7 +469,7 @@ class Dec(DecObject):
LibraryClass.RecommendedInstance = NormPath(List[1]) LibraryClass.RecommendedInstance = NormPath(List[1])
LibraryClass.SupArchList = Arch LibraryClass.SupArchList = Arch
self.Package.LibraryClassDeclarations.append(LibraryClass) self.Package.LibraryClassDeclarations.append(LibraryClass)
def AddPcd(self, CName, Token, TokenSpaceGuidCName, DatumType, DefaultValue, ItemType, Arch): def AddPcd(self, CName, Token, TokenSpaceGuidCName, DatumType, DefaultValue, ItemType, Arch):
Pcd = CommonClass.PcdClass() Pcd = CommonClass.PcdClass()
Pcd.CName = CName Pcd.CName = CName
@ -480,7 +480,7 @@ class Dec(DecObject):
Pcd.ItemType = ItemType Pcd.ItemType = ItemType
Pcd.SupArchList = Arch Pcd.SupArchList = Arch
self.Package.PcdDeclarations.append(Pcd) self.Package.PcdDeclarations.append(Pcd)
## GenPcds ## GenPcds
# #
# Gen Pcds of Dec # Gen Pcds of Dec
@ -498,7 +498,7 @@ class Dec(DecObject):
RecordSet3 = self.RecordSet[MODEL_PCD_FEATURE_FLAG] RecordSet3 = self.RecordSet[MODEL_PCD_FEATURE_FLAG]
RecordSet4 = self.RecordSet[MODEL_PCD_DYNAMIC_EX] RecordSet4 = self.RecordSet[MODEL_PCD_DYNAMIC_EX]
RecordSet5 = self.RecordSet[MODEL_PCD_DYNAMIC] RecordSet5 = self.RecordSet[MODEL_PCD_DYNAMIC]
# Go through each pcd # Go through each pcd
for Record in RecordSet1: for Record in RecordSet1:
Arch = Record[1] Arch = Record[1]
@ -520,7 +520,7 @@ class Dec(DecObject):
Arch = Record[1] Arch = Record[1]
(TokenGuidCName, TokenName, DefaultValue, DatumType, Token, ItemType) = GetPcdOfDec(Record[0], TAB_PCDS_DYNAMIC, ContainerFile, Record[2]) (TokenGuidCName, TokenName, DefaultValue, DatumType, Token, ItemType) = GetPcdOfDec(Record[0], TAB_PCDS_DYNAMIC, ContainerFile, Record[2])
self.AddPcd(TokenName, Token, TokenGuidCName, DatumType, DefaultValue, ItemType, Arch) self.AddPcd(TokenName, Token, TokenGuidCName, DatumType, DefaultValue, ItemType, Arch)
## Show detailed information of Package ## Show detailed information of Package
# #
# Print all members and their values of Package class # Print all members and their values of Package class
@ -533,7 +533,7 @@ class Dec(DecObject):
print 'PackagePath =', M.PackageHeader.PackagePath print 'PackagePath =', M.PackageHeader.PackagePath
print 'ModulePath =', M.PackageHeader.ModulePath print 'ModulePath =', M.PackageHeader.ModulePath
print 'CombinePath =', M.PackageHeader.CombinePath print 'CombinePath =', M.PackageHeader.CombinePath
print 'BaseName =', M.PackageHeader.Name print 'BaseName =', M.PackageHeader.Name
print 'Guid =', M.PackageHeader.Guid print 'Guid =', M.PackageHeader.Guid
print 'Version =', M.PackageHeader.Version print 'Version =', M.PackageHeader.Version
@ -571,7 +571,7 @@ class Dec(DecObject):
if __name__ == '__main__': if __name__ == '__main__':
EdkLogger.Initialize() EdkLogger.Initialize()
EdkLogger.SetLevel(EdkLogger.QUIET) EdkLogger.SetLevel(EdkLogger.QUIET)
W = os.getenv('WORKSPACE') W = os.getenv('WORKSPACE')
F = os.path.join(W, 'MdeModulePkg/MdeModulePkg.dec') F = os.path.join(W, 'MdeModulePkg/MdeModulePkg.dec')

View File

@ -91,7 +91,7 @@ class DscObject(object):
class Dsc(DscObject): class Dsc(DscObject):
_NullClassIndex = 0 _NullClassIndex = 0
def __init__(self, Filename = None, IsToDatabase = False, IsToPlatform = False, WorkspaceDir = None, Database = None): def __init__(self, Filename=None, IsToDatabase=False, IsToPlatform=False, WorkspaceDir=None, Database=None):
self.Identification = Identification() self.Identification = Identification()
self.Platform = PlatformClass() self.Platform = PlatformClass()
self.UserExtensions = '' self.UserExtensions = ''
@ -460,7 +460,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd # @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report # @param ContainerFile: The file which describes the pcd, used for error report
# #
def GenPcds(self, Type = '', ContainerFile = ''): def GenPcds(self, Type='', ContainerFile=''):
Pcds = {} Pcds = {}
if Type == DataType.TAB_PCDS_PATCHABLE_IN_MODULE: if Type == DataType.TAB_PCDS_PATCHABLE_IN_MODULE:
Model = MODEL_PCD_PATCHABLE_IN_MODULE Model = MODEL_PCD_PATCHABLE_IN_MODULE
@ -512,7 +512,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd # @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report # @param ContainerFile: The file which describes the pcd, used for error report
# #
def GenFeatureFlagPcds(self, Type = '', ContainerFile = ''): def GenFeatureFlagPcds(self, Type='', ContainerFile=''):
Pcds = {} Pcds = {}
if Type == DataType.TAB_PCDS_FEATURE_FLAG: if Type == DataType.TAB_PCDS_FEATURE_FLAG:
Model = MODEL_PCD_FEATURE_FLAG Model = MODEL_PCD_FEATURE_FLAG
@ -562,7 +562,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd # @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report # @param ContainerFile: The file which describes the pcd, used for error report
# #
def GenDynamicDefaultPcds(self, Type = '', ContainerFile = ''): def GenDynamicDefaultPcds(self, Type='', ContainerFile=''):
Pcds = {} Pcds = {}
SkuInfoList = {} SkuInfoList = {}
if Type == DataType.TAB_PCDS_DYNAMIC_DEFAULT: if Type == DataType.TAB_PCDS_DYNAMIC_DEFAULT:
@ -594,20 +594,20 @@ class Dsc(DscObject):
if CleanString(NewItem) == '': if CleanString(NewItem) == '':
continue continue
(K1, K2, K3, K4, K5, K6) = GetDynamicDefaultPcd(NewItem, Type, Filename, -1) (K1, K2, K3, K4, K5, K6) = GetDynamicDefaultPcd(NewItem, Type, Filename, -1)
MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, IncludeFile[4]), Arch) MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, IncludeFile[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1) self.PcdToken[Record[3]] = (K2, K1)
for Record in RecordSet: for Record in RecordSet:
if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper(): if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper():
(K1, K2, K3, K4, K5, K6) = GetDynamicDefaultPcd(Record[0], Type, ContainerFile, Record[2]) (K1, K2, K3, K4, K5, K6) = GetDynamicDefaultPcd(Record[0], Type, ContainerFile, Record[2])
MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, Record[4]), Arch) MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, Record[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1) self.PcdToken[Record[3]] = (K2, K1)
for Key in Pcds: for Key in Pcds:
(Status, SkuInfoList) = self.GenSkuInfoList(Key[6], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', '', Key[2]) (Status, SkuInfoList) = self.GenSkuInfoList(Key[6], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', '', Key[2])
if Status == False: if Status == False:
ErrorMsg = "The SKUID '%s' used in section '%s' is not defined in section [SkuIds]" % (SkuInfoList, Type) ErrorMsg = "The SKUID '%s' used in section '%s' is not defined in section [SkuIds]" % (SkuInfoList, Type)
EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError=EdkLogger.IsRaiseError)
Pcd = PcdClass(Key[0], '', Key[1], Key[3], Key[4], Key[2], Key[5], [], SkuInfoList, []) Pcd = PcdClass(Key[0], '', Key[1], Key[3], Key[4], Key[2], Key[5], [], SkuInfoList, [])
Pcd.SupArchList = Pcds[Key] Pcd.SupArchList = Pcds[Key]
self.Platform.DynamicPcdBuildDefinitions.append(Pcd) self.Platform.DynamicPcdBuildDefinitions.append(Pcd)
@ -619,7 +619,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd # @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report # @param ContainerFile: The file which describes the pcd, used for error report
# #
def GenDynamicHiiPcds(self, Type = '', ContainerFile = ''): def GenDynamicHiiPcds(self, Type='', ContainerFile=''):
Pcds = {} Pcds = {}
SkuInfoList = {} SkuInfoList = {}
if Type == DataType.TAB_PCDS_DYNAMIC_HII: if Type == DataType.TAB_PCDS_DYNAMIC_HII:
@ -651,20 +651,20 @@ class Dsc(DscObject):
if CleanString(NewItem) == '': if CleanString(NewItem) == '':
continue continue
(K1, K2, K3, K4, K5, K6, K7, K8) = GetDynamicHiiPcd(NewItem, Type, Filename, -1) (K1, K2, K3, K4, K5, K6, K7, K8) = GetDynamicHiiPcd(NewItem, Type, Filename, -1)
MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, K7, K8, IncludeFile[4]), Arch) MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, K7, K8, IncludeFile[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1) self.PcdToken[Record[3]] = (K2, K1)
for Record in RecordSet: for Record in RecordSet:
if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper(): if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper():
(K1, K2, K3, K4, K5, K6, K7, K8) = GetDynamicHiiPcd(Record[0], Type, ContainerFile, Record[2]) (K1, K2, K3, K4, K5, K6, K7, K8) = GetDynamicHiiPcd(Record[0], Type, ContainerFile, Record[2])
MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, K7, K8, Record[4]), Arch) MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, K7, K8, Record[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1) self.PcdToken[Record[3]] = (K2, K1)
for Key in Pcds: for Key in Pcds:
(Status, SkuInfoList) = self.GenSkuInfoList(Key[8], self.Platform.SkuInfos.SkuInfoList, Key[2], Key[3], Key[4], Key[5], '', '') (Status, SkuInfoList) = self.GenSkuInfoList(Key[8], self.Platform.SkuInfos.SkuInfoList, Key[2], Key[3], Key[4], Key[5], '', '')
if Status == False: if Status == False:
ErrorMsg = "The SKUID '%s' used in section '%s' is not defined in section [SkuIds]" % (SkuInfoList, Type) ErrorMsg = "The SKUID '%s' used in section '%s' is not defined in section [SkuIds]" % (SkuInfoList, Type)
EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError=EdkLogger.IsRaiseError)
Pcd = PcdClass(Key[0], '', Key[1], '', Key[6], Key[5], Key[7], [], SkuInfoList, []) Pcd = PcdClass(Key[0], '', Key[1], '', Key[6], Key[5], Key[7], [], SkuInfoList, [])
Pcd.SupArchList = Pcds[Key] Pcd.SupArchList = Pcds[Key]
self.Platform.DynamicPcdBuildDefinitions.append(Pcd) self.Platform.DynamicPcdBuildDefinitions.append(Pcd)
@ -676,7 +676,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd # @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report # @param ContainerFile: The file which describes the pcd, used for error report
# #
def GenDynamicVpdPcds(self, Type = '', ContainerFile = ''): def GenDynamicVpdPcds(self, Type='', ContainerFile=''):
Pcds = {} Pcds = {}
SkuInfoList = {} SkuInfoList = {}
if Type == DataType.TAB_PCDS_DYNAMIC_VPD: if Type == DataType.TAB_PCDS_DYNAMIC_VPD:
@ -708,20 +708,20 @@ class Dsc(DscObject):
if CleanString(NewItem) == '': if CleanString(NewItem) == '':
continue continue
(K1, K2, K3, K4, K5) = GetDynamicVpdPcd(NewItem, Type, Filename, -1) (K1, K2, K3, K4, K5) = GetDynamicVpdPcd(NewItem, Type, Filename, -1)
MergeArches(Pcds, (K1, K2, K3, K4, K5, IncludeFile[4]), Arch) MergeArches(Pcds, (K1, K2, K3, K4, K5, IncludeFile[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1) self.PcdToken[Record[3]] = (K2, K1)
for Record in RecordSet: for Record in RecordSet:
if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper(): if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper():
(K1, K2, K3, K4, K5) = GetDynamicVpdPcd(Record[0], Type, ContainerFile, Record[2]) (K1, K2, K3, K4, K5) = GetDynamicVpdPcd(Record[0], Type, ContainerFile, Record[2])
MergeArches(Pcds, (K1, K2, K3, K4, K5, Record[4]), Arch) MergeArches(Pcds, (K1, K2, K3, K4, K5, Record[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1) self.PcdToken[Record[3]] = (K2, K1)
for Key in Pcds: for Key in Pcds:
(Status, SkuInfoList) = self.GenSkuInfoList(Key[5], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', Key[2], '') (Status, SkuInfoList) = self.GenSkuInfoList(Key[5], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', Key[2], '')
if Status == False: if Status == False:
ErrorMsg = "The SKUID '%s' used in section '%s' is not defined in section [SkuIds]" % (SkuInfoList, Type) ErrorMsg = "The SKUID '%s' used in section '%s' is not defined in section [SkuIds]" % (SkuInfoList, Type)
EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError=EdkLogger.IsRaiseError)
Pcd = PcdClass(Key[0], '', Key[1], '', Key[3], '', Key[4], [], SkuInfoList, []) Pcd = PcdClass(Key[0], '', Key[1], '', Key[3], '', Key[4], [], SkuInfoList, [])
Pcd.SupArchList = Pcds[Key] Pcd.SupArchList = Pcds[Key]
self.Platform.DynamicPcdBuildDefinitions.append(Pcd) self.Platform.DynamicPcdBuildDefinitions.append(Pcd)
@ -769,7 +769,7 @@ class Dsc(DscObject):
SubLibSet = QueryDscItem(self.TblDsc, MODEL_EFI_LIBRARY_CLASS, Record[3], self.FileID) SubLibSet = QueryDscItem(self.TblDsc, MODEL_EFI_LIBRARY_CLASS, Record[3], self.FileID)
for SubLib in SubLibSet: for SubLib in SubLibSet:
Lib.append(TAB_VALUE_SPLIT.join([SubLib[0],SubLib[4]])) Lib.append(TAB_VALUE_SPLIT.join([SubLib[0], SubLib[4]]))
SubBoSet = QueryDscItem(self.TblDsc, MODEL_META_DATA_BUILD_OPTION, Record[3], self.FileID) SubBoSet = QueryDscItem(self.TblDsc, MODEL_META_DATA_BUILD_OPTION, Record[3], self.FileID)
for SubBo in SubBoSet: for SubBo in SubBoSet:
@ -806,7 +806,7 @@ class Dsc(DscObject):
# #
# @retval PlatformModuleClass() A instance for PlatformModuleClass # @retval PlatformModuleClass() A instance for PlatformModuleClass
# #
def GenComponent(self, Item, ContainerFile, LineNo = -1): def GenComponent(self, Item, ContainerFile, LineNo= -1):
(InfFilename, ExecFilename) = GetExec(Item[0]) (InfFilename, ExecFilename) = GetExec(Item[0])
LibraryClasses = Item[1] LibraryClasses = Item[1]
BuildOptions = Item[2] BuildOptions = Item[2]
@ -894,7 +894,7 @@ class Dsc(DscObject):
# @retval (False, SkuName) Not found in section SkuId Dsc file # @retval (False, SkuName) Not found in section SkuId Dsc file
# @retval (True, SkuInfoList) Found in section SkuId of Dsc file # @retval (True, SkuInfoList) Found in section SkuId of Dsc file
# #
def GenSkuInfoList(self, SkuNameList, SkuInfo, VariableName = '', VariableGuid = '', VariableOffset = '', HiiDefaultValue = '', VpdOffset = '', DefaultValue = ''): def GenSkuInfoList(self, SkuNameList, SkuInfo, VariableName='', VariableGuid='', VariableOffset='', HiiDefaultValue='', VpdOffset='', DefaultValue=''):
SkuNameList = GetSplitValueList(SkuNameList) SkuNameList = GetSplitValueList(SkuNameList)
if SkuNameList == None or SkuNameList == [] or SkuNameList == ['']: if SkuNameList == None or SkuNameList == [] or SkuNameList == ['']:
SkuNameList = ['DEFAULT'] SkuNameList = ['DEFAULT']
@ -964,7 +964,7 @@ class Dsc(DscObject):
(Value1, Value2, Value3, Model, StartColumn, EndColumn, Enabled) = ('', '', '', -1, -1, -1, 0) (Value1, Value2, Value3, Model, StartColumn, EndColumn, Enabled) = ('', '', '', -1, -1, -1, 0)
if IfDefList == []: if IfDefList == []:
ErrorMsg = 'Not suited conditional statement in file %s' % Filename ErrorMsg = 'Not suited conditional statement in file %s' % Filename
EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, Filename, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, Filename, RaiseError=EdkLogger.IsRaiseError)
else: else:
# #
# Get New Dsc item ID # Get New Dsc item ID
@ -1046,10 +1046,10 @@ class Dsc(DscObject):
# Remove comment block # Remove comment block
# #
if Line.find(TAB_COMMENT_EDK_START) > -1: if Line.find(TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
IsFindBlockComment = True IsFindBlockComment = True
if Line.find(TAB_COMMENT_EDK_END) > -1: if Line.find(TAB_COMMENT_EDK_END) > -1:
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:
@ -1087,7 +1087,7 @@ class Dsc(DscObject):
CurrentSection = ItemList[0] CurrentSection = ItemList[0]
else: else:
if CurrentSection != ItemList[0]: if CurrentSection != ItemList[0]:
EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
if CurrentSection.upper() not in self.KeyList: if CurrentSection.upper() not in self.KeyList:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
CurrentSection = TAB_UNKNOWN CurrentSection = TAB_UNKNOWN
@ -1098,7 +1098,7 @@ class Dsc(DscObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else: else:
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL: if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper()) ArchList.append(ItemList[1].upper())
ThirdList.append(ItemList[2]) ThirdList.append(ItemList[2])
@ -1109,7 +1109,7 @@ class Dsc(DscObject):
# #
if CurrentSection == TAB_UNKNOWN: if CurrentSection == TAB_UNKNOWN:
ErrorMsg = "%s is not in any defined section" % Line ErrorMsg = "%s is not in any defined section" % Line
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
# #
# Add a section item # Add a section item
@ -1161,7 +1161,7 @@ class Dsc(DscObject):
MODEL_META_DATA_DEFINE) MODEL_META_DATA_DEFINE)
RecordSet = self.TblDsc.Exec(SqlCommand) RecordSet = self.TblDsc.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" %(self.TblDsc.Table, Record[0], Record[1]) SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" % (self.TblDsc.Table, Record[0], Record[1])
self.TblDsc.Exec(SqlCommand) self.TblDsc.Exec(SqlCommand)
# #
@ -1185,8 +1185,8 @@ class Dsc(DscObject):
MODEL_META_DATA_DEFINE) MODEL_META_DATA_DEFINE)
RecordSet = self.TblDsc.Exec(SqlCommand) RecordSet = self.TblDsc.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" %(self.TblDsc.Table, Record[0], Record[1]) SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" % (self.TblDsc.Table, Record[0], Record[1])
EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
self.Cur.execute(SqlCommand) self.Cur.execute(SqlCommand)
# #
@ -1210,13 +1210,13 @@ class Dsc(DscObject):
for Record in RecordSet: for Record in RecordSet:
if Record[0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_IF: if Record[0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_IF:
if not self.Compare(Record[6], Record[2], Record[3]): if not self.Compare(Record[6], Record[2], Record[3]):
SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" %(self.TblDsc.Table, Record[4], Record[5]) SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" % (self.TblDsc.Table, Record[4], Record[5])
self.TblDsc.Exec(SqlCommand) self.TblDsc.Exec(SqlCommand)
else: else:
DisabledList.append(Record[1]) DisabledList.append(Record[1])
continue continue
if Record[0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE and Record[1] in DisabledList: if Record[0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE and Record[1] in DisabledList:
SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" %(self.TblDsc.Table, Record[4], Record[5]) SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" % (self.TblDsc.Table, Record[4], Record[5])
self.TblDsc.Exec(SqlCommand) self.TblDsc.Exec(SqlCommand)
## Compare ## Compare
@ -1227,7 +1227,7 @@ class Dsc(DscObject):
# @param Value2: # @param Value2:
# #
def Compare(self, Value1, CompareType, Value2): def Compare(self, Value1, CompareType, Value2):
Command = """Value1 %s Value2""" %CompareType Command = """Value1 %s Value2""" % CompareType
return eval(Command) return eval(Command)
## First time to insert records to database ## First time to insert records to database
@ -1259,7 +1259,7 @@ class Dsc(DscObject):
LineValue, StartLine, EndLine = SectionItem[0], SectionItem[1], SectionItem[1] LineValue, StartLine, EndLine = SectionItem[0], SectionItem[1], SectionItem[1]
EdkLogger.debug(4, "Parsing %s ..." %LineValue) EdkLogger.debug(4, "Parsing %s ..." % LineValue)
# #
# Parse '!ifdef' # Parse '!ifdef'
# #
@ -1337,10 +1337,10 @@ class Dsc(DscObject):
Components = [] Components = []
GetComponent(SectionItemList, Components) GetComponent(SectionItemList, Components)
for Component in Components: for Component in Components:
EdkLogger.debug(4, "Parsing component %s ..." %Component) EdkLogger.debug(4, "Parsing component %s ..." % Component)
DscItmeID = self.TblDsc.Insert(MODEL_META_DATA_COMPONENT, Component[0], '', '', Arch, -1, FileID, StartLine, -1, StartLine, -1, 0) DscItmeID = self.TblDsc.Insert(MODEL_META_DATA_COMPONENT, Component[0], '', '', Arch, -1, FileID, StartLine, -1, StartLine, -1, 0)
for Item in Component[1]: for Item in Component[1]:
List = GetSplitValueList(Item, MaxSplit = 2) List = GetSplitValueList(Item, MaxSplit=2)
LibName, LibIns = '', '' LibName, LibIns = '', ''
if len(List) == 2: if len(List) == 2:
LibName = List[0] LibName = List[0]

View File

@ -163,7 +163,7 @@ class InfObject(object):
# @var KeyList: To store value for KeyList, a list for all Keys used in Inf # @var KeyList: To store value for KeyList, a list for all Keys used in Inf
# #
class Inf(InfObject): class Inf(InfObject):
def __init__(self, Filename = None, IsToDatabase = False, IsToModule = False, WorkspaceDir = None, Database = None, SupArchList = DataType.ARCH_LIST): def __init__(self, Filename=None, IsToDatabase=False, IsToModule=False, WorkspaceDir=None, Database=None, SupArchList=DataType.ARCH_LIST):
self.Identification = Identification() self.Identification = Identification()
self.Module = ModuleClass() self.Module = ModuleClass()
self.UserExtensions = '' self.UserExtensions = ''
@ -353,10 +353,10 @@ class Inf(InfObject):
# Remove comment block # Remove comment block
# #
if Line.find(TAB_COMMENT_EDK_START) > -1: if Line.find(TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
IsFindBlockComment = True IsFindBlockComment = True
if Line.find(TAB_COMMENT_EDK_END) > -1: if Line.find(TAB_COMMENT_EDK_END) > -1:
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:
@ -397,7 +397,7 @@ class Inf(InfObject):
CurrentSection = ItemList[0] CurrentSection = ItemList[0]
else: else:
if CurrentSection != ItemList[0]: if CurrentSection != ItemList[0]:
EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
if CurrentSection.upper() not in self.KeyList: if CurrentSection.upper() not in self.KeyList:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
CurrentSection = TAB_UNKNOWN CurrentSection = TAB_UNKNOWN
@ -408,7 +408,7 @@ class Inf(InfObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else: else:
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL: if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper()) ArchList.append(ItemList[1].upper())
ThirdList.append(ItemList[2]) ThirdList.append(ItemList[2])
@ -419,7 +419,7 @@ class Inf(InfObject):
# #
if CurrentSection == TAB_UNKNOWN: if CurrentSection == TAB_UNKNOWN:
ErrorMsg = "%s is not in any defined section" % Line ErrorMsg = "%s is not in any defined section" % Line
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
# #
# Add a section item # Add a section item
@ -497,13 +497,13 @@ class Inf(InfObject):
print Item.Name, Item.Value, Item.SupArchList print Item.Name, Item.Value, Item.SupArchList
print '\nPcds =', M.PcdCodes print '\nPcds =', M.PcdCodes
for Item in M.PcdCodes: for Item in M.PcdCodes:
print '\tCName=',Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList print '\tCName=', Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList
print '\nSources =', M.Sources print '\nSources =', M.Sources
for Source in M.Sources: for Source in M.Sources:
print Source.SourceFile, 'Fam=', Source.ToolChainFamily, 'Pcd=', Source.FeatureFlag, 'Tag=', Source.TagName, 'ToolCode=', Source.ToolCode, Source.SupArchList print Source.SourceFile, 'Fam=', Source.ToolChainFamily, 'Pcd=', Source.FeatureFlag, 'Tag=', Source.TagName, 'ToolCode=', Source.ToolCode, Source.SupArchList
print '\nUserExtensions =', M.UserExtensions print '\nUserExtensions =', M.UserExtensions
for UserExtension in M.UserExtensions: for UserExtension in M.UserExtensions:
print UserExtension.UserID, UserExtension.Identifier,UserExtension.Content print UserExtension.UserID, UserExtension.Identifier, UserExtension.Content
print '\nGuids =', M.Guids print '\nGuids =', M.Guids
for Item in M.Guids: for Item in M.Guids:
print Item.CName, Item.SupArchList, Item.FeatureFlag print Item.CName, Item.SupArchList, Item.FeatureFlag
@ -629,7 +629,7 @@ class Inf(InfObject):
if ModuleHeader.ComponentType in gComponentType2ModuleType: if ModuleHeader.ComponentType in gComponentType2ModuleType:
ModuleHeader.ModuleType = gComponentType2ModuleType[ModuleHeader.ComponentType] ModuleHeader.ModuleType = gComponentType2ModuleType[ModuleHeader.ComponentType]
elif ModuleHeader.ComponentType != '': elif ModuleHeader.ComponentType != '':
EdkLogger.error("Parser", PARSER_ERROR, "Unsupported Edk component type [%s]" % ModuleHeader.ComponentType, ExtraData=File, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Unsupported Edk component type [%s]" % ModuleHeader.ComponentType, ExtraData=File, RaiseError=EdkLogger.IsRaiseError)
self.Module.Header[Arch] = ModuleHeader self.Module.Header[Arch] = ModuleHeader

View File

@ -73,7 +73,7 @@ class InfHeader(ModuleHeaderClass):
TAB_INF_DEFINES_MODULE_TYPE : "ModuleType", TAB_INF_DEFINES_MODULE_TYPE : "ModuleType",
TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION : "UefiSpecificationVersion", TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION : "UefiSpecificationVersion",
TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION : "UefiSpecificationVersion", TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION : "UefiSpecificationVersion",
TAB_INF_DEFINES_EDK_RELEASE_VERSION : "EdkReleaseVersion", TAB_INF_DEFINES_EDK_RELEASE_VERSION : "EdkReleaseVersion",
# Optional Fields # Optional Fields
TAB_INF_DEFINES_INF_VERSION : "InfVersion", TAB_INF_DEFINES_INF_VERSION : "InfVersion",
@ -139,34 +139,34 @@ class InfObject(object):
# @var KeyList: To store value for KeyList, a list for all Keys used in Inf # @var KeyList: To store value for KeyList, a list for all Keys used in Inf
# #
class Inf(InfObject): class Inf(InfObject):
def __init__(self, Filename = None, IsToModule = False, WorkspaceDir = None, PackageDir = None, SupArchList = DataType.ARCH_LIST): def __init__(self, Filename=None, IsToModule=False, WorkspaceDir=None, PackageDir=None, SupArchList=DataType.ARCH_LIST):
self.Identification = IdentificationClass() self.Identification = IdentificationClass()
self.Module = ModuleClass() self.Module = ModuleClass()
self.WorkspaceDir = WorkspaceDir self.WorkspaceDir = WorkspaceDir
self.PackageDir = PackageDir self.PackageDir = PackageDir
self.SupArchList = SupArchList self.SupArchList = SupArchList
self.KeyList = [ self.KeyList = [
TAB_SOURCES, TAB_BUILD_OPTIONS, TAB_BINARIES, TAB_INCLUDES, TAB_GUIDS, TAB_SOURCES, TAB_BUILD_OPTIONS, TAB_BINARIES, TAB_INCLUDES, TAB_GUIDS,
TAB_PROTOCOLS, TAB_PPIS, TAB_LIBRARY_CLASSES, TAB_PACKAGES, TAB_INF_FIXED_PCD, TAB_PROTOCOLS, TAB_PPIS, TAB_LIBRARY_CLASSES, TAB_PACKAGES, TAB_INF_FIXED_PCD,
TAB_INF_PATCH_PCD, TAB_INF_FEATURE_PCD, TAB_INF_PCD, TAB_INF_PCD_EX, TAB_INF_PATCH_PCD, TAB_INF_FEATURE_PCD, TAB_INF_PCD, TAB_INF_PCD_EX,
TAB_DEPEX, TAB_INF_DEFINES TAB_DEPEX, TAB_INF_DEFINES
] ]
# Upper all KEYs to ignore case sensitive when parsing # Upper all KEYs to ignore case sensitive when parsing
self.KeyList = map(lambda c: c.upper(), self.KeyList) self.KeyList = map(lambda c: c.upper(), self.KeyList)
# Init RecordSet # Init RecordSet
self.RecordSet = {} self.RecordSet = {}
for Key in self.KeyList: for Key in self.KeyList:
self.RecordSet[Section[Key]] = [] self.RecordSet[Section[Key]] = []
# Init Comment # Init Comment
self.SectionHeaderCommentDict = {} self.SectionHeaderCommentDict = {}
# Load Inf file if filename is not None # Load Inf file if filename is not None
if Filename != None: if Filename != None:
self.LoadInfFile(Filename) self.LoadInfFile(Filename)
# Transfer to Module Object if IsToModule is True # Transfer to Module Object if IsToModule is True
if IsToModule: if IsToModule:
self.InfToModule() self.InfToModule()
@ -209,16 +209,16 @@ class Inf(InfObject):
InfList['Defines'] = TmpList InfList['Defines'] = TmpList
if ModuleHeader.Description != '': if ModuleHeader.Description != '':
SectionHeaderCommentDict['Defines'] = ModuleHeader.Description SectionHeaderCommentDict['Defines'] = ModuleHeader.Description
if Module.UserExtensions != None: if Module.UserExtensions != None:
InfList['BuildOptions'] = Module.UserExtensions.BuildOptions InfList['BuildOptions'] = Module.UserExtensions.BuildOptions
for Item in Module.Includes: for Item in Module.Includes:
Key = 'Includes.' + GetStringOfList(Item.SupArchList) Key = 'Includes.' + GetStringOfList(Item.SupArchList)
Value = GetHelpTextList(Item.HelpTextList) Value = GetHelpTextList(Item.HelpTextList)
Value.append(Item.FilePath) Value.append(Item.FilePath)
GenMetaDatSectionItem(Key, Value, InfList) GenMetaDatSectionItem(Key, Value, InfList)
for Item in Module.LibraryClasses: for Item in Module.LibraryClasses:
Key = 'LibraryClasses.' + GetStringOfList(Item.SupArchList) Key = 'LibraryClasses.' + GetStringOfList(Item.SupArchList)
Value = GetHelpTextList(Item.HelpTextList) Value = GetHelpTextList(Item.HelpTextList)
@ -227,15 +227,15 @@ class Inf(InfObject):
NewValue = NewValue + '|' + Item.RecommendedInstance NewValue = NewValue + '|' + Item.RecommendedInstance
if Item.FeatureFlag: if Item.FeatureFlag:
NewValue = NewValue + '|' + Item.FeatureFlag NewValue = NewValue + '|' + Item.FeatureFlag
Value.append(NewValue) Value.append(NewValue)
GenMetaDatSectionItem(Key, Value, InfList) GenMetaDatSectionItem(Key, Value, InfList)
for Item in Module.PackageDependencies: for Item in Module.PackageDependencies:
Key = 'Packages.' + GetStringOfList(Item.SupArchList) Key = 'Packages.' + GetStringOfList(Item.SupArchList)
Value = GetHelpTextList(Item.HelpTextList) Value = GetHelpTextList(Item.HelpTextList)
Value.append(Item.FilePath) Value.append(Item.FilePath)
GenMetaDatSectionItem(Key, Value, InfList) GenMetaDatSectionItem(Key, Value, InfList)
for Item in Module.PcdCodes: for Item in Module.PcdCodes:
Key = 'Pcds' + Item.ItemType + '.' + GetStringOfList(Item.SupArchList) Key = 'Pcds' + Item.ItemType + '.' + GetStringOfList(Item.SupArchList)
Value = GetHelpTextList(Item.HelpTextList) Value = GetHelpTextList(Item.HelpTextList)
@ -244,7 +244,7 @@ class Inf(InfObject):
NewValue = NewValue + '|' + Item.DefaultValue NewValue = NewValue + '|' + Item.DefaultValue
Value.append(NewValue) Value.append(NewValue)
GenMetaDatSectionItem(Key, Value, InfList) GenMetaDatSectionItem(Key, Value, InfList)
for Item in Module.Sources: for Item in Module.Sources:
Key = 'Sources.' + GetStringOfList(Item.SupArchList) Key = 'Sources.' + GetStringOfList(Item.SupArchList)
Value = GetHelpTextList(Item.HelpTextList) Value = GetHelpTextList(Item.HelpTextList)
@ -261,40 +261,40 @@ class Inf(InfObject):
if Item.HelpText != '': if Item.HelpText != '':
SectionHeaderCommentDict[Key] = Item.HelpText SectionHeaderCommentDict[Key] = Item.HelpText
GenMetaDatSectionItem(Key, Value, InfList) GenMetaDatSectionItem(Key, Value, InfList)
for Item in Module.Guids: for Item in Module.Guids:
Key = 'Guids.' + GetStringOfList(Item.SupArchList) Key = 'Guids.' + GetStringOfList(Item.SupArchList)
Value = GetHelpTextList(Item.HelpTextList) Value = GetHelpTextList(Item.HelpTextList)
Value.append(Item.CName) Value.append(Item.CName)
GenMetaDatSectionItem(Key, Value, InfList) GenMetaDatSectionItem(Key, Value, InfList)
for Item in Module.Protocols: for Item in Module.Protocols:
Key = 'Protocols.' + GetStringOfList(Item.SupArchList) Key = 'Protocols.' + GetStringOfList(Item.SupArchList)
Value = GetHelpTextList(Item.HelpTextList) Value = GetHelpTextList(Item.HelpTextList)
Value.append(Item.CName) Value.append(Item.CName)
GenMetaDatSectionItem(Key, Value, InfList) GenMetaDatSectionItem(Key, Value, InfList)
for Item in Module.Ppis: for Item in Module.Ppis:
Key = 'Ppis.' + GetStringOfList(Item.SupArchList) Key = 'Ppis.' + GetStringOfList(Item.SupArchList)
Value = GetHelpTextList(Item.HelpTextList) Value = GetHelpTextList(Item.HelpTextList)
Value.append(Item.CName) Value.append(Item.CName)
GenMetaDatSectionItem(Key, Value, InfList) GenMetaDatSectionItem(Key, Value, InfList)
if Module.PeiDepex: if Module.PeiDepex:
Key = 'Depex' Key = 'Depex'
Value = Module.PeiDepex.Depex Value = Module.PeiDepex.Depex
GenMetaDatSectionItem(Key, Value, InfList) GenMetaDatSectionItem(Key, Value, InfList)
if Module.DxeDepex: if Module.DxeDepex:
Key = 'Depex' Key = 'Depex'
Value = Module.DxeDepex.Depex Value = Module.DxeDepex.Depex
GenMetaDatSectionItem(Key, Value, InfList) GenMetaDatSectionItem(Key, Value, InfList)
if Module.SmmDepex: if Module.SmmDepex:
Key = 'Depex' Key = 'Depex'
Value = Module.SmmDepex.Depex Value = Module.SmmDepex.Depex
GenMetaDatSectionItem(Key, Value, InfList) GenMetaDatSectionItem(Key, Value, InfList)
for Item in Module.Binaries: for Item in Module.Binaries:
Key = 'Binaries.' + GetStringOfList(Item.SupArchList) Key = 'Binaries.' + GetStringOfList(Item.SupArchList)
Value = GetHelpTextList(Item.HelpTextList) Value = GetHelpTextList(Item.HelpTextList)
@ -318,10 +318,10 @@ class Inf(InfObject):
else: else:
Inf = Inf + ' ' + Value + '\n' Inf = Inf + ' ' + Value + '\n'
Inf = Inf + '\n' Inf = Inf + '\n'
return Inf return Inf
## Transfer to Module Object ## Transfer to Module Object
# #
# Transfer all contents of an Inf file to a standard Module Object # Transfer all contents of an Inf file to a standard Module Object
@ -329,28 +329,28 @@ class Inf(InfObject):
def InfToModule(self): def InfToModule(self):
# Init global information for the file # Init global information for the file
ContainerFile = self.Identification.FullPath ContainerFile = self.Identification.FullPath
# Generate Module Header # Generate Module Header
self.GenModuleHeader(ContainerFile) self.GenModuleHeader(ContainerFile)
# Generate BuildOptions # Generate BuildOptions
self.GenBuildOptions(ContainerFile) self.GenBuildOptions(ContainerFile)
# Generate Includes # Generate Includes
self.GenIncludes(ContainerFile) self.GenIncludes(ContainerFile)
# Generate LibraryClasses # Generate LibraryClasses
self.GenLibraryClasses(ContainerFile) self.GenLibraryClasses(ContainerFile)
# Generate Packages # Generate Packages
self.GenPackages(ContainerFile) self.GenPackages(ContainerFile)
# Generate Pcds # Generate Pcds
self.GenPcds(ContainerFile) self.GenPcds(ContainerFile)
# Generate Sources # Generate Sources
self.GenSources(ContainerFile) self.GenSources(ContainerFile)
# Generate Guids # Generate Guids
self.GenGuidProtocolPpis(DataType.TAB_GUIDS, ContainerFile) self.GenGuidProtocolPpis(DataType.TAB_GUIDS, ContainerFile)
@ -359,13 +359,13 @@ class Inf(InfObject):
# Generate Ppis # Generate Ppis
self.GenGuidProtocolPpis(DataType.TAB_PPIS, ContainerFile) self.GenGuidProtocolPpis(DataType.TAB_PPIS, ContainerFile)
# Generate Depexes # Generate Depexes
self.GenDepexes(ContainerFile) self.GenDepexes(ContainerFile)
# Generate Binaries # Generate Binaries
self.GenBinaries(ContainerFile) self.GenBinaries(ContainerFile)
# Init MiscFiles # Init MiscFiles
self.GenMiscFiles(ContainerFile) self.GenMiscFiles(ContainerFile)
@ -386,24 +386,24 @@ class Inf(InfObject):
# #
# @param Filename: Input value for filename of Inf file # @param Filename: Input value for filename of Inf file
# #
def LoadInfFile(self, Filename): def LoadInfFile(self, Filename):
# Insert a record for file # Insert a record for file
Filename = NormPath(Filename) Filename = NormPath(Filename)
self.Identification.FullPath = Filename self.Identification.FullPath = Filename
(self.Identification.RelaPath, self.Identification.FileName) = os.path.split(Filename) (self.Identification.RelaPath, self.Identification.FileName) = os.path.split(Filename)
if self.Identification.FullPath.find(self.WorkspaceDir) > -1: if self.Identification.FullPath.find(self.WorkspaceDir) > -1:
self.Identification.ModulePath = os.path.dirname(self.Identification.FullPath[len(self.WorkspaceDir) + 1:]) self.Identification.ModulePath = os.path.dirname(self.Identification.FullPath[len(self.WorkspaceDir) + 1:])
if self.PackageDir: if self.PackageDir:
self.Identification.PackagePath = self.PackageDir self.Identification.PackagePath = self.PackageDir
if self.Identification.ModulePath.find(self.PackageDir) == 0: if self.Identification.ModulePath.find(self.PackageDir) == 0:
self.Identification.ModulePath = self.Identification.ModulePath[len(self.PackageDir) + 1:] self.Identification.ModulePath = self.Identification.ModulePath[len(self.PackageDir) + 1:]
# Init common datas # Init common datas
IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \ IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \
[], [], TAB_UNKNOWN, [], [], [] [], [], TAB_UNKNOWN, [], [], []
LineNo = 0 LineNo = 0
# Parse file content # Parse file content
IsFindBlockComment = False IsFindBlockComment = False
ReservedLine = '' ReservedLine = ''
@ -412,7 +412,7 @@ class Inf(InfObject):
LineNo = LineNo + 1 LineNo = LineNo + 1
# Remove comment block # Remove comment block
if Line.find(TAB_COMMENT_EDK_START) > -1: if Line.find(TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
if ReservedLine.strip().startswith(TAB_COMMENT_SPLIT): if ReservedLine.strip().startswith(TAB_COMMENT_SPLIT):
Comment = Comment + Line.strip() + '\n' Comment = Comment + Line.strip() + '\n'
ReservedLine = '' ReservedLine = ''
@ -423,20 +423,20 @@ class Inf(InfObject):
continue continue
if Line.find(TAB_COMMENT_EDK_END) > -1: if Line.find(TAB_COMMENT_EDK_END) > -1:
Comment = Comment + Line[:Line.find(TAB_COMMENT_EDK_END) + len(TAB_COMMENT_EDK_END)] + '\n' Comment = Comment + Line[:Line.find(TAB_COMMENT_EDK_END) + len(TAB_COMMENT_EDK_END)] + '\n'
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:
Comment = Comment + Line.strip() + '\n' Comment = Comment + Line.strip() + '\n'
continue continue
# Remove comments at tail and remove spaces again # Remove comments at tail and remove spaces again
if Line.strip().startswith(TAB_COMMENT_SPLIT) or Line.strip().startswith('--/'): if Line.strip().startswith(TAB_COMMENT_SPLIT) or Line.strip().startswith('--/'):
Comment = Comment + Line.strip() + '\n' Comment = Comment + Line.strip() + '\n'
Line = CleanString(Line) Line = CleanString(Line)
if Line == '': if Line == '':
continue continue
## Find a new section tab ## Find a new section tab
# First insert previous section items # First insert previous section items
# And then parse the content of the new section # And then parse the content of the new section
@ -446,12 +446,12 @@ class Inf(InfObject):
Model = Section[CurrentSection.upper()] Model = Section[CurrentSection.upper()]
# Insert items data of previous section # Insert items data of previous section
InsertSectionItems(Model, CurrentSection, SectionItemList, ArchList, ThirdList, self.RecordSet) InsertSectionItems(Model, CurrentSection, SectionItemList, ArchList, ThirdList, self.RecordSet)
# Parse the new section # Parse the new section
SectionItemList = [] SectionItemList = []
ArchList = [] ArchList = []
ThirdList = [] ThirdList = []
CurrentSection = '' CurrentSection = ''
LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT) LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT)
for Item in LineList: for Item in LineList:
@ -460,7 +460,7 @@ class Inf(InfObject):
CurrentSection = ItemList[0] CurrentSection = ItemList[0]
else: else:
if CurrentSection != ItemList[0]: if CurrentSection != ItemList[0]:
EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
if CurrentSection.upper() not in self.KeyList: if CurrentSection.upper() not in self.KeyList:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
ItemList.append('') ItemList.append('')
@ -469,7 +469,7 @@ class Inf(InfObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else: else:
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL: if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper()) ArchList.append(ItemList[1].upper())
ThirdList.append(ItemList[2]) ThirdList.append(ItemList[2])
@ -479,18 +479,18 @@ class Inf(InfObject):
self.SectionHeaderCommentDict[Section[CurrentSection.upper()]] = Comment self.SectionHeaderCommentDict[Section[CurrentSection.upper()]] = Comment
Comment = '' Comment = ''
continue continue
# Not in any defined section # Not in any defined section
if CurrentSection == TAB_UNKNOWN: if CurrentSection == TAB_UNKNOWN:
ErrorMsg = "%s is not in any defined section" % Line ErrorMsg = "%s is not in any defined section" % Line
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
# Add a section item # Add a section item
SectionItemList.append([Line, LineNo, Comment]) SectionItemList.append([Line, LineNo, Comment])
Comment = '' Comment = ''
# End of parse # End of parse
#End of For #End of For
# Insert items data of last section # Insert items data of last section
Model = Section[CurrentSection.upper()] Model = Section[CurrentSection.upper()]
InsertSectionItems(Model, CurrentSection, SectionItemList, ArchList, ThirdList, self.RecordSet) InsertSectionItems(Model, CurrentSection, SectionItemList, ArchList, ThirdList, self.RecordSet)
@ -510,7 +510,7 @@ class Inf(InfObject):
print 'PackagePath =', M.ModuleHeader.PackagePath print 'PackagePath =', M.ModuleHeader.PackagePath
print 'ModulePath =', M.ModuleHeader.ModulePath print 'ModulePath =', M.ModuleHeader.ModulePath
print 'CombinePath =', M.ModuleHeader.CombinePath print 'CombinePath =', M.ModuleHeader.CombinePath
print 'BaseName =', M.ModuleHeader.Name print 'BaseName =', M.ModuleHeader.Name
print 'Guid =', M.ModuleHeader.Guid print 'Guid =', M.ModuleHeader.Guid
print 'Version =', M.ModuleHeader.Version print 'Version =', M.ModuleHeader.Version
@ -526,7 +526,7 @@ class Inf(InfObject):
print Item.FilePath, Item.SupArchList, Item.FeatureFlag print Item.FilePath, Item.SupArchList, Item.FeatureFlag
print '\nPcds =' print '\nPcds ='
for Item in M.PcdCodes: for Item in M.PcdCodes:
print '\tCName=',Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList print '\tCName=', Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList
print '\nSources =' print '\nSources ='
for Source in M.Sources: for Source in M.Sources:
print Source.SourceFile, 'Fam=', Source.ToolChainFamily, 'Pcd=', Source.FeatureFlag, 'Tag=', Source.TagName, 'ToolCode=', Source.ToolCode, Source.SupArchList print Source.SourceFile, 'Fam=', Source.ToolChainFamily, 'Pcd=', Source.FeatureFlag, 'Tag=', Source.TagName, 'ToolCode=', Source.ToolCode, Source.SupArchList
@ -562,7 +562,7 @@ class Inf(InfObject):
EdkLogger.debug(2, "Generate ModuleHeader ...") EdkLogger.debug(2, "Generate ModuleHeader ...")
# Update all defines item in database # Update all defines item in database
RecordSet = self.RecordSet[MODEL_META_DATA_HEADER] RecordSet = self.RecordSet[MODEL_META_DATA_HEADER]
ModuleHeader = ModuleHeaderClass() ModuleHeader = ModuleHeaderClass()
ModuleExtern = ModuleExternClass() ModuleExtern = ModuleExternClass()
OtherDefines = [] OtherDefines = []
@ -614,7 +614,7 @@ class Inf(InfObject):
UE = UserExtensionsClass() UE = UserExtensionsClass()
UE.Defines = OtherDefines UE.Defines = OtherDefines
self.Module.UserExtensions = UE self.Module.UserExtensions = UE
## GenBuildOptions ## GenBuildOptions
# #
# Gen BuildOptions of Inf # Gen BuildOptions of Inf
@ -633,7 +633,7 @@ class Inf(InfObject):
for Record in RecordSet: for Record in RecordSet:
UE.BuildOptions.append(Record[0]) UE.BuildOptions.append(Record[0])
self.Module.UserExtensions = UE self.Module.UserExtensions = UE
## GenIncludes ## GenIncludes
# #
# Gen Includes of Inf # Gen Includes of Inf
@ -653,7 +653,7 @@ class Inf(InfObject):
Include.HelpTextList.append(GenerateHelpText(Record[5], '')) Include.HelpTextList.append(GenerateHelpText(Record[5], ''))
self.Module.Includes.append(Include) self.Module.Includes.append(Include)
#self.Module.FileList.extend(GetFiles(os.path.normpath(os.path.join(self.Identification.FileRelativePath, Include.FilePath)), ['CVS', '.svn'])) #self.Module.FileList.extend(GetFiles(os.path.normpath(os.path.join(self.Identification.FileRelativePath, Include.FilePath)), ['CVS', '.svn']))
## GenLibraryClasses ## GenLibraryClasses
# #
# Get LibraryClass of Inf # Get LibraryClass of Inf
@ -667,7 +667,7 @@ class Inf(InfObject):
# Get all LibraryClasses # Get all LibraryClasses
RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_CLASS] RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_CLASS]
for Record in RecordSet: for Record in RecordSet:
(LibClassName, LibClassIns, Pcd, SupModelList) = GetLibraryClassOfInf([Record[0], Record[4]], ContainerFile, self.WorkspaceDir, Record[2]) (LibClassName, LibClassIns, Pcd, SupModelList) = GetLibraryClassOfInf([Record[0], Record[4]], ContainerFile, self.WorkspaceDir, Record[2])
LibraryClass = CommonClass.LibraryClassClass() LibraryClass = CommonClass.LibraryClassClass()
LibraryClass.LibraryClass = LibClassName LibraryClass.LibraryClass = LibClassName
LibraryClass.RecommendedInstance = LibClassIns LibraryClass.RecommendedInstance = LibClassIns
@ -698,7 +698,7 @@ class Inf(InfObject):
if GenerateHelpText(Record[5], ''): if GenerateHelpText(Record[5], ''):
Package.HelpTextList.append(GenerateHelpText(Record[5], '')) Package.HelpTextList.append(GenerateHelpText(Record[5], ''))
self.Module.PackageDependencies.append(Package) self.Module.PackageDependencies.append(Package)
def AddPcd(self, CName, TokenSpaceGuidCName, DefaultValue, ItemType, Arch, HelpTextList): def AddPcd(self, CName, TokenSpaceGuidCName, DefaultValue, ItemType, Arch, HelpTextList):
Pcd = PcdClass() Pcd = PcdClass()
Pcd.CName = CName Pcd.CName = CName
@ -709,7 +709,7 @@ class Inf(InfObject):
if GenerateHelpText(HelpTextList, ''): if GenerateHelpText(HelpTextList, ''):
Pcd.HelpTextList.append(GenerateHelpText(HelpTextList, '')) Pcd.HelpTextList.append(GenerateHelpText(HelpTextList, ''))
self.Module.PcdCodes.append(Pcd) self.Module.PcdCodes.append(Pcd)
## GenPcds ## GenPcds
# #
# Gen Pcds of Inf # Gen Pcds of Inf
@ -721,14 +721,14 @@ class Inf(InfObject):
EdkLogger.debug(2, "Generate %s ..." % TAB_PCDS) EdkLogger.debug(2, "Generate %s ..." % TAB_PCDS)
Pcds = {} Pcds = {}
PcdToken = {} PcdToken = {}
# Get all Pcds # Get all Pcds
RecordSet1 = self.RecordSet[MODEL_PCD_FIXED_AT_BUILD] RecordSet1 = self.RecordSet[MODEL_PCD_FIXED_AT_BUILD]
RecordSet2 = self.RecordSet[MODEL_PCD_PATCHABLE_IN_MODULE] RecordSet2 = self.RecordSet[MODEL_PCD_PATCHABLE_IN_MODULE]
RecordSet3 = self.RecordSet[MODEL_PCD_FEATURE_FLAG] RecordSet3 = self.RecordSet[MODEL_PCD_FEATURE_FLAG]
RecordSet4 = self.RecordSet[MODEL_PCD_DYNAMIC_EX] RecordSet4 = self.RecordSet[MODEL_PCD_DYNAMIC_EX]
RecordSet5 = self.RecordSet[MODEL_PCD_DYNAMIC] RecordSet5 = self.RecordSet[MODEL_PCD_DYNAMIC]
# Go through each arch # Go through each arch
for Record in RecordSet1: for Record in RecordSet1:
(TokenSpaceGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], TAB_PCDS_FIXED_AT_BUILD, ContainerFile, Record[2]) (TokenSpaceGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], TAB_PCDS_FIXED_AT_BUILD, ContainerFile, Record[2])
@ -745,7 +745,7 @@ class Inf(InfObject):
for Record in RecordSet5: for Record in RecordSet5:
(TokenSpaceGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], '', ContainerFile, Record[2]) (TokenSpaceGuidCName, TokenName, Value, Type) = GetPcdOfInf(Record[0], '', ContainerFile, Record[2])
self.AddPcd(TokenName, TokenSpaceGuidCName, Value, Type, Record[1], Record[5]) self.AddPcd(TokenName, TokenSpaceGuidCName, Value, Type, Record[1], Record[5])
## GenSources ## GenSources
# #
# Gen Sources of Inf # Gen Sources of Inf
@ -756,7 +756,7 @@ class Inf(InfObject):
def GenSources(self, ContainerFile): def GenSources(self, ContainerFile):
EdkLogger.debug(2, "Generate %s ..." % TAB_SOURCES) EdkLogger.debug(2, "Generate %s ..." % TAB_SOURCES)
Sources = {} Sources = {}
# Get all Sources # Get all Sources
RecordSet = self.RecordSet[MODEL_EFI_SOURCE_FILE] RecordSet = self.RecordSet[MODEL_EFI_SOURCE_FILE]
for Record in RecordSet: for Record in RecordSet:
@ -820,7 +820,7 @@ class Inf(InfObject):
def GenBinaries(self, ContainerFile): def GenBinaries(self, ContainerFile):
EdkLogger.debug(2, "Generate %s ..." % TAB_BINARIES) EdkLogger.debug(2, "Generate %s ..." % TAB_BINARIES)
Binaries = {} Binaries = {}
# Get all Guids # Get all Guids
RecordSet = self.RecordSet[MODEL_EFI_BINARY_FILE] RecordSet = self.RecordSet[MODEL_EFI_BINARY_FILE]
for Record in RecordSet: for Record in RecordSet:
@ -830,7 +830,7 @@ class Inf(InfObject):
Binary.HelpTextList.append(GenerateHelpText(Record[5], '')) Binary.HelpTextList.append(GenerateHelpText(Record[5], ''))
self.Module.Binaries.append(Binary) self.Module.Binaries.append(Binary)
#self.Module.FileList.append(os.path.normpath(os.path.join(self.Identification.RelaPath, Filename))) #self.Module.FileList.append(os.path.normpath(os.path.join(self.Identification.RelaPath, Filename)))
## GenGuids ## GenGuids
# #
# Gen Guids of Inf # Gen Guids of Inf
@ -859,7 +859,7 @@ class Inf(InfObject):
if GenerateHelpText(Record[5], ''): if GenerateHelpText(Record[5], ''):
ListClass.HelpTextList.append(GenerateHelpText(Record[5], '')) ListClass.HelpTextList.append(GenerateHelpText(Record[5], ''))
ListMember.append(ListClass) ListMember.append(ListClass)
## ##
# #
# This acts like the main() function for the script, unless it is 'import'ed into another # This acts like the main() function for the script, unless it is 'import'ed into another
@ -868,10 +868,10 @@ class Inf(InfObject):
if __name__ == '__main__': if __name__ == '__main__':
EdkLogger.Initialize() EdkLogger.Initialize()
EdkLogger.SetLevel(EdkLogger.QUIET) EdkLogger.SetLevel(EdkLogger.QUIET)
W = os.getenv('WORKSPACE') W = os.getenv('WORKSPACE')
F = os.path.join(W, 'MdeModulePkg/Application/HelloWorld/HelloWorld.inf') F = os.path.join(W, 'MdeModulePkg/Application/HelloWorld/HelloWorld.inf')
P = Inf(os.path.normpath(F), True, W, 'MdeModulePkg') P = Inf(os.path.normpath(F), True, W, 'MdeModulePkg')
P.ShowModule() P.ShowModule()
print P.ModuleToInf(P.Module) print P.ModuleToInf(P.Module)

View File

@ -24,7 +24,7 @@ import GlobalData
from BuildToolError import * from BuildToolError import *
from CommonDataClass.Exceptions import * from CommonDataClass.Exceptions import *
gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$',re.IGNORECASE) gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$', re.IGNORECASE)
gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$') gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
## GetSplitValueList ## GetSplitValueList
@ -39,7 +39,7 @@ gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
# #
# @retval list() A list for splitted string # @retval list() A list for splitted string
# #
def GetSplitValueList(String, SplitTag = DataType.TAB_VALUE_SPLIT, MaxSplit = -1): def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
ValueList = [] ValueList = []
Last = 0 Last = 0
Escaped = False Escaped = False
@ -51,7 +51,7 @@ def GetSplitValueList(String, SplitTag = DataType.TAB_VALUE_SPLIT, MaxSplit = -1
# Found a splitter not in a string, split it # Found a splitter not in a string, split it
if not InString and Char == SplitTag: if not InString and Char == SplitTag:
ValueList.append(String[Last:Index].strip()) ValueList.append(String[Last:Index].strip())
Last = Index+1 Last = Index + 1
if MaxSplit > 0 and len(ValueList) >= MaxSplit: if MaxSplit > 0 and len(ValueList) >= MaxSplit:
break break
@ -84,7 +84,7 @@ def GetSplitValueList(String, SplitTag = DataType.TAB_VALUE_SPLIT, MaxSplit = -1
# #
# @retval list() A list for splitted string # @retval list() A list for splitted string
# #
def GetSplitList(String, SplitStr = DataType.TAB_VALUE_SPLIT, MaxSplit = -1): def GetSplitList(String, SplitStr=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
return map(lambda l: l.strip(), String.split(SplitStr, MaxSplit)) return map(lambda l: l.strip(), String.split(SplitStr, MaxSplit))
## MergeArches ## MergeArches
@ -235,7 +235,7 @@ def SplitModuleType(Key):
# #
# @retval NewList A new string list whose macros are replaced # @retval NewList A new string list whose macros are replaced
# #
def ReplaceMacros(StringList, MacroDefinitions={}, SelfReplacement = False): def ReplaceMacros(StringList, MacroDefinitions={}, SelfReplacement=False):
NewList = [] NewList = []
for String in StringList: for String in StringList:
if type(String) == type(''): if type(String) == type(''):
@ -289,7 +289,7 @@ def ReplaceMacro(String, MacroDefinitions={}, SelfReplacement=False, RaiseError=
# #
# @retval Path Formatted path # @retval Path Formatted path
# #
def NormPath(Path, Defines = {}): def NormPath(Path, Defines={}):
IsRelativePath = False IsRelativePath = False
if Path: if Path:
if Path[0] == '.': if Path[0] == '.':
@ -319,7 +319,7 @@ def NormPath(Path, Defines = {}):
# #
# @retval Path Formatted path # @retval Path Formatted path
# #
def CleanString(Line, CommentCharacter = DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False): def CleanString(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False):
# #
# remove whitespace # remove whitespace
# #
@ -342,19 +342,19 @@ def CleanString(Line, CommentCharacter = DataType.TAB_COMMENT_SPLIT, AllowCppSty
elif Line[Index] == CommentCharacter and not InString : elif Line[Index] == CommentCharacter and not InString :
Line = Line[0: Index] Line = Line[0: Index]
break break
if CommentInString: if CommentInString:
Line = Line.replace('"', '') Line = Line.replace('"', '')
ChIndex = Line.find('#') ChIndex = Line.find('#')
while ChIndex >= 0: while ChIndex >= 0:
if GlobalData.gIsWindows: if GlobalData.gIsWindows:
if ChIndex == 0 or Line[ChIndex-1] != '^': if ChIndex == 0 or Line[ChIndex - 1] != '^':
Line = Line[0:ChIndex] + '^' + Line[ChIndex:] Line = Line[0:ChIndex] + '^' + Line[ChIndex:]
ChIndex = Line.find('#', ChIndex + 2) ChIndex = Line.find('#', ChIndex + 2)
else: else:
ChIndex = Line.find('#', ChIndex + 1) ChIndex = Line.find('#', ChIndex + 1)
else: else:
if ChIndex == 0 or Line[ChIndex-1] != '\\': if ChIndex == 0 or Line[ChIndex - 1] != '\\':
Line = Line[0:ChIndex] + '\\' + Line[ChIndex:] Line = Line[0:ChIndex] + '\\' + Line[ChIndex:]
ChIndex = Line.find('#', ChIndex + 2) ChIndex = Line.find('#', ChIndex + 2)
else: else:
@ -376,7 +376,7 @@ def CleanString(Line, CommentCharacter = DataType.TAB_COMMENT_SPLIT, AllowCppSty
# #
# @retval Path Formatted path # @retval Path Formatted path
# #
def CleanString2(Line, CommentCharacter = DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False): def CleanString2(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False):
# #
# remove whitespace # remove whitespace
# #
@ -468,7 +468,7 @@ def GetHexVerValue(VerString):
if len(Minor) == 1: if len(Minor) == 1:
Minor += '0' Minor += '0'
DeciValue = (int(Major) << 16) + int(Minor); DeciValue = (int(Major) << 16) + int(Minor);
return "0x%08x"%DeciValue return "0x%08x" % DeciValue
elif gHexVerPatt.match(VerString): elif gHexVerPatt.match(VerString):
return VerString return VerString
else: else:
@ -578,7 +578,7 @@ def PreCheck(FileName, FileContent, SupSectionTag):
# #
if Line.find('$') > -1: if Line.find('$') > -1:
if Line.find('$(') < 0 or Line.find(')') < 0: if Line.find('$(') < 0 or Line.find(')') < 0:
EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError=EdkLogger.IsRaiseError)
# #
# Check [] # Check []
@ -588,7 +588,7 @@ def PreCheck(FileName, FileContent, SupSectionTag):
# Only get one '[' or one ']' # Only get one '[' or one ']'
# #
if not (Line.find('[') > -1 and Line.find(']') > -1): if not (Line.find('[') > -1 and Line.find(']') > -1):
EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError=EdkLogger.IsRaiseError)
# #
# Regenerate FileContent # Regenerate FileContent
@ -596,7 +596,7 @@ def PreCheck(FileName, FileContent, SupSectionTag):
NewFileContent = NewFileContent + Line + '\r\n' NewFileContent = NewFileContent + Line + '\r\n'
if IsFailed: if IsFailed:
EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError=EdkLogger.IsRaiseError)
return NewFileContent return NewFileContent
@ -614,7 +614,7 @@ def PreCheck(FileName, FileContent, SupSectionTag):
# #
# @retval True The file type is correct # @retval True The file type is correct
# #
def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line, LineNo = -1): def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line, LineNo= -1):
if CheckFilename != '' and CheckFilename != None: if CheckFilename != '' and CheckFilename != None:
(Root, Ext) = os.path.splitext(CheckFilename) (Root, Ext) = os.path.splitext(CheckFilename)
if Ext.upper() != ExtName.upper(): if Ext.upper() != ExtName.upper():
@ -623,7 +623,7 @@ def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line,
LineNo = GetLineNo(ContainerFile, Line) LineNo = GetLineNo(ContainerFile, Line)
ErrorMsg = "Invalid %s. '%s' is found, but '%s' file is needed" % (SectionName, CheckFilename, ExtName) ErrorMsg = "Invalid %s. '%s' is found, but '%s' file is needed" % (SectionName, CheckFilename, ExtName)
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, Line=LineNo, EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, Line=LineNo,
File=ContainerFilename, RaiseError = EdkLogger.IsRaiseError) File=ContainerFilename, RaiseError=EdkLogger.IsRaiseError)
return True return True
@ -641,7 +641,7 @@ def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line,
# #
# @retval The file full path if the file exists # @retval The file full path if the file exists
# #
def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName, Line, LineNo = -1): def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName, Line, LineNo= -1):
CheckFile = '' CheckFile = ''
if CheckFilename != '' and CheckFilename != None: if CheckFilename != '' and CheckFilename != None:
CheckFile = WorkspaceFile(WorkspaceDir, CheckFilename) CheckFile = WorkspaceFile(WorkspaceDir, CheckFilename)
@ -651,7 +651,7 @@ def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName,
LineNo = GetLineNo(ContainerFile, Line) LineNo = GetLineNo(ContainerFile, Line)
ErrorMsg = "Can't find file '%s' defined in section '%s'" % (CheckFile, SectionName) ErrorMsg = "Can't find file '%s' defined in section '%s'" % (CheckFile, SectionName)
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg,
File=ContainerFilename, Line = LineNo, RaiseError = EdkLogger.IsRaiseError) File=ContainerFilename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
return CheckFile return CheckFile
@ -665,7 +665,7 @@ def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName,
# @retval int Index of the line # @retval int Index of the line
# @retval -1 The line is not found # @retval -1 The line is not found
# #
def GetLineNo(FileContent, Line, IsIgnoreComment = True): def GetLineNo(FileContent, Line, IsIgnoreComment=True):
LineList = FileContent.splitlines() LineList = FileContent.splitlines()
for Index in range(len(LineList)): for Index in range(len(LineList)):
if LineList[Index].find(Line) > -1: if LineList[Index].find(Line) > -1:
@ -688,13 +688,13 @@ def GetLineNo(FileContent, Line, IsIgnoreComment = True):
# @param File: File which has the string # @param File: File which has the string
# @param Format: Correct format # @param Format: Correct format
# #
def RaiseParserError(Line, Section, File, Format = '', LineNo = -1): def RaiseParserError(Line, Section, File, Format='', LineNo= -1):
if LineNo == -1: if LineNo == -1:
LineNo = GetLineNo(open(os.path.normpath(File), 'r').read(), Line) LineNo = GetLineNo(open(os.path.normpath(File), 'r').read(), Line)
ErrorMsg = "Invalid statement '%s' is found in section '%s'" % (Line, Section) ErrorMsg = "Invalid statement '%s' is found in section '%s'" % (Line, Section)
if Format != '': if Format != '':
Format = "Correct format is " + Format Format = "Correct format is " + Format
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=File, Line=LineNo, ExtraData=Format, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=File, Line=LineNo, ExtraData=Format, RaiseError=EdkLogger.IsRaiseError)
## WorkspaceFile ## WorkspaceFile
# #
@ -757,10 +757,10 @@ def RemoveBlockComment(Lines):
# Remove comment block # Remove comment block
# #
if Line.find(DataType.TAB_COMMENT_EDK_START) > -1: if Line.find(DataType.TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, DataType.TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, DataType.TAB_COMMENT_EDK_START, 1)[0]
IsFindBlockComment = True IsFindBlockComment = True
if Line.find(DataType.TAB_COMMENT_EDK_END) > -1: if Line.find(DataType.TAB_COMMENT_EDK_END) > -1:
Line = ReservedLine + GetSplitValueList(Line, DataType.TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, DataType.TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:
@ -773,7 +773,7 @@ def RemoveBlockComment(Lines):
# #
# Get String of a List # Get String of a List
# #
def GetStringOfList(List, Split = ' '): def GetStringOfList(List, Split=' '):
if type(List) != type([]): if type(List) != type([]):
return List return List
Str = '' Str = ''
@ -797,7 +797,7 @@ def GetHelpTextList(HelpTextClassList):
def StringToArray(String): def StringToArray(String):
if isinstance(String, unicode): if isinstance(String, unicode):
if len(unicode) ==0: if len(unicode) == 0:
return "{0x00, 0x00}" return "{0x00, 0x00}"
return "{%s, 0x00, 0x00}" % ", ".join(["0x%02x, 0x00" % ord(C) for C in String]) return "{%s, 0x00, 0x00}" % ", ".join(["0x%02x, 0x00" % ord(C) for C in String])
elif String.startswith('L"'): elif String.startswith('L"'):
@ -822,7 +822,7 @@ def StringArrayLength(String):
return (len(String) - 2 + 1) return (len(String) - 2 + 1)
else: else:
return len(String.split()) + 1 return len(String.split()) + 1
def RemoveDupOption(OptionString, Which="/I", Against=None): def RemoveDupOption(OptionString, Which="/I", Against=None):
OptionList = OptionString.split() OptionList = OptionString.split()
ValueList = [] ValueList = []

View File

@ -59,8 +59,8 @@ class Check(object):
for Char in Line: for Char in Line:
IndexOfChar += 1 IndexOfChar += 1
if ord(Char) > 126: if ord(Char) > 126:
OtherMsg = "File %s has Non-ASCII char at line %s column %s" %(Record[1], IndexOfLine, IndexOfChar) OtherMsg = "File %s has Non-ASCII char at line %s column %s" % (Record[1], IndexOfLine, IndexOfChar)
EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_NON_ACSII, OtherMsg = OtherMsg, BelongsToTable = 'File', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_NON_ACSII, OtherMsg=OtherMsg, BelongsToTable='File', BelongsToItem=Record[0])
# C Function Layout Checking # C Function Layout Checking
def FunctionLayoutCheck(self): def FunctionLayoutCheck(self):
@ -251,7 +251,7 @@ class Check(object):
EdkLogger.quiet("Checking same struct ...") EdkLogger.quiet("Checking same struct ...")
AllStructure = {} AllStructure = {}
for IdentifierTable in EccGlobalData.gIdentifierTableList: for IdentifierTable in EccGlobalData.gIdentifierTableList:
SqlCommand = """select ID, Name, BelongsToFile from %s where Model = %s""" %(IdentifierTable, MODEL_IDENTIFIER_STRUCTURE) SqlCommand = """select ID, Name, BelongsToFile from %s where Model = %s""" % (IdentifierTable, MODEL_IDENTIFIER_STRUCTURE)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if Record[1] != '': if Record[1] != '':
@ -265,7 +265,7 @@ class Check(object):
if NewRecordSet != []: if NewRecordSet != []:
OtherMsg = "The structure name [%s] is duplicate with the one defined in %s, maybe struct NOT typedefed or the typedef new type NOT used to qualify variables" % (Record[1], NewRecordSet[0][0]) OtherMsg = "The structure name [%s] is duplicate with the one defined in %s, maybe struct NOT typedefed or the typedef new type NOT used to qualify variables" % (Record[1], NewRecordSet[0][0])
if not EccGlobalData.gException.IsException(ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE, OtherMsg = OtherMsg, BelongsToTable = IdentifierTable, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE, OtherMsg=OtherMsg, BelongsToTable=IdentifierTable, BelongsToItem=Record[0])
# Check whether Union Type has a 'typedef' and the name is capital # Check whether Union Type has a 'typedef' and the name is capital
def DeclCheckUnionType(self): def DeclCheckUnionType(self):
@ -365,7 +365,7 @@ class Check(object):
if Path.startswith('\\') or Path.startswith('/'): if Path.startswith('\\') or Path.startswith('/'):
Path = Path[1:] Path = Path[1:]
if not EccGlobalData.gException.IsException(ERROR_INCLUDE_FILE_CHECK_NAME, Path): if not EccGlobalData.gException.IsException(ERROR_INCLUDE_FILE_CHECK_NAME, Path):
EccGlobalData.gDb.TblReport.Insert(ERROR_INCLUDE_FILE_CHECK_NAME, OtherMsg = "The file name for [%s] is duplicate" % Path, BelongsToTable = 'File', BelongsToItem = Item[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_INCLUDE_FILE_CHECK_NAME, OtherMsg="The file name for [%s] is duplicate" % Path, BelongsToTable='File', BelongsToItem=Item[0])
# Check whether all include file contents is guarded by a #ifndef statement. # Check whether all include file contents is guarded by a #ifndef statement.
def IncludeFileCheckIfndef(self): def IncludeFileCheckIfndef(self):
@ -526,7 +526,7 @@ class Check(object):
LibraryClasses[List[0]].append(Item) LibraryClasses[List[0]].append(Item)
if Record[2] != 'BASE' and Record[2] not in SupModType: if Record[2] != 'BASE' and Record[2] not in SupModType:
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2, OtherMsg = "The Library Class '%s' does not specify its supported module types" % (List[0]), BelongsToTable = 'Inf', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2, OtherMsg="The Library Class '%s' does not specify its supported module types" % (List[0]), BelongsToTable='Inf', BelongsToItem=Record[0])
SqlCommand = """select A.ID, A.Value1, B.Value2 from Inf as A left join Inf as B SqlCommand = """select A.ID, A.Value1, B.Value2 from Inf as A left join Inf as B
where A.Model = %s and B.Value1 = '%s' and B.Model = %s where A.Model = %s and B.Value1 = '%s' and B.Model = %s
@ -546,10 +546,10 @@ class Check(object):
if Record[1] in LibraryClasses: if Record[1] in LibraryClasses:
if Record[2] not in LibraryClasses[Record[1]] and 'BASE' not in RecordDict[Record[1]]: if Record[2] not in LibraryClasses[Record[1]] and 'BASE' not in RecordDict[Record[1]]:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg = "The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable = 'Inf', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg="The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
else: else:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg = "The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable = 'Inf', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg="The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
# Check whether a Library Instance has been defined for all dependent library classes # Check whether a Library Instance has been defined for all dependent library classes
def MetaDataFileCheckLibraryInstanceDependent(self): def MetaDataFileCheckLibraryInstanceDependent(self):
@ -571,7 +571,7 @@ class Check(object):
IsFound = True IsFound = True
if not IsFound: if not IsFound:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, LibraryClass[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, LibraryClass[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, OtherMsg = "The Library Class [%s] is not specified in '%s'" % (LibraryClass[1], LibraryClass[2]), BelongsToTable = 'Dsc', BelongsToItem = LibraryClass[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, OtherMsg="The Library Class [%s] is not specified in '%s'" % (LibraryClass[1], LibraryClass[2]), BelongsToTable='Dsc', BelongsToItem=LibraryClass[0])
# Check whether the Library Instances specified by the LibraryClasses sections are listed in order of dependencies # Check whether the Library Instances specified by the LibraryClasses sections are listed in order of dependencies
def MetaDataFileCheckLibraryInstanceOrder(self): def MetaDataFileCheckLibraryInstanceOrder(self):
@ -587,7 +587,7 @@ class Check(object):
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, OtherMsg = "The Library Class [%s] is not used in any platform" % (Record[1]), BelongsToTable = 'Inf', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, OtherMsg="The Library Class [%s] is not used in any platform" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
# Check whether an Inf file is specified in the FDF file, but not in the Dsc file, then the Inf file must be for a Binary module only # Check whether an Inf file is specified in the FDF file, but not in the Dsc file, then the Inf file must be for a Binary module only
def MetaDataFileCheckBinaryInfInFdf(self): def MetaDataFileCheckBinaryInfInFdf(self):
@ -608,9 +608,9 @@ class Check(object):
SqlCommand = """select ID from Inf where Model = %s and BelongsToFile = (select ID from File where FullPath like '%s') SqlCommand = """select ID from Inf where Model = %s and BelongsToFile = (select ID from File where FullPath like '%s')
""" % (MODEL_EFI_SOURCE_FILE, FilePath) """ % (MODEL_EFI_SOURCE_FILE, FilePath)
NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
if NewRecordSet!= []: if NewRecordSet != []:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF, FilePath): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF, FilePath):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF, OtherMsg = "File [%s] defined in FDF file and not in DSC file must be a binary module" % (FilePath), BelongsToTable = 'Fdf', BelongsToItem = FdfID) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF, OtherMsg="File [%s] defined in FDF file and not in DSC file must be a binary module" % (FilePath), BelongsToTable='Fdf', BelongsToItem=FdfID)
# Check whether a PCD is set in a Dsc file or the FDF file, but not in both. # Check whether a PCD is set in a Dsc file or the FDF file, but not in both.
def MetaDataFileCheckPcdDuplicate(self): def MetaDataFileCheckPcdDuplicate(self):
@ -624,19 +624,19 @@ class Check(object):
and A.Enabled > -1 and A.Enabled > -1
and B.Enabled > -1 and B.Enabled > -1
group by A.ID group by A.ID
"""% (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER) """ % (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
SqlCommand1 = """select Name from File where ID = %s""" %Record[2] SqlCommand1 = """select Name from File where ID = %s""" % Record[2]
SqlCommand2 = """select Name from File where ID = %s""" %Record[5] SqlCommand2 = """select Name from File where ID = %s""" % Record[5]
DscFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand1)[0][0])[0] DscFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand1)[0][0])[0]
FdfFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand2)[0][0])[0] FdfFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand2)[0][0])[0]
if DscFileName != FdfFileName: if DscFileName != FdfFileName:
continue continue
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg = "The PCD [%s] is defined in both FDF file and DSC file" % (Record[1]), BelongsToTable = 'Dsc', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined in both FDF file and DSC file" % (Record[1]), BelongsToTable='Dsc', BelongsToItem=Record[0])
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[3]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[3]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg = "The PCD [%s] is defined in both FDF file and DSC file" % (Record[4]), BelongsToTable = 'Fdf', BelongsToItem = Record[3]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined in both FDF file and DSC file" % (Record[4]), BelongsToTable='Fdf', BelongsToItem=Record[3])
EdkLogger.quiet("Checking for duplicate PCDs defined in DEC files ...") EdkLogger.quiet("Checking for duplicate PCDs defined in DEC files ...")
SqlCommand = """ SqlCommand = """
@ -650,11 +650,11 @@ class Check(object):
and B.Enabled > -1 and B.Enabled > -1
and A.BelongsToFile = B.BelongsToFile and A.BelongsToFile = B.BelongsToFile
group by A.ID group by A.ID
"""% (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER) """ % (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg = "The PCD [%s] is defined duplicated in DEC file" % (Record[1]), BelongsToTable = 'Dec', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined duplicated in DEC file" % (Record[1]), BelongsToTable='Dec', BelongsToItem=Record[0])
# Check whether PCD settings in the FDF file can only be related to flash. # Check whether PCD settings in the FDF file can only be related to flash.
def MetaDataFileCheckPcdFlash(self): def MetaDataFileCheckPcdFlash(self):
@ -665,11 +665,11 @@ class Check(object):
where A.Model >= %s and Model < %s where A.Model >= %s and Model < %s
and A.Enabled > -1 and A.Enabled > -1
and A.Value2 not like '%%Flash%%' and A.Value2 not like '%%Flash%%'
"""% (MODEL_PCD, MODEL_META_DATA_HEADER) """ % (MODEL_PCD, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblFdf.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFdf.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, OtherMsg = "The PCD [%s] defined in FDF file is not related to Flash" % (Record[1]), BelongsToTable = 'Fdf', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, OtherMsg="The PCD [%s] defined in FDF file is not related to Flash" % (Record[1]), BelongsToTable='Fdf', BelongsToItem=Record[0])
# Check whether PCDs used in Inf files but not specified in Dsc or FDF files # Check whether PCDs used in Inf files but not specified in Dsc or FDF files
def MetaDataFileCheckPcdNoUse(self): def MetaDataFileCheckPcdNoUse(self):
@ -687,11 +687,11 @@ class Check(object):
(select Value2 from Fdf as C (select Value2 from Fdf as C
where C.Model >= %s and C.Model < %s where C.Model >= %s and C.Model < %s
and C.Enabled > -1) and C.Enabled > -1)
"""% (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER) """ % (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, OtherMsg = "The PCD [%s] defined in INF file is not specified in either DSC or FDF files" % (Record[1]), BelongsToTable = 'Inf', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, OtherMsg="The PCD [%s] defined in INF file is not specified in either DSC or FDF files" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
# Check whether having duplicate guids defined for Guid/Protocol/Ppi # Check whether having duplicate guids defined for Guid/Protocol/Ppi
def MetaDataFileCheckGuidDuplicate(self): def MetaDataFileCheckGuidDuplicate(self):
@ -735,7 +735,7 @@ class Check(object):
Path = Path.upper().replace('\X64', '').replace('\IA32', '').replace('\EBC', '').replace('\IPF', '').replace('\ARM', '') Path = Path.upper().replace('\X64', '').replace('\IA32', '').replace('\EBC', '').replace('\IPF', '').replace('\ARM', '')
if Path in InfPathList: if Path in InfPathList:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, Record[2]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, Record[2]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, OtherMsg = "The source file [%s] is existing in module directory but it is not described in INF file." % (Record[2]), BelongsToTable = 'File', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, OtherMsg="The source file [%s] is existing in module directory but it is not described in INF file." % (Record[2]), BelongsToTable='File', BelongsToItem=Record[0])
# Check whether the PCD is correctly used in C function via its type # Check whether the PCD is correctly used in C function via its type
def MetaDataFileCheckPcdType(self): def MetaDataFileCheckPcdType(self):
@ -755,7 +755,7 @@ class Check(object):
select ID from File where FullPath in select ID from File where FullPath in
(select B.Path || '\\' || A.Value1 from INF as A, File as B where A.Model = %s and A.BelongsToFile = %s (select B.Path || '\\' || A.Value1 from INF as A, File as B where A.Model = %s and A.BelongsToFile = %s
and B.ID = %s and (B.Model = %s or B.Model = %s)) and B.ID = %s and (B.Model = %s or B.Model = %s))
""" %(MODEL_EFI_SOURCE_FILE, BelongsToFile, BelongsToFile, MODEL_FILE_C, MODEL_FILE_H) """ % (MODEL_EFI_SOURCE_FILE, BelongsToFile, BelongsToFile, MODEL_FILE_C, MODEL_FILE_H)
TableSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) TableSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Tbl in TableSet: for Tbl in TableSet:
TblName = 'Identifier' + str(Tbl[0]) TblName = 'Identifier' + str(Tbl[0])
@ -768,11 +768,11 @@ class Check(object):
FunName = Record[0] FunName = Record[0]
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, FunName): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, FunName):
if Model in [MODEL_PCD_FIXED_AT_BUILD] and not FunName.startswith('FixedPcdGet'): if Model in [MODEL_PCD_FIXED_AT_BUILD] and not FunName.startswith('FixedPcdGet'):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg = "The pcd '%s' is defined as a FixPcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable = TblName, BelongsToItem = Record[1]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg="The pcd '%s' is defined as a FixPcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable=TblName, BelongsToItem=Record[1])
if Model in [MODEL_PCD_FEATURE_FLAG] and (not FunName.startswith('FeaturePcdGet') and not FunName.startswith('FeaturePcdSet')): if Model in [MODEL_PCD_FEATURE_FLAG] and (not FunName.startswith('FeaturePcdGet') and not FunName.startswith('FeaturePcdSet')):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg = "The pcd '%s' is defined as a FeaturePcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable = TblName, BelongsToItem = Record[1]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg="The pcd '%s' is defined as a FeaturePcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable=TblName, BelongsToItem=Record[1])
if Model in [MODEL_PCD_PATCHABLE_IN_MODULE] and (not FunName.startswith('PatchablePcdGet') and not FunName.startswith('PatchablePcdSet')): if Model in [MODEL_PCD_PATCHABLE_IN_MODULE] and (not FunName.startswith('PatchablePcdGet') and not FunName.startswith('PatchablePcdSet')):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg = "The pcd '%s' is defined as a PatchablePcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable = TblName, BelongsToItem = Record[1]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg="The pcd '%s' is defined as a PatchablePcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable=TblName, BelongsToItem=Record[1])
#ERROR_META_DATA_FILE_CHECK_PCD_TYPE #ERROR_META_DATA_FILE_CHECK_PCD_TYPE
pass pass
@ -806,7 +806,7 @@ class Check(object):
if InfPath1 and InfPath2: if InfPath1 and InfPath2:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, InfPath1): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, InfPath1):
Msg = "The FILE_GUID of INF file [%s] is duplicated with that of %s" % (InfPath1, InfPath2) Msg = "The FILE_GUID of INF file [%s] is duplicated with that of %s" % (InfPath1, InfPath2)
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, OtherMsg = Msg, BelongsToTable = Table.Table, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
# Check whether these is duplicate Guid/Ppi/Protocol name # Check whether these is duplicate Guid/Ppi/Protocol name
@ -822,6 +822,7 @@ class Check(object):
select A.ID, A.Value1 from %s as A, %s as B select A.ID, A.Value1 from %s as A, %s as B
where A.Model = %s and B.Model = %s where A.Model = %s and B.Model = %s
and A.Value1 = B.Value1 and A.ID <> B.ID and A.Value1 = B.Value1 and A.ID <> B.ID
and A.Arch = B.Arch
and A.Enabled > -1 and A.Enabled > -1
and B.Enabled > -1 and B.Enabled > -1
group by A.ID group by A.ID
@ -829,7 +830,7 @@ class Check(object):
RecordSet = Table.Exec(SqlCommand) RecordSet = Table.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not EccGlobalData.gException.IsException(ErrorID, Record[1]): if not EccGlobalData.gException.IsException(ErrorID, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ErrorID, OtherMsg = "The %s name [%s] is defined more than one time" % (Name.upper(), Record[1]), BelongsToTable = Table.Table, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ErrorID, OtherMsg="The %s name [%s] is defined more than one time" % (Name.upper(), Record[1]), BelongsToTable=Table.Table, BelongsToItem=Record[0])
# Check whether these is duplicate Guid/Ppi/Protocol value # Check whether these is duplicate Guid/Ppi/Protocol value
def CheckGuidProtocolPpiValue(self, ErrorID, Model): def CheckGuidProtocolPpiValue(self, ErrorID, Model):
@ -845,12 +846,13 @@ class Check(object):
select A.ID, A.Value2 from %s as A, %s as B select A.ID, A.Value2 from %s as A, %s as B
where A.Model = %s and B.Model = %s where A.Model = %s and B.Model = %s
and A.Value2 = B.Value2 and A.ID <> B.ID and A.Value2 = B.Value2 and A.ID <> B.ID
and A.Arch = B.Arch
group by A.ID group by A.ID
""" % (Table.Table, Table.Table, Model, Model) """ % (Table.Table, Table.Table, Model, Model)
RecordSet = Table.Exec(SqlCommand) RecordSet = Table.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not EccGlobalData.gException.IsException(ErrorID, Record[1]): if not EccGlobalData.gException.IsException(ErrorID, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ErrorID, OtherMsg = "The %s value [%s] is used more than one time" % (Name.upper(), Record[1]), BelongsToTable = Table.Table, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ErrorID, OtherMsg="The %s value [%s] is used more than one time" % (Name.upper(), Record[1]), BelongsToTable=Table.Table, BelongsToItem=Record[0])
# Naming Convention Check # Naming Convention Check
def NamingConventionCheck(self): def NamingConventionCheck(self):
@ -883,7 +885,7 @@ class Check(object):
if EccGlobalData.gConfig.NamingConventionCheckDefineStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.NamingConventionCheckDefineStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of #define statement ...") EdkLogger.quiet("Checking naming covention of #define statement ...")
SqlCommand = """select ID, Value from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_MACRO_DEFINE) SqlCommand = """select ID, Value from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_MACRO_DEFINE)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
Name = Record[1].strip().split()[1] Name = Record[1].strip().split()[1]
@ -891,14 +893,14 @@ class Check(object):
Name = Name[0:Name.find('(')] Name = Name[0:Name.find('(')]
if Name.upper() != Name: if Name.upper() != Name:
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT, Name): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT, Name):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT, OtherMsg = "The #define name [%s] does not follow the rules" % (Name), BelongsToTable = FileTable, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT, OtherMsg="The #define name [%s] does not follow the rules" % (Name), BelongsToTable=FileTable, BelongsToItem=Record[0])
# Check whether only capital letters are used for typedef declarations # Check whether only capital letters are used for typedef declarations
def NamingConventionCheckTypedefStatement(self, FileTable): def NamingConventionCheckTypedefStatement(self, FileTable):
if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of #typedef statement ...") EdkLogger.quiet("Checking naming covention of #typedef statement ...")
SqlCommand = """select ID, Name from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_TYPEDEF) SqlCommand = """select ID, Name from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_TYPEDEF)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
Name = Record[1].strip() Name = Record[1].strip()
@ -911,20 +913,20 @@ class Check(object):
Name = Name.replace('*', '').strip() Name = Name.replace('*', '').strip()
if Name.upper() != Name: if Name.upper() != Name:
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, Name): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, Name):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, OtherMsg = "The #typedef name [%s] does not follow the rules" % (Name), BelongsToTable = FileTable, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, OtherMsg="The #typedef name [%s] does not follow the rules" % (Name), BelongsToTable=FileTable, BelongsToItem=Record[0])
# Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'. # Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'.
def NamingConventionCheckIfndefStatement(self, FileTable): def NamingConventionCheckIfndefStatement(self, FileTable):
if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of #ifndef statement ...") EdkLogger.quiet("Checking naming covention of #ifndef statement ...")
SqlCommand = """select ID, Value from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF) SqlCommand = """select ID, Value from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
Name = Record[1].replace('#ifndef', '').strip() Name = Record[1].replace('#ifndef', '').strip()
if Name[0] != '_' or Name[-1] != '_': if Name[0] != '_' or Name[-1] != '_':
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT, Name): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT, Name):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT, OtherMsg = "The #ifndef name [%s] does not follow the rules" % (Name), BelongsToTable = FileTable, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT, OtherMsg="The #ifndef name [%s] does not follow the rules" % (Name), BelongsToTable=FileTable, BelongsToItem=Record[0])
# Rule for path name, variable name and function name # Rule for path name, variable name and function name
# 1. First character should be upper case # 1. First character should be upper case
@ -940,7 +942,7 @@ class Check(object):
for Record in RecordSet: for Record in RecordSet:
if not Pattern.match(Record[1]): if not Pattern.match(Record[1]):
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_PATH_NAME, Record[1]): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_PATH_NAME, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_PATH_NAME, OtherMsg = "The file path [%s] does not follow the rules" % (Record[1]), BelongsToTable = 'File', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_PATH_NAME, OtherMsg="The file path [%s] does not follow the rules" % (Record[1]), BelongsToTable='File', BelongsToItem=Record[0])
# Rule for path name, variable name and function name # Rule for path name, variable name and function name
# 1. First character should be upper case # 1. First character should be upper case
@ -953,12 +955,12 @@ class Check(object):
EdkLogger.quiet("Checking naming covention of variable name ...") EdkLogger.quiet("Checking naming covention of variable name ...")
Pattern = re.compile(r'^[A-Zgm]+\S*[a-z]\S*$') Pattern = re.compile(r'^[A-Zgm]+\S*[a-z]\S*$')
SqlCommand = """select ID, Name from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_VARIABLE) SqlCommand = """select ID, Name from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_VARIABLE)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not Pattern.match(Record[1]): if not Pattern.match(Record[1]):
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Record[1]): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, OtherMsg = "The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable = FileTable, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable=FileTable, BelongsToItem=Record[0])
# Rule for path name, variable name and function name # Rule for path name, variable name and function name
# 1. First character should be upper case # 1. First character should be upper case
@ -974,20 +976,20 @@ class Check(object):
for Record in RecordSet: for Record in RecordSet:
if not Pattern.match(Record[1]): if not Pattern.match(Record[1]):
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME, Record[1]): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME, OtherMsg = "The function name [%s] does not follow the rules" % (Record[1]), BelongsToTable = 'Function', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME, OtherMsg="The function name [%s] does not follow the rules" % (Record[1]), BelongsToTable='Function', BelongsToItem=Record[0])
# Check whether NO use short variable name with single character # Check whether NO use short variable name with single character
def NamingConventionCheckSingleCharacterVariable(self, FileTable): def NamingConventionCheckSingleCharacterVariable(self, FileTable):
if EccGlobalData.gConfig.NamingConventionCheckSingleCharacterVariable == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.NamingConventionCheckSingleCharacterVariable == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of single character variable name ...") EdkLogger.quiet("Checking naming covention of single character variable name ...")
SqlCommand = """select ID, Name from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_VARIABLE) SqlCommand = """select ID, Name from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_VARIABLE)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
Variable = Record[1].replace('*', '') Variable = Record[1].replace('*', '')
if len(Variable) == 1: if len(Variable) == 1:
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, OtherMsg = "The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable = FileTable, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable=FileTable, BelongsToItem=Record[0])
## ##
# #

View File

@ -50,10 +50,10 @@ def PreProcess(Filename, MergeMultipleLines = True, LineNo = -1):
Line = Line.strip() Line = Line.strip()
# Remove comment block # Remove comment block
if Line.find(TAB_COMMENT_EDK_START) > -1: if Line.find(TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
IsFindBlockComment = True IsFindBlockComment = True
if Line.find(TAB_COMMENT_EDK_END) > -1: if Line.find(TAB_COMMENT_EDK_END) > -1:
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:

View File

@ -1118,6 +1118,34 @@ class FdfParser:
def SetFileBufferPos(self, Pos): def SetFileBufferPos(self, Pos):
(self.CurrentLineNumber, self.CurrentOffsetWithinLine) = Pos (self.CurrentLineNumber, self.CurrentOffsetWithinLine) = Pos
## Preprocess() method
#
# Preprocess comment, conditional directive, include directive, replace macro.
# Exception will be raised if syntax error found
#
# @param self The object pointer
#
def Preprocess(self):
self.__StringToList()
self.PreprocessFile()
self.PreprocessIncludeFile()
self.__StringToList()
self.PreprocessFile()
self.PreprocessConditionalStatement()
self.__StringToList()
for Pos in self.__WipeOffArea:
self.__ReplaceFragment(Pos[0], Pos[1])
self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]
while self.__GetDefines():
pass
Index = 0
while Index < len(self.Profile.FileLinesList):
FileLineTuple = GetRealFileLine(self.FileName, Index + 1)
self.Profile.FileLinesList[Index] = self.__ReplaceMacros(self.Profile.FileLinesList[Index], FileLineTuple[0], FileLineTuple[1])
Index += 1
## ParseFile() method ## ParseFile() method
# #
# Parse the file profile buffer to extract fd, fv ... information # Parse the file profile buffer to extract fd, fv ... information
@ -1128,26 +1156,7 @@ class FdfParser:
def ParseFile(self): def ParseFile(self):
try: try:
self.__StringToList() self.Preprocess()
self.PreprocessFile()
self.PreprocessIncludeFile()
self.__StringToList()
self.PreprocessFile()
self.PreprocessConditionalStatement()
self.__StringToList()
for Pos in self.__WipeOffArea:
self.__ReplaceFragment(Pos[0], Pos[1])
self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]
while self.__GetDefines():
pass
Index = 0
while Index < len(self.Profile.FileLinesList):
FileLineTuple = GetRealFileLine(self.FileName, Index + 1)
self.Profile.FileLinesList[Index] = self.__ReplaceMacros(self.Profile.FileLinesList[Index], FileLineTuple[0], FileLineTuple[1])
Index += 1
while self.__GetFd(): while self.__GetFd():
pass pass

View File

@ -660,10 +660,10 @@ def RemoveBlockComment(Lines):
# Remove comment block # Remove comment block
# #
if Line.find(DataType.TAB_COMMENT_EDK1_START) > -1: if Line.find(DataType.TAB_COMMENT_EDK1_START) > -1:
ReservedLine = GetSplitValueList(Line, DataType.TAB_COMMENT_EDK1_START, 1)[0] ReservedLine = GetSplitList(Line, DataType.TAB_COMMENT_EDK1_START, 1)[0]
IsFindBlockComment = True IsFindBlockComment = True
if Line.find(DataType.TAB_COMMENT_EDK1_END) > -1: if Line.find(DataType.TAB_COMMENT_EDK1_END) > -1:
Line = ReservedLine + GetSplitValueList(Line, DataType.TAB_COMMENT_EDK1_END, 1)[1] Line = ReservedLine + GetSplitList(Line, DataType.TAB_COMMENT_EDK1_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:

View File

@ -450,6 +450,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
if len(ValueList) == 2: if len(ValueList) == 2:
Type = ValueList[1] Type = ValueList[1]
TypeList = GetSplitValueList(Type, ' ') TypeList = GetSplitValueList(Type, ' ')
TypeList = [Type for Type in TypeList if Type != '']
for Item in TypeList: for Item in TypeList:
if Item not in DT.MODULE_LIST: if Item not in DT.MODULE_LIST:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Item), ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Item),