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_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_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_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_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_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_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_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
//
#define __BUILD_VERSION "Build 2386"
#define __BUILD_VERSION "Build 2396"

View File

@ -2184,13 +2184,19 @@ class ModuleAutoGen(AutoGen):
def _GetBuildOptionIncPathList(self):
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
#
if self.PlatformInfo.ToolChainFamily in ('MSFT'):
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)
else:
#
# New ToolChainFamily, don't known whether there is option to specify include directories
#
self._BuildOptionIncPathList = []
return self._BuildOptionIncPathList
BuildOptionIncPathList = []
for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'ASM'):
@ -2200,7 +2206,17 @@ class ModuleAutoGen(AutoGen):
except KeyError:
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
# within the module's directory tree. Report error if violation.

View File

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

View File

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

View File

@ -1,3 +1,3 @@
#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
#
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.Package = PackageClass()
self.UserExtensions = ''
self.WorkspaceDir = WorkspaceDir
self.SupArchList = SupArchList
self.IsToDatabase = IsToDatabase
self.Cur = Database.Cur
self.TblFile = Database.TblFile
self.TblDec = Database.TblDec
@ -104,26 +104,26 @@ class Dec(DecObject):
# Upper all KEYs to ignore case sensitive when parsing
#
self.KeyList = map(lambda c: c.upper(), self.KeyList)
#
# Init RecordSet
#
self.RecordSet = {}
self.RecordSet = {}
for Key in self.KeyList:
self.RecordSet[Section[Key]] = []
#
# Load Dec file if filename is not None
#
if Filename != None:
self.LoadDecFile(Filename)
#
# Transfer to Package Object if IsToPackage is True
#
if IsToPackage:
self.DecToPackage()
## Load Dec file
#
# Load the file if it exists
@ -138,20 +138,20 @@ class Dec(DecObject):
self.Identification.FileFullPath = Filename
(self.Identification.FileRelativePath, self.Identification.FileName) = os.path.split(Filename)
self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_DEC)
#
# Init DecTable
#
#self.TblDec.Table = "Dec%s" % self.FileID
#self.TblDec.Create()
#
# Init common datas
#
IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \
[], [], TAB_UNKNOWN, [], [], []
LineNo = 0
#
# Parse file content
#
@ -163,10 +163,10 @@ class Dec(DecObject):
# Remove comment block
#
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
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 = ''
IsFindBlockComment = False
if IsFindBlockComment:
@ -178,7 +178,7 @@ class Dec(DecObject):
Line = CleanString(Line)
if Line == '':
continue
#
# Find a new section tab
# First insert previous section items
@ -197,7 +197,7 @@ class Dec(DecObject):
SectionItemList = []
ArchList = []
ThirdList = []
CurrentSection = ''
LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT)
for Item in LineList:
@ -206,7 +206,7 @@ class Dec(DecObject):
CurrentSection = ItemList[0]
else:
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:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
ItemList.append('')
@ -215,18 +215,18 @@ class Dec(DecObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else:
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())
ThirdList.append(ItemList[2])
continue
#
# Not in any defined section
#
if CurrentSection == TAB_UNKNOWN:
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
@ -234,13 +234,13 @@ class Dec(DecObject):
SectionItemList.append([Line, LineNo])
# End of parse
#End of For
#
# Insert items data of last section
#
Model = Section[CurrentSection.upper()]
InsertSectionItemsIntoDatabase(self.TblDec, self.FileID, Filename, Model, CurrentSection, SectionItemList, ArchList, ThirdList, IfDefList, self.RecordSet)
#
# Replace all DEFINE macros with its actual values
#
@ -255,12 +255,12 @@ class Dec(DecObject):
# Init global information for the file
#
ContainerFile = self.Identification.FileFullPath
#
# Generate Package Header
#
self.GenPackageHeader(ContainerFile)
#
# Generate Includes
#
@ -280,17 +280,17 @@ class Dec(DecObject):
# Generate Ppis
#
self.GenGuidProtocolPpis(DataType.TAB_PPIS, ContainerFile)
#
# Generate LibraryClasses
#
self.GenLibraryClasses(ContainerFile)
#
# Generate Pcds
#
self.GenPcds(ContainerFile)
## Get Package Header
#
# Gen Package Header of Dec as <Key> = <Value>
@ -311,22 +311,22 @@ class Dec(DecObject):
SqlCommand = """update %s set Value1 = '%s', Value2 = '%s'
where ID = %s""" % (self.TblDec.Table, ConvertToSqlString2(Value1), ConvertToSqlString2(Value2), ID)
self.TblDec.Exec(SqlCommand)
#
# Get detailed information
#
for Arch in self.SupArchList:
PackageHeader = PackageHeaderClass()
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.Version = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_PACKAGE_VERSION, Arch, self.FileID)[0]
PackageHeader.FileName = self.Identification.FileName
PackageHeader.FullPath = self.Identification.FileFullPath
PackageHeader.DecSpecification = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_DEC_SPECIFICATION, Arch, self.FileID)[0]
self.Package.Header[Arch] = PackageHeader
## GenIncludes
#
# Gen Includes of Dec
@ -341,7 +341,7 @@ class Dec(DecObject):
# Get all Includes
#
RecordSet = self.RecordSet[MODEL_EFI_INCLUDE]
#
# Go through each arch
#
@ -355,7 +355,7 @@ class Dec(DecObject):
Include.FilePath = NormPath(Key)
Include.SupArchList = Includes[Key]
self.Package.Includes.append(Include)
## GenPpis
#
# Gen Ppis of Dec
@ -370,7 +370,7 @@ class Dec(DecObject):
# Get all Items
#
RecordSet = self.RecordSet[Section[Type.upper()]]
#
# Go through each arch
#
@ -383,7 +383,7 @@ class Dec(DecObject):
SqlCommand = """update %s set Value1 = '%s', Value2 = '%s'
where ID = %s""" % (self.TblDec.Table, ConvertToSqlString2(Name), ConvertToSqlString2(Value), Record[3])
self.TblDec.Exec(SqlCommand)
ListMember = None
if Type == TAB_GUIDS:
ListMember = self.Package.GuidDeclarations
@ -391,15 +391,15 @@ class Dec(DecObject):
ListMember = self.Package.ProtocolDeclarations
elif Type == TAB_PPIS:
ListMember = self.Package.PpiDeclarations
for Key in Lists.keys():
ListClass = GuidProtocolPpiCommonClass()
ListClass.CName = Key[0]
ListClass.Guid = Key[1]
ListClass.SupArchList = Lists[Key]
ListMember.append(ListClass)
## GenLibraryClasses
#
# Gen LibraryClasses of Dec
@ -414,7 +414,7 @@ class Dec(DecObject):
# Get all Guids
#
RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_CLASS]
#
# 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])
self.TblDec.Exec(SqlCommand)
for Key in LibraryClasses.keys():
LibraryClass = LibraryClassClass()
LibraryClass.LibraryClass = Key[0]
@ -440,7 +440,7 @@ class Dec(DecObject):
LibraryClass.SupModuleList = SUP_MODULE_LIST
LibraryClass.SupArchList = LibraryClasses[Key]
self.Package.LibraryClassDeclarations.append(LibraryClass)
## GenPcds
#
# Gen Pcds of Dec
@ -460,7 +460,7 @@ class Dec(DecObject):
RecordSet3 = self.RecordSet[MODEL_PCD_FEATURE_FLAG]
RecordSet4 = self.RecordSet[MODEL_PCD_DYNAMIC_EX]
RecordSet5 = self.RecordSet[MODEL_PCD_DYNAMIC]
#
# Go through each arch
#
@ -508,7 +508,7 @@ class Dec(DecObject):
Pcd.ItemType = Key[5]
Pcd.SupArchList = Pcds[Key]
self.Package.PcdDeclarations.append(Pcd)
## Show detailed information of Package
#
# Print all members and their values of Package class
@ -550,14 +550,14 @@ class Dec(DecObject):
if __name__ == '__main__':
EdkLogger.Initialize()
EdkLogger.SetLevel(EdkLogger.DEBUG_0)
W = os.getenv('WORKSPACE')
F = os.path.join(W, 'Nt32Pkg/Nt32Pkg.dec')
Db = Database.Database('Dec.db')
Db.InitDatabase()
P = Dec(os.path.normpath(F), True, True, W, Db)
P.ShowPackage()
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
#
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.Package = PackageClass()
self.UserExtensions = ''
@ -92,23 +92,23 @@ class Dec(DecObject):
]
# Upper all KEYs to ignore case sensitive when parsing
self.KeyList = map(lambda c: c.upper(), self.KeyList)
# Init RecordSet
self.RecordSet = {}
self.RecordSet = {}
for Key in self.KeyList:
self.RecordSet[Section[Key]] = []
# Init Comment
self.SectionHeaderCommentDict = {}
# Load Dec file if filename is not None
if Filename != None:
self.LoadDecFile(Filename)
# Transfer to Package Object if IsToPackage is True
if IsToPackage:
self.DecToPackage()
## Load Dec file
#
# Load the file if it exists
@ -121,13 +121,13 @@ class Dec(DecObject):
self.Identification.FullPath = Filename
(self.Identification.RelaPath, self.Identification.FileName) = os.path.split(Filename)
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
IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \
[], [], TAB_UNKNOWN, [], [], []
LineNo = 0
# Parse file content
IsFindBlockComment = False
ReservedLine = ''
@ -136,7 +136,7 @@ class Dec(DecObject):
LineNo = LineNo + 1
# Remove comment block
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):
Comment = Comment + Line.strip() + '\n'
ReservedLine = ''
@ -147,7 +147,7 @@ class Dec(DecObject):
continue
if Line.find(TAB_COMMENT_EDK_END) > -1:
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 = ''
IsFindBlockComment = False
if IsFindBlockComment:
@ -160,7 +160,7 @@ class Dec(DecObject):
Line = CleanString(Line)
if Line == '':
continue
## Find a new section tab
# First insert previous section items
# And then parse the content of the new section
@ -173,7 +173,7 @@ class Dec(DecObject):
SectionItemList = []
ArchList = []
ThirdList = []
CurrentSection = ''
LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT)
for Item in LineList:
@ -182,7 +182,7 @@ class Dec(DecObject):
CurrentSection = ItemList[0]
else:
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:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
ItemList.append('')
@ -191,28 +191,28 @@ class Dec(DecObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else:
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())
ThirdList.append(ItemList[2])
if Comment:
if Comment.endswith('\n'):
Comment = Comment[:len(Comment) - len('\n')]
self.SectionHeaderCommentDict[Section[CurrentSection.upper()]] = Comment
Comment = ''
continue
# Not in any defined section
if CurrentSection == TAB_UNKNOWN:
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
SectionItemList.append([Line, LineNo, Comment])
Comment = ''
# End of parse
#End of For
#
# Insert items data of last section
#
@ -229,7 +229,7 @@ class Dec(DecObject):
SectionHeaderCommentDict = {}
if Package == None:
return Dec
PackageHeader = Package.PackageHeader
TmpList = []
if PackageHeader.Name:
@ -243,30 +243,30 @@ class Dec(DecObject):
if Package.UserExtensions != None:
for Item in Package.UserExtensions.Defines:
TmpList.append(Item)
DecList['Defines'] =TmpList
DecList['Defines'] = TmpList
if PackageHeader.Description != '':
SectionHeaderCommentDict['Defines'] = PackageHeader.Description
for Item in Package.Includes:
Key = 'Includes.' + Item.SupArchList
Value = Item.FilePath
GenMetaDatSectionItem(Key, Value, DecList)
for Item in Package.GuidDeclarations:
Key = 'Guids.' + Item.SupArchList
Value = Item.CName + '=' + Item.Guid
GenMetaDatSectionItem(Key, Value, DecList)
for Item in Package.ProtocolDeclarations:
Key = 'Protocols.' + Item.SupArchList
Value = Item.CName + '=' + Item.Guid
GenMetaDatSectionItem(Key, Value, DecList)
for Item in Package.PpiDeclarations:
Key = 'Ppis.' + Item.SupArchList
Value = Item.CName + '=' + Item.Guid
GenMetaDatSectionItem(Key, Value, DecList)
for Item in Package.LibraryClassDeclarations:
Key = 'LibraryClasses.' + Item.SupArchList
Value = Item.LibraryClass + '|' + Item.RecommendedInstance
@ -297,7 +297,7 @@ class Dec(DecObject):
else:
Dec = Dec + ' ' + Value + '\n'
Dec = Dec + '\n'
return Dec
## Transfer to Package Object
@ -307,10 +307,10 @@ class Dec(DecObject):
def DecToPackage(self):
# Init global information for the file
ContainerFile = self.Identification.FullPath
# Generate Package Header
self.GenPackageHeader(ContainerFile)
# Generate Includes
# Only for Edk
self.GenIncludes(ContainerFile)
@ -323,16 +323,16 @@ class Dec(DecObject):
# Generate Ppis
self.GenGuidProtocolPpis(DataType.TAB_PPIS, ContainerFile)
# Generate LibraryClasses
self.GenLibraryClasses(ContainerFile)
# Generate Pcds
self.GenPcds(ContainerFile)
# Init MiscFiles
self.GenMiscFiles(ContainerFile)
## GenMiscFiles
#
def GenMiscFiles(self, ContainerFile):
@ -343,7 +343,7 @@ class Dec(DecObject):
File.Filename = Item
MiscFiles.Files.append(File)
self.Package.MiscFiles = MiscFiles
## Get Package Header
#
# Gen Package Header of Dec as <Key> = <Value>
@ -375,23 +375,23 @@ class Dec(DecObject):
PackageHeader.DecSpecification = Value
else:
OtherDefines.append(Record[0])
PackageHeader.FileName = self.Identification.FileName
PackageHeader.FullPath = self.Identification.FullPath
PackageHeader.RelaPath = self.Identification.RelaPath
PackageHeader.PackagePath = self.Identification.PackagePath
PackageHeader.ModulePath = self.Identification.ModulePath
PackageHeader.CombinePath = os.path.normpath(os.path.join(PackageHeader.PackagePath, PackageHeader.ModulePath, PackageHeader.FileName))
if MODEL_META_DATA_HEADER in self.SectionHeaderCommentDict:
PackageHeader.Description = self.SectionHeaderCommentDict[MODEL_META_DATA_HEADER]
self.Package.PackageHeader = PackageHeader
UE = UserExtensionsClass()
UE.Defines = OtherDefines
self.Package.UserExtensions = UE
## GenIncludes
#
# Gen Includes of Dec
@ -403,7 +403,7 @@ class Dec(DecObject):
Includes = {}
# Get all Includes
RecordSet = self.RecordSet[MODEL_EFI_INCLUDE]
# Go through each arch
for Record in RecordSet:
Arch = Record[1]
@ -412,7 +412,7 @@ class Dec(DecObject):
Include.FilePath = NormPath(Key)
Include.SupArchList = Arch
self.Package.Includes.append(Include)
## GenPpis
#
# Gen Ppis of Dec
@ -425,12 +425,12 @@ class Dec(DecObject):
Lists = {}
# Get all Items
RecordSet = self.RecordSet[Section[Type.upper()]]
# Go through each arch
for Record in RecordSet:
Arch = Record[1]
(Name, Value) = GetGuidsProtocolsPpisOfDec(Record[0], Type, ContainerFile, Record[2])
ListMember = None
if Type == TAB_GUIDS:
ListMember = self.Package.GuidDeclarations
@ -438,13 +438,13 @@ class Dec(DecObject):
ListMember = self.Package.ProtocolDeclarations
elif Type == TAB_PPIS:
ListMember = self.Package.PpiDeclarations
ListClass = GuidProtocolPpiCommonClass()
ListClass.CName = Name
ListClass.Guid = Value
ListClass.SupArchList = Arch
ListMember.append(ListClass)
## GenLibraryClasses
#
# Gen LibraryClasses of Dec
@ -457,7 +457,7 @@ class Dec(DecObject):
LibraryClasses = {}
# Get all Guids
RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_CLASS]
# Go through each arch
for Record in RecordSet:
Arch = Record[1]
@ -469,7 +469,7 @@ class Dec(DecObject):
LibraryClass.RecommendedInstance = NormPath(List[1])
LibraryClass.SupArchList = Arch
self.Package.LibraryClassDeclarations.append(LibraryClass)
def AddPcd(self, CName, Token, TokenSpaceGuidCName, DatumType, DefaultValue, ItemType, Arch):
Pcd = CommonClass.PcdClass()
Pcd.CName = CName
@ -480,7 +480,7 @@ class Dec(DecObject):
Pcd.ItemType = ItemType
Pcd.SupArchList = Arch
self.Package.PcdDeclarations.append(Pcd)
## GenPcds
#
# Gen Pcds of Dec
@ -498,7 +498,7 @@ class Dec(DecObject):
RecordSet3 = self.RecordSet[MODEL_PCD_FEATURE_FLAG]
RecordSet4 = self.RecordSet[MODEL_PCD_DYNAMIC_EX]
RecordSet5 = self.RecordSet[MODEL_PCD_DYNAMIC]
# Go through each pcd
for Record in RecordSet1:
Arch = Record[1]
@ -520,7 +520,7 @@ class Dec(DecObject):
Arch = Record[1]
(TokenGuidCName, TokenName, DefaultValue, DatumType, Token, ItemType) = GetPcdOfDec(Record[0], TAB_PCDS_DYNAMIC, ContainerFile, Record[2])
self.AddPcd(TokenName, Token, TokenGuidCName, DatumType, DefaultValue, ItemType, Arch)
## Show detailed information of Package
#
# Print all members and their values of Package class
@ -533,7 +533,7 @@ class Dec(DecObject):
print 'PackagePath =', M.PackageHeader.PackagePath
print 'ModulePath =', M.PackageHeader.ModulePath
print 'CombinePath =', M.PackageHeader.CombinePath
print 'BaseName =', M.PackageHeader.Name
print 'Guid =', M.PackageHeader.Guid
print 'Version =', M.PackageHeader.Version
@ -571,7 +571,7 @@ class Dec(DecObject):
if __name__ == '__main__':
EdkLogger.Initialize()
EdkLogger.SetLevel(EdkLogger.QUIET)
W = os.getenv('WORKSPACE')
F = os.path.join(W, 'MdeModulePkg/MdeModulePkg.dec')

View File

@ -91,7 +91,7 @@ class DscObject(object):
class Dsc(DscObject):
_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.Platform = PlatformClass()
self.UserExtensions = ''
@ -460,7 +460,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report
#
def GenPcds(self, Type = '', ContainerFile = ''):
def GenPcds(self, Type='', ContainerFile=''):
Pcds = {}
if Type == DataType.TAB_PCDS_PATCHABLE_IN_MODULE:
Model = MODEL_PCD_PATCHABLE_IN_MODULE
@ -512,7 +512,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report
#
def GenFeatureFlagPcds(self, Type = '', ContainerFile = ''):
def GenFeatureFlagPcds(self, Type='', ContainerFile=''):
Pcds = {}
if Type == DataType.TAB_PCDS_FEATURE_FLAG:
Model = MODEL_PCD_FEATURE_FLAG
@ -562,7 +562,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report
#
def GenDynamicDefaultPcds(self, Type = '', ContainerFile = ''):
def GenDynamicDefaultPcds(self, Type='', ContainerFile=''):
Pcds = {}
SkuInfoList = {}
if Type == DataType.TAB_PCDS_DYNAMIC_DEFAULT:
@ -594,20 +594,20 @@ class Dsc(DscObject):
if CleanString(NewItem) == '':
continue
(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)
for Record in RecordSet:
if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper():
(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)
for Key in Pcds:
(Status, SkuInfoList) = self.GenSkuInfoList(Key[6], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', '', Key[2])
if Status == False:
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.SupArchList = Pcds[Key]
self.Platform.DynamicPcdBuildDefinitions.append(Pcd)
@ -619,7 +619,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report
#
def GenDynamicHiiPcds(self, Type = '', ContainerFile = ''):
def GenDynamicHiiPcds(self, Type='', ContainerFile=''):
Pcds = {}
SkuInfoList = {}
if Type == DataType.TAB_PCDS_DYNAMIC_HII:
@ -651,20 +651,20 @@ class Dsc(DscObject):
if CleanString(NewItem) == '':
continue
(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)
for Record in RecordSet:
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])
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)
for Key in Pcds:
(Status, SkuInfoList) = self.GenSkuInfoList(Key[8], self.Platform.SkuInfos.SkuInfoList, Key[2], Key[3], Key[4], Key[5], '', '')
if Status == False:
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.SupArchList = Pcds[Key]
self.Platform.DynamicPcdBuildDefinitions.append(Pcd)
@ -676,7 +676,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report
#
def GenDynamicVpdPcds(self, Type = '', ContainerFile = ''):
def GenDynamicVpdPcds(self, Type='', ContainerFile=''):
Pcds = {}
SkuInfoList = {}
if Type == DataType.TAB_PCDS_DYNAMIC_VPD:
@ -708,20 +708,20 @@ class Dsc(DscObject):
if CleanString(NewItem) == '':
continue
(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)
for Record in RecordSet:
if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper():
(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)
for Key in Pcds:
(Status, SkuInfoList) = self.GenSkuInfoList(Key[5], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', Key[2], '')
if Status == False:
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.SupArchList = Pcds[Key]
self.Platform.DynamicPcdBuildDefinitions.append(Pcd)
@ -769,7 +769,7 @@ class Dsc(DscObject):
SubLibSet = QueryDscItem(self.TblDsc, MODEL_EFI_LIBRARY_CLASS, Record[3], self.FileID)
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)
for SubBo in SubBoSet:
@ -806,7 +806,7 @@ class Dsc(DscObject):
#
# @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])
LibraryClasses = Item[1]
BuildOptions = Item[2]
@ -894,7 +894,7 @@ class Dsc(DscObject):
# @retval (False, SkuName) Not found in section SkuId 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)
if SkuNameList == None or SkuNameList == [] or SkuNameList == ['']:
SkuNameList = ['DEFAULT']
@ -964,7 +964,7 @@ class Dsc(DscObject):
(Value1, Value2, Value3, Model, StartColumn, EndColumn, Enabled) = ('', '', '', -1, -1, -1, 0)
if IfDefList == []:
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:
#
# Get New Dsc item ID
@ -1046,10 +1046,10 @@ class Dsc(DscObject):
# Remove comment block
#
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
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 = ''
IsFindBlockComment = False
if IsFindBlockComment:
@ -1087,7 +1087,7 @@ class Dsc(DscObject):
CurrentSection = ItemList[0]
else:
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:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
CurrentSection = TAB_UNKNOWN
@ -1098,7 +1098,7 @@ class Dsc(DscObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else:
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())
ThirdList.append(ItemList[2])
@ -1109,7 +1109,7 @@ class Dsc(DscObject):
#
if CurrentSection == TAB_UNKNOWN:
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
@ -1161,7 +1161,7 @@ class Dsc(DscObject):
MODEL_META_DATA_DEFINE)
RecordSet = self.TblDsc.Exec(SqlCommand)
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)
#
@ -1185,8 +1185,8 @@ class Dsc(DscObject):
MODEL_META_DATA_DEFINE)
RecordSet = self.TblDsc.Exec(SqlCommand)
for Record in RecordSet:
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)
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)
self.Cur.execute(SqlCommand)
#
@ -1210,13 +1210,13 @@ class Dsc(DscObject):
for Record in RecordSet:
if Record[0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_IF:
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)
else:
DisabledList.append(Record[1])
continue
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)
## Compare
@ -1227,7 +1227,7 @@ class Dsc(DscObject):
# @param Value2:
#
def Compare(self, Value1, CompareType, Value2):
Command = """Value1 %s Value2""" %CompareType
Command = """Value1 %s Value2""" % CompareType
return eval(Command)
## First time to insert records to database
@ -1259,7 +1259,7 @@ class Dsc(DscObject):
LineValue, StartLine, EndLine = SectionItem[0], SectionItem[1], SectionItem[1]
EdkLogger.debug(4, "Parsing %s ..." %LineValue)
EdkLogger.debug(4, "Parsing %s ..." % LineValue)
#
# Parse '!ifdef'
#
@ -1337,10 +1337,10 @@ class Dsc(DscObject):
Components = []
GetComponent(SectionItemList, 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)
for Item in Component[1]:
List = GetSplitValueList(Item, MaxSplit = 2)
List = GetSplitValueList(Item, MaxSplit=2)
LibName, LibIns = '', ''
if len(List) == 2:
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
#
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.Module = ModuleClass()
self.UserExtensions = ''
@ -353,10 +353,10 @@ class Inf(InfObject):
# Remove comment block
#
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
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 = ''
IsFindBlockComment = False
if IsFindBlockComment:
@ -397,7 +397,7 @@ class Inf(InfObject):
CurrentSection = ItemList[0]
else:
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:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
CurrentSection = TAB_UNKNOWN
@ -408,7 +408,7 @@ class Inf(InfObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else:
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())
ThirdList.append(ItemList[2])
@ -419,7 +419,7 @@ class Inf(InfObject):
#
if CurrentSection == TAB_UNKNOWN:
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
@ -497,13 +497,13 @@ class Inf(InfObject):
print Item.Name, Item.Value, Item.SupArchList
print '\nPcds =', 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
for Source in M.Sources:
print Source.SourceFile, 'Fam=', Source.ToolChainFamily, 'Pcd=', Source.FeatureFlag, 'Tag=', Source.TagName, 'ToolCode=', Source.ToolCode, Source.SupArchList
print '\nUserExtensions =', 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
for Item in M.Guids:
print Item.CName, Item.SupArchList, Item.FeatureFlag
@ -629,7 +629,7 @@ class Inf(InfObject):
if ModuleHeader.ComponentType in gComponentType2ModuleType:
ModuleHeader.ModuleType = gComponentType2ModuleType[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

View File

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

View File

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

View File

@ -59,8 +59,8 @@ class Check(object):
for Char in Line:
IndexOfChar += 1
if ord(Char) > 126:
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])
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])
# C Function Layout Checking
def FunctionLayoutCheck(self):
@ -251,7 +251,7 @@ class Check(object):
EdkLogger.quiet("Checking same struct ...")
AllStructure = {}
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)
for Record in RecordSet:
if Record[1] != '':
@ -265,7 +265,7 @@ class Check(object):
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])
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
def DeclCheckUnionType(self):
@ -365,7 +365,7 @@ class Check(object):
if Path.startswith('\\') or Path.startswith('/'):
Path = Path[1:]
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.
def IncludeFileCheckIfndef(self):
@ -526,7 +526,7 @@ class Check(object):
LibraryClasses[List[0]].append(Item)
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
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[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]):
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:
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
def MetaDataFileCheckLibraryInstanceDependent(self):
@ -571,7 +571,7 @@ class Check(object):
IsFound = True
if not IsFound:
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
def MetaDataFileCheckLibraryInstanceOrder(self):
@ -587,7 +587,7 @@ class Check(object):
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
for Record in RecordSet:
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
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')
""" % (MODEL_EFI_SOURCE_FILE, FilePath)
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):
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.
def MetaDataFileCheckPcdDuplicate(self):
@ -624,19 +624,19 @@ class Check(object):
and A.Enabled > -1
and B.Enabled > -1
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)
for Record in RecordSet:
SqlCommand1 = """select Name from File where ID = %s""" %Record[2]
SqlCommand2 = """select Name from File where ID = %s""" %Record[5]
SqlCommand1 = """select Name from File where ID = %s""" % Record[2]
SqlCommand2 = """select Name from File where ID = %s""" % Record[5]
DscFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand1)[0][0])[0]
FdfFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand2)[0][0])[0]
if DscFileName != FdfFileName:
continue
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]):
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 ...")
SqlCommand = """
@ -650,11 +650,11 @@ class Check(object):
and B.Enabled > -1
and A.BelongsToFile = B.BelongsToFile
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)
for Record in RecordSet:
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.
def MetaDataFileCheckPcdFlash(self):
@ -665,11 +665,11 @@ class Check(object):
where A.Model >= %s and Model < %s
and A.Enabled > -1
and A.Value2 not like '%%Flash%%'
"""% (MODEL_PCD, MODEL_META_DATA_HEADER)
""" % (MODEL_PCD, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblFdf.Exec(SqlCommand)
for Record in RecordSet:
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
def MetaDataFileCheckPcdNoUse(self):
@ -687,11 +687,11 @@ class Check(object):
(select Value2 from Fdf as C
where C.Model >= %s and C.Model < %s
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)
for Record in RecordSet:
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
def MetaDataFileCheckGuidDuplicate(self):
@ -735,7 +735,7 @@ class Check(object):
Path = Path.upper().replace('\X64', '').replace('\IA32', '').replace('\EBC', '').replace('\IPF', '').replace('\ARM', '')
if Path in InfPathList:
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
def MetaDataFileCheckPcdType(self):
@ -755,7 +755,7 @@ class Check(object):
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
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)
for Tbl in TableSet:
TblName = 'Identifier' + str(Tbl[0])
@ -768,11 +768,11 @@ class Check(object):
FunName = Record[0]
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'):
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')):
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')):
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
pass
@ -806,7 +806,7 @@ class Check(object):
if InfPath1 and InfPath2:
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)
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
@ -822,6 +822,7 @@ class Check(object):
select A.ID, A.Value1 from %s as A, %s as B
where A.Model = %s and B.Model = %s
and A.Value1 = B.Value1 and A.ID <> B.ID
and A.Arch = B.Arch
and A.Enabled > -1
and B.Enabled > -1
group by A.ID
@ -829,7 +830,7 @@ class Check(object):
RecordSet = Table.Exec(SqlCommand)
for Record in RecordSet:
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
def CheckGuidProtocolPpiValue(self, ErrorID, Model):
@ -845,12 +846,13 @@ class Check(object):
select A.ID, A.Value2 from %s as A, %s as B
where A.Model = %s and B.Model = %s
and A.Value2 = B.Value2 and A.ID <> B.ID
and A.Arch = B.Arch
group by A.ID
""" % (Table.Table, Table.Table, Model, Model)
RecordSet = Table.Exec(SqlCommand)
for Record in RecordSet:
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
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':
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)
for Record in RecordSet:
Name = Record[1].strip().split()[1]
@ -891,14 +893,14 @@ class Check(object):
Name = Name[0:Name.find('(')]
if Name.upper() != 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
def NamingConventionCheckTypedefStatement(self, FileTable):
if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
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)
for Record in RecordSet:
Name = Record[1].strip()
@ -911,20 +913,20 @@ class Check(object):
Name = Name.replace('*', '').strip()
if Name.upper() != 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, '_'.
def NamingConventionCheckIfndefStatement(self, FileTable):
if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
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)
for Record in RecordSet:
Name = Record[1].replace('#ifndef', '').strip()
if Name[0] != '_' or Name[-1] != '_':
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
# 1. First character should be upper case
@ -940,7 +942,7 @@ class Check(object):
for Record in RecordSet:
if not Pattern.match(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
# 1. First character should be upper case
@ -953,12 +955,12 @@ class Check(object):
EdkLogger.quiet("Checking naming covention of variable name ...")
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)
for Record in RecordSet:
if not Pattern.match(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
# 1. First character should be upper case
@ -974,20 +976,20 @@ class Check(object):
for Record in RecordSet:
if not Pattern.match(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
def NamingConventionCheckSingleCharacterVariable(self, FileTable):
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 ...")
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)
for Record in RecordSet:
Variable = Record[1].replace('*', '')
if len(Variable) == 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()
# Remove comment block
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
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 = ''
IsFindBlockComment = False
if IsFindBlockComment:

View File

@ -1118,6 +1118,34 @@ class FdfParser:
def SetFileBufferPos(self, 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
#
# Parse the file profile buffer to extract fd, fv ... information
@ -1128,26 +1156,7 @@ class FdfParser:
def ParseFile(self):
try:
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
self.Preprocess()
while self.__GetFd():
pass

View File

@ -660,10 +660,10 @@ def RemoveBlockComment(Lines):
# Remove comment block
#
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
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 = ''
IsFindBlockComment = False
if IsFindBlockComment:

View File

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