4.7 Indirect call of macros
Any macro can be called indirectly with `indir':
-- Builtin: indir (NAME, ...)
Results in a call to the macro NAME, which is passed the rest of
the arguments. If NAME is not defined, an error message is
printed, and the expansion is void.
The macro `indir' is recognized only with parameters.
This can be used to call macros with computed or "invalid" names
(`define' allows such names to be defined):
define(`$$internal$macro', `Internal macro (name `$0')')
=>Internal macro (name $$internal$macro)
The point is, here, that larger macro packages can have private
macros defined, that will not be called by accident. They can _only_ be
called through the builtin `indir'.
One other point to observe is that argument collection occurs before
`indir' invokes NAME, so if argument collection changes the value of
NAME, that will be reflected in the final expansion. This is different
than the behavior when invoking macros directly, where the definition
that was in effect before argument collection is used.
indir(`f', define(`f', `3'))
error-->m4:stdin:4: undefined macro `f'
automatically generated byinfo2html