make m4 see macro when macro ends with same character as string following macro
I'm working on a system that uses M4 to expand some files out, but I'm getting a problem with the expansion in certain cases. The convention for definition / macro naming (which I'd rather not change if possible) is __<name>__
(i.e. double leading and trailing underscores.) So this expands correctly:
define(`__ROOT__', `/home/mydir')
...
__ROOT__/bin
开发者_开发技巧
gives
/home/mydir/bin
but,
define(`__PREFIX__', `App_Mnemonic')
...
__PREFIX___some_service
should give:
App_Mnemonic_some_service
but gives
__PREFIX___some_service
(i.e. it missed the expansion)
I presume the lack of space between the trailing underscore of the macro and the valid underscore of the underlying text is confusing m4. Is there anything I can do about this? Can I delimit the macro with silent braces, for example, like enviromnment variables?
Deceptively simple really, all I had to do in the underlying text was change this:
__PREFIX___some_service
for this:
__PREFIX__()_some_service
It looks a bit clunky perhaps, but it is a macro after all and there's no need to change the macro definition. So this can stay as it is:
define(`__PREFIX__', `App_Mnemonic')
精彩评论