11 left_paren = line.find(
'(')
14 li = line[left_paren:]
15 right_paren = line.find(
')')
16 if right_paren > 0
and right_paren > left_paren
and line[
17 right_paren:].find(
'(') >= 0:
18 fname = line[:right_paren]
19 fname = fname.lstrip(
' ').lstrip(
'*').lstrip(
' ').rstrip(
' ')
22 print(
"from {0}:{1}".format(file, num))
23 print(
"-T {0}".format(fname))
27 line = line.rstrip(
' ').rstrip(
'\t').rstrip(
' ').rstrip(
'\t')
28 right_space = line.rfind(
' ')
29 right_tab = line.rfind(
'\t')
30 sep = right_tab
if right_tab > right_space
else right_space
33 tname = tname.lstrip(
'*')
36 print(
"from {0}:{1}".format(file, num))
37 print(
"-T {0}".format(tname))
41 with open(file,
'rb')
as f:
47 for i, l
in enumerate(data.splitlines(
False)):
49 l = l.rstrip(
' ').rstrip(
'\t')
53 if l[:8] !=
'typedef ':
57 if l[8:].lstrip(
' ').lstrip(
'\t')[:6] ==
'struct':
60 leftcbrace = l.find(
'{')
63 td_line.append(l[:leftcbrace])
64 l = l[leftcbrace + 1:]
66 rightcbrace = l.rfind(
'}')
70 td_line.append(l[rightcbrace + 1:])
73 if len(l) > 0
and l[-1] ==
';' and (
not td_struct
or td_level == 0):
74 td_line =
' '.join(td_line)
75 td_line = td_line[:-1]
77 if td_line[-1] ==
')':
88 for dirpath, dirs, files
in os.walk(d):
90 if re.match(
r'(?!lt_).+\.(c|cc|h)$', f):
91 file = os.path.join(dirpath, f)
95if __name__ ==
'__main__':
96 if len(sys.argv[1:]) == 0:
def get_td_from_simple_type(line, file, num)
def get_td_from_function_signature(line, file, num)