m4: Builtin

 
 5.8 Indirect call of builtins
 =============================
 
 Builtin macros can be called indirectly with 'builtin':
 
  -- Builtin: builtin (NAME, [ARGS...])
      Results in a call to the builtin NAME, which is passed the rest of
      the arguments ARGS.  If NAME does not name a builtin, an error
      message is printed, and the expansion is void.
 
      The macro 'builtin' is recognized only with parameters.
 
    This can be used even if NAME has been given another definition that
 has covered the original, or been undefined so that no macro maps to the
 builtin.
 
      pushdef(`define', `hidden')
      =>
      undefine(`undefine')
      =>
      define(`foo', `bar')
      =>hidden
      foo
      =>foo
      builtin(`define', `foo', defn(`divnum'))
      =>
      foo
      =>0
      builtin(`define', `foo', `BAR')
      =>
      foo
      =>BAR
      undefine(`foo')
      =>undefine(foo)
      foo
      =>BAR
      builtin(`undefine', `foo')
      =>
      foo
      =>foo
 
    The NAME argument only matches the original name of the builtin, even
 when the '--prefix-builtins' option (or '-P', ⇒Invoking m4
 Operation modes.) is in effect.  This is different from 'indir', which
 only tracks current macro names.
 
      $ m4 -P
      m4_builtin(`divnum')
      =>0
      m4_builtin(`m4_divnum')
      error->m4:stdin:2: undefined builtin `m4_divnum'
      =>
      m4_indir(`divnum')
      error->m4:stdin:3: undefined macro `divnum'
      =>
      m4_indir(`m4_divnum')
      =>0
 
    Note that 'indir' and 'builtin' can be used to invoke builtins
 without arguments, even when they normally require parameters to be
 recognized; but it will provoke a warning, and result in a void
 expansion.
 
      builtin
      =>builtin
      builtin()
      error->m4:stdin:2: undefined builtin `'
      =>
      builtin(`builtin')
      error->m4:stdin:3: Warning: too few arguments to builtin `builtin'
      =>
      builtin(`builtin',)
      error->m4:stdin:4: undefined builtin `'
      =>
      builtin(`builtin', ``'
      ')
      error->m4:stdin:5: undefined builtin ``'
      error->'
      =>
      indir(`index')
      error->m4:stdin:7: Warning: too few arguments to builtin `index'
      =>