From 1609cf59115ed94c6eaec6a5bb421379560689fe Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 30 Aug 2011 16:34:51 -0400 Subject: [PATCH] implement -E command-line switch --- jtlc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/jtlc b/jtlc index f88ace9..c6865e2 100755 --- a/jtlc +++ b/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: