Re: very basic question incr

jfw <[email protected]>
Newsgroups gmane.comp.gnu.m4.general
Message-ID <[email protected]>
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.
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.