[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strings to Macro

From: Varghese Paul
Subject: Re: Strings to Macro
Date: Sat, 21 Jan 2017 11:31:47 +0530

Thanks very much Eric and Jack. 

I can make it work using 'indir'.


Varghese Paul 

On Sat, Jan 21, 2017 at 4:42 AM, Eric Blake <address@hidden> wrote:
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,

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,

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

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]