Incorporated Nobu's patches for the Ruby module, to handle the new

allocation framework from Ruby 1.8. Also updated the TODO list to
indicate that this task has been completed.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4684 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Logan Johnson 2003-04-15 18:51:00 +00:00
commit c621aa6c27
3 changed files with 15 additions and 2 deletions

View file

@ -1,5 +1,9 @@
Version 1.3.20 (In progress)
============================
04/15/2003: ljohnson (Lyle Johnson)
[Ruby] Incorporated Nobu Nakada's patches for supporting the Ruby
1.8 allocation framework.
04/15/2003: ljohnson (Lyle Johnson)
[Ruby] Replaced all uses of the deprecated STR2CSTR() macro with the
safer StringValuePtr() macro. For more information, see ruby-talk:67059

View file

@ -478,8 +478,13 @@ public:
iname, "\", ", wname, ", -1);\n", NIL);
break;
case CONSTRUCTOR_ALLOCATE:
Printv(s, "#ifdef HAVE_RB_DEFINE_ALLOC_FUNC\n", NIL);
Printv(s, tab4, "rb_define_alloc_func(", klass->vname,
", ", wname, ");\n", NIL);
Printv(s, "#else\n", NIL);
Printv(s, tab4, "rb_define_singleton_method(", klass->vname,
", \"new\", ", wname, ", -1);\n", NIL);
Printv(s, "#endif\n", NIL);
Replaceall(klass->init,"$allocator", s);
break;
case CONSTRUCTOR_INITIALIZE:
@ -829,7 +834,9 @@ public:
if (current == CONSTRUCTOR_ALLOCATE) {
need_result = 1;
Printf(f->code, "VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE%s);\n", Char(SwigType_manglestr(t)));
Printf(f->code, "#ifndef HAVE_RB_DEFINE_ALLOC_FUNC\n");
Printf(f->code, "rb_obj_call_init(vresult, argc, argv);\n");
Printf(f->code, "#endif\n");
} else if (current == CONSTRUCTOR_INITIALIZE) {
need_result = 1;
// Printf(f->code, "DATA_PTR(self) = result;\n");
@ -1328,8 +1335,10 @@ public:
Printv(f_header, klass->header,NIL);
String *s = NewString("");
Printv(s, "#ifndef HAVE_RB_DEFINE_ALLOC_FUNC\n", NIL);
Printv(s, tab4, "rb_undef_method(CLASS_OF(", klass->vname,
"), \"new\");\n", NIL);
Printv(s, "#endif\n", NIL);
Replaceall(klass->init,"$allocator", s);
Replaceall(klass->init,"$initializer", "");
Replaceall(klass->init,"$super", "rb_cObject");

View file

@ -203,14 +203,14 @@ Ruby
**** Add Ruby support for Mark Rose's polymorphism code.
**** Investigate the new object allocation framework that has been
[DONE] Investigate the new object allocation framework that has been
implemented for Ruby 1.8 and determine what (if anything) needs
to be changed for the wrapper code generated by SWIG. For background
see ruby-talk messages 23358 and 38856 (and related threads).
*** Add support for keyword arguments (by collecting them in a hash?).
** Add support for defining nested modules. This should work like it does
[DONE] Add support for defining nested modules. This should work like it does
for the SWIG Perl module.
** In a post to the SWIG users' mailing list (June 5: "Multiple Inheritance