]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Ecc/Configuration.py
Sync EDKII BaseTools to BaseTools project r2042.
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / Configuration.py
index 310cb5716bfa5875e5ec756dfeb6eb546f7990fc..1478ee6351bae5e3807ad3819b81ada3d872d874 100644 (file)
@@ -28,7 +28,7 @@ from Common.String import *
 class Configuration(object):\r
     def __init__(self, Filename):\r
         self.Filename = Filename\r
-        \r
+\r
         self.Version = 0.1\r
 \r
         ## Identify to if check all items\r
@@ -49,14 +49,14 @@ class Configuration(object):
         # SpaceCheckAll\r
         #\r
         self.AutoCorrect = 0\r
-        \r
+\r
         # List customized Modifer here, split with ','\r
         # Defaultly use the definition in class DataType\r
         self.ModifierList = MODIFIER_LIST\r
-        \r
+\r
         ## General Checking\r
         self.GeneralCheckAll = 0\r
-        \r
+\r
         # Check whether NO Tab is used, replaced with spaces\r
         self.GeneralCheckNoTab = 1\r
         # The width of Tab\r
@@ -77,31 +77,33 @@ class Configuration(object):
         self.GeneralCheckCarriageReturn = 1\r
         # Check whether the file exists\r
         self.GeneralCheckFileExistence = 1\r
-        \r
+        # Check whether file has non ACSII char\r
+        self.GeneralCheckNonAcsii = 1\r
+\r
         ## Space Checking\r
         self.SpaceCheckAll = 1\r
-        \r
+\r
         ## Predicate Expression Checking\r
         self.PredicateExpressionCheckAll = 0\r
-        \r
+\r
         # Check whether Boolean values, variable type BOOLEAN not use explicit comparisons to TRUE or FALSE\r
         self.PredicateExpressionCheckBooleanValue = 1\r
-        # Check whether Non-Boolean comparisons use a compare operator (==, !=, >, < >=, <=). \r
+        # Check whether Non-Boolean comparisons use a compare operator (==, !=, >, < >=, <=).\r
         self.PredicateExpressionCheckNonBooleanOperator = 1\r
         # Check whether a comparison of any pointer to zero must be done via the NULL type\r
         self.PredicateExpressionCheckComparisonNullType = 1\r
-        \r
+\r
         ## Headers Checking\r
         self.HeaderCheckAll = 0\r
-        \r
+\r
         # Check whether File header exists\r
         self.HeaderCheckFile = 1\r
         # Check whether Function header exists\r
         self.HeaderCheckFunction = 1\r
-        \r
+\r
         ## C Function Layout Checking\r
         self.CFunctionLayoutCheckAll = 0\r
-        \r
+\r
         # Check whether return type exists and in the first line\r
         self.CFunctionLayoutCheckReturnType = 1\r
         # Check whether any optional functional modifiers exist and next to the return type\r
@@ -119,10 +121,10 @@ class Configuration(object):
         self.CFunctionLayoutCheckNoInitOfVariable = 1\r
         # Check whether no use of STATIC for functions\r
         self.CFunctionLayoutCheckNoStatic = 1\r
-        \r
+\r
         ## Include Files Checking\r
         self.IncludeFileCheckAll = 0\r
-        \r
+\r
         #Check whether having include files with same name\r
         self.IncludeFileCheckSameName = 1\r
         # Check whether all include file contents is guarded by a #ifndef statement.\r
@@ -132,10 +134,10 @@ class Configuration(object):
         # Check whether include files contain only public or only private data\r
         # Check whether include files NOT contain code or define data variables\r
         self.IncludeFileCheckData = 1\r
-        \r
+\r
         ## Declarations and Data Types Checking\r
         self.DeclarationDataTypeCheckAll = 0\r
-        \r
+\r
         # Check whether no use of int, unsigned, char, void, static, long in any .c, .h or .asl files.\r
         self.DeclarationDataTypeCheckNoUseCType = 1\r
         # Check whether the modifiers IN, OUT, OPTIONAL, and UNALIGNED are used only to qualify arguments to a function and should not appear in a data type declaration\r
@@ -150,10 +152,10 @@ class Configuration(object):
         self.DeclarationDataTypeCheckSameStructure = 1\r
         # Check whether Union Type has a 'typedef' and the name is capital\r
         self.DeclarationDataTypeCheckUnionType = 1\r
-        \r
+\r
         ## Naming Conventions Checking\r
         self.NamingConventionCheckAll = 0\r
-        \r
+\r
         # Check whether only capital letters are used for #define declarations\r
         self.NamingConventionCheckDefineStatement = 1\r
         # Check whether only capital letters are used for typedef declarations\r
@@ -172,33 +174,33 @@ class Configuration(object):
         self.NamingConventionCheckFunctionName = 1\r
         # Check whether NO use short variable name with single character\r
         self.NamingConventionCheckSingleCharacterVariable = 1\r
-        \r
+\r
         ## Doxygen Checking\r
         self.DoxygenCheckAll = 0\r
-        \r
+\r
         # Check whether the file headers are followed Doxygen special documentation blocks in section 2.3.5\r
         self.DoxygenCheckFileHeader = 1\r
         # Check whether the function headers are followed Doxygen special documentation blocks in section 2.3.5\r
         self.DoxygenCheckFunctionHeader = 1\r
-        # Check whether the first line of text in a comment block is a brief description of the element being documented. \r
+        # Check whether the first line of text in a comment block is a brief description of the element being documented.\r
         # The brief description must end with a period.\r
         self.DoxygenCheckCommentDescription = 1\r
         # Check whether comment lines with '///< ... text ...' format, if it is used, it should be after the code section.\r
         self.DoxygenCheckCommentFormat = 1\r
         # Check whether only Doxygen commands allowed to mark the code are @bug and @todo.\r
         self.DoxygenCheckCommand = 1\r
-        \r
+\r
         ## Meta-Data File Processing Checking\r
         self.MetaDataFileCheckAll = 0\r
-        \r
+\r
         # Check whether each file defined in meta-data exists\r
         self.MetaDataFileCheckPathName = 1\r
         # Generate a list for all files defined in meta-data files\r
         self.MetaDataFileCheckGenerateFileList = 1\r
         # The path of log file\r
         self.MetaDataFileCheckPathOfGenerateFileList = 'File.log'\r
-        # Check whether all Library Instances defined for a given module (or dependent library instance) match the module's type.  \r
-        # Each Library Instance must specify the Supported Module Types in its INF file, \r
+        # Check whether all Library Instances defined for a given module (or dependent library instance) match the module's type.\r
+        # Each Library Instance must specify the Supported Module Types in its INF file,\r
         # and any module specifying the library instance must be one of the supported types.\r
         self.MetaDataFileCheckLibraryInstance = 1\r
         # Check whether a Library Instance has been defined for all dependent library classes\r
@@ -235,14 +237,17 @@ class Configuration(object):
         # The directory listed here will not be parsed, split with ','\r
         self.SkipDirList = []\r
 \r
+        # A list for binary file ext name\r
+        self.BinaryExtList = []\r
+\r
         self.ParseConfig()\r
-        \r
+\r
     def ParseConfig(self):\r
         Filepath = os.path.normpath(self.Filename)\r
         if not os.path.isfile(Filepath):\r
             ErrorMsg = "Can't find configuration file '%s'" % Filepath\r
             EdkLogger.error("Ecc", EdkLogger.ECC_ERROR, ErrorMsg, File = Filepath)\r
-        \r
+\r
         LineNo = 0\r
         for Line in open(Filepath, 'r'):\r
             LineNo = LineNo + 1\r
@@ -258,8 +263,10 @@ class Configuration(object):
                     continue\r
                 if List[0] == 'SkipDirList':\r
                     List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)\r
+                if List[0] == 'BinaryExtList':\r
+                    List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)\r
                 self.__dict__[List[0]] = List[1]\r
-    \r
+\r
     def ShowMe(self):\r
         print self.Filename\r
         for Key in self.__dict__.keys():\r