|
From: | Varghese Paul |
Subject: | Re: Strings to Macro |
Date: | Sat, 21 Jan 2017 11:31:47 +0530 |
On 01/19/2017 09:50 PM, Varghese Paul wrote:
> Hi all,
>
> Nedd a help on the below program. How can i convert the formatted strings
> to MARCO ?. In the below program i am not able to replace the FORMATTED
> strings to macro.
>
>
>
> forloop(`i', `1', APP_DOMAINS,
> ``VARIABLE_APP_PORT'i'
So you are trying to construct a macro name to be called, where each
iteration of the loop constructs another macro name. The problem with
your approach is that there is no way to expand i without first parsing
over the string `VARIABLE_APP_PORT', making that text ineligible for
rescanning. Sounds like you want to use indir:
forloop(`i', `1', APP_DOMAINS,
`indir(`VARIABLE_APP_PORT'i)'
)
Or, if you want to stick to straight POSIX m4, you'll have to write a
helper macro that concatenates two arguments and then scans the overall
result for a macro name:
define(`concat', `$1$2')dnl
forloop(`i',`1',APP_DOMAINS,
`concat(`VARIABLE_APP_PORT',i)'
)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |