Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'irb/completion'
require 'irb/ext/save-history'
require 'rubygems'
require 'wirble'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
jroelofs@maude:~$ gem search -r integrity
*** REMOTE GEMS ***
agileanimal-integrity-twitter (1.0.4)
alphasights-integrity (0.1.10)
atmos-integrity-irccat (0.0.3)
badcarl-integrity-jabber (0.1.1)
bantic-integrity (0.1.4.4)
be9-integrity-twitter (1.0.4.1)
// Wrapping this method:
int global_do(int x, int y = 3, int z = 10) {
return x * y * z;
}
// Happens like this:
{
typedef int ( *global_do_func_type )( int x, int y, int z );
Rice::define_global_function("global_do",
# Normal
def method
ret_val = "something"
do_this_thing if ret_val == "something"
ret_val
end
# Or with #tap
Winners:
James Kilton, Phouchg, nettix
Losers:
elarnia
The town Maribar has been pillaged by James Kilton. The following resources have been stolen:
Building material: 4916Sulfur: 4228
The town Maribar has been pillaged by Phouchg. The following resources have been stolen:
Building material: 2787Sulfur: 2397
The town Maribar has been pillaged by nettix. The following resources have been stolen:
Building material: 532Sulfur: 458
Stack trace from gdb:
Class:construct .
Class:undef_creation_funcs
Program received signal SIGSEGV, Segmentation fault.
0x00235981 in vm_backtrace () at vm.c:744
744 ary = vm_backtrace_each(th, RUBY_VM_NEXT_CONTROL_FRAME(cfp),
(gdb) where
#0 0x00235981 in vm_backtrace () at vm.c:744
#1 rb_make_backtrace () at vm_eval.c:1356
require 'mkmf-rice'
create_makefile('virtual')
(gdb) run start_game.rb
Starting program: /usr/bin/ruby start_game.rb
[Thread debugging using libthread_db enabled]
Program received signal SIGSEGV, Segmentation fault.
0x00560d66 in glTexImage2D () from /usr/lib/libGL.so.1
(gdb) where
#0 0x00560d66 in glTexImage2D () from /usr/lib/libGL.so.1
#1 0x030cf458 in max_quad_size () at utils.c:740
#2 0x030ce4a5 in Init_texplay () at texplay.c:72
CL_Size CL_Size_minus(CL_Size self, CL_Size against) {
return self - against;
}
extern "C"
void Init_clanlib()
{
Rice::Data_Type<CL_Size> cSize = Rice::define_class<CL_Size>("Size");
cSize.define_method("-", &CL_Size_minus);
}
diff --git a/extconf.rb b/extconf.rb
index e4274eb..3f138fb 100644
--- a/extconf.rb
+++ b/extconf.rb
@@ -27,6 +27,8 @@ env = ""
if RUBY_PLATFORM =~ /darwin10/
other_opts = "--disable-dependency-tracking"
env = "ARCHFLAGS='-arch x86_64'"
+elsif RUBY_PLATFORM =~ /darwin9/
+ env = "ARCHFLAGS='-arch #{`uname -p`.chomp}'"