diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/dietcc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/dietcc b/scripts/dietcc index 110a647..540d168 100755 --- a/scripts/dietcc +++ b/scripts/dietcc @@ -127,6 +127,16 @@ def final_cleanup_pass(dietc, meta): return dietc +def make_external_pass(command): + def pass_(dietc, meta): + with tempfile.TemporaryDirectory() as tmpdir: + t_file = open(f"{tmpdir}/file.c", "wb") + t_file.write(dietc) + t_file.flush() + return check_result(subprocess.run(f"{command} {t_file.name}", + shell=True, capture_output=True)) + return pass_ + PASSES = [preprocess_pass, strip_after_preprocess_pass, dietc_pass, @@ -136,11 +146,10 @@ def main(): args = list(map(shlex.quote, sys.argv[1:])) args.insert(0, f"-I{dietc_dir}/scripts/stdincludes") # first, parse out any DietC passes - dietc_passes = [] while "--dietc-pass" in args: i = args.index("--dietc-pass") args.pop(i) - dietc_passes.append(args.pop(i)) + PASSES.insert(-1, make_external_pass(args.pop(i))) # then process all of the C files out_dir = tempfile.TemporaryDirectory() |