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
\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
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