Hi!
This is just an open proposal. I have imported some self-documented macros of mine to autoconf/lib/m4sugar/m4sugar.m4
(please see the patch attached):
m4_case_in()
: Searches for the existence of a text within one or more lists, using a syntax identical to that of m4_case()
m4_define_substrings_as()
: Searches for the first match of a regular _expression_ in a string and defines custom macros accordinglym4_for_each_match()
: Calls a custom macro for every occurrence of a regular _expression_ in a stringm4_get_replacements()
Replaces every occurrence of a regular _expression_ in a string with the text returned by a custom macro, invoked for each matchm4_lambda()
: Creates an anonymous macro on the fly, able to be passed as a callback argumentm4_list_index()
: Searches for the first occurence of a string in a list and returns its position, or -1
if the string as not been foundm4_repeat()
: Repeats a text n timesm4_redepth()
: Examines a regular _expression_ and returns the number of capturing parentheses present
Please browse the patched m4sugar.m4
file for the complete documentation with examples. This patch refers to commit 5b9db67786a428164abafe626ab11a2754aad528
(2019-09-10 08:00:33 -0700).
All the best
--madmurphy