Fix some bugs and remove unused code.
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 7 Aug 2006 08:21:32 +0000 (08:21 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 7 Aug 2006 08:21:32 +0000 (08:21 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1201 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java
Tools/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/Token.java

index 614bd9e..5928061 100644 (file)
@@ -195,7 +195,7 @@ public class PCDAutoGenAction extends BuildAction {
 \r
         usageInstanceArray = null;\r
         if (!isBuildUsedLibrary) {\r
-            usageInstanceArray  = dbManager.getUsageInstanceArrayByModuleName(usageId);\r
+            usageInstanceArray  = dbManager.getUsageInstanceArrayById(usageId);\r
             MemoryDatabaseManager.UsageInstanceContext = usageInstanceArray;\r
             MemoryDatabaseManager.CurrentModuleName    = moduleName;\r
         } else if ((pcdNameArrayInMsa != null) && (pcdNameArrayInMsa.length > 0)) {\r
@@ -205,7 +205,7 @@ public class PCDAutoGenAction extends BuildAction {
             // these library should be used to autogen.\r
             //\r
             if (usageContext == null) {\r
-                usageInstanceArray  = dbManager.getUsageInstanceArrayByModuleName(usageId);\r
+                usageInstanceArray  = dbManager.getUsageInstanceArrayById(usageId);\r
             } else {\r
                 usageInstanceArray = new ArrayList<UsageInstance>();\r
 \r
index f2d5247..42d682d 100644 (file)
@@ -159,9 +159,9 @@ public abstract class PlatformPcdPreprocessAction {
 \r
     public void putError(String error) {\r
         if (errorString == null) {\r
-            errorString = "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n\r\n";\r
+            errorString = "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n";\r
         } else {\r
-            errorString += "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n\r\n";\r
+            errorString += "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n";\r
         }\r
 \r
         errorCount++;\r
index 2962e74..62789fe 100644 (file)
@@ -220,21 +220,6 @@ public class MemoryDatabaseManager {
         }\r
     }\r
 \r
-    /**\r
-      Get all PCD record for a module according to module's name, module's GUID,\r
-      package name, package GUID, arch, version information.\r
-\r
-      @param usageId   the id of UsageInstance.\r
-\r
-      @return  all usage instance for this module in memory database.\r
-    **/\r
-    public List<UsageInstance> getUsageInstanceArrayByModuleName(UsageIdentification usageId) {\r
-\r
-        String primaryKey = UsageInstance.getPrimaryKey(usageId);\r
-\r
-        return getUsageInstanceArrayByKeyString(primaryKey);\r
-    }\r
-\r
     public void clearDatabase() {\r
         memoryDatabase.clear();\r
     }\r
@@ -246,14 +231,15 @@ public class MemoryDatabaseManager {
 \r
        @return List<UsageInstance>  the list contains all usage instances.\r
     **/\r
-    public List<UsageInstance> getUsageInstanceArrayByKeyString(String primaryKey) {\r
+    public List<UsageInstance> getUsageInstanceArrayById(UsageIdentification usageId) {\r
         Token[]               tokenArray          = null;\r
         int                   recordIndex         = 0;\r
         UsageInstance         usageInstance       = null;\r
         List<UsageInstance>   returnArray         = new ArrayList<UsageInstance>();\r
+        String                primaryKey          = usageId.toString();\r
 \r
         tokenArray = getRecordArray();\r
-\r
+        \r
         //\r
         // Loop to find all PCD record related to current module\r
         //\r
@@ -269,19 +255,34 @@ public class MemoryDatabaseManager {
         return returnArray;\r
     }\r
 \r
+    public List<Token> getPcdTokenListForModule(UsageIdentification usageId) {\r
+        List<UsageInstance> usageList = getUsageInstanceArrayById(usageId);\r
+        List<Token>         tokenList = new ArrayList<Token>();\r
+\r
+        if (usageList == null) {\r
+            return null;\r
+        }\r
+\r
+        for (int usageIndex = 0; usageIndex < usageList.size(); usageIndex++) {\r
+            tokenList.add(usageList.get(usageIndex).parentToken);\r
+        }\r
+\r
+        return tokenList;\r
+    }\r
+\r
     /**\r
       Get all modules name who contains PCD information\r
 \r
-      @return Array for module name\r
+      @return Array for usage's identification\r
     **/\r
-    public List<String> getAllModuleArray()\r
+    public List<UsageIdentification> getAllModuleArray()\r
     {\r
         int                       tokenIndex    = 0;\r
         int                       usageIndex    = 0;\r
         int                       moduleIndex   = 0;\r
         Token[]                   tokenArray    = null;\r
         Object[]                  usageInstanceArray = null;\r
-        List<String>              moduleNames   = new ArrayList<String>();\r
+        List<UsageIdentification> usageArray    = new ArrayList<UsageIdentification>();\r
         UsageInstance             usageInstance = null;\r
         boolean                   bFound        = false;\r
         String                    primaryKey    = null;\r
@@ -296,17 +297,17 @@ public class MemoryDatabaseManager {
                 usageInstance = (UsageInstance)((Map.Entry)usageInstanceArray[usageIndex]).getValue();\r
                 primaryKey    = usageInstance.getPrimaryKey();\r
                 bFound        = false;\r
-                for (moduleIndex = 0; moduleIndex < moduleNames.size(); moduleIndex++) {\r
-                    if (moduleNames.get(moduleIndex).equalsIgnoreCase(primaryKey)) {\r
+                for (moduleIndex = 0; moduleIndex < usageArray.size(); moduleIndex++) {\r
+                    if (usageArray.get(moduleIndex).toString().equalsIgnoreCase(primaryKey)) {\r
                         bFound = true;\r
                         break;\r
                     }\r
                 }\r
                 if (!bFound) {\r
-                    moduleNames.add(primaryKey);\r
+                    usageArray.add(usageInstance.usageId);\r
                 }\r
             }\r
         }\r
-        return moduleNames;\r
+        return usageArray;\r
     }\r
 }\r
index 1038cb0..ed71742 100644 (file)
@@ -193,7 +193,7 @@ public class Token {
         if (tokenSpaceName == null) {\r
             return cName + "_nullTokenSpaceGuid";\r
         } else {\r
-            return cName + "_" + tokenSpaceName.toString().replace('-', '_');\r
+            return cName + "_" + tokenSpaceName.toString().replace('-', '_').toLowerCase();\r
         }\r
     }\r
 \r