summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-09-12 05:59:41 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-09-12 05:59:41 -0700
commit000220fca51ff45aeb979ad766667fb3667f0b05 (patch)
tree088f6fef11683e5af043888160f649a2109eed73 /share
parentc8fce379dc53372516766abe5bd8deb9a0f864aa (diff)
downloadtxr-000220fca51ff45aeb979ad766667fb3667f0b05.tar.gz
txr-000220fca51ff45aeb979ad766667fb3667f0b05.tar.bz2
txr-000220fca51ff45aeb979ad766667fb3667f0b05.zip
awk macro: fix: rebind *stdout* in broader scope.
* share/txr/stdlib/awk.tl (sys:awk-state loop): Do not bind *stdout* around the call to the main record-processing function. (awk): Re-bind *stdout* around all of the user code, just after the run-time awk state object is constructed. * txr.1: Correct the lies written about :output.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/awk.tl4
1 files changed, 2 insertions, 2 deletions
diff --git a/share/txr/stdlib/awk.tl b/share/txr/stdlib/awk.tl
index 3c92286a..bb1dec1e 100644
--- a/share/txr/stdlib/awk.tl
+++ b/share/txr/stdlib/awk.tl
@@ -94,8 +94,7 @@
(inc aws.file-rec-num)
aws.(rec-to-f)
(block :awk-rec
- (let ((*stdout* aws.output))
- [func aws]))))
+ [func aws])))
(when end-file-func
[end-file-func aws])))))
@@ -200,6 +199,7 @@
,*(if awc.inputs ^(inputs (list ,*awc.inputs)))
,*(if awc.output ^(output ,awc.output))
rng-n (macro-time (qref ,awc nranges))))
+ (*stdout* (qref ,aws-sym output))
,*(if awc.begin-file-actions
^((,awk-begf-fun (lambda (,aws-sym)
,*awc.begin-file-actions))))