You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
416 B
24 lines
416 B
5 months ago
|
import re
|
||
|
import sys
|
||
|
|
||
|
fsrc = "rtthread.dll"
|
||
|
fname ="rtthread.def"
|
||
|
prefix = "__vs_rtm_"
|
||
|
|
||
|
if len(sys.argv) >= 2:
|
||
|
fsrc = sys.argv[1]
|
||
|
fname = sys.argv[2]
|
||
|
|
||
|
#restr = r"__vs_rtm_.*?\0"
|
||
|
restr = prefix + r".*?\0"
|
||
|
s = open(fsrc, 'rb').read()
|
||
|
l = re.findall(restr, s, re.S)
|
||
|
lines = [i[len(prefix):-1] for i in l]
|
||
|
|
||
|
s = '\n'.join(lines)
|
||
|
|
||
|
fout = open(fname, 'w')
|
||
|
fout.write('EXPORTS\n')
|
||
|
fout.write('main\n')
|
||
|
fout.write(s)
|