]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java
Refine the code for PCD tools.
[mirror_edk2.git] / Tools / Source / PcdTools / org / tianocore / pcd / action / PlatformPcdPreprocessAction.java
index 9343c1689d09365a4ab0205d48ecae4b17d056ee..ee91f2a8e8aaede47fcdc3207585f96ef2f2de54 100644 (file)
@@ -58,6 +58,7 @@ public abstract class PlatformPcdPreprocessAction {
     public PlatformPcdPreprocessAction() {\r
         pcdDbManager = null;\r
         errorString  = null;\r
     public PlatformPcdPreprocessAction() {\r
         pcdDbManager = null;\r
         errorString  = null;\r
+       errorCount   = 0;\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -77,12 +78,13 @@ public abstract class PlatformPcdPreprocessAction {
     public MemoryDatabaseManager getPcdDbManager() {\r
         return pcdDbManager;\r
     }\r
     public MemoryDatabaseManager getPcdDbManager() {\r
         return pcdDbManager;\r
     }\r
+\r
     /**\r
        Abstract function: retrieve module information from FPD file.\r
 \r
        In building environement, this function will be implementated by FpdParserTask.\r
 \r
     /**\r
        Abstract function: retrieve module information from FPD file.\r
 \r
        In building environement, this function will be implementated by FpdParserTask.\r
 \r
-       @return List<ModuleInfo>                  the component array.\r
+       @return List<ModulePcdInfoFromFpd>        the component array.\r
        @throws PlatformPcdPreprocessException    get all modules in <ModuleSA> in FPD file.\r
 \r
     **/\r
        @throws PlatformPcdPreprocessException    get all modules in <ModuleSA> in FPD file.\r
 \r
     **/\r
@@ -100,8 +102,7 @@ public abstract class PlatformPcdPreprocessAction {
        @throws PlatformPcdPreprocessException\r
                             Fail to get Guid information from SPD file.\r
     **/\r
        @throws PlatformPcdPreprocessException\r
                             Fail to get Guid information from SPD file.\r
     **/\r
-    public abstract String                  getGuidInfoFromSpd(String guidCName)\r
-                                            throws PlatformPcdPreprocessException;\r
+    public abstract String getGuidInfoFromSpd(String guidCName) throws PlatformPcdPreprocessException;\r
 \r
     /**\r
        Abstract function: Verification the PCD data.\r
 \r
     /**\r
        Abstract function: Verification the PCD data.\r
@@ -118,11 +119,8 @@ public abstract class PlatformPcdPreprocessAction {
        @return String       exception strings.\r
 \r
     **/\r
        @return String       exception strings.\r
 \r
     **/\r
-    public abstract String                  verifyDatum(String            cName,\r
-                                                        String            moduleName,\r
-                                                        String            datum,\r
-                                                        Token.DATUM_TYPE  datumType,\r
-                                                        int               maxDatumSize);\r
+    public abstract String verifyDatum(String cName, String moduleName, String datum,\r
+                                       Token.DATUM_TYPE  datumType, int maxDatumSize);\r
 \r
     /**\r
        Abstract function: Get dynamic information for a token\r
 \r
     /**\r
        Abstract function: Get dynamic information for a token\r
@@ -173,22 +171,23 @@ public abstract class PlatformPcdPreprocessAction {
     **/\r
     public void initPcdMemoryDbWithPlatformInfo()\r
         throws PlatformPcdPreprocessException {\r
     **/\r
     public void initPcdMemoryDbWithPlatformInfo()\r
         throws PlatformPcdPreprocessException {\r
-        int                                 index             = 0;\r
-        int                                 pcdIndex          = 0;\r
+        int                                 index;\r
+        int                                 pcdIndex;\r
         List<PcdBuildDefinition.PcdData>    pcdBuildDataArray = new ArrayList<PcdBuildDefinition.PcdData>();\r
         List<PcdBuildDefinition.PcdData>    pcdBuildDataArray = new ArrayList<PcdBuildDefinition.PcdData>();\r
-        PcdBuildDefinition.PcdData          pcdBuildData      = null;\r
+        PcdBuildDefinition.PcdData          pcdBuildData;\r
         Token                               token             = null;\r
         Token                               token             = null;\r
-        List<ModulePcdInfoFromFpd>          modules           = null;\r
-        String                              primaryKey        = null;\r
-        String                              exceptionString   = null;\r
-        UsageInstance                       usageInstance     = null;\r
+        List<ModulePcdInfoFromFpd>          modules;\r
+        String                              primaryKey;\r
+        String                              exceptionString;\r
+        UsageInstance                       usageInstance;\r
         Token.PCD_TYPE                      pcdType           = Token.PCD_TYPE.UNKNOWN;\r
         Token.DATUM_TYPE                    datumType         = Token.DATUM_TYPE.UNKNOWN;\r
         Token.PCD_TYPE                      pcdType           = Token.PCD_TYPE.UNKNOWN;\r
         Token.DATUM_TYPE                    datumType         = Token.DATUM_TYPE.UNKNOWN;\r
-        long                                tokenNumber       = 0;\r
-        String                              moduleName        = null;\r
-        String                              datum             = null;\r
-        int                                 maxDatumSize      = 0;\r
-        String                              tokenSpaceStrRet  = null;\r
+        long                                tokenNumber;\r
+        String                              moduleName;\r
+        String                              datum;\r
+        int                                 maxDatumSize;\r
+        String                              tokenSpaceStrRet;\r
+        ModulePcdInfoFromFpd                curModule;\r
 \r
         //\r
         // ----------------------------------------------\r
 \r
         //\r
         // ----------------------------------------------\r
@@ -208,16 +207,17 @@ public abstract class PlatformPcdPreprocessAction {
         // -------------------------------------------------------------------\r
         //\r
         for (index = 0; index < modules.size(); index++) {\r
         // -------------------------------------------------------------------\r
         //\r
         for (index = 0; index < modules.size(); index++) {\r
-           //\r
+            curModule = modules.get(index);\r
+\r
+            //\r
            // It is legal for a module does not contains ANY pcd build definitions.\r
            //\r
            // It is legal for a module does not contains ANY pcd build definitions.\r
            //\r
-           if (modules.get(index).pcdBuildDefinition == null) {\r
+           if (curModule.pcdBuildDefinition == null) {\r
                 continue;\r
            }\r
 \r
                 continue;\r
            }\r
 \r
-            pcdBuildDataArray = modules.get(index).pcdBuildDefinition.getPcdDataList();\r
-\r
-            moduleName = modules.get(index).usageId.moduleName;\r
+            pcdBuildDataArray = curModule.pcdBuildDefinition.getPcdDataList();\r
+            moduleName        = curModule.usageId.moduleName;\r
 \r
             //\r
             // ----------------------------------------------------------------------\r
 \r
             //\r
             // ----------------------------------------------------------------------\r
@@ -433,7 +433,7 @@ public abstract class PlatformPcdPreprocessAction {
                 // ------------------------------------------------\r
                 //\r
                 usageInstance = new UsageInstance(token,\r
                 // ------------------------------------------------\r
                 //\r
                 usageInstance = new UsageInstance(token,\r
-                                                  modules.get(index).usageId,\r
+                                                  curModule.usageId,\r
                                                   pcdType,\r
                                                   datum,\r
                                                   maxDatumSize);\r
                                                   pcdType,\r
                                                   datum,\r
                                                   maxDatumSize);\r
@@ -441,7 +441,7 @@ public abstract class PlatformPcdPreprocessAction {
                     putError(String.format("PCD %s for module %s(%s) already exists in the database.\nPlease check all PCD build entries "+\r
                                            "in the %s module's <ModuleSA> section to make sure there are no duplicated definitions in the FPD file!",\r
                                            token.cName,\r
                     putError(String.format("PCD %s for module %s(%s) already exists in the database.\nPlease check all PCD build entries "+\r
                                            "in the %s module's <ModuleSA> section to make sure there are no duplicated definitions in the FPD file!",\r
                                            token.cName,\r
-                                           modules.get(index).usageId.moduleGuid,\r
+                                           curModule.usageId.moduleGuid,\r
                                            moduleName,\r
                                            moduleName));\r
                     continue;\r
                                            moduleName,\r
                                            moduleName));\r
                     continue;\r