]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/Misc.py
BaseTools: FdfParser and FdfParserLite share reg exp
[mirror_edk2.git] / BaseTools / Source / Python / Common / Misc.py
index af374d804d86b8a01a5fee2ae38b0c2968169eaf..7d44fdcf8ba73b42107299e65e36a7b4379659fb 100644 (file)
@@ -1441,6 +1441,22 @@ def ParseConsoleLog(Filename):
     Opr.close()\r
     Opw.close()\r
 \r
+def IsFieldValueAnArray (Value):\r
+    Value = Value.strip()\r
+    if Value.startswith('GUID') and Value.endswith(')'):\r
+        return True\r
+    if Value.startswith('L"') and Value.endswith('"')  and len(list(Value[2:-1])) > 1:\r
+        return True\r
+    if Value[0] == '"' and Value[-1] == '"' and len(list(Value[1:-1])) > 1:\r
+        return True\r
+    if Value[0] == '{' and Value[-1] == '}':\r
+        return True\r
+    if Value.startswith("L'") and Value.endswith("'") and len(list(Value[2:-1])) > 1:\r
+        return True\r
+    if Value[0] == "'" and Value[-1] == "'" and len(list(Value[1:-1])) > 1:\r
+        return True\r
+    return False\r
+\r
 def AnalyzePcdExpression(Setting):\r
     Setting = Setting.strip()\r
     # There might be escaped quote in a string: \", \\\" , \', \\\'\r
@@ -1704,14 +1720,6 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''):
             Type = DataType\r
         if len(FieldList) > 2:\r
             Size = FieldList[2]\r
-        else:\r
-            if Type == 'VOID*':\r
-                if Value.startswith("L"):\r
-                    Size = str((len(Value)- 3 + 1) * 2)\r
-                elif Value.startswith("{"):\r
-                    Size = str(len(Value.split(",")))\r
-                else:\r
-                    Size = str(len(Value) -2 + 1 )\r
         if DataType == "":\r
             IsValid = (len(FieldList) <= 1)\r
         else:\r
@@ -2377,31 +2385,6 @@ def PackRegistryFormatGuid(Guid):
                 int(Guid[4][-2:], 16)\r
                 )\r
 \r
-def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, Value):\r
-    if PcdDatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64,'BOOLEAN']:\r
-        if Value.startswith('L') or Value.startswith('"'):\r
-            if not Value[1]:\r
-                EdkLogger.error("build", FORMAT_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')\r
-            Value = Value\r
-        elif Value.startswith('H'):\r
-            if not Value[1]:\r
-                EdkLogger.error("build", FORMAT_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')\r
-            Value = Value[1:]\r
-        else:\r
-            if not Value[0]:\r
-                EdkLogger.error("build", FORMAT_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')\r
-            Value = '"' + Value + '"'\r
-\r
-    IsValid, Cause = CheckPcdDatum(PcdDatumType, Value)\r
-    if not IsValid:\r
-        EdkLogger.error("build", FORMAT_INVALID, Cause, ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName))\r
-    if PcdDatumType == 'BOOLEAN':\r
-        Value = Value.upper()\r
-        if Value == 'TRUE' or Value == '1':\r
-            Value = '1'\r
-        elif Value == 'FALSE' or Value == '0':\r
-            Value = '0'\r
-    return  Value\r
 ##  Get the integer value from string like "14U" or integer like 2\r
 #\r
 #   @param      Input   The object that may be either a integer value or a string\r