_for-each-n_: Add current_n_dec

This would be better handled by better template arithmetic features, but
that's for another time.

* tplgen.xml (_for-each-n_): Add `current_n_dec' for caller body, which
  decrements `current_n` by 1 (for 0-indexed values).
master
Mike Gerwitz 2018-01-29 13:17:21 -05:00
parent 6f891b7b15
commit 34f7c6bef1
1 changed files with 5 additions and 1 deletions

View File

@ -51,11 +51,15 @@
<param-add name="@start@" value="@step@" />
</param>
<param name="@n_dec@" desc="Current n - 1">
<param-add name="@start@" value="-1" />
</param>
<!-- inefficient trick to expose @current_n@ to the body -->
<inline-template>
<for-each>
<set current_n="@start@" />
<set current_n="@start@" current_n_dec="@n_dec@" />
</for-each>
<param-copy name="@values@" />