m4-discuss
[Top][All Lists]
Advanced

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

Re: very basic question incr


From: jfw
Subject: Re: very basic question incr
Date: Wed, 11 Jan 2012 10:16:14 -0800 (PST)

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


Thanks, ok I'm now beyond infinite recursion.  Now what I want to do is
increment each time I invoke count.

I'm using lowercase ~ for left quote and lowercase " for right quote.  I'll
paste rather than retype.

So using:

define emit(`text', text)
define(`count',`0')
count
define(`count',incr(count))
count
count

emit(count)
emit(count)

define(`next_bit', `1')
define(`next_bit', eval(next_bit * 2))
next_bit
next_bit

M4 produces:

define emit(text, text)

0

1
1

emit(1)
emit(1)



2
2


I expected 0,1,2 and 2,4

Thanks again,

/s/ Jim WIlliams
-- 
View this message in context: 
http://old.nabble.com/very-basic-question-incr-tp33122312p33123046.html
Sent from the Gnu - M4 - Discuss mailing list archive at Nabble.com.




reply via email to

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