]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java
Remove unused PCD file.
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / pcd / entity / Token.java
index edcbd80aa2aeed8597163a22faf41f6a94e15e74..2a29b0c7f33a489f54c5df396906495a6674dca2 100644 (file)
@@ -67,12 +67,12 @@ public class Token {
     /// platform token space. For Dynamic, dynamicEx type, this number will be re-adjust by\r
     /// PCD run-time database autogen tools.\r
     ///\r
-    public int              tokenNumber;\r
+    public long              tokenNumber;\r
 \r
     ///\r
     /// This token number is retrieved from FPD file for DynamicEx type. \r
     /// \r
-    public int              dynamicExTokenNumber;\r
+    public long              dynamicExTokenNumber;\r
 \r
     ///\r
     /// All supported PCD type, this value can be retrieved from SPD\r
@@ -279,8 +279,9 @@ public class Token {
                                  usageInstance.arch,\r
                                  usageInstance.version)) {\r
             exceptionStr = String.format("PCD %s for module %s has already exist in database, Please check all PCD build entries "+\r
-                                         "in modules PcdPeim in <ModuleSA> to make sure no duplicated definitions!",\r
+                                         "in modules %s in <ModuleSA> to make sure no duplicated definitions!",\r
                                          usageInstance.parentToken.cName,\r
+                                         usageInstance.moduleName,\r
                                          usageInstance.moduleName);\r
             throw new EntityException(exceptionStr);\r
         }\r
@@ -574,7 +575,78 @@ public class Token {
     public int getSkuIdCount () {\r
         return this.skuData.size();\r
     }\r
-    \r
+\r
+    private void getCurrentSizeFromDefaultValue (String str, ArrayList<Integer> al) {\r
+        if (isValidNullValue(str)) {\r
+            al.add(new Integer(0));\r
+        } else {\r
+            //\r
+            // isValidNullValue has already make sure that str here\r
+            // always contain a valid default value of the following 3\r
+            // cases:\r
+            // 1) "Hello world" //Assci string\r
+            // 2) L"Hello" //Unicode string\r
+            // 3) {0x01, 0x02, 0x03} //Byte stream\r
+            //\r
+            if (str.startsWith("\"")) {\r
+                al.add(new Integer(str.length() - 2));\r
+            } else if (str.startsWith("L\"")){\r
+                //\r
+                // Unicode is 2 bytes each.\r
+                //\r
+                al.add(new Integer((str.length() - 3) * 2));\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
+                // comma.\r
+                //\r
+                String str2 = str;\r
+                \r
+                int cnt = 0;\r
+                int pos = 0;\r
+                pos = str2.indexOf(",", 0);\r
+                while (pos != -1) {\r
+                    cnt++;\r
+                    pos++;\r
+                    pos = str2.indexOf(",", pos);\r
+                }\r
+                cnt++;\r
+                al.add(new Integer(cnt));\r
+            }\r
+        }\r
+    }\r
+    //\r
+    // This method can be used to get the MAX and current size\r
+    // for pointer type dynamic(ex) PCD entry\r
+    //\r
+    public ArrayList<Integer> getPointerTypeSize () {\r
+        ArrayList<Integer> al = new ArrayList<Integer>();\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
+        if (!this.isVpdEnable()) {\r
+            int idx;\r
+            if (this.isHiiEnable()){\r
+                for (idx = 0; idx < this.skuData.size(); idx++) {\r
+                    String str = this.skuData.get(idx).value.hiiDefaultValue;\r
+                    getCurrentSizeFromDefaultValue(str, al);\r
+                }\r
+            } else {\r
+                for (idx = 0; idx < this.skuData.size(); idx++) {\r
+                    String str = this.skuData.get(idx).value.value;\r
+                    getCurrentSizeFromDefaultValue(str, al);\r
+                }\r
+            }\r
+        }\r
+        \r
+        return al;\r
+    }\r
 \r
     /**\r
        Get default value for a token, For HII type, HiiDefaultValue of default\r
@@ -587,8 +659,6 @@ public class Token {
         DynamicTokenValue dynamicData = getDefaultSku();\r
         if (hasDefaultValue()) {\r
             switch (dynamicData.type) {\r
-            case HII_TYPE:\r
-                return dynamicData.hiiDefaultValue;\r
             case DEFAULT_TYPE:\r
                 return dynamicData.value;\r
             }\r
@@ -626,7 +696,6 @@ public class Token {
     }\r
 \r
     public boolean isValidNullValue(String judgedValue) {\r
-        int         intValue;\r
         String      subStr;\r
         BigInteger  bigIntValue;\r
 \r
@@ -687,7 +756,27 @@ public class Token {
         }\r
         return false;\r
     }\r
-\r
+    \r
+    public boolean isHiiDefaultValueUnicodeStringType() {\r
+        DynamicTokenValue dynamicData = getDefaultSku();\r
+        \r
+        if (dynamicData == null)\r
+            return false;\r
+        \r
+        return dynamicData.hiiDefaultValue.startsWith("L\"")\r
+                && dynamicData.hiiDefaultValue.endsWith("\"");\r
+    }\r
+    \r
+    public boolean isHiiDefaultValueASCIIStringType() {\r
+        DynamicTokenValue dynamicData = getDefaultSku();\r
+    \r
+        if (dynamicData == null)\r
+            return false;\r
+        \r
+        return dynamicData.hiiDefaultValue.startsWith("\"")\r
+        && dynamicData.hiiDefaultValue.endsWith("\"");\r
+    }\r
+    \r
     /**\r
        Judege whether current value is UNICODE string type.\r
        @return boolean\r