very basic question incr

jfw <[email protected]>
Newsgroups gmane.comp.gnu.m4.general
Message-ID <[email protected]>
I've been programming for about 45 years.  I've been programming about 2 days
with M4.

I want to increment or double a "variable" every time I call a macro.
A paper "Exploiting the m4 Macro Language" by Kenneth J. Turner available on
the web suggests:


define(‘Count’,‘incr(Count)’)

then invoking it with
Count

produces m4: stack overflow

using:

define(‘Count’,incr(`Count'))
Count produces m4: non-numeric to builtin`incr'

using:
define(`count',0)
define(`count',`incr(count)')
count
also produces stack overflow

I would appreciate being told the simple idiom I am trying to write.  Once I
understand incr() I assume I could use eval(x *2) to produce doubling


Thanks,

/s/ Jim WIlliams

I'm using:
m4 (GNU M4) 1.4.16
Packaged by Cygwin (1.4.16-1)


-- 
View this message in context: http://old.nabble.com/very-basic-question-incr-tp33122312p33122312.html
Sent from the Gnu - M4 - Discuss mailing list archive at Nabble.com.
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.