diff options
author | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-31 18:55:26 +0000 |
---|---|---|
committer | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-31 18:55:26 +0000 |
commit | d14ebb43742f411f2a013996b8e76bcab2420552 (patch) | |
tree | 5ff0ad6c323200b2bff4d8a1180eedbab37f3b13 /Tools/Source/GenBuild/org | |
parent | 58d8da3cf9641a8d37d652ecd7aa06cb07895a4e (diff) | |
download | edk2-d14ebb43742f411f2a013996b8e76bcab2420552.tar.gz edk2-d14ebb43742f411f2a013996b8e76bcab2420552.tar.bz2 edk2-d14ebb43742f411f2a013996b8e76bcab2420552.zip |
Because Pcd entity, exception and some action package are shared by Building tools and Wizard Tools, so I move them to Tools/Source folder and generated PcdTools.jar,
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1160 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Source/GenBuild/org')
14 files changed, 48 insertions, 2137 deletions
diff --git a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java index 39d4d6f2d4..bd87b6e0f2 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java +++ b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java @@ -39,7 +39,7 @@ import org.tianocore.build.global.SurfaceAreaQuery; import org.tianocore.build.id.FpdModuleIdentification;
import org.tianocore.build.id.ModuleIdentification;
import org.tianocore.build.id.PlatformIdentification;
-import org.tianocore.build.pcd.action.ActionMessage;
+import org.tianocore.pcd.action.ActionMessage;
import org.tianocore.build.pcd.action.CollectPCDAction;
import org.tianocore.build.toolchain.ToolChainAttribute;
import org.tianocore.build.toolchain.ToolChainElement;
diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java index a769816720..b02af3df66 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java @@ -35,7 +35,7 @@ import org.tianocore.build.id.FpdModuleIdentification; import org.tianocore.build.id.ModuleIdentification;
import org.tianocore.build.id.PackageIdentification;
import org.tianocore.build.id.PlatformIdentification;
-import org.tianocore.build.pcd.entity.MemoryDatabaseManager;
+import org.tianocore.pcd.entity.MemoryDatabaseManager;
import org.tianocore.build.toolchain.ToolChainAttribute;
import org.tianocore.build.toolchain.ToolChainConfig;
import org.tianocore.build.toolchain.ToolChainElement;
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/ActionMessage.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/ActionMessage.java deleted file mode 100644 index d993fab6ec..0000000000 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/ActionMessage.java +++ /dev/null @@ -1,122 +0,0 @@ -/** @file
- ActionMessage class.
-
- ActionMessage class take over all message for loging and waning. This class should
- dispatch message into different class according to instance class type.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.build.pcd.action;
-
-import org.apache.tools.ant.Task;
-import org.tianocore.build.pcd.action.BuildAction;
-
-/** ActionMessage class take over all message for loging and waning. This class
- should dispatch message into different Action class according to instance
- class type.
-**/
-public class ActionMessage {
- ///
- /// Macro definition for NULL messge level.
- /// In this meessage level, all message will be hidden.
- ///
- public final static int NULL_MESSAGE_LEVEL = 0;
- ///
- /// Macro definition for Log messge level.
- /// In this message level, Only log information will be shown.
- ///
- public final static int LOG_MESSAGE_LEVEL = 1;
- ///
- /// Macro definition for Warning message level.
- /// In this message level, log and waning message will be shown.
- ///
- public final static int WARNING_MESSAGE_LEVEL = 2;
- ///
- /// Macro definition for Debug mesage level.
- /// In this message level, log, warning, debug message will be shown.
- ///
- public final static int DEBUG_MESSAGE_LEVEL = 3;
- ///
- /// Macor definition for MAX message level.
- /// In this message level, all message will be shown.
- ///
- public final static int MAX_MESSAGE_LEVEL = 4;
- ///
- /// Current message level. It will control all message output for PCD tool.
- ///
- public static int messageLevel = NULL_MESSAGE_LEVEL;
-
- /**
- Log() function provide common log information functionality for all
- PCD tool includes all function
-
- This function will dispatch message to special class such as BuildAction
- Class, Entity Class etc.
-
- @param thisClass The class object who want log information.
- @param logStr The string contains log information.
- **/
- public static void log(Object thisClass, String logStr) {
- if(messageLevel < LOG_MESSAGE_LEVEL) {
- return;
- }
-
- if(thisClass instanceof Task) {
- BuildAction.logMsg(thisClass, "$$LOG$$:" + logStr);
- } else {
- System.out.println("$$LOG$$:" + logStr);
- }
- }
-
- /**
- Warning() function provide common warning information functionality for all
- PCD tool.
-
- This function will dispatch message to special class such as BuildAction
- Class, Entity Class etc.
-
- @param thisClass The class object who want warn information.
- @param warningStr The string contains warning information.
- **/
- public static void warning(Object thisClass, String warningStr) {
- if(messageLevel < WARNING_MESSAGE_LEVEL) {
- return;
- }
-
- if(thisClass instanceof Task) {
- BuildAction.warningMsg(thisClass, "**WARNING**:" + warningStr);
- } else {
- System.out.println("**WARNING**:" + warningStr);
- }
- }
-
- /**
- Debug() function provide common Debug information functionality for all
- PCD tool.
-
- This function will dispatch message to special class such as BuildAction
- Class, Entity Class etc.
-
- @param thisClass The class object who want Debug information.
- @param debugStr The string contains Debug information.
- **/
- public static void debug(Object thisClass, String debugStr) {
- if(messageLevel < DEBUG_MESSAGE_LEVEL) {
- return;
- }
-
- if(thisClass instanceof Task) {
- BuildAction.logMsg(thisClass, "%%DEBUG%%:" + debugStr);
- } else {
- System.out.println("%%DEBUG%%:" + debugStr);
- }
- }
-}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/BuildAction.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/BuildAction.java deleted file mode 100644 index 3614547e8d..0000000000 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/BuildAction.java +++ /dev/null @@ -1,105 +0,0 @@ -/** @file
- BuildAction class.
-
- BuildAction is the parent class for all action related to ant Task. This class will
- define some common utility functionality, such as logMsg, warningMsg..etc.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.build.pcd.action;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.tianocore.build.pcd.exception.BuildActionException;
-
-/** BuildAction is the parent class for all action related to ant Task. This class will
- define some common utility functionality, such as logMsg, warningMsg..etc.
-**/
-abstract class BuildAction extends Task {
- ///
- /// Original message level before this action. This value will
- /// be restored when quit this action.
- ///
- private int originalMessageLevel;
-
- /**
- checkParameter function check all parameter valid.
-
- This function will be overrided by child class.
- **/
- abstract void checkParameter() throws BuildActionException;
-
- /**
- performAction is to execute the detail action.
-
- This function will be overrided by child class.
- **/
- abstract void performAction() throws BuildActionException;
-
- /**
- setMessageLevel function set current message for task instance object.
-
- The message should be restored when this action exit.
-
- @param messageLevel The message level for this action.
- **/
- public void setMessageLevel(int messageLevel) {
- originalMessageLevel = ActionMessage.messageLevel;
- ActionMessage.messageLevel = messageLevel;
- }
-
- /**
- logMsg function provide common log information functionality for all
- PCD tool extends from ANT task class.
-
- This function will use the log function in Ant task class.
-
- @param action The class object who want log information.
- @param logStr The string contains log information.
- **/
- public static void logMsg(Object action, String logStr) {
- ((Task) action).log(logStr, Project.MSG_INFO);
- }
-
- /**
- warningMsg function provide common warning information functionality for all
- PCD tool.
-
- This function will dispatch message to special class such as BuildAction
- Class, Entity Class etc.
-
- @param action The class object who want warn information.
- @param warningStr The string contains warning information.
- **/
- public static void warningMsg(Object action, String warningStr) {
- ((Task) action).log(warningStr, Project.MSG_WARN);
- }
-
- /**
- execute function is the main flow for all build action class.
-
- This workflow will be:
- 1) Check paramet of this action.
- 2) Perform the child class action function.
- 3) Restore the message level.
-
- @throws BuildActionException
- **/
- public void execute() throws BuildActionException {
- checkParameter();
- performAction();
-
- //
- // Restore orignal message level when exist the action.
- //
- ActionMessage.messageLevel = originalMessageLevel;
- }
-}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java index 8242a4c87c..e0a3eb6fd3 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java +++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java @@ -41,17 +41,19 @@ import org.tianocore.ModuleSADocument; import org.tianocore.PcdBuildDefinitionDocument;
import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition;
import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.build.autogen.CommonDefinition;
import org.tianocore.build.fpd.FpdParserTask;
import org.tianocore.build.global.GlobalData;
import org.tianocore.build.id.FpdModuleIdentification;
-import org.tianocore.build.pcd.action.ActionMessage;
-import org.tianocore.build.pcd.entity.DynamicTokenValue;
-import org.tianocore.build.pcd.entity.MemoryDatabaseManager;
-import org.tianocore.build.pcd.entity.SkuInstance;
-import org.tianocore.build.pcd.entity.Token;
-import org.tianocore.build.pcd.entity.UsageInstance;
-import org.tianocore.build.pcd.exception.EntityException;
+import org.tianocore.build.id.ModuleIdentification;
+import org.tianocore.pcd.action.ActionMessage;
+import org.tianocore.pcd.entity.CommonDefinition;
+import org.tianocore.pcd.entity.DynamicTokenValue;
+import org.tianocore.pcd.entity.MemoryDatabaseManager;
+import org.tianocore.pcd.entity.SkuInstance;
+import org.tianocore.pcd.entity.Token;
+import org.tianocore.pcd.entity.UsageIdentification;
+import org.tianocore.pcd.entity.UsageInstance;
+import org.tianocore.pcd.exception.EntityException;
/**
CStructTypeDeclaration
@@ -1893,6 +1895,8 @@ public class CollectPCDAction { String datum = null;
int maxDatumSize = 0;
String[] tokenSpaceStrRet = null;
+ UsageIdentification usageId = null;
+ ModuleIdentification moduleId = null;
//
// ----------------------------------------------
@@ -2112,10 +2116,17 @@ public class CollectPCDAction { // 2.1.4), Create an usage instance for this token.
// ------------------------------------------------
//
+ moduleId = modules.get(index).getModuleId().getModule();
+ usageId = new UsageIdentification (moduleId.getName(),
+ moduleId.getGuid(),
+ moduleId.getPackage().getName(),
+ moduleId.getPackage().getGuid(),
+ modules.get(index).getModuleId().getArch(),
+ moduleId.getVersion(),
+ moduleId.getModuleType());
usageInstance = new UsageInstance(token,
- modules.get(index).getModuleId().getModule(),
+ usageId,
pcdType,
- modules.get(index).getModuleId().getArch(),
datum,
maxDatumSize);
token.addUsageInstance(usageInstance);
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java index 2707c5d1a8..40d2b32a9b 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java +++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java @@ -29,11 +29,14 @@ import org.apache.xmlbeans.XmlObject; import org.tianocore.build.global.GlobalData;
import org.tianocore.build.global.SurfaceAreaQuery;
import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.pcd.entity.MemoryDatabaseManager;
-import org.tianocore.build.pcd.entity.Token;
-import org.tianocore.build.pcd.entity.UsageInstance;
-import org.tianocore.build.pcd.exception.BuildActionException;
-import org.tianocore.build.pcd.exception.EntityException;
+import org.tianocore.pcd.entity.MemoryDatabaseManager;
+import org.tianocore.pcd.entity.Token;
+import org.tianocore.pcd.entity.UsageInstance;
+import org.tianocore.pcd.exception.BuildActionException;
+import org.tianocore.pcd.exception.EntityException;
+import org.tianocore.pcd.entity.UsageIdentification;
+import org.tianocore.pcd.action.BuildAction;
+import org.tianocore.pcd.action.ActionMessage;
/** This class is to manage how to generate the PCD information into Autogen.c and
Autogen.h.
@@ -44,9 +47,9 @@ public class PCDAutoGenAction extends BuildAction { ///
private MemoryDatabaseManager dbManager;
///
- /// The identification for a module.
+ /// The identification for a UsageInstance.
///
- private ModuleIdentification moduleId;
+ private UsageIdentification usageId;
///
/// The arch of current module
///
@@ -72,17 +75,8 @@ public class PCDAutoGenAction extends BuildAction { @param moduleName the module name parameter.
**/
- public void setModuleId(ModuleIdentification moduleId) {
- this.moduleId = moduleId;
- }
-
- /**
- set Arch parameter.
-
- @param arch
- **/
- public void setArch(String arch) {
- this.arch = arch;
+ public void setUsageId(UsageIdentification usageId) {
+ this.usageId = usageId;
}
/**
@@ -136,12 +130,18 @@ public class PCDAutoGenAction extends BuildAction { String arch,
boolean isBuildUsedLibrary,
String[] pcdNameArrayInMsa) {
+ UsageIdentification usageId = new UsageIdentification(moduleId.getName(),
+ moduleId.getGuid(),
+ moduleId.getPackage().getName(),
+ moduleId.getPackage().getGuid(),
+ arch,
+ moduleId.getVersion(),
+ moduleId.getModuleType());
dbManager = null;
hAutoGenString = "";
cAutoGenString = "";
- setModuleId(moduleId);
- setArch(arch);
+ setUsageId(usageId);
setIsBuildUsedLibrary(isBuildUsedLibrary);
setPcdNameArrayInMsa(pcdNameArrayInMsa);
}
@@ -151,7 +151,7 @@ public class PCDAutoGenAction extends BuildAction { @throws BuildActionException Bad parameter.
**/
- void checkParameter() throws BuildActionException {
+ public void checkParameter() throws BuildActionException {
}
@@ -165,7 +165,7 @@ public class PCDAutoGenAction extends BuildAction { @throws BuildActionException Failed to execute this aciton class.
**/
- void performAction() throws BuildActionException {
+ public void performAction() throws BuildActionException {
ActionMessage.debug(this,
"Starting PCDAutoGenAction to generate autogen.h and autogen.c!...");
//
@@ -200,13 +200,13 @@ public class PCDAutoGenAction extends BuildAction { String[] guidStringArray = null;
String guidStringCName = null;
String guidString = null;
- String moduleName = moduleId.getName();
+ String moduleName = usageId.moduleName;
UsageInstance usageInstance = null;
boolean found = false;
usageInstanceArray = null;
if (!isBuildUsedLibrary) {
- usageInstanceArray = dbManager.getUsageInstanceArrayByModuleName(moduleId, arch);
+ usageInstanceArray = dbManager.getUsageInstanceArrayByModuleName(usageId);
dbManager.UsageInstanceContext = usageInstanceArray;
dbManager.CurrentModuleName = moduleName;
} else if ((pcdNameArrayInMsa != null) && (pcdNameArrayInMsa.length > 0)) {
@@ -216,7 +216,7 @@ public class PCDAutoGenAction extends BuildAction { // these library should be used to autogen.
//
if (usageContext == null) {
- usageInstanceArray = dbManager.getUsageInstanceArrayByModuleName(moduleId, arch);
+ usageInstanceArray = dbManager.getUsageInstanceArrayByModuleName(usageId);
} else {
usageInstanceArray = new ArrayList<UsageInstance>();
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/DynamicTokenValue.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/DynamicTokenValue.java deleted file mode 100644 index 533bd51920..0000000000 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/DynamicTokenValue.java +++ /dev/null @@ -1,162 +0,0 @@ -/** @file
- DynamicTokenValue class.
-
- This module contains the value type of a dynamic token.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.build.pcd.entity;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.tianocore.build.pcd.exception.EntityException;
-
-/** This class is to descript a value type of dynamic PCD.
- For a dynamic or dynamicEx type PCD data, the value type can be:
- 1) Hii type: the value of dynamic or dynamicEx is stored into a variable.
- 2) Vpd type: the value of dynamic or dynamicEx is stored into somewhere set
- by OEM.
- 3) Default type: the value of dynamic or dynamicEx is stored into PCD dynamic
- database.
-**/
-public class DynamicTokenValue {
- ///
- /// Enumeration macro defintion for value type.
- /// BUGBUG: Not use upcase charater is to facility for reading. It may be changed
- /// in coding review.
- public enum VALUE_TYPE {HII_TYPE, VPD_TYPE, DEFAULT_TYPE}
-
- public VALUE_TYPE type;
-
- ///
- /// ---------------------------------------------------------------------
- /// Following member is for HII case.
- /// ---------------------------------------------------------------------
- ///
-
- ///
- /// variableName is valid only when this token support Hii functionality. variableName
- /// indicates the value of token is associated with what variable.
- /// variableName is defined in FPD.
- public List variableName;
-
- ///
- /// variableGuid is the GUID this token associated with.
- ///
- public UUID variableGuid;
-
- ///
- /// Variable offset indicate the associated variable's offset in NV storage.
- ///
- public String variableOffset;
-
- ///
- /// The default value for HII case.
- ///
- public String hiiDefaultValue;
-
- ///
- /// Following member is for VPD case.
- /// BUGBUG: Consider 64 bit integer by using java.math.BigInteger.
- ///
- public String vpdOffset;
-
- ///
- /// Following member is for default case.
- ///
- public String value;
-
- public DynamicTokenValue() {
- this.type = VALUE_TYPE.DEFAULT_TYPE;
- this.variableName = null;
- this.variableGuid = null;
- this.variableOffset = null;
- this.hiiDefaultValue = null;
-
- this.vpdOffset = null;
-
- this.value = null;
- }
-
- /**
- Set the HII case data.
-
- @param variableName
- @param variableGuid
- @param variableOffset
- @param hiiDefaultValue
- */
- public void setHiiData(List variableName,
- UUID variableGuid,
- String variableOffset,
- String hiiDefaultValue) {
- this.type = VALUE_TYPE.HII_TYPE;
-
- this.variableName = variableName;
- this.variableGuid = variableGuid;
- this.variableOffset = variableOffset;
- this.hiiDefaultValue = hiiDefaultValue;
- }
-
- /**
- Get the string like L"xxx" for a variable Name.
-
- BUGBUG: In fact, it is not correctly, variable name should be
- treated as unicode UINT16 array.
-
- @return String
- */
- public String getStringOfVariableName()
- throws EntityException {
- String str;
- int index, num;
- char ch;
-
- str = "";
- for (index = 0; index < variableName.size(); index ++) {
- num = Integer.decode(variableName.get(index).toString());
- if ((num > 127 ) || (num < 0)) {
- throw new EntityException(String.format("variable name contains >0x80 character, now is not support!"));
- }
- str += (char)num;
- }
-
- return str;
- }
-
- /**
- Set Vpd case data.
-
- @param vpdOffset
- */
- public void setVpdData(String vpdOffset) {
- this.type = VALUE_TYPE.VPD_TYPE;
-
- this.vpdOffset = vpdOffset;
- }
-
- /**
- Set default case data.
-
- @param value
- */
- public void setValue(String value) {
- this.type = VALUE_TYPE.DEFAULT_TYPE;
-
- this.value = value;
- }
-}
-
-
-
-
-
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/MemoryDatabaseManager.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/MemoryDatabaseManager.java deleted file mode 100644 index 636be3adaf..0000000000 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/MemoryDatabaseManager.java +++ /dev/null @@ -1,308 +0,0 @@ -/** @file
- MemoryDatabaseManager class.
-
- Database hold all PCD information comes from SPD, MSA, FPD file in memory.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.build.pcd.entity;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.pcd.exception.EntityException;
-
-/** Database hold all PCD information comes from SPD, MSA, FPD file in memory.
-**/
-public class MemoryDatabaseManager {
- ///
- /// Memory database. The string "cName + SpaceNameGuid" is primary key.
- /// memory database is in global scope, and it will be used for others PCD tools.
- ///
- private static Map<String, Token> memoryDatabase = null;
-
- ///
- /// Before build a module, the used libary will be build firstly, the PCD of these
- /// libarry is inheritted by the module, so stored module's PCD information as PCD
- /// context of building libary.
- ///
- public static List<UsageInstance> UsageInstanceContext = null;
-
- ///
- /// Current module name, if now is buiding library, this value indicate this library
- /// is for building what module.
- ///
- public static String CurrentModuleName = null;
-
- ///
- /// String for PCD PEIM and DXE autogen file
- ///
- public static String PcdPeimHString = "";
- public static String PcdPeimCString = "";
- public static String PcdDxeHString = "";
- public static String PcdDxeCString = "";
-
- /**
- Constructure function
- **/
- public MemoryDatabaseManager() {
- //
- // Allocate memory for new database in global scope.
- //
- if (memoryDatabase == null) {
- memoryDatabase = new HashMap<String, Token>();
- }
- }
-
- /**
- Judege whether token exists in memory database
-
- @param primaryKey the primaryKey for searching token
-
- @retval TRUE - token already exist in database.
- @retval FALSE - token does not exist in database.
- **/
- public boolean isTokenInDatabase(String primaryKey) {
- return (memoryDatabase.get(primaryKey) != null);
- }
-
- /**
- Add a pcd token into memory database.
-
- @param primaryKey the primary key for searching token
- @param token token instance
- **/
- public void addTokenToDatabase(String primaryKey, Token token) {
- memoryDatabase.put(primaryKey, token);
- }
-
- /**
- Get a token instance from memory database with primary key.
-
- @param primaryKey the primary key for searching token
-
- @return token instance.
- **/
- public Token getTokenByKey(String primaryKey) {
- return memoryDatabase.get(primaryKey);
- }
-
- /**
- Get the number of PCD token record in memory database.
-
- @return the number of PCD token record in memory database.
- **/
- public int getDBSize() {
- return memoryDatabase.size();
- }
-
- /**
- Get the token record array contained all PCD token in memory database.
-
- @return the token record array contained all PCD token in memory database.
- **/
- public Token[] getRecordArray() {
- Token[] tokenArray = null;
- Object[] dataArray = null;
- Map.Entry entry = null;
- int index = 0;
-
- if (memoryDatabase == null) {
- return null;
- }
-
- dataArray = memoryDatabase.entrySet().toArray();
- tokenArray = new Token[memoryDatabase.size()];
- for (index = 0; index < memoryDatabase.size(); index ++) {
- entry =(Map.Entry) dataArray [index];
- tokenArray[index] =(Token) entry.getValue();
- }
-
- return tokenArray;
- }
-
- /**
- Get record array only contains DYNAMIC or DYNAMIC_EX type PCD.
-
- @return ArrayList
- */
- private ArrayList getDynamicRecordArray() {
- Token[] tokenArray = getRecordArray();
- int index = 0;
- ArrayList<Token> al = new ArrayList<Token>();
-
- for (index = 0; index < tokenArray.length; index++) {
- if (tokenArray[index].isDynamicPCD) {
- al.add(tokenArray[index]);
- }
- }
-
- return al;
- }
-
-
- /**
- Get the token record array contained all PCD token referenced by PEI phase.
- The output array is sorted based on descending order of the size of alignment for each feilds.
-
- @return the token record array contained all PCD token referenced in PEI phase.
- @throws EntityException
- **/
- public void getTwoPhaseDynamicRecordArray(ArrayList<Token> pei, ArrayList<Token> dxe)
- throws EntityException {
- int usageInstanceIndex = 0;
- int index = 0;
- ArrayList tokenArrayList = getDynamicRecordArray();
- Object[] usageInstanceArray = null;
- UsageInstance usageInstance = null;
-
- //pei = new ArrayList<Token>();
- //dxe = new ArrayList<Token>();
-
- for (index = 0; index < tokenArrayList.size(); index++) {
- boolean found = false;
- Token token = (Token) tokenArrayList.get(index);
- if (token.consumers != null) {
- usageInstanceArray = token.consumers.entrySet().toArray();
- for (usageInstanceIndex = 0; usageInstanceIndex < token.consumers.size(); usageInstanceIndex ++) {
- usageInstance =(UsageInstance) (((Map.Entry)usageInstanceArray[usageInstanceIndex]).getValue());
- if (usageInstance.isPeiPhaseComponent()) {
- pei.add(token);
- found = true;
- break;
- }
- }
- }
-
- //
- // If no PEI components reference the PCD entry,
- // we check if it is referenced in DXE driver.
- //
- if (!found) {
- if (token.consumers != null) {
- usageInstanceArray = token.consumers.entrySet().toArray();
- for (usageInstanceIndex = 0; usageInstanceIndex < token.consumers.size(); usageInstanceIndex ++) {
- usageInstance =(UsageInstance) (((Map.Entry)usageInstanceArray[usageInstanceIndex]).getValue());
- if (usageInstance.isDxePhaseComponent()) {
- dxe.add(token);
- found = true;
- break;
- }
- }
- }
-
- if (!found) {
- if (token.isDynamicPCD && token.consumers.size() == 0) {
- dxe.add(token);
- } else {
- //
- // We only support Dynamice(EX) type for PEI and DXE phase.
- // If it is not referenced in either PEI or DXE, throw exception now.
- //
- throw new EntityException("[PCD tool Internal Error] Dynamic(EX) PCD Entries are referenced in module that is not in PEI phase nor in DXE phase.");
- }
- }
- }
- }
-
- return;
- }
-
- /**
- Get all PCD record for a module according to module's name, module's GUID,
- package name, package GUID, arch, version information.
-
- @param moduleId the id of module.
- @param arch the architecture
-
- @return all usage instance for this module in memory database.
- **/
- public List<UsageInstance> getUsageInstanceArrayByModuleName(ModuleIdentification moduleId,
- String arch) {
-
- String primaryKey = UsageInstance.getPrimaryKey(moduleId, arch);
-
- return getUsageInstanceArrayByKeyString(primaryKey);
- }
-
- /**
- Get all PCD token for a usage instance according to primary key.
-
- @param primaryKey the primary key of usage instance.
-
- @return List<UsageInstance>
- */
- public List<UsageInstance> getUsageInstanceArrayByKeyString(String primaryKey) {
- Token[] tokenArray = null;
- int recordIndex = 0;
- UsageInstance usageInstance = null;
- List<UsageInstance> returnArray = new ArrayList<UsageInstance>();
-
- tokenArray = getRecordArray();
-
- //
- // Loop to find all PCD record related to current module
- //
- for (recordIndex = 0; recordIndex < getDBSize(); recordIndex ++) {
- if (tokenArray[recordIndex].consumers.size() != 0) {
- usageInstance = tokenArray[recordIndex].consumers.get(primaryKey);
- if (usageInstance != null) {
- returnArray.add(usageInstance);
- }
- }
- }
-
- return returnArray;
- }
-
- /**
- Get all modules name who contains PCD information
-
- @return Array for module name
- **/
- public List<String> getAllModuleArray()
- {
- int indexToken = 0;
- int usageIndex = 0;
- int moduleIndex = 0;
- Token[] tokenArray = null;
- Object[] usageInstanceArray = null;
- List<String> moduleNames = new ArrayList<String>();
- UsageInstance usageInstance = null;
- boolean bFound = false;
-
- tokenArray = getRecordArray();
- //
- // Find all consumer usage instance for retrieving module's name
- //
- for (indexToken = 0; indexToken < getDBSize(); indexToken ++) {
- usageInstanceArray = tokenArray[indexToken].consumers.entrySet().toArray();
- for (usageIndex = 0; usageIndex < tokenArray[indexToken].consumers.size(); usageIndex ++) {
- usageInstance = (UsageInstance)((Map.Entry)usageInstanceArray[usageIndex]).getValue();
- bFound = false;
- for (moduleIndex = 0; moduleIndex < moduleNames.size(); moduleIndex ++) {
- if (moduleNames.get(moduleIndex).equalsIgnoreCase(usageInstance.getPrimaryKey())) {
- bFound = true;
- break;
- }
- }
- if (!bFound) {
- moduleNames.add(usageInstance.getPrimaryKey());
- }
- }
- }
- return moduleNames;
- }
-}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/SkuInstance.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/SkuInstance.java deleted file mode 100644 index 6df155157c..0000000000 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/SkuInstance.java +++ /dev/null @@ -1,45 +0,0 @@ -/** @file
- SkuInstance class.
-
- Sku instance contains ID and value, A pcd token maybe contains more than one Sku instance.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.build.pcd.entity;
-
-/** Sku instance contains ID and value, A pcd token maybe contains more than one Sku instance.
-**/
-public class SkuInstance {
- ///
- /// The id number of this SKU instance
- ///
- public int id;
- ///
- /// The value of this SKU instance
- ///
- public DynamicTokenValue value;
-
- /**
- Constructure function
-
- @param id sku id
- @param value sku value for this id.
- **/
- public SkuInstance(int id, DynamicTokenValue value) {
- this.id = id;
- this.value = value;
- }
-
- public SkuInstance() {
- this.id = 0;
- this.value = new DynamicTokenValue();
- }
-}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java deleted file mode 100644 index 20b4f4e01a..0000000000 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java +++ /dev/null @@ -1,854 +0,0 @@ -/** @file
- Token class.
-
- This module contains all classes releted to PCD token.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.build.pcd.entity;
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.pcd.exception.EntityException;
-
-/** This class is to descript a PCD token object. The information of a token mainly
- comes from MSA, SPD and setting produced by platform developer.
-**/
-public class Token {
- ///
- /// Enumeration macro defintion for PCD type.
- /// BUGBUG: Not use upcase charater is to facility for reading. It may be changed
- /// in coding review.
- public enum PCD_TYPE {FEATURE_FLAG, FIXED_AT_BUILD, PATCHABLE_IN_MODULE, DYNAMIC,
- DYNAMIC_EX, UNKNOWN}
-
- ///
- /// Enumeration macro definition for datum type. All type mainly comes from ProcessBind.h.
- /// Wizard maybe expand this type as "int, unsigned int, short, unsigned short etc" in
- /// prompt dialog.
- ///
- public enum DATUM_TYPE {UINT8, UINT16, UINT32, UINT64, BOOLEAN, POINTER, UNKNOWN}
-
- ///
- /// Enumeration macor defintion for usage of PCD
- ///
- public enum PCD_USAGE {ALWAYS_PRODUCED, ALWAYS_CONSUMED, SOMETIMES_PRODUCED,
- SOMETIMES_CONSUMED, UNKNOWN}
-
- ///
- /// cName is to identify a PCD entry and will be used for generating autogen.h/autogen.c.
- /// cName will be defined in MSA, SPD and FPD, can be regarded as primary key with token space guid.
- ///
- public String cName;
-
- ///
- /// Token space name is the guid defined by token itself in package or module level. This
- /// name mainly for DynamicEx type. For other PCD type token, his token space name is the
- /// assignedtokenSpaceName as follows.
- /// tokenSpaceName is defined in MSA, SPD, FPD, can be regarded as primary key with cName.
- ///
- public String tokenSpaceName;
-
- ///
- /// tokenNumber is allocated by platform. tokenNumber indicate an index for this token in
- /// platform token space. For Dynamic, dynamicEx type, this number will be re-adjust by
- /// PCD run-time database autogen tools.
- ///
- public long tokenNumber;
-
- ///
- /// This token number is retrieved from FPD file for DynamicEx type.
- ///
- public long dynamicExTokenNumber;
-
- ///
- /// All supported PCD type, this value can be retrieved from SPD
- /// Currently, only record all PCD type for this token in FPD file.
- ///
- public List<PCD_TYPE> supportedPcdType;
-
- ///
- /// If the token's item type is Dynamic or DynamicEx type, isDynamicPCD
- /// is true.
- ///
- public boolean isDynamicPCD;
-
- ///
- /// datumSize is to descript the fix size or max size for this token.
- /// datumSize is defined in SPD.
- ///
- public int datumSize;
-
- ///
- /// datum type is to descript what type can be expressed by a PCD token.
- /// For same PCD used in different module, the datum type should be unique.
- /// So it belong memeber to Token class.
- ///
- public DATUM_TYPE datumType;
-
- ///
- /// skuData contains all value for SkuNumber of token.
- /// This field is for Dynamic or DynamicEx type PCD,
- ///
- public List<SkuInstance> skuData;
-
- ///
- /// consumers array record all module private information who consume this PCD token.
- ///
- public Map<String, UsageInstance> consumers;
-
- /**
- Constructure function for Token class
-
- @param cName The name of token
- @param tokenSpaceName The name of token space, it is a guid string
- **/
- public Token(String cName, String tokenSpaceName) {
- UUID nullUUID = new UUID(0, 0);
-
- this.cName = cName;
- this.tokenSpaceName = tokenSpaceName;
- this.tokenNumber = 0;
- this.datumType = DATUM_TYPE.UNKNOWN;
- this.datumSize = -1;
- this.skuData = new ArrayList<SkuInstance>();
-
- this.consumers = new HashMap<String, UsageInstance>();
- this.supportedPcdType = new ArrayList<PCD_TYPE>();
- }
-
- /**
- updateSupportPcdType
-
- SupportPcdType should be gotten from SPD file actually, but now it just
- record all PCD type for this token in FPD file.
-
- @param pcdType new PCD type found in FPD file for this token.
- **/
- public void updateSupportPcdType(PCD_TYPE pcdType) {
- for (int index = 0; index < this.supportedPcdType.size(); index ++) {
- if (supportedPcdType.get(index) == pcdType) {
- return;
- }
- }
-
- //
- // If not found, add the pcd type to member variable supportedPcdType
- //
- supportedPcdType.add(pcdType);
- }
-
- /**
- Judge whether pcdType is belong to dynamic type. Dynamic type includes
- DYNAMIC and DYNAMIC_EX.
-
- @param pcdType the judged pcd type
-
- @return boolean
- */
- public static boolean isDynamic(PCD_TYPE pcdType) {
- if ((pcdType == PCD_TYPE.DYNAMIC ) ||
- (pcdType == PCD_TYPE.DYNAMIC_EX)) {
- return true;
- }
-
- return false;
- }
-
- public boolean isDynamicEx() {
- for (int i = 0; i < supportedPcdType.size(); i++) {
- if (supportedPcdType.get(i) == PCD_TYPE.DYNAMIC_EX) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- Use "TokencName + "-" + SpaceTokenName" as primary key when adding token into database
-
- @param cName Token name.
- @param tokenSpaceName The token space guid string defined in MSA or SPD
-
- @retval primary key for this token in token database.
- **/
- public static String getPrimaryKeyString(String cName, String tokenSpaceName) {
- if (tokenSpaceName == null) {
- return cName + "_nullTokenSpaceGuid";
- } else {
- return cName + "_" + tokenSpaceName.toString().replace('-', '_');
- }
- }
-
- /**
- If skudata list contains more than one data, then Sku mechanism is enable.
-
- @retval boolean if the number of sku data exceed to 1
- */
- public boolean isSkuEnable() {
- if (this.skuData.size() > 1) {
- return true;
- }
- return false;
- }
-
- /**
- If Hii type for value of token
-
- @return boolean
- **/
- public boolean isHiiEnable() {
- if (getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.HII_TYPE) {
- return true;
- }
- return false;
- }
-
- /**
- If Vpd type for value of token
-
- @return boolean
- **/
- public boolean isVpdEnable() {
- if (getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.VPD_TYPE) {
- return true;
- }
- return false;
- }
-
- /**
- Get the token primary key in token database.
-
- @return String
- */
- public String getPrimaryKeyString () {
- return Token.getPrimaryKeyString(cName, tokenSpaceName);
- }
-
- /**
- Judge datumType is valid
-
- @param type The datumType want to be judged.
-
- @retval TRUE - The type is valid.
- @retval FALSE - The type is invalid.
- **/
- public static boolean isValiddatumType(DATUM_TYPE type) {
- if ((type.ordinal() < DATUM_TYPE.UINT8.ordinal() ) ||
- (type.ordinal() > DATUM_TYPE.POINTER.ordinal())) {
- return false;
- }
- return true;
- }
-
- /**
- Judge pcdType is valid
-
- @param type The PCdType want to be judged.
-
- @retval TRUE - The type is valid.
- @retval FALSE - The type is invalid.
- **/
- public static boolean isValidpcdType(PCD_TYPE type) {
- if ((type.ordinal() < PCD_TYPE.FEATURE_FLAG.ordinal() ) ||
- (type.ordinal() > PCD_TYPE.DYNAMIC_EX.ordinal())) {
- return false;
- }
- return true;
- }
-
- /**
- Add an usage instance for token
-
- @param usageInstance The usage instance
-
- @retval TRUE - Success to add usage instance.
- @retval FALSE - Fail to add usage instance
- **/
- public boolean addUsageInstance(UsageInstance usageInstance) throws EntityException {
- String exceptionStr;
-
- if (isUsageInstanceExist(usageInstance.moduleId, usageInstance.arch)) {
- exceptionStr = String.format("[PCD Collection Tool Exception] PCD %s for module %s has already exist in database, Please check all PCD build entries "+
- "in modules %s in <ModuleSA> to make sure no duplicated definitions in FPD file!",
- usageInstance.parentToken.cName,
- usageInstance.moduleId.getName(),
- usageInstance.moduleId.getName());
- throw new EntityException(exceptionStr);
- }
-
- //
- // Put usage instance into usage instance database of this PCD token.
- //
- consumers.put(usageInstance.getPrimaryKey(), usageInstance);
-
- return true;
- }
-
- /**
- Judge whether exist an usage instance for this token
-
- @param moduleId The module identification for usage instance
- @param arch the architecture string
-
- @return boolean whether exist an usage instance for this token.
- */
- public boolean isUsageInstanceExist(ModuleIdentification moduleId,
- String arch) {
- String keyStr = UsageInstance.getPrimaryKey(moduleId, arch);
-
- return (consumers.get(keyStr) != null);
- }
-
- /**
- Get the PCD_TYPE according to the string of PCD_TYPE
-
- @param pcdTypeStr The string of PCD_TYPE
-
- @return PCD_TYPE
- **/
- public static PCD_TYPE getpcdTypeFromString(String pcdTypeStr) {
- if (pcdTypeStr == null) {
- return PCD_TYPE.UNKNOWN;
- }
-
- if (pcdTypeStr.equalsIgnoreCase("FEATURE_FLAG")) {
- return PCD_TYPE.FEATURE_FLAG;
- } else if (pcdTypeStr.equalsIgnoreCase("FIXED_AT_BUILD")) {
- return PCD_TYPE.FIXED_AT_BUILD;
- } else if (pcdTypeStr.equalsIgnoreCase("PATCHABLE_IN_MODULE")) {
- return PCD_TYPE.PATCHABLE_IN_MODULE;
- } else if (pcdTypeStr.equalsIgnoreCase("DYNAMIC")) {
- return PCD_TYPE.DYNAMIC;
- } else if (pcdTypeStr.equalsIgnoreCase("DYNAMIC_EX")) {
- return PCD_TYPE.DYNAMIC_EX;
- } else {
- return PCD_TYPE.UNKNOWN;
- }
- }
-
- /**
- Get the string of given datumType. This string will be used for generating autogen files
-
- @param datumType Given datumType
-
- @return The string of datum type.
- **/
- public static String getStringOfdatumType(DATUM_TYPE datumType) {
- switch (datumType) {
- case UINT8:
- return "UINT8";
- case UINT16:
- return "UINT16";
- case UINT32:
- return "UINT32";
- case UINT64:
- return "UINT64";
- case POINTER:
- return "POINTER";
- case BOOLEAN:
- return "BOOLEAN";
- }
- return "UNKNOWN";
- }
-
- /**
- Get the datumType according to a string.
-
- @param datumTypeStr The string of datumType
-
- @return DATUM_TYPE
- **/
- public static DATUM_TYPE getdatumTypeFromString(String datumTypeStr) {
- if (datumTypeStr.equalsIgnoreCase("UINT8")) {
- return DATUM_TYPE.UINT8;
- } else if (datumTypeStr.equalsIgnoreCase("UINT16")) {
- return DATUM_TYPE.UINT16;
- } else if (datumTypeStr.equalsIgnoreCase("UINT32")) {
- return DATUM_TYPE.UINT32;
- } else if (datumTypeStr.equalsIgnoreCase("UINT64")) {
- return DATUM_TYPE.UINT64;
- } else if (datumTypeStr.equalsIgnoreCase("VOID*")) {
- return DATUM_TYPE.POINTER;
- } else if (datumTypeStr.equalsIgnoreCase("BOOLEAN")) {
- return DATUM_TYPE.BOOLEAN;
- }
- return DATUM_TYPE.UNKNOWN;
- }
-
- /**
- Get string of given pcdType
-
- @param pcdType The given PcdType
-
- @return The string of PCD_TYPE.
- **/
- public static String getStringOfpcdType(PCD_TYPE pcdType) {
- switch (pcdType) {
- case FEATURE_FLAG:
- return "FEATURE_FLAG";
- case FIXED_AT_BUILD:
- return "FIXED_AT_BUILD";
- case PATCHABLE_IN_MODULE:
- return "PATCHABLE_IN_MODULE";
- case DYNAMIC:
- return "DYNAMIC";
- case DYNAMIC_EX:
- return "DYNAMIC_EX";
- }
- return "UNKNOWN";
- }
-
- /**
- Get the PCD_USAGE according to a string
-
- @param usageStr The string of PCD_USAGE
-
- @return The PCD_USAGE
- **/
- public static PCD_USAGE getUsageFromString(String usageStr) {
- if (usageStr == null) {
- return PCD_USAGE.UNKNOWN;
- }
-
- if (usageStr.equalsIgnoreCase("ALWAYS_PRODUCED")) {
- return PCD_USAGE.ALWAYS_PRODUCED;
- } else if (usageStr.equalsIgnoreCase("SOMETIMES_PRODUCED")) {
- return PCD_USAGE.SOMETIMES_PRODUCED;
- } else if (usageStr.equalsIgnoreCase("ALWAYS_CONSUMED")) {
- return PCD_USAGE.ALWAYS_CONSUMED;
- } else if (usageStr.equalsIgnoreCase("SOMETIMES_CONSUMED")) {
- return PCD_USAGE.SOMETIMES_CONSUMED;
- }
-
- return PCD_USAGE.UNKNOWN;
- }
-
- /**
- Get the string of given PCD_USAGE
-
- @param usage The given PCD_USAGE
-
- @return The string of PDC_USAGE.
- **/
- public static String getStringOfUsage(PCD_USAGE usage) {
- switch (usage) {
- case ALWAYS_PRODUCED:
- return "ALWAYS_PRODUCED";
- case ALWAYS_CONSUMED:
- return "ALWAYS_CONSUMED";
- case SOMETIMES_PRODUCED:
- return "SOMETIMES_PRODUCED";
- case SOMETIMES_CONSUMED:
- return "SOMETIMES_CONSUMED";
- }
- return "UNKNOWN";
- }
-
- /**
- Get the Defined datumType string for autogen. The string is for generating some MACROs in Autogen.h
-
- @param datumType The given datumType
-
- @return string of datum type for autogen.
- **/
- public static String GetAutogenDefinedatumTypeString(DATUM_TYPE datumType) {
- switch (datumType) {
-
- case UINT8:
- return "8";
- case UINT16:
- return "16";
- case BOOLEAN:
- return "BOOL";
- case POINTER:
- return "PTR";
- case UINT32:
- return "32";
- case UINT64:
- return "64";
- default:
- return null;
- }
- }
-
- /**
- Get the datumType String for Autogen. This string will be used for generating defintions of PCD token in autogen
-
- @param datumType The given datumType
-
- @return string of datum type.
- **/
-
- public static String getAutogendatumTypeString(DATUM_TYPE datumType) {
- switch (datumType) {
- case UINT8:
- return "UINT8";
- case UINT16:
- return "UINT16";
- case UINT32:
- return "UINT32";
- case UINT64:
- return "UINT64";
- case POINTER:
- return "VOID*";
- case BOOLEAN:
- return "BOOLEAN";
- }
- return null;
- }
-
- /**
- Get the datumType string for generating some MACROs in autogen file of Library
-
- @param datumType The given datumType
-
- @return String of datum for genrating bit charater.
- **/
- public static String getAutogenLibrarydatumTypeString(DATUM_TYPE datumType) {
- switch (datumType) {
- case UINT8:
- return "8";
- case UINT16:
- return "16";
- case BOOLEAN:
- return "Bool";
- case POINTER:
- return "Ptr";
- case UINT32:
- return "32";
- case UINT64:
- return "64";
- default:
- return null;
- }
- }
-
- /**
- Get the sku data who id is 0.
-
- @retval DynamicTokenValue the value of this dyanmic token.
- **/
- public DynamicTokenValue getDefaultSku() {
- DynamicTokenValue dynamicData;
- int index;
-
- for (index = 0; index < this.skuData.size(); index ++) {
- if (skuData.get(index).id == 0) {
- return skuData.get(index).value;
- }
- }
-
- return null;
- }
-
- /**
- Get the number of Sku data for this token
-
- @retval int the number of sku data
- **/
- public int getSkuIdCount () {
- return this.skuData.size();
- }
-
- /**
- Get the size of PCD value, this PCD is POINTER type.
-
- @param str the string of the value
- @param al
- **/
- private void getCurrentSizeFromDefaultValue (String str, ArrayList<Integer> al) {
- if (isValidNullValue(str)) {
- al.add(new Integer(0));
- } else {
- //
- // isValidNullValue has already make sure that str here
- // always contain a valid default value of the following 3
- // cases:
- // 1) "Hello world" //Assci string
- // 2) L"Hello" //Unicode string
- // 3) {0x01, 0x02, 0x03} //Byte stream
- //
- if (str.startsWith("\"")) {
- al.add(new Integer(str.length() - 2));
- } else if (str.startsWith("L\"")){
- //
- // Unicode is 2 bytes each.
- //
- al.add(new Integer((str.length() - 3) * 2));
- } else if (str.startsWith("{")) {
- //
- // We count the number of "," in the string.
- // The number of byte is one plus the number of
- // comma.
- //
- String str2 = str;
-
- int cnt = 0;
- int pos = 0;
- pos = str2.indexOf(",", 0);
- while (pos != -1) {
- cnt++;
- pos++;
- pos = str2.indexOf(",", pos);
- }
- cnt++;
- al.add(new Integer(cnt));
- }
- }
- }
-
- /**
- This method can be used to get the MAX and current size
- for pointer type dynamic(ex) PCD entry
- **/
- public ArrayList<Integer> getPointerTypeSize () {
- ArrayList<Integer> al = new ArrayList<Integer>();
-
- //
- // For VPD_enabled and HII_enabled, we can only return the MAX size.
- // For the default DATA type dynamic PCD entry, we will return
- // the MAX size and current size for each SKU_ID.
- //
- al.add(new Integer(this.datumSize));
-
- if (!this.isVpdEnable()) {
- int idx;
- if (this.isHiiEnable()){
- for (idx = 0; idx < this.skuData.size(); idx++) {
- String str = this.skuData.get(idx).value.hiiDefaultValue;
- getCurrentSizeFromDefaultValue(str, al);
- }
- } else {
- for (idx = 0; idx < this.skuData.size(); idx++) {
- String str = this.skuData.get(idx).value.value;
- getCurrentSizeFromDefaultValue(str, al);
- }
- }
- }
-
- return al;
- }
-
- /**
- Get default value for a token, For HII type, HiiDefaultValue of default
- SKU 0 will be returned; For Default type, the defaultvalue of default SKU
- 0 will be returned.
-
- @return String
- */
- public String getDynamicDefaultValue() {
- DynamicTokenValue dynamicData = getDefaultSku();
- if (hasDefaultValue()) {
- switch (dynamicData.type) {
- case DEFAULT_TYPE:
- return dynamicData.value;
- }
- }
-
- return null;
- }
-
- //
- // BugBug: We need change this algorithm accordingly when schema is updated
- // to support no default value.
- //
- public boolean hasDefaultValue () {
- int value = 0;
- boolean isInteger = true;
- DynamicTokenValue dynamicValue = null;
-
- if (isSkuEnable()) {
- return true;
- }
-
- if (this.isDynamicPCD) {
- dynamicValue = getDefaultSku();
- switch (dynamicValue.type) {
- case HII_TYPE:
- return true;
- case VPD_TYPE:
- return true;
- case DEFAULT_TYPE:
- return !isValidNullValue(dynamicValue.value);
- }
- }
-
- return false;
- }
-
- /**
- Judge the value is NULL value. NULL value means the value is uninitialized value
-
- @param judgedValue
-
- @return boolean
- */
- public boolean isValidNullValue(String judgedValue) {
- String subStr;
- BigInteger bigIntValue;
-
- switch (datumType) {
- case UINT8:
- case UINT16:
- case UINT32:
- if (judgedValue.length() > 2) {
- if ((judgedValue.charAt(0) == '0') &&
- ((judgedValue.charAt(1) == 'x') || (judgedValue.charAt(1) == 'X'))){
- subStr = judgedValue.substring(2, judgedValue.length());
- bigIntValue = new BigInteger(subStr, 16);
- } else {
- bigIntValue = new BigInteger(judgedValue);
- }
- } else {
- bigIntValue = new BigInteger(judgedValue);
- }
- if (bigIntValue.bitCount() == 0) {
- return true;
- }
- break;
- case UINT64:
- if (judgedValue.length() > 2){
- if ((judgedValue.charAt(0) == '0') &&
- ((judgedValue.charAt(1) == 'x') ||
- (judgedValue.charAt(1) == 'X'))) {
- bigIntValue = new BigInteger(judgedValue.substring(2, judgedValue.length()), 16);
- if (bigIntValue.bitCount() == 0) {
- return true;
- }
- } else {
- bigIntValue = new BigInteger(judgedValue);
- if (bigIntValue.bitCount() == 0) {
- return true;
- }
- }
- } else {
- bigIntValue = new BigInteger(judgedValue);
- if (bigIntValue.bitCount() == 0) {
- return true;
- }
- }
- break;
- case BOOLEAN:
- if (judgedValue.equalsIgnoreCase("false")) {
- return true;
- }
- break;
- case POINTER:
- if (judgedValue.equalsIgnoreCase("") ||
- judgedValue.equalsIgnoreCase("\"\"") ||
- judgedValue.equalsIgnoreCase("L\"\"") ||
- (judgedValue.length() == 0) ||
- judgedValue.equalsIgnoreCase("{0}")) {
- return true;
- }
- }
- return false;
- }
-
- /**
- Is the string value in Unicode
-
- @return boolean
- **/
- public boolean isHiiDefaultValueUnicodeStringType() {
- DynamicTokenValue dynamicData = getDefaultSku();
-
- if (dynamicData == null)
- return false;
-
- return dynamicData.hiiDefaultValue.startsWith("L\"")
- && dynamicData.hiiDefaultValue.endsWith("\"");
- }
-
- /**
- Is the string value in ANSCI
-
- @return boolean
- **/
- public boolean isHiiDefaultValueASCIIStringType() {
- DynamicTokenValue dynamicData = getDefaultSku();
-
- if (dynamicData == null)
- return false;
-
- return dynamicData.hiiDefaultValue.startsWith("\"")
- && dynamicData.hiiDefaultValue.endsWith("\"");
- }
-
- /**
- Judege whether current value is UNICODE string type.
- @return boolean
- */
- public boolean isUnicodeStringType () {
- String str = getDynamicDefaultValue();
-
- if (str == null) {
- return false;
- }
-
- if (datumType == Token.DATUM_TYPE.POINTER &&
- str.startsWith("L\"") &&
- str.endsWith("\"")) {
- return true;
- }
-
- return false;
- }
-
- public boolean isASCIIStringType () {
- String str = getDynamicDefaultValue();
-
- if (str == null) {
- return false;
- }
-
- if (datumType == Token.DATUM_TYPE.POINTER &&
- str.startsWith("\"") &&
- str.endsWith("\"")) {
- return true;
- }
-
- return false;
- }
-
- public boolean isByteStreamType () {
- String str = getDynamicDefaultValue();
-
- if (str == null) {
- return false;
- }
-
- if (datumType == Token.DATUM_TYPE.POINTER &&
- str.startsWith("{") &&
- str.endsWith("}")) {
- return true;
- }
-
- return false;
-
- }
-
- public String getStringTypeString () {
- return getDefaultSku().value.substring(2, getDefaultSku().value.length() - 1);
- }
-}
-
-
-
-
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java deleted file mode 100644 index 2f7d5ae523..0000000000 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java +++ /dev/null @@ -1,409 +0,0 @@ -/** @file
- UsageInstance class.
-
- This class indicate an usage instance for a PCD token. This instance maybe a module
- or platform setting. When a module produce or cosume a PCD token, then this module
- is an usage instance for this PCD token.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.build.pcd.entity;
-
-
-import java.util.UUID;
-
-import org.tianocore.ModuleTypeDef;
-import org.tianocore.build.autogen.CommonDefinition;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.pcd.exception.EntityException;
-
-/**
- This class indicate an usage instance for a PCD token. This instance maybe a module
- or platform setting. When a module produce or cosume a PCD token, then this module
- is an usage instance for this PCD token.
-**/
-public class UsageInstance {
- ///
- /// This parent that this usage instance belongs to.
- ///
- public Token parentToken;
-
- ///
- /// ModuleIdentification for Usage Instance
- ///
- public ModuleIdentification moduleId;
-
- ///
- /// Arch also is a key for a UsageInstance
- ///
- public String arch;
-
- ///
- /// The PCD type defined for module
- ///
- public Token.PCD_TYPE modulePcdType;
-
- ///
- /// The value of the PCD in this usage instance.
- ///
- public String datum;
-
- ///
- /// The maxDatumSize could be different for same PCD in different module
- /// But this case is allow for FeatureFlag, FixedAtBuild, PatchableInModule
- /// type.
- ///
- public int maxDatumSize;
-
- ///
- /// Autogen string for header file.
- ///
- public String hAutogenStr;
-
- ///
- /// Auotgen string for C code file.
- ///
- public String cAutogenStr;
-
- /**
- Constructure function for UsageInstance
-
- @param parentToken The token instance for this usgaInstance
- @param id The identification for usage instance
- @param modulePcdType The PCD type for this usage instance
- @param value The value of this PCD in this usage instance
- @param maxDatumSize The max datum size of this PCD in this usage
- instance.
- **/
- public UsageInstance(Token parentToken,
- ModuleIdentification moduleId,
- Token.PCD_TYPE modulePcdType,
- String arch,
- String value,
- int maxDatumSize) {
- this.parentToken = parentToken;
- this.moduleId = moduleId;
- this.modulePcdType = modulePcdType;
- this.arch = arch;
- this.datum = value;
- this.maxDatumSize = maxDatumSize;
- }
-
- /**
- Get the primary key for usage instance array for every token.
-
- @param moduleId The module Identification for generating primary key
- @param arch Arch string
-
- @retval String The primary key for this usage instance
- **/
- public static String getPrimaryKey(ModuleIdentification moduleId,
- String arch) {
- String moduleName = moduleId.getName();
- String moduleGuid = moduleId.getGuid();
- String packageName = moduleId.getPackage().getName();
- String packageGuid = moduleId.getPackage().getGuid();
- String version = moduleId.getVersion();
-
- //
- // Because currently transition schema not require write moduleGuid, package Name, Packge GUID in
- // <ModuleSA> section, So currently no expect all paramter must be valid.
- // BUGBUG: Because currently we can not get version from MSA, So ignore verison.
- //
- return(moduleName + "_" +
- ((moduleGuid != null) ? moduleGuid.toLowerCase() : "NullModuleGuid") + "_" +
- ((packageName != null) ? packageName : "NullPackageName") + "_" +
- ((packageGuid != null) ? packageGuid.toLowerCase() : "NullPackageGuid") + "_" +
- ((arch != null) ? arch : "NullArch") + "_" +
- "NullVersion");
- }
-
- /**
- Get primary key string for this usage instance
-
- @return String primary key string
- **/
- public String getPrimaryKey() {
- return UsageInstance.getPrimaryKey(moduleId, arch);
- }
-
- /**
- Judget whether current module is PEI driver
-
- @return boolean whether current module is PEI driver
- **/
- public boolean isPeiPhaseComponent() {
- int moduleType = CommonDefinition.getModuleType(moduleId.getModuleType());
-
- if ((moduleType == CommonDefinition.ModuleTypePeiCore) ||
- (moduleType == CommonDefinition.ModuleTypePeim)) {
- return true;
- }
- return false;
- }
-
- /**
- Judge whether current module is DXE driver.
-
- @return boolean whether current module is DXE driver
- **/
- public boolean isDxePhaseComponent() {
- int moduleType = CommonDefinition.getModuleType(moduleId.getModuleType());
-
- if ((moduleType == CommonDefinition.ModuleTypeDxeDriver) ||
- (moduleType == CommonDefinition.ModuleTypeDxeRuntimeDriver) ||
- (moduleType == CommonDefinition.ModuleTypeDxeSalDriver) ||
- (moduleType == CommonDefinition.ModuleTypeDxeSmmDriver) ||
- (moduleType == CommonDefinition.ModuleTypeUefiDriver) ||
- (moduleType == CommonDefinition.ModuleTypeUefiApplication)
- ) {
- return true;
- }
- return false;
- }
-
- /**
- Generate autogen string for header file and C code file.
-
- @param isBuildUsedLibrary whether the autogen is for library.
- **/
- public void generateAutoGen(boolean isBuildUsedLibrary) {
- String guidStringCName = null;
- boolean isByteArray = false;
- String printDatum = null;
- String tokenNumberString = null;
-
- hAutogenStr = "";
- cAutogenStr = "";
-
- if (this.modulePcdType == Token.PCD_TYPE.DYNAMIC_EX) {
- //
- // For DYNAMIC_EX type PCD, use original token number in SPD or FPD to generate autogen
- //
- tokenNumberString = Long.toString(parentToken.dynamicExTokenNumber, 16);
- } else {
- //
- // For Others type PCD, use autogenerated token number to generate autogen
- //
- tokenNumberString = Long.toString(parentToken.tokenNumber, 16);
- }
-
- hAutogenStr += String.format("#define _PCD_TOKEN_%s 0x%s\r\n", parentToken.cName, tokenNumberString);
-
- //
- // Judge the value of this PCD is byte array type
- //
- if (!isBuildUsedLibrary && !parentToken.isDynamicPCD) {
- if (datum.trim().charAt(0) == '{') {
- isByteArray = true;
- }
- }
-
- //
- // "ULL" should be added to value's tail for UINT64 value
- //
- if (parentToken.datumType == Token.DATUM_TYPE.UINT64) {
- printDatum = this.datum + "ULL";
- } else {
- printDatum = this.datum;
- }
-
- switch (modulePcdType) {
- case FEATURE_FLAG:
- hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n",
- parentToken.cName);
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s _gPcd_FixedAtBuild_%s\r\n",
- parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- hAutogenStr += String.format("//#define _PCD_SET_MODE_%s_%s ASSERT(FALSE) If is not allowed to set value for a FEATURE_FLAG PCD\r\n",
- parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName);
-
- if (!isBuildUsedLibrary) {
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
- parentToken.cName,
- printDatum);
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
- parentToken.cName,
- parentToken.cName);
- }
- break;
- case FIXED_AT_BUILD:
- if (isByteArray) {
- hAutogenStr += String.format("extern const UINT8 _gPcd_FixedAtBuild_%s[];\r\n",
- parentToken.cName);
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s (VOID*)_gPcd_FixedAtBuild_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- } else {
- hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName);
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s _gPcd_FixedAtBuild_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
-
- hAutogenStr += String.format("//#define _PCD_SET_MODE_%s_%s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\r\n",
- parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName);
- if (!isBuildUsedLibrary) {
- if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {
- if (isByteArray) {
- hAutogenStr += String.format("#define _PCD_VALUE_%s (VOID*)_gPcd_FixedAtBuild_%s\r\n",
- parentToken.cName,
- parentToken.cName);
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_%s[] = %s;\r\n",
- parentToken.cName,
- printDatum);
- } else {
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
- parentToken.cName,
- printDatum);
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
- } else {
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
- parentToken.cName,
- printDatum);
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
- }
- break;
- case PATCHABLE_IN_MODULE:
- if (isByteArray) {
- hAutogenStr += String.format("extern UINT8 _gPcd_BinaryPatch_%s[];\r\n",
- parentToken.cName);
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s (VOID*)_gPcd_BinaryPatch_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- } else {
- hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName);
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s _gPcd_BinaryPatch_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
-
- //
- // Generate _PCD_SET_MODE_xx macro for using set BinaryPatch value via PcdSet macro
- //
- if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {
- hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) CopyMem (_gPcd_BinaryPatch_%s, (Buffer), (SizeOfBuffer))\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- } else {
- hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(Value) (_gPcd_BinaryPatch_%s = (Value))\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
-
- if (!isBuildUsedLibrary) {
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
- parentToken.cName,
- printDatum);
- if (isByteArray) {
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[] = _PCD_VALUE_%s;\r\n",
- parentToken.cName,
- parentToken.cName);
- } else {
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED %s _gPcd_BinaryPatch_%s = _PCD_VALUE_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
- }
-
- break;
- case DYNAMIC:
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s LibPcdGet%s(_PCD_TOKEN_%s)\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
- parentToken.cName);
- if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {
- hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) LibPcdSet%s(_PCD_TOKEN_%s, (SizeOfBuffer), (Buffer))\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
- parentToken.cName);
- } else {
- hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(Value) LibPcdSet%s(_PCD_TOKEN_%s, (Value))\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
- parentToken.cName);
- }
- break;
- case DYNAMIC_EX:
- guidStringCName = "_gPcd_TokenSpaceGuid_" +
- parentToken.tokenSpaceName.toString().replaceAll("-", "_");
-
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s LibPcdGetEx%s(&%s, _PCD_TOKEN_%s)\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
- guidStringCName,
- parentToken.cName);
-
- if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {
- hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, _PCD_TOKEN_%s, (SizeOfBuffer), (Buffer))\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
- guidStringCName,
- parentToken.cName);
- } else {
- hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(Value) LibPcdSetEx%s(&%s, _PCD_TOKEN_%s, (Value))\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
- guidStringCName,
- parentToken.cName);
-
- }
- break;
- }
- }
-
- /**
- Get the autogen string for header file.
-
- @return The string of header file.
- **/
- public String getHAutogenStr() {
- return hAutogenStr;
- }
-
- /**
- Get the autogen string for C code file.
-
- @return The string of C Code file.
- **/
- public String getCAutogenStr() {
- return cAutogenStr;
- }
-}
-
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/BuildActionException.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/BuildActionException.java deleted file mode 100644 index 357ebf017a..0000000000 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/BuildActionException.java +++ /dev/null @@ -1,33 +0,0 @@ -/** @file
- BuildActionException class.
-
- BuildAction Exception deals with all build action exceptions.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.build.pcd.exception;
-
-import org.apache.tools.ant.BuildException;
-
-/**
- BuildAction Exception deals with all build action exceptions.
-**/
-public class BuildActionException extends BuildException {
- static final long serialVersionUID = -7034897190740066939L;
- /**
- Constructure function
-
- @param reason exception message string.
- **/
- public BuildActionException(String reason) {
- super(reason);
- }
-}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/EntityException.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/EntityException.java deleted file mode 100644 index 070c2db5d7..0000000000 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/EntityException.java +++ /dev/null @@ -1,31 +0,0 @@ -/** @file
- EntityException class.
-
- The class handle the exception throwed by entity class.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.build.pcd.exception;
-
-/**
- The class handle the exception throwed by entity class.
-**/
-public class EntityException extends Exception {
- static final long serialVersionUID = -8034897190740066939L;
- /**
- Constructure function
-
- @param expStr exception message string.
- **/
- public EntityException(String expStr) {
- super("[PCD EntityException]:" + expStr);
- }
-}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/UIException.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/UIException.java deleted file mode 100644 index 96575a1450..0000000000 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/UIException.java +++ /dev/null @@ -1,31 +0,0 @@ -/** @file
- UIException class.
-
- The class handle the exception throwed by UI action class.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.build.pcd.exception;
-
-/**
- The class handle the exception throwed by UI action class.
-**/
-public class UIException extends Exception {
- static final long serialVersionUID = -7034897190740066930L;
- /**
- Constructure function
-
- @param reason exception message string.
- **/
- public UIException(String reason) {
- super(reason);
- }
-}
|