Permalink
Browse files

dexter_bcd compiles, runs and passes tests; rb_define_method works - …

…wohooo\!
  • Loading branch information...
Tomasz Stachewicz
Tomasz Stachewicz committed Feb 22, 2009
1 parent 72574a5 commit 7ba235721704a37403615b4dbe049a36f2e34a0f
Showing with 8 additions and 83 deletions.
  1. +2 −1 bcd/Ruby/ruby.d
  2. +2 −55 dexter/README
  3. +0 −23 dexter/dexter.d
  4. +2 −2 dexter/dexter_bcd.d
  5. +1 −1 dexter/dexter_rubyd.d
  6. +1 −1 dexter/dexter_tester.rb
View
@@ -1709,7 +1709,8 @@ extern (C) int _IO_getc(_IO_FILE *);
extern (C) uint rb_mod_init_copy(uint, uint);
alias uint function(uint, uint, int) _BCD_func__1940;
extern (C) uint rb_exec_recursive(_BCD_func__1940, uint, uint);
extern (C) void rb_define_method(uint, char *, _BCD_func__1839, int);
//extern (C) void rb_define_method(uint, char *, _BCD_func__1839, int);
extern (C) void rb_define_method(VALUE, char*,VALUE(*)(),int);
extern (C) int vdprintf(int, char *, char *);
extern (C) _IO_FILE * open_memstream(char * *, uint *);
extern (C) int rb_memcmp(void *, void *, int);
View
@@ -10,59 +10,6 @@ dexter_tester.rb - a test suite for the above experimental D application
Current state of affairs:
tomek@tomek-asus-f80s:~/ruby_apps/rudy/dexter$ ruby dexter_tester.rb
./dexter.so: [BUG] Segmentation fault
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
rb_define_method works as in "available from Ruby and passes tests" works
GDB session:
tomek@tomek-asus-f80s:~/ruby_apps/rudy/dexter$ gdb ruby
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(no debugging symbols found)
(gdb) r -rdexter_tester -e 'p 1'
Starting program: /usr/bin/ruby -rdexter_tester -e 'p 1'
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[New Thread 0xb7da5b70 (LWP 30729)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7da5b70 (LWP 30729)]
0xb8017ae9 in ?? () from /usr/lib/libruby1.8.so.1.8
(gdb) bt
#0 0xb8017ae9 in ?? () from /usr/lib/libruby1.8.so.1.8
#1 0xb8017946 in st_lookup () from /usr/lib/libruby1.8.so.1.8
#2 0xb7feaf32 in rb_intern () from /usr/lib/libruby1.8.so.1.8
#3 0xb7f98202 in rb_define_method () from /usr/lib/libruby1.8.so.1.8
#4 0xb7d4d1e0 in Init_dexter () at dexter.d:15
#5 0xb7f9da96 in dln_load () from /usr/lib/libruby1.8.so.1.8
#6 0xb7fbf9dc in rb_require_safe () from /usr/lib/libruby1.8.so.1.8
#7 0xb7fbfd29 in rb_f_require () from /usr/lib/libruby1.8.so.1.8
#8 0xb7fa701b in ?? () from /usr/lib/libruby1.8.so.1.8
#9 0xb7fb287e in ?? () from /usr/lib/libruby1.8.so.1.8
#10 0xb7fb2a1a in ?? () from /usr/lib/libruby1.8.so.1.8
#11 0xb7fad141 in ?? () from /usr/lib/libruby1.8.so.1.8
#12 0xb7fbf53a in rb_load () from /usr/lib/libruby1.8.so.1.8
#13 0xb7fbfb76 in rb_require_safe () from /usr/lib/libruby1.8.so.1.8
#14 0xb7fbfcf4 in rb_require () from /usr/lib/libruby1.8.so.1.8
#15 0xb7fa8a61 in rb_protect () from /usr/lib/libruby1.8.so.1.8
#16 0xb80127af in ?? () from /usr/lib/libruby1.8.so.1.8
#17 0xb8013b5f in ?? () from /usr/lib/libruby1.8.so.1.8
#18 0xb8013e6f in ruby_process_options () from /usr/lib/libruby1.8.so.1.8
#19 0xb7fb7874 in ruby_options () from /usr/lib/libruby1.8.so.1.8
#20 0x08048708 in main ()
(gdb)
Getting it on to work with other method definition functions.
View

This file was deleted.

Oops, something went wrong.
View
@@ -5,7 +5,7 @@ import bcd.Ruby.ruby;
alias VALUE(*func_type)();
// Prototype for our method 'test1' - methods are prefixed by 'method_' here
VALUE method_return_ten(...);
extern (C) VALUE method_return_ten();
extern (C) VALUE Dexter = 0;
@@ -16,7 +16,7 @@ extern (C) void Init_dexter() {
}
// Our 'test1' method.. it simply returns a value of '10' for now.
ulong method_return_ten(VALUE self, ...) {
extern (C) ulong method_return_ten(VALUE self) {
int x = 10;
//return INT2NUM(x);
return rb_int2inum(x);
View
@@ -12,7 +12,7 @@ extern (C) VALUE Dexter = 0;
// The initialization method for this module
extern (C) void Init_dexter() {
Dexter = rb_define_class("Dexter", rb_cObject);
rb_define_method(Dexter, "return_ten", &method_return_ten, 0);
rb_define_method(Dexter, "return_ten".ptr, &method_return_ten, 0);
}
// Our 'test1' method.. it simply returns a value of '10' for now.
View
@@ -7,7 +7,7 @@ class DexterTester < Test::Unit::TestCase
def test_module_defined_properly
assert_equal(Dexter.class, Class)
assert_equal(Dexter.superclass, Object)
assert_equal(Dexter::return_ten, 10)
assert_equal(Dexter.new.return_ten, 10)
end
end

0 comments on commit 7ba2357

Please sign in to comment.