implement -E command-line switch
This commit is contained in:
parent
0ddfabc64b
commit
1609cf5911
18
jtlc
18
jtlc
@ -35,13 +35,23 @@ def main(argv):
|
||||
success = translate(args, s, tf)
|
||||
tf.close()
|
||||
if success:
|
||||
suffix = '.c' if args.E else '.o'
|
||||
m = re.match('(.*)\.jtl', s)
|
||||
if m is not None:
|
||||
ofname = m.group(1) + '.o'
|
||||
ofname = m.group(1) + suffix
|
||||
else:
|
||||
ofname = s + '.o'
|
||||
success = do_compile(args, tfname, ofname)
|
||||
ofiles.append(ofname)
|
||||
ofname = s + suffix
|
||||
if args.E:
|
||||
f = open(tfname, 'r')
|
||||
content = f.read()
|
||||
f.close()
|
||||
f = open(ofname, 'w')
|
||||
f.write(content)
|
||||
f.close()
|
||||
return 0
|
||||
else:
|
||||
success = do_compile(args, tfname, ofname)
|
||||
ofiles.append(ofname)
|
||||
os.unlink(tfname)
|
||||
|
||||
if success and not args.c:
|
||||
|
Loading…
x
Reference in New Issue
Block a user