diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-01-29 18:09:35 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-01-29 18:09:35 -0800 |
commit | f7728e425b2d7b1188aaff039053e044a0fe6a20 (patch) | |
tree | 1b08ca8700b616c4dd8c0f2fb150fc1768a401a0 | |
parent | e4e105c96bd9a57df15dce1215e000cbc24199fb (diff) | |
download | txr-f7728e425b2d7b1188aaff039053e044a0fe6a20.tar.gz txr-f7728e425b2d7b1188aaff039053e044a0fe6a20.tar.bz2 txr-f7728e425b2d7b1188aaff039053e044a0fe6a20.zip |
awk: support list of string as input source.
* share/txr/stdlib/awk.tl (sys:awk-state loop): Allow an input
source to be a list of strings, which is converted to a
stream.
* txr.1: Documented.
-rw-r--r-- | share/txr/stdlib/awk.tl | 5 | ||||
-rw-r--r-- | txr.1 | 16 |
2 files changed, 17 insertions, 4 deletions
diff --git a/share/txr/stdlib/awk.tl b/share/txr/stdlib/awk.tl index 05567956..90f9e8b0 100644 --- a/share/txr/stdlib/awk.tl +++ b/share/txr/stdlib/awk.tl @@ -125,7 +125,10 @@ in)) (when beg-file-func [beg-file-func aws]) - (let* ((*stdin* (if (streamp in) in (open-file in))) + (let* ((*stdin* (cond + ((streamp in) in) + ((listp in) (make-strlist-input-stream in)) + ((open-file in)))) (noted-rs (not aws.rs)) (noted-krs (not aws.krs)) (cached-rr nil)) @@ -42790,9 +42790,19 @@ clauses. Each is evaluated and the values of these forms are gathered into a list. This list then comprises the list of input sources for the .code awk -processing task. The input sources are either character strings, -denoting file system path names to be opened for reading, or else -input stream objects. +processing task. + +Each input source must be one of three kinds of objects. +It may be a stream object, which must be capable of character +input. It may be a list of strings, which +.code awk +will convert to an input stream as if by the +.code make-strlist-input-stream +function. +Or else it must be a character +string, which denotes a filesystem path name which +.code awk +will open for reading. If the .code :inputs |