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

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