From c95adf6c4c7515b4f13747a46a7c2b8a9baad8e9 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 30 Dec 2022 15:05:30 -0800 Subject: awk: new feature, res variable. The res variable captures the specific value of the condition expression, making it available to the action. * autoload.c (awk_set_entries): Intern the res symbol * stdlib/awk.tl (awk): Instead of generating the condition-action into a simple when, we use whenlet to also bind the res variable. * tests/015/awk-res.tl: New file. * txr.1: Documented. * stdlib/doc-syms.tl: Updated. --- autoload.c | 1 + stdlib/awk.tl | 6 ++++-- stdlib/doc-syms.tl | 1 + tests/015/awk-res.tl | 8 ++++++++ txr.1 | 44 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 tests/015/awk-res.tl diff --git a/autoload.c b/autoload.c index 30d388ba..72e89e9e 100644 --- a/autoload.c +++ b/autoload.c @@ -352,6 +352,7 @@ static val awk_set_entries(val fun) lit("<-"), lit("!>"), lit("