[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

rb_iterate

Tim Pease

12/7/2006 3:51:00 PM

If anyone out there has used the "rb_iterate" function in a Ruby C
extension, could you please post a simple explanation of (a) how to
use the function and (b) an explanation of the method signature?

From eval.c ...

VALUE
rb_iterate(it_proc, data1, bl_proc, data2)
VALUE (*it_proc) _((VALUE)), (*bl_proc)(ANYARGS);
VALUE data1, data2;
{
...
}


I understand that "it_proc" and "bl_proc" are function pointers and
"data1" and "data2" are the arguments that are passed to each
function, respectively. What I don't understand is how all these work
together to iterate over a collection.

Pointers, tips, tutorials, explanations?

Blessings,
TwP

22 Answers

Ara.T.Howard

12/7/2006 4:44:00 PM

0

George

12/9/2006 9:01:00 AM

0

On 12/8/06, Tim Pease <tim.pease@gmail.com> wrote:
> If anyone out there has used the "rb_iterate" function in a Ruby C
> extension, could you please post a simple explanation of (a) how to
> use the function and (b) an explanation of the method signature?

From README.EXT:

** Control Structure

VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)

Calls the function func1, supplying func2 as the block. func1 will be
called with the argument arg1. func2 receives the value from yield as
the first argument, arg2 as the second argument.

VALUE rb_yield(VALUE val)

Evaluates the block with value val.

*US*

6/3/2007 11:41:00 AM

0

On Sat, 02 Jun 2007 21:01:02 -0700, poldy <poldy@kfu.com> wrote:

>In article <4655A3DD.BEF6126@sympatico.ca>,
> Dave Smith <adavidsmith@sympatico.ca> wrote:
>
>> There have been some bad US presidents over the years, but I would have to
>> agree that Bush has got to be the worst. The sad thing is that he was
>> re-elected. I can understand the American people making the mistake of
>> electing him once, but I am astounded that they were stupid enough to
>> re-elect him.
>
>He wasn't elected the first time.

Nor the second.

Jim Higgins

6/3/2007 11:43:00 AM

0

poldy wrote:
> In article <4655A3DD.BEF6126@sympatico.ca>,
> Dave Smith <adavidsmith@sympatico.ca> wrote:
>
>> There have been some bad US presidents over the years, but I would have to
>> agree that Bush has got to be the worst. The sad thing is that he was
>> re-elected. I can understand the American people making the mistake of
>> electing him once, but I am astounded that they were stupid enough to
>> re-elect him.
>
> He wasn't elected the first time.

According to the U.S. Constitution he was elected-Electoral College.
Try reading the U.S. Constitution some time.

Magda

6/3/2007 11:48:00 AM

0

On Sun, 03 Jun 2007 07:43:03 -0400, in rec.travel.europe, Jim Higgins
<gordian238@hotmail.com> arranged some electrons, so they looked like this:

... poldy wrote:
... > In article <4655A3DD.BEF6126@sympatico.ca>,
... > Dave Smith <adavidsmith@sympatico.ca> wrote:
... >
... >> There have been some bad US presidents over the years, but I would have to
... >> agree that Bush has got to be the worst. The sad thing is that he was
... >> re-elected. I can understand the American people making the mistake of
... >> electing him once, but I am astounded that they were stupid enough to
... >> re-elect him.
... >
... > He wasn't elected the first time.
...
... According to the U.S. Constitution he was elected-Electoral College.
... Try reading the U.S. Constitution some time.

Best sleeping pill ever!

Jim Higgins

6/3/2007 11:54:00 AM

0

* US * wrote:
> On Sat, 02 Jun 2007 21:01:02 -0700, poldy <poldy@kfu.com> wrote:
>
>> In article <4655A3DD.BEF6126@sympatico.ca>,
>> Dave Smith <adavidsmith@sympatico.ca> wrote:
>>
>>> There have been some bad US presidents over the years, but I would have to
>>> agree that Bush has got to be the worst. The sad thing is that he was
>>> re-elected. I can understand the American people making the mistake of
>>> electing him once, but I am astounded that they were stupid enough to
>>> re-elect him.
>> He wasn't elected the first time.
>
> Nor the second.


According to the Electoral College (remember the U.S. Constitution?) he
was lawfully elected.

Earl Evleth

6/3/2007 2:52:00 PM

0

On 3/06/07 13:48, in article bja563t8bkkjelmc4kl4nm9jvvmucuisu0@4ax.com,
"Magda" <magda@eu> wrote:

> ... According to the U.S. Constitution he was elected-Electoral College.
> ... Try reading the U.S. Constitution some time.
>
> Best sleeping pill ever!
>

It is fairly interesting since one discovers how archaic it is. Changing
it is difficult, a long tedious process. It is obvious it was
written for another time when the States were to govern themselves
and only those issues which dealt interstate interactions and
collective defense were the domain of the Federal Government.

Its greatest sin was not dealing with the issue of slavery,
in fact the word is not mentioned. This was important in deciding
how many Representatives each state has. This was done by
population, but who was in the populations count? Well everybody
almost. How to count the slaves? Slaves? What slaves? Women?
Of course, but they did not vote either. The language is dodgy
but here it is.

"Representatives and direct taxes shall be apportioned among the several
states which may be included within this union, according to their
respective numbers, which shall be determined by adding to the whole number
of free persons, including those bound to service for a term of years, and
excluding Indians not taxed, three fifths of all other Persons."

So indentured who has a specific time to work off their contract
were counted, some Indians were not. But for the "rest" (the slaves)
they were worth 60% of a free person. Bravo for great American
Constitution. Off on the wrong foot from the start and with the
right to bear arms to boot.



Fred Bloggs

6/3/2007 5:02:00 PM

0

In article <1365atsq34euk00@corp.supernews.com>, gordian238@hotmail.com
says...
> * US * wrote:
> > On Sat, 02 Jun 2007 21:01:02 -0700, poldy <poldy@kfu.com> wrote:
> >
> >> In article <4655A3DD.BEF6126@sympatico.ca>,
> >> Dave Smith <adavidsmith@sympatico.ca> wrote:
> >>
> >>> There have been some bad US presidents over the years, but I would have to
> >>> agree that Bush has got to be the worst. The sad thing is that he was
> >>> re-elected. I can understand the American people making the mistake of
> >>> electing him once, but I am astounded that they were stupid enough to
> >>> re-elect him.
> >> He wasn't elected the first time.
> >
> > Nor the second.
>
>
> According to the Electoral College (remember the U.S. Constitution?) he
> was lawfully elected.

The fact that he was "elected" in accordance with a flawed procedure
that allowed the usurpation of the popular democratic process by an
unelected few is no reason to be proud of the document that allowed that
flawed process.
>

John Rennie

6/3/2007 5:43:00 PM

0


"Fred Bloggs" <mister_exador@hotmail.com> wrote in message
news:MPG.20cd91134a5b7ca59899fe@news.bigpond.com...
> In article <1365atsq34euk00@corp.supernews.com>, gordian238@hotmail.com
> says...
>> * US * wrote:
>> > On Sat, 02 Jun 2007 21:01:02 -0700, poldy <poldy@kfu.com> wrote:
>> >
>> >> In article <4655A3DD.BEF6126@sympatico.ca>,
>> >> Dave Smith <adavidsmith@sympatico.ca> wrote:
>> >>
>> >>> There have been some bad US presidents over the years, but I would
>> >>> have to
>> >>> agree that Bush has got to be the worst. The sad thing is that he was
>> >>> re-elected. I can understand the American people making the mistake
>> >>> of
>> >>> electing him once, but I am astounded that they were stupid enough to
>> >>> re-elect him.
>> >> He wasn't elected the first time.
>> >
>> > Nor the second.
>>
>>
>> According to the Electoral College (remember the U.S. Constitution?) he
>> was lawfully elected.
>
> The fact that he was "elected" in accordance with a flawed procedure
> that allowed the usurpation of the popular democratic process by an
> unelected few is no reason to be proud of the document that allowed that
> flawed process.
>>


'Checks and Balances', Craig. A lovely phrase that helps obscure the fact
that the USA is not really a democracy.


Planet Visitor II

6/4/2007 3:03:00 AM

0

"Magda" <magda@eu> wrote in message
news:bja563t8bkkjelmc4kl4nm9jvvmucuisu0@4ax.com...
> On Sun, 03 Jun 2007 07:43:03 -0400, in rec.travel.europe, Jim Higgins
> <gordian238@hotmail.com> arranged some electrons, so they looked like this:
>
> ... poldy wrote:
> ... > In article <4655A3DD.BEF6126@sympatico.ca>,
> ... > Dave Smith <adavidsmith@sympatico.ca> wrote:
> ... >
> ... >> There have been some bad US presidents over the years, but I would have
> to
> ... >> agree that Bush has got to be the worst. The sad thing is that he was
> ... >> re-elected. I can understand the American people making the mistake of
> ... >> electing him once, but I am astounded that they were stupid enough to
> ... >> re-elect him.
> ... >
> ... > He wasn't elected the first time.
> ...
> ... According to the U.S. Constitution he was elected-Electoral College.
> ... Try reading the U.S. Constitution some time.
>
> Best sleeping pill ever!

I suspect having to climb into bed with you is the best sleeping pill ever,
you cold-hearted piece of euro-trailer-trash.



Planet Visitor II
Official publisher of AADP Official dictionary
http://www.planetvisitor.name/dicti...