summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-09-17 14:31:58 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-09-17 14:31:58 -0700
commit848e713f8fd84af478d9d2c31661b50081ee136b (patch)
treec91a6362a4096b4e51e71bd029e524985d545b07 /share
parent6a61ffbabf4a3c5616c5fbf30c7dff7b1af4dd39 (diff)
downloadtxr-848e713f8fd84af478d9d2c31661b50081ee136b.tar.gz
txr-848e713f8fd84af478d9d2c31661b50081ee136b.tar.bz2
txr-848e713f8fd84af478d9d2c31661b50081ee136b.zip
New awk variable: krs.
* share/txr/stdlib/awk.tl (sys:awk-state): New slot, krs. (sys:awk-state loop): Use record-adapter if krs is true, even if the default fs is in effect. Pass value of krs to record-adapter function. (sys:awk-let): Provide krs "awk variable" symbol macro. * txr.1: Documented krs. Clarified semantics of rs being those of both separation and termination.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/awk.tl9
1 files changed, 6 insertions, 3 deletions
diff --git a/share/txr/stdlib/awk.tl b/share/txr/stdlib/awk.tl
index ad5cbe35..bc5dc9dd 100644
--- a/share/txr/stdlib/awk.tl
+++ b/share/txr/stdlib/awk.tl
@@ -24,7 +24,7 @@
;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(defstruct sys:awk-state ()
- (rs "\n")
+ (rs "\n") krs
fs ft kfs
(ofs " ")
(ors "\n")
@@ -86,12 +86,14 @@
[beg-file-func aws])
(unwind-protect
(let* ((stin (if (streamp in) in (open-file in)))
- (recin (if (equal aws.rs "\n")
+ (recin (if (and (equal aws.rs "\n")
+ (not aws.krs))
stin
(record-adapter (if (regexp aws.rs)
aws.rs
(regex-compile aws.rs))
- stin))))
+ stin
+ aws.krs))))
(set aws.file-rec-num 0)
(whilet ((rec (get-line recin)))
(set aws.rec rec)
@@ -169,6 +171,7 @@
(fnr (qref ,aws-sym file-rec-num))
(arg (qref ,aws-sym file-num))
(rs (qref ,aws-sym rs))
+ (krs (qref ,aws-sym krs))
(fs (qref ,aws-sym fs))
(ft (qref ,aws-sym ft))
(kfs (qref ,aws-sym kfs))