]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
update ModuleSA PCD editor.
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdFileContents.java
index 633aafeb2166810735d0c92e2da75cc3ca4721db..6d9235cdc87dc5334de95d33a127bba75dedd52f 100644 (file)
@@ -347,10 +347,11 @@ public class FpdFileContents {
             PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = li.next();\r
             saa[i][0] = pcdData.getCName();\r
             saa[i][1] = pcdData.getTokenSpaceGuidCName();\r
-            saa[i][2] = pcdData.getItemType().toString();\r
+            saa[i][2] = pcdData.getItemType()+"";\r
             saa[i][3] = pcdData.getToken().toString();\r
-            saa[i][4] = pcdData.getDatumType().toString();\r
-            saa[i][5] = pcdData.getValue();\r
+            saa[i][4] = pcdData.getMaxDatumSize()+"";\r
+            saa[i][5] = pcdData.getDatumType()+"";\r
+            saa[i][6] = pcdData.getValue();\r
             \r
         }\r
     }\r
@@ -556,7 +557,7 @@ public class FpdFileContents {
      * @param mi\r
      * @param moduleSa if null, generate a new ModuleSA.\r
      */\r
-    public void addFrameworkModulesPcdBuildDefs(ModuleIdentification mi, ModuleSADocument.ModuleSA moduleSa){\r
+    public void addFrameworkModulesPcdBuildDefs(ModuleIdentification mi, ModuleSADocument.ModuleSA moduleSa) throws Exception {\r
         //ToDo add Arch filter\r
         \r
         try {\r
@@ -583,7 +584,7 @@ public class FpdFileContents {
                     //\r
                     // ToDo Error \r
                     //\r
-                    break;\r
+                    throw new PcdDeclNotFound(mi.getName() + " " + msaPcd.getCName());\r
                 }\r
                 //\r
                 // AddItem to ModuleSA PcdBuildDefinitions\r
@@ -595,6 +596,7 @@ public class FpdFileContents {
         }\r
         catch (Exception e){\r
             e.printStackTrace();\r
+            throw e; \r
         }\r
         \r
     }\r
@@ -640,7 +642,8 @@ public class FpdFileContents {
         return msa;\r
     }\r
     \r
-    private void genPcdData (String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal, ModuleSADocument.ModuleSA moduleSa) {\r
+    private void genPcdData (String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal, ModuleSADocument.ModuleSA moduleSa) \r
+    throws PcdItemTypeConflictException, PcdValueMalFormed{\r
         if (moduleSa.getPcdBuildDefinition() == null){\r
             moduleSa.addNewPcdBuildDefinition();\r
         }\r
@@ -669,7 +672,7 @@ public class FpdFileContents {
                 if (!valuePart[4].equals("DYNAMIC")) {\r
                     //ToDo error for same pcd, other type than dynamic\r
                     pcdConsumer.remove(listValue);\r
-                    return;\r
+                    throw new PcdItemTypeConflictException(value);\r
                 }\r
             }\r
         }\r
@@ -681,7 +684,7 @@ public class FpdFileContents {
                 if (valuePart[4].equals("DYNAMIC")) {\r
                     //ToDo error for same pcd, other type than non-dynamic\r
                     pcdConsumer.remove(listValue);\r
-                    return;\r
+                    throw new PcdItemTypeConflictException(value);\r
                 }\r
             }\r
         }\r
@@ -740,7 +743,7 @@ public class FpdFileContents {
         }\r
     }\r
     \r
-    private int setMaxSizeForPointer(String datum) {\r
+    private int setMaxSizeForPointer(String datum) throws PcdValueMalFormed{\r
         if (datum == null) {\r
             return 0;\r
         }\r
@@ -760,6 +763,7 @@ public class FpdFileContents {
                 (end   > datum.length())||\r
                 ((start == end) && (datum.length() > 0))) {\r
                 //ToDo Error handling here\r
+                throw new PcdValueMalFormed (datum);\r
             }\r
 \r
             strValue    = datum.substring(start + 1, end);\r
@@ -770,7 +774,7 @@ public class FpdFileContents {
             if ((start > end)           || \r
                 (end   > datum.length())||\r
                 ((start == end) && (datum.length() > 0))) {\r
-                \r
+                throw new PcdValueMalFormed (datum);\r
             }\r
             strValue    = datum.substring(start + 1, end);\r
             return strValue.length();\r
@@ -791,7 +795,7 @@ public class FpdFileContents {
                 if (value > 0xFF) {\r
 //                   "[FPD file error] The datum type of PCD %s in %s is VOID*, "+\r
 //                   "it is byte array in fact. But the element of %s exceed the byte range",\r
-                                                    \r
+                    throw new PcdValueMalFormed (datum);                               \r
                 }\r
             }\r
             return strValueArray.length;\r
@@ -803,7 +807,7 @@ public class FpdFileContents {
 //            "2) ANSIC string: like \"xxx\";\r\n"+\r
 //            "3) Byte array: like {0x2, 0x45, 0x23}\r\n"+\r
 //            "but the datum in seems does not following above format!",\r
-              return -1;                             \r
+            throw new PcdValueMalFormed (datum);\r
             \r
         }\r
     }\r
@@ -845,7 +849,8 @@ public class FpdFileContents {
         }\r
     }\r
     \r
-    private void addDynamicPcdBuildData(String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal) {\r
+    private void addDynamicPcdBuildData(String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal) \r
+    throws PcdValueMalFormed{\r
         DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData dynPcdData = getfpdDynPcdBuildDefs().addNewPcdBuildData();\r
         dynPcdData.setItemType(PcdItemTypes.Enum.forString(itemType));\r
         dynPcdData.setCName(cName);\r
@@ -2173,3 +2178,54 @@ public class FpdFileContents {
         return s.trim();\r
     }\r
 }\r
+\r
+class PcdItemTypeConflictException extends Exception {\r
+\r
+    /**\r
+     * \r
+     */\r
+    private static final long serialVersionUID = 1L;\r
+    private String details = null;\r
+    \r
+    PcdItemTypeConflictException(String info){\r
+        details = info;\r
+    }\r
+    \r
+    public String getMessage() {\r
+        return details;\r
+    }\r
+}\r
+\r
+class PcdDeclNotFound extends Exception {\r
+\r
+    /**\r
+     * \r
+     */\r
+    private static final long serialVersionUID = 1L;\r
+    private String details = null;\r
+    \r
+    PcdDeclNotFound(String info) {\r
+        details = info;\r
+    }\r
+    \r
+    public String getMessage() {\r
+        return details;\r
+    }\r
+}\r
+\r
+class PcdValueMalFormed extends Exception {\r
+\r
+    /**\r
+     * \r
+     */\r
+    private static final long serialVersionUID = 1L;\r
+    private String details = null;\r
+    \r
+    PcdValueMalFormed(String info) {\r
+        details = info;\r
+    }\r
+    \r
+    public String getMessage() {\r
+        return details;\r
+    }\r
+}\r