From 31c922203e7c08f64c983044985d31d3470db13f Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 4 May 2015 11:00:46 +0100 Subject: [PATCH] defs.m4: New macros for inserting separators into lists. --- defs.m4 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/defs.m4 b/defs.m4 index c289385..f2767fd 100644 --- a/defs.m4 +++ b/defs.m4 @@ -73,6 +73,19 @@ m4_pushdef(<:_foreach_func:>, <:$1:>)m4_dnl _FOREACH($2)<::>m4_dnl m4_popdef(<:_foreach_func:>):>) +## CLRSEP +## +## Clear the separator. Use in conjunction with `SEP' below. +m4_define(<:CLRSEP:>, <:m4_define(<:__sep:>, <::>):>)m4_dnl + +## SEP(newsep) +## +## Insert the current separator, and then set the separator to NEWSEP. This +## is handy in `FOREACH' loops, in order to separate the items with the +## correct number of fenceposts: call `CLRSEP' before the list, and begin +## each item with SEP(...). +m4_define(<:SEP:>, <:__sep<::>m4_define(<:__sep:>, <:$1:>):>)m4_dnl + ## DIVERT(name) ## ## Make _div:NAME be the current diversion. -- 2.11.0