summaryrefslogtreecommitdiffstats
path: root/lisplib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-12-22 22:47:49 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-12-22 22:47:49 -0800
commitc49feea690ee65ec754ac0172db5964d363927af (patch)
tree3320cb34143972d624ad6a9c335447c6033c13ce /lisplib.c
parentc740cf5e2af62936fb95799d05a8235b956c15b2 (diff)
downloadtxr-c49feea690ee65ec754ac0172db5964d363927af.tar.gz
txr-c49feea690ee65ec754ac0172db5964d363927af.tar.bz2
txr-c49feea690ee65ec754ac0172db5964d363927af.zip
New function: compile-update-file.
The new function only compiles a file if the output file doesn't exist or is out of date. In addition, both compile-file now deletes the output file if compilation fails, and has a documented return value. * lisplib.c (compiler_set_entries): Add autoload entry fro compile-update-file. (open-compile-streams): Accepts a third argument: a function to test the input stream against the output path. The output file is opened, and the streams are returned, only if that test function returns true. Also, a third element is returned: the output path. This lets the caller to know what to delete, if the output file must be deleted. (compile-file-conditionally): New internal function, formed from compile-file. Takes an extra argument, the test function to pass to open-compile-streams. Compilation is skipped if open-compile-streams returns nil. Internals reshuffled a bit. If compilation doesn't set the success flag, then the with-resources logic now removes the output file in addition to closing the output stream. Prior to setting the success flag, we flush the output stream. * txr.1: Documented new function, all return values, and deletion of output file on unsuccessful compilation.
Diffstat (limited to 'lisplib.c')
-rw-r--r--lisplib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lisplib.c b/lisplib.c
index 78d6c024..d143ab2d 100644
--- a/lisplib.c
+++ b/lisplib.c
@@ -716,7 +716,8 @@ static val compiler_set_entries(val dlt, val fun)
nil
};
val name[] = {
- lit("compile-toplevel"), lit("compile-file"), lit("compile"),
+ lit("compile-toplevel"), lit("compile"), lit("compile-file"),
+ lit("compile-update-file"),
lit("with-compilation-unit"), lit("dump-compiled-objects"),
nil
};