fix feature director/nodirector, fix callback for python, reduce the SwigValueWrapper use
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6425 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ced0d5e023
commit
4804b899db
1 changed files with 18 additions and 11 deletions
|
|
@ -350,11 +350,12 @@ static Parm *nonvoid_parms(Parm *p) {
|
||||||
*/
|
*/
|
||||||
SwigType *cplus_value_type(SwigType *t) {
|
SwigType *cplus_value_type(SwigType *t) {
|
||||||
Node *n = 0;
|
Node *n = 0;
|
||||||
|
SwigType *w = 0;
|
||||||
int use_wrapper = 1;
|
int use_wrapper = 1;
|
||||||
if (CPlusPlus) {
|
if (CPlusPlus) {
|
||||||
if (SwigType_type(t) == T_USER) {
|
SwigType *ftd = SwigType_typedef_resolve_all(t);
|
||||||
SwigType *ftd = SwigType_typedef_resolve_all(t);
|
SwigType *td = SwigType_strip_qualifiers(ftd);
|
||||||
SwigType *td = SwigType_strip_qualifiers(ftd);
|
if (SwigType_type(td) == T_USER) {
|
||||||
if ((n = Swig_symbol_clookup(td,0))) {
|
if ((n = Swig_symbol_clookup(td,0))) {
|
||||||
if (((Strcmp(nodeType(n),"class") == 0)
|
if (((Strcmp(nodeType(n),"class") == 0)
|
||||||
&& !Getattr(n,"allocate:noassign")
|
&& !Getattr(n,"allocate:noassign")
|
||||||
|
|
@ -363,16 +364,18 @@ SwigType *cplus_value_type(SwigType *t) {
|
||||||
use_wrapper = Getattr(n,"feature:valuewrapper") ? 1 : 0;
|
use_wrapper = Getattr(n,"feature:valuewrapper") ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Delete(ftd);
|
|
||||||
Delete(td);
|
|
||||||
} else {
|
} else {
|
||||||
use_wrapper = 0;
|
use_wrapper = 0;
|
||||||
|
}
|
||||||
|
if (use_wrapper) {
|
||||||
|
String *name = SwigType_str(t,0);
|
||||||
|
w = NewStringf("SwigValueWrapper< %s >",name);
|
||||||
|
Delete(name);
|
||||||
}
|
}
|
||||||
} else {
|
Delete(ftd);
|
||||||
use_wrapper = 0;
|
Delete(td);
|
||||||
}
|
}
|
||||||
return use_wrapper ?
|
return w;
|
||||||
NewStringf("SwigValueWrapper< %s >",SwigType_str(t,0)) : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Patch C++ pass-by-value */
|
/* Patch C++ pass-by-value */
|
||||||
|
|
@ -1027,7 +1030,9 @@ Language::callbackfunctionHandler(Node *n) {
|
||||||
Setattr(n,"type", cbty);
|
Setattr(n,"type", cbty);
|
||||||
Setattr(n,"value", calltype);
|
Setattr(n,"value", calltype);
|
||||||
|
|
||||||
constantWrapper(n);
|
Node *ns = Getattr(symbols,cbname);
|
||||||
|
if (!ns) constantWrapper(n);
|
||||||
|
|
||||||
Delete(cbname);
|
Delete(cbname);
|
||||||
Delete(cbty);
|
Delete(cbty);
|
||||||
|
|
||||||
|
|
@ -1572,7 +1577,6 @@ int Language::unrollVirtualMethods(Node *n,
|
||||||
(is_public(ni) || need_nopublic)) {
|
(is_public(ni) || need_nopublic)) {
|
||||||
String *name = Getattr(ni, "name");
|
String *name = Getattr(ni, "name");
|
||||||
String *local_decl = SwigType_typedef_resolve_all(decl);
|
String *local_decl = SwigType_typedef_resolve_all(decl);
|
||||||
|
|
||||||
Node *method_id = is_destructor ? NewStringf("~destructor") : NewStringf("%s|%s", name, local_decl);
|
Node *method_id = is_destructor ? NewStringf("~destructor") : NewStringf("%s|%s", name, local_decl);
|
||||||
/* Make sure that the new method overwrites the existing: */
|
/* Make sure that the new method overwrites the existing: */
|
||||||
Hash *exists_item = Getattr(vm, method_id);
|
Hash *exists_item = Getattr(vm, method_id);
|
||||||
|
|
@ -1588,8 +1592,11 @@ int Language::unrollVirtualMethods(Node *n,
|
||||||
Hash *item = NewHash();
|
Hash *item = NewHash();
|
||||||
Setattr(item, "fqName", fqname);
|
Setattr(item, "fqName", fqname);
|
||||||
Node *m = Copy(ni);
|
Node *m = Copy(ni);
|
||||||
|
String *mname = NewStringf("%s::%s", Getattr(parent,"name"), name);
|
||||||
|
Swig_features_get(Swig_cparse_features(), 0, mname, Getattr(m,"decl"), m);
|
||||||
Setattr(item, "methodNode", m);
|
Setattr(item, "methodNode", m);
|
||||||
Setattr(vm, method_id, item);
|
Setattr(vm, method_id, item);
|
||||||
|
Delete(mname);
|
||||||
Delete(fqname);
|
Delete(fqname);
|
||||||
Delete(item);
|
Delete(item);
|
||||||
Delete(method_id);
|
Delete(method_id);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue