opensubscriber
   Find in this group all groups
 
Unknown more information…

m : m4-discuss@gnu.org 12 January 2012 • 2:16AM -0500

Re: very basic question incr
by jfw

REPLY TO AUTHOR
 
REPLY TO GROUP





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.



Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.