]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Abstract the logic of Platform pcd preprocess according to FPD file to a class. And...
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 1 Aug 2006 14:53:02 +0000 (14:53 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 1 Aug 2006 14:53:02 +0000 (14:53 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1170 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/PcdTools/org/tianocore/pcd/action/ActionMessage.java
Tools/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java [new file with mode: 0644]
Tools/Source/PcdTools/org/tianocore/pcd/entity/CommonDefinition.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/DynamicTokenValue.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/SkuInstance.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/Token.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/UsageIdentification.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/UsageInstance.java

index 2b589e571a4a680e9b6cfbd9f16f7d13e569a840..3c4b467f7fa5fbb39903b5dfeee57dbbb2670f35 100644 (file)
@@ -3,13 +3,13 @@
 \r
   ActionMessage class take over all message for loging and waning. This class should\r
   dispatch message into different class according to instance class type.\r
 \r
   ActionMessage class take over all message for loging and waning. This class should\r
   dispatch message into different class according to instance class type.\r
\r
+\r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
\r
+\r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
@@ -17,49 +17,55 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 package org.tianocore.pcd.action;\r
 \r
 import org.apache.tools.ant.Task;\r
 package org.tianocore.pcd.action;\r
 \r
 import org.apache.tools.ant.Task;\r
+import org.tianocore.logger.EdkLog;\r
 \r
 \r
-/** ActionMessage class take over all message for loging and waning. This class \r
-    should dispatch message into different Action class according to instance \r
+/** ActionMessage class take over all message for loging and waning. This class\r
+    should dispatch message into different Action class according to instance\r
     class type.\r
 **/\r
 public class ActionMessage {\r
     ///\r
     class type.\r
 **/\r
 public class ActionMessage {\r
     ///\r
-    /// Macro definition for NULL messge level. \r
+    /// Macro definition for NULL messge level.\r
     /// In this meessage level, all message will be hidden.\r
     ///\r
     /// In this meessage level, all message will be hidden.\r
     ///\r
-    public final static int NULL_MESSAGE_LEVEL    = 0; \r
+    public final static int NULL_MESSAGE_LEVEL    = 0;\r
+\r
     ///\r
     /// Macro definition for Log messge level.\r
     /// In this message level, Only log information will be shown.\r
     ///\r
     public final static int LOG_MESSAGE_LEVEL     = 1;\r
     ///\r
     /// Macro definition for Log messge level.\r
     /// In this message level, Only log information will be shown.\r
     ///\r
     public final static int LOG_MESSAGE_LEVEL     = 1;\r
+\r
     ///\r
     ///\r
-    /// Macro definition for Warning message level.  \r
+    /// Macro definition for Warning message level.\r
     /// In this message level, log and waning message will be shown.\r
     ///\r
     public final static int WARNING_MESSAGE_LEVEL = 2;\r
     /// In this message level, log and waning message will be shown.\r
     ///\r
     public final static int WARNING_MESSAGE_LEVEL = 2;\r
+\r
     ///\r
     /// Macro definition for Debug mesage level.\r
     /// In this message level, log, warning, debug message will be shown.\r
     ///\r
     public final static int DEBUG_MESSAGE_LEVEL   = 3;\r
     ///\r
     /// Macro definition for Debug mesage level.\r
     /// In this message level, log, warning, debug message will be shown.\r
     ///\r
     public final static int DEBUG_MESSAGE_LEVEL   = 3;\r
+\r
     ///\r
     /// Macor definition for MAX message level.\r
     /// In this message level, all message will be shown.\r
     ///\r
     public final static int MAX_MESSAGE_LEVEL     = 4;\r
     ///\r
     /// Macor definition for MAX message level.\r
     /// In this message level, all message will be shown.\r
     ///\r
     public final static int MAX_MESSAGE_LEVEL     = 4;\r
+\r
     ///\r
     /// Current message level. It will control all message output for PCD tool.\r
     ///\r
     public       static int messageLevel          = NULL_MESSAGE_LEVEL;\r
 \r
     /**\r
     ///\r
     /// Current message level. It will control all message output for PCD tool.\r
     ///\r
     public       static int messageLevel          = NULL_MESSAGE_LEVEL;\r
 \r
     /**\r
-      Log() function provide common log information functionality for all \r
+      Log() function provide common log information functionality for all\r
       PCD tool includes all function\r
 \r
       This function will dispatch message to special class such as BuildAction\r
       Class, Entity Class etc.\r
       PCD tool includes all function\r
 \r
       This function will dispatch message to special class such as BuildAction\r
       Class, Entity Class etc.\r
-     \r
+\r
       @param thisClass   The class object who want log information.\r
       @param logStr      The string contains log information.\r
     **/\r
       @param thisClass   The class object who want log information.\r
       @param logStr      The string contains log information.\r
     **/\r
@@ -76,15 +82,15 @@ public class ActionMessage {
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-      Warning() function provide common warning information functionality for all \r
+      Warning() function provide common warning information functionality for all\r
       PCD tool.\r
 \r
       This function will dispatch message to special class such as BuildAction\r
       Class, Entity Class etc.\r
       PCD tool.\r
 \r
       This function will dispatch message to special class such as BuildAction\r
       Class, Entity Class etc.\r
-     \r
+\r
       @param thisClass   The class object who want warn information.\r
       @param warningStr  The string contains warning information.\r
       @param thisClass   The class object who want warn information.\r
       @param warningStr  The string contains warning information.\r
-    **/  \r
+    **/\r
     public static void warning(Object thisClass, String warningStr) {\r
         if(messageLevel < WARNING_MESSAGE_LEVEL) {\r
             return;\r
     public static void warning(Object thisClass, String warningStr) {\r
         if(messageLevel < WARNING_MESSAGE_LEVEL) {\r
             return;\r
@@ -98,15 +104,15 @@ public class ActionMessage {
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-      Debug() function provide common Debug information functionality for all \r
+      Debug() function provide common Debug information functionality for all\r
       PCD tool.\r
 \r
       This function will dispatch message to special class such as BuildAction\r
       Class, Entity Class etc.\r
       PCD tool.\r
 \r
       This function will dispatch message to special class such as BuildAction\r
       Class, Entity Class etc.\r
-     \r
+\r
       @param thisClass   The class object who want Debug information.\r
       @param debugStr    The string contains Debug information.\r
       @param thisClass   The class object who want Debug information.\r
       @param debugStr    The string contains Debug information.\r
-    **/  \r
+    **/\r
     public static void debug(Object thisClass, String debugStr) {\r
         if(messageLevel < DEBUG_MESSAGE_LEVEL) {\r
             return;\r
     public static void debug(Object thisClass, String debugStr) {\r
         if(messageLevel < DEBUG_MESSAGE_LEVEL) {\r
             return;\r
diff --git a/Tools/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java b/Tools/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java
new file mode 100644 (file)
index 0000000..f455a9b
--- /dev/null
@@ -0,0 +1,909 @@
+/** @file\r
+   PlatformPcdPreprocessAction class.\r
+\r
+   The abstract parent class PlatformPcdPreprocessAction, This class is to collect platform's\r
+   pcd build information from fpd file.\r
+   This class will be extended by building tools and wizard tools.\r
+\r
+Copyright (c) 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+package org.tianocore.pcd.action;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+import java.util.UUID;\r
+import java.util.regex.Matcher;\r
+import java.util.regex.Pattern;\r
+\r
+import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions;\r
+import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition;\r
+import org.tianocore.pcd.entity.MemoryDatabaseManager;\r
+import org.tianocore.pcd.exception.EntityException;\r
+import org.tianocore.pcd.entity.*;\r
+import org.tianocore.pcd.entity.Token;\r
+\r
+/**\r
+   The abstract parent class PlatformPcdPreprocessAction, This class is to collect platform's\r
+   pcd build information from fpd file.\r
+   This class will be extended by building tools and wizard tools.\r
+\r
+**/\r
+public abstract class PlatformPcdPreprocessAction {\r
+    ///\r
+    /// PCD memory database\r
+    ///\r
+    private MemoryDatabaseManager pcdDbManager;\r
+\r
+    /**\r
+       Set parameter pcdDbManager\r
+\r
+       @param pcdDbManager\r
+    **/\r
+    public void setPcdDbManager(MemoryDatabaseManager pcdDbManager) {\r
+        this.pcdDbManager = pcdDbManager;\r
+    }\r
+\r
+    /**\r
+       Get parameter pcdDbManager\r
+         \r
+       @return MemoryDatabaseManager\r
+    **/\r
+    public MemoryDatabaseManager getPcdDbManager() {\r
+        return pcdDbManager;\r
+    }\r
+    /**\r
+       Abstract function: retrieve module information from FPD file.\r
+\r
+       In building environement, this function will be implementated by FpdParserTask.\r
+\r
+       @return List<ModuleInfoFromFpd>\r
+    **/\r
+    public abstract List<ModulePcdInfoFromFpd> getComponentsFromFpd()\r
+                                               throws EntityException;\r
+\r
+    /**\r
+       Abstract function to get GUID string from SPD file.\r
+\r
+       In building evnironment, this function will be implementated by GlobaData.\r
+\r
+       @param guidCName the CName of GUID\r
+\r
+       @return String[] Guid Info array contains CName and Guid String\r
+    **/\r
+    public abstract String[]                getGuidInfoFromSpd(String guidCName)\r
+                                            throws EntityException;\r
+\r
+    /**\r
+       Abstract function: Verification the PCD data.\r
+\r
+       In different environment, such as building environment and wizard environment,\r
+       it has different implementation according to optimization.\r
+\r
+       @param cName\r
+       @param moduleName\r
+       @param datum\r
+       @param datumType\r
+       @param maxDatumSize\r
+\r
+       @return String\r
+    **/\r
+    public abstract String                  verifyDatum(String            cName,\r
+                                                        String            moduleName,\r
+                                                        String            datum,\r
+                                                        Token.DATUM_TYPE  datumType,\r
+                                                        int               maxDatumSize);\r
+\r
+    /**\r
+       Abstract function: Get dynamic information for a token\r
+\r
+       @param token\r
+       @param moduleName\r
+\r
+       @return DynamicPcdBuildDefinitions.PcdBuildData\r
+    **/\r
+    public abstract DynamicPcdBuildDefinitions.PcdBuildData\r
+                                            getDynamicInfoFromFpd(Token     token,\r
+                                                                  String    moduleName)\r
+                                            throws EntityException;\r
+\r
+    /**\r
+       Abstract function: Get all dynamic PCD information from FPD file.\r
+\r
+       @return List<DynamicPcdBuildDefinitions.PcdBuildData>\r
+    **/\r
+    public abstract List<DynamicPcdBuildDefinitions.PcdBuildData>\r
+                                            getAllDynamicPcdInfoFromFpd()\r
+                                            throws EntityException;\r
+\r
+    /**\r
+      Collect all PCD information from FPD file into PCD memory database.\r
+\r
+    **/\r
+    public void initPcdMemoryDbWithPlatformInfo()\r
+        throws EntityException {\r
+        int                                 index             = 0;\r
+        int                                 pcdIndex          = 0;\r
+        List<PcdBuildDefinition.PcdData>    pcdBuildDataArray = new ArrayList<PcdBuildDefinition.PcdData>();\r
+        PcdBuildDefinition.PcdData          pcdBuildData      = null;\r
+        Token                               token             = null;\r
+        List<ModulePcdInfoFromFpd>          modules           = null;\r
+        String                              primaryKey        = null;\r
+        String                              exceptionString   = null;\r
+        UsageInstance                       usageInstance     = null;\r
+        Token.PCD_TYPE                      pcdType           = Token.PCD_TYPE.UNKNOWN;\r
+        Token.DATUM_TYPE                    datumType         = Token.DATUM_TYPE.UNKNOWN;\r
+        long                                tokenNumber       = 0;\r
+        String                              moduleName        = null;\r
+        String                              datum             = null;\r
+        int                                 maxDatumSize      = 0;\r
+        String[]                            tokenSpaceStrRet  = null;\r
+\r
+        //\r
+        // ----------------------------------------------\r
+        // 1), Get all <ModuleSA> from FPD file.\r
+        // ----------------------------------------------\r
+        //\r
+        modules = getComponentsFromFpd();\r
+\r
+        if (modules == null) {\r
+            throw new EntityException("[FPD file error] No modules in FPD file, Please check whether there are elements in <FrameworkModules> in FPD file!");\r
+        }\r
+\r
+        //\r
+        // -------------------------------------------------------------------\r
+        // 2), Loop all modules to process <PcdBuildDeclarations> for each module.\r
+        // -------------------------------------------------------------------\r
+        //\r
+        for (index = 0; index < modules.size(); index ++) {\r
+           //\r
+           // It is legal for a module does not contains ANY pcd build definitions.\r
+           //\r
+           if (modules.get(index).pcdBuildDefinition == null) {\r
+                continue;\r
+           }\r
+\r
+            pcdBuildDataArray = modules.get(index).pcdBuildDefinition.getPcdDataList();\r
+\r
+            moduleName = modules.get(index).usageId.moduleName;\r
+\r
+            //\r
+            // ----------------------------------------------------------------------\r
+            // 2.1), Loop all Pcd entry for a module and add it into memory database.\r
+            // ----------------------------------------------------------------------\r
+            //\r
+            for (pcdIndex = 0; pcdIndex < pcdBuildDataArray.size(); pcdIndex ++) {\r
+                pcdBuildData = pcdBuildDataArray.get(pcdIndex);\r
+\r
+                tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
+\r
+                if (tokenSpaceStrRet == null) {\r
+                    throw new EntityException ("Fail to get Token space guid for token" + pcdBuildData.getCName());\r
+                }\r
+\r
+                primaryKey   = Token.getPrimaryKeyString(pcdBuildData.getCName(), tokenSpaceStrRet[1]);\r
+                pcdType      = Token.getpcdTypeFromString(pcdBuildData.getItemType().toString());\r
+                datumType    = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());\r
+                tokenNumber  = Long.decode(pcdBuildData.getToken().toString());\r
+                if (pcdBuildData.getValue() != null) {\r
+                    datum = pcdBuildData.getValue().toString();\r
+                } else {\r
+                    datum = null;\r
+                }\r
+                maxDatumSize = pcdBuildData.getMaxDatumSize();\r
+\r
+                if ((pcdType    == Token.PCD_TYPE.FEATURE_FLAG) &&\r
+                    (datumType  != Token.DATUM_TYPE.BOOLEAN)){\r
+                    exceptionString = String.format("[FPD file error] For PCD %s in module %s, the PCD type is FEATRUE_FLAG but "+\r
+                                                    "datum type of this PCD entry is not BOOLEAN!",\r
+                                                    pcdBuildData.getCName(),\r
+                                                    moduleName);\r
+                    throw new EntityException(exceptionString);\r
+                }\r
+\r
+                //\r
+                // -------------------------------------------------------------------------------------------\r
+                // 2.1.1), Do some necessary checking work for FixedAtBuild, FeatureFlag and PatchableInModule\r
+                // -------------------------------------------------------------------------------------------\r
+                //\r
+                if (!Token.isDynamic(pcdType)) {\r
+                     //\r
+                     // Value is required.\r
+                     //\r
+                     if (datum == null) {\r
+                         exceptionString = String.format("[FPD file error] There is no value for PCD entry %s in module %s!",\r
+                                                         pcdBuildData.getCName(),\r
+                                                         moduleName);\r
+                         throw new EntityException(exceptionString);\r
+                     }\r
+\r
+                     //\r
+                     // Check whether the datum size is matched datum type.\r
+                     //\r
+                     if ((exceptionString = verifyDatum(pcdBuildData.getCName(),\r
+                                                        moduleName,\r
+                                                        datum,\r
+                                                        datumType,\r
+                                                        maxDatumSize)) != null) {\r
+                         throw new EntityException(exceptionString);\r
+                     }\r
+                }\r
+\r
+                //\r
+                // ---------------------------------------------------------------------------------\r
+                // 2.1.2), Create token or update token information for current anaylized PCD data.\r
+                // ---------------------------------------------------------------------------------\r
+                //\r
+                if (pcdDbManager.isTokenInDatabase(primaryKey)) {\r
+                    //\r
+                    // If the token is already exist in database, do some necessary checking\r
+                    // and add a usage instance into this token in database\r
+                    //\r
+                    token = pcdDbManager.getTokenByKey(primaryKey);\r
+\r
+                    //\r
+                    // checking for DatumType, DatumType should be unique for one PCD used in different\r
+                    // modules.\r
+                    //\r
+                    if (token.datumType != datumType) {\r
+                        exceptionString = String.format("[FPD file error] The datum type of PCD entry %s is %s, which is different with  %s defined in before!",\r
+                                                        pcdBuildData.getCName(),\r
+                                                        pcdBuildData.getDatumType().toString(),\r
+                                                        Token.getStringOfdatumType(token.datumType));\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+\r
+                    //\r
+                    // Check token number is valid\r
+                    //\r
+                    if (tokenNumber != token.tokenNumber) {\r
+                        exceptionString = String.format("[FPD file error] The token number of PCD entry %s in module %s is different with same PCD entry in other modules!",\r
+                                                        pcdBuildData.getCName(),\r
+                                                        moduleName);\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+\r
+                    //\r
+                    // For same PCD used in different modules, the PCD type should all be dynamic or non-dynamic.\r
+                    //\r
+                    if (token.isDynamicPCD != Token.isDynamic(pcdType)) {\r
+                        exceptionString = String.format("[FPD file error] For PCD entry %s in module %s, you define dynamic or non-dynamic PCD type which"+\r
+                                                        "is different with others module's",\r
+                                                        token.cName,\r
+                                                        moduleName);\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+\r
+                    if (token.isDynamicPCD) {\r
+                        //\r
+                        // Check datum is equal the datum in dynamic information.\r
+                        // For dynamic PCD, you can do not write <Value> in sperated every <PcdBuildDefinition> in different <ModuleSA>,\r
+                        // But if you write, the <Value> must be same as the value in <DynamicPcdBuildDefinitions>.\r
+                        //\r
+                        if (!token.isSkuEnable() &&\r
+                            (token.getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.DEFAULT_TYPE) &&\r
+                            (datum != null)) {\r
+                            if (!datum.equalsIgnoreCase(token.getDefaultSku().value)) {\r
+                                exceptionString = String.format("[FPD file error] For dynamic PCD %s in module %s, the datum in <ModuleSA> is "+\r
+                                                                "not equal to the datum in <DynamicPcdBuildDefinitions>, it is "+\r
+                                                                "illega! You could no set <Value> in <ModuleSA> for a dynamic PCD!",\r
+                                                                token.cName,\r
+                                                                moduleName);\r
+                                throw new EntityException(exceptionString);\r
+                            }\r
+                        }\r
+\r
+                        if ((maxDatumSize != 0) &&\r
+                            (maxDatumSize != token.datumSize)){\r
+                            exceptionString = String.format("[FPD file error] For dynamic PCD %s in module %s, the max datum size is %d which "+\r
+                                                            "is different with <MaxDatumSize> %d defined in <DynamicPcdBuildDefinitions>!",\r
+                                                            token.cName,\r
+                                                            moduleName,\r
+                                                            maxDatumSize,\r
+                                                            token.datumSize);\r
+                            throw new EntityException(exceptionString);\r
+                        }\r
+                    }\r
+\r
+                } else {\r
+                    //\r
+                    // If the token is not in database, create a new token instance and add\r
+                    // a usage instance into this token in database.\r
+                    //\r
+                    tokenSpaceStrRet = this.getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
+\r
+                    if (tokenSpaceStrRet == null) {\r
+                        throw new EntityException("Fail to get token space guid for token " + token.cName);\r
+                    }\r
+\r
+                    token = new Token(pcdBuildData.getCName(), tokenSpaceStrRet[1]);\r
+\r
+                    token.datumType     = datumType;\r
+                    token.tokenNumber   = tokenNumber;\r
+                    token.isDynamicPCD  = Token.isDynamic(pcdType);\r
+                    token.datumSize     = maxDatumSize;\r
+\r
+                    if (token.isDynamicPCD) {\r
+                        //\r
+                        // For Dynamic and Dynamic Ex type, need find the dynamic information\r
+                        // in <DynamicPcdBuildDefinition> section in FPD file.\r
+                        //\r
+                        updateDynamicInformation(moduleName,\r
+                                                 token,\r
+                                                 datum,\r
+                                                 maxDatumSize);\r
+                    }\r
+\r
+                    pcdDbManager.addTokenToDatabase(primaryKey, token);\r
+                }\r
+\r
+                //\r
+                // -----------------------------------------------------------------------------------\r
+                // 2.1.3), Add the PcdType in current module into this Pcd token's supported PCD type.\r
+                // -----------------------------------------------------------------------------------\r
+                //\r
+                token.updateSupportPcdType(pcdType);\r
+\r
+                //\r
+                // ------------------------------------------------\r
+                // 2.1.4), Create an usage instance for this token.\r
+                // ------------------------------------------------\r
+                //\r
+                usageInstance = new UsageInstance(token,\r
+                                                  modules.get(index).usageId,\r
+                                                  pcdType,\r
+                                                  datum,\r
+                                                  maxDatumSize);\r
+                token.addUsageInstance(usageInstance);\r
+            }\r
+        }\r
+\r
+        //\r
+        // ------------------------------------------------\r
+        // 3), Add unreference dynamic_Ex pcd token into Pcd database.\r
+        // ------------------------------------------------\r
+        //\r
+        List<Token> tokenArray = getUnreferencedDynamicPcd();\r
+        if (tokenArray != null) {\r
+            for (index = 0; index < tokenArray.size(); index ++) {\r
+                pcdDbManager.addTokenToDatabase(tokenArray.get(index).getPrimaryKeyString(),\r
+                                             tokenArray.get(index));\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+       Update dynamic information for PCD entry.\r
+\r
+       Dynamic information is retrieved from <PcdDynamicBuildDeclarations> in\r
+       FPD file.\r
+\r
+       @param moduleName        The name of the module who use this PCD\r
+       @param token             The token instance\r
+       @param datum             The <datum> in module's PCD information\r
+       @param maxDatumSize      The <maxDatumSize> in module's PCD information\r
+\r
+       @return Token\r
+     */\r
+    private Token updateDynamicInformation(String   moduleName,\r
+                                           Token    token,\r
+                                           String   datum,\r
+                                           int      maxDatumSize)\r
+        throws EntityException {\r
+        int                 index           = 0;\r
+        int                 offset;\r
+        String              exceptionString = null;\r
+        SkuInstance         skuInstance     = null;\r
+        String              temp;\r
+        boolean             hasSkuId0       = false;\r
+        long                tokenNumber     = 0;\r
+        String              hiiDefaultValue = null;\r
+        String[]            variableGuidString = null;\r
+\r
+        List<DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo>   skuInfoList = null;\r
+        DynamicPcdBuildDefinitions.PcdBuildData                 dynamicInfo = null;\r
+\r
+        dynamicInfo = getDynamicInfoFromFpd(token, moduleName);\r
+        if (dynamicInfo == null) {\r
+            exceptionString = String.format("[FPD file error] For Dynamic PCD %s used by module %s, "+\r
+                                            "there is no dynamic information in <DynamicPcdBuildDefinitions> "+\r
+                                            "in FPD file, but it is required!",\r
+                                            token.cName,\r
+                                            moduleName);\r
+            throw new EntityException(exceptionString);\r
+        }\r
+\r
+        token.datumSize = dynamicInfo.getMaxDatumSize();\r
+\r
+        exceptionString = verifyDatum(token.cName,\r
+                                      moduleName,\r
+                                      null,\r
+                                      token.datumType,\r
+                                      token.datumSize);\r
+        if (exceptionString != null) {\r
+            throw new EntityException(exceptionString);\r
+        }\r
+\r
+        if ((maxDatumSize != 0) &&\r
+            (maxDatumSize != token.datumSize)) {\r
+            exceptionString = String.format("FPD file error] For dynamic PCD %s, the datum size in module %s is %d, but "+\r
+                                            "the datum size in <DynamicPcdBuildDefinitions> is %d, they are not match!",\r
+                                            token.cName,\r
+                                            moduleName,\r
+                                            maxDatumSize,\r
+                                            dynamicInfo.getMaxDatumSize());\r
+            throw new EntityException(exceptionString);\r
+        }\r
+        tokenNumber = Long.decode(dynamicInfo.getToken().toString());\r
+        if (tokenNumber != token.tokenNumber) {\r
+            exceptionString = String.format("[FPD file error] For dynamic PCD %s, the token number in module %s is 0x%x, but"+\r
+                                            "in <DynamicPcdBuildDefinictions>, the token number is 0x%x, they are not match!",\r
+                                            token.cName,\r
+                                            moduleName,\r
+                                            token.tokenNumber,\r
+                                            tokenNumber);\r
+            throw new EntityException(exceptionString);\r
+        }\r
+\r
+        token.dynamicExTokenNumber = tokenNumber;\r
+\r
+        skuInfoList = dynamicInfo.getSkuInfoList();\r
+\r
+        //\r
+        // Loop all sku data\r
+        //\r
+        for (index = 0; index < skuInfoList.size(); index ++) {\r
+            skuInstance = new SkuInstance();\r
+            //\r
+            // Although SkuId in schema is BigInteger, but in fact, sku id is 32 bit value.\r
+            //\r
+            temp = skuInfoList.get(index).getSkuId().toString();\r
+            skuInstance.id = Integer.decode(temp);\r
+            if (skuInstance.id == 0) {\r
+                hasSkuId0 = true;\r
+            }\r
+            //\r
+            // Judge whether is DefaultGroup at first, because most case is DefautlGroup.\r
+            //\r
+            if (skuInfoList.get(index).getValue() != null) {\r
+                skuInstance.value.setValue(skuInfoList.get(index).getValue().toString());\r
+                if ((exceptionString = verifyDatum(token.cName,\r
+                                                   null,\r
+                                                   skuInfoList.get(index).getValue().toString(),\r
+                                                   token.datumType,\r
+                                                   token.datumSize)) != null) {\r
+                    throw new EntityException(exceptionString);\r
+                }\r
+\r
+                token.skuData.add(skuInstance);\r
+\r
+                //\r
+                // Judege wether is same of datum between module's information\r
+                // and dynamic information.\r
+                //\r
+                if (datum != null) {\r
+                    if ((skuInstance.id == 0)                                   &&\r
+                        !datum.toString().equalsIgnoreCase(skuInfoList.get(index).getValue().toString())) {\r
+                        exceptionString = "[FPD file error] For dynamic PCD " + token.cName + ", the value in module " + moduleName + " is " + datum.toString() + " but the "+\r
+                                          "value of sku 0 data in <DynamicPcdBuildDefinition> is " + skuInstance.value.value + ". They are must be same!"+\r
+                                          " or you could not define value for a dynamic PCD in every <ModuleSA>!";\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+                }\r
+                continue;\r
+            }\r
+\r
+            //\r
+            // Judge whether is HII group case.\r
+            //\r
+            if (skuInfoList.get(index).getVariableName() != null) {\r
+                exceptionString = null;\r
+                if (skuInfoList.get(index).getVariableGuid() == null) {\r
+                    exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+                                                    "file, who use HII, but there is no <VariableGuid> defined for Sku %d data!",\r
+                                                    token.cName,\r
+                                                    index);\r
+                    if (exceptionString != null) {\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+                }\r
+\r
+                if (skuInfoList.get(index).getVariableOffset() == null) {\r
+                    exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+                                                    "file, who use HII, but there is no <VariableOffset> defined for Sku %d data!",\r
+                                                    token.cName,\r
+                                                    index);\r
+                    if (exceptionString != null) {\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+                }\r
+\r
+                if (skuInfoList.get(index).getHiiDefaultValue() == null) {\r
+                    exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+                                                    "file, who use HII, but there is no <HiiDefaultValue> defined for Sku %d data!",\r
+                                                    token.cName,\r
+                                                    index);\r
+                    if (exceptionString != null) {\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+                }\r
+\r
+                if (skuInfoList.get(index).getHiiDefaultValue() != null) {\r
+                    hiiDefaultValue = skuInfoList.get(index).getHiiDefaultValue().toString();\r
+                } else {\r
+                    hiiDefaultValue = null;\r
+                }\r
+\r
+                if ((exceptionString = verifyDatum(token.cName,\r
+                                                   null,\r
+                                                   hiiDefaultValue,\r
+                                                   token.datumType,\r
+                                                   token.datumSize)) != null) {\r
+                    throw new EntityException(exceptionString);\r
+                }\r
+\r
+                offset = Integer.decode(skuInfoList.get(index).getVariableOffset());\r
+                if (offset > 0xFFFF) {\r
+                    throw new EntityException(String.format("[FPD file error] For dynamic PCD %s ,  the variable offset defined in sku %d data "+\r
+                                                            "exceed 64K, it is not allowed!",\r
+                                                            token.cName,\r
+                                                            index));\r
+                }\r
+\r
+                //\r
+                // Get variable guid string according to the name of guid which will be mapped into a GUID in SPD file.\r
+                //\r
+                variableGuidString = getGuidInfoFromSpd(skuInfoList.get(index).getVariableGuid().toString());\r
+                if (variableGuidString == null) {\r
+                    throw new EntityException(String.format("[GUID Error] For dynamic PCD %s,  the variable guid %s can be found in all SPD file!",\r
+                                                            token.cName,\r
+                                                            skuInfoList.get(index).getVariableGuid().toString()));\r
+                }\r
+                String variableStr = skuInfoList.get(index).getVariableName();\r
+                Pattern pattern = Pattern.compile("0x([a-fA-F0-9]){4}");\r
+                Matcher matcher = pattern.matcher(variableStr);\r
+                List<String> varNameList = new ArrayList<String>();\r
+                while (matcher.find()){\r
+                        String str = variableStr.substring(matcher.start(),matcher.end());\r
+                        varNameList.add(str);\r
+                }\r
+\r
+                skuInstance.value.setHiiData(varNameList,\r
+                                             translateSchemaStringToUUID(variableGuidString[1]),\r
+                                             skuInfoList.get(index).getVariableOffset(),\r
+                                             skuInfoList.get(index).getHiiDefaultValue().toString());\r
+                token.skuData.add(skuInstance);\r
+                continue;\r
+            }\r
+\r
+            if (skuInfoList.get(index).getVpdOffset() != null) {\r
+                skuInstance.value.setVpdData(skuInfoList.get(index).getVpdOffset());\r
+                token.skuData.add(skuInstance);\r
+                continue;\r
+            }\r
+\r
+            exceptionString = String.format("[FPD file error] For dynamic PCD %s, the dynamic info must "+\r
+                                            "be one of 'DefaultGroup', 'HIIGroup', 'VpdGroup'.",\r
+                                            token.cName);\r
+            throw new EntityException(exceptionString);\r
+        }\r
+\r
+        if (!hasSkuId0) {\r
+            exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions>, there are "+\r
+                                            "no sku id = 0 data, which is required for every dynamic PCD",\r
+                                            token.cName);\r
+            throw new EntityException(exceptionString);\r
+        }\r
+\r
+        return token;\r
+    }\r
+\r
+    /**\r
+       Get all dynamic PCD defined in <DynamicPcdBuildDefinitions> which unreferenced by \r
+       any <ModuleSA> in FPD file.\r
+         \r
+       @return List<Token>  Return PCD token \r
+    **/\r
+    private List<Token> getUnreferencedDynamicPcd () throws EntityException {\r
+        List<Token>                                   tokenArray                 = new ArrayList<Token>();\r
+        Token                                         token                      = null;\r
+        List<DynamicPcdBuildDefinitions.PcdBuildData> dynamicPcdBuildDataArray   = null;\r
+        DynamicPcdBuildDefinitions.PcdBuildData       pcdBuildData               = null;\r
+        List<DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo>   skuInfoList      = null;\r
+        Token.PCD_TYPE                                pcdType;\r
+        SkuInstance                                   skuInstance                = null;\r
+        String  primaryKey = null;\r
+        boolean hasSkuId0  = false;\r
+        int     index, offset, index2;\r
+        String  temp;\r
+        String  exceptionString;\r
+        String  hiiDefaultValue;\r
+        String  tokenSpaceStrRet[];\r
+        String  variableGuidString[];\r
+\r
+        dynamicPcdBuildDataArray = getAllDynamicPcdInfoFromFpd();\r
+        if (dynamicPcdBuildDataArray == null) {\r
+            return null;\r
+        }\r
+\r
+        for (index2 = 0; index2 < dynamicPcdBuildDataArray.size(); index2 ++) {\r
+            pcdBuildData = dynamicPcdBuildDataArray.get(index2);\r
+            tokenSpaceStrRet = this.getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
+\r
+            if (tokenSpaceStrRet == null) {\r
+                throw new EntityException ("Fail to get Token space guid for token" + pcdBuildData.getCName());\r
+            }\r
+\r
+            primaryKey = Token.getPrimaryKeyString(pcdBuildData.getCName(),\r
+                                                   tokenSpaceStrRet[1]);\r
+\r
+            if (pcdDbManager.isTokenInDatabase(primaryKey)) {\r
+                continue;\r
+            }\r
+\r
+            pcdType = Token.getpcdTypeFromString(pcdBuildData.getItemType().toString());\r
+            if (pcdType != Token.PCD_TYPE.DYNAMIC_EX) {\r
+                throw new EntityException (String.format("[FPD file error] It not allowed for DYNAMIC PCD %s who is no used by any module",\r
+                                                         pcdBuildData.getCName()));\r
+            }\r
+\r
+            //\r
+            // Create new token for unreference dynamic PCD token\r
+            //\r
+            token           = new Token(pcdBuildData.getCName(), tokenSpaceStrRet[1]);\r
+            token.datumSize = pcdBuildData.getMaxDatumSize();\r
+\r
+\r
+            token.datumType     = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());\r
+            token.tokenNumber   = Long.decode(pcdBuildData.getToken().toString());\r
+            token.dynamicExTokenNumber = token.tokenNumber;\r
+            token.isDynamicPCD  = true;\r
+            token.updateSupportPcdType(pcdType);\r
+\r
+            exceptionString = verifyDatum(token.cName,\r
+                                          null,\r
+                                          null,\r
+                                          token.datumType,\r
+                                          token.datumSize);\r
+            if (exceptionString != null) {\r
+                throw new EntityException(exceptionString);\r
+            }\r
+\r
+            skuInfoList = pcdBuildData.getSkuInfoList();\r
+\r
+            //\r
+            // Loop all sku data\r
+            //\r
+            for (index = 0; index < skuInfoList.size(); index ++) {\r
+                skuInstance = new SkuInstance();\r
+                //\r
+                // Although SkuId in schema is BigInteger, but in fact, sku id is 32 bit value.\r
+                //\r
+                temp = skuInfoList.get(index).getSkuId().toString();\r
+                skuInstance.id = Integer.decode(temp);\r
+                if (skuInstance.id == 0) {\r
+                    hasSkuId0 = true;\r
+                }\r
+                //\r
+                // Judge whether is DefaultGroup at first, because most case is DefautlGroup.\r
+                //\r
+                if (skuInfoList.get(index).getValue() != null) {\r
+                    skuInstance.value.setValue(skuInfoList.get(index).getValue().toString());\r
+                    if ((exceptionString = verifyDatum(token.cName,\r
+                                                       null,\r
+                                                       skuInfoList.get(index).getValue().toString(),\r
+                                                       token.datumType,\r
+                                                       token.datumSize)) != null) {\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+\r
+                    token.skuData.add(skuInstance);\r
+\r
+                    continue;\r
+                }\r
+\r
+                //\r
+                // Judge whether is HII group case.\r
+                //\r
+                if (skuInfoList.get(index).getVariableName() != null) {\r
+                    exceptionString = null;\r
+                    if (skuInfoList.get(index).getVariableGuid() == null) {\r
+                        exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+                                                        "file, who use HII, but there is no <VariableGuid> defined for Sku %d data!",\r
+                                                        token.cName,\r
+                                                        index);\r
+                        if (exceptionString != null) {\r
+                            throw new EntityException(exceptionString);\r
+                        }\r
+                    }\r
+\r
+                    if (skuInfoList.get(index).getVariableOffset() == null) {\r
+                        exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+                                                        "file, who use HII, but there is no <VariableOffset> defined for Sku %d data!",\r
+                                                        token.cName,\r
+                                                        index);\r
+                        if (exceptionString != null) {\r
+                            throw new EntityException(exceptionString);\r
+                        }\r
+                    }\r
+\r
+                    if (skuInfoList.get(index).getHiiDefaultValue() == null) {\r
+                        exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+                                                        "file, who use HII, but there is no <HiiDefaultValue> defined for Sku %d data!",\r
+                                                        token.cName,\r
+                                                        index);\r
+                        if (exceptionString != null) {\r
+                            throw new EntityException(exceptionString);\r
+                        }\r
+                    }\r
+\r
+                    if (skuInfoList.get(index).getHiiDefaultValue() != null) {\r
+                        hiiDefaultValue = skuInfoList.get(index).getHiiDefaultValue().toString();\r
+                    } else {\r
+                        hiiDefaultValue = null;\r
+                    }\r
+\r
+                    if ((exceptionString = verifyDatum(token.cName,\r
+                                                       null,\r
+                                                       hiiDefaultValue,\r
+                                                       token.datumType,\r
+                                                       token.datumSize)) != null) {\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+\r
+                    offset = Integer.decode(skuInfoList.get(index).getVariableOffset());\r
+                    if (offset > 0xFFFF) {\r
+                        throw new EntityException(String.format("[FPD file error] For dynamic PCD %s ,  the variable offset defined in sku %d data "+\r
+                                                                "exceed 64K, it is not allowed!",\r
+                                                                token.cName,\r
+                                                                index));\r
+                    }\r
+\r
+                    //\r
+                    // Get variable guid string according to the name of guid which will be mapped into a GUID in SPD file.\r
+                    //\r
+                    variableGuidString = this.getGuidInfoFromSpd(skuInfoList.get(index).getVariableGuid().toString());\r
+                    if (variableGuidString == null) {\r
+                        throw new EntityException(String.format("[GUID Error] For dynamic PCD %s,  the variable guid %s can be found in all SPD file!",\r
+                                                                token.cName,\r
+                                                                skuInfoList.get(index).getVariableGuid().toString()));\r
+                    }\r
+                    String variableStr = skuInfoList.get(index).getVariableName();\r
+                    Pattern pattern = Pattern.compile("0x([a-fA-F0-9]){4}");\r
+                    Matcher matcher = pattern.matcher(variableStr);\r
+                    List<String> varNameList = new ArrayList<String>();\r
+                    while (matcher.find()){\r
+                            String str = variableStr.substring(matcher.start(),matcher.end());\r
+                            varNameList.add(str);\r
+                    }\r
+\r
+                    skuInstance.value.setHiiData(varNameList,\r
+                                                 translateSchemaStringToUUID(variableGuidString[1]),\r
+                                                 skuInfoList.get(index).getVariableOffset(),\r
+                                                 skuInfoList.get(index).getHiiDefaultValue().toString());\r
+                    token.skuData.add(skuInstance);\r
+                    continue;\r
+                }\r
+\r
+                if (skuInfoList.get(index).getVpdOffset() != null) {\r
+                    skuInstance.value.setVpdData(skuInfoList.get(index).getVpdOffset());\r
+                    token.skuData.add(skuInstance);\r
+                    continue;\r
+                }\r
+\r
+                exceptionString = String.format("[FPD file error] For dynamic PCD %s, the dynamic info must "+\r
+                                                "be one of 'DefaultGroup', 'HIIGroup', 'VpdGroup'.",\r
+                                                token.cName);\r
+                throw new EntityException(exceptionString);\r
+            }\r
+\r
+            if (!hasSkuId0) {\r
+                exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions>, there are "+\r
+                                                "no sku id = 0 data, which is required for every dynamic PCD",\r
+                                                token.cName);\r
+                throw new EntityException(exceptionString);\r
+            }\r
+\r
+            tokenArray.add(token);\r
+        }\r
+\r
+        return tokenArray;\r
+    }\r
+\r
+    /**\r
+       Translate the schema string to UUID instance.\r
+\r
+       In schema, the string of UUID is defined as following two types string:\r
+        1) GuidArrayType: pattern = 0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},(\r
+        )*0x[a-fA-F0-9]{1,4}(,( )*\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\})?\r
+\r
+        2) GuidNamingConvention: pattern =\r
+        [a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\r
+\r
+       This function will convert string and create uuid instance.\r
+\r
+       @param uuidString    UUID string in XML file\r
+\r
+       @return UUID         UUID instance\r
+    **/\r
+    private UUID translateSchemaStringToUUID(String uuidString)\r
+        throws EntityException {\r
+        String      temp;\r
+        String[]    splitStringArray;\r
+        int         index;\r
+        int         chIndex;\r
+        int         chLen;\r
+\r
+        if (uuidString == null) {\r
+            return null;\r
+        }\r
+\r
+        if (uuidString.length() == 0) {\r
+            return null;\r
+        }\r
+\r
+        if (uuidString.equals("0") ||\r
+            uuidString.equalsIgnoreCase("0x0")) {\r
+            return new UUID(0, 0);\r
+        }\r
+\r
+        uuidString = uuidString.replaceAll("\\{", "");\r
+        uuidString = uuidString.replaceAll("\\}", "");\r
+\r
+        //\r
+        // If the UUID schema string is GuidArrayType type then need translate\r
+        // to GuidNamingConvention type at first.\r
+        //\r
+        if ((uuidString.charAt(0) == '0') && ((uuidString.charAt(1) == 'x') || (uuidString.charAt(1) == 'X'))) {\r
+            splitStringArray = uuidString.split("," );\r
+            if (splitStringArray.length != 11) {\r
+                throw new EntityException ("[FPD file error] Wrong format for UUID string: " + uuidString);\r
+            }\r
+\r
+            //\r
+            // Remove blank space from these string and remove header string "0x"\r
+            //\r
+            for (index = 0; index < 11; index ++) {\r
+                splitStringArray[index] = splitStringArray[index].trim();\r
+                splitStringArray[index] = splitStringArray[index].substring(2, splitStringArray[index].length());\r
+            }\r
+\r
+            //\r
+            // Add heading '0' to normalize the string length\r
+            //\r
+            for (index = 3; index < 11; index ++) {\r
+                chLen = splitStringArray[index].length();\r
+                for (chIndex = 0; chIndex < 2 - chLen; chIndex ++) {\r
+                    splitStringArray[index] = "0" + splitStringArray[index];\r
+                }\r
+            }\r
+\r
+            //\r
+            // construct the final GuidNamingConvention string\r
+            //\r
+            temp = String.format("%s-%s-%s-%s%s-%s%s%s%s%s%s",\r
+                                 splitStringArray[0],\r
+                                 splitStringArray[1],\r
+                                 splitStringArray[2],\r
+                                 splitStringArray[3],\r
+                                 splitStringArray[4],\r
+                                 splitStringArray[5],\r
+                                 splitStringArray[6],\r
+                                 splitStringArray[7],\r
+                                 splitStringArray[8],\r
+                                 splitStringArray[9],\r
+                                 splitStringArray[10]);\r
+            uuidString = temp;\r
+        }\r
+\r
+        return UUID.fromString(uuidString);\r
+    }\r
+}\r
+\r
index c16bb04f100d8a7a761593410df283918951ab6a..aef640c60821e5f430a4bb67e40d0ce19c304bf0 100644 (file)
@@ -2,29 +2,28 @@
  CommonDefinition class.\r
 \r
  This class is to define some common marcos and funcions, which used by AutoGen.\r
  CommonDefinition class.\r
 \r
  This class is to define some common marcos and funcions, which used by AutoGen.\r
\r
+\r
  Copyright (c) 2006, Intel Corporation\r
  All rights reserved. This program and the accompanying materials\r
  are licensed and made available under the terms and conditions of the BSD License\r
  which accompanies this distribution.  The full text of the license may be found at\r
  http://opensource.org/licenses/bsd-license.php\r
  Copyright (c) 2006, Intel Corporation\r
  All rights reserved. This program and the accompanying materials\r
  are licensed and made available under the terms and conditions of the BSD License\r
  which accompanies this distribution.  The full text of the license may be found at\r
  http://opensource.org/licenses/bsd-license.php\r
\r
+\r
  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
  **/\r
 package org.tianocore.pcd.entity;\r
 \r
  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
  **/\r
 package org.tianocore.pcd.entity;\r
 \r
-import java.util.HashSet;\r
 import java.util.Iterator;\r
 import java.util.LinkedHashSet;\r
 import java.util.Set;\r
 \r
 /**\r
   CommonDefinition\r
 import java.util.Iterator;\r
 import java.util.LinkedHashSet;\r
 import java.util.Set;\r
 \r
 /**\r
   CommonDefinition\r
-  \r
+\r
   This class is to define some common marcos, which used by AutoGen.\r
   This class is to define some common marcos, which used by AutoGen.\r
-  \r
+\r
 **/\r
 public class CommonDefinition {\r
     public final static String spdSuffix = ".spd";\r
 **/\r
 public class CommonDefinition {\r
     public final static String spdSuffix = ".spd";\r
@@ -34,7 +33,7 @@ public class CommonDefinition {
     public final static String autoGenHbegin = "extern int __make_me_compile_correctly;\r\n";\r
     public final static String include = "#include";\r
     public final static String autoGenCLine1 = "\r\n";\r
     public final static String autoGenHbegin = "extern int __make_me_compile_correctly;\r\n";\r
     public final static String include = "#include";\r
     public final static String autoGenCLine1 = "\r\n";\r
-    \r
+\r
     public final static String autoGenCLine2 = "const UINT8  _gDebugPropertyMask "\r
                     + "= DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED"\r
                     + "  | DEBUG_PROPERTY_DEBUG_PRINT_ENABLED"\r
     public final static String autoGenCLine2 = "const UINT8  _gDebugPropertyMask "\r
                     + "= DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED"\r
                     + "  | DEBUG_PROPERTY_DEBUG_PRINT_ENABLED"\r
@@ -42,7 +41,7 @@ public class CommonDefinition {
 \r
     public final static String autoGenCLine3 = "const UINTN  _gModuleDefaultErrorLevel"\r
                     + " = EFI_D_ERROR | EFI_D_LOAD;\r\n";\r
 \r
     public final static String autoGenCLine3 = "const UINTN  _gModuleDefaultErrorLevel"\r
                     + " = EFI_D_ERROR | EFI_D_LOAD;\r\n";\r
-    \r
+\r
     public final static String autoGenHLine1          = "#define EFI_SPECIFICATION_VERSION    0x00020000\r\n";\r
     public final static String autoGenHVersionDefault = "#define EFI_SPECIFICATION_VERSION    0x00000000\r\n";\r
     public final static String autoGenHLine2          = "#define EDK_RELEASE_VERSION        0x00090000\r\n";\r
     public final static String autoGenHLine1          = "#define EFI_SPECIFICATION_VERSION    0x00020000\r\n";\r
     public final static String autoGenHVersionDefault = "#define EFI_SPECIFICATION_VERSION    0x00000000\r\n";\r
     public final static String autoGenHLine2          = "#define EDK_RELEASE_VERSION        0x00090000\r\n";\r
@@ -58,11 +57,11 @@ public class CommonDefinition {
 \r
        public final static String tianoR8FlashMapH = "TianoR8FlashMap.h";\r
        public final static String flashMapH = "FlashMap.h";\r
 \r
        public final static String tianoR8FlashMapH = "TianoR8FlashMap.h";\r
        public final static String flashMapH = "FlashMap.h";\r
-    \r
+\r
     //\r
     // AutoGen.h and AutoGen.c file's header\r
     //\r
     //\r
     // AutoGen.h and AutoGen.c file's header\r
     //\r
-    public final static String autogenHNotation = \r
+    public final static String autogenHNotation =\r
       "/**\r\n" +\r
       "  DO NOT EDIT\r\n" +\r
       "  FILE auto-generated by GenBuild tasks\r\n" +\r
       "/**\r\n" +\r
       "  DO NOT EDIT\r\n" +\r
       "  FILE auto-generated by GenBuild tasks\r\n" +\r
@@ -71,8 +70,8 @@ public class CommonDefinition {
       "  Abstract:" +\r
       "       Auto-generated AutoGen.h for building module or library.\r\n" +\r
       "**/\r\n\r\n";\r
       "  Abstract:" +\r
       "       Auto-generated AutoGen.h for building module or library.\r\n" +\r
       "**/\r\n\r\n";\r
-        \r
-    public final static String autogenCNotation = \r
+\r
+    public final static String autogenCNotation =\r
         "/**\r\n" +\r
         "  DO NOT EDIT\r\n" +\r
         "  FILE auto-generated by GenBuild tasks\r\n" +\r
         "/**\r\n" +\r
         "  DO NOT EDIT\r\n" +\r
         "  FILE auto-generated by GenBuild tasks\r\n" +\r
@@ -81,7 +80,7 @@ public class CommonDefinition {
         "  Abstract:" +\r
         "       Auto-generated AutoGen.c for building module or library.\r\n" +\r
         "**/\r\n\r\n";\r
         "  Abstract:" +\r
         "       Auto-generated AutoGen.c for building module or library.\r\n" +\r
         "**/\r\n\r\n";\r
-    \r
+\r
     //\r
     // module type\r
     //\r
     //\r
     // module type\r
     //\r
@@ -97,11 +96,11 @@ public class CommonDefinition {
     public final static int ModuleTypeUefiDriver = 9;\r
     public final static int ModuleTypeUefiApplication = 10;\r
     public final static int ModuleTypeUnknown = 11;\r
     public final static int ModuleTypeUefiDriver = 9;\r
     public final static int ModuleTypeUefiApplication = 10;\r
     public final static int ModuleTypeUnknown = 11;\r
-    \r
-   \r
+\r
+\r
     //\r
     // component type\r
     //\r
     // component type\r
-    //                           \r
+    //\r
     public final static int  ComponentTypeNull = 0;\r
     public final static int  ComponentTypeApriori = 1;\r
     public final static int  ComponentTypeSec = 2;\r
     public final static int  ComponentTypeNull = 0;\r
     public final static int  ComponentTypeApriori = 1;\r
     public final static int  ComponentTypeSec = 2;\r
@@ -123,13 +122,13 @@ public class CommonDefinition {
     public final static int  ComponentTypeCustomBuild = 18;\r
     public final static int  ComponentTypeUnknown = 19;\r
 \r
     public final static int  ComponentTypeCustomBuild = 18;\r
     public final static int  ComponentTypeUnknown = 19;\r
 \r
-    \r
+\r
     //\r
     // Usaged style\r
     //\r
     public final static String AlwaysConsumed = "ALWAYS_CONSUMED";\r
     public final static String AlwaysProduced = "ALWAYS_PRODUCED";\r
     //\r
     // Usaged style\r
     //\r
     public final static String AlwaysConsumed = "ALWAYS_CONSUMED";\r
     public final static String AlwaysProduced = "ALWAYS_PRODUCED";\r
-  \r
+\r
 \r
     public static class MyEnum {\r
         String moduleTypeStr;\r
 \r
     public static class MyEnum {\r
         String moduleTypeStr;\r
@@ -147,7 +146,7 @@ public class CommonDefinition {
                 return -1;\r
         }\r
     }\r
                 return -1;\r
         }\r
     }\r
-    \r
+\r
     //\r
     // Module type\r
     //\r
     //\r
     // Module type\r
     //\r
@@ -163,7 +162,7 @@ public class CommonDefinition {
                     new MyEnum("DXE_SMM_DRIVER", ModuleTypeDxeSmmDriver),\r
                     new MyEnum("UEFI_DRIVER", ModuleTypeUefiDriver),\r
                     new MyEnum("UEFI_APPLICATION", ModuleTypeUefiApplication) };\r
                     new MyEnum("DXE_SMM_DRIVER", ModuleTypeDxeSmmDriver),\r
                     new MyEnum("UEFI_DRIVER", ModuleTypeUefiDriver),\r
                     new MyEnum("UEFI_APPLICATION", ModuleTypeUefiApplication) };\r
-    \r
+\r
     //\r
     // Component type\r
     //\r
     //\r
     // Component type\r
     //\r
@@ -187,14 +186,14 @@ public class CommonDefinition {
                     new MyEnum("LOGO", ComponentTypeLogo),\r
                     new MyEnum("CUSTOM_BUILD", ComponentTypeCustomBuild)\r
                     };\r
                     new MyEnum("LOGO", ComponentTypeLogo),\r
                     new MyEnum("CUSTOM_BUILD", ComponentTypeCustomBuild)\r
                     };\r
-   \r
+\r
     /**\r
       getModuleType\r
     /**\r
       getModuleType\r
-      \r
+\r
       This function get the module type value according module type string.\r
       This function get the module type value according module type string.\r
-      \r
+\r
       @param  moduleTypeStr     String of modlue type.\r
       @param  moduleTypeStr     String of modlue type.\r
-      @return                   \r
+      @return\r
     **/\r
     static public int getModuleType(String moduleTypeStr) {\r
         int returnValue = -1;\r
     **/\r
     static public int getModuleType(String moduleTypeStr) {\r
         int returnValue = -1;\r
@@ -209,10 +208,10 @@ public class CommonDefinition {
 \r
     /**\r
       getComponentType\r
 \r
     /**\r
       getComponentType\r
-      \r
-      This function get the component type value according commponet type \r
+\r
+      This function get the component type value according commponet type\r
       string.\r
       string.\r
-      \r
+\r
       @param    componentTypeStr  String of component type.\r
       @return\r
     **/\r
       @param    componentTypeStr  String of component type.\r
       @return\r
     **/\r
@@ -229,14 +228,14 @@ public class CommonDefinition {
 \r
     /**\r
     getComponentTypeString\r
 \r
     /**\r
     getComponentTypeString\r
-    \r
+\r
     This function get the commponet type string according component type value.\r
     This function get the commponet type string according component type value.\r
-    \r
+\r
     @param    componentType  Integer value of component type.\r
     @return\r
   **/\r
     static public String getComponentTypeString (int componentType) {\r
     @param    componentType  Integer value of component type.\r
     @return\r
   **/\r
     static public String getComponentTypeString (int componentType) {\r
-      if ((componentType > CommonDefinition.ComponentTypeUnknown) || \r
+      if ((componentType > CommonDefinition.ComponentTypeUnknown) ||\r
           (componentType < CommonDefinition.ComponentTypeNull)) {\r
         return null;\r
       }\r
           (componentType < CommonDefinition.ComponentTypeNull)) {\r
         return null;\r
       }\r
@@ -249,11 +248,11 @@ public class CommonDefinition {
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-      isLibraryComponent \r
-      \r
+      isLibraryComponent\r
+\r
       This function is to check does componet is library according to commponet\r
       type value.\r
       This function is to check does componet is library according to commponet\r
       type value.\r
-      \r
+\r
       @param   componentType     Integer value of component type.\r
       @return\r
     **/\r
       @param   componentType     Integer value of component type.\r
       @return\r
     **/\r
@@ -263,12 +262,12 @@ public class CommonDefinition {
       }\r
       return false;\r
     }\r
       }\r
       return false;\r
     }\r
-    \r
+\r
     /**\r
      * formateGuidName\r
     /**\r
      * formateGuidName\r
-     * \r
+     *\r
      * This function is to formate GUID to ANSI c form.\r
      * This function is to formate GUID to ANSI c form.\r
-     * \r
+     *\r
      * @param guidNameCon\r
      *            String of GUID.\r
      * @return Formated GUID.\r
      * @param guidNameCon\r
      *            String of GUID.\r
      * @return Formated GUID.\r
@@ -322,12 +321,12 @@ public class CommonDefinition {
 \r
         }\r
     }\r
 \r
         }\r
     }\r
-    \r
+\r
     /**\r
      * Remove deuplicat string in list\r
     /**\r
      * Remove deuplicat string in list\r
-     * \r
+     *\r
      * This function is to duplicat string in list\r
      * This function is to duplicat string in list\r
-     * \r
+     *\r
      * @param String[]\r
      *            String list.\r
      * @return String[] String list which remove the duplicate string.\r
      * @param String[]\r
      *            String list.\r
      * @return String[] String list which remove the duplicate string.\r
@@ -350,5 +349,5 @@ public class CommonDefinition {
         }\r
         return desList;\r
     }\r
         }\r
         return desList;\r
     }\r
-    \r
+\r
 }
\ No newline at end of file
 }
\ No newline at end of file
index e8fb8e837dea3f16a0b517a8817c351dc3816cdc..175fb1a7f5cdab24537d53effdbd13452548e963 100644 (file)
@@ -2,17 +2,17 @@
   DynamicTokenValue class.\r
 \r
   This module contains the value type of a dynamic token.\r
   DynamicTokenValue class.\r
 \r
   This module contains the value type of a dynamic token.\r
\r
+\r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
\r
+\r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-**/  \r
+**/\r
 package org.tianocore.pcd.entity;\r
 \r
 import java.util.List;\r
 package org.tianocore.pcd.entity;\r
 \r
 import java.util.List;\r
@@ -61,40 +61,43 @@ public class DynamicTokenValue {
 \r
     ///\r
     /// The default value for HII case.\r
 \r
     ///\r
     /// The default value for HII case.\r
-    /// \r
+    ///\r
     public String      hiiDefaultValue;\r
 \r
     ///\r
     public String      hiiDefaultValue;\r
 \r
     ///\r
+    /// ---------------------------------------------------------------------\r
     /// Following member is for VPD case.\r
     /// Following member is for VPD case.\r
-    /// BUGBUG: Consider 64 bit integer by using java.math.BigInteger.\r
-    /// \r
+    /// ---------------------------------------------------------------------\r
+    ///\r
     public String      vpdOffset;\r
 \r
     public String      vpdOffset;\r
 \r
-    ///\r
+    /// ---------------------------------------------------------------------\r
     /// Following member is for default case.\r
     /// Following member is for default case.\r
-    /// \r
+    /// ---------------------------------------------------------------------\r
     public String      value;\r
 \r
     public String      value;\r
 \r
+    /**\r
+       Constructor function for DynamicTokenValue class.\r
+         \r
+    **/\r
     public DynamicTokenValue() {\r
     public DynamicTokenValue() {\r
-        this.type               = VALUE_TYPE.DEFAULT_TYPE;\r
-        this.variableName       = null;\r
-        this.variableGuid       = null;\r
-        this.variableOffset     = null;\r
-        this.hiiDefaultValue    = null;\r
-\r
-        this.vpdOffset          = null;\r
-\r
-        this.value              = null;\r
+        type               = VALUE_TYPE.DEFAULT_TYPE;\r
+        variableName       = null;\r
+        variableGuid       = null;\r
+        variableOffset     = null;\r
+        hiiDefaultValue    = null;\r
+        vpdOffset          = null;\r
+        value              = null;\r
     }\r
 \r
     /**\r
        Set the HII case data.\r
     }\r
 \r
     /**\r
        Set the HII case data.\r
-       \r
-       @param variableName\r
-       @param variableGuid\r
-       @param variableOffset\r
-       @param hiiDefaultValue\r
-     */\r
+\r
+       @param variableName      The variable name \r
+       @param variableGuid      The variable guid\r
+       @param variableOffset    The offset of value in this variable\r
+       @param hiiDefaultValue   Default value for this PCD\r
+    **/\r
     public void setHiiData(List        variableName,\r
                            UUID        variableGuid,\r
                            String      variableOffset,\r
     public void setHiiData(List        variableName,\r
                            UUID        variableGuid,\r
                            String      variableOffset,\r
@@ -109,17 +112,16 @@ public class DynamicTokenValue {
 \r
     /**\r
        Get the string like L"xxx" for a variable Name.\r
 \r
     /**\r
        Get the string like L"xxx" for a variable Name.\r
-       \r
+\r
        BUGBUG: In fact, it is not correctly, variable name should be\r
                treated as unicode UINT16 array.\r
        BUGBUG: In fact, it is not correctly, variable name should be\r
                treated as unicode UINT16 array.\r
-       \r
+\r
        @return String\r
      */\r
        @return String\r
      */\r
-    public String getStringOfVariableName() \r
+    public String getStringOfVariableName()\r
         throws EntityException {\r
         String str;\r
         int    index, num;\r
         throws EntityException {\r
         String str;\r
         int    index, num;\r
-        char   ch;\r
 \r
         str = "";\r
         for (index = 0; index < variableName.size(); index ++) {\r
 \r
         str = "";\r
         for (index = 0; index < variableName.size(); index ++) {\r
@@ -135,7 +137,7 @@ public class DynamicTokenValue {
 \r
     /**\r
        Set Vpd case data.\r
 \r
     /**\r
        Set Vpd case data.\r
-       \r
+\r
        @param vpdOffset\r
      */\r
     public void setVpdData(String vpdOffset) {\r
        @param vpdOffset\r
      */\r
     public void setVpdData(String vpdOffset) {\r
@@ -146,7 +148,7 @@ public class DynamicTokenValue {
 \r
     /**\r
        Set default case data.\r
 \r
     /**\r
        Set default case data.\r
-       \r
+\r
        @param value\r
      */\r
     public void setValue(String value) {\r
        @param value\r
      */\r
     public void setValue(String value) {\r
index 7a874699677801b08a5ab0c6ec2149604f249039..90d0db4aaa62599ebed0b0057316e471a28a9c5b 100644 (file)
@@ -2,13 +2,13 @@
   MemoryDatabaseManager class.\r
 \r
   Database hold all PCD information comes from SPD, MSA, FPD file in memory.\r
   MemoryDatabaseManager class.\r
 \r
   Database hold all PCD information comes from SPD, MSA, FPD file in memory.\r
\r
+\r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
\r
+\r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
@@ -19,12 +19,12 @@ import java.util.ArrayList;
 import java.util.HashMap;\r
 import java.util.List;\r
 import java.util.Map;\r
 import java.util.HashMap;\r
 import java.util.List;\r
 import java.util.Map;\r
-import java.util.UUID;\r
 \r
 import org.tianocore.pcd.entity.UsageIdentification;\r
 import org.tianocore.pcd.exception.EntityException;\r
 \r
 \r
 import org.tianocore.pcd.entity.UsageIdentification;\r
 import org.tianocore.pcd.exception.EntityException;\r
 \r
-/** Database hold all PCD information comes from SPD, MSA, FPD file in memory.\r
+/**\r
+  Database hold all PCD information comes from SPD, MSA, FPD file in memory.\r
 **/\r
 public class MemoryDatabaseManager {\r
     ///\r
 **/\r
 public class MemoryDatabaseManager {\r
     ///\r
@@ -37,18 +37,18 @@ public class MemoryDatabaseManager {
     /// Before build a module, the used libary will be build firstly, the PCD of these\r
     /// libarry is inheritted by the module, so stored module's PCD information as PCD\r
     /// context of building libary.\r
     /// Before build a module, the used libary will be build firstly, the PCD of these\r
     /// libarry is inheritted by the module, so stored module's PCD information as PCD\r
     /// context of building libary.\r
-    /// \r
+    ///\r
     public static List<UsageInstance> UsageInstanceContext = null;\r
 \r
     ///\r
     /// Current module name, if now is buiding library, this value indicate this library\r
     /// is for building what module.\r
     public static List<UsageInstance> UsageInstanceContext = null;\r
 \r
     ///\r
     /// Current module name, if now is buiding library, this value indicate this library\r
     /// is for building what module.\r
-    /// \r
+    ///\r
     public static String CurrentModuleName                 = null;\r
 \r
     ///\r
     /// String for PCD PEIM and DXE autogen file\r
     public static String CurrentModuleName                 = null;\r
 \r
     ///\r
     /// String for PCD PEIM and DXE autogen file\r
-    /// \r
+    ///\r
     public static String PcdPeimHString                    = "";\r
     public static String PcdPeimCString                    = "";\r
     public static String PcdDxeHString                     = "";\r
     public static String PcdPeimHString                    = "";\r
     public static String PcdPeimCString                    = "";\r
     public static String PcdDxeHString                     = "";\r
@@ -68,9 +68,9 @@ public class MemoryDatabaseManager {
 \r
     /**\r
       Judege whether token exists in memory database\r
 \r
     /**\r
       Judege whether token exists in memory database\r
-      \r
+\r
       @param primaryKey    the primaryKey for searching token\r
       @param primaryKey    the primaryKey for searching token\r
-      \r
+\r
       @retval  TRUE  - token already exist in database.\r
       @retval  FALSE - token does not exist in database.\r
     **/\r
       @retval  TRUE  - token already exist in database.\r
       @retval  FALSE - token does not exist in database.\r
     **/\r
@@ -80,7 +80,7 @@ public class MemoryDatabaseManager {
 \r
     /**\r
       Add a pcd token into memory database.\r
 \r
     /**\r
       Add a pcd token into memory database.\r
-      \r
+\r
       @param primaryKey   the primary key for searching token\r
       @param token        token instance\r
     **/\r
       @param primaryKey   the primary key for searching token\r
       @param token        token instance\r
     **/\r
@@ -90,9 +90,9 @@ public class MemoryDatabaseManager {
 \r
     /**\r
       Get a token instance from memory database with primary key.\r
 \r
     /**\r
       Get a token instance from memory database with primary key.\r
-  \r
+\r
       @param primaryKey   the primary key for searching token\r
       @param primaryKey   the primary key for searching token\r
-    \r
+\r
       @return token instance.\r
     **/\r
     public Token getTokenByKey(String primaryKey) {\r
       @return token instance.\r
     **/\r
     public Token getTokenByKey(String primaryKey) {\r
@@ -101,7 +101,7 @@ public class MemoryDatabaseManager {
 \r
     /**\r
       Get the number of PCD token record in memory database.\r
 \r
     /**\r
       Get the number of PCD token record in memory database.\r
-      \r
+\r
       @return the number of PCD token record in memory database.\r
     **/\r
     public int getDBSize() {\r
       @return the number of PCD token record in memory database.\r
     **/\r
     public int getDBSize() {\r
@@ -110,7 +110,7 @@ public class MemoryDatabaseManager {
 \r
     /**\r
       Get the token record array contained all PCD token in memory database.\r
 \r
     /**\r
       Get the token record array contained all PCD token in memory database.\r
-      \r
+\r
       @return the token record array contained all PCD token in memory database.\r
     **/\r
     public Token[] getRecordArray() {\r
       @return the token record array contained all PCD token in memory database.\r
     **/\r
     public Token[] getRecordArray() {\r
@@ -135,7 +135,7 @@ public class MemoryDatabaseManager {
 \r
     /**\r
        Get record array only contains DYNAMIC or DYNAMIC_EX type PCD.\r
 \r
     /**\r
        Get record array only contains DYNAMIC or DYNAMIC_EX type PCD.\r
-       \r
+\r
        @return ArrayList\r
      */\r
     private ArrayList getDynamicRecordArray() {\r
        @return ArrayList\r
      */\r
     private ArrayList getDynamicRecordArray() {\r
@@ -155,12 +155,12 @@ public class MemoryDatabaseManager {
 \r
     /**\r
       Get the token record array contained all PCD token referenced by PEI phase.\r
 \r
     /**\r
       Get the token record array contained all PCD token referenced by PEI phase.\r
-          The output array is sorted based on descending order of the size of alignment for each feilds.\r
+      The output array is sorted based on descending order of the size of alignment for each feilds.\r
 \r
       @return the token record array contained all PCD token referenced in PEI phase.\r
       @throws EntityException\r
     **/\r
 \r
       @return the token record array contained all PCD token referenced in PEI phase.\r
       @throws EntityException\r
     **/\r
-    public void getTwoPhaseDynamicRecordArray(ArrayList<Token> pei, ArrayList<Token> dxe) \r
+    public void getTwoPhaseDynamicRecordArray(ArrayList<Token> pei, ArrayList<Token> dxe)\r
         throws EntityException {\r
         int                     usageInstanceIndex  =   0;\r
         int                     index               =   0;\r
         throws EntityException {\r
         int                     usageInstanceIndex  =   0;\r
         int                     index               =   0;\r
@@ -187,8 +187,8 @@ public class MemoryDatabaseManager {
             }\r
 \r
             //\r
             }\r
 \r
             //\r
-            // If no PEI components reference the PCD entry, \r
-            // we check if it is referenced in DXE driver. \r
+            // If no PEI components reference the PCD entry,\r
+            // we check if it is referenced in DXE driver.\r
             //\r
             if (!found) {\r
                 if (token.consumers != null) {\r
             //\r
             if (!found) {\r
                 if (token.consumers != null) {\r
@@ -202,7 +202,7 @@ public class MemoryDatabaseManager {
                         }\r
                     }\r
                 }\r
                         }\r
                     }\r
                 }\r
-                \r
+\r
                 if (!found) {\r
                     if (token.isDynamicPCD && token.consumers.size() == 0) {\r
                         dxe.add(token);\r
                 if (!found) {\r
                     if (token.isDynamicPCD && token.consumers.size() == 0) {\r
                         dxe.add(token);\r
@@ -223,9 +223,9 @@ public class MemoryDatabaseManager {
     /**\r
       Get all PCD record for a module according to module's name, module's GUID,\r
       package name, package GUID, arch, version information.\r
     /**\r
       Get all PCD record for a module according to module's name, module's GUID,\r
       package name, package GUID, arch, version information.\r
-     \r
+\r
       @param usageId   the id of UsageInstance.\r
       @param usageId   the id of UsageInstance.\r
-      \r
+\r
       @return  all usage instance for this module in memory database.\r
     **/\r
     public List<UsageInstance> getUsageInstanceArrayByModuleName(UsageIdentification usageId) {\r
       @return  all usage instance for this module in memory database.\r
     **/\r
     public List<UsageInstance> getUsageInstanceArrayByModuleName(UsageIdentification usageId) {\r
@@ -237,14 +237,14 @@ public class MemoryDatabaseManager {
 \r
     /**\r
        Get all PCD token for a usage instance according to primary key.\r
 \r
     /**\r
        Get all PCD token for a usage instance according to primary key.\r
-       \r
+\r
        @param primaryKey    the primary key of usage instance.\r
        @param primaryKey    the primary key of usage instance.\r
-       \r
+\r
        @return List<UsageInstance>\r
      */\r
     public List<UsageInstance> getUsageInstanceArrayByKeyString(String primaryKey) {\r
         Token[]               tokenArray          = null;\r
        @return List<UsageInstance>\r
      */\r
     public List<UsageInstance> getUsageInstanceArrayByKeyString(String primaryKey) {\r
         Token[]               tokenArray          = null;\r
-        int                   recordIndex         = 0; \r
+        int                   recordIndex         = 0;\r
         UsageInstance         usageInstance       = null;\r
         List<UsageInstance>   returnArray         = new ArrayList<UsageInstance>();\r
 \r
         UsageInstance         usageInstance       = null;\r
         List<UsageInstance>   returnArray         = new ArrayList<UsageInstance>();\r
 \r
@@ -267,7 +267,7 @@ public class MemoryDatabaseManager {
 \r
     /**\r
       Get all modules name who contains PCD information\r
 \r
     /**\r
       Get all modules name who contains PCD information\r
-     \r
+\r
       @return Array for module name\r
     **/\r
     public List<String> getAllModuleArray()\r
       @return Array for module name\r
     **/\r
     public List<String> getAllModuleArray()\r
index 181e321b0a62663f554ee6f71e1b7b53f6502355..f6292d7820843cf9e52f38026d4be652479cb05d 100644 (file)
@@ -22,6 +22,7 @@ public class SkuInstance {
     /// The id number of this SKU instance\r
     ///\r
     public int              id;\r
     /// The id number of this SKU instance\r
     ///\r
     public int              id;\r
+\r
     ///\r
     /// The value of this SKU instance\r
     ///\r
     ///\r
     /// The value of this SKU instance\r
     ///\r
@@ -38,6 +39,9 @@ public class SkuInstance {
         this.value = value;\r
     }\r
 \r
         this.value = value;\r
     }\r
 \r
+    /**\r
+      Default constructor function.  \r
+    **/\r
     public SkuInstance() {\r
         this.id    = 0;\r
         this.value = new DynamicTokenValue();\r
     public SkuInstance() {\r
         this.id    = 0;\r
         this.value = new DynamicTokenValue();\r
index 2e2a297aa025c591566fa339eaaa6518d93baaf9..8429dfd0036ca8ee114f02739370739b4c7f954a 100644 (file)
@@ -2,17 +2,17 @@
   Token class.\r
 \r
   This module contains all classes releted to PCD token.\r
   Token class.\r
 \r
   This module contains all classes releted to PCD token.\r
\r
+\r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
\r
+\r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-**/  \r
+**/\r
 package org.tianocore.pcd.entity;\r
 \r
 import java.math.BigInteger;\r
 package org.tianocore.pcd.entity;\r
 \r
 import java.math.BigInteger;\r
@@ -20,25 +20,24 @@ import java.util.ArrayList;
 import java.util.HashMap;\r
 import java.util.List;\r
 import java.util.Map;\r
 import java.util.HashMap;\r
 import java.util.List;\r
 import java.util.Map;\r
-import java.util.UUID;\r
 \r
 import org.tianocore.pcd.entity.UsageIdentification;\r
 import org.tianocore.pcd.exception.EntityException;\r
 \r
 \r
 import org.tianocore.pcd.entity.UsageIdentification;\r
 import org.tianocore.pcd.exception.EntityException;\r
 \r
-/** This class is to descript a PCD token object. The information of a token mainly \r
-    comes from MSA, SPD and setting produced by platform developer. \r
+/**\r
+   This class is to descript a PCD token object. The information of a token mainly\r
+   comes from MSA, SPD and setting produced by platform developer.\r
 **/\r
 public class Token {\r
     ///\r
     /// Enumeration macro defintion for PCD type.\r
 **/\r
 public class Token {\r
     ///\r
     /// Enumeration macro defintion for PCD type.\r
-    /// BUGBUG: Not use upcase charater is to facility for reading. It may be changed\r
-    ///         in coding review.\r
-    public enum             PCD_TYPE {FEATURE_FLAG, FIXED_AT_BUILD, PATCHABLE_IN_MODULE, DYNAMIC, \r
+    ///\r
+    public enum             PCD_TYPE {FEATURE_FLAG, FIXED_AT_BUILD, PATCHABLE_IN_MODULE, DYNAMIC,\r
                                       DYNAMIC_EX, UNKNOWN}\r
 \r
     ///\r
     /// Enumeration macro definition for datum type. All type mainly comes from ProcessBind.h.\r
                                       DYNAMIC_EX, UNKNOWN}\r
 \r
     ///\r
     /// Enumeration macro definition for datum type. All type mainly comes from ProcessBind.h.\r
-    /// Wizard maybe expand this type as "int, unsigned int, short, unsigned short etc" in \r
+    /// Wizard maybe expand this type as "int, unsigned int, short, unsigned short etc" in\r
     /// prompt dialog.\r
     ///\r
     public enum             DATUM_TYPE {UINT8, UINT16, UINT32, UINT64, BOOLEAN, POINTER, UNKNOWN}\r
     /// prompt dialog.\r
     ///\r
     public enum             DATUM_TYPE {UINT8, UINT16, UINT32, UINT64, BOOLEAN, POINTER, UNKNOWN}\r
@@ -57,7 +56,7 @@ public class Token {
 \r
     ///\r
     /// Token space name is the guid defined by token itself in package or module level. This\r
 \r
     ///\r
     /// Token space name is the guid defined by token itself in package or module level. This\r
-    /// name mainly for DynamicEx type. For other PCD type token, his token space name is the \r
+    /// name mainly for DynamicEx type. For other PCD type token, his token space name is the\r
     /// assignedtokenSpaceName as follows.\r
     /// tokenSpaceName is defined in MSA, SPD, FPD, can be regarded as primary key with cName.\r
     ///\r
     /// assignedtokenSpaceName as follows.\r
     /// tokenSpaceName is defined in MSA, SPD, FPD, can be regarded as primary key with cName.\r
     ///\r
@@ -71,24 +70,24 @@ public class Token {
     public long             tokenNumber;\r
 \r
     ///\r
     public long             tokenNumber;\r
 \r
     ///\r
-    /// This token number is retrieved from FPD file for DynamicEx type. \r
-    /// \r
+    /// This token number is retrieved from FPD file for DynamicEx type.\r
+    ///\r
     public long             dynamicExTokenNumber;\r
 \r
     ///\r
     /// All supported PCD type, this value can be retrieved from SPD\r
     /// Currently, only record all PCD type for this token in FPD file.\r
     public long             dynamicExTokenNumber;\r
 \r
     ///\r
     /// All supported PCD type, this value can be retrieved from SPD\r
     /// Currently, only record all PCD type for this token in FPD file.\r
-    /// \r
+    ///\r
     public List<PCD_TYPE>   supportedPcdType;\r
 \r
     ///\r
     /// If the token's item type is Dynamic or DynamicEx type, isDynamicPCD\r
     /// is true.\r
     public List<PCD_TYPE>   supportedPcdType;\r
 \r
     ///\r
     /// If the token's item type is Dynamic or DynamicEx type, isDynamicPCD\r
     /// is true.\r
-    /// \r
+    ///\r
     public boolean          isDynamicPCD;\r
 \r
     ///\r
     public boolean          isDynamicPCD;\r
 \r
     ///\r
-    /// datumSize is to descript the fix size or max size for this token. \r
+    /// datumSize is to descript the fix size or max size for this token.\r
     /// datumSize is defined in SPD.\r
     ///\r
     public int              datumSize;\r
     /// datumSize is defined in SPD.\r
     ///\r
     public int              datumSize;\r
@@ -102,7 +101,7 @@ public class Token {
 \r
     ///\r
     /// skuData contains all value for SkuNumber of token.\r
 \r
     ///\r
     /// skuData contains all value for SkuNumber of token.\r
-    /// This field is for Dynamic or DynamicEx type PCD, \r
+    /// This field is for Dynamic or DynamicEx type PCD,\r
     ///\r
     public List<SkuInstance> skuData;\r
 \r
     ///\r
     public List<SkuInstance> skuData;\r
 \r
@@ -113,7 +112,7 @@ public class Token {
 \r
     /**\r
        Constructure function for Token class\r
 \r
     /**\r
        Constructure function for Token class\r
-       \r
+\r
        @param cName             The name of token\r
        @param tokenSpaceName    The name of token space, it is a guid string\r
     **/\r
        @param cName             The name of token\r
        @param tokenSpaceName    The name of token space, it is a guid string\r
     **/\r
@@ -131,10 +130,10 @@ public class Token {
 \r
     /**\r
       updateSupportPcdType\r
 \r
     /**\r
       updateSupportPcdType\r
-      \r
+\r
       SupportPcdType should be gotten from SPD file actually, but now it just\r
       record all PCD type for this token in FPD file.\r
       SupportPcdType should be gotten from SPD file actually, but now it just\r
       record all PCD type for this token in FPD file.\r
-      \r
+\r
       @param pcdType    new PCD type found in FPD file for this token.\r
     **/\r
     public void updateSupportPcdType(PCD_TYPE pcdType) {\r
       @param pcdType    new PCD type found in FPD file for this token.\r
     **/\r
     public void updateSupportPcdType(PCD_TYPE pcdType) {\r
@@ -146,16 +145,16 @@ public class Token {
 \r
         //\r
         // If not found, add the pcd type to member variable supportedPcdType\r
 \r
         //\r
         // If not found, add the pcd type to member variable supportedPcdType\r
-        // \r
+        //\r
         supportedPcdType.add(pcdType);\r
     }\r
 \r
     /**\r
        Judge whether pcdType is belong to dynamic type. Dynamic type includes\r
        DYNAMIC and DYNAMIC_EX.\r
         supportedPcdType.add(pcdType);\r
     }\r
 \r
     /**\r
        Judge whether pcdType is belong to dynamic type. Dynamic type includes\r
        DYNAMIC and DYNAMIC_EX.\r
-       \r
+\r
        @param pcdType       the judged pcd type\r
        @param pcdType       the judged pcd type\r
-       \r
+\r
        @return boolean\r
      */\r
     public static boolean isDynamic(PCD_TYPE pcdType) {\r
        @return boolean\r
      */\r
     public static boolean isDynamic(PCD_TYPE pcdType) {\r
@@ -173,16 +172,16 @@ public class Token {
                 return true;\r
             }\r
         }\r
                 return true;\r
             }\r
         }\r
-        \r
+\r
         return false;\r
     }\r
 \r
     /**\r
       Use "TokencName + "-" + SpaceTokenName" as primary key when adding token into database\r
         return false;\r
     }\r
 \r
     /**\r
       Use "TokencName + "-" + SpaceTokenName" as primary key when adding token into database\r
-      \r
+\r
       @param   cName                     Token name.\r
       @param   tokenSpaceName            The token space guid string defined in MSA or SPD\r
       @param   cName                     Token name.\r
       @param   tokenSpaceName            The token space guid string defined in MSA or SPD\r
-      \r
+\r
       @retval  primary key for this token in token database.\r
     **/\r
     public static String getPrimaryKeyString(String cName, String tokenSpaceName) {\r
       @retval  primary key for this token in token database.\r
     **/\r
     public static String getPrimaryKeyString(String cName, String tokenSpaceName) {\r
@@ -195,7 +194,7 @@ public class Token {
 \r
     /**\r
        If skudata list contains more than one data, then Sku mechanism is enable.\r
 \r
     /**\r
        If skudata list contains more than one data, then Sku mechanism is enable.\r
-       \r
+\r
        @retval boolean  if the number of sku data exceed to 1\r
      */\r
     public boolean isSkuEnable() {\r
        @retval boolean  if the number of sku data exceed to 1\r
      */\r
     public boolean isSkuEnable() {\r
@@ -207,7 +206,7 @@ public class Token {
 \r
     /**\r
        If Hii type for value of token\r
 \r
     /**\r
        If Hii type for value of token\r
-       \r
+\r
        @return boolean\r
     **/\r
     public boolean isHiiEnable() {\r
        @return boolean\r
     **/\r
     public boolean isHiiEnable() {\r
@@ -219,7 +218,7 @@ public class Token {
 \r
     /**\r
        If Vpd type for value of token\r
 \r
     /**\r
        If Vpd type for value of token\r
-       \r
+\r
        @return boolean\r
     **/\r
     public boolean isVpdEnable() {\r
        @return boolean\r
     **/\r
     public boolean isVpdEnable() {\r
@@ -231,7 +230,7 @@ public class Token {
 \r
     /**\r
        Get the token primary key in token database.\r
 \r
     /**\r
        Get the token primary key in token database.\r
-       \r
+\r
        @return String\r
      */\r
     public String getPrimaryKeyString () {\r
        @return String\r
      */\r
     public String getPrimaryKeyString () {\r
@@ -240,14 +239,14 @@ public class Token {
 \r
     /**\r
       Judge datumType is valid\r
 \r
     /**\r
       Judge datumType is valid\r
-      \r
+\r
       @param type  The datumType want to be judged.\r
       @param type  The datumType want to be judged.\r
-      \r
+\r
       @retval TRUE  - The type is valid.\r
       @retval FALSE - The type is invalid.\r
     **/\r
     public static boolean isValiddatumType(DATUM_TYPE type) {\r
       @retval TRUE  - The type is valid.\r
       @retval FALSE - The type is invalid.\r
     **/\r
     public static boolean isValiddatumType(DATUM_TYPE type) {\r
-        if ((type.ordinal() < DATUM_TYPE.UINT8.ordinal() ) || \r
+        if ((type.ordinal() < DATUM_TYPE.UINT8.ordinal() ) ||\r
             (type.ordinal() > DATUM_TYPE.POINTER.ordinal())) {\r
             return false;\r
         }\r
             (type.ordinal() > DATUM_TYPE.POINTER.ordinal())) {\r
             return false;\r
         }\r
@@ -256,14 +255,14 @@ public class Token {
 \r
     /**\r
       Judge pcdType is valid\r
 \r
     /**\r
       Judge pcdType is valid\r
-      \r
+\r
       @param  type The PCdType want to be judged.\r
       @param  type The PCdType want to be judged.\r
-      \r
+\r
       @retval TRUE  - The type is valid.\r
       @retval FALSE - The type is invalid.\r
     **/\r
     public static boolean isValidpcdType(PCD_TYPE  type) {\r
       @retval TRUE  - The type is valid.\r
       @retval FALSE - The type is invalid.\r
     **/\r
     public static boolean isValidpcdType(PCD_TYPE  type) {\r
-        if ((type.ordinal() < PCD_TYPE.FEATURE_FLAG.ordinal() ) || \r
+        if ((type.ordinal() < PCD_TYPE.FEATURE_FLAG.ordinal() ) ||\r
             (type.ordinal() > PCD_TYPE.DYNAMIC_EX.ordinal())) {\r
             return false;\r
         }\r
             (type.ordinal() > PCD_TYPE.DYNAMIC_EX.ordinal())) {\r
             return false;\r
         }\r
@@ -272,9 +271,9 @@ public class Token {
 \r
     /**\r
       Add an usage instance for token\r
 \r
     /**\r
       Add an usage instance for token\r
-      \r
+\r
       @param usageInstance   The usage instance\r
       @param usageInstance   The usage instance\r
-     \r
+\r
       @retval TRUE  - Success to add usage instance.\r
       @retval FALSE - Fail to add usage instance\r
     **/\r
       @retval TRUE  - Success to add usage instance.\r
       @retval FALSE - Fail to add usage instance\r
     **/\r
@@ -292,7 +291,7 @@ public class Token {
 \r
         //\r
         // Put usage instance into usage instance database of this PCD token.\r
 \r
         //\r
         // Put usage instance into usage instance database of this PCD token.\r
-        // \r
+        //\r
         consumers.put(usageInstance.getPrimaryKey(), usageInstance);\r
 \r
         return true;\r
         consumers.put(usageInstance.getPrimaryKey(), usageInstance);\r
 \r
         return true;\r
@@ -300,9 +299,9 @@ public class Token {
 \r
     /**\r
        Judge whether exist an usage instance for this token\r
 \r
     /**\r
        Judge whether exist an usage instance for this token\r
-       \r
+\r
        @param usageId       The UsageInstance identification for usage instance\r
        @param usageId       The UsageInstance identification for usage instance\r
-       \r
+\r
        @return boolean      whether exist an usage instance for this token.\r
      */\r
     public boolean isUsageInstanceExist(UsageIdentification usageId) {\r
        @return boolean      whether exist an usage instance for this token.\r
      */\r
     public boolean isUsageInstanceExist(UsageIdentification usageId) {\r
@@ -313,9 +312,9 @@ public class Token {
 \r
     /**\r
       Get the PCD_TYPE according to the string of PCD_TYPE\r
 \r
     /**\r
       Get the PCD_TYPE according to the string of PCD_TYPE\r
-      \r
+\r
       @param pcdTypeStr    The string of PCD_TYPE\r
       @param pcdTypeStr    The string of PCD_TYPE\r
-      \r
+\r
       @return PCD_TYPE\r
     **/\r
     public static PCD_TYPE getpcdTypeFromString(String pcdTypeStr) {\r
       @return PCD_TYPE\r
     **/\r
     public static PCD_TYPE getpcdTypeFromString(String pcdTypeStr) {\r
@@ -340,9 +339,9 @@ public class Token {
 \r
     /**\r
       Get the string of given datumType. This string will be used for generating autogen files\r
 \r
     /**\r
       Get the string of given datumType. This string will be used for generating autogen files\r
-     \r
+\r
       @param datumType   Given datumType\r
       @param datumType   Given datumType\r
-     \r
+\r
       @return The string of datum type.\r
     **/\r
     public static String getStringOfdatumType(DATUM_TYPE  datumType) {\r
       @return The string of datum type.\r
     **/\r
     public static String getStringOfdatumType(DATUM_TYPE  datumType) {\r
@@ -365,9 +364,9 @@ public class Token {
 \r
     /**\r
       Get the datumType according to a string.\r
 \r
     /**\r
       Get the datumType according to a string.\r
-      \r
+\r
       @param datumTypeStr    The string of datumType\r
       @param datumTypeStr    The string of datumType\r
-     \r
+\r
       @return DATUM_TYPE\r
     **/\r
     public static DATUM_TYPE getdatumTypeFromString(String datumTypeStr) {\r
       @return DATUM_TYPE\r
     **/\r
     public static DATUM_TYPE getdatumTypeFromString(String datumTypeStr) {\r
@@ -389,9 +388,9 @@ public class Token {
 \r
     /**\r
       Get string of given pcdType\r
 \r
     /**\r
       Get string of given pcdType\r
-      \r
+\r
       @param pcdType  The given PcdType\r
       @param pcdType  The given PcdType\r
-      \r
+\r
       @return The string of PCD_TYPE.\r
     **/\r
     public static String getStringOfpcdType(PCD_TYPE pcdType) {\r
       @return The string of PCD_TYPE.\r
     **/\r
     public static String getStringOfpcdType(PCD_TYPE pcdType) {\r
@@ -412,9 +411,9 @@ public class Token {
 \r
     /**\r
       Get the PCD_USAGE according to a string\r
 \r
     /**\r
       Get the PCD_USAGE according to a string\r
-      \r
+\r
       @param usageStr  The string of PCD_USAGE\r
       @param usageStr  The string of PCD_USAGE\r
-      \r
+\r
       @return The PCD_USAGE\r
     **/\r
     public static PCD_USAGE getUsageFromString(String usageStr) {\r
       @return The PCD_USAGE\r
     **/\r
     public static PCD_USAGE getUsageFromString(String usageStr) {\r
@@ -437,9 +436,9 @@ public class Token {
 \r
     /**\r
       Get the string of given PCD_USAGE\r
 \r
     /**\r
       Get the string of given PCD_USAGE\r
-      \r
+\r
       @param   usage   The given PCD_USAGE\r
       @param   usage   The given PCD_USAGE\r
-      \r
+\r
       @return The string of PDC_USAGE.\r
     **/\r
     public static String getStringOfUsage(PCD_USAGE usage) {\r
       @return The string of PDC_USAGE.\r
     **/\r
     public static String getStringOfUsage(PCD_USAGE usage) {\r
@@ -458,14 +457,14 @@ public class Token {
 \r
     /**\r
       Get the Defined datumType string for autogen. The string is for generating some MACROs in Autogen.h\r
 \r
     /**\r
       Get the Defined datumType string for autogen. The string is for generating some MACROs in Autogen.h\r
-      \r
+\r
       @param datumType The given datumType\r
 \r
       @return string of datum type for autogen.\r
     **/\r
     public static String GetAutogenDefinedatumTypeString(DATUM_TYPE datumType) {\r
         switch (datumType) {\r
       @param datumType The given datumType\r
 \r
       @return string of datum type for autogen.\r
     **/\r
     public static String GetAutogenDefinedatumTypeString(DATUM_TYPE datumType) {\r
         switch (datumType) {\r
-        \r
+\r
         case UINT8:\r
             return "8";\r
         case UINT16:\r
         case UINT8:\r
             return "8";\r
         case UINT16:\r
@@ -485,7 +484,7 @@ public class Token {
 \r
     /**\r
       Get the datumType String for Autogen. This string will be used for generating defintions of PCD token in autogen\r
 \r
     /**\r
       Get the datumType String for Autogen. This string will be used for generating defintions of PCD token in autogen\r
-      \r
+\r
       @param datumType   The given datumType\r
 \r
       @return string of datum type.\r
       @param datumType   The given datumType\r
 \r
       @return string of datum type.\r
@@ -511,7 +510,7 @@ public class Token {
 \r
     /**\r
       Get the datumType string for generating some MACROs in autogen file of Library\r
 \r
     /**\r
       Get the datumType string for generating some MACROs in autogen file of Library\r
-      \r
+\r
       @param   datumType  The given datumType\r
 \r
       @return String of datum for genrating bit charater.\r
       @param   datumType  The given datumType\r
 \r
       @return String of datum for genrating bit charater.\r
@@ -537,11 +536,10 @@ public class Token {
 \r
     /**\r
        Get the sku data who id is 0.\r
 \r
     /**\r
        Get the sku data who id is 0.\r
-       \r
+\r
        @retval DynamicTokenValue    the value of this dyanmic token.\r
     **/\r
     public DynamicTokenValue getDefaultSku() {\r
        @retval DynamicTokenValue    the value of this dyanmic token.\r
     **/\r
     public DynamicTokenValue getDefaultSku() {\r
-        DynamicTokenValue dynamicData;\r
         int               index;\r
 \r
         for (index = 0; index < this.skuData.size(); index ++) {\r
         int               index;\r
 \r
         for (index = 0; index < this.skuData.size(); index ++) {\r
@@ -555,7 +553,7 @@ public class Token {
 \r
     /**\r
        Get the number of Sku data for this token\r
 \r
     /**\r
        Get the number of Sku data for this token\r
-       \r
+\r
        @retval int the number of sku data\r
     **/\r
     public int getSkuIdCount () {\r
        @retval int the number of sku data\r
     **/\r
     public int getSkuIdCount () {\r
@@ -564,9 +562,9 @@ public class Token {
 \r
     /**\r
        Get the size of PCD value, this PCD is POINTER type.\r
 \r
     /**\r
        Get the size of PCD value, this PCD is POINTER type.\r
-       \r
+\r
        @param str   the string of the value\r
        @param str   the string of the value\r
-       @param al    \r
+       @param al\r
     **/\r
     private void getCurrentSizeFromDefaultValue (String str, ArrayList<Integer> al) {\r
         if (isValidNullValue(str)) {\r
     **/\r
     private void getCurrentSizeFromDefaultValue (String str, ArrayList<Integer> al) {\r
         if (isValidNullValue(str)) {\r
@@ -590,11 +588,11 @@ public class Token {
             } else if (str.startsWith("{")) {\r
                 //\r
                 // We count the number of "," in the string.\r
             } else if (str.startsWith("{")) {\r
                 //\r
                 // We count the number of "," in the string.\r
-                // The number of byte is one plus the number of \r
+                // The number of byte is one plus the number of\r
                 // comma.\r
                 //\r
                 String str2 = str;\r
                 // comma.\r
                 //\r
                 String str2 = str;\r
-                \r
+\r
                 int cnt = 0;\r
                 int pos = 0;\r
                 pos = str2.indexOf(",", 0);\r
                 int cnt = 0;\r
                 int pos = 0;\r
                 pos = str2.indexOf(",", 0);\r
@@ -612,17 +610,17 @@ public class Token {
     /**\r
        This method can be used to get the MAX and current size\r
        for pointer type dynamic(ex) PCD entry\r
     /**\r
        This method can be used to get the MAX and current size\r
        for pointer type dynamic(ex) PCD entry\r
-    **/ \r
+    **/\r
     public ArrayList<Integer> getPointerTypeSize () {\r
         ArrayList<Integer> al = new ArrayList<Integer>();\r
     public ArrayList<Integer> getPointerTypeSize () {\r
         ArrayList<Integer> al = new ArrayList<Integer>();\r
-        \r
+\r
         //\r
         // For VPD_enabled and HII_enabled, we can only return the MAX size.\r
         // For the default DATA type dynamic PCD entry, we will return\r
         // the MAX size and current size for each SKU_ID.\r
         //\r
         al.add(new Integer(this.datumSize));\r
         //\r
         // For VPD_enabled and HII_enabled, we can only return the MAX size.\r
         // For the default DATA type dynamic PCD entry, we will return\r
         // the MAX size and current size for each SKU_ID.\r
         //\r
         al.add(new Integer(this.datumSize));\r
-        \r
+\r
         if (!this.isVpdEnable()) {\r
             int idx;\r
             if (this.isHiiEnable()){\r
         if (!this.isVpdEnable()) {\r
             int idx;\r
             if (this.isHiiEnable()){\r
@@ -637,7 +635,7 @@ public class Token {
                 }\r
             }\r
         }\r
                 }\r
             }\r
         }\r
-        \r
+\r
         return al;\r
     }\r
 \r
         return al;\r
     }\r
 \r
@@ -645,7 +643,7 @@ public class Token {
        Get default value for a token, For HII type, HiiDefaultValue of default\r
        SKU 0 will be returned; For Default type, the defaultvalue of default SKU\r
        0 will be returned.\r
        Get default value for a token, For HII type, HiiDefaultValue of default\r
        SKU 0 will be returned; For Default type, the defaultvalue of default SKU\r
        0 will be returned.\r
-       \r
+\r
        @return String\r
      */\r
     public String getDynamicDefaultValue() {\r
        @return String\r
      */\r
     public String getDynamicDefaultValue() {\r
@@ -665,14 +663,12 @@ public class Token {
     //          to support no default value.\r
     //\r
     public boolean hasDefaultValue () {\r
     //          to support no default value.\r
     //\r
     public boolean hasDefaultValue () {\r
-        int               value         = 0;\r
-        boolean           isInteger     = true;\r
         DynamicTokenValue dynamicValue  = null;\r
 \r
         if (isSkuEnable()) {\r
             return true;\r
         }\r
         DynamicTokenValue dynamicValue  = null;\r
 \r
         if (isSkuEnable()) {\r
             return true;\r
         }\r
-        \r
+\r
         if (this.isDynamicPCD) {\r
             dynamicValue = getDefaultSku();\r
             switch (dynamicValue.type) {\r
         if (this.isDynamicPCD) {\r
             dynamicValue = getDefaultSku();\r
             switch (dynamicValue.type) {\r
@@ -690,9 +686,9 @@ public class Token {
 \r
     /**\r
        Judge the value is NULL value. NULL value means the value is uninitialized value\r
 \r
     /**\r
        Judge the value is NULL value. NULL value means the value is uninitialized value\r
-       \r
+\r
        @param judgedValue\r
        @param judgedValue\r
-       \r
+\r
        @return boolean\r
      */\r
     public boolean isValidNullValue(String judgedValue) {\r
        @return boolean\r
      */\r
     public boolean isValidNullValue(String judgedValue) {\r
@@ -704,7 +700,7 @@ public class Token {
         case UINT16:\r
         case UINT32:\r
             if (judgedValue.length() > 2) {\r
         case UINT16:\r
         case UINT32:\r
             if (judgedValue.length() > 2) {\r
-                if ((judgedValue.charAt(0) == '0')        && \r
+                if ((judgedValue.charAt(0) == '0')        &&\r
                     ((judgedValue.charAt(1) == 'x') || (judgedValue.charAt(1) == 'X'))){\r
                     subStr      = judgedValue.substring(2, judgedValue.length());\r
                     bigIntValue = new BigInteger(subStr, 16);\r
                     ((judgedValue.charAt(1) == 'x') || (judgedValue.charAt(1) == 'X'))){\r
                     subStr      = judgedValue.substring(2, judgedValue.length());\r
                     bigIntValue = new BigInteger(subStr, 16);\r
@@ -720,7 +716,7 @@ public class Token {
             break;\r
         case UINT64:\r
             if (judgedValue.length() > 2){\r
             break;\r
         case UINT64:\r
             if (judgedValue.length() > 2){\r
-                if ((judgedValue.charAt(0) == '0') && \r
+                if ((judgedValue.charAt(0) == '0') &&\r
                     ((judgedValue.charAt(1) == 'x') ||\r
                      (judgedValue.charAt(1) == 'X'))) {\r
                     bigIntValue = new BigInteger(judgedValue.substring(2, judgedValue.length()),  16);\r
                     ((judgedValue.charAt(1) == 'x') ||\r
                      (judgedValue.charAt(1) == 'X'))) {\r
                     bigIntValue = new BigInteger(judgedValue.substring(2, judgedValue.length()),  16);\r
@@ -759,34 +755,34 @@ public class Token {
 \r
     /**\r
        Is the string value in Unicode\r
 \r
     /**\r
        Is the string value in Unicode\r
-       \r
+\r
        @return boolean\r
     **/\r
     public boolean isHiiDefaultValueUnicodeStringType() {\r
         DynamicTokenValue dynamicData = getDefaultSku();\r
        @return boolean\r
     **/\r
     public boolean isHiiDefaultValueUnicodeStringType() {\r
         DynamicTokenValue dynamicData = getDefaultSku();\r
-        \r
+\r
         if (dynamicData == null)\r
             return false;\r
         if (dynamicData == null)\r
             return false;\r
-        \r
+\r
         return dynamicData.hiiDefaultValue.startsWith("L\"")\r
                 && dynamicData.hiiDefaultValue.endsWith("\"");\r
     }\r
 \r
     /**\r
        Is the string value in ANSCI\r
         return dynamicData.hiiDefaultValue.startsWith("L\"")\r
                 && dynamicData.hiiDefaultValue.endsWith("\"");\r
     }\r
 \r
     /**\r
        Is the string value in ANSCI\r
-       \r
+\r
        @return boolean\r
     **/\r
     public boolean isHiiDefaultValueASCIIStringType() {\r
         DynamicTokenValue dynamicData = getDefaultSku();\r
        @return boolean\r
     **/\r
     public boolean isHiiDefaultValueASCIIStringType() {\r
         DynamicTokenValue dynamicData = getDefaultSku();\r
-    \r
+\r
         if (dynamicData == null)\r
             return false;\r
         if (dynamicData == null)\r
             return false;\r
-        \r
+\r
         return dynamicData.hiiDefaultValue.startsWith("\"")\r
         && dynamicData.hiiDefaultValue.endsWith("\"");\r
     }\r
         return dynamicData.hiiDefaultValue.startsWith("\"")\r
         && dynamicData.hiiDefaultValue.endsWith("\"");\r
     }\r
-    \r
+\r
     /**\r
        Judege whether current value is UNICODE string type.\r
        @return boolean\r
     /**\r
        Judege whether current value is UNICODE string type.\r
        @return boolean\r
@@ -799,14 +795,14 @@ public class Token {
         }\r
 \r
         if (datumType == Token.DATUM_TYPE.POINTER &&\r
         }\r
 \r
         if (datumType == Token.DATUM_TYPE.POINTER &&\r
-            str.startsWith("L\"") && \r
+            str.startsWith("L\"") &&\r
             str.endsWith("\"")) {\r
             return true;\r
         }\r
 \r
         return false;\r
     }\r
             str.endsWith("\"")) {\r
             return true;\r
         }\r
 \r
         return false;\r
     }\r
-    \r
+\r
     public boolean isASCIIStringType () {\r
         String str = getDynamicDefaultValue();\r
 \r
     public boolean isASCIIStringType () {\r
         String str = getDynamicDefaultValue();\r
 \r
@@ -815,7 +811,7 @@ public class Token {
         }\r
 \r
         if (datumType == Token.DATUM_TYPE.POINTER &&\r
         }\r
 \r
         if (datumType == Token.DATUM_TYPE.POINTER &&\r
-            str.startsWith("\"") && \r
+            str.startsWith("\"") &&\r
             str.endsWith("\"")) {\r
             return true;\r
         }\r
             str.endsWith("\"")) {\r
             return true;\r
         }\r
@@ -831,16 +827,16 @@ public class Token {
         }\r
 \r
         if (datumType == Token.DATUM_TYPE.POINTER &&\r
         }\r
 \r
         if (datumType == Token.DATUM_TYPE.POINTER &&\r
-            str.startsWith("{") && \r
+            str.startsWith("{") &&\r
             str.endsWith("}")) {\r
             return true;\r
         }\r
 \r
         return false;\r
             str.endsWith("}")) {\r
             return true;\r
         }\r
 \r
         return false;\r
-        \r
+\r
     }\r
 \r
     }\r
 \r
-    public String getStringTypeString () {                       \r
+    public String getStringTypeString () {\r
         return getDefaultSku().value.substring(2, getDefaultSku().value.length() - 1);\r
     }\r
 }\r
         return getDefaultSku().value.substring(2, getDefaultSku().value.length() - 1);\r
     }\r
 }\r
index 0f52b22d7869586bf09c2549289c65a9d2c102e8..0c54525661e9bf4482ca7529e592a1ad1cb4c6a7 100644 (file)
@@ -17,33 +17,41 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 package org.tianocore.pcd.entity;\r
 \r
 /**\r
 package org.tianocore.pcd.entity;\r
 \r
 /**\r
-   \r
+   The identification for a UsageInstance. \r
+   It should be extend from ModuleIdentification in future.\r
+\r
 **/\r
 public class UsageIdentification {\r
     ///\r
     /// The module CName: one key of Identification\r
     /// \r
     public String moduleName;\r
 **/\r
 public class UsageIdentification {\r
     ///\r
     /// The module CName: one key of Identification\r
     /// \r
     public String moduleName;\r
+\r
     /// \r
     /// The module Guid String: one key of Identification\r
     /// \r
     public String moduleGuid;\r
     /// \r
     /// The module Guid String: one key of Identification\r
     /// \r
     public String moduleGuid;\r
+\r
     /// \r
     /// The package CName: one key of Identification \r
     ///\r
     public String packageName;\r
     /// \r
     /// The package CName: one key of Identification \r
     ///\r
     public String packageName;\r
+\r
     /// \r
     /// The package Guid: one key of Identification\r
     /// \r
     public String packageGuid;\r
     /// \r
     /// The package Guid: one key of Identification\r
     /// \r
     public String packageGuid;\r
+\r
     /// \r
     /// Module's Arch: one key of Identification\r
     /// \r
     public String arch;\r
     /// \r
     /// Module's Arch: one key of Identification\r
     /// \r
     public String arch;\r
+\r
     /// \r
     /// Module's version: one key of Identification\r
     /// \r
     public String version;\r
     /// \r
     /// Module's version: one key of Identification\r
     /// \r
     public String version;\r
+\r
     ///\r
     /// Module's type\r
     /// \r
     ///\r
     /// Module's type\r
     /// \r
index a961d8807da552204800f87c4460763e0c41a894..6fc66055eb8043bd8ba80e98cb22e1af4044de43 100644 (file)
@@ -4,26 +4,21 @@
   This class indicate an usage instance for a PCD token. This instance maybe a module\r
   or platform setting. When a module produce or cosume a PCD token, then this module\r
   is an usage instance for this PCD token.\r
   This class indicate an usage instance for a PCD token. This instance maybe a module\r
   or platform setting. When a module produce or cosume a PCD token, then this module\r
   is an usage instance for this PCD token.\r
\r
+\r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
\r
+\r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-**/  \r
+**/\r
 package org.tianocore.pcd.entity;\r
 \r
 package org.tianocore.pcd.entity;\r
 \r
-\r
-import java.util.UUID;\r
-\r
-import org.tianocore.ModuleTypeDef;\r
 import org.tianocore.pcd.entity.CommonDefinition;\r
 import org.tianocore.pcd.entity.UsageIdentification;\r
 import org.tianocore.pcd.entity.CommonDefinition;\r
 import org.tianocore.pcd.entity.UsageIdentification;\r
-import org.tianocore.pcd.exception.EntityException;\r
 \r
 /**\r
   This class indicate an usage instance for a PCD token. This instance maybe a module\r
 \r
 /**\r
   This class indicate an usage instance for a PCD token. This instance maybe a module\r
@@ -38,29 +33,29 @@ public class UsageInstance {
 \r
     ///\r
     /// ModuleIdentification for Usage Instance\r
 \r
     ///\r
     /// ModuleIdentification for Usage Instance\r
-    /// \r
+    ///\r
     public UsageIdentification  usageId;\r
 \r
     ///\r
     /// Arch also is a key for a UsageInstance\r
     public UsageIdentification  usageId;\r
 \r
     ///\r
     /// Arch also is a key for a UsageInstance\r
-    /// \r
+    ///\r
     public String               arch;\r
 \r
     ///\r
     public String               arch;\r
 \r
     ///\r
-    /// The PCD type defined for module \r
-    /// \r
+    /// The PCD type defined for module\r
+    ///\r
     public Token.PCD_TYPE       modulePcdType;\r
 \r
     ///\r
     public Token.PCD_TYPE       modulePcdType;\r
 \r
     ///\r
-    /// The value of the PCD in this usage instance. \r
-    /// \r
+    /// The value of the PCD in this usage instance.\r
+    ///\r
     public String               datum;\r
 \r
     ///\r
     /// The maxDatumSize could be different for same PCD in different module\r
     /// But this case is allow for FeatureFlag, FixedAtBuild, PatchableInModule\r
     /// type.\r
     public String               datum;\r
 \r
     ///\r
     /// The maxDatumSize could be different for same PCD in different module\r
     /// But this case is allow for FeatureFlag, FixedAtBuild, PatchableInModule\r
     /// type.\r
-    /// \r
+    ///\r
     public int                  maxDatumSize;\r
 \r
     ///\r
     public int                  maxDatumSize;\r
 \r
     ///\r
@@ -70,12 +65,12 @@ public class UsageInstance {
 \r
     ///\r
     /// Auotgen string for C code file.\r
 \r
     ///\r
     /// Auotgen string for C code file.\r
-    /// \r
+    ///\r
     public String               cAutogenStr;\r
 \r
     /**\r
        Constructure function for UsageInstance\r
     public String               cAutogenStr;\r
 \r
     /**\r
        Constructure function for UsageInstance\r
-       \r
+\r
        @param parentToken         The token instance for this usgaInstance\r
        @param id                  The identification for usage instance\r
        @param modulePcdType       The PCD type for this usage instance\r
        @param parentToken         The token instance for this usgaInstance\r
        @param id                  The identification for usage instance\r
        @param modulePcdType       The PCD type for this usage instance\r
@@ -97,9 +92,9 @@ public class UsageInstance {
 \r
     /**\r
        Get the primary key for usage instance array for every token.\r
 \r
     /**\r
        Get the primary key for usage instance array for every token.\r
-       \r
+\r
        @param   usageId       The identification of UsageInstance\r
        @param   usageId       The identification of UsageInstance\r
-       \r
+\r
        @retval  String        The primary key for this usage instance\r
     **/\r
     public static String getPrimaryKey(UsageIdentification usageId) {\r
        @retval  String        The primary key for this usage instance\r
     **/\r
     public static String getPrimaryKey(UsageIdentification usageId) {\r
@@ -108,7 +103,7 @@ public class UsageInstance {
 \r
     /**\r
        Get primary key string for this usage instance\r
 \r
     /**\r
        Get primary key string for this usage instance\r
-       \r
+\r
        @return String primary key string\r
     **/\r
     public String getPrimaryKey() {\r
        @return String primary key string\r
     **/\r
     public String getPrimaryKey() {\r
@@ -117,7 +112,7 @@ public class UsageInstance {
 \r
     /**\r
        Judget whether current module is PEI driver\r
 \r
     /**\r
        Judget whether current module is PEI driver\r
-       \r
+\r
        @return boolean whether current module is PEI driver\r
     **/\r
     public boolean isPeiPhaseComponent() {\r
        @return boolean whether current module is PEI driver\r
     **/\r
     public boolean isPeiPhaseComponent() {\r
@@ -132,7 +127,7 @@ public class UsageInstance {
 \r
     /**\r
        Judge whether current module is DXE driver.\r
 \r
     /**\r
        Judge whether current module is DXE driver.\r
-       \r
+\r
        @return boolean whether current module is DXE driver\r
     **/\r
     public boolean isDxePhaseComponent() {\r
        @return boolean whether current module is DXE driver\r
     **/\r
     public boolean isDxePhaseComponent() {\r
@@ -152,7 +147,7 @@ public class UsageInstance {
 \r
     /**\r
        Generate autogen string for header file and C code file.\r
 \r
     /**\r
        Generate autogen string for header file and C code file.\r
-       \r
+\r
        @param isBuildUsedLibrary  whether the autogen is for library.\r
     **/\r
     public void generateAutoGen(boolean isBuildUsedLibrary) {\r
        @param isBuildUsedLibrary  whether the autogen is for library.\r
     **/\r
     public void generateAutoGen(boolean isBuildUsedLibrary) {\r
@@ -167,12 +162,12 @@ public class UsageInstance {
         if (this.modulePcdType == Token.PCD_TYPE.DYNAMIC_EX) {\r
             //\r
             // For DYNAMIC_EX type PCD, use original token number in SPD or FPD to generate autogen\r
         if (this.modulePcdType == Token.PCD_TYPE.DYNAMIC_EX) {\r
             //\r
             // For DYNAMIC_EX type PCD, use original token number in SPD or FPD to generate autogen\r
-            // \r
+            //\r
             tokenNumberString =  Long.toString(parentToken.dynamicExTokenNumber, 16);\r
         } else {\r
             //\r
             // For Others type PCD, use autogenerated token number to generate autogen\r
             tokenNumberString =  Long.toString(parentToken.dynamicExTokenNumber, 16);\r
         } else {\r
             //\r
             // For Others type PCD, use autogenerated token number to generate autogen\r
-            // \r
+            //\r
             tokenNumberString = Long.toString(parentToken.tokenNumber, 16);\r
         }\r
 \r
             tokenNumberString = Long.toString(parentToken.tokenNumber, 16);\r
         }\r
 \r
@@ -180,7 +175,7 @@ public class UsageInstance {
 \r
         //\r
         // Judge the value of this PCD is byte array type\r
 \r
         //\r
         // Judge the value of this PCD is byte array type\r
-        // \r
+        //\r
         if (!isBuildUsedLibrary && !parentToken.isDynamicPCD) {\r
             if (datum.trim().charAt(0) == '{') {\r
                 isByteArray = true;\r
         if (!isBuildUsedLibrary && !parentToken.isDynamicPCD) {\r
             if (datum.trim().charAt(0) == '{') {\r
                 isByteArray = true;\r
@@ -189,7 +184,7 @@ public class UsageInstance {
 \r
         //\r
         // "ULL" should be added to value's tail for UINT64 value\r
 \r
         //\r
         // "ULL" should be added to value's tail for UINT64 value\r
-        // \r
+        //\r
         if (parentToken.datumType == Token.DATUM_TYPE.UINT64) {\r
             printDatum = this.datum + "ULL";\r
         } else {\r
         if (parentToken.datumType == Token.DATUM_TYPE.UINT64) {\r
             printDatum = this.datum + "ULL";\r
         } else {\r
@@ -198,19 +193,19 @@ public class UsageInstance {
 \r
         switch (modulePcdType) {\r
         case FEATURE_FLAG:\r
 \r
         switch (modulePcdType) {\r
         case FEATURE_FLAG:\r
-            hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n", \r
+            hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n",\r
                                          parentToken.cName);\r
             hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n",\r
                                          parentToken.cName);\r
             hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n",\r
-                                         parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                         Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                          parentToken.cName,\r
                                          parentToken.cName);\r
             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",\r
                                          parentToken.cName,\r
                                          parentToken.cName);\r
             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",\r
-                                         parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                         Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                          parentToken.cName);\r
 \r
             if (!isBuildUsedLibrary) {\r
                                          parentToken.cName);\r
 \r
             if (!isBuildUsedLibrary) {\r
-                hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
-                                             parentToken.cName, \r
+                hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n",\r
+                                             parentToken.cName,\r
                                              printDatum);\r
                 cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                              parentToken.cName,\r
                                              printDatum);\r
                 cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                              parentToken.cName,\r
@@ -221,7 +216,7 @@ public class UsageInstance {
             if (isByteArray) {\r
                 hAutogenStr += String.format("extern const UINT8 _gPcd_FixedAtBuild_%s[];\r\n",\r
                                              parentToken.cName);\r
             if (isByteArray) {\r
                 hAutogenStr += String.format("extern const UINT8 _gPcd_FixedAtBuild_%s[];\r\n",\r
                                              parentToken.cName);\r
-                hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  (VOID*)_gPcd_FixedAtBuild_%s\r\n", \r
+                hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  (VOID*)_gPcd_FixedAtBuild_%s\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
@@ -229,27 +224,27 @@ public class UsageInstance {
                 hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",\r
                                              Token.getAutogendatumTypeString(parentToken.datumType),\r
                                              parentToken.cName);\r
                 hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",\r
                                              Token.getAutogendatumTypeString(parentToken.datumType),\r
                                              parentToken.cName);\r
-                hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n", \r
+                hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
             }\r
 \r
             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",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
             }\r
 \r
             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",\r
-                                         parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                         Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                          parentToken.cName);\r
             if (!isBuildUsedLibrary) {\r
                 if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
                     if (isByteArray) {\r
                                          parentToken.cName);\r
             if (!isBuildUsedLibrary) {\r
                 if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
                     if (isByteArray) {\r
-                        hAutogenStr += String.format("#define _PCD_VALUE_%s   (VOID*)_gPcd_FixedAtBuild_%s\r\n", \r
-                                                     parentToken.cName, \r
+                        hAutogenStr += String.format("#define _PCD_VALUE_%s   (VOID*)_gPcd_FixedAtBuild_%s\r\n",\r
+                                                     parentToken.cName,\r
                                                      parentToken.cName);\r
                         cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_%s[] = %s;\r\n",\r
                                                      parentToken.cName,\r
                                                      printDatum);\r
                     } else {\r
                                                      parentToken.cName);\r
                         cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_%s[] = %s;\r\n",\r
                                                      parentToken.cName,\r
                                                      printDatum);\r
                     } else {\r
-                        hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
-                                                     parentToken.cName, \r
+                        hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n",\r
+                                                     parentToken.cName,\r
                                                      printDatum);\r
                         cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                                      Token.getAutogendatumTypeString(parentToken.datumType),\r
                                                      printDatum);\r
                         cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                                      Token.getAutogendatumTypeString(parentToken.datumType),\r
@@ -257,8 +252,8 @@ public class UsageInstance {
                                                      parentToken.cName);\r
                     }\r
                 } else {\r
                                                      parentToken.cName);\r
                     }\r
                 } else {\r
-                    hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
-                                                 parentToken.cName, \r
+                    hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n",\r
+                                                 parentToken.cName,\r
                                                  printDatum);\r
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                                  Token.getAutogendatumTypeString(parentToken.datumType),\r
                                                  printDatum);\r
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                                  Token.getAutogendatumTypeString(parentToken.datumType),\r
@@ -274,7 +269,7 @@ public class UsageInstance {
                 hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  (VOID*)_gPcd_BinaryPatch_%s\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                 hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  (VOID*)_gPcd_BinaryPatch_%s\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
-                                             parentToken.cName);  \r
+                                             parentToken.cName);\r
             } else {\r
                 hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",\r
                                              Token.getAutogendatumTypeString(parentToken.datumType),\r
             } else {\r
                 hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",\r
                                              Token.getAutogendatumTypeString(parentToken.datumType),\r
@@ -282,12 +277,12 @@ public class UsageInstance {
                 hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  _gPcd_BinaryPatch_%s\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                 hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  _gPcd_BinaryPatch_%s\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
-                                             parentToken.cName);                \r
+                                             parentToken.cName);\r
             }\r
 \r
             //\r
             // Generate _PCD_SET_MODE_xx macro for using set BinaryPatch value via PcdSet macro\r
             }\r
 \r
             //\r
             // Generate _PCD_SET_MODE_xx macro for using set BinaryPatch value via PcdSet macro\r
-            // \r
+            //\r
             if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) CopyMem (_gPcd_BinaryPatch_%s, (Buffer), (SizeOfBuffer))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
             if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) CopyMem (_gPcd_BinaryPatch_%s, (Buffer), (SizeOfBuffer))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
@@ -299,10 +294,10 @@ public class UsageInstance {
                                              parentToken.cName,\r
                                              parentToken.cName);\r
             }\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
             }\r
-            \r
+\r
             if (!isBuildUsedLibrary) {\r
             if (!isBuildUsedLibrary) {\r
-                hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
-                                             parentToken.cName, \r
+                hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n",\r
+                                             parentToken.cName,\r
                                              printDatum);\r
                 if (isByteArray) {\r
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[] = _PCD_VALUE_%s;\r\n",\r
                                              printDatum);\r
                 if (isByteArray) {\r
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[] = _PCD_VALUE_%s;\r\n",\r
@@ -370,7 +365,7 @@ public class UsageInstance {
 \r
     /**\r
       Get the autogen string for header file.\r
 \r
     /**\r
       Get the autogen string for header file.\r
-      \r
+\r
       @return The string of header file.\r
     **/\r
     public String getHAutogenStr() {\r
       @return The string of header file.\r
     **/\r
     public String getHAutogenStr() {\r
@@ -379,7 +374,7 @@ public class UsageInstance {
 \r
     /**\r
       Get the autogen string for C code file.\r
 \r
     /**\r
       Get the autogen string for C code file.\r
-      \r
+\r
       @return The string of C Code file.\r
     **/\r
     public String getCAutogenStr() {\r
       @return The string of C Code file.\r
     **/\r
     public String getCAutogenStr() {\r