Incorporated Kou's patch for the Ruby module's %import directive, so

that nested module names are imported correctly.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5908 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Lyle Johnson 2004-05-15 04:52:43 +00:00
commit 410af41cae
2 changed files with 42 additions and 1 deletions

View file

@ -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.

View file

@ -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);
}