diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2013-10-06 20:39:10 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2013-10-06 20:39:10 -0700 |
commit | 7c8c8d326bbb8b9725efa6a3c364d3426a7cdca9 (patch) | |
tree | 86984ce58ca520cd3402fb9b77732d24f8046735 /match.c | |
parent | 7a7b1d26622b2f7df03b60847f622111296b008d (diff) | |
download | txr-7c8c8d326bbb8b9725efa6a3c364d3426a7cdca9.tar.gz txr-7c8c8d326bbb8b9725efa6a3c364d3426a7cdca9.tar.bz2 txr-7c8c8d326bbb8b9725efa6a3c364d3426a7cdca9.zip |
New feature: :vars argument in repeat and rep directives in an output
block, for specifying variables to include in iteration whose
presence repeat is not able to deduce.
* match.c (extract_bindings): New argument, vars, specifies
additional variables to consider.
(do_output_line, do_output): Process :vars argument of repeat
and rep directive.
* txr.1: Updated.
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1579,10 +1579,10 @@ static val extract_vars(val output_spec) return vars; } -static val extract_bindings(val bindings, val output_spec) +static val extract_bindings(val bindings, val output_spec, val vars) { list_collect_decl (bindings_out, ptail); - val var_list = extract_vars(output_spec); + val var_list = nappend2(vars, extract_vars(output_spec)); for (; bindings; bindings = cdr(bindings)) { val binding = car(bindings); @@ -1627,7 +1627,8 @@ static void do_output_line(val bindings, val specline, val filter, val out) val mod_clauses = pop(&clauses); val modlast_clauses = pop(&clauses); val counter = getplist(args, counter_k); - val bind_cp = extract_bindings(bindings, elem); + val vars = getplist(args, vars_k); + val bind_cp = extract_bindings(bindings, elem, vars); val max_depth = reduce_left(func_n2(max2), bind_cp, zero, chain(func_n1(cdr), @@ -1752,7 +1753,8 @@ static void do_output(val bindings, val specs, val filter, val out) val mod_clauses = pop(&clauses); val modlast_clauses = pop(&clauses); val counter = getplist(args, counter_k); - val bind_cp = extract_bindings(bindings, first_elem); + val vars = getplist(args, vars_k); + val bind_cp = extract_bindings(bindings, first_elem, vars); val max_depth = reduce_left(func_n2(max2), bind_cp, zero, chain(func_n1(cdr), |