Additions to %types so that a user can specify the code to go into the casting / conversion function

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10222 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-01-31 22:45:59 +00:00
commit 629aae375c
5 changed files with 76 additions and 13 deletions

View file

@ -776,6 +776,7 @@ int Language::typemapcopyDirective(Node *n) {
int Language::typesDirective(Node *n) {
Parm *parms = Getattr(n, "parms");
String *convcode = Getattr(n, "convcode"); /* optional user supplied conversion code for custom casting */
while (parms) {
SwigType *t = Getattr(parms, "type");
String *v = Getattr(parms, "value");
@ -783,7 +784,7 @@ int Language::typesDirective(Node *n) {
SwigType_remember(t);
} else {
if (SwigType_issimple(t)) {
SwigType_inherit(t, v, 0);
SwigType_inherit(t, v, 0, convcode);
}
}
parms = nextSibling(parms);

View file

@ -205,7 +205,7 @@ class TypePass:private Dispatcher {
Setmeta(bname, "already_warned", "1");
}
}
SwigType_inherit(clsname, bname, cast);
SwigType_inherit(clsname, bname, cast, 0);
}
}
}
@ -225,7 +225,7 @@ class TypePass:private Dispatcher {
String *bname = Getattr(n, "name");
Node *bclass = n; /* Getattr(n,"class"); */
Hash *scopes = Getattr(bclass, "typescope");
SwigType_inherit(clsname, bname, cast);
SwigType_inherit(clsname, bname, cast, 0);
if (!importmode) {
String *btype = Copy(bname);
SwigType_add_pointer(btype);