Strings to Macro

Varghese Paul <[email protected]> Fri, 20 Jan 2017 09:20:11 +0530
Newsgroups gmane.comp.gnu.m4.general
Message-ID <CACzzdK5EHoDXESsttuc_0xiROmLmtf+RyvYjY+W0TYbQ6HH9ng@mail.gmail.com>
 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