mirror of https://github.com/acidanthera/audk.git
Modify code according to Wang, jian's comments.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1182 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
e6225e3c73
commit
f28c083051
|
@ -162,7 +162,7 @@ public abstract class PlatformPcdPreprocessAction {
|
|||
// 2), Loop all modules to process <PcdBuildDeclarations> for each module.
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
for (index = 0; index < modules.size(); index ++) {
|
||||
for (index = 0; index < modules.size(); index++) {
|
||||
//
|
||||
// It is legal for a module does not contains ANY pcd build definitions.
|
||||
//
|
||||
|
@ -179,7 +179,7 @@ public abstract class PlatformPcdPreprocessAction {
|
|||
// 2.1), Loop all Pcd entry for a module and add it into memory database.
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
for (pcdIndex = 0; pcdIndex < pcdBuildDataArray.size(); pcdIndex ++) {
|
||||
for (pcdIndex = 0; pcdIndex < pcdBuildDataArray.size(); pcdIndex++) {
|
||||
pcdBuildData = pcdBuildDataArray.get(pcdIndex);
|
||||
|
||||
tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());
|
||||
|
@ -189,7 +189,7 @@ public abstract class PlatformPcdPreprocessAction {
|
|||
}
|
||||
|
||||
primaryKey = Token.getPrimaryKeyString(pcdBuildData.getCName(), tokenSpaceStrRet[1]);
|
||||
pcdType = Token.getpcdTypeFromString(pcdBuildData.getItemType().toString());
|
||||
pcdType = Token.getPcdTypeFromString(pcdBuildData.getItemType().toString());
|
||||
datumType = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());
|
||||
tokenNumber = Long.decode(pcdBuildData.getToken().toString());
|
||||
if (pcdBuildData.getValue() != null) {
|
||||
|
@ -372,7 +372,7 @@ public abstract class PlatformPcdPreprocessAction {
|
|||
//
|
||||
List<Token> tokenArray = getUnreferencedDynamicPcd();
|
||||
if (tokenArray != null) {
|
||||
for (index = 0; index < tokenArray.size(); index ++) {
|
||||
for (index = 0; index < tokenArray.size(); index++) {
|
||||
pcdDbManager.addTokenToDatabase(tokenArray.get(index).getPrimaryKeyString(),
|
||||
tokenArray.get(index));
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ public abstract class PlatformPcdPreprocessAction {
|
|||
//
|
||||
// Loop all sku data
|
||||
//
|
||||
for (index = 0; index < skuInfoList.size(); index ++) {
|
||||
for (index = 0; index < skuInfoList.size(); index++) {
|
||||
skuInstance = new SkuInstance();
|
||||
//
|
||||
// Although SkuId in schema is BigInteger, but in fact, sku id is 32 bit value.
|
||||
|
@ -633,7 +633,7 @@ public abstract class PlatformPcdPreprocessAction {
|
|||
return null;
|
||||
}
|
||||
|
||||
for (index2 = 0; index2 < dynamicPcdBuildDataArray.size(); index2 ++) {
|
||||
for (index2 = 0; index2 < dynamicPcdBuildDataArray.size(); index2++) {
|
||||
pcdBuildData = dynamicPcdBuildDataArray.get(index2);
|
||||
tokenSpaceStrRet = this.getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());
|
||||
|
||||
|
@ -648,7 +648,7 @@ public abstract class PlatformPcdPreprocessAction {
|
|||
continue;
|
||||
}
|
||||
|
||||
pcdType = Token.getpcdTypeFromString(pcdBuildData.getItemType().toString());
|
||||
pcdType = Token.getPcdTypeFromString(pcdBuildData.getItemType().toString());
|
||||
if (pcdType != Token.PCD_TYPE.DYNAMIC_EX) {
|
||||
throw new EntityException (String.format("[FPD file error] It not allowed for DYNAMIC PCD %s who is no used by any module",
|
||||
pcdBuildData.getCName()));
|
||||
|
@ -681,7 +681,7 @@ public abstract class PlatformPcdPreprocessAction {
|
|||
//
|
||||
// Loop all sku data
|
||||
//
|
||||
for (index = 0; index < skuInfoList.size(); index ++) {
|
||||
for (index = 0; index < skuInfoList.size(); index++) {
|
||||
skuInstance = new SkuInstance();
|
||||
//
|
||||
// Although SkuId in schema is BigInteger, but in fact, sku id is 32 bit value.
|
||||
|
@ -870,7 +870,7 @@ public abstract class PlatformPcdPreprocessAction {
|
|||
//
|
||||
// Remove blank space from these string and remove header string "0x"
|
||||
//
|
||||
for (index = 0; index < 11; index ++) {
|
||||
for (index = 0; index < 11; index++) {
|
||||
splitStringArray[index] = splitStringArray[index].trim();
|
||||
splitStringArray[index] = splitStringArray[index].substring(2, splitStringArray[index].length());
|
||||
}
|
||||
|
@ -878,9 +878,9 @@ public abstract class PlatformPcdPreprocessAction {
|
|||
//
|
||||
// Add heading '0' to normalize the string length
|
||||
//
|
||||
for (index = 3; index < 11; index ++) {
|
||||
for (index = 3; index < 11; index++) {
|
||||
chLen = splitStringArray[index].length();
|
||||
for (chIndex = 0; chIndex < 2 - chLen; chIndex ++) {
|
||||
for (chIndex = 0; chIndex < 2 - chLen; chIndex++) {
|
||||
splitStringArray[index] = "0" + splitStringArray[index];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ public class CommonDefinition {
|
|||
(componentType < CommonDefinition.ComponentTypeNull)) {
|
||||
return null;
|
||||
}
|
||||
for (int index = 0; index < CommonDefinition.componentEnum.length; index ++) {
|
||||
for (int index = 0; index < CommonDefinition.componentEnum.length; index++) {
|
||||
if (componentType == CommonDefinition.componentEnum[index].type) {
|
||||
return CommonDefinition.componentEnum[index].moduleTypeStr;
|
||||
}
|
||||
|
|
|
@ -20,26 +20,33 @@ import java.util.UUID;
|
|||
|
||||
import org.tianocore.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.
|
||||
/**
|
||||
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}
|
||||
|
||||
///
|
||||
/// The value type maybe:
|
||||
/// HII_TYPE: the value stored into variable area.
|
||||
/// VPD_TYPE: the value stored into OEM specific area.
|
||||
/// DEFAULT_TYPE: the value stored into PCD runtime database.
|
||||
///
|
||||
public VALUE_TYPE type;
|
||||
|
||||
///
|
||||
/// ---------------------------------------------------------------------
|
||||
/// Following member is for HII case.
|
||||
/// Following member is for HII case. The value of HII case will be put
|
||||
/// into variable area in flash.
|
||||
/// ---------------------------------------------------------------------
|
||||
///
|
||||
|
||||
|
@ -66,14 +73,21 @@ public class DynamicTokenValue {
|
|||
|
||||
///
|
||||
/// ---------------------------------------------------------------------
|
||||
/// Following member is for VPD case.
|
||||
/// Following member is for VPD case. The value of VPD case will be put into
|
||||
/// some flash position pointed by OEM.
|
||||
/// ---------------------------------------------------------------------
|
||||
///
|
||||
|
||||
public String vpdOffset;
|
||||
|
||||
/// ---------------------------------------------------------------------
|
||||
/// Following member is for default case.
|
||||
/// Following member is for default case. The value of default type will
|
||||
/// be put into PCD runtime database.
|
||||
/// ---------------------------------------------------------------------
|
||||
|
||||
///
|
||||
/// The default value of this PCD in default case.
|
||||
///
|
||||
public String value;
|
||||
|
||||
/**
|
||||
|
@ -116,15 +130,17 @@ public class DynamicTokenValue {
|
|||
BUGBUG: In fact, it is not correctly, variable name should be
|
||||
treated as unicode UINT16 array.
|
||||
|
||||
@return String
|
||||
*/
|
||||
@return String
|
||||
**/
|
||||
public String getStringOfVariableName()
|
||||
throws EntityException {
|
||||
String str;
|
||||
int index, num;
|
||||
int size;
|
||||
|
||||
str = "";
|
||||
for (index = 0; index < variableName.size(); index ++) {
|
||||
str = "";
|
||||
size = variableName.size();
|
||||
for (index = 0; index < 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!"));
|
||||
|
@ -138,8 +154,8 @@ public class DynamicTokenValue {
|
|||
/**
|
||||
Set Vpd case data.
|
||||
|
||||
@param vpdOffset
|
||||
*/
|
||||
@param vpdOffset the value offset the start address of OEM specific.
|
||||
**/
|
||||
public void setVpdData(String vpdOffset) {
|
||||
this.type = VALUE_TYPE.VPD_TYPE;
|
||||
|
||||
|
@ -150,7 +166,7 @@ public class DynamicTokenValue {
|
|||
Set default case data.
|
||||
|
||||
@param value
|
||||
*/
|
||||
**/
|
||||
public void setValue(String value) {
|
||||
this.type = VALUE_TYPE.DEFAULT_TYPE;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public class MemoryDatabaseManager {
|
|||
|
||||
///
|
||||
/// 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
|
||||
/// library is inheritted by the module, so stored module's PCD information as PCD
|
||||
/// context of building libary.
|
||||
///
|
||||
public static List<UsageInstance> UsageInstanceContext = null;
|
||||
|
@ -118,26 +118,26 @@ public class MemoryDatabaseManager {
|
|||
Object[] dataArray = null;
|
||||
Map.Entry entry = null;
|
||||
int index = 0;
|
||||
int size = 0;
|
||||
|
||||
if (memoryDatabase == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
dataArray = memoryDatabase.entrySet().toArray();
|
||||
size = memoryDatabase.size();
|
||||
tokenArray = new Token[memoryDatabase.size()];
|
||||
for (index = 0; index < memoryDatabase.size(); index ++) {
|
||||
for (index = 0; index < 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
|
||||
*/
|
||||
@return ArrayList the array list contains all dynamic type PCD.
|
||||
**/
|
||||
private ArrayList getDynamicRecordArray() {
|
||||
Token[] tokenArray = getRecordArray();
|
||||
int index = 0;
|
||||
|
@ -167,16 +167,17 @@ public class MemoryDatabaseManager {
|
|||
ArrayList tokenArrayList = getDynamicRecordArray();
|
||||
Object[] usageInstanceArray = null;
|
||||
UsageInstance usageInstance = null;
|
||||
int size = 0;
|
||||
int consumerSize = 0;
|
||||
|
||||
//pei = new ArrayList<Token>();
|
||||
//dxe = new ArrayList<Token>();
|
||||
|
||||
for (index = 0; index < tokenArrayList.size(); index++) {
|
||||
size = tokenArrayList.size();
|
||||
for (index = 0; index < 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 ++) {
|
||||
consumerSize = token.consumers.size();
|
||||
for (usageInstanceIndex = 0; usageInstanceIndex < consumerSize; usageInstanceIndex++) {
|
||||
usageInstance =(UsageInstance) (((Map.Entry)usageInstanceArray[usageInstanceIndex]).getValue());
|
||||
if (usageInstance.isPeiPhaseComponent()) {
|
||||
pei.add(token);
|
||||
|
@ -193,7 +194,8 @@ public class MemoryDatabaseManager {
|
|||
if (!found) {
|
||||
if (token.consumers != null) {
|
||||
usageInstanceArray = token.consumers.entrySet().toArray();
|
||||
for (usageInstanceIndex = 0; usageInstanceIndex < token.consumers.size(); usageInstanceIndex ++) {
|
||||
consumerSize = token.consumers.size();
|
||||
for (usageInstanceIndex = 0; usageInstanceIndex < consumerSize; usageInstanceIndex++) {
|
||||
usageInstance =(UsageInstance) (((Map.Entry)usageInstanceArray[usageInstanceIndex]).getValue());
|
||||
if (usageInstance.isDxePhaseComponent()) {
|
||||
dxe.add(token);
|
||||
|
@ -216,8 +218,6 @@ public class MemoryDatabaseManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -240,8 +240,8 @@ public class MemoryDatabaseManager {
|
|||
|
||||
@param primaryKey the primary key of usage instance.
|
||||
|
||||
@return List<UsageInstance>
|
||||
*/
|
||||
@return List<UsageInstance> the list contains all usage instances.
|
||||
**/
|
||||
public List<UsageInstance> getUsageInstanceArrayByKeyString(String primaryKey) {
|
||||
Token[] tokenArray = null;
|
||||
int recordIndex = 0;
|
||||
|
@ -253,7 +253,7 @@ public class MemoryDatabaseManager {
|
|||
//
|
||||
// Loop to find all PCD record related to current module
|
||||
//
|
||||
for (recordIndex = 0; recordIndex < getDBSize(); recordIndex ++) {
|
||||
for (recordIndex = 0; recordIndex < getDBSize(); recordIndex++) {
|
||||
if (tokenArray[recordIndex].consumers.size() != 0) {
|
||||
usageInstance = tokenArray[recordIndex].consumers.get(primaryKey);
|
||||
if (usageInstance != null) {
|
||||
|
@ -272,7 +272,7 @@ public class MemoryDatabaseManager {
|
|||
**/
|
||||
public List<String> getAllModuleArray()
|
||||
{
|
||||
int indexToken = 0;
|
||||
int tokenIndex = 0;
|
||||
int usageIndex = 0;
|
||||
int moduleIndex = 0;
|
||||
Token[] tokenArray = null;
|
||||
|
@ -280,24 +280,26 @@ public class MemoryDatabaseManager {
|
|||
List<String> moduleNames = new ArrayList<String>();
|
||||
UsageInstance usageInstance = null;
|
||||
boolean bFound = false;
|
||||
String primaryKey = null;
|
||||
|
||||
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 ++) {
|
||||
for (tokenIndex = 0; tokenIndex < getDBSize(); tokenIndex++) {
|
||||
usageInstanceArray = tokenArray[tokenIndex].consumers.entrySet().toArray();
|
||||
for (usageIndex = 0; usageIndex < tokenArray[tokenIndex].consumers.size(); usageIndex++) {
|
||||
usageInstance = (UsageInstance)((Map.Entry)usageInstanceArray[usageIndex]).getValue();
|
||||
primaryKey = usageInstance.getPrimaryKey();
|
||||
bFound = false;
|
||||
for (moduleIndex = 0; moduleIndex < moduleNames.size(); moduleIndex ++) {
|
||||
if (moduleNames.get(moduleIndex).equalsIgnoreCase(usageInstance.getPrimaryKey())) {
|
||||
for (moduleIndex = 0; moduleIndex < moduleNames.size(); moduleIndex++) {
|
||||
if (moduleNames.get(moduleIndex).equalsIgnoreCase(primaryKey)) {
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bFound) {
|
||||
moduleNames.add(usageInstance.getPrimaryKey());
|
||||
moduleNames.add(primaryKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
**/
|
||||
package org.tianocore.pcd.entity;
|
||||
|
||||
/** Sku instance contains ID and value, A pcd token maybe contains more than one Sku instance.
|
||||
/**
|
||||
Sku instance contains ID and value, A pcd token maybe contains more than one Sku instance.
|
||||
**/
|
||||
public class SkuInstance {
|
||||
///
|
||||
|
|
|
@ -137,7 +137,8 @@ public class Token {
|
|||
@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 ++) {
|
||||
int size = supportedPcdType.size();
|
||||
for (int index = 0; index < size; index++) {
|
||||
if (supportedPcdType.get(index) == pcdType) {
|
||||
return;
|
||||
}
|
||||
|
@ -156,7 +157,7 @@ public class Token {
|
|||
@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)) {
|
||||
|
@ -166,8 +167,15 @@ public class Token {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
The pcd type is DynamicEx?
|
||||
|
||||
@retval true Is DynamicEx type
|
||||
@retval false not DynamicEx type
|
||||
**/
|
||||
public boolean isDynamicEx() {
|
||||
for (int i = 0; i < supportedPcdType.size(); i++) {
|
||||
int size = supportedPcdType.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (supportedPcdType.get(i) == PCD_TYPE.DYNAMIC_EX) {
|
||||
return true;
|
||||
}
|
||||
|
@ -196,7 +204,7 @@ public class Token {
|
|||
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;
|
||||
|
@ -232,7 +240,7 @@ public class Token {
|
|||
Get the token primary key in token database.
|
||||
|
||||
@return String
|
||||
*/
|
||||
**/
|
||||
public String getPrimaryKeyString () {
|
||||
return Token.getPrimaryKeyString(cName, tokenSpaceName);
|
||||
}
|
||||
|
@ -303,7 +311,7 @@ public class Token {
|
|||
@param usageId The UsageInstance identification for usage instance
|
||||
|
||||
@return boolean whether exist an usage instance for this token.
|
||||
*/
|
||||
**/
|
||||
public boolean isUsageInstanceExist(UsageIdentification usageId) {
|
||||
String keyStr = UsageInstance.getPrimaryKey(usageId);
|
||||
|
||||
|
@ -317,7 +325,7 @@ public class Token {
|
|||
|
||||
@return PCD_TYPE
|
||||
**/
|
||||
public static PCD_TYPE getpcdTypeFromString(String pcdTypeStr) {
|
||||
public static PCD_TYPE getPcdTypeFromString(String pcdTypeStr) {
|
||||
if (pcdTypeStr == null) {
|
||||
return PCD_TYPE.UNKNOWN;
|
||||
}
|
||||
|
@ -345,21 +353,7 @@ public class Token {
|
|||
@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";
|
||||
return datumType.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -394,19 +388,7 @@ public class Token {
|
|||
@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";
|
||||
return pcdType.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -442,17 +424,7 @@ public class Token {
|
|||
@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";
|
||||
return usage.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -540,9 +512,9 @@ public class Token {
|
|||
@retval DynamicTokenValue the value of this dyanmic token.
|
||||
**/
|
||||
public DynamicTokenValue getDefaultSku() {
|
||||
int index;
|
||||
|
||||
for (index = 0; index < this.skuData.size(); index ++) {
|
||||
int index;
|
||||
int size = skuData.size();
|
||||
for (index = 0; index < size; index++) {
|
||||
if (skuData.get(index).id == 0) {
|
||||
return skuData.get(index).value;
|
||||
}
|
||||
|
@ -564,7 +536,7 @@ public class Token {
|
|||
Get the size of PCD value, this PCD is POINTER type.
|
||||
|
||||
@param str the string of the value
|
||||
@param al
|
||||
@param al the array list for outer parameter.
|
||||
**/
|
||||
private void getCurrentSizeFromDefaultValue (String str, ArrayList<Integer> al) {
|
||||
if (isValidNullValue(str)) {
|
||||
|
@ -644,8 +616,8 @@ public class Token {
|
|||
SKU 0 will be returned; For Default type, the defaultvalue of default SKU
|
||||
0 will be returned.
|
||||
|
||||
@return String
|
||||
*/
|
||||
@return String get the default value for a DYNAMIC type PCD.
|
||||
**/
|
||||
public String getDynamicDefaultValue() {
|
||||
DynamicTokenValue dynamicData = getDefaultSku();
|
||||
if (hasDefaultValue()) {
|
||||
|
@ -658,10 +630,11 @@ public class Token {
|
|||
return null;
|
||||
}
|
||||
|
||||
//
|
||||
// BugBug: We need change this algorithm accordingly when schema is updated
|
||||
// to support no default value.
|
||||
//
|
||||
/**
|
||||
Judge whether a DYNAMIC PCD has default value.
|
||||
|
||||
@return whether a DYNAMIC PCD has default value.
|
||||
**/
|
||||
public boolean hasDefaultValue () {
|
||||
DynamicTokenValue dynamicValue = null;
|
||||
|
||||
|
@ -687,10 +660,10 @@ public class Token {
|
|||
/**
|
||||
Judge the value is NULL value. NULL value means the value is uninitialized value
|
||||
|
||||
@param judgedValue
|
||||
@param judgedValue the want want to be judged
|
||||
|
||||
@return boolean
|
||||
*/
|
||||
@return boolean whether the value of PCD is NULL.
|
||||
**/
|
||||
public boolean isValidNullValue(String judgedValue) {
|
||||
String subStr;
|
||||
BigInteger bigIntValue;
|
||||
|
@ -742,12 +715,21 @@ public class Token {
|
|||
}
|
||||
break;
|
||||
case POINTER:
|
||||
if (judgedValue.equalsIgnoreCase("") ||
|
||||
judgedValue.equalsIgnoreCase("\"\"") ||
|
||||
if (judgedValue.equalsIgnoreCase("\"\"") ||
|
||||
judgedValue.equalsIgnoreCase("L\"\"") ||
|
||||
(judgedValue.length() == 0) ||
|
||||
judgedValue.equalsIgnoreCase("{0}")) {
|
||||
(judgedValue.length() == 0)) {
|
||||
return true;
|
||||
} else if (judgedValue.trim().charAt(0) == '{') {
|
||||
int start = judgedValue.indexOf('{');
|
||||
int end = judgedValue.lastIndexOf('}');
|
||||
String[] strValueArray = judgedValue.substring(start + 1, end).split(",");
|
||||
if (strValueArray.length > 1) {
|
||||
return false;
|
||||
} else {
|
||||
if (strValueArray[0].matches("(0x)?(0X)?0*")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -756,7 +738,7 @@ public class Token {
|
|||
/**
|
||||
Is the string value in Unicode
|
||||
|
||||
@return boolean
|
||||
@return boolean the string value is UNICODE type string.
|
||||
**/
|
||||
public boolean isHiiDefaultValueUnicodeStringType() {
|
||||
DynamicTokenValue dynamicData = getDefaultSku();
|
||||
|
@ -771,7 +753,7 @@ public class Token {
|
|||
/**
|
||||
Is the string value in ANSCI
|
||||
|
||||
@return boolean
|
||||
@return boolean whether the dfault value for HII case is string type.
|
||||
**/
|
||||
public boolean isHiiDefaultValueASCIIStringType() {
|
||||
DynamicTokenValue dynamicData = getDefaultSku();
|
||||
|
@ -785,8 +767,9 @@ public class Token {
|
|||
|
||||
/**
|
||||
Judege whether current value is UNICODE string type.
|
||||
@return boolean
|
||||
*/
|
||||
|
||||
@return boolean whether the value is UNICODE string.
|
||||
**/
|
||||
public boolean isUnicodeStringType () {
|
||||
String str = getDynamicDefaultValue();
|
||||
|
||||
|
@ -803,6 +786,11 @@ public class Token {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
Judge whether the string type is ANSIC string.
|
||||
|
||||
@return boolean whether the string type is ANSIC string
|
||||
**/
|
||||
public boolean isASCIIStringType () {
|
||||
String str = getDynamicDefaultValue();
|
||||
|
||||
|
@ -819,6 +807,12 @@ public class Token {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
Judge whether the string value is byte array.
|
||||
|
||||
@return boolean whether the string value is byte array.
|
||||
|
||||
**/
|
||||
public boolean isByteStreamType () {
|
||||
String str = getDynamicDefaultValue();
|
||||
|
||||
|
@ -836,6 +830,11 @@ public class Token {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
Get string value for ANSIC string type
|
||||
|
||||
@return String the string value
|
||||
**/
|
||||
public String getStringTypeString () {
|
||||
return getDefaultSku().value.substring(2, getDefaultSku().value.length() - 1);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class UsageInstance {
|
|||
Constructure function for UsageInstance
|
||||
|
||||
@param parentToken The token instance for this usgaInstance
|
||||
@param id The identification for usage instance
|
||||
@param usageId 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
|
||||
|
|
Loading…
Reference in New Issue