Keep the old non-resolved type str and add the fully

resolved one if is needed.

Add examples showing the problem with SWIG_TypeQuery
and template+typedef and the old type str, and how
it works now.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5704 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-02-10 08:37:30 +00:00
commit d29dbe752d
4 changed files with 58 additions and 15 deletions

View file

@ -1674,7 +1674,11 @@ SwigType_emit_type_table(File *f_forward, File *f_table) {
while (ki.key) {
List *el;
Iterator ei;
SwigType *ft;
SwigType *lt;
SwigType *rt;
String *nt;
String *ln;
String *rn;
const String *cd;
Printf(f_forward,"#define SWIGTYPE%s swig_types[%d] \n", ki.key, i);
@ -1682,8 +1686,17 @@ SwigType_emit_type_table(File *f_forward, File *f_table) {
cd = SwigType_clientdata_collect(ki.key,0);
if (!cd) cd = "0";
ft = SwigType_typedef_resolve_all(Getattr(r_ltype,ki.key));
Printv(types,"{\"", ki.key, "\", 0, \"",SwigType_str(ft,0),"\", ", cd, ", 0, 0, 0},", NIL);
lt = Getattr(r_ltype,ki.key);
rt = SwigType_typedef_resolve_all(lt);
/* we save the original type and the fully resolved version */
ln = SwigType_str(lt,0);
rn = SwigType_str(rt,0);
if (Strcmp(ln,rn) == 0) {
nt = NewStringf("%s", ln);
} else {
nt = NewStringf("%s|%s", rn, ln);
}
Printv(types,"{\"", ki.key, "\", 0, \"",nt,"\", ", cd, ", 0, 0, 0},", NIL);
el = SwigType_equivalent_mangle(ki.key,0,0);
for (ei = First(el); ei.item; ei = Next(ei)) {
String *ckey;
@ -1698,7 +1711,8 @@ SwigType_emit_type_table(File *f_forward, File *f_table) {
Delete(ckey);
}
Delete(el);
Delete(ft);
Delete(nt);
Delete(rt);
Printf(types,"{0, 0, 0, 0, 0, 0, 0}};\n");
Printv(table, "_swigt_", ki.key, ", \n", NIL);
ki = Next(ki);