summaryrefslogtreecommitdiff
path: root/Tools/Source/PcdTools
diff options
context:
space:
mode:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-07 08:21:32 +0000
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-07 08:21:32 +0000
commitb6297711809e23f322ba99177445670b56f28973 (patch)
tree664ccee184ea2d50b3117345d38865c904746a8a /Tools/Source/PcdTools
parent74c0c087a2a7ed32dcbc8a91c9466b01430a241c (diff)
downloadedk2-platforms-b6297711809e23f322ba99177445670b56f28973.tar.xz
Fix some bugs and remove unused code.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1201 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Source/PcdTools')
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java4
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java49
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/entity/Token.java2
3 files changed, 28 insertions, 27 deletions
diff --git a/Tools/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java b/Tools/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java
index f2d52475ae..42d682d0a8 100644
--- a/Tools/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java
@@ -159,9 +159,9 @@ public abstract class PlatformPcdPreprocessAction {
public void putError(String error) {
if (errorString == null) {
- errorString = "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n\r\n";
+ errorString = "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n";
} else {
- errorString += "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n\r\n";
+ errorString += "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n";
}
errorCount++;
diff --git a/Tools/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java b/Tools/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java
index 2962e748a2..62789fe4c9 100644
--- a/Tools/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java
@@ -220,21 +220,6 @@ public class MemoryDatabaseManager {
}
}
- /**
- Get all PCD record for a module according to module's name, module's GUID,
- package name, package GUID, arch, version information.
-
- @param usageId the id of UsageInstance.
-
- @return all usage instance for this module in memory database.
- **/
- public List<UsageInstance> getUsageInstanceArrayByModuleName(UsageIdentification usageId) {
-
- String primaryKey = UsageInstance.getPrimaryKey(usageId);
-
- return getUsageInstanceArrayByKeyString(primaryKey);
- }
-
public void clearDatabase() {
memoryDatabase.clear();
}
@@ -246,14 +231,15 @@ public class MemoryDatabaseManager {
@return List<UsageInstance> the list contains all usage instances.
**/
- public List<UsageInstance> getUsageInstanceArrayByKeyString(String primaryKey) {
+ public List<UsageInstance> getUsageInstanceArrayById(UsageIdentification usageId) {
Token[] tokenArray = null;
int recordIndex = 0;
UsageInstance usageInstance = null;
List<UsageInstance> returnArray = new ArrayList<UsageInstance>();
+ String primaryKey = usageId.toString();
tokenArray = getRecordArray();
-
+
//
// Loop to find all PCD record related to current module
//
@@ -269,19 +255,34 @@ public class MemoryDatabaseManager {
return returnArray;
}
+ public List<Token> getPcdTokenListForModule(UsageIdentification usageId) {
+ List<UsageInstance> usageList = getUsageInstanceArrayById(usageId);
+ List<Token> tokenList = new ArrayList<Token>();
+
+ if (usageList == null) {
+ return null;
+ }
+
+ for (int usageIndex = 0; usageIndex < usageList.size(); usageIndex++) {
+ tokenList.add(usageList.get(usageIndex).parentToken);
+ }
+
+ return tokenList;
+ }
+
/**
Get all modules name who contains PCD information
- @return Array for module name
+ @return Array for usage's identification
**/
- public List<String> getAllModuleArray()
+ public List<UsageIdentification> getAllModuleArray()
{
int tokenIndex = 0;
int usageIndex = 0;
int moduleIndex = 0;
Token[] tokenArray = null;
Object[] usageInstanceArray = null;
- List<String> moduleNames = new ArrayList<String>();
+ List<UsageIdentification> usageArray = new ArrayList<UsageIdentification>();
UsageInstance usageInstance = null;
boolean bFound = false;
String primaryKey = null;
@@ -296,17 +297,17 @@ public class MemoryDatabaseManager {
usageInstance = (UsageInstance)((Map.Entry)usageInstanceArray[usageIndex]).getValue();
primaryKey = usageInstance.getPrimaryKey();
bFound = false;
- for (moduleIndex = 0; moduleIndex < moduleNames.size(); moduleIndex++) {
- if (moduleNames.get(moduleIndex).equalsIgnoreCase(primaryKey)) {
+ for (moduleIndex = 0; moduleIndex < usageArray.size(); moduleIndex++) {
+ if (usageArray.get(moduleIndex).toString().equalsIgnoreCase(primaryKey)) {
bFound = true;
break;
}
}
if (!bFound) {
- moduleNames.add(primaryKey);
+ usageArray.add(usageInstance.usageId);
}
}
}
- return moduleNames;
+ return usageArray;
}
}
diff --git a/Tools/Source/PcdTools/org/tianocore/pcd/entity/Token.java b/Tools/Source/PcdTools/org/tianocore/pcd/entity/Token.java
index 1038cb021c..ed717421f0 100644
--- a/Tools/Source/PcdTools/org/tianocore/pcd/entity/Token.java
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/entity/Token.java
@@ -193,7 +193,7 @@ public class Token {
if (tokenSpaceName == null) {
return cName + "_nullTokenSpaceGuid";
} else {
- return cName + "_" + tokenSpaceName.toString().replace('-', '_');
+ return cName + "_" + tokenSpaceName.toString().replace('-', '_').toLowerCase();
}
}