fix for templates to avoid using the templatereduce mode

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7961 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-12-09 09:25:28 +00:00
commit 99f0122d0d
5 changed files with 24 additions and 4 deletions

View file

@ -375,6 +375,7 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *ts
String *name, *value, *valuestr, *tydef, *tmp, *tmpr;
int sz, i;
String *dvalue = 0;
String *qvalue = 0;
name = Getattr(tp,k_name);
value = Getattr(p,k_value);
@ -382,7 +383,8 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *ts
if (name) {
if (!value) value = Getattr(p,k_type);
dvalue = Swig_symbol_type_qualify(value,tsdecl);
qvalue = Swig_symbol_type_qualify(value,tsdecl);
dvalue = Swig_symbol_typedef_reduce(qvalue, tsdecl);
if (SwigType_istemplate(dvalue)) {
String *ty = Swig_symbol_template_deftype(dvalue, tscope);
Delete(dvalue);
@ -434,6 +436,7 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *ts
Delete(tmpr);
Delete(valuestr);
Delete(dvalue);
Delete(qvalue);
}
p = nextSibling(p);
tp = nextSibling(tp);

View file

@ -17,7 +17,7 @@ char cvsroot_perl5_cxx[] = "$Header$";
#include "swigmod.h"
#include "cparse.h"
static int treduce = SWIG_cparse_template_reduce(1);
static int treduce = SWIG_cparse_template_reduce(0);
#include <ctype.h>

View file

@ -14,7 +14,7 @@ char cvsroot_ruby_cxx[] = "$Header$";
#include "swigmod.h"
#include "cparse.h"
static int treduce = SWIG_cparse_template_reduce(1);
static int treduce = SWIG_cparse_template_reduce(0);
#define SWIG_PROTECTED_TARGET_METHODS 1

View file

@ -24,7 +24,7 @@ char cvsroot_tcl8_cxx[] = "$Header$";
#include "swigmod.h"
#include "cparse.h"
static int treduce = SWIG_cparse_template_reduce(1);
static int treduce = SWIG_cparse_template_reduce(0);
static const char *usage = (char*)"\
Tcl 8 Options (available with -tcl)\n\

View file

@ -1016,6 +1016,10 @@ symbol_lookup_qualified(String_or_char *name, Symtab *symtab, String *prefix, in
* to get the real node.
* ----------------------------------------------------------------------------- */
static
SwigType *Swig_symbol_template_reduce(SwigType *qt, Symtab *ntab);
Node *
Swig_symbol_clookup(String_or_char *name, Symtab *n) {
Hash *hsym = 0;
@ -1052,6 +1056,19 @@ Swig_symbol_clookup(String_or_char *name, Symtab *n) {
}
}
}
if (!s) {
if (SwigType_istemplate(name)) {
SwigType *qt = Swig_symbol_type_qualify(name,hsym);
SwigType *rt = Swig_symbol_template_reduce(qt, hsym);
if (!Equal(rt,name)) {
s = Swig_symbol_clookup(rt, hsym);
}
Delete(qt);
Delete(rt);
}
}
if (!s) {
while (hsym) {
s = symbol_lookup(name,hsym,0);