summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--share/txr/stdlib/compiler.tl4
-rw-r--r--txr.111
2 files changed, 15 insertions, 0 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index 56db42b2..5b194263 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -1595,6 +1595,10 @@
(with-resources ((in-stream (car streams) (close-stream in-stream))
(out-stream (cadr streams) (close-stream out-stream))
(out (new list-builder)))
+ (iflet ((line (get-line in-stream))
+ ((starts-with "#!" line)))
+ (put-line line out-stream)
+ (seek-stream in-stream 0 :from-start))
(labels ((compile-form (form)
(unless (atom form)
(caseq (car form)
diff --git a/txr.1 b/txr.1
index 9941c972..0a377670 100644
--- a/txr.1
+++ b/txr.1
@@ -62306,6 +62306,17 @@ special variable has no influence on this.
Circular structures in compiled literals are preserved; on loading, similar
circular structures are reproduced.
+.SS* Treatment of The Hash Bang Line
+
+When a source file begins with the
+.code #!
+("hash-bang") character sequence, the file compiler propagates that
+line to the compiled file, verbatim.
+
+\*(TX supports the hash bang mechanism in compiled
+.code .tlo
+files, thereby allowing compiled scripts to be executable.
+
.coNP Function @ compile-toplevel
.synb
.mets (compile-toplevel < form << expanded-p )