fixes for mixed_types.i, multidimension arrays, and arrays +references+typedefs
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6728 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e623572061
commit
7c617cd2f1
4 changed files with 47 additions and 24 deletions
|
|
@ -264,14 +264,13 @@ Swig_cfunction_call(String_or_char *name, ParmList *parms) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int comma = 0;
|
int comma = 0;
|
||||||
Parm *p = parms;
|
Parm *p = parms;
|
||||||
SwigType *pt;
|
|
||||||
String *nname;
|
String *nname;
|
||||||
|
|
||||||
func = NewString("");
|
func = NewString("");
|
||||||
nname = SwigType_namestr(name);
|
nname = SwigType_namestr(name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SWIG_TEMPLATE_DESIMBUAGATOR is compiler dependent (common.swg),
|
SWIG_TEMPLATE_DISAMBIGUATOR is compiler dependent (common.swg),
|
||||||
- SUN Studio 9 requires 'template',
|
- SUN Studio 9 requires 'template',
|
||||||
- gcc-3.4 forbids the use of 'template'.
|
- gcc-3.4 forbids the use of 'template'.
|
||||||
the rest seems not caring very much,
|
the rest seems not caring very much,
|
||||||
|
|
@ -292,13 +291,13 @@ Swig_cfunction_call(String_or_char *name, ParmList *parms) {
|
||||||
|
|
||||||
|
|
||||||
while (p) {
|
while (p) {
|
||||||
String *pname;
|
SwigType *pt = Getattr(p,"type");
|
||||||
pt = Getattr(p,"type");
|
|
||||||
|
|
||||||
if ((SwigType_type(pt) != T_VOID)) {
|
if ((SwigType_type(pt) != T_VOID)) {
|
||||||
|
String *pname = Swig_cparm_name(p,i);
|
||||||
|
String *rcaststr = SwigType_rcaststr(pt, pname);
|
||||||
if (comma) Printf(func,",");
|
if (comma) Printf(func,",");
|
||||||
pname = Swig_cparm_name(p,i);
|
Printf(func,"%s", rcaststr);
|
||||||
Printf(func,"%s", SwigType_rcaststr(pt, pname));
|
Delete(rcaststr);
|
||||||
comma = 1;
|
comma = 1;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
@ -342,7 +341,9 @@ Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self) {
|
||||||
if (Strstr(func,"*this")) {
|
if (Strstr(func,"*this")) {
|
||||||
Replaceall(func,"this", Swig_cparm_name(p,0));
|
Replaceall(func,"this", Swig_cparm_name(p,0));
|
||||||
} else {
|
} else {
|
||||||
Replaceall(func,"this", SwigType_rcaststr(pt, Swig_cparm_name(p,0)));
|
String *rcaststr = SwigType_rcaststr(pt, Swig_cparm_name(p,0));
|
||||||
|
Replaceall(func,"this", rcaststr);
|
||||||
|
Delete(rcaststr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -360,12 +361,13 @@ Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self) {
|
||||||
i++;
|
i++;
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
while (p) {
|
while (p) {
|
||||||
String *pname;
|
|
||||||
pt = Getattr(p,"type");
|
pt = Getattr(p,"type");
|
||||||
if ((SwigType_type(pt) != T_VOID)) {
|
if ((SwigType_type(pt) != T_VOID)) {
|
||||||
|
String *pname = Swig_cparm_name(p,i);
|
||||||
|
String *rcaststr = SwigType_rcaststr(pt, pname);
|
||||||
if (comma) Printf(func,",");
|
if (comma) Printf(func,",");
|
||||||
pname = Swig_cparm_name(p,i);
|
Printf(func,"%s", rcaststr);
|
||||||
Printf(func,"%s", SwigType_rcaststr(pt, pname));
|
Delete(rcaststr);
|
||||||
comma = 1;
|
comma = 1;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -752,17 +752,17 @@ String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
|
||||||
rs = s;
|
rs = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SwigType_issimple(rs)) {
|
|
||||||
td = SwigType_typedef_resolve(rs);
|
td = SwigType_typedef_resolve(rs);
|
||||||
if ((td) && (SwigType_isconst(td) || SwigType_isarray(td) || SwigType_isreference(td))) {
|
if (td) {
|
||||||
|
if ((SwigType_isconst(td) || SwigType_isarray(td) || SwigType_isreference(td))) {
|
||||||
elements = SwigType_split(td);
|
elements = SwigType_split(td);
|
||||||
} else if (td && SwigType_isenum(td)) {
|
} else if (SwigType_isenum(td)) {
|
||||||
elements = SwigType_split(rs);
|
elements = SwigType_split(rs);
|
||||||
clear = 0;
|
clear = 0;
|
||||||
} else {
|
} else {
|
||||||
elements = SwigType_split(rs);
|
elements = SwigType_split(rs);
|
||||||
}
|
}
|
||||||
if (td) Delete(td);
|
Delete(td);
|
||||||
} else {
|
} else {
|
||||||
elements = SwigType_split(rs);
|
elements = SwigType_split(rs);
|
||||||
}
|
}
|
||||||
|
|
@ -838,6 +838,7 @@ String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
|
||||||
Delete(parms);
|
Delete(parms);
|
||||||
} else if (SwigType_isenum(element)) {
|
} else if (SwigType_isenum(element)) {
|
||||||
String *bs = SwigType_namestr(element);
|
String *bs = SwigType_namestr(element);
|
||||||
|
Insert(result,0," ");
|
||||||
Insert(result,0,bs);
|
Insert(result,0,bs);
|
||||||
Delete(bs);
|
Delete(bs);
|
||||||
clear = 0;
|
clear = 0;
|
||||||
|
|
|
||||||
|
|
@ -750,7 +750,7 @@ void typemap_replace_vars(String *s, ParmList *locals, SwigType *type, SwigType
|
||||||
String *size;
|
String *size;
|
||||||
int ndim;
|
int ndim;
|
||||||
int i;
|
int i;
|
||||||
if (!SwigType_isarray(type)) type = ftype;
|
if (SwigType_array_ndim(type) != SwigType_array_ndim(ftype)) type = ftype;
|
||||||
ndim = SwigType_array_ndim(type);
|
ndim = SwigType_array_ndim(type);
|
||||||
size = NewString("");
|
size = NewString("");
|
||||||
for (i = 0; i < ndim; i++) {
|
for (i = 0; i < ndim; i++) {
|
||||||
|
|
|
||||||
|
|
@ -547,6 +547,7 @@ typedef_resolve(Typetab *s, String *base) {
|
||||||
* SwigType_typedef_resolve()
|
* SwigType_typedef_resolve()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* #define SWIG_DEBUG */
|
||||||
SwigType *SwigType_typedef_resolve(SwigType *t) {
|
SwigType *SwigType_typedef_resolve(SwigType *t) {
|
||||||
String *base;
|
String *base;
|
||||||
String *type = 0;
|
String *type = 0;
|
||||||
|
|
@ -578,7 +579,9 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
|
||||||
|
|
||||||
base = SwigType_base(t);
|
base = SwigType_base(t);
|
||||||
|
|
||||||
/* Printf(stdout,"base = '%s' t='%s'\n", base, t); */
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stdout,"base = '%s' t='%s'\n", base, t);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SwigType_issimple(base)) {
|
if (SwigType_issimple(base)) {
|
||||||
s = current_scope;
|
s = current_scope;
|
||||||
|
|
@ -599,7 +602,9 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
|
||||||
if (Swig_scopename_check(base)) {
|
if (Swig_scopename_check(base)) {
|
||||||
/* A qualified name. */
|
/* A qualified name. */
|
||||||
nameprefix = Swig_scopename_prefix(base);
|
nameprefix = Swig_scopename_prefix(base);
|
||||||
/* Printf(stdout,"nameprefix = '%s'\n", nameprefix); */
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stdout,"nameprefix = '%s'\n", nameprefix);
|
||||||
|
#endif
|
||||||
if (nameprefix) {
|
if (nameprefix) {
|
||||||
/* Name had a prefix on it. See if we can locate the proper scope for it */
|
/* Name had a prefix on it. See if we can locate the proper scope for it */
|
||||||
s = SwigType_find_scope(s,nameprefix);
|
s = SwigType_find_scope(s,nameprefix);
|
||||||
|
|
@ -613,10 +618,22 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
|
||||||
}
|
}
|
||||||
/* Try to locate the name starting in the scope */
|
/* Try to locate the name starting in the scope */
|
||||||
namebase = Swig_scopename_last(base);
|
namebase = Swig_scopename_last(base);
|
||||||
/* Printf(stdout,"namebase = '%s'\n", namebase); */
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stdout,"namebase = '%s'\n", namebase);
|
||||||
|
#endif
|
||||||
type = typedef_resolve(s,namebase);
|
type = typedef_resolve(s,namebase);
|
||||||
/* Printf(stdout,"%s type = '%s'\n", Getattr(s,"name"), type); */
|
if (type) {
|
||||||
if ((type) && (!Swig_scopename_check(type))) {
|
/* we need to look for the resolved type, this will also
|
||||||
|
fix the resolved_scope if 'type' and 'namebase' are
|
||||||
|
declared in different scopes */
|
||||||
|
String *rtype = 0;
|
||||||
|
rtype = typedef_resolve(resolved_scope,type);
|
||||||
|
if (rtype) type = rtype;
|
||||||
|
}
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stdout,"%s type = '%s'\n", Getattr(s,"name"), type);
|
||||||
|
#endif
|
||||||
|
if ((type) && (!Swig_scopename_check(type)) && resolved_scope) {
|
||||||
Typetab *rtab = resolved_scope;
|
Typetab *rtab = resolved_scope;
|
||||||
String *qname = Getattr(resolved_scope,k_qname);
|
String *qname = Getattr(resolved_scope,k_qname);
|
||||||
/* If qualified *and* the typename is defined from the resolved scope, we qualify */
|
/* If qualified *and* the typename is defined from the resolved scope, we qualify */
|
||||||
|
|
@ -624,6 +641,9 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
|
||||||
type = Copy(type);
|
type = Copy(type);
|
||||||
Insert(type,0,"::");
|
Insert(type,0,"::");
|
||||||
Insert(type,0,qname);
|
Insert(type,0,qname);
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stdout,"qual %s \n", type);
|
||||||
|
#endif
|
||||||
newtype = 1;
|
newtype = 1;
|
||||||
}
|
}
|
||||||
resolved_scope = rtab;
|
resolved_scope = rtab;
|
||||||
|
|
@ -1079,12 +1099,12 @@ int SwigType_typedef_using(String_or_char *name) {
|
||||||
defined_name = Copy(defined_name);
|
defined_name = Copy(defined_name);
|
||||||
Append(defined_name,"::");
|
Append(defined_name,"::");
|
||||||
Append(defined_name,base);
|
Append(defined_name,base);
|
||||||
|
/* Printf(stdout,"defined_name = '%s'\n", defined_name);*/
|
||||||
|
tt = SwigType_find_scope(current_scope,defined_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (td) Delete(td);
|
if (td) Delete(td);
|
||||||
|
|
||||||
/* Printf(stdout,"defined_name = '%s'\n", defined_name);*/
|
|
||||||
tt = SwigType_find_scope(current_scope,defined_name);
|
|
||||||
|
|
||||||
/* Figure out the scope the using directive refers to */
|
/* Figure out the scope the using directive refers to */
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue