diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-09-22 07:04:10 +0000 |
---|---|---|
committer | <> | 2015-02-02 12:02:31 +0000 |
commit | 23c11479b3ad787adc7a651ee0c4347839e47723 (patch) | |
tree | 3aa9e1125da84f7e3bd764bbff577c42a766508b /examples/stack_sep.m4 | |
download | m4-tarball-23c11479b3ad787adc7a651ee0c4347839e47723.tar.gz |
Diffstat (limited to 'examples/stack_sep.m4')
-rw-r--r-- | examples/stack_sep.m4 | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/stack_sep.m4 b/examples/stack_sep.m4 new file mode 100644 index 0000000..767d15e --- /dev/null +++ b/examples/stack_sep.m4 @@ -0,0 +1,17 @@ +divert(`-1') +# stack_foreach_sep(macro, pre, post, sep) +# Invoke PRE`'defn`'POST with a single argument of each definition +# from the definition stack of MACRO, starting with the oldest, and +# separated by SEP between definitions. +define(`stack_foreach_sep', +`_stack_reverse_sep(`$1', `tmp-$1')'dnl +`_stack_reverse_sep(`tmp-$1', `$1', `$2`'defn(`$1')$3', `$4`'')') +# stack_foreach_sep_lifo(macro, pre, post, sep) +# Like stack_foreach_sep, but starting with the newest definition. +define(`stack_foreach_sep_lifo', +`_stack_reverse_sep(`$1', `tmp-$1', `$2`'defn(`$1')$3', `$4`'')'dnl +`_stack_reverse_sep(`tmp-$1', `$1')') +define(`_stack_reverse_sep', +`ifdef(`$1', `pushdef(`$2', defn(`$1'))$3`'popdef(`$1')$0( + `$1', `$2', `$4$3')')') +divert`'dnl |