Dominik Bathon <dbatml / gmx.de> wrote:

>> Is there some kind of priority queue in the stdlib or available as a  
>> gem?
>
> There is nothing in the stdlib currently, but there is rbtree and a RCR  
> to include it in the stdlib:
>
> http://www.rcrchive.net/rcr/show/306

I tried to build it but it fails the unit tests

The check for "rb_block_proc" and the later warnings seems to suggest that  
there is something wrong with my system.  Any hints?


Thank You,
Levin

$ ruby -v
ruby 1.8.3 (2005-06-23) [i486-linux]
$ ruby extconf.rb
checking for allocation framework... yes
checking for rb_obj_init_copy()... no
checking for rb_block_proc()... no
checking for rb_yield_values()... no
checking for rb_marshal_dump()... no
checking for rb_marshal_load()... no
checking for inline keyword... __inline
creating Makefile
$ make
gcc -fPIC -Wall -g -O2  -fPIC -std=c89 -pedantic -Wall -Wno-long-long  -I.  
-I/usr/lib/ruby/1.8/i486-linux -I/usr/lib/ruby/1.8/i486-linux -I.   
-DNDEBUG -DHAVE_OBJECT_ALLOCATE -Dinline=__inline  -c dict.c
gcc -fPIC -Wall -g -O2  -fPIC -std=c89 -pedantic -Wall -Wno-long-long  -I.  
-I/usr/lib/ruby/1.8/i486-linux -I/usr/lib/ruby/1.8/i486-linux -I.   
-DNDEBUG -DHAVE_OBJECT_ALLOCATE -Dinline=__inline  -c rbtree.c
rbtree.c:58: warning: static declaration for `rb_block_proc' follows  
non-static
rbtree.c:66: warning: static declaration for `rb_yield_values' follows  
non-static
rbtree.c:1486: warning: static declaration for `rb_marshal_dump' follows  
non-static
rbtree.c:1492: warning: static declaration for `rb_marshal_load' follows  
non-static
gcc -shared  -L"/usr/lib" -o rbtree.so dict.o rbtree.o  -lruby1.8   
-lpthread -ldl -lcrypt -lm   -lc
$ ruby -v test.rb
Loaded suite test
Started
......................test.rb:819: warning: rb_f_lambda() is deprecated;  
use rb_block_proc() instead
..................test.rb:121: warning: rb_f_lambda() is deprecated; use  
rb_block_proc() instead
test.rb:126: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
.test.rb:57: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
test.rb:59: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
.test.rb:139: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
.test.rb:154: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
........test.rb:179: warning: rb_f_lambda() is deprecated; use  
rb_block_proc() instead
test.rb:185: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
.test.rb:201: warning: block supersedes default value argument
.test.rb:564: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
....test.rb:483: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
...test.rb:574: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
..test.rb:649: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
test.rb:653: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
.Ftest.rb:23: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
.test.rb:326: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
.Ftest.rb:581: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
test.rb:609: warning: RBTree#readjust() uses current comparison block, use  
RBTree#readjust(nil) to set default comparison block
test.rb:613: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
.F.test.rb:623: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
test.rb:624: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
...test.rb:145: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
.test.rb:310: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
...test.rb:468: warning: rb_f_lambda() is deprecated; use rb_block_proc()  
instead
.......
Finished in 0.1 seconds.

   1) Failure:
test_merge(RBTreeTest) [test.rb:425]:
<#<RBTree: {["a", "A"]=>nil,
   ["b", "B"]=>nil,
   ["c", "C"]=>nil,
   ["d", "D"]=>nil,
   ["e", "E"]=>nil},
  default=nil,
  cmp_proc=nil>> expected but was
<#<RBTree: {["e", "E"]=>nil}, default=nil, cmp_proc=nil>>.

   2) Failure:
test_pp(RBTreeTest) [test.rb:664]:
<"#<RBTree: {\"a\"=>\"A\", \"b\"=>\"B\"}, default=nil, cmp_proc=nil>\n">  
expected but was
<"#<RBTree: {[\"a\", \"A\"]=>nil, [\"b\", \"B\"]=>nil}, default=nil,  
cmp_proc=nil>\n">.

   3) Failure:
test_reject(RBTreeTest) [test.rb:382]:
<#<RBTree: {["c", "C"]=>nil, ["d", "D"]=>nil}, default=nil, cmp_proc=nil>>  
expected but was
<nil>.

84 tests, 283 assertions, 3 failures, 0 errors