fix several memory leaks
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7036 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
310bff2e1b
commit
b4edea6fa9
8 changed files with 164 additions and 69 deletions
|
|
@ -158,7 +158,9 @@ cparse_template_expand(Node *n, String *tname, String *rname, String *templatear
|
||||||
}
|
}
|
||||||
name = Getattr(n,"sym:name");
|
name = Getattr(n,"sym:name");
|
||||||
if (name && Strstr(name,"<")) {
|
if (name && Strstr(name,"<")) {
|
||||||
Setattr(n,"sym:name", Copy(tname));
|
String *sn = Copy(tname);
|
||||||
|
Setattr(n,"sym:name", sn);
|
||||||
|
Delete(sn);
|
||||||
} else {
|
} else {
|
||||||
Replace(name,tname,rname, DOH_REPLACE_ANY);
|
Replace(name,tname,rname, DOH_REPLACE_ANY);
|
||||||
}
|
}
|
||||||
|
|
@ -252,11 +254,13 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *ts
|
||||||
partial_type = partial_arg(tptype,ptype);
|
partial_type = partial_arg(tptype,ptype);
|
||||||
/* Printf(stdout,"partial '%s' '%s' ---> '%s'\n", tptype, ptype, partial_type); */
|
/* Printf(stdout,"partial '%s' '%s' ---> '%s'\n", tptype, ptype, partial_type); */
|
||||||
Setattr(tp,"type",partial_type);
|
Setattr(tp,"type",partial_type);
|
||||||
|
Delete(partial_type);
|
||||||
}
|
}
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
tp = nextSibling(tp);
|
tp = nextSibling(tp);
|
||||||
}
|
}
|
||||||
assert(ParmList_len(ptargs) == ParmList_len(tparms));
|
assert(ParmList_len(ptargs) == ParmList_len(tparms));
|
||||||
|
Delete(ptargs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
|
|
@ -377,6 +381,7 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *ts
|
||||||
String *qn = Swig_symbol_type_qualify(b.item,tscope);
|
String *qn = Swig_symbol_type_qualify(b.item,tscope);
|
||||||
Clear(b.item);
|
Clear(b.item);
|
||||||
Append(b.item,qn);
|
Append(b.item,qn);
|
||||||
|
Delete(qn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -384,6 +389,7 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *ts
|
||||||
Delete(cpatchlist);
|
Delete(cpatchlist);
|
||||||
Delete(typelist);
|
Delete(typelist);
|
||||||
Delete(tbase);
|
Delete(tbase);
|
||||||
|
Delete(templateargs);
|
||||||
|
|
||||||
/* set_nodeType(n,"template");*/
|
/* set_nodeType(n,"template");*/
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -427,6 +433,7 @@ template_locate(String *name, Parm *tparms, Symtab *tscope) {
|
||||||
if (ty) {
|
if (ty) {
|
||||||
SwigType *nt = Swig_symbol_type_qualify(ty,tscope);
|
SwigType *nt = Swig_symbol_type_qualify(ty,tscope);
|
||||||
Setattr(p,"type",nt);
|
Setattr(p,"type",nt);
|
||||||
|
Delete(nt);
|
||||||
}
|
}
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,9 +59,15 @@ Swig_clocal(SwigType *t, const String_or_char *name, const String_or_char *value
|
||||||
switch(SwigType_type(t)) {
|
switch(SwigType_type(t)) {
|
||||||
case T_REFERENCE:
|
case T_REFERENCE:
|
||||||
if (value) {
|
if (value) {
|
||||||
Printf(decl,"%s = (%s) &%s_defvalue", SwigType_lstr(t,name), SwigType_lstr(t,0), name);
|
String *lstrname = SwigType_lstr(t,name);
|
||||||
|
String *lstr = SwigType_lstr(t,0);
|
||||||
|
Printf(decl,"%s = (%s) &%s_defvalue", lstrname, lstr, name);
|
||||||
|
Delete(lstrname);
|
||||||
|
Delete(lstr);
|
||||||
} else {
|
} else {
|
||||||
Printf(decl,"%s = 0", SwigType_lstr(t,name));
|
String *lstrname = SwigType_lstr(t,name);
|
||||||
|
Printf(decl,"%s = 0", lstrname);
|
||||||
|
Delete(lstrname);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_VOID:
|
case T_VOID:
|
||||||
|
|
@ -72,9 +78,15 @@ Swig_clocal(SwigType *t, const String_or_char *name, const String_or_char *value
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (value) {
|
if (value) {
|
||||||
Printf(decl,"%s = (%s) %s", SwigType_lstr(t,name), SwigType_lstr(t,0), SwigType_lcaststr(t,value));
|
String *lcaststr = SwigType_lcaststr(t,value);
|
||||||
|
String *lstr = SwigType_lstr(t,0);
|
||||||
|
Printf(decl,"%s = (%s) %s", SwigType_lstr(t,name), lstr, lcaststr);
|
||||||
|
Delete(lcaststr);
|
||||||
|
Delete(lstr);
|
||||||
} else {
|
} else {
|
||||||
Printf(decl,"%s", SwigType_lstr(t,name));
|
String *lstrname = SwigType_lstr(t,name);
|
||||||
|
Printf(decl,"%s", lstrname);
|
||||||
|
Delete(lstrname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return decl;
|
return decl;
|
||||||
|
|
@ -185,7 +197,9 @@ int Swig_cargs(Wrapper *w, ParmList *p) {
|
||||||
defvalue = NewStringf("%s = %s", SwigType_lstr(tvalue,defname),qvalue);
|
defvalue = NewStringf("%s = %s", SwigType_lstr(tvalue,defname),qvalue);
|
||||||
} else {
|
} else {
|
||||||
/* user type, we copy the reference value */
|
/* user type, we copy the reference value */
|
||||||
defvalue = NewStringf("%s = %s",SwigType_str(type,defname),qvalue);
|
String *str = SwigType_str(type,defname);
|
||||||
|
defvalue = NewStringf("%s = %s",str,qvalue);
|
||||||
|
Delete(str);
|
||||||
}
|
}
|
||||||
Wrapper_add_localv(w,defname, defvalue, NIL);
|
Wrapper_add_localv(w,defname, defvalue, NIL);
|
||||||
Delete(tvalue);
|
Delete(tvalue);
|
||||||
|
|
@ -827,6 +841,7 @@ Swig_MethodToFunction(Node *n, String *classname, int flags) {
|
||||||
Setattr(n,"parms",p);
|
Setattr(n,"parms",p);
|
||||||
Delete(p);
|
Delete(p);
|
||||||
Delete(self);
|
Delete(self);
|
||||||
|
Delete(parms);
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -926,6 +941,7 @@ Swig_ConstructorToFunction(Node *n, String *classname,
|
||||||
for (p2 = parms; p2; p2 = nextSibling(p2)) {
|
for (p2 = parms; p2; p2 = nextSibling(p2)) {
|
||||||
p3 = CopyParm(p2);
|
p3 = CopyParm(p2);
|
||||||
set_nextSibling(p, p3);
|
set_nextSibling(p, p3);
|
||||||
|
Delete(p3);
|
||||||
p = p3;
|
p = p3;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|
|
||||||
|
|
@ -49,13 +49,19 @@ Swig_fragment_register(Node* fragment) {
|
||||||
fragments = NewHash();
|
fragments = NewHash();
|
||||||
}
|
}
|
||||||
if (!Getattr(fragments,name)) {
|
if (!Getattr(fragments,name)) {
|
||||||
String *section = Getattr(fragment,"section");
|
String *section = Copy(Getattr(fragment,"section"));
|
||||||
String *ccode = Copy(Getattr(fragment,"code"));
|
String *ccode = Copy(Getattr(fragment,"code"));
|
||||||
Hash *kwargs = Getattr(fragment,"kwargs");
|
Hash *kwargs = Getattr(fragment,"kwargs");
|
||||||
Setmeta(ccode,"section",Copy(section));
|
Setmeta(ccode,"section",section);
|
||||||
if (kwargs) Setmeta(ccode,"kwargs",Copy(kwargs));
|
if (kwargs) {
|
||||||
|
kwargs = Copy(kwargs);
|
||||||
|
Setmeta(ccode,"kwargs",kwargs);
|
||||||
|
Delete(kwargs);
|
||||||
|
}
|
||||||
Setattr(fragments,name,ccode);
|
Setattr(fragments,name,ccode);
|
||||||
if (debug) Printf(stdout,"registering fragment %s %s\n",name,section);
|
if (debug) Printf(stdout,"registering fragment %s %s\n",name,section);
|
||||||
|
Delete(section);
|
||||||
|
Delete(ccode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -404,7 +404,7 @@ Swig_name_object_set(Hash *namehash, String *name, SwigType *decl, DOH *object)
|
||||||
}
|
}
|
||||||
/* Add an object based on the declarator value */
|
/* Add an object based on the declarator value */
|
||||||
if (!decl) {
|
if (!decl) {
|
||||||
Setattr(n,NewString("*"),object);
|
Setattr(n,"*",object);
|
||||||
} else {
|
} else {
|
||||||
Setattr(n,Copy(decl),object);
|
Setattr(n,Copy(decl),object);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,9 @@ Parm *NewParm(SwigType *type, const String_or_char *n) {
|
||||||
Parm *p = NewHash();
|
Parm *p = NewHash();
|
||||||
|
|
||||||
if (type) {
|
if (type) {
|
||||||
Setattr(p,"type", Copy(type));
|
SwigType *ntype = Copy(type);
|
||||||
|
Setattr(p,"type",ntype);
|
||||||
|
Delete(ntype);
|
||||||
}
|
}
|
||||||
Setattr(p,"name",n);
|
Setattr(p,"name",n);
|
||||||
return p;
|
return p;
|
||||||
|
|
@ -41,41 +43,56 @@ Parm *NewParm(SwigType *type, const String_or_char *n) {
|
||||||
* ------------------------------------------------------------------------ */
|
* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
Parm *CopyParm(Parm *p) {
|
Parm *CopyParm(Parm *p) {
|
||||||
SwigType *t;
|
Parm *np = NewHash();
|
||||||
String *name;
|
SwigType *t = Getattr(p,"type");
|
||||||
String *lname;
|
String *name = Getattr(p,"name");
|
||||||
String *value;
|
String *lname = Getattr(p,"lname");
|
||||||
String *ignore;
|
String *value = Getattr(p,"value");
|
||||||
String *alttype;
|
String *ignore = Getattr(p,"ignore");
|
||||||
String *byname;
|
String *alttype = Getattr(p,"alttype");
|
||||||
String *compactdefargs;
|
String *byname = Getattr(p, "arg:byname");
|
||||||
|
String *compactdefargs = Getattr(p, "compactdefargs");
|
||||||
|
|
||||||
Parm *np = NewHash();
|
if (t) {
|
||||||
t = Getattr(p,"type");
|
SwigType *nt = Copy(t);
|
||||||
name = Getattr(p,"name");
|
Setattr(np,"type",nt);
|
||||||
lname = Getattr(p,"lname");
|
Delete(nt);
|
||||||
value = Getattr(p,"value");
|
}
|
||||||
ignore = Getattr(p,"ignore");
|
if (name) {
|
||||||
alttype = Getattr(p,"alttype");
|
String *str = Copy(name);
|
||||||
byname = Getattr(p, "arg:byname");
|
Setattr(np,"name",str);
|
||||||
compactdefargs = Getattr(p, "compactdefargs");
|
Delete(str);
|
||||||
|
}
|
||||||
if (t)
|
if (lname) {
|
||||||
Setattr(np,"type",Copy(t));
|
String *str = Copy(lname);
|
||||||
if (name)
|
Setattr(np,"lname", str);
|
||||||
Setattr(np,"name",Copy(name));
|
Delete(str);
|
||||||
if (lname)
|
}
|
||||||
Setattr(np,"lname", Copy(lname));
|
if (value) {
|
||||||
if (value)
|
String *str = Copy(value);
|
||||||
Setattr(np,"value", Copy(value));
|
Setattr(np,"value", str);
|
||||||
if (ignore)
|
Delete(str);
|
||||||
Setattr(np,"ignore", Copy(ignore));
|
}
|
||||||
if (alttype)
|
if (ignore) {
|
||||||
Setattr(np,"alttype", Copy(alttype));
|
String *str = Copy(ignore);
|
||||||
if (byname)
|
Setattr(np,"ignore", str);
|
||||||
Setattr(np, "arg:byname", Copy(byname));
|
Delete(str);
|
||||||
if (compactdefargs)
|
}
|
||||||
Setattr(np, "compactdefargs", Copy(compactdefargs));
|
if (alttype) {
|
||||||
|
String *str = Copy(alttype);
|
||||||
|
Setattr(np,"alttype", str);
|
||||||
|
Delete(str);
|
||||||
|
}
|
||||||
|
if (byname) {
|
||||||
|
String *str = Copy(byname);
|
||||||
|
Setattr(np, "arg:byname", str);
|
||||||
|
Delete(str);
|
||||||
|
}
|
||||||
|
if (compactdefargs) {
|
||||||
|
String *str = Copy(compactdefargs);
|
||||||
|
Setattr(np, "compactdefargs", str);
|
||||||
|
Delete(str);
|
||||||
|
}
|
||||||
|
|
||||||
Setfile(np,Getfile(p));
|
Setfile(np,Getfile(p));
|
||||||
Setline(np,Getline(p));
|
Setline(np,Getline(p));
|
||||||
|
|
@ -99,6 +116,7 @@ CopyParmList(ParmList *p) {
|
||||||
np = CopyParm(p);
|
np = CopyParm(p);
|
||||||
if (pp) {
|
if (pp) {
|
||||||
set_nextSibling(pp,np);
|
set_nextSibling(pp,np);
|
||||||
|
Delete(np);
|
||||||
} else {
|
} else {
|
||||||
fp = np;
|
fp = np;
|
||||||
}
|
}
|
||||||
|
|
@ -280,6 +298,7 @@ ParmList *ParmList_copy_all_except_last_parm(ParmList *p) {
|
||||||
newparm = CopyParm(p);
|
newparm = CopyParm(p);
|
||||||
if (pp) {
|
if (pp) {
|
||||||
set_nextSibling(pp,newparm);
|
set_nextSibling(pp,newparm);
|
||||||
|
Delete(newparm);
|
||||||
} else {
|
} else {
|
||||||
fp = newparm;
|
fp = newparm;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -386,6 +386,7 @@ SwigType *SwigType_default(SwigType *t) {
|
||||||
def = r;
|
def = r;
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
Delete(q);
|
||||||
}
|
}
|
||||||
if (Strcmp(r,"p.SWIGTYPE") == 0) {
|
if (Strcmp(r,"p.SWIGTYPE") == 0) {
|
||||||
def = NewString("SWIGTYPE");
|
def = NewString("SWIGTYPE");
|
||||||
|
|
@ -502,14 +503,17 @@ SwigType_namestr(const SwigType *t) {
|
||||||
p = SwigType_parmlist(t);
|
p = SwigType_parmlist(t);
|
||||||
sz = Len(p);
|
sz = Len(p);
|
||||||
for (i = 0; i < sz; i++) {
|
for (i = 0; i < sz; i++) {
|
||||||
Append(r,SwigType_str(Getitem(p,i),0));
|
String *str = SwigType_str(Getitem(p,i),0);
|
||||||
|
Append(r,str);
|
||||||
if ((i+1) < sz) Putc(',',r);
|
if ((i+1) < sz) Putc(',',r);
|
||||||
|
Delete(str);
|
||||||
}
|
}
|
||||||
Putc(' ',r);
|
Putc(' ',r);
|
||||||
Putc('>',r);
|
Putc('>',r);
|
||||||
suffix = SwigType_templatesuffix(t);
|
suffix = SwigType_templatesuffix(t);
|
||||||
Append(r,suffix);
|
Append(r,suffix);
|
||||||
Delete(suffix);
|
Delete(suffix);
|
||||||
|
Delete(p);
|
||||||
#if 0
|
#if 0
|
||||||
if (SwigType_istemplate(r)) {
|
if (SwigType_istemplate(r)) {
|
||||||
SwigType *rr = SwigType_namestr(r);
|
SwigType *rr = SwigType_namestr(r);
|
||||||
|
|
@ -835,6 +839,7 @@ String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
|
||||||
for (j = 0; j < plen; j++) {
|
for (j = 0; j < plen; j++) {
|
||||||
p = SwigType_str(Getitem(parms,j),0);
|
p = SwigType_str(Getitem(parms,j),0);
|
||||||
Append(result,p);
|
Append(result,p);
|
||||||
|
Delete(p);
|
||||||
if (j < (plen-1)) Append(result,",");
|
if (j < (plen-1)) Append(result,",");
|
||||||
}
|
}
|
||||||
Append(result,")");
|
Append(result,")");
|
||||||
|
|
@ -886,7 +891,9 @@ String *SwigType_lcaststr(SwigType *s, const String_or_char *name) {
|
||||||
if (SwigType_isarray(s)) {
|
if (SwigType_isarray(s)) {
|
||||||
Printf(result,"(%s)%s", SwigType_lstr(s,0),name);
|
Printf(result,"(%s)%s", SwigType_lstr(s,0),name);
|
||||||
} else if (SwigType_isreference(s)) {
|
} else if (SwigType_isreference(s)) {
|
||||||
Printf(result,"(%s)", SwigType_str(s,0));
|
String *str = SwigType_str(s,0);
|
||||||
|
Printf(result,"(%s)", str);
|
||||||
|
Delete(str);
|
||||||
if (name)
|
if (name)
|
||||||
Printv(result,name,NIL);
|
Printv(result,name,NIL);
|
||||||
} else if (SwigType_isqualifier(s)) {
|
} else if (SwigType_isqualifier(s)) {
|
||||||
|
|
@ -1044,6 +1051,7 @@ SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
|
||||||
}
|
}
|
||||||
Clear(t);
|
Clear(t);
|
||||||
Append(t,nt);
|
Append(t,nt);
|
||||||
|
Delete(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ Swig_typemap_register(const String_or_char *op, ParmList *parms, String_or_char
|
||||||
tm1 = Getattr(tm,pname);
|
tm1 = Getattr(tm,pname);
|
||||||
if (!tm1) {
|
if (!tm1) {
|
||||||
tm1 = NewHash();
|
tm1 = NewHash();
|
||||||
Setattr(tm,NewString(pname),tm1);
|
Setattr(tm,pname,tm1);
|
||||||
Delete(tm1);
|
Delete(tm1);
|
||||||
}
|
}
|
||||||
tm = tm1;
|
tm = tm1;
|
||||||
|
|
@ -225,14 +225,25 @@ Swig_typemap_register(const String_or_char *op, ParmList *parms, String_or_char
|
||||||
/* Setattr(tm2,newop,newop); */
|
/* Setattr(tm2,newop,newop); */
|
||||||
Delete(newop);
|
Delete(newop);
|
||||||
} else {
|
} else {
|
||||||
Setattr(tm2,"code",NewString(code));
|
String *str = SwigType_str(type,pname);
|
||||||
Setattr(tm2,"type",Copy(type));
|
String *typemap = NewStringf("typemap(%s) %s", op, str);
|
||||||
Setattr(tm2,"typemap",NewStringf("typemap(%s) %s", op, SwigType_str(type,pname)));
|
ParmList *clocals = CopyParmList(locals);
|
||||||
|
ParmList *ckwargs = CopyParmList(kwargs);
|
||||||
|
|
||||||
|
Setattr(tm2,"code", code);
|
||||||
|
Setattr(tm2,"type", type);
|
||||||
|
Setattr(tm2,"typemap", typemap);
|
||||||
if (pname) {
|
if (pname) {
|
||||||
Setattr(tm2,"pname", NewString(pname));
|
Setattr(tm2,"pname", pname);
|
||||||
}
|
}
|
||||||
Setattr(tm2,"locals", CopyParmList(locals));
|
Setattr(tm2,"locals", clocals);
|
||||||
Setattr(tm2,"kwargs", CopyParmList(kwargs));
|
Setattr(tm2,"kwargs", ckwargs);
|
||||||
|
|
||||||
|
Delete(clocals);
|
||||||
|
Delete(ckwargs);
|
||||||
|
|
||||||
|
Delete(str);
|
||||||
|
Delete(typemap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1079,14 +1090,19 @@ static void typemap_locals(DOHString *s, ParmList *l, Wrapper *f, int argnum) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (value) {
|
if (value) {
|
||||||
new_name = Wrapper_new_localv(f,str, SwigType_str(pt,str), "=", value, NIL);
|
String *pstr = SwigType_str(pt,str);
|
||||||
|
new_name = Wrapper_new_localv(f,str, pstr, "=", value, NIL);
|
||||||
|
Delete(pstr);
|
||||||
} else {
|
} else {
|
||||||
new_name = Wrapper_new_localv(f,str, SwigType_str(pt,str), NIL);
|
String *pstr = SwigType_str(pt,str);
|
||||||
|
new_name = Wrapper_new_localv(f,str, pstr, NIL);
|
||||||
|
Delete(pstr);
|
||||||
}
|
}
|
||||||
if (!isglobal) {
|
if (!isglobal) {
|
||||||
/* Substitute */
|
/* Substitute */
|
||||||
Replace(s,pn,new_name,DOH_REPLACE_ID | DOH_REPLACE_NOQUOTE);
|
Replace(s,pn,new_name,DOH_REPLACE_ID | DOH_REPLACE_NOQUOTE);
|
||||||
}
|
}
|
||||||
|
Delete(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
|
|
|
||||||
|
|
@ -869,7 +869,8 @@ SwigType *SwigType_typedef_qualified(SwigType *t)
|
||||||
String *isenum = 0;
|
String *isenum = 0;
|
||||||
if (SwigType_isenum(e)) {
|
if (SwigType_isenum(e)) {
|
||||||
isenum = NewString("enum ");
|
isenum = NewString("enum ");
|
||||||
e = NewString(Char(e)+5);
|
ty = NewString(Char(e)+5);
|
||||||
|
e = ty;
|
||||||
}
|
}
|
||||||
resolved_scope = 0;
|
resolved_scope = 0;
|
||||||
if (typedef_resolve(current_scope,e)) {
|
if (typedef_resolve(current_scope,e)) {
|
||||||
|
|
@ -917,11 +918,10 @@ SwigType *SwigType_typedef_qualified(SwigType *t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isenum) {
|
if (isenum) {
|
||||||
Insert(e,0,isenum);
|
Insert(e,0,isenum);
|
||||||
|
Delete(isenum);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* Template. We need to qualify template parameters as well as the template itself */
|
/* Template. We need to qualify template parameters as well as the template itself */
|
||||||
String *tprefix, *qprefix;
|
String *tprefix, *qprefix;
|
||||||
|
|
@ -1289,7 +1289,12 @@ SwigType *SwigType_alttype(SwigType *t, int local_tmap) {
|
||||||
use_wrapper = 1;
|
use_wrapper = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (use_wrapper) w = NewStringf("SwigValueWrapper<%s >",SwigType_str(td,0));
|
if (use_wrapper) {
|
||||||
|
String *str = SwigType_str(td,0);
|
||||||
|
w = NewStringf("SwigValueWrapper<%s >",str);
|
||||||
|
Delete(str);
|
||||||
|
}
|
||||||
|
|
||||||
Delete(td);
|
Delete(td);
|
||||||
}
|
}
|
||||||
return w;
|
return w;
|
||||||
|
|
@ -1414,6 +1419,7 @@ void SwigType_remember_clientdata(SwigType *t, const String_or_char *clientdata)
|
||||||
lt = SwigType_ltype(t);
|
lt = SwigType_ltype(t);
|
||||||
}
|
}
|
||||||
Setattr(r_ltype, mt, lt);
|
Setattr(r_ltype, mt, lt);
|
||||||
|
Delete(lt);
|
||||||
fr = SwigType_typedef_resolve_all(t); /* Create fully resolved type */
|
fr = SwigType_typedef_resolve_all(t); /* Create fully resolved type */
|
||||||
qr = SwigType_typedef_qualified(fr);
|
qr = SwigType_typedef_qualified(fr);
|
||||||
Delete(fr);
|
Delete(fr);
|
||||||
|
|
@ -1455,7 +1461,9 @@ void SwigType_remember_clientdata(SwigType *t, const String_or_char *clientdata)
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Setattr(r_clientdata, fr, NewString(clientdata));
|
String *cstr = NewString(clientdata);
|
||||||
|
Setattr(r_clientdata, fr, cstr);
|
||||||
|
Delete(cstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1588,18 +1596,22 @@ static Hash *conversions = 0;
|
||||||
void
|
void
|
||||||
SwigType_inherit(String *derived, String *base, String *cast) {
|
SwigType_inherit(String *derived, String *base, String *cast) {
|
||||||
Hash *h;
|
Hash *h;
|
||||||
|
String *dd = 0;
|
||||||
|
String *bb = 0;
|
||||||
if (!subclass) subclass = NewHash();
|
if (!subclass) subclass = NewHash();
|
||||||
|
|
||||||
/* Printf(stdout,"'%s' --> '%s' '%s'\n", derived, base, cast); */
|
/* Printf(stdout,"'%s' --> '%s' '%s'\n", derived, base, cast); */
|
||||||
|
|
||||||
if (SwigType_istemplate(derived)) {
|
if (SwigType_istemplate(derived)) {
|
||||||
String *ty = SwigType_typedef_resolve_all(derived);
|
String *ty = SwigType_typedef_resolve_all(derived);
|
||||||
derived = SwigType_typedef_qualified(ty);
|
dd = SwigType_typedef_qualified(ty);
|
||||||
|
derived = dd;
|
||||||
Delete(ty);
|
Delete(ty);
|
||||||
}
|
}
|
||||||
if (SwigType_istemplate(base)) {
|
if (SwigType_istemplate(base)) {
|
||||||
String *ty = SwigType_typedef_resolve_all(base);
|
String *ty = SwigType_typedef_resolve_all(base);
|
||||||
base = SwigType_typedef_qualified(ty);
|
bb = SwigType_typedef_qualified(ty);
|
||||||
|
base = bb;
|
||||||
Delete(ty);
|
Delete(ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1614,6 +1626,8 @@ SwigType_inherit(String *derived, String *base, String *cast) {
|
||||||
Setattr(h,derived, cast ? cast : (void *) "");
|
Setattr(h,derived, cast ? cast : (void *) "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Delete(dd);
|
||||||
|
Delete(bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -1659,6 +1673,7 @@ SwigType_issubtype(SwigType *t1, SwigType *t2) {
|
||||||
void SwigType_inherit_equiv(File *out) {
|
void SwigType_inherit_equiv(File *out) {
|
||||||
String *ckey;
|
String *ckey;
|
||||||
String *prefix, *base;
|
String *prefix, *base;
|
||||||
|
String *mprefix, *mkey;
|
||||||
Hash *sub;
|
Hash *sub;
|
||||||
Hash *rh;
|
Hash *rh;
|
||||||
List *rlist;
|
List *rlist;
|
||||||
|
|
@ -1694,15 +1709,21 @@ void SwigType_inherit_equiv(File *out) {
|
||||||
prefix= SwigType_prefix(rk.key);
|
prefix= SwigType_prefix(rk.key);
|
||||||
Append(prefix,bk.key);
|
Append(prefix,bk.key);
|
||||||
/* Printf(stdout,"set %x = '%s' : '%s'\n", rh, SwigType_manglestr(prefix),prefix); */
|
/* Printf(stdout,"set %x = '%s' : '%s'\n", rh, SwigType_manglestr(prefix),prefix); */
|
||||||
Setattr(rh,SwigType_manglestr(prefix),prefix);
|
mprefix = SwigType_manglestr(prefix);
|
||||||
ckey = NewStringf("%s+%s",SwigType_manglestr(prefix), SwigType_manglestr(rk.key));
|
Setattr(rh,mprefix,prefix);
|
||||||
|
mkey = SwigType_manglestr(rk.key);
|
||||||
|
ckey = NewStringf("%s+%s",mprefix, mkey);
|
||||||
if (!Getattr(conversions,ckey)) {
|
if (!Getattr(conversions,ckey)) {
|
||||||
String *convname = NewStringf("%sTo%s", SwigType_manglestr(prefix), SwigType_manglestr(rk.key));
|
String *convname = NewStringf("%sTo%s", mprefix, mkey);
|
||||||
|
String *lkey = SwigType_lstr(rk.key,0);
|
||||||
|
String *lprefix = SwigType_lstr(prefix,0);
|
||||||
Printf(out,"static void *%s(void *x) {\n", convname);
|
Printf(out,"static void *%s(void *x) {\n", convname);
|
||||||
Printf(out," return (void *)((%s) %s ((%s) x));\n", SwigType_lstr(rk.key,0), Getattr(sub,bk.key), SwigType_lstr(prefix,0));
|
Printf(out," return (void *)((%s) %s ((%s) x));\n", lkey, Getattr(sub,bk.key), lprefix);
|
||||||
Printf(out,"}\n");
|
Printf(out,"}\n");
|
||||||
Setattr(conversions,ckey,convname);
|
Setattr(conversions,ckey,convname);
|
||||||
Delete(ckey);
|
Delete(ckey);
|
||||||
|
Delete(lkey);
|
||||||
|
Delete(lprefix);
|
||||||
|
|
||||||
/* This inserts conversions for typedefs */
|
/* This inserts conversions for typedefs */
|
||||||
{
|
{
|
||||||
|
|
@ -1716,7 +1737,7 @@ void SwigType_inherit_equiv(File *out) {
|
||||||
|
|
||||||
/* Make sure this name equivalence is not due to inheritance */
|
/* Make sure this name equivalence is not due to inheritance */
|
||||||
if (Cmp(prefix, Getattr(r,rrk.key)) == 0) {
|
if (Cmp(prefix, Getattr(r,rrk.key)) == 0) {
|
||||||
rkeymangle = SwigType_manglestr(rk.key);
|
rkeymangle = Copy(mkey);
|
||||||
ckey = NewStringf("%s+%s", rrk.key, rkeymangle);
|
ckey = NewStringf("%s+%s", rrk.key, rkeymangle);
|
||||||
if (!Getattr(conversions, ckey)) {
|
if (!Getattr(conversions, ckey)) {
|
||||||
Setattr(conversions, ckey, convname);
|
Setattr(conversions, ckey, convname);
|
||||||
|
|
@ -1739,6 +1760,8 @@ void SwigType_inherit_equiv(File *out) {
|
||||||
Delete(convname);
|
Delete(convname);
|
||||||
}
|
}
|
||||||
Delete(prefix);
|
Delete(prefix);
|
||||||
|
Delete(mprefix);
|
||||||
|
Delete(mkey);
|
||||||
bk = Next(bk);
|
bk = Next(bk);
|
||||||
}
|
}
|
||||||
rk = Next(rk);
|
rk = Next(rk);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue