problem embedding argument inside nested macro def's

"Piotr Wysocki" <[email protected]>
Newsgroups gmane.comp.gnu.m4.general
Message-ID <[email protected]>
Hi,

I have a problem. This is my code:
--- CUT HERE ---
divert(-1)

define(`___DEF', `define(`__$1', `define(`_a$1', `a$1')')')
dumpdef(`___DEF')
___DEF(`T')
dumpdef(`__T')
__T(`abc')
dumpdef(`_aT')

divert(0)dnl

_aT
--- CUT HERE ---

What I meant is to define ___DEF macro, whose argument will
be used in creating another macro (__T in the above example),
which will be a macro creating a simple macro (without args).
I would like the last expression to result in "aabc".
The problem is that the last `$1' is expanded into `T'. I would
rather like to expand it later.
(this is not exactly what I want, but I want sth similar and the
above is a simplified version - just to show the exact problem)

I tried some to modify it, like `$'1, $`1', `$'{1}, ... but none
of them worked :(

What is the correct syntax to achieve my goal?

PS. Please CC me, as I am not subscribing this list.
(I will check the archives nevertheless)

Cheers,
Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.