m4-discuss
[Top][All Lists]
Advanced

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

Strings to Macro


From: Varghese Paul
Subject: Strings to Macro
Date: Fri, 20 Jan 2017 09:20:11 +0530

 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. 


divert(`-1')
define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')')
define(`_forloop',`$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')')
divert`'dnl
define(`APP_DOMAINS',2)dnl
define(`VARIABLE_APP_PORT1',`8000')dnl
define(`VARIABLE_APP_PORT2',`8001')dnl

forloop(`i', `1', APP_DOMAINS,
``VARIABLE_APP_PORT'i'
)

Output : m4 test.m4 

VARIABLE_APP_PORT1
VARIABLE_APP_PORT2

Expected : 
8000
8001

Any help will be highly appreciated. 

Regards

Varghese Paul 

reply via email to

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