diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-06-04 08:24:32 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-06-04 08:24:32 -0700 |
commit | 35e78942bed148e1a23ffc7eaa50dc38d81f1af9 (patch) | |
tree | 275bd5b19a853f54f61c1eb2840b99308e1af2da /stdlib | |
parent | f73ef8182bebb9344d445edbb2f210ada03c8469 (diff) | |
download | txr-35e78942bed148e1a23ffc7eaa50dc38d81f1af9.tar.gz txr-35e78942bed148e1a23ffc7eaa50dc38d81f1af9.tar.bz2 txr-35e78942bed148e1a23ffc7eaa50dc38d81f1af9.zip |
compiler: new function, clean-file.
This function simplifies cleaning, by allowing a file to
be cleaned to be identified in much the same way as an input
file to load or compile-file.
* autoload.c (compiler_set_entries): The clean-file symbol
is interned and becomes an autoload trigger for the
compiler module.
* stdlib/compiler.tl (clean-file): New function.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/compiler.tl | 16 | ||||
-rw-r--r-- | stdlib/doc-syms.tl | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/stdlib/compiler.tl b/stdlib/compiler.tl index 62893e94..ea8124e8 100644 --- a/stdlib/compiler.tl +++ b/stdlib/compiler.tl @@ -2425,6 +2425,22 @@ (list in-stream out-stream out-path))) +(defun clean-file (path) + (let* ((parent *load-path*) + (path (if (and parent (pure-rel-path-p path)) + (path-cat (dir-name parent) path) + path))) + (match-case path + (@(or `@base.tlo` + `@base.tlo.gz`) + (ignore base) + (remove-path path)) + (@(or `@base.txr` + `@base.tl` + `@base`) + (or (remove-path `@base.tlo` nil) + (remove-path `@base.tlo.gz` nil)))))) + (defun list-from-vm-desc (vd) (list (sys:vm-desc-nlevels vd) (sys:vm-desc-nregs vd) diff --git a/stdlib/doc-syms.tl b/stdlib/doc-syms.tl index a3d5434d..49e7cb9f 100644 --- a/stdlib/doc-syms.tl +++ b/stdlib/doc-syms.tl @@ -329,6 +329,7 @@ ("chr-xdigit" "N-021C89F4") ("chrp" "N-02C6CEED") ("clamp" "N-03B940D4") + ("clean-file" "N-001939D4") ("clear-cflags" "N-02061924") ("clear-dirty" "N-03AB857D") ("clear-error" "D-000C") |