1. Fix EDKT344: The algorithm for PCD of msa should be adjusted
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 16 Oct 2006 08:46:52 +0000 (08:46 +0000)
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 16 Oct 2006 08:46:52 +0000 (08:46 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1759 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java

index 21d76139c5718dfbf3d4db275be41651e20e0c91..daf00ee80fab7259af802c69f32208666bdec2d9 100644 (file)
@@ -254,7 +254,7 @@ public class DataType {
     public static final String FALSE = "False";\r
     \r
     //\r
-    // The Sting for USAGE type\r
+    // The String for USAGE type\r
     //\r
     public final static String USAGE_TYPE_ALWAYS_CONSUMED = "ALWAYS_CONSUMED";\r
     \r
@@ -266,6 +266,19 @@ public class DataType {
     \r
     public final static String USAGE_TYPE_PRIVATE = "PRIVATE";\r
     \r
+    //\r
+    // The String for PCD type\r
+    //\r
+    public final static String PCD_ITEM_TYPE_FEATURE_FLAG = "FEATURE_FLAG";\r
+    \r
+    public final static String PCD_ITEM_TYPE_FIXED_AT_BUILD = "FIXED_AT_BUILD";\r
+    \r
+    public final static String PCD_ITEM_TYPE_PATCHABLE_IN_MODULE = "PATCHABLE_IN_MODULE";\r
+    \r
+    public final static String PCD_ITEM_TYPE_DYNAMIC = "DYNAMIC";\r
+    \r
+    public final static String PCD_ITEM_TYPE_DYNAMIC_EX = "DYNAMIC_EX";\r
+    \r
     //\r
     // The String for PPI type\r
     //\r
index 4ffca7af594ea7d073928cb8bb4ca64fd034b659..408e75e8124a2db4e1bc8cbda903da4b23925d67 100644 (file)
@@ -709,11 +709,11 @@ public class EnumerationData {
     \r
     private void initPcdItemTypes() {\r
         vPcdItemTypes.removeAllElements();\r
-        vPcdItemTypes.addElement("FEATURE_FLAG");\r
-        vPcdItemTypes.addElement("FIXED_AT_BUILD");\r
-        vPcdItemTypes.addElement("PATCHABLE_IN_MODULE");\r
-        vPcdItemTypes.addElement("DYNAMIC");\r
-        vPcdItemTypes.addElement("DYNAMIC_EX");\r
+        vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_FEATURE_FLAG);\r
+        vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_FIXED_AT_BUILD);\r
+        vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_PATCHABLE_IN_MODULE);\r
+        vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_DYNAMIC);\r
+        vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_DYNAMIC_EX);\r
     }\r
     \r
     private void initPcdUsage() {\r
index dedbdddf20b48c45d4355a0c14eaa102630ea3a3..c27b81eea0c029dd5a1d402f2f48396150dcb400 100644 (file)
@@ -458,7 +458,31 @@ public class WorkspaceTools {
                     String help = spd.getPcdDeclarations().getPcdEntryList().get(index).getHelpText();\r
                     Vector<String> type = Tools.convertListToVector(spd.getPcdDeclarations().getPcdEntryList()\r
                                                                        .get(index).getValidUsage());\r
-\r
+                    //\r
+                    // The algorithm for PCD of msa should be:\r
+                    // 1. If the type of PCD from Spd is FEATURE_FLAG, \r
+                    //    the type of Msa only can be FEATURE_FLAG.\r
+                    // 2. If the type of PCD from Spd is not FEATURE_FLAG, \r
+                    //    the type of Msa could be selected from the PCD's all types and "DYNAMIC" type.\r
+                    //\r
+                    boolean hasFEATURE_FLAG = false;\r
+                    boolean hasDYNAMIC = false;\r
+                    for (int indexOfType = 0; indexOfType < type.size(); indexOfType++) {\r
+                        if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_DYNAMIC)) {\r
+                            hasDYNAMIC = true;\r
+                        }\r
+                        if(type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_FEATURE_FLAG)) {\r
+                            hasFEATURE_FLAG = true;\r
+                        }\r
+                    }\r
+                    if (hasFEATURE_FLAG) {\r
+                        type.removeAllElements();\r
+                        type.addElement(DataType.PCD_ITEM_TYPE_FEATURE_FLAG);\r
+                    } else {\r
+                        if (!hasDYNAMIC) {\r
+                            type.addElement(DataType.PCD_ITEM_TYPE_DYNAMIC);\r
+                        }\r
+                    }\r
                     vector.addPcd(new PcdIdentification(name, guidCName, help, type));\r
                 }\r
             }\r