]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Scripts/ConvertFceToStructurePcd.py
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Scripts / ConvertFceToStructurePcd.py
index 6ca51c4ed1a790e9f5074fc13ece512752cbb052..c65cb555afe2a6ad6160136baf3caf801941b23d 100644 (file)
@@ -6,13 +6,7 @@
 # PCD setting in DEC/DSC/INF files.\r
 #\r
 # Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
-# 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
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
 \r
 '''\r
@@ -135,7 +129,7 @@ class parser_lst(object):
                       tmp_dict[offset] = tmp_name\r
                       pcdname_num = int(pcdname_num_re.findall(t_name)[0],10)\r
                       uint = int(unit_num.findall(uint)[0],10)\r
-                      bit = uint / 8\r
+                      bit = uint // 8\r
                       for i in range(1, pcdname_num):\r
                         offset += bit\r
                         tmp_name = pcdname2_re.findall(t_name)[0] + '[%s]' % i\r
@@ -303,7 +297,10 @@ class Config(object):
     list1 = [t for t in list1 if t != '']  # remove '' form list\r
     first_num = int(list1[0], 16)\r
     if list1[first_num + 1] == 'STRING':  # parser STRING\r
-      value = 'L%s' % list1[-1]\r
+      if list1[-1] == '""':\r
+        value = "{0x0, 0x0}"\r
+      else:\r
+        value = 'L%s' % list1[-1]\r
     elif list1[first_num + 1] == 'ORDERED_LIST':  # parser ORDERED_LIST\r
       value_total = int(list1[first_num + 2])\r
       list2 = list1[-value_total:]\r
@@ -413,7 +410,7 @@ class PATH(object):
 \r
   def header(self,struct):\r
     header={}\r
-    head_re = re.compile(r'} %s;[\s\S\n]+h{1}"'%struct,re.M|re.S)\r
+    head_re = re.compile('typedef.*} %s;[\n]+(.*?)(?:typedef|formset)'%struct,re.M|re.S)\r
     head_re2 = re.compile(r'#line[\s\d]+"(\S+h)"')\r
     for i in list(self.lstinf.keys()):\r
       with open(i,'r') as lst:\r
@@ -505,12 +502,22 @@ class mainprocess(object):
     inf_list = self.del_repeat(inf_list)\r
     header_list = self.plus(self.del_repeat(header_list))\r
     title_all=list(set(title_list))\r
-    info_list = self.del_repeat(info_list)\r
+    info_list = self.remove_bracket(self.del_repeat(info_list))\r
     for i in range(len(info_list)-1,-1,-1):\r
       if len(info_list[i]) == 0:\r
         info_list.remove(info_list[i])\r
     return keys,title_all,info_list,header_list,inf_list\r
 \r
+  def remove_bracket(self,List):\r
+    for i in List:\r
+      for j in i:\r
+        tmp = j.split("|")\r
+        if (('L"' in j) and ("[" in j)) or (tmp[1].strip() == '{0x0, 0x0}'):\r
+          tmp[0] = tmp[0][:tmp[0].index('[')]\r
+          List[List.index(i)][i.index(j)] = "|".join(tmp)\r
+        else:\r
+          List[List.index(i)][i.index(j)] = j\r
+    return List\r
 \r
   def write_all(self):\r
     title_flag=1\r