diff --git a/SWIG/CHANGES.current b/SWIG/CHANGES.current index 9b8ca8e52..bce94a65a 100644 --- a/SWIG/CHANGES.current +++ b/SWIG/CHANGES.current @@ -1,6 +1,29 @@ Version 1.3.22 (in progress) ================================== +05/14/2004: lyle + Added Kou's patch for the Ruby %import directive so that modules + with "nested" names are handled properly. Consider an interface + file foo.i that has this %module declaration at its top: + + %module "misc::text::foo" + + Now consider another interface file spam.i that imports foo.i: + + %import foo.i + + Before this patch, this would result in the following code being + generated for spam_wrap.c: + + rb_require("misc::text::foo"); + + With this patch, however, you'll get the correct path name + for the call to rb_require(), e.g. + + rb_require("misc/text/foo"); + + See SourceForge Bug #928299. + 05/12/2004: wsfulton Patch for emitting directors when %feature("director") specified for a class with no virtual methods, but does have a virtual destructor. diff --git a/SWIG/Source/Modules/ruby.cxx b/SWIG/Source/Modules/ruby.cxx index cc3bf50fa..e3c7ce6ad 100644 --- a/SWIG/Source/Modules/ruby.cxx +++ b/SWIG/Source/Modules/ruby.cxx @@ -484,7 +484,25 @@ public: virtual int importDirective(Node *n) { String *modname = Getattr(n,"module"); if (modname) { - Printf(f_init,"rb_require(\"%s\");\n", modname); + List *modules = Split(modname,':',INT_MAX); + if (modules && Len(modules) > 0) { + modname = NewString(""); + String *last = NULL; + Iterator m = First(modules); + while (m.item) { + if (Len(m.item) > 0) { + if (last) { + Append(modname, "/"); + } + Append(modname, m.item); + last = m.item; + } + m = Next(m); + } + Printf(f_init,"rb_require(\"%s\");\n", modname); + Delete(modname); + } + Delete(modules); } return Language::importDirective(n); }