public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools ConvertFceToStructurePcd: Fix the array value with empty string
@ 2018-10-30 14:59 Liming Gao
  2018-10-31  3:51 ` Zhu, Yonghong
  0 siblings, 1 reply; 2+ messages in thread
From: Liming Gao @ 2018-10-30 14:59 UTC (permalink / raw)
  To: edk2-devel

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Scripts/ConvertFceToStructurePcd.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py b/BaseTools/Scripts/ConvertFceToStructurePcd.py
index 6ca51c4..9240b8f 100644
--- a/BaseTools/Scripts/ConvertFceToStructurePcd.py
+++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py
@@ -303,7 +303,10 @@ class Config(object):
     list1 = [t for t in list1 if t != '']  # remove '' form list
     first_num = int(list1[0], 16)
     if list1[first_num + 1] == 'STRING':  # parser STRING
-      value = 'L%s' % list1[-1]
+      if list1[-1] == '""':
+        value = "{0x0, 0x0}"
+      else:
+        value = 'L%s' % list1[-1]
     elif list1[first_num + 1] == 'ORDERED_LIST':  # parser ORDERED_LIST
       value_total = int(list1[first_num + 2])
       list2 = list1[-value_total:]
@@ -505,12 +508,22 @@ class mainprocess(object):
     inf_list = self.del_repeat(inf_list)
     header_list = self.plus(self.del_repeat(header_list))
     title_all=list(set(title_list))
-    info_list = self.del_repeat(info_list)
+    info_list = self.remove_bracket(self.del_repeat(info_list))
     for i in range(len(info_list)-1,-1,-1):
       if len(info_list[i]) == 0:
         info_list.remove(info_list[i])
     return keys,title_all,info_list,header_list,inf_list
 
+  def remove_bracket(self,List):
+    for i in List:
+      for j in i:
+        tmp = j.split("|")
+        if (('L"' in j) and ("[" in j)) or (tmp[1].strip() == '{0x0, 0x0}'):
+          tmp[0] = tmp[0][:tmp[0].index('[')]
+          List[List.index(i)][i.index(j)] = "|".join(tmp)
+        else:
+          List[List.index(i)][i.index(j)] = j
+    return List
 
   def write_all(self):
     title_flag=1
-- 
2.10.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] BaseTools ConvertFceToStructurePcd: Fix the array value with empty string
  2018-10-30 14:59 [Patch] BaseTools ConvertFceToStructurePcd: Fix the array value with empty string Liming Gao
@ 2018-10-31  3:51 ` Zhu, Yonghong
  0 siblings, 0 replies; 2+ messages in thread
From: Zhu, Yonghong @ 2018-10-31  3:51 UTC (permalink / raw)
  To: Gao, Liming, edk2-devel@lists.01.org

Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong


-----Original Message-----
From: Gao, Liming 
Sent: Tuesday, October 30, 2018 11:00 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [Patch] BaseTools ConvertFceToStructurePcd: Fix the array value with empty string

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Scripts/ConvertFceToStructurePcd.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py b/BaseTools/Scripts/ConvertFceToStructurePcd.py
index 6ca51c4..9240b8f 100644
--- a/BaseTools/Scripts/ConvertFceToStructurePcd.py
+++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py
@@ -303,7 +303,10 @@ class Config(object):
     list1 = [t for t in list1 if t != '']  # remove '' form list
     first_num = int(list1[0], 16)
     if list1[first_num + 1] == 'STRING':  # parser STRING
-      value = 'L%s' % list1[-1]
+      if list1[-1] == '""':
+        value = "{0x0, 0x0}"
+      else:
+        value = 'L%s' % list1[-1]
     elif list1[first_num + 1] == 'ORDERED_LIST':  # parser ORDERED_LIST
       value_total = int(list1[first_num + 2])
       list2 = list1[-value_total:]
@@ -505,12 +508,22 @@ class mainprocess(object):
     inf_list = self.del_repeat(inf_list)
     header_list = self.plus(self.del_repeat(header_list))
     title_all=list(set(title_list))
-    info_list = self.del_repeat(info_list)
+    info_list = self.remove_bracket(self.del_repeat(info_list))
     for i in range(len(info_list)-1,-1,-1):
       if len(info_list[i]) == 0:
         info_list.remove(info_list[i])
     return keys,title_all,info_list,header_list,inf_list
 
+  def remove_bracket(self,List):
+    for i in List:
+      for j in i:
+        tmp = j.split("|")
+        if (('L"' in j) and ("[" in j)) or (tmp[1].strip() == '{0x0, 0x0}'):
+          tmp[0] = tmp[0][:tmp[0].index('[')]
+          List[List.index(i)][i.index(j)] = "|".join(tmp)
+        else:
+          List[List.index(i)][i.index(j)] = j
+    return List
 
   def write_all(self):
     title_flag=1
-- 
2.10.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-31  3:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-30 14:59 [Patch] BaseTools ConvertFceToStructurePcd: Fix the array value with empty string Liming Gao
2018-10-31  3:51 ` Zhu, Yonghong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox