From 969b24f06ad615f56f452c87cf2735b5978c754f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 21 Apr 2018 11:38:01 -0700 Subject: awk: bug: multiple expansion in redirection macros. share/txr/stdlib/awk.tl (sys:awk-redir): Put the unused gensym to use: evaluate the path expressio nonce into the gensym variable. Also move strangely place comma. --- share/txr/stdlib/awk.tl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'share') diff --git a/share/txr/stdlib/awk.tl b/share/txr/stdlib/awk.tl index dee43dcd..a0e2a39e 100644 --- a/share/txr/stdlib/awk.tl +++ b/share/txr/stdlib/awk.tl @@ -287,9 +287,10 @@ (defmacro sys:awk-redir (aws-sym stream-var kind mode path body) (with-gensyms (res-sym) - ^(let ((,stream-var (qref ,aws-sym (ensure-stream ,kind ,path, mode)))) + ^(let ((,res-sym ,path) + (,stream-var (qref ,aws-sym (ensure-stream ,kind ,res-sym ,mode)))) ,(if body - ^(qref ,aws-sym (close-or-flush ,stream-var ,kind ,path + ^(qref ,aws-sym (close-or-flush ,stream-var ,kind ,res-sym (progn ,*body))) stream-var)))) -- cgit v1.2.3