diff options
-rw-r--r-- | CHANGES.current | 21 | ||||
-rw-r--r-- | Source/Modules/java.cxx | 10 | ||||
-rw-r--r-- | Source/Modules/lang.cxx | 7 | ||||
-rw-r--r-- | Source/Modules/r.cxx | 2 | ||||
-rw-r--r-- | Source/Swig/parms.c | 22 | ||||
-rw-r--r-- | Source/Swig/swigparm.h | 3 | ||||
-rw-r--r-- | Source/Swig/typemap.c | 10 |
7 files changed, 62 insertions, 13 deletions
diff --git a/CHANGES.current b/CHANGES.current index 913951fec..17e4f76e4 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -8,6 +8,27 @@ Version 2.0.9 (in progress) 2012-11-09: vzeitlin [Python] Fix overflow when passing values greater than LONG_MAX from Python 3 for parameters with unsigned long C type. +2012-11-02: wsfulton + Fix some subtle named output typemap lookup misses, the fully qualified name was not always being + used for variables, for example: + + struct Glob { + int MyVar; + }; + + Previously the search rules (as shown by -debug-tmsearch) for the getter wrapper were: + + example.i:44: Searching for a suitable 'out' typemap for: int MyVar + Looking for: int MyVar + Looking for: int + + Now the scope is named correctly: + + example.i:44: Searching for a suitable 'out' typemap for: int Glob::MyVar + Looking for: int Glob::MyVar + Looking for: int MyVar + Looking for: int + 2012-10-26: wsfulton Fix director typemap searching so that a typemap specified with a name will be correctly matched. Previously the name was ignored during the typemap search. Applies to the following list of typemaps: diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index d9964edd8..6e9ee54b2 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -3514,7 +3514,6 @@ public: * --------------------------------------------------------------- */ int classDirectorMethod(Node *n, Node *parent, String *super) { - String *empty_str = NewString(""); String *classname = Getattr(parent, "sym:name"); String *c_classname = Getattr(parent, "name"); String *name = Getattr(n, "name"); @@ -3625,8 +3624,7 @@ public: String *cdesc = NULL; SwigType *covariant = Getattr(n, "covariant"); SwigType *adjustedreturntype = covariant ? covariant : returntype; - Parm *adjustedreturntypeparm = NewParm(adjustedreturntype, name, n); -// Setattr(adjustedreturntypeparm, "sym:symtab", Getattr(n, "sym:symtab")); + Parm *adjustedreturntypeparm = NewParmNode(adjustedreturntype, n); if ((tm = Swig_typemap_lookup("directorin", adjustedreturntypeparm, "", 0)) && (cdesc = Getattr(adjustedreturntypeparm, "tmap:directorin:descriptor"))) { @@ -3646,7 +3644,7 @@ public: /* Get the JNI field descriptor for this return type, add the JNI field descriptor to jniret_desc */ if ((c_ret_type = Swig_typemap_lookup("jni", n, "", 0))) { - Parm *tp = NewParm(c_ret_type, name, n); + Parm *tp = NewParmNode(c_ret_type, n); if (!is_void && !ignored_method) { String *jretval_decl = NewStringf("%s jresult", c_ret_type); @@ -3737,7 +3735,7 @@ public: } /* Start the Java field descriptor for the intermediate class's upcall (insert self object) */ - Parm *tp = NewParm(c_classname, empty_str, n); + Parm *tp = NewParmNode(c_classname, n); String *jdesc; if ((tm = Swig_typemap_lookup("directorin", tp, "", 0)) @@ -3779,7 +3777,7 @@ public: /* Get parameter's intermediary C type */ if ((c_param_type = Getattr(p, "tmap:jni"))) { - Parm *tp = NewParm(c_param_type, empty_str, n); + Parm *tp = NewParm(c_param_type, Getattr(p, "name"), n); String *desc_tm = NULL, *jdesc = NULL, *cdesc = NULL; /* Add to local variables */ diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index ff1dc08d0..297e245f3 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -1419,7 +1419,12 @@ int Language::membervariableHandler(Node *n) { target = NewStringf("%s->%s", pname, name); Delete(pname); } - tm = Swig_typemap_lookup("memberin", n, target, 0); + + // This is an input type typemap lookup and so it should not use Node n + // otherwise qualification is done on the parameter name for the setter function + Parm *nin = NewParm(type, name, n); + tm = Swig_typemap_lookup("memberin", nin, target, 0); + Delete(nin); } int flags = Extend | SmartPointer | use_naturalvar_mode(n); if (isNonVirtualProtectedAccess(n)) diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx index 14da3a975..94e6ed4bd 100644 --- a/Source/Modules/r.cxx +++ b/Source/Modules/r.cxx @@ -682,7 +682,7 @@ String * R::createFunctionPointerHandler(SwigType *t, Node *n, int *numArgs) { XXX Have to be a little more clever so that we can deal with struct A * - the * is getting lost. Is this still true? If so, will a SwigType_push() solve things? */ - Parm *bbase = NewParm(rettype, Swig_cresult_name(), n); + Parm *bbase = NewParmNode(rettype, n); String *returnTM = Swig_typemap_lookup("in", bbase, Swig_cresult_name(), f); if(returnTM) { String *tm = returnTM; diff --git a/Source/Swig/parms.c b/Source/Swig/parms.c index 283a2f5c2..0f4d17b73 100644 --- a/Source/Swig/parms.c +++ b/Source/Swig/parms.c @@ -19,13 +19,13 @@ char cvsroot_parms_c[] = "$Id$"; * NewParm() * * Create a new parameter from datatype 'type' and name 'name' copying - * the file and line number from the Node file_line_node. + * the file and line number from the Node from_node. * ------------------------------------------------------------------------ */ -Parm *NewParm(SwigType *type, const_String_or_char_ptr name, Node *file_line_node) { +Parm *NewParm(SwigType *type, const_String_or_char_ptr name, Node *from_node) { Parm *p = NewParmWithoutFileLineInfo(type, name); - Setfile(p, Getfile(file_line_node)); - Setline(p, Getline(file_line_node)); + Setfile(p, Getfile(from_node)); + Setline(p, Getline(from_node)); return p; } @@ -49,6 +49,20 @@ Parm *NewParmWithoutFileLineInfo(SwigType *type, const_String_or_char_ptr name) } /* ------------------------------------------------------------------------ + * NewParmNode() + * + * Create a new parameter from datatype 'type' and name and symbol table as + * well as file and line number from the 'from_node'. + * The resulting Parm will be similar to a Node used for typemap lookups. + * ------------------------------------------------------------------------ */ + +Parm *NewParmNode(SwigType *type, Node *from_node) { + Parm *p = NewParm(type, Getattr(from_node, "name"), from_node); + Setattr(p, "sym:symtab", Getattr(from_node, "sym:symtab")); + return p; +} + +/* ------------------------------------------------------------------------ * CopyParm() * ------------------------------------------------------------------------ */ diff --git a/Source/Swig/swigparm.h b/Source/Swig/swigparm.h index 70a39390e..368b4d26b 100644 --- a/Source/Swig/swigparm.h +++ b/Source/Swig/swigparm.h @@ -13,8 +13,9 @@ * ----------------------------------------------------------------------------- */ /* Individual parameters */ -extern Parm *NewParm(SwigType *type, const_String_or_char_ptr name, Node *file_line_node); +extern Parm *NewParm(SwigType *type, const_String_or_char_ptr name, Node *from_node); extern Parm *NewParmWithoutFileLineInfo(SwigType *type, const_String_or_char_ptr name); +extern Parm *NewParmNode(SwigType *type, Node *from_node); extern Parm *CopyParm(Parm *p); /* Parameter lists */ diff --git a/Source/Swig/typemap.c b/Source/Swig/typemap.c index 0488b1b62..fc7728084 100644 --- a/Source/Swig/typemap.c +++ b/Source/Swig/typemap.c @@ -1339,7 +1339,17 @@ static String *Swig_typemap_lookup_impl(const_String_or_char_ptr tmap_method, No pname = Getattr(node, "name"); +/* + if (pname && node && Getattr(node, "sym:symtab")) { + if (!checkAttribute(node, "kind", "function")) { + Printf(stdout, "New check: %s %s %s\n", Getattr(node, "name"), nodeType(node), Getattr(node, "kind")); + } + } +*/ + if (pname && node && Getattr(node, "sym:symtab")) { + /* if (pname && node && checkAttribute(node, "kind", "function")) { + */ /* For functions, add on a qualified name search, for example struct Foo { |