Modify r_ltype in typesys.c to store a hashtable instead of a single value
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9933 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
f4b9fd381d
commit
38f6ca7f15
2 changed files with 59 additions and 20 deletions
|
|
@ -1,5 +1,11 @@
|
|||
Version 1.3.32 (in progress)
|
||||
============================
|
||||
09/05/2007: wuzzeb (John Lenz)
|
||||
- Change r_ltype in typesys.c to store a hashtable instead of a single value.
|
||||
several very subtle bugs were being caused by multiple ltypes being mapped
|
||||
to a single mangled type, mostly when using typedefed template parameters.
|
||||
Now, r_ltype stores a hashtable of possible ltypes, and when generating the
|
||||
type table, all the ltypes are added into the swig_type_info structure.
|
||||
|
||||
08/31/2007: wsfulton
|
||||
SF #1754967 from James Bigler.
|
||||
|
|
|
|||
|
|
@ -1428,6 +1428,7 @@ void SwigType_remember_clientdata(SwigType *t, const String_or_char *clientdata)
|
|||
SwigType *qr;
|
||||
String *tkey;
|
||||
String *cd;
|
||||
Hash *lthash;
|
||||
|
||||
if (!r_mangled) {
|
||||
r_mangled = NewHash();
|
||||
|
|
@ -1461,8 +1462,15 @@ void SwigType_remember_clientdata(SwigType *t, const String_or_char *clientdata)
|
|||
} else {
|
||||
lt = SwigType_ltype(t);
|
||||
}
|
||||
Setattr(r_ltype, mt, lt);
|
||||
|
||||
lthash = Getattr(r_ltype, mt);
|
||||
if (!lthash) {
|
||||
lthash = NewHash();
|
||||
Setattr(r_ltype, mt, lthash);
|
||||
}
|
||||
Setattr(lthash, lt, "1");
|
||||
Delete(lt);
|
||||
|
||||
fr = SwigType_typedef_resolve_all(t); /* Create fully resolved type */
|
||||
qr = SwigType_typedef_qualified(fr);
|
||||
Delete(fr);
|
||||
|
|
@ -1866,7 +1874,7 @@ void SwigType_emit_type_table(File *f_forward, File *f_table) {
|
|||
|
||||
SwigType_inherit_equiv(f_table);
|
||||
|
||||
/* #define DEBUG 1 */
|
||||
/*#define DEBUG 1*/
|
||||
#ifdef DEBUG
|
||||
Printf(stdout, "---r_mangled---\n");
|
||||
Printf(stdout, "%s\n", r_mangled);
|
||||
|
|
@ -1903,11 +1911,14 @@ void SwigType_emit_type_table(File *f_forward, File *f_table) {
|
|||
List *el;
|
||||
Iterator ei;
|
||||
SwigType *lt;
|
||||
SwigType *rt;
|
||||
SwigType *rt = 0;
|
||||
String *nt;
|
||||
String *ln;
|
||||
String *rn;
|
||||
const String *cd;
|
||||
Hash *lthash;
|
||||
Iterator ltiter;
|
||||
Hash *nthash;
|
||||
|
||||
cast_temp = NewStringEmpty();
|
||||
|
||||
|
|
@ -1920,26 +1931,48 @@ void SwigType_emit_type_table(File *f_forward, File *f_table) {
|
|||
if (!cd)
|
||||
cd = "0";
|
||||
|
||||
lt = Getattr(r_ltype, ki.item);
|
||||
rt = SwigType_typedef_resolve_all(lt);
|
||||
/* we save the original type and the fully resolved version */
|
||||
ln = SwigType_lstr(lt, 0);
|
||||
rn = SwigType_lstr(rt, 0);
|
||||
if (Equal(ln, rn)) {
|
||||
nt = NewString(ln);
|
||||
} else {
|
||||
nt = NewStringf("%s|%s", rn, ln);
|
||||
}
|
||||
if (SwigType_istemplate(rt)) {
|
||||
String *dt = Swig_symbol_template_deftype(rt, 0);
|
||||
String *dn = SwigType_lstr(dt, 0);
|
||||
if (!Equal(dn, rn) && !Equal(dn, ln)) {
|
||||
Printf(nt, "|%s", dn);
|
||||
lthash = Getattr(r_ltype, ki.item);
|
||||
nt = 0;
|
||||
nthash = NewHash();
|
||||
ltiter = First(lthash);
|
||||
while (ltiter.key) {
|
||||
lt = ltiter.key;
|
||||
rt = SwigType_typedef_resolve_all(lt);
|
||||
/* we save the original type and the fully resolved version */
|
||||
ln = SwigType_lstr(lt, 0);
|
||||
rn = SwigType_lstr(rt, 0);
|
||||
if (Equal(ln, rn)) {
|
||||
Setattr(nthash, ln, "1");
|
||||
} else {
|
||||
Setattr(nthash, rn, "1");
|
||||
Setattr(nthash, ln, "1");
|
||||
}
|
||||
Delete(dt);
|
||||
Delete(dn);
|
||||
if (SwigType_istemplate(rt)) {
|
||||
String *dt = Swig_symbol_template_deftype(rt, 0);
|
||||
String *dn = SwigType_lstr(dt, 0);
|
||||
if (!Equal(dn, rn) && !Equal(dn, ln)) {
|
||||
Setattr(nthash, dn, "1");
|
||||
}
|
||||
Delete(dt);
|
||||
Delete(dn);
|
||||
}
|
||||
|
||||
ltiter = Next(ltiter);
|
||||
}
|
||||
|
||||
/* now build nt */
|
||||
ltiter = First(nthash);
|
||||
nt = 0;
|
||||
while (ltiter.key) {
|
||||
if (nt) {
|
||||
Printf(nt, "|%s", ltiter.key);
|
||||
} else {
|
||||
nt = NewString(ltiter.key);
|
||||
}
|
||||
ltiter = Next(ltiter);
|
||||
}
|
||||
Delete(nthash);
|
||||
|
||||
Printf(types, "\"%s\", \"%s\", 0, 0, (void*)%s, 0};\n", ki.item, nt, cd);
|
||||
|
||||
el = SwigType_equivalent_mangle(ki.item, 0, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue