[Top][All Lists]

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

Re: Strings to Macro

From: Eric Blake
Subject: Re: Strings to Macro
Date: Fri, 20 Jan 2017 17:12:33 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

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

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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